增加前台保存iscs

This commit is contained in:
zyy 2020-02-05 12:21:56 +08:00
parent 252b3b5871
commit aa709a546d
4 changed files with 23 additions and 7 deletions

View File

@ -0,0 +1,4 @@
const iscsData = {
'11': { 'manualAlarmButtonList': [{ 'point': { 'x': 560, 'y': 100 }, 'code': 'ManualAlarmButton_1', '_type': 'ManualAlarmButton', 'width': 25, 'zlevel': 1, 'z': 4 }], 'fireHydranAlarmButtonList': [{ 'point': { 'x': 562, 'y': 234 }, 'code': 'FireHydranAlarmButton_1', '_type': 'FireHydranAlarmButton', 'width': 25, 'zlevel': 1, 'z': 4 }, { 'point': { 'x': 201, 'y': 242 }, 'code': 'FireHydranAlarmButton_2', '_type': 'FireHydranAlarmButton', 'width': 25, 'zlevel': 1, 'z': 4 }, { 'point': { 'x': 391, 'y': 127 }, 'code': 'FireHydranAlarmButton_3', '_type': 'FireHydranAlarmButton', 'width': 25, 'zlevel': 1, 'z': 4 }] }
};
export default iscsData;

View File

@ -2,7 +2,7 @@
<transition name="el-zoom-in-center">
<div class="mapPaint">
<div class="map-view">
<iscs-plate ref="iscsPlate" />
<iscs-plate ref="iscsPlate" @iscsChange="iscsChange" />
</div>
<div class="map-draft">
<iscs-operate v-if="iscsMode==='fas'" ref="iscsOperate" @iscsChange="iscsChange" />
@ -16,6 +16,7 @@
</transition>
</template>
<script>
import localStore from 'storejs';
import IscsPlate from '@/views/iscsSystem/index';
import IscsOperate from './iscsOperate/index';
import IscsBasOperate from './iscsBasOperate/index';
@ -39,7 +40,8 @@ export default {
size: {
width: this.$store.state.app.width - 521,
height: this.$store.state.app.height - 60
}
},
widthLeft: Number(localStore.get('LeftWidth')) || 450
};
},
computed:{
@ -50,9 +52,13 @@ export default {
watch: {
$route(val) {
this.iscsChange();
},
'$store.state.app.windowSizeCount': function() {
this.$store.dispatch('config/resize', { width: this.$store.state.app.width - 521 - this.widthLeft, height: this.$store.state.app.height - 60 });
}
},
created() {
this.$store.dispatch('config/resize', { width: this.$store.state.app.width - 521 - this.widthLeft, height: this.$store.state.app.height - 60 });
},
mounted() {
this.$refs.iscsPlate.show();
@ -62,7 +68,8 @@ export default {
},
methods: {
iscsChange() {
iscsChange(id) {
this.$refs.iscsPlate.show(id);
this.$refs.iscsPlate.drawIscsInit();
}
}

View File

@ -93,6 +93,7 @@ export default {
}
},
mounted() {
this.$emit('iscsChange', this.$route.params.id);
},
beforeDestroy() {

View File

@ -9,6 +9,7 @@
import Vue from 'vue';
import Iscs from '@/iscs/iscs';
import { parser } from '@/iscs/utils/parser';
import iscsData from '@/iscs/constant/iscsData';
import { mapGetters } from 'vuex';
import { exitFullscreen } from '@/utils/screen';
import { putJointTrainingSimulationUser } from '@/api/chat';
@ -82,13 +83,16 @@ export default {
this.iscsDestroy();
},
methods: {
show () {
show (deviceCode) {
if (!deviceCode) {
return;
}
document.getElementById(this.iscsId).oncontextmenu = function (e) {
return false;
};
this.iscsDestroy();
this.loading = true;
const data = {};
const data = parser(iscsData[deviceCode], {width: this.canvasWidth, height: this.canvasHeight});
this.$iscs = new Iscs({
dom: document.getElementById(this.iscsId),
config: {
@ -110,8 +114,8 @@ export default {
if (this.$route.query.group) {
this.$iscs.on('selected', this.onSelected, this);
}
this.setIscs(data, {});
this.$store.dispatch('iscs/setIscsData', {});
this.setIscs(data, iscsData[deviceCode]);
this.$store.dispatch('iscs/setIscsData', iscsData[deviceCode]);
window.document.oncontextmenu = function () {
return false;
};