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

zhu

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