From b2b4329d018d73dfaacd0179661aea4e7046b27a Mon Sep 17 00:00:00 2001 From: caoyizhong <1270296080@qq.com> Date: Thu, 1 Dec 2022 15:19:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E5=BA=93=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/jeecg/HPlan.vue | 16 ++-- .../form/ProcessMaterialWarehousingForm.vue | 86 +++++++++++++------ .../activiti/form/ProcessUdgetPlanForm.vue | 16 ++-- 3 files changed, 77 insertions(+), 41 deletions(-) diff --git a/src/components/jeecg/HPlan.vue b/src/components/jeecg/HPlan.vue index b45333a..12d557c 100644 --- a/src/components/jeecg/HPlan.vue +++ b/src/components/jeecg/HPlan.vue @@ -115,7 +115,7 @@ value: { immediate: true, handler: function(val) { - console.log(val,'4444444444444444444') + // console.log(val,'4444444444444444444') if (!val) { this.showText = '' } else { @@ -145,7 +145,7 @@ showTextVal(){ getAction("/hy/processUdgetPlan/queryById", {id:this.showText}).then((res) => { if (res.success) { - console.log(res.result) + // console.log(res.result) let params={} params.ids=[]; params.vals=[]; @@ -213,7 +213,7 @@ if(!val){ val = "" } - console.log(val,"这是什么鬼") + // console.log(val,"这是什么鬼") tempDestArr.push(val) } res[destFieldsArr[i]] = tempDestArr.join(",") @@ -224,7 +224,7 @@ params.ids=[]; params.vals=[]; for(let rw of rows){ - console.log(rw,"11111111111111111111") + // console.log(rw,"11111111111111111111") if(!rw){ rw = "" } @@ -232,10 +232,10 @@ params.vals.push(rw.warehousingBatch) } params.vals=params.vals.join(",") - console.log(params,"*-*-*-*-*-*-*-") + // console.log(params,"*-*-*-*-*-*-*-") this.showText = params }else { - console.log("222222222222222222") + // console.log("222222222222222222") this.showText =rows[0].id } // update--end--autor:lvdandan-----date:20200630------for:多选时未带回多个值------ @@ -245,11 +245,11 @@ this.$emit('callback', rows[0].id) this.$emit('mounted', rows) this.$emit('callType', rows[0]) - console.log(rows,"选中的数据-----") + // console.log(rows,"选中的数据-----") } else { //v-model时 需要传一个参数field 表示当前这个字段 从而根据这个字段的顺序找到原始值 // this.$emit("input",row[orgFieldsArr[destFieldsArr.indexOf(this.field)]]) - console.log(rows,"选中的数据") + // console.log(rows,"选中的数据") this.$emit('input', this.showText, rows[0]) this.$emit('mounted', rows) this.$emit('callType', rows[0]) diff --git a/src/views/activiti/form/ProcessMaterialWarehousingForm.vue b/src/views/activiti/form/ProcessMaterialWarehousingForm.vue index d2b699a..6fe1cf7 100644 --- a/src/views/activiti/form/ProcessMaterialWarehousingForm.vue +++ b/src/views/activiti/form/ProcessMaterialWarehousingForm.vue @@ -383,6 +383,18 @@ import JSelectItem from '@/components/jeecgbiz/JSelectItem' this.popupCallback(company, userInfo, puwwcid) } }, + watch:{ + 'processMaterialWarehousingListTable.dataSource': { // 对对象的某一个属性进行深度监听 + handler(nv) { + // console.log(nv) + if(nv.length>0){ + this.echoStorage(nv); + } + }, + immediate: true, + deep: true + } + }, methods: { //tab 值改变触发事件 onSelect(record){ @@ -559,7 +571,7 @@ import JSelectItem from '@/components/jeecgbiz/JSelectItem' //1、文件回显 this.data = getRecord(this.data) } - console.log(this.data,'回显表单数据') + // console.log(this.data,'回显表单数据') let fieldval = pick(this.data, 'id', 'company', 'createTime', 'departId', 'createBy', 'processUdgetPlanId', 'materialType', 'targetLibrary', 'warehousingBatch', 'fileId','opinion') this.$nextTick(() => { this.form.setFieldsValue(fieldval) @@ -570,6 +582,54 @@ import JSelectItem from '@/components/jeecgbiz/JSelectItem' this.requestSubTableData(this.url.processMaterialWarehousingList.list, params, this.processMaterialWarehousingListTable) } }, + /** 查询某个tab的数据 */ + requestSubTableData(url, params, tab, success) { + // tab.loading = true + getAction(url, params).then(res => { + let { result } = res + let dataSource = [] + if (result) { + if (Array.isArray(result)) { + dataSource = result + } else if (Array.isArray(result.records)) { + dataSource = result.records + } + } + tab.dataSource = dataSource + typeof success === 'function' ? success(res) : '' + }).finally(() => { + // tab.loading = false + }) + }, + + async echoStorage(nv){ + this.processMaterialWarehousingListTable.loading = true; + for (const item of nv) { + let par = { id : item.materialGroup,} + let param = {id : item.materialNumber,} + await getAction(this.url.queryByIdDescription,par).then( res=>{ + // console.log(res); + if(res.success){ + this.processMaterialWarehousingListTable.columns[0].options= [{ + title : res.result.materialClassify, + value : item.materialGroup, + disabled : true }]; + } + }) + await getAction(this.url.queryByIdMerchandiseNews,param).then( res=>{ + // console.log(res); + if(res.success){ + this.processMaterialWarehousingListTable.columns[1].options= [{ + title : res.result.materialsNumber, + value : item.materialNumber, + disabled : true }]; + } + }) + + } + this.processMaterialWarehousingListTable.loading = false; + }, + /** 整理成formData */ classifyIntoFormData(allValues) { let main = Object.assign(this.model, allValues.formValue) @@ -597,30 +657,6 @@ import JSelectItem from '@/components/jeecgbiz/JSelectItem' } } this.processUdgetPlanIds=ids.join(","); - this.processMaterialWarehousingListTable.dataSource.forEach(item =>{ - let par = { id : item.materialGroup,} - let param = {id : item.materialNumber,} - getAction(this.url.queryByIdDescription,par).then( res=>{ - // console.log(res); - if(res.success){ - this.processMaterialWarehousingListTable.columns[0].options= [{ - title : res.result.materialClassify, - value : item.materialGroup, - disabled : true }]; - } - }) - getAction(this.url.queryByIdMerchandiseNews,param).then( res=>{ - // console.log(res); - if(res.success){ - this.processMaterialWarehousingListTable.columns[1].options= [{ - title : res.result.materialsNumber, - value : item.materialNumber, - disabled : true }]; - } - }) - - }) - }, validateError(msg) { this.$message.error(msg) diff --git a/src/views/activiti/form/ProcessUdgetPlanForm.vue b/src/views/activiti/form/ProcessUdgetPlanForm.vue index 29ca943..63c66af 100644 --- a/src/views/activiti/form/ProcessUdgetPlanForm.vue +++ b/src/views/activiti/form/ProcessUdgetPlanForm.vue @@ -856,7 +856,7 @@ } }) - if (!!record.row.id) { + if (!!record.row.id && Object.keys(materialName).length > 0 ) { await this.$refs.processUdgetPlanMaterial.getValues((a, b, c) => { // console.log("bbbbbbbbbbbbbb",b) b.forEach(item => { @@ -958,14 +958,14 @@ if (this.processUdgetPlanMaterialTable.columns[1].options.length > 0) { this.processUdgetPlanMaterialTable.columns[1].options = [] } - this.$refs.processUdgetPlanMaterial.getValues((a, b, c) => { - b.forEach(item => { - if (item.materialNumber !== '' && item.materialNumber !== undefined && item.materialNumber !== null) { - numberList.push(item.materialNumber) - } - }) + this.$refs.processUdgetPlanMaterial.getValues((a, b, c) => { + b.forEach(item => { + if (item.materialNumber !== '' && item.materialNumber !== undefined && item.materialNumber !== null) { + numberList.push(item.materialNumber) + } + }) - }) + }) getAction(this.url.merchandiseNewsList, par).then((res) => { // console.log('12312', res.result) // console.log('12312')