diff --git a/src/views/quality/checkTypeProject/MaterialGroupAdd.vue b/src/views/quality/checkTypeProject/MaterialGroupAdd.vue index 248d7573..c89a76ab 100644 --- a/src/views/quality/checkTypeProject/MaterialGroupAdd.vue +++ b/src/views/quality/checkTypeProject/MaterialGroupAdd.vue @@ -106,7 +106,7 @@ import { } from "@/api/quality/materialGroupDetail"; import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; -import ItemSelectMaterial from "../qcIncome/selectMaterial.vue"; +import ItemSelectMaterial from "./selectMaterial.vue"; export default { name: "MaterialGroupAdd", @@ -201,7 +201,7 @@ export default { //this.loading = false; }); }, - /** 查询部门下拉树结构 */ + /** 查询下拉树结构 */ getMaterialTree() { materialTreeSelect().then((response) => { this.materialOptions = response.data; @@ -304,6 +304,7 @@ export default { this.reset(); this.form.groupId = data.id; this.$refs.itemSelectMaterial.showFlag = true; + //this.$refs.itemSelectMaterial.headerToken = }, /**删除树节点 */ remove(node, data) { @@ -337,21 +338,27 @@ export default { }, //物料选择确认 onSelectMaterial(obj) { - this.form.materialCode = obj.code; - this.form.materialName = obj.name; - console.log(this.form.groupId); - if(this.form.materialCode != null) { - addMaterialGroupDetail(this.form).then((response) => { - let message = response.code - if(message == 200) { - this.$modal.msgSuccess("新增成功"); - }else { - this.$modal.msgError("新增失败"); - } - this.open = false; - this.getMaterialTree(); - }); - } + debugger + if(obj.length == 0){ + this.getMaterialTree(); + }else{ + this.form.materialCode = obj.code; + this.form.materialName = obj.name; + console.log(this.form.groupId); + if(this.form.materialCode != null) { + addMaterialGroupDetail(this.form).then((response) => { + let message = response.code + if(message == 200) { + this.$modal.msgSuccess("新增成功"); + }else { + this.$modal.msgError("新增失败"); + } + this.open = false; + this.getMaterialTree(); + }); + } + } + } }, }; diff --git a/src/views/quality/checkTypeProject/selectMaterial.vue b/src/views/quality/checkTypeProject/selectMaterial.vue new file mode 100644 index 00000000..78959190 --- /dev/null +++ b/src/views/quality/checkTypeProject/selectMaterial.vue @@ -0,0 +1,224 @@ + +