Browse Source

修改调拨数量

dev
caoyizhong 2 years ago
parent
commit
32804af8c9
  1. 120
      src/views/activiti/form/ProcessMaterialsAllotForm.vue

120
src/views/activiti/form/ProcessMaterialsAllotForm.vue

@ -398,6 +398,7 @@
qeihuan: undefined, // qeihuan: undefined, //
kucun: 0, // kucun: 0, //
hiegkucun: [], // hiegkucun: [], //
shiyan: [], //
} }
}, },
props: { props: {
@ -460,7 +461,7 @@
// console.log("this.disabled",this.disabled); // console.log("this.disabled",this.disabled);
// console.log("this.heid",this.heid); // console.log("this.heid",this.heid);
this.heid = this.hieg; this.heid = this.hieg;
console.log("this.allotNumber====",this.allotShuNumber); // console.log("this.allotNumber====",this.allotShuNumber);
return this.disabled return this.disabled
}, },
showFlowSubmitButton() { showFlowSubmitButton() {
@ -489,32 +490,14 @@
}, },
methods: { methods: {
async seeWateNumber(log) { async seeWateNumber(log) {
// console.log(this.allotShuNumber,"asdfasd===")
// //
//this.assigneesText
let pas = await log.target.getValuesPromise(log.rowIds); let pas = await log.target.getValuesPromise(log.rowIds);
// console.log(pas,log);
if(!!pas[log.index].equipment && !this.allotShuNumber) { if(!!pas[log.index].equipment && !this.allotShuNumber) {
console.log(pas); this.shiyan.forEach(item =>{
let did = ''; if(item.merchandiseNewsId == pas[log.index].equipment){
this.form.validateFields((err, values) => { this.kucun =item.materialQuantity;
//
console.log(values.beAllotDepartment) // { username: '' }
if(!!values.beAllotDepartmen){
did = values.beAllotDepartmen;
} }
}); });
let param = {merchandiseNewsId : pas[log.index].equipment,
departId : did
}
getAction(this.url.wastematerialsList,param).then(res =>{
if(res.success){
// console.log(res.result.records[0].materialQuantity,"edsrtg");
this.kucun = res.result.records[0].materialQuantity;
}
}).catch(()=>{
this.kucun = 0;
});
} }
}, },
@ -528,15 +511,8 @@
}, },
async onSelect(record) { async onSelect(record) {
let isDB = true let isDB = true
// if (!!record.row.materialGroup) {
// if (this.issh){
// return;
// }
// if (!!record.row.id && this.materialGroupId !== record.row.materialGroup && record.column.key !== "allotNumber" ) {
if (!record.row.equipment && !!record.row.materialGroup && !!record.row.materialName if (!record.row.equipment && !!record.row.materialGroup && !!record.row.materialName
|| !record.row.materialName && !!record.row.materialGroup && !!record.row.equipment ) { || !record.row.materialName && !!record.row.materialGroup && !!record.row.equipment ) {
// console.log("record.row.materialGroup")
// await this.fetchMerchandiseNews(record.row.materialGroup, 1)
let value = [ let value = [
{ {
rowKey: record.row.id, rowKey: record.row.id,
@ -560,7 +536,6 @@
isDB = false isDB = false
} }
// }
if (!!record.row.equipment && !record.row.allotNumber && isDB && this.materialGroupId !== record.row.materialGroup) { if (!!record.row.equipment && !record.row.allotNumber && isDB && this.materialGroupId !== record.row.materialGroup) {
// console.log("materialNumber") // console.log("materialNumber")
@ -606,16 +581,11 @@
} }
} }
}) })
// console.log("materialName",materialName);
if(Object.keys(materialName).length > 0){ if(Object.keys(materialName).length > 0){
this.processMaterialsAllotListTable.columns[0].options.push({ this.processMaterialsAllotListTable.columns[0].options.push({
title: materialName.materialGroup, title: materialName.materialGroup,
value: materialName.descriptionId value: materialName.descriptionId
}) })
let values = [ let values = [
{ {
rowKey: record.row.id, rowKey: record.row.id,
@ -631,13 +601,22 @@
} }
} }
] ]
// console.log("",values);
this.$refs.processMaterialsAllotList.setValues(values) this.$refs.processMaterialsAllotList.setValues(values)
} }
} }
//
if(record.column.key == 'allotSendNumber'){
this.shiyan.forEach( item =>{
// console.log(item);
// console.log(record);
if(parseInt( record.value) > parseInt(item.materialQuantity )){
this.$message.warning("实发数大于库存数");
record.row.allotSendNumber = !record.value ? 0 : item.materialQuantity ;
}
});
}
// //
if (record.row.allotNumber !== '' && record.row.allotNumber !== undefined && isDB) { if (!!record.row.allotNumber && isDB) {
let res = record.row let res = record.row
let materialName = {} let materialName = {}
this.bigIdMerchandiseNewsList.forEach(item => { this.bigIdMerchandiseNewsList.forEach(item => {
@ -647,13 +626,16 @@
} }
} }
}) })
// console.log("==",this.hiegkucun.length);
// console.log("111",record.row.allotSendNumber);
// console.log("materialName.residueNumber",materialName.residueNumber) // console.log("materialName.residueNumber",materialName.residueNumber)
// if(parseInt( res.allotNumber) > parseInt( materialName.number )){ // if(parseInt( res.allotNumber) > parseInt( materialName.number )){
// // console.log("") // // console.log("")
// this.$message.warn("") // this.$message.warn("")
// res.allotNumber = materialName.number; // res.allotNumber = materialName.number;
// } // }
if (res.id != undefined) { if (!!res.id) {
let value = [ let value = [
{ {
rowKey: res.id, rowKey: res.id,
@ -664,9 +646,9 @@
// 'materialUnit': res.unit, // 'materialUnit': res.unit,
// 'supplier': res.supplierName, // 'supplier': res.supplierName,
// 'materialPrice': res.price, // 'materialPrice': res.price,
// 'number': res.number, 'allotSendNumber': res.allotSendNumber,
'allotNumber': res.allotNumber, 'allotNumber': res.allotNumber,
'materialAmount': parseFloat((res.materialPrice * parseInt(res.allotNumber)).toFixed(1)), 'materialAmount': parseFloat((res.materialPrice * parseInt( !res.allotSendNumber ? 0 : res.allotSendNumber)).toFixed(1)),
} }
} }
] ]
@ -674,10 +656,6 @@
this.$refs.processMaterialsAllotList.setValues(value) this.$refs.processMaterialsAllotList.setValues(value)
}) })
} }
// console.log('****>',value)
} }
}, },
@ -847,6 +825,34 @@
/*通过审批*/ /*通过审批*/
passTask() { passTask() {
// this.handleSubmit() // this.handleSubmit()
if(!this.allotShuNumber){
this.getAllTable().then(tables => {
return validateFormAndTables(this.form, tables)
}).then(allValues => {
console.log('所有数据', allValues)
if(!!allValues.tablesValue[0].values[0] ){
let all = false;
allValues.tablesValue[0].values.forEach( it => {
if(!it.allotSendNumber){
this.$message.warning("请填写实发调拨数据!");
all = true;
}
});
if(all){
return
}else{
let formData = this.classifyIntoFormData(allValues);
// console.log("124234123",formData);
let method = 'put'
httpAction(this.url.edit, formData, method).then((res) => {
if (res.success) {
}
}).finally(() => {
})
}
}
})
}
this.$emit('passTask') this.$emit('passTask')
}, },
/*驳回审批*/ /*驳回审批*/
@ -1089,6 +1095,7 @@
} }
} }
this.hiegkucun = []; this.hiegkucun = [];
this.shiyan = [];
// console.log("tab.dataSource",dataSource) // console.log("tab.dataSource",dataSource)
dataSource.forEach(item =>{ dataSource.forEach(item =>{
let par = { id : item.materialGroup,} let par = { id : item.materialGroup,}
@ -1102,17 +1109,36 @@
disabled : true }]; disabled : true }];
} }
}) })
let did = '';
this.form.validateFields((err, values) => {
//
// console.log(values.beAllotDepartment) // { username: '' }
if(!!values.beAllotDepartmen){
did = values.beAllotDepartmen;
}
});
getAction(this.url.queryByIdMerchandiseNews,param).then( res=>{ getAction(this.url.queryByIdMerchandiseNews,param).then( res=>{
// console.log(res);
if(res.success){ if(res.success){
this.processMaterialsAllotListTable.columns[1].options= [{ this.processMaterialsAllotListTable.columns[1].options= [{
title : res.result.materialsNumber, title : res.result.materialsNumber,
value : item.equipment, value : item.equipment,
disabled : true }]; disabled : true }];
let parer = {
merchandiseNewsId : res.result.id,
departId : did
}
getAction(this.url.wastematerialsList,parer).then(res =>{
if(res.success){
this.shiyan.push( res.result.records[0]);
}
});
} }
this.hiegkucun.push(res.result); this.hiegkucun.push(res.result);
}) })
item.allotSendNumber = undefined;
console.log(item,"235234");
}) })
tab.dataSource = dataSource; tab.dataSource = dataSource;
typeof success === 'function' ? success(res) : '' typeof success === 'function' ? success(res) : ''

Loading…
Cancel
Save