搜索保安证件号
This commit is contained in:
parent
c88984537e
commit
87c9c7b053
|
@ -1,17 +1,19 @@
|
||||||
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 } from 'vue'
|
import { reactive, ref, h } from 'vue'
|
||||||
import { FormExpose } from 'ant-design-vue/es/form/Form'
|
import { FormExpose } from 'ant-design-vue/es/form/Form'
|
||||||
import { ComponentExposed } from 'vue-component-type-helpers'
|
import { ComponentExposed } from 'vue-component-type-helpers'
|
||||||
import { FormProMaxItemOptions } from '@/types/components/form'
|
import { FormProMaxItemOptions } from '@/types/components/form'
|
||||||
import { dictSelectNodes } from '@/config/dict.ts'
|
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 api from '@/axios'
|
||||||
import TableProMax from '@/components/table/TableProMax.vue'
|
import TableProMax from '@/components/table/TableProMax.vue'
|
||||||
import { deleteDataModal } from '@/components/tsx/ModalPro.tsx'
|
import { deleteDataModal } from '@/components/tsx/ModalPro.tsx'
|
||||||
import { PageParams } from '@/types/hooks/useTableProMax.ts'
|
import { PageParams } from '@/types/hooks/useTableProMax.ts'
|
||||||
import FormProMax from '@/components/form/FormProMax.vue'
|
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>
|
type _TableProps = TableProMaxProps<securityUnitIdListPagerVo, EnterprisesUnitPagerQueryParams>
|
||||||
|
|
||||||
const _formParams = reactive<securityUnitIdListParams>({
|
const _formParams = reactive<securityUnitIdListParams>({
|
||||||
|
@ -31,8 +33,29 @@ const _formParams = reactive<securityUnitIdListParams>({
|
||||||
homeAddress: '',
|
homeAddress: '',
|
||||||
remark: '',
|
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) => {
|
const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) => {
|
||||||
console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params)
|
// console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params)
|
||||||
if (type === 'add') {
|
if (type === 'add') {
|
||||||
_formParams.serviceProjectId = params.snowFlakeId
|
_formParams.serviceProjectId = params.snowFlakeId
|
||||||
_formParams.securityUnitId = params.securityUnitId
|
_formParams.securityUnitId = params.securityUnitId
|
||||||
|
@ -56,17 +79,26 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) =
|
||||||
|
|
||||||
const _formRef = ref<FormExpose>(null)
|
const _formRef = ref<FormExpose>(null)
|
||||||
|
|
||||||
const _formOptions = ref<FormProMaxItemOptions<any>>({
|
const _formOptions = ref<FormProMaxItemOptions<securityUnitIdListParams>>({
|
||||||
name: {
|
name: {
|
||||||
type: 'input',
|
type: 'input',
|
||||||
label: '姓名',
|
label: '姓名',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
idCard: {
|
idCard: {
|
||||||
type: 'input',
|
type: 'custom',
|
||||||
label: '身份证',
|
label: '身份证',
|
||||||
required: true,
|
required: true,
|
||||||
|
customRender: () => (
|
||||||
|
<Space>
|
||||||
|
<Input allow-clear v-model:value={_formParams.idCard} placeholder={'请输入身份证号'} />
|
||||||
|
<Button type={'primary'} icon={h(SearchOutlined)} onClick={() => searchSecurityUnitId()}>
|
||||||
|
搜索保安证号
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
telephone: {
|
telephone: {
|
||||||
type: 'input',
|
type: 'input',
|
||||||
label: '手机号',
|
label: '手机号',
|
||||||
|
@ -122,7 +154,6 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) =
|
||||||
content: () => <FormProMax ref={_formRef} v-model:value={_formParams} formItemOptions={_formOptions.value} />,
|
content: () => <FormProMax ref={_formRef} v-model:value={_formParams} formItemOptions={_formOptions.value} />,
|
||||||
onOk: async () => {
|
onOk: async () => {
|
||||||
await _formRef.value?.validate()
|
await _formRef.value?.validate()
|
||||||
|
|
||||||
const resp = await api.post('/m2/eu/add_upd_sec_user', {
|
const resp = await api.post('/m2/eu/add_upd_sec_user', {
|
||||||
..._formParams,
|
..._formParams,
|
||||||
})
|
})
|
||||||
|
@ -130,8 +161,6 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) =
|
||||||
callback && callback()
|
callback && callback()
|
||||||
},
|
},
|
||||||
onCancel: async () => {
|
onCancel: async () => {
|
||||||
console.log('onCancel')
|
|
||||||
|
|
||||||
_formParams.snowFlakeId = ''
|
_formParams.snowFlakeId = ''
|
||||||
_formParams.serviceProjectId = ''
|
_formParams.serviceProjectId = ''
|
||||||
_formParams.securityUnitId = ''
|
_formParams.securityUnitId = ''
|
||||||
|
@ -150,9 +179,9 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) =
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// record_
|
|
||||||
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)
|
||||||
const _columns: _TableProps['columns'] = [
|
const _columns: _TableProps['columns'] = [
|
||||||
{
|
{
|
||||||
|
@ -245,7 +274,7 @@ export const showEnterprisesUnit = (record_) => {
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
deleteDataModal(record.name, async () => {
|
deleteDataModal(record.name, async () => {
|
||||||
const resp = await api.delete('/m2/eu/del_security_user_id', {
|
const resp = await api.delete('/m2/eu/del_security_user_id', {
|
||||||
enterprisesUnitId: record.snowFlakeId,
|
securityUserId: record?.securityUnitId,
|
||||||
})
|
})
|
||||||
message.success(resp.message)
|
message.success(resp.message)
|
||||||
await _tableRef.value?.requestGetTableData()
|
await _tableRef.value?.requestGetTableData()
|
||||||
|
|
|
@ -635,8 +635,8 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
|
||||||
return (
|
return (
|
||||||
<div style={{ width: '100%' }}>
|
<div style={{ width: '100%' }}>
|
||||||
<TableProMax
|
<TableProMax
|
||||||
style={{ width: '1500px' }}
|
style={{ width: '1600px' }}
|
||||||
scroll={{ x: '1500px' }}
|
scroll={{ x: '1600px' }}
|
||||||
ref={_tableRef}
|
ref={_tableRef}
|
||||||
size='small'
|
size='small'
|
||||||
columns={_columns}
|
columns={_columns}
|
||||||
|
|
Loading…
Reference in New Issue