Commit 5a568618 authored by wangxiaoming's avatar wangxiaoming

前台描点

parent 4152bc68
...@@ -5,6 +5,7 @@ import ElementUI from 'element-ui'; ...@@ -5,6 +5,7 @@ import ElementUI from 'element-ui';
import BaiduMap from 'vue-baidu-map'; import BaiduMap from 'vue-baidu-map';
import 'element-ui/lib/theme-chalk/index.css'; import 'element-ui/lib/theme-chalk/index.css';
import _ from 'lodash'; import _ from 'lodash';
import moment from 'moment';
import App from './App.vue'; import App from './App.vue';
import router from './router'; import router from './router';
import store from './store'; import store from './store';
...@@ -13,7 +14,7 @@ Vue.use(ElementUI); ...@@ -13,7 +14,7 @@ Vue.use(ElementUI);
Vue.use(BaiduMap, { Vue.use(BaiduMap, {
ak: 'AZzMTSKLP4lVHphRauTBdINZUFnpWTcu', ak: 'AZzMTSKLP4lVHphRauTBdINZUFnpWTcu',
}); });
Object.defineProperty(Vue.prototype, '$moment', { value: moment }) Object.defineProperty(Vue.prototype, '$moment', { value: moment });
Object.defineProperty(Vue.prototype, '$_', { value: _ }); Object.defineProperty(Vue.prototype, '$_', { value: _ });
Vue.config.productionTip = false; Vue.config.productionTip = false;
......
...@@ -146,8 +146,13 @@ ...@@ -146,8 +146,13 @@
</baidu-map> </baidu-map>
</div> </div>
</div> </div>
<el-dialog :visible.sync="isShowPicture" width="960px"> <el-dialog :visible.sync="isShowPicture" width="960px" >
<img :src="bigImgUrl" width="100%" /> <div :style="'height:' + fullHeight + 'px; position: relative;'" ref="mainW">
<img :src="bigImgUrl" ref="BGIMG" width="100%" @load="loadBigImg"/>
<div v-for="(item) in customStyleArray" :key="item">
<div class="dash" :style="item" v-if="showRedBox"></div>
</div>
</div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
...@@ -164,6 +169,10 @@ export default { ...@@ -164,6 +169,10 @@ export default {
name: 'task', name: 'task',
data() { data() {
return { return {
fullHeight: document.documentElement.clientHeight / 1.5,
styleItem: {
},
tableData: [], tableData: [],
infoWindow: { infoWindow: {
show: false, show: false,
...@@ -240,6 +249,7 @@ export default { ...@@ -240,6 +249,7 @@ export default {
], ],
}, },
searchLoading: false, searchLoading: false,
customStyleArray: [],
}; };
}, },
mounted() {}, mounted() {},
...@@ -248,6 +258,25 @@ export default { ...@@ -248,6 +258,25 @@ export default {
this.queryTravel(); this.queryTravel();
}, },
methods: { methods: {
loadBigImg() {
const newRedArray = [];
this.scale = this.$refs.BGIMG.naturalWidth / this.$refs.mainW.offsetWidth;
this.hscale = this.$refs.BGIMG.naturalHeight / this.$refs.mainW.offsetHeight;
this.customStyleArray.forEach((e) => {
const customStyle = {
top: `${e.positionRight / this.hscale}px`,
left: `${e.positionLeft / this.scale}px`,
width: `${e.positionWidth / this.scale}px`,
height: `${e.positionHeight / this.hscale}px`,
};
newRedArray.push(customStyle);
});
this.customStyleArray = newRedArray;
this.showRedBox = true;
},
showTitle(e) { showTitle(e) {
this.infoPosition.lng = e.point.lng; this.infoPosition.lng = e.point.lng;
this.infoPosition.lat = e.point.lat; this.infoPosition.lat = e.point.lat;
...@@ -269,8 +298,11 @@ export default { ...@@ -269,8 +298,11 @@ export default {
}, },
showPicture(e) { showPicture(e) {
this.infos.forEach((item) => { this.infos.forEach((item) => {
console.log(JSON.stringify(item));
if (item.lng == e.point.lng && item.lat == e.point.lat) { if (item.lng == e.point.lng && item.lat == e.point.lat) {
// 根据坐标信息获取图片 // 根据坐标信息获取图片
// 这个是描点的
this.getTrajectImgLocation(item.channel, item.plateNo, `${item.date} ${item.time}`);
this.bigImgUrl = `${address this.bigImgUrl = `${address
}getTrajectImg?channel=${ }getTrajectImg?channel=${
item.channel item.channel
...@@ -295,7 +327,40 @@ export default { ...@@ -295,7 +327,40 @@ export default {
equipment: plateNo, equipment: plateNo,
createTime, createTime,
}) })
.then((response) => {}) // eslint-disable-next-line no-unused-vars
.then((response) => {
})
.catch((error) => {
console.log(error);
});
},
getTrajectImgLocation(channel, plateNo, createTime) {
axios
.get(
`${address}getTrajectImgLocation?channel=${channel}&equipment=${plateNo}&createTime=${createTime}`,
)
// eslint-disable-next-line no-unused-vars
.then((response) => {
const styleArray = response.data.data;
this.customStyleArray = [];
styleArray.forEach((e) => {
const point = JSON.parse(e).location;
if (point.length === 4) {
const style = {
positionLeft: point[0],
positionRight: point[1],
positionWidth: point[2] - point[0],
positionHeight: point[3] - point[1],
};
this.customStyleArray.push(style);
}
});
})
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
}); });
...@@ -698,4 +763,9 @@ export default { ...@@ -698,4 +763,9 @@ export default {
} }
} }
} }
.dash{
position: absolute;
border: 2px #EC292A dashed;
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment