Commit 6b41fe09 authored by 仇晓婷's avatar 仇晓婷

分类区分库类型

parent 791da147
...@@ -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,
......
...@@ -86,7 +86,7 @@ import MasterData from "./masterData.vue"; ...@@ -86,7 +86,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() {
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
model8: "", model8: "",
root: { root: {
id: 0, id: 0,
ids: [] ids: [],
}, },
downName: "请选择类型", downName: "请选择类型",
cityList: [], cityList: [],
...@@ -102,14 +102,15 @@ export default { ...@@ -102,14 +102,15 @@ 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({ store, params }) { async fetch({ store, params }) {
...@@ -121,12 +122,14 @@ export default { ...@@ -121,12 +122,14 @@ export default {
}, },
methods: { methods: {
clickItem(val) { clickItem(val) {
console.log(val);
this.nodeInfo.codeRuleId = val; this.nodeInfo.codeRuleId = val;
this.model8 = val; this.model8 = val;
this.loadTree(this.nodeInfo.codeRuleId); 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.model8 = val;
...@@ -135,9 +138,9 @@ export default { ...@@ -135,9 +138,9 @@ export default {
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;
...@@ -203,7 +206,7 @@ export default { ...@@ -203,7 +206,7 @@ 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.$Message.success("删除成功"); this.$Message.success("删除成功");
...@@ -212,7 +215,7 @@ export default { ...@@ -212,7 +215,7 @@ export default {
}, },
onCancel: () => { onCancel: () => {
this.$Message.success("取消删除"); this.$Message.success("取消删除");
} },
}); });
} }
}, },
...@@ -229,14 +232,14 @@ export default { ...@@ -229,14 +232,14 @@ export default {
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 +
"(" + "(" +
...@@ -275,16 +278,21 @@ export default { ...@@ -275,16 +278,21 @@ export default {
loadTree(id) { loadTree(id) {
let data = { let data = {
conditions: [ conditions: [
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" } { fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" },
{
fieldName: "codeRuleType",
fieldValue: this.nodeInfo.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;
...@@ -309,7 +317,7 @@ export default { ...@@ -309,7 +317,7 @@ export default {
if (b.children) { if (b.children) {
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);
...@@ -323,7 +331,7 @@ export default { ...@@ -323,7 +331,7 @@ export default {
}, },
hide() { hide() {
this.showMenu = false; this.showMenu = false;
} },
}, },
computed: { computed: {
data() { data() {
...@@ -332,7 +340,7 @@ export default { ...@@ -332,7 +340,7 @@ export default {
let result = []; let result = [];
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);
...@@ -347,8 +355,8 @@ export default { ...@@ -347,8 +355,8 @@ export default {
}); });
} }
return result; return result;
} },
} },
}; };
</script> </script>
<style lang="less" > <style lang="less" >
......
...@@ -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>
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