<template>
  <a-spin :spinning="spinning != 0">
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="pagination"
        @change="handleTableChange"
      >
        <template slot="serialNum" slot-scope="text,record,index">
          {{(pagination.current-1) * pagination.pageSize + parseInt(index) + 1}}
        </template>
      </a-table>
    </div>
  </a-spin>
</template>

<script>

  import { ViewMixin } from '../../../utils/ViewMixin'
  import YchConstant from "../../../utils/YchConstant";
  import locleUtil from "../../../utils/LocleUtil";

  export default {
    name: 'BpmVariable',
    mixins: [ViewMixin],
    props: {
      processInstanceId: {
        type: String,
        default: null
      }
    },
    data () {
      return {
        url: {
          list: YchConstant.PREFIX_BPM + '/bpm-back/processInstanceRest/getVariableListByPage/v1'
        },
        queryParam: {
          processInstanceId: this.processInstanceId
        },//查询参数
        columns: [{
          title:this.$locale('m.common.label.number'),
          dataIndex: '',
          key: 'rowIndex',
          width: 50,
          align: 'center',
          scopedSlots: { customRender: 'serialNum' },
        }, {
          title: this.$locale('m.bpm.entity.varName'),
          dataIndex: 'name',
          align: 'center',
          width: 180
        }, {
          title: this.$locale('m.bpm.entity.varValue'),
          dataIndex: 'value',
          align: 'center',
          width: 180
        }, {
          title: this.$locale('m.bpm.entity.varType'),
          dataIndex: 'type',
          width: 80,
          align: 'center'
        }, {
          title: this.$locale('m.bpm.entity.varCreateTime'),
          dataIndex: 'createTime',
          width: 80,
          align: 'center'
        }],
      }
    },
    methods: {
      $locale(params){
        return locleUtil.getLocale(params)
      },
    }
  }
</script>
