ibp盘调整

This commit is contained in:
fan 2019-09-06 15:08:47 +08:00
parent 32dab2fa7d
commit 80edc1ad20
3 changed files with 46 additions and 16 deletions

View File

@ -3,10 +3,15 @@
<div class="map-control"> <div class="map-control">
<el-card type="border-card"> <el-card type="border-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span> <span>车站名称</span>
车站名称 <el-select v-model="stationCode" @change="changeStationCode" placeholder="请选择车站">
<b>请选择车站</b> <el-option
</span> v-for="item in stationOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button <el-button
type="text" type="text"
style="float: right; padding: 3px 0; margin-right: 5px;" style="float: right; padding: 3px 0; margin-right: 5px;"
@ -153,7 +158,18 @@
data() { data() {
return { return {
enabledTab: 'BgImage', enabledTab: 'BgImage',
data: '' data: '',
stationOptions:[
{
value: 'Station_203_0.07533',
label: '福州线一号车站'
},
{
value: 'Station_209_0.95175',
label: '福州线三号车站'
}
],
stationCode: ''
}; };
}, },
watch: { watch: {
@ -182,9 +198,12 @@
this.$store.dispatch('ibp/deleteIbpDevices', model); this.$store.dispatch('ibp/deleteIbpDevices', model);
}, },
handleSave() { handleSave() {
const data = JSON.stringify(this.$store.state.ibp.ibp) const data = JSON.stringify(this.$store.state.ibp.ibp);
console.log(data); console.log(data);
}, },
changeStationCode(e) {
this.$emit('ibpChange',e);
},
handleTabClick() { handleTabClick() {
this.$refs.ibpline.initPage(); this.$refs.ibpline.initPage();
this.$refs.ibptext.initPage(); this.$refs.ibptext.initPage();

View File

@ -5,7 +5,7 @@
<ibp-plate ref="ibpPlate" :size="size"/> <ibp-plate ref="ibpPlate" :size="size"/>
</div> </div>
<div class="map-draft"> <div class="map-draft">
<ibp-operate ref="ibpOperate" /> <ibp-operate ref="ibpOperate" @ibpChange="ibpChange" />
</div> </div>
</div> </div>
</transition> </transition>
@ -52,7 +52,11 @@ export default {
}, },
selectViewDraft(data) { selectViewDraft(data) {
this.viewDraft = data; this.viewDraft = data;
} },
ibpChange(stationCode) {
this.$refs.ibpPlate.show(stationCode);
this.$refs.ibpPlate.drawIbpInit();
}
} }
}; };
</script> </script>

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<div :id="ibpId" :style="{ width: '100%', height: '100%' }" class="ibp-canvas" /> <div :id="ibpId" :style="{ width: '100%', height: '100%',background:'#000' }" class="ibp-canvas" />
<el-button v-if="showBackButton" class="ibp-button" type="primary" @click="back">返回</el-button> <el-button v-if="showBackButton" class="ibp-button" type="primary" @click="back">返回</el-button>
</div> </div>
</template> </template>
@ -76,17 +76,17 @@ export default {
this.setWindowSize(); this.setWindowSize();
}, },
beforeDestroy() { beforeDestroy() {
if (this.$ibp) { this.ibpDestroy();
this.$ibp.dispose();
this.$ibp = '';
Vue.prototype.$ibp = '';
}
}, },
methods: { methods: {
show (deviceCode) { show (deviceCode) {
if (!deviceCode) {
return;
}
document.getElementById(this.ibpId).oncontextmenu = function (e) { document.getElementById(this.ibpId).oncontextmenu = function (e) {
return false; return false;
}; };
this.ibpDestroy();
const data = parser(ibpData[deviceCode], {width: this.canvasWidth, height: this.canvasHeight}); const data = parser(ibpData[deviceCode], {width: this.canvasWidth, height: this.canvasHeight});
this.$ibp = new IbpPan({ this.$ibp = new IbpPan({
dom: document.getElementById(this.ibpId), dom: document.getElementById(this.ibpId),
@ -127,7 +127,7 @@ export default {
}, },
// //
drawIbpInit() { drawIbpInit() {
this.$ibp.drawIbpInit(); this.$ibp&&this.$ibp.drawIbpInit();
this.showBackButton = false; this.showBackButton = false;
}, },
// //
@ -154,7 +154,14 @@ export default {
}, },
back() { back() {
this.$emit('hideIbp'); this.$emit('hideIbp');
} },
ibpDestroy() {
if (this.$ibp) {
this.$ibp.dispose();
this.$ibp = '';
Vue.prototype.$ibp = '';
}
}
} }
}; };
</script> </script>