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