清理$calcAge

This commit is contained in:
aixianling
2022-10-14 11:53:24 +08:00
parent 54f1356756
commit e710fc4604
10 changed files with 574 additions and 592 deletions

View File

@@ -10,25 +10,25 @@
</template>
<template #right>
<el-input
v-model="search.name"
size="small"
placeholder="请输入姓名"
clearable
v-throttle="() => {search.current = 1, getList()}"
@clear="search.current = 1, search.name = '', getList()"
suffix-icon="iconfont iconSearch">
v-model="search.name"
size="small"
placeholder="请输入姓名"
clearable
v-throttle="() => {search.current = 1, getList()}"
@clear="search.current = 1, search.name = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
v-loading="loading"
style="margin-top: 16px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
v-loading="loading"
style="margin-top: 16px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="options" width="140px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
@@ -45,113 +45,109 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
import {mapState} from 'vuex'
import {ID} from "dvcp-ui/lib/js/utils";
props: {
instance: Function,
dict: Object
},
export default {
name: 'List',
data () {
return {
search: {
current: 1,
size: 10,
name: ''
},
colConfigs: [
{ prop: 'name', label: '姓名' },
{ prop: 'idNumber', align: 'center', label: '身份证号' },
{ prop: 'gender', align: 'center', label: '性别' },
{ prop: 'birthday', align: 'center', label: '出生日期' },
{ prop: 'age', align: 'center', label: '年龄', },
{ prop: 'phone', align: 'center', label: '联系方式' }
],
tableData: [],
total: 0,
loading: false
}
},
props: {
instance: Function,
dict: Object
},
computed: {
...mapState(['user']),
data() {
return {
search: {
current: 1,
size: 10,
name: ''
},
colConfigs: [
{prop: 'name', label: '姓名'},
{prop: 'idNumber', align: 'center', label: '身份证号'},
{prop: 'gender', align: 'center', label: '性别'},
{prop: 'birthday', align: 'center', label: '出生日期'},
{prop: 'age', align: 'center', label: '年龄',},
{prop: 'phone', align: 'center', label: '联系方式'}
],
tableData: [],
total: 0,
loading: false
}
},
param () {
return {
computed: {
...mapState(['user']),
},
created() {
this.dict.load('sex').then(() => {
this.getList()
})
},
methods: {
getList() {
this.instance.post(`/app/appspecialdisabled/list`, null, {
params: {
...this.search
}
}
},
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records.map(v => {
let info = new ID(v.idNumber)
v.birthday = info.birthday
v.age = info.age
v.gender = info.gender
created () {
this.dict.load('sex').then(() => {
this.getList()
return v
})
this.total = res.data.total
}
})
},
methods: {
getList () {
this.instance.post(`/app/appspecialdisabled/list`, null, {
params: {
...this.search
}
}).then(res => {
toEdit(e) {
this.$emit('change', {
type: 'Add',
params: {
type: 'Add',
id: e
}
})
},
toAdd() {
this.$emit('change', {
type: 'Add',
params: {
type: 'Add',
}
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appspecialadjustment/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.tableData = res.data.records.map(v => {
let info = this.idCardNoUtil.getIdCardInfo(v.idNumber)
v.birthday = info.birthday
v.age = this.$calcAge(v.idNumber)
v.gender = info.gender
return v
})
this.total = res.data.total
this.$message.success('删除成功!')
this.getList()
}
})
},
})
},
toEdit (e) {
this.$emit('change', {
type: 'Add',
params: {
type: 'Add',
id: e
}
})
},
toAdd() {
this.$emit('change', {
type: 'Add',
params: {
type: 'Add',
}
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appspecialadjustment/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toDetail (id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
}
toDetail(id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
}
}
}
</script>
<style scoped lang="scss">