<template>
  <div>
    <Title title="四措两案" />
    <Preview :dataList="FourMeasuresAndTowSchemes" />
    <Title title="审批意见" />
    <u--textarea
      v-model="textareaValue"
      placeholder="请输入内容"
      count
      height="105"
      @blur="handleBlur"
      :disabled="isDetail"
    />
    <Title title="审批记录" />
    <Steps :data="approvalRecordList" />
  </div>
</template>

<script>
import Steps from 'pages/component/Steps'
import { selectFile, approvalHistory } from '@/api/project'
import { filterInput } from '@/utils/regular'

export default {
  props: {
    isDetail: {
      type: Boolean,
      default: false
    },
    isLeave: {
      type: Boolean,
      default: false
    },
    isSubcontractor: {
      type: Boolean,
      default: false
    },
    params: {
      type: Object,
      default: () => {}
    },
    approvalRecordList: {
      type: Array,
      default: () => []
    }
  },
  components: { Steps },
  data() {
    return {
      // 四措两案
      FourMeasuresAndTowSchemes: [],
      // 离场原因
      leaveValue: '',
      // 审批意见
      textareaValue: ''
    }
  },
  mounted() {
    if (this.isSubcontractor) {
    } else {
    }
    this.getFourMeasuresAndTowSchemes()
  },
  methods: {
    handleBlur() {
      console.log('审批意见', this.textareaValue)
      this.textareaValue = filterInput(this.textareaValue)
      this.$emit('handleOpinion', { FourMeasuresAndTowSchemes: this.textareaValue })
    },
    // 获取四措两案
    getFourMeasuresAndTowSchemes() {
      const params = {
        proId: this.params.proId,
        uuid: this.params.uuid,
        subUuid: this.params.subUuid,
        supUuid: this.params.supUuid,
        taskId: this.params.taskId,
        consUuid: this.params.consUuid,
        classification: this.isSubcontractor ? '3' : '2',
        fromType: '1',
        informationType: '3'
      }
      // console.log('🚀 ~ getEnterpriseQualification ~ params:', params)
      selectFile(params).then(res => {
        console.log('四措两案', res)
        if (res.data && res.data.length > 0) {
          this.FourMeasuresAndTowSchemes = res.data
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped></style>
