|
@@ -128,6 +128,16 @@
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="18">
|
|
|
+ <div class="right_btn">
|
|
|
+ <el-button
|
|
|
+ :disabled="!currentItem.id"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ @click="BOMAddHandler"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
<el-table
|
|
|
:data="materialInfoList"
|
|
|
border
|
|
@@ -154,7 +164,7 @@
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
- @click="editHandler(scope.row)"
|
|
|
+ @click="bomEditHandler(scope.row)"
|
|
|
>修改
|
|
|
</el-button>
|
|
|
</el-dropdown-item>
|
|
@@ -188,7 +198,7 @@
|
|
|
:model="editorForm"
|
|
|
ref="editorForm"
|
|
|
:rules="editorFormRules"
|
|
|
- label-width="80px"
|
|
|
+ label-width="100px"
|
|
|
:inline="false"
|
|
|
size="normal"
|
|
|
>
|
|
@@ -196,7 +206,7 @@
|
|
|
<el-form-item label="类型" prop="type">
|
|
|
<el-select v-model="editorForm.type" placeholder="" filterable>
|
|
|
<el-option label="分类" value="0" />
|
|
|
- <el-option label="物料" value="1" />
|
|
|
+ <el-option label="半成品" value="1" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -212,7 +222,7 @@
|
|
|
<treeselect
|
|
|
v-model="editorForm.fid"
|
|
|
:normalizer="normalizer"
|
|
|
- :options="treeOptions"
|
|
|
+ :options="excludeTreeList"
|
|
|
:multiple="false"
|
|
|
:disable-branch-nodes="false"
|
|
|
:clear-on-select="true"
|
|
@@ -223,12 +233,18 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="物料编码" prop="materialCode">
|
|
|
+ <el-form-item
|
|
|
+ :label="editorForm.type == 0 ? '分类编码' : '半成品编码'"
|
|
|
+ prop="materialCode"
|
|
|
+ >
|
|
|
<el-input v-model="editorForm.materialCode"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="物料名称" prop="materialName">
|
|
|
+ <el-form-item
|
|
|
+ :label="editorForm.type == 0 ? '分类名称' : '半成品名称'"
|
|
|
+ prop="materialName"
|
|
|
+ >
|
|
|
<el-input v-model="editorForm.materialName"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -241,6 +257,35 @@
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog :title="bomTitle" :visible.sync="BOMshow" width="500px">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-form
|
|
|
+ :model="bomForm"
|
|
|
+ ref="bomForm"
|
|
|
+ :rules="bomFormmRules"
|
|
|
+ label-width="100px"
|
|
|
+ :inline="false"
|
|
|
+ size="normal"
|
|
|
+ >
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="物料编码" prop="materialCode">
|
|
|
+ <el-input v-model="bomForm.materialCode"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="物料名称" prop="materialName">
|
|
|
+ <el-input v-model="bomForm.materialName"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-form>
|
|
|
+ </el-row>
|
|
|
+ <template #footer>
|
|
|
+ <span>
|
|
|
+ <el-button @click="BOMshow = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="bomConfirmHandler">确认</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -253,6 +298,7 @@ import {
|
|
|
addBom,
|
|
|
updateBom,
|
|
|
deleteBom,
|
|
|
+ excludeTreeList,
|
|
|
} from "@/api/amichi/BOMList/index";
|
|
|
export default {
|
|
|
name: "BOMList",
|
|
@@ -260,6 +306,36 @@ export default {
|
|
|
components: { Treeselect },
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 新增修改物料 start
|
|
|
+ currentItem: {},
|
|
|
+ BOMshow: false,
|
|
|
+ bomTitle: "",
|
|
|
+ bomForm: {
|
|
|
+ fid: "",
|
|
|
+ isTreeShow: "1",
|
|
|
+ isClickLine: "1",
|
|
|
+ isOnlyMenu: "1",
|
|
|
+ materialCode: "",
|
|
|
+ materialName: "",
|
|
|
+ type: "1", //'0'分类 '1'半成品
|
|
|
+ },
|
|
|
+ bomFormmRules: {
|
|
|
+ materialCode: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "物料编码不能为空",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ materialName: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "物料名称不能为空",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ // 新增修改物料 end
|
|
|
ids: [], //勾选数据
|
|
|
title: "",
|
|
|
show: false, //新增/修改弹窗
|
|
@@ -277,6 +353,7 @@ export default {
|
|
|
checkStrictly: true,
|
|
|
},
|
|
|
treeOptions: undefined, //树形数据
|
|
|
+ excludeTreeList: undefined, //仅包含分类数据的树形数据
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
@@ -293,7 +370,7 @@ export default {
|
|
|
materialCode: null,
|
|
|
materialName: null,
|
|
|
},
|
|
|
- // 新增物料表单
|
|
|
+ // 新增表单
|
|
|
editorForm: {
|
|
|
fid: "1",
|
|
|
isTreeShow: "",
|
|
@@ -301,7 +378,7 @@ export default {
|
|
|
isOnlyMenu: "",
|
|
|
materialCode: "",
|
|
|
materialName: "",
|
|
|
- type: "0", //'0'分类 '1'物料
|
|
|
+ type: "0", //'0'分类 '1'半成品
|
|
|
},
|
|
|
editorFormRules: {
|
|
|
type: [
|
|
@@ -341,6 +418,64 @@ export default {
|
|
|
this.initTreeList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ // bom修改回调
|
|
|
+ bomEditHandler(data) {
|
|
|
+ this.bomTitle = "修改物料";
|
|
|
+ let { materialCode, materialName } = data;
|
|
|
+ this.editData = data;
|
|
|
+ this.bomForm = {
|
|
|
+ fid: data.fid,
|
|
|
+ isTreeShow: data.isTreeShow,
|
|
|
+ isClickLine: data.isClickLine,
|
|
|
+ isOnlyMenu: data.isOnlyMenu,
|
|
|
+ materialCode,
|
|
|
+ materialName,
|
|
|
+ type: "1", //'0'分类 '1'半成品
|
|
|
+ };
|
|
|
+ this.BOMshow = true;
|
|
|
+ },
|
|
|
+ // bom确认新增或修改回调
|
|
|
+ bomConfirmHandler() {
|
|
|
+ this.$refs.bomForm.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let {
|
|
|
+ materialCode,
|
|
|
+ materialName,
|
|
|
+ isTreeShow,
|
|
|
+ isClickLine,
|
|
|
+ isOnlyMenu,
|
|
|
+ } = this.bomForm;
|
|
|
+ let payload = {
|
|
|
+ fid: this.currentItem.id,
|
|
|
+ isTreeShow,
|
|
|
+ isClickLine,
|
|
|
+ isOnlyMenu,
|
|
|
+ materialCode,
|
|
|
+ materialName,
|
|
|
+ };
|
|
|
+ let fun = addBom;
|
|
|
+ if (this.bomTitle == "修改物料") {
|
|
|
+ payload.id = this.editData.id;
|
|
|
+ fun = updateBom;
|
|
|
+ }
|
|
|
+
|
|
|
+ let res = await fun(payload);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("操作成功");
|
|
|
+ this.BOMshow = false;
|
|
|
+ this.getList();
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
+ // this.initTreeList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // bom新增回调
|
|
|
+ BOMAddHandler() {
|
|
|
+ this.bomTitle = "新增物料";
|
|
|
+ this.BOMshow = true;
|
|
|
+ },
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
this.ids = selection.map((item) => item.id);
|
|
@@ -387,7 +522,7 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
// 修改回调
|
|
|
- editHandler(data) {
|
|
|
+ async editHandler(data) {
|
|
|
this.title = "修改";
|
|
|
let { id, fid, isOnlyMenu, materialCode, materialName } = data;
|
|
|
this.editData = data;
|
|
@@ -397,6 +532,7 @@ export default {
|
|
|
materialCode,
|
|
|
materialName,
|
|
|
};
|
|
|
+ await this.getExcludeTreeList();
|
|
|
this.show = true;
|
|
|
},
|
|
|
// 新增/修改确认回调
|
|
@@ -434,11 +570,28 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 新增回调
|
|
|
- addHandler() {
|
|
|
+ async addHandler() {
|
|
|
this.resetForm("editorForm");
|
|
|
+ Object.assign(this.editorForm, {
|
|
|
+ fid: "1",
|
|
|
+ isTreeShow: "",
|
|
|
+ isClickLine: "",
|
|
|
+ isOnlyMenu: "",
|
|
|
+ materialCode: "",
|
|
|
+ materialName: "",
|
|
|
+ type: "0", //'0'分类 '1'半成品
|
|
|
+ });
|
|
|
this.title = "新增";
|
|
|
+ await this.getExcludeTreeList();
|
|
|
this.show = true;
|
|
|
},
|
|
|
+ // 获取菜单树形数据
|
|
|
+ async getExcludeTreeList() {
|
|
|
+ let res = await excludeTreeList();
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.excludeTreeList = res.data;
|
|
|
+ }
|
|
|
+ },
|
|
|
// 初始化树形数据
|
|
|
initTreeList() {
|
|
|
this.resetForm("treeForm");
|
|
@@ -471,7 +624,7 @@ export default {
|
|
|
// 节点单击事件
|
|
|
handleNodeClick(data) {
|
|
|
// if (data.isClickLine == "1") return;
|
|
|
-
|
|
|
+ this.currentItem = data;
|
|
|
this.queryParams.fid = data.id;
|
|
|
this.handleQuery();
|
|
|
},
|