Commit 91bf49b8 by zhangxw

页面完成

1 parent 0e78cabf
This diff could not be displayed because it is too large.
......@@ -15,7 +15,9 @@
"babel-plugin-import": "^1.13.5",
"clipboard": "^2.0.11",
"core-js": "^3.8.3",
"element-plus": "^2.2.9",
"moment": "^2.29.1",
"svg-sprite-loader": "^6.0.11",
"vant": "^3.5.2",
"vue": "^3.2.13",
"vue-router": "^4.0.3",
......@@ -50,7 +52,9 @@
"parserOptions": {
"parser": "@babel/eslint-parser"
},
"rules": {}
"rules": {
"indent": "off"
}
},
"browserslist": [
"> 1%",
......
......@@ -2,25 +2,42 @@ import request from "./request";
// 获取所有车辆数据
export const GET_ALL_CAR_LIST = (params) => {
return request(params, "");
};
// 搜索车辆数据
export const GET_CAR_DATA_BYSEARCH = (params) => {
return request(params, "/miniappserver/monitor/search");
};
// 获取车辆位置详细信息
export const GET_CAR_LOCATION_INFO = (params) => {
return request(params, "/trialdrive/api/vehicle/location");
return request(params, "/miniappserver/monitor/location");
};
// 获取常驻地数据
export const GET_RESIDENT_DATA = (params) => {
return request(params, "");
return request(params, "/miniappserver/monitor/location/residentList");
};
// 获取轨迹回放数据
export const GET_REPLAY_DATA = (params) => {
return request(params, "/devicemonitor/api/track/playback");
// /devicemonitor/api/track/playback
// /miniappserver/monitor/location/trackPointList
return request(params, "/miniappserver/monitor/location/trackPointList");
};
// 获取已设置调频数据
export const GET_FREQ_INFO = (params) => {
return request(params, "/miniappserver/deviceFreq/getAdjFreqBySn");
};
// 关闭调频
export const CLOSE_FREQ = (params) => {
return request(params, "/miniappserver/deviceFreq/resetAdjFreq");
};
// 一键调频
export const SET_FREQ = (params) => {
return request(params, "/miniappserver/deviceFreq/adjFreq", "POST");
};
// 新增围栏
export const ADD_FENCE = (params) => {
return request(params, "/miniappserver/fence/add", "POST");
};
......@@ -17,18 +17,18 @@
width: 130px;
}
.el-slider__bar {
height: var(--el-slider-height);
background-color: var(--el-slider-main-bg-color);
border-top-left-radius: var(--el-slider-border-radius);
border-bottom-left-radius: var(--el-slider-border-radius);
height: 2px;
background-color: var(--base-color);
border-top-left-radius: 1px;
border-bottom-left-radius: 1px;
position: absolute;
}
.el-slider__button-wrapper {
height: var(--el-slider-button-wrapper-size);
width: var(--el-slider-button-wrapper-size);
height: 16px;
width: 16px;
position: absolute;
z-index: 1;
top: var(--el-slider-button-wrapper-offset);
top: -9px;
transform: translateX(-50%);
background-color: transparent;
text-align: center;
......@@ -52,14 +52,15 @@
}
.el-slider__button {
display: inline-block;
width: var(--el-slider-button-size);
height: var(--el-slider-button-size);
width: 16px;
height: 16px;
vertical-align: middle;
border: solid 2px var(--el-slider-main-bg-color);
background-color: var(--el-color-white);
border: none;
box-shadow: 0px 2px 8px 0px rgba(135,143,153,0.5000);
background-color: #fff;
border-radius: 50%;
box-sizing: border-box;
transition: var(--el-transition-duration-fast);
transition: .2s;
-webkit-user-select: none;
user-select: none;
}
......@@ -77,10 +78,10 @@
}
.el-slider__stop {
position: absolute;
top: -6px;
height: 10px;
width: 10px;
border-radius: 10px;
top: -4px;
height: 6px;
width: 6px;
border-radius: 6px;
background-color: #fff;
border: 2px solid #e4e7eb;
}
......@@ -94,37 +95,9 @@
position: absolute;
transform: translateX(-50%);
font-size: 14px;
color: var(--el-color-info);
color: #111;
margin-top: 15px;
}
.el-slider.is-vertical {
position: relative;
height: 100%;
flex: 0;
}
.el-slider.is-vertical .el-slider__runway {
width: var(--el-slider-height);
height: 100%;
margin: 0 16px;
}
.el-slider.is-vertical .el-slider__bar {
width: var(--el-slider-height);
height: auto;
border-radius: 0 0 3px 3px;
}
.el-slider.is-vertical .el-slider__button-wrapper {
top: auto;
left: var(--el-slider-button-wrapper-offset);
transform: translateY(50%);
}
.el-slider.is-vertical .el-slider__stop {
transform: translateY(50%);
}
.el-slider.is-vertical .el-slider__marks-text {
margin-top: 0;
left: 15px;
transform: translateY(50%);
}
.el-slider--large {
height: 40px;
}
......
......@@ -6,4 +6,7 @@
--van-text-link-color: #0077FF !important;
--van-blue: #0077FF !important;
--van-search-input-height: 32px !important;
--van-font-weight-bold: 600 !important;
--van-search-action-text-color: var(--base-color) !important;
--van-dropdown-menu-title-active-text-color: var(--base-color) !important;
}
\ No newline at end of file
const req = require.context("./svg", false, /\.svg$/);
// 解析获取的.svg文件的文件名称并返回
const requireAll = (requireContext) => {
return requireContext.keys().map(requireContext);
};
requireAll(req);
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>选中备份 2</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="2-14找车-车辆窗口-设备调频-星期模式" transform="translate(-204.000000, -374.000000)">
<g id="编组-6" transform="translate(0.000000, 132.000000)">
<g id="Menu备份-5" transform="translate(12.000000, 182.000000)">
<g id="编组-4备份-2" transform="translate(0.000000, 8.000000)">
<g id="编组-5备份" transform="translate(16.000000, 52.000000)">
<g id="选中备份-2" transform="translate(176.000000, 0.000000)">
<rect id="矩形" x="0" y="0" width="20" height="20"></rect>
<rect id="矩形" stroke="#C4C8CC" fill="#FFFFFF" x="2.5" y="2.5" width="15" height="15" rx="2"></rect>
<path d="M4.86930191,8.95982997 L8.17974051,11.5439429 C8.17974051,11.5439429 8.36234281,11.6362088 8.59059569,11.5439429 L15.0272533,5.52055608 C15.0272533,5.52055608 16.1888069,5.27027934 15.973345,6.51631431 C15.1871406,7.32375211 8.8874347,14.2666776 8.8874347,14.2666776 C8.8874347,14.2666776 8.36234281,14.5666531 7.85996595,14.2666776 C7.35803015,13.7589924 4.00238204,10.0442882 4.00238204,10.0442882 C4.00238204,10.0442882 3.91041929,9.14458457 4.86930191,8.95982997 Z" id="路径" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>选中</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="2-14找车-车辆窗口-设备调频-星期模式" transform="translate(-28.000000, -338.000000)">
<g id="编组-6" transform="translate(0.000000, 132.000000)">
<g id="Menu备份-5" transform="translate(12.000000, 182.000000)">
<g id="编组-4备份-2" transform="translate(0.000000, 8.000000)">
<g id="选中" transform="translate(16.000000, 16.000000)">
<rect id="矩形" x="0" y="0" width="20" height="20"></rect>
<rect id="矩形" fill="#0077FF" x="2" y="2" width="16" height="16" rx="2"></rect>
<path d="M4.86930191,8.95982997 L8.17974051,11.5439429 C8.17974051,11.5439429 8.36234281,11.6362088 8.59059569,11.5439429 L15.0272533,5.52055608 C15.0272533,5.52055608 16.1888069,5.27027934 15.973345,6.51631431 C15.1871406,7.32375211 8.8874347,14.2666776 8.8874347,14.2666776 C8.8874347,14.2666776 8.36234281,14.5666531 7.85996595,14.2666776 C7.35803015,13.7589924 4.00238204,10.0442882 4.00238204,10.0442882 C4.00238204,10.0442882 3.91041929,9.14458457 4.86930191,8.95982997 Z" id="路径" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>闹钟</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="2-14找车-车辆窗口-设备调频-星期模式" transform="translate(-239.000000, -429.000000)">
<g id="编组-6" transform="translate(0.000000, 132.000000)">
<g id="Menu备份-5" transform="translate(12.000000, 182.000000)">
<g id="编组-4" transform="translate(0.000000, 96.000000)">
<g id="编组-3" transform="translate(16.000000, 8.000000)">
<g id="闹钟" transform="translate(211.000000, 11.000000)">
<rect id="矩形" x="0" y="0" width="18" height="18"></rect>
<path d="M8.9999655,3.7006587 C12.3973772,3.7006587 15.1515128,6.45479433 15.1515128,9.85220605 C15.1515128,13.2496178 12.3973772,16.0037534 8.9999655,16.0037534 C5.60255377,16.0037534 2.84841814,13.2496178 2.84841814,9.85220605 C2.84841814,6.45479433 5.60255377,3.7006587 8.9999655,3.7006587 Z M8.9999655,4.81912186 C6.22473885,4.81912186 3.9668813,7.07697941 3.9668813,9.85220605 C3.9668813,12.6274327 6.22473885,14.8852903 8.9999655,14.8852903 C11.7751921,14.8852903 14.0330497,12.6274327 14.0330497,9.85220605 C14.0330497,7.07697941 11.7751921,4.81912186 8.9999655,4.81912186 Z M8.76029482,6.12293032 C9.06914989,6.12293032 9.3195264,6.37245313 9.3195264,6.68025511 L9.3195264,6.68025511 L9.3195264,9.78535041 L12.4352452,9.78535041 C12.6350394,9.7853504 12.8196569,9.8915759 12.919554,10.0640128 C13.0194511,10.2364497 13.0194511,10.4489007 12.919554,10.6213376 C12.8196569,10.7937745 12.6350394,10.9 12.4352452,10.9 L12.4352452,10.9 L8.76029482,10.9 C8.45143975,10.9 8.20106324,10.6504772 8.20106324,10.3426752 L8.20106324,10.3426752 L8.20106324,6.68025511 C8.20106324,6.37245313 8.45143975,6.12293032 8.76029482,6.12293032 Z M5.37414762,2.00000048 C5.60930085,1.99986286 5.81941973,2.14634504 5.89991948,2.36653705 C5.98041923,2.58672906 5.91410064,2.83358571 5.73397319,2.9842363 L5.73397319,2.9842363 L2.91872154,5.33845586 C2.6821165,5.53630657 2.32937177,5.50554397 2.13084415,5.26974566 C1.93231652,5.03394736 1.96318437,4.68240537 2.1997894,4.48455465 L2.1997894,4.48455465 L5.01496117,2.13041471 C5.11550332,2.04607583 5.2427303,1.99988205 5.37414762,2.00000048 Z M12.6257834,2.00000035 C12.7571817,1.99985276 12.8843933,2.04605123 12.9848899,2.13041471 L12.9848899,2.13041471 L15.8001416,4.48455465 C15.9803222,4.63518172 16.0466887,4.88205871 15.9662018,5.1022825 C15.8857148,5.32250629 15.6755747,5.46901415 15.4403959,5.46887014 C15.3089762,5.46900225 15.1817446,5.4228068 15.0812095,5.33845586 L15.0812095,5.33845586 L12.2660377,2.98431592 C12.085857,2.83368884 12.0194905,2.58681185 12.0999775,2.36658806 C12.1804645,2.14636427 12.3906046,1.99985642 12.6257834,2.00000035 Z" id="形状结合" fill="#C0C5CC" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
.icon {display: inline-block;background-image: url(sprite.png);background-size: 188px 164px;}
.icon-checked { width: 20px; height: 20px; background-position: -128px -60px; }
.icon-device { width: 14px; height: 14px; background-position: -168px -60px; }
.icon-locate-sm { width: 14px; height: 14px; background-position: -68px -60px; }
.icon-location { width: 24px; height: 24px; background-position: -164px -80px; }
.icon-off-car { width: 52px; height: 52px; background-position: -60px -80px; }
.icon-off-line { width: 20px; height: 20px; background-position: -148px -60px; }
.icon-offline-time { width: 14px; height: 14px; background-position: -82px -60px; }
.icon-on-car { width: 52px; height: 52px; background-position: -112px -80px; }
.icon-on-line { width: 24px; height: 24px; background-position: -164px -104px; }
.icon-online-time { width: 14px; height: 14px; background-position: -96px -60px; }
.icon-refresh-car { width: 24px; height: 24px; background-position: 0px -140px; }
.icon-replay-pause { width: 60px; height: 60px; background-position: -68px 0px; }
.icon-replay-play { width: 60px; height: 60px; background-position: -128px 0px; }
.icon-replay-refresh { width: 60px; height: 60px; background-position: 0px -80px; }
.icon {display: inline-block;background-image: url(sprite.png);background-size: 232px 186px;}
.icon-begin { width: 52px; height: 72px; background-position: -68px 0px; }
.icon-checked { width: 20px; height: 20px; background-position: -150px -156px; }
.icon-copy { width: 28px; height: 28px; background-position: -172px -112px; }
.icon-device { width: 14px; height: 14px; background-position: -64px -140px; }
.icon-loc-icon { width: 30px; height: 30px; background-position: 0px -156px; }
.icon-locate-sm { width: 14px; height: 14px; background-position: -78px -140px; }
.icon-location { width: 24px; height: 24px; background-position: -30px -156px; }
.icon-navgation { width: 28px; height: 28px; background-position: -200px -112px; }
.icon-off-car { width: 52px; height: 52px; background-position: -172px -60px; }
.icon-off-line { width: 20px; height: 20px; background-position: -170px -156px; }
.icon-offline-time { width: 14px; height: 14px; background-position: -92px -140px; }
.icon-on-car { width: 52px; height: 52px; background-position: -120px -80px; }
.icon-on-line { width: 24px; height: 24px; background-position: -54px -156px; }
.icon-online-time { width: 14px; height: 14px; background-position: -106px -140px; }
.icon-put-away { width: 64px; height: 16px; background-position: 0px -140px; }
.icon-refresh-car { width: 24px; height: 24px; background-position: -78px -156px; }
.icon-replay-pause { width: 60px; height: 60px; background-position: 0px -80px; }
.icon-replay-play { width: 60px; height: 60px; background-position: -60px -80px; }
.icon-replay-refresh { width: 60px; height: 60px; background-position: -172px 0px; }
.icon-resident { width: 52px; height: 72px; background-position: -120px 0px; }
.icon-screen-btn { width: 24px; height: 24px; background-position: -102px -156px; }
.icon-setting-btn { width: 24px; height: 24px; background-position: -126px -156px; }
.icon-share { width: 68px; height: 80px; background-position: 0px 0px; }
.icon-typeList { width: 14px; height: 14px; background-position: -110px -60px; }
\ No newline at end of file
.icon-typeList { width: 14px; height: 14px; background-position: -120px -140px; }
\ No newline at end of file

12 KB | W: | H:

21.4 KB | W: | H:

