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