fix:生产领料时数量不可编辑

This commit is contained in:
shijing 2025-03-10 11:04:11 +08:00
parent 984c481df8
commit bcbca918e3
1 changed files with 52 additions and 53 deletions

View File

@ -125,6 +125,7 @@
v-model="form.count" v-model="form.count"
:min="1" :min="1"
:precision="3" :precision="3"
:disabled="form.type == 'do_out'"
style="width: 100%" style="width: 100%"
@change="countChange" @change="countChange"
/> />
@ -266,6 +267,7 @@ export default {
components: [], components: [],
wbatchOptions: [], wbatchOptions: [],
mioitems:[''], mioitems:[''],
mioitemw:[],
project_code:'', project_code:'',
}; };
}, },
@ -427,9 +429,9 @@ export default {
} }
}, },
selectBatchChange(item) { selectBatchChange(item) {
// var item = this.getItem(this.batchOptions, id)
this.form.batch = item.batch; this.form.batch = item.batch;
this.form.mb = item.id; this.form.mb = item.id;
this.form.count = item.count;
this.form.warehouse = item.warehouse; this.form.warehouse = item.warehouse;
this.warehouseDisable = true; this.warehouseDisable = true;
this.inputBatchDisable = true; this.inputBatchDisable = true;
@ -437,6 +439,7 @@ export default {
selectBatchClear() { selectBatchClear() {
this.form.mb = ""; this.form.mb = "";
this.form.batch = ""; this.form.batch = "";
this.form.count = "";
this.form.warehouse = ""; this.form.warehouse = "";
this.warehouseDisable = false; this.warehouseDisable = false;
this.inputBatchDisable = false; this.inputBatchDisable = false;
@ -444,7 +447,7 @@ export default {
// //
open(mode = "add", type = "") { open(mode = "add", type = "") {
this.mode = mode; this.mode = mode;
this.form.type = type; this.form.type = this.type = type;
if (mode == "add") { if (mode == "add") {
this.init(); this.init();
} }
@ -452,33 +455,41 @@ export default {
return this; return this;
}, },
countChange(){ countChange(){
if(this.project_code=='bxerp'){ let that = this;
let numbers = this.mioitems[0]; if(that.project_code=='bxerp'){
if(this.form.count>this.mioitems.length){ if(that.form.type == "pur_in"){
this.mioitems = []; let numbers = that.mioitems[0];
for(let i=0;i<this.form.count;i++){ that.mioitems = [];that.mioitemw = [];
for(let i=0;i<that.form.count;i++){
if(numbers!=''&&numbers!=null&&numbers!=undefined){ if(numbers!=''&&numbers!=null&&numbers!=undefined){
this.mioitems[i] = Number(numbers)+i; that.mioitems[i] = Number(numbers)+i;
let obj = {};
obj.number = that.form.batch+'0'+(i+1);
that.mioitemw.push(obj);
}else{ }else{
this.mioitems[i] = ''; that.mioitems[i] = '';
}
}
}else if(this.form.count<this.mioitems.length){
this.mioitems = [];
for(let i=0;i<this.form.count;i++){
if(numbers!=''&&numbers!=null&&numbers!=undefined){
this.mioitems[i] = Number(numbers)+i;
}else{
this.mioitems[i] = '';
} }
} }
} }
// else if(that.form.type == "do_out"){
// for(let i=0;i<that.form.count;i++){
// let obj = {};
// obj.number = that.form.batch+'0'+(i+1);
// that.mioitemw.push(obj);
// }
// }
} }
}, },
firstNumberChange(){ firstNumberChange(){
let numbers = this.mioitems[0]; let that = this;
for(let i=0;i<this.form.count;i++){ that.mioitemw = [];
this.mioitems[i] = Number(numbers)+i; let numbers = that.mioitems[0];
for(let i=0;i<that.form.count;i++){
that.mioitems[i] = Number(numbers)+i;
let obj = {};
obj.number = that.form.batch+'0'+(i+1);
that.mioitemw.push(obj);
} }
}, },
validateInput(i){ validateInput(i){
@ -486,48 +497,36 @@ export default {
}, },
// //
submit() { submit() {
this.$refs.dialogForm.validate(async (valid) => { let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) { if (valid) {
this.isSaveing = true; that.isSaveing = true;
this.form.mio = this.mioId; that.form.mio = that.mioId;
if (this.components.length > 0) { if (that.components.length > 0) {
this.form.assemb = []; that.form.assemb = [];
for (var i = 0; i < this.components.length; i++) { for (var i = 0; i < that.components.length; i++) {
this.form.assemb.push({ that.form.assemb.push({
material: this.components[i].id, material: that.components[i].id,
batch: this.components[i].batch, batch: that.components[i].batch,
}); });
} }
} }
let mioitemw = []; that.form.mioitemw = that.mioitemw;
if(this.mioitems.length>1){
this.mioitems.forEach((item)=>{
let obj = {};
obj.number= item;
mioitemw.push(obj);
})
this.form.mioitemw = mioitemw;
}
try { try {
let res; let res;
if (this.mode == "add") { if (that.mode == "add") {
res = await this.$API.inm.mioitem.create.req( res = await that.$API.inm.mioitem.create.req(that.form);
this.form } else if (that.mode == "edit") {
); res = await that.$API.inm.mioitem.update.req(that.form.id,that.form);
} else if (this.mode == "edit") {
res = await this.$API.inm.mioitem.update.req(
this.form.id,
this.form
);
} }
this.isSaveing = false; that.isSaveing = false;
this.$emit("success", this.form, this.mode); that.$emit("success", that.form, that.mode);
this.visible = false; that.visible = false;
this.$message.success("操作成功"); that.$message.success("操作成功");
} catch (err) { } catch (err) {
console.log(err); console.log(err);
// //
this.isSaveing = false; that.isSaveing = false;
return err; return err;
} }
} }