From d6ea52e36764e21bb5397bf7c2c21fcaf11c266e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Mon, 29 Aug 2022 00:53:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=95=86=E5=93=81=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=A4=9A=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jshERP-web/src/api/api.js | 6 +- .../views/material/modules/MaterialModal.vue | 240 +++++++++--------- 2 files changed, 119 insertions(+), 127 deletions(-) diff --git a/jshERP-web/src/api/api.js b/jshERP-web/src/api/api.js index 7a2c3285..1eae5dcc 100644 --- a/jshERP-web/src/api/api.js +++ b/jshERP-web/src/api/api.js @@ -67,7 +67,8 @@ const getEnableSerialNumberList = (params)=>getAction("/serialNumber/getEnableSe const addMaterialAttribute = (params)=>postAction("/materialAttribute/add",params); const editMaterialAttribute = (params)=>putAction("/materialAttribute/update",params); const checkMaterialAttribute = (params)=>getAction("/materialAttribute/checkIsNameExist",params); -const getAllMaterialAttribute = (params)=>getAction("/materialAttribute/getAll",params); +const getMaterialAttributeNameList = (params)=>getAction("/materialAttribute/getNameList",params); +const getMaterialAttributeValueListById = (params)=>getAction("/materialAttribute/getValueListById",params); //功能管理 const addFunction = (params)=>postAction("/function/add",params); const editFunction = (params)=>putAction("/function/update",params); @@ -160,7 +161,8 @@ export { addMaterialAttribute, editMaterialAttribute, checkMaterialAttribute, - getAllMaterialAttribute, + getMaterialAttributeNameList, + getMaterialAttributeValueListById, addFunction, editFunction, checkFunction, diff --git a/jshERP-web/src/views/material/modules/MaterialModal.vue b/jshERP-web/src/views/material/modules/MaterialModal.vue index 08abdbba..8a18a7a2 100644 --- a/jshERP-web/src/views/material/modules/MaterialModal.vue +++ b/jshERP-web/src/views/material/modules/MaterialModal.vue @@ -113,69 +113,42 @@ - + - + + + {{ item.name }} + + + + + + + + + + + {{ item.name }} + + + + + + + + + {{ item.name }} + + + + + + + - - - - - - - {{ item.name }} - - - - - - - - - {{ item.name }} - - - - - - - - - {{ item.name }} - - - - - - - - - - - {{ item.name }} - - - - - - - - - {{ item.name }} - - - - - - - - - - -
{ + (array.indexOf(item.value) === -1)?Vue.set(array[index], 'disabled', false):'' + }) + }else{ + this.materialAttributeList.forEach((item,index,array)=>{ + (value.indexOf(item.value) === -1)?Vue.set(array[index], 'disabled', true):'' + }) + } + //更新属性1和属性2的下拉框 + if(value.length <= 2) { + let skuOneId = value[0] + let skuTwoId = value[1] + this.materialAttributeList.forEach(item => { + if(item.value === skuOneId) { + this.skuOneTitle = item.name + } + if(item.value === skuTwoId) { + this.skuTwoTitle = item.name + } + }) + getMaterialAttributeValueListById({'id': skuOneId}).then((res)=>{ + if(res) { + this.skuOneList = res + } + }) + getMaterialAttributeValueListById({'id': skuTwoId}).then((res)=>{ + if(res) { + this.skuTwoList = res + } + }) + } + //控制条码列表中的多属性列 + if(value.length>0) { this.meTable.columns[2].type = FormTypes.input - this.form.setFieldsValue({ 'color': '' }) } else { this.meTable.columns[2].type = FormTypes.hidden } + this.barCodeSwitch = false; + this.meTable.dataSource = [] }, onBarCodeChange(checked) { let unit = this.form.getFieldValue('unit') if(unit) { if(checked){ //计算多属性已经选择了几个 - let count = this.getNumByField('manyColor') + this.getNumByField('manySize') - + this.getNumByField('other1') + this.getNumByField('other2') + this.getNumByField('other3') - if(count === 2) { + let count = this.getNumByField('skuOne') + this.getNumByField('skuTwo') + let barCodeSku = [] + if(count === 1) { let skuArr = [] - if(this.getNumByField('manyColor')) { - skuArr.push(this.form.getFieldValue('manyColor')) + if(this.getNumByField('skuOne')) { + skuArr.push(this.form.getFieldValue('skuOne')) } - if(this.getNumByField('manySize')) { - skuArr.push(this.form.getFieldValue('manySize')) + let skuArrOne = skuArr[0] + for (let i = 0; i < skuArrOne.length; i++) { + barCodeSku.push(skuArrOne[i]) } - if(this.getNumByField('other1')) { - skuArr.push(this.form.getFieldValue('other1')) + } else if(count === 2) { + let skuArr = [] + if(this.getNumByField('skuOne')) { + skuArr.push(this.form.getFieldValue('skuOne')) } - if(this.getNumByField('other2')) { - skuArr.push(this.form.getFieldValue('other2')) - } - if(this.getNumByField('other3')) { - skuArr.push(this.form.getFieldValue('other3')) + if(this.getNumByField('skuTwo')) { + skuArr.push(this.form.getFieldValue('skuTwo')) } let skuArrOne = skuArr[0] let skuArrTwo = skuArr[1] - let barCodeSku = [] for (let i = 0; i < skuArrOne.length; i++) { for (let j = 0; j < skuArrTwo.length; j++) { barCodeSku.push(skuArrOne[i] + ',' + skuArrTwo[j]) } } - let meTableData = [] - getMaxBarCode({}).then((res)=>{ - if(res && res.code===200) { - let maxBarCode = res.data.barCode-0 - for (let i = 0; i < barCodeSku.length; i++) { - let currentBarCode = maxBarCode + i + 1 - meTableData.push({barCode: currentBarCode, commodityUnit: unit, sku: barCodeSku[i]}) - } - this.meTable.dataSource = meTableData + } + let meTableData = [] + getMaxBarCode({}).then((res)=>{ + if(res && res.code===200) { + let maxBarCode = res.data.barCode-0 + for (let i = 0; i < barCodeSku.length; i++) { + let currentBarCode = maxBarCode + i + 1 + meTableData.push({barCode: currentBarCode, commodityUnit: unit, sku: barCodeSku[i]}) } - }) - } else { - this.$message.warning('请选择两个属性!'); - this.barCodeSwitch = false; + this.meTable.dataSource = meTableData + } + }) + if(this.skuOneTitle === '多颜色' || this.skuTwoTitle === '多颜色') { + this.form.setFieldsValue({ 'color': '' }) } } else { this.meTable.dataSource = [] @@ -889,7 +890,7 @@ } }, batchSetPrice(type) { - if(this.skuSwitch || this.model.id){ + if(this.manySkuSelected>0 || this.model.id){ this.$refs.priceModalForm.add(type); this.$refs.priceModalForm.disableSubmit = false; } else { @@ -948,22 +949,11 @@ this.depotTable.dataSource = depotTableData }, initMaterialAttribute() { - getAllMaterialAttribute({}).then((res)=>{ - if(res && res.code===200) { - if(res.data) { - this.sku.manyColor = res.data.manyColorName; - this.sku.manySize = res.data.manySizeName; - this.sku.other1 = res.data.other1Name; - this.sku.other2 = res.data.other2Name; - this.sku.other3 = res.data.other3Name; - this.sku.manyColorList = res.data.manyColorValue; - this.sku.manySizeList = res.data.manySizeValue; - this.sku.other1List = res.data.other1Value; - this.sku.other2List = res.data.other2Value; - this.sku.other3List = res.data.other3Value; - } + getMaterialAttributeNameList().then((res)=>{ + if(res) { + this.materialAttributeList = res } - }); + }) }, loadParseMaterialProperty() { let mpList = Vue.ls.get('materialPropertyList')