修改bug
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: zhp
|
||||
* @LastEditTime: 2023-11-10 16:26:08
|
||||
* @LastEditTime: 2023-11-22 16:50:55
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@@ -100,7 +100,8 @@ import {
|
||||
updateProcessEquMaterialBom,
|
||||
getEquipmentList,
|
||||
processEquMaterialBomDetPage,
|
||||
deleteProcessEquMaterialBomDet
|
||||
deleteProcessEquMaterialBomDet,
|
||||
getMaterialCode
|
||||
} from '@/api/extend/processEquMaterialBom';
|
||||
import SmallTitle from './SmallTitle';
|
||||
import { parseTime } from '../../core/mixins/code-filter';
|
||||
@@ -197,7 +198,6 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
getCode(val) {
|
||||
@@ -223,6 +223,9 @@ export default {
|
||||
// console.log(response);
|
||||
this.equipmentList = res.data
|
||||
})
|
||||
getMaterialCode().then(res => {
|
||||
this.dataForm.code = res.data
|
||||
})
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
@@ -267,7 +270,8 @@ export default {
|
||||
});
|
||||
},
|
||||
init(id, isdetail) {
|
||||
this.initData();
|
||||
this.initData()
|
||||
this.getDict()
|
||||
this.isdetail = isdetail || false;
|
||||
this.dataForm.id = id || undefined;
|
||||
this.visible = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-08 15:30:27
|
||||
* @LastEditTime: 2023-11-09 14:11:02
|
||||
* @LastEditTime: 2023-11-23 14:27:59
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@@ -18,13 +18,16 @@
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px"
|
||||
@keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item label="物料名称" prop="materialId">
|
||||
<el-select v-model="dataForm.materialId" filterable placeholder="请选择物料名称">
|
||||
<el-select v-model="dataForm.materialId" filterable placeholder="请选择物料名称" multiple>
|
||||
<el-option v-for="dict in materialList" :key=" dict.id" :label="dict.name" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="num">
|
||||
<el-input v-model="dataForm.num" placeholder="请输入数量" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="请输入备注" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row style="text-align: right">
|
||||
@@ -37,7 +40,7 @@
|
||||
<script>
|
||||
import {
|
||||
getProcessEquMaterialBomDet,
|
||||
createProcessEquMaterialBomDet,
|
||||
createProcessEquMaterialBomDetList,
|
||||
updateProcessEquMaterialBomDet,
|
||||
getMaterialList
|
||||
} from '@/api/extend/processEquMaterialBom';
|
||||
@@ -56,11 +59,13 @@ export default {
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
bomId: undefined,
|
||||
materialId:null,
|
||||
materialId:[],
|
||||
num: undefined,
|
||||
remark:undefined
|
||||
},
|
||||
dataRule: {
|
||||
attrName: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
materialId: [{ required: true, message: '名称不能为空', trigger: 'change' }],
|
||||
num: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -79,8 +84,11 @@ export default {
|
||||
getProcessEquMaterialBomDet({
|
||||
id: this.dataForm.id
|
||||
}).then((res) => {
|
||||
this.dataForm = res.data;
|
||||
// this.dataForm.materialId = materialId;
|
||||
this.dataForm = res.data
|
||||
const arr = []
|
||||
arr.push(res.data.materialId)
|
||||
this.dataForm.materialId =arr
|
||||
console.log(this.dataForm.materialId);
|
||||
// this.dataForm.value = value;
|
||||
});
|
||||
}
|
||||
@@ -97,10 +105,16 @@ export default {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
if (this.dataForm.id) {
|
||||
const dataObj = {
|
||||
materialId: this.dataForm.materialId.toString(),
|
||||
bomId: this.dataForm.bomId,
|
||||
num: this.dataForm.num,
|
||||
id: this.dataForm.id,
|
||||
remark: this.dataForm.remark
|
||||
}
|
||||
updateProcessEquMaterialBomDet({
|
||||
...this.dataForm,
|
||||
productId: this.productId,
|
||||
...dataObj
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
@@ -108,11 +122,16 @@ export default {
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createProcessEquMaterialBomDet({
|
||||
...this.dataForm,
|
||||
productId: this.productId,
|
||||
}).then((response) => {
|
||||
// 添加的提交
|
||||
const dataArr = this.dataForm.materialId.map(ele => {
|
||||
return {
|
||||
materialId: ele,
|
||||
bomId: this.dataForm.bomId,
|
||||
num: this.dataForm.num,
|
||||
remark: this.dataForm.remark
|
||||
}
|
||||
});
|
||||
createProcessEquMaterialBomDetList(dataArr).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
|
||||
Reference in New Issue
Block a user