搜索保安证件号

This commit is contained in:
TimSpan 2024-11-29 15:37:53 +08:00
parent c88984537e
commit 87c9c7b053
2 changed files with 43 additions and 14 deletions

View File

@ -1,17 +1,19 @@
import { TableProMaxProps, TableProMaxSlots } from '@/types/components/table'
import { EnterprisesUnitPagerQueryParams, securityUnitIdListPagerVo, securityUnitIdListParams, PoliceUnitPagerVo } from '@/types/views/unitManage/police/policeUnit.ts'
import { reactive, ref } from 'vue'
import { reactive, ref, h } from 'vue'
import { FormExpose } from 'ant-design-vue/es/form/Form'
import { ComponentExposed } from 'vue-component-type-helpers'
import { FormProMaxItemOptions } from '@/types/components/form'
import { dictSelectNodes } from '@/config/dict.ts'
import { Button, message, Modal, Space, Tag } from 'ant-design-vue'
import { Button, message, Modal, Space, Tag, Input } from 'ant-design-vue'
import api from '@/axios'
import TableProMax from '@/components/table/TableProMax.vue'
import { deleteDataModal } from '@/components/tsx/ModalPro.tsx'
import { PageParams } from '@/types/hooks/useTableProMax.ts'
import FormProMax from '@/components/form/FormProMax.vue'
import { debounce } from 'lodash-es'
import { SearchOutlined } from '@ant-design/icons-vue'
import axios from 'axios'
type _TableProps = TableProMaxProps<securityUnitIdListPagerVo, EnterprisesUnitPagerQueryParams>
const _formParams = reactive<securityUnitIdListParams>({
@ -31,8 +33,29 @@ const _formParams = reactive<securityUnitIdListParams>({
homeAddress: '',
remark: '',
})
const searchSecurityUnitId = debounce(async () => {
if (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
message.success(res.data.message)
} else {
message.error('未查询到保安证件号')
}
} else {
const res = await api.get<any>('/common/querySecurityNumberByIdCard', { idCard: _formParams.idCard })
if (res.data?.data?.hasOwnProperty('bayzh')) {
_formParams.securityNumber = res.data.data.bayzh
message.success(res.data.message)
} else {
message.error('未查询到保安证件号')
}
}
}, 300)
const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) => {
console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params)
// console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params)
if (type === 'add') {
_formParams.serviceProjectId = params.snowFlakeId
_formParams.securityUnitId = params.securityUnitId
@ -56,17 +79,26 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) =
const _formRef = ref<FormExpose>(null)
const _formOptions = ref<FormProMaxItemOptions<any>>({
const _formOptions = ref<FormProMaxItemOptions<securityUnitIdListParams>>({
name: {
type: 'input',
label: '姓名',
required: true,
},
idCard: {
type: 'input',
type: 'custom',
label: '身份证',
required: true,
customRender: () => (
<Space>
<Input allow-clear v-model:value={_formParams.idCard} placeholder={'请输入身份证号'} />
<Button type={'primary'} icon={h(SearchOutlined)} onClick={() => searchSecurityUnitId()}>
</Button>
</Space>
),
},
telephone: {
type: 'input',
label: '手机号',
@ -122,7 +154,6 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) =
content: () => <FormProMax ref={_formRef} v-model:value={_formParams} formItemOptions={_formOptions.value} />,
onOk: async () => {
await _formRef.value?.validate()
const resp = await api.post('/m2/eu/add_upd_sec_user', {
..._formParams,
})
@ -130,8 +161,6 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) =
callback && callback()
},
onCancel: async () => {
console.log('onCancel')
_formParams.snowFlakeId = ''
_formParams.serviceProjectId = ''
_formParams.securityUnitId = ''
@ -150,9 +179,9 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) =
},
})
}
// record_
export const showEnterprisesUnit = (record_) => {
console.log('🚀 ~ showEnterprisesUnit ~ record_:', record_)
// console.log('🚀 ~ showEnterprisesUnit ~ record_:', record_)
const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null)
const _columns: _TableProps['columns'] = [
{
@ -245,7 +274,7 @@ export const showEnterprisesUnit = (record_) => {
onClick={() =>
deleteDataModal(record.name, async () => {
const resp = await api.delete('/m2/eu/del_security_user_id', {
enterprisesUnitId: record.snowFlakeId,
securityUserId: record?.securityUnitId,
})
message.success(resp.message)
await _tableRef.value?.requestGetTableData()

View File

@ -635,8 +635,8 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
return (
<div style={{ width: '100%' }}>
<TableProMax
style={{ width: '1500px' }}
scroll={{ x: '1500px' }}
style={{ width: '1600px' }}
scroll={{ x: '1600px' }}
ref={_tableRef}
size='small'
columns={_columns}