<template> <div class="water-analysis-page"> <el-table :key="isFlag" :data="tableData" stripe max-height="500" v-loading="tableLoading"> <el-table-column type="index" width="55" label="序号" align="center" /> <el-table-column :label="i.value" align="center" :prop="i.key" show-overflow-tooltip v-for="i in cloums"> <!-- {{ i.key }} --> <template #default="{ row }" v-if="i.key == 'fileList'"> <span v-if="row?.id" style="color: #108ee9; cursor: pointer" @click="FileClick(row)">文件上传</span> <p @click="handlePreview(k)" style="color: #108ee9; cursor: pointer" v-for="k in row.fileList">{{ k.name }}</p> </template> <template #default="{ row }" v-if="i.key == 'reachStandard'"> <!-- {{ row.reachStandard===0?'1':'' }} --> <el-tag round :type="row.reachStandard === '' ? 'warning' : row.reachStandard === 1 ? 'success' : 'error'">{{ row.reachStandard === '' ? '未填报' : row.reachStandard === 1 ? '达标' : '未达标' }}</el-tag> </template> </el-table-column> <el-table-column fixed="right" label="操作" width="250" align="center"> <template #default="{ row }"> <el-button link type="primary" icon="View" @click="onCheck(row)">详情</el-button> </template> </el-table-column> </el-table> <el-dialog v-model="visible" :title="FormList.examineYear + '年材料上传'" :modal-append-to-body="false" :close-on-click-modal="false" width="30%" > <el-form label-width="auto" :rules="projectEstimateRules" inline ref="ruleForm" :model="FormList"> <el-form-item label="文件上传:" prop="fileList"> <ImageFileUpload v-model:saveFileArr="FormList.fileList" :listType="'text'" :refType="'water_logging'" /> </el-form-item> </el-form> <template #footer> <el-button @click="open2" type="primary">保存</el-button> <el-button @click="closed">关闭</el-button> </template> </el-dialog> </div> </template> <script setup> import { defineExpose, defineEmits } from 'vue'; import { getInfo, projectInfoDelete, projectInfoGet, dynamic_page_data_type, dynamic_page_data_typeedit, } from '@/api/waterloggedArea'; import { ElMessage, ElMessageBox } from 'element-plus'; import ImageFileUpload from '@/components/ImageFileUpload'; //图片文件上传 const { proxy } = getCurrentInstance(); const { fund_source, unit_list } = proxy.useDict('fund_source', 'unit_list'); import { reactive } from 'vue'; import { getToken } from '@/utils/auth'; let isFlag = ref(1); const visible = ref(false); const cloums = ref([ { value: '考核年份', key: 'examineYear' }, { value: '消除个数', key: 'removeNum' }, // {value:'雨量mm',key:'examineYear'}, { value: '总数', key: 'totalNum' }, { value: '消除比例%', key: 'actualPercent' }, { value: '目标%', key: 'targetPercent' }, { value: '达标情况', key: 'reachStandard' }, { value: '佐证材料', key: 'fileList' }, ]); const uploadHeader = ref({ Authorization: 'Bearer ' + getToken(), }); const { params } = defineProps(['params']); const FormList = ref({ pageNum: 1, pageSize: 10, title: '', fileList: [], }); const emits = defineEmits(); //动态组件 let dataForm = reactive({ tableData: '', tableDateTwo: '', tableLoading: true, }); let { date, tableData, tableDateTwo, tableLoading } = toRefs(dataForm); //获取列表数据 //搜索 const search = p => { dynamic_page_data_typeM(p); isFlag.value++; }; defineExpose({ search }); // 查看上报数据 const onCheck = (row, ty, t) => { emits('searchClick', { data: row, type: 1 }); }; const dynamic_page_data_typeM = async id => { let { code, data, monitorDynamicTableTitleList, total } = await dynamic_page_data_type(id); tableData.value = data; FormList.value.totals = total; tableLoading.value = false; }; function handlePreview(file) { return ElMessageBox.confirm(`下载此文件: ${file.name}?`).then( () => window.open(file.url), () => false ); } function FileClick(v) { visible.value = true; FormList.value = v; } function open2() { dynamic_page_data_typeedit({ ...FormList.value, ...params }).then(() => { proxy.$modal.msgSuccess('修改成功'); visible.value = false; getDataList(); }); } function closed() { dynamic_page_data_typeM(params); visible.value = false; } onMounted(() => { dynamic_page_data_typeM(params); }); </script> <style lang="scss" scoped> :deep(.el-dialog__body) { height: 520px; overflow: auto; } </style>