添加关照、全局等高线、修改图层问题

This commit is contained in:
2025-07-17 18:54:05 +08:00
parent c781d38c0c
commit b274b62671
4594 changed files with 791769 additions and 4921 deletions

View File

@ -0,0 +1,437 @@
<template>
<div class="model">
<div class="model-btn">
<el-button @click="createLib('model')" type="warning" size="small">
{{ $t("headerTitles.model.createModelLibrary") }}
</el-button>
<el-button @click="selectLib('model')" type="primary" size="small">
{{ $t("headerTitles.model.selectModelLibrary") }}
</el-button>
<el-button @click="addModelTypeF" :disabled="importModelEnable()" type="success" size="small">
{{ $t("headerTitles.model.addModelType") }}
</el-button>
<el-tooltip class="item" effect="dark" content="选中了类型为其上级,未选中则为根目录" placement="right">
<i class="el-icon-question" style="color: #b6e4ff" title="7"></i>
</el-tooltip>
<el-button @click="addModelF" :disabled="importModelEnable()" type="success" size="small">
{{ $t("headerTitles.model.importModel") }}
</el-button>
<el-button style="margin-left: 10px" @click="editModelTypes()" type="warning" size="small">
{{ $t("headerTitles.model.editModel") }}
</el-button>
<el-button @click="delModelTypes()" type="warning" size="small">
{{ $t("headerTitles.model.deleteModel") }}
</el-button>
</div>
<div class="model-content">
<div class="model-tree">
<div class="modelType " style="position: relative;">
<template v-if="modelLoading">
<div class="parentBox">
<div class="containerBox">
<div class="canvasBox">
<div class="spinnerSexBox p1"></div>
<div class="spinnerSexBox p2"></div>
<div class="spinnerSexBox p3"></div>
<div class="spinnerSexBox p4"></div>
</div>
</div>
</div>
</template>
<template v-else>
<div style="font-size: 16px;margin-left: 4px;margin-top: 4px">
类型列表
</div>
<div class="typeBox custom_scroll_bar">
<template v-if="modelTypeList.length > 0">
<el-tree :data="modelTypeList" :props="modelLabelProps" :expand-on-click-node="false"
ref="myTree" node-key="type_id" highlight-current accordion
@node-click="modelLabelClick">
</el-tree>
</template>
<template v-else>
无军标类型<br />请先添加军标类型
</template>
</div>
</template>
</div>
</div>
<div class="model-table">
<el-table border :data="modelTableData" style="width: 95%" :row-class-name="tableRowClassName">
<el-table-column type="index" label="序号" width="35" align="center">
</el-table-column>
<el-table-column prop="model_name" label="名称" :width="calcsWidth({ label: '名称' })" align="center">
</el-table-column>
<el-table-column label="缩略图" width="110" align="center">
<template slot-scope="scope">
<el-image style="width: 40px; height: 40px"
:src="scope.row.poster_url + '?' + Math.random()"
:preview-src-list="[scope.row.poster_url]">
</el-image>
</template>
</el-table-column>
<el-table-column prop="type" label="操作" align="center">
<template slot-scope="scope">
<el-button @click="preview(scope.row)" type="warning" size="mini">
{{ $t("headerTitles.model.preview") }}
</el-button>
<el-button @click="updatePoster1(scope.row)" type="warning" size="mini">
{{ $t("headerTitles.model.updatePoster") }}
</el-button>
<el-button @click="delModel(scope.row.model_id)" type="danger" size="mini">
{{ $t("headerTitles.model.deleteModel") }}
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="model-url">
</div>
</div>
</template>
<script>
import { addModel, createModel, importModel, getModelType, addModelType, editModelType, delModelType, updatePoster, delModel } from '../../../../../api/gisAPI';
import { calcWidth } from "@/utils";
export default {
name: 'model',
data() {
return {
modelLoading: false,
selectedModelType: '',
modelTypeList: [],
modelTableData: [],
modelLabelProps: {
id: "type_id",
children: "sonNode",
label: "type_name",
}
};
},
mounted() {
this.getModelTypeList()
},
methods: {
getModelTypeList() {
getModelType((res) => {
console.log("", res);
this.modelTypeList = res.list;
setTimeout(() => {
this.modelLoading = false;
});
this.selectedModelType = res.list.length ? res.list[0].type_id : "";
this.modelTableData = res.list.length ? res.list[0].children : [];
});
},
// 创建模型库
createLib() {
let option = {
title: "创建模型库",
filename: "YJEarth.model",
filters: [{ name: "保存库文件", extensions: ["model"] }],
};
this.$sendElectronChanel("saveFile", option);
this.$recvElectronChanel("selectedFileItem", (e, path) => {
console.log(path);
if (path) {
let index = path.lastIndexOf("/");
let model_lib_path = path.slice(0, index);
let model_lib_name = path.slice(index + 1);
createModel({ model_lib_name, model_lib_path }, (res) => {
this.initModelData(path);
});
}
});
},
// 创建模型
initModelData(path) {
this.modelLoading = true;
importModel({ model_lib_path: path }, (res) => {
this.$store.dispatch("changeModelLibPath", path);
this.getModelTypeList();
});
},
// 模型库选择
selectLib() {
let option = {
properties: ["openFile"],
filters: [
{
name: '模型库', //、底图
extensions: ['model'],
},
],
};
this.$sendElectronChanel("open-directory-dialog", option);
this.$recvElectronChanel("selectedItem", (e, path) => {
if (path.length) this.initModelData(path[0]);
});
},
// 模型类型选择
addModelF() {
// 需获取模型列表后,并选中一项后
if (this.selectedModelType) {
let option = {
properties: ["openFile", "multiSelections"],
filters: [
{
name: "人工模型",
extensions: ["glb", "gltf"],
},
],
};
this.$sendElectronChanel("open-directory-dialog", option);
this.$recvElectronChanel("selectedItem", (e, paths) => {
if (paths.length) {
addModel(
{ model_paths: paths, p_id: this.selectedModelType },
(res) => {
this.getModelTypeList();
}
);
}
});
} else this.$message.warning("请选择一项类型");
},
addModelTypeF() {
this.$prompt("请输入模型类型", "添加模型类型", {
confirmButtonText: "确定",
inputPattern: /^[^\s]+$/,
inputErrorMessage: "请输入非空字符串",
cancelButtonText: "取消",
}).then(({ value }) => {
addModelType({ type_name: value }, (res) => {
this.modelTypeList.push({
type_name: value,
type_id: res.type_id,
children: [],
});
});
}).catch(() => {
/*this.$message({
type: 'info',
message: '取消输入'
});*/
});
},
//删除模型类型
delModelTypes() {
if (!this.selectedModel) {
this.$message.warning("请选择模型节点!");
return;
}
let type_id = this.selectedModel.type_id;
this.$confirm("此操作会删除该类型及其对应的模型,是否继续?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then((res) => {
delModelType({ type_id }, (res) => {
this.modelTypeList = this.modelTypeList.filter(
(item) => item.type_id !== type_id
);
this.modelTableData = [];
});
}).catch(() => { });
},
// 模型类型编辑
//编辑模型类型
editModelTypes() {
if (!this.selectedModel) {
this.$message.warning("请选择模型节点!");
return;
}
let type_id = this.selectedModel.type_id,
type_name = this.selectedModel.type_name;
this.$prompt("请输入模型类型", "修改模型类型", {
confirmButtonText: "确定",
cancelButtonText: "取消",
inputValue: type_name,
}).then(({ value }) => {
editModelType({ type_name: value, type_id }, (res) => {
this.modelTypeList.forEach((item) => {
if (item.type_id == type_id) {
item.type_name = value;
}
});
});
}).catch(() => {
/*this.$message({
type: 'info',
message: '取消输入'
});*/
});
},
// 树节点点击事件
modelLabelClick(data, event) {
if (this.selectedGraphLabelType == data.type_id) {
this.graphTableData = [];
this.$nextTick(() => {
this.$refs.myTree && this.$refs.myTree.setCurrentKey(null);
});
this.selectedGraphLabelType = null;
} else {
this.selectedGraphLabelType = data.type_id;
this.graphTableData = data.children || [];
}
},
// 预览
preview(row) {
this.$changeComponentShow("#scene", true);
this.$sendChanel("openView3d", row);
},
// 更新图片
updatePoster1(row, flag = false, path = "") {
let that = this;
console.log("row++++++++++++++++++++++");
console.log(path);
console.log(row);
let cb = (c) => {
let formData = new FormData();
formData.append("model_id", row.model_id);
formData.append("file", c);
updatePoster(formData)
.then((res) => {
if ([0, 200].includes(res.code)) {
that.$message({
type: "success",
message: "更新成功",
});
row.poster_url = "";
console.log("row.poster_url", res.data.url);
this.$nextTick(() => {
row.poster_url = res.data.url + "?" + Math.random();
});
this.$sendChanel("updatePosterComplete", res);
}
})
.catch((err) => {
console.log(err);
this.$sendChanel("updatePosterComplete", err);
});
};
if (!flag) {
let option = {
properties: ["openFile"],
filters: [
{
name: "图片",
extensions: ["png", "jpg", "jpeg"],
},
],
};
this.$sendElectronChanel("open-directory-dialog", option);
this.$recvElectronChanel("selectedItem", (e, paths) => {
if (paths.length) {
console.log(paths[0]);
// 取出路径中的文件名
let name = getNamefromPath(paths[0]);
// 读取文件
fs.readFile(paths[0], (err, data) => {
const blob = new Blob([data], {
type: "image/png, image/jpeg, image/jpg",
});
var file = new File([blob], `${name}` + ".png");
cb(file);
});
// cb(paths[0]);
}
});
} else {
cb(path);
}
},
delModelF(model_id) {
let msg = "确定删除?";
this.$confirm(msg, "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then((res) => {
delModel({ model_id }, (res) => {
//刷新当前页
this.modelTableData = this.modelTableData.filter(
(item) => item.model_id !== model_id
);
this.getModelTypeList();
});
}).catch(() => { });
},
importModelEnable() {
return ["", null, "null"].includes(this.modelLibPath);
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex === 1) {
return "warning-row";
} else if (rowIndex === 3) {
return "success-row";
}
return "";
},
calcsWidth(row) {
return calcWidth(row);
},
},
};
</script>
<style lang="scss">
.model-content {
display: flex;
.model-table{
flex: 1;
}
}
.model-btn{
margin-bottom: 10px;
}
.modelList {
display: flex;
.modelType {
background: #fff;
width: 150px;
.typeBox {
margin-top: 5px;
height: 250px;
overflow-y: auto;
.typeItem {
padding: 3px 0 3px 10px;
color: #0c0d0e;
display: flex;
align-items: center;
justify-content: space-between;
.label {
width: 70%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.btns {
cursor: pointer;
}
}
}
.selectedModelTypeCss {
background: rgba(230, 242, 255, 0.93);
.label {
color: #409eff !important;
}
}
}
}
</style>

View File

@ -279,12 +279,13 @@
<el-tab-pane :label="$t('headerTitles.equipment.title')">
<equipment />
</el-tab-pane>
<!-- 无人机配置 -->
<!-- 无人机配置 v-if="false" -->
<el-tab-pane v-if="false" :label="$t('headerTitles.air.title')">
<Air />
</el-tab-pane>
<!-- 模型管理 -->
<el-tab-pane :label="$t('headerTitles.model.title')">
<!-- <model></model> -->
<div class="modelBtn custom_scroll_bar" v-if="isStandAlone">
<el-button @click="createLib('model')" type="warning" size="small">{{
$t("headerTitles.model.createModelLibrary") }}
@ -486,124 +487,6 @@
</template>
</div>
</el-tab-pane>
<!-- <el-tab-pane :label="$t('headerTitles.graphLabel.title')">
<div class="modelBtn">
<el-button @click="createModel" type="warning" size="small">{{
$t('headerTitles.model.createModelLibrary')
}}
</el-button>
<el-button @click="selectModel" type="primary" size="small">{{
$t('headerTitles.model.selectModelLibrary')
}}
</el-button>
<el-button @click="addModel" :disabled="importModelEnable()" type="success" size="small">
{{ $t('headerTitles.model.importModel') }}
</el-button>
<el-button @click="addModelType" :disabled="importModelEnable()" type="success" size="small">
{{ $t('headerTitles.model.addModelType') }}
</el-button>
</div>
<div class="modelList">
<div class="modelType ">
<div style="font-size: 16px;margin-left: 4px;margin-top: 4px">类型列表:</div>
<div class="typeBox custom_scroll_bar">
<template v-if="modelTypeList.length">
<template v-for="item in modelTypeList">
<div :class="[selectedModelType==item.type_id?'selectedModelTypeCss':'','typeItem']"
@click="selectedModelType=item.type_id">
<div class="label" :title="item.type_name">{{ item.type_name }}</div>
<div class="btns">
<i class="el-icon-edit" style="color: #409eff" @click="editModelTypes(item)"></i>
<i class="el-icon-delete" style="color:#f00;" @click="delModelTypes(item)"></i>
</div>
</div>
</template>
</template>
<template v-else>
无模型类型,<br>请先添加模型类型
</template>
</div>
</div>
<el-table
border
:data="modelTableData"
style="width: 100%"
:row-class-name="tableRowClassName">
<el-table-column
type="index"
label="序号"
width="35"
align="center"
>
</el-table-column>
<el-table-column
prop="model_name"
label="名称"
:width="calcsWidth({label:'名称'})"
align="center"
>
</el-table-column>
&lt;!&ndash; <el-table-column
prop="model_type"
label="类型"
width="60"
align="center"
>
</el-table-column>&ndash;&gt;
<el-table-column
label="缩略图"
width="110"
align="center">
<template slot-scope="scope">
&lt;!&ndash; :title="scope.row.poster_url"&ndash;&gt;
&lt;!&ndash; <img :src="scope.row.poster_url">&ndash;&gt;
<el-image
style="width: 40px; height: 40px"
:src="scope.row.poster_url"
:preview-src-list="[scope.row.poster_url]">
</el-image>
</template>
</el-table-column>
<el-table-column
prop="type"
label="操作"
align="center"
>
<template slot-scope="scope">
<el-button @click="updatePoster(scope.row)" type="warning" size="mini">
{{ $t('headerTitles.model.updatePoster') }}
</el-button>
<el-button type="primary" size="mini">{{ $t('headerTitles.model.updateModel') }}</el-button>
<el-button @click="delModel(scope.row.model_id)" type="danger" size="mini">
{{ $t('headerTitles.model.deleteModel') }}
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="modelLibPath ">
&lt;!&ndash; <el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
style="align-self: center;"
:current-page="modelListPage"
:page-sizes="[5,10,20,30]"
:page-size="modelListPageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="modelTotal">
</el-pagination>&ndash;&gt;
&lt;!&ndash; </div>&ndash;&gt;
<span class="oneLine" :title="modelLibPath">
模型库地址:{{ modelLibPath }}
</span>
</el-tab-pane> -->
<!-- 军标管理 -->
<!-- v-if="false" 标准版本 -->
<el-tab-pane :label="$t('headerTitles.graphLabel.title')">
@ -651,26 +534,8 @@
</div>
<div class="typeBox custom_scroll_bar">
<template v-if="graphLabelTypeList.length > 0">
<!-- <template v-for="item in graphLabelTypeList">
<div :class="[selectedGraphLabelType==item.type_id?'selectedModelTypeCss':'','typeItem']"
@click="selectedGraphLabelType=item.type_id">
<div class="label" :title="item.type_name">{{ item.type_name }}</div>
<div class="btns">
<i class="el-icon-edit" style="color: #409eff" @click="editGraphLabelTypes(item)"></i>
<i class="el-icon-delete" style="color:#f00;" @click="delGraphLabelTypes(item)"></i>
</div>
</div>
</template>-->
<el-tree :data="graphLabelTypeList" :props="graphLabelProps" :expand-on-click-node="false"
ref="myTree" node-key="type_id" highlight-current accordion @node-click="graphLabelClick">
<!-- <span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<span style=" position: absolute;right: 5px;">
<i class="el-icon-edit" style="color: #409eff" @click="() =>editGraphLabelTypes(data)"></i>
<i class="el-icon-delete" style="color:#f00;" @click="() =>delGraphLabelTypes(data)"></i>
</span>
</span>-->
</el-tree>
</template>
<template v-else>
@ -842,6 +707,7 @@ import { calcWidth } from "@/utils";
import { validateCommonText } from "@/utils/validate";
import equipment from "../../PLTraffic/components/manager/equipment/equipment";
import Air from "./components/air/index.vue"
// import model from "./components/modelType/index.vue"
// import {baseURL} from "../../../utils/request";
export default {