fix: BUG修改

This commit is contained in:
kun 2023-11-29 18:42:04 +08:00
parent 9469bc022b
commit 5eb552b86e
5 changed files with 76 additions and 27 deletions

View File

@ -142,3 +142,13 @@ export const gltfModelEdit = (params: any) => {
export const gltfModelDelete = (params: any) => { export const gltfModelDelete = (params: any) => {
return http.post(BASEURL + `/base/gltfModel/delete`, params); return http.post(BASEURL + `/base/gltfModel/delete`, params);
}; };
// 设备样式
// 样式查询
export const equipmentStyleGet = (params: any) => {
return http.post(BASEURL + `/base/deviceConfig/queryById`, params);
};
// 样式编辑
export const equipmentStyleEdit = (params: any) => {
return http.post(BASEURL + `/base/deviceConfig/edit`, params);
};

View File

@ -14,7 +14,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { CSSProperties } from "vue"; import type { CSSProperties } from "vue";
import { ref } from "vue"; import { ref, watch } from "vue";
import { Codemirror } from "vue-codemirror"; import { Codemirror } from "vue-codemirror";
import { vue } from "@codemirror/lang-vue"; import { vue } from "@codemirror/lang-vue";
import { oneDark } from "@codemirror/theme-one-dark"; import { oneDark } from "@codemirror/theme-one-dark";
@ -42,7 +42,7 @@ const props = withDefaults(defineProps<Props>(), {
// tabSize: 2 // tabSize: 2
}); });
const extensions = props.dark ? [vue(), oneDark] : [vue()]; const extensions = props.dark ? [vue(), oneDark] : [vue()];
const codeValue = ref(props.code); const codeValue = ref();
const emits = defineEmits(["update:code", "ready", "change", "focus", "blur"]); const emits = defineEmits(["update:code", "ready", "change", "focus", "blur"]);
function handleReady(payload: any) { function handleReady(payload: any) {
// console.log('ready') // console.log('ready')
@ -58,6 +58,12 @@ function onFocus(viewUpdate: any) {
function onBlur(viewUpdate: any) { function onBlur(viewUpdate: any) {
emits("blur", viewUpdate); emits("blur", viewUpdate);
} }
watch(
() => props.code,
n => {
codeValue.value = n;
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -2,6 +2,10 @@
<div class="map-content" id="map-content"> <div class="map-content" id="map-content">
<div id="mars3dContainer" class="mars3d-container"></div> <div id="mars3dContainer" class="mars3d-container"></div>
<div class="layer-config" v-if="props.type == '底图'"> <div class="layer-config" v-if="props.type == '底图'">
<div class="property-column-item">
<span>透明度{{ formData.opacity ? formData.opacity : 1 }}</span>
<el-slider v-model="formData.opacity" :step="0.1" :max="1" :min="0" @change="e => layerOperate(e, 'opacity')" />
</div>
<div class="property-column-item"> <div class="property-column-item">
<span>饱和度{{ formData.saturation ? formData.saturation : 0 }}</span> <span>饱和度{{ formData.saturation ? formData.saturation : 0 }}</span>
<el-slider v-model="formData.saturation" :step="0.5" :max="5" :min="-5" @change="e => layerOperate(e, 'saturation')" /> <el-slider v-model="formData.saturation" :step="0.5" :max="5" :min="-5" @change="e => layerOperate(e, 'saturation')" />
@ -22,10 +26,10 @@
<span>伽马校正{{ formData.gamma ? formData.gamma : 0 }}</span> <span>伽马校正{{ formData.gamma ? formData.gamma : 0 }}</span>
<el-slider v-model="formData.gamma" :step="0.5" :max="5" :min="-5" @change="e => layerOperate(e, 'gamma')" /> <el-slider v-model="formData.gamma" :step="0.5" :max="5" :min="-5" @change="e => layerOperate(e, 'gamma')" />
</div> </div>
<div class="property-row-item"> <!-- <div class="property-row-item">
<span>是否反色</span> <span>是否反色</span>
<el-switch v-model="formData.invertColor" @change="e => layerOperate(e, 'invertColor')" /> <el-switch v-model="formData.invertColor" @change="e => layerOperate(e, 'invertColor')" />
</div> </div> -->
<div class="property-row-item"> <div class="property-row-item">
<span>滤镜颜色{{ formData.filterColor ? formData.filterColor : "" }}</span> <span>滤镜颜色{{ formData.filterColor ? formData.filterColor : "" }}</span>
<el-color-picker v-model="formData.filterColor" @change="e => layerOperate(e, 'filterColor')" /> <el-color-picker v-model="formData.filterColor" @change="e => layerOperate(e, 'filterColor')" />
@ -411,8 +415,6 @@ const layerOperate = (e: any, label: any) => {
thisLayer.layer[label] = Cesium.Color.fromCssColorString("#FBFBFB"); thisLayer.layer[label] = Cesium.Color.fromCssColorString("#FBFBFB");
// thisLayer.layer[label] = "#FBFBFB"; // thisLayer.layer[label] = "#FBFBFB";
} }
} else if (label == "invertColor") {
thisLayer.layer[label] = e;
} else { } else {
thisLayer[label] = e; thisLayer[label] = e;
} }
@ -513,16 +515,28 @@ const getBaseMapsInfo = async () => {
id: props.relativeId id: props.relativeId
}; };
const { result }: { result: any } = await baseMapDetails(requestData); const { result }: { result: any } = await baseMapDetails(requestData);
console.log(result);
if (result) { if (result) {
formData.value = { ...result }; formData.value = { ...result, opacity: result.opacity && result.opacity == 0 ? result.opacity : 1 };
configJson.value.basemaps = [ configJson.value.basemaps = [
{ {
id: result.id, id: result.id,
name: result.name, name: result.name,
...JSON.parse(result.layer), ...JSON.parse(result.layer),
brightness: result.brightness,
contrast: result.brightness,
filterColor: result.filterColor
? Cesium.Color.fromCssColorString(result.filterColor)
: Cesium.Color.fromCssColorString("#FBFBFB"),
briggammahtness: result.gamma,
hue: result.hue,
// invertColor: result.invertColor,
saturation: result.saturation,
opacity: result.opacity && result.opacity == 0 ? result.opacity : 1,
show: true show: true
} }
]; ];
configJson.value.scene.center = { lat: 26.502888, lng: 106.174716, alt: 17036414, heading: 0, pitch: -90 };
initMars3d(configJson.value); initMars3d(configJson.value);
} }
}; };

