diff --git a/src/views/tested/device/info/components/edit.vue b/src/views/tested/device/info/components/edit.vue index 53c3b17..a14ce57 100644 --- a/src/views/tested/device/info/components/edit.vue +++ b/src/views/tested/device/info/components/edit.vue @@ -17,6 +17,7 @@ import { uploadApi } from '@/api/system/notice' import useUserStore from '@/store/modules/user' import { getUserDept } from '@/api/system/user' +import { getDeviceNameList, getModelAllList, getModelList } from '@/api/eqpt/device/model' const $route = useRoute() const $router = useRouter() const userStore = useUserStore() @@ -40,6 +41,7 @@ approvalType: '', // 申请审批类型(1新增2编辑3删除) approvalTypeName: '', // 申请审批类型名称 attachments: [], // 主附件信息列表 + taskInfos: [], // 参试任务 category: '', // 设备分类(字典code) certificateValid: '', // 证书有效期 checkCycle: '', // 检定周期(月) @@ -80,6 +82,7 @@ usageStatus: '', // 使用状态(字典code) usePosition: '', // 使用岗位 useSign: '', // 在用信息(字典code) + helpInstruction: '', // 辅助字段 companyName: '', certificateList: [], }) // 表单 @@ -93,7 +96,6 @@ testTask.value.push('') } const radio = ref('基本信息') -console.log($route, 'route') // 表单1验证规则 const rules1 = ref({ equipmentName: [{ required: true, message: '设备名称必填', trigger: ['blur', 'change'] }], @@ -103,10 +105,11 @@ productCountry: [{ required: true, message: '生产国家必填', trigger: ['blur', 'change'] }], manufacturer: [{ required: true, message: '生产厂家必填', trigger: ['blur', 'change'] }], manufactureNo: [{ required: true, message: '生产编号必填', trigger: ['blur', 'change'] }], - productDate: [{ required: true, message: '生产日期必选', trigger: ['blur', 'change'] }], - unitPrice: [{ required: true, message: '设备单价必填', trigger: ['blur', 'change'] }], - purchaseDate: [{ required: true, message: '购进日期必选', trigger: ['blur', 'change'] }], + // productDate: [{ required: true, message: '生产日期必选', trigger: ['blur', 'change'] }], + // unitPrice: [{ required: true, message: '设备单价必填', trigger: ['blur', 'change'] }], + // purchaseDate: [{ required: true, message: '购进日期必选', trigger: ['blur', 'change'] }], model: [{ required: true, message: '型号规格必填', trigger: ['blur', 'change'] }], + helpInstruction: [{ required: true, message: '辅助字段必选', trigger: ['blur', 'change'] }], qualityCondition: [{ required: true, message: '质量状况必填', trigger: ['blur', 'change'] }], deptId: [{ required: true, message: '使用部门必选', trigger: ['blur', 'change'] }], category: [{ required: true, message: '设备分类必选', trigger: ['blur', 'change'] }], @@ -129,6 +132,13 @@ const deviceTypeList = ref<{ id: string; value: string; name: string }[]>() // 设备分类 const inUseList = ref<{ id: string; value: string; name: string }[]>() // 设备在用信息 const meterIdentifyList = ref<{ id: string; value: string; name: string }[]>() // 计量标识 +// 设备名称 +const deviceNameList = ref([]) +// 规格型号 +const modelList = ref([]) +// 辅助字段 +const helpList = ref([]) +const allList = ref([]) const fetchSelectData = () => { getDictByCode('eqptDeviceUseStatus').then((res) => { useStatusList.value = res.data @@ -145,8 +155,54 @@ getDictByCode('eqptMeterIdentify').then((res) => { meterIdentifyList.value = res.data }) + // 设备名称 + getDeviceNameList().then((res) => { + deviceNameList.value = res.data + }) + // 规格型号及辅助字段 + getModelAllList({}).then((res) => { + allList.value = res.data + modelList.value = res.data + helpList.value = res.data.filter((item: any) => item.helpInstruction) + }) } fetchSelectData() +// 监听设备名称下拉框,修改规格型号和辅助字段 +watch(() => ruleForm.value.equipmentName, (newVal) => { + if (newVal) { + ruleForm.value.helpInstruction = '' + ruleForm.value.model = '' + // 修改规格型号和辅助字段列表 + const data = allList.value.filter(item => item.equipmentName === newVal) + modelList.value = data + helpList.value = data.filter(item => item.helpInstruction) + } +}) +// 监听规格型号下拉框,修改辅助字段 +watch(() => ruleForm.value.model, (newVal) => { + if (newVal) { + ruleForm.value.helpInstruction = '' + // 修改规格型号和辅助字段列表 + helpList.value = helpList.value.filter(item => item.model === newVal) + } +}) +// 设备相关,填充数据 +watch(() => ruleForm.value, (newVal) => { + if (ruleForm.value.helpInstruction && ruleForm.value.model && ruleForm.value.equipmentName) { + console.log('自动') + const arr = allList.value.filter((item: any) => item.helpInstruction === ruleForm.value.helpInstruction && item.model === ruleForm.value.model && item.equipmentName === ruleForm.value.equipmentName) + if (arr.length) { + const data = arr[0] + ruleForm.value.category = data.category + ruleForm.value.remark = data.remark + ruleForm.value.technicalTargetList = data.technicalTargetList + ruleForm.value.checkCycle = data.checkCycle + } + } +}, { + deep: true, + // immediate: true, +}) // 加载组织机构树形下拉 const deptTreeList = ref() const fetchDeptTree = () => { @@ -186,17 +242,17 @@ getInfoDetail({ equipmentId: $route.query.id as string }).then((res) => { ruleForm.value = res.data console.log(res.data, 'res.data') - if (ruleForm.value.testTask) { - if (ruleForm.value.testTask.includes(',')) { - testTask.value = ruleForm.value.testTask.split(',') - } - else { - testTask.value = [ruleForm.value.testTask] - } - } - else { - testTask.value = [''] - } + // if (ruleForm.value.testTask) { + // if (ruleForm.value.testTask.includes(',')) { + // testTask.value = ruleForm.value.testTask.split(',') + // } + // else { + // testTask.value = [ruleForm.value.testTask] + // } + // } + // else { + // testTask.value = [''] + // } if ($route.params.type === 'update') { ruleForm.value.approvalType = '2' ruleForm.value.approvalTypeName = '编辑设备' @@ -211,17 +267,17 @@ else { getApprovalDetail({ id: $route.query.id as string }).then((res) => { ruleForm.value = res.data - if (ruleForm.value.testTask) { - if (ruleForm.value.testTask.includes(',')) { - testTask.value = ruleForm.value.testTask.split(',') - } - else { - testTask.value = [ruleForm.value.testTask] - } - } - else { - testTask.value = [''] - } + // if (ruleForm.value.testTask) { + // if (ruleForm.value.testTask.includes(',')) { + // testTask.value = ruleForm.value.testTask.split(',') + // } + // else { + // testTask.value = [ruleForm.value.testTask] + // } + // } + // else { + // testTask.value = [''] + // } }) // ruleForm.value = JSON.parse($route.query.row as string) } @@ -410,6 +466,23 @@ const filterData = data.filter(item => item !== fileName) ruleForm.value.instructionsFile = filterData.length ? filterData.join(',') : '' } +// 删除参试任务 +const delHandler = (row: any) => { + // ruleForm.taskInfos + console.log(row, 'row') + ElMessageBox.confirm( + `确认删除${row.taskName}吗?`, + '确认', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }, + ).then(() => { + ruleForm.value.taskInfos = ruleForm.value.taskInfos.filter((item: any) => item.id !== row.id) + ElMessage.success('操作成功') + }) +} const print = () => { } @@ -483,29 +556,34 @@ > - - - - - - - - - - - - + + + - - - + + + + + + + + + + + + + + + + + @@ -519,11 +597,6 @@ - - - - - + + + + + @@ -543,30 +624,29 @@ - - + + + + - + - - + + @@ -574,20 +654,27 @@ - + - + + + + + + + + @@ -595,6 +682,11 @@ + + + + + @@ -645,9 +737,6 @@ - - - @@ -679,11 +768,10 @@ - - - - - + + + + @@ -696,7 +784,7 @@ - + + + + + + + + + + + + + + + - + @@ -717,6 +827,9 @@ + + + @@ -739,6 +852,6 @@ } .margin { - padding: 10px 10px; + padding: 10px; } diff --git a/src/views/tested/device/info/components/edit.vue b/src/views/tested/device/info/components/edit.vue index 53c3b17..a14ce57 100644 --- a/src/views/tested/device/info/components/edit.vue +++ b/src/views/tested/device/info/components/edit.vue @@ -17,6 +17,7 @@ import { uploadApi } from '@/api/system/notice' import useUserStore from '@/store/modules/user' import { getUserDept } from '@/api/system/user' +import { getDeviceNameList, getModelAllList, getModelList } from '@/api/eqpt/device/model' const $route = useRoute() const $router = useRouter() const userStore = useUserStore() @@ -40,6 +41,7 @@ approvalType: '', // 申请审批类型(1新增2编辑3删除) approvalTypeName: '', // 申请审批类型名称 attachments: [], // 主附件信息列表 + taskInfos: [], // 参试任务 category: '', // 设备分类(字典code) certificateValid: '', // 证书有效期 checkCycle: '', // 检定周期(月) @@ -80,6 +82,7 @@ usageStatus: '', // 使用状态(字典code) usePosition: '', // 使用岗位 useSign: '', // 在用信息(字典code) + helpInstruction: '', // 辅助字段 companyName: '', certificateList: [], }) // 表单 @@ -93,7 +96,6 @@ testTask.value.push('') } const radio = ref('基本信息') -console.log($route, 'route') // 表单1验证规则 const rules1 = ref({ equipmentName: [{ required: true, message: '设备名称必填', trigger: ['blur', 'change'] }], @@ -103,10 +105,11 @@ productCountry: [{ required: true, message: '生产国家必填', trigger: ['blur', 'change'] }], manufacturer: [{ required: true, message: '生产厂家必填', trigger: ['blur', 'change'] }], manufactureNo: [{ required: true, message: '生产编号必填', trigger: ['blur', 'change'] }], - productDate: [{ required: true, message: '生产日期必选', trigger: ['blur', 'change'] }], - unitPrice: [{ required: true, message: '设备单价必填', trigger: ['blur', 'change'] }], - purchaseDate: [{ required: true, message: '购进日期必选', trigger: ['blur', 'change'] }], + // productDate: [{ required: true, message: '生产日期必选', trigger: ['blur', 'change'] }], + // unitPrice: [{ required: true, message: '设备单价必填', trigger: ['blur', 'change'] }], + // purchaseDate: [{ required: true, message: '购进日期必选', trigger: ['blur', 'change'] }], model: [{ required: true, message: '型号规格必填', trigger: ['blur', 'change'] }], + helpInstruction: [{ required: true, message: '辅助字段必选', trigger: ['blur', 'change'] }], qualityCondition: [{ required: true, message: '质量状况必填', trigger: ['blur', 'change'] }], deptId: [{ required: true, message: '使用部门必选', trigger: ['blur', 'change'] }], category: [{ required: true, message: '设备分类必选', trigger: ['blur', 'change'] }], @@ -129,6 +132,13 @@ const deviceTypeList = ref<{ id: string; value: string; name: string }[]>() // 设备分类 const inUseList = ref<{ id: string; value: string; name: string }[]>() // 设备在用信息 const meterIdentifyList = ref<{ id: string; value: string; name: string }[]>() // 计量标识 +// 设备名称 +const deviceNameList = ref([]) +// 规格型号 +const modelList = ref([]) +// 辅助字段 +const helpList = ref([]) +const allList = ref([]) const fetchSelectData = () => { getDictByCode('eqptDeviceUseStatus').then((res) => { useStatusList.value = res.data @@ -145,8 +155,54 @@ getDictByCode('eqptMeterIdentify').then((res) => { meterIdentifyList.value = res.data }) + // 设备名称 + getDeviceNameList().then((res) => { + deviceNameList.value = res.data + }) + // 规格型号及辅助字段 + getModelAllList({}).then((res) => { + allList.value = res.data + modelList.value = res.data + helpList.value = res.data.filter((item: any) => item.helpInstruction) + }) } fetchSelectData() +// 监听设备名称下拉框,修改规格型号和辅助字段 +watch(() => ruleForm.value.equipmentName, (newVal) => { + if (newVal) { + ruleForm.value.helpInstruction = '' + ruleForm.value.model = '' + // 修改规格型号和辅助字段列表 + const data = allList.value.filter(item => item.equipmentName === newVal) + modelList.value = data + helpList.value = data.filter(item => item.helpInstruction) + } +}) +// 监听规格型号下拉框,修改辅助字段 +watch(() => ruleForm.value.model, (newVal) => { + if (newVal) { + ruleForm.value.helpInstruction = '' + // 修改规格型号和辅助字段列表 + helpList.value = helpList.value.filter(item => item.model === newVal) + } +}) +// 设备相关,填充数据 +watch(() => ruleForm.value, (newVal) => { + if (ruleForm.value.helpInstruction && ruleForm.value.model && ruleForm.value.equipmentName) { + console.log('自动') + const arr = allList.value.filter((item: any) => item.helpInstruction === ruleForm.value.helpInstruction && item.model === ruleForm.value.model && item.equipmentName === ruleForm.value.equipmentName) + if (arr.length) { + const data = arr[0] + ruleForm.value.category = data.category + ruleForm.value.remark = data.remark + ruleForm.value.technicalTargetList = data.technicalTargetList + ruleForm.value.checkCycle = data.checkCycle + } + } +}, { + deep: true, + // immediate: true, +}) // 加载组织机构树形下拉 const deptTreeList = ref() const fetchDeptTree = () => { @@ -186,17 +242,17 @@ getInfoDetail({ equipmentId: $route.query.id as string }).then((res) => { ruleForm.value = res.data console.log(res.data, 'res.data') - if (ruleForm.value.testTask) { - if (ruleForm.value.testTask.includes(',')) { - testTask.value = ruleForm.value.testTask.split(',') - } - else { - testTask.value = [ruleForm.value.testTask] - } - } - else { - testTask.value = [''] - } + // if (ruleForm.value.testTask) { + // if (ruleForm.value.testTask.includes(',')) { + // testTask.value = ruleForm.value.testTask.split(',') + // } + // else { + // testTask.value = [ruleForm.value.testTask] + // } + // } + // else { + // testTask.value = [''] + // } if ($route.params.type === 'update') { ruleForm.value.approvalType = '2' ruleForm.value.approvalTypeName = '编辑设备' @@ -211,17 +267,17 @@ else { getApprovalDetail({ id: $route.query.id as string }).then((res) => { ruleForm.value = res.data - if (ruleForm.value.testTask) { - if (ruleForm.value.testTask.includes(',')) { - testTask.value = ruleForm.value.testTask.split(',') - } - else { - testTask.value = [ruleForm.value.testTask] - } - } - else { - testTask.value = [''] - } + // if (ruleForm.value.testTask) { + // if (ruleForm.value.testTask.includes(',')) { + // testTask.value = ruleForm.value.testTask.split(',') + // } + // else { + // testTask.value = [ruleForm.value.testTask] + // } + // } + // else { + // testTask.value = [''] + // } }) // ruleForm.value = JSON.parse($route.query.row as string) } @@ -410,6 +466,23 @@ const filterData = data.filter(item => item !== fileName) ruleForm.value.instructionsFile = filterData.length ? filterData.join(',') : '' } +// 删除参试任务 +const delHandler = (row: any) => { + // ruleForm.taskInfos + console.log(row, 'row') + ElMessageBox.confirm( + `确认删除${row.taskName}吗?`, + '确认', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }, + ).then(() => { + ruleForm.value.taskInfos = ruleForm.value.taskInfos.filter((item: any) => item.id !== row.id) + ElMessage.success('操作成功') + }) +} const print = () => { } @@ -483,29 +556,34 @@ > - - - - - - - - - - - - + + + - - - + + + + + + + + + + + + + + + + + @@ -519,11 +597,6 @@ - - - - - + + + + + @@ -543,30 +624,29 @@ - - + + + + - + - - + + @@ -574,20 +654,27 @@ - + - + + + + + + + + @@ -595,6 +682,11 @@ + + + + + @@ -645,9 +737,6 @@ - - - @@ -679,11 +768,10 @@ - - - - - + + + + @@ -696,7 +784,7 @@ - + + + + + + + + + + + + + + + - + @@ -717,6 +827,9 @@ + + + @@ -739,6 +852,6 @@ } .margin { - padding: 10px 10px; + padding: 10px; } diff --git a/src/views/tested/device/info/components/interface.ts b/src/views/tested/device/info/components/interface.ts index fbb1f51..73bfbf4 100644 --- a/src/views/tested/device/info/components/interface.ts +++ b/src/views/tested/device/info/components/interface.ts @@ -12,6 +12,17 @@ limit: number approvalStatus?: string formId?: string + model: string + manufactureNo: string + companyId: string + directorName: string + useSign: string + installLocation: string + taskId: string + checkOrganization: string + meterIdentify: string + checkDateStart: string + checkDateEnd: string } // 设备信息对象 export interface IlistObjType { diff --git a/src/views/tested/device/info/components/edit.vue b/src/views/tested/device/info/components/edit.vue index 53c3b17..a14ce57 100644 --- a/src/views/tested/device/info/components/edit.vue +++ b/src/views/tested/device/info/components/edit.vue @@ -17,6 +17,7 @@ import { uploadApi } from '@/api/system/notice' import useUserStore from '@/store/modules/user' import { getUserDept } from '@/api/system/user' +import { getDeviceNameList, getModelAllList, getModelList } from '@/api/eqpt/device/model' const $route = useRoute() const $router = useRouter() const userStore = useUserStore() @@ -40,6 +41,7 @@ approvalType: '', // 申请审批类型(1新增2编辑3删除) approvalTypeName: '', // 申请审批类型名称 attachments: [], // 主附件信息列表 + taskInfos: [], // 参试任务 category: '', // 设备分类(字典code) certificateValid: '', // 证书有效期 checkCycle: '', // 检定周期(月) @@ -80,6 +82,7 @@ usageStatus: '', // 使用状态(字典code) usePosition: '', // 使用岗位 useSign: '', // 在用信息(字典code) + helpInstruction: '', // 辅助字段 companyName: '', certificateList: [], }) // 表单 @@ -93,7 +96,6 @@ testTask.value.push('') } const radio = ref('基本信息') -console.log($route, 'route') // 表单1验证规则 const rules1 = ref({ equipmentName: [{ required: true, message: '设备名称必填', trigger: ['blur', 'change'] }], @@ -103,10 +105,11 @@ productCountry: [{ required: true, message: '生产国家必填', trigger: ['blur', 'change'] }], manufacturer: [{ required: true, message: '生产厂家必填', trigger: ['blur', 'change'] }], manufactureNo: [{ required: true, message: '生产编号必填', trigger: ['blur', 'change'] }], - productDate: [{ required: true, message: '生产日期必选', trigger: ['blur', 'change'] }], - unitPrice: [{ required: true, message: '设备单价必填', trigger: ['blur', 'change'] }], - purchaseDate: [{ required: true, message: '购进日期必选', trigger: ['blur', 'change'] }], + // productDate: [{ required: true, message: '生产日期必选', trigger: ['blur', 'change'] }], + // unitPrice: [{ required: true, message: '设备单价必填', trigger: ['blur', 'change'] }], + // purchaseDate: [{ required: true, message: '购进日期必选', trigger: ['blur', 'change'] }], model: [{ required: true, message: '型号规格必填', trigger: ['blur', 'change'] }], + helpInstruction: [{ required: true, message: '辅助字段必选', trigger: ['blur', 'change'] }], qualityCondition: [{ required: true, message: '质量状况必填', trigger: ['blur', 'change'] }], deptId: [{ required: true, message: '使用部门必选', trigger: ['blur', 'change'] }], category: [{ required: true, message: '设备分类必选', trigger: ['blur', 'change'] }], @@ -129,6 +132,13 @@ const deviceTypeList = ref<{ id: string; value: string; name: string }[]>() // 设备分类 const inUseList = ref<{ id: string; value: string; name: string }[]>() // 设备在用信息 const meterIdentifyList = ref<{ id: string; value: string; name: string }[]>() // 计量标识 +// 设备名称 +const deviceNameList = ref([]) +// 规格型号 +const modelList = ref([]) +// 辅助字段 +const helpList = ref([]) +const allList = ref([]) const fetchSelectData = () => { getDictByCode('eqptDeviceUseStatus').then((res) => { useStatusList.value = res.data @@ -145,8 +155,54 @@ getDictByCode('eqptMeterIdentify').then((res) => { meterIdentifyList.value = res.data }) + // 设备名称 + getDeviceNameList().then((res) => { + deviceNameList.value = res.data + }) + // 规格型号及辅助字段 + getModelAllList({}).then((res) => { + allList.value = res.data + modelList.value = res.data + helpList.value = res.data.filter((item: any) => item.helpInstruction) + }) } fetchSelectData() +// 监听设备名称下拉框,修改规格型号和辅助字段 +watch(() => ruleForm.value.equipmentName, (newVal) => { + if (newVal) { + ruleForm.value.helpInstruction = '' + ruleForm.value.model = '' + // 修改规格型号和辅助字段列表 + const data = allList.value.filter(item => item.equipmentName === newVal) + modelList.value = data + helpList.value = data.filter(item => item.helpInstruction) + } +}) +// 监听规格型号下拉框,修改辅助字段 +watch(() => ruleForm.value.model, (newVal) => { + if (newVal) { + ruleForm.value.helpInstruction = '' + // 修改规格型号和辅助字段列表 + helpList.value = helpList.value.filter(item => item.model === newVal) + } +}) +// 设备相关,填充数据 +watch(() => ruleForm.value, (newVal) => { + if (ruleForm.value.helpInstruction && ruleForm.value.model && ruleForm.value.equipmentName) { + console.log('自动') + const arr = allList.value.filter((item: any) => item.helpInstruction === ruleForm.value.helpInstruction && item.model === ruleForm.value.model && item.equipmentName === ruleForm.value.equipmentName) + if (arr.length) { + const data = arr[0] + ruleForm.value.category = data.category + ruleForm.value.remark = data.remark + ruleForm.value.technicalTargetList = data.technicalTargetList + ruleForm.value.checkCycle = data.checkCycle + } + } +}, { + deep: true, + // immediate: true, +}) // 加载组织机构树形下拉 const deptTreeList = ref() const fetchDeptTree = () => { @@ -186,17 +242,17 @@ getInfoDetail({ equipmentId: $route.query.id as string }).then((res) => { ruleForm.value = res.data console.log(res.data, 'res.data') - if (ruleForm.value.testTask) { - if (ruleForm.value.testTask.includes(',')) { - testTask.value = ruleForm.value.testTask.split(',') - } - else { - testTask.value = [ruleForm.value.testTask] - } - } - else { - testTask.value = [''] - } + // if (ruleForm.value.testTask) { + // if (ruleForm.value.testTask.includes(',')) { + // testTask.value = ruleForm.value.testTask.split(',') + // } + // else { + // testTask.value = [ruleForm.value.testTask] + // } + // } + // else { + // testTask.value = [''] + // } if ($route.params.type === 'update') { ruleForm.value.approvalType = '2' ruleForm.value.approvalTypeName = '编辑设备' @@ -211,17 +267,17 @@ else { getApprovalDetail({ id: $route.query.id as string }).then((res) => { ruleForm.value = res.data - if (ruleForm.value.testTask) { - if (ruleForm.value.testTask.includes(',')) { - testTask.value = ruleForm.value.testTask.split(',') - } - else { - testTask.value = [ruleForm.value.testTask] - } - } - else { - testTask.value = [''] - } + // if (ruleForm.value.testTask) { + // if (ruleForm.value.testTask.includes(',')) { + // testTask.value = ruleForm.value.testTask.split(',') + // } + // else { + // testTask.value = [ruleForm.value.testTask] + // } + // } + // else { + // testTask.value = [''] + // } }) // ruleForm.value = JSON.parse($route.query.row as string) } @@ -410,6 +466,23 @@ const filterData = data.filter(item => item !== fileName) ruleForm.value.instructionsFile = filterData.length ? filterData.join(',') : '' } +// 删除参试任务 +const delHandler = (row: any) => { + // ruleForm.taskInfos + console.log(row, 'row') + ElMessageBox.confirm( + `确认删除${row.taskName}吗?`, + '确认', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }, + ).then(() => { + ruleForm.value.taskInfos = ruleForm.value.taskInfos.filter((item: any) => item.id !== row.id) + ElMessage.success('操作成功') + }) +} const print = () => { } @@ -483,29 +556,34 @@ > - - - - - - - - - - - - + + + - - - + + + + + + + + + + + + + + + + + @@ -519,11 +597,6 @@ - - - - - + + + + + @@ -543,30 +624,29 @@ - - + + + + - + - - + + @@ -574,20 +654,27 @@ - + - + + + + + + + + @@ -595,6 +682,11 @@ + + + + + @@ -645,9 +737,6 @@ - - - @@ -679,11 +768,10 @@ - - - - - + + + + @@ -696,7 +784,7 @@ - + + + + + + + + + + + + + + + - + @@ -717,6 +827,9 @@ + + + @@ -739,6 +852,6 @@ } .margin { - padding: 10px 10px; + padding: 10px; } diff --git a/src/views/tested/device/info/components/interface.ts b/src/views/tested/device/info/components/interface.ts index fbb1f51..73bfbf4 100644 --- a/src/views/tested/device/info/components/interface.ts +++ b/src/views/tested/device/info/components/interface.ts @@ -12,6 +12,17 @@ limit: number approvalStatus?: string formId?: string + model: string + manufactureNo: string + companyId: string + directorName: string + useSign: string + installLocation: string + taskId: string + checkOrganization: string + meterIdentify: string + checkDateStart: string + checkDateEnd: string } // 设备信息对象 export interface IlistObjType { diff --git a/src/views/tested/device/info/components/list.vue b/src/views/tested/device/info/components/list.vue index 2c0fc99..f962ae8 100644 --- a/src/views/tested/device/info/components/list.vue +++ b/src/views/tested/device/info/components/list.vue @@ -10,6 +10,8 @@ import { SCHEDULE } from '@/utils/scheduleDict' import useTemplateDownload from '@/utils/useTemplateDownload' import { exportFile } from '@/utils/exportUtils' +import { getDeviceNameList, getModelAllList, getModelList } from '@/api/eqpt/device/model' +import { getTaskList } from '@/api/eqpt/device/task' import task from '@/views/tested/device/task/index.vue' const $props = defineProps({ statusName: { @@ -45,6 +47,17 @@ limit: 20, approvalStatus: '', formId: SCHEDULE.DEVICE_INFO_APPROVAL, + model: '', // 规格型号 + manufactureNo: '', // 出厂编号 + companyId: '', // 所在单位 + directorName: '', // 负责人 + useSign: '', // 再用信息 + installLocation: '', // 安装位置 + taskId: '', // 参试任务 + checkOrganization: '', // 检定机构 + meterIdentify: '', // 计量标识 + checkDateEnd: '', + checkDateStart: '', }) const columns = ref([ { @@ -167,12 +180,57 @@ } // 获取使用状态列表 const useStatusList = ref() +// 设备名称 +const deviceNameList = ref<{ id: string; value: string; name: string }[]>([]) +// 设备分类 +const deviceTypeList = ref<{ id: string; value: string; name: string }[]>([]) +// 再用信息 +const useSignList = ref<{ id: string; value: string; name: string }[]>([]) +// 任务列表 +const taskList = ref<{ id: string; value: string; name: string }[]>([]) +// 计量标识 +const meterIdentifyList = ref<{ id: string; value: string; name: string }[]>() +// 规格型号 +const modelList = ref([]) +const allList = ref([]) const fetchUseStatus = () => { getDictByCode('eqptDeviceUseStatus').then((res) => { useStatusList.value = res.data }) + getDictByCode('eqptDeviceInUse').then((res) => { + useSignList.value = res.data + }) + // 设备分类 + getDictByCode('eqptDeviceType').then((res) => { + deviceTypeList.value = res.data + }) + // 设备名称 + getDeviceNameList().then((res) => { + deviceNameList.value = res.data + }) + // 规格型号 + getModelAllList({}).then((res) => { + allList.value = res.data + modelList.value = res.data + }) + // 参试任务 + getTaskList({ limit: 9999, offset: 1 }).then((res) => { + taskList.value = res.data.rows.map((item: any) => ({ name: item.taskName, value: item.id, id: item.id })) + }) + getDictByCode('eqptMeterIdentify').then((res) => { + meterIdentifyList.value = res.data + }) } fetchUseStatus() +// 监听设备名称下拉框,修改规格型号和辅助字段 +watch(() => listQuery.equipmentName, (newVal) => { + if (newVal) { + listQuery.model = '' + // 修改规格型号和辅助字段列表 + const data = allList.value.filter(item => item.equipmentName === newVal) + modelList.value = data + } +}) // 查询数据 const search = () => { fetchData(false) @@ -189,16 +247,39 @@ listQuery.certificateValidEnd = '' } }) +const datetimerange1 = ref() +watch(() => datetimerange1.value, (newVal) => { + if (newVal.length) { + listQuery.checkDateStart = `${newVal[0]} 00:00:00` + listQuery.checkDateEnd = `${newVal[1]} 23:59:59` + } + else { + listQuery.checkDateStart = '' + listQuery.checkDateEnd = '' + } +}) // 重置 const reset = () => { datetimerange.value = [] + datetimerange1.value = [] listQuery.equipmentNo = '' listQuery.equipmentName = '' listQuery.usageStatus = '' listQuery.usePosition = '' listQuery.certificateValidEnd = '' listQuery.certificateValidStart = '' + listQuery.model = '' listQuery.deptIds = '' + listQuery.manufactureNo = '' + listQuery.companyId = '' + listQuery.directorName = '' + listQuery.useSign = '' + listQuery.installLocation = '' + listQuery.checkOrganization = '' + listQuery.checkDateStart = '' + listQuery.checkDateEnd = '' + listQuery.taskId = '' + listQuery.meterIdentify = '' listQuery.offset = 1 listQuery.limit = 20 search() @@ -589,13 +670,17 @@ - + + + - - + + + + + + @@ -603,11 +688,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +