import langTagDialog from "@base/views/user/lang_tag/dialog.vue";

let modules = {};
modules = {
  name: "langTagAddButton",
  props: {
    option: {
      type: Object,
      default: () => {
      }
    }
  },
  components: {langTagDialog},
  data() {
    return {
      showLangTagDialog: false
    }
  },
  methods: {
    openLangTagDialog() {
      let rows = this.option.tableDatas();
      if (!rows.length) {
        this.$baseAlert(this.$t1('请选择需要设置标签的数据'));
        return;
      }
      this.showLangTagDialog = true;
    },
    confirmLangTagDialog(rows) {
      if (!rows.length) return
      let checkRows = this.option.tableDatas();
      let reqData = this.option.reqData(rows, checkRows)
      this.$http({
        url: this.option.url,
        method: `post`,
        data: reqData,
        isLoading: true,
        success: res => {
          this.$message({
            message: res.content,
            type: 'success',
            duration: 500,
            onClose: t => {
              this.option.callback && this.option.callback()
            }
          });
        }
      });
    },
  },
}
export default modules
