<template>
  <div>
    <CommonInfo :purchaseData="purchaseData"/>
    <div style="margin: 11px 30px;color: #1890ff;">部门长审核</div>
    <el-form label-width="100px">
      <el-form-item label="审核人">{{ purchaseData.purchaseDeptManagerName }}</el-form-item>
    </el-form>
    <el-divider></el-divider>
    <div style="margin: 11px 30px;color: #1890ff;">核算部审批</div>
    <el-row style="margin-left:97px">
      <el-col :span="10">
        <el-row>
          <el-col :span="6">
            <el-radio v-model="radio" label="1">通过</el-radio>
          </el-col>
          <el-col :span="6">
            <el-radio v-model="radio" label="2">不通过</el-radio>
          </el-col>
        </el-row>
      </el-col>
      <el-col :span="10">
        <el-row>
          <el-col :span="5">审核人</el-col>
          <el-col :span="16"><el-input :value="$store.state.user.nickName" style="width: 90px" disabled/></el-col>
        </el-row>
      </el-col>
    </el-row>
  </div>
</template>

<script>
  import CommonInfo from "./CommonInfo";
  export default {
    name: "calculate",
    props: {
      purchaseData:{
        type: Object
      }
    },
    components:{
      CommonInfo
    },
    watch:{
      radio(newVal,oldVal){
        if(newVal== "1"){
          this.purchaseStatus = "2";

        }
        if(newVal== "2"){
          this.purchaseStatus = "3";
        }
      }
    },
    data(){
      return{
        radio: "1",
        purchaseStatus: "2"
      }
    },
    methods:{
      resetSuggestion(){
        this.radio = "1";
      },
      checkParam(){
        return false;
      },
      submitSuggestion(){
        let param = {...this.purchaseData};
        param.purchaseStatus = this.purchaseStatus;
        param.approvedUserId = this.$store.state.user.userId;
        param.approvedTime =this.getNowTime();
        return param;
      },
      getNowTime(){
        var date = new Date();
        var seperator = "-";
        var currentdate =date.getFullYear()+seperator+date.getMonth()+seperator+date.getDate() +" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
        console.log(currentdate,"currentdate")
        return currentdate;
      }
    }
  }
</script>

<style scoped>

</style>
