Commit 5647f358 authored by 仇晓婷's avatar 仇晓婷

物料主数据

parent 929a2081
...@@ -150,6 +150,10 @@ export default { ...@@ -150,6 +150,10 @@ export default {
type: Function, type: Function,
default: null default: null
}, },
initsearch: {
type: Function,
default: null
},
lazy: { lazy: {
//懒加载设置,设置为真时候,默认不加载数据。 //懒加载设置,设置为真时候,默认不加载数据。
type: Boolean, type: Boolean,
...@@ -291,6 +295,10 @@ export default { ...@@ -291,6 +295,10 @@ export default {
this.tableHeight = window.innerHeight - this.firstY - 60; this.tableHeight = window.innerHeight - this.firstY - 60;
} }
if (this.action) { if (this.action) {
//条件初始化处理。
if(this.initsearch){
this.initsearch(this.search)
}
this.$api.post(this.action, this.search).then(r => { this.$api.post(this.action, this.search).then(r => {
if (this.format) { if (this.format) {
this.list = this.format(r.result.items); this.list = this.format(r.result.items);
......
...@@ -201,7 +201,7 @@ export default { ...@@ -201,7 +201,7 @@ export default {
this.checkList.splice(index, 1); this.checkList.splice(index, 1);
} }
}, },
setRow(row,index) { setRow(row, index) {
this.$set(this.checkList, index, row); this.$set(this.checkList, index, row);
}, },
addNew() { addNew() {
...@@ -229,12 +229,12 @@ export default { ...@@ -229,12 +229,12 @@ export default {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
this.$emit("on-ok"); this.$emit("on-ok");
} else { } else {
this.$Message.error("保存失败"); this.$Message.error(r.error.message);
} }
}) })
.catch(err => { .catch(err => {
this.disabled = false; this.disabled = false;
this.$Message.error("保存失败"); this.$Message.error(r.error.message);
}); });
} }
}); });
......
...@@ -69,8 +69,9 @@ ...@@ -69,8 +69,9 @@
<template <template
slot-scope="{ row, index }" slot-scope="{ row, index }"
slot="action" slot="action"
v-if="row.fieldType==2||row.fieldType==3" v-if="row.fieldType==2||row.fieldType==3||!row.notEditDelete"
> >
<!-- notEditDelete=true,删除不显示 -->
<a @click="remove(index,row)" style="color:#FF7A8B">删除</a> <a @click="remove(index,row)" style="color:#FF7A8B">删除</a>
</template> </template>
</Table> </Table>
...@@ -197,7 +198,7 @@ export default { ...@@ -197,7 +198,7 @@ export default {
this.checkList.splice(index, 1); this.checkList.splice(index, 1);
} }
}, },
setRow(row,index) { setRow(row, index) {
this.$set(this.checkList, index, row); this.$set(this.checkList, index, row);
}, },
addNew() { addNew() {
...@@ -227,12 +228,12 @@ export default { ...@@ -227,12 +228,12 @@ export default {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
this.$emit("on-ok"); this.$emit("on-ok");
} else { } else {
this.$Message.error("保存失败"); this.$Message.error(r.error.message);
} }
}) })
.catch(err => { .catch(err => {
this.disabled = false; this.disabled = false;
this.$Message.error("保存失败"); this.$Message.error(r.error.message);
}); });
} }
}); });
......
...@@ -74,12 +74,12 @@ export default { ...@@ -74,12 +74,12 @@ export default {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
this.$emit("on-ok"); this.$emit("on-ok");
} else { } else {
this.$Message.error("保存失败"); this.$Message.error(r.error.message);
} }
}) })
.catch(err => { .catch(err => {
this.disabled = false; this.disabled = false;
this.$Message.error("保存失败"); this.$Message.error(r.error.message);
}); });
} }
}); });
......
...@@ -83,12 +83,12 @@ export default { ...@@ -83,12 +83,12 @@ export default {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
this.$emit("on-ok",this.entity); this.$emit("on-ok",this.entity);
} else { } else {
this.$Message.error("保存失败"); this.$Message.error(r.error.message);
} }
}) })
.catch(err => { .catch(err => {
this.disabled = false; this.disabled = false;
this.$Message.error("保存失败"); this.$Message.error(r.error.message);
}); });
} }
}); });
......
<template> <template>
<div> <div>
{{nodeInfo}}
<Form ref="form" :model="entity" :rules="rules" :label-width="90"> <Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row> <Row>
<Col :span="12"> <Col :span="12">
...@@ -25,8 +24,8 @@ ...@@ -25,8 +24,8 @@
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem label="版本" prop="banben"> <FormItem label="版本" prop="version">
<Input v-model="entity.banben" placeholder="请输入"></Input> <Input v-model="entity.version" placeholder="请输入"></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="24"> <Col :span="24">
...@@ -121,12 +120,12 @@ export default { ...@@ -121,12 +120,12 @@ export default {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
this.$emit("on-ok"); this.$emit("on-ok");
} else { } else {
this.$Message.error("保存失败"); this.$Message.error(r.error.message);
} }
}) })
.catch(err => { .catch(err => {
this.disabled = false; this.disabled = false;
this.$Message.error("保存失败"); this.$Message.error(r.error.message);
}); });
} }
}); });
......
...@@ -107,7 +107,7 @@ export default { ...@@ -107,7 +107,7 @@ export default {
}, },
handleSelect(root, data) { handleSelect(root, data) {
// console.log(root); // console.log(root);
// console.log(data);
let pid = null; //定义最顶级id let pid = null; //定义最顶级id
let upId = data.upId; let upId = data.upId;
let roots = root; let roots = root;
...@@ -124,11 +124,13 @@ export default { ...@@ -124,11 +124,13 @@ export default {
}); });
} }
addId(roots, upId); addId(roots, upId);
console.log(pid);
this.nodeInfo.categoryId = data.id; this.nodeInfo.categoryId = data.id;
if (pid == null) {
this.nodeInfo.rootCategoryId = data.id;
} else {
this.nodeInfo.rootCategoryId = pid; this.nodeInfo.rootCategoryId = pid;
// this.$refs.dataTable.$refs.grid.reload(this.nodeInfo); }
}, },
loadTree() { loadTree() {
let conditions = []; let conditions = [];
...@@ -149,35 +151,7 @@ export default { ...@@ -149,35 +151,7 @@ export default {
toggle() { toggle() {
this.expand = !this.expand; this.expand = !this.expand;
}, },
change(v, b) { change(v, b) {},
// console.log(v);
// console.log(b);
// }
// var parentList = [];
// buildParentList(v);
// findParent(b.id);
// function buildParentList(arr) {
// arr.forEach(g => {
// console.log(g);
// if (g.upId != undefined) {
// let pid = g["upId"];
// let oid = g["id"];
// parentList[oid] = pid;
// }
// if (g.children != undefined) buildParentList(g["children"]);
// });
// }
// function findParent(idx) {
// alert(idx);
// alert(parentList[idx]);
// if (parentList[idx] != undefined) {
// let pid = parentList[idx];
// console.log(pid);
// findParent(pid);
// } else {
// }
// }
},
hide() { hide() {
this.showMenu = false; this.showMenu = false;
} }
......
<template> <template>
<div class="master-data"> <div class="master-data">
{{nodeInfo}} {{nodeInfo}}
<DataGrid :columns="columns" ref="grid" :action="action"> <DataGrid :columns="columns" ref="grid" :action="action" :initsearch="sets" :high="false">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
<Input <Input
placeholder="请输入工艺名称/工艺编号" placeholder="请输入编码/名称/状态"
v-width="200" v-width="200"
v-model="easySearch.keys.value" v-model="easySearch.keys.value"
clearable clearable
...@@ -47,21 +47,25 @@ export default { ...@@ -47,21 +47,25 @@ export default {
props: ["nodeInfo"], props: ["nodeInfo"],
data() { data() {
return { return {
action: "", action: Api.index,
modal: false, modal: false,
title: "新增", title: "新增",
curId: 0, curId: 0,
detail: null, detail: null,
sets: v => {
v.categoryId = this.nodeInfo.categoryId;
v.rootCategoryId = this.nodeInfo.rootCategoryId;
},
easySearch: { easySearch: {
keys: { op: "categoryId,rootCategoryId", value: null }, keys: { op: "Code,Name", value: null },
categoryId: { // categoryId: {
op: "In", // op: "In",
value: this.nodeInfo.categoryId // value: this.nodeInfo.categoryId
}, // },
rootCategoryId: { // rootCategoryId: {
op: "In", // op: "In",
value: this.nodeInfo.rootCategoryId // value: this.nodeInfo.rootCategoryId
} // }
}, },
columns: [ columns: [
// { // {
...@@ -71,17 +75,17 @@ export default { ...@@ -71,17 +75,17 @@ export default {
// width: 60 // width: 60
// }, // },
{ {
key: "code", key: "Code",
title: "编码", title: "编码",
align: "left" align: "left"
}, },
{ {
key: "name", key: "Name",
title: "名称", title: "名称",
align: "left" align: "left"
}, },
{ {
key: "status", key: "Status",
title: "状态", title: "状态",
align: "left", align: "left",
render: (h, params) => { render: (h, params) => {
...@@ -89,17 +93,21 @@ export default { ...@@ -89,17 +93,21 @@ export default {
props: { props: {
code: "materail.category.status", code: "materail.category.status",
type: "text", type: "text",
value: params.row.status + "" value: params.row.Status + ""
} }
}); });
} }
}, },
{ {
key: "description", key: "Version",
title: "版本",
align: "left"
},
{
key: "Description",
title: "描述", title: "描述",
align: "left" align: "left"
}, },
{ {
title: "操作", title: "操作",
key: "action", key: "action",
...@@ -132,12 +140,7 @@ export default { ...@@ -132,12 +140,7 @@ export default {
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
created() { created() {},
Api.paged().then(r => {
if (r.success) {
}
});
},
methods: { methods: {
search() { search() {
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch);
...@@ -167,7 +170,7 @@ export default { ...@@ -167,7 +170,7 @@ export default {
}); });
}, },
ok() { ok() {
// this.loadTree(); this.$refs.grid.reload(this.easySearch);
this.modal = false; this.modal = false;
this.curId = 0; this.curId = 0;
}, },
...@@ -175,6 +178,13 @@ export default { ...@@ -175,6 +178,13 @@ export default {
this.curId = 0; this.curId = 0;
this.modal = false; this.modal = false;
} }
},
watch: {
"nodeInfo.categoryId"(v) {
if (v) {
this.$refs.grid.reload(this.easySearch);
}
}
} }
}; };
</script> </script>
......
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