<!--跟进人-律所/管理人tab子组件-->
<template>
  <div class="traceFeedBackSub">
    <el-row :gutter="10">
      <!--已分配任务-->
      <el-col :lg="10" :md="10" :xl="10" class="card-margin">
        <el-card class="box-card" shadow="never" body-style="height:100px;padding-top: 10px;padding-left: 10px;">
            <div slot="header">
                <span class="iconfont iconcompanylist header-icon-color header-icon-font"/>
                <span class="header-title">{{$t('traceManageMain.lawFirmAssigned')}}</span>
            </div>
            <div>
              <el-col :span="7">
                <span class="body-ul">{{$t('traceManageMain.toPracticable')}}</span>
                    <div class="body-text">
                      <span class="num-large show-cursor" @click="showFeedbackMain">{{feedbackData.implementeCount?feedbackData.implementeCount:0}}</span>
                      <span class="num-text">{{$t('traceManageMain.count')}}</span>
                    </div>
              </el-col>
              <el-col :span="1">
                <div class="body-devide-line"></div>
              </el-col>
              <el-col :span="8">
                 <span class="body-ul">{{$t('traceManageMain.toHandle')}}</span>
                    <div class="body-text">
                      <span class="num-large show-cursor" @click="showFeedbackMain">{{feedbackData.disposalCount?feedbackData.disposalCount:0}}</span>
                      <span class="num-text">{{$t('traceManageMain.count')}}</span>
                    </div>
              </el-col>
              <el-col :span="1">
                <div class="body-devide-line"></div>
              </el-col>
              <el-col :span="7">
                 <span class="body-ul">{{$t('traceManageMain.toSend')}}</span>
                    <div class="body-text">
                      <span class="num-large show-cursor" @click="showFeedbackMain">{{feedbackData.sendCount ?feedbackData.sendCount :0}}</span>
                      <span class="num-text">{{$t('traceManageMain.count')}}</span>
                    </div>
              </el-col>
            </div>
        </el-card>
      </el-col>
      <el-col :lg="8" :md="8" :xl="8" class="card-margin"  v-if="feedbackData.sendListFlag==='2'">
        <el-card class="box-card" shadow="never" body-style="height:109px;padding:10px;">
            <div slot="header">
                <span class="iconfont iconcompanylist header-icon-color header-icon-font"/>
                <span class="header-title">{{$t('coordManageMain.checkListProgress')}}</span>
                <auth-button type="primary" size="medium" :label="$t('common.view')" class="header-btn1 iconfont iconzuopintoupiao" @click="showAssetsStatus('1')"></auth-button>
            </div>
            <div>
                <ul class="body-ul">
                    <li>
                        <span>{{$t('coordManageMain.currentTotalCount')}}</span>
                        <span class="body-num-float">{{feedbackData.sampleCount.totalCount|numFormat}}</span>
                    </li>
                    <li class="body-li-margin">
                        <span>{{$t('coordManageMain.reviewedTotalCount')}}</span>
                        <span class="body-num-float">{{feedbackData.sampleCount.completeCount|numFormat}}</span>
                    </li>
                    <li class="body-li-margin">
                        <span>{{$t('coordManageMain.submittedTotalCount')}}</span>
                        <span class="body-num-float">{{feedbackData.sampleCount.submittedCount|numFormat}}</span>
                    </li>
                    <li class="body-li-margin">
                        <span>{{$t('coordManageMain.newSubmittedTotalCount')}}</span>
                        <span class="body-num-float">{{feedbackData.sampleCount.newSubmitCount |numFormat}}</span>
                    </li>
                </ul>
            </div>
        </el-card>
      </el-col>
      <!--进度跟踪-基础资产反馈进度-->
      <el-col :lg="16" :md="16" :xl="16" class="card-margin">
        <sample-track-schedule-sub :form="feedbackData.sampleCountDTO" :trackParam="trackData" userType="2" :fileAll="fileAll"></sample-track-schedule-sub>
      </el-col>
      <!--进度跟踪-后补进度-->
      <el-col :lg="8" :md="8" :xl="8" class="card-margin">
        <file-back-track-schedule-sub :form="feedbackData.afterCountDTO" :trackParam="trackData" userType="2" :fileAll="fileAll"></file-back-track-schedule-sub>
      </el-col>
      <!--进度跟踪-批量反馈进度-->
      <el-col :span="24" class="card-margin">
        <con-and-other-track-schedule-sub :form="feedbackData.confirmAndOtherCounts" :trackParam="trackData" userType="2" :fileAll="fileAll"></con-and-other-track-schedule-sub>
      </el-col>
    </el-row>
      <!--查看资产状态-->
      <asset-flow-status-pop v-if="assetVisible" :visible.sync="assetVisible" :fileType="assetsStatusType" :form="trackData"></asset-flow-status-pop>
  </div>
