jiaxing.zhou

refactor(roleConfig): 调整角色配置对话框逻辑

- 将 watch 代码块的位置进行调整,移到 methods 前面
- 优化了 outerVisible监听器中的逻辑,根据不同类型初始化 formData
...@@ -94,6 +94,14 @@ export default { ...@@ -94,6 +94,14 @@ export default {
94 watch: { 94 watch: {
95 outerVisible(val) { 95 outerVisible(val) {
96 if (val) { 96 if (val) {
97 + this.loadings.dialogLoading = false;
98 + if (this.type == "update") {
99 + this.formData = this.active;
100 + } else if (this.type == "menuChange") {
101 + this.formData = this.active;
102 + this.searchTreeData();
103 + this.loadCheckedKeys();//加载已绑定的菜单
104 + }
97 } 105 }
98 }, 106 },
99 }, 107 },
...@@ -128,20 +136,6 @@ export default { ...@@ -128,20 +136,6 @@ export default {
128 loadingText: "", 136 loadingText: "",
129 }; 137 };
130 }, 138 },
131 - watch: {
132 - outerVisible(val) {
133 - if (val) {
134 - this.loadings.dialogLoading = false;
135 - if (this.type == "update") {
136 - this.formData = this.active;
137 - } else if (this.type == "menuChange") {
138 - this.formData = this.active;
139 - this.searchTreeData();
140 - this.loadCheckedKeys();//加载已绑定的菜单
141 - }
142 - }
143 - },
144 - },
145 methods: { 139 methods: {
146 //查询菜单数据 140 //查询菜单数据
147 searchTreeData() { 141 searchTreeData() {
......