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",
          });
      }
  }
  },
};