| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
- import type { VbenFormSchema } from '#/adapter/form';
- import type { OnActionClickFn } from '#/adapter/vxe-table';
- import type { PersonnelQualificationModel } from '#/api/method/personnel-qualification';
- import { h } from 'vue';
- import {
- CERTIFICATE_NAME_OPTIONS,
- optionsPersonnelDecoctionCenterMethod,
- optionsPersonnelEnterpriseMethod,
- POSITION_OPTIONS,
- QUALIFICATION_STATUS_LABELS,
- QUALIFICATION_STATUS_OPTIONS,
- } from '#/api/method/personnel-qualification';
- import { maskIdNumber } from '#/utils/mask-id';
- export function usePersonnelQualificationSearchFormSchema(): VbenFormSchema[] {
- return [
- {
- component: 'ApiSelect',
- componentProps: {
- allowClear: true,
- api: optionsPersonnelEnterpriseMethod,
- class: 'w-full',
- labelField: 'label',
- showSearch: true,
- valueField: 'value',
- },
- fieldName: 'enterpriseId',
- label: '煎药企业',
- },
- {
- component: 'ApiSelect',
- componentProps: {
- allowClear: true,
- api: () => optionsPersonnelDecoctionCenterMethod(),
- class: 'w-full',
- labelField: 'label',
- showSearch: true,
- valueField: 'value',
- },
- dependencies: {
- componentProps: (values) => ({
- key: `decoction-center-${values.enterpriseId || 'all'}`,
- allowClear: true,
- api: () =>
- optionsPersonnelDecoctionCenterMethod(values.enterpriseId),
- class: 'w-full',
- labelField: 'label',
- showSearch: true,
- valueField: 'value',
- }),
- trigger: (_values, formApi) => {
- formApi.setFieldValue('decoctionCenterId', undefined);
- },
- triggerFields: ['enterpriseId'],
- },
- fieldName: 'decoctionCenterId',
- label: '煎药中心',
- },
- {
- component: 'Select',
- componentProps: {
- allowClear: true,
- options: POSITION_OPTIONS,
- placeholder: '请选择',
- },
- fieldName: 'position',
- label: '岗位',
- },
- {
- component: 'Select',
- componentProps: {
- allowClear: true,
- options: QUALIFICATION_STATUS_OPTIONS,
- placeholder: '请选择',
- },
- fieldName: 'qualificationStatus',
- label: '资质状态',
- },
- {
- component: 'Input',
- componentProps: {
- placeholder: '请输入',
- },
- fieldName: 'keyword',
- label: '姓名/工号',
- },
- ];
- }
- export function usePersonnelQualificationTableColumns(
- onActionClick?: OnActionClickFn<PersonnelQualificationModel.Personnel>,
- ): VxeTableGridOptions<PersonnelQualificationModel.Personnel>['columns'] {
- return [
- {
- field: 'enterpriseName',
- minWidth: 160,
- title: '煎药企业/医疗机构',
- },
- {
- field: 'decoctionCenterName',
- minWidth: 150,
- title: '所属煎药中心',
- },
- {
- field: 'name',
- minWidth: 90,
- title: '姓名',
- },
- {
- field: 'positions',
- minWidth: 110,
- slots: {
- default: ({ row }) => row.positions?.join('、') || '-',
- },
- title: '岗位',
- },
- {
- field: 'employeeNo',
- minWidth: 90,
- title: '工号',
- },
- {
- field: 'idNumber',
- minWidth: 150,
- slots: {
- default: ({ row }) => maskIdNumber(row.idNumber),
- },
- title: '身份证号',
- },
- {
- field: 'certificateNames',
- minWidth: 160,
- title: '证书名称',
- },
- {
- field: 'qualificationStatus',
- minWidth: 100,
- slots: {
- default: ({ row }) => {
- const label =
- QUALIFICATION_STATUS_LABELS[row.qualificationStatus] ?? '-';
- const isWarning =
- row.qualificationStatus === 'expired' ||
- row.qualificationStatus === 'expiring';
- return h(
- 'span',
- { style: isWarning ? { color: '#ff4d4f' } : undefined },
- label,
- );
- },
- },
- title: '资质状态',
- },
- {
- align: 'center',
- cellRender: {
- attrs: {
- nameField: 'name',
- nameTitle: '岗位人员',
- onClick: onActionClick,
- },
- name: 'CellOperation',
- options: [
- {
- code: 'certificate',
- style: { color: '#fa8c16' },
- text: '证书',
- },
- 'edit',
- 'delete',
- ],
- },
- field: 'operation',
- fixed: 'right',
- title: '操作',
- width: 160,
- },
- ];
- }
- export function createEmptyCertificate(): PersonnelQualificationModel.Certificate {
- return {
- attachments: [],
- expiryDate: '',
- id: '',
- longTerm: false,
- name: '',
- number: '',
- status: 'valid',
- type: '',
- };
- }
- export { CERTIFICATE_NAME_OPTIONS, POSITION_OPTIONS };
|