/**version-1.0*/
let tmixins = {};
tmixins = {
  props: ["dataId", "type", "parentTarget", 'option'],
  data() {
    return {
      oplogDTOs: [],
      m1Option: {}
    };
  },
  computed: {
    target: function () {
      return this.parentTarget || this;
    }
  },
  mounted() {
    this.initOplogDTOs();
  },
  methods: {
    initOplogDTOs() {
      const tableOption = {
        vue: this,
        tableRef: 'table-m1',
        tableName: 'component-oplogList-m1Grid',
        columns: [{
          type: 'checkbox',
          fixed: 'left',
          width: 48,
          resizable: false
        },
          {
            title: this.$t2('操作时间', 'components.oplogTable.createDate'),
            field: 'createDate',
            width: 150,
            slots:{
              default: ({row})=>{
                return row.createDate || row.create_date
              }
            }
          },
          {
            title: this.$t2('操作人员', 'components.oplogTable.createBy'),
            field: '_createBy',
            width: 150
          },
          {
            title: this.$t2('操作日志', 'components.oplogTable.content'),
            field: 'content',
            width: 150
          },
          {
            width: 47,
            fixed: 'right',
            title: '',
            sortable: false
          }
        ]
      };
      this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
        this.m1Option = opts;
      });

    },
    initData(option) {
      let data = option.param ? option.param() : {};
      this.target.$commonHttp({
        url: option.url,
        method: `post`,
        data: {
          ...data,
          searchCount: false
        },
        isLoading: true,
        modalStrictly: true,
        success: res => {
          let rows = res.objx ? (res.objx.records || res.objx || []) : [];
          this.oplogDTOs = rows;
        }
      });
    },
  }
};
export const mixins = tmixins
