| | |
| | | getCertificatePage, |
| | | updateCertificate, |
| | | } from '#/api/safety'; |
| | | import HrmEmployeeSelect from '#/views/hrm/employee/components/select.vue'; |
| | | |
| | | import { CERT_STATUS_COLOR, CERT_STATUS_OPTIONS, CERT_TYPE_OPTIONS } from '../shared'; |
| | | |
| | |
| | | const formRef = ref<FormInstance>(); |
| | | |
| | | const initial = (): SafetyApi.Certificate => ({ |
| | | employeeName: '', |
| | | employeeNo: '', |
| | | deptName: '', |
| | | employeeId: undefined, |
| | | certType: 'HIGH_VOLTAGE_OPERATION', |
| | | certNo: '', |
| | | issuer: '', |
| | |
| | | const model = reactive<SafetyApi.Certificate>(initial()); |
| | | |
| | | const rules = { |
| | | employeeName: [{ required: true, whitespace: true, message: '请输入持证人姓名' }], |
| | | employeeId: [{ required: true, message: '请选择持证人' }], |
| | | certType: [{ required: true, message: '请选择证件类型' }], |
| | | certNo: [{ required: true, whitespace: true, message: '请输入证件编号' }], |
| | | expireDate: [{ required: true, message: '请选择有效期至' }], |
| | | }; |
| | | |
| | | const columns = [ |
| | | { title: '持证人', dataIndex: 'employeeName', width: 110, fixed: 'left' as const }, |
| | | { title: '持证人', dataIndex: 'employeeName', width: 150, fixed: 'left' as const }, |
| | | { title: '部门', dataIndex: 'deptName', width: 120 }, |
| | | { title: '证件类型', dataIndex: 'certType', width: 160 }, |
| | | { title: '证件编号', dataIndex: 'certNo', width: 190 }, |
| | |
| | | try { |
| | | const data = { |
| | | ...model, |
| | | employeeName: model.employeeName.trim(), |
| | | certNo: model.certNo.trim(), |
| | | }; |
| | | await (data.id ? updateCertificate(data) : createCertificate(data)); |
| | |
| | | <Form :model="filters" layout="inline" class="safety-filters" @finish="load(true)"> |
| | | <FormItem label="持证人"> |
| | | <Input v-model:value="filters.employeeName" allow-clear placeholder="姓名" style="width: 120px" /> |
| | | </FormItem> |
| | | <FormItem label="工号"> |
| | | <Input v-model:value="filters.employeeNo" allow-clear placeholder="工号" style="width: 120px" /> |
| | | </FormItem> |
| | | <FormItem label="部门"> |
| | | <Input v-model:value="filters.deptName" allow-clear placeholder="部门" style="width: 130px" /> |
| | |
| | | @change="tableChange" |
| | | > |
| | | <template #bodyCell="{ column, record }"> |
| | | <template v-if="column.dataIndex === 'certType'"> |
| | | <template v-if="column.dataIndex === 'employeeName'"> |
| | | <div class="flex flex-col"> |
| | | <span class="font-medium">{{ record.employeeName || '-' }}</span> |
| | | <span class="text-muted-foreground font-mono text-xs"> |
| | | {{ record.employeeNo || '' }} |
| | | </span> |
| | | </div> |
| | | </template> |
| | | <template v-else-if="column.dataIndex === 'deptName'"> |
| | | {{ record.deptName || '-' }} |
| | | </template> |
| | | <template v-else-if="column.dataIndex === 'certType'"> |
| | | <Tag color="blue">{{ record.certTypeName }}</Tag> |
| | | </template> |
| | | <template v-else-if="column.dataIndex === 'remainingDays'"> |
| | |
| | | layout="vertical" |
| | | class="safety-form" |
| | | > |
| | | <FormItem label="持证人姓名" name="employeeName"> |
| | | <Input v-model:value="model.employeeName" :maxlength="50" placeholder="请输入姓名" /> |
| | | </FormItem> |
| | | <FormItem label="工号" name="employeeNo"> |
| | | <Input v-model:value="model.employeeNo" :maxlength="50" placeholder="选填" /> |
| | | </FormItem> |
| | | <FormItem label="所属部门" name="deptName"> |
| | | <Input v-model:value="model.deptName" :maxlength="100" placeholder="如 电气车间" /> |
| | | <FormItem label="持证人" name="employeeId" class="col-span-full"> |
| | | <HrmEmployeeSelect v-model="model.employeeId" placeholder="从员工档案中选择持证人" /> |
| | | <div class="text-muted-foreground mt-1 text-xs"> |
| | | 持证人来自人力资源的员工档案,姓名 / 工号 / 部门自动带出,员工调岗后台账会同步更新。 |
| | | </div> |
| | | </FormItem> |
| | | <FormItem label="证件类型" name="certType"> |
| | | <Select v-model:value="model.certType" :options="CERT_TYPE_OPTIONS" /> |