<template>
  <div :class="$style.maintainLogListDiv">
    <a-card :bordered="false">
      <audit-advanced-query
        :expand="expand"
        :search-data="formData"
        ref-name="searchform"
        :search-style="{ height: '150px', left: '20px', top: '57px' }"
        :search-fun="handleSearch"
        @searchedClick="searchedClick"
      >
        <template>
          <a-col :span="12">
            <a-form-model-item :label="'操作人员'" prop="creatorName">
              <a-input v-model="formData.creatorName" allow-clear />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item :label="'所属单位'" prop="unitName">
              <a-input v-model="formData.unitName" allow-clear />
            </a-form-model-item>
          </a-col>
        </template>
      </audit-advanced-query>
      <sd-data-table-ex
        ref="dataTable"
        :projectlist="true"
        :filter-expressions="expressions"
        :columns="columns"
        :actions="actions"
        form-id="iamModelMaintainLog"
        page-id="audit/maintain/iamModelMaintainLog"
        :search-fields="['creatorName', 'unitName', 'maintainCode', 'maintainName']"
        show-selection
        :show-advance-query="true"
        @searchbtnClick="searchbtnClick"
      >
      </sd-data-table-ex>
    </a-card>
  </div>
</template>

<script>
import TableColumnTypes from '@/common/services/table-column-types'
import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
import components from './_import-components/audit-maintain-log-list-import'

export default {
  name: 'AuditMaintainLogList',
  metaInfo: {
    title: '审计模型操作日志',
  },
  components: {
    ...components,
    auditAdvancedQuery,
  },
  mixins: [auditAdvancedQueryMixins, auditAdvancedGroupMixins],
  data() {
    return {
      expressions: [],
      formData: {
        creatorName: '',
        unitName: '',
      },
      columns: [
        {
          title: '序号',
          dataIndex: 'sortNum',
          width: '80px',
          customRender: (text, record, index) => `${index + 1}`,
        },
        {
          title: '操作人员',
          dataIndex: 'creatorName',
        },
        {
          title: '所属单位',
          dataIndex: 'unitName',
        },
        {
          title: '模型编码',
          dataIndex: 'maintainCode',
        },
        {
          title: '模型名称',
          dataIndex: 'maintainName',
        },
        {
          title: '操作时间',
          dataIndex: 'creationTime',
          width: '180px',
          // sdRender: TableColumnTypes.dateSecondime,
          sdRender: TableColumnTypes.date,

          defaultSortOrder: 'desc',
          sorter: true,
        },
        {
          title: '操作类型',
          dataIndex: 'operateType',
        },
      ],
      actions: [],
    }
  },
  created() {},
  methods: {
    // 查询
    handleSearch() {
      this.expressions = []
      // 操作人员
      if (this.formData.creatorName) {
        this.expressions.push({
          dataType: 'str',
          name: 'creatorName',
          op: 'like',
          stringValue: `%${this.formData.creatorName}%`,
        })
      }
      // 所属单位
      if (this.formData.unitName) {
        this.expressions.push({
          dataType: 'str',
          name: 'unitName',
          op: 'like',
          stringValue: `%${this.formData.unitName}%`,
        })
      }
    },
  },
}
</script>

<style module lang="scss">
@use '@/common/design' as *;

.maintainLogListDiv {
  :global(.ant-table-content) {
    :global(.ant-table-body) {
      overflow-x: hidden !important;
    }
  }
}
</style>
