<template>
  <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="150px" label-position="top" class="rule-form-orange">
    <cy-info-title>上游结算单</cy-info-title>
    <el-form-item
      label="上游结算单："
      prop="desc"
      style="width: 100%;"
      class="form-required"
    >
      <cy-upload
        ref="fileStorage"
        :upload-params="uploadParams"
        :file-data="file"
        :upload-from-orange-status="true"
        disabled
        placeholder="请上传上游结算单"
      />
    </el-form-item>
    <cy-info-title>审批结论</cy-info-title>
    <el-form-item label="审批结论" prop="approvalConclusion">
      <el-radio-group v-model="ruleForm.approvalConclusion" disabled>
        <el-radio label="pass">通过</el-radio>
        <el-radio label="back">退回</el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="审批意见" prop="approvalComment" style="width: 100%;" :rules="[{ required: ruleForm.approvalConclusion == 'back', trigger: 'blur', message: '请输入审批意见' }]">
      <el-input
        v-model="ruleForm.approvalComment"
        placeholder="请输入审批意见"
        type="textarea"
        :rows="3"
        disabled
      ></el-input>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: 'SettlementEdit',
  data() {
    return {
      uploadParams: {},
      file: [],
      ruleForm: {
        approvalConclusion: '',
        approvalComment: ''
      },
      rules: {
        approvalConclusion: [{ required: true, trigger: 'change', message: '请选择审批结论' }]
      },
      isLoading: false,
      stepList: [],
      activeNames: []
    }
  },
  props: ["info"],
  watch: {
    'info.mathId': {
      handler(newV) {
        if(newV) {
          this.ruleForm.approvalConclusion = this.info.approvalConclusion
          this.ruleForm.approvalComment = this.info.approvalComment
          this.file = [...this.info.files] || []
          console.log(this.info)
        }
      },
      immediate: true
    }
  }
}
</script>

<style lang="scss" scoped>
  /* .template-examine .submit-btn {
    position: absolute;
    bottom: 40px;
    right: 40px;
  } */
</style>

