Commit fa5f87e7 authored by 仇晓婷's avatar 仇晓婷

zhu

parent 2d2effa6
<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">
...@@ -46,14 +47,15 @@ ...@@ -46,14 +47,15 @@
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
props: ["nodeInfo"],
data() { data() {
return { return {
arr: [], arr: [],
entity: { entity: {
code: 0, code: 0,
categoryId: 0, //左侧树点击的id categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {}, customProperties: {},
rootCategoryId: 0 //左侧树点击的数据的最顶层id rootCategoryId: this.nodeInfo.rootCategoryId //左侧树点击的数据的最顶层id
}, },
disabled: false, disabled: false,
...@@ -113,19 +115,19 @@ export default { ...@@ -113,19 +115,19 @@ export default {
if (v) { if (v) {
// let categoryDto = this.entity; // let categoryDto = this.entity;
// let pro = this.checkList.concat(this.arr); // let pro = this.checkList.concat(this.arr);
// Api.create({ categoryDto: categoryDto, pro: pro }) Api.create(this.entity)
// .then(r => { .then(r => {
// if (r.success) { if (r.success) {
// this.$Message.success("保存成功"); this.$Message.success("保存成功");
// this.$emit("on-ok"); this.$emit("on-ok");
// } else { } else {
// this.$Message.error("保存失败"); this.$Message.error("保存失败");
// } }
// }) })
// .catch(err => { .catch(err => {
// this.disabled = false; this.disabled = false;
// this.$Message.error("保存失败"); this.$Message.error("保存失败");
// }); });
} }
}); });
}, },
......
import Api from '@/plugins/request' import Api from '@/plugins/request'
export default { export default {
listTable(params){ index:`${systemUrl}/material/paged`,
return Api.post(`${systemUrl}/custompropertydefinition/list`,params); paged(params){
return Api.post(`${systemUrl}/material/paged`,params);
}, },
list(params){ list(params){
return Api.post(`${systemUrl}/category/list`,params); return Api.post(`${systemUrl}/category/list`,params);
......
...@@ -34,19 +34,9 @@ ...@@ -34,19 +34,9 @@
</a> </a>
</div> </div>
<Content :class="!showMenu?'con_bord':''"> <Content :class="!showMenu?'con_bord':''">
<MasterData ref="dataTable" @on-edit="edit" /> <MasterData ref="dataTable" :nodeInfo="nodeInfo" />
</Content> </Content>
</Layout> </Layout>
<!-- <Modal v-model="modal" :title="title" width="1000" footer-hide :mask-closable="false">
<component
:is="detail"
:eid="curId"
:nodeInfo="nodeInfo"
@on-close="cancel"
@on-ok="ok"
ref="chlidren"
/>
</Modal>-->
</div> </div>
</template> </template>
<script> <script>
...@@ -63,7 +53,10 @@ export default { ...@@ -63,7 +53,10 @@ export default {
keys: "", keys: "",
expand: false, expand: false,
list: [], list: [],
nodeInfo: {}, nodeInfo: {
categoryId: 0,
rootCategoryId: 0
},
modal: false, modal: false,
title: "新增", title: "新增",
curId: 0, curId: 0,
...@@ -105,14 +98,38 @@ export default { ...@@ -105,14 +98,38 @@ export default {
{ {
on: { on: {
click: () => { click: () => {
this.handleSelect(data); //手动选择树节点 this.handleSelect(root, data); //手动选择树节点
} }
} }
}, },
data.title data.title
); );
}, },
handleSelect(data) {}, handleSelect(root, data) {
// console.log(root);
// console.log(data);
let pid = null; //定义最顶级id
let upId = data.upId;
let roots = root;
function addId(roots, upId) {
roots.map(u => {
if (u.node.id == upId) {
if (u.node.upId == 0) {
pid = u.node.id;
} else {
upId = u.node.upId;
addId(roots, upId);
}
}
});
}
addId(roots, upId);
console.log(pid);
this.nodeInfo.categoryId = data.id;
this.nodeInfo.rootCategoryId = pid;
// this.$refs.dataTable.$refs.grid.reload(this.nodeInfo);
},
loadTree() { loadTree() {
let conditions = []; let conditions = [];
Api.list({ conditions: conditions }).then(r => { Api.list({ conditions: conditions }).then(r => {
...@@ -133,22 +150,33 @@ export default { ...@@ -133,22 +150,33 @@ export default {
this.expand = !this.expand; this.expand = !this.expand;
}, },
change(v, b) { change(v, b) {
console.log(v); // console.log(v);
console.log(b); // console.log(b);
let ids = []; // }
ids.push(b.value); // var parentList = [];
if (b.children) { // buildParentList(v);
addId(b.children); // findParent(b.id);
function addId(data) { // function buildParentList(arr) {
data.map(u => { // arr.forEach(g => {
ids.push(u.value); // console.log(g);
if (u.children) { // if (g.upId != undefined) {
addId(u.children); // let pid = g["upId"];
} // let oid = g["id"];
}); // parentList[oid] = pid;
} // }
} // if (g.children != undefined) buildParentList(g["children"]);
// this.$emit("on-select", b.value, b, ids); // });
// }
// 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}}
<DataGrid :columns="columns" ref="grid" :action="action"> <DataGrid :columns="columns" ref="grid" :action="action">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
...@@ -43,6 +44,7 @@ export default { ...@@ -43,6 +44,7 @@ export default {
components: { components: {
// Search // Search
}, },
props: ["nodeInfo"],
data() { data() {
return { return {
action: "", action: "",
...@@ -50,9 +52,16 @@ export default { ...@@ -50,9 +52,16 @@ export default {
title: "新增", title: "新增",
curId: 0, curId: 0,
detail: null, detail: null,
nodeInfo: {},
easySearch: { easySearch: {
keys: { op: "unicode,name,code", value: null } keys: { op: "categoryId,rootCategoryId", value: null },
categoryId: {
op: "In",
value: this.nodeInfo.categoryId
},
rootCategoryId: {
op: "In",
value: this.nodeInfo.rootCategoryId
}
}, },
columns: [ columns: [
// { // {
...@@ -124,8 +133,10 @@ export default { ...@@ -124,8 +133,10 @@ export default {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
created() { created() {
// this.dataColumns = this.dataTable; Api.paged().then(r => {
// console.log(this.dataColumns) if (r.success) {
}
});
}, },
methods: { methods: {
search() { search() {
......
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