diff --git a/policeManagement/package-lock.json b/policeManagement/package-lock.json index 63a6f29..0bc69dd 100644 --- a/policeManagement/package-lock.json +++ b/policeManagement/package-lock.json @@ -12,6 +12,7 @@ "@vueuse/core": "^11.2.0", "ant-design-vue": "^4.2.3", "axios": "^1.7.5", + "dayjs": "^1.11.13", "jsencrypt": "^3.3.2", "lodash-es": "^4.17.21", "pinia": "^2.2.2", @@ -1950,8 +1951,9 @@ }, "node_modules/dayjs": { "version": "1.11.13", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", - "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==" + "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", + "license": "MIT" }, "node_modules/de-indent": { "version": "1.0.2", diff --git a/policeManagement/package.json b/policeManagement/package.json index d57c43b..0f9aafb 100644 --- a/policeManagement/package.json +++ b/policeManagement/package.json @@ -14,6 +14,7 @@ "@vueuse/core": "^11.2.0", "ant-design-vue": "^4.2.3", "axios": "^1.7.5", + "dayjs": "^1.11.13", "jsencrypt": "^3.3.2", "lodash-es": "^4.17.21", "pinia": "^2.2.2", diff --git a/policeManagement/src/views/query/index.tsx b/policeManagement/src/views/query/index.tsx index 9bb02d4..846b4ec 100644 --- a/policeManagement/src/views/query/index.tsx +++ b/policeManagement/src/views/query/index.tsx @@ -1,3 +1,4 @@ +import dayjs from 'dayjs' import { TableProMaxProps, TableProMaxSlots } from '@/types/components/table' import { EnterprisesUnitPagerQueryParams, securityUnitIdListPagerVo, securityUnitIdListParams, PoliceUnitPagerVo } from '@/types/views/unitManage/police/policeUnit.ts' import { reactive, ref, h } from 'vue' @@ -34,10 +35,23 @@ const _formParams = reactive({ homeAddress: '', remark: '', }) - +const cardBlur = () => { + let value = _formParams.idCard + if (!value?.length || value.length < 18) { + _formParams.dateOfBirth = '' + return + } + const birthDate = value.substring(6, 14) + const year = birthDate.substring(0, 4) + const month = birthDate.substring(4, 6) + const day = birthDate.substring(6, 8) + var _data = new Date(parseInt(year), parseInt(month) - 1, parseInt(day)) + _formParams.dateOfBirth = dayjs(_data).format('YYYY-MM-DD HH:mm:ss') + console.log('🚀 ~ cardBlur ~ _data:', _formParams.dateOfBirth) +} const searchSecurityUnitId = debounce(async () => { if (process.env.NODE_ENV === 'development') { - // console.log('process.env.NODE_ENV === development') + console.log('process.env.NODE_ENV === development') const res = await axios.get(`https://www.hnjinglian.cn:5678/common/querySecurityNumberByIdCard?idCard=${_formParams.idCard}`) if (res.data?.data?.hasOwnProperty('bayzh')) { _formParams.securityNumber = res.data.data.bayzh @@ -47,13 +61,15 @@ const searchSecurityUnitId = debounce(async () => { } } else { const res = await api.get('/common/querySecurityNumberByIdCard', { idCard: _formParams.idCard }) - if (res.data?.data?.hasOwnProperty('bayzh')) { - _formParams.securityNumber = res.data.data.bayzh - message.success(res.data.message) + console.log(res) + if (res.data?.hasOwnProperty('bayzh')) { + _formParams.securityNumber = res.data.bayzh + message.success(res.message) } else { message.error('未查询到保安证件号') } } + cardBlur() }, 300) const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) => { // console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params) @@ -165,28 +181,31 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) = ..._formParams, }) message.success(resp.message) + clearForm() callback && callback() }, onCancel: async () => { - _formParams.snowFlakeId = '' - _formParams.serviceProjectId = '' - _formParams.securityUnitId = '' - _formParams.name = '' - _formParams.photo = '' - _formParams.telephone = '' - _formParams.workPost = '' - _formParams.sex = '' - _formParams.nativePlace = '' - _formParams.idCard = '' - _formParams.dateOfBirth = '' - _formParams.securityNumber = '' - _formParams.noSecurityNumberDesc = '' - _formParams.homeAddress = '' - _formParams.remark = '' + clearForm() }, }) } - +const clearForm = () => { + _formParams.snowFlakeId = '' + _formParams.serviceProjectId = '' + _formParams.securityUnitId = '' + _formParams.name = '' + _formParams.photo = '' + _formParams.telephone = '' + _formParams.workPost = '' + _formParams.sex = '' + _formParams.nativePlace = '' + _formParams.idCard = '' + _formParams.dateOfBirth = '' + _formParams.securityNumber = '' + _formParams.noSecurityNumberDesc = '' + _formParams.homeAddress = '' + _formParams.remark = '' +} export const showEnterprisesUnit = (record_) => { // console.log('🚀 ~ showEnterprisesUnit ~ record_:', record_) const _tableRef = ref>(null)