From 165d1ed470cc2f664d42be0ff471c67ff511366c Mon Sep 17 00:00:00 2001 From: long <18782126717@163.com> Date: Sat, 12 Nov 2022 16:18:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E5=8D=95=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E6=8F=90=E4=BA=A4=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/ProcessMaterialWarehousingForm.vue | 52 +- .../form/ProcessMaterialsAllotForm.vue | 59 +- .../form/ProcessMaterialsDeliveryForm.vue | 737 +++++++++--------- .../form/ProcessSmaterialsScrapForm.vue | 120 ++- .../activiti/form/ProcessUdgetPlanForm.vue | 4 +- 5 files changed, 478 insertions(+), 494 deletions(-) diff --git a/src/views/activiti/form/ProcessMaterialWarehousingForm.vue b/src/views/activiti/form/ProcessMaterialWarehousingForm.vue index 8548bb8..9d040a2 100644 --- a/src/views/activiti/form/ProcessMaterialWarehousingForm.vue +++ b/src/views/activiti/form/ProcessMaterialWarehousingForm.vue @@ -283,8 +283,7 @@ import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep' getForm:'/actBusiness/getForm', add: "/hy/processMaterialWarehousing/add", edit: "/hy/processMaterialWarehousing/edit", - addWarehousingApply: "/hy/processMaterialWarehousing/addWarehousingApply" + - "", + addWarehousingApply: "/hy/processMaterialWarehousing/addWarehousingApply", editWarehousingApply: "/hy/processMaterialWarehousing/editWarehousingApply", queryById: "/hy/processMaterialWarehousing/queryById", list: "/hy/processUdgetPlan/queryProcessUdgetPlanMaterialByMainId", @@ -426,51 +425,40 @@ import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep' applySubmit(e) { this.getAllTable().then(tables => { return validateFormAndTables(this.form, tables) - }).then(allValues=>{ + }).then(allValues => { if (typeof this.classifyIntoFormData !== 'function') { throw this.throwNotFunction('classifyIntoFormData') } let formData = this.classifyIntoFormData(allValues) - //计算总价 - for (let i = 0; i < formData.processUdgetPlanMaterialList.length; i++) { - this.materialAmount=this.materialAmount+ formData.processUdgetPlanMaterialList[i].materialAmount; + formData.fileId = getStringArry(formData.fileId) + for (let i = 0; i < formData.processMaterialWarehousingListList.length; i++) { if (i==0){ - this.describes=formData.processUdgetPlanMaterialList[i].materialName + this.describes=formData.processMaterialWarehousingListList[i].materialName }else { - this.describes=this.describes+"---"+formData.processUdgetPlanMaterialList[i].materialName + this.describes=this.describes+"---"+formData.processMaterialWarehousingListList[i].materialName } - } - formData.fileId = getStringArry(formData.fileId) - formData.materialPrice=this.materialPrice; - formData.materialAmount=this.materialAmount; formData.describes=this.describes; - if (new Date(formData.createTime).getTime()/100>new Date(formData.needTime).getTime()/100){ - this.$message.error("需求时间不能小于当前流程发起时间") - return; - } - console.log(this.materialAmount,'采购总价') - - console.log(this.opinion,'流程说明') + 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; - var url = this.url.addWarehousingApply; - let method='post'; - if (!this.isNew){ - url = this.url.editWarehousingApply; - method='put'; + formData.procDefId = this.processData.id + formData.procDeTitle = this.processData.name + formData.title = this.processData.description + formData.targetLibrary = this.libraryAssociationIdInvisible + if (!formData.tableName) formData.tableName = this.processData.businessTable + var url = this.url.add + let method = 'post' + if (!this.isNew) { + url = this.url.edit + method = 'put' } - this.btndisabled = true; - console.log(formData,'表单数据') + this.btndisabled = true httpAction(url,formData,method).then((res)=>{ if (res.success){ - //this.$message.success("保存成功!") + this.$message.success("提交申请成功!") //todo 将表单的数据传给父组件 - this.$emit('afterSubmit',formData) + this.close(); }else { this.$message.error(res.message) } diff --git a/src/views/activiti/form/ProcessMaterialsAllotForm.vue b/src/views/activiti/form/ProcessMaterialsAllotForm.vue index ee5e5e2..91f9053 100644 --- a/src/views/activiti/form/ProcessMaterialsAllotForm.vue +++ b/src/views/activiti/form/ProcessMaterialsAllotForm.vue @@ -628,51 +628,50 @@ applySubmit(e) { this.getAllTable().then(tables => { return validateFormAndTables(this.form, tables) - }).then(allValues=>{ + }).then(allValues => { + console.log('所有数据', allValues) if (typeof this.classifyIntoFormData !== 'function') { throw this.throwNotFunction('classifyIntoFormData') } let formData = this.classifyIntoFormData(allValues) - //计算总价 - for (let i = 0; i < formData.processUdgetPlanMaterialList.length; i++) { - this.materialAmount=this.materialAmount+ formData.processUdgetPlanMaterialList[i].materialAmount; + formData.fileId = getStringArry(formData.fileId) + // if (formData.materialType === null || formData.materialType ==='' || formData.materialType === undefined){ + // this.$message.error("物资类型不能为空") + // return; + // } + // if (formData.beAllotDepartment === null || formData.beAllotDepartment ==='' || formData.beAllotDepartment === undefined){ + // this.$message.error("被调拨部门不能为空") + // return; + // } + for (let i = 0; i < formData.processMaterialsAllotListList.length; i++) { if (i==0){ - this.describes=formData.processUdgetPlanMaterialList[i].materialName + this.describes=formData.processMaterialsAllotListList[i].materialName }else { - this.describes=this.describes+"---"+formData.processUdgetPlanMaterialList[i].materialName + this.describes=this.describes+"---"+formData.processMaterialsAllotListList[i].materialName } - } - formData.fileId = getStringArry(formData.fileId) - formData.materialPrice=this.materialPrice; - formData.materialAmount=this.materialAmount; formData.describes=this.describes; - if (new Date(formData.createTime).getTime()/100>new Date(formData.needTime).getTime()/100){ - this.$message.error("需求时间不能小于当前流程发起时间") - return; - } - console.log(this.materialAmount,'采购总价') - - console.log(this.opinion,'流程说明') 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; - var url = this.url.addAlloApply; - let method='post'; - if (!this.isNew){ - url = this.url.editAlloApply; - method='put'; + formData.procDefId = this.processData.id + formData.procDeTitle = this.processData.name + formData.title = this.processData.description + formData.targetLibrary = this.libraryAssociationIdInvisible + 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' } - this.btndisabled = true; - console.log(formData,'表单数据') + console.log('提交方法', method) + this.btndisabled = true httpAction(url,formData,method).then((res)=>{ if (res.success){ - //this.$message.success("保存成功!") + this.$message.success("提交申请成功!") //todo 将表单的数据传给父组件 - this.$emit('afterSubmit',formData) + this.close(); }else { this.$message.error(res.message) } diff --git a/src/views/activiti/form/ProcessMaterialsDeliveryForm.vue b/src/views/activiti/form/ProcessMaterialsDeliveryForm.vue index f83f3f0..bf4b3fa 100644 --- a/src/views/activiti/form/ProcessMaterialsDeliveryForm.vue +++ b/src/views/activiti/form/ProcessMaterialsDeliveryForm.vue @@ -14,22 +14,22 @@ - + - + - + - + @@ -42,13 +42,13 @@ dictCode="material_type" placeholder="请选择物资类型"/> - + - + @@ -66,24 +66,24 @@ :dataSource="processMaterialsDeliveryListTable.dataSource" :maxHeight="300" :disabled="this.heid" - @valueChange ="onSelect" + @valueChange="onSelect" :rowNumber="true" :rowSelection="true" :actionButton="true" @added="addid" > - - - + + + - + - - + + @@ -94,12 +94,13 @@
保存 - 提交申请 + 提交申请 + 取消 - 通过 - 驳回 + 通过 + 驳回
@@ -134,32 +135,32 @@ }, data() { return { - libraryAssociationIdInvisible:'ZK', - rolePlay :false , - jiy:[], + libraryAssociationIdInvisible: 'ZK', + rolePlay: false, + jiy: [], heid: true, - addId : '', - bigIdMerchandiseNewsList:[], + addId: '', + bigIdMerchandiseNewsList: [], labelCol: { xs: { span: 24 }, - sm: { span: 6 }, + sm: { span: 6 } }, wrapperCol: { xs: { span: 24 }, - sm: { span: 16 }, + sm: { span: 16 } }, labelCol2: { xs: { span: 24 }, - sm: { span: 3 }, + sm: { span: 3 } }, wrapperCol2: { xs: { span: 24 }, - sm: { span: 20 }, + sm: { span: 20 } }, // 新增时子表默认添加几行空数据 addDefaultRowNum: 1, - refKeys: ['processMaterialsDeliveryList', ], - tableKeys:['processMaterialsDeliveryList', ], + refKeys: ['processMaterialsDeliveryList'], + tableKeys: ['processMaterialsDeliveryList'], activeKey: 'processMaterialsDeliveryList', // 物资出库流程出库清单 processMaterialsDeliveryListTable: { @@ -175,7 +176,7 @@ dictCode: '', width: '200px', placeholder: '请输入${title}', - options: [], + options: [] // props:{title: 'show title'} // scopedSlots: { customRender: 'edit' },//引入的插槽 // customRender:function (t,r,index) { @@ -200,42 +201,42 @@ dictCode: '', width: '200px', placeholder: '请输入${title}', - defaultValue:'', + defaultValue: '' }, { title: '物料名称', key: 'materialName', type: FormTypes.input, - dictCode:"", - width:"200px", + dictCode: '', + width: '200px', placeholder: '请输入${title}', - defaultValue:'', + defaultValue: '' }, { title: '规格', key: 'specification', type: FormTypes.input, - dictCode:"", - width:"200px", + dictCode: '', + width: '200px', placeholder: '请输入${title}', - defaultValue:'', + defaultValue: '' }, { title: '型号', key: 'type', type: FormTypes.input, - dictCode:"", - width:"200px", + dictCode: '', + width: '200px', placeholder: '请输入${title}', - defaultValue:'', + defaultValue: '' }, { title: '单位', key: 'materialUnit', type: FormTypes.input, - dictCode:"", - width:"200px", + dictCode: '', + width: '200px', placeholder: '请输入${title}', - defaultValue:'', + defaultValue: '' }, // { // title: '批次', @@ -249,55 +250,55 @@ title: '请发数', key: 'pleaseSendNumber', type: FormTypes.inputNumber, - width:"200px", + width: '200px', placeholder: '请输入${title}', - defaultValue:'', + defaultValue: '' // slotName: 'qing' }, { title: '实发数', key: 'actualSendNumber', type: FormTypes.inputNumber, - width:"200px", + width: '200px', placeholder: '请输入${title}', - defaultValue:'', - disabled:true, + defaultValue: '', + disabled: true }, { title: '供货商', key: 'supplierId', type: FormTypes.input, - dictCode:"", - width:"200px", + dictCode: '', + width: '200px', placeholder: '请输入${title}', - defaultValue:'', + defaultValue: '' }, { title: '单价(元)', key: 'materialPrice', type: FormTypes.inputNumber, - width:"200px", + width: '200px', placeholder: '请输入${title}', - defaultValue:'', - disabled:true, + defaultValue: '', + disabled: true }, { title: '金额(元)', key: 'materialAmount', type: FormTypes.inputNumber, - width:"200px", + width: '200px', placeholder: '请输入${title}', - defaultValue:'', - disabled:true, + defaultValue: '', + disabled: true }, { title: '用途', key: 'purpose', type: FormTypes.input, - width:"200px", + width: '200px', placeholder: '请输入${title}', - defaultValue:'', - }, + defaultValue: '' + } // { // title: '', // key: 'MaterialsDeliveryId', @@ -320,21 +321,21 @@ wasteMaterialsUrl: '/wastematerials/processWasteMaterials/wasteMaterialsName', //查询账外物料组 merchandiseNewsList: '/suppliesstronger/processSuppliesStronger/merchandiseNews', wasteMaterialsList: '/wastematerials/processWasteMaterials/merchandiseNewsName', //账外 - puwwlist: "/unitwaste/processUnitWasteWarehouseCode/queryById", - unitWasteWarehouseList: "/unitwaste/processUnitWasteWarehouseCode/queryById", //查询目标库 + puwwlist: '/unitwaste/processUnitWasteWarehouseCode/queryById', + unitWasteWarehouseList: '/unitwaste/processUnitWasteWarehouseCode/queryById', //查询目标库 processMaterialsDeliveryList: { list: '/hy/processMaterialsDelivery/queryProcessMaterialsDeliveryListByMainId' } }, btndisabled: false, - describes:'', + describes: '', validatorRules: { // 'blur'是鼠标失去焦点的时候会触发验证 materialType: { rules: [{ required: true, message: '请选择物资类型!' }] }, deliveryTime: { rules: [{ required: true, message: '请选择出库时间!' }] }, processPlan: { rules: [{ required: true, message: '请选择流程计划!' }] } }, - materialGroupId: undefined, + materialGroupId: undefined } }, props: { @@ -400,67 +401,67 @@ let puwwcid = sessionStorage.getItem('PUWWC_Id') let userInfo = sessionStorage.getItem('USER_INFORMATION') // userInfo.company=company; - this.popupCallback(company,userInfo,puwwcid); + this.popupCallback(company, userInfo, puwwcid) }, methods: { - shuliang(){ + shuliang() { this.addId }, //请数量输入 - addid(val){ - this.addId = val.row.id; + addid(val) { + this.addId = val.row.id // console.log(this.addId); - this.materialGroupId = undefined; + this.materialGroupId = undefined }, //核算属性切换 - isMaterialType(val){ - if(val !== undefined){ - this.accountingAttributesVal = val - this.heid = false; - this.fetchData(val); + isMaterialType(val) { + if (val !== undefined) { + this.accountingAttributesVal = val + this.heid = false + this.fetchData(val) - } + } }, async onSelect(record) { // console.log(record) - let isMA= true; - if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined){ + let isMA = true + if (record.row.materialGroup !== '' && record.row.materialGroup !== undefined) { // console.log("执行materialGroup111") - if(record.row.id !== undefined && record.row.id !== '' && record.row.materialGroup !== this.materialGroupId){ + if (record.row.id !== undefined && record.row.id !== '' && record.row.materialGroup !== this.materialGroupId) { // console.log("执行materialGroup222") - if(this.rolePlay){ + if (this.rolePlay) { //账外 - await this.fetchMerchandiseNewsZW(record.row.materialGroup, 1); - }else{ + await this.fetchMerchandiseNewsZW(record.row.materialGroup, 1) + } else { //总库 - await this.fetchMerchandiseNews(record.row.materialGroup, 1); + await this.fetchMerchandiseNews(record.row.materialGroup, 1) } - let valu = [ - { - rowKey: record.row.id, - values: { - 'equipment': '', - 'materialGroup': record.row.materialGroup, - 'materialName': '', - 'materialUnit': '', - 'supplierId': '', - 'materialPrice': '', - 'actualSendNumber': '', - 'materialAmount': '', - 'pleaseSendNumber': '', + let valu = [ + { + rowKey: record.row.id, + values: { + 'equipment': '', + 'materialGroup': record.row.materialGroup, + 'materialName': '', + 'materialUnit': '', + 'supplierId': '', + 'materialPrice': '', + 'actualSendNumber': '', + 'materialAmount': '', + 'pleaseSendNumber': '' - }, - }, - ] - // console.log(valu) - this.$refs.processMaterialsDeliveryList.setValues(valu); - this.materialGroupId = record.row.materialGroup; - isMA = false; + } + } + ] + // console.log(valu) + this.$refs.processMaterialsDeliveryList.setValues(valu) + this.materialGroupId = record.row.materialGroup + isMA = false } } - if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment !== '' && record.row.equipment !== undefined && isMA ){ + if (record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment !== '' && record.row.equipment !== undefined && isMA) { // console.log("执行materialNumber") let materialName = {} this.bigIdMerchandiseNewsList.forEach(item => { @@ -470,11 +471,11 @@ unit: item.materialsUnit, supplierName: item.supplierName, price: item.materialPrice, - residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, + residueNumber: item.residueNumber === undefined ? 0 : item.residueNumber } } }) - if(record.row.id !== undefined){ + if (record.row.id !== undefined) { let values = [ { rowKey: record.row.id, @@ -486,188 +487,188 @@ 'supplierId': materialName.supplierName, 'materialPrice': materialName.price, 'actualSendNumber': materialName.residueNumber, - 'materialAmount': materialName.price * materialName.residueNumber, - }, - }, + 'materialAmount': materialName.price * materialName.residueNumber + } + } ] - this.$refs.processMaterialsDeliveryList.setValues(values); + this.$refs.processMaterialsDeliveryList.setValues(values) } } // 根据请发数量计算 - if(record.row.pleaseSendNumber !== '' && record.row.pleaseSendNumber !== undefined && isMA ){ + if (record.row.pleaseSendNumber !== '' && record.row.pleaseSendNumber !== undefined && isMA) { // console.log("执行了",record.row) - let res = record.row; + let res = record.row let materialName = {} this.bigIdMerchandiseNewsList.forEach(item => { if (item.merchandiseNewsId === record.row.equipment) { materialName = { - residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, + residueNumber: item.residueNumber === undefined ? 0 : item.residueNumber } } }) // console.log("materialName.residueNumber",materialName.residueNumber) - if(parseInt( res.pleaseSendNumber) > parseInt( materialName.residueNumber )){ + if (parseInt(res.pleaseSendNumber) > parseInt(materialName.residueNumber)) { // console.log("大于") - this.$message.warn("输入请发数不能大于库存数") - res.pleaseSendNumber = materialName.residueNumber; - res.actualSendNumber = materialName.residueNumber; - }else{ + this.$message.warn('输入请发数不能大于库存数') + res.pleaseSendNumber = materialName.residueNumber + res.actualSendNumber = materialName.residueNumber + } else { // console.log("小于") - res.actualSendNumber = res.pleaseSendNumber; + res.actualSendNumber = res.pleaseSendNumber + } + if (res.id !== undefined) { + let value = [ + { + rowKey: res.id, + values: { + // 'equipment': res.equipment, + // 'materialGroup': res.materialGroup, + // 'materialName': res.materialName, + // 'materialUnit': res.materialUnit, + // 'supplier': res.supplier, + // 'materialPrice': res.materialPrice, + 'actualSendNumber': res.actualSendNumber, + 'pleaseSendNumber': res.pleaseSendNumber, + 'materialAmount': res.materialPrice * res.actualSendNumber + } + } + ] + this.$nextTick(() => { + this.$refs.processMaterialsDeliveryList.setValues(value) + }) } - if(res.id !== undefined ){ - let value = [ - { - rowKey: res.id, - values: { - // 'equipment': res.equipment, - // 'materialGroup': res.materialGroup, - // 'materialName': res.materialName, - // 'materialUnit': res.materialUnit, - // 'supplier': res.supplier, - // 'materialPrice': res.materialPrice, - 'actualSendNumber': res.actualSendNumber, - 'pleaseSendNumber': res.pleaseSendNumber, - 'materialAmount': res.materialPrice * res.actualSendNumber, - }, - }, - ] - this.$nextTick(()=>{ - this.$refs.processMaterialsDeliveryList.setValues(value); - }) - } } }, - fetchMerchandiseNews(value){ //查询物料清单信息 + fetchMerchandiseNews(value) { //查询物料清单信息 //查询大品类数据 - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { //你的逻辑代码 let par = { delFlag: 0, - descriptionId:value, + descriptionId: value } - this.bigIdMerchandiseNewsList = []; - let qc = []; - let numberList = []; - if(this.processMaterialsDeliveryListTable.columns[1].options.length > 0){ - this.processMaterialsDeliveryListTable.columns[1].options = []; + this.bigIdMerchandiseNewsList = [] + let qc = [] + let numberList = [] + if (this.processMaterialsDeliveryListTable.columns[1].options.length > 0) { + this.processMaterialsDeliveryListTable.columns[1].options = [] } - this.$refs.processMaterialsDeliveryList.getValues((a,b,c)=>{ - console.log(a,b,c) - b.forEach(item =>{ - if(item.equipment !== '' && item.equipment !== undefined && item.equipment !== null){ - numberList.push(item.equipment); + this.$refs.processMaterialsDeliveryList.getValues((a, b, c) => { + console.log(a, b, c) + b.forEach(item => { + if (item.equipment !== '' && item.equipment !== undefined && item.equipment !== null) { + numberList.push(item.equipment) } - }); - }); - getAction(this.url.merchandiseNewsList,par).then((res)=>{ - if(res.success){ - console.log(res.result); - let newList = res.result; - console.log("12312312:"+numberList.length); - if(numberList.length > 0){ - newList.forEach( item => { + }) + }) + getAction(this.url.merchandiseNewsList, par).then((res) => { + if (res.success) { + 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.merchandiseNewsId, - disabled : false + title: item.materialsNumber, + value: item.merchandiseNewsId, + disabled: false }) }) - numberList.forEach( num => { - qc.forEach( i => { - console.log(num); - console.log(i.value); - if(num === i.value){ - console.log(num,i.value); - i.disabled = true; + numberList.forEach(num => { + qc.forEach(i => { + console.log(num) + console.log(i.value) + if (num === i.value) { + console.log(num, i.value) + i.disabled = true } - }); + }) }) - this.processMaterialsDeliveryListTable.columns[1].options = qc; - }else{ - newList.forEach( item => { + this.processMaterialsDeliveryListTable.columns[1].options = qc + } else { + newList.forEach(item => { this.processMaterialsDeliveryListTable.columns[1].options.push({ - title : item.materialsNumber, - value : item.merchandiseNewsId, - disabled : false + title: item.materialsNumber, + value: item.merchandiseNewsId, + disabled: false }) }) } // console.log(this.processUdgetPlanMaterialTable.columns[1].options); - resolve(this.bigIdMerchandiseNewsList = res.result ); + resolve(this.bigIdMerchandiseNewsList = res.result) // return } - }); + }) - }); + }) }, - fetchMerchandiseNewsZW(value){ //查询账外物料清单信息 + fetchMerchandiseNewsZW(value) { //查询账外物料清单信息 //查询大品类数据 - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { //你的逻辑代码 let par = { delFlag: 0, - descriptionId:value, + descriptionId: value } - this.bigIdMerchandiseNewsList = []; - let qc = []; - let numberList = []; - if(this.processMaterialsDeliveryListTable.columns[1].options.length > 0){ - this.processMaterialsDeliveryListTable.columns[1].options = []; + this.bigIdMerchandiseNewsList = [] + let qc = [] + let numberList = [] + if (this.processMaterialsDeliveryListTable.columns[1].options.length > 0) { + this.processMaterialsDeliveryListTable.columns[1].options = [] } - this.$refs.processMaterialsDeliveryList.getValues((a,b,c)=>{ - console.log(a,b,c) - b.forEach(item =>{ - if(item.equipment !== '' && item.equipment !== undefined && item.equipment !== null){ - numberList.push(item.equipment); + this.$refs.processMaterialsDeliveryList.getValues((a, b, c) => { + console.log(a, b, c) + b.forEach(item => { + if (item.equipment !== '' && item.equipment !== undefined && item.equipment !== null) { + numberList.push(item.equipment) } - }); - }); - getAction(this.url.wasteMaterialsList,par).then((res)=>{ - if(res.success){ + }) + }) + getAction(this.url.wasteMaterialsList, par).then((res) => { + if (res.success) { // console.log(res.result); - let newList = res.result; + let newList = res.result // console.log("12312312:"+numberList.length); - if(numberList.length > 0){ - newList.forEach( item => { + if (numberList.length > 0) { + newList.forEach(item => { qc.push({ - title : item.materialsNumber, - value : item.merchandiseNewsId, - disabled : false + title: item.materialsNumber, + value: item.merchandiseNewsId, + disabled: false }) }) - numberList.forEach( num => { - qc.forEach( i => { - if(num === i.value){ + numberList.forEach(num => { + qc.forEach(i => { + if (num === i.value) { // console.log(num,i.value); - i.disabled = true; + i.disabled = true } - }); + }) }) - this.processMaterialsDeliveryListTable.columns[1].options = qc; - }else{ - newList.forEach( item => { + this.processMaterialsDeliveryListTable.columns[1].options = qc + } else { + newList.forEach(item => { this.processMaterialsDeliveryListTable.columns[1].options.push({ - title : item.materialsNumber, - value : item.merchandiseNewsId, - disabled : false + title: item.materialsNumber, + value: item.merchandiseNewsId, + disabled: false }) }) } // console.log(this.processUdgetPlanMaterialTable.columns[1].options); - resolve(this.bigIdMerchandiseNewsList = res.result ); + resolve(this.bigIdMerchandiseNewsList = res.result) // return } - }); + }) - }); + }) }, //table 值改变触发 @@ -959,55 +960,54 @@ fetchData(value) { //查询物料组 // console.log("this.data==============>",this.data) //部门id let params = {} - params.id =sessionStorage.getItem('USER_INFORMATION');//关联中间表id + params.id = sessionStorage.getItem('USER_INFORMATION')//关联中间表id - let ue= sessionStorage.getItem('USER_INFORMATION'); - let res=JSON.parse(ue); - if(res.realname !== "管理员"){ - // console.log("78979789",res); - // 查询大品类数据 账外库 - let par = { - delFlag: 0, - accountingAttributes: value, - sysOrgCode: this.data.sysOrgCode - } - getAction(this.url.wasteMaterialsUrl, par).then((res) => { - console.log(res) - if (res.success) { - if (this.processMaterialsDeliveryListTable.columns[0].options.length > 0) { - this.processMaterialsDeliveryListTable.columns[0].options = [] - } - res.result.forEach(item => { - this.processMaterialsDeliveryListTable.columns[0].options.push({ - title: item.descriptionName, - value: item.descriptionId - }) - }) + let ue = sessionStorage.getItem('USER_INFORMATION') + let res = JSON.parse(ue) + if (res.realname !== '管理员') { + // console.log("78979789",res); + // 查询大品类数据 账外库 + let par = { + delFlag: 0, + accountingAttributes: value, + sysOrgCode: this.data.sysOrgCode + } + getAction(this.url.wasteMaterialsUrl, par).then((res) => { + console.log(res) + if (res.success) { + if (this.processMaterialsDeliveryListTable.columns[0].options.length > 0) { + this.processMaterialsDeliveryListTable.columns[0].options = [] } - }) - this.rolePlay = true; - } else { - //查询大品类数据 总库 - let par = { - delFlag: 0, - accountingAttributes: value - } - getAction(this.url.descriptionRake, par).then((res) => { - if (res.success) { - if (this.processMaterialsDeliveryListTable.columns[0].options.length > 0) { - this.processMaterialsDeliveryListTable.columns[0].options = [] - } - res.result.forEach(item => { - this.processMaterialsDeliveryListTable.columns[0].options.push({ - title: item.descriptionName, - value: item.descriptionId - }) + res.result.forEach(item => { + this.processMaterialsDeliveryListTable.columns[0].options.push({ + title: item.descriptionName, + value: item.descriptionId }) - } - }) - this.rolePlay = false; + }) + } + }) + this.rolePlay = true + } else { + //查询大品类数据 总库 + let par = { + delFlag: 0, + accountingAttributes: value } - + getAction(this.url.descriptionRake, par).then((res) => { + if (res.success) { + if (this.processMaterialsDeliveryListTable.columns[0].options.length > 0) { + this.processMaterialsDeliveryListTable.columns[0].options = [] + } + res.result.forEach(item => { + this.processMaterialsDeliveryListTable.columns[0].options.push({ + title: item.descriptionName, + value: item.descriptionId + }) + }) + } + }) + this.rolePlay = false + } // getAction(this.url.unitWasteWarehouseList, params).then((res) => { // console.log(res) @@ -1056,24 +1056,23 @@ // } // }) - }, /*回显数据*/ - init(){ - this.btndisabled = true; - var r = this.processData; - this.getAction(this.url.queryById,{ - id:r.tableId - }).then((res)=>{ - if (res.success){ - let formData = res.result; - formData.tableName = r.tableName; - this.data = formData; - console.log("表单回显数据",this.data) - this.editAfter(); - this.btndisabled = false; - }else { + init() { + this.btndisabled = true + var r = this.processData + this.getAction(this.url.queryById, { + id: r.tableId + }).then((res) => { + if (res.success) { + let formData = res.result + formData.tableName = r.tableName + this.data = formData + console.log('表单回显数据', this.data) + this.editAfter() + this.btndisabled = false + } else { this.$message.error(res.message) } }) @@ -1094,76 +1093,80 @@ applySubmit(e) { this.getAllTable().then(tables => { return validateFormAndTables(this.form, tables) - }).then(allValues=>{ + }).then(allValues => { + if (typeof this.classifyIntoFormData !== 'function') { throw this.throwNotFunction('classifyIntoFormData') } let formData = this.classifyIntoFormData(allValues) - //计算总价 - for (let i = 0; i < formData.processUdgetPlanMaterialList.length; i++) { - this.materialAmount=this.materialAmount+ formData.processUdgetPlanMaterialList[i].materialAmount; - if (i==0){ - this.describes=formData.processUdgetPlanMaterialList[i].materialName - }else { - this.describes=this.describes+"---"+formData.processUdgetPlanMaterialList[i].materialName - } - - } formData.fileId = getStringArry(formData.fileId) - formData.materialPrice=this.materialPrice; - formData.materialAmount=this.materialAmount; - formData.describes=this.describes; - if (new Date(formData.createTime).getTime()/100>new Date(formData.needTime).getTime()/100){ - this.$message.error("需求时间不能小于当前流程发起时间") - return; + console.log('所有数据', formData) + if (new Date(formData.createTime).getTime() / 100 > new Date(formData.deliveryTime).getTime() / 100) { + this.$message.error('出库时间不能小于当前流程发起时间') + return } - console.log(this.materialAmount,'采购总价') - - console.log(this.opinion,'流程说明') + // if (formData.materialType === null || formData.materialType ==='' || formData.materialType === undefined){ + // this.$message.error("物资类型不能为空") + // return; + // } + // if (formData.deliveryTime === null || formData.deliveryTime ==='' || formData.deliveryTime === undefined){ + // this.$message.error("出库时间不能为空") + // return; + // } + for (let i = 0; i < formData.processMaterialsDeliveryListList.length; i++) { + if (i == 0) { + this.describes = formData.processMaterialsDeliveryListList[i].materialName + } else { + this.describes = this.describes + '---' + formData.processMaterialsDeliveryListList[i].materialName + } + } + formData.describes = this.describes 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; - var url = this.url.addDeliveryApply; - let method='post'; - if (!this.isNew){ - url = this.url.editDeliveryApply; - method='put'; + formData.procDefId = this.processData.id + formData.procDeTitle = this.processData.name + formData.title = this.processData.description + formData.targetLibrary = this.libraryAssociationIdInvisible + 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' } - this.btndisabled = true; - console.log(formData,'表单数据') - httpAction(url,formData,method).then((res)=>{ - if (res.success){ - //this.$message.success("保存成功!") + 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.close(); + } else { this.$message.error(res.message) } - }).finally(()=>{ - this.btndisabled = false; + }).finally(() => { + this.btndisabled = false }) } }) }) }, - handleSubmit (e) { + handleSubmit(e) { this.getAllTable().then(tables => { return validateFormAndTables(this.form, tables) - }).then(allValues=>{ + }).then(allValues => { if (typeof this.classifyIntoFormData !== 'function') { throw this.throwNotFunction('classifyIntoFormData') } let formData = this.classifyIntoFormData(allValues) formData.fileId = getStringArry(formData.fileId) - console.log('所有数据',formData) - if (new Date(formData.createTime).getTime()/100>new Date(formData.deliveryTime).getTime()/100){ - this.$message.error("出库时间不能小于当前流程发起时间") - return; + console.log('所有数据', formData) + if (new Date(formData.createTime).getTime() / 100 > new Date(formData.deliveryTime).getTime() / 100) { + this.$message.error('出库时间不能小于当前流程发起时间') + return } // if (formData.materialType === null || formData.materialType ==='' || formData.materialType === undefined){ // this.$message.error("物资类型不能为空") @@ -1174,48 +1177,48 @@ // return; // } for (let i = 0; i < formData.processMaterialsDeliveryListList.length; i++) { - if (i==0){ - this.describes=formData.processMaterialsDeliveryListList[i].materialName - }else { - this.describes=this.describes+"---"+formData.processMaterialsDeliveryListList[i].materialName + if (i == 0) { + this.describes = formData.processMaterialsDeliveryListList[i].materialName + } else { + this.describes = this.describes + '---' + formData.processMaterialsDeliveryListList[i].materialName } } - formData.describes=this.describes; + formData.describes = this.describes this.form.validateFields((err, values) => { if (!err) { - formData.procDefId = this.processData.id; - formData.procDeTitle = this.processData.name; - formData.title=this.processData.description; + formData.procDefId = this.processData.id + formData.procDeTitle = this.processData.name + formData.title = this.processData.description formData.targetLibrary = this.libraryAssociationIdInvisible - 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'; + 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){ + 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.$emit('afterSubmit', formData) + } else { this.$message.error(res.message) } - }).finally(()=>{ - this.btndisabled = false; + }).finally(() => { + this.btndisabled = false }) } }) }) }, - addBefore(){ + addBefore() { this.form.resetFields() - this.processMaterialsDeliveryListTable.dataSource=[] + this.processMaterialsDeliveryListTable.dataSource = [] }, getAllTable() { let values = this.tableKeys.map(key => getRefPromise(this, key)) @@ -1228,8 +1231,8 @@ this.data = getRecord(this.data) } - console.log('回显数据',this.data) - let fieldval = pick(this.data,'id','company','createTime','sysOrgCode','createBy','materialType','deliveryTime','fileId','opinion') + console.log('回显数据', this.data) + let fieldval = pick(this.data, 'id', 'company', 'createTime', 'sysOrgCode', 'createBy', 'materialType', 'deliveryTime', 'fileId', 'opinion') this.$nextTick(() => { this.form.setFieldsValue(fieldval) }) @@ -1244,25 +1247,25 @@ let main = Object.assign(this.model, allValues.formValue) return { ...main, // 展开 - processMaterialsDeliveryListList: allValues.tablesValue[0].values, + processMaterialsDeliveryListList: allValues.tablesValue[0].values } }, //渲染流程表单数据 - showFlowData(){ - if(this.formBpm === true){ - let params = {id:this.formData.dataId}; - getAction(this.url.queryById,params).then((res)=>{ - if(res.success){ - this.edit (res.result); + showFlowData() { + if (this.formBpm === true) { + let params = { id: this.formData.dataId } + getAction(this.url.queryById, params).then((res) => { + if (res.success) { + this.edit(res.result) } }) } }, - validateError(msg){ + validateError(msg) { this.$message.error(msg) }, - popupCallback(company,row,puwwcid) { - let res=JSON.parse(row); + popupCallback(company, row, puwwcid) { + let res = JSON.parse(row) let params = {} params.id = puwwcid getAction(this.url.puwwlist, params).then((rest) => { @@ -1270,25 +1273,25 @@ this.libraryAssociationIdInvisible = rest.result.unit } }) - console.log('获取我的数据',res.id) - let param={} - param.createBy=res.username; - param.company=company; - param.sysOrgCode=res.departIds; - param.createTime= getCurrentTime(); - this.data=param; - let fieldval =pick(this.data, 'createBy','company','sysOrgCode','createTime') + console.log('获取我的数据', res.id) + let param = {} + param.createBy = res.username + param.company = company + param.sysOrgCode = res.departIds + param.createTime = getCurrentTime() + this.data = param + let fieldval = pick(this.data, 'createBy', 'company', 'sysOrgCode', 'createTime') this.$nextTick(() => { this.form.setFieldsValue(fieldval) }) - }, + } } } \ No newline at end of file diff --git a/src/views/activiti/form/ProcessSmaterialsScrapForm.vue b/src/views/activiti/form/ProcessSmaterialsScrapForm.vue index c28ad49..4632332 100644 --- a/src/views/activiti/form/ProcessSmaterialsScrapForm.vue +++ b/src/views/activiti/form/ProcessSmaterialsScrapForm.vue @@ -38,7 +38,9 @@
- + @@ -64,11 +66,11 @@ :actionButton="true"/> - + - - + + @@ -79,7 +81,8 @@
保存 - 提交申请 + 提交申请 + 取消 @@ -141,7 +144,7 @@ // 新增时子表默认添加几行空数据 addDefaultRowNum: 1, processOutflowId: '', - describes:'', + describes: '', refKeys: ['processSmaterialsScrapList'], tableKeys: ['processSmaterialsScrapList'], activeKey: 'processSmaterialsScrapList', @@ -259,7 +262,7 @@ addScrapApply: '/hy/processSmaterialsScrap/addScrapApply', editScrapApply: '/hy/processSmaterialsScrap/editScrapApply', queryById: '/hy/processSmaterialsScrap/queryById', - list:"/hy/processMaterialsDelivery/queryProcessMaterialsDeliveryListByMainId", + list: '/hy/processMaterialsDelivery/queryProcessMaterialsDeliveryListByMainId', processSmaterialsScrapList: { list: '/hy/processSmaterialsScrap/queryProcessSmaterialsScrapListByMainId' } @@ -267,10 +270,10 @@ btndisabled: false, validatorRules: { // 'blur'是鼠标失去焦点的时候会触发验证 - processOutflowId: {rules: [{ required: true, message: '关联出库流程不能为空!' }]}, - processReturnId: {rules:[{ required: true, message: '关联归还流程不能为空!' }]}, - processPlan: {rules:[ { required: true, message: '请选择流程计划!'}]} - }, + processOutflowId: { rules: [{ required: true, message: '关联出库流程不能为空!' }] }, + processReturnId: { rules: [{ required: true, message: '关联归还流程不能为空!' }] }, + processPlan: { rules: [{ required: true, message: '请选择流程计划!' }] } + } } }, props: { @@ -338,8 +341,8 @@ console.log(userInfo) // userInfo.company=company; this.popupCallback(company, userInfo) - if (!this.isNew){ - this.init(); + if (!this.isNew) { + this.init() } }, methods: { @@ -368,9 +371,9 @@ } }) }, - getPlanList(id){ - let params={} - params.id=id; + getPlanList(id) { + let params = {} + params.id = id this.requestSubTableData(this.url.list, params, this.processSmaterialsScrapListTable) }, close() { @@ -389,56 +392,47 @@ applySubmit(e) { this.getAllTable().then(tables => { return validateFormAndTables(this.form, tables) - }).then(allValues=>{ + }).then(allValues => { + console.log('所有数据', allValues) if (typeof this.classifyIntoFormData !== 'function') { throw this.throwNotFunction('classifyIntoFormData') } let formData = this.classifyIntoFormData(allValues) - //计算总价 - for (let i = 0; i < formData.processUdgetPlanMaterialList.length; i++) { - this.materialAmount=this.materialAmount+ formData.processUdgetPlanMaterialList[i].materialAmount; - if (i==0){ - this.describes=formData.processUdgetPlanMaterialList[i].materialName - }else { - this.describes=this.describes+"---"+formData.processUdgetPlanMaterialList[i].materialName + for (let i = 0; i < formData.processSmaterialsScrapListList.length; i++) { + if (i == 0) { + this.describes = formData.processSmaterialsScrapListList[i].materialName + } else { + this.describes = this.describes + '---' + formData.processSmaterialsScrapListList[i].materialName } - } + formData.describes = this.describes formData.fileId = getStringArry(formData.fileId) - formData.materialPrice=this.materialPrice; - formData.materialAmount=this.materialAmount; - formData.describes=this.describes; - if (new Date(formData.createTime).getTime()/100>new Date(formData.needTime).getTime()/100){ - this.$message.error("需求时间不能小于当前流程发起时间") - return; - } - console.log(this.materialAmount,'采购总价') - console.log(this.opinion,'流程说明') 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; - var url = this.url.addScrapApply; - let method='post'; - if (!this.isNew){ - url = this.url.editScrapApply; - method='put'; + 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' } - this.btndisabled = true; - console.log(formData,'表单数据') - httpAction(url,formData,method).then((res)=>{ - if (res.success){ - //this.$message.success("保存成功!") + 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.close(); + } else { this.$message.error(res.message) } - }).finally(()=>{ - this.btndisabled = false; + }).finally(() => { + this.btndisabled = false }) } }) @@ -455,13 +449,13 @@ } let formData = this.classifyIntoFormData(allValues) for (let i = 0; i < formData.processSmaterialsScrapListList.length; i++) { - if (i==0){ - this.describes=formData.processSmaterialsScrapListList[i].materialName - }else { - this.describes=this.describes+"---"+formData.processSmaterialsScrapListList[i].materialName + if (i == 0) { + this.describes = formData.processSmaterialsScrapListList[i].materialName + } else { + this.describes = this.describes + '---' + formData.processSmaterialsScrapListList[i].materialName } } - formData.describes=this.describes; + formData.describes = this.describes formData.fileId = getStringArry(formData.fileId) this.form.validateFields((err, values) => { @@ -495,10 +489,10 @@ }) }, - getcallType(type){ - this.data.materialType = type.materialType; - this.data.processOutflowId=type.id - let fieldval =pick(this.data,'materialType','processOutflowId') + getcallType(type) { + this.data.materialType = type.materialType + this.data.processOutflowId = type.id + let fieldval = pick(this.data, 'materialType', 'processOutflowId') this.$nextTick(() => { this.form.setFieldsValue(fieldval) }) @@ -518,8 +512,8 @@ this.data = getRecord(this.data) } - console.log('000000000000>',this.data) - let fieldval = pick(this.data, 'id', 'company', 'createTime', 'sysOrgCode', 'createBy', 'materialType', 'processOutflowId', 'fileId','opinion') + console.log('000000000000>', this.data) + let fieldval = pick(this.data, 'id', 'company', 'createTime', 'sysOrgCode', 'createBy', 'materialType', 'processOutflowId', 'fileId', 'opinion') this.$nextTick(() => { this.form.setFieldsValue(fieldval) }) diff --git a/src/views/activiti/form/ProcessUdgetPlanForm.vue b/src/views/activiti/form/ProcessUdgetPlanForm.vue index 1996011..2b73ba1 100644 --- a/src/views/activiti/form/ProcessUdgetPlanForm.vue +++ b/src/views/activiti/form/ProcessUdgetPlanForm.vue @@ -1051,9 +1051,9 @@ console.log(formData,'表单数据') httpAction(url,formData,method).then((res)=>{ if (res.success){ - //this.$message.success("保存成功!") + this.$message.success("提交申请成功!") //todo 将表单的数据传给父组件 - this.$emit('afterSubmit',formData) + this.close(); }else { this.$message.error(res.message) }