From b45ae38eb94b5074f5c62469a80237802552202f Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Wed, 21 Aug 2024 09:40:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=EF=BC=9ANZKO-694=EF=BC=8CNZK?= =?UTF-8?q?O-695=EF=BC=9B=E5=86=85=E5=AE=B9=EF=BC=9A=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E5=8F=B0=E8=B4=A6=E6=B7=BB=E5=8A=A0=EF=BC=8C=E5=A4=87=E4=BB=B6?= =?UTF-8?q?=E7=94=B3=E9=A2=86=E5=8A=A0=E5=A4=87=E4=BB=B6=E5=92=8C=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=9A=84=E7=AD=9B=E9=80=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/device.ts | 4 + src/api/mold.ts | 5 + src/components/device/slectDeviceList.vue | 243 ++++++++++++++++++++ src/components/item/slectItemList.vue | 11 +- src/pages/repairOrder/addServiceRecord.vue | 3 + src/pages/sparePartsApplication/addForm.vue | 141 +++++++++++- 6 files changed, 402 insertions(+), 5 deletions(-) create mode 100644 src/components/device/slectDeviceList.vue diff --git a/src/api/device.ts b/src/api/device.ts index c3cad9e..689553f 100644 --- a/src/api/device.ts +++ b/src/api/device.ts @@ -23,4 +23,8 @@ export function getSubList(params) { // 新增申领备件时获取备件列表 export function getApplyDeviceList() { return http.get('/eam/device-accounts/selectAll') +} +// 设备分页列表 +export function selectAllByParams(params) { + return http.get('/eam/device-accounts/selectAllByParams',{params}) } \ No newline at end of file diff --git a/src/api/mold.ts b/src/api/mold.ts index 8190163..0721f13 100644 --- a/src/api/mold.ts +++ b/src/api/mold.ts @@ -18,4 +18,9 @@ export function moldList(params) { // 新增申领备件时获取模具列表 export function getApplyMoldList() { return http.get('/eam/item-accounts/selectAll') +} + +// 新增申领备件时获取模具列表 +export function getAllMoldByParams(data) { + return http.post('/eam/mold-accounts/noPage',data) } \ No newline at end of file diff --git a/src/components/device/slectDeviceList.vue b/src/components/device/slectDeviceList.vue new file mode 100644 index 0000000..d697d0d --- /dev/null +++ b/src/components/device/slectDeviceList.vue @@ -0,0 +1,243 @@ + + + + + \ No newline at end of file diff --git a/src/components/item/slectItemList.vue b/src/components/item/slectItemList.vue index 8c67e40..e205dbd 100644 --- a/src/components/item/slectItemList.vue +++ b/src/components/item/slectItemList.vue @@ -12,10 +12,13 @@ - 备件名称:{{item.name}} + 名称: {{item.name}} - 备件编码:{{item.number}} + 型号: {{item.specifications}} + + + 编码: {{item.number}} @@ -75,9 +78,11 @@ const form1 = ref({ number: "", name:"", + specifications:"", qty: 0, temporarilyNumber:"",//;临时选中的编码 temporarilyName:"",//临时选中的名称 + temporarilySpecifications:"",//临时选中的型号 searchName:"",//模糊搜索 }) onLoad((option) => { @@ -90,6 +95,7 @@ if(type==1){ form1.value.number = form1.value.temporarilyNumber form1.value.name = form1.value.temporarilyName + form1.value.specifications = form1.value.temporarilySpecifications } emits('chooseItem1',type,form1); } @@ -107,6 +113,7 @@ let arr1 = props.singleColumnList.filter(cur=>cur.number == item.number) form1.value.temporarilyNumber = arr1[0].number; form1.value.temporarilyName = arr1[0].name; + form1.value.temporarilySpecifications = arr1[0].specifications; } diff --git a/src/pages/repairOrder/addServiceRecord.vue b/src/pages/repairOrder/addServiceRecord.vue index 16171f8..2cd2d36 100644 --- a/src/pages/repairOrder/addServiceRecord.vue +++ b/src/pages/repairOrder/addServiceRecord.vue @@ -169,9 +169,11 @@ const form1 = ref({ number: "", name:"", + specifications:"", qty: 0, temporarilyNumber:"",//;临时选中的编码 temporarilyName:"",//临时选中的名称 + temporarilySpecifications:"",//临时选中的型号 searchName:"",//模糊搜索 }) @@ -273,6 +275,7 @@ if(type==1){ form1.value.number = forms.value.temporarilyNumber form1.value.name =forms.value.temporarilyName + form1.value.specifications = form1.value.temporarilySpecifications } await getSparePartsList(null,null); isShowSelectItem.value = false; diff --git a/src/pages/sparePartsApplication/addForm.vue b/src/pages/sparePartsApplication/addForm.vue index ff06973..6e7b203 100644 --- a/src/pages/sparePartsApplication/addForm.vue +++ b/src/pages/sparePartsApplication/addForm.vue @@ -77,7 +77,7 @@ - + {{form1.name}} @@ -99,7 +99,7 @@ - + {{form1.deviceName}} @@ -130,6 +130,8 @@ + + @@ -146,6 +148,9 @@ import * as deviceApi from "@/api/device" import * as dictApi from "@/api/dict" import * as moldApi from "@/api/mold" + import SelectItemList from "../../components/item/slectItemList.vue" + import SelectDeviceList from "../../components/device/slectDeviceList.vue" + const { proxy } = getCurrentInstance() const loading = ref(false) @@ -157,24 +162,32 @@ const singleColumnShow = ref(false) const singleColumnDefaultValue = ref([]) const singleColumnList = ref([]) + const isShowSelectItem = ref(false) + const isShowSelectDevice = ref(false) const field = ref('') const deviceList = ref([])//设备列表 const choosesingleColumnItem = ref([]) + const deviceNumber = ref(); + const deviceType = ref('DEVICE') const form = ref({ name: '', subList: [] }) const form1 = ref({ itemNumber: undefined, + name: '', + specifications: '', type: '', deviceNumber: undefined, isRadeIn: '', currentQty: '', - qty: '' + qty: '', + temporarilySpecifications: '' }) const deviceMoldType = ref([])//设备列表 const costCenterDept = ref([])//成本中心映射部门 const updataKey = ref(0) + const tempSparePartsList = ref([]); // 触发提交表单 function submit() { // 校验 @@ -257,6 +270,128 @@ getApplyDeviceList() singleColumnShow.value = false } + + + + // 单列模式 + function openSingleNewColumn(fieldName, val, list) { + singleColumnList.value = list + field.value = fieldName + if (val) { + singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)] + } else { + singleColumnDefaultValue.value = [] + } + isShowSelectItem.value = true; + singleColumnList.value = list + } + + async function searchItem(name){ + await getSparePartsList(name); + } + + async function chooseItem1(type, forms) { + if (!forms.value.number && type == 1) { + proxy.$modal.showToast('请选择备件'); + return; + } + if (type == 1) { + form1.value.itemNumber = forms.value.temporarilyNumber; + form1.value.name = forms.value.temporarilyName; + form1.value.specifications = forms.value.temporarilySpecifications; + let param = { + number:form1.value.itemNumber + } + await sparePartsApi.getApplySparePartsList(param).then(res => { + const itemInfo = res.data.find(item=>item.number == form1.value.itemNumber); + if(itemInfo){ + form1.value.currentQty = itemInfo.qty; + form1.value.isRadeIn = itemInfo.isRadeIn; + updataKey.value++ + } + }).catch(() => { }) + } + await getSparePartsList(null); + isShowSelectItem.value = false; + } + + // 获取备件列表 + async function getSparePartsList(name) { + let param = { + name:name + } + await sparePartsApi.getSparePartsList(param).then(res => { + res.data.map(item => { + item.value = item.number + item.label = item.name + }) + sparePartsList.value = res.data + singleColumnList.value = sparePartsList.value + }).catch(() => { }) + } + + // 单列模式 + function openSingleNewDeviceColumn(fieldName, val, list, type) { + singleColumnList.value = list + field.value = fieldName + deviceType.value = type + if (val) { + singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)] + } else { + singleColumnDefaultValue.value = [] + } + isShowSelectDevice.value = true; + singleColumnList.value = list + } + + async function searchDevice(name){ + await getDeviceList(name); + } + + async function chooseDevice1(type,forms){ + if(!forms.value.number&&type==1){ + proxy.$modal.showToast('请选择设备') + return + } + if(type==1){ + form1.value.deviceNumber = forms.value.temporarilyNumber + form1.value.deviceName =forms.value.temporarilyName + form1.value.deviceSpecification = form1.value.temporarilySpecifications + } + await getDeviceList(null); + isShowSelectDevice.value = false; + } + + // 获取备件列表 + async function getDeviceList(name) { + let param = { + name:name + } + if (form1.value.type == 'DEVICE') { + await deviceApi.selectAllByParams(param).then(res => { + res.data.map(item => { + item.value = item.number + item.label = item.name + }) + deviceList.value = res.data + singleColumnList.value = deviceList.value + console.log(singleColumnList.value) + }).catch(() => { }) + } else if (form1.value.type == 'MOLD') { + moldApi.getAllMoldByParams(param).then((res) => { + res.data.map(item => { + item.value = item.number + item.label = item.name + }) + deviceList.value = res.data + singleColumnList.value = deviceList.value + console.log(singleColumnList.value) + }).catch(() => { }) + } + + } + + // 获取备件列表 async function getApplySparePartsList() { await sparePartsApi.getApplySparePartsList().then(res => {