diff --git a/src/views/equipement/standard/book/components/config/seventh/config.vue b/src/views/equipement/standard/book/components/config/seventh/config.vue index b192fdc..ca61bc4 100644 --- a/src/views/equipement/standard/book/components/config/seventh/config.vue +++ b/src/views/equipement/standard/book/components/config/seventh/config.vue @@ -10,7 +10,7 @@ import { config, getCheckItemDetail } from '@/api/equipment/standard/book' import { calc } from '@/utils/useCalc' import { getDictByCode } from '@/api/system/dict' -import { differenceArray, setSelectList } from '@/utils/Array' +import { differenceArray, setSelectList, uniqueMultiArray } from '@/utils/Array' import templateTable from '@/views/business/measure/item/components/second/templateTable.vue' const textMap: { [key: string]: string } = { @@ -49,12 +49,13 @@ const list = ref([]) const checkoutList = ref([]) const columns = ref([ - { text: '类型', value: 'type', align: 'center', required: true, type: 'select' }, - { text: '温度点/湿度点', value: 'ponit', align: 'center', required: true, type: 'number' }, - { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, - { text: '配套设备名称', value: 'deviceName', align: 'center', required: true, type: '' }, + { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { text: '配套设备名称', value: 'equipmentName', align: 'center', required: true, type: '' }, { text: '型号规格', value: 'model', align: 'center', required: false, type: 'text' }, { text: '出厂编号', value: 'manufactureNo', align: 'center', required: false, type: 'text' }, + { text: '类型', value: 'typeValue', align: 'center', required: true, type: 'select' }, + { text: '相对湿度/温度', value: 'relativeDimension', align: 'center', required: true, type: 'select-dict', code: 'RelativeHumidity' }, + { text: '温度点/相对湿度点', value: 'dimensionPoint', align: 'center', required: true, type: 'select-dict', code: 'RelativeHumidityPonit' }, { text: '循环次数', value: 'cycleNumber', align: 'center', required: true, type: 'number' }, { text: '核查类型', value: 'checkType', align: 'center', required: true, type: 'select-multi' }, { text: 'U(k=2)', value: 'urel', align: 'center', required: true, type: 'number' }, @@ -71,19 +72,33 @@ * @param title 操作的表格 */ const addRow = (data: IList[], title: string) => { - if (checkList(data, columns.value, `${title}表格`)) { + if (checkList(data, `${title}表格`)) { const obj = { - type: '', - ponit: '', + paramsName: '温湿度核查', + equipmentName: '', + equipmentId: '', + model: '', + manufactureNo: '', + typeValue: '', + relativeDimension: '', + relativeDimensionUnit: '', + dimensionPoint: '', + dimensionPointUnit: '', checkType: ['重复性', '稳定性'], // 核查类型 cycleNumber: 10, // 循环次数 unit: '', + params: '1', urel: '', - deviceName: '', - model: '', - manufactureNo: '', } - list.value.length ? list.value.push(JSON.parse(JSON.stringify(list.value[list.value.length - 1]))) : list.value.push(obj) + list.value.length + ? list.value.push({ + ...JSON.parse(JSON.stringify(list.value[list.value.length - 1])), + equipmentName: '', + equipmentId: '', + model: '', + manufactureNo: '', + }) + : list.value.push(obj) } } /** @@ -91,12 +106,12 @@ * @param checkoutList 选中的数组 * @param list 操作的数组 */ -const delRow = (checkoutList: IList[], list: IList[], title: string) => { +const delRow = (checkoutList: IList[], clist: IList[], title: string) => { if (!checkoutList.length) { ElMessage.warning('请选中要删除的行') } else { - list.value = differenceArray(list, checkoutList) + list.value = differenceArray(clist, checkoutList) } } // 多选 @@ -129,56 +144,61 @@ // 点击保存 const save = () => { if (!list.value.length) { ElMessage.warning('核查项不能为空'); return false } - if (!checkList(list.value, columns.value, '核查项表格')) { return false } - // const params = { - // itemCategoryId: form.value.itemCategoryId, // 核查项分类id - // checkItemDataPistonGaugeList: list.value, + if (!checkList(list.value, '核查项表格')) { return false } + // 验证数据 配套设备名称、类型、相对湿度/温度、温度点/相对湿度点这几个字段数据不能完全相同 + // const sameData = uniqueMultiArray(uniqueMultiArray(uniqueMultiArray(uniqueMultiArray(list.value, 'equipmentId'), 'typeValue'), 'relativeDimension'), 'dimensionPoint') + // if (sameData.length > 1) { + // ElMessage.warning(`${sameData[0].equipmentName} 的类型、相对湿度/温度、温度点/相对湿度点 不能完全相同`) + // return false // } - // const loading = ElLoading.service({ - // lock: true, - // text: '加载中', - // background: 'rgba(255, 255, 255, 0.6)', - // }) - // config(params).then((res) => { - // ElMessage.success('已保存') - // pageType.value = 'detail' - // loading.close() - // }) + const params = { + itemCategoryId: form.value.itemCategoryId, // 核查项分类id + checkItemDataPointMeterList: list.value.map((item: any) => ({ ...item, equipmentId: equipmentId.value, id: '', remark: form.value.remark })), + equipmentId: equipmentId.value, + standardId: $route.query.standardId, + } + const loading = ElLoading.service({ + lock: true, + text: '加载中', + background: 'rgba(255, 255, 255, 0.6)', + }) + config(params).then((res) => { + ElMessage.success('已保存') + pageType.value = 'detail' + loading.close() + }).catch(() => { + loading.close() + }) } // 获取详情 const getInfo = () => { - // const loading = ElLoading.service({ - // lock: true, - // text: '加载中', - // background: 'rgba(255, 255, 255, 0.6)', - // }) + const loading = ElLoading.service({ + lock: true, + text: '加载中', + background: 'rgba(255, 255, 255, 0.6)', + }) const params = { equipmentId: equipmentId.value, // 设备id belongStandardEquipment: form.value.belongStandardEquipment, // 检校标准装置code itemCategoryId: form.value.itemCategoryId, // 核查项分类id itemCategoryName: form.value.itemCategoryName, // 核查项分类名称 } - // getCheckItemDetail(params).then((res) => { - // list.value = res.data.checkItemDataPistonGaugeList.map((item: any) => { - // return { - // ...item, - // resolution: Number(item.resolution), - // } - // }) - // loading.close() - // }) + getCheckItemDetail(params).then((res) => { + const data = res.data?.checkItemDataPointMeterList || [] + data.forEach((item: any) => { + list.value.push({ + ...item, checkType: ['重复性', '稳定性'], paramsName: '温湿度核查', + }) + form.value.remark = item.remark + }) + loading.close() + }).catch(() => { + loading.close() + }) } // 表格下拉框等内容是否禁用 const disabled = ({ scope, column }: any, fun: any) => { - if (column.text === '核查类型') { - fun(true) - return - } - if (column.text === '是否为基准点') { - fun(true) - return - } if (column.text === '循环次数') { fun(true) return @@ -199,7 +219,7 @@ form.value.belongStandardEquipment = $route.query.belongStandardEquipment as string // 核查项标准装置id form.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string // 核查项标准装置id equipmentId.value = $route.query.equipmentId as string // 设备id - // getInfo() + getInfo() }) // 核查类型 const checkTypeList = ref<{ value: string;name: string;id: string }[]>([]) @@ -214,12 +234,12 @@ TypeList.value = [ { name: '相对湿度', - value: '1', + value: '相对湿度', id: '1', }, { name: '温度', - value: '2', + value: '温度', id: '2', }, ] @@ -231,7 +251,9 @@ fecthDict() const changeLoadSituationa = (value: any, index: number, text: string, type: string, list: any[], item: string) => { if (text === '类型') { - list[index].unit = value === '温度' ? '℃' : value === '相对湿度' ? '%RH' : '' + if (typeof value !== 'string') { return } + list[index].dimensionPointUnit = value.includes('温度') ? '℃' : '%RH' + list[index].relativeDimensionUnit = value.includes('温度') ? '%RH' : '℃' } } const selectIndex = ref(0) @@ -243,7 +265,8 @@ } const confirmSelect = (val: any) => { if (!val || !val.length) { return false } - list.value[selectIndex.value].deviceName = val[0].equipmentName + list.value[selectIndex.value].equipmentName = val[0].equipmentName + list.value[selectIndex.value].equipmentId = val[0].id list.value[selectIndex.value].model = val[0].model list.value[selectIndex.value].manufactureNo = val[0].manufactureNo } @@ -358,7 +381,7 @@ - + diff --git a/src/views/equipement/standard/book/components/config/seventh/config.vue b/src/views/equipement/standard/book/components/config/seventh/config.vue index b192fdc..ca61bc4 100644 --- a/src/views/equipement/standard/book/components/config/seventh/config.vue +++ b/src/views/equipement/standard/book/components/config/seventh/config.vue @@ -10,7 +10,7 @@ import { config, getCheckItemDetail } from '@/api/equipment/standard/book' import { calc } from '@/utils/useCalc' import { getDictByCode } from '@/api/system/dict' -import { differenceArray, setSelectList } from '@/utils/Array' +import { differenceArray, setSelectList, uniqueMultiArray } from '@/utils/Array' import templateTable from '@/views/business/measure/item/components/second/templateTable.vue' const textMap: { [key: string]: string } = { @@ -49,12 +49,13 @@ const list = ref([]) const checkoutList = ref([]) const columns = ref([ - { text: '类型', value: 'type', align: 'center', required: true, type: 'select' }, - { text: '温度点/湿度点', value: 'ponit', align: 'center', required: true, type: 'number' }, - { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, - { text: '配套设备名称', value: 'deviceName', align: 'center', required: true, type: '' }, + { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { text: '配套设备名称', value: 'equipmentName', align: 'center', required: true, type: '' }, { text: '型号规格', value: 'model', align: 'center', required: false, type: 'text' }, { text: '出厂编号', value: 'manufactureNo', align: 'center', required: false, type: 'text' }, + { text: '类型', value: 'typeValue', align: 'center', required: true, type: 'select' }, + { text: '相对湿度/温度', value: 'relativeDimension', align: 'center', required: true, type: 'select-dict', code: 'RelativeHumidity' }, + { text: '温度点/相对湿度点', value: 'dimensionPoint', align: 'center', required: true, type: 'select-dict', code: 'RelativeHumidityPonit' }, { text: '循环次数', value: 'cycleNumber', align: 'center', required: true, type: 'number' }, { text: '核查类型', value: 'checkType', align: 'center', required: true, type: 'select-multi' }, { text: 'U(k=2)', value: 'urel', align: 'center', required: true, type: 'number' }, @@ -71,19 +72,33 @@ * @param title 操作的表格 */ const addRow = (data: IList[], title: string) => { - if (checkList(data, columns.value, `${title}表格`)) { + if (checkList(data, `${title}表格`)) { const obj = { - type: '', - ponit: '', + paramsName: '温湿度核查', + equipmentName: '', + equipmentId: '', + model: '', + manufactureNo: '', + typeValue: '', + relativeDimension: '', + relativeDimensionUnit: '', + dimensionPoint: '', + dimensionPointUnit: '', checkType: ['重复性', '稳定性'], // 核查类型 cycleNumber: 10, // 循环次数 unit: '', + params: '1', urel: '', - deviceName: '', - model: '', - manufactureNo: '', } - list.value.length ? list.value.push(JSON.parse(JSON.stringify(list.value[list.value.length - 1]))) : list.value.push(obj) + list.value.length + ? list.value.push({ + ...JSON.parse(JSON.stringify(list.value[list.value.length - 1])), + equipmentName: '', + equipmentId: '', + model: '', + manufactureNo: '', + }) + : list.value.push(obj) } } /** @@ -91,12 +106,12 @@ * @param checkoutList 选中的数组 * @param list 操作的数组 */ -const delRow = (checkoutList: IList[], list: IList[], title: string) => { +const delRow = (checkoutList: IList[], clist: IList[], title: string) => { if (!checkoutList.length) { ElMessage.warning('请选中要删除的行') } else { - list.value = differenceArray(list, checkoutList) + list.value = differenceArray(clist, checkoutList) } } // 多选 @@ -129,56 +144,61 @@ // 点击保存 const save = () => { if (!list.value.length) { ElMessage.warning('核查项不能为空'); return false } - if (!checkList(list.value, columns.value, '核查项表格')) { return false } - // const params = { - // itemCategoryId: form.value.itemCategoryId, // 核查项分类id - // checkItemDataPistonGaugeList: list.value, + if (!checkList(list.value, '核查项表格')) { return false } + // 验证数据 配套设备名称、类型、相对湿度/温度、温度点/相对湿度点这几个字段数据不能完全相同 + // const sameData = uniqueMultiArray(uniqueMultiArray(uniqueMultiArray(uniqueMultiArray(list.value, 'equipmentId'), 'typeValue'), 'relativeDimension'), 'dimensionPoint') + // if (sameData.length > 1) { + // ElMessage.warning(`${sameData[0].equipmentName} 的类型、相对湿度/温度、温度点/相对湿度点 不能完全相同`) + // return false // } - // const loading = ElLoading.service({ - // lock: true, - // text: '加载中', - // background: 'rgba(255, 255, 255, 0.6)', - // }) - // config(params).then((res) => { - // ElMessage.success('已保存') - // pageType.value = 'detail' - // loading.close() - // }) + const params = { + itemCategoryId: form.value.itemCategoryId, // 核查项分类id + checkItemDataPointMeterList: list.value.map((item: any) => ({ ...item, equipmentId: equipmentId.value, id: '', remark: form.value.remark })), + equipmentId: equipmentId.value, + standardId: $route.query.standardId, + } + const loading = ElLoading.service({ + lock: true, + text: '加载中', + background: 'rgba(255, 255, 255, 0.6)', + }) + config(params).then((res) => { + ElMessage.success('已保存') + pageType.value = 'detail' + loading.close() + }).catch(() => { + loading.close() + }) } // 获取详情 const getInfo = () => { - // const loading = ElLoading.service({ - // lock: true, - // text: '加载中', - // background: 'rgba(255, 255, 255, 0.6)', - // }) + const loading = ElLoading.service({ + lock: true, + text: '加载中', + background: 'rgba(255, 255, 255, 0.6)', + }) const params = { equipmentId: equipmentId.value, // 设备id belongStandardEquipment: form.value.belongStandardEquipment, // 检校标准装置code itemCategoryId: form.value.itemCategoryId, // 核查项分类id itemCategoryName: form.value.itemCategoryName, // 核查项分类名称 } - // getCheckItemDetail(params).then((res) => { - // list.value = res.data.checkItemDataPistonGaugeList.map((item: any) => { - // return { - // ...item, - // resolution: Number(item.resolution), - // } - // }) - // loading.close() - // }) + getCheckItemDetail(params).then((res) => { + const data = res.data?.checkItemDataPointMeterList || [] + data.forEach((item: any) => { + list.value.push({ + ...item, checkType: ['重复性', '稳定性'], paramsName: '温湿度核查', + }) + form.value.remark = item.remark + }) + loading.close() + }).catch(() => { + loading.close() + }) } // 表格下拉框等内容是否禁用 const disabled = ({ scope, column }: any, fun: any) => { - if (column.text === '核查类型') { - fun(true) - return - } - if (column.text === '是否为基准点') { - fun(true) - return - } if (column.text === '循环次数') { fun(true) return @@ -199,7 +219,7 @@ form.value.belongStandardEquipment = $route.query.belongStandardEquipment as string // 核查项标准装置id form.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string // 核查项标准装置id equipmentId.value = $route.query.equipmentId as string // 设备id - // getInfo() + getInfo() }) // 核查类型 const checkTypeList = ref<{ value: string;name: string;id: string }[]>([]) @@ -214,12 +234,12 @@ TypeList.value = [ { name: '相对湿度', - value: '1', + value: '相对湿度', id: '1', }, { name: '温度', - value: '2', + value: '温度', id: '2', }, ] @@ -231,7 +251,9 @@ fecthDict() const changeLoadSituationa = (value: any, index: number, text: string, type: string, list: any[], item: string) => { if (text === '类型') { - list[index].unit = value === '温度' ? '℃' : value === '相对湿度' ? '%RH' : '' + if (typeof value !== 'string') { return } + list[index].dimensionPointUnit = value.includes('温度') ? '℃' : '%RH' + list[index].relativeDimensionUnit = value.includes('温度') ? '%RH' : '℃' } } const selectIndex = ref(0) @@ -243,7 +265,8 @@ } const confirmSelect = (val: any) => { if (!val || !val.length) { return false } - list.value[selectIndex.value].deviceName = val[0].equipmentName + list.value[selectIndex.value].equipmentName = val[0].equipmentName + list.value[selectIndex.value].equipmentId = val[0].id list.value[selectIndex.value].model = val[0].model list.value[selectIndex.value].manufactureNo = val[0].manufactureNo } @@ -358,7 +381,7 @@ - + diff --git a/src/views/resource/file/approval/detail.vue b/src/views/resource/file/approval/detail.vue index 86945c8..70f3991 100644 --- a/src/views/resource/file/approval/detail.vue +++ b/src/views/resource/file/approval/detail.vue @@ -580,27 +580,29 @@ - + - - - {{ approvalForm.attachmentFile }} - +
+ + + {{ approvalForm.attachmentFile }} + - - - - - - + + + + + + +