<template>
  <a-card :bordered="false">
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>
      </a-table>
    </div>

    <process-operation-log-modal ref="modalForm" @ok="modalFormOk"></process-operation-log-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ProcessOperationLogModal from './modules/ProcessOperationLogModal'
  import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'
  import { getAction } from '@api/manage'

  export default {
    name: 'ProcessOperationLogList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      ProcessOperationLogModal,
      JSuperQuery,
    },
    props: {
      tableId: {
        type: String,
        default: '',
        required: true
      },
    },
    data () {
      return {
        queryParam: {
          processRelevanceId: this.tableId
        },
        description: '流程操作记录',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'操作人',
            align:"center",
            dataIndex: 'operator'
          },
          {
            title:'行为',
            align:"center",
            dataIndex: 'behavior'
          },
          {
            title:'操作时间',
            align:"center",
            dataIndex: 'operationDate',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          }
        ],
        url: {
          list: "/processoperationlog/processOperationLog/list",
          delete: "/processoperationlog/processOperationLog/delete",
          deleteBatch: "/processoperationlog/processOperationLog/deleteBatch",
          exportXlsUrl: "/processoperationlog/processOperationLog/exportXls",
          importExcelUrl: "processoperationlog/processOperationLog/importExcel",

        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {

      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'operator',text:'操作人',dictCode:''})
        fieldList.push({type:'string',value:'behavior',text:'行为',dictCode:''})
        fieldList.push({type:'date',value:'operationDate',text:'操作时间'})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>