优化动态表单逻辑

dev
smallchill 6 years ago
parent 4cfafd538f
commit 4c1228bdd4
  1. 5
      src/views/authority/datascope.vue

@ -107,6 +107,7 @@
scopeMenuName: "菜单", scopeMenuName: "菜单",
scopeLoading: false, scopeLoading: false,
menu: true, menu: true,
watchMode: true,
option: { option: {
tip: false, tip: false,
dialogWidth: "60%", dialogWidth: "60%",
@ -429,6 +430,7 @@
}, },
methods: { methods: {
initScope() { initScope() {
if (this.watchMode) {
const scopeType = this.formScope.scopeType; const scopeType = this.formScope.scopeType;
let column = "-", name = "暂无"; let column = "-", name = "暂无";
if (scopeType === "1") { if (scopeType === "1") {
@ -461,6 +463,7 @@
item.display = scopeType === '5'; item.display = scopeType === '5';
} }
}); });
}
}, },
// //
rowSave(row, loading, done) { rowSave(row, loading, done) {
@ -655,9 +658,11 @@
}, },
beforeOpenScope(done, type) { beforeOpenScope(done, type) {
if (["add"].includes(type)) { if (["add"].includes(type)) {
this.watchMode = true;
this.initScope(); this.initScope();
} }
if (["edit", "view"].includes(type)) { if (["edit", "view"].includes(type)) {
this.watchMode = false;
getMenuDataScope(this.formScope.id).then(res => { getMenuDataScope(this.formScope.id).then(res => {
this.formScope = res.data.data; this.formScope = res.data.data;
}); });

Loading…
Cancel
Save