239 lines
6.8 KiB
TypeScript
239 lines
6.8 KiB
TypeScript
import { BasicColumn, FormSchema } from '/@/components/Table';
|
|
import { Component, h } from 'vue';
|
|
import { Image, message } from 'ant-design-vue';
|
|
import { getFamaleDefaultImage, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
|
|
import { EyeOutlined } from '@ant-design/icons-vue';
|
|
import { render } from '/@/utils/common/renderUtils';
|
|
import BasicInfo from '/@/views/archive/employeeFile/components/basicInfo/basicInfo.vue';
|
|
import ExaminationReport from '/@/views/archive/employeeFile/components/examinationReport/examinationReport.vue';
|
|
import HealthAssessment from '/src/views/archive/employeeFile/components/healthAssessment/healthAssessment.vue';
|
|
import PsychologicalAssessment from '/@/views/archive/employeeFile/components/psychologicalAssessment/psychologicalAssessment.vue';
|
|
import AnalysisReport from '/@/views/archive/employeeFile/components/analysisReport/analysisReport.vue';
|
|
import { getSecondaryDepartmentList } from '/@/views/system/user/user.api';
|
|
import { getThirdDepartListByOrgCode } from '/@/views/archive/employeeFile/employeeFileList.api';
|
|
import { useDepartment } from '/@/utils/auth/formAuth';
|
|
import { AesEncryption } from '/@/utils/cipher';
|
|
import { cacheCipher } from '/@/settings/encryptionSetting';
|
|
|
|
export const columns: BasicColumn[] = [
|
|
{
|
|
title: '用户账号',
|
|
align: 'center',
|
|
dataIndex: 'username',
|
|
width: 100,
|
|
fixed: 'left',
|
|
},
|
|
{
|
|
title: '姓名',
|
|
align: 'center',
|
|
dataIndex: 'realname',
|
|
fixed: 'left',
|
|
width: 100,
|
|
},
|
|
{
|
|
title: '头像',
|
|
align: 'center',
|
|
dataIndex: 'avatar',
|
|
width: 100,
|
|
customRender: ({ text, record }) => {
|
|
const t = text ? text.replace(',', '') : null;
|
|
return h(Image, {
|
|
placeholder: true,
|
|
src: getFileAccessHttpUrl(t),
|
|
height: 50,
|
|
width: 50,
|
|
fallback: getFamaleDefaultImage(record.sex),
|
|
previewMask: () => {
|
|
return h(EyeOutlined, {
|
|
style: {
|
|
color: 'white',
|
|
},
|
|
});
|
|
},
|
|
});
|
|
},
|
|
},
|
|
{
|
|
title: '性别',
|
|
align: 'center',
|
|
dataIndex: 'sex',
|
|
width: 60,
|
|
customRender: ({ text }) => {
|
|
return render.renderDict(text, 'gender');
|
|
},
|
|
},
|
|
{
|
|
title: '年龄',
|
|
align: 'center',
|
|
dataIndex: 'age',
|
|
width: 60,
|
|
},
|
|
{
|
|
title: '单位',
|
|
align: 'center',
|
|
dataIndex: ['secondDepart', 'departName'],
|
|
},
|
|
{
|
|
title: '部门',
|
|
align: 'center',
|
|
dataIndex: ['depart', 'departName'],
|
|
},
|
|
{
|
|
title: '身份证',
|
|
align: 'center',
|
|
dataIndex: 'idCard',
|
|
width: 200,
|
|
},
|
|
{
|
|
title: '手机号',
|
|
align: 'center',
|
|
dataIndex: 'phone',
|
|
},
|
|
{
|
|
title: '职务',
|
|
align: 'center',
|
|
dataIndex: ['extension', 'empJob_dictText'],
|
|
},
|
|
{
|
|
title: '编号',
|
|
align: 'center',
|
|
dataIndex: ['extension', 'empNo'],
|
|
},
|
|
{
|
|
title: '家庭成员',
|
|
align: 'center',
|
|
dataIndex: 'familyNum',
|
|
},
|
|
];
|
|
export const searchFormSchema: FormSchema[] = [
|
|
{
|
|
label: '姓名',
|
|
field: 'realname',
|
|
component: 'Input',
|
|
},
|
|
{
|
|
label: '手机号',
|
|
field: 'phone',
|
|
component: 'Input',
|
|
},
|
|
{
|
|
label: '身份证号',
|
|
field: 'idCord',
|
|
component: 'Input',
|
|
},
|
|
{
|
|
label: '单位',
|
|
field: 'orgCode',
|
|
component: 'ApiSelect',
|
|
componentProps: ({ formModel, schema }) => {
|
|
const { secondSelectValue, secondSelectDisabled } = useDepartment({ schema, key: 'orgCode' });
|
|
secondSelectValue();
|
|
return {
|
|
api: getSecondaryDepartmentList,
|
|
resultField: 'result',
|
|
labelField: 'departName',
|
|
valueField: 'orgCode',
|
|
immediate: true,
|
|
onChange: () => {
|
|
formModel.orgCode2 = '';
|
|
},
|
|
onDeselect: () => {
|
|
formModel.orgCode = '';
|
|
formModel.orgCode2 = '';
|
|
},
|
|
showSearch: true,
|
|
filterOption: (input: string, option: any): boolean => {
|
|
const str: string = input.toLowerCase();
|
|
return option.label.toLowerCase().indexOf(str) >= 0;
|
|
},
|
|
disabled: secondSelectDisabled,
|
|
};
|
|
},
|
|
},
|
|
{
|
|
label: '部门',
|
|
field: 'orgCode2',
|
|
component: 'ApiSelect',
|
|
componentProps: ({ formModel, schema }) => {
|
|
const { thirdSelectValue, thirdSelectDisabled } = useDepartment({ schema, key: 'orgCode' });
|
|
thirdSelectValue();
|
|
return {
|
|
api: getThirdDepartListByOrgCode,
|
|
resultField: 'list',
|
|
labelField: 'departName',
|
|
params: {
|
|
orgCode: formModel?.orgCode || '12313',
|
|
},
|
|
valueField: 'orgCode',
|
|
immediate: true,
|
|
onFocus: () => {
|
|
if (!formModel.orgCode) {
|
|
return message.warn('请先选择单位!');
|
|
}
|
|
},
|
|
showSearch: true,
|
|
filterOption: (input: string, option: any): boolean => {
|
|
const str: string = input.toLowerCase();
|
|
return option.label.toLowerCase().indexOf(str) >= 0;
|
|
},
|
|
disabled: thirdSelectDisabled,
|
|
};
|
|
},
|
|
},
|
|
];
|
|
|
|
export interface ComponentsType {
|
|
key: number;
|
|
title: string;
|
|
component: Component;
|
|
auth?: string;
|
|
}
|
|
export const componentsList: ComponentsType[] = [
|
|
{
|
|
key: 1,
|
|
title: '健康档案',
|
|
component: BasicInfo,
|
|
},
|
|
// {
|
|
// key: 2,
|
|
// title: '压力评估',
|
|
// component: StressAssessment,
|
|
// },
|
|
{
|
|
key: 2,
|
|
title: '体检报告',
|
|
component: ExaminationReport,
|
|
},
|
|
{
|
|
key: 3,
|
|
title: '心理评估',
|
|
component: PsychologicalAssessment,
|
|
},
|
|
{
|
|
key: 4,
|
|
title: '健康评估',
|
|
component: HealthAssessment,
|
|
},
|
|
{
|
|
key: 5,
|
|
title: '体检分析报告',
|
|
component: AnalysisReport,
|
|
},
|
|
];
|
|
|
|
export function encryption() {
|
|
const aes = new AesEncryption(cacheCipher);
|
|
|
|
function encrypt(word: string) {
|
|
if (!word) return;
|
|
return aes.encryptByAES(word);
|
|
}
|
|
|
|
function decrypt(word: string) {
|
|
if (!word) return;
|
|
return aes.decryptByAES(word);
|
|
}
|
|
|
|
return { encrypt, decrypt };
|
|
}
|