<template>
  <div class="m20">
    <div class="header">
      <span> {{ title }} </span>
    </div>
    <el-table
      ref="multipleTable"
      v-loading="loading"
      :data="tableARR"
      tooltip-effect="dark"
      style="width: 95%;margin:0 auto"
      :fit="true"
      height="300"
      :row-class-name="tableRowClassName"
      :header-cell-style="{background:'#8cc3fb',color:'#fff'}"
    >
      <el-table-column prop="index" label="序号" min-width="70" align="center">
        <template slot-scope="scope">
          {{ (pageParam.curPage - 1 ) * pageParam.pageSize + scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column prop="sid" label="奖惩措施编码" show-overflow-tooltip min-width="120" align="left" />
      <el-table-column prop="jccs" label="激励措施（惩戒措施）" show-overflow-tooltip min-width="280" align="left" />
      <el-table-column prop="jcdx" label="激励对象（惩戒对象）" show-overflow-tooltip min-width="280" align="left" />
      <el-table-column prop="sxxw" label="激励措施内容（惩戒措施内容）" show-overflow-tooltip min-width="280" align="left" />
      <el-table-column prop="bwl" label="法规政策依据" show-overflow-tooltip min-width="300" align="left" />
      <el-table-column prop="jclb" label="奖惩类别" show-overflow-tooltip min-width="100" align="left">
        <template slot-scope="scope">
          {{ scope.row.jclb === '1' ? '惩戒' : '激励' }}
        </template>
      </el-table-column>
      <el-table-column prop="syqx" label="适用情形" show-overflow-tooltip min-width="100" align="left" />
      <el-table-column prop="csly" label="措施来源" show-overflow-tooltip min-width="100" align="left" />
      <el-table-column prop="ssbm" label="实施部门" show-overflow-tooltip min-width="100" align="left" />
      <el-table-column label="操作" min-width="100" align="left" fixed="right">
        <template slot-scope="scope">
          <el-link type="primary" @click="feedBack(scope.row)">实施反馈</el-link>
        </template>
      </el-table-column>
    </el-table>
    <div v-if="showPagination" class="page-box">
      <el-row>
        <el-col :span="18" :offset="6">
          <el-pagination
            :disabled="loading"
            :page-size="pageParam.pageSize"
            :total="tableARR.total"
            :page-sizes="[10, 20, 30, 40,50,100,200]"
            layout="slot,total, sizes, prev, pager, next, jumper"
            @size-change="pageSizeChange"
            @current-change="pageIndexChange"
          >
            <span>
              第 {{ pageParam.curPage }} 页 /
              共 {{ (tableARR.total !== 0 ? parseInt((tableARR.total + pageParam.pageSize - 1)/pageParam.pageSize) : 1) }} 页
            </span>
          </el-pagination>
        </el-col>
      </el-row>
    </div>
    <ImplementFeedback ref="ImplementFeedback" />
  </div>
</template>

<script>
import ImplementFeedback from './实施反馈'
export default {
  components: {
    ImplementFeedback
  },
  props: {
    tableARR: {
      type: Array,
      default: () => {
        return []
      }
    },
    title: {
      type: String,
      default: () => {
        return ''
      }
    },
    showPagination: {
      type: Boolean,
      default: () => {
        return false
      }
    },
    searchInfo: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      showMore: '',
      loading: false,
      pageParam: {
        curPage: 1,
        pageSize: 10
      }
    }
  },
  watch: {},
  mounted() {},
  methods: {
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 === 1) {
        return 'warning-row'
      }
    },
    pageSizeChange(val) {
      this.pageParam.pageSize = val
      this.$emit('pageSizeChangeTable', val)
    },
    pageIndexChange(val) {
      this.pageParam.curPage = val
      this.$emit('pageIndexChangeTable', val)
    },
    feedBack(item) {
      var form = {
        ...item,
        ztmc: this.searchInfo.xxztmc,
        ztlb: this.searchInfo.xxztlb + '',
        tyshxydm: this.searchInfo.xxzthm,
        zjhm: this.searchInfo.xxzthm,
        csnr: item.jccs,
        cxcode: this.searchInfo.busiNo
      }
      this.$refs.ImplementFeedback.openDiaolog(form)
    }
  }
}
</script>

<style lang="scss" scoped>

.page-box{
    margin:10PX;
  .el-pagination{
    text-align: right;
  }
}
.header{
  width: 95%;
  margin: 10px auto;
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  color: #000;
  img{
    margin-right:10px;
  }
}
</style>
