<!--合规人员处理问题分布情况-->
<template>
  <div>
    <dialog-edit
      :visible.sync="dialogVisible"
      :autoSave="false"
      :autoClose="false"
      :editModel="editModel"
      :form="{}"
      center
      :title="$t('coordManageMain.traceUserDealInfo')">
      <span>{{$t('coordManageMain.name')+form.traceUserName}}</span>
      <!-- <external-transition :isCollapse="false" :title="$t('coordManageMain.name')+form.traceUserName">
         <template slot="unfolded"> -->
           <data-table  :sourceData.sync="sourceData"
                        :api="taskApi"
                        loadPage="getDefault"
                        :queryParas="queryParas"
                        :loadCount.sync="loadCount"
                        @handleFilter="handleFilter"
                        :pageAll="true"
                        :showPage="true"
                        :columns="columns"
                        :menuFlag="false"
                        ref="dataTable">
            <template slot="whetherChargeUser">
              <span>{{formatYesNo(chargeUser)}}</span>
            </template>
           </data-table>
         <!-- </template>
      </external-transition> -->
    </dialog-edit>
  </div>
</template>
<script>
import { DialogEdit, authButton, DataTable } from 'newepoch-components'
import * as format from '@/filters/index'
import externalTransition from '@/components/element/assetoutfeedback/externalTransition'
import coordManageApi from '@/api/assetoutfeedback/coordManage/coordManageApi'
import BasePage from '@/pages/baseEditPage'
export default {
  name: 'traceUserDealInfoPop',
  extends: new BasePage(),
  components: {
    DialogEdit,
    authButton,
    DataTable,
    externalTransition
  },
  props: {
    editModel: {
      type: [String],
      default () {
        return 'E'
      }
    },
    form: {
      type: [Object],
      default () {
        return {}
      }
    }
  },
  data () {
    return {
      columns: [
        {
          // 项目
          prop: 'projectName',
          align: 'left',
          width: '100px',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.project
        },
        {
          // 期数
          prop: 'periods',
          align: 'center',
          width: '50px',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.periods
        },
        {
          // 正在解决的笔数
          prop: 'solvingAssetNum',
          align: 'center',
          width: '70px',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.solvingAssetNum
        },
        {
          // 正在解决问题数
          prop: 'solvingQuestionNum',
          align: 'center',
          width: '70px',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.solvingQuestionNum
        },
        {
          // 抽样未完成数量
          prop: 'sampleUnfinishedNum',
          align: 'center',
          width: '70px',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.sampleUnfinishedNum
        },
        {
          // 是否定稿当天
          prop: 'whetherFinalizeDateList',
          align: 'center',
          width: '70px',
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.whetherFinalizeDate,
          format: (row) => {
            return this.whetherFinalizeDate(row.whetherFinalizeDateList)
          }
        },
        {
          // 是否统筹人
          prop: 'whetherChargeUser',
          align: 'center',
          width: '50px',
          slot: true,
          label: this.$i18n.messages[this.$i18n.locale].coordManageMain.whetherChargeUser
        }
      ],
      sourceData: [],
      loadCount: 0,
      queryParas: {
        pageIndex: 0,
        pageSize: 10
      }
    }
  },
  mounted () {
    Object.assign(this.queryParas, this.form)
    this.$nextTick(() => {
      this.handleFilter()
    })
  },
  computed: {
    taskApi () {
      return coordManageApi.traceDealInfo
    },
    chargeUser () {
      return this.form.whetherChargeUser
    }
  },
  methods: {
    handleFilter () {
      this.loadCount = this.loadCount + 1
    },
    formatYesNo (val) {
      return val === '2' ? '是' : '否'
    },
    // 是否定稿当天
    whetherFinalizeDate (data) {
      let flag = false
      data.forEach(item => {
        if (item) {
          let date1 = format.formatDateNull(new Date(), 'yyyy-MM-dd')
          let date2 = format.formatDateNull(item, 'yyyy-MM-dd')
          if (date1 === date2) {
            flag = true
          }
        }
      })
      return flag ? '是' : '否'
    }
  }
}
</script>