src/assets/spritesmith-generated/sprite.png
src/assets/spritesmith-generated/sprite.png
src/assets/spritesmith-generated/sprite.png
src/assets/spritesmith-generated/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template>
<div>
<slot name="mapBox"></slot>
<slot name="screenBox"></slot>
<div v-show="isUploaded">
<a class="map-cmd-icon location" @click="getLocation">
<span class="icon icon-location"></span>
......@@ -41,6 +40,7 @@ export default {
const init = (id) => {
map = new window.AMap.Map(id);
isUploaded.value = true;
context.emit("isUploaded", true);
context.emit("getData", map);
return map;
};
......
export default {
name: "ElMarker",
props: {
mark: {
type: [String, Object],
},
},
render() {
let label = typeof this.mark === "string" ? this.mark : this.mark.text;
return (
<div class="el-slider__marks-text" style={this.mark.style || {}}>
{label}
</div>
);
},
};
<template>
<van-popup
v-model:show="props.showPopup"
round
@close="close"
:close-on-click-overlay="true"
:position="props.position"
>
<div class="content-box">
<div class="btn-class">
<span class="cancel-btn" @click="cancel">取消</span>
<span
class="save-btn"
:class="isDisabled ? 'disabled' : ''"
@click="save"
>{{ isDisabled ? "关闭" : "确定" }}</span
>
</div>
<slot></slot>
</div>
</van-popup>
</template>
<script>
import { defineComponent } from "vue";
export default defineComponent({
name: "PopupCom",
props: {
showPopup: {
type: Boolean,
default: false,
},
position: {
type: String,
},
isDisabled: {
type: Boolean,
default: false,
},
},
setup(props, { emit }) {
const cancel = () => {
emit("btnCancel");
};
const close = () => {
emit("btnCancel");
};
const save = () => {
if (props.isDisabled) {
emit("btnCancel");
} else {
emit("btnSave");
}
};
return {
cancel,
save,
props,
close,
};
},
});
</script>
<style lang="scss">
.content-box {
display: flex;
align-items: center;
background: #fff;
flex-flow: column;
border-radius: 0 0 16px 16px;
overflow: hidden;
padding-bottom: 40px;
.btn-class {
padding: 20px;
width: calc(100% - 40px);
display: flex;
justify-content: space-between;
.cancel-btn {
color: #6c737a;
}
.save-btn {
color: var(--base-color);
}
.save-btn.disabled {
color: #6c737a;
}
}
}
</style>
<template>
<div>
<van-overlay
:show="showOverlay"
@click="showOverlay = false"
:z-index="100000"
>
<span class="icon icon-share"></span>
<p class="tip">“点击右上角转发/分享”</p>
</van-overlay>
<slot></slot>
</div>
</template>
<script>
import { ref, defineComponent } from "vue";
export default defineComponent({
name: "SharePage",
props: {
isShowOverlay: {
type: Boolean,
default: false,
},
},
setup(props) {
const showOverlay = ref(false);
const share = () => {
showOverlay.value = true;
};
if (props.isShowOverlay) {
showOverlay.value = true;
}
return {
showOverlay,
share,
};
},
});
</script>
<style lang="scss" scoped>
.icon-share {
position: absolute;
top: 20px;
right: 65px;
}
.tip {
margin-top: 105px;
text-align: center;
color: #fff;
font-size: 16px;
}
</style>
<template>
<div
class="el-slider__button-wrapper"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeave"
@mousedown="onButtonDown"
@touchstart="onButtonDown"
:class="{ hover: hovering, dragging: dragging }"
:style="wrapperStyle"
ref="button"
tabindex="0"
@focus="handleMouseEnter"
@blur="handleMouseLeave"
></div>
</template>
<script>
export default {
name: "ElSliderButton",
components: {},
props: {
value: {
type: Number,
default: 0,
},
vertical: {
type: Boolean,
default: false,
},
tooltipClass: String,
},
data() {
return {
hovering: false,
dragging: false,
isClick: false,
startX: 0,
currentX: 0,
startY: 0,
currentY: 0,
startPosition: 0,
newPosition: null,
oldValue: this.value,
};
},
computed: {
disabled() {
return this.$parent.sliderDisabled;
},
max() {
return this.$parent.max;
},
min() {
return this.$parent.min;
},
step() {
return this.$parent.step;
},
showTooltip() {
return this.$parent.showTooltip;
},
precision() {
return this.$parent.precision;
},
currentPosition() {
return `${((this.value - this.min) / (this.max - this.min)) * 100}%`;
},
enableFormat() {
return this.$parent.formatTooltip instanceof Function;
},
formatValue() {
return (
(this.enableFormat && this.$parent.formatTooltip(this.value)) ||
this.value
);
},
wrapperStyle() {
return this.vertical
? { bottom: this.currentPosition }
: { left: this.currentPosition };
},
},
watch: {
dragging(val) {
this.$parent.dragging = val;
},
},
methods: {
displayTooltip() {
this.$refs.tooltip && (this.$refs.tooltip.showPopper = true);
},
hideTooltip() {
this.$refs.tooltip && (this.$refs.tooltip.showPopper = false);
},
handleMouseEnter() {
this.hovering = true;
this.displayTooltip();
},
handleMouseLeave() {
this.hovering = false;
this.hideTooltip();
},
onButtonDown(event) {
console.log(event);
if (this.disabled) return;
event.preventDefault();
this.onDragStart(event);
window.addEventListener("mousemove", this.onDragging);
window.addEventListener("touchmove", this.onDragging);
window.addEventListener("mouseup", this.onDragEnd);
window.addEventListener("touchend", this.onDragEnd);
window.addEventListener("contextmenu", this.onDragEnd);
},
onDragStart(event) {
this.dragging = true;
this.isClick = true;
if (event.type === "touchstart") {
event.clientY = event.touches[0].clientY;
event.clientX = event.touches[0].clientX;
}
if (this.vertical) {
this.startY = event.clientY;
} else {
this.startX = event.clientX;
}
this.startPosition = parseFloat(this.currentPosition);
this.newPosition = this.startPosition;
},
onDragging(event) {
if (this.dragging) {
this.isClick = false;
this.displayTooltip();
this.$parent.resetSize();
let diff = 0;
if (event.type === "touchmove") {
event.clientY = event.touches[0].clientY;
event.clientX = event.touches[0].clientX;
}
if (this.vertical) {
this.currentY = event.clientY;
diff =
((this.startY - this.currentY) / this.$parent.sliderSize) * 100;
} else {
this.currentX = event.clientX;
diff =
((this.currentX - this.startX) / this.$parent.sliderSize) * 100;
}
this.newPosition = this.startPosition + diff;
this.setPosition(this.newPosition);
}
},
onDragEnd() {
if (this.dragging) {
/*
* 防止在 mouseup 后立即触发 click,导致滑块有几率产生一小段位移
* 不使用 preventDefault 是因为 mouseup 和 click 没有注册在同一个 DOM 上
*/
setTimeout(() => {
this.dragging = false;
this.hideTooltip();
if (!this.isClick) {
this.setPosition(this.newPosition);
this.$parent.emitChange();
}
}, 0);
window.removeEventListener("mousemove", this.onDragging);
window.removeEventListener("touchmove", this.onDragging);
window.removeEventListener("mouseup", this.onDragEnd);
window.removeEventListener("touchend", this.onDragEnd);
window.removeEventListener("contextmenu", this.onDragEnd);
}
},
setPosition(newPosition) {
if (newPosition === null || isNaN(newPosition)) return;
if (newPosition < 0) {
newPosition = 0;
} else if (newPosition > 100) {
newPosition = 100;
}
const lengthPerStep = 100 / ((this.max - this.min) / this.step);
const steps = Math.round(newPosition / lengthPerStep);
let value =
steps * lengthPerStep * (this.max - this.min) * 0.01 + this.min;
value = parseFloat(value.toFixed(this.precision));
this.$emit("input", value);
this.$nextTick(() => {
this.displayTooltip();
this.$refs.tooltip && this.$refs.tooltip.updatePopper();
});
if (!this.dragging && this.value !== this.oldValue) {
this.oldValue = this.value;
}
},
},
};
</script>
<style scoped>
@import "./slider.css";
</style>
<template>
<div
class="el-slider"
role="slider"
:aria-valuemin="min"
:aria-valuemax="max"
>
<div
class="el-slider__runway"
:style="runwayStyle"
@click="onSliderClick"
ref="slider"
>
<div class="el-slider__bar" :style="barStyle"></div>
<slider-button
v-model="firstValue"
:tooltip-class="tooltipClass"
ref="button1"
>
</slider-button>
<div
class="el-slider__stop"
v-for="(item, key) in stops"
:key="key"
:style="getStopStyle(item)"
></div>
<template v-if="markList.length > 0">
<div>
<div
v-for="(item, key) in markList"
:style="getStopStyle(item.position)"
class="el-slider__stop el-slider__marks-stop"
:key="key"
></div>
</div>
<div class="el-slider__marks">
<slider-marker
:mark="item.mark"
v-for="(item, key) in markList"
:key="key"
:style="getStopStyle(item.position)"
>
</slider-marker>
</div>
</template>
</div>
</div>
</template>
<script>
import SliderButton from "./sliderButton.vue";
import SliderMarker from "./marker";
export default {
name: "ElSlider",
inject: {
elForm: {
default: "",
},
},
props: {
min: {
type: Number,
default: 0,
},
max: {
type: Number,
default: 100,
},
step: {
type: Number,
default: 1,
},
value: {
type: [Number, Array],
default: 0,
},
height: {
type: String,
},
debounce: {
type: Number,
default: 300,
},
label: {
type: String,
},
tooltipClass: String,
marks: Object,
},
components: {
SliderButton,
SliderMarker,
},
data() {
return {
firstValue: null,
secondValue: null,
oldValue: null,
dragging: false,
sliderSize: 1,
};
},
watch: {
value(val, oldVal) {
console.log(val);
if (
this.dragging ||
(Array.isArray(val) &&
Array.isArray(oldVal) &&
val.every((item, index) => item === oldVal[index]))
) {
return;
}
this.setValues();
},
dragging(val) {
if (!val) {
this.setValues();
}
},
firstValue(val) {
if (this.range) {
this.$emit("input", [this.minValue, this.maxValue]);
} else {
this.$emit("input", val);
}
},
secondValue() {
if (this.range) {
this.$emit("input", [this.minValue, this.maxValue]);
}
},
min() {
this.setValues();
},
max() {
this.setValues();
},
},
methods: {
valueChanged() {
if (this.range) {
return ![this.minValue, this.maxValue].every(
(item, index) => item === this.oldValue[index]
);
} else {
return this.value !== this.oldValue;
}
},
setValues() {
if (this.min > this.max) {
console.error(
"[Element Error][Slider]min should not be greater than max."
);
return;
}
const val = this.value;
if (this.range && Array.isArray(val)) {
if (val[1] < this.min) {
this.$emit("input", [this.min, this.min]);
} else if (val[0] > this.max) {
this.$emit("input", [this.max, this.max]);
} else if (val[0] < this.min) {
this.$emit("input", [this.min, val[1]]);
} else if (val[1] > this.max) {
this.$emit("input", [val[0], this.max]);
} else {
this.firstValue = val[0];
this.secondValue = val[1];
if (this.valueChanged()) {
this.dispatch("ElFormItem", "el.form.change", [
this.minValue,
this.maxValue,
]);
this.oldValue = val.slice();
}
}
} else if (!this.range && typeof val === "number" && !isNaN(val)) {
if (val < this.min) {
this.$emit("input", this.min);
} else if (val > this.max) {
this.$emit("input", this.max);
} else {
this.firstValue = val;
if (this.valueChanged()) {
this.dispatch("ElFormItem", "el.form.change", val);
this.oldValue = val;
}
}
}
},
setPosition(percent) {
const targetValue = this.min + (percent * (this.max - this.min)) / 100;
if (!this.range) {
this.$refs.button1.setPosition(percent);
return;
}
let button;
if (
Math.abs(this.minValue - targetValue) <
Math.abs(this.maxValue - targetValue)
) {
button = this.firstValue < this.secondValue ? "button1" : "button2";
} else {
button = this.firstValue > this.secondValue ? "button1" : "button2";
}
this.$refs[button].setPosition(percent);
},
onSliderClick(event) {
console.log(event);
if (this.dragging) return;
this.resetSize();
const sliderOffsetLeft = this.$refs.slider.getBoundingClientRect().left;
this.setPosition(
((event.clientX - sliderOffsetLeft) / this.sliderSize) * 100
);
this.emitChange();
},
resetSize() {
if (this.$refs.slider) {
this.sliderSize =
this.$refs.slider[`client${this.vertical ? "Height" : "Width"}`];
}
},
emitChange() {
this.$nextTick(() => {
this.$emit(
"change",
this.range ? [this.minValue, this.maxValue] : this.value
);
});
},
getStopStyle(position) {
return this.vertical
? { bottom: position + "%" }
: { left: position + "%" };
},
},
computed: {
stops() {
const stopCount = (this.max - this.min) / this.step;
const stepWidth = (100 * this.step) / (this.max - this.min);
const result = [];
for (let i = 1; i < stopCount; i++) {
result.push(i * stepWidth);
}
if (this.range) {
return result.filter((step) => {
return (
step < (100 * (this.minValue - this.min)) / (this.max - this.min) ||
step > (100 * (this.maxValue - this.min)) / (this.max - this.min)
);
});
} else {
return result.filter(
(step) =>
step > (100 * (this.firstValue - this.min)) / (this.max - this.min)
);
}
},
markList() {
if (!this.marks) {
return [];
}
const marksKeys = Object.keys(this.marks);
return marksKeys
.map(parseFloat)
.sort((a, b) => a - b)
.filter((point) => point <= this.max && point >= this.min)
.map((point) => ({
point,
position: ((point - this.min) * 100) / (this.max - this.min),
mark: this.marks[point],
}));
},
minValue() {
return Math.min(this.firstValue, this.secondValue);
},
maxValue() {
return Math.max(this.firstValue, this.secondValue);
},
barSize() {
return this.range
? `${(100 * (this.maxValue - this.minValue)) / (this.max - this.min)}%`
: `${(100 * (this.firstValue - this.min)) / (this.max - this.min)}%`;
},
barStart() {
return this.range
? `${(100 * (this.minValue - this.min)) / (this.max - this.min)}%`
: "0%";
},
precision() {
let precisions = [this.min, this.max, this.step].map((item) => {
let decimal = ("" + item).split(".")[1];
return decimal ? decimal.length : 0;
});
return Math.max.apply(null, precisions);
},
runwayStyle() {
return this.vertical ? { height: this.height } : {};
},
barStyle() {
return this.vertical
? {
height: this.barSize,
bottom: this.barStart,
}
: {
width: this.barSize,
left: this.barStart,
};
},
},
mounted() {
let valuetext;
if (this.range) {
if (Array.isArray(this.value)) {
this.firstValue = Math.max(this.min, this.value[0]);
this.secondValue = Math.min(this.max, this.value[1]);
} else {
this.firstValue = this.min;
this.secondValue = this.max;
}
this.oldValue = [this.firstValue, this.secondValue];
valuetext = `${this.firstValue}-${this.secondValue}`;
} else {
if (typeof this.value !== "number" || isNaN(this.value)) {
this.firstValue = this.min;
} else {
this.firstValue = Math.min(this.max, Math.max(this.min, this.value));
}
this.oldValue = this.firstValue;
valuetext = this.firstValue;
}
this.$el.setAttribute("aria-valuetext", valuetext);
// label screen reader
this.$el.setAttribute(
"aria-label",
this.label ? this.label : `slider between ${this.min} and ${this.max}`
);
this.resetSize();
window.addEventListener("resize", this.resetSize);
},
beforeUnmount() {
window.removeEventListener("resize", this.resetSize);
},
};
</script>
<style scoped>
@import "./slider.css";
</style>
<template>
<svg :class="svgClass" aria-hidden="true">
<use :xlink:href="iconName"></use>
</svg>
</template>
<script>
import { computed } from "@vue/reactivity";
export default {
name: "baseSvgIcon",
props: {
iconClass: { type: String },
className: { type: String },
},
setup(props) {
const iconName = computed(() => {
return props.iconClass ? `#icon-${props.iconClass}` : "#icon";
});
const svgClass = computed(() => {
return props.className ? "svg-icon " + props.className : "svg-icon";
});
return { iconName, svgClass };
},
};
</script>
<style scoped lang="scss">
.svg-icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
</style>
......@@ -7,75 +7,60 @@
:key="index"
:name="item.name"
>
<slot :name="item.name"></slot>
<div class="tab-content">
<slot :name="item.name"></slot>
</div>
</van-tab>
</van-tabs>
<div v-show="active === 'share'">
<share ref="shareRefs" :isShowOverlay="true">
<div id="shareContainer" class="map-container"></div>
</share>
</div>
</div>
</template>
<script>
import { defineComponent, nextTick, ref } from "vue";
import { ref } from "vue";
import routes from "@/router/routes";
import { useRoute } from "vue-router";
import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant";
export default defineComponent({
export default {
name: "TopTab",
setup() {
setup(props, { emit }) {
const tabRoutes = ref([]);
const active = ref(null);
const route = useRoute();
let routeQuery = route.query;
let map = null;
let checkLoadedTimeoutId = "";
tabRoutes.value = routes.tabRoutes;
active.value = routeQuery.tabItem;
const onTabClick = (e) => {
if (e.name === "share") {
nextTick(() => {
console.log(active.value);
AMapLoader.load({
key: CONSTANT.MAP_KEY,
version: "1.4.8",
plugins: CONSTANT.MAP_PLUGINS,
}).then((AMap) => {
window.AMap = AMap;
if (map) return;
initMap("shareContainer");
});
let routesArr = JSON.parse(JSON.stringify(routes.tabRoutes));
// 过滤tab
const filterTabs = async (cb) => {
let source = routeQuery.source;
// 有线设备 无设备调频
if (source == 1) {
routesArr.map((val, index) => {
if (val.name === "freq") {
routesArr.splice(index, 1);
}
});
}
if (source == 0) {
routesArr.map((val, index) => {
if (val.name === "fence") {
routesArr.splice(index, 1);
}
});
}
await cb();
};
const initMap = (id) => {
let check = () => {
checkLoadedTimeoutId && window.clearTimeout(checkLoadedTimeoutId);
let AMap = window.AMap;
if (AMap && typeof AMap.Map == "function") {
window.AMap = AMap;
init(id);
} else {
checkLoadedTimeoutId = check();
}
};
checkLoadedTimeoutId = check();
};
const init = (id) => {
console.log(id);
map = new window.AMap.Map(id);
console.log(map);
return map;
filterTabs(() => {
tabRoutes.value = routesArr;
active.value = routeQuery.tabItem;
});
const onTabClick = (e) => {
emit("changeTabItem", e);
};
return {
tabRoutes,
active,
onTabClick,
filterTabs,
};
},
});
};
</script>
<style lang="scss">
.van-tabs__wrap {
......
export const MAP_KEY = "c3c66897b0c7c3170ba7f3b596e76e6b";
export const MAP_KEY = "75116f653f3b2e4568116dad8cd9b899";
// 地图插件
export const MAP_PLUGINS = [
......
......@@ -5,11 +5,15 @@ import "@/assets/spritesmith-generated/sprite.css";
import router from "./router";
import { vant } from "@/utils/vant.config";
import "@/assets/css/style.css";
import "@/assets/icons";
import SvgIcon from "@/components/svgIcon";
const app = createApp(App);
app.component("svg-icon", SvgIcon);
vant(app);
app.use(store).use(router).mount("#app");
router.beforeEach((to, from, next) => {
console.log(to);
if (to.meta.title) {
document.title = to.meta.title;
}
......
......@@ -41,7 +41,7 @@ const tabRoutes = [
},
{
path: "/deviceFreq",
name: "deviceFreq",
name: "freq",
title: "设备调频",
component: () => import("../views/monitor.vue"),
},
......
/* eslint-disable */
const ADCODE = [
{ adcode: "86", parentid: "0", type: "0", name: "中华人民共和国" },
{ adcode: "110000", parentid: "86", type: "1", name: "北京市" },
{ adcode: "110100", parentid: "110000", type: "2", name: "北京市市辖区" },
{ adcode: "120000", parentid: "86", type: "1", name: "天津市" },
{ adcode: "120100", parentid: "120000", type: "2", name: "天津市市辖区" },
{ adcode: "130000", parentid: "86", type: "1", name: "河北省" },
{ adcode: "130100", parentid: "130000", type: "2", name: "石家庄市" },
{ adcode: "130200", parentid: "130000", type: "2", name: "唐山市" },
{ adcode: "130300", parentid: "130000", type: "2", name: "秦皇岛市" },
{ adcode: "130400", parentid: "130000", type: "2", name: "邯郸市" },
{ adcode: "130500", parentid: "130000", type: "2", name: "邢台市" },
{ adcode: "130600", parentid: "130000", type: "2", name: "保定市" },
{ adcode: "130700", parentid: "130000", type: "2", name: "张家口市" },
{ adcode: "130800", parentid: "130000", type: "2", name: "承德市" },
{ adcode: "130900", parentid: "130000", type: "2", name: "沧州市" },
{ adcode: "131000", parentid: "130000", type: "2", name: "廊坊市" },
{ adcode: "131100", parentid: "130000", type: "2", name: "衡水市" },
{ adcode: "140000", parentid: "86", type: "1", name: "山西省" },
{ adcode: "140100", parentid: "140000", type: "2", name: "太原市" },
{ adcode: "140200", parentid: "140000", type: "2", name: "大同市" },
{ adcode: "140300", parentid: "140000", type: "2", name: "阳泉市" },
{ adcode: "140400", parentid: "140000", type: "2", name: "长治市" },
{ adcode: "140500", parentid: "140000", type: "2", name: "晋城市" },
{ adcode: "140600", parentid: "140000", type: "2", name: "朔州市" },
{ adcode: "140700", parentid: "140000", type: "2", name: "晋中市" },
{ adcode: "140800", parentid: "140000", type: "2", name: "运城市" },
{ adcode: "140900", parentid: "140000", type: "2", name: "忻州市" },
{ adcode: "141000", parentid: "140000", type: "2", name: "临汾市" },
{ adcode: "141100", parentid: "140000", type: "2", name: "吕梁市" },
{ adcode: "150000", parentid: "86", type: "1", name: "内蒙古自治区" },
{ adcode: "150100", parentid: "150000", type: "2", name: "呼和浩特市" },
{ adcode: "150200", parentid: "150000", type: "2", name: "包头市" },
{ adcode: "150300", parentid: "150000", type: "2", name: "乌海市" },
{ adcode: "150400", parentid: "150000", type: "2", name: "赤峰市" },
{ adcode: "150500", parentid: "150000", type: "2", name: "通辽市" },
{ adcode: "150600", parentid: "150000", type: "2", name: "鄂尔多斯市" },
{ adcode: "150700", parentid: "150000", type: "2", name: "呼伦贝尔市" },
{ adcode: "150800", parentid: "150000", type: "2", name: "巴彦淖尔市" },
{ adcode: "150900", parentid: "150000", type: "2", name: "乌兰察布市" },
{ adcode: "152200", parentid: "150000", type: "2", name: "兴安盟" },
{ adcode: "152500", parentid: "150000", type: "2", name: "锡林郭勒盟" },
{ adcode: "152900", parentid: "150000", type: "2", name: "阿拉善盟" },
{ adcode: "210000", parentid: "86", type: "1", name: "辽宁省" },
{ adcode: "210100", parentid: "210000", type: "2", name: "沈阳市" },
{ adcode: "210200", parentid: "210000", type: "2", name: "大连市" },
{ adcode: "210300", parentid: "210000", type: "2", name: "鞍山市" },
{ adcode: "210400", parentid: "210000", type: "2", name: "抚顺市" },
{ adcode: "210500", parentid: "210000", type: "2", name: "本溪市" },
{ adcode: "210600", parentid: "210000", type: "2", name: "丹东市" },
{ adcode: "210700", parentid: "210000", type: "2", name: "锦州市" },
{ adcode: "210800", parentid: "210000", type: "2", name: "营口市" },
{ adcode: "210900", parentid: "210000", type: "2", name: "阜新市" },
{ adcode: "211000", parentid: "210000", type: "2", name: "辽阳市" },
{ adcode: "211100", parentid: "210000", type: "2", name: "盘锦市" },
{ adcode: "211200", parentid: "210000", type: "2", name: "铁岭市" },
{ adcode: "211300", parentid: "210000", type: "2", name: "朝阳市" },
{ adcode: "211400", parentid: "210000", type: "2", name: "葫芦岛市" },
{ adcode: "220000", parentid: "86", type: "1", name: "吉林省" },
{ adcode: "220100", parentid: "220000", type: "2", name: "长春市" },
{ adcode: "220200", parentid: "220000", type: "2", name: "吉林市" },
{ adcode: "220300", parentid: "220000", type: "2", name: "四平市" },
{ adcode: "220400", parentid: "220000", type: "2", name: "辽源市" },
{ adcode: "220500", parentid: "220000", type: "2", name: "通化市" },
{ adcode: "220600", parentid: "220000", type: "2", name: "白山市" },
{ adcode: "220700", parentid: "220000", type: "2", name: "松原市" },
{ adcode: "220800", parentid: "220000", type: "2", name: "白城市" },
{ adcode: "222400", parentid: "220000", type: "2", name: "延边朝鲜族自治州" },
{ adcode: "230000", parentid: "86", type: "1", name: "黑龙江省" },
{ adcode: "230100", parentid: "230000", type: "2", name: "哈尔滨市" },
{ adcode: "230200", parentid: "230000", type: "2", name: "齐齐哈尔市" },
{ adcode: "230300", parentid: "230000", type: "2", name: "鸡西市" },
{ adcode: "230400", parentid: "230000", type: "2", name: "鹤岗市" },
{ adcode: "230500", parentid: "230000", type: "2", name: "双鸭山市" },
{ adcode: "230600", parentid: "230000", type: "2", name: "大庆市" },
{ adcode: "230700", parentid: "230000", type: "2", name: "伊春市" },
{ adcode: "230800", parentid: "230000", type: "2", name: "佳木斯市" },
{ adcode: "230900", parentid: "230000", type: "2", name: "七台河市" },
{ adcode: "231000", parentid: "230000", type: "2", name: "牡丹江市" },
{ adcode: "231100", parentid: "230000", type: "2", name: "黑河市" },
{ adcode: "231200", parentid: "230000", type: "2", name: "绥化市" },
{ adcode: "232700", parentid: "230000", type: "2", name: "大兴安岭地区" },
{ adcode: "310000", parentid: "86", type: "1", name: "上海市" },
{ adcode: "310100", parentid: "310000", type: "2", name: "上海市市辖区" },
{ adcode: "320000", parentid: "86", type: "1", name: "江苏省" },
{ adcode: "320100", parentid: "320000", type: "2", name: "南京市" },
{ adcode: "320200", parentid: "320000", type: "2", name: "无锡市" },
{ adcode: "320300", parentid: "320000", type: "2", name: "徐州市" },
{ adcode: "320400", parentid: "320000", type: "2", name: "常州市" },
{ adcode: "320500", parentid: "320000", type: "2", name: "苏州市" },
{ adcode: "320600", parentid: "320000", type: "2", name: "南通市" },
{ adcode: "320700", parentid: "320000", type: "2", name: "连云港市" },
{ adcode: "320800", parentid: "320000", type: "2", name: "淮安市" },
{ adcode: "320900", parentid: "320000", type: "2", name: "盐城市" },
{ adcode: "321000", parentid: "320000", type: "2", name: "扬州市" },
{ adcode: "321100", parentid: "320000", type: "2", name: "镇江市" },
{ adcode: "321200", parentid: "320000", type: "2", name: "泰州市" },
{ adcode: "321300", parentid: "320000", type: "2", name: "宿迁市" },
{ adcode: "330000", parentid: "86", type: "1", name: "浙江省" },
{ adcode: "330100", parentid: "330000", type: "2", name: "杭州市" },
{ adcode: "330200", parentid: "330000", type: "2", name: "宁波市" },
{ adcode: "330300", parentid: "330000", type: "2", name: "温州市" },
{ adcode: "330400", parentid: "330000", type: "2", name: "嘉兴市" },
{ adcode: "330500", parentid: "330000", type: "2", name: "湖州市" },
{ adcode: "330600", parentid: "330000", type: "2", name: "绍兴市" },
{ adcode: "330700", parentid: "330000", type: "2", name: "金华市" },
{ adcode: "330800", parentid: "330000", type: "2", name: "衢州市" },
{ adcode: "330900", parentid: "330000", type: "2", name: "舟山市" },
{ adcode: "331000", parentid: "330000", type: "2", name: "台州市" },
{ adcode: "331100", parentid: "330000", type: "2", name: "丽水市" },
{ adcode: "340000", parentid: "86", type: "1", name: "安徽省" },
{ adcode: "340100", parentid: "340000", type: "2", name: "合肥市" },
{ adcode: "340200", parentid: "340000", type: "2", name: "芜湖市" },
{ adcode: "340300", parentid: "340000", type: "2", name: "蚌埠市" },
{ adcode: "340400", parentid: "340000", type: "2", name: "淮南市" },
{ adcode: "340500", parentid: "340000", type: "2", name: "马鞍山市" },
{ adcode: "340600", parentid: "340000", type: "2", name: "淮北市" },
{ adcode: "340700", parentid: "340000", type: "2", name: "铜陵市" },
{ adcode: "340800", parentid: "340000", type: "2", name: "安庆市" },
{ adcode: "341000", parentid: "340000", type: "2", name: "黄山市" },
{ adcode: "341100", parentid: "340000", type: "2", name: "滁州市" },
{ adcode: "341200", parentid: "340000", type: "2", name: "阜阳市" },
{ adcode: "341300", parentid: "340000", type: "2", name: "宿州市" },
{ adcode: "341500", parentid: "340000", type: "2", name: "六安市" },
{ adcode: "341600", parentid: "340000", type: "2", name: "亳州市" },
{ adcode: "341700", parentid: "340000", type: "2", name: "池州市" },
{ adcode: "341800", parentid: "340000", type: "2", name: "宣城市" },
{ adcode: "350000", parentid: "86", type: "1", name: "福建省" },
{ adcode: "350100", parentid: "350000", type: "2", name: "福州市" },
{ adcode: "350200", parentid: "350000", type: "2", name: "厦门市" },
{ adcode: "350300", parentid: "350000", type: "2", name: "莆田市" },
{ adcode: "350400", parentid: "350000", type: "2", name: "三明市" },
{ adcode: "350500", parentid: "350000", type: "2", name: "泉州市" },
{ adcode: "350600", parentid: "350000", type: "2", name: "漳州市" },
{ adcode: "350700", parentid: "350000", type: "2", name: "南平市" },
{ adcode: "350800", parentid: "350000", type: "2", name: "龙岩市" },
{ adcode: "350900", parentid: "350000", type: "2", name: "宁德市" },
{ adcode: "360000", parentid: "86", type: "1", name: "江西省" },
{ adcode: "360100", parentid: "360000", type: "2", name: "南昌市" },
{ adcode: "360200", parentid: "360000", type: "2", name: "景德镇市" },
{ adcode: "360300", parentid: "360000", type: "2", name: "萍乡市" },
{ adcode: "360400", parentid: "360000", type: "2", name: "九江市" },
{ adcode: "360500", parentid: "360000", type: "2", name: "新余市" },
{ adcode: "360600", parentid: "360000", type: "2", name: "鹰潭市" },
{ adcode: "360700", parentid: "360000", type: "2", name: "赣州市" },
{ adcode: "360800", parentid: "360000", type: "2", name: "吉安市" },
{ adcode: "360900", parentid: "360000", type: "2", name: "宜春市" },
{ adcode: "361000", parentid: "360000", type: "2", name: "抚州市" },
{ adcode: "361100", parentid: "360000", type: "2", name: "上饶市" },
{ adcode: "370000", parentid: "86", type: "1", name: "山东省" },
{ adcode: "370100", parentid: "370000", type: "2", name: "济南市" },
{ adcode: "370200", parentid: "370000", type: "2", name: "青岛市" },
{ adcode: "370300", parentid: "370000", type: "2", name: "淄博市" },
{ adcode: "370400", parentid: "370000", type: "2", name: "枣庄市" },
{ adcode: "370500", parentid: "370000", type: "2", name: "东营市" },
{ adcode: "370600", parentid: "370000", type: "2", name: "烟台市" },
{ adcode: "370700", parentid: "370000", type: "2", name: "潍坊市" },
{ adcode: "370800", parentid: "370000", type: "2", name: "济宁市" },
{ adcode: "370900", parentid: "370000", type: "2", name: "泰安市" },
{ adcode: "371000", parentid: "370000", type: "2", name: "威海市" },
{ adcode: "371100", parentid: "370000", type: "2", name: "日照市" },
{ adcode: "371200", parentid: "370000", type: "2", name: "莱芜市" },
{ adcode: "371300", parentid: "370000", type: "2", name: "临沂市" },
{ adcode: "371400", parentid: "370000", type: "2", name: "德州市" },
{ adcode: "371500", parentid: "370000", type: "2", name: "聊城市" },
{ adcode: "371600", parentid: "370000", type: "2", name: "滨州市" },
{ adcode: "371700", parentid: "370000", type: "2", name: "菏泽市" },
{ adcode: "410000", parentid: "86", type: "1", name: "河南省" },
{ adcode: "410100", parentid: "410000", type: "2", name: "郑州市" },
{ adcode: "410200", parentid: "410000", type: "2", name: "开封市" },
{ adcode: "410300", parentid: "410000", type: "2", name: "洛阳市" },
{ adcode: "410400", parentid: "410000", type: "2", name: "平顶山市" },
{ adcode: "410500", parentid: "410000", type: "2", name: "安阳市" },
{ adcode: "410600", parentid: "410000", type: "2", name: "鹤壁市" },
{ adcode: "410700", parentid: "410000", type: "2", name: "新乡市" },
{ adcode: "410800", parentid: "410000", type: "2", name: "焦作市" },
{ adcode: "410900", parentid: "410000", type: "2", name: "濮阳市" },
{ adcode: "411000", parentid: "410000", type: "2", name: "许昌市" },
{ adcode: "411100", parentid: "410000", type: "2", name: "漯河市" },
{ adcode: "411200", parentid: "410000", type: "2", name: "三门峡市" },
{ adcode: "411300", parentid: "410000", type: "2", name: "南阳市" },
{ adcode: "411400", parentid: "410000", type: "2", name: "商丘市" },
{ adcode: "411500", parentid: "410000", type: "2", name: "信阳市" },
{ adcode: "411600", parentid: "410000", type: "2", name: "周口市" },
{ adcode: "411700", parentid: "410000", type: "2", name: "驻马店市" },
{ adcode: "419001", parentid: "410000", type: "2", name: "济源市" },
{ adcode: "420000", parentid: "86", type: "1", name: "湖北省" },
{ adcode: "420100", parentid: "420000", type: "2", name: "武汉市" },
{ adcode: "420200", parentid: "420000", type: "2", name: "黄石市" },
{ adcode: "420300", parentid: "420000", type: "2", name: "十堰市" },
{ adcode: "420500", parentid: "420000", type: "2", name: "宜昌市" },
{ adcode: "420600", parentid: "420000", type: "2", name: "襄阳市" },
{ adcode: "420700", parentid: "420000", type: "2", name: "鄂州市" },
{ adcode: "420800", parentid: "420000", type: "2", name: "荆门市" },
{ adcode: "420900", parentid: "420000", type: "2", name: "孝感市" },
{ adcode: "421000", parentid: "420000", type: "2", name: "荆州市" },
{ adcode: "421100", parentid: "420000", type: "2", name: "黄冈市" },
{ adcode: "421200", parentid: "420000", type: "2", name: "咸宁市" },
{ adcode: "421300", parentid: "420000", type: "2", name: "随州市" },
{
adcode: "422800",
parentid: "420000",
type: "2",
name: "恩施土家族苗族自治州",
},
{ adcode: "429004", parentid: "420000", type: "2", name: "仙桃市" },
{ adcode: "429005", parentid: "420000", type: "2", name: "潜江市" },
{ adcode: "429006", parentid: "420000", type: "2", name: "天门市" },
{ adcode: "429021", parentid: "420000", type: "2", name: "神农架林区" },
{ adcode: "430000", parentid: "86", type: "1", name: "湖南省" },
{ adcode: "430100", parentid: "430000", type: "2", name: "长沙市" },
{ adcode: "430200", parentid: "430000", type: "2", name: "株洲市" },
{ adcode: "430300", parentid: "430000", type: "2", name: "湘潭市" },
{ adcode: "430400", parentid: "430000", type: "2", name: "衡阳市" },
{ adcode: "430500", parentid: "430000", type: "2", name: "邵阳市" },
{ adcode: "430600", parentid: "430000", type: "2", name: "岳阳市" },
{ adcode: "430700", parentid: "430000", type: "2", name: "常德市" },
{ adcode: "430800", parentid: "430000", type: "2", name: "张家界市" },
{ adcode: "430900", parentid: "430000", type: "2", name: "益阳市" },
{ adcode: "431000", parentid: "430000", type: "2", name: "郴州市" },
{ adcode: "431100", parentid: "430000", type: "2", name: "永州市" },
{ adcode: "431200", parentid: "430000", type: "2", name: "怀化市" },
{ adcode: "431300", parentid: "430000", type: "2", name: "娄底市" },
{
adcode: "433100",
parentid: "430000",
type: "2",
name: "湘西土家族苗族自治州",
},
{ adcode: "440000", parentid: "86", type: "1", name: "广东省" },
{ adcode: "440100", parentid: "440000", type: "2", name: "广州市" },
{ adcode: "440200", parentid: "440000", type: "2", name: "韶关市" },
{ adcode: "440300", parentid: "440000", type: "2", name: "深圳市" },
{ adcode: "440400", parentid: "440000", type: "2", name: "珠海市" },
{ adcode: "440500", parentid: "440000", type: "2", name: "汕头市" },
{ adcode: "440600", parentid: "440000", type: "2", name: "佛山市" },
{ adcode: "440700", parentid: "440000", type: "2", name: "江门市" },
{ adcode: "440800", parentid: "440000", type: "2", name: "湛江市" },
{ adcode: "440900", parentid: "440000", type: "2", name: "茂名市" },
{ adcode: "441200", parentid: "440000", type: "2", name: "肇庆市" },
{ adcode: "441300", parentid: "440000", type: "2", name: "惠州市" },
{ adcode: "441400", parentid: "440000", type: "2", name: "梅州市" },
{ adcode: "441500", parentid: "440000", type: "2", name: "汕尾市" },
{ adcode: "441600", parentid: "440000", type: "2", name: "河源市" },
{ adcode: "441700", parentid: "440000", type: "2", name: "阳江市" },
{ adcode: "441800", parentid: "440000", type: "2", name: "清远市" },
{ adcode: "441900", parentid: "440000", type: "2", name: "东莞市" },
{ adcode: "442000", parentid: "440000", type: "2", name: "中山市" },
{ adcode: "445100", parentid: "440000", type: "2", name: "潮州市" },
{ adcode: "445200", parentid: "440000", type: "2", name: "揭阳市" },
{ adcode: "445300", parentid: "440000", type: "2", name: "云浮市" },
{ adcode: "450000", parentid: "86", type: "1", name: "广西壮族自治区" },
{ adcode: "450100", parentid: "450000", type: "2", name: "南宁市" },
{ adcode: "450200", parentid: "450000", type: "2", name: "柳州市" },
{ adcode: "450300", parentid: "450000", type: "2", name: "桂林市" },
{ adcode: "450400", parentid: "450000", type: "2", name: "梧州市" },
{ adcode: "450500", parentid: "450000", type: "2", name: "北海市" },
{ adcode: "450600", parentid: "450000", type: "2", name: "防城港市" },
{ adcode: "450700", parentid: "450000", type: "2", name: "钦州市" },
{ adcode: "450800", parentid: "450000", type: "2", name: "贵港市" },
{ adcode: "450900", parentid: "450000", type: "2", name: "玉林市" },
{ adcode: "451000", parentid: "450000", type: "2", name: "百色市" },
{ adcode: "451100", parentid: "450000", type: "2", name: "贺州市" },
{ adcode: "451200", parentid: "450000", type: "2", name: "河池市" },
{ adcode: "451300", parentid: "450000", type: "2", name: "来宾市" },
{ adcode: "451400", parentid: "450000", type: "2", name: "崇左市" },
{ adcode: "460000", parentid: "86", type: "1", name: "海南省" },
{ adcode: "460100", parentid: "460000", type: "2", name: "海口市" },
{ adcode: "460200", parentid: "460000", type: "2", name: "三亚市" },
{ adcode: "460300", parentid: "460000", type: "2", name: "三沙市" },
{ adcode: "469001", parentid: "460000", type: "2", name: "五指山市" },
{ adcode: "469002", parentid: "460000", type: "2", name: "琼海市" },
{ adcode: "469003", parentid: "460000", type: "2", name: "儋州市" },
{ adcode: "469005", parentid: "460000", type: "2", name: "文昌市" },
{ adcode: "469006", parentid: "460000", type: "2", name: "万宁市" },
{ adcode: "469007", parentid: "460000", type: "2", name: "东方市" },
{ adcode: "469021", parentid: "460000", type: "2", name: "定安县" },
{ adcode: "469022", parentid: "460000", type: "2", name: "屯昌县" },
{ adcode: "469023", parentid: "460000", type: "2", name: "澄迈县" },
{ adcode: "469024", parentid: "460000", type: "2", name: "临高县" },
{ adcode: "469025", parentid: "460000", type: "2", name: "白沙黎族自治县" },
{ adcode: "469026", parentid: "460000", type: "2", name: "昌江黎族自治县" },
{ adcode: "469027", parentid: "460000", type: "2", name: "乐东黎族自治县" },
{ adcode: "469028", parentid: "460000", type: "2", name: "陵水黎族自治县" },
{
adcode: "469029",
parentid: "460000",
type: "2",
name: "保亭黎族苗族自治县",
},
{
adcode: "469030",
parentid: "460000",
type: "2",
name: "琼中黎族苗族自治县",
},
{ adcode: "469031", parentid: "460000", type: "2", name: "西沙群岛" },
{ adcode: "469032", parentid: "460000", type: "2", name: "南沙群岛" },
{
adcode: "469033",
parentid: "460000",
type: "2",
name: "中沙群岛的岛礁及其海域",
},
{ adcode: "500000", parentid: "86", type: "1", name: "重庆市" },
{ adcode: "500100", parentid: "500000", type: "2", name: "重庆市市辖区" },
{ adcode: "510000", parentid: "86", type: "1", name: "四川省" },
{ adcode: "510100", parentid: "510000", type: "2", name: "成都市" },
{ adcode: "510300", parentid: "510000", type: "2", name: "自贡市" },
{ adcode: "510400", parentid: "510000", type: "2", name: "攀枝花市" },
{ adcode: "510500", parentid: "510000", type: "2", name: "泸州市" },
{ adcode: "510600", parentid: "510000", type: "2", name: "德阳市" },
{ adcode: "510700", parentid: "510000", type: "2", name: "绵阳市" },
{ adcode: "510800", parentid: "510000", type: "2", name: "广元市" },
{ adcode: "510900", parentid: "510000", type: "2", name: "遂宁市" },
{ adcode: "511000", parentid: "510000", type: "2", name: "内江市" },
{ adcode: "511100", parentid: "510000", type: "2", name: "乐山市" },
{ adcode: "511300", parentid: "510000", type: "2", name: "南充市" },
{ adcode: "511400", parentid: "510000", type: "2", name: "眉山市" },
{ adcode: "511500", parentid: "510000", type: "2", name: "宜宾市" },
{ adcode: "511600", parentid: "510000", type: "2", name: "广安市" },
{ adcode: "511700", parentid: "510000", type: "2", name: "达州市" },
{ adcode: "511800", parentid: "510000", type: "2", name: "雅安市" },
{ adcode: "511900", parentid: "510000", type: "2", name: "巴中市" },
{ adcode: "512000", parentid: "510000", type: "2", name: "资阳市" },
{
adcode: "513200",
parentid: "510000",
type: "2",
name: "阿坝藏族羌族自治州",
},
{ adcode: "513300", parentid: "510000", type: "2", name: "甘孜藏族自治州" },
{ adcode: "513400", parentid: "510000", type: "2", name: "凉山彝族自治州" },
{ adcode: "520000", parentid: "86", type: "1", name: "贵州省" },
{ adcode: "520100", parentid: "520000", type: "2", name: "贵阳市" },
{ adcode: "520200", parentid: "520000", type: "2", name: "六盘水市" },
{ adcode: "520300", parentid: "520000", type: "2", name: "遵义市" },
{ adcode: "520400", parentid: "520000", type: "2", name: "安顺市" },
{ adcode: "520500", parentid: "520000", type: "2", name: "毕节市" },
{ adcode: "520600", parentid: "520000", type: "2", name: "铜仁市" },
{
adcode: "522300",
parentid: "520000",
type: "2",
name: "黔西南布依族苗族自治州",
},
{
adcode: "522600",
parentid: "520000",
type: "2",
name: "黔东南苗族侗族自治州",
},
{
adcode: "522700",
parentid: "520000",
type: "2",
name: "黔南布依族苗族自治州",
},
{ adcode: "530000", parentid: "86", type: "1", name: "云南省" },
{ adcode: "530100", parentid: "530000", type: "2", name: "昆明市" },
{ adcode: "530300", parentid: "530000", type: "2", name: "曲靖市" },
{ adcode: "530400", parentid: "530000", type: "2", name: "玉溪市" },
{ adcode: "530500", parentid: "530000", type: "2", name: "保山市" },
{ adcode: "530600", parentid: "530000", type: "2", name: "昭通市" },
{ adcode: "530700", parentid: "530000", type: "2", name: "丽江市" },
{ adcode: "530800", parentid: "530000", type: "2", name: "普洱市" },
{ adcode: "530900", parentid: "530000", type: "2", name: "临沧市" },
{ adcode: "532300", parentid: "530000", type: "2", name: "楚雄彝族自治州" },
{
adcode: "532500",
parentid: "530000",
type: "2",
name: "红河哈尼族彝族自治州",
},
{
adcode: "532600",
parentid: "530000",
type: "2",
name: "文山壮族苗族自治州",
},
{
adcode: "532800",
parentid: "530000",
type: "2",
name: "西双版纳傣族自治州",
},
{ adcode: "532900", parentid: "530000", type: "2", name: "大理白族自治州" },
{
adcode: "533100",
parentid: "530000",
type: "2",
name: "德宏傣族景颇族自治州",
},
{ adcode: "533300", parentid: "530000", type: "2", name: "怒江傈僳族自治州" },
{ adcode: "533400", parentid: "530000", type: "2", name: "迪庆藏族自治州" },
{ adcode: "540000", parentid: "86", type: "1", name: "西藏自治区" },
{ adcode: "540100", parentid: "540000", type: "2", name: "拉萨市" },
{ adcode: "542100", parentid: "540000", type: "2", name: "昌都地区" },
{ adcode: "542200", parentid: "540000", type: "2", name: "山南地区" },
{ adcode: "542300", parentid: "540000", type: "2", name: "日喀则地区" },
{ adcode: "542400", parentid: "540000", type: "2", name: "那曲地区" },
{ adcode: "542500", parentid: "540000", type: "2", name: "阿里地区" },
{ adcode: "542600", parentid: "540000", type: "2", name: "林芝地区" },
{ adcode: "610000", parentid: "86", type: "1", name: "陕西省" },
{ adcode: "610100", parentid: "610000", type: "2", name: "西安市" },
{ adcode: "610200", parentid: "610000", type: "2", name: "铜川市" },
{ adcode: "610300", parentid: "610000", type: "2", name: "宝鸡市" },
{ adcode: "610400", parentid: "610000", type: "2", name: "咸阳市" },
{ adcode: "610500", parentid: "610000", type: "2", name: "渭南市" },
{ adcode: "610600", parentid: "610000", type: "2", name: "延安市" },
{ adcode: "610700", parentid: "610000", type: "2", name: "汉中市" },
{ adcode: "610800", parentid: "610000", type: "2", name: "榆林市" },
{ adcode: "610900", parentid: "610000", type: "2", name: "安康市" },
{ adcode: "611000", parentid: "610000", type: "2", name: "商洛市" },
{ adcode: "620000", parentid: "86", type: "1", name: "甘肃省" },
{ adcode: "620100", parentid: "620000", type: "2", name: "兰州市" },
{ adcode: "620200", parentid: "620000", type: "2", name: "嘉峪关市" },
{ adcode: "620300", parentid: "620000", type: "2", name: "金昌市" },
{ adcode: "620400", parentid: "620000", type: "2", name: "白银市" },
{ adcode: "620500", parentid: "620000", type: "2", name: "天水市" },
{ adcode: "620600", parentid: "620000", type: "2", name: "武威市" },
{ adcode: "620700", parentid: "620000", type: "2", name: "张掖市" },
{ adcode: "620800", parentid: "620000", type: "2", name: "平凉市" },
{ adcode: "620900", parentid: "620000", type: "2", name: "酒泉市" },
{ adcode: "621000", parentid: "620000", type: "2", name: "庆阳市" },
{ adcode: "621100", parentid: "620000", type: "2", name: "定西市" },
{ adcode: "621200", parentid: "620000", type: "2", name: "陇南市" },
{ adcode: "622900", parentid: "620000", type: "2", name: "临夏回族自治州" },
{ adcode: "630000", parentid: "86", type: "1", name: "青海省" },
{ adcode: "630100", parentid: "630000", type: "2", name: "西宁市" },
{ adcode: "632100", parentid: "630000", type: "2", name: "海东地区" },
{ adcode: "632200", parentid: "630000", type: "2", name: "海北藏族自治州" },
{ adcode: "632300", parentid: "630000", type: "2", name: "黄南藏族自治州" },
{ adcode: "632500", parentid: "630000", type: "2", name: "海南藏族自治州" },
{ adcode: "632600", parentid: "630000", type: "2", name: "果洛藏族自治州" },
{ adcode: "632700", parentid: "630000", type: "2", name: "玉树藏族自治州" },
{
adcode: "632800",
parentid: "630000",
type: "2",
name: "海西蒙古族藏族自治州",
},
{ adcode: "640000", parentid: "86", type: "1", name: "宁夏回族自治区" },
{ adcode: "640100", parentid: "640000", type: "2", name: "银川市" },
{ adcode: "640200", parentid: "640000", type: "2", name: "石嘴山市" },
{ adcode: "640300", parentid: "640000", type: "2", name: "吴忠市" },
{ adcode: "640400", parentid: "640000", type: "2", name: "固原市" },
{ adcode: "640500", parentid: "640000", type: "2", name: "中卫市" },
{ adcode: "650000", parentid: "86", type: "1", name: "新疆维吾尔自治区" },
{ adcode: "650100", parentid: "650000", type: "2", name: "乌鲁木齐市" },
{ adcode: "650200", parentid: "650000", type: "2", name: "克拉玛依市" },
{ adcode: "652100", parentid: "650000", type: "2", name: "吐鲁番地区" },
{ adcode: "652200", parentid: "650000", type: "2", name: "哈密地区" },
{ adcode: "652300", parentid: "650000", type: "2", name: "昌吉回族自治州" },
{
adcode: "652700",
parentid: "650000",
type: "2",
name: "博尔塔拉蒙古自治州",
},
{
adcode: "652800",
parentid: "650000",
type: "2",
name: "巴音郭楞蒙古自治州",
},
{ adcode: "652900", parentid: "650000", type: "2", name: "阿克苏地区" },
{ adcode: "653100", parentid: "650000", type: "2", name: "喀什地区" },
{ adcode: "653200", parentid: "650000", type: "2", name: "和田地区" },
{ adcode: "654200", parentid: "650000", type: "2", name: "塔城地区" },
{ adcode: "654300", parentid: "650000", type: "2", name: "阿勒泰地区" },
{ adcode: "659001", parentid: "650000", type: "2", name: "石河子市" },
{ adcode: "659002", parentid: "650000", type: "2", name: "阿拉尔市" },
{ adcode: "659003", parentid: "650000", type: "2", name: "图木舒克市" },
{ adcode: "659004", parentid: "650000", type: "2", name: "五家渠市" },
{ adcode: "700000", parentid: "86", type: "1", name: "台灣" },
{ adcode: "710000", parentid: "700000", type: "2", name: "台湾省" },
{ adcode: "720000", parentid: "700000", type: "2", name: "台灣福建省" },
{ adcode: "730000", parentid: "700000", type: "2", name: "台灣" },
{ adcode: "740000", parentid: "700000", type: "2", name: "台北市" },
{ adcode: "750000", parentid: "700000", type: "2", name: "高雄市" },
{ adcode: "760000", parentid: "700000", type: "2", name: "新北市" },
{ adcode: "770000", parentid: "700000", type: "2", name: "台中市" },
{ adcode: "780000", parentid: "700000", type: "2", name: "台南市" },
{ adcode: "810000", parentid: "86", type: "1", name: "香港特别行政区" },
{ adcode: "810001", parentid: "810000", type: "2", name: "中西区" },
{ adcode: "810002", parentid: "810000", type: "2", name: "湾仔区" },
{ adcode: "810003", parentid: "810000", type: "2", name: "东区" },
{ adcode: "810004", parentid: "810000", type: "2", name: "南区" },
{ adcode: "810005", parentid: "810000", type: "2", name: "油尖旺区" },
{ adcode: "810006", parentid: "810000", type: "2", name: "深水埗区" },
{ adcode: "810007", parentid: "810000", type: "2", name: "九龙城区" },
{ adcode: "810008", parentid: "810000", type: "2", name: "黄大仙区" },
{ adcode: "810009", parentid: "810000", type: "2", name: "观塘区" },
{ adcode: "810010", parentid: "810000", type: "2", name: "荃湾区" },
{ adcode: "810011", parentid: "810000", type: "2", name: "屯门区" },
{ adcode: "810012", parentid: "810000", type: "2", name: "元朗区" },
{ adcode: "810013", parentid: "810000", type: "2", name: "北区" },
{ adcode: "810014", parentid: "810000", type: "2", name: "大埔区" },
{ adcode: "810015", parentid: "810000", type: "2", name: "西贡区" },
{ adcode: "810016", parentid: "810000", type: "2", name: "沙田区" },
{ adcode: "810017", parentid: "810000", type: "2", name: "葵青区" },
{ adcode: "810018", parentid: "810000", type: "2", name: "离岛区" },
{ adcode: "820000", parentid: "86", type: "1", name: "澳门特别行政区" },
{ adcode: "820001", parentid: "820000", type: "2", name: "花地玛堂区" },
{ adcode: "820002", parentid: "820000", type: "2", name: "花王堂区" },
{ adcode: "820003", parentid: "820000", type: "2", name: "望德堂区" },
{ adcode: "820004", parentid: "820000", type: "2", name: "大堂区" },
{ adcode: "820005", parentid: "820000", type: "2", name: "风顺堂区" },
{ adcode: "820006", parentid: "820000", type: "2", name: "嘉模堂区" },
{ adcode: "820007", parentid: "820000", type: "2", name: "路氹城" },
{ adcode: "820008", parentid: "820000", type: "2", name: "圣方济各堂区" },
];
export default ADCODE;
......@@ -2,9 +2,9 @@ import axios from "axios";
import { Dialog } from "vant";
import store from "@/store";
// 测试 https://eshield.test.glsx.com.cn
// 开发
// 开发 https://eshield.dev.glsx.com.cn
// 线上
const BASE_URL = "https://eshield.test.glsx.com.cn";
const BASE_URL = "https://eshield.dev.glsx.com.cn";
const instance = axios.create({
// 创建axios实例,在这里可以设置请求的默认配置
timeout: 10 * 60 * 1000, // 设置超时时间60s
......@@ -18,7 +18,10 @@ instance.defaults.headers.post["Content-Type"] = "application/json";
/** 添加请求拦截器 **/
instance.interceptors.request.use(
(config) => {
store.commit("showLoading");
if (config.url.indexOf("/miniappserver/monitor/search") <= -1) {
// 下拉加载不显示loading
store.commit("showLoading");
}
config.headers["Authorization"] = localStorage.getItem("token") || "";
return config;
},
......
......@@ -11,6 +11,9 @@ import {
RadioGroup,
Radio,
Slider,
DropdownMenu,
Field,
Switch,
} from "vant";
export function vant(app) {
......@@ -26,4 +29,7 @@ export function vant(app) {
app.use(RadioGroup);
app.use(Radio);
app.use(Slider);
app.use(DropdownMenu);
app.use(Field);
app.use(Switch);
}
<template>
<div>
<div class="settingControll" @click="showSettingDialog = true">
<a class="icon icon-setting-btn"></a>
<span class="setting-text">设置</span>
</div>
<popup
:show="showSettingDialog"
@btnCancel="showSettingDialog = false"
@btnSave="saveSetting"
:isDisabled="
(selectedTypeItem === 0 && hasRadiusFence) ||
(selectedTypeItem === 1 && hasProviceCityFence)
"
:position="'bottom'"
>
<div class="setting-content">
<div class="type-btn">
<span
:class="selectedTypeItem === index ? 'active' : ''"
v-for="(item, index) in fenceTypeList"
:key="index"
@click="changeFenceType(index)"
>{{ item }}</span
>
</div>
<div class="type-box" v-if="selectedTypeItem === 0">
<div>
<span class="label">{{ fenceTypeList[selectedTypeItem] }}</span>
<van-field
class="input-class"
placeholder="500-5000"
input-align="center"
v-model="radiusNum"
type="digit"
/>&nbsp;&nbsp;米
</div>
</div>
<div class="type-box" v-if="selectedTypeItem === 1">
<div>
<span class="label">{{ fenceTypeList[selectedTypeItem] }}</span>
<a @click="changeProviceCity(1)"
><span
class="radio"
:class="proviceCityType === 1 ? 'active' : ''"
></span
><span>跨省</span></a
>
<a @click="changeProviceCity(2)"
><span
class="radio"
:class="proviceCityType === 2 ? 'active' : ''"
></span
><span>跨市</span></a
>
</div>
</div>
</div>
</popup>
<mapContent @refreshCb="refreshCb" @getData="getData" ref="mapContentRefs">
<template #mapBox>
<div id="fenceContainer" class="map-container"></div>
</template>
</mapContent>
</div>
</template>
<script>
import { defineComponent, onMounted, ref } from "vue";
import mapContent from "@/components/mapContent.vue";
import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant";
import { Toast, Dialog } from "vant";
import ADCODE from "@/utils/adcode";
import { useRoute } from "vue-router";
import "vant/es/toast/style";
import { GET_CAR_LOCATION_INFO, ADD_FENCE } from "@/api/index";
export default defineComponent({
name: "FencePage",
components: {
mapContent,
},
setup() {
const mapContentRefs = ref(null);
const showSettingDialog = ref(false);
const fenceTypeList = ref(["点半径", "跨省市"]);
const selectedTypeItem = ref(0);
const proviceCityType = ref(null);
const radiusNum = ref(null);
const currLnglat = ref(null);
let currentMap = null;
const geocoderValue = ref(null);
let areaPolygons = [];
const route = useRoute();
const routeQuery = route.query;
const hasRadiusFence = ref(false);
const hasProviceCityFence = ref(false);
let district = null;
onMounted(() => {
AMapLoader.load({
key: CONSTANT.MAP_KEY,
version: "1.4.8",
plugins: CONSTANT.MAP_PLUGINS,
}).then((AMap) => {
window.AMap = AMap;
mapContentRefs.value.initMap("fenceContainer");
geocoderValue.value = new AMap.Geocoder({
radius: 1000,
extensions: "all",
});
});
});
// 地图刷新
const refreshCb = () => {};
// 切换围栏类型
const changeFenceType = (index) => {
selectedTypeItem.value = index;
};
// 切换省市
const changeProviceCity = (index) => {
proviceCityType.value = index;
};
// 获取车辆定位信息
const getData = (map) => {
GET_CAR_LOCATION_INFO({ sns: routeQuery.sn }).then((res) => {
currentMap = map ? map : currentMap;
if (res.code === 200) {
if (res.data.length > 0) {
res.data.forEach((val) => {
currLnglat.value = new window.AMap.LngLat(
val["gpsLocation"].elng,
val["gpsLocation"].elat
);
});
} else {
Dialog({ message: "暂无数据" });
}
}
});
};
// 保存围栏
const saveSetting = () => {
if (selectedTypeItem.value === 0 && !radiusNum.value) {
return Toast("请输入半径范围");
}
if (selectedTypeItem.value === 0 && radiusNum.value) {
if (radiusNum.value > 5000 || radiusNum.value < 500) {
return Toast("请输入半径范围500-5000米");
}
// 设置点半径围栏
ADD_FENCE({
shapeType: 1,
radius: radiusNum.value,
lnglat: currLnglat.value.lng + "," + currLnglat.value.lat,
sn: routeQuery.sn,
}).then((res) => {
if (res.code === 200) {
Toast("设定点半径围栏成功");
createCircle(currLnglat.value, radiusNum.value);
createPoint(currLnglat.value);
currentMap = currentMap
? currentMap
: mapContentRefs.value.init("fenceContainer");
drawMarker(currLnglat.value);
currentMap.setFitView();
showSettingDialog.value = false;
hasRadiusFence.value = true;
}
});
}
if (selectedTypeItem.value === 1 && !proviceCityType.value) {
return Toast("请选择跨省或跨市");
}
if (selectedTypeItem.value === 1 && proviceCityType.value) {
getAdcodeByLatlng(currLnglat.value, (obj) => {
var adcodeItem = filterAdcodeObj(obj.adcode);
if (proviceCityType.value != adcodeItem.type) {
adcodeItem = filterAdcodeObj(adcodeItem.parentid);
}
ADD_FENCE({
shapeType: 4,
areaCode: adcodeItem.adcode,
lnglat: currLnglat.value.lng + "," + currLnglat.value.lat,
sn: routeQuery.sn,
}).then((res) => {
if (res.code === 200) {
Toast(
`设定${proviceCityType.value === 1 ? "跨省" : "跨市"}围栏成功`
);
coverArea(adcodeItem.name, currentMap);
currentMap.setFitView();
hasProviceCityFence.value = true;
}
});
});
}
};
const coverArea = (areaName, currentMap) => {
areaPolygons && currentMap.remove(areaPolygons);
//加载行政区划插件
window.AMap.service("AMap.DistrictSearch", function () {
var opts = {
subdistrict: 1, //返回下一级行政区
extensions: "all", //返回行政区边界坐标组等具体信息
level: "city", //查询行政级别为 市
};
//实例化DistrictSearch
district = new window.AMap.DistrictSearch(opts);
district.setLevel("district");
//行政区查询
district.search(areaName, function (status, result) {
var bounds = result.districtList[0].boundaries;
areaPolygons = [];
if (bounds) {
for (var i = 0, l = bounds.length; i < l; i++) {
//生成行政区划polygon
var polygon = new window.AMap.Polygon({
map: currentMap,
strokeWeight: 1,
path: bounds[i],
fillOpacity: 0.7,
fillColor: "#CCF3FF",
strokeColor: "#CC66CC",
});
areaPolygons.push(polygon);
}
currentMap.setFitView(); //地图自适应
showSettingDialog.value = false;
}
});
});
};
// 获取省市code
const getAdcodeByLatlng = (currLnglat, cb) => {
if (geocoderValue.value) {
var lnglatXY = [currLnglat.lng, currLnglat.lat];
geocoderValue.value.getAddress(lnglatXY, function (status, result) {
var _adcode = "";
if (status === "complete" && result.info === "OK") {
_adcode = result.regeocode.addressComponent.adcode;
_adcode = _adcode.substr(0, 4) + "00";
}
cb({ adcode: _adcode });
});
} else {
setTimeout(function () {
getAdcodeByLatlng(currLnglat, cb);
}, 500);
}
};
// 省市区code过滤
const filterAdcodeObj = (adcode) => {
adcode = adcode.toString().substr(0, 4) + "00";
for (var i = 0, len = ADCODE.length; i < len; i++) {
var item = ADCODE[i];
if (adcode == item.adcode) {
return item;
}
}
return null;
};
// 添加标记
const drawMarker = (currLnglat) => {
new window.AMap.Marker({
position: currLnglat,
content:
'<img src=" ' +
require("@/assets/images/car.png") +
'" style="transform: scale(0.5);" />',
map: currentMap,
offset: new window.AMap.Pixel(-17, -26),
});
};
// 地图添加圆
const createCircle = (lnglat, radius) => {
currentMap = currentMap
? currentMap
: mapContentRefs.value.init("fenceContainer");
return new window.AMap.Circle({
map: currentMap,
center: lnglat,
radius: radius,
strokeColor: "#0077FF",
fillColor: "#0077FF",
strokeWeight: 1,
strokeOpacity: 0.5,
fillOpacity: 0.16,
});
};
// 围栏中心点
const createPoint = (lnglat) => {
currentMap = currentMap
? currentMap
: mapContentRefs.value.init("fenceContainer");
return new window.AMap.Circle({
map: currentMap,
center: lnglat,
radius: 3,
strokeColor: "#094",
fillColor: "#094",
strokeWeight: 3,
strokeOpacity: 1,
fillOpacity: 1,
});
};
return {
getData,
currLnglat,
refreshCb,
mapContentRefs,
showSettingDialog,
saveSetting,
fenceTypeList,
selectedTypeItem,
changeFenceType,
proviceCityType,
changeProviceCity,
radiusNum,
createPoint,
createCircle,
hasRadiusFence,
hasProviceCityFence,
};
},
});
</script>
<style lang="scss" scoped>
.settingControll {
position: fixed;
top: 70px;
right: 12px;
width: 40px;
height: 52px;
background: #fff;
z-index: 300;
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
.setting-text {
font-size: 16px;
display: inline-block;
transform: scale(0.5);
}
}
.setting-content {
width: calc(100% - 32px);
height: 100%;
padding: 0 16px;
font-size: 14px;
.type-btn {
width: 100%;
height: 100%;
color: #111;
font-weight: var(--van-font-weight-bold);
display: flex;
span {
flex: 1;
border-radius: 5px;
height: 36px;
margin: 10px 8px;
background: #f0f2f5;
text-align: center;
line-height: 36px;
}
span.active {
height: 34px;
line-height: 34px;
color: var(--base-color);
background: #ebf5ff;
border: 1px solid var(--base-color);
}
}
.type-box {
margin: 8px;
display: flex;
justify-content: space-between;
align-items: center;
div {
display: flex;
align-items: center;
.input-class {
display: inline-block;
width: 120px;
height: 40px;
padding: 0;
margin-left: 16px;
background: #f0f2f5;
border-radius: 4px;
line-height: 40px;
}
a {
display: flex;
align-items: center;
margin-left: 15px;
height: 40px;
.radio {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
margin-right: 5px;
border: 1px solid #c4c8cc;
}
.radio.active {
width: 4px;
height: 4px;
border: 5px solid var(--base-color);
}
}
}
.del-btn {
font-size: 16px;
color: #ef4646;
}
}
}
</style>
<template>
<div class="freq-page">
<div class="top">
<span>设备调频</span>
<van-switch
v-model="openFreq"
@change="switchOnChange"
inactive-color="#C0C5CC"
/>
</div>
<div class="content" v-if="openFreq">
<span class="title-text">选择模式</span>
<div class="middle">
<span
v-for="(item, index) in typeList"
:key="index"
@click="changeType(index)"
>
<span class="radio" :class="type === index ? 'active' : ''"></span>
<span>{{ item }}</span>
</span>
</div>
<!-- 追车模式 -->
<div class="chas-car-content bottom" v-if="type === 0">
<span>设置时间</span>
<span class="cont-right">
<van-field
class="input-class"
placeholder="1-5"
input-align="center"
v-model="minuteNum"
type="digit"
/>分钟
</span>
</div>
<!-- 闹钟模式 -->
<div class="clock-content bottom" v-if="type === 1">
<div v-for="(item, index) in clockList" :key="index" class="clock-item">
<span class="cont-left" @click="changeClockCheck(index)">
<svg-icon
:icon-class="item.checked ? 'checked' : 'check'"
class="check-class"
></svg-icon>
<span class="lable">{{ item.name }}</span>
</span>
<span class="cont-right" @click="onShowTimePicker(1, index)">
<svg-icon icon-class="clock" class="clock-class"></svg-icon>
<span>
{{ item.time }}
</span>
</span>
</div>
</div>
<!-- 星期模式 -->
<div class="week-content bottom" v-if="type === 2">
<div class="week-top">
<span
v-for="(item, index) in weekCheckboxItems"
:key="index"
class="week-item"
@click="changeWeekCheck(index)"
>
<svg-icon
:icon-class="item.checked ? 'checked' : 'check'"
class="check-class"
></svg-icon>
<span class="lable">{{ item.name }}</span>
</span>
</div>
<div class="time-cont">
<span class="label">上点时间</span>
<span class="cont-right" @click="onShowTimePicker(2, weekSelectTime)">
<svg-icon icon-class="clock" class="clock-class"></svg-icon>
<span>
{{ weekSelectTime }}
</span>
</span>
</div>
</div>
<van-button class="save-btn" type="primary" @click="onSave" block
>保存</van-button
>
</div>
<!-- 时间选择 -->
<popup
:show="showTimePicker"
@btnCancel="showTimePicker = false"
@btnSave="saveTime"
:position="'bottom'"
>
<van-datetime-picker
v-model="currentTime"
class="time-picker"
type="time"
title="选择时间"
:show-toolbar="false"
:filter="filter"
@change="changeTime"
/>
</popup>
</div>
</template>
<script>
import { defineComponent, onMounted, ref } from "vue";
import { Toast } from "vant";
import "vant/es/toast/style";
import popup from "@/components/popup.vue";
import { CLOSE_FREQ, GET_FREQ_INFO, SET_FREQ } from "@/api/index";
import { useRoute } from "vue-router";
export default defineComponent({
name: "FreqPage",
components: {
popup,
},
setup() {
const openFreq = ref(true);
const type = ref(0);
const route = useRoute();
let routeQuery = route.query;
const typeList = ["追车模式", "闹钟模式", "星期模式"];
const minuteNum = ref(null);
const clockList = ref([
{ name: "第一组", time: "08:00", checked: true },
{ name: "第二组", time: "12:00" },
{ name: "第三组", time: "18:00" },
{ name: "第四组", time: "22:00" },
]);
const weekCheckboxItems = ref([
{ name: "周一", id: "1", checked: true },
{ name: "周二", id: "2" },
{ name: "周三", id: "3" },
{ name: "周四", id: "4" },
{ name: "周五", id: "5" },
{ name: "周六", id: "6" },
{ name: "周日", id: "7" },
]);
const currentTime = ref("");
const selectTime = ref("");
const weekSelectTime = ref("10:00");
const columns = ref([]);
const showTimePicker = ref(false);
const selectedId = ref(null);
onMounted(() => {
// 获取已设置调频数据
getInfoData();
});
const getInfoData = () => {
GET_FREQ_INFO({ sn: routeQuery.sn }).then((res) => {
if (res.code === 200) {
res;
if (!res.data.type.toString()) {
openFreq.value = false;
} else {
type.value = res.data.type;
switch (res.data.type) {
case 0:
minuteNum.value = res.data.catchingTimer;
break;
case 1:
res.data.timer &&
res.data.timer.split(",").forEach((val, index) => {
clockList.value[index].checked = true;
clockList.value[index].time = val;
});
break;
case 2:
res.data.week &&
weekCheckboxItems.value.forEach((item) => {
if (res.data.week.split("").indexOf(item.id) > -1) {
item.checked = true;
} else {
item.checked = false;
}
});
weekSelectTime.value = res.data.weekTimer;
break;
}
}
}
});
};
// 切换模式
const changeType = (index) => {
type.value = index;
switch (index) {
case 0:
Toast("适用于收车场景,指定设备每隔几分钟更新定位信息。");
break;
case 1:
Toast("适用于催款环节,增加设备每天的上点频率。防止人车失联。");
break;
case 2:
Toast("适用于日常场景,可按需设置每周的设备回传次数。");
break;
}
};
// 闹钟模式选择
const changeClockCheck = (index) => {
clockList.value.forEach((val, id) => {
if (index === id) {
val.checked = !val.checked;
}
});
};
// 星期模式选择
const changeWeekCheck = (index) => {
weekCheckboxItems.value.forEach((val, id) => {
if (index === id) {
val.checked = !val.checked;
}
});
};
// 时间选择picker
const onShowTimePicker = (num, data) => {
showTimePicker.value = true;
// 闹钟模式
if (num === 1) {
selectedId.value = data;
let time = clockList.value[data].value;
currentTime.value = time;
selectTime.value = time;
}
// 星期模式
if (num === 2) {
currentTime.value = data;
selectTime.value = data;
}
};
// 时间选项过滤
const filter = (type, options) => {
if (type === "minute") {
return options.filter((option) => Number(option) % 15 === 0);
}
return options;
};
// 时间选择确定
const saveTime = () => {
if (type.value === 1) {
clockList.value.forEach((val, index) => {
if (index === selectedId.value) {
val.value = selectTime.value;
}
});
}
if (type.value === 2) {
weekSelectTime.value = selectTime.value;
}
showTimePicker.value = false;
};
const changeTime = (e) => {
selectTime.value = e;
};
// 开启关闭调频
const switchOnChange = (e) => {
if (!e) {
CLOSE_FREQ({ sn: routeQuery.sn }).then((res) => {
if (res.code === 200) {
Toast("关闭调频成功");
}
});
}
};
// 保存
const onSave = () => {
let OParams = {
sn: routeQuery.sn,
type: type.value,
};
switch (type.value) {
case 0:
OParams.catchingTimer = minuteNum.value;
if (
!/^\d{1,3}$/.test(minuteNum.value) ||
minuteNum.value < 1 ||
minuteNum.value > 999
) {
return Toast("请输入1~999之间的数字");
}
break;
case 1:
// eslint-disable-next-line no-case-declarations
let arr = [];
clockList.value.forEach((val) => {
if (val.checked) {
arr.push(val.time);
}
});
if (arr.length <= 0) {
return Toast("请至少选择一组模式");
}
OParams.timer = arr.join(",");
break;
case 2:
// eslint-disable-next-line no-case-declarations
let arr1 = [];
weekCheckboxItems.value.forEach((val) => {
if (val.checked) {
arr1.push(val.id);
}
});
if (arr1.length <= 0) {
return Toast("请至少选择一天");
}
OParams.week = arr1.join("");
OParams.weekTimer = weekSelectTime.value;
break;
}
SET_FREQ({ ...OParams }).then((res) => {
if (res.code === 200) {
Toast("保存成功");
}
});
};
return {
openFreq,
typeList,
type,
changeType,
minuteNum,
clockList,
weekCheckboxItems,
changeClockCheck,
showTimePicker,
saveTime,
columns,
filter,
currentTime,
selectTime,
onShowTimePicker,
selectedId,
changeTime,
changeWeekCheck,
weekSelectTime,
onSave,
switchOnChange,
getInfoData,
};
},
});
</script>
<style lang="scss" scoped>
.freq-page {
position: fixed;
width: calc(100% - 20px);
padding: 16px 10px;
height: 100%;
background: #f5f6f7;
color: #111;
.top {
width: calc(100% - 32px);
height: 52px;
border-radius: 8px;
padding: 0 16px;
background: #fff;
display: flex;
justify-content: space-between;
align-items: center;
}
.content {
.title-text {
display: inline-block;
font-size: 14px;
color: #6c737a;
margin: 16px 0 8px 24px;
}
.middle {
width: calc(100% - 32px);
height: 52px;
border-radius: 8px;
padding: 0 16px;
background: #fff;
display: flex;
align-items: center;
font-size: 14px;
span {
flex: 1;
display: flex;
align-items: center;
.radio {
display: inline-block;
flex: 0 0 12px;
height: 12px;
border-radius: 50%;
margin-right: 5px;
margin-top: 2px;
border: 1px solid #c4c8cc;
}
.radio.active {
flex: 0 0 4px;
height: 4px;
border: 5px solid var(--base-color);
}
}
}
.bottom {
width: calc(100% - 32px);
padding: 24px 16px;
border-radius: 8px;
margin-top: 16px;
background: #fff;
font-size: 14px;
}
.chas-car-content {
display: flex;
align-items: center;
justify-content: space-between;
.cont-right {
display: flex;
align-items: center;
.input-class {
display: inline-block;
width: 80px;
height: 40px;
border-radius: 4px;
margin-right: 12px;
background: #f0f2f5;
padding: 0;
line-height: 40px;
}
}
}
.clock-content {
display: flex;
flex-flow: column;
.clock-item {
display: flex;
justify-content: space-between;
align-items: center;
margin: 8px 0;
.cont-left {
display: flex;
align-items: center;
.check-class {
width: 20px;
height: 20px;
margin: 3px 8px 0 0;
}
}
.cont-right {
width: 120px;
height: 40px;
background: #f0f2f5;
border-radius: 4px;
display: flex;
align-items: center;
.clock-class {
margin: 0 10px;
}
}
}
}
.week-content {
width: 100%;
padding: 24px 0;
.week-top {
display: flex;
align-items: center;
flex-wrap: wrap;
.week-item {
flex: 0 0 25%;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 16px;
.check-class {
width: 20px;
height: 20px;
margin: 3px 8px 0 0;
}
}
}
.time-cont {
padding: 8px 16px;
display: flex;
justify-content: space-between;
align-items: center;
.cont-right {
width: 120px;
height: 40px;
background: #f0f2f5;
border-radius: 4px;
display: flex;
align-items: center;
.clock-class {
margin: 0 10px;
}
}
}
}
.save-btn {
border-radius: 6px;
margin-top: 54px;
}
}
.time-picker {
width: 100%;
}
}
</style>
<template>
<div>
<mapContent @refreshCb="refreshCb" ref="mapContentRefs">
<mapContent
@refreshCb="refreshCb"
@isUploaded="isUploaded"
ref="mapContentRefs"
>
<template #mapBox>
<div id="container" class="map-container"></div>
</template>
</mapContent>
<!-- 搜索区域 -->
<div class="search-box">
<div class="search-box" v-if="mapIsUploaded">
<div class="search-header">
<div
class="select-box"
......@@ -14,20 +18,19 @@
@click="isShowList = !isShowList"
>
<span>{{
carItem ? carItem.ownerName + " | " + carItem.name : "请选择"
carItem
? (carItem.ownerName || "--") + " | " + (carItem.vin || "--")
: "请选择"
}}</span>
<span class="arrow-icon"><van-icon name="arrow-down" /></span>
</div>
</div>
<div
class="search-content"
v-show="isShowList"
:class="isShowList ? '' : 'hidden'"
>
<div class="search-content" :class="isShowList ? '' : 'hidden'">
<van-search
class="search-input"
v-model="keyWord"
placeholder="请输入姓名或车牌号搜索"
@search="getCarList(keyWord, true)"
/>
<van-list
class="list-box"
......@@ -40,16 +43,16 @@
<van-cell v-for="item in list" @click="getCarInfo(item)" :key="item">
<div
class="list-item"
:class="(carItem && carItem.id) === item.id ? 'active' : ''"
:class="(carItem && carItem.id) == item.id ? 'active' : ''"
>
<i v-if="item.offLineDuration" class="icon icon-off-line"></i>
<i v-else class="icon icon-on-line"></i>
<div class="item-right">
<span class="item-text">{{
item.ownerName + " | " + item.name
(item.ownerName || "--") + " | " + (item.vin || "--")
}}</span>
<span
v-if="(carItem && carItem.id) === item.id"
v-if="(carItem && carItem.id) == item.id"
class="slectedicon"
><i class="icon icon-checked"></i
></span>
......@@ -57,33 +60,37 @@
</div>
</van-cell>
</van-list>
<div class="no-data-class" v-if="list.length <= 0 && !searched">
<img src="../assets/images/no-data.png" alt="" />
<span>暂无数据</span>
</div>
<div class="no-data-class" v-if="list.length <= 0 && searched">
<img src="../assets/images/search-noData.png" alt="" />
<span>搜索无结果</span>
</div>
</div>
</div>
<share ref="shareRefs" />
</div>
</template>
<script>
import { ref, defineComponent, onMounted } from "vue";
import { ref, defineComponent, onMounted, watch } from "vue";
import mapContent from "@/components/mapContent.vue";
import share from "@/components/share.vue";
import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant";
import MAPGEO from "@/utils/mapgeo";
import wx from "wx";
import { useRouter } from "vue-router";
import { useRoute, useRouter } from "vue-router";
import { Dialog, Toast } from "vant";
import "vant/es/toast/style";
import { GET_CAR_LOCATION_INFO } from "@/api/index";
import { GET_ALL_CAR_LIST, GET_CAR_LOCATION_INFO } from "@/api/index";
export default defineComponent({
name: "IndexPage",
components: {
mapContent,
share,
},
setup() {
const mapContentRefs = ref(null);
const shareRefs = ref(null);
const isShowList = ref(false);
const keyWord = ref("");
const loading = ref(false);
......@@ -92,18 +99,43 @@ export default defineComponent({
const carItem = ref(null);
const loginUserId = ref("");
const isShareDead = ref(1);
const showMore = ref(false);
const carInfoList = ref([]);
const route = useRoute();
const router = useRouter();
let map = null;
const routeQuery = ref(null);
const searched = ref(false);
const pageNumber = ref(0);
const mapIsUploaded = ref(false);
let map = undefined;
const refreshCb = () => {
map.clearMap();
if (Object.keys(carItem.value).length > 0) {
getCarInfo(carItem.value);
if (map && carItem.value) {
map && map.clearMap();
if (Object.keys(carItem.value).length > 0) {
getCarInfo(carItem.value);
}
}
};
watch(mapIsUploaded, (newVal) => {
// 被分享者打开直接获取车辆定位数据
routeQuery.value = route.query;
if (newVal && routeQuery.value.sns) {
carItem.value = {
sns: routeQuery.value.sns,
ownerName:
routeQuery.value.ownerName == "null"
? "--"
: routeQuery.value.ownerName,
vin: routeQuery.value.vin == "null" ? "--" : routeQuery.value.vin,
id: routeQuery.value.id,
};
getCarInfo(carItem.value);
}
});
onMounted(() => {
getCarList();
if (route.query.token) {
localStorage.setItem("token", route.query.token);
}
AMapLoader.load({
key: CONSTANT.MAP_KEY,
version: "1.4.8",
......@@ -113,15 +145,20 @@ export default defineComponent({
mapContentRefs.value.initMap("container");
});
});
const onSearch = () => {
// 获取车辆数据
console.log(1123);
const isUploaded = (data) => {
mapIsUploaded.value = data;
};
const getCarInfo = (it) => {
carItem.value = it;
isShowList.value = false;
wx.miniProgram.postMessage({
data: {
carInfo: it,
},
});
map = map ? map : mapContentRefs.value.init("container");
GET_CAR_LOCATION_INFO({ sns: "Sr1PRLqA32LCbSWZDch+Sg==" }).then((res) => {
map.clearMap();
GET_CAR_LOCATION_INFO({ sns: it.sns }).then((res) => {
if (res.code === 200) {
if (res.data.length > 0) {
const markers = [];
......@@ -165,98 +202,6 @@ export default defineComponent({
}
}
});
// let res = {
// data: [
// {
// sn: "39106110001",
// status: 1,
// statusTime: "0天0小时0分19秒",
// source: 1,
// battery: null,
// power: 15,
// alarmTypeSet: null,
// gpsLocation: {
// lng: "113.984752",
// lat: "22.590434",
// elng: "113.989711",
// elat: "22.587525",
// blng: "113.996172",
// blat: "22.593823",
// dateTime: "2022-06-30 15:49:28",
// address: "广东省深圳市南山区塘朗站(环中线)",
// alt: "214",
// dir: "170",
// storeTime: "2022-06-30 15:49:28",
// speed: "0",
// },
// bsLocation: {
// lng: "113.983448",
// lat: "22.587246",
// elng: "113.988404",
// elat: "22.584333",
// blng: "113.994867",
// blat: "22.590618",
// dateTime: "2022-06-30 16:12:40",
// address: "广东省深圳市南山区入口",
// alt: null,
// dir: null,
// storeTime: "2022-06-30 16:12:38",
// speed: null,
// },
// wifiLocation: null,
// hasWifi: false,
// encryptSn: "Sr1PRLqA32LCbSWZDch+Sg==",
// vin: "FVN20220629000001",
// ownerName: "谢俊琼",
// shopName: "测试店面",
// licensePlate: null,
// },
// {
// sn: "17107120001",
// status: 2,
// statusTime: "44天22小时30分47秒",
// source: 1,
// power: 60,
// battery: null,
// alarmTypeSet: null,
// gpsLocation: {
// lng: "113.987688",
// lat: "22.591266",
// elng: "113.992654",
// elat: "22.588366",
// blng: "113.999111",
// blat: "22.594687",
// dateTime: "2022-05-16 17:42:10",
// address: "广东省深圳市南山区华晖&#8226;云门",
// alt: "0",
// dir: "0",
// storeTime: "2022-05-16 17:42:10",
// speed: "0",
// },
// bsLocation: {
// lng: "113.982816",
// lat: "22.588568",
// elng: "113.987771",
// elat: "22.585654",
// blng: "113.994236",
// blat: "22.591932",
// dateTime: "2022-03-10 13:08:20",
// address: "广东省深圳市南山区深圳市圣丰塑胶模具厂",
// alt: null,
// dir: null,
// storeTime: "2022-03-10 13:08:19",
// speed: null,
// },
// wifiLocation: null,
// hasWifi: false,
// encryptSn: "2RAxRr1EYpXBQSTtg+2vKw==",
// vin: "FVN20220629000001",
// ownerName: "谢俊琼",
// shopName: "测试店面",
// licensePlate: null,
// },
// ],
// };
};
const drawMarker = (item, map, locates) => {
item.locationType = "gpsLocation";
......@@ -276,7 +221,7 @@ export default defineComponent({
var marker = new window.AMap.Marker({
position: lnglat,
content:
item.deviceType === "无线设备"
item.source == "0"
? '<span class="icon icon-off-car"></span>'
: '<span class="icon icon-on-car"></span>',
map: map,
......@@ -284,23 +229,10 @@ export default defineComponent({
});
var carInfoWindowTpl = `<div class="car-info-window">`;
carInfoWindowTpl += `<div class="main-info">`;
carInfoWindowTpl += `<h4 class="info-title"><div>${item.ownerName}</div><div>${item.vin}</div></h4>`;
carInfoWindowTpl += `<h4 class="info-title"><div>${
item.ownerName || "--"
}</div><div>${item.vin || "--"}</div></h4>`;
carInfoWindowTpl += `<div class="info-list">`;
// if (item.isFreq !== 2) {
// if (item.power && item.power < 20) {
// carInfoWindowTpl += `<div class="battery empty">
// <span style="width:${item.power}%" class="fill"></span>
// <span class="icon icon-battery-empty"></span>
// <span class="text">不足</span>
// </div>`;
// } else if (item.power) {
// carInfoWindowTpl += `<div class="battery">
// <span style="width:${item.power}%" class="fill"></span>
// <span class="icon icon-battery-enough"></span>
// <span class="text">${item.power}</span>
// </div>`;
// }
// }
carInfoWindowTpl += `<p class="device-info"><i class="icon icon-device"></i><span class="label">${
item.source == 1 ? "有线设备" : "无线设备"
}</span><span>${item.sn}</span></p>`;
......@@ -345,6 +277,7 @@ export default defineComponent({
infoDiv.innerHTML = carInfoWindowTpl;
let infoWindow = new window.AMap.InfoWindow({
isCustom: true,
autoMove: false,
position: lnglat,
content: infoDiv,
offset: new window.AMap.Pixel(0, -20),
......@@ -377,52 +310,67 @@ export default defineComponent({
// 有线设备
carFreqBtn && carFreqBtn.classList.add("disabled");
} else {
carFenceBtn && carFenceBtn.classList.add("carFenceBtn");
carFenceBtn && carFenceBtn.classList.add("disabled");
}
// 点击GPS
GPSBtn &&
(GPSBtn.onclick = () => {
check(() => {
item.locationType = "gpsLocation";
let gpsObj = item[item.locationType];
GPSIcon && GPSIcon.classList.add("active");
GPRSIcon && GPRSIcon.classList.remove("active");
WIFIIcon && WIFIIcon.classList.remove("active");
var newLnglat = new window.AMap.LngLat(gpsObj.elng, gpsObj.elat);
// 窗体 marker移动
setAddress();
move(newLnglat);
let gpsObj = item["gpsLocation"];
if (gpsObj) {
var newLnglat = new window.AMap.LngLat(gpsObj.elng, gpsObj.elat);
GPSIcon && GPSIcon.classList.add("active");
GPRSIcon && GPRSIcon.classList.remove("active");
WIFIIcon && WIFIIcon.classList.remove("active");
item.locationType = "gpsLocation";
setAddress();
move(newLnglat);
} else {
Toast("暂无GPS定位信息");
}
});
});
// 点击基站
GPRSBtn &&
(GPRSBtn.onclick = () => {
check(() => {
item.locationType = "bsLocation";
let gprsObj = item[item.locationType];
GPRSIcon && GPRSIcon.classList.add("active");
GPSIcon && GPSIcon.classList.remove("active");
WIFIIcon && WIFIIcon.classList.remove("active");
var newLnglat = new window.AMap.LngLat(gprsObj.elng, gprsObj.elat);
// 窗体 marker移动
setAddress();
move(newLnglat);
let gprsObj = item["bsLocation"];
if (gprsObj) {
GPRSIcon && GPRSIcon.classList.add("active");
GPSIcon && GPSIcon.classList.remove("active");
WIFIIcon && WIFIIcon.classList.remove("active");
item.locationType = "bsLocation";
var newLnglat = new window.AMap.LngLat(
gprsObj.elng,
gprsObj.elat
);
setAddress();
move(newLnglat);
} else {
Toast("暂无基站定位信息");
}
});
});
// 点击WIFI
WIFIBtn &&
(WIFIBtn.onclick = () => {
check(() => {
item.locationType = "wifiLocation";
let wifiObj = item[item.locationType];
WIFIIcon && WIFIIcon.classList.add("active");
GPSIcon && GPSIcon.classList.remove("active");
GPRSIcon && GPRSIcon.classList.remove("active");
var newLnglat = new window.AMap.LngLat(wifiObj.elng, wifiObj.elat);
// 窗体 marker移动
setAddress();
move(newLnglat);
let wifiObj = item["wifiLocation"];
if (wifiObj) {
var newLnglat = new window.AMap.LngLat(
wifiObj.elng,
wifiObj.elat
);
WIFIIcon && WIFIIcon.classList.add("active");
GPSIcon && GPSIcon.classList.remove("active");
GPRSIcon && GPRSIcon.classList.remove("active");
item.locationType = "wifiLocation";
setAddress();
move(newLnglat);
} else {
Toast("暂无wifi定位信息");
}
});
});
......@@ -442,10 +390,13 @@ export default defineComponent({
carReplayBtn &&
(carReplayBtn.onclick = () => {
check(() => {
router.push({
name: "info",
query: { sn: item.sn, tabItem: "replay" },
wx.miniProgram.navigateTo({
url: `../../pages/findCarInfo/index?sn=${item.sn}&tabItem=replay&source=${item.source}&locationType=${item.locationType}`,
});
// router.push({
// name: "info",
// query: { sn: item.sn, tabItem: "replay", source: item.source, locationType: item.locationType },
// });
});
});
......@@ -453,60 +404,83 @@ export default defineComponent({
carResidentBtn &&
(carResidentBtn.onclick = () => {
check(() => {
router.push({
name: "info",
query: { sn: item.sn, tabItem: "resident" },
wx.miniProgram.navigateTo({
url: `../../pages/findCarInfo/index?sn=${item.sn}&tabItem=resident&source=${item.source}&locationType=${item.locationType}`,
});
// router.push({
// name: "info",
// query: { sn: item.sn, tabItem: "resident", source: item.source, locationType: item.locationType },
// });
});
});
// 实时监控
carMonitorBtn &&
(carMonitorBtn.onclick = () => {
let currSn = item.sn;
check(() => {
router.push({
name: "info",
query: { sn: currSn, tabItem: "monitor" },
query: {
sn: item.sn,
tabItem: "monitor",
locationType: item.locationType,
source: item.source,
},
});
// wx.miniProgram.navigateTo({
// url: `../../pages/findCarInfo/index?sn=${item.sn}&tabItem=monitor&source=${item.source}&locationType=${item.locationType}`,
// });
});
});
// 设备调频
(carFreqBtn && carFreqBtn).onclick = () => {
let currSn = item.sn;
let vehicleid = item.vehicleid;
if (item.source === 1) {
if (item.source == 1) {
// 仅无线设备可调频
return;
} else {
router.push({
name: "info",
query: { sn: currSn, vehicleid: vehicleid, tabItem: "freq" },
// router.push({
// name: "info",
// query: { sn: item.sn, vehicleid: vehicleid, tabItem: "freq" },
// });
wx.miniProgram.navigateTo({
url: `../../pages/findCarInfo/index?sn=${item.sn}&tabItem=freq&source=${item.source}&locationType=${item.locationType}`,
});
}
};
// 电子围栏
(carFenceBtn && carFenceBtn).onclick = () => {
let currSn = item.sn;
if (loginUserId.value) {
if (loginUserId.value || item.source == 0) {
return;
} else {
router.push({
name: "info",
query: { sn: currSn, tabItem: "fence" },
// router.push({
// name: "info",
// query: { sn: item.sn, tabItem: "fence" },
// });
wx.miniProgram.navigateTo({
url: `../../pages/findCarInfo/index?sn=${item.sn}&tabItem=fence&source=${item.source}&locationType=${item.locationType}`,
});
}
};
// 分享找车
shareBtn.onclick = () => {
shareRefs.value.share();
// let currSn = item.sn;
// router.push({
// name: "info",
// query: {
// sn: currSn,
// tabItem: "share",
// source: item.source,
// locationType: item.locationType,
// },
// });
wx.miniProgram.navigateTo({
url: `../../pages/findCarInfo/index?sn=${item.sn}&tabItem=share&source=${item.source}&locationType=${item.locationType}`,
});
};
//点击车辆打开信息窗体
marker.on("click", () => {
setTimeout(() => {
map.setCenter(infoWindow.getPosition());
});
map.setCenter(infoWindow.getPosition());
if (infoWindow.getIsOpen()) {
infoWindow.close();
} else {
......@@ -524,46 +498,30 @@ export default defineComponent({
cb();
};
// 加载更多
const getCarList = () => {
setTimeout(() => {
for (let i = 0; i < 10; i++) {
if (i % 2) {
list.value.push({
id: i,
device: [{ type: "有线设备", sn: "1500628541" }],
name: "鄂ADB1383",
ownerName: "张三",
offLineDuration: 1,
sns: "1500628541",
sqbh: "skgd_220420134847279",
standno: "LA9XL44B0HBLG6389",
vehicleId: "985962",
workOrderId: null,
});
} else {
list.value.push({
id: i,
device: [{ type: "有线设备", sn: "1500628541" }],
name: "鄂ADB1383",
ownerName: "李四",
offLineDuration: null,
sns: "1500628541",
sqbh: "skgd_220420134847279",
standno: "LA9XL44B0HBLG6389",
vehicleId: "985962",
workOrderId: null,
});
const getCarList = (data, flag) => {
if (flag) {
pageNumber.value = 0;
list.value = [];
}
pageNumber.value++;
if (data && data.length < 2) {
// 关键字小于两个字符 忽略 全量搜索
data = "";
}
GET_ALL_CAR_LIST({
pageSize: 10,
pageNumber: pageNumber.value,
term: data,
}).then((res) => {
if (res.code === 200) {
list.value = list.value.concat(res.data.list);
loading.value = false;
searched.value = flag;
if (res.totalPages === pageNumber.value) {
finished.value = true;
}
}
// 加载状态结束
loading.value = false;
// 数据全部加载完成
if (list.value.length >= 40) {
finished.value = true;
}
}, 1000);
});
};
return {
refreshCb,
......@@ -573,16 +531,17 @@ export default defineComponent({
loading,
finished,
list,
onSearch,
getCarList,
getCarInfo,
showMore,
loginUserId,
check,
share,
shareRefs,
carInfoList,
carItem,
searched,
pageNumber,
isUploaded,
mapIsUploaded,
routeQuery,
};
},
});
......@@ -620,11 +579,11 @@ export default defineComponent({
border-radius: 12px;
background: #fff;
overflow: hidden;
transition: max-height 0.3s;
.search-input {
border-radius: 12px;
}
.list-box {
// height: calc(100% - 65px);
max-height: 450px;
overflow-y: auto;
.list-item {
......@@ -643,22 +602,27 @@ export default defineComponent({
height: 20px;
}
}
.off-line {
display: inline-block;
width: 15px;
height: 15px;
border-radius: 50%;
background: #999;
margin-right: 10px;
}
.line-status {
background: #37c060;
}
}
.list-item.active {
background: #ecf5fe;
}
}
.no-data-class {
display: flex;
flex-flow: column;
justify-content: center;
align-items: center;
padding: 40px;
span {
font-size: 14px;
color: #9fa6ad;
margin-top: 16px;
}
}
}
.search-content.hidden {
max-height: 0;
transition: max-height 0.3s;
}
}
</style>
......@@ -674,6 +638,21 @@ export default defineComponent({
.main-info {
padding: 10px;
}
.info-title {
font-weight: normal;
border-bottom: 1px solid #f5f6f7;
padding-bottom: 10px;
font-size: 14px;
color: #333;
div {
color: #111111;
font-weight: 600;
margin-bottom: 5px;
}
:last-child {
font-weight: 500;
}
}
.info-list {
position: relative;
font-size: 12px;
......@@ -683,13 +662,16 @@ export default defineComponent({
align-items: flex-start;
line-height: 100%;
margin: 8px 0;
i {
flex: 0 0 14px;
}
span {
color: #111111;
line-height: 16px;
}
.label {
color: #6c737a;
width: 52px;
margin-right: 8px;
flex: 0 0 60px;
margin-left: 5px;
}
a {
......@@ -717,21 +699,6 @@ export default defineComponent({
}
}
}
.info-title {
font-weight: normal;
border-bottom: 1px solid #f5f6f7;
padding-bottom: 10px;
font-size: 14px;
color: #333;
div {
color: #111111;
font-weight: 600;
margin-bottom: 5px;
}
:last-child {
font-weight: 500;
}
}
.cmd-list {
font-size: 0px;
border-top: 1px solid #f5f6f7;
......@@ -771,41 +738,6 @@ export default defineComponent({
}
}
}
// .battery {
// position: absolute;
// top: 10px;
// right: 0px;
// width: 37px;
// height: 19px;
// span {
// position: absolute;
// top: 0;
// left: 0;
// width: 100%;
// height: 100%;
// }
// .bg {
// background-size: 37px 19px;
// }
// .fill {
// background-color: #d4f1dc;
// }
// .text {
// color: #37c060;
// font-size: 12px;
// text-align: center;
// line-height: 19px;
// }
// }
// .empty {
// .fill {
// background-color: #f0d0d0;
// }
// .text {
// color: #df2222;
// line-height: 19px;
// }
// }
}
.van-cell {
padding: 0;
......
<template>
<topTab ref="tabRefs">
<template #replay>
<replay />
</template>
<template #monitor>
<monitor />
</template>
<template #resident>
<resident />
</template>
<!-- <template #fence>
<fence />
</template> -->
</topTab>
<div>
<topTab ref="tabRefs" @changeTabItem="changeTabItem">
<template #replay>
<replay />
</template>
<template #monitor>
<MonitorPage ref="monitorRefs" />
</template>
<template #resident>
<resident />
</template>
<template #share>
<share>
<van-overlay
:show="showOverlay"
@click="showOverlay = false"
:z-index="100000"
>
<span class="icon icon-share"></span>
<p class="tip">
点击右上角“&nbsp;<span class="fle"
><span class="sharebtn"></span
><span class="sharebtn middle"></span
><span class="sharebtn"></span></span
>&nbsp;”转发/分享
</p>
</van-overlay>
</share>
</template>
<template #fence>
<fence />
</template>
<template #freq>
<freq ref="freqRefs" />
</template>
</topTab>
</div>
</template>
<script>
import { defineComponent } from "vue";
import {
defineComponent,
onMounted,
ref,
getCurrentInstance,
nextTick,
onUnmounted,
} from "vue";
import topTab from "@/components/top-tab.vue";
import replay from "./replay.vue";
import monitor from "./monitor.vue";
import MonitorPage from "./monitor.vue";
import resident from "./resident.vue";
// import fence from "./fence.vue";
import fence from "./fence.vue";
import share from "./share.vue";
import freq from "./freq.vue";
export default defineComponent({
name: "InfoPage",
components: {
topTab,
replay,
monitor,
MonitorPage,
resident,
// fence,
fence,
share,
freq,
},
setup() {
const showOverlay = ref(true);
const tabRefs = ref(null);
const monitorRefs = ref(null);
const instance = getCurrentInstance();
onMounted(() => {
nextTick(() => {
monitorRefs.value = instance.refs.monitorRefs;
});
});
const changeTabItem = (e) => {
// 切换tab 清除定时器
if (e.name !== "monitor") {
instance.refs.monitorRefs &&
instance.refs.monitorRefs.timeoutId &&
clearTimeout(instance.refs.monitorRefs.timeoutId);
if (e.name === "freq") {
// 获取最新的设备调频数据
instance.refs.freqRefs && instance.refs.freqRefs.getInfoData();
}
if (e.name === "share") {
showOverlay.value = true;
}
} else {
instance.refs.monitorRefs && instance.refs.monitorRefs.getData();
}
};
onUnmounted(() => {
monitorRefs.value &&
monitorRefs.value.timeoutId &&
clearTimeout(monitorRefs.value.timeoutId);
});
return {
changeTabItem,
showOverlay,
tabRefs,
};
},
setup() {},
});
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.icon-share {
position: absolute;
top: 20px;
right: 65px;
}
.tip {
margin-top: 105px;
text-align: center;
color: #fff;
font-size: 16px;
.fle {
display: inline-block;
width: 18px;
height: 22px;
vertical-align: middle;
}
.sharebtn {
display: inline-block;
width: 4px;
height: 4px;
margin: 1px;
background: #fff;
border-radius: 50%;
}
.sharebtn.middle {
width: 6px;
height: 6px;
margin: 0;
}
}
</style>
<template>
<div>
<div class="monitor-tabContent">
<mapContent @refreshCb="refreshCb" @getData="getData" ref="mapContentRefs">
<template #mapBox>
<div id="monitorContainer" class="map-container"></div>
</template>
</mapContent>
<transition name="van-fade"> </transition>
<div class="toggle-bottom" :class="isShowAllList ? '' : 'hidden'">
<div
class="toggle-bottom-monitor"
:class="isShowAllList && locationList.length > 2 ? 'show' : 'hidden'"
>
<div class="toggle-btn" @click="showHideList">
<van-icon
:name="
!isShowAllList && locationList.length > 2
? 'arrow-up'
: 'arrow-down'
"
/>
<span
v-if="!isShowAllList || locationList.length <= 2"
class="ident-icon"
></span>
<a v-else class="icon icon-put-away"></a>
</div>
<div class="list-content">
<div class="list-content-monitor">
<div
class="list-item"
v-for="(item, index) in locationList"
:key="index"
>
<p class="title">{{ item.transferAddress }}</p>
<p class="title">
<span>{{ index + 1 }}</span
>&nbsp;&nbsp;{{ item.transferAddress }}
</p>
<p class="time">{{ item.time }}</p>
</div>
</div>
......@@ -31,20 +34,21 @@
</template>
<script>
import { defineComponent, onMounted, ref } from "vue";
import { onMounted, ref, nextTick, watch } from "vue";
import mapContent from "@/components/mapContent.vue";
import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant";
import { GET_RESIDENT_DATA } from "@/api/index";
import { GET_CAR_LOCATION_INFO } from "@/api/index";
import { useRoute } from "vue-router";
import MAPGEO from "@/utils/mapgeo";
import { Dialog } from "vant";
import "vant/es/dialog/style";
export default defineComponent({
export default {
name: "MonitorPage",
components: {
mapContent,
},
setup() {
const route = useRoute();
const mapContentRefs = ref(null);
......@@ -59,6 +63,8 @@ export default defineComponent({
let beginMarker = null;
let polyLine = null;
const timeoutId = ref(null);
const listScroll = ref(0);
const changey = ref(null);
const refreshCb = (map) => {
map.clearMap();
getData();
......@@ -81,14 +87,47 @@ export default defineComponent({
mapContentRefs.value.initMap("monitorContainer");
});
});
watch(changey, (newVal) => {
let listNode = document.querySelector(".list-content-monitor");
let flag = false;
if (listScroll.value === 0) {
flag = true;
}
if (flag && newVal >= 100) {
isShowAllList.value = false;
}
if (newVal <= -100 && listNode.scrollTop === 0) {
// 上滑
isShowAllList.value = true;
}
});
let starty, endy;
nextTick(() => {
let touchNode = document.querySelector(".toggle-bottom-monitor");
let listNode = document.querySelector(".list-content-monitor");
const scroll = () => {
let scroolTop = listNode.scrollTop;
listScroll.value = scroolTop;
};
touchNode.addEventListener("touchstart", function (e) {
listNode.addEventListener("scroll", scroll(e), false);
listNode.removeEventListener("scroll", scroll(e), false);
starty = e.touches[0].pageY;
});
//结束点击时获得触点
touchNode.addEventListener("touchend", function (e) {
endy = e.changedTouches[0].pageY;
//判断触点差值
changey.value = endy - starty;
});
});
// 获取数据
const getData = (map) => {
currentMap = map ? map : currentMap;
init(currentMap);
GET_RESIDENT_DATA({ sns: routeQuery.sn }).then((res) => {
GET_CAR_LOCATION_INFO({ sns: routeQuery.sn }).then((res) => {
if (res.code === 200) {
if (res.data.length > 0) {
init(currentMap);
init(currentMap, res.data);
} else {
Dialog({ message: "暂无数据" });
}
......@@ -96,24 +135,15 @@ export default defineComponent({
});
};
// marker渲染
const init = (currentMap) => {
let data = [
{
totalDuration: 2032460,
totalTimes: 1,
time: "2022-07-01 15:30:26",
longitude: "114.0736",
latitude: "30.606778",
blat: "30.610309854203035",
blng: "114.08589711310412",
elat: "30.604489843507423",
elng: "114.07934400356585",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市东西湖区慈惠路毛家台(公交站)",
},
];
const init = (currentMap, data) => {
data.forEach((val) => {
(val.elat =
val[routeQuery.locationType] && val[routeQuery.locationType].elat),
(val.elng =
val[routeQuery.locationType] && val[routeQuery.locationType].elng);
val.time =
val[routeQuery.locationType] && val[routeQuery.locationType].dateTime;
});
MAPGEO.transferAddressByGroup(
{
data: data,
......@@ -129,13 +159,17 @@ export default defineComponent({
firstPosLat = val.elat;
carMarker = new window.AMap.Marker({
position: lnglat,
content: '<span class="icon icon-car"></span>',
content:
'<img src=" ' +
require("@/assets/images/car.png") +
'" style="transform: scale(0.5);" />',
map: currentMap,
offset: new window.AMap.Pixel(-8.5, -13),
});
beginMarker = new window.AMap.Marker({
position: lnglat,
content: '<span class="icon icon-begin"></span>',
content:
'<span class="icon icon-begin" style="transform: scale(0.5);"></span>',
map: currentMap,
offset: new window.AMap.Pixel(-8.5, -13),
visible: false,
......@@ -159,9 +193,8 @@ export default defineComponent({
});
currentMap.setFitView();
timeoutId.value = setTimeout(function () {
init(currentMap);
getData();
}, 10 * 1000);
if (locationList.value.length > 6) locationList.value.shift();
}
);
};
......@@ -177,48 +210,57 @@ export default defineComponent({
showHideList,
isShowAllList,
locationList,
listScroll,
changey,
timeoutId,
};
},
});
};
</script>
<style lang="scss" scoped>
.toggle-bottom {
.toggle-bottom-monitor {
position: fixed;
width: 100%;
left: 0px;
bottom: 0px;
z-index: 300;
display: flex;
border-radius: 20px;
max-height: 455px;
border-radius: 20px 20px 0 0;
align-items: center;
flex-flow: column;
background-color: #fff;
padding-top: 10px;
.list-content {
padding-left: 10px;
overflow-y: scroll;
.toggle-btn {
position: absolute;
top: -20px;
.ident-icon {
display: inline-block;
width: 56px;
height: 4px;
border-radius: 2px;
background: #a2a2a4;
}
}
.list-content-monitor {
width: calc(100% - 30px);
padding: 5px 15px 0 15px;
font-size: 14px;
.list-item {
padding: 5px 10px 5px 0;
border-bottom: 1px solid #ececec;
height: 39px;
border-bottom: 1px solid #f0f2f5;
padding: 14px 0;
display: flex;
flex-flow: column;
.title {
color: #000;
font-size: 16px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.time {
color: #666;
.navigate {
padding-left: 16px;
background-size: 12px 12px;
float: right;
margin-left: 10px;
}
.copy-adr {
padding-left: 16px;
background-size: 12px 12px;
float: right;
}
font-size: 12px;
margin-top: 5px;
}
}
:last-child {
......@@ -226,7 +268,15 @@ export default defineComponent({
}
}
}
.toggle-bottom.hidden {
max-height: 160px;
.toggle-bottom-monitor.hidden {
max-height: 135px;
transition: max-height 0.3s;
}
.toggle-bottom-monitor.show {
max-height: 80%;
transition: max-height 0.3s;
.list-content-monitor {
overflow-y: scroll;
}
}
</style>
......@@ -2,86 +2,87 @@
<div>
<div class="tab">
<div class="tabbar">
<div class="tabbar-item" @click="showTimeDialog = !showTimeDialog">
轨迹时间
<div class="tabbar-item" @click="showTimeDialog = true">
轨迹时间&nbsp;
<span class="slect-class">{{ currDateText }}</span>
<van-icon class="icon-rotate" name="play" />
</div>
<div class="tabbar-item" @click="showSpeedPicker = true">
回放速度
<!-- <span class="speed-text" id="speedText">{{
speedItem[speedId].text
回放速度&nbsp;
<span class="slect-class">{{
(speedItem[selectSpeedId] && speedItem[selectSpeedId].text) || ""
}}</span>
<van-icon name="arrow-down" /> -->
<van-icon class="icon-rotate" name="play" />
</div>
</div>
</div>
<!-- <van-popup v-model:show="showSpeedPicker" round position="bottom">
<van-picker
:columns="speedItem"
@cancel="showSpeedPicker = false"
@confirm="onConfirm"
/>
</van-popup> -->
<div class="speedSelect" v-show="showSpeedPicker">
<!-- <div class="speed-list" v-for="(item, index) in speedItem" :key="index">
<span class="dot" :class="speedId === item.value ? 'active' : ''">
<span>{{ item.text }}</span>
</span>
<span class="line"></span>
</div> -->
<elSlider v-model="speedId" :max="3" :marks="speedItem" :step="1" />
</div>
<div
class="time-content"
v-show="showTimeDialog"
:class="showTimeDialog ? '' : 'hidden'"
<!-- 回放速度 -->
<popup
:show="showSpeedPicker"
@btnCancel="showSpeedPicker = false"
@btnSave="saveSpeed"
:position="'bottom'"
>
<div class="time-btn-list">
<span
class="time_btn"
v-for="(item, index) in timeBtnList"
:key="index"
:class="timeSelected === index ? 'active' : ''"
@click="selectTime(index)"
>{{ item }}</span
>
<div class="speedSelect-box">
<div class="box">
<el-slider
v-model="speedId"
:marks="speedItem"
:show-tooltip="false"
:max="3"
:format-tooltip="changSpeed"
:step="1"
/>
<div class="speed-text">
<span
class="item-text"
:class="'text' + index"
v-for="(item, index) in speedItem"
:key="index"
>{{ item.text }}</span
>
</div>
</div>
</div>
<div class="custom-time">
<span class="time-text">自定义时间</span
><input
v-model="customTime"
class="time-input"
placeholder="请选择日期"
@click="showTimePicker = true"
type="text"
readonly
</popup>
<!-- 轨迹时间 -->
<popup
:show="showTimeDialog"
@btnCancel="showTimeDialog = false"
@btnSave="saveTime"
:position="'bottom'"
>
<div class="time-content">
<div class="time-btn-list">
<span class="label">回放时段</span>
<span
class="time_btn"
v-for="(item, index) in timeBtnList"
:key="index"
:class="timeSelected === index ? 'active' : ''"
@click="selectTime(index)"
>{{ item }}</span
>
</div>
<div class="custom-time">
<span class="label">自定义时间</span>
<div @click="onShowTimePicker">
<span>{{ customTime }}</span>
<van-icon name="arrow" />
</div>
</div>
<van-datetime-picker
style="width: 100%"
v-if="showTimePicker"
v-model="currentDate"
:show-toolbar="false"
:max-date="maxDate"
type="date"
title="选择年月日"
@change="changeCurrTiem"
/>
</div>
<div class="footer">
<van-button
type="default"
class="time-btn"
size="small"
@click="showTimeDialog = false"
>取消</van-button
>
<van-button
type="primary"
class="time-btn"
size="small"
@click="getCarReplayData"
>确认</van-button
>
</div>
</div>
<van-popup v-model:show="showTimePicker" round position="bottom">
<van-datetime-picker
v-model="currentDate"
type="date"
title="选择年月日"
@confirm="timeConfirm"
@cancel="showTimePicker = false"
/>
</van-popup>
</popup>
<mapContent @refreshCb="refreshCb" ref="mapContentRefs">
<template #mapBox>
<div id="replayContainer" class="map-container"></div>
......@@ -91,57 +92,47 @@
<a class="icon icon-replay-play" v-if="!isPlay" @click="play"></a>
<a class="icon icon-replay-pause" v-else @click="pause"></a>
<a class="icon icon-replay-refresh" @click="replayPath"></a>
<!-- <div class="btn_">
<span v-if="!isPlay" @click="play"
><van-icon name="play-circle-o"
/></span>
<span v-if="isPlay" @click="pause"
><van-icon name="pause-circle-o"
/></span>
<span @click="replayPath"><van-icon name="stop-circle-o" /></span>
</div>
<van-progress
class="progress-content"
:percentage="percentage"
pivot-text=""
/> -->
</div>
</div>
</template>
<script>
import { defineComponent, onMounted, ref, reactive } from "vue";
import { defineComponent, onMounted, ref, reactive, nextTick } from "vue";
import mapContent from "@/components/mapContent.vue";
import elSlider from "@/components/speedSlider.vue";
import popup from "@/components/popup.vue";
import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant";
import { Toast } from "vant";
import { Toast, Dialog } from "vant";
import moment from "@/utils/moment";
import "vant/es/toast/style";
import "vant/es/dialog/style";
import "vant/es/progress/style";
import { GET_REPLAY_DATA } from "@/api/index";
import carPng from "@/assets/images/car.png";
import { useRoute } from "vue-router";
import { ElSlider } from "element-plus";
export default defineComponent({
name: "ReplayPage",
components: {
mapContent,
elSlider,
["el-slider"]: ElSlider,
popup,
},
setup() {
const mapContentRefs = ref(null);
const showSpeedPicker = ref(false);
const speedId = ref(0);
const selectSpeedId = ref(0);
const eParams = ref({});
const timeSelected = ref(null);
const showTimeDialog = ref(false);
const showTimePicker = ref(false);
const currentDate = ref(new Date());
let timeBtnList = ["24小时", "3天", "7天"];
const timeBtnList = ["24小时", "3天", "7天"];
const customTime = ref("");
const searchTime = ref([]);
const route = useRoute();
const percentage = ref(0); // 轨迹播放进度
const currDateText = ref("");
const maxDate = ref(new Date());
let map = null;
let routeQuery = route.query;
const replay = reactive({
......@@ -170,18 +161,6 @@ export default defineComponent({
value: 3,
},
];
const refreshCb = () => {
if (replay.navg) {
replay.navg.destroy();
}
if (replay.pathSimplifierIns) {
replay.pathSimplifierIns.setData({
path: [],
});
}
percentage.value = 0;
getCarReplayData();
};
onMounted(() => {
AMapLoader.load({
key: CONSTANT.MAP_KEY,
......@@ -206,59 +185,153 @@ export default defineComponent({
);
});
});
// 查询参数
const getParams = () => {
console.log(routeQuery);
eParams.value = {
speed: speedId.value,
time: timeSelected.value || customTime.value,
locationType: 0,
startTime: "2022-06-27 00:00:00",
endTime: "2022-07-04 23:59:59",
// sn: routeQuery.sn,
sn: "Sr1PRLqA32LCbSWZDch+Sg==",
};
};
// 点击快捷时间选择
const selectTime = (e) => {
timeSelected.value = e;
};
// 自定义时间选择确定
const timeConfirm = (e) => {
customTime.value = moment(e).format("YYYY-MM-DD");
showTimePicker.value = false;
timeSelected.value = null;
};
// 轨迹时间弹窗关闭
const onBeforeClose = (action) => {
if (action === "confirm") {
return customTime.value || timeSelected.value;
const refreshCb = () => {
if (replay.navg) {
replay.navg.destroy();
}
if (replay.pathSimplifierIns) {
replay.pathSimplifierIns.setData({
path: [],
});
}
isPlay.value = false;
map.clearMap();
getCarReplayData();
};
// 获取车辆轨迹
const getCarReplayData = () => {
if (!customTime.value && !timeSelected.value) {
return Toast("请选择一个时间段");
}
getParams();
if (replay.navg) {
replay.navg.destroy();
}
if (replay.pathSimplifierIns) {
replay.pathSimplifierIns.setData({
path: [],
});
}
isPlay.value = false;
map && map.clearMap();
GET_REPLAY_DATA({ ...eParams.value }).then((res) => {
showTimeDialog.value = false;
if (res.code === 200) {
if (res.data.length > 0) {
var replayData = [];
res.data.forEach(function (item) {
res.data.forEach((item) => {
var arr = [];
arr.push(item.elng);
arr.push(item.elat);
replayData.push(arr);
});
initPath(replayData);
} else {
Dialog({ message: "暂无轨迹数据" });
}
} else if (res.data.length > 0) {
Toast("暂无轨迹数据");
}
});
};
// 切换速度
const changSpeed = () => {
nextTick(() => {
let sliderBar = document.querySelector(".el-slider__button-wrapper");
let sliderStop = document.querySelectorAll(".el-slider__stop");
sliderStop.forEach((val) => {
if (
Number(val.style.left.split("%")[0]) <
Number(sliderBar.style.left.split("%")[0])
) {
val.style.border = `2px solid #0077FF`;
} else {
val.style.border = `2px solid #E4E7EB`;
}
});
});
};
// 切换速度保存
const saveSpeed = () => {
showSpeedPicker.value = false;
selectSpeedId.value = speedId.value;
if (replay.navg) {
replay.navg.setSpeed(speedEvent(speedId.value, replay.dis));
if (!isPlay.value) {
play();
}
}
};
// 时间选择保存
const saveTime = () => {
if (!searchTime.value.length) {
return Toast("请选择一个时间段");
}
getCarReplayData();
showTimeDialog.value = false;
let isSelectTime =
timeSelected.value !== null && timeSelected.value.toString();
if (isSelectTime) {
currDateText.value = timeBtnList[timeSelected.value];
} else if (currentDate.value) {
currDateText.value = moment(currentDate.value).format("MM-DD");
customTime.value = moment(currentDate.value).format("YYYY-MM-DD");
}
};
// 显示自定义时间
const onShowTimePicker = () => {
showTimePicker.value = true;
timeSelected.value = null;
searchTime.value = [
moment(currentDate.value).format("YYYY-MM-DD") + " 00:00:00",
moment(currentDate.value).format("YYYY-MM-DD") + " 23:59:59",
];
};
// 自定义时间选择
const changeCurrTiem = (e) => {
currentDate.value = e;
timeSelected.value = null;
searchTime.value = [
moment(e).format("YYYY-MM-DD") + " 00:00:00",
moment(e).format("YYYY-MM-DD") + " 23:59:59",
];
};
// 查询参数
const getParams = () => {
console.log(routeQuery);
eParams.value = {
speed: speedId.value,
// startTime: searchTime.value[0],
// endTime: searchTime.value[1],
locationType: 0,
// sn: routeQuery.sn,
startTime: "2022-06-27 00:00:00",
endTime: "2022-07-04 23:59:59",
// sn: routeQuery.sn,
sn: "Sr1PRLqA32LCbSWZDch+Sg==",
};
};
// 点击快捷时间选择
const selectTime = (e) => {
timeSelected.value = e;
showTimePicker.value = false;
switch (e) {
case 0:
searchTime.value = [
moment().subtract(1, "day").format("YYYY-MM-DD HH:mm:ss"),
moment().format("YYYY-MM-DD HH:mm:ss"),
];
break;
case 1:
searchTime.value = [
moment().subtract(3, "day").format("YYYY-MM-DD HH:mm:ss"),
moment().format("YYYY-MM-DD HH:mm:ss"),
];
break;
case 2:
searchTime.value = [
moment().subtract(7, "day").format("YYYY-MM-DD HH:mm:ss"),
moment().format("YYYY-MM-DD HH:mm:ss"),
];
break;
}
customTime.value = null;
};
// 根据距离 实时计算速度
const speedEvent = (idx, dis) => {
let timeArr = [
......@@ -288,13 +361,12 @@ export default defineComponent({
zIndex: 100,
map: map, //所属的地图实例
getPath: function (pathData) {
//返回轨迹数据中的节点坐标信息,[AMap.LngLat, AMap.LngLat...] 或者 [[lng|number,lat|number],...]
return pathData.path;
},
renderOptions: {
//轨迹线的样式
pathLineStyle: {
strokeStyle: "#0b94db",
strokeStyle: "#EC8788",
lineWidth: 6,
dirArrowStyle: true,
},
......@@ -326,23 +398,6 @@ export default defineComponent({
replay.navg.on("pause", function () {
isPlay.value = false;
});
replay.navg.on("move", function () {
progressEvent();
});
}
};
const onChange = (e) => {
console.log(e);
};
// 速度切换
const onConfirm = (e) => {
speedId.value = e.value;
showSpeedPicker.value = false;
if (replay.navg) {
replay.navg.setSpeed(speedEvent(e.value, replay.dis));
if (!isPlay.value) {
play();
}
}
};
// 播放轨迹
......@@ -372,17 +427,9 @@ export default defineComponent({
isPlay.value = true;
}
};
// 播放进度条处理
const progressEvent = () => {
let moveDis = replay.navg.getMovedDistance();
let allDis = replay.dis * 1000;
percentage.value =
(moveDis / allDis) * 100 > 100 ? 100 : (moveDis / allDis) * 100;
};
return {
mapContentRefs,
showSpeedPicker,
onConfirm,
speedItem,
speedId,
refreshCb,
......@@ -392,20 +439,23 @@ export default defineComponent({
showTimeDialog,
showTimePicker,
currentDate,
timeConfirm,
timeBtnList,
selectTime,
customTime,
onBeforeClose,
initPath,
speedEvent,
play,
pause,
replayPath,
isPlay,
percentage,
progressEvent,
onChange,
changSpeed,
saveSpeed,
selectSpeedId,
saveTime,
changeCurrTiem,
currDateText,
onShowTimePicker,
maxDate,
};
},
});
......@@ -416,103 +466,129 @@ export default defineComponent({
.tabbar {
font-size: 0px;
display: flex;
border-bottom: 1px solid #f0f2f5;
position: relative;
color: #666;
font-size: 14px;
color: #111111;
z-index: 1000;
.tabbar-item {
flex: 1;
font-size: 14px;
text-align: center;
border-right: 1px solid #eee;
display: flex;
align-items: center;
justify-content: center;
padding: 10px 0;
.speed-text {
margin-right: 5px;
.slect-class {
color: var(--base-color);
}
.icon-rotate {
transform: rotate(90deg);
font-size: 12px;
color: #9ca4ad;
margin-left: 5px;
}
}
.tabbar-item:last-child {
border-right: none;
}
}
}
.time-content {
background: #fff;
position: fixed;
top: 84px;
right: 0;
left: 0;
z-index: 301;
padding: 20px;
color: #999;
overflow: hidden;
width: calc(100% - 40px);
padding: 0 20px;
.time-btn-list {
display: flex;
justify-content: space-between;
text-align: center;
margin-bottom: 20px;
align-items: center;
padding-bottom: 20px;
font-size: 14px;
border-bottom: 1px solid #f0f2f5;
.label {
width: 60px;
color: #000;
font-weight: 600;
}
.time_btn {
border: 1px solid #999;
border: 1px solid #dfe2e6;
color: #111;
border-radius: 5px;
width: 80px;
height: 34px;
line-height: 34px;
}
.active {
border: 1px solid var(--base-color);
background: #ebf5ff;
color: var(--base-color);
}
}
.custom-time {
display: flex;
align-items: center;
.time-text {
margin-right: 10px;
}
.time-input {
text-align: center;
display: inline-block;
width: 240px;
height: 28px;
border: 1px solid #999;
border-radius: 5px;
justify-content: space-between;
justify-items: end;
font-size: 14px;
padding: 20px 0;
.label {
width: 96px;
color: #000;
font-weight: 600;
flex: 1;
}
}
.footer {
display: flex;
padding-top: 20px;
justify-content: center;
.time-btn {
margin: 0 10px;
width: 100px;
border-radius: 5px;
div {
flex: 1;
display: flex;
justify-content: flex-end;
align-items: center;
}
}
}
.speedSelect {
height: 90px;
.speedSelect-box {
display: flex;
align-items: center;
margin: 0 30px;
}
.btn-control {
position: fixed;
background: #fff;
width: 100%;
height: 60px;
bottom: 0px;
z-index: 300;
padding: 0 20px;
display: flex;
align-items: center;
span {
display: inline-block;
margin-right: 5px;
width: 30px;
height: 30px;
i {
font-size: 25px;
color: var(--base-color);
background: #fff;
flex-flow: column;
border-radius: 0 0 16px 16px;
overflow: hidden;
.box {
padding: 20px 40px;
width: calc(100% - 80px);
overflow: hidden;
.speed-text {
width: 100%;
position: relative;
font-size: 14px;
.item-text {
position: absolute;
}
.text0 {
left: -3%;
}
.text1 {
left: 27%;
}
.text2 {
left: 64%;
}
.text3 {
right: -5%;
}
}
}
.progress-content {
width: 70%;
}
.btn-control {
position: fixed;
bottom: 41px;
left: 50%;
margin-left: -72px;
z-index: 101;
.icon-replay-refresh {
margin-left: 12px;
}
}
</style>
<style scoped>
@import "@/assets/css/slider.css";
</style>
<template>
<div>
<div class="tab">
<div class="tabbar">
<div
class="tabbar-item"
:class="seledtedItem === 7 ? 'active' : ''"
@click="getParams(7)"
>
7天
</div>
<div
class="tabbar-item"
:class="seledtedItem === 30 ? 'active' : ''"
@click="getParams(30)"
>
30天
</div>
<div
class="tabbar-item"
:class="seledtedItem === 99 ? 'active' : ''"
@click="showTimePicker = true"
<div class="searchControll" @click="showTimeDialog = true">
<a class="icon icon-screen-btn"></a>
<span class="screen-text">筛选</span>
</div>
<popup
:show="showTimeDialog"
@btnCancel="showTimeDialog = false"
@btnSave="saveTime"
:position="'bottom'"
>
<div class="time-content">
<span
class="time_btn"
v-for="(item, index) in timeBtnList"
:key="index"
:class="seledtedItem === index ? 'active' : ''"
@click="selectTime(index)"
>{{ index < 2 ? item : currentDateText }}</span
>
<span class="speed-text" id="speedText">{{ currentDateText }}</span>
</div>
</div>
</div>
<van-popup v-model:show="showTimePicker" round position="bottom">
<van-datetime-picker
style="width: 100%"
v-if="showTimePicker"
:show-toolbar="false"
v-model="currentDate"
:max-date="maxDate"
type="year-month"
title="选择年月"
@confirm="timeConfirm"
@cancel="showTimePicker = false"
:formatter="formatter"
@change="change"
/>
</van-popup>
</popup>
<mapContent @refreshCb="refreshCb" @getData="getData" ref="mapContentRefs">
<template #mapBox>
<div id="residentContainer" class="map-container"></div>
</template>
<template #screenBox>
<div class="screenBtn">
<van-icon name="more-o" />
</div>
</template>
</mapContent>
<div class="toggle-bottom" :class="isShowAllList ? '' : 'hidden'">
<div
class="toggle-bottom-resident"
:class="isShowAllList && residentList.length > 2 ? 'show' : 'hidden'"
>
<div class="toggle-btn" @click="showHideList">
<van-icon
:name="
!isShowAllList && residentList.length > 2
? 'arrow-up'
: 'arrow-down'
"
/>
<span
v-if="!isShowAllList || residentList.length <= 2"
class="ident-icon"
></span>
<a v-else class="icon icon-put-away"></a>
</div>
<div class="list-content">
<div class="list-content-resident">
<div
class="list-item"
v-for="(item, index) in residentList"
:key="index"
>
<p class="title">{{ item.transferAddress }}</p>
<p class="time">
停留({{ parseInt(item.totalDuration / 3600) }})小时
<a class="navigate" @click="navigation(item)"
><i class="icon icon-navigate"></i>导航</a
>
<span class="icon icon-loc-icon"></span>
<div class="left">
<p class="title">{{ item.transferAddress }}</p>
<p class="time">
停留&nbsp;<span class="time-text">{{
parseInt(item.totalDuration / 3600)
}}</span
>&nbsp;小时
</p>
</div>
<div class="right">
<a
class="copy-adr"
@click="copyAddress"
:data-clipboard-text="item.transferAddress"
><i class="icon icon-copy"></i>复制</a
><i class="icon icon-copy"></i><span>复制</span></a
>
<a class="navigate" @click="navigation(item)"
><i class="icon icon-navgation"></i><span>导航</span></a
>
</p>
</div>
</div>
</div>
</div>
......@@ -80,7 +82,7 @@
</template>
<script>
import { defineComponent, onMounted, ref } from "vue";
import { defineComponent, nextTick, onMounted, ref, watch } from "vue";
import mapContent from "@/components/mapContent.vue";
import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant";
......@@ -92,7 +94,6 @@ import wx from "wx";
import Clipboard from "clipboard";
import { Toast, Dialog } from "vant";
import "vant/es/toast/style";
import "vant/es/dialog/style";
export default defineComponent({
name: "ResidentPage",
components: {
......@@ -104,21 +105,82 @@ export default defineComponent({
const mapContentRefs = ref(null);
const currentDate = ref(new Date());
const currentDateText = ref("自定义");
const seledtedItem = ref(7);
const timeBtnList = ["7天", "30天", "自定义"];
const seledtedItem = ref(0);
const showTimeDialog = ref(false);
const isShowAllList = ref(false);
const residentList = ref([]);
const listScroll = ref(0);
const searchTime = ref([
moment().subtract(7, "day").format("YYYY-MM-DD HH:mm:ss"),
moment().format("YYYY-MM-DD HH:mm:ss"),
]);
const changey = ref(null);
const maxDate = ref(new Date());
let currentMap = null;
let routeQuery = route.query;
let markerArr = [];
const oParams = ref({
sn: routeQuery.sn,
sTime: moment().subtract("day", 7).format("YYYY-MM-DD HH:mm:ss"),
eTime: moment().format("YYYY-MM-DD HH:mm:ss"),
watch(changey, (newVal) => {
let listNode = document.querySelector(".list-content-resident");
let flag = false;
if (listScroll.value === 0) {
flag = true;
}
if (flag && newVal >= 100) {
isShowAllList.value = false;
}
if (newVal <= -100 && listNode.scrollTop === 0) {
// 上滑
isShowAllList.value = true;
}
});
let starty, endy;
nextTick(() => {
let touchNode = document.querySelector(".toggle-bottom-resident");
let listNode = document.querySelector(".list-content-resident");
const scroll = () => {
let scroolTop = listNode.scrollTop;
listScroll.value = scroolTop;
};
touchNode.addEventListener("touchstart", function (e) {
listNode.addEventListener("scroll", scroll(e), false);
listNode.removeEventListener("scroll", scroll(e), false);
starty = e.touches[0].pageY;
});
//结束点击时获得触点
touchNode.addEventListener("touchend", function (e) {
endy = e.changedTouches[0].pageY;
//判断触点差值
changey.value = endy - starty;
});
});
const refreshCb = (map) => {
map.clearMap();
getData();
};
const formatter = (type, val) => {
if (type === "year") {
return `${val}年`;
}
if (type === "month") {
return `${val}月`;
}
return val;
};
const saveTime = () => {
showTimeDialog.value = false;
if (seledtedItem.value === 2) {
currentDateText.value = moment(currentDate.value).format("YYYY-MM");
searchTime.value = [
moment(currentDate.value)
.endOf("month")
.format("YYYY-MM-DD HH:mm:ss"),
moment(currentDate.value).format("YYYY-MM-DD HH:mm:ss"),
];
}
getData();
};
onMounted(() => {
AMapLoader.load({
key: CONSTANT.MAP_KEY,
......@@ -129,41 +191,44 @@ export default defineComponent({
mapContentRefs.value.initMap("residentContainer");
});
});
// 时间选择确定
const timeConfirm = (e) => {
seledtedItem.value = 99;
currentDateText.value = moment(e).format("YYYY-MM");
showTimePicker.value = false;
getParams();
};
// 查询参数
const getParams = (num) => {
if (num) {
if (num === seledtedItem.value) return;
seledtedItem.value = num;
oParams.value = {
sn: routeQuery.sn,
eTime: moment().format("YYYY-MM-DD HH:mm:ss"),
sTime: moment().subtract("day", num).format("YYYY-MM-DD HH:mm:ss"),
};
} else {
seledtedItem.value = 99;
oParams.value = {
sn: routeQuery.sn,
eTime: moment(currentDate.value).format("YYYY-MM-DD HH:mm:ss"),
sTime: moment(currentDate.value)
.endOf("month")
.format("YYYY-MM-DD HH:mm:ss"),
};
// 选择时间
const selectTime = (e) => {
seledtedItem.value = e;
switch (e) {
case 0:
searchTime.value = [
moment().subtract(7, "day").format("YYYY-MM-DD HH:mm:ss"),
moment().format("YYYY-MM-DD HH:mm:ss"),
];
showTimePicker.value = false;
currentDateText.value = "自定义";
break;
case 1:
searchTime.value = [
moment().subtract(30, "day").format("YYYY-MM-DD HH:mm:ss"),
moment().format("YYYY-MM-DD HH:mm:ss"),
];
currentDateText.value = "自定义";
showTimePicker.value = false;
break;
case 2:
showTimePicker.value = true;
break;
}
getData();
};
// 时间选择确定
const change = (e) => {
currentDate.value = e;
};
// 获取数据
const getData = (map) => {
currentMap = map ? map : currentMap;
console.log(oParams);
init(currentMap);
GET_RESIDENT_DATA({ ...oParams.value }).then((res) => {
GET_RESIDENT_DATA({
startTime: searchTime.value[0],
endTime: searchTime.value[1],
sn: routeQuery.sn,
}).then((res) => {
if (res.code === 200) {
if (res.data.length > 0) {
init(currentMap);
......@@ -218,6 +283,146 @@ export default defineComponent({
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
{
totalDuration: 67351,
totalTimes: 4,
longitude: "114.27008",
latitude: "30.481154",
blat: "30.4845642911033",
blng: "114.28200904532856",
elat: "30.47866175313912",
elng: "114.27548450027317",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
{
totalDuration: 67351,
totalTimes: 4,
longitude: "114.27008",
latitude: "30.481154",
blat: "30.4845642911033",
blng: "114.28200904532856",
elat: "30.47866175313912",
elng: "114.27548450027317",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
{
totalDuration: 67351,
totalTimes: 4,
longitude: "114.27008",
latitude: "30.481154",
blat: "30.4845642911033",
blng: "114.28200904532856",
elat: "30.47866175313912",
elng: "114.27548450027317",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
{
totalDuration: 67351,
totalTimes: 4,
longitude: "114.27008",
latitude: "30.481154",
blat: "30.4845642911033",
blng: "114.28200904532856",
elat: "30.47866175313912",
elng: "114.27548450027317",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
{
totalDuration: 67351,
totalTimes: 4,
longitude: "114.27008",
latitude: "30.481154",
blat: "30.4845642911033",
blng: "114.28200904532856",
elat: "30.47866175313912",
elng: "114.27548450027317",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
{
totalDuration: 67351,
totalTimes: 4,
longitude: "114.27008",
latitude: "30.481154",
blat: "30.4845642911033",
blng: "114.28200904532856",
elat: "30.47866175313912",
elng: "114.27548450027317",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
{
totalDuration: 67351,
totalTimes: 4,
longitude: "114.27008",
latitude: "30.481154",
blat: "30.4845642911033",
blng: "114.28200904532856",
elat: "30.47866175313912",
elng: "114.27548450027317",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
{
totalDuration: 67351,
totalTimes: 4,
longitude: "114.27008",
latitude: "30.481154",
blat: "30.4845642911033",
blng: "114.28200904532856",
elat: "30.47866175313912",
elng: "114.27548450027317",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
{
totalDuration: 67351,
totalTimes: 4,
longitude: "114.27008",
latitude: "30.481154",
blat: "30.4845642911033",
blng: "114.28200904532856",
elat: "30.47866175313912",
elng: "114.27548450027317",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
{
totalDuration: 67351,
totalTimes: 4,
longitude: "114.27008",
latitude: "30.481154",
blat: "30.4845642911033",
blng: "114.28200904532856",
elat: "30.47866175313912",
elng: "114.27548450027317",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市洪山区天地源荷景苑",
},
];
MAPGEO.transferAddressByGroup(
{
......@@ -231,7 +436,8 @@ export default defineComponent({
var lnglat = new window.AMap.LngLat(item.elng, item.elat);
var marker = new window.AMap.Marker({
position: lnglat,
content: '<span class="icon icon-resident"></span>',
content:
'<span class="icon icon-resident" style="transform: scale(0.5);"></span>',
map: currentMap,
offset: new window.AMap.Pixel(-8.5, -13),
});
......@@ -282,84 +488,149 @@ export default defineComponent({
currentDate,
currentDateText,
init,
timeConfirm,
change,
seledtedItem,
oParams,
getParams,
navigation,
copyAddress,
showHideList,
isShowAllList,
residentList,
selectTime,
searchTime,
showTimeDialog,
timeBtnList,
changey,
listScroll,
saveTime,
formatter,
maxDate,
};
},
});
</script>
<style lang="scss" scoped>
.tab {
.tabbar {
font-size: 0px;
display: flex;
border-bottom: 1px solid #eee;
position: relative;
color: #666;
z-index: 1000;
.tabbar-item {
flex: 1;
font-size: 14px;
text-align: center;
border-right: 1px solid #eee;
padding: 10px 0;
.speed-text {
margin-right: 5px;
}
}
.tabbar-item.active {
border-bottom: 2px solid var(--base-color);
color: var(--base-color);
}
.tabbar-item:last-child {
border-right: none;
}
.searchControll {
position: fixed;
top: 70px;
right: 12px;
width: 40px;
height: 52px;
background: #fff;
z-index: 300;
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
.screen-text {
font-size: 16px;
display: inline-block;
transform: scale(0.5);
}
}
.toggle-bottom {
.time-content {
background: #fff;
color: #999;
display: flex;
width: calc(100% - 16px);
padding: 0 8px;
overflow: hidden;
.time_btn {
text-align: center;
flex: 1;
color: #111;
background: #f0f2f5;
height: 36px;
line-height: 36px;
border-radius: 5px;
margin: 0 8px;
}
.active {
border: 1px solid var(--base-color);
background: #ebf5ff;
color: var(--base-color);
}
}
.toggle-bottom-resident {
position: fixed;
width: 100%;
left: 0px;
bottom: 0px;
z-index: 300;
display: flex;
border-radius: 20px;
max-height: 455px;
border-radius: 20px 20px 0 0;
align-items: center;
flex-flow: column;
background-color: #fff;
padding-top: 10px;
.list-content {
background-color: #fff;
padding-left: 10px;
overflow-y: scroll;
.toggle-btn {
position: absolute;
top: -20px;
.ident-icon {
display: inline-block;
width: 56px;
height: 4px;
border-radius: 2px;
background: #a2a2a4;
}
}
.list-content-resident {
width: calc(100% - 30px);
padding: 5px 15px 0 15px;
font-size: 14px;
.list-item {
padding: 5px 10px 5px 0;
border-bottom: 1px solid #ececec;
.title {
color: #000;
font-size: 16px;
height: 68px;
border-bottom: 1px solid #f0f2f5;
display: flex;
.icon-loc-icon {
margin-top: 7px;
}
.time {
color: #666;
.left {
padding: 12px 10px 12px 0;
.title {
color: #000;
width: 224px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.time {
color: #6c737a;
font-size: 12px;
margin-top: 5px;
.time-text {
color: var(--base-color);
}
}
}
.right {
padding: 12px 0;
display: flex;
align-items: center;
a {
display: flex;
flex-flow: column;
align-items: center;
}
.navigate {
padding-left: 16px;
background-size: 12px 12px;
float: right;
margin-left: 10px;
i {
display: inline-block;
}
span {
color: #6c737a;
font-size: 20px;
transform: scale(0.5);
}
}
.copy-adr {
padding-left: 16px;
background-size: 12px 12px;
float: right;
i {
display: inline-block;
}
span {
color: #6c737a;
font-size: 20px;
transform: scale(0.5);
}
}
}
}
......@@ -368,8 +639,16 @@ export default defineComponent({
}
}
}
.toggle-bottom.hidden {
max-height: 165px;
.toggle-bottom-resident.hidden {
max-height: 135px;
transition: max-height 0.3s;
}
.toggle-bottom-resident.show {
max-height: 80%;
transition: max-height 0.3s;
.list-content-resident {
overflow-y: scroll;
}
}
</style>
<style lang="scss">
......
<template>
<div>
<mapContent ref="mapContentRefs">
<template #mapBox>
<div id="shareContainer" class="map-container"></div>
</template>
</mapContent>
<slot></slot>
</div>
</template>
<script>
import { ref, defineComponent, onMounted } from "vue";
import mapContent from "@/components/mapContent.vue";
import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant";
export default defineComponent({
name: "SharePage",
components: {
mapContent,
},
setup() {
const mapContentRefs = ref(null);
onMounted(() => {
AMapLoader.load({
key: CONSTANT.MAP_KEY,
version: "1.4.8",
plugins: CONSTANT.MAP_PLUGINS,
}).then((AMap) => {
window.AMap = AMap;
mapContentRefs.value.initMap("shareContainer");
});
});
return {
mapContentRefs,
};
},
});
</script>
<style lang="scss" scoped></style>
......@@ -2,20 +2,18 @@ const { defineConfig } = require("@vue/cli-service");
const Spritesmith = require("webpack-spritesmith");
const path = require("path");
const templateFunction = require("./sprite");
const { VantResolver } = require("unplugin-vue-components/resolvers");
const {
VantResolver,
ElementPlusResolver,
} = require("unplugin-vue-components/resolvers");
const ComponentsPlugin = require("unplugin-vue-components/webpack");
function resolve(dir) {
return path.join(__dirname, ".", dir);
}
module.exports = defineConfig({
transpileDependencies: true,
devServer: {
port: 9527,
proxy: {
"/api": {
target: "https://eshield.test.glsx.com.cn/",
ws: true,
changeOrigin: true,
pathRewrite: { "^/api": "" },
},
},
},
chainWebpack: (config) => {
config.plugin("webpack-spritesmith").use(Spritesmith, [
......@@ -49,11 +47,22 @@ module.exports = defineConfig({
},
},
]);
config.module.rules.delete("svg"); // 重点:删除默认配置中处理svg,
config.module
.rule("svg-sprite-loader")
.test(/\.svg$/)
.include.add(resolve("src/assets/icons")) // 处理svg目录
.end()
.use("svg-sprite-loader")
.loader("svg-sprite-loader")
.options({
symbolId: "icon-[name]",
});
},
configureWebpack: {
plugins: [
ComponentsPlugin({
resolvers: [VantResolver()],
resolvers: [VantResolver(), ElementPlusResolver()],
}),
],
externals: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!