Newer
Older
Nanping_sponge_GCYPG / src / views / home / evaluate / index.vue
@liyingjing liyingjing on 25 Oct 2023 5 KB 工程预评估
<template>
  <div
    class="evaluate"
    v-loading.fullscreen.lock="loading"
    element-loading-text="加载中..."
    element-loading-background="rgba(0, 0, 0, 0.6)"
  >
    <el-card class="box-card">
      <template #header>
        <div class="card-header">
          <span>项目目标</span>
        </div>
      </template>
      <el-form class="form" ref="targetForm" :model="form">
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="建设工程:" prop="projectNo">
              <span>{{ form.projectName }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="工程类型:" prop="engineeringType">
              <span>{{ findText('sponge_engineering_type', form.engineeringType) }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="建设分区:" prop="drainagePartition">
              <span>{{ findText('drainage_partition', form.drainagePartition) }}</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="建设类型:" prop="buildCategory">
              <span>{{ findText('build_category', form.buildCategory) }}</span>
            </el-form-item></el-col>
          <el-col :span="8">
            <el-form-item label="年径流总量控制率%,≥:" prop="targetAnnualRunoffTotalControlRate">
              <span>{{ form.targetAnnualRunoffTotalControlRate }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="年径流污染控制率%,≥:" prop="targetAnnualRunoffPollutionControlRate">
              <span>{{ form.targetAnnualRunoffPollutionControlRate }}</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="调蓄量是否达标:" prop="storageCapacityStandards">
              <el-tag
                v-if="standardMap.get(form.storageCapacityStandards)?.text"
                :type="standardMap.get(form.storageCapacityStandards)?.type"
              >{{ standardMap.get(form.storageCapacityStandards)?.text }}</el-tag>
              <span v-else></span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="污染去除率是否达标:" prop="pollutionRemovalStandards">
              <el-tag
                v-if="standardMap.get(form.pollutionRemovalStandards)?.text"
                :type="standardMap.get(form.pollutionRemovalStandards)?.type"
              >{{ standardMap.get(form.pollutionRemovalStandards)?.text }}</el-tag>
              <span v-else></span>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <div class="tabs">
      <el-tabs
        v-model="active"
        type="border-card"
      >
        <el-tab-pane label="控制项" :name="0">
          <Control ref="controlRef"/>
        </el-tab-pane>
        <el-tab-pane label="评分项" :name="1">
          <Mark ref="markRef"/>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script setup>
import { reactive, onMounted } from 'vue'
import Control from './control.vue'
import Mark from './mark.vue'
import { useDicts } from '@/hooks'
import {
  getFacilitiesStandardCalcList,
  projectPreEvaluateDetails
} from '@/api/preassess/evaluation'
import { inheritAttr } from '@/utils/v3'
const { proxy } = getCurrentInstance()
const props = defineProps({
  id: {
    type: [String, Number],
    default: ''
  }
})
const { id } = props
const { findText } = useDicts(proxy)
const form = reactive({
  projectNo: '',
  projectName: '',
  buildCategory: '',
  engineeringType: '',
  drainagePartition: '',
  targetAnnualRunoffTotalControlRate: '',
  targetAnnualRunoffPollutionControlRate: '',
  storageCapacityStandards: '',
  pollutionRemovalStandards: '',
})
const active = ref(0)
const standardMap = new Map([
  [0, { text: '否', type: 'danger' }],
  [1, { text: '是', type: 'success' }]
])
let list = []
const loading = ref(true)

const getList = async () => {
  const res = await getFacilitiesStandardCalcList({ status: '1' })
  if(res?.code !== 200) return
  list = res.data
}

const getDetail = async () => {
  const res = await projectPreEvaluateDetails(id)
  loading.value = false
  if(res?.code !== 200) return
  console.log(res)
  const projectInfo = list.find(item => item.projectNo === res.data.projectNo)
  inheritAttr(projectInfo, form)
  nextTick(() => {
    proxy.$refs.controlRef.getDetail(res.data.evaluateAssessControllerItemSaveRequestList)
    proxy.$refs.markRef.getDetail(res.data.evaluateAssessGradeItemSaveRequestList)
  })
}
onMounted(async () => {
  await getList()
  if(id) getDetail()
})
</script>

<style lang="scss" scoped>
.box-card {
  .card-header {
    font-weight: 700;
    font-size: 18px;
  }

  ::v-deep(.form) {
    .el-form-item {
      margin-bottom: 5px;
    }
  }
}
.tabs {
  margin-top: 20px;
  ::v-deep(.el-tabs) {
    border-radius: 4px;
    box-shadow: 0px 0px 12px rgba(0, 0, 0, .12);
    border: 1px solid #e4e7ed;
    .el-tabs__header {
      background-color: #fff !important;
      font-size: 18px;
      .el-tabs__item {
        height: 48px !important;
        line-height: 48px !important;
        font-size: 16px;
      }
    }
  }
}
</style>