// @ts-ignore import { BasicColumn, FormSchema } from '/@/components/Table'; import { allSecondaryDepartsNew, getThirdDepartsNew } from '/@/utils/orgSearchInfo'; import { message } from 'ant-design-vue'; import { queryDepartTreeSync } from '/@/views/system/depart/depart.api'; export const columns: BasicColumn[] = [ { title: '单位', dataIndex: 'secondDepart', }, { title: '部门', dataIndex: 'thirdDepart', }, { title: '员工编号', dataIndex: 'workNo', width: 110, }, { title: '姓名', dataIndex: 'realName', width: 90, }, { title: '性别', dataIndex: 'sex_dictText', width: 70, }, { title: '年龄', dataIndex: 'age', width: 70, }, ]; export const searchSchema: FormSchema[] = [ { label: '单位', field: 'orgCode1', component: 'ApiSelect', componentProps: ({ formModel }) => { return { api: allSecondaryDepartsNew, resultField: 'result', labelField: 'departName', valueField: 'orgCode', placeholder: '请选择单位', showSearch: true, showDefaultValue: false, filterOption: (input: string, option: any): boolean => { const str: string = input.trim().toLowerCase(); return option.label.toLowerCase().indexOf(str) >= 0; }, onChange: () => { formModel['orgCode2'] = ''; }, onDeselect: () => { formModel['orgCode1'] = ''; formModel['orgCode2'] = ''; formModel['orgCode'] = ''; }, getPopupContainer: () => document.body, }; }, }, { label: '部门', field: 'orgCode2', component: 'ApiSelect', componentProps: ({ formModel }) => { return { api: getThirdDepartsNew, resultField: 'list', labelField: 'departName', valueField: 'orgCode', placeholder: '请选择部门', showSearch: true, showDefaultValue: false, getPopupContainer: () => document.body, params: { idOrCode: formModel['orgCode1'] || 'xasd', }, onFocus: () => { if (!formModel['orgCode1']) { return message.warn('请先选择单位!'); } }, filterOption: (input: string, option: any): boolean => { const str: string = input.trim().toLowerCase(); return option.label.toLowerCase().indexOf(str) >= 0; }, }; }, }, { label: '员工编号', field: 'workNo', component: 'Input', }, { label: '姓名', field: 'realName', component: 'Input', }, { label: '性别', field: 'sex', component: 'JDictSelectTag', componentProps: () => ({ dictCode: 'sex2' }), }, { label: '年龄', field: 'nl', component: 'JCascadeInput', componentProps: ({ formModel }) => { return { getPopupContainer: () => document.body, onChange: (val) => { const data = JSON.parse(val); formModel.ageFindType = data.selectValue; formModel.ageStat = data.inputValue1; if (data.selectValue == '2') { formModel.ageEnd = data.inputValue2; } }, optionsType: '2', }; }, }, { label: '', field: 'ageFindType', component: 'Input', show: false, }, { label: '', field: 'age', component: 'Input', show: false, }, { label: '', field: 'ageB', component: 'Input', show: false, }, ]; export const employeeSearchSchema: FormSchema[] = [ { label: '单位部门', field: 'orgCode', component: 'JlazyTreeSelect', componentProps: () => { return { api: queryDepartTreeSync, loadApi: queryDepartTreeSync, multiple: false, afterApi: (data) => { data.forEach((item: any) => { item['preTitle'] = item.title; item['key'] = item.orgCode; }); return data; }, preItem: (title, item) => { item['preTitle'] = title + '/' + item.title; item['key'] = item.orgCode; return item; }, fieldNamesInfo: { value: 'orgCode', label: 'preTitle', key: 'orgCode', }, }; }, }, { label: '员工编号', field: 'workNo', component: 'Input', }, { label: '姓名', field: 'realname', component: 'Input', }, { label: '性别', field: 'sex', component: 'JDictSelectTag', componentProps: () => { return { dictCode: 'sex2', }; }, }, { label: '年龄', field: 'nl', component: 'JCascadeInput', componentProps: ({ formModel }) => { return { getPopupContainer: () => document.body, onChange: (val) => { const data = JSON.parse(val); formModel.ageFindType = data.selectValue; formModel.ageStat = data.inputValue1; if (data.selectValue == '2') { formModel.ageEnd = data.inputValue2; } }, optionsType: '2', }; }, }, { label: '', field: 'ageFindType', component: 'Input', show: false, }, { label: '', field: 'ageStat', component: 'Input', show: false, }, { label: '', field: 'ageEnd', component: 'Input', show: false, }, ]; export const employeeColumns: BasicColumn[] = [ { title: '单位', dataIndex: 'secondDepart', }, { title: '部门', dataIndex: 'thirdDepart', }, { title: '员工编号', dataIndex: 'workNo', width: 110, }, { title: '姓名', dataIndex: 'realname', width: 90, }, { title: '性别', dataIndex: 'sex_dictText', width: 70, }, { title: '年龄', dataIndex: 'age', width: 70, }, ];