<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-news__subauditrecordslog}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataListSearch()">
        <el-form-item label="流程节点" prop="processCode">
          <el-select v-model="dataForm.processCode" placeholder="流程节点" clearable>
            <el-option v-for="item in processCodeArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="success" @click="getDataListSearch()">{{ $t('query') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('news:subauditrecordslog:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('news:subauditrecordslog:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column label="序号" header-align="center" align="center" width="50px">
          <template slot-scope="scope">
            {{scope.$index+1}}
          </template>
        </el-table-column>
        <el-table-column prop="checkDeptName" label="操作部门" header-align="center" align="center"></el-table-column>
        <el-table-column prop="checkTime" label="操作时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="processName" label="流程节点" header-align="center" align="center"></el-table-column>
        <el-table-column prop="checkResult" label="审核结果" header-align="center" align="center" :formatter="showFlagFormatter"></el-table-column>
        <el-table-column prop="checkOpinion" label="审核意见" header-align="center" align="center"></el-table-column>
        <!--<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">-->
          <!--<template slot-scope="scope">-->
            <!--<el-button v-if="$hasPermission('news:subauditrecordslog:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>-->
            <!--<el-button v-if="$hasPermission('news:subauditrecordslog:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>-->
          <!--</template>-->
        <!--</el-table-column>-->
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './subauditrecordslog-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/news/subauditrecordslog/page',
        getDataListIsPage: true,
        deleteURL: '/news/subauditrecordslog',
        deleteIsBatch: true
      },
      dataForm: {
        id: '',
        processCode: ''
      },
      processCodeArr: [
        { dictValue: '1', dictName: '提交' },
        { dictValue: '2', dictName: '初审' },
        { dictValue: '3', dictName: '验收' },
        { dictValue: '4', dictName: '驳回' }
      ]
    }
  },
  components: {
    AddOrUpdate
  },
  methods: {
    showFlagFormatter: function (row, column) {
      if (row.showFlag === '1') {
        return '驳回'
      } else if (row.showFlag === '2') {
        return '通过'
      }
    }
  }
}
</script>
