清理$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

@@ -765,9 +765,10 @@
<script> <script>
import {mapState} from "vuex"; import {mapState} from "vuex";
import {ID} from "dvcp-ui/lib/js/utils";
export default { export default {
name: "Add", name: "Add",
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
@@ -938,10 +939,10 @@ export default {
this.isShowDisciplinaryForm = true; this.isShowDisciplinaryForm = true;
}, },
idChange(val) { idChange(val) {
let info = this.idCardNoUtil.getIdCardInfo(val) let info = new ID(val)
this.form.sex = info.sex || ""; this.form.sex = info.sex || "";
this.form.birthday = info.birthday || ""; this.form.birthday = info.birthday || "";
this.form.age = this.$calcAge(val) || ""; this.form.age = info.age
}, },
checkName(val) { checkName(val) {
for (let i in this.form) { for (let i in this.form) {

View File

@@ -434,6 +434,7 @@ import {mapState} from "vuex";
import AiEditCard from "./components/AiEditCard"; import AiEditCard from "./components/AiEditCard";
import PersonalAssets from "./components/personalAssets"; import PersonalAssets from "./components/personalAssets";
import TagsManage from "./components/tagsManage"; import TagsManage from "./components/tagsManage";
import {ID} from "dvcp-ui/lib/js/utils";
export default { export default {
name: "residentDetail", name: "residentDetail",
@@ -685,10 +686,10 @@ export default {
}, },
IdCard(UUserCard) { IdCard(UUserCard) {
if (UUserCard) { if (UUserCard) {
this.baseInfo.age = this.$calcAge(UUserCard) const idCard = new ID(UUserCard)
let {birthday, sex} = this.idCardNoUtil.getIdCardInfo(UUserCard) this.baseInfo.age = idCard.age
this.baseInfo.sex = sex this.baseInfo.sex = idCard.sex
this.baseInfo.birthday = birthday this.baseInfo.birthday = idCard.birthday
} }
} }
}, },

View File

@@ -328,6 +328,7 @@
<script> <script>
import {mapState} from "vuex"; import {mapState} from "vuex";
import {ID} from "dvcp-ui/lib/js/utils";
export default { export default {
name: "hrAdd", name: "hrAdd",
@@ -453,12 +454,12 @@ export default {
if (v.length == 20) { if (v.length == 20) {
idNumber = v.substring(0, 18) idNumber = v.substring(0, 18)
} }
let {birthday: birthDate, sex} = this.idCardNoUtil.getIdCardInfo(idNumber) let {birthday: birthDate, sex, age} = new ID(idNumber)
this.form = {...this.form, birthDate, sex, age: this.$calcAge(idNumber)} this.form = {...this.form, birthDate, sex, age}
}, },
submit() { submit() {
if(this.form.houseType == 1) { if (this.form.houseType == 1) {
if(!this.form.objectType) { if (!this.form.objectType) {
return this.$message.error('请选择监测对象类型') return this.$message.error('请选择监测对象类型')
} }
} }

View File

@@ -42,7 +42,7 @@
<el-form-item label="证件号">{{ detail.idNumber }}</el-form-item> <el-form-item label="证件号">{{ detail.idNumber }}</el-form-item>
<el-form-item label="性别" prop="sex">{{ dict.getLabel("sex", detail.sex) }}</el-form-item> <el-form-item label="性别" prop="sex">{{ dict.getLabel("sex", detail.sex) }}</el-form-item>
<el-form-item label="出生日期">{{ detail.birthDate }}</el-form-item> <el-form-item label="出生日期">{{ detail.birthDate }}</el-form-item>
<el-form-item label="家庭人口数">{{ detail.familyCount}}</el-form-item> <el-form-item label="家庭人口数">{{ detail.familyCount }}</el-form-item>
<!-- <el-form-item label="年龄" prop="age">{{ detail.age}}</el-form-item> --> <!-- <el-form-item label="年龄" prop="age">{{ detail.age}}</el-form-item> -->
<el-form-item label="民族">{{ dict.getLabel("fpNation", detail.nation) }}</el-form-item> <el-form-item label="民族">{{ dict.getLabel("fpNation", detail.nation) }}</el-form-item>
<el-form-item label="文化程度">{{ dict.getLabel("fpEducation", detail.education) }}</el-form-item> <el-form-item label="文化程度">{{ dict.getLabel("fpEducation", detail.education) }}</el-form-item>
@@ -497,6 +497,7 @@
import {mapState} from "vuex"; import {mapState} from "vuex";
import HrMeasure from "./detail/hrMeasure"; import HrMeasure from "./detail/hrMeasure";
import HrLog from "./detail/hrLog"; import HrLog from "./detail/hrLog";
import {ID} from "dvcp-ui/lib/js/utils";
export default { export default {
name: "hrDetail", name: "hrDetail",
@@ -677,8 +678,8 @@ export default {
}) })
}, },
handleIdNumberAutocomplete(v) { handleIdNumberAutocomplete(v) {
let {birthday: birthDate, sex} = this.idCardNoUtil.getIdCardInfo(v); let {birthday: birthDate, sex, age} = new ID(v);
this.form = {...this.form, birthDate, sex, age: this.$calcAge(v)}; this.form = {...this.form, birthDate, sex, age};
}, },
onConfirm() { onConfirm() {
this.$refs.ruleForm.validate((v) => { this.$refs.ruleForm.validate((v) => {

View File

@@ -294,7 +294,7 @@
<ai-card title="入学积极分子的确定和教育培养"> <ai-card title="入学积极分子的确定和教育培养">
<template #content> <template #content>
<el-form-item label="确定为入学积极分子时间" prop="phone" required > <el-form-item label="确定为入学积极分子时间" prop="phone" required>
<el-date-picker <el-date-picker
size="small" size="small"
v-model="form.joinPartyTime" v-model="form.joinPartyTime"
@@ -365,7 +365,7 @@
</ai-card> </ai-card>
<ai-card title="发展对象的确定和考察"> <ai-card title="发展对象的确定和考察">
<template #content> <template #content>
<el-form-item label="确定为发展对象时间" prop="phone" required > <el-form-item label="确定为发展对象时间" prop="phone" required>
<el-date-picker <el-date-picker
size="small" size="small"
v-model="form.joinPartyTime" v-model="form.joinPartyTime"
@@ -413,7 +413,7 @@
</ai-card> </ai-card>
<ai-card title="预备学员的接收"> <ai-card title="预备学员的接收">
<template #content> <template #content>
<el-form-item label="吸收入学时间" prop="phone" required > <el-form-item label="吸收入学时间" prop="phone" required>
<el-date-picker <el-date-picker
size="small" size="small"
v-model="form.joinPartyTime" v-model="form.joinPartyTime"
@@ -458,7 +458,7 @@
</ai-card> </ai-card>
<ai-card title="预备学员的教育考察和转正"> <ai-card title="预备学员的教育考察和转正">
<template #content> <template #content>
<el-form-item label="转正时间" prop="phone" required > <el-form-item label="转正时间" prop="phone" required>
<el-date-picker <el-date-picker
size="small" size="small"
v-model="form.joinPartyTime" v-model="form.joinPartyTime"
@@ -667,6 +667,8 @@
<script> <script>
import {mapState} from "vuex"; import {mapState} from "vuex";
import {ID} from "dvcp-ui/lib/js/utils";
export default { export default {
name: "Add", name: "Add",
@@ -845,10 +847,10 @@ export default {
this.isShowDisciplinaryForm = true; this.isShowDisciplinaryForm = true;
}, },
idChange(val) { idChange(val) {
let info = this.idCardNoUtil.getIdCardInfo(val) let info = new ID(val)
this.form.sex = info.sex || ""; this.form.sex = info.sex || "";
this.form.birthday = info.birthday || ""; this.form.birthday = info.birthday || "";
this.form.age = this.$calcAge(val) || ""; this.form.age = info.age || "";
}, },
checkName(val) { checkName(val) {
for (let i in this.form) { for (let i in this.form) {
@@ -997,12 +999,14 @@ export default {
.audit-1 { .audit-1 {
color: #2ea222 !important; color: #2ea222 !important;
} }
::v-deep .ai-form .el-form-item .el-form-item__content { ::v-deep .ai-form .el-form-item .el-form-item__content {
margin-left: 174px!important; margin-left: 174px !important;
} }
::v-deep .ai-form .el-form-item, ::v-deep .ai-form .el-form-item,
::v-deep .el-form-item { ::v-deep .el-form-item {
margin-bottom: 8px!important; margin-bottom: 8px !important;
} }
} }
</style> </style>

View File

@@ -45,8 +45,10 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default { import {ID} from "dvcp-ui/lib/js/utils";
export default {
name: 'List', name: 'List',
props: { props: {
@@ -54,7 +56,7 @@
dict: Object dict: Object
}, },
data () { data() {
return { return {
search: { search: {
current: 1, current: 1,
@@ -62,12 +64,12 @@
name: '' name: ''
}, },
colConfigs: [ colConfigs: [
{ prop: 'name', label: '姓名' }, {prop: 'name', label: '姓名'},
{ prop: 'idNumber', align: 'center', label: '身份证号' }, {prop: 'idNumber', align: 'center', label: '身份证号'},
{ prop: 'gender', align: 'center', label: '性别' }, {prop: 'gender', align: 'center', label: '性别'},
{ prop: 'birthday', align: 'center', label: '出生日期' }, {prop: 'birthday', align: 'center', label: '出生日期'},
{ prop: 'age', align: 'center', label: '年龄', }, {prop: 'age', align: 'center', label: '年龄',},
{ prop: 'phone', align: 'center', label: '联系方式' } {prop: 'phone', align: 'center', label: '联系方式'}
], ],
tableData: [], tableData: [],
total: 0, total: 0,
@@ -77,22 +79,16 @@
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
param () {
return {
}
}
}, },
created () { created() {
this.dict.load('sex').then(() => { this.dict.load('sex').then(() => {
this.getList() this.getList()
}) })
}, },
methods: { methods: {
getList () { getList() {
this.instance.post(`/app/appspecialadjustment/list`, null, { this.instance.post(`/app/appspecialadjustment/list`, null, {
params: { params: {
...this.search ...this.search
@@ -100,11 +96,10 @@
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.tableData = res.data.records.map(v => { this.tableData = res.data.records.map(v => {
let info = this.idCardNoUtil.getIdCardInfo(v.idNumber) let info = new ID(v.idNumber)
v.birthday = info.birthday v.birthday = info.birthday
v.age = this.$calcAge(v.idNumber) v.age = info.age
v.gender = info.gender v.gender = info.gender
return v return v
}) })
this.total = res.data.total this.total = res.data.total
@@ -112,7 +107,7 @@
}) })
}, },
toEdit (e) { toEdit(e) {
this.$emit('change', { this.$emit('change', {
type: 'Add', type: 'Add',
params: { params: {
@@ -142,7 +137,7 @@
}) })
}, },
toDetail (id) { toDetail(id) {
this.$emit('change', { this.$emit('change', {
type: 'Detail', type: 'Detail',
params: { params: {
@@ -151,7 +146,7 @@
}) })
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -45,8 +45,10 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default { import {ID} from "dvcp-ui/lib/js/utils";
export default {
name: 'List', name: 'List',
props: { props: {
@@ -54,7 +56,7 @@
dict: Object dict: Object
}, },
data () { data() {
return { return {
search: { search: {
current: 1, current: 1,
@@ -62,12 +64,12 @@
name: '' name: ''
}, },
colConfigs: [ colConfigs: [
{ prop: 'name', label: '姓名' }, {prop: 'name', label: '姓名'},
{ prop: 'idNumber', align: 'center', label: '身份证号' }, {prop: 'idNumber', align: 'center', label: '身份证号'},
{ prop: 'gender', align: 'center', label: '性别' }, {prop: 'gender', align: 'center', label: '性别'},
{ prop: 'birthday', align: 'center', label: '出生日期' }, {prop: 'birthday', align: 'center', label: '出生日期'},
{ prop: 'age', align: 'center', label: '年龄', }, {prop: 'age', align: 'center', label: '年龄',},
{ prop: 'phone', align: 'center', label: '联系方式' } {prop: 'phone', align: 'center', label: '联系方式'}
], ],
tableData: [], tableData: [],
total: 0, total: 0,
@@ -77,22 +79,16 @@
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
param () {
return {
}
}
}, },
created () { created() {
this.dict.load('sex').then(() => { this.dict.load('sex').then(() => {
this.getList() this.getList()
}) })
}, },
methods: { methods: {
getList () { getList() {
this.instance.post(`/app/appspecialdisabled/list`, null, { this.instance.post(`/app/appspecialdisabled/list`, null, {
params: { params: {
...this.search ...this.search
@@ -100,9 +96,9 @@
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.tableData = res.data.records.map(v => { this.tableData = res.data.records.map(v => {
let info = this.idCardNoUtil.getIdCardInfo(v.idNumber) let info = new ID(v.idNumber)
v.birthday = info.birthday v.birthday = info.birthday
v.age = this.$calcAge(v.idNumber) v.age = info.age
v.gender = info.gender v.gender = info.gender
return v return v
@@ -112,7 +108,7 @@
}) })
}, },
toEdit (e) { toEdit(e) {
this.$emit('change', { this.$emit('change', {
type: 'Add', type: 'Add',
params: { params: {
@@ -142,7 +138,7 @@
}) })
}, },
toDetail (id) { toDetail(id) {
this.$emit('change', { this.$emit('change', {
type: 'Detail', type: 'Detail',
params: { params: {
@@ -151,7 +147,7 @@
}) })
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -45,8 +45,10 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default { import {ID} from "dvcp-ui/lib/js/utils";
export default {
name: 'List', name: 'List',
props: { props: {
@@ -54,7 +56,7 @@
dict: Object dict: Object
}, },
data () { data() {
return { return {
search: { search: {
current: 1, current: 1,
@@ -62,12 +64,12 @@
name: '' name: ''
}, },
colConfigs: [ colConfigs: [
{ prop: 'name', label: '姓名' }, {prop: 'name', label: '姓名'},
{ prop: 'idNumber', align: 'center', label: '身份证号' }, {prop: 'idNumber', align: 'center', label: '身份证号'},
{ prop: 'gender', align: 'center', label: '性别' }, {prop: 'gender', align: 'center', label: '性别'},
{ prop: 'birthday', align: 'center', label: '出生日期' }, {prop: 'birthday', align: 'center', label: '出生日期'},
{ prop: 'age', align: 'center', label: '年龄', }, {prop: 'age', align: 'center', label: '年龄',},
{ prop: 'phone', align: 'center', label: '联系方式' } {prop: 'phone', align: 'center', label: '联系方式'}
], ],
tableData: [], tableData: [],
total: 0, total: 0,
@@ -77,22 +79,16 @@
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
param () {
return {
}
}
}, },
created () { created() {
this.dict.load('sex').then(() => { this.dict.load('sex').then(() => {
this.getList() this.getList()
}) })
}, },
methods: { methods: {
getList () { getList() {
this.instance.post(`/app/appspecialdrug/list`, null, { this.instance.post(`/app/appspecialdrug/list`, null, {
params: { params: {
...this.search ...this.search
@@ -100,11 +96,10 @@
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.tableData = res.data.records.map(v => { this.tableData = res.data.records.map(v => {
let info = this.idCardNoUtil.getIdCardInfo(v.idNumber) let info = new ID(v.idNumber)
v.birthday = info.birthday v.birthday = info.birthday
v.age = this.$calcAge(v.idNumber) v.age = info.age
v.gender = info.gender v.gender = info.gender
return v return v
}) })
this.total = res.data.total this.total = res.data.total
@@ -112,7 +107,7 @@
}) })
}, },
toEdit (e) { toEdit(e) {
this.$emit('change', { this.$emit('change', {
type: 'Add', type: 'Add',
params: { params: {
@@ -142,7 +137,7 @@
}) })
}, },
toDetail (id) { toDetail(id) {
this.$emit('change', { this.$emit('change', {
type: 'Detail', type: 'Detail',
params: { params: {
@@ -151,7 +146,7 @@
}) })
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -45,8 +45,10 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default { import {ID} from "dvcp-ui/lib/js/utils"
export default {
name: 'List', name: 'List',
props: { props: {
@@ -54,7 +56,7 @@
dict: Object dict: Object
}, },
data () { data() {
return { return {
search: { search: {
current: 1, current: 1,
@@ -62,12 +64,12 @@
name: '' name: ''
}, },
colConfigs: [ colConfigs: [
{ prop: 'name', label: '姓名' }, {prop: 'name', label: '姓名'},
{ prop: 'idNumber', align: 'center', label: '身份证号' }, {prop: 'idNumber', align: 'center', label: '身份证号'},
{ prop: 'gender', align: 'center', label: '性别' }, {prop: 'gender', align: 'center', label: '性别'},
{ prop: 'birthday', align: 'center', label: '出生日期' }, {prop: 'birthday', align: 'center', label: '出生日期'},
{ prop: 'age', align: 'center', label: '年龄', }, {prop: 'age', align: 'center', label: '年龄',},
{ prop: 'phone', align: 'center', label: '联系方式' } {prop: 'phone', align: 'center', label: '联系方式'}
], ],
tableData: [], tableData: [],
total: 0, total: 0,
@@ -77,22 +79,16 @@
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
param () {
return {
}
}
}, },
created () { created() {
this.dict.load('sex').then(() => { this.dict.load('sex').then(() => {
this.getList() this.getList()
}) })
}, },
methods: { methods: {
getList () { getList() {
this.instance.post(`/app/appspecialmental/list`, null, { this.instance.post(`/app/appspecialmental/list`, null, {
params: { params: {
...this.search ...this.search
@@ -100,11 +96,10 @@
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.tableData = res.data.records.map(v => { this.tableData = res.data.records.map(v => {
let info = this.idCardNoUtil.getIdCardInfo(v.idNumber) let info = new ID(v.idNumber)
v.birthday = info.birthday v.birthday = info.birthday
v.age = this.$calcAge(v.idNumber) v.age = info.age
v.gender = info.gender v.gender = info.gender
return v return v
}) })
this.total = res.data.total this.total = res.data.total
@@ -112,7 +107,7 @@
}) })
}, },
toEdit (e) { toEdit(e) {
this.$emit('change', { this.$emit('change', {
type: 'Add', type: 'Add',
params: { params: {
@@ -142,7 +137,7 @@
}) })
}, },
toDetail (id) { toDetail(id) {
this.$emit('change', { this.$emit('change', {
type: 'Detail', type: 'Detail',
params: { params: {
@@ -151,7 +146,7 @@
}) })
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -45,8 +45,10 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default { import {ID} from "dvcp-ui/lib/js/utils";
export default {
name: 'List', name: 'List',
props: { props: {
@@ -54,7 +56,7 @@
dict: Object dict: Object
}, },
data () { data() {
return { return {
search: { search: {
current: 1, current: 1,
@@ -62,37 +64,29 @@
name: '' name: ''
}, },
colConfigs: [ colConfigs: [
{ prop: 'name', label: '姓名' }, {prop: 'name', label: '姓名'},
{ prop: 'idNumber', align: 'center', label: '身份证号' }, {prop: 'idNumber', align: 'center', label: '身份证号'},
{ prop: 'gender', align: 'center', label: '性别' }, {prop: 'gender', align: 'center', label: '性别'},
{ prop: 'birthday', align: 'center', label: '出生日期' }, {prop: 'birthday', align: 'center', label: '出生日期'},
{ prop: 'age', align: 'center', label: '年龄', }, {prop: 'age', align: 'center', label: '年龄',},
{ prop: 'phone', align: 'center', label: '联系方式' } {prop: 'phone', align: 'center', label: '联系方式'}
], ],
tableData: [], tableData: [],
total: 0, total: 0,
loading: false loading: false
} }
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
param () {
return {
}
}
}, },
created() {
created () {
this.dict.load('sex').then(() => { this.dict.load('sex').then(() => {
this.getList() this.getList()
}) })
}, },
methods: { methods: {
getList () { getList() {
this.instance.post(`/app/appspecialprison/list`, null, { this.instance.post(`/app/appspecialprison/list`, null, {
params: { params: {
...this.search ...this.search
@@ -100,11 +94,10 @@
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.tableData = res.data.records.map(v => { this.tableData = res.data.records.map(v => {
let info = this.idCardNoUtil.getIdCardInfo(v.idNumber) let info = new ID(v.idNumber)
v.birthday = info.birthday v.birthday = info.birthday
v.age = this.$calcAge(v.idNumber) v.age = info.age
v.gender = info.gender v.gender = info.gender
return v return v
}) })
this.total = res.data.total this.total = res.data.total
@@ -112,7 +105,7 @@
}) })
}, },
toEdit (e) { toEdit(e) {
this.$emit('change', { this.$emit('change', {
type: 'Add', type: 'Add',
params: { params: {
@@ -142,7 +135,7 @@
}) })
}, },
toDetail (id) { toDetail(id) {
this.$emit('change', { this.$emit('change', {
type: 'Detail', type: 'Detail',
params: { params: {
@@ -151,7 +144,7 @@
}) })
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">