</template>
<script>
import { authButton, DataTable } from 'newepoch-components'
import sampleTrackScheduleSub from '@/components/element/assetoutfeedback/sampleTrackScheduleSub'
import fileBackTrackScheduleSub from '@/components/element/assetoutfeedback/fileBackTrackScheduleSub'
import assetFlowStatusPop from '@/components/element/assetoutfeedback/assetFlowStatusPop'
import conAndOtherTrackScheduleSub from '@/components/element/assetoutfeedback/conAndOtherTrackScheduleSub'
import traceManageApi from '@/api/assetoutfeedback/traceManage/traceManageApi'
import BasePage from '@/pages/basePage'
export default {
  extends: new BasePage(),
  components: {
    authButton,
    DataTable,
    sampleTrackScheduleSub,
    fileBackTrackScheduleSub,
    conAndOtherTrackScheduleSub,
    assetFlowStatusPop
  },
  props: {
    projectInfo: {
      type: [Object],
      default: function () {
        return {}
      }
    },
    activeName: {
      type: [String],
      default: function () {
        return '0'
      }
    },
    fileAll: {
      type: [Array],
      default: function () {
        return []
      }
    }
  },
  data () {
    return {
      feedbackData: {},
      trackData: {},
      solveFlag: '',
      assetVisible: false
    }
  },
  watch: {
    projectInfo: function () {
      if (JSON.stringify(this.projectInfo) !== '{}') {
        this.getFeedback(this.projectInfo, this.activeName)
      }
    }
  },
  mounted () {
    if (this.activeName && this.activeName !== '' && JSON.stringify(this.projectInfo) !== '{}') {
      this.getFeedback(this.projectInfo, this.activeName)
    }
  },
  methods: {
    showFeedbackMain () {
      this.$router.push({ path: '/assetoutfeedback/effectDealFeedBack/effectDealFeedBackMain', query: Object.assign({ 'displayFlag': true }, this.projectInfo) })
    },
    // 查看资产流程状态
    showAssetsStatus (type) {
      this.assetsStatusType = type // 文件类型
      this.assetVisible = true
    },
    // 获取反馈信息
    getFeedback (data, activeName) {
      this.trackData = {
        periods: data.periods,
        projectId: data.projectId,
        projectName: data.projectName,
        feedbackResource: activeName === '0' ? '1' : '2',
        traceUserId: this.$store.getters.userId
      }
      this.getFeedbackApi.getDefaultInfo(this.trackData).then(res => {
        if (res.success) {
          this.feedbackData = res.data
          if (res.data.implementeCount > 0 || res.data.disposalCount > 0 || res.data.sendCount > 0) {
            this.solveFlag = '1'
          } else {
            this.solveFlag = '0'
          }
          this.$emit('solveFlag', this.solveFlag)
        }
      })
    }
  },
  computed: {
    getFeedbackApi () {
      return traceManageApi.getFeedback
    }
  },
  filters: {
    numFormat (data) {
      if (!data) {
        return '0'
      } else {
        return data
      }
    }
  }
}
</script>
<style lang="scss" scoped>
@import '~@/styles/assetoutfeedback/common.scss'
</style>
