This commit is contained in:
TimSpan 2024-12-03 16:56:34 +08:00
parent 93818ca9bf
commit 6a481c205f
3 changed files with 45 additions and 23 deletions

View File

@ -12,6 +12,7 @@
"@vueuse/core": "^11.2.0", "@vueuse/core": "^11.2.0",
"ant-design-vue": "^4.2.3", "ant-design-vue": "^4.2.3",
"axios": "^1.7.5", "axios": "^1.7.5",
"dayjs": "^1.11.13",
"jsencrypt": "^3.3.2", "jsencrypt": "^3.3.2",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"pinia": "^2.2.2", "pinia": "^2.2.2",
@ -1950,8 +1951,9 @@
}, },
"node_modules/dayjs": { "node_modules/dayjs": {
"version": "1.11.13", "version": "1.11.13",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz",
"integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==" "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==",
"license": "MIT"
}, },
"node_modules/de-indent": { "node_modules/de-indent": {
"version": "1.0.2", "version": "1.0.2",

View File

@ -14,6 +14,7 @@
"@vueuse/core": "^11.2.0", "@vueuse/core": "^11.2.0",
"ant-design-vue": "^4.2.3", "ant-design-vue": "^4.2.3",
"axios": "^1.7.5", "axios": "^1.7.5",
"dayjs": "^1.11.13",
"jsencrypt": "^3.3.2", "jsencrypt": "^3.3.2",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"pinia": "^2.2.2", "pinia": "^2.2.2",

View File

@ -1,3 +1,4 @@
import dayjs from 'dayjs'
import { TableProMaxProps, TableProMaxSlots } from '@/types/components/table' import { TableProMaxProps, TableProMaxSlots } from '@/types/components/table'
import { EnterprisesUnitPagerQueryParams, securityUnitIdListPagerVo, securityUnitIdListParams, PoliceUnitPagerVo } from '@/types/views/unitManage/police/policeUnit.ts' import { EnterprisesUnitPagerQueryParams, securityUnitIdListPagerVo, securityUnitIdListParams, PoliceUnitPagerVo } from '@/types/views/unitManage/police/policeUnit.ts'
import { reactive, ref, h } from 'vue' import { reactive, ref, h } from 'vue'
@ -34,10 +35,23 @@ const _formParams = reactive<securityUnitIdListParams>({
homeAddress: '', homeAddress: '',
remark: '', 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 () => { const searchSecurityUnitId = debounce(async () => {
if (process.env.NODE_ENV === 'development') { 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}`) const res = await axios.get(`https://www.hnjinglian.cn:5678/common/querySecurityNumberByIdCard?idCard=${_formParams.idCard}`)
if (res.data?.data?.hasOwnProperty('bayzh')) { if (res.data?.data?.hasOwnProperty('bayzh')) {
_formParams.securityNumber = res.data.data.bayzh _formParams.securityNumber = res.data.data.bayzh
@ -47,13 +61,15 @@ const searchSecurityUnitId = debounce(async () => {
} }
} else { } else {
const res = await api.get<any>('/common/querySecurityNumberByIdCard', { idCard: _formParams.idCard }) const res = await api.get<any>('/common/querySecurityNumberByIdCard', { idCard: _formParams.idCard })
if (res.data?.data?.hasOwnProperty('bayzh')) { console.log(res)
_formParams.securityNumber = res.data.data.bayzh if (res.data?.hasOwnProperty('bayzh')) {
message.success(res.data.message) _formParams.securityNumber = res.data.bayzh
message.success(res.message)
} else { } else {
message.error('未查询到保安证件号') message.error('未查询到保安证件号')
} }
} }
cardBlur()
}, 300) }, 300)
const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) => { const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) => {
// console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params) // console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params)
@ -165,9 +181,15 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) =
..._formParams, ..._formParams,
}) })
message.success(resp.message) message.success(resp.message)
clearForm()
callback && callback() callback && callback()
}, },
onCancel: async () => { onCancel: async () => {
clearForm()
},
})
}
const clearForm = () => {
_formParams.snowFlakeId = '' _formParams.snowFlakeId = ''
_formParams.serviceProjectId = '' _formParams.serviceProjectId = ''
_formParams.securityUnitId = '' _formParams.securityUnitId = ''
@ -183,10 +205,7 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) =
_formParams.noSecurityNumberDesc = '' _formParams.noSecurityNumberDesc = ''
_formParams.homeAddress = '' _formParams.homeAddress = ''
_formParams.remark = '' _formParams.remark = ''
},
})
} }
export const showEnterprisesUnit = (record_) => { export const showEnterprisesUnit = (record_) => {
// console.log('🚀 ~ showEnterprisesUnit ~ record_:', record_) // console.log('🚀 ~ showEnterprisesUnit ~ record_:', record_)
const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null) const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null)