diff --git a/src/views/device/receive/createOrCheck.vue b/src/views/device/receive/createOrCheck.vue index ec48847..9cbc3bc 100644 --- a/src/views/device/receive/createOrCheck.vue +++ b/src/views/device/receive/createOrCheck.vue @@ -204,14 +204,13 @@ }) } else { // 单选替换 + const index = list.value.findIndex((i: IdeviceList) => val[0].equipmentNo === i.equipmentNo) + if (index !== -1) { + ElMessage.warning('此设备已添加过') + return + } list.value.splice(selectIndex.value, 1, val[0]) } - - // 把选择好的设备添加到列表中后,清除空行 - // const index = list.value.findIndex((item: IdeviceList) => !item.equipmentNo) - // if (index !== -1) { - // list.value.splice(index, 1) - // } } // 保存 @@ -222,6 +221,11 @@ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) + // 保存之前清除空行、避免传给后端无用空对象 + const index = list.value.findIndex((item: IdeviceList) => !item.equipmentNo) + if (index !== -1) { + list.value.splice(index, 1) + } const params = { applyName: form.value.applyName, // 申请名称 applyUnit: form.value.applyUnit, // 申请单位 @@ -239,7 +243,7 @@ // 新建 if (typeValue.value === 'add') { saveAddReceiveApplyList(params).then((res) => { - form.value.id = res.data.id + form.value.id = res.data ElMessage.success('保存成功') loading.close() }) @@ -247,7 +251,7 @@ // 保存 else if (typeValue.value === 'edit') { saveEditReceiveApplyList(params).then((res) => { - form.value.id = res.data.id + form.value.id = res.data ElMessage.success('保存成功') loading.close() }) @@ -307,6 +311,7 @@ const fetchReceiveApplyListDetail = () => { getReceiveApplyListDetail({ id: form.value.id }).then((res) => { form.value.applyUnit = res.data.applyUnit // 部门 + form.value.applyName = res.data.applyName // 申请名称 form.value.applyPerson = res.data.applyPerson// 申请人 form.value.time = res.data.time // 领用时间 form.value.applyDesc = res.data.applyDesc // 申请说明 diff --git a/src/views/device/receive/createOrCheck.vue b/src/views/device/receive/createOrCheck.vue index ec48847..9cbc3bc 100644 --- a/src/views/device/receive/createOrCheck.vue +++ b/src/views/device/receive/createOrCheck.vue @@ -204,14 +204,13 @@ }) } else { // 单选替换 + const index = list.value.findIndex((i: IdeviceList) => val[0].equipmentNo === i.equipmentNo) + if (index !== -1) { + ElMessage.warning('此设备已添加过') + return + } list.value.splice(selectIndex.value, 1, val[0]) } - - // 把选择好的设备添加到列表中后,清除空行 - // const index = list.value.findIndex((item: IdeviceList) => !item.equipmentNo) - // if (index !== -1) { - // list.value.splice(index, 1) - // } } // 保存 @@ -222,6 +221,11 @@ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) + // 保存之前清除空行、避免传给后端无用空对象 + const index = list.value.findIndex((item: IdeviceList) => !item.equipmentNo) + if (index !== -1) { + list.value.splice(index, 1) + } const params = { applyName: form.value.applyName, // 申请名称 applyUnit: form.value.applyUnit, // 申请单位 @@ -239,7 +243,7 @@ // 新建 if (typeValue.value === 'add') { saveAddReceiveApplyList(params).then((res) => { - form.value.id = res.data.id + form.value.id = res.data ElMessage.success('保存成功') loading.close() }) @@ -247,7 +251,7 @@ // 保存 else if (typeValue.value === 'edit') { saveEditReceiveApplyList(params).then((res) => { - form.value.id = res.data.id + form.value.id = res.data ElMessage.success('保存成功') loading.close() }) @@ -307,6 +311,7 @@ const fetchReceiveApplyListDetail = () => { getReceiveApplyListDetail({ id: form.value.id }).then((res) => { form.value.applyUnit = res.data.applyUnit // 部门 + form.value.applyName = res.data.applyName // 申请名称 form.value.applyPerson = res.data.applyPerson// 申请人 form.value.time = res.data.time // 领用时间 form.value.applyDesc = res.data.applyDesc // 申请说明 diff --git a/src/views/device/receive/selectDeviceDialog.vue b/src/views/device/receive/selectDeviceDialog.vue index c89ed14..519f0af 100644 --- a/src/views/device/receive/selectDeviceDialog.vue +++ b/src/views/device/receive/selectDeviceDialog.vue @@ -1,6 +1,8 @@ + + + + + diff --git a/src/views/device/receive/createOrCheck.vue b/src/views/device/receive/createOrCheck.vue index ec48847..9cbc3bc 100644 --- a/src/views/device/receive/createOrCheck.vue +++ b/src/views/device/receive/createOrCheck.vue @@ -204,14 +204,13 @@ }) } else { // 单选替换 + const index = list.value.findIndex((i: IdeviceList) => val[0].equipmentNo === i.equipmentNo) + if (index !== -1) { + ElMessage.warning('此设备已添加过') + return + } list.value.splice(selectIndex.value, 1, val[0]) } - - // 把选择好的设备添加到列表中后,清除空行 - // const index = list.value.findIndex((item: IdeviceList) => !item.equipmentNo) - // if (index !== -1) { - // list.value.splice(index, 1) - // } } // 保存 @@ -222,6 +221,11 @@ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) + // 保存之前清除空行、避免传给后端无用空对象 + const index = list.value.findIndex((item: IdeviceList) => !item.equipmentNo) + if (index !== -1) { + list.value.splice(index, 1) + } const params = { applyName: form.value.applyName, // 申请名称 applyUnit: form.value.applyUnit, // 申请单位 @@ -239,7 +243,7 @@ // 新建 if (typeValue.value === 'add') { saveAddReceiveApplyList(params).then((res) => { - form.value.id = res.data.id + form.value.id = res.data ElMessage.success('保存成功') loading.close() }) @@ -247,7 +251,7 @@ // 保存 else if (typeValue.value === 'edit') { saveEditReceiveApplyList(params).then((res) => { - form.value.id = res.data.id + form.value.id = res.data ElMessage.success('保存成功') loading.close() }) @@ -307,6 +311,7 @@ const fetchReceiveApplyListDetail = () => { getReceiveApplyListDetail({ id: form.value.id }).then((res) => { form.value.applyUnit = res.data.applyUnit // 部门 + form.value.applyName = res.data.applyName // 申请名称 form.value.applyPerson = res.data.applyPerson// 申请人 form.value.time = res.data.time // 领用时间 form.value.applyDesc = res.data.applyDesc // 申请说明 diff --git a/src/views/device/receive/selectDeviceDialog.vue b/src/views/device/receive/selectDeviceDialog.vue index c89ed14..519f0af 100644 --- a/src/views/device/receive/selectDeviceDialog.vue +++ b/src/views/device/receive/selectDeviceDialog.vue @@ -1,6 +1,8 @@ + + + + + diff --git a/src/views/device/receive/solveComponent/detail.vue b/src/views/device/receive/solveComponent/detail.vue index fa18d11..8076684 100644 --- a/src/views/device/receive/solveComponent/detail.vue +++ b/src/views/device/receive/solveComponent/detail.vue @@ -62,6 +62,7 @@ }) getReceiveApplyListDetail({ id: form.value.id }).then((res) => { form.value.applyUnit = res.data.applyUnit // 部门 + form.value.applyName = res.data.applyName// 申请名称 form.value.applyPerson = res.data.applyPerson// 申请人 form.value.time = res.data.time // 领用时间 form.value.applyDesc = res.data.applyDesc // 申请说明 @@ -191,7 +192,6 @@ style="width: 100%;" max-height="600" > - val[0].equipmentNo === i.equipmentNo) + if (index !== -1) { + ElMessage.warning('此设备已添加过') + return + } list.value.splice(selectIndex.value, 1, val[0]) } - - // 把选择好的设备添加到列表中后,清除空行 - // const index = list.value.findIndex((item: IdeviceList) => !item.equipmentNo) - // if (index !== -1) { - // list.value.splice(index, 1) - // } } // 保存 @@ -222,6 +221,11 @@ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) + // 保存之前清除空行、避免传给后端无用空对象 + const index = list.value.findIndex((item: IdeviceList) => !item.equipmentNo) + if (index !== -1) { + list.value.splice(index, 1) + } const params = { applyName: form.value.applyName, // 申请名称 applyUnit: form.value.applyUnit, // 申请单位 @@ -239,7 +243,7 @@ // 新建 if (typeValue.value === 'add') { saveAddReceiveApplyList(params).then((res) => { - form.value.id = res.data.id + form.value.id = res.data ElMessage.success('保存成功') loading.close() }) @@ -247,7 +251,7 @@ // 保存 else if (typeValue.value === 'edit') { saveEditReceiveApplyList(params).then((res) => { - form.value.id = res.data.id + form.value.id = res.data ElMessage.success('保存成功') loading.close() }) @@ -307,6 +311,7 @@ const fetchReceiveApplyListDetail = () => { getReceiveApplyListDetail({ id: form.value.id }).then((res) => { form.value.applyUnit = res.data.applyUnit // 部门 + form.value.applyName = res.data.applyName // 申请名称 form.value.applyPerson = res.data.applyPerson// 申请人 form.value.time = res.data.time // 领用时间 form.value.applyDesc = res.data.applyDesc // 申请说明 diff --git a/src/views/device/receive/selectDeviceDialog.vue b/src/views/device/receive/selectDeviceDialog.vue index c89ed14..519f0af 100644 --- a/src/views/device/receive/selectDeviceDialog.vue +++ b/src/views/device/receive/selectDeviceDialog.vue @@ -1,6 +1,8 @@ + + + + + diff --git a/src/views/device/receive/solveComponent/detail.vue b/src/views/device/receive/solveComponent/detail.vue index fa18d11..8076684 100644 --- a/src/views/device/receive/solveComponent/detail.vue +++ b/src/views/device/receive/solveComponent/detail.vue @@ -62,6 +62,7 @@ }) getReceiveApplyListDetail({ id: form.value.id }).then((res) => { form.value.applyUnit = res.data.applyUnit // 部门 + form.value.applyName = res.data.applyName// 申请名称 form.value.applyPerson = res.data.applyPerson// 申请人 form.value.time = res.data.time // 领用时间 form.value.applyDesc = res.data.applyDesc // 申请说明 @@ -191,7 +192,6 @@ style="width: 100%;" max-height="600" > - -import { ref } from 'vue' -const emits = defineEmits(['changeCurrentButton']) -const menu = [ - { name: '未领用', id: '4' }, - { name: '已领用', id: '5' }, -] -const current = ref('4') -watch(current, (newValue) => { - console.log(newValue) - emits('changeCurrentButton', newValue) -}) - - - - - - diff --git a/src/views/device/receive/createOrCheck.vue b/src/views/device/receive/createOrCheck.vue index ec48847..9cbc3bc 100644 --- a/src/views/device/receive/createOrCheck.vue +++ b/src/views/device/receive/createOrCheck.vue @@ -204,14 +204,13 @@ }) } else { // 单选替换 + const index = list.value.findIndex((i: IdeviceList) => val[0].equipmentNo === i.equipmentNo) + if (index !== -1) { + ElMessage.warning('此设备已添加过') + return + } list.value.splice(selectIndex.value, 1, val[0]) } - - // 把选择好的设备添加到列表中后,清除空行 - // const index = list.value.findIndex((item: IdeviceList) => !item.equipmentNo) - // if (index !== -1) { - // list.value.splice(index, 1) - // } } // 保存 @@ -222,6 +221,11 @@ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) + // 保存之前清除空行、避免传给后端无用空对象 + const index = list.value.findIndex((item: IdeviceList) => !item.equipmentNo) + if (index !== -1) { + list.value.splice(index, 1) + } const params = { applyName: form.value.applyName, // 申请名称 applyUnit: form.value.applyUnit, // 申请单位 @@ -239,7 +243,7 @@ // 新建 if (typeValue.value === 'add') { saveAddReceiveApplyList(params).then((res) => { - form.value.id = res.data.id + form.value.id = res.data ElMessage.success('保存成功') loading.close() }) @@ -247,7 +251,7 @@ // 保存 else if (typeValue.value === 'edit') { saveEditReceiveApplyList(params).then((res) => { - form.value.id = res.data.id + form.value.id = res.data ElMessage.success('保存成功') loading.close() }) @@ -307,6 +311,7 @@ const fetchReceiveApplyListDetail = () => { getReceiveApplyListDetail({ id: form.value.id }).then((res) => { form.value.applyUnit = res.data.applyUnit // 部门 + form.value.applyName = res.data.applyName // 申请名称 form.value.applyPerson = res.data.applyPerson// 申请人 form.value.time = res.data.time // 领用时间 form.value.applyDesc = res.data.applyDesc // 申请说明 diff --git a/src/views/device/receive/selectDeviceDialog.vue b/src/views/device/receive/selectDeviceDialog.vue index c89ed14..519f0af 100644 --- a/src/views/device/receive/selectDeviceDialog.vue +++ b/src/views/device/receive/selectDeviceDialog.vue @@ -1,6 +1,8 @@ + + + + + diff --git a/src/views/device/receive/solveComponent/detail.vue b/src/views/device/receive/solveComponent/detail.vue index fa18d11..8076684 100644 --- a/src/views/device/receive/solveComponent/detail.vue +++ b/src/views/device/receive/solveComponent/detail.vue @@ -62,6 +62,7 @@ }) getReceiveApplyListDetail({ id: form.value.id }).then((res) => { form.value.applyUnit = res.data.applyUnit // 部门 + form.value.applyName = res.data.applyName// 申请名称 form.value.applyPerson = res.data.applyPerson// 申请人 form.value.time = res.data.time // 领用时间 form.value.applyDesc = res.data.applyDesc // 申请说明 @@ -191,7 +192,6 @@ style="width: 100%;" max-height="600" > - -import { ref } from 'vue' -const emits = defineEmits(['changeCurrentButton']) -const menu = [ - { name: '未领用', id: '4' }, - { name: '已领用', id: '5' }, -] -const current = ref('4') -watch(current, (newValue) => { - console.log(newValue) - emits('changeCurrentButton', newValue) -}) - - - - - - diff --git a/src/views/device/receive/solveList.vue b/src/views/device/receive/solveList.vue index 8d2667b..b654c2e 100644 --- a/src/views/device/receive/solveList.vue +++ b/src/views/device/receive/solveList.vue @@ -5,7 +5,7 @@ import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import { useRouter } from 'vue-router' import type { IlistQuery, IsolveListType } from '@/views/device/receive/receive' -import ButtonBox from '@/views/device/receive/solveComponent/solveBox.vue' +import ButtonBox from '@/views/device/receive/solveComponent/buttonBox.vue' import { exportFile } from '@/utils/exportUtils' import { printJSON } from '@/utils/printUtils' import { SCHEDULE } from '@/utils/scheduleDict' @@ -112,10 +112,6 @@ listQuery.value.startTime = timeRange.value[0] as string || '' listQuery.value.endTime = timeRange.value[1] as string || '' listQuery.value.equipmentApplyProcessResult = active.value // 设备申请处理结果4待领用5已领用 - // ------------------processResult为4时先传空、接口修改后再正常传4----- - if (listQuery.value.processResult === '4') { - listQuery.value.processResult = '' - } getReceiveApplyList(listQuery.value).then((response) => { list.value = response.data.rows.map((item: IsolveListType) => { @@ -328,7 +324,7 @@ - +