Commit 1d969369 authored by kangzhenfei's avatar kangzhenfei

Merge branch 'product' of git.mes123.com:zhouyx/mes-ui into product

parents e6c645db 900731c6
...@@ -201,7 +201,7 @@ export default { ...@@ -201,7 +201,7 @@ export default {
this.checkList.splice(index, 1); this.checkList.splice(index, 1);
} }
}, },
setRow() { setRow(row,index) {
this.$set(this.checkList, index, row); this.$set(this.checkList, index, row);
}, },
addNew() { addNew() {
......
...@@ -197,7 +197,7 @@ export default { ...@@ -197,7 +197,7 @@ export default {
this.checkList.splice(index, 1); this.checkList.splice(index, 1);
} }
}, },
setRow() { setRow(row,index) {
this.$set(this.checkList, index, row); this.$set(this.checkList, index, row);
}, },
addNew() { addNew() {
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</a> </a>
</div> </div>
<Content :class="!showMenu?'con_bord':''"> <Content :class="!showMenu?'con_bord':''">
<!-- <Product :parent="parent" /> --> <MasterData ref="dataTable" @on-edit="edit" />
</Content> </Content>
</Layout> </Layout>
<Modal v-model="modal" :title="title" width="1000" footer-hide :mask-closable="false"> <Modal v-model="modal" :title="title" width="1000" footer-hide :mask-closable="false">
...@@ -69,11 +69,14 @@ ...@@ -69,11 +69,14 @@
</div> </div>
</template> </template>
<script> <script>
// import spareParts from "./spareParts"; import MasterData from "./masterData";
// import Product from "./product";
import Api from "./api"; import Api from "./api";
export default { export default {
name: "", components: {
MasterData
},
name: "classification",
data() { data() {
return { return {
keys: "", keys: "",
...@@ -85,11 +88,7 @@ export default { ...@@ -85,11 +88,7 @@ export default {
curId: 0, curId: 0,
detail: null, detail: null,
showMenu: true, showMenu: true,
parent: { dataList: []
id: null,
parentName: "",
ids: ""
}
}; };
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
...@@ -103,15 +102,19 @@ export default { ...@@ -103,15 +102,19 @@ export default {
//this.$Message.info("展开左侧树") //this.$Message.info("展开左侧树")
this.showMenu = true; this.showMenu = true;
}, },
ok() { ok(row) {
this.loadTree(); this.loadTree();
this.modal = false; this.modal = false;
this.curId = 0; this.curId = 0;
if (row) {
this.dataList.map((e, index) => {
if (e.id == row.id) {
this.$set(this.$refs.dataTable.dataColumns, index, row);
}
});
}
}, },
addNew() { addNew() {
// this.nodeInfo.id = 0;
// let conditions = [];
this.curId = 0; this.curId = 0;
this.title = "新增"; this.title = "新增";
this.detail = () => import("./add"); this.detail = () => import("./add");
...@@ -124,7 +127,10 @@ export default { ...@@ -124,7 +127,10 @@ export default {
this.detail = () => import("./sonAdd"); this.detail = () => import("./sonAdd");
this.modal = true; this.modal = true;
}, },
edit() { edit(row) {
if (row) {
this.nodeInfo = row;
}
if (this.nodeInfo.upId == 0) { if (this.nodeInfo.upId == 0) {
this.detail = () => import("./edit"); this.detail = () => import("./edit");
this.$refs.chlidren.arr = []; this.$refs.chlidren.arr = [];
...@@ -166,9 +172,9 @@ export default { ...@@ -166,9 +172,9 @@ export default {
"span", "span",
{ {
on: { on: {
// click: () => { click: () => {
// this.handleSelect(data); //手动选择树节点 this.handleSelect(data); //手动选择树节点
// }, },
//右键点击事件 //右键点击事件
contextmenu: e => { contextmenu: e => {
e.preventDefault(); e.preventDefault();
...@@ -182,9 +188,32 @@ export default { ...@@ -182,9 +188,32 @@ export default {
data.title data.title
); );
}, },
// handleSelect(data) { handleSelect(data) {
// this.$emit("clickItem", data); let tableData = [];
// }, let obj = {};
let children = 0;
if (data.upId == 0 && data.children.length > 0) {
data.children.forEach(e => {
if (e.children.length > 0) {
children = 1;
} else {
children = 0;
}
obj = {
id: e.id,
name: e.name,
code: e.code,
status: e.status,
children: children,
upId: e.upId,
description: e.description
};
tableData.push(obj);
});
this.dataList = tableData;
this.$refs.dataTable.dataColumns = tableData;
}
},
loadTree() { loadTree() {
let conditions = []; let conditions = [];
Api.list({ conditions: conditions }).then(r => { Api.list({ conditions: conditions }).then(r => {
......
<template> <template>
<div class="master-data"> <div class="master-data">
<DataGrid :columns="columns" ref="grid" :action="action"> <Table stripe :columns="columns" :data="dataColumns"></Table>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入编码/名称" v-width="200" v-model="easySearch.keys.value" clearable />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1120" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal>
</div> </div>
</template> </template>
<script> <script>
import Api from "../api";
export default { export default {
name: "masterData",
data() { data() {
return { return {
action: "", action: "",
detail: null, detail: null,
modal: false, modal: false,
curId: 0, curId: 0,
easySearch: { dataColumns: [],
keys: { op: "name,code", value: null }
},
title: "", title: "",
columns: [ columns: [
// {
// key: "index",
// title: "#",
// align: "left",
// width: 60
// },
{ {
key: "code", key: "code",
title: "编码", title: "编码",
align: "left", align: "left"
width: 200,
easy: true,
high: true
}, },
{ {
key: "name", key: "name",
title: "名称", title: "名称",
align: "left"
},
{
key: "status",
title: "状态",
align: "left", align: "left",
easy: true, render: (h, params) => {
high: true, return h("state", {
tooltip: true props: {
code: "materail.category.status",
type: "text",
value: params.row.status + ""
}
});
}
},
{
key: "description",
title: "描述",
align: "left"
}, },
{ {
title: "操作", title: "操作",
key: "action", key: "action",
...@@ -70,7 +73,7 @@ export default { ...@@ -70,7 +73,7 @@ export default {
attrs: { oprate: "delete" }, attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) } on: { click: () => this.remove(params.row.id) }
}, },
"删除" params.row.children == 0 ? "删除" : ""
) )
]); ]);
} }
...@@ -78,12 +81,34 @@ export default { ...@@ -78,12 +81,34 @@ export default {
] ]
}; };
}, },
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
// this.dataColumns = this.dataTable;
// console.log(this.dataColumns)
},
methods: { methods: {
edit() { edit(row) {
this.modal = true; this.$emit("on-edit", row);
this.detail = () => import("./add"); },
remove(id) {
this.$Modal.confirm({
title: "删除",
content: "<p>您确定要删除吗?</p>",
onOk: () => {
Api.delete(id).then(r => {
if (r.success) {
this.loadTree();
this.$Message.success("删除成功");
}
});
},
onCancel: () => {
this.$Message.success("取消删除");
}
});
}, },
remove() {},
add() { add() {
this.modal = true; this.modal = true;
this.detail = () => import("./add"); this.detail = () => import("./add");
......
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
.then(r => { .then(r => {
if (r.success) { if (r.success) {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
this.$emit("on-ok"); this.$emit("on-ok",this.entity);
} else { } else {
this.$Message.error("保存失败"); this.$Message.error("保存失败");
} }
......
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