<template>
  <view class="content">
    <view class="card">
      <u-steps :current="current" activeIcon="checkmark" inactiveIcon="arrow-right" direction="column">
        <u-steps-item v-for="(item,index) in steps" :key="index" :title="item.title" :desc="item.desc"></u-steps-item>
      </u-steps>
    </view>
  </view>
</template>

<script>
import {getHotWorkGoEdit} from "../../../api";

export default {
  data() {
    return {
      current:0,
      steps: [
        {
          title:'特级动火申请人申请',
          audit:true
        },
        {
          title:'动火单位负责人确认',
          audit:true
        },
        {
          title:'项目主管人员初审',
          audit:true
        },
        {
          title:'项目主管部门负责人审核',
          audit:true
        },
        {
          title:'分公司安全总监审批',
          audit:true
        },
        {
          title:'分公司主要负责人签批',
          audit:true
        },
        {
          title:'安全监督部初审',
          audit:true
        },
        {
          title:'安委会办公室审批',
          audit:true
        },
        {
          title:'安全总监签批',
          audit:true
        }
      ],
      HOTWORKAPPLICATION_ID:''
    }
  },
  onLoad(event) {
    this.HOTWORKAPPLICATION_ID = event.HOTWORKAPPLICATION_ID
    this.getDate()
  },
  methods: {
    async getDate(){
      let resData = await getHotWorkGoEdit({HOTWORKAPPLICATION_ID:this.HOTWORKAPPLICATION_ID});
      let state = resData.pd.STATE
      if(state == '35'){
        this.current = 5
      }else if(state == '36'){
        this.current = 6
      }else if(state == '37'){
        this.current = 7
      }
	  let hotUserAllList = resData.pd.hotUserAllList
	  if(hotUserAllList && hotUserAllList.length > 0){
		  for(var i = 0; i < hotUserAllList.length; i++){
        // if(hotUserAllList[i].STATE == 0){
        // }else if(hotUserAllList[i].STATE == 30){
        // } 另一种解决，暂时没有注释
			  // if(hotUserAllList[i].STATE){ 申请人不正确，state=0时，没有进入case，所以注释
				  switch (hotUserAllList[i].STATE){
            case 0:
              this.steps[0].desc = hotUserAllList[i].OPERATTIME
              if(hotUserAllList[i].userName !== undefined){
                this.steps[0].title += ": "+hotUserAllList[i].userName || hotUserAllList[i].userName2 || hotUserAllList[i].userName3
              }
              break;
				  	case 30:
						if(hotUserAllList[i].TYPE != '-1' ){
							this.steps[1].desc = hotUserAllList[i].OPERATTIME
						}
                      if(hotUserAllList[i].userName !== undefined){
                        this.steps[1].title += ": "+hotUserAllList[i].userName || hotUserAllList[i].userName2 || hotUserAllList[i].userName3
                      }				  		break;
				  	case 31:
						if(hotUserAllList[i].TYPE != '-1' ){
							this.steps[2].desc = hotUserAllList[i].OPERATTIME
						}
                      if(hotUserAllList[i].userName !== undefined){
                        this.steps[2].title += ": "+hotUserAllList[i].userName || hotUserAllList[i].userName2 || hotUserAllList[i].userName3
                      }				  		break;
				  	case 32:
						if(hotUserAllList[i].TYPE != '-1' ){
							this.steps[3].desc = hotUserAllList[i].OPERATTIME
						}
                      if(hotUserAllList[i].userName !== undefined){
                        this.steps[3].title += ": "+hotUserAllList[i].userName || hotUserAllList[i].userName2 || hotUserAllList[i].userName3
                      }				  		break;
				  	case 33:
						if(hotUserAllList[i].TYPE != '-1' ){
							this.steps[4].desc = hotUserAllList[i].OPERATTIME
						}
                      if(hotUserAllList[i].userName !== undefined){
                        this.steps[4].title += ": "+hotUserAllList[i].userName || hotUserAllList[i].userName2 || hotUserAllList[i].userName3
                      }				  		break;
				  	case 34:
						if(hotUserAllList[i].TYPE != '-1' ){
							this.steps[5].desc = hotUserAllList[i].OPERATTIME
						}
                      if(hotUserAllList[i].userName !== undefined){
                        this.steps[5].title += ": "+hotUserAllList[i].userName || hotUserAllList[i].userName2 || hotUserAllList[i].userName3
                      }				  		break;
				  	case 35:
						if(hotUserAllList[i].TYPE != '-1' ){
							this.steps[6].desc = hotUserAllList[i].OPERATTIME
						}
                      if(hotUserAllList[i].userName !== undefined){
                        this.steps[6].title += ": "+hotUserAllList[i].userName || hotUserAllList[i].userName2 || hotUserAllList[i].userName3
                      }
				  		break;
				  	case 36:
						if(hotUserAllList[i].TYPE != '-1' ){
							this.steps[7].desc = hotUserAllList[i].OPERATTIME
						}
                      if(hotUserAllList[i].userName !== undefined){
                        this.steps[7].title += ": "+hotUserAllList[i].userName || hotUserAllList[i].userName2 || hotUserAllList[i].userName3
                      }				  		break;
				  	case 37:
						if(hotUserAllList[i].TYPE != '-1' ){
							this.steps[8].desc = hotUserAllList[i].OPERATTIME
						}
						if(hotUserAllList[i].userName !== undefined){
                          this.steps[8].title += ": "+hotUserAllList[i].userName || hotUserAllList[i].userName2 || hotUserAllList[i].userName3
                        }
				  		break;
				  	case 38:
						if(hotUserAllList[i].TYPE != '-1' ){
							this.steps[9].desc = hotUserAllList[i].OPERATTIME
						}
						this.steps[9].title += ": "+hotUserAllList[i].userName || hotUserAllList[i].userName2 || hotUserAllList[i].userName3
				  		break;
				  }
			  // }
			  
		  }
	  }
    }
  }
}
</script>

<style scoped>
</style>
