Browse Source

地图scale缩放还原

feature
SongZhen 2 years ago
parent
commit
713973449d
  1. 4
      src/App.vue
  2. 11
      src/js/store/modules/chooseArea.js
  3. 1
      src/views/components/fixed1920.vue
  4. 14
      src/views/dataBoard/organizational/dangTree/index.vue
  5. 1498
      yarn.lock

4
src/App.vue

@ -42,7 +42,7 @@ export default {
},
computed: {},
mounted() {
console.log("开始::::" + localStorage.getItem("userType"));
// console.log("" + localStorage.getItem("userType"));
if (!localStorage.getItem("userType")) {
localStorage.setItem("userType", "oper");
}
@ -64,7 +64,7 @@ export default {
// eslint-disable-next-line
// debugger
that.setEnv(env);
console.log("屏幕宽度:" + document.documentElement.clientWidth);
// console.log(":" + document.documentElement.clientWidth);
// size
if (document.documentElement.clientHeight < 800) {
// medium

11
src/js/store/modules/chooseArea.js

@ -1,20 +1,27 @@
const state = {
chooseName: {
orgId: '',
level: '',
orgId: "",
level: "",
},
realScale: null,
};
const mutations = {
CHOOSE_NAME: (state, name) => {
state.chooseName = name;
},
CHOOSE_REAL_SCALE: (state, name) => {
state.realScale = name;
},
};
const actions = {
chooseName({ commit }, name) {
commit("CHOOSE_NAME", name);
},
chooseScale({ commit }, name) {
commit("CHOOSE_REAL_SCALE", name);
},
};
export default {

1
src/views/components/fixed1920.vue

@ -24,6 +24,7 @@ export default {
const top = (clientHeight - height) / 2;
const left = (clientWidth - 1920) / 2;
this.$store.state.fixed1920.height = height;
this.$store.dispatch("chooseArea/chooseScale", scale);
return {
transform: `scale(${scale})`,
height: `${height}px`,

14
src/views/dataBoard/organizational/dangTree/index.vue

@ -28,6 +28,7 @@ export default {
levelArr: [],
nowVal: 100,
nodeConfig: {},
zoom: 0,
};
},
watch: {
@ -38,15 +39,28 @@ export default {
this.getTreeData();
}
},
"$store.state.chooseArea.realScale"(n, v) {
this.setStartScale(n);
},
},
computed: {},
mounted() {
const orgId = this.$store.state.chooseArea.chooseName.orgId;
const scale = this.$store.state.chooseArea.realScale;
if (scale) {
this.setStartScale(scale);
}
if (orgId) {
this.getTreeData();
}
this.getTextMap();
},
methods: {
setStartScale(n) {
const scale = 1 / n;
this.zoom = scale;
},
getLevelArrNum(myArray) {
const arr = [...myArray];
while (arr.length > 1) {

1498
yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save