<!--进度跟踪-批量反馈进度-->
<template>
  <div class="conAndOtherTrackScheduleSub">
    <el-card body-style="height:210px" shadow="never" class="card-header">
      <div slot="header" class="card-btn">
          <span class="iconfont iconcompanylist header-icon-color header-icon-font"></span>
          <span class="header-title">{{$t('coordManageMain.batchFeedbackProgress')}}</span>
          <auth-button size="medium" type="primary" :label="$t('coordManageMain.trackSchedule')" v-if="trackParam.coordType==='1'||userType==='2'" class="header-btn1 iconfont icongenzongbiao" @click="showTracking()"></auth-button>
      </div>
      <div>
          <data-table :sourceData.sync="formUpdate"
                      class="table-width assets-table"
                      :columns="newColumns"
                      :showPage="false"
                      :height="192">
            <template slot="auditFileType" slot-scope="scope">
              {{formatType(scope.data.row)}}
            </template>
          </data-table>
      </div>
    </el-card>
    <tracking-table-summary v-if="visible" :visible.sync="visible" :form="params" :userType="userType" :fileAll="fileAll"></tracking-table-summary>
  </div>
</template>
<script>
import trackingTableSummary from '@/pages/assetoutfeedback/coordManage/trackingTableSummary'
import * as format from '@/filters/index'
import { DataTable, authButton } from 'newepoch-components'
export default {
  components: {
    DataTable,
    authButton,
    trackingTableSummary
  },
  name: 'conAndOtherTrackScheduleSub',
  props: {
    form: {
      type: Array,
      default () {
        return []
      }
    },
    trackParam: {
      type: Object,
      default () {
        return {}
      }
    },
    userType: {
      type: String,
      default () {
        return '1'
      }
    },
    fileAll: {
      type: Array,
      default () {
        return []
      }
    },
    stampType: {
      type: String,
      default () {
        return '1'
      }
    }
  },
  data () {
    return {
      visible: false,
      params: {},
      columns: [
        {
          // 分类
          prop: 'auditFileType',
          align: 'left',
          width: '20%',
          slot: true,
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.classification
        },
        {
          // 已反馈
          prop: 'feedbackCount',
          align: 'center',
          width: '10%',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.feedbacked,
          format: row => {
            row.feedbackCount = row.feedbackCount ? row.feedbackCount : 0
            row.feedbackQuestionCount = row.feedbackQuestionCount ? row.feedbackQuestionCount : 0
            return row.feedbackCount + this.$t('coordManageMain.count') + row.feedbackQuestionCount + this.$t('coordManageMain.question')
          }
        },
        {
          // 已通过
          prop: 'passCount',
          align: 'center',
          width: '10%',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.passed,
          format: row => {
            row.passCount = row.passCount ? row.passCount : 0
            return row.passCount + this.$t('coordManageMain.count')
          }
        },
        {
          // 已退单
          prop: 'returnAssetTotal',
          align: 'center',
          width: '10%',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.rejected,
          format: row => {
            row.returnAssetTotal = row.returnAssetTotal ? row.returnAssetTotal : 0
            return row.returnAssetTotal + this.$t('coordManageMain.count')
          }
        },
        {
          // 审核中
          prop: 'reviewCount',
          align: 'center',
          width: '10%',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.auditing,
          format: row => {
            row.reviewCount = row.reviewCount ? row.reviewCount : 0
            return row.reviewCount + this.$t('coordManageMain.count')
          }
        },
        {
          // 解决中
          prop: 'dealCount',
          align: 'center',
          width: '20%',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.solving,
          format: row => {
            row.dealCount = row.dealCount ? row.dealCount : 0
            row.dealQuestionCount = row.dealQuestionCount ? row.dealQuestionCount : 0
            return row.dealCount + this.$t('coordManageMain.count') + row.dealQuestionCount + this.$t('coordManageMain.question')
          }
        },
        {
          // 反馈状态
          prop: 'feedbackEndFlag',
          align: 'center',
          width: '20%',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.feedbackStatus,
          format: row => {
            return format.formatDict(row.feedbackEndFlag, 'AUDIT_OUT_QUST_MANAGE_STATUS')
          }
        }
      ],
      sourceData: []
    }
  },
  methods: {
    showTracking () {
      Object.assign(this.params, this.trackParam)
      this.visible = true
    },
    formatType (data) {
      let fileType = this.fileAll
      let auditFileType = fileType.filter(item => {
        return data.auditFileType === item.fileType
      })
      return auditFileType.length > 0 ? auditFileType[0].fileName : ''
    }
  },
  computed: {
    formUpdate: {
      get: function () { return this.form },
      set: function () { }
    },
    newColumns () {
      if (this.userType === '2') {
        return this.columns.slice(0, this.columns.length - 1)
      } else {
        return this.columns
      }
    }

  }
}
</script>
<style lang="scss" scoped>
@import '~@/styles/assetoutfeedback/common.scss'
</style>