View File

@ -8,7 +8,7 @@
<div :class="operateIndex == 0 ? 'active-btn' : ''" @click="operateIndex = 0">基础配置</div> <div :class="operateIndex == 0 ? 'active-btn' : ''" @click="operateIndex = 0">基础配置</div>
<div :class="operateIndex == 1 ? 'active-btn' : ''" @click="operateIndex = 1">设备列表</div> <div :class="operateIndex == 1 ? 'active-btn' : ''" @click="operateIndex = 1">设备列表</div>
</div> </div>
<div class="basic-config" v-if="operateIndex == 0"> <div class="basic-config" v-show="operateIndex == 0">
<!-- <div class="switch-content"> <!-- <div class="switch-content">
<div> <div>
<span>是否启用</span> <span>是否启用</span>
@ -30,7 +30,7 @@
/> />
</div> </div>
<div class="btn-style"> <div class="btn-style">
<el-button type="primary">保存</el-button> <el-button type="primary" @click="saveStyle">保存</el-button>
</div> </div>
<!-- <codemirror <!-- <codemirror
v-model="code" v-model="code"
@ -47,7 +47,7 @@
/> />
<component :is="previewComp"></component> --> <component :is="previewComp"></component> -->
</div> </div>
<div class="equip-list" v-if="operateIndex == 1"> <div class="equip-list" v-show="operateIndex == 1">
<div class="type-select"> <div class="type-select">
<span>选择类型</span> <span>选择类型</span>
<el-radio-group v-model="formData.showType"> <el-radio-group v-model="formData.showType">
@ -98,22 +98,45 @@ import { loadModule } from "vue3-sfc-loader";
import { initVue3Popup } from "@/utils/file-util"; import { initVue3Popup } from "@/utils/file-util";
import QueryPopup from "./query-popup.vue"; import QueryPopup from "./query-popup.vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { equipmentStyleGet, equipmentStyleEdit } from "@/api/modules/mapCommon";
const basicConfig = ref({} as any);
const tableData = ref<any>([]); const tableData = ref<any>([]);
const baseUrl = import.meta.env.VITE_API_URL; const baseUrl = import.meta.env.VITE_API_URL;
const formData = ref({ const formData = ref({
enable: false, enable: false,
showType: 1, showType: 1
listData: []
}); });
const operateIndex = ref(0); const operateIndex = ref(0);
const code = ref(""); const code = ref();
const previewComp = shallowRef(); const previewComp = shallowRef();
const extensions = [vue(), oneDark]; const extensions = [vue(), oneDark];
import CodeMirror from "@/components/CodeMirror/index.vue"; import CodeMirror from "@/components/CodeMirror/index.vue";
const props = defineProps(["mapInstance", "graphicInstance"]); const props = defineProps(["mapInstance", "equipTypeDictLabel"]);
const emits = defineEmits(["hiddenConfim"]); const emits = defineEmits(["hiddenConfim"]);
let map: any = props.mapInstance; let map: any = props.mapInstance;
let graphicLayer: any; let graphicLayer: any;
//
const saveStyle = async () => {
let requestData: any = {
style: code.value,
category: props.equipTypeDictLabel
};
if (basicConfig.value.id) {
requestData.id = basicConfig.value.id;
}
const res = await equipmentStyleEdit(requestData);
if (res) {
ElMessage.success("保存成功");
}
};
//
const getStyle = async () => {
const res = await equipmentStyleGet({ category: props.equipTypeDictLabel }); //
if (res.result) {
basicConfig.value = { ...res.result };
code.value = res.result.style;
}
};
// //
const saveEdit = (row: any) => { const saveEdit = (row: any) => {
const graphic = graphicLayer.getGraphicById(row.id); const graphic = graphicLayer.getGraphicById(row.id);
@ -241,24 +264,18 @@ const onBlur = (viewUpdate: any) => {
console.error(err); console.error(err);
} }
}; };
onMounted(() => { onMounted(async () => {
console.log(map, "66666"); console.log(map, "66666");
console.log(QueryPopup, "777888"); console.log(QueryPopup, "777888");
map.scene.globe.depthTestAgainstTerrain = false; // map.scene.globe.depthTestAgainstTerrain = false; //
map.onlyPickModelPosition = true; // map.onlyPickModelPosition = true; //
graphicLayer = new mars3d.layer.GraphicLayer({ graphicLayer = new mars3d.layer.GraphicLayer();
// isRestorePositions: true,
// hasEdit: true,
// isAutoEditing: true //
// drawAddEventType: false,
// drawEndEventType: mars3d.EventType.rightClick,
// drawDelEventType: mars3d.EventType.middleClick
});
map.addLayer(graphicLayer); map.addLayer(graphicLayer);
graphicLayer.on(mars3d.EventType.drawCreated, function (e) { graphicLayer.on(mars3d.EventType.drawCreated, function (e) {
console.log("创建完成", e); console.log("创建完成", e);
addRandomGraphicByCount(e.graphic.point); addRandomGraphicByCount(e.graphic.point);
}); });
await getStyle();
}); });
onUnmounted(() => { onUnmounted(() => {
map = null; map = null;

View File

@ -48,7 +48,7 @@
</div> </div>
<!-- 物联网设备操作 --> <!-- 物联网设备操作 -->
<div class="equip-menu-operate" v-if="equipListShow"> <div class="equip-menu-operate" v-if="equipListShow">
<div class="tool-item" v-for="(item, index) in equipTypeList" :key="index" @click="clickEquipMenu(item.dictValue)"> <div class="tool-item" v-for="(item, index) in equipTypeList" :key="index" @click="clickEquipMenu(item)">
<!-- <img :src="item.icon" alt="" srcset="" style="width: 14px; height: 14px" /> --> <!-- <img :src="item.icon" alt="" srcset="" style="width: 14px; height: 14px" /> -->
<span>{{ item.dictValue }}</span> <span>{{ item.dictValue }}</span>
</div> </div>
@ -134,7 +134,7 @@
</div> </div>
</div> </div>
<!-- 设备添加弹框 --> <!-- 设备添加弹框 -->
<EquipmentAdd :mapInstance="map" v-if="equipmentShow" @hiddenConfim="equipmentShow = false" v-draggable /> <EquipmentAdd :mapInstance="map" :equipTypeDictLabel="equipTypeDictLabel" v-if="equipmentShow" @hiddenConfim="equipmentShow = false" v-draggable />
<!-- 图上量算弹框 --> <!-- 图上量算弹框 -->
<MapMeasurement :mapInstance="map" v-if="measurementShow" @hiddenConfim="measurementShow = false" v-draggable /> <MapMeasurement :mapInstance="map" v-if="measurementShow" @hiddenConfim="measurementShow = false" v-draggable />
<!-- 空间分析弹框 --> <!-- 空间分析弹框 -->
@ -314,6 +314,7 @@ import {
updateSystemConfig updateSystemConfig
} from "@/api/modules/mapCommon"; } from "@/api/modules/mapCommon";
import { getDicList } from "@/api/modules/jxjview"; import { getDicList } from "@/api/modules/jxjview";
const equipTypeDictLabel = ref();
const equipTypeList = ref([]); const equipTypeList = ref([]);
const equipListShow = ref(false); const equipListShow = ref(false);
const toolListShow = ref(false); const toolListShow = ref(false);
@ -827,8 +828,9 @@ const showWidget = (name: string) => {
console.log(666); console.log(666);
}; };
// //
const clickEquipMenu = (name: any) => { const clickEquipMenu = async (obj: any) => {
console.log(name); console.log(obj, "111222333");
equipTypeDictLabel.value = obj.dictLabel
equipmentShow.value = true; equipmentShow.value = true;
equipListShow.value = false; equipListShow.value = false;
}; };