Commit b9e0bf33 by 前端

修复bug

1 parent 938daa57
...@@ -147,6 +147,12 @@ ...@@ -147,6 +147,12 @@
color: #ee3040ff; color: #ee3040ff;
font-style: normal; font-style: normal;
} }
span{
margin-right:40px;
}
span:last-child{
margin-right:0;
}
} }
.btn_group { .btn_group {
...@@ -283,4 +289,10 @@ ...@@ -283,4 +289,10 @@
span { span {
color: #185EFE; color: #185EFE;
} }
}
.device_label{
.img{
width:16px;
height: 16px;
}
} }
\ No newline at end of file \ No newline at end of file
export const Validator = {
/*手机号码格式校验正则*/
PHONEREG: /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/,
/*同时包含字母和数字*/
ISNUMANDLETTERS: /^[a-zA-Z0-9]+$/,
/*特殊字符正则*/
SPECIALLETTER:new RegExp("[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]"),
/*邮箱地址格式正则*/
//EMAILREG:/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/,
EMAILREG:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
/*判断是否为中文*/
ISCHINESE:/^[\u0391-\uFFE5]+$/,
/*判断是否为英文字母*/
ISENGLISH:/^[a-zA-Z]+$/,
/*是否包含空格*/
ISHAVENULL:/^[^\s]*$/,
/*保留两位小数*/
TWODECIMAL: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,
/*判断是否为正整数*/
ISDECIMAL:/^[0-9]*$/,
// 只能输入负数
ISNEGATIVENUMBER:/^-[0-9]+.?[0-9]*/,
/**
* 账号管理-手机号码校验
*/
checkPhoneNumber:function(str){
return Validator.PHONEREG.test(str);
}
};
// 校验手机号码格式
export const PHONE_VALIDATOR = (rule, value, callback) => {
let reg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
if (!reg.test(value)) {
return callback(new Error('手机号格式不正确'));
}
callback()
}
// 校验是否为数字
export const CHECK_NUMBER = function(rule, value, callback){
let reg = /^[0-9]*$/
console.log(reg.test(value))
if (!reg.test(value)) {
return callback(new Error('请输入纯数字'));
}
callback()
}
// 校验值的大小
export const CHECK_MAX_MIN = function(rule, value, callback){
if (value>5 || value<1) {
return callback(new Error('总体评分最小1,最大5'));
}
callback()
}
...@@ -36,8 +36,9 @@ ...@@ -36,8 +36,9 @@
<div v-show="menuId == 1"> <div v-show="menuId == 1">
<el-form-item label="详细地址"> <el-form-item label="详细地址">
<el-input <el-input
v-model="form.address" v-model.trim="form.address"
id="tipInput" id="tipInput"
maxlength="50"
placeholder="请输入详细地址" placeholder="请输入详细地址"
/> />
</el-form-item> </el-form-item>
...@@ -50,18 +51,18 @@ ...@@ -50,18 +51,18 @@
content="请先设备号精准搜索设备定位后,再进行“选择区域”操作" content="请先设备号精准搜索设备定位后,再进行“选择区域”操作"
placement="top" placement="top"
> >
<i class="el-icon-warning-outline"></i> <glsx-image src="circle-question.png" class="img" />
</el-tooltip> </el-tooltip>
</div> </div>
<div class="device_item"> <div class="device_item">
<el-input <el-input
v-model="form.sn" v-model.trim="form.sn"
maxlength="50"
placeholder="请输入您要查询的设备号" placeholder="请输入您要查询的设备号"
/> />
<el-button <el-button
type="primary" type="primary"
class="btn" class="btn"
:disabled="!form.sn"
@click="getLocation" @click="getLocation"
>搜索</el-button >搜索</el-button
> >
...@@ -155,7 +156,7 @@ import { ...@@ -155,7 +156,7 @@ import {
import { GET_DEVICEINFO_BYSNS } from "@/api/services/monitor"; import { GET_DEVICEINFO_BYSNS } from "@/api/services/monitor";
import EventBus from "@/event-bus"; import EventBus from "@/event-bus";
import { showToast, deepClone } from "@/utils/utils.js"; import { showToast, deepClone } from "@/utils/utils.js";
import moment from "moment"; import { Validator } from "@/common/validator";
export default { export default {
components: { components: {
CitySelect, CitySelect,
...@@ -197,7 +198,7 @@ export default { ...@@ -197,7 +198,7 @@ export default {
], ],
drawDone: false, drawDone: false,
location: {}, // 设备维度查询的位置点 location: {}, // 设备维度查询的位置点
autoCenterMarker:null autoCenterMarker: null,
}; };
}, },
mounted() { mounted() {
...@@ -234,7 +235,7 @@ export default { ...@@ -234,7 +235,7 @@ export default {
console.log(e); console.log(e);
let poi = e.poi || {}; let poi = e.poi || {};
if (poi && poi.location) { if (poi && poi.location) {
_this.autoCenterMarker = mapService.createMarker(poi.location) _this.autoCenterMarker = mapService.createMarker(poi.location);
_this.map.setFitView(); _this.map.setFitView();
_this.map.add(_this.autoCenterMarker); _this.map.add(_this.autoCenterMarker);
} }
...@@ -267,6 +268,7 @@ export default { ...@@ -267,6 +268,7 @@ export default {
fillColor: "#00b0ff", fillColor: "#00b0ff",
strokeColor: "#80d8ff", strokeColor: "#80d8ff",
fillOpacity: 0.2, fillOpacity: 0.2,
strokeWeight:4,
draggable: true, draggable: true,
}); });
...@@ -425,6 +427,12 @@ export default { ...@@ -425,6 +427,12 @@ export default {
async getLocation() { async getLocation() {
let params = {}; let params = {};
this.clearMap(); this.clearMap();
if (!Validator.ISDECIMAL.test(this.form.sn)) {
showToast({
message: "设备号必须为纯数字",
});
return false;
}
params.sns = this.form.sn; params.sns = this.form.sn;
params.deviceCode = "gps"; params.deviceCode = "gps";
let res = await GET_DEVICEINFO_BYSNS(params); let res = await GET_DEVICEINFO_BYSNS(params);
......
...@@ -864,7 +864,7 @@ MapService.prototype = { ...@@ -864,7 +864,7 @@ MapService.prototype = {
createAraeInfowindow(info){ createAraeInfowindow(info){
let _div = `<h3 class="map-infowindow-title">${info.ownerName || '--'}/${info.vin || '--'}</h3> let _div = `<h3 class="map-infowindow-title">${info.ownerName || '--'}/${info.vin || '--'}</h3>
<div class="map-infowindow-ct"> <div class="map-infowindow-ct">
<p><i class="icon icon-info_device"></i> 设备号:<span class="des"> ${info.sn} (${info.isSource === '1' ? '有线' : '无线'})</span> <p><i class="icon icon-info_device"></i> 设备号:<span class="des"> ${info.sn} (${info.sourccStr})</span>
<span class="battery" data-battery style="display:${info.battery?'block':'none'}"> <span class="battery" data-battery style="display:${info.battery?'block':'none'}">
<i class="fill"><i class="fill-percentage" data-battery-percentage style="width:${info.battery}%;"></i></i> <i class="fill"><i class="fill-percentage" data-battery-percentage style="width:${info.battery}%;"></i></i>
<i class="icon icon-battery_enough"></i> <i class="icon icon-battery_enough"></i>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!