diff --git a/src/assets/icons/icon-batch-ignore.svg b/src/assets/icons/icon-batch-ignore.svg new file mode 100644 index 0000000..f29251a --- /dev/null +++ b/src/assets/icons/icon-batch-ignore.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/icon-batch-ignore.svg b/src/assets/icons/icon-batch-ignore.svg new file mode 100644 index 0000000..f29251a --- /dev/null +++ b/src/assets/icons/icon-batch-ignore.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/icon-config.svg b/src/assets/icons/icon-config.svg new file mode 100644 index 0000000..818dbb4 --- /dev/null +++ b/src/assets/icons/icon-config.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/icon-batch-ignore.svg b/src/assets/icons/icon-batch-ignore.svg new file mode 100644 index 0000000..f29251a --- /dev/null +++ b/src/assets/icons/icon-batch-ignore.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/icon-config.svg b/src/assets/icons/icon-config.svg new file mode 100644 index 0000000..818dbb4 --- /dev/null +++ b/src/assets/icons/icon-config.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue b/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue new file mode 100644 index 0000000..979ba98 --- /dev/null +++ b/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue @@ -0,0 +1,280 @@ + + + + + + + diff --git a/src/assets/icons/icon-batch-ignore.svg b/src/assets/icons/icon-batch-ignore.svg new file mode 100644 index 0000000..f29251a --- /dev/null +++ b/src/assets/icons/icon-batch-ignore.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/icon-config.svg b/src/assets/icons/icon-config.svg new file mode 100644 index 0000000..818dbb4 --- /dev/null +++ b/src/assets/icons/icon-config.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue b/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue new file mode 100644 index 0000000..979ba98 --- /dev/null +++ b/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue @@ -0,0 +1,280 @@ + + + + + + + diff --git a/src/views/equipement/info/book/list.vue b/src/views/equipement/info/book/list.vue index e53e608..a2f5f1f 100644 --- a/src/views/equipement/info/book/list.vue +++ b/src/views/equipement/info/book/list.vue @@ -7,6 +7,7 @@ import dayjs from 'dayjs' import type { IList, IListQuery } from './book-interface' import delReasonDialog from './dialog/delReasonDialog.vue' +import configWeekAndMonthDialog from './dialog/configWeekAndMonthDialog.vue' import { approvalDelete, batchImport, cancelApproval, draftDelete, getEquipmentList, getStream, refuseApproval, submit } from '@/api/equipment/info/book' import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import type { deptType } from '@/global' @@ -376,6 +377,13 @@ fetchData(true) }) } + +// ----------------------------------------------配置周维护月保养------------------------------------------------------ +const configWeekAndMonthDialogRef = ref() +// 点击配置周维护、月保养 +const config = () => { + configWeekAndMonthDialogRef.value.initDialog() +} // ----------------------------------------------钩子------------------------------------------------------ watch(dateRange, (val) => { if (val) { @@ -389,7 +397,6 @@ }) // 只有审批给看审批状态 -// -----------------------------------------钩子-------------------------------------------------- watch(() => active.value, (val) => { if (val === '10') { // 审批把审批状态加上 if (columns.value[columns.value.length - 1].value !== 'approvalStatusName') { @@ -501,6 +508,7 @@ + @@ -622,6 +630,8 @@ + + diff --git a/src/assets/icons/icon-batch-ignore.svg b/src/assets/icons/icon-batch-ignore.svg new file mode 100644 index 0000000..f29251a --- /dev/null +++ b/src/assets/icons/icon-batch-ignore.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/icon-config.svg b/src/assets/icons/icon-config.svg new file mode 100644 index 0000000..818dbb4 --- /dev/null +++ b/src/assets/icons/icon-config.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue b/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue new file mode 100644 index 0000000..979ba98 --- /dev/null +++ b/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue @@ -0,0 +1,280 @@ + + + + + + + diff --git a/src/views/equipement/info/book/list.vue b/src/views/equipement/info/book/list.vue index e53e608..a2f5f1f 100644 --- a/src/views/equipement/info/book/list.vue +++ b/src/views/equipement/info/book/list.vue @@ -7,6 +7,7 @@ import dayjs from 'dayjs' import type { IList, IListQuery } from './book-interface' import delReasonDialog from './dialog/delReasonDialog.vue' +import configWeekAndMonthDialog from './dialog/configWeekAndMonthDialog.vue' import { approvalDelete, batchImport, cancelApproval, draftDelete, getEquipmentList, getStream, refuseApproval, submit } from '@/api/equipment/info/book' import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import type { deptType } from '@/global' @@ -376,6 +377,13 @@ fetchData(true) }) } + +// ----------------------------------------------配置周维护月保养------------------------------------------------------ +const configWeekAndMonthDialogRef = ref() +// 点击配置周维护、月保养 +const config = () => { + configWeekAndMonthDialogRef.value.initDialog() +} // ----------------------------------------------钩子------------------------------------------------------ watch(dateRange, (val) => { if (val) { @@ -389,7 +397,6 @@ }) // 只有审批给看审批状态 -// -----------------------------------------钩子-------------------------------------------------- watch(() => active.value, (val) => { if (val === '10') { // 审批把审批状态加上 if (columns.value[columns.value.length - 1].value !== 'approvalStatusName') { @@ -501,6 +508,7 @@ + @@ -622,6 +630,8 @@ + + diff --git a/src/views/equipement/resume/week/components/templateDetail.vue b/src/views/equipement/resume/week/components/templateDetail.vue index fcd41fe..89e5bcd 100644 --- a/src/views/equipement/resume/week/components/templateDetail.vue +++ b/src/views/equipement/resume/week/components/templateDetail.vue @@ -5,9 +5,9 @@ import { ElLoading, ElMessage } from 'element-plus' import type { IForm } from '../week-interface' import useUserStore from '@/store/modules/user' -import { getDictByCode } from '@/api/system/dict' -import type { dictType } from '@/global' import SelectEquipmentDialog from '@/views/business/fieldTest/approve/dialog/selectEquipmentDialog.vue' +import { getDictByCode } from '@/api/system/dict' +import type { deptType, dictType } from '@/global' import { useCheckList } from '@/commonMethods/useCheckList' import { useDoubleClickTableRow, useSetAllRowReadable } from '@/commonMethods/useSetAllRowReadable' import { addResumeWeekMonthList, getInfo, updateResumeWeekMonthList } from '@/api/equipment/resume/week-month' @@ -39,162 +39,167 @@ const form = ref({ logNo: '', // 记录编号 logName: '', // 记录名称 + labCodeName: '', // 实验室 + labCode: '', // 实验室 + groupCode: '', // 部门 + groupCodeName: '', // 部门名称 createUserId: '', // 记录人id + equipmentName: '', // 设备名称 createUserName: '', // 记录人 createTime: '', // 记录时间 - deptId: '', // 记录部门id - deptName: '', // 记录部门 - dustAbnormalReason: '', // 除尘除潮不正常原因 - appearanceAbnormalReason: '', // 外观检查不正常原因 - workAbnormalReason: '', // 工作正常性检查不正常原因 - performanceAbnormalReason: '', // 性能测试不正常原因 - attachmentAbnormalReason: '', // 备附件和资料检查不正常原因 - checkResult: '', // 检查结果 remark: '', // 备注 + checkResult: '', // 检查结果 }) // 校验规则 const formRules = ref({ - logName: [{ required: true, message: '记录名称不能为空', trigger: ['blur', 'change'] }], + groupCode: [{ required: true, message: '部门不能为空', trigger: ['blur', 'change'] }], + labCode: [{ required: true, message: '实验室不能为空', trigger: ['blur', 'change'] }], }) const loading = ref(false) + +// ------------------------------------------字典---------------------------------------------- +const useDeptList = ref([]) // 所属部门列表 +const useDeptDict = ref([]) as any // 所属部门字典 +const labNameList = ref([]) // 实验室列表 +const labNameDict = ref([]) as any // 实验室字典 +/** + * 获取字典 + */ +async function getDict() { + // 实验室 + const responseLab = await getDictByCode('bizGroupCodeEquipment') + labNameList.value = responseLab.data + labNameList.value.forEach((item) => { + labNameDict.value[item.value] = item.name + }) + // 部门 + const responseDept = await getDictByCode('bizGroupCode') + useDeptList.value = responseDept.data + responseDept.data.forEach((item: any) => { + useDeptDict.value[item.value] = item.name + }) +} // -------------------------------------------表格---------------------------------------------- const columns = ref([ // 表头 - { text: '维护项目', value: 'item', align: 'center' }, - { text: '内容', value: 'content', align: 'center' }, - { text: '要求', value: 'require', align: 'center' }, - { text: '方法', value: 'method', align: 'center' }, + { text: '维护项目', value: 'item', align: 'center', required: true }, { text: '检查结果', value: 'result', align: 'center', required: true, width: '180' }, - { text: '试验装备管理使用档案填写内容', value: 'reason', align: 'center' }, + { text: '备注', value: 'remark', align: 'center', required: true }, ]) -const list = ref([ - { - id: '1', - item: '除尘除潮', - content: '对设备表面进行除尘、清洁、加点除潮', - require: '无积尘、无受潮', - method: '用拧干的湿毛巾对标准设备进行擦拭。设备加电', +const list = ref([]) as any // 表格数据 +const checkoutList = ref([]) as any // 多选表格数据 +// 选中 +const handleSelectionChange = (e: any) => { + checkoutList.value = e +} +// 增加行 +const addRow = () => { + list.value.push({ + item: '', result: '1', - normalContent: '除尘、清洁、设备加电除潮', - reason: '', - }, - { - id: '2', - item: '外观检查', - content: '检查标准设备外观和状态标识', - require: '1)外观完整。连接头安装牢固,设备无影响正常工作的机械损伤;\n2)各按键、开关、旋钮旋转灵活,定位准确。连接器应安装牢固,设备无影响正常工作的机械损伤。 \n3)状态标识清晰、完好', - method: '目视、手动检查。不满足要求时查找原因或更换状态标识', - result: '1', - normalContent: '外观良好', - reason: '', - }, - { - id: '3', - item: '工作正常性检查', - content: '检查标准设备各功能,能否正常工作', - require: '1)控制开关通断分明,转换清晰。\n2)相应的指示灯应发亮,显示功能正常', - method: '1)调节各按钮、开关、旋钮\n2)观察相应的指示灯是否发亮、显示功能是否正常', - result: '1', - normalContent: '工作正常性检查正常', - reason: '', - }, - { - id: '4', - item: '性能测试', - content: '检查测量标准功能是否正常,', - require: '1)系统自检正常\n2)校准因子测试', - method: '设备开机启动正常\n2)测试功率计功率因子', - result: '1', - normalContent: '维护正常,校准因子测试正常', - reason: '', - }, - { - id: '5', - item: '备附件和资料检查', - content: '1)标准档案一套', - require: '1)备附件和资料是否齐全', - method: '1)对照档案目录,检查资料是否齐全', - result: '1', - normalContent: '备附件和资料齐全', - reason: '', - }, -]) // 维护保养信息 + remark: '', + customer: true, + }) +} +// 删除行 +const deleteRow = () => { + if (!checkoutList.value.length) { + ElMessage({ + message: '请选中要删除的行', + type: 'warning', + }) + return false + } + list.value = list.value.filter((item: any) => { + return !checkoutList.value.includes(item) + }) +} +// --------------------------------------选择设备------------------------------------------------- +const selectEquipmentDialogRef = ref() + +// 批量添加 +const selectEquipment = () => { + selectEquipmentDialogRef.value.initDialog() +} + +// 确定选择设备 +const confirmSelectEquipment = (list = []) => { + if (Array.isArray(list) && list.length) { + form.value.equipmentName = list[0].equipmentName + list[0].model + list[0].manufactureNo + } +} // -------------------------------------------按钮---------------------------------------------- // 关闭新增页面的回调 const close = () => { $router.back() } -// 导出word -const exportWord = () => { ElMessage.info('敬请期待') } - // 导出pdf -const exportPdf = () => { ElMessage.info('敬请期待') } - -// 打印 -const print = () => { ElMessage.info('敬请期待') } - -// 点击编辑按钮 -const edit = () => { - pageType.value = 'edit' +const exportPdf = () => { + ElMessage.info('敬请期待') } // 保存 const save = () => { - if (!useCheckList(list.value, columns.value, '维护保养信息', 'reason', 'result', '0')) { + if (!list.value.length) { + ElMessage.warning('维护保养信息不能为空') return false } - ruleFormRef.value!.validate((valid: boolean) => { - if (valid) { - const loading = ElLoading.service({ - lock: true, - background: 'rgba(255, 255, 255, 0.8)', - }) - let checkResult // 检查结果 - const index = list.value.findIndex(item => item.result === '0') - if (index !== -1) { - checkResult = '2' - } - else { - checkResult = '1' - } - const params = { - ...form.value, - id: props.infoId, - checkResult, // 检查结果,1全部正常、2不正常 - maintainType: props.maintainType, // 类型 1周维护、2月保养 - dustAbnormalReason: list.value[0].result === '0' ? list.value[0].reason : '', // 除尘除潮不正常原因 - appearanceAbnormalReason: list.value[1].result === '0' ? list.value[1].reason : '', // 外观检查不正常原因 - workAbnormalReason: list.value[2].result === '0' ? list.value[2].reason : '', // 工作正常性检查不正常原因 - performanceAbnormalReason: list.value[3].result === '0' ? list.value[3].reason : '', // 性能测试不正常原因 - attachmentAbnormalReason: list.value[4].result === '0' ? list.value[4].reason : '', // 备附件和资料检查不正常原因 - } - // 新建 - if (pageType.value === 'add') { // 新建 - addResumeWeekMonthList(params).then((res) => { - ElMessage.success('保存成功') - form.value.logNo = res.data.logNo // 记录表单号 - pageType.value = 'detail' - loading.close() - }).catch(() => { - loading.close() - }) - } - // 保存 - else if (pageType.value === 'edit') { // 编辑 - updateResumeWeekMonthList(params).then((res) => { - ElMessage.success('保存成功') - pageType.value = 'detail' - loading.close() - }).catch(() => { - loading.close() - }) - } - } - else { - console.log('表单校验不通过') - } - }) + if (!useCheckList(list.value, columns.value, '维护保养信息', 'remark', 'result', '0')) { + return false + } + ElMessage.info('敬请期待') + // ruleFormRef.value!.validate((valid: boolean) => { + // if (valid) { + // const loading = ElLoading.service({ + // lock: true, + // background: 'rgba(255, 255, 255, 0.8)', + // }) + // let checkResult // 检查结果 + // const index = list.value.findIndex(item => item.result === '0') + // if (index !== -1) { + // checkResult = '2' + // } + // else { + // checkResult = '1' + // } + // const params = { + // ...form.value, + // id: props.infoId, + // checkResult, // 检查结果,1全部正常、2不正常 + // maintainType: props.maintainType, // 类型 1周维护、2月保养 + // dustAbnormalReason: list.value[0].result === '0' ? list.value[0].reason : '', // 除尘除潮不正常原因 + // appearanceAbnormalReason: list.value[1].result === '0' ? list.value[1].reason : '', // 外观检查不正常原因 + // workAbnormalReason: list.value[2].result === '0' ? list.value[2].reason : '', // 工作正常性检查不正常原因 + // performanceAbnormalReason: list.value[3].result === '0' ? list.value[3].reason : '', // 性能测试不正常原因 + // attachmentAbnormalReason: list.value[4].result === '0' ? list.value[4].reason : '', // 备附件和资料检查不正常原因 + // } + // // 新建 + // if (pageType.value === 'add') { // 新建 + // addResumeWeekMonthList(params).then((res) => { + // ElMessage.success('保存成功') + // form.value.logNo = res.data.logNo // 记录表单号 + // pageType.value = 'detail' + // loading.close() + // }).catch(() => { + // loading.close() + // }) + // } + // // 保存 + // else if (pageType.value === 'edit') { // 编辑 + // updateResumeWeekMonthList(params).then((res) => { + // ElMessage.success('保存成功') + // pageType.value = 'detail' + // loading.close() + // }).catch(() => { + // loading.close() + // }) + // } + // } + // else { + // console.log('表单校验不通过') + // } + // }) } // -------------------------------------------获取详情信息-------------------------------------------------- @@ -206,60 +211,6 @@ }) getInfo({ id: props.infoId! }).then((res) => { form.value = res.data - - list.value = [ - { - id: '1', - item: '除尘除潮', - content: '对设备表面进行除尘、清洁、加点除潮', - require: '无积尘、无受潮', - method: '用拧干的湿毛巾对标准设备进行擦拭。设备加电', - result: res.data.dustAbnormalReason ? '0' : '1', - normalContent: '除尘、清洁、设备加电除潮', - reason: res.data.dustAbnormalReason, - }, - { - id: '2', - item: '外观检查', - content: '检查标准设备外观和状态标识', - require: '1)外观完整。连接头安装牢固,设备无影响正常工作的机械损伤;\n2)各按键、开关、旋钮旋转灵活,定位准确。连接器应安装牢固,设备无影响正常工作的机械损伤。 \n3)状态标识清晰、完好', - method: '目视、手动检查。不满足要求时查找原因或更换状态标识', - result: res.data.appearanceAbnormalReason ? '0' : '1', - normalContent: '外观良好', - reason: res.data.appearanceAbnormalReason, - }, - { - id: '3', - item: '工作正常性检查', - content: '检查标准设备各功能,能否正常工作', - require: '1)控制开关通断分明,转换清晰。\n2)相应的指示灯应发亮,显示功能正常', - method: '1)调节各按钮、开关、旋钮\n2)观察相应的指示灯是否发亮、显示功能是否正常', - result: res.data.workAbnormalReason ? '0' : '1', - normalContent: '工作正常性检查正常', - reason: res.data.workAbnormalReason, - }, - { - id: '4', - item: '性能测试', - content: '检查测量标准功能是否正常,', - require: '1)系统自检正常\n2)校准因子测试', - method: '设备开机启动正常\n2)测试功率计功率因子', - result: res.data.performanceAbnormalReason ? '0' : '1', - normalContent: '维护正常,校准因子测试正常', - reason: res.data.performanceAbnormalReason, - }, - { - id: '5', - item: '备附件和资料检查', - content: '1)标准档案一套', - require: '1)备附件和资料是否齐全', - method: '1)对照档案目录,检查资料是否齐全', - result: res.data.attachmentAbnormalReason ? '0' : '1', - normalContent: '备附件和资料齐全', - reason: res.data.attachmentAbnormalReason, - }, - ] - loading.close() }) } @@ -269,13 +220,61 @@ }, { immediate: true }) onMounted(async () => { + await getDict() form.value.createUserId = user.id// 创建人 form.value.createUserName = user.name // 创建人名字 form.value.deptId = user.deptId // 记录人部门id form.value.deptName = user.deptName // 记录人部门 form.value.createTime = dayjs().format('YYYY-MM-DD HH-mm:ss')// 记录时间 + form.value.logName = props.title // 文件名称 + form.value.labCode = user.bizLabCode // 实验室 + form.value.labCodeName = user.labCodeName // 实验室名称 + form.value.groupCode = user.groupNo // 部门名称 + form.value.groupCodeName = user.groupName // 部门名称 if (pageType.value !== 'add') { - fetchInfo() + // fetchInfo() + } + else { // 新建 + // 在这里,如果是从待维护跳转过来,则渲染从列表页带来的默认配置 + list.value = [ + { + id: '1', + item: '清理卫生', + result: '1', + remark: '', // 备注 + }, + { + id: '2', + item: '外观检查', + result: '1', + remark: '', // 备注 + }, { + id: '3', + item: '外观检查', + result: '1', + remark: '', // 备注 + }, { + id: '4', + item: '功能性检查', + result: '1', + remark: '', // 备注 + }, { + id: '5', + item: '油液检查', + result: '1', + remark: '', // 备注 + }, { + id: '6', + item: '软件病毒查杀、系统升级', + result: '1', + remark: '', // 备注 + }, { + id: '7', + item: '备附件和资料齐全', + result: '1', + remark: '', // 备注 + }, + ] // 维护保养信息 } }) @@ -285,21 +284,12 @@ + + diff --git a/src/assets/icons/icon-batch-ignore.svg b/src/assets/icons/icon-batch-ignore.svg new file mode 100644 index 0000000..f29251a --- /dev/null +++ b/src/assets/icons/icon-batch-ignore.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/icon-config.svg b/src/assets/icons/icon-config.svg new file mode 100644 index 0000000..818dbb4 --- /dev/null +++ b/src/assets/icons/icon-config.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue b/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue new file mode 100644 index 0000000..979ba98 --- /dev/null +++ b/src/views/equipement/info/book/dialog/configWeekAndMonthDialog.vue @@ -0,0 +1,280 @@ + + + + + + + diff --git a/src/views/equipement/info/book/list.vue b/src/views/equipement/info/book/list.vue index e53e608..a2f5f1f 100644 --- a/src/views/equipement/info/book/list.vue +++ b/src/views/equipement/info/book/list.vue @@ -7,6 +7,7 @@ import dayjs from 'dayjs' import type { IList, IListQuery } from './book-interface' import delReasonDialog from './dialog/delReasonDialog.vue' +import configWeekAndMonthDialog from './dialog/configWeekAndMonthDialog.vue' import { approvalDelete, batchImport, cancelApproval, draftDelete, getEquipmentList, getStream, refuseApproval, submit } from '@/api/equipment/info/book' import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import type { deptType } from '@/global' @@ -376,6 +377,13 @@ fetchData(true) }) } + +// ----------------------------------------------配置周维护月保养------------------------------------------------------ +const configWeekAndMonthDialogRef = ref() +// 点击配置周维护、月保养 +const config = () => { + configWeekAndMonthDialogRef.value.initDialog() +} // ----------------------------------------------钩子------------------------------------------------------ watch(dateRange, (val) => { if (val) { @@ -389,7 +397,6 @@ }) // 只有审批给看审批状态 -// -----------------------------------------钩子-------------------------------------------------- watch(() => active.value, (val) => { if (val === '10') { // 审批把审批状态加上 if (columns.value[columns.value.length - 1].value !== 'approvalStatusName') { @@ -501,6 +508,7 @@ + @@ -622,6 +630,8 @@ + + diff --git a/src/views/equipement/resume/week/components/templateDetail.vue b/src/views/equipement/resume/week/components/templateDetail.vue index fcd41fe..89e5bcd 100644 --- a/src/views/equipement/resume/week/components/templateDetail.vue +++ b/src/views/equipement/resume/week/components/templateDetail.vue @@ -5,9 +5,9 @@ import { ElLoading, ElMessage } from 'element-plus' import type { IForm } from '../week-interface' import useUserStore from '@/store/modules/user' -import { getDictByCode } from '@/api/system/dict' -import type { dictType } from '@/global' import SelectEquipmentDialog from '@/views/business/fieldTest/approve/dialog/selectEquipmentDialog.vue' +import { getDictByCode } from '@/api/system/dict' +import type { deptType, dictType } from '@/global' import { useCheckList } from '@/commonMethods/useCheckList' import { useDoubleClickTableRow, useSetAllRowReadable } from '@/commonMethods/useSetAllRowReadable' import { addResumeWeekMonthList, getInfo, updateResumeWeekMonthList } from '@/api/equipment/resume/week-month' @@ -39,162 +39,167 @@ const form = ref({ logNo: '', // 记录编号 logName: '', // 记录名称 + labCodeName: '', // 实验室 + labCode: '', // 实验室 + groupCode: '', // 部门 + groupCodeName: '', // 部门名称 createUserId: '', // 记录人id + equipmentName: '', // 设备名称 createUserName: '', // 记录人 createTime: '', // 记录时间 - deptId: '', // 记录部门id - deptName: '', // 记录部门 - dustAbnormalReason: '', // 除尘除潮不正常原因 - appearanceAbnormalReason: '', // 外观检查不正常原因 - workAbnormalReason: '', // 工作正常性检查不正常原因 - performanceAbnormalReason: '', // 性能测试不正常原因 - attachmentAbnormalReason: '', // 备附件和资料检查不正常原因 - checkResult: '', // 检查结果 remark: '', // 备注 + checkResult: '', // 检查结果 }) // 校验规则 const formRules = ref({ - logName: [{ required: true, message: '记录名称不能为空', trigger: ['blur', 'change'] }], + groupCode: [{ required: true, message: '部门不能为空', trigger: ['blur', 'change'] }], + labCode: [{ required: true, message: '实验室不能为空', trigger: ['blur', 'change'] }], }) const loading = ref(false) + +// ------------------------------------------字典---------------------------------------------- +const useDeptList = ref([]) // 所属部门列表 +const useDeptDict = ref([]) as any // 所属部门字典 +const labNameList = ref([]) // 实验室列表 +const labNameDict = ref([]) as any // 实验室字典 +/** + * 获取字典 + */ +async function getDict() { + // 实验室 + const responseLab = await getDictByCode('bizGroupCodeEquipment') + labNameList.value = responseLab.data + labNameList.value.forEach((item) => { + labNameDict.value[item.value] = item.name + }) + // 部门 + const responseDept = await getDictByCode('bizGroupCode') + useDeptList.value = responseDept.data + responseDept.data.forEach((item: any) => { + useDeptDict.value[item.value] = item.name + }) +} // -------------------------------------------表格---------------------------------------------- const columns = ref([ // 表头 - { text: '维护项目', value: 'item', align: 'center' }, - { text: '内容', value: 'content', align: 'center' }, - { text: '要求', value: 'require', align: 'center' }, - { text: '方法', value: 'method', align: 'center' }, + { text: '维护项目', value: 'item', align: 'center', required: true }, { text: '检查结果', value: 'result', align: 'center', required: true, width: '180' }, - { text: '试验装备管理使用档案填写内容', value: 'reason', align: 'center' }, + { text: '备注', value: 'remark', align: 'center', required: true }, ]) -const list = ref([ - { - id: '1', - item: '除尘除潮', - content: '对设备表面进行除尘、清洁、加点除潮', - require: '无积尘、无受潮', - method: '用拧干的湿毛巾对标准设备进行擦拭。设备加电', +const list = ref([]) as any // 表格数据 +const checkoutList = ref([]) as any // 多选表格数据 +// 选中 +const handleSelectionChange = (e: any) => { + checkoutList.value = e +} +// 增加行 +const addRow = () => { + list.value.push({ + item: '', result: '1', - normalContent: '除尘、清洁、设备加电除潮', - reason: '', - }, - { - id: '2', - item: '外观检查', - content: '检查标准设备外观和状态标识', - require: '1)外观完整。连接头安装牢固,设备无影响正常工作的机械损伤;\n2)各按键、开关、旋钮旋转灵活,定位准确。连接器应安装牢固,设备无影响正常工作的机械损伤。 \n3)状态标识清晰、完好', - method: '目视、手动检查。不满足要求时查找原因或更换状态标识', - result: '1', - normalContent: '外观良好', - reason: '', - }, - { - id: '3', - item: '工作正常性检查', - content: '检查标准设备各功能,能否正常工作', - require: '1)控制开关通断分明,转换清晰。\n2)相应的指示灯应发亮,显示功能正常', - method: '1)调节各按钮、开关、旋钮\n2)观察相应的指示灯是否发亮、显示功能是否正常', - result: '1', - normalContent: '工作正常性检查正常', - reason: '', - }, - { - id: '4', - item: '性能测试', - content: '检查测量标准功能是否正常,', - require: '1)系统自检正常\n2)校准因子测试', - method: '设备开机启动正常\n2)测试功率计功率因子', - result: '1', - normalContent: '维护正常,校准因子测试正常', - reason: '', - }, - { - id: '5', - item: '备附件和资料检查', - content: '1)标准档案一套', - require: '1)备附件和资料是否齐全', - method: '1)对照档案目录,检查资料是否齐全', - result: '1', - normalContent: '备附件和资料齐全', - reason: '', - }, -]) // 维护保养信息 + remark: '', + customer: true, + }) +} +// 删除行 +const deleteRow = () => { + if (!checkoutList.value.length) { + ElMessage({ + message: '请选中要删除的行', + type: 'warning', + }) + return false + } + list.value = list.value.filter((item: any) => { + return !checkoutList.value.includes(item) + }) +} +// --------------------------------------选择设备------------------------------------------------- +const selectEquipmentDialogRef = ref() + +// 批量添加 +const selectEquipment = () => { + selectEquipmentDialogRef.value.initDialog() +} + +// 确定选择设备 +const confirmSelectEquipment = (list = []) => { + if (Array.isArray(list) && list.length) { + form.value.equipmentName = list[0].equipmentName + list[0].model + list[0].manufactureNo + } +} // -------------------------------------------按钮---------------------------------------------- // 关闭新增页面的回调 const close = () => { $router.back() } -// 导出word -const exportWord = () => { ElMessage.info('敬请期待') } - // 导出pdf -const exportPdf = () => { ElMessage.info('敬请期待') } - -// 打印 -const print = () => { ElMessage.info('敬请期待') } - -// 点击编辑按钮 -const edit = () => { - pageType.value = 'edit' +const exportPdf = () => { + ElMessage.info('敬请期待') } // 保存 const save = () => { - if (!useCheckList(list.value, columns.value, '维护保养信息', 'reason', 'result', '0')) { + if (!list.value.length) { + ElMessage.warning('维护保养信息不能为空') return false } - ruleFormRef.value!.validate((valid: boolean) => { - if (valid) { - const loading = ElLoading.service({ - lock: true, - background: 'rgba(255, 255, 255, 0.8)', - }) - let checkResult // 检查结果 - const index = list.value.findIndex(item => item.result === '0') - if (index !== -1) { - checkResult = '2' - } - else { - checkResult = '1' - } - const params = { - ...form.value, - id: props.infoId, - checkResult, // 检查结果,1全部正常、2不正常 - maintainType: props.maintainType, // 类型 1周维护、2月保养 - dustAbnormalReason: list.value[0].result === '0' ? list.value[0].reason : '', // 除尘除潮不正常原因 - appearanceAbnormalReason: list.value[1].result === '0' ? list.value[1].reason : '', // 外观检查不正常原因 - workAbnormalReason: list.value[2].result === '0' ? list.value[2].reason : '', // 工作正常性检查不正常原因 - performanceAbnormalReason: list.value[3].result === '0' ? list.value[3].reason : '', // 性能测试不正常原因 - attachmentAbnormalReason: list.value[4].result === '0' ? list.value[4].reason : '', // 备附件和资料检查不正常原因 - } - // 新建 - if (pageType.value === 'add') { // 新建 - addResumeWeekMonthList(params).then((res) => { - ElMessage.success('保存成功') - form.value.logNo = res.data.logNo // 记录表单号 - pageType.value = 'detail' - loading.close() - }).catch(() => { - loading.close() - }) - } - // 保存 - else if (pageType.value === 'edit') { // 编辑 - updateResumeWeekMonthList(params).then((res) => { - ElMessage.success('保存成功') - pageType.value = 'detail' - loading.close() - }).catch(() => { - loading.close() - }) - } - } - else { - console.log('表单校验不通过') - } - }) + if (!useCheckList(list.value, columns.value, '维护保养信息', 'remark', 'result', '0')) { + return false + } + ElMessage.info('敬请期待') + // ruleFormRef.value!.validate((valid: boolean) => { + // if (valid) { + // const loading = ElLoading.service({ + // lock: true, + // background: 'rgba(255, 255, 255, 0.8)', + // }) + // let checkResult // 检查结果 + // const index = list.value.findIndex(item => item.result === '0') + // if (index !== -1) { + // checkResult = '2' + // } + // else { + // checkResult = '1' + // } + // const params = { + // ...form.value, + // id: props.infoId, + // checkResult, // 检查结果,1全部正常、2不正常 + // maintainType: props.maintainType, // 类型 1周维护、2月保养 + // dustAbnormalReason: list.value[0].result === '0' ? list.value[0].reason : '', // 除尘除潮不正常原因 + // appearanceAbnormalReason: list.value[1].result === '0' ? list.value[1].reason : '', // 外观检查不正常原因 + // workAbnormalReason: list.value[2].result === '0' ? list.value[2].reason : '', // 工作正常性检查不正常原因 + // performanceAbnormalReason: list.value[3].result === '0' ? list.value[3].reason : '', // 性能测试不正常原因 + // attachmentAbnormalReason: list.value[4].result === '0' ? list.value[4].reason : '', // 备附件和资料检查不正常原因 + // } + // // 新建 + // if (pageType.value === 'add') { // 新建 + // addResumeWeekMonthList(params).then((res) => { + // ElMessage.success('保存成功') + // form.value.logNo = res.data.logNo // 记录表单号 + // pageType.value = 'detail' + // loading.close() + // }).catch(() => { + // loading.close() + // }) + // } + // // 保存 + // else if (pageType.value === 'edit') { // 编辑 + // updateResumeWeekMonthList(params).then((res) => { + // ElMessage.success('保存成功') + // pageType.value = 'detail' + // loading.close() + // }).catch(() => { + // loading.close() + // }) + // } + // } + // else { + // console.log('表单校验不通过') + // } + // }) } // -------------------------------------------获取详情信息-------------------------------------------------- @@ -206,60 +211,6 @@ }) getInfo({ id: props.infoId! }).then((res) => { form.value = res.data - - list.value = [ - { - id: '1', - item: '除尘除潮', - content: '对设备表面进行除尘、清洁、加点除潮', - require: '无积尘、无受潮', - method: '用拧干的湿毛巾对标准设备进行擦拭。设备加电', - result: res.data.dustAbnormalReason ? '0' : '1', - normalContent: '除尘、清洁、设备加电除潮', - reason: res.data.dustAbnormalReason, - }, - { - id: '2', - item: '外观检查', - content: '检查标准设备外观和状态标识', - require: '1)外观完整。连接头安装牢固,设备无影响正常工作的机械损伤;\n2)各按键、开关、旋钮旋转灵活,定位准确。连接器应安装牢固,设备无影响正常工作的机械损伤。 \n3)状态标识清晰、完好', - method: '目视、手动检查。不满足要求时查找原因或更换状态标识', - result: res.data.appearanceAbnormalReason ? '0' : '1', - normalContent: '外观良好', - reason: res.data.appearanceAbnormalReason, - }, - { - id: '3', - item: '工作正常性检查', - content: '检查标准设备各功能,能否正常工作', - require: '1)控制开关通断分明,转换清晰。\n2)相应的指示灯应发亮,显示功能正常', - method: '1)调节各按钮、开关、旋钮\n2)观察相应的指示灯是否发亮、显示功能是否正常', - result: res.data.workAbnormalReason ? '0' : '1', - normalContent: '工作正常性检查正常', - reason: res.data.workAbnormalReason, - }, - { - id: '4', - item: '性能测试', - content: '检查测量标准功能是否正常,', - require: '1)系统自检正常\n2)校准因子测试', - method: '设备开机启动正常\n2)测试功率计功率因子', - result: res.data.performanceAbnormalReason ? '0' : '1', - normalContent: '维护正常,校准因子测试正常', - reason: res.data.performanceAbnormalReason, - }, - { - id: '5', - item: '备附件和资料检查', - content: '1)标准档案一套', - require: '1)备附件和资料是否齐全', - method: '1)对照档案目录,检查资料是否齐全', - result: res.data.attachmentAbnormalReason ? '0' : '1', - normalContent: '备附件和资料齐全', - reason: res.data.attachmentAbnormalReason, - }, - ] - loading.close() }) } @@ -269,13 +220,61 @@ }, { immediate: true }) onMounted(async () => { + await getDict() form.value.createUserId = user.id// 创建人 form.value.createUserName = user.name // 创建人名字 form.value.deptId = user.deptId // 记录人部门id form.value.deptName = user.deptName // 记录人部门 form.value.createTime = dayjs().format('YYYY-MM-DD HH-mm:ss')// 记录时间 + form.value.logName = props.title // 文件名称 + form.value.labCode = user.bizLabCode // 实验室 + form.value.labCodeName = user.labCodeName // 实验室名称 + form.value.groupCode = user.groupNo // 部门名称 + form.value.groupCodeName = user.groupName // 部门名称 if (pageType.value !== 'add') { - fetchInfo() + // fetchInfo() + } + else { // 新建 + // 在这里,如果是从待维护跳转过来,则渲染从列表页带来的默认配置 + list.value = [ + { + id: '1', + item: '清理卫生', + result: '1', + remark: '', // 备注 + }, + { + id: '2', + item: '外观检查', + result: '1', + remark: '', // 备注 + }, { + id: '3', + item: '外观检查', + result: '1', + remark: '', // 备注 + }, { + id: '4', + item: '功能性检查', + result: '1', + remark: '', // 备注 + }, { + id: '5', + item: '油液检查', + result: '1', + remark: '', // 备注 + }, { + id: '6', + item: '软件病毒查杀、系统升级', + result: '1', + remark: '', // 备注 + }, { + id: '7', + item: '备附件和资料齐全', + result: '1', + remark: '', // 备注 + }, + ] // 维护保养信息 } }) @@ -285,21 +284,12 @@ + + diff --git a/src/views/equipement/resume/week/list.vue b/src/views/equipement/resume/week/list.vue index ff049c9..a956f62 100644 --- a/src/views/equipement/resume/week/list.vue +++ b/src/views/equipement/resume/week/list.vue @@ -7,9 +7,12 @@ import type { IList, IListQuery } from './week-interface' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getDictByCode } from '@/api/system/dict' +import buttonBox from '@/components/buttonBox/buttonBox.vue' import type { deptType, dictType } from '@/global' import { batchDelete, getResumeWeekMonthList } from '@/api/equipment/resume/week-month' const $router = useRouter() +const buttonBoxActive = 'equipmentResumeWeek' // 存储在sessionstorage里面的字段名,用于记录右上角buttonbox点击状态 +const active = ref('') const loadingTable = ref(false) // 查询条件 const listQuery: Ref = ref({ @@ -23,28 +26,67 @@ offset: 1, }) const dateRange = ref<[DateModelType, DateModelType]>(['', ''])// 筛选时间段数据 -// 表头 -const columns = ref([ - { text: '记录编号', value: 'logNo', align: 'center', width: '180' }, - { text: '记录名称', value: 'logName', align: 'center' }, - { text: '检查结果', value: 'checkResultName', align: 'center', width: '90' }, - { text: '记录部门', value: 'deptName', align: 'center' }, +const columns = ref([ // 表头-待维护 + { text: '设备名称', value: 'equipmentName', align: 'center' }, + { text: '规格型号', value: 'model', align: 'center' }, + { text: '出厂编号', value: 'manufactureNo', align: 'center' }, + { text: '生产厂家', value: 'manufacturer', align: 'center' }, + { text: '实验室', value: 'labCodeName', align: 'center' }, + { text: '部门', value: 'groupCodeName', align: 'center' }, + { text: '负责人', value: 'directorName', align: 'center', width: '120' }, + { text: '使用状态', value: 'usageStatusName', align: 'center', width: '90' }, + { text: '溯源单位', value: 'traceCompany', align: 'center' }, + { text: '检定有效期', value: 'measureValidDate', align: 'center', width: '120' }, + { text: '所属标准装置', value: 'meterStandardName', align: 'center', width: '120' }, + { text: '最近一次周维护时间', value: 'zhyczwhsj', align: 'center', width: '180' }, +]) + +const columnsAllRecord = ref([ // 表头-全部维护记录 + { text: '文件编号', value: 'logNo', align: 'center', width: '160' }, + { text: '文件名称', value: 'logName', align: 'center' }, + { text: '实验室', value: 'labCodeName', align: 'center' }, + { text: '部门', value: 'groupCodeName', align: 'center' }, { text: '记录人', value: 'createUserName', align: 'center' }, + { text: '设备名称', value: 'equipmentName', align: 'center' }, { text: '记录时间', value: 'createTime', align: 'center', width: '180' }, + { text: '检查结果', value: 'checkResultName', align: 'center' }, ]) const list = ref([]) // 列表 const total = ref(0) // 数据总条数 // 选中的内容 const checkoutList = ref([]) +const menu = ref([ + { + id: '1', + value: '1', + name: '待维护', + }, + { + id: '2', + value: '2', + name: '全部维护记录', + }, +]) // 审批状态按钮组合 // -----------------------------------------字典-------------------------------------------------------------- -const checkResultList = ref([]) // 标准类型 - +const checkResultList = ref([]) // 检查结果 +const useDeptList = ref([]) // 所属部门列表 +const labDeptList = ref([]) // 实验室 // 查询字典 const getDict = async () => { + // 检查结果 getDictByCode('bizMaintainCheckResult').then((response) => { checkResultList.value = response.data }) + // 实验室 + getDictByCode('bizGroupCodeEquipment').then((response) => { + labDeptList.value = response.data + }) + + // 部门 + getDictByCode('bizGroupCode').then((response) => { + useDeptList.value = response.data + }) } // --------------------------------------------------------------------------------------------------------- // 多选发生改变时 @@ -54,21 +96,31 @@ // 数据查询 function fetchData(isNowPage = false) { - loadingTable.value = true + loadingTable.value = false if (!isNowPage) { // 是否显示当前页,否则跳转第一页 listQuery.value.offset = 1 } - getResumeWeekMonthList(listQuery.value).then((response) => { - list.value = response.data.rows.map((item: { packingTime: string }) => { - return { - ...item, - packingTime: item.packingTime ? dayjs(item.packingTime).format('YYYY-MM-DD') : item.packingTime, - } - }) - total.value = parseInt(response.data.total) - loadingTable.value = false - }) + // getResumeWeekMonthList(listQuery.value).then((response) => { + // list.value = response.data.rows.map((item: { packingTime: string }) => { + // return { + // ...item, + // packingTime: item.packingTime ? dayjs(item.packingTime).format('YYYY-MM-DD') : item.packingTime, + // } + // }) + // total.value = parseInt(response.data.total) + // loadingTable.value = false + // }) + list.value = [ + { + equipmentName: '1', + logNo: '1', + }, + { + equipmentName: '2', + logNo: '2', + }, + ] } // 清除条件 const clearList = () => { @@ -97,6 +149,92 @@ }) } +// 导出 +const exportAll = () => { + ElMessage.info('敬请期待') + // const loading = ElLoading.service({ + // lock: true, + // text: '下载中请稍后', + // background: 'rgba(255, 255, 255, 0.8)', + // }) + // if (list.value.length > 0) { + // const params = { + // approvalStatus: listQuery.value.approvalStatus, // 审批状态类型code + // changeApplyNo: listQuery.value.changeApplyNo, // 申请单编号 + // changeReportName: listQuery.value.changeReportName, // 更换证书名称 + // changeReportNo: listQuery.value.changeReportNo, // 更换证书编号 + // changeType: listQuery.value.changeType, // 变更类型(字典code) + // createTimeEnd: listQuery.value.createTimeEnd, // 创建结束时间 + // createTimeStart: listQuery.value.createTimeStart, // 创建开始时间 + // createUserName: listQuery.value.createUserName, // 创建用户名字 + // formId: listQuery.value.formId, // formId + // offset: 1, + // limit: 20, + // ids: checkoutList.value, + // } + // exportChangeCertApplyList(params).then((res) => { + // const blob = new Blob([res.data]) + // exportFile(blob, '证书/报告补充或更换申请单.xlsx') + // loading.close() + // }) + // } + // else { + // loading.close() + // ElMessage.warning('无数据可导出数据') + // } +} + +// 批量忽略 +const bacthIgnore = (id = '') => { + if (!id && !checkoutList.value.length) { + ElMessage.warning('请至少选择一条数据') + return false + } + ElMessageBox.confirm( + '确认忽略所选操作吗?', + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }, + ) + .then(() => { + if (id) { // 单次操作 + ElMessage.info('敬请期待') + } + else { // 批量操作 + ElMessage.info('敬请期待') + } + }) +} + +// 批量记录 +const batchRecord = () => { + if (!checkoutList.value.length) { + ElMessage.warning('请至少选择一条数据') + return false + } + // 先比较所选的几个设备的默认配置是否相同,完全相同才可以进行编辑 + const comResult = true // 几个设备的默认配置完全相同 + if (comResult) { // 几个设备的默认配置完全相同 + ElMessage.info('敬请期待') + // const add = () => { + // $router.push({ + // path: 'week/add', + // query: { + // fromTab: 'toBeMaintained', + // }, + // }) + // } + } + else { // 几个设备的默认配置完全不同 + // ***********找到哪个设备不同************ + ElMessage.warning('***设备的默认维护项目不同,不支持批量操作。') + return false + } +} + // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 const changePage = (val: { size?: number; page?: number }) => { if (val && val.size) { @@ -131,6 +269,19 @@ }) }) break + case 'ignore': // 忽略本次 + // bacthIgnore(row.id) + bacthIgnore('1') + break + case 'record': // 周维护记录 + $router.push({ + path: 'week/add', + query: { + // 这里带上设备id,名称,型号,出厂编号 + fromTab: 'toBeMaintained', + }, + }) + break default: $router.push({ path: `week/${val}/${row.id}`, @@ -139,6 +290,14 @@ } } +// ---------------------------------------切换tab--------------------------------------------------------------------- +// 切换tab状态 +const changeCurrentButton = (val: string) => { + active.value = val // 此时的tab + window.sessionStorage.setItem(buttonBoxActive, val) // 记录tab状态 + clearList() // 刷新 +} + // ---------------------------------------钩子---------------------------------------------- watch(dateRange, (val) => { if (val) { @@ -154,6 +313,16 @@ await getDict() fetchData(false) }) + +onMounted(async () => { + await getDict() + if (window.sessionStorage.getItem(buttonBoxActive)) { + active.value = window.sessionStorage.getItem(buttonBoxActive)! + } + else { + active.value = menu.value.find(item => item.name === '待维护')!.id as string // 全部 + } +}) diff --git a/src/views/equipement/resume/week/components/templateDetail.vue b/src/views/equipement/resume/week/components/templateDetail.vue index fcd41fe..89e5bcd 100644 --- a/src/views/equipement/resume/week/components/templateDetail.vue +++ b/src/views/equipement/resume/week/components/templateDetail.vue @@ -5,9 +5,9 @@ import { ElLoading, ElMessage } from 'element-plus' import type { IForm } from '../week-interface' import useUserStore from '@/store/modules/user' -import { getDictByCode } from '@/api/system/dict' -import type { dictType } from '@/global' import SelectEquipmentDialog from '@/views/business/fieldTest/approve/dialog/selectEquipmentDialog.vue' +import { getDictByCode } from '@/api/system/dict' +import type { deptType, dictType } from '@/global' import { useCheckList } from '@/commonMethods/useCheckList' import { useDoubleClickTableRow, useSetAllRowReadable } from '@/commonMethods/useSetAllRowReadable' import { addResumeWeekMonthList, getInfo, updateResumeWeekMonthList } from '@/api/equipment/resume/week-month' @@ -39,162 +39,167 @@ const form = ref({ logNo: '', // 记录编号 logName: '', // 记录名称 + labCodeName: '', // 实验室 + labCode: '', // 实验室 + groupCode: '', // 部门 + groupCodeName: '', // 部门名称 createUserId: '', // 记录人id + equipmentName: '', // 设备名称 createUserName: '', // 记录人 createTime: '', // 记录时间 - deptId: '', // 记录部门id - deptName: '', // 记录部门 - dustAbnormalReason: '', // 除尘除潮不正常原因 - appearanceAbnormalReason: '', // 外观检查不正常原因 - workAbnormalReason: '', // 工作正常性检查不正常原因 - performanceAbnormalReason: '', // 性能测试不正常原因 - attachmentAbnormalReason: '', // 备附件和资料检查不正常原因 - checkResult: '', // 检查结果 remark: '', // 备注 + checkResult: '', // 检查结果 }) // 校验规则 const formRules = ref({ - logName: [{ required: true, message: '记录名称不能为空', trigger: ['blur', 'change'] }], + groupCode: [{ required: true, message: '部门不能为空', trigger: ['blur', 'change'] }], + labCode: [{ required: true, message: '实验室不能为空', trigger: ['blur', 'change'] }], }) const loading = ref(false) + +// ------------------------------------------字典---------------------------------------------- +const useDeptList = ref([]) // 所属部门列表 +const useDeptDict = ref([]) as any // 所属部门字典 +const labNameList = ref([]) // 实验室列表 +const labNameDict = ref([]) as any // 实验室字典 +/** + * 获取字典 + */ +async function getDict() { + // 实验室 + const responseLab = await getDictByCode('bizGroupCodeEquipment') + labNameList.value = responseLab.data + labNameList.value.forEach((item) => { + labNameDict.value[item.value] = item.name + }) + // 部门 + const responseDept = await getDictByCode('bizGroupCode') + useDeptList.value = responseDept.data + responseDept.data.forEach((item: any) => { + useDeptDict.value[item.value] = item.name + }) +} // -------------------------------------------表格---------------------------------------------- const columns = ref([ // 表头 - { text: '维护项目', value: 'item', align: 'center' }, - { text: '内容', value: 'content', align: 'center' }, - { text: '要求', value: 'require', align: 'center' }, - { text: '方法', value: 'method', align: 'center' }, + { text: '维护项目', value: 'item', align: 'center', required: true }, { text: '检查结果', value: 'result', align: 'center', required: true, width: '180' }, - { text: '试验装备管理使用档案填写内容', value: 'reason', align: 'center' }, + { text: '备注', value: 'remark', align: 'center', required: true }, ]) -const list = ref([ - { - id: '1', - item: '除尘除潮', - content: '对设备表面进行除尘、清洁、加点除潮', - require: '无积尘、无受潮', - method: '用拧干的湿毛巾对标准设备进行擦拭。设备加电', +const list = ref([]) as any // 表格数据 +const checkoutList = ref([]) as any // 多选表格数据 +// 选中 +const handleSelectionChange = (e: any) => { + checkoutList.value = e +} +// 增加行 +const addRow = () => { + list.value.push({ + item: '', result: '1', - normalContent: '除尘、清洁、设备加电除潮', - reason: '', - }, - { - id: '2', - item: '外观检查', - content: '检查标准设备外观和状态标识', - require: '1)外观完整。连接头安装牢固,设备无影响正常工作的机械损伤;\n2)各按键、开关、旋钮旋转灵活,定位准确。连接器应安装牢固,设备无影响正常工作的机械损伤。 \n3)状态标识清晰、完好', - method: '目视、手动检查。不满足要求时查找原因或更换状态标识', - result: '1', - normalContent: '外观良好', - reason: '', - }, - { - id: '3', - item: '工作正常性检查', - content: '检查标准设备各功能,能否正常工作', - require: '1)控制开关通断分明,转换清晰。\n2)相应的指示灯应发亮,显示功能正常', - method: '1)调节各按钮、开关、旋钮\n2)观察相应的指示灯是否发亮、显示功能是否正常', - result: '1', - normalContent: '工作正常性检查正常', - reason: '', - }, - { - id: '4', - item: '性能测试', - content: '检查测量标准功能是否正常,', - require: '1)系统自检正常\n2)校准因子测试', - method: '设备开机启动正常\n2)测试功率计功率因子', - result: '1', - normalContent: '维护正常,校准因子测试正常', - reason: '', - }, - { - id: '5', - item: '备附件和资料检查', - content: '1)标准档案一套', - require: '1)备附件和资料是否齐全', - method: '1)对照档案目录,检查资料是否齐全', - result: '1', - normalContent: '备附件和资料齐全', - reason: '', - }, -]) // 维护保养信息 + remark: '', + customer: true, + }) +} +// 删除行 +const deleteRow = () => { + if (!checkoutList.value.length) { + ElMessage({ + message: '请选中要删除的行', + type: 'warning', + }) + return false + } + list.value = list.value.filter((item: any) => { + return !checkoutList.value.includes(item) + }) +} +// --------------------------------------选择设备------------------------------------------------- +const selectEquipmentDialogRef = ref() + +// 批量添加 +const selectEquipment = () => { + selectEquipmentDialogRef.value.initDialog() +} + +// 确定选择设备 +const confirmSelectEquipment = (list = []) => { + if (Array.isArray(list) && list.length) { + form.value.equipmentName = list[0].equipmentName + list[0].model + list[0].manufactureNo + } +} // -------------------------------------------按钮---------------------------------------------- // 关闭新增页面的回调 const close = () => { $router.back() } -// 导出word -const exportWord = () => { ElMessage.info('敬请期待') } - // 导出pdf -const exportPdf = () => { ElMessage.info('敬请期待') } - -// 打印 -const print = () => { ElMessage.info('敬请期待') } - -// 点击编辑按钮 -const edit = () => { - pageType.value = 'edit' +const exportPdf = () => { + ElMessage.info('敬请期待') } // 保存 const save = () => { - if (!useCheckList(list.value, columns.value, '维护保养信息', 'reason', 'result', '0')) { + if (!list.value.length) { + ElMessage.warning('维护保养信息不能为空') return false } - ruleFormRef.value!.validate((valid: boolean) => { - if (valid) { - const loading = ElLoading.service({ - lock: true, - background: 'rgba(255, 255, 255, 0.8)', - }) - let checkResult // 检查结果 - const index = list.value.findIndex(item => item.result === '0') - if (index !== -1) { - checkResult = '2' - } - else { - checkResult = '1' - } - const params = { - ...form.value, - id: props.infoId, - checkResult, // 检查结果,1全部正常、2不正常 - maintainType: props.maintainType, // 类型 1周维护、2月保养 - dustAbnormalReason: list.value[0].result === '0' ? list.value[0].reason : '', // 除尘除潮不正常原因 - appearanceAbnormalReason: list.value[1].result === '0' ? list.value[1].reason : '', // 外观检查不正常原因 - workAbnormalReason: list.value[2].result === '0' ? list.value[2].reason : '', // 工作正常性检查不正常原因 - performanceAbnormalReason: list.value[3].result === '0' ? list.value[3].reason : '', // 性能测试不正常原因 - attachmentAbnormalReason: list.value[4].result === '0' ? list.value[4].reason : '', // 备附件和资料检查不正常原因 - } - // 新建 - if (pageType.value === 'add') { // 新建 - addResumeWeekMonthList(params).then((res) => { - ElMessage.success('保存成功') - form.value.logNo = res.data.logNo // 记录表单号 - pageType.value = 'detail' - loading.close() - }).catch(() => { - loading.close() - }) - } - // 保存 - else if (pageType.value === 'edit') { // 编辑 - updateResumeWeekMonthList(params).then((res) => { - ElMessage.success('保存成功') - pageType.value = 'detail' - loading.close() - }).catch(() => { - loading.close() - }) - } - } - else { - console.log('表单校验不通过') - } - }) + if (!useCheckList(list.value, columns.value, '维护保养信息', 'remark', 'result', '0')) { + return false + } + ElMessage.info('敬请期待') + // ruleFormRef.value!.validate((valid: boolean) => { + // if (valid) { + // const loading = ElLoading.service({ + // lock: true, + // background: 'rgba(255, 255, 255, 0.8)', + // }) + // let checkResult // 检查结果 + // const index = list.value.findIndex(item => item.result === '0') + // if (index !== -1) { + // checkResult = '2' + // } + // else { + // checkResult = '1' + // } + // const params = { + // ...form.value, + // id: props.infoId, + // checkResult, // 检查结果,1全部正常、2不正常 + // maintainType: props.maintainType, // 类型 1周维护、2月保养 + // dustAbnormalReason: list.value[0].result === '0' ? list.value[0].reason : '', // 除尘除潮不正常原因 + // appearanceAbnormalReason: list.value[1].result === '0' ? list.value[1].reason : '', // 外观检查不正常原因 + // workAbnormalReason: list.value[2].result === '0' ? list.value[2].reason : '', // 工作正常性检查不正常原因 + // performanceAbnormalReason: list.value[3].result === '0' ? list.value[3].reason : '', // 性能测试不正常原因 + // attachmentAbnormalReason: list.value[4].result === '0' ? list.value[4].reason : '', // 备附件和资料检查不正常原因 + // } + // // 新建 + // if (pageType.value === 'add') { // 新建 + // addResumeWeekMonthList(params).then((res) => { + // ElMessage.success('保存成功') + // form.value.logNo = res.data.logNo // 记录表单号 + // pageType.value = 'detail' + // loading.close() + // }).catch(() => { + // loading.close() + // }) + // } + // // 保存 + // else if (pageType.value === 'edit') { // 编辑 + // updateResumeWeekMonthList(params).then((res) => { + // ElMessage.success('保存成功') + // pageType.value = 'detail' + // loading.close() + // }).catch(() => { + // loading.close() + // }) + // } + // } + // else { + // console.log('表单校验不通过') + // } + // }) } // -------------------------------------------获取详情信息-------------------------------------------------- @@ -206,60 +211,6 @@ }) getInfo({ id: props.infoId! }).then((res) => { form.value = res.data - - list.value = [ - { - id: '1', - item: '除尘除潮', - content: '对设备表面进行除尘、清洁、加点除潮', - require: '无积尘、无受潮', - method: '用拧干的湿毛巾对标准设备进行擦拭。设备加电', - result: res.data.dustAbnormalReason ? '0' : '1', - normalContent: '除尘、清洁、设备加电除潮', - reason: res.data.dustAbnormalReason, - }, - { - id: '2', - item: '外观检查', - content: '检查标准设备外观和状态标识', - require: '1)外观完整。连接头安装牢固,设备无影响正常工作的机械损伤;\n2)各按键、开关、旋钮旋转灵活,定位准确。连接器应安装牢固,设备无影响正常工作的机械损伤。 \n3)状态标识清晰、完好', - method: '目视、手动检查。不满足要求时查找原因或更换状态标识', - result: res.data.appearanceAbnormalReason ? '0' : '1', - normalContent: '外观良好', - reason: res.data.appearanceAbnormalReason, - }, - { - id: '3', - item: '工作正常性检查', - content: '检查标准设备各功能,能否正常工作', - require: '1)控制开关通断分明,转换清晰。\n2)相应的指示灯应发亮,显示功能正常', - method: '1)调节各按钮、开关、旋钮\n2)观察相应的指示灯是否发亮、显示功能是否正常', - result: res.data.workAbnormalReason ? '0' : '1', - normalContent: '工作正常性检查正常', - reason: res.data.workAbnormalReason, - }, - { - id: '4', - item: '性能测试', - content: '检查测量标准功能是否正常,', - require: '1)系统自检正常\n2)校准因子测试', - method: '设备开机启动正常\n2)测试功率计功率因子', - result: res.data.performanceAbnormalReason ? '0' : '1', - normalContent: '维护正常,校准因子测试正常', - reason: res.data.performanceAbnormalReason, - }, - { - id: '5', - item: '备附件和资料检查', - content: '1)标准档案一套', - require: '1)备附件和资料是否齐全', - method: '1)对照档案目录,检查资料是否齐全', - result: res.data.attachmentAbnormalReason ? '0' : '1', - normalContent: '备附件和资料齐全', - reason: res.data.attachmentAbnormalReason, - }, - ] - loading.close() }) } @@ -269,13 +220,61 @@ }, { immediate: true }) onMounted(async () => { + await getDict() form.value.createUserId = user.id// 创建人 form.value.createUserName = user.name // 创建人名字 form.value.deptId = user.deptId // 记录人部门id form.value.deptName = user.deptName // 记录人部门 form.value.createTime = dayjs().format('YYYY-MM-DD HH-mm:ss')// 记录时间 + form.value.logName = props.title // 文件名称 + form.value.labCode = user.bizLabCode // 实验室 + form.value.labCodeName = user.labCodeName // 实验室名称 + form.value.groupCode = user.groupNo // 部门名称 + form.value.groupCodeName = user.groupName // 部门名称 if (pageType.value !== 'add') { - fetchInfo() + // fetchInfo() + } + else { // 新建 + // 在这里,如果是从待维护跳转过来,则渲染从列表页带来的默认配置 + list.value = [ + { + id: '1', + item: '清理卫生', + result: '1', + remark: '', // 备注 + }, + { + id: '2', + item: '外观检查', + result: '1', + remark: '', // 备注 + }, { + id: '3', + item: '外观检查', + result: '1', + remark: '', // 备注 + }, { + id: '4', + item: '功能性检查', + result: '1', + remark: '', // 备注 + }, { + id: '5', + item: '油液检查', + result: '1', + remark: '', // 备注 + }, { + id: '6', + item: '软件病毒查杀、系统升级', + result: '1', + remark: '', // 备注 + }, { + id: '7', + item: '备附件和资料齐全', + result: '1', + remark: '', // 备注 + }, + ] // 维护保养信息 } }) @@ -285,21 +284,12 @@ + + diff --git a/src/views/equipement/resume/week/list.vue b/src/views/equipement/resume/week/list.vue index ff049c9..a956f62 100644 --- a/src/views/equipement/resume/week/list.vue +++ b/src/views/equipement/resume/week/list.vue @@ -7,9 +7,12 @@ import type { IList, IListQuery } from './week-interface' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getDictByCode } from '@/api/system/dict' +import buttonBox from '@/components/buttonBox/buttonBox.vue' import type { deptType, dictType } from '@/global' import { batchDelete, getResumeWeekMonthList } from '@/api/equipment/resume/week-month' const $router = useRouter() +const buttonBoxActive = 'equipmentResumeWeek' // 存储在sessionstorage里面的字段名,用于记录右上角buttonbox点击状态 +const active = ref('') const loadingTable = ref(false) // 查询条件 const listQuery: Ref = ref({ @@ -23,28 +26,67 @@ offset: 1, }) const dateRange = ref<[DateModelType, DateModelType]>(['', ''])// 筛选时间段数据 -// 表头 -const columns = ref([ - { text: '记录编号', value: 'logNo', align: 'center', width: '180' }, - { text: '记录名称', value: 'logName', align: 'center' }, - { text: '检查结果', value: 'checkResultName', align: 'center', width: '90' }, - { text: '记录部门', value: 'deptName', align: 'center' }, +const columns = ref([ // 表头-待维护 + { text: '设备名称', value: 'equipmentName', align: 'center' }, + { text: '规格型号', value: 'model', align: 'center' }, + { text: '出厂编号', value: 'manufactureNo', align: 'center' }, + { text: '生产厂家', value: 'manufacturer', align: 'center' }, + { text: '实验室', value: 'labCodeName', align: 'center' }, + { text: '部门', value: 'groupCodeName', align: 'center' }, + { text: '负责人', value: 'directorName', align: 'center', width: '120' }, + { text: '使用状态', value: 'usageStatusName', align: 'center', width: '90' }, + { text: '溯源单位', value: 'traceCompany', align: 'center' }, + { text: '检定有效期', value: 'measureValidDate', align: 'center', width: '120' }, + { text: '所属标准装置', value: 'meterStandardName', align: 'center', width: '120' }, + { text: '最近一次周维护时间', value: 'zhyczwhsj', align: 'center', width: '180' }, +]) + +const columnsAllRecord = ref([ // 表头-全部维护记录 + { text: '文件编号', value: 'logNo', align: 'center', width: '160' }, + { text: '文件名称', value: 'logName', align: 'center' }, + { text: '实验室', value: 'labCodeName', align: 'center' }, + { text: '部门', value: 'groupCodeName', align: 'center' }, { text: '记录人', value: 'createUserName', align: 'center' }, + { text: '设备名称', value: 'equipmentName', align: 'center' }, { text: '记录时间', value: 'createTime', align: 'center', width: '180' }, + { text: '检查结果', value: 'checkResultName', align: 'center' }, ]) const list = ref([]) // 列表 const total = ref(0) // 数据总条数 // 选中的内容 const checkoutList = ref([]) +const menu = ref([ + { + id: '1', + value: '1', + name: '待维护', + }, + { + id: '2', + value: '2', + name: '全部维护记录', + }, +]) // 审批状态按钮组合 // -----------------------------------------字典-------------------------------------------------------------- -const checkResultList = ref([]) // 标准类型 - +const checkResultList = ref([]) // 检查结果 +const useDeptList = ref([]) // 所属部门列表 +const labDeptList = ref([]) // 实验室 // 查询字典 const getDict = async () => { + // 检查结果 getDictByCode('bizMaintainCheckResult').then((response) => { checkResultList.value = response.data }) + // 实验室 + getDictByCode('bizGroupCodeEquipment').then((response) => { + labDeptList.value = response.data + }) + + // 部门 + getDictByCode('bizGroupCode').then((response) => { + useDeptList.value = response.data + }) } // --------------------------------------------------------------------------------------------------------- // 多选发生改变时 @@ -54,21 +96,31 @@ // 数据查询 function fetchData(isNowPage = false) { - loadingTable.value = true + loadingTable.value = false if (!isNowPage) { // 是否显示当前页,否则跳转第一页 listQuery.value.offset = 1 } - getResumeWeekMonthList(listQuery.value).then((response) => { - list.value = response.data.rows.map((item: { packingTime: string }) => { - return { - ...item, - packingTime: item.packingTime ? dayjs(item.packingTime).format('YYYY-MM-DD') : item.packingTime, - } - }) - total.value = parseInt(response.data.total) - loadingTable.value = false - }) + // getResumeWeekMonthList(listQuery.value).then((response) => { + // list.value = response.data.rows.map((item: { packingTime: string }) => { + // return { + // ...item, + // packingTime: item.packingTime ? dayjs(item.packingTime).format('YYYY-MM-DD') : item.packingTime, + // } + // }) + // total.value = parseInt(response.data.total) + // loadingTable.value = false + // }) + list.value = [ + { + equipmentName: '1', + logNo: '1', + }, + { + equipmentName: '2', + logNo: '2', + }, + ] } // 清除条件 const clearList = () => { @@ -97,6 +149,92 @@ }) } +// 导出 +const exportAll = () => { + ElMessage.info('敬请期待') + // const loading = ElLoading.service({ + // lock: true, + // text: '下载中请稍后', + // background: 'rgba(255, 255, 255, 0.8)', + // }) + // if (list.value.length > 0) { + // const params = { + // approvalStatus: listQuery.value.approvalStatus, // 审批状态类型code + // changeApplyNo: listQuery.value.changeApplyNo, // 申请单编号 + // changeReportName: listQuery.value.changeReportName, // 更换证书名称 + // changeReportNo: listQuery.value.changeReportNo, // 更换证书编号 + // changeType: listQuery.value.changeType, // 变更类型(字典code) + // createTimeEnd: listQuery.value.createTimeEnd, // 创建结束时间 + // createTimeStart: listQuery.value.createTimeStart, // 创建开始时间 + // createUserName: listQuery.value.createUserName, // 创建用户名字 + // formId: listQuery.value.formId, // formId + // offset: 1, + // limit: 20, + // ids: checkoutList.value, + // } + // exportChangeCertApplyList(params).then((res) => { + // const blob = new Blob([res.data]) + // exportFile(blob, '证书/报告补充或更换申请单.xlsx') + // loading.close() + // }) + // } + // else { + // loading.close() + // ElMessage.warning('无数据可导出数据') + // } +} + +// 批量忽略 +const bacthIgnore = (id = '') => { + if (!id && !checkoutList.value.length) { + ElMessage.warning('请至少选择一条数据') + return false + } + ElMessageBox.confirm( + '确认忽略所选操作吗?', + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }, + ) + .then(() => { + if (id) { // 单次操作 + ElMessage.info('敬请期待') + } + else { // 批量操作 + ElMessage.info('敬请期待') + } + }) +} + +// 批量记录 +const batchRecord = () => { + if (!checkoutList.value.length) { + ElMessage.warning('请至少选择一条数据') + return false + } + // 先比较所选的几个设备的默认配置是否相同,完全相同才可以进行编辑 + const comResult = true // 几个设备的默认配置完全相同 + if (comResult) { // 几个设备的默认配置完全相同 + ElMessage.info('敬请期待') + // const add = () => { + // $router.push({ + // path: 'week/add', + // query: { + // fromTab: 'toBeMaintained', + // }, + // }) + // } + } + else { // 几个设备的默认配置完全不同 + // ***********找到哪个设备不同************ + ElMessage.warning('***设备的默认维护项目不同,不支持批量操作。') + return false + } +} + // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 const changePage = (val: { size?: number; page?: number }) => { if (val && val.size) { @@ -131,6 +269,19 @@ }) }) break + case 'ignore': // 忽略本次 + // bacthIgnore(row.id) + bacthIgnore('1') + break + case 'record': // 周维护记录 + $router.push({ + path: 'week/add', + query: { + // 这里带上设备id,名称,型号,出厂编号 + fromTab: 'toBeMaintained', + }, + }) + break default: $router.push({ path: `week/${val}/${row.id}`, @@ -139,6 +290,14 @@ } } +// ---------------------------------------切换tab--------------------------------------------------------------------- +// 切换tab状态 +const changeCurrentButton = (val: string) => { + active.value = val // 此时的tab + window.sessionStorage.setItem(buttonBoxActive, val) // 记录tab状态 + clearList() // 刷新 +} + // ---------------------------------------钩子---------------------------------------------- watch(dateRange, (val) => { if (val) { @@ -154,6 +313,16 @@ await getDict() fetchData(false) }) + +onMounted(async () => { + await getDict() + if (window.sessionStorage.getItem(buttonBoxActive)) { + active.value = window.sessionStorage.getItem(buttonBoxActive)! + } + else { + active.value = menu.value.find(item => item.name === '待维护')!.id as string // 全部 + } +})