index.js 1.07 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
import commonFunctions from '~/mixin/commonFunctions.js';

export default {
  mixins: [commonFunctions],
  methods: {
    async handleSave() {
      let result = await this.save();
      if (result.respCode == SUCCESS && Object.keys(result.fieldErrors).length == 0) {
          this.$notify({
              title: "成功",
              message: "保存成功",
              type: "success",
          });
          this.$store.dispatch("TagsView/delView", this.$route)
          this.$router.go(-1)
      } else if (result.fieldErrors && Object.keys(result.fieldErrors).length > 0) {
          const tab = this.showBackendErrors(result.fieldErrors)
          if (tab) {
              // tab切换之后,需出发tab-click的事件
              this.tabClick(tab);
          }
          this.$notify({
              title: "错误",
              message: "检核失败!",
              type: "error",
          });
      } else {
          this.$notify({
              title: "失败",
              message: "保存失败",
              type: "error",
          });
      }
  }
  },
};