项目列表上传DXF文件并显示

This commit is contained in:
Teo
2025-04-23 18:19:47 +08:00
parent 68648072de
commit 0ab7056dd1
8 changed files with 326 additions and 78 deletions

View File

@ -69,12 +69,34 @@
<el-table-column label="开工时间" align="center" prop="onStreamTime" width="120" />
<el-table-column label="打卡范围" align="center" prop="punchRange" />
<el-table-column label="设计总量" align="center" prop="designTotal" />
<el-table-column label="是否上传DXF" align="center" prop="designId" width="140">
<template #default="scope">
<el-link
:type="scope.row.designId ? 'primary' : 'default'"
:disabled="!scope.row.designId"
@click="handleOpenLayer(scope.row)"
v-loading.fullscreen.lock="fullscreenLoading"
>{{ scope.row.designId ? '已上传' : '未上传' }}</el-link
>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180" />
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="260">
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="400">
<template #default="scope">
<el-space>
<el-button link type="primary" icon="FolderOpened" @click="handleShowUpload(scope.row)">导入安全协议书 </el-button>
<file-upload
:limit="1"
:fileSize="200"
:fileType="['dxf']"
v-model:model-value="dxfFile"
uploadUrl="/project/projectFile/upload/dxf"
:data="{ projectId: scope.row.id }"
>
<el-button link type="primary" icon="upload">上传DXF </el-button>
</file-upload>
<el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:project:edit']">修改 </el-button>
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:project:remove']">删除 </el-button>
</el-space>
@ -232,20 +254,26 @@
</div>
</template>
</el-dialog>
<!-- //选取项目地址弹窗 -->
<el-dialog v-model="amapStatus" :title="form.projectName + '-获取经纬度'" width="80%">
<amap height="620px" @setLocation="setPoi"></amap>
<!-- <template #footer>
<div class="dialog-footer">
<el-button v-loading="buttonLoading" type="primary" @click="amapStatus = false"> 确定</el-button>
<el-button @click="amapStatus = false">取消</el-button>
</div>
</template> -->
</el-dialog>
<!-- 选取方阵地址 -->
<el-dialog title="设置方阵" v-model="polygonStatus" width="1400px">
<open-layers-map :tree-data="jsonData" :project-id="projectId"></open-layers-map>
<template #footer>
<span>
<el-button @click="polygonStatus = false">取消</el-button>
<el-button type="primary" @click="">确定</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup name="Project" lang="ts">
import { addProject, delProject, getProject, listProject, updateProject } from '@/api/project/project';
import { addProject, delProject, getProject, listDXFProject, listProject, updateProject } from '@/api/project/project';
import { ProjectForm, ProjectQuery, ProjectVO, locationType } from '@/api/project/project/types';
import amap from '@/components/amap/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -266,10 +294,15 @@ const total = ref(0);
const amapStatus = ref(false);
const queryFormRef = ref<ElFormInstance>();
const projectFormRef = ref<ElFormInstance>();
const polygonStatus = ref(false);
const dxfFile = ref(null);
const projectId = ref<string>('');
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const jsonData = ref(null);
const fullscreenLoading = ref(false);
const initFormData: ProjectForm = {
id: undefined,
@ -426,6 +459,15 @@ const handleShowUpload = (row?: ProjectVO) => {
uploadVisible.value = true;
};
const handleOpenLayer = async (row: ProjectVO) => {
fullscreenLoading.value = true;
const res = await listDXFProject(row.designId);
projectId.value = row.id;
jsonData.value = res.data.layers;
polygonStatus.value = true;
fullscreenLoading.value = false;
};
const updateProjectFile = async () => {
buttonLoading.value = true;
await updateProject(fileUploadParam.value);