<!-- @desc:审批履历通过组件  @auth:张潇木  @time:2022-7-8 14:39 -->
<template>
  <div>
    <DkTable :pageFlag="false" :pageTotalFlag="false" :treeFlag="true" primaryKey="submitStepId"
             name="table" ref="detail-select" :data="tableData" :height="tableHeight">
      <DkTableColumn type="seq" width="60" sortable></DkTableColumn>
      <DkTableColumn
        v-for="(item, index) in tableDetailColumn"
        :key="index"
        align="center"
        :type="item.type"
        :field="item.field"
        :title="item.title"
        :width="item.width"
        :tree-node="item.treeNode"
      >
      </DkTableColumn>
    </DkTable>
  </div>
</template>

<script>
export default {
  name: 'ApprovalDetailTable',
  props: {
    dataId: {
      type: Number,
      default: undefined,
    },
    docCode: {
      type: String,
      default: undefined,
    },
    tableHeight:{
      type: Number,
      default: 385,
    },
    // 查询数据
    searchDataFlag:{
      type:Boolean,
      default:false,
    }
  },
  watch: {
    // 监听processData变化
    // dataId(n, o) {
    //   this.getData()
    // },
    searchDataFlag(n,o){
      if(n){
        this.getData()
      }
    }
  },
  data() {
    return {
      tableData:[],
      tableDetailColumn: [
        // {field: 'dataNo', width: 'auto', type: 'text', treeNode: true},
        // {field: 'docCode', width: 'auto', type: 'text'},
        {field: 'apvResult', width: 'auto', type: 'text', treeNode: true},
        {field: 'apvName', width: 'auto', type: 'text'},
        // {field: 'submitUserCode', width: 'auto', type: 'text',title:'提交用户编码'},
        {field: 'submitUserName', width: 'auto', type: 'text',title:'提交用户名称'},
        // {field: 'displayNo', width: 'auto', type: 'text',title:'步骤顺序'},
        {field: 'stepTypeName', width: 'auto', type: 'text',title:'步骤类别'},
        // {field: 'apsUserTypeName', width: 'auto', type: 'text',title:'对象类别'},
        // {field: 'objectName', width: 'auto', type: 'text',title:'对象名称'},
        {field: 'apsUserNames', width: 'auto', type: 'text',title:'审批用户'},
        {field: 'flgCurrent', width: 'auto', type: 'switch',title:'是否当前步骤'},
        {field: 'apsResult', width: 'auto', type: 'text',title:'审批结果'},
        {field: 'remarks', width: 'auto', type: 'text'},
      ]

      }

  },
  created() {
  },
  methods: {
    getData(){
      // approvalSubmitService.selectByCond({cpId:this.$store.state.user.cpId,dataId:this.dataId,docCode:this.docCode}).then(res => {
      //   if (res.code === 200) {
      //     let resData=res.data.list
      //     resData.forEach(it=>{
      //         this.$set(it,'id',it.submitId)
      //         this.$set(it,'hasChild',true)
      //         it['bomItems']=it['approvalSubmitStepResponseList']
      //         it.bomItems.forEach(item=>{
      //           this.$set(item,'parentId',it.submitId)
      //         })
      //       }
      //     )
      //     this.tableData=resData
      //     this.$emit('approval-data',  this.tableData)
      //   } else {
      //     this.$Message.warning(res.message)
      //   }
      // })
    }
  }

}
</script>

<style scoped>
</style>
