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

分类区分库类型

parent 791da147
......@@ -110,6 +110,7 @@ export default {
code: 0,
status: 0,
codeRuleId: this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
},
disabled: false,
codeList: [],
......
......@@ -108,6 +108,7 @@ export default {
upId: 0,
code: 0,
codeRuleId: this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
},
arr: [],
disabled: false,
......
......@@ -86,7 +86,7 @@ import MasterData from "./masterData.vue";
import Api from "./api";
export default {
components: {
MasterData
MasterData,
},
name: "classification",
data() {
......@@ -94,7 +94,7 @@ export default {
model8: "",
root: {
id: 0,
ids: []
ids: [],
},
downName: "请选择类型",
cityList: [],
......@@ -102,14 +102,15 @@ export default {
expand: false,
list: [],
nodeInfo: {
codeRuleId: ""
codeRuleId: "",
codeRuleType: "",
},
modal: false,
title: "新增",
curId: 0,
detail: null,
showMenu: true,
dataList: []
dataList: [],
};
},
async fetch({ store, params }) {
......@@ -121,12 +122,14 @@ export default {
},
methods: {
clickItem(val) {
console.log(val);
this.nodeInfo.codeRuleId = val;
this.model8 = val;
this.loadTree(this.nodeInfo.codeRuleId);
this.cityList.forEach(e => {
this.cityList.forEach((e) => {
if (val == e.id) {
this.downName = e.name;
this.nodeInfo.codeRuleType = e.type;
}
});
this.model8 = val;
......@@ -135,9 +138,9 @@ export default {
let data = {
conditions: [],
sortBy: "id",
isDesc: false
isDesc: false,
};
Api.pagedSlecet(data).then(r => {
Api.pagedSlecet(data).then((r) => {
this.cityList = r.result.items;
this.downName = this.cityList[0].name;
this.model8 = this.cityList[0].id;
......@@ -203,7 +206,7 @@ export default {
title: "删除",
content: "<p>您确定要删除吗?</p>",
onOk: () => {
Api.delete(this.nodeInfo.id).then(r => {
Api.delete(this.nodeInfo.id).then((r) => {
if (r.success) {
this.loadTree(this.nodeInfo.codeRuleId);
this.$Message.success("删除成功");
......@@ -212,7 +215,7 @@ export default {
},
onCancel: () => {
this.$Message.success("取消删除");
}
},
});
}
},
......@@ -229,14 +232,14 @@ export default {
this.handleSelect(data); //手动选择树节点
},
//右键点击事件
contextmenu: e => {
contextmenu: (e) => {
e.preventDefault();
this.$refs.contentMenu.$refs.reference = event.target;
this.$refs.contentMenu.currentVisible = !this.$refs.contentMenu
.currentVisible;
this.nodeInfo = data;
}
}
},
},
},
data.title +
"(" +
......@@ -275,16 +278,21 @@ export default {
loadTree(id) {
let data = {
conditions: [
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" }
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" },
{
fieldName: "codeRuleType",
fieldValue: this.nodeInfo.codeRuleType,
conditionalType: "Equal",
},
],
sortBy: "code",
isDesc: false
isDesc: false,
};
Api.list(data).then(r => {
Api.list(data).then((r) => {
var data = this.$u.toTree(
r.result,
0,
u => {
(u) => {
u.title = u.code + u.name;
u.value = u.id;
u.expand = true;
......@@ -309,7 +317,7 @@ export default {
if (b.children) {
addId(b.children);
function addId(data) {
data.map(u => {
data.map((u) => {
ids.push(u.id);
if (u.children) {
addId(u.children);
......@@ -323,7 +331,7 @@ export default {
},
hide() {
this.showMenu = false;
}
},
},
computed: {
data() {
......@@ -332,7 +340,7 @@ export default {
let result = [];
search(this.keys, items);
function search(keys, data) {
data.map(u => {
data.map((u) => {
if (keys.length < u.title) {
u.expand = expand;
result.push(u);
......@@ -347,8 +355,8 @@ export default {
});
}
return result;
}
}
},
},
};
</script>
<style lang="less" >
......
......@@ -52,7 +52,8 @@ export default {
upId: this.nodeInfo.id,
code: 0,
status: 0,
codeRuleId:this.nodeInfo.codeRuleId
codeRuleId:this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
},
upName: this.nodeInfo.title,
disabled: false,
......
......@@ -51,13 +51,14 @@ export default {
entity: {
upId: 0,
code: 0,
codeRuleId:this.nodeInfo.codeRuleId
codeRuleId: this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
},
upName: this.nodeInfo.title,
disabled: false,
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
name: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: ["nodeInfo"],
......@@ -69,25 +70,25 @@ export default {
},
methods: {
get() {
Api.get({ id: this.nodeInfo.id }).then(r => {
Api.get({ id: this.nodeInfo.id }).then((r) => {
if (r.result) {
this.entity = r.result;
}
});
},
handleSubmit() {
this.$refs.form.validate(v => {
this.$refs.form.validate((v) => {
if (v) {
Api.update({ categoryDto: this.entity, pro: [] })
.then(r => {
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok",this.entity);
this.$emit("on-ok", this.entity);
} else {
this.$Message.error(r.error.message);
}
})
.catch(err => {
.catch((err) => {
this.disabled = false;
this.$Message.error(r.error.message);
});
......@@ -96,7 +97,7 @@ export default {
},
handleClose() {
this.$emit("on-close");
}
}
},
},
};
</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