初步完成人员 人员录入的增删改

This commit is contained in:
TimSpan 2024-11-29 14:10:18 +08:00
parent d29d649933
commit 918b6b5468
6 changed files with 416 additions and 170 deletions

View File

@ -1,7 +1,7 @@
# 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config
TARO_APP_ID="wx0acd1c4fcf94bdd3"
# TARO_APP_BASE_API="http://172.10.10.93:8765"
TARO_APP_BASE_API="https://www.hnjinglian.cn:5678"
TARO_APP_BASE_API="http://172.10.10.93:8765"
# TARO_APP_BASE_API="https://www.hnjinglian.cn:5678"

View File

@ -14,6 +14,8 @@ export interface PoliceUnitPagerQueryParams {
}
export interface PoliceUnitPagerVo extends BaseTableRowRecord {
sex: { label: string }
/** 名称 **/
name?: string;
/** 代码 **/
@ -53,6 +55,7 @@ export interface EnterprisesUnitPagerQueryParams {
}
export interface EnterprisesUnitPagerVo extends BaseTableRowRecord {
sex: { label: string }
/** 名字 **/
name?: string;
type: BaseEnum<string>
@ -86,9 +89,12 @@ export interface EnterprisesUnitPagerVo extends BaseTableRowRecord {
remark?: string;
}
export interface EnterprisesUnitSaveOrUpdateParams {
/** id **/
snowFlakeId?: string;
/** 公安单位id **/
policeUnitId: string;
/** 名称 **/
@ -108,3 +114,47 @@ export interface EnterprisesUnitSaveOrUpdateParams {
/** 备注 **/
remark?: string;
}
export interface securityUnitIdListParams {
snowFlakeId?: string;
serviceProjectId?: string;
securityUnitId?: string;
name?: string;
remark?: string;
photo?: string;
telephone?: string;
workPost?: string;
sex?: string;
nativePlace?: string;
idCard?: string;
dateOfBirth?: string;
securityNumber?: string;
noSecurityNumberDesc?: string;
homeAddress?: string;
}
export interface securityUnitIdListPagerVo {
snowFlakeId?: string;
serviceProjectId?: string;
securityUnitId?: string;
name?: string;
remark?: string;
photo?: string;
telephone?: {
desensitizedValue?: string;
originalValue?: string;
};
workPost?: string;
sex?: {
label?: string;
value: number | string
};
nativePlace?: string;
idCard?: {
desensitizedValue?: string;
originalValue?: string;
};
dateOfBirth?: string;
securityNumber?: string;
noSecurityNumberDesc?: string;
homeAddress?: string;
}

View File

@ -1,148 +0,0 @@
<template>
<div>
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns">
</TableProMax>
<div>
<a-modal v-model:open="open" title="扣分项" @ok="open = false" width="80%">
<a-table :columns="TableColumns" :data-source="dataSource" :pagination="false" bordered>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'itemName'">
<ul>
<li v-for="(item, index) in record.itemName" :key="index">
{{ item.itemName }}
</li>
</ul>
</template>
<template v-if="column.key === 'deductionStandards'">
<ul>
<li v-for="(item, index) in record.itemName" :key="index">
<ul>
<li v-for="(standard, standardIndex) in item.standards" :key="standardIndex">
{{ standard.standardName }}
</li>
</ul>
</li>
</ul>
</template>
</template>
</a-table>
</a-modal>>
</div>
</div>
</template>
<script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue";
import api from "@/axios";
import {TableProMaxProps} from "@/types/components/table";
import {
AssessmentRecordPagerQueryParams,
AssessmentRecordPagerVo,
} from "@/types/views/assessmentRecord.ts";
import {ComponentExposed} from "vue-component-type-helpers";
import {computed, ref} from "vue";
import {Modal} from "ant-design-vue";
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
type TableProps = TableProMaxProps<AssessmentRecordPagerVo,AssessmentRecordPagerQueryParams>
const open = ref<boolean>(false);
const reqApi: TableProps['requestApi'] = (params) => api.post('/assessmentRecord/pager', params) //
const columns: TableProps['columns'] = [
{
dataIndex: 'enterprisesUnitName',
title: '单位名称'
}, {
dataIndex: 'type',
title: '类型',
customRender: ({text}) => text?.label
}, {
dataIndex: 'ckProjectName',
title: '考核项目'
}, {
dataIndex: 'totalScore',
title: '总分'
}, {
dataIndex: 'deductionPointsTotal',
title: '扣分',
customRender:({record})=>{
if (!record.deductionPointsTotal) {
return <a-tag color="green">0</a-tag>
}
return <a-tag class="pointer" color="red" onClick={()=>deductionPointsTotalTable(record)}>{record.deductionPointsTotal}</a-tag>
}
}, {
dataIndex: 'result',
title: '得分',
customRender: ({record}) => record.totalScore - record.deductionPointsTotal
}, {
dataIndex: 'policeUnitName',
title: '考核单位'
}, {
dataIndex: 'createUserName',
title: '考核人'
}, {
dataIndex: 'createTime',
title: '考核时间'
}, {
dataIndex: 'remark',
title: '考核备注'
}, {
dataIndex: 'signature',
title: '签字',
customRender:({record})=>{
return <a-button onClick={()=>{
Modal.info({
title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`,
content: () => <>
<div>审核人签字: <a-image src={record.assessmentUserSignature}/>
</div>
<div>被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature}/></div>
</>
})
}}>查看</a-button>
},
}
]
const groupRow = ref({})
const TableColumns = [
{ title: '考核分组', dataIndex: 'groupName', key: 'groupName' },
{ title: '考核项', dataIndex: 'itemName', key: 'itemName', slots: { customRender: 'bodyCell' } },
{ title: '扣分标准', dataIndex: 'deductionStandards', key: 'deductionStandards', slots: { customRender: 'bodyCell' } }
];
const dataSource = computed(() => {
return Object.keys(groupRow.value).map(groupName => ({
key: groupName,
groupName: groupName,
itemName: Object.values(groupRow.value[groupName])
}));
});
const deductionPointsTotalTable =async(record:AssessmentRecordPagerVo)=>{
const resp = await api.get('/assessmentRecord/deductedDetail',{assessmentRecordId:record.snowFlakeId})
resp.data.forEach((item,index)=>{
if (!groupRow.value[item.groupName]) {
groupRow.value[item.groupName] = {};
}
if (!groupRow.value[item.groupName][item.ckItemId]) {
groupRow.value[item.groupName][item.ckItemId] = {
itemName: item.itemName,
standards: []
};
}
groupRow.value[item.groupName][item.ckItemId].standards.push(item);
})
open.value = true
}
</script>
<style scoped lang="scss">
</style>

View File

@ -0,0 +1,311 @@
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 { 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 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'
type _TableProps = TableProMaxProps<securityUnitIdListPagerVo, EnterprisesUnitPagerQueryParams>
const _formParams = reactive<securityUnitIdListParams>({
snowFlakeId: '', //
serviceProjectId: '', // 服务项目id
securityUnitId: '', // 保安单位id
name: '', //
photo: '',
telephone: '',
workPost: '',
sex: '',
nativePlace: '',
idCard: '',
dateOfBirth: '',
securityNumber: '',
noSecurityNumberDesc: '',
homeAddress: '',
remark: '',
})
const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) => {
console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params)
if (type === 'add') {
_formParams.serviceProjectId = params.snowFlakeId
_formParams.securityUnitId = params.securityUnitId
} else {
_formParams.snowFlakeId = params.snowFlakeId
_formParams.serviceProjectId = params.serviceProjectId
_formParams.securityUnitId = params.securityUnitId
_formParams.name = params.name
_formParams.photo = params?.photo
_formParams.telephone = params.telephone.originalValue
_formParams.workPost = params.workPost
_formParams.sex = params.sex.value
_formParams.nativePlace = params.nativePlace
_formParams.idCard = params.idCard.originalValue
_formParams.dateOfBirth = params.dateOfBirth
_formParams.securityNumber = params.securityNumber
_formParams.noSecurityNumberDesc = params?.noSecurityNumberDesc
_formParams.homeAddress = params.homeAddress
_formParams.remark = params.remark
}
const _formRef = ref<FormExpose>(null)
const _formOptions = ref<FormProMaxItemOptions<any>>({
name: {
type: 'input',
label: '姓名',
required: true,
},
idCard: {
type: 'input',
label: '身份证',
required: true,
},
telephone: {
type: 'input',
label: '手机号',
required: true,
},
sex: {
type: 'radioGroup',
label: '性别',
required: true,
options: [...dictSelectNodes('Sex')],
},
securityNumber: {
type: 'input',
label: '保安证号',
required: true,
},
dateOfBirth: {
type: 'datePicker',
label: '出生日期',
componentsProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
required: true,
},
workPost: {
type: 'input',
label: '工作岗位',
},
nativePlace: {
type: 'input',
label: '籍贯',
},
homeAddress: {
type: 'input',
label: '家庭住址',
},
noSecurityNumberDesc: {
type: 'input',
label: '无证说明',
},
remark: {
type: 'inputTextArea',
label: '备注',
},
})
Modal.confirm({
title: params.name ? `${params.name}】 编辑保安信息` : '新增保安人员',
width: 600,
icon: ' ',
centered: true,
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,
})
message.success(resp.message)
callback && callback()
},
onCancel: async () => {
console.log('onCancel')
_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 = ''
},
})
}
// record_
export const showEnterprisesUnit = (record_) => {
console.log('🚀 ~ showEnterprisesUnit ~ record_:', record_)
const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null)
const _columns: _TableProps['columns'] = [
{
dataIndex: 'name',
title: '姓名',
width: 100,
ellipsis: true,
},
{
dataIndex: 'idCard',
title: '身份证',
customRender: ({ text }) => {
return text.desensitizedValue
},
width: 160,
ellipsis: true,
},
{
dataIndex: 'sex',
title: '性别',
width: 60,
customRender: ({ record }) => {
return <Tag color={'success'}>{record.sex.label}</Tag>
},
},
{
dataIndex: 'dateOfBirth',
title: '出生日期',
width: 100,
ellipsis: true,
},
{
dataIndex: 'telephone',
title: '手机号',
width: 120,
ellipsis: true,
customRender: ({ text }) => text?.originalValue,
},
{
dataIndex: 'securityNumber',
title: '保安证号',
width: 120,
ellipsis: true,
},
{
dataIndex: 'nativePlace',
title: '籍贯',
width: 120,
ellipsis: true,
},
{
dataIndex: 'workPost',
title: '工作岗位',
width: 120,
ellipsis: true,
},
{
dataIndex: 'homeAddress',
title: '家庭住址',
width: 120,
ellipsis: true,
},
{
dataIndex: 'remark',
title: '备注',
width: 120,
},
{
dataIndex: 'createTime',
title: '创建时间',
width: 120,
ellipsis: true,
},
{
dataIndex: 'opt',
title: '操作',
width: 200,
fixed: 'right',
customRender: ({ record }) => (
<Space>
<Button class='btn-warn' onClick={() => saveOrUpdateEnterprisesUnit(_tableRef.value?.requestGetTableData, record, 'edit')}>
</Button>
<Button
class='btn-danger'
onClick={() =>
deleteDataModal(record.name, async () => {
const resp = await api.delete('/m2/eu/del_security_user_id', {
enterprisesUnitId: record.snowFlakeId,
})
message.success(resp.message)
await _tableRef.value?.requestGetTableData()
})
}
>
</Button>
</Space>
),
},
]
const x: number = _columns.reduce((a, b) => a + (b.width as number), 0)
const _reqApi: _TableProps['requestApi'] = (params) => {
// console.log(record_);
;(params as PageParams<EnterprisesUnitPagerQueryParams>).params.serviceProjectId = record_.snowFlakeId
return api.post('/m2/eu/sec_user_pager', params)
}
Modal.info({
title: `${record_.name}】 管理保安人员`,
width: '80%',
centered: true,
maskClosable: true,
content: () => (
<TableProMax
scroll={{ x: x }}
ref={_tableRef}
size='small'
columns={_columns}
requestApi={_reqApi}
searchFormOptions={{
name: {
type: 'input',
label: '姓名',
},
securityNumber: {
type: 'input',
label: '保安证号',
},
telephone: {
type: 'input',
label: '手机号',
},
}}
v-slots={
{
tableHeader: (_) => {
return (
<Space>
<Button class='btn-success' onClick={() => saveOrUpdateEnterprisesUnit(_tableRef.value?.requestGetTableData, record_, 'add')}>
</Button>
<Button disabled></Button>
</Space>
)
},
} as TableProMaxSlots<PoliceUnitPagerVo>
}
/>
),
})
}

View File

@ -1,6 +1,7 @@
<template>
<div>
<TableProMax
style="width: 100%"
:expandedRowRender="expandedRowRender"
:expand-column-width="50"
:defaultExpandAllRows="false"
@ -39,6 +40,7 @@ import { publicUnitPagerQueryParams } from '@/types/views/publicUnit.ts'
import { FormProMaxItemOptions } from '@/types/components/form//index.ts'
import { FormExpose } from 'ant-design-vue/es/form/Form'
import { serviceProjectSaveOrUpdateParams_ } from '@/types/views/serviceManagement'
import { showEnterprisesUnit } from './index.tsx'
type _FormType = EnterprisesUnitSaveOrUpdateParams & {
contactPersonInfoName?: string
contactPersonInfoTelephone?: string
@ -476,16 +478,19 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
{
dataIndex: 'name',
title: '服务项目名称',
width: 120,
},
{
dataIndex: 'type',
title: '服务类型',
customRender: ({ text }) => <a-tag>{text?.label}</a-tag>,
width: 120,
},
{
dataIndex: 'twoType',
title: '二级类型',
customRender: ({ text }) => <a-tag>{text?.label}</a-tag>,
width: 120,
},
{
dataIndex: 'outsourceName',
@ -495,45 +500,63 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
return record.outsourceName
}
},
width: 120,
ellipsis: true,
},
{
dataIndex: 'isFiling',
title: '是否备案',
customRender: ({ text }) => <a-tag>{text?.label}</a-tag>,
width: 120,
},
{
dataIndex: 'idNumber',
title: '保安服务许可证',
width: 200,
ellipsis: true,
},
{
dataIndex: 'serviceArea',
title: '服务区域面积',
width: 60,
ellipsis: true,
},
{
dataIndex: 'buildingTotal',
title: '楼栋数量',
width: 60,
ellipsis: true,
},
{
dataIndex: 'houseTotal',
title: '户数',
width: 60,
ellipsis: true,
},
{
dataIndex: 'staffTotal',
title: '工作人员数量',
width: 60,
ellipsis: true,
},
{
dataIndex: 'securityUserTotal',
title: '保安人员数量',
width: 60,
ellipsis: true,
},
{
dataIndex: 'remark',
title: '备注',
width: 120,
},
{
dataIndex: 'createUserInfo',
title: '创建人',
width: 200,
ellipsis: true,
customRender: ({ record }) => {
return (
<div>
@ -547,15 +570,20 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
{
dataIndex: 'createTime',
title: '创建时间',
width: 120,
ellipsis: true,
},
{
dataIndex: 'opt',
title: '操作',
fixed: 'right',
width: 300,
customRender({ record }) {
return (
<a-space>
<a-button class='btn-success' onClick={() => showEnterprisesUnit(record)}>
保安人员
</a-button>
<a-button
class='btn-warn'
onClick={async () => {
@ -599,19 +627,23 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
},
},
]
// const x2: number = _columns.reduce((a, b) => a + (b.width as number), 0)
const _reqApi: _TableProps['requestApi'] = async () => {
// @ts-ignore
return await api.get('/m2/eu/listSp', { enterprisesUnitId: record?.snowFlakeId })
}
return (
<div style={{ width: '100%' }}>
<TableProMax
style={{ width: '1500px' }}
scroll={{ x: '1500px' }}
ref={_tableRef}
size='small'
columns={_columns}
requestApi={_reqApi}
isPagination={false}
v-slots={{
tableHeader: (_) => {
tableHeader: () => {
return (
<Space>
<Button type={'primary'} onClick={() => addService(record)}>
@ -622,6 +654,7 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
},
}}
/>
</div>
)
}

View File

@ -29,7 +29,7 @@ import FormProMax from '@/components/form/FormProMax.vue'
import { FormProMaxItemOptions } from '@/types/components/form'
import { FormExpose } from 'ant-design-vue/es/form/Form'
import { publicUnitPagerQueryParams, FromItem } from '@/types/views/publicUnit.ts'
import { ComponentExposed } from 'vue-component-type-helpers'
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
const formRef = ref<FormExpose>(null)
type TableProps = TableProMaxProps<publicUnitPagerQueryParams>