|
@@ -2,27 +2,9 @@
|
|
|
<div class="body-head">
|
|
|
<h3 style="visibility: hidden">场景管理</h3>
|
|
|
|
|
|
- <el-tooltip
|
|
|
- class="item"
|
|
|
- effect="dark"
|
|
|
- :content="`请上传${format}(支持obj/ply/las/laz/b3dm格式的数据),大小在${size}以内 `"
|
|
|
- placement="bottom-start"
|
|
|
- ><el-upload
|
|
|
- class="upload-demo"
|
|
|
- :multiple="false"
|
|
|
- :limit="1"
|
|
|
- :accept="accept"
|
|
|
- :show-file-list="false"
|
|
|
- :http-request="() => {}"
|
|
|
- :file-list="fileList"
|
|
|
- :disabled="percentage || !operateIsPermissionByPath('sync')"
|
|
|
- :before-upload="uploadCheck"
|
|
|
- >
|
|
|
- <el-button v-pdpath="'sync'" type="primary">
|
|
|
- <el-icon><Upload /></el-icon>{{ percentage ? "文件上传中" : "上传数据" }}
|
|
|
- </el-button>
|
|
|
- </el-upload>
|
|
|
- </el-tooltip>
|
|
|
+ <el-button @click="uploadHandler" v-pdpath="'sync'" type="primary">
|
|
|
+ <el-icon><Upload /></el-icon>{{ "上传数据" }}
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
|
|
|
<el-table
|
|
@@ -40,10 +22,26 @@
|
|
|
<el-table-column label="原始数据格式" prop="modelDateType"></el-table-column>
|
|
|
<el-table-column label="大小" prop="modelSize"></el-table-column>
|
|
|
<el-table-column label="上传时间" v-slot:default="{ row }: { row: ModelScene }">
|
|
|
- {{ getStatusText(row) }}
|
|
|
+ {{ row.createTime }}
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="状态" v-slot:default="{ row }: { row: ModelScene }">
|
|
|
+ {{
|
|
|
+ row.uploadStatus !== UploadStatus.SUCCESS && row.uploadStatus !== null
|
|
|
+ ? "上传失败"
|
|
|
+ : getStatusText(row)
|
|
|
+ }}
|
|
|
</el-table-column>
|
|
|
+
|
|
|
<el-table-column label="所属架构" prop="deptName"></el-table-column>
|
|
|
<el-table-column label="操作" v-slot:default="{ row }" width="350px">
|
|
|
+ <span
|
|
|
+ class="oper-span"
|
|
|
+ @click="contineUpload(row)"
|
|
|
+ v-if="row.uploadStatus !== UploadStatus.SUCCESS && row.uploadStatus !== null"
|
|
|
+ >
|
|
|
+ 继续上传
|
|
|
+ </span>
|
|
|
+
|
|
|
<template v-if="row.createStatus === ModelSceneStatus.SUCCESS">
|
|
|
<span class="oper-span" @click="downOrigin(row)" v-if="row.fileNewName">
|
|
|
下载原始资源
|
|
@@ -73,15 +71,6 @@
|
|
|
<span v-else class="oper-span" v-pdpath="['viewaaa']"> 模型转换中… </span>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
-
|
|
|
- <el-dialog
|
|
|
- :model-value="!!percentage"
|
|
|
- :show-close="false"
|
|
|
- title="文件上传中"
|
|
|
- :close-on-click-modal="false"
|
|
|
- >
|
|
|
- <el-progress :percentage="percentage" />
|
|
|
- </el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
@@ -89,36 +78,35 @@ import {
|
|
|
ModelSceneStatus,
|
|
|
ModelScene,
|
|
|
cancelUploadModelScene,
|
|
|
- uploadModelScene,
|
|
|
delModelScene,
|
|
|
- getModelSceneStatus,
|
|
|
copyModelScene,
|
|
|
downModelSceneHash,
|
|
|
+ UploadStatus,
|
|
|
} from "@/store/scene";
|
|
|
-import {
|
|
|
- ModelMaxSize,
|
|
|
- ModelSceneStatusDesc,
|
|
|
- ModelSupportFormats,
|
|
|
-} from "@/constant/scene";
|
|
|
+import { ModelSceneStatusDesc } from "@/constant/scene";
|
|
|
import { confirm } from "@/helper/message";
|
|
|
-import { useUpload } from "@/hook/upload";
|
|
|
import { ScenePagging } from "./pagging";
|
|
|
-import { watchPolling } from "@/hook/watchPolling";
|
|
|
import { OpenType, openSceneUrl } from "../case/help";
|
|
|
-import { operateIsPermissionByPath } from "@/directive/permission";
|
|
|
-import { editModelScene } from "./quisk";
|
|
|
+import { editModelScene, uploadScene } from "./quisk";
|
|
|
import saveAs from "@/util/file-serve";
|
|
|
+import { watchEffect } from "vue";
|
|
|
|
|
|
const props = defineProps<{ pagging: ScenePagging }>();
|
|
|
|
|
|
const getStatusText = (scene: ModelScene) => {
|
|
|
let desc = ModelSceneStatusDesc[scene.createStatus];
|
|
|
- if (scene.createStatus === ModelSceneStatus.RUN && scene.progress) {
|
|
|
- desc += ` ${scene.progress}% `;
|
|
|
- } else if (scene.createStatus === ModelSceneStatus.SUCCESS) {
|
|
|
- desc = scene.createTime;
|
|
|
- }
|
|
|
return desc;
|
|
|
+ // if (scene.createStatus === ModelSceneStatus.RUN && scene.progress) {
|
|
|
+ // desc += ` ${scene.progress}% `;
|
|
|
+ // } else if (scene.createStatus === ModelSceneStatus.SUCCESS) {
|
|
|
+ // desc = scene.createTime;
|
|
|
+ // }
|
|
|
+ // return desc;
|
|
|
+};
|
|
|
+
|
|
|
+const uploadHandler = async () => {
|
|
|
+ await uploadScene({ type: props.pagging.state.query.type });
|
|
|
+ props.pagging.refresh();
|
|
|
};
|
|
|
|
|
|
const delOrCancel = async (scene: ModelScene) => {
|
|
@@ -131,6 +119,17 @@ const delOrCancel = async (scene: ModelScene) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const contineUpload = async (row: ModelScene) => {
|
|
|
+ await uploadScene({
|
|
|
+ type: props.pagging.state.query.type,
|
|
|
+ name: row.modelTitle,
|
|
|
+ fileType: row.fileType,
|
|
|
+ oldMd5: row.fileMd5,
|
|
|
+ id: row.id,
|
|
|
+ });
|
|
|
+ props.pagging.refresh();
|
|
|
+};
|
|
|
+
|
|
|
const editHanlder = async (scene: ModelScene) => {
|
|
|
if (await editModelScene({ model: scene })) {
|
|
|
props.pagging.refresh();
|
|
@@ -146,47 +145,47 @@ const downHash = async (scene: ModelScene) => {
|
|
|
downModelSceneHash(scene);
|
|
|
};
|
|
|
|
|
|
-const {
|
|
|
- percentage,
|
|
|
- upload: uploadCheck,
|
|
|
- fileList,
|
|
|
- size,
|
|
|
- format,
|
|
|
- removeFile,
|
|
|
- accept,
|
|
|
-} = useUpload({
|
|
|
- maxSize: ModelMaxSize,
|
|
|
- formats: ModelSupportFormats,
|
|
|
- upload: async (file, onPercentage) => {
|
|
|
- try {
|
|
|
- await uploadModelScene(file, onPercentage);
|
|
|
- props.pagging.refresh();
|
|
|
- } catch {}
|
|
|
- removeFile();
|
|
|
- },
|
|
|
-});
|
|
|
-
|
|
|
-// 处理后台正在处理的模型类
|
|
|
-const refreshStatus = (models: ModelScene[]) => {
|
|
|
- const refreshStatusAll = models.map(async (scene) => {
|
|
|
- const { status, progress } = await getModelSceneStatus(scene);
|
|
|
- scene.createStatus = status;
|
|
|
- scene.progress = progress;
|
|
|
- if (status == ModelSceneStatus.SUCCESS) {
|
|
|
- props.pagging.refresh();
|
|
|
- }
|
|
|
- });
|
|
|
- return Promise.all(refreshStatusAll);
|
|
|
-};
|
|
|
-
|
|
|
const downOrigin = async (model: ModelScene) => {
|
|
|
await saveAs(model.fileNewName, model.modelTitle + ".zip");
|
|
|
};
|
|
|
|
|
|
-watchPolling(() => {
|
|
|
- const payload = (props.pagging.state.table.rows as ModelScene[]).filter(
|
|
|
- (item) => item.createStatus === ModelSceneStatus.RUN
|
|
|
- );
|
|
|
- return { start: payload.length > 0, payload };
|
|
|
-}, refreshStatus);
|
|
|
+// 自动刷新状态
|
|
|
+let timeout: any;
|
|
|
+watchEffect(() => {
|
|
|
+ clearTimeout(timeout);
|
|
|
+ const rows = props.pagging.state.table.rows as ModelScene[];
|
|
|
+ const calcIng = rows.some((row) => {
|
|
|
+ if (row.uploadStatus !== UploadStatus.SUCCESS) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ row.createStatus === ModelSceneStatus.RUN ||
|
|
|
+ row.createStatus === ModelSceneStatus.REV
|
|
|
+ );
|
|
|
+ });
|
|
|
+ if (calcIng) {
|
|
|
+ timeout = setTimeout(() => {
|
|
|
+ props.pagging.refresh();
|
|
|
+ }, 5000);
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+// // 处理后台正在处理的模型类
|
|
|
+// const refreshStatus = (models: ModelScene[]) => {
|
|
|
+// const refreshStatusAll = models.map(async (scene) => {
|
|
|
+// const { status, progress } = await getModelSceneStatus(scene);
|
|
|
+// scene.createStatus = status;
|
|
|
+// scene.progress = progress;
|
|
|
+// if (status == ModelSceneStatus.SUCCESS) {
|
|
|
+// props.pagging.refresh();
|
|
|
+// }
|
|
|
+// });
|
|
|
+// return Promise.all(refreshStatusAll);
|
|
|
+// };
|
|
|
+// watchPolling(() => {
|
|
|
+// const payload = (props.pagging.state.table.rows as ModelScene[]).filter(
|
|
|
+// (item) => item.createStatus === ModelSceneStatus.RUN
|
|
|
+// );
|
|
|
+// return { start: payload.length > 0, payload };
|
|
|
+// }, refreshStatus);
|
|
|
</script>
|