import {selectDialogMixins} from "@base/mixins/selectDialog";

let modules = {};
modules = {
  name: 'tableModelDialog',
  props: ['visiable', 'multi', 'rows', 'param'],
  mixins: [selectDialogMixins],
  components: {},
  created() {
    this.initSetting();
  },
  mounted() {
    this.initTableM1();
  },
  data() {
    return {
      showDialog: true,
      falseValue: false,
      selectMulti: true,
      formData: {},
      vxeOption: {},
      showSaleOrgDialog: false
    };
  },
  methods: {
    initTableM1() {
      let that = this;
      let tableOption = {
        vue: that,
        tableRef: 'table-m1',
        tableName: 'bd_table_model_dialog-m1',
        path: USER_PREFIX + '/szTaMb/listPage',
        param: () => {
          return {
            enabled: true,
            ...this.formData,
            ...this.param
          };
        },
        columns: [
          {type: 'checkbox', width: 48, resizable: false, fixed: 'left'},
          {title: this.$t1('实体名称'), field: 'taEn', width: 150, fixed: 'left'},
          {title: this.$t1('数据库表名'), field: 'taBm', width: 150},
          {title: this.$t1('表描述'), field: 'taCh', width: 150},
          {
            title: this.$t1('表类型'), field: 'taType', width: 150, slots: {
              default: ({row}) => {
                return row.taType === 0 ? this.$t1('主表') : this.$t1('明细表')
              }
            }
          },
          {title: this.$t1('表编码'), field: 'taCode', width: 150},
          {field: 'serviceName', title: this.$t1('服务名'), width: 150},
          {
            width: 47,
            fixed: 'right',
            title: '',
            sortable: false
          }
        ],
        config: {
          checkboxConfig: {
            checkStrictly: true,
            showHeader: this.selectMulti,
            trigger: 'row'
          }
        }
      };
      this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
        that.vxeOption = opts;
      });
    },
  }
};
export default modules
