|
@@ -122,6 +122,7 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
+ console.log(this.checkId, "checkid");
|
|
|
this.menuOptions[0].children.push(...this.tableData);
|
|
|
if (this.title === "编辑" && this.activeName === "2") {
|
|
|
this.menuForm = {
|
|
@@ -133,29 +134,67 @@ export default {
|
|
|
permissionShow: this.row.permissionShow,
|
|
|
};
|
|
|
} else if (this.title === "新增" && this.activeName === "2") {
|
|
|
- this.menuForm.parentId = this.row.permissionId;
|
|
|
+ this.menuForm.parentId = this.checkId;
|
|
|
+ } else {
|
|
|
+ this.menuForm.parentId = 0;
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- checkId(newVale, oldVal) {
|
|
|
- if (newVale) {
|
|
|
- console.log(newVale, "newVale");
|
|
|
- if (this.title === "编辑" && this.activeName === "2") {
|
|
|
- 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,
|
|
|
- };
|
|
|
- } else if (this.title === "新增" && this.activeName === "2") {
|
|
|
- this.menuForm.parentId = this.row.permissionId;
|
|
|
+ row: {
|
|
|
+ handler(newVal) {
|
|
|
+ if (newVal) {
|
|
|
+ console.log(newVal, "newRowValue");
|
|
|
+ if (this.title === "编辑" && this.activeName === "2") {
|
|
|
+ this.menuForm = {
|
|
|
+ parentId: newVal.parentId,
|
|
|
+ pname: newVal.permissionName,
|
|
|
+ purl: newVal.permissionUrl,
|
|
|
+ pstat: newVal.permissionState,
|
|
|
+ pcode: newVal.permissionCode,
|
|
|
+ permissionShow: newVal.permissionShow,
|
|
|
+ };
|
|
|
+ } else if (this.title === "新增" && this.activeName === "2") {
|
|
|
+ this.menuForm.parentId = this.checkId;
|
|
|
+ } else {
|
|
|
+ this.menuForm.parentId = 0;
|
|
|
+ }
|
|
|
}
|
|
|
+ },
|
|
|
+ immediate: true,
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ checkId(newVal) {
|
|
|
+ if (newVal !== null && newVal !== undefined) {
|
|
|
+ console.log(newVal, "checkId");
|
|
|
+ this.menuForm.parentId = newVal;
|
|
|
}
|
|
|
},
|
|
|
+ tableData: {
|
|
|
+ handler(newData) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ console.log("gengxin");
|
|
|
+ this.setExpandAll(this.defaultExpandAll);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ immediate: true,
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
},
|
|
|
+
|
|
|
methods: {
|
|
|
+ setExpandAll(expand) {
|
|
|
+ const table = this.$refs.table;
|
|
|
+ if (table) {
|
|
|
+ this.tableData.forEach((row) => {
|
|
|
+ table.toggleRowExpansion(row, expand);
|
|
|
+ if (row.children) {
|
|
|
+ row.children.forEach((child) => {
|
|
|
+ table.toggleRowExpansion(child, expand);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
/** 转换菜单数据结构 */
|
|
|
normalizer(node) {
|
|
|
if (node.children && !node.children.length) {
|
|
@@ -221,6 +260,14 @@ export default {
|
|
|
},
|
|
|
cancel() {
|
|
|
this.$refs["addUserForm"].resetFields();
|
|
|
+ this.menuForm = {
|
|
|
+ parentId: null,
|
|
|
+ pname: null,
|
|
|
+ purl: null,
|
|
|
+ pstat: null,
|
|
|
+ pcode: null,
|
|
|
+ permissionShow: null,
|
|
|
+ };
|
|
|
},
|
|
|
},
|
|
|
};
|