- <template>
- <el-dialog
- class="dialog"
- v-model="visible"
- :title="`${opts.text}项目工程预评估`"
- :close-on-click-modal="false"
- width="70%"
- :before-close="close"
- >
- <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">
- <el-select v-model="form.projectNo" placeholder="建设工程" v-if="opts.type === 'add'">
- <el-option
- v-for="item in list"
- :label="item.projectName"
- :value="item.projectNo"
- :key="item.projectNo"
- @click="selectChange(item)"
- />
- </el-select>
- <span v-else>{{ 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" v-if="isSelect">
- <el-tabs v-model="active">
- <el-tab-pane label="控制项" :name="0">
- <Control ref="controlRef" :key="form.projectNo" :project-info="form" :id="id" :opts="opts" />
- </el-tab-pane>
- <el-tab-pane label="评分项" :name="1">
- <Mark ref="markRef" :key="form.projectNo" :project-info="form" :id="id" :opts="opts" />
- </el-tab-pane>
- </el-tabs>
- </div>
- <template #footer v-if="isSelect && opts.type !== 'view'">
- <div class="dialog-footer">
- <div class="btns">
- <el-button type="primary" @click="submit">确定</el-button>
- <el-button type="primary" v-show="form.rowId" @click="handleOk">提交</el-button>
- <el-button @click="close">取消</el-button>
- </div>
- </div>
- </template>
- </el-dialog>
- </template>
-
- <script setup>
- import { ref, reactive, onMounted, toRef, computed, nextTick } from 'vue';
- import Control from './control.vue';
- import Mark from './mark.vue';
- import {
- getFacilitiesStandardCalcList,
- projectPreEvaluateAdd,
- projectPreEvaluateDetails,
- projectPreEvaluateSubmit,
- } from '@/api/preassess/evaluation';
- import { inheritAttr } from '@/utils/v3';
- const { proxy } = getCurrentInstance();
- const emit = defineEmits(['update:modelValue', 'close']);
- const props = defineProps({
- id: {
- type: [String, Number],
- default: '',
- },
- opts: {
- type: Object,
- default: () => {},
- },
- modelValue: {
- type: Boolean,
- default: false,
- },
- });
- const { id, opts } = props;
-
- const { build_category } = proxy.useDict('build_category');
- const { drainage_partition } = proxy.useDict('drainage_partition');
- const { sponge_engineering_type } = proxy.useDict('sponge_engineering_type');
- const dicts = {
- build_category,
- drainage_partition,
- sponge_engineering_type,
- };
- const findText = (prop, type) => {
- const item = dicts[prop].value.find(it => it.value === type);
- return item?.label || '';
- };
- const isShowDialog = toRef(props, 'modelValue');
- const visible = computed({
- get() {
- return isShowDialog.value;
- },
- set(value) {
- emit('update:modelValue', value);
- },
- });
-
- const form = reactive({
- id: '',
- rowId: id,
- projectNo: '',
- projectName: '',
- buildCategory: '',
- engineeringType: '',
- drainagePartition: '',
- targetAnnualRunoffTotalControlRate: '',
- targetAnnualRunoffPollutionControlRate: '',
- storageCapacityStandards: '',
- pollutionRemovalStandards: '',
- });
- const active = ref(0);
- const list = ref([]);
-
- const standardMap = new Map([
- [0, { text: '否', type: 'danger' }],
- [1, { text: '是', type: 'success' }],
- ]);
-
- const isSelect = ref(false);
- const isSubmit = ref(false);
-
- const close = () => {
- visible.value = false;
- emit('close', {
- type: opts.type,
- isSubmit: isSubmit.value,
- });
- };
-
- const submit = async () => {
- console.log('submit!!!');
- const params = {
- id: form.rowId,
- calcId: form.id,
- projectNo: form.projectNo,
- evaluateAssessControllerItemSaveRequestList: proxy.$refs.controlRef.treeData,
- evaluateAssessGradeItemSaveRequestList: proxy.$refs.markRef.treeData,
- };
- const res = await projectPreEvaluateAdd(params);
- if (res?.code !== 200) return;
- if (!form.rowId) form.rowId = res.data;
- isSubmit.value = true;
- proxy.$modal.msgSuccess('操作成功');
- };
-
- const handleOk = async () => {
- const formData = new FormData();
- formData.append('id', form.rowId);
- const res = await projectPreEvaluateSubmit(formData);
- if (res?.code !== 200) return;
- isSubmit.value = true;
- proxy.$modal.msgSuccess('操作成功');
- close();
- };
-
- const selectChange = item => {
- isSelect.value = true;
- inheritAttr(item, form);
- active.value = 0;
- };
-
- const getList = async () => {
- const res = await getFacilitiesStandardCalcList({ status: '2' });
- if (res?.code !== 200) return;
- list.value = res.data;
- };
-
- const getDetail = async () => {
- const res = await projectPreEvaluateDetails(id);
- if (res?.code !== 200) return;
- console.log(res);
- const projectInfo = list.value.find(item => item.projectNo === res.data.projectNo);
- selectChange(projectInfo);
- 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;
- }
-
- :deep(.form) {
- .el-form-item {
- margin-bottom: 5px;
- }
- }
- }
- </style>