<template>
  <!--
        @slot 顶部
    -->
  <slot name="top"></slot>
  <hot-table ref="table" :settings="hotSetting"></hot-table>
  <!-- DialogSelect 弹窗仍用 modal-table + view-table（行内「选择」列插槽）；modal-table-excel 供全站按需使用 -->
  <modal-table ref="dialogTable">
    <template #command="{ row }">
      <Button size="small" title="选择" type="primary" custom-icon="fa fa-check" @click="dialogCheck(row)"></Button>
    </template>
  </modal-table>
  <div class="ivu-mt ivu-text-right">
    <Button
      class="ivu-fr ivu-ml-8"
      type="error"
      :title="$t('Front_Btn_Setting')"
      custom-icon="fa fa-cog"
      v-if="settingEnable && allow('permission/tableView')"
      @click="tableSettingOpen"
    ></Button>
  </div>
  <table-setting ref="tableSetting" v-if="tableSettingActive" :is-setting="true" @on-change="viewCode => init(viewCode)" />
</template>
<script>
  import { mapActions } from 'vuex';
  import dateFormat from 'date-fns/format';

  import Handsontable from 'handsontable';
  import { HotTable } from '@handsontable/vue3';
  import { ContextMenu } from 'handsontable/plugins/contextMenu';
  import { registerAllModules } from 'handsontable/registry';
  import 'handsontable/styles/handsontable.min.css';
  import 'handsontable/styles/ht-theme-main.min.css';

  import modelApi from '../../api/model';
  import customModelApi from '../../api/customModel';
  import mixinPage from '../../mixins/page';
  import mixin from './mixin';
  import tableSetting from './table-setting.vue';

  // register Handsontable's modules
  registerAllModules();

  /**
   * @displayName view-table 表格视图
   */
  export default {
    mixins: [mixin, mixinPage],
    components: { HotTable, tableSetting },
    emits: ['after-init', 'on-change', 'on-load-data'],
    data() {
      return {
        inited: false,
        tableView: {},
        hotSetting: {
          themeName: 'ht-theme-main',
          colHeaders: true,
          height: 'auto',
          // columns: [],
          // 固定行高，避免含换行文本时横向滚动触发自动重算导致表格整体高度变化
          autoRowSize: false,
          autoWrapCol: true,
          autoWrapRow: true,
          manualColumnResize: true,
          readOnly: this.readonly,
          // columnSummary: [
          //   {
          //     sourceColumn: 2,
          //     type: 'sum',
          //     destinationRow: 3,
          //     destinationColumn: 2
          //   }
          // ],
          // minSpareRows: 1,
          contextMenu: this.readonly ? false : { items: {} },
          licenseKey: 'non-commercial-and-evaluation'
        },
        coords: {},
        staticData: [],
        setting: false,
        tableSettingActive: false,
        isMaxHight: false
      };
    },
    async created() {
      // 默认视图代码
      if (this.viewCode) {
        // 初始化
        setTimeout(async () => {
          await this.init(this.viewCode);

          /**
           * 初始化完成事件
           */
          this.$emit('after-init');

          if (this.autoLoad && !this.tableView.autoLoadDisable) {
            this.loadData();
          }
        });
      }
    },
    mounted() {
      this.$refs.table.hotInstance.addHook('beforeOnCellMouseUp', (event, coords) => {
        this.coords = coords;
        if (event.detail === 2 && coords.row >= 0 && !this.readonly) {
          let isReadonly = this.$refs.table.hotInstance.getCellMeta(coords.row, coords.col).readOnly;
          if (!isReadonly) {
            // 双击弹出窗口
            let column = this.hotSetting.columns[coords.col];
            //let data = this.$refs.table.hotInstance.getSourceData();

            if (column.controlType === 'DialogSelect' && !column.readonly) {
              this.$refs.dialogTable.init(column.source, () => {
                this.$refs.dialogTable.open(this.getParam(this.staticData[coords.row], column, this.parentData));
                this.$refs.dialogTable.resetFilter();
              });
            }
          }
        }
      });
    },
    props: {
      /**
       * 视图代码
       */
      viewCode: {
        type: String
      },
      /**
       * 只读
       */
      readonly: {
        type: Boolean,
        default: false
      },
      /**
       * 内嵌表格的父对象
       */
      parentData: {
        type: Object,
        default() {
          return {};
        }
      },
      /**
       * 是否允许配置界面
       */
      settingEnable: {
        type: Boolean,
        default: true
      },
      /**
       * 自动加载
       */
      autoLoad: {
        type: Boolean,
        default: true
      },
      /**
       * 高度
       */
      height: {
        type: Number,
        default: null
      }
    },
    computed: {
      data() {
        return this.staticData;
      }
    },
    watch: {
      // value() {
      //     if (this.embedded) {
      //         this.loadData(this.value);
      //     }
      //     //this.changed = false;
      // }
      // staticData() {
      //     // 设置选中项
      //     if (typeof this.selectFunc === 'function') {
      //         let selected = this.staticData.filter(this.selectFunc);
      //         this.setSelected(selected);
      //     }
      // }
    },
    methods: {
      ...mapActions('admin/dataView', { loadDataView: 'load' }),
      /**
       * 初始化
       *
       * @param {string} viewCode 视图代码
       * @param {function} callback 完成后回调方法
       * @param {function} onFail 失败后回调方法
       * @public
       */
      async init(viewCode, callback, onFail) {
        // 加载表格视图
        let view = await this.loadDataView(viewCode);

        if (view && !view.isExist && viewCode.indexOf('_') >= 0) {
          view = await this.loadDataView(viewCode.split('_')[0]);
        }

        if (view == null) {
          return;
        } else if (!view.isExist) {
          if (typeof onFail === 'function') {
            onFail();
          } else {
            this.error('Front_Msg_View_Code_Not_Exist|' + viewCode);
          }
          return;
        }

        this.tableView = view.dataView;
        this.tableView.columns = view.viewColumns;

        // 序号
        this.hotSetting.rowHeaders = this.tableView.snEnable;

        // 文本必填
        Handsontable.validators.registerValidator('text-required', (value, callback) => {
          if (!(value || '').trim()) {
            callback(false);
          } else {
            callback(true);
          }
        });

        // 数字必填
        Handsontable.validators.registerValidator('numeric-required', (value, callback) => {
          if (value === null || value === void 0) {
            callback(false);
          } else {
            Handsontable.validators.NumericValidator(value, callback);
          }
        });

        // 日期必填
        Handsontable.validators.registerValidator('date-required', (value, callback) => {
          if (!(value || '').trim()) {
            callback(false);
          } else {
            Handsontable.validators.DateValidator.apply({ instance: this.$refs.table.hotInstance }, [value, callback]);
          }
        });

        // 选择必填
        Handsontable.validators.registerValidator('select-required', (value, callback) => {
          if (!(value || '').trim()) {
            callback(false);
          } else {
            Handsontable.validators.AutocompleteValidator(value, callback);
          }
        });

        // 初始化数据源
        // this.initDataSource();

        this.columns = await Promise.all(
          view.viewColumns.map(async item => {
            let column = {
              ...item,
              title: item.isRequired ? '<font style="color: red">*</font>' + item.name : item.name,
              data: item.code,
              width: item.controlWidth || 80,
              className: item.align ? 'ht' + item.align : 'htCenter',
              controlType: item.controlType
            };

            if (!this.readonly) {
              if (item.controlType === 'Label' || item.isReadonly == true) {
                column.readOnly = true;
              } else {
                column.validator = this.getValidator(column);

                if (item.controlType === 'TextInput') {
                  column.type = 'text';
                } else if (item.controlType === 'NumberInput') {
                  column.type = 'numeric';
                } else if (item.controlType === 'Check') {
                  column.type = 'checkbox';
                } else if (item.controlType === 'Select' || item.controlType == 'ComboSelect') {
                  let dataSource = [];

                  if (column.isStaticItem) {
                    if (!!(column.itemData || '').trim()) {
                      column.itemData.split(/[\n]/).forEach(item => {
                        if (!!(item || '').trim()) {
                          if (item.split(':').length > 1) {
                            let key = item.split(':')[0];
                            let value = item.split(':')[1];

                            if (column.dataType == 'Integer' || column.dataType == 'BigInteger') {
                              dataSource.push({
                                id: parseInt(key),
                                name: value
                              });
                            } else if (column.dataType == 'Decimal' || column.dataType == 'Float' || column.dataType == 'Double') {
                              dataSource.push({
                                id: parseFloat(key),
                                name: value
                              });
                            } else if (column.dataType == 'Boolean') {
                              dataSource.push({
                                id: key.toUpperCase() == 'TRUE',
                                name: value
                              });
                            } else {
                              dataSource.push({
                                id: key,
                                name: value
                              });
                            }
                          } else {
                            if (column.dataType == 'Integer' || column.dataType == 'BigInteger') {
                              dataSource.push({
                                id: parseInt(item),
                                name: item
                              });
                            } else if (column.dataType == 'Decimal' || column.dataType == 'Float' || column.dataType == 'Double') {
                              dataSource.push({
                                id: parseFloat(item),
                                name: item
                              });
                            } else if (column.dataType == 'Boolean') {
                              dataSource.push({
                                id: item.toUpperCase() == 'TRUE',
                                name: item
                              });
                            } else {
                              dataSource.push({
                                id: item,
                                name: item
                              });
                            }
                          }
                        }
                      });
                    }
                  } else {
                    if (column.dataType.startsWith('Enum:')) {
                      // 枚举
                      dataSource = this.getEnumList(column.dataType.split(':')[1]);
                    } else if (!!(column.source || '').trim()) {
                      let param = this.getParam(null, column, this.parentData);

                      // 选择框、单选框组
                      this.disableLoader();
                      let res;
                      if (column.isSourceCustom) {
                        res = await customModelApi.query(column.source, param); //, [column.sourceDataCode, column.sourceDisplayCode]);
                      } else {
                        res = await modelApi.query(column.source, param); //, [column.sourceDataCode, column.sourceDisplayCode]);
                      }
                      this.enableLoader();

                      dataSource = res.data.map(item => {
                        return {
                          id: !(column.sourceDataCode || '').trim() ? item.id : this.parseData(item, column.sourceDataCode),
                          name: this.parseData(item, column.sourceDisplayCode)
                        };
                      });
                    }
                  }

                  if (item.controlType == 'Select') {
                    column.editor = 'select';
                    column.selectOptions = dataSource.map(option => {
                      return option.id;
                    });
                  } else if (item.controlType == 'ComboSelect') {
                    column.type = 'autocomplete';
                    column.dropdownMenu = true;
                    column.strict = true;
                    column.source = (query, process) => {
                      let searchResult = [];
                      if (query) {
                        const lowerQuery = query.toLowerCase();
                        searchResult = dataSource.filter(data => {
                          return data.name.toLowerCase().includes(lowerQuery);
                        });
                      } else {
                        searchResult = [...dataSource];
                      }
                      const showNames = searchResult.map(item => item.name);
                      process(showNames);
                    };
                  }
                } else if (item.controlType === 'Date') {
                  column.type = 'date';
                  column.dateFormat = 'YYYY-MM-DD';
                  column.correctFormat = true;
                  // column.renderer = function (instance, td, row, col, prop, value, cellProperties) {
                  //   if (value) {
                  //     td.innerHTML = dateFormat(new Date(value), 'yyyy-MM-dd');
                  //     console.log(instance);
                  //     console.log(td);
                  //     console.log(row);
                  //     console.log(col);
                  //     console.log(prop);
                  //     console.log(value);
                  //     console.log(cellProperties);
                  //   }
                  //   return td;
                  // };
                }
              }
            }

            return column;
          })
        );

        this.columns = this.columns
          .filter(item => {
            return item.isFixed == true;
          })
          .concat(
            this.columns.filter(item => {
              return item.isFixed != true;
            })
          );

        // .filter(item => {
        //   return !(item.parentCode || '').trim();
        // })
        // .map(item => {
        //   return getColumns(view, item, this.static);
        // });

        this.hotSetting.columns = this.columns.filter(item => {
          return (
            !!(item.parentCode || '').trim() ||
            this.columns.filter(i => {
              return i.parentCode == item.code;
            }).length == 0
          );
        });

        // 冻结列
        this.hotSetting.fixedColumnsStart = this.columns.filter(item => {
          return item.isFixed == true;
        }).length;

        // 多级表头
        if (
          this.columns.filter(item => {
            return !!(item.parentCode || '').trim();
          }).length > 0
        ) {
          let lv1 = this.columns
            .filter(item => {
              return !(item.parentCode || '').trim();
            })
            .map(item => {
              return {
                label: item.title,
                colspan:
                  this.columns.filter(i => {
                    return i.parentCode == item.code;
                  }).length == 0
                    ? 1
                    : this.columns.filter(i => {
                        return i.parentCode == item.code;
                      }).length
              };
            });

          let lv2 = this.columns
            .filter(item => {
              return (
                !!(item.parentCode || '').trim() ||
                this.columns.filter(i => {
                  return i.parentCode == item.code;
                }).length == 0
              );
            })
            .map(item => {
              return {
                label: !!(item.parentCode || '').trim() ? item.title : ''
              };
            });

          this.hotSetting.nestedHeaders = [lv1, lv2];
        }

        // this.columns.unshift({
        //   tree: true,
        //   display: 'inline',
        //   align: 'left',
        //   width: 100
        // });

        // if (this.tableView.snEnable) {
        //   this.columns.unshift({
        //     title: this.$t('Front_Label_Sn'),
        //     slot: 'sn',
        //     align: 'center',
        //     width: 60
        //   });
        // }

        if (!this.readonly) {
          // 右键菜单 新增
          if (this.tableView.createEnable) {
            this.hotSetting.contextMenu.items.row_above = { name: '上方插入行' };
            this.hotSetting.contextMenu.items.row_below = { name: '下方插入行' };
            this.hotSetting.contextMenu.items.separator1 = ContextMenu.SEPARATOR;
          }

          // 右键菜单 调整
          if (this.tableView.adjustEnable) {
            this.hotSetting.contextMenu.items.move_up = {
              name: '整行上移',
              callback: (key, selection, clickEvent) => {
                let rows = [];

                for (let item of selection) {
                  for (let i = item.start.row; i <= item.end.row; i++) {
                    rows.push(i);
                  }
                }

                rows.sort(function (a, b) {
                  return a - b; // 升序排列
                });

                rows = [...new Set(rows)]; // 去重

                if (rows[rows.length - 1] - rows[0] != rows.length - 1) {
                  this.error('只能选中连续的行执行此操作！');
                  return;
                }

                let index = rows[0];

                if (index > 0) {
                  let moveRows = this.staticData.splice(index, rows.length);
                  this.staticData.splice(index - 1, 0, ...moveRows);
                  this.$refs.table.hotInstance.updateData(this.staticData);
                }
              }
            };
            this.hotSetting.contextMenu.items.move_down = {
              name: '整行下移',
              callback: (key, selection, clickEvent) => {
                let rows = [];

                for (let item of selection) {
                  for (let i = item.start.row; i <= item.end.row; i++) {
                    rows.push(i);
                  }
                }

                rows.sort(function (a, b) {
                  return a - b; // 升序排列
                });

                rows = [...new Set(rows)]; // 去重

                if (rows[rows.length - 1] - rows[0] != rows.length - 1) {
                  this.error('只能选中连续的行执行此操作！');
                  return;
                }

                let index = rows[0];

                if (rows[rows.length - 1] < this.staticData.length - 1) {
                  let moveRows = this.staticData.splice(index, rows.length);
                  this.staticData.splice(index + 1, 0, ...moveRows);
                  this.$refs.table.hotInstance.updateData(this.staticData);
                }
              }
            };
          }

          // 右键菜单 删除
          if (this.tableView.removeEnable) {
            this.hotSetting.contextMenu.items.remove_row = {
              name: '整行删除',
              callback: (key, selection, clickEvent) => {
                this.confirm('确定要删除这些行吗？', async () => {
                  let rows = [];

                  for (let item of selection) {
                    for (let i = item.start.row; i <= item.end.row; i++) {
                      rows.push(i);
                    }
                  }

                  rows.sort(function (a, b) {
                    return b - a; // 降序排列
                  });

                  rows = [...new Set(rows)]; // 去重

                  for (let i of rows) {
                    this.staticData.splice(i, 1);
                  }

                  this.$refs.table.hotInstance.updateData(this.staticData);
                });
              }
            };
          }
        }

        // 变更事件
        this.$refs.table.hotInstance.addHook('afterChange', changes => {
          if (changes) {
            changes.forEach(([row, property, oldValue, newValue]) => {
              if (!this.readonly && this.tableView.createEnable && row == this.staticData.length - 1 && (oldValue ?? '') != (newValue ?? '')) {
                this.staticData.push(this.getDefaultData());
              }

              let column = this.columns.find(item => item.code == property);

              if (column.controlType != 'DialogSelect') {
                // 弹出框控件不触发数据变更事件，此处手动触发
                this.onDataChange(this.staticData[row], column);
              }

              if (column.controlType == 'Select') {
                // 校验下拉框选项是否在列表中
                if (!column.selectOptions.some(item => item == newValue)) {
                  this.staticData[row][column.code] = null;
                }
              }

              this.calc(this.staticData[row]);
            });
            this.$refs.table.hotInstance.updateData(this.staticData);
            this.setShowStatus();
          }
        });

        // 粘贴事件
        this.$refs.table.hotInstance.addHook('beforePaste', (data, coords) => {
          // 不含父级表头
          let columns = this.columns.filter(item => {
            return (
              !!(item.parentCode || '').trim() ||
              this.columns.filter(i => {
                return i.parentCode == item.code;
              }).length == 0
            );
          });

          for (let col = coords[0].startCol; col < coords[0].startCol + data[0].length; col++) {
            for (let row = coords[0].startRow; row < coords[0].startRow + data.length; row++) {
              if (data[row - coords[0].startRow][col - coords[0].startCol] != null) {
                // 去除前后空格
                data[row - coords[0].startRow][col - coords[0].startCol] = data[row - coords[0].startRow][col - coords[0].startCol].trim();

                if (columns[col].controlType == 'NumberInput') {
                  // 数字类型，去掉逗号
                  data[row - coords[0].startRow][col - coords[0].startCol] = data[row - coords[0].startRow][col - coords[0].startCol].replace(/,/g, '');
                  // this.$refs.table.hotInstance.updateData(this.data);
                }
              }
            }
          }

          // return data;
        });

        // 必须在 init 的 Promise 完成前同步清空并绑定表格，避免 setTimeout(loadData([])) 晚于
        // 「await init 后执行的 loadData(真实数据)」而把数据冲掉
        this.inited = true;
        await this.loadData([]);

        setTimeout(() => {
          if (typeof callback === 'function') {
            callback();
          }
        });
      },
      // 获取验证器
      getValidator(column) {
        if (column.controlType === 'TextInput' || column.controlType === 'Select' || column.controlType === 'DialogSelect') {
          if (column.isRequired) {
            return 'text-required';
          } else {
            return null;
          }
        } else if (column.controlType === 'NumberInput') {
          if (column.isRequired) {
            return 'numeric-required';
          } else {
            return 'numeric';
          }
        } else if (column.controlType === 'Date') {
          if (column.isRequired) {
            return 'date-required';
          } else {
            return 'date';
          }
        }
      },
      /**
       * 加载数据
       *
       * @param {array} staticData 静态数据
       * @public
       */
      async loadData(staticData) {
        if (!this.inited) {
          await this.init(this.viewCode);

          if (!this.inited) {
            return;
          }
        }

        if (staticData) {
          this.staticData = this.copy(staticData);

          this.staticData.forEach(item => {
            for (let key in item) {
              if (item[key] != null && this.columns.some(i => i.code === key && i.controlType === 'Date')) {
                item[key] = dateFormat(new Date(item[key]), 'yyyy-MM-dd');
              }
            }
          });
        }

        //this.data = this.staticData;

        if (!this.readonly && staticData && this.tableView.createEnable) {
          this.staticData.push(this.getDefaultData());
        }

        //this.hotSetting.data = this.data;

        // 设置数据的可见性和只读属性
        this.setShowStatus();

        // 加载数据源
        //this.initDataSource();

        // 重新计算公式
        for (let i = 0; i < this.staticData.length; i++) {
          this.calc(this.staticData[i]);
        }

        this.$refs.table.hotInstance.loadData(this.staticData);

        setTimeout(() => {
          this.$refs.table.hotInstance.render();
        });

        /**
         * 数据加载事件
         */
        this.$emit('on-load-data');

        /**
         * 数据变化事件
         * @property {object} data 行对象
         * @property {object} sender 触发的列对象
         * @property {object} selected 选中对象（弹出选择框等有效）
         */
        if (staticData) {
          this.$emit('on-change', null, null, null);
        }

        // 刷新表头控件
        // if (this.$refs.tableFilter) {
        //   //this.$refs.tableFilter.$forceUpdate();
        // }
      },
      /**
       * 刷新
       *
       * @public
       */
      refresh() {
        this.$refs.table.hotInstance.updateData(this.staticData);
      },
      /**
       * 验证
       *
       * @public
       */
      async validate() {
        let rows = [];

        for (let i = 0; i < this.staticData.length; i++) {
          rows.push(i);
        }

        if (!this.readonly && this.tableView.createEnable) {
          rows.pop();
        }

        return new Promise(resolve => {
          this.$refs.table.hotInstance.validateRows(rows, valid => {
            resolve(valid);
          });
        });
      },

      /**
       * 获取数据
       *
       * @public
       */
      getData() {
        let data = this.copy(this.staticData);

        if (!this.readonly && this.tableView.createEnable) {
          data.pop();
        }

        data.forEach(item => {
          for (let key in item) {
            if (key.startsWith('_')) {
              delete item[key];
            }
          }
        });

        // 调整顺序
        if (this.tableView.adjustEnable) {
          let i = 0;
          for (let item of data) {
            item.orderNo = i;
            i += 10;
          }
        }

        return data;
      },
      // 数据变化事件
      onDataChange(data, sender, selected) {
        //this.setShowStatus();

        //this.$forceUpdate();

        // 公式计算
        this.calc(data, sender);

        /**
         * 数据变化事件
         * @property {object} data 行对象
         * @property {object} sender 触发的列对象
         * @property {object} selected 选中对象（弹出选择框等有效）
         */
        this.$emit('on-change', data, sender, selected);
      },
      // 公式计算
      calc(data, sender) {
        for (let i = 0; i < this.columns.length; i++) {
          let column = this.columns[i];
          if (!!(column.calculate || '').trim()) {
            let triggers = this.getTriggers(column.calculate);
            if (!sender || triggers.some(item => item == sender.code)) {
              // 包含在公式中，需要刷新
              let result = this.calculate(column.calculate, data);

              // 保留小数
              if (column.digit != null) {
                result = this.keepDecimal(result, column.digit, column.fixedDigit);
              }

              this.setData(data, column.code, result);
            }
          }
        }
      },
      // 打开表格设置界面
      tableSettingOpen() {
        this.tableSettingActive = true;

        setTimeout(() => {
          this.$refs.tableSetting.open(this.tableView, this.copy(this.tableView.columns));
        });
      },
      // 行数据
      rowData(row, index) {
        return this.staticData[index];
      },
      // 设置可见性和只读
      setShowStatus() {
        this.$refs.table.hotInstance.updateSettings({
          cells: (row, col, prop) => {
            let column = this.columns.find(item => item.code == prop);

            if (column == null) {
              console.log('column not found!', row, col, prop);
              return;
            }

            let isShow = column.isShow;
            let isReadonly = column.isReadonly;

            // 判断是否只读
            if (column.controlType == 'Label' || this.readonly) {
              isReadonly = true;
            } else if (!!(column.readonlyJson || '').trim()) {
              let setting = JSON.parse(column.readonlyJson);

              if (setting.type == 'Condition' || setting.type == 'Expression') {
                isReadonly = this.judgeCondition(setting, this.staticData[row]);
              }
            } else {
              isReadonly = column.isReadonly;
            }

            // 判断是否显示
            if (!!(column.showJson || '').trim()) {
              let setting = JSON.parse(column.showJson);

              if (setting.type == 'Condition' || setting.type == 'Expression') {
                isShow = this.judgeCondition(setting, this.staticData[row]);
              }
            } else {
              isShow = column.isShow;
            }

            if (!isShow) {
              this.setData(this.staticData[row], prop, null);
            }

            return { readOnly: !isShow || isReadonly, validator: !isShow ? null : this.getValidator(column) };
          }
        });
      },
      // 获取多语言名称
      getNameI18n(column) {
        if (column) {
          if (this.layout.showI18n) {
            if (column.code) {
              let key = 'DataView_' + this.tableView.code + '_' + column.code;
              let text = this.$t(key);
              if (text == key) {
                return column.name;
              } else {
                return text;
              }
            }
          } else {
            return column.name;
          }
        }
      },
      // 清空数据
      clear() {
        this.staticData = [];
        //this.data = [];
      },
      // 弹出选择框选中

      dialogCheck(row) {
        let column = this.hotSetting.columns[this.coords.col];

        this.$refs.table.hotInstance.setDataAtRowProp([[this.coords.row, column.data, this.parseData(row, column.sourceDisplayCode)]]);
        this.$refs.dialogTable.close();

        this.onDataChange(this.staticData[this.coords.row], column, row);
        this.setShowStatus();
      }
    }
  };
</script>

<style>
  .htContextMenu {
    z-index: 9999 !important;
  }
</style>
