|
@@ -124,7 +124,7 @@ export default {
|
|
|
created() {
|
|
|
console.log(this.checkId, "checkid");
|
|
|
this.menuOptions[0].children.push(...this.tableData);
|
|
|
- if (this.title === "编辑" && this.activeName === "2") {
|
|
|
+ if (this.row && this.title === "编辑" && this.activeName === "2") {
|
|
|
this.menuForm = {
|
|
|
parentId: this.row.parentId,
|
|
|
pname: this.row.permissionName,
|
|
@@ -167,13 +167,31 @@ export default {
|
|
|
if (newVal !== null && newVal !== undefined) {
|
|
|
console.log(newVal, "checkId");
|
|
|
this.menuForm.parentId = newVal;
|
|
|
+ if (
|
|
|
+ this.menuForm.pname === null &&
|
|
|
+ this.row &&
|
|
|
+ this.title === "编辑" &&
|
|
|
+ this.activeName === "2"
|
|
|
+ ) {
|
|
|
+ console.log(this.props, " this.row");
|
|
|
+ this.menuForm = {
|
|
|
+ parentId: this.row.parentId,
|
|
|
+ pname: this.row.permissionName,
|
|
|
+ purl: this.row.permissionUrl,
|
|
|
+ pstat: this.row.permissionState,
|
|
|
+ pcode: this.row.permissionCode,
|
|
|
+ permissionShow: this.row.permissionShow,
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
tableData: {
|
|
|
handler(newData) {
|
|
|
this.$nextTick(() => {
|
|
|
- console.log("gengxin");
|
|
|
- this.setExpandAll(this.defaultExpandAll);
|
|
|
+ console.log("gengxin", this.setExpandAll(newData));
|
|
|
+ this.setExpandAll(newData);
|
|
|
+ this.menuOptions[0].children = [];
|
|
|
+ this.menuOptions[0].children.push(...this.tableData);
|
|
|
});
|
|
|
},
|
|
|
immediate: true,
|
|
@@ -193,9 +211,9 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
+ console.log(this.tableData, "新值");
|
|
|
}
|
|
|
},
|
|
|
- /** 转换菜单数据结构 */
|
|
|
normalizer(node) {
|
|
|
if (node.children && !node.children.length) {
|
|
|
delete node.children;
|
|
@@ -210,7 +228,7 @@ export default {
|
|
|
const that = this;
|
|
|
this.$refs["addUserForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- if (this.title === "编辑") {
|
|
|
+ if (this.title === "编辑" && this.row) {
|
|
|
updateMenuFn({
|
|
|
...this.menuForm,
|
|
|
permissionId: this.row.permissionId,
|
|
@@ -230,11 +248,12 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
} else if (this.title === "新增") {
|
|
|
+ console.log("新增", this.activeName);
|
|
|
addMenuFn({
|
|
|
...this.menuForm,
|
|
|
purl:
|
|
|
this.menuForm.purl !== null ? this.menuForm.purl : undefined,
|
|
|
- ptype: "1",
|
|
|
+ ptype: this.activeName,
|
|
|
parentId:
|
|
|
this.activeName === "1" ? undefined : this.menuForm.parentId,
|
|
|
})
|