Commit 14cfad59 authored by 仇晓婷's avatar 仇晓婷

封装物料控件

parent 8270e90f
...@@ -17,9 +17,7 @@ ...@@ -17,9 +17,7 @@
<Col :span="12"> <Col :span="12">
<FormItem :label="l('materialId')" prop="materialId"> <FormItem :label="l('materialId')" prop="materialId">
<!-- <Input v-model="entity.mmcode"></Input> --> <!-- <Input v-model="entity.mmcode"></Input> -->
<Select v-model="entity.materialId" filterable clearable @on-change="change"> <Materiel v-model="entity.materialId" @on-change="change"></Materiel>
<Option v-for="item in dataList" :value="item.id" :key="item.id">{{ item.code }}</Option>
</Select>
</FormItem> </FormItem>
</Col> </Col>
<!-- <Col :span="12"> <!-- <Col :span="12">
...@@ -123,17 +121,13 @@ export default { ...@@ -123,17 +121,13 @@ export default {
v: Object, v: Object,
eid: Number, eid: Number,
parents: { parents: {
type: Object, id: Number,
default: () => { parentName: String,
return { ids: String
id: -1,
parentName: ""
};
}
} }
}, },
created() { created() {
this.getMaterialList(); // this.getMaterialList();
}, },
mounted() { mounted() {
this.treeCompany(); this.treeCompany();
...@@ -145,23 +139,13 @@ export default { ...@@ -145,23 +139,13 @@ export default {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods: { methods: {
change(val) { change(e) {
this.dataList.forEach(e => { // console.log(e);
if (e.id == val) { this.entity.name = e.name;
this.entity.name = e.name; this.entity.mmcode = e.mmcode;
this.entity.mmcode = e.code; this.entity.drawingNo = e.drawingNo;
this.entity.drawingNo = e.drawingNo; this.entity.version = e.version;
this.entity.version = e.version; this.entity.materialId = e.materialId;
}
});
},
getMaterialList() {
let data = {
conditions: []
};
Api.materiallist(data).then(r => {
this.dataList = r.result.filter(item => item.status == 3);
});
}, },
clickData(data, liUrl) { clickData(data, liUrl) {
this.img = liUrl; this.img = liUrl;
...@@ -189,7 +173,7 @@ export default { ...@@ -189,7 +173,7 @@ export default {
}); });
}, },
load(v) { load(v) {
Api.get({ id: v }).then(r => { Api.get({ id: v, levelId: this.parents.id }).then(r => {
if (r.result.productUrlList && r.result.productUrlList != "") { if (r.result.productUrlList && r.result.productUrlList != "") {
this.parms.eid = r.result.productUrlList; this.parms.eid = r.result.productUrlList;
} else { } else {
...@@ -202,7 +186,7 @@ export default { ...@@ -202,7 +186,7 @@ export default {
this.$refs.edit.dep = r.result.levelId; this.$refs.edit.dep = r.result.levelId;
this.$refs.edit.label = r.result.levelTitle; this.$refs.edit.label = r.result.levelTitle;
this.entity.materialId = r.result.materialId; this.entity.materialId = r.result.materialId;
this.entity.levelId = r.result.levelId+''; this.entity.levelId = r.result.levelId + "";
}); });
}, },
handleSubmit() { handleSubmit() {
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<a @click="bom(row)"> <a @click="bom(row)">
<Icon type="md-git-merge" />BOM <Icon type="md-git-merge" />BOM
</a>&nbsp; </a>&nbsp;
<a @click="edit(row.id)"> <a @click="edit(row)">
<Icon type="md-create" />编辑 <Icon type="md-create" />编辑
</a>&nbsp; </a>&nbsp;
<a @click="remove(row.id)"> <a @click="remove(row.id)">
...@@ -189,7 +189,7 @@ export default { ...@@ -189,7 +189,7 @@ export default {
{ {
attrs: { oprate: "edit" }, attrs: { oprate: "edit" },
on: { on: {
click: () => this.edit(params.row.id) click: () => this.edit(params.row)
} }
}, },
"编辑" "编辑"
...@@ -279,14 +279,16 @@ export default { ...@@ -279,14 +279,16 @@ export default {
// console.log(row) // console.log(row)
this.curId = row.id; this.curId = row.id;
this.parent.id = row.levelId; this.parent.id = row.levelId;
this.parent.parentName = row.levelTitle; this.parent.parentName = row.levelTitle;
this.title = "详情"; this.title = "详情";
this.detail = () => import("./detail"); this.detail = () => import("./detail");
this.modal = true; this.modal = true;
this.fullscreen = false; this.fullscreen = false;
}, },
edit(id) { edit(row) {
this.curId = id; this.curId = row.id;
this.parent.id = row.levelId;
this.parent.parentName = row.levelTitle;
this.title = "编辑"; this.title = "编辑";
this.detail = () => import("./edit"); this.detail = () => import("./edit");
this.modal = true; this.modal = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment