From b9f127e59ea5fa113b3b0241ed3fc860512ae6d1 Mon Sep 17 00:00:00 2001 From: caoyizhong <1270296080@qq.com> Date: Wed, 26 Oct 2022 15:21:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=81=E7=A8=8B=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activiti/form/ProcessUdgetPlanForm.vue | 186 +++++++++++++----- 1 file changed, 134 insertions(+), 52 deletions(-) diff --git a/src/views/activiti/form/ProcessUdgetPlanForm.vue b/src/views/activiti/form/ProcessUdgetPlanForm.vue index 5b1d8c5..0fe2bd8 100644 --- a/src/views/activiti/form/ProcessUdgetPlanForm.vue +++ b/src/views/activiti/form/ProcessUdgetPlanForm.vue @@ -119,6 +119,8 @@ data() { return { bigId:[], + bigIdMerchandiseNews:[], + bigIdMerchandiseNewsList:[], labelCol: { xs: { span: 24 }, sm: { span: 6 } @@ -156,7 +158,6 @@ width: '200px', placeholder: '请输入${title}', options: [], - props:{title: 'show title'} // scopedSlots: { customRender: 'edit' },//引入的插槽 // customRender:function (t,r,index) { // console.log(t,r); @@ -171,7 +172,7 @@ dictCode: '', width: '200px', placeholder: '请输入${title}', - defaultValue: '' + options: [], }, // { // title: '物料描述', @@ -240,7 +241,8 @@ { title: '物料名称及规格型号', key: 'materialName', - type: FormTypes.sel_search, + type: FormTypes.input, + // type: FormTypes.sel_search, dictCode: '', width: '200px', placeholder: '请输入${title}', @@ -249,7 +251,7 @@ { title: '系列', key: 'materialSeries', - type: FormTypes.sel_search, + type: FormTypes.input, dictCode: '', width: '200px', placeholder: '请输入${title}', @@ -258,7 +260,8 @@ { title: '单位', key: 'materialUnit', - type: FormTypes.select, + type: FormTypes.input, + // type: FormTypes.select, dictCode: '', width: '200px', placeholder: '请输入${title}', @@ -396,17 +399,55 @@ }, methods: { onSelect(record) { - // this.$refs.processUdgetPlanMaterial.getValues((error, values) => { - // - // console.log(error, values) - // }) - - console.log(record.row); - console.log(record.row.materialGroup); - if(record.row.materialGroup.length > 0){ - console.log("执行l") + // console.log(record.row); + if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.materialNumber === ''){ + // console.log("执行materialGroup") this.fetchMerchandiseNews(record.row.materialGroup); } + if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.materialNumber !== ''){ + // console.log("执行materialNumber") + let materialName = { } + this.bigIdMerchandiseNewsList.forEach( item => { + if( item.id === record.row.materialNumber ){ + materialName ={ + name: item.merchandiseName, + unit: item.materialsUnit, + } + + } + }) + let values = [ + { + rowKey: record.row.id, + values: { + 'materialNumber': record.row.materialNumber, + 'materialGroup': record.row.materialGroup, + 'materialSeries':"SM-JD36-BA", + 'materialName': materialName.name, + 'materialUnit': materialName.unit, + }, + }, + ] + this.$refs.processUdgetPlanMaterial.setValues(values); + } + + if(record.row.materialQuantity !== '' && record.row.materialPrice !== '' && record.row.materialQuantity !== undefined && record.row.materialPrice !== undefined){ + // record.row.materialAmount = record.row.materialQuantity * record.row.materialPrice; + let values = [ + { + rowKey: record.row.id, + values: { + 'materialNumber': record.row.materialNumber, + 'materialGroup': record.row.materialGroup, + 'materialSeries': record.row.materialSeries, + 'materialName': record.row.materialName, + 'materialUnit': record.row.materialUnit, + 'materialAmount': record.row.materialQuantity * record.row.materialPrice + }, + }, + ] + this.$refs.processUdgetPlanMaterial.setValues(values); + } }, fetchMerchandiseNews(value){ //查询物料组 @@ -415,16 +456,54 @@ delFlag: 0, descriptionId:value, } - this.bigId = []; + this.bigIdMerchandiseNews = []; + this.bigIdMerchandiseNewsList = []; + let qc = []; + let numberList = []; + if(this.processUdgetPlanMaterialTable.columns[1].options.length > 0){ + this.processUdgetPlanMaterialTable.columns[1].options = []; + } + this.$refs.processUdgetPlanMaterial.getValues((a,b,c)=>{ + // console.log(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)=>{ if(res.success){ - console.log(res.result); - // res.result.forEach( item => { - // this.processUdgetPlanMaterialTable.columns[0].options.push({ - // title : item.descriptionName, - // value : item.id, - // }) - // }) + // console.log(res.result); + let newList = res.result; + // console.log("12312312:"+numberList.length); + if(numberList.length > 0){ + newList.forEach( item => { + qc.push({ + title : item.materialsNumber, + value : item.id, + disabled : false + }) + }) + numberList.forEach( num => { + qc.forEach( i => { + if(num === i.value){ + console.log(num,i.value); + i.disabled = true; + } + }); + }) + this.processUdgetPlanMaterialTable.columns[1].options = qc; + }else{ + newList.forEach( item => { + this.processUdgetPlanMaterialTable.columns[1].options.push({ + title : item.materialsNumber, + value : item.id, + disabled : false + }) + }) + } + // console.log(this.processUdgetPlanMaterialTable.columns[1].options); + this.bigIdMerchandiseNewsList = res.result; } }); }, @@ -437,7 +516,10 @@ this.bigId = []; getAction(this.url.descriptionRake,par).then((res)=>{ if(res.success){ - console.log(res.result); + // console.log(res.result); + if(this.processUdgetPlanMaterialTable.columns[0].options.length > 0){ + this.processUdgetPlanMaterialTable.columns[0].options = []; + } res.result.forEach( item => { this.processUdgetPlanMaterialTable.columns[0].options.push({ title : item.descriptionName, @@ -555,35 +637,35 @@ throw this.throwNotFunction('classifyIntoFormData') } let formData = this.classifyIntoFormData(allValues) - - this.form.validateFields((err, values) => { - if (!err) { - formData.procDefId = this.processData.id; - formData.procDeTitle = this.processData.name; - formData.title=this.processData.description; - if (!formData.tableName)formData.tableName = this.processData.businessTable; - console.log('格式化后的数据',formData) - var url = this.url.add; - let method='post'; - if (!this.isNew){ - url = this.url.edit; - method='put'; - } - console.log('提交方法',method) - this.btndisabled = true; - httpAction(url,formData,method).then((res)=>{ - if (res.success){ - this.$message.success("保存成功!") - //todo 将表单的数据传给父组件 - this.$emit('afterSubmit',formData) - }else { - this.$message.error(res.message) - } - }).finally(()=>{ - this.btndisabled = false; - }) - } - }) + console.log('格式化后的数据',formData) + // this.form.validateFields((err, values) => { + // if (!err) { + // formData.procDefId = this.processData.id; + // formData.procDeTitle = this.processData.name; + // formData.title=this.processData.description; + // if (!formData.tableName)formData.tableName = this.processData.businessTable; + // console.log('格式化后的数据',formData) + // var url = this.url.add; + // let method='post'; + // if (!this.isNew){ + // url = this.url.edit; + // method='put'; + // } + // console.log('提交方法',method) + // this.btndisabled = true; + // httpAction(url,formData,method).then((res)=>{ + // if (res.success){ + // this.$message.success("保存成功!") + // //todo 将表单的数据传给父组件 + // this.$emit('afterSubmit',formData) + // }else { + // this.$message.error(res.message) + // } + // }).finally(()=>{ + // this.btndisabled = false; + // }) + // } + // }) }) },