Files
xj-admin/src/views/system/user/HealthUserEmployeeEx/HealthUserEmployeeEx.data.ts
T
lianlonggang eeb1496483 feat(upload): 配置文件上传组件的业务路径和文本提示
- 在 JImageUpload 组件中添加 bizPath 属性以指定上传路径
- 为头像上传功能统一设置 bizPath: 'avatar'
- 为图片上传功能设置 bizPath: 'img'
- 为视频上传功能设置 bizPath: 'video'
- 为PDF文件上传设置 bizPath: 'bizfile'
- 为APP文件上传设置 bizPath: 'appfile'
- 添加 text 属性统一显示 '上传头像' 提示文本
- 在系统横幅管理中配置图片上传的业务路径
- 为新资源管理模块添加完整的数据结构定义
2026-04-30 08:56:14 +08:00

873 lines
27 KiB
TypeScript

import { BasicColumn, FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Image, message } from 'ant-design-vue';
import { getFamaleDefaultImage, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
import { getSecondaryDepartmentList, getThirdDepartmentList } from '/@/views/system/user/user.api';
import { allSecondaryDepartsNew, getFourthDepartsNew } from '/@/utils/system/api';
import { rules } from '/@/utils/helper/validator';
import { checkPassword } from '/@/hooks/checkPassword/checkPassword';
import { isShowIdCard } from '/@/utils/getEnv';
//列表数据
export const columns: BasicColumn[] = [
{
title: '员工账号',
align: 'center',
fixed: 'left',
dataIndex: 'username',
},
{
title: '员工姓名',
align: 'center',
fixed: 'left',
dataIndex: 'realname',
},
{
title: '性别',
align: 'center',
dataIndex: 'sex_dictText',
width: 64,
},
{
title: '员工工号',
align: 'center',
dataIndex: ['extension', 'empSysno'],
width: 80,
},
{
title: '头像',
align: 'center',
dataIndex: 'avatar',
width: 64,
customRender: ({ text, record }) => {
return h(Image, {
placeholder: true,
src: getFileAccessHttpUrl(text) || '',
height: 40,
width: 40,
fallback: getFamaleDefaultImage(record.sex),
});
},
},
{
title: '身份证号',
align: 'center',
dataIndex: 'idCard',
width: 160,
ifShow: isShowIdCard(),
},
{
title: '手机号',
align: 'center',
dataIndex: 'phone',
width: 120,
},
{
title: '状态',
dataIndex: 'status_dictText',
width: 80,
slots: { customRender: 'statusTag' },
},
{
title: '单位名称',
align: 'center',
dataIndex: ['secondDepart', 'departName'],
},
{
title: '部门名称',
align: 'center',
dataIndex: ['departTree', '2'],
width: 180,
},
{
title: '四级部门名称',
align: 'center',
dataIndex: ['departTree', '3'],
width: 180,
},
{
title: '出生日期',
align: 'center',
dataIndex: 'birthday',
},
{
title: '职务',
align: 'center',
dataIndex: ['extension', 'empJob_dictText'],
},
{
title: '行政级别',
align: 'center',
dataIndex: ['extension', 'empLevel_dictText'],
},
{
title: '民族',
align: 'center',
dataIndex: ['extension', 'empNation_dictText'],
},
{
title: '学历',
align: 'center',
dataIndex: ['extension', 'empDegree_dictText'],
},
{
title: '婚姻状况',
align: 'center',
dataIndex: ['extension', 'empMarriage_dictText'],
},
{
title: '籍贯',
align: 'center',
dataIndex: ['extension', 'empNativeplace'],
},
// {
// title: '工种',
// align: 'center',
// dataIndex: ['extension', 'medicalWorkTypeCode_dictText'],
// },
// {
// title: '用工形式',
// align: 'center',
// dataIndex: ['extension', 'empType_dictText'],
// },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: '员工账号',
field: 'username',
component: 'Input',
},
{
label: '员工姓名',
field: 'realname',
component: 'Input',
},
{
label: '员工工号',
field: 'empNo',
component: 'Input',
},
{
label: '身份证号',
field: 'idCard',
component: 'Input',
ifShow: isShowIdCard(),
},
{
label: '手机号',
field: 'phone',
component: 'Input',
},
{
label: '单位名称',
field: 'orgCode',
component: 'ApiSelect',
componentProps: ({ formModel }) => {
return {
api: allSecondaryDepartsNew,
resultField: 'result',
labelField: 'departName',
valueField: 'orgCode',
immediate: true,
onChange: (_value, option) => {
formModel.departId = option?.id || '';
formModel.orgCode2 = '';
},
onDeselect: () => {
formModel.departId = '';
formModel.orgCode2 = '';
},
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.trim().toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
};
},
},
{
label: '部门名称',
field: 'orgCode2',
component: 'ApiSelect',
componentProps: ({ formModel }) => {
return {
api: getThirdDepartmentList,
resultField: 'list',
labelField: 'departName',
params: {
secondDepartId: formModel?.departId || '',
},
valueField: 'orgCode',
immediate: false,
onFocus: () => {
if (!formModel.departId) {
return message.warn('请先选择单位!');
}
},
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.trim().toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
};
},
},
{
label: '四级部门名称',
field: 'deptCode',
component: 'ApiSelect',
componentProps: ({ formModel }) => {
return {
api: getFourthDepartsNew,
resultField: 'result',
labelField: 'departName',
params: {
idOrCode: formModel.orgCode2 || '',
},
valueField: 'orgCode',
immediate: false,
onFocus: () => {
if (!formModel.orgCode2) {
return message.warn('请先选择部门!');
}
},
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.trim().toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
};
},
},
];
//表单数据
export const formSchema: (isUpdate: boolean) => FormSchema[] = (isUpdate) => {
return [
{
label: '员工账号',
field: 'username',
component: 'Input',
componentProps: ({ formModel }) => {
return {
onInput: () => {
formModel.username = formModel.username.replace(/[^a-zA-Z0-9_]/g, '');
},
autocomplete: 'off',
placeholder: '请输入员工姓名全拼+数字',
};
},
required: true,
dynamicDisabled: isUpdate,
},
{
label: '密码',
field: 'password',
component: 'StrengthMeter',
componentProps: {
autocomplete: 'new-password',
readOnly: true,
onfocus: (field) => {
field.target.readOnly = false;
},
},
dynamicRules: () => {
return [
{
required: true,
validator: (_, value) => {
let { message } = checkPassword(value);
if (message === 'ok') {
return Promise.resolve();
} else {
return Promise.reject(message);
}
},
trigger: 'blur',
},
];
},
required: !isUpdate,
ifShow: !isUpdate,
},
{
label: '员工姓名',
field: 'realname',
component: 'Input',
required: true,
},
{
label: '员工工号',
field: 'empSysno',
component: 'Input',
componentProps: ({ formModel }) => {
return {
onInput: () => {
// formModel.empSysno = formModel.empSysno.replace(/[^0-9][^a-z][^A-Z]/g, '');
formModel.empSysno = formModel.empSysno.replace(/ /g, '');
},
};
},
dynamicRules: ({ model, schema }) => {
let rule = rules.duplicateCheckRuleAndDelFlag('QH_HLT_USER_EMPLOYEE_EX', 'EMP_SYSNO', 'false', model, schema, false);
rule[0] = { ...rule[0], required: false };
return rule;
},
},
{
label: '性别',
field: 'sex',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'sex2',
},
required: true,
},
{
label: '头像',
field: 'avatar',
component: 'JImageUpload',
componentProps: {
text: '上传头像',
bizPath: 'avatar',
maxCount: 1,
},
},
{
label: '',
field: 'secondDepartName',
component: 'Input',
defaultValue: '',
dynamicDisabled: true,
show: false,
},
{
label: '部门',
field: 'orgCode',
component: 'JSelectDeptStaff',
componentProps: ({ formModel }) => {
return {
sync: true,
checkStrictly: true,
defaultExpandLevel: 1,
initOptions: isUpdate
? [
{
value: formModel.departId,
label: ' ' + formModel.secondDepartName + ' - ' + formModel.departName + ' ',
},
]
: [],
};
},
required: true,
},
{
label: '出生日期',
field: 'birthday',
component: 'DatePicker',
componentProps: {
showTime: false,
valueFormat: 'YYYY-MM-DD',
},
required: true,
},
{
label: '身份证号',
field: 'idCard',
component: 'Input',
componentProps: ({ formModel }) => {
return {
onInput: () => {
formModel.idCard = formModel.idCard.replace(/[^Xx0-9]/g, '');
},
};
},
// rules: [
// {
// required: true,
// },
// {
// pattern: /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/,
// message: '${label}格式有误',
// },
// ],
// dynamicRules: ({ model, schema }) =>
// rules.idcard(true).concat(rules.duplicateCheckRuleAndDelFlag('sys_user', 'id_card', 'false', model, schema, false)),
// dynamicRules: ({ model, schema }) => rules.idcard(true).concat(rules.duplicateCheckRule('sys_user', 'id_card', model, schema, false)),
},
/*{
label: '身份证正面',
field: 'empIdcardFace',
component: 'JImageUpload',
componentProps: {
maxCount: 1,
},
},
{
label: '身份证反面',
field: 'empIdcardBack',
component: 'JImageUpload',
componentProps: {
maxCount: 1,
},
},*/
{
label: '手机号',
field: 'phone',
component: 'Input',
componentProps: ({ formModel }) => {
return {
onInput: () => {
formModel.phone = formModel.phone.replace(/[^0-9]/g, '');
},
};
},
// rules: [
// {
// required: true,
// },
// {
// pattern: /^1[3456789][0-9]{9}$/,
// message: '${label}格式有误',
// },
// ],
},
{
label: '邮箱',
field: 'email',
component: 'Input',
rules: [
{
pattern: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
message: '${label}格式有误',
},
],
},
{
label: '职务',
field: 'empJob',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'e_job',
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.trim().toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
},
},
{
label: '职称',
field: 'empTitle',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'e_title',
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.trim().toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
},
},
// {
// label: '子组',
// field: 'empGroup',
// component: 'JDictSelectTag',
// componentProps: {
// dictCode: 'emp_group',
// showSearch: true,
// filterOption: (input: string, option: any): boolean => {
// const str: string = input.trim().toLowerCase();
// return option.label.toLowerCase().indexOf(str) >= 0;
// },
// },
// },
{
label: '职位',
field: 'empPosition',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'emp_position',
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
},
},
{
label: '行政级别',
field: 'empLevel',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'emp_level',
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.trim().toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
},
},
{
label: '员工状态',
field: 'empStatus',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'emp_status',
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.trim().toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
},
},
{
label: '政治面貌',
field: 'empPolitical',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'emp_political',
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.trim().toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
},
},
{
label: '民族',
field: 'empNation',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'nation',
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.trim().toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
},
},
{
label: '学历',
field: 'empDegree',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'emp_education',
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.trim().toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
},
},
{
label: '婚姻状况',
field: 'empMarriage',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'mr_state',
},
},
{
label: '籍贯',
field: 'empNativeplace',
component: 'Input',
},
{
label: '入职时间',
field: 'empWorktime',
component: 'DatePicker',
componentProps: {
showTime: false,
valueFormat: 'YYYY-MM-DD',
},
},
// {
// label: '体检形式',
// field: 'medicalOnJob',
// component: 'JDictSelectTag',
// componentProps: {
// dictCode: 'medical_on_job',
// },
// },
// {
// label: '工种',
// field: 'medicalWorkTypeCode',
// component: 'JDictSelectTag',
// componentProps: {
// dictCode: 'medical_worktype',
// showSearch: true,
// },
// },
// {
// label: '其他工种',
// field: 'medicalWorkTypeOther',
// component: 'Input',
// ifShow: ({ model }) => {
// return model.medicalWorkTypeCode === '0014' || model.medicalWorkTypeCode === '0033' || model.medicalWorkTypeCode === '999999';
// },
// required: ({ model }) => {
// return model.medicalWorkTypeCode === '0014' || model.medicalWorkTypeCode === '0033' || model.medicalWorkTypeCode === '999999';
// },
// },
// {
// label: '危害因素',
// field: 'medicalHazardFactorCode',
// component: 'JDictSelectTag',
// componentProps: {
// dictCode: 'medical_hazard',
// showSearch: true,
// mode: 'multiple',
// },
// },
// {
// label: '其他危害',
// field: 'medicalHazardFactorOther',
// component: 'Input',
// ifShow: ({ model }) => {
// return model.medicalHazardFactorCode?.join(',').indexOf('0999') > -1;
// },
// required: ({ model }) => {
// return model.medicalHazardFactorCode?.join(',').indexOf('0999') > -1;
// },
// },
// {
// label: '接害时间',
// field: 'medicalHazardDate',
// component: 'DatePicker',
// componentProps: {
// showTime: false,
// valueFormat: 'YYYY-MM-DD',
// },
// },
// {
// label: '用工形式',
// field: 'empType',
// component: 'JDictSelectTag',
// componentProps: {
// dictCode: 'contract',
// },
// },
// {
// label: '上市员工',
// field: 'listedFlag',
// component: 'JDictSelectTag',
// componentProps: {
// type: 'radio',
// dictCode: 'sf_10',
// },
// },
{
label: '工作地点',
field: 'workSpace',
component: 'Input',
},
{
label: '居住地点',
field: 'liveSpace',
component: 'Input',
},
{
label: '关爱联络员姓名',
field: 'careLiaisonName',
component: 'Input',
},
{
label: '关爱联络员职务',
field: 'careLiaisonJob',
component: 'Input',
},
{
label: '关爱联络员电话',
field: 'careLiaisonPhone',
component: 'Input',
rules: [{ required: false, pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' }],
},
{
label: '急救人员姓名',
field: 'lifeguardName',
component: 'Input',
},
{
label: '急救人员电话',
field: 'lifeguardPhone',
component: 'Input',
rules: [{ required: false, pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' }],
},
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
{
label: '',
field: 'personType',
component: 'Input',
defaultValue: '1',
dynamicDisabled: true,
show: false,
},
{
label: '',
field: 'departName',
component: 'Input',
dynamicDisabled: true,
show: false,
},
{
label: '',
field: 'departId',
component: 'Input',
dynamicDisabled: true,
show: false,
},
];
};
//迁移用户
export const migrateUserFormSchema: FormSchema[] = [
{
label: '员工姓名',
field: 'realname',
component: 'Input',
componentProps: {
disabled: true,
},
},
{
label: '员工工号',
field: 'workNo',
component: 'Input',
componentProps: {
disabled: true,
},
},
{
label: '单位名称',
field: 'oldSecond',
component: 'Input',
componentProps: {
disabled: true,
},
},
{
label: '部门名称',
field: 'oldThird',
component: 'Input',
componentProps: {
disabled: true,
},
},
{
label: '迁移单位',
field: 'toDepartCode',
component: 'ApiTreeSelect',
required: true,
componentProps: ({ formModel }) => {
let treeData: any;
return {
api: getSecondaryDepartmentList,
fieldNames: {
label: 'departName',
value: 'orgCode',
},
immediate: true,
onSelect: (val, v) => {
formModel.toDepartId = v.id;
},
onOptionsChange: (data) => {
treeData = data;
},
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
loadData: async (treeNode: any) => {
return new Promise(async (resolve) => {
const { id } = treeNode.dataRef;
const result = await getThirdDepartmentList({ secondDepartId: id });
const add = (pid, children, treeArray) => {
if (treeArray && treeArray.length > 0) {
// @ts-ignore
for (const item of treeArray) {
if (item.id == pid) {
if (!children || children.length == 0) {
item.isLeaf = true;
} else {
item['children'] = children;
}
return;
} else {
add(pid, children, item.children);
}
}
}
};
add(id, result, treeData);
resolve(treeData);
});
},
getPopupContainer: () => document.body,
};
},
},
{
label: '',
field: 'isBind',
component: 'ApiSelect',
slot: 'isBind',
required: true,
componentProps: {
options: [
{
label: '是(解除绑定,手表仍属于当前单位)',
value: '1',
},
{
label: '否(不解除绑定,手表跟随用户一并迁移至新单位)',
value: '0',
},
],
},
show: false,
},
{
label: '是否解绑',
field: 'watchStatus',
component: 'Input',
show: false,
},
{
label: '迁移部门id',
field: 'toDepartId',
component: 'Input',
show: false,
},
{
label: '原部门Code',
field: 'fromDepartCode',
component: 'Input',
show: false,
},
{
label: '原部门Id',
field: 'fromDepartId',
component: 'Input',
show: false,
},
{
label: '',
field: 'userId',
component: 'Input',
show: false,
},
];