audit.vue 3.5 KB

<template>
  <div class="from-table font-line-space" style="height:65vh;overflow:auto;">
    <a-spin :spinning="loading" style="width: 100%;height: 100%;">
      <thesis-info v-model="conclusionData" />
      <a-form-model ref="form" :model="auditObj" :rules="rules" class="from-table">
        <audit-edit :auditObj.sync="auditObj" :disabledBtns.sync="disabledBtns" />
      </a-form-model>
    </a-spin>
  </div>
</template>
<script>
import { isEmptyParams } from "@/views/utils/common";
import thesisInfo from '@/views/conclusion/components/thesis/thesisInfo'
import auditEdit from '@/views/audit/components/auditEdit'

export default {
  name: "Audit",
  components: {
    thesisInfo, auditEdit
  },
  data () {
    return {
      conclusionData: {
        projNo: null,
        projName: null,
        appPersonName: null,
        appUnitName: null,
        telephone: null,
        planCategory: null,
        startDate: null,
        endDate: null,
        promotionContent: null,
        promotionTarget: null,
        selfEvaluation: null,
        achievingResults: null,
        thesisList: [],
        researchersList: [],
        //拔款
        grant: [],
        //其它途径筹资
        finance: [],
        //主要支出项目
        spending: [],
        balance: null,
        researchContent: null,
        workPlan: null,
        extensionReport: null,
        fileList: [],
        catalogList: [],
      },
      auditObj: { id: this.value, auditObjectId: this.objectId, auditResult: null, auditType: 5, auditContent: '' },
      rules: {
        auditContent: { required: true, message: '请填写审核意见', trigger: 'blur' },
        auditResult: { required: true, message: '请选择审核结果', trigger: 'change' },
      },
      loading: false,
    };
  },
  props: {
    value: {
      type: String,
      default: () => {
        return null;
      },
    },
    projId: {
      type: String,
      default: () => {
        return null
      }
    },
    objectId: {
      type: String,
      default: () => {
        return null
      }
    },
    disabledBtns: {
      type: Object,
      default: () => {
        return {
          btnPassed: false,
          btnReturn: false,
          btnUnpassed: false,
        }
      }
    }
  },
  created () {
    this.getConclusionByProjId()
  },
  methods: {
    getConclusionByProjId () {
      this.loading = true
      if (!!this.projId) {
        this.$api.conclusion.getConclusionByProjId({ id: this.projId }).then(({ data = {} }) => {
          if (data) {
            this.conclusionData = data
            this.loading = false
          } else {
            this.$emit('closeWindow', 'error')
          }
        }).catch(() => {
          this.$emit('closeWindow', 'error')
        })
      } else {
        this.$emit('closeWindow', 'error')
      }
    },
    submit () {
      this.$refs.form.validate(valid => {
        if (valid) {
          this.loading = true
          let pars = isEmptyParams(this.auditObj)
          let par = { ...pars }
          this.$api.conclusion.thesisAudit(par).then(({ data = {} }) => {
            if (data) {
              this.$message.success('审核成功!')
              this.$emit('closeWindow', 'audit')
            }
          }).catch((error) => {
            this.$message.error(error)
            this.loading = false
          })
        } else {
          this.$message.error('请选择审核结果或填写审核意见!')
          return false
        }
      })
    },
  },
}
</script>
<style lang="less" scoped>
</style>