Commit 2e96f4bc authored by renjintao's avatar renjintao

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

parents f8aed324 c4b7b181
...@@ -110,6 +110,7 @@ export default { ...@@ -110,6 +110,7 @@ export default {
code: 0, code: 0,
status: 0, status: 0,
codeRuleId: this.nodeInfo.codeRuleId, codeRuleId: this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
}, },
disabled: false, disabled: false,
codeList: [], codeList: [],
......
...@@ -108,6 +108,7 @@ export default { ...@@ -108,6 +108,7 @@ export default {
upId: 0, upId: 0,
code: 0, code: 0,
codeRuleId: this.nodeInfo.codeRuleId, codeRuleId: this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
}, },
arr: [], arr: [],
disabled: false, disabled: false,
......
<template> <template>
<div class="classification"> <div class="classification">
<Layout> <Layout>
<Sider width="300" v-if="showMenu"> <Sider width="300" v-if="showMenu">
<div class="p-list"> <div class="p-list">
...@@ -10,14 +10,26 @@ ...@@ -10,14 +10,26 @@
<Icon type="ios-arrow-down"></Icon> <Icon type="ios-arrow-down"></Icon>
</a> </a>
<DropdownMenu slot="list"> <DropdownMenu slot="list">
<DropdownItem v-for="item in cityList" :key="item.id" :name="item.id">{{ item.name }}</DropdownItem> <DropdownItem
v-for="item in cityList"
:key="item.id"
:name="item.id"
>{{ item.name }}</DropdownItem>
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
<div class="fr mr10 mt10"> <div class="fr mr10 mt10">
<ButtonGroup class="fr" size="small"> <ButtonGroup class="fr" size="small">
<Button icon="md-add" title="新增顶级" @click="addNew"></Button> <Button icon="md-add" title="新增顶级" @click="addNew"></Button>
<Button :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" @click="toggle" title="展开/合并"></Button> <Button
<Button icon="md-refresh" title="刷新" @click="loadTree(model8)"></Button> :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'"
@click="toggle"
title="展开/合并"
></Button>
<Button
icon="md-refresh"
title="刷新"
@click="loadTree(model8,nodeInfo.codeRuleType)"
></Button>
<Button icon="md-rewind" title="收起" @click="hide"></Button> <Button icon="md-rewind" title="收起" @click="hide"></Button>
</ButtonGroup> </ButtonGroup>
</div> </div>
...@@ -28,7 +40,13 @@ ...@@ -28,7 +40,13 @@
<div class="fg"> <div class="fg">
<div class="tree"> <div class="tree">
<Tree :data="data" ref="tree" @on-select-change="change" :render="renderContent"></Tree> <Tree :data="data" ref="tree" @on-select-change="change" :render="renderContent"></Tree>
<Dropdown transfer ref="contentMenu" style="display: none;" trigger="click" placement="right-start"> <Dropdown
transfer
ref="contentMenu"
style="display: none;"
trigger="click"
placement="right-start"
>
<DropdownMenu slot="list" ref="ppp" style="min-width: 80px;"> <DropdownMenu slot="list" ref="ppp" style="min-width: 80px;">
<DropdownItem @click.native="add"> <DropdownItem @click.native="add">
<a>添加</a> <a>添加</a>
...@@ -55,9 +73,16 @@ ...@@ -55,9 +73,16 @@
</Content> </Content>
</Layout> </Layout>
<Modal v-model="modal" :title="title" width="1500" footer-hide :mask-closable="false"> <Modal v-model="modal" :title="title" width="1500" footer-hide :mask-closable="false">
<component :is="detail" :eid="curId" :nodeInfo="nodeInfo" @on-close="cancel" @on-ok="ok" ref="chlidren" /> <component
:is="detail"
:eid="curId"
:nodeInfo="nodeInfo"
@on-close="cancel"
@on-ok="ok"
ref="chlidren"
/>
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
...@@ -66,7 +91,7 @@ import MasterData from "./masterData.vue"; ...@@ -66,7 +91,7 @@ import MasterData from "./masterData.vue";
import Api from "./api"; import Api from "./api";
export default { export default {
components: { components: {
MasterData MasterData,
}, },
name: "classification", name: "classification",
data() { data() {
...@@ -74,7 +99,7 @@ export default { ...@@ -74,7 +99,7 @@ export default {
model8: "", model8: "",
root: { root: {
id: 0, id: 0,
ids: [] ids: [],
}, },
downName: "请选择类型", downName: "请选择类型",
cityList: [], cityList: [],
...@@ -82,20 +107,18 @@ export default { ...@@ -82,20 +107,18 @@ export default {
expand: false, expand: false,
list: [], list: [],
nodeInfo: { nodeInfo: {
codeRuleId: "" codeRuleId: "",
codeRuleType: "",
}, },
modal: false, modal: false,
title: "新增", title: "新增",
curId: 0, curId: 0,
detail: null, detail: null,
showMenu: true, showMenu: true,
dataList: [] dataList: [],
}; };
}, },
async fetch({ async fetch({ store, params }) {
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
created() { created() {
...@@ -106,26 +129,27 @@ export default { ...@@ -106,26 +129,27 @@ export default {
clickItem(val) { clickItem(val) {
this.nodeInfo.codeRuleId = val; this.nodeInfo.codeRuleId = val;
this.model8 = val; this.model8 = val;
this.loadTree(this.nodeInfo.codeRuleId); this.cityList.forEach((e) => {
this.cityList.forEach(e => {
if (val == e.id) { if (val == e.id) {
this.downName = e.name; this.downName = e.name;
this.nodeInfo.codeRuleType = e.type;
} }
}); });
this.model8 = val; this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
}, },
listSlecet() { listSlecet() {
let data = { let data = {
conditions: [], conditions: [],
sortBy: "id", sortBy: "id",
isDesc: false isDesc: false,
}; };
Api.pagedSlecet(data).then(r => { Api.pagedSlecet(data).then((r) => {
this.cityList = r.result.items; this.cityList = r.result.items;
this.downName = this.cityList[0].name; this.downName = this.cityList[0].name;
this.model8 = this.cityList[0].id; this.model8 = this.cityList[0].id;
this.nodeInfo.codeRuleId = this.cityList[0].id; this.nodeInfo.codeRuleId = this.cityList[0].id;
this.loadTree(this.nodeInfo.codeRuleId); this.nodeInfo.codeRuleType = this.cityList[0].type;
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
}); });
}, },
...@@ -134,7 +158,7 @@ export default { ...@@ -134,7 +158,7 @@ export default {
this.showMenu = true; this.showMenu = true;
}, },
ok(row) { ok(row) {
this.loadTree(this.nodeInfo.codeRuleId); this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
this.modal = false; this.modal = false;
this.curId = 0; this.curId = 0;
// if (row) { // if (row) {
...@@ -186,16 +210,19 @@ export default { ...@@ -186,16 +210,19 @@ export default {
title: "删除", title: "删除",
content: "<p>您确定要删除吗?</p>", content: "<p>您确定要删除吗?</p>",
onOk: () => { onOk: () => {
Api.delete(this.nodeInfo.id).then(r => { Api.delete(this.nodeInfo.id).then((r) => {
if (r.success) { if (r.success) {
this.loadTree(this.nodeInfo.codeRuleId); this.loadTree(
this.nodeInfo.codeRuleId,
this.nodeInfo.codeRuleType
);
this.$Message.success("删除成功"); this.$Message.success("删除成功");
} }
}); });
}, },
onCancel: () => { onCancel: () => {
this.$Message.success("取消删除"); this.$Message.success("取消删除");
} },
}); });
} }
}, },
...@@ -203,32 +230,29 @@ export default { ...@@ -203,32 +230,29 @@ export default {
this.curId = 0; this.curId = 0;
this.modal = false; this.modal = false;
}, },
renderContent(h, { renderContent(h, { root, node, data }) {
root,
node,
data
}) {
return h( return h(
"span", { "span",
{
on: { on: {
click: () => { click: () => {
this.handleSelect(data); //手动选择树节点 this.handleSelect(data); //手动选择树节点
}, },
//右键点击事件 //右键点击事件
contextmenu: e => { contextmenu: (e) => {
e.preventDefault(); e.preventDefault();
this.$refs.contentMenu.$refs.reference = event.target; this.$refs.contentMenu.$refs.reference = event.target;
this.$refs.contentMenu.currentVisible = !this.$refs.contentMenu this.$refs.contentMenu.currentVisible = !this.$refs.contentMenu
.currentVisible; .currentVisible;
this.nodeInfo = data; this.nodeInfo = data;
} },
} },
}, },
data.title + data.title +
"(" + "(" +
(data.totalMaterialCount == undefined ? (data.totalMaterialCount == undefined
"0" : ? "0"
data.totalMaterialCount) + : data.totalMaterialCount) +
")" ")"
); );
}, },
...@@ -258,21 +282,28 @@ export default { ...@@ -258,21 +282,28 @@ export default {
// this.$refs.dataTable.dataColumns = tableData; // this.$refs.dataTable.dataColumns = tableData;
// } // }
}, },
loadTree(id) { loadTree(id, codeRuleType) {
let data = { let data = {
conditions: [{ conditions: [
{
fieldName: "codeRuleId", fieldName: "codeRuleId",
fieldValue: id, fieldValue: id,
conditionalType: "Equal" conditionalType: "Equal",
}], },
{
fieldName: "codeRuleType",
fieldValue: codeRuleType,
conditionalType: "Equal",
},
],
sortBy: "code", sortBy: "code",
isDesc: false isDesc: false,
}; };
Api.list(data).then(r => { Api.list(data).then((r) => {
var data = this.$u.toTree( var data = this.$u.toTree(
r.result, r.result,
0, 0,
u => { (u) => {
u.title = u.code + u.name; u.title = u.code + u.name;
u.value = u.id; u.value = u.id;
u.expand = true; u.expand = true;
...@@ -298,7 +329,7 @@ export default { ...@@ -298,7 +329,7 @@ export default {
addId(b.children); addId(b.children);
function addId(data) { function addId(data) {
data.map(u => { data.map((u) => {
ids.push(u.id); ids.push(u.id);
if (u.children) { if (u.children) {
addId(u.children); addId(u.children);
...@@ -312,7 +343,7 @@ export default { ...@@ -312,7 +343,7 @@ export default {
}, },
hide() { hide() {
this.showMenu = false; this.showMenu = false;
} },
}, },
computed: { computed: {
data() { data() {
...@@ -322,7 +353,7 @@ export default { ...@@ -322,7 +353,7 @@ export default {
search(this.keys, items); search(this.keys, items);
function search(keys, data) { function search(keys, data) {
data.map(u => { data.map((u) => {
if (keys.length < u.title) { if (keys.length < u.title) {
u.expand = expand; u.expand = expand;
result.push(u); result.push(u);
...@@ -337,8 +368,8 @@ export default { ...@@ -337,8 +368,8 @@ export default {
}); });
} }
return result; return result;
} },
} },
}; };
</script> </script>
......
...@@ -52,7 +52,8 @@ export default { ...@@ -52,7 +52,8 @@ export default {
upId: this.nodeInfo.id, upId: this.nodeInfo.id,
code: 0, code: 0,
status: 0, status: 0,
codeRuleId:this.nodeInfo.codeRuleId codeRuleId:this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
}, },
upName: this.nodeInfo.title, upName: this.nodeInfo.title,
disabled: false, disabled: false,
......
...@@ -51,13 +51,14 @@ export default { ...@@ -51,13 +51,14 @@ export default {
entity: { entity: {
upId: 0, upId: 0,
code: 0, code: 0,
codeRuleId:this.nodeInfo.codeRuleId codeRuleId: this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
}, },
upName: this.nodeInfo.title, upName: this.nodeInfo.title,
disabled: false, disabled: false,
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }] name: [{ required: true, message: "必填", trigger: "blur" }],
} },
}; };
}, },
props: ["nodeInfo"], props: ["nodeInfo"],
...@@ -69,25 +70,25 @@ export default { ...@@ -69,25 +70,25 @@ export default {
}, },
methods: { methods: {
get() { get() {
Api.get({ id: this.nodeInfo.id }).then(r => { Api.get({ id: this.nodeInfo.id }).then((r) => {
if (r.result) { if (r.result) {
this.entity = r.result; this.entity = r.result;
} }
}); });
}, },
handleSubmit() { handleSubmit() {
this.$refs.form.validate(v => { this.$refs.form.validate((v) => {
if (v) { if (v) {
Api.update({ categoryDto: this.entity, pro: [] }) Api.update({ categoryDto: this.entity, pro: [] })
.then(r => { .then((r) => {
if (r.success) { if (r.success) {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
this.$emit("on-ok",this.entity); this.$emit("on-ok", this.entity);
} else { } else {
this.$Message.error(r.error.message); this.$Message.error(r.error.message);
} }
}) })
.catch(err => { .catch((err) => {
this.disabled = false; this.disabled = false;
this.$Message.error(r.error.message); this.$Message.error(r.error.message);
}); });
...@@ -96,7 +97,7 @@ export default { ...@@ -96,7 +97,7 @@ export default {
}, },
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
} },
} },
}; };
</script> </script>
...@@ -91,14 +91,15 @@ export default { ...@@ -91,14 +91,15 @@ export default {
codeRuleId: this.nodeInfo.codeRuleId, codeRuleId: this.nodeInfo.codeRuleId,
categoryId: this.nodeInfo.categoryId, //左侧树点击的id categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {}, customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId //左侧树点击的数据的最顶层id rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
codeRuleType: this.nodeInfo.codeRuleType,
}, },
disabled: false, disabled: false,
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }] name: [{ required: true, message: "必填", trigger: "blur" }],
}, },
fileds: [] //扩展属性 fileds: [], //扩展属性
}; };
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
...@@ -113,17 +114,17 @@ export default { ...@@ -113,17 +114,17 @@ export default {
{ {
conditionalType: "Equal", conditionalType: "Equal",
fieldName: "categoryId", fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId fieldValue: this.nodeInfo.rootCategoryId,
} },
]; ];
Api.listTable({ Api.listTable({
conditions: conditions, conditions: conditions,
sortBy: "id", sortBy: "id",
isDesc: false isDesc: false,
}).then(r => { }).then((r) => {
if (r.result) { if (r.result) {
this.fileds = r.result.filter(function(item) { this.fileds = r.result.filter(function (item) {
item.span = 12; item.span = 12;
if (item.dataType > 4) { if (item.dataType > 4) {
item.span = 24; item.span = 24;
...@@ -131,7 +132,7 @@ export default { ...@@ -131,7 +132,7 @@ export default {
delete item["id"]; delete item["id"];
return item.fieldType != 1; return item.fieldType != 1;
}); });
this.fileds.map(u => { this.fileds.map((u) => {
let v = ""; let v = "";
if (u.dataType == 1 || u.dataType == 2) { if (u.dataType == 1 || u.dataType == 2) {
v = 0; v = 0;
...@@ -158,12 +159,12 @@ export default { ...@@ -158,12 +159,12 @@ export default {
}, },
handleSubmit() { handleSubmit() {
this.$refs.form.validate(v => { this.$refs.form.validate((v) => {
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(this.entity) 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");
...@@ -171,7 +172,7 @@ export default { ...@@ -171,7 +172,7 @@ export default {
this.$Message.error(r.error.message); this.$Message.error(r.error.message);
} }
}) })
.catch(err => { .catch((err) => {
this.disabled = false; this.disabled = false;
this.$Message.error(r.error.message); this.$Message.error(r.error.message);
}); });
...@@ -180,7 +181,7 @@ export default { ...@@ -180,7 +181,7 @@ export default {
}, },
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
} },
} },
}; };
</script> </script>
...@@ -89,14 +89,15 @@ export default { ...@@ -89,14 +89,15 @@ export default {
categoryId: this.nodeInfo.categoryId, //左侧树点击的id categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {}, customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
version: null version: null,
codeRuleType: this.nodeInfo.codeRuleType,
}, },
fileds: [], fileds: [],
checkList: [], checkList: [],
disabled: false, disabled: false,
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }] name: [{ required: true, message: "必填", trigger: "blur" }],
} },
}; };
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
...@@ -114,16 +115,16 @@ export default { ...@@ -114,16 +115,16 @@ export default {
{ {
conditionalType: "Equal", conditionalType: "Equal",
fieldName: "categoryId", fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId fieldValue: this.nodeInfo.rootCategoryId,
} },
]; ];
Api.listTable({ Api.listTable({
conditions: conditions, conditions: conditions,
sortBy: "id", sortBy: "id",
isDesc: false isDesc: false,
}).then(r => { }).then((r) => {
if (r.result) { if (r.result) {
this.fileds = r.result.filter(function(item) { this.fileds = r.result.filter(function (item) {
item.span = 12; item.span = 12;
if (item.dataType > 4) { if (item.dataType > 4) {
item.span = 24; item.span = 24;
...@@ -131,7 +132,7 @@ export default { ...@@ -131,7 +132,7 @@ export default {
delete item["id"]; delete item["id"];
return item.fieldType != 1; return item.fieldType != 1;
}); });
this.fileds.map(u => { this.fileds.map((u) => {
let v = ""; let v = "";
if (u.dataType == 1 || u.dataType == 2) { if (u.dataType == 1 || u.dataType == 2) {
v = 0; v = 0;
...@@ -143,7 +144,7 @@ export default { ...@@ -143,7 +144,7 @@ export default {
}); });
}, },
get() { get() {
Api.get({ id: this.eid }).then(r => { Api.get({ id: this.eid }).then((r) => {
if (r.result) { if (r.result) {
this.entity = r.result; this.entity = r.result;
this.entity.version = parseInt(r.result.version); this.entity.version = parseInt(r.result.version);
...@@ -155,23 +156,23 @@ export default { ...@@ -155,23 +156,23 @@ export default {
{ {
conditionalType: "In", conditionalType: "In",
fieldName: "fieldType", fieldName: "fieldType",
fieldValue: "1,2" fieldValue: "1,2",
}, },
{ {
conditionalType: "Equal", conditionalType: "Equal",
fieldName: "categoryId", fieldName: "categoryId",
fieldValue: "0" fieldValue: "0",
} },
]; ];
Api.listTable({ Api.listTable({
conditions: conditions, conditions: conditions,
sortBy: "id", sortBy: "id",
isDesc: false isDesc: false,
}).then(r => { }).then((r) => {
if (r.result) { if (r.result) {
var arr = r.result; var arr = r.result;
this.checkList = arr.filter(function(item) { this.checkList = arr.filter(function (item) {
item.mid = item.id; item.mid = item.id;
delete item["id"]; //删除属性id delete item["id"]; //删除属性id
return item; return item;
...@@ -195,12 +196,12 @@ export default { ...@@ -195,12 +196,12 @@ export default {
}, },
handleSubmit() { handleSubmit() {
this.$refs.form.validate(v => { this.$refs.form.validate((v) => {
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.update(this.entity) Api.update(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");
...@@ -208,7 +209,7 @@ export default { ...@@ -208,7 +209,7 @@ export default {
this.$Message.error(r.error.message); this.$Message.error(r.error.message);
} }
}) })
.catch(err => { .catch((err) => {
this.disabled = false; this.disabled = false;
this.$Message.error(r.error.message); this.$Message.error(r.error.message);
}); });
...@@ -217,7 +218,7 @@ export default { ...@@ -217,7 +218,7 @@ export default {
}, },
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
} },
} },
}; };
</script> </script>
<template> <template>
<div class="classification"> <div class="classification">
<Layout> <Layout>
<Sider width="300" v-if="showMenu"> <Sider width="300" v-if="showMenu">
<div class="p-list"> <div class="p-list">
...@@ -10,13 +10,25 @@ ...@@ -10,13 +10,25 @@
<Icon type="ios-arrow-down"></Icon> <Icon type="ios-arrow-down"></Icon>
</a> </a>
<DropdownMenu slot="list"> <DropdownMenu slot="list">
<DropdownItem v-for="item in cityList" :key="item.id" :name="item.id">{{ item.name }}</DropdownItem> <DropdownItem
v-for="item in cityList"
:key="item.id"
:name="item.id"
>{{ item.name }}</DropdownItem>
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
<div class="fr mr10 mt10"> <div class="fr mr10 mt10">
<ButtonGroup class="fr ddi" size="small"> <ButtonGroup class="fr ddi" size="small">
<Button :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" @click="toggle" title="展开/合并"></Button> <Button
<Button icon="md-refresh" title="刷新" @click="loadTree(model8)"></Button> :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'"
@click="toggle"
title="展开/合并"
></Button>
<Button
icon="md-refresh"
title="刷新"
@click="loadTree(model8,nodeInfo.codeRuleType)"
></Button>
<Button icon="md-rewind" title="收起" @click="hide"></Button> <Button icon="md-rewind" title="收起" @click="hide"></Button>
</ButtonGroup> </ButtonGroup>
</div> </div>
...@@ -40,7 +52,7 @@ ...@@ -40,7 +52,7 @@
<MasterData ref="dataTable" :nodeInfo="nodeInfo" @on-ok="ok" /> <MasterData ref="dataTable" :nodeInfo="nodeInfo" @on-ok="ok" />
</Content> </Content>
</Layout> </Layout>
</div> </div>
</template> </template>
<script> <script>
...@@ -67,6 +79,7 @@ export default { ...@@ -67,6 +79,7 @@ export default {
ids: [], ids: [],
addChange: true, addChange: true,
codeRuleId: 0, codeRuleId: 0,
codeRuleType: "",
}, },
downName: "请选择类型", downName: "请选择类型",
modal: false, modal: false,
...@@ -75,15 +88,12 @@ export default { ...@@ -75,15 +88,12 @@ export default {
detail: null, detail: null,
showMenu: true, showMenu: true,
dataList: [], dataList: [],
codeRuleId: "",
rootCategoryId: null, rootCategoryId: null,
categoryId: null, categoryId: null,
}; };
}, },
async fetch({ async fetch({ store, params }) {
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
created() { created() {
...@@ -92,15 +102,15 @@ export default { ...@@ -92,15 +102,15 @@ export default {
}, },
methods: { methods: {
clickItem(val) { clickItem(val) {
this.codeRuleId = val;
this.nodeInfo.codeRuleId = val; this.nodeInfo.codeRuleId = val;
this.model8 = val; this.model8 = val;
this.loadTree(this.codeRuleId);
this.cityList.forEach((e) => { this.cityList.forEach((e) => {
if (val == e.id) { if (val == e.id) {
this.downName = e.name; this.downName = e.name;
this.nodeInfo.codeRuleType = e.type;
} }
}); });
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
}, },
listSlecet() { listSlecet() {
let data = { let data = {
...@@ -113,7 +123,8 @@ export default { ...@@ -113,7 +123,8 @@ export default {
this.downName = this.cityList[0].name; this.downName = this.cityList[0].name;
this.model8 = this.cityList[0].id; this.model8 = this.cityList[0].id;
this.nodeInfo.codeRuleId = this.cityList[0].id; this.nodeInfo.codeRuleId = this.cityList[0].id;
this.loadTree(this.nodeInfo.codeRuleId); this.nodeInfo.codeRuleType = this.cityList[0].type;
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
}); });
}, },
...@@ -122,7 +133,7 @@ export default { ...@@ -122,7 +133,7 @@ export default {
this.showMenu = true; this.showMenu = true;
}, },
ok(row) { ok(row) {
this.loadTree(this.codeRuleId); this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
// this.modal = false; // this.modal = false;
// this.curId = 0; // this.curId = 0;
// if (row) { // if (row) {
...@@ -137,13 +148,10 @@ export default { ...@@ -137,13 +148,10 @@ export default {
this.curId = 0; this.curId = 0;
this.modal = false; this.modal = false;
}, },
renderContent(h, { renderContent(h, { root, node, data }) {
root,
node,
data
}) {
return h( return h(
"span", { "span",
{
on: { on: {
click: () => { click: () => {
this.handleSelect(root, data); //手动选择树节点 this.handleSelect(root, data); //手动选择树节点
...@@ -152,9 +160,9 @@ export default { ...@@ -152,9 +160,9 @@ export default {
}, },
data.title + data.title +
"(" + "(" +
(data.totalMaterialCount == undefined ? (data.totalMaterialCount == undefined
"0" : ? "0"
data.totalMaterialCount) + : data.totalMaterialCount) +
")" ")"
); );
}, },
...@@ -186,16 +194,23 @@ export default { ...@@ -186,16 +194,23 @@ export default {
this.nodeInfo.rootCategoryName = data.name; this.nodeInfo.rootCategoryName = data.name;
} else { } else {
this.nodeInfo.rootCategoryId = pid; this.nodeInfo.rootCategoryId = pid;
this.nodeInfo.rootCategoryName = pname this.nodeInfo.rootCategoryName = pname;
} }
}, },
loadTree(id) { loadTree(id, codeRuleType) {
let data = { let data = {
conditions: [{ conditions: [
{
fieldName: "codeRuleId", fieldName: "codeRuleId",
fieldValue: id, fieldValue: id,
conditionalType: "Equal" conditionalType: "Equal",
}, ], },
{
fieldName: "codeRuleType",
fieldValue: codeRuleType,
conditionalType: "Equal",
},
],
sortBy: "code", sortBy: "code",
isDesc: false, isDesc: false,
}; };
......
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