sys-role-edit-view.vue 1.7 KB
Newer Older
1
<script lang='tsx'>
2 3
import { Component } from "vue-property-decorator";
import SysRoleEditViewBase from "./sys-role-edit-view-base.vue";
4

5
import view_form from "@widgets/sys-role/main-form/main-form.vue";
6
@Component({
7 8 9 10 11 12 13 14 15 16 17 18 19 20
  components: {
    view_form,
  },
  beforeRouteEnter: (to: any, from: any, next: any) => {
    next((vm: any) => {
      if (!Object.is(vm.navModel, "route")) {
        vm.initNavDataWithTab(vm.viewCacheData);
      }
      vm.$store.commit("addCurPageViewtag", {
        fullPath: to.fullPath,
        viewtag: vm.viewtag,
      });
    });
  },
21 22
})
export default class SysRoleEditView extends SysRoleEditViewBase {
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
  /**
   * 保存
   *
   * @param {any[]} args 当前数据
   * @param {any} contextJO 行为附加上下文
   * @param {*} [params] 附加参数
   * @param {*} [$event] 事件源
   * @param {*} [xData]  执行行为所需当前部件
   * @param {*} [actionContext]  执行行为上下文
   * @memberof SysRoleEditViewBase
   */
  public Save(
    args: any[],
    contextJO?: any,
    params?: any,
    $event?: any,
    xData?: any,
    actionContext?: any,
    srfParentDeName?: string
  ) {
    // 界面行为容器对象 _this
    const _this: any = this;
    if (xData && xData.save instanceof Function) {
      // 禁用保存按钮
      _this.toolBarModels.tbitem3.disabled = true;
      xData.save().then((response: any) => {
        // 启用保存按钮
        _this.toolBarModels.tbitem3.disabled = false;
        if (!response || response.status !== 200) {
          return;
        }
        _this.$emit("viewdataschange", [{ ...response.data }]);
      });
    } else if (_this.save && _this.save instanceof Function) {
      _this.save();
    }
  }
60 61
}
</script>