import { dictionaryMix, formConfigMix, mixTableConfig, mixTableConstants, pageInitMix, } from "@/comps/mixin/common-mixins";

const commonMagnifierMixin = {
  mixins: [ dictionaryMix, formConfigMix, mixTableConfig, mixTableConstants, pageInitMix ],
  data() {
    let { ...listeners } = this.$listeners;
    return {
      listeners: listeners,
    }
  },
  methods: {
    search: function () {
      this.$refs['commonMagnifierRef'].reload();
    },
    reload() {
      this.$refs['commonMagnifierRef'].reload();
    },
    zoomModal({ $modal, $event, type }) {
    },
    cellDblclick(row) {
      this.confirm(row);
    },
    show() {
      this.$emit('show');
    },
    confirm(row) {
      this.$emit('confirm', row);
    }
  },
  computed: {
    inputValue: {
      get() {
        return this.value
      },
      set(value) {
        this.$emit('input', value);
      }
    },
  },
  props: {
    placeholder: String,
    initConstantLoad: Function,
    showFooter: Boolean,
    value: [ String ],
    immediateLoad: {
      type: Boolean,
      default: () => {
        return true;
      }
    },
    initLoadTableData: {
      type: Boolean,
      default: () => {
        return true;
      }
    },
    height: [ String ],
    formModel: {
      type: Object,
      default: () => {
        return {}
      }
    },
    columnConfig: {
      type: Array,
      default: () => {
        return []
      }
    },
    formItems: {
      type: Array,
      default: () => {
        return []
      }
    },
    /* 数据字典配置 */
    dictionaryConfig: {
      type: Array,
      default: () => {
        return []
      }
    },
    /* 标题 */
    magnifierTitle: {
      type: String,
      default: undefined
    },
    /* 字段匹配 */
    matchKey: {
      type: Object,
      default: () => {
        return {}
      }
    },
    multiple: Boolean,
    /* 是否禁用 */
    disabled: Boolean,
    /** 查询参数 */
    queryParams: {
      type: Object,
      default: () => {
        return {};
      },
    },
    /* modal 宽度 */
    modalWidth: {
      type: [ String, Number ],
      default: () => {
        return '50%'
      }
    },
    /* modal 高度 */
    modalHeight: {
      type: [ String, Number ],
      default: '50%'
    },
    requestCall: [Function, String],
  }
}

export { commonMagnifierMixin }
