Commit 6ce922e1 by 张杰

修改

1 parent 89a36cfb
<template> <template>
<v-full-layout> <v-full-layout>
<template slot="breadcrumb"> <template slot="breadcrumb">
<el-breadcrumb-item>车辆监控</el-breadcrumb-item> <el-breadcrumb-item>车辆监控</el-breadcrumb-item>
</template> </template>
<template slot="main"> <template slot="main">
<div class="map-wrap" v-loading="mapLoading"> <div class="map-wrap" v-loading="mapLoading">
<div id="map" class="map-container"></div> <div id="map" class="map-container"></div>
<map-controll isShowFullsize="true"></map-controll> <map-controll isShowFullsize="true"></map-controll>
<div class="controll-wrap"> <div class="controll-wrap">
<div class="menu-search"> <div class="menu-search">
<el-autocomplete <!-- <el-autocomplete
ref="autocomplete" ref="autocomplete"
size="small" size="small"
:popper-class="'search_auto'+(autocompleteHide?' search_auto_hide':'')" :popper-class="'search_auto'+(autocompleteHide?' search_auto_hide':'')"
...@@ -18,17 +18,17 @@ ...@@ -18,17 +18,17 @@
:fetch-suggestions="querySearch" :fetch-suggestions="querySearch"
:trigger-on-focus="false" :trigger-on-focus="false"
:placeholder="'请输入'+['6位以上设备号','6位以上车架号','2位以上姓名'][searchType-1]" :placeholder="'请输入'+['6位以上设备号','6位以上车架号','2位以上姓名'][searchType-1]"
@select="handleSelect"> @select="handleSelect"> -->
<!-- <el-input placeholder="请输入对应条件值" v-model.trim="searchText" size="small" class="input-with-select" @keyup.enter.native='searchSubmit'> --> <el-input placeholder="请输入对应条件值" v-model.trim="searchText" size="small" class="input-with-select" @keyup.enter.native='searchSubmit'>
<el-select v-model="searchType" slot="prepend" placeholder="请选择" size="small" > <el-select v-model="searchType" slot="prepend" placeholder="请选择" size="small">
<el-option label="设备号" value="1"></el-option> <el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option> <el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option> <el-option label="姓名" value="3"></el-option>
<!-- <el-option label="工单号" value="4"></el-option> --> <!-- <el-option label="工单号" value="4"></el-option> -->
</el-select> </el-select>
<el-button icon="el-icon-search" size="mini" slot="append" :loading="isSearching" @click="searchSubmit" > <el-button icon="el-icon-search" size="mini" slot="append" :loading="isSearching" @click="searchSubmit">
</el-button> </el-button>
<template slot-scope="{ item }"> <!-- <template slot-scope="{ item }">
<div style="margin: 0 -20px; font-size: 12px; " class="auto_item"> <div style="margin: 0 -20px; font-size: 12px; " class="auto_item">
<template v-if="item.tip"> <template v-if="item.tip">
{{item.tip}} {{item.tip}}
...@@ -39,558 +39,544 @@ ...@@ -39,558 +39,544 @@
</template> </template>
</div> </div>
</template> </template> -->
</el-autocomplete> <!-- </el-autocomplete> -->
<!-- </el-input> --> </el-input>
</div> </div>
<el-row type="flex" class="filter-entrance" justify="space-between"> <el-row type="flex" class="filter-entrance" justify="space-between">
<!-- <el-button type="text" @click="importDialogHidden=false;listDialogHidden=true;resultDialogHidden=true;">导入查询</el-button> --> <!-- <el-button type="text" @click="importDialogHidden=false;listDialogHidden=true;resultDialogHidden=true;">导入查询</el-button> -->
<el-button type="text" @click="treeHidden=false;listDialogHidden=true;importDialogHidden=true;resultDialogHidden=true;">组织</el-button> <el-button type="text" @click="treeHidden=false;listDialogHidden=true;importDialogHidden=true;resultDialogHidden=true;">组织</el-button>
<el-button type="text" @click="listDialogHidden=false;treeHidden=true;importDialogHidden=true;resultDialogHidden=true;">监控列表({{getMonitorListVisibleCount}})</el-button> <el-button type="text" @click="listDialogHidden=false;treeHidden=true;importDialogHidden=true;resultDialogHidden=true;">监控列表({{getMonitorListVisibleCount}})</el-button>
</el-row> </el-row>
<div class="filter-dialog-set"> <div class="filter-dialog-set">
<div class="filter-dialog animated " :class="importDialogHidden?'fadeOut':'active fadeIn'"> <div class="filter-dialog animated " :class="importDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header"> <div class="filter-dialog-header">
导入查询 导入查询
<i class="el-icon-close pull-right" @click.stop="importDialogHidden=true"></i> <i class="el-icon-close pull-right" @click.stop="importDialogHidden=true"></i>
</div> </div>
<div class="filter-dialog-body"> <div class="filter-dialog-body">
<el-form ref="form" :model="form" :rules="rules" :inline="false" size="mini"> <el-form ref="form" :model="form" :rules="rules" :inline="false" size="mini">
<el-form-item label="" prop="filename"> <el-form-item label="" prop="filename">
<el-upload ref="upload" class="upload-wrap" <el-upload ref="upload" class="upload-wrap" action="vehicle/importSerchDevice" :on-change="changeFile" :before-upload="beforeUpload" :multiple="false" :show-file-list="false" :on-success="successUpload" :on-error="errorUpload" :data="uploadData" accept=".xlsx" :auto-upload="false">
action="vehicle/importSerchDevice" <el-input v-model="form.filename" placeholder="未选取任何文件" class="input-with-select" size="small">
:on-change="changeFile" <el-select v-model="form.uploadType" slot="prepend" placeholder="请选择" size="small">
:before-upload="beforeUpload" <el-option label="设备号" value="1"></el-option>
:multiple="false" <el-option label="车架号" value="2"></el-option>
:show-file-list="false" <el-option label="姓名" value="3"></el-option>
:on-success="successUpload" <el-option label="工单号" value="4"></el-option>
:on-error="errorUpload" </el-select>
:data="uploadData" </el-input>
accept=".xlsx" <div slot="tip" class="el-upload__tip">仅支持同时监控100台设备,还可导入{{100-monitorList.count}}台设备</div>
:auto-upload="false"> </el-upload>
<el-input v-model="form.filename" placeholder="未选取任何文件" class="input-with-select" size="small" > </el-form-item>
<el-select v-model="form.uploadType" slot="prepend" placeholder="请选择" size="small" > <el-button type="primary" class="upload-sure-btn" size="small" @click="submitUpload" :loading="importing" :disabled="uploadDisabled">确认</el-button>
<el-option label="设备号" value="1"></el-option> <el-button size="mini" type="text" @click="downloadTpl" style="margin-left: 0px;">下载模板</el-button>
<el-option label="车架号" value="2"></el-option> </el-form>
<el-option label="姓名" value="3"></el-option> </div>
<el-option label="工单号" value="4"></el-option> </div>
</el-select> <div class="filter-dialog animated " :class="listDialogHidden?'fadeOut':'active fadeIn'">
</el-input> <div class="filter-dialog-header">
<div slot="tip" class="el-upload__tip">仅支持同时监控100台设备,还可导入{{100-monitorList.count}}台设备</div> 监控列表({{monitorList.count}})
</el-upload> <i class="el-icon-close pull-right" @click.stop="listDialogHidden=true"></i>
</el-form-item> </div>
<el-button type="primary" class="upload-sure-btn" size="small" @click="submitUpload" :loading="importing" :disabled="uploadDisabled">确认</el-button> <div class="filter-dialog-body">
<el-button size="mini" type="text" @click="downloadTpl" style="margin-left: 0px;">下载模板</el-button> <el-row type="flex" class="sub-filter" justify="space-between">
</el-form> <el-select v-model="monitorFilterType" placeholder="请选择" size="small" style="width: 100px;">
</div> <el-option label="全部" value=""></el-option>
</div> <el-option label="有线" value="1"></el-option>
<div class="filter-dialog animated " :class="listDialogHidden?'fadeOut':'active fadeIn'"> <el-option label="无线" value="0"></el-option>
<div class="filter-dialog-header"> </el-select>
监控列表({{monitorList.count}}) <el-button type="primary" plain size="small" @click="removeMonitorByGroup(monitorList.itemArr)">批量删除</el-button>
<i class="el-icon-close pull-right" @click.stop="listDialogHidden=true"></i> </el-row>
</div> <ul class="monitor-list" style="max-height:calc(100vh - 380px);">
<div class="filter-dialog-body"> <template v-for="(sn, key) in monitorList.itemArr">
<el-row type="flex" class="sub-filter" justify="space-between"> <li class="monitor-list-item" :key="sn" @click="openMapInfoWindow(sn, monitorList[sn].source)" v-if="key!=='count' && monitorList[sn]&&(monitorList[sn].source==monitorFilterType||monitorFilterType=='')">
<el-select v-model="monitorFilterType" placeholder="请选择" size="small" style="width: 100px;"> <span class="device-icon" :class="monitorList[sn].online?'':'offline'" v-show="monitorList[sn].online !== undefined"></span>
<el-option label="全部" value=""></el-option> <div class="user-info">
<el-option label="有线" value="1"></el-option> <p>
<el-option label="无线" value="0"></el-option> <span class="name">{{monitorList[sn].name||'--'}}</span>
</el-select> <span>{{sn}}({{monitorList[sn].sourceType}})</span>
<!-- <el-button type="primary" plain size="small" @click="removeMonitorByGroup(monitorList.itemArr)">批量删除</el-button> --> </p>
</el-row> <p>车架号:{{monitorList[sn].standNo}}</p>
<ul class="monitor-list" style="max-height:calc(100vh - 380px);"> </div>
<li class="monitor-list-item" <span class="none_tip" v-show="!monitorList[sn].isHasPosition">无定位信息</span>
v-for="(sn, key) in monitorList.itemArr" <el-button type="text" @click.stop="removeMonitor(monitorList[sn], true)"><i class="fa fa-trash"></i></el-button>
:key="sn" </li>
@click="openMapInfoWindow(sn, monitorList[sn].source)" </template>
v-show="key!=='count' && (monitorList[sn].source==monitorFilterType||monitorFilterType=='')"> </ul>
<span class="device-icon" :class="monitorList[sn].online?'':'offline'" v-show="monitorList[sn].online !== undefined"></span> </div>
<div class="user-info"> <div class="filter-dialog-footer">
<p> <div class="device-icon-label"><span class="device-icon"></span> <span>在线</span></div>
<span class="name">{{monitorList[sn].name||'--'}}</span> <div class="device-icon-label"><span class="device-icon offline"></span> <span>离线</span></div>
<span>{{sn}}({{monitorList[sn].sourceType}})</span> </div>
</p> </div>
<p>车架号:{{monitorList[sn].standNo}}</p> <div class="filter-dialog animated " :class="resultDialogHidden?'fadeOut':'active fadeIn'">
</div> <div class="filter-dialog-header">
<span class="none_tip" v-show="!monitorList[sn].isHasPosition">无定位信息</span> 查询结果
<!-- <el-button type="text" @click.stop="removeMonitor(monitorList[sn], true)"><i class="fa fa-trash"></i></el-button> --> <i class="el-icon-close pull-right" @click.stop="resultDialogHidden=true"></i>
</li> </div>
</ul> <div class="filter-dialog-body">
</div> <el-row type="flex" class="sub-filter" justify="space-between">
<div class="filter-dialog-footer"> <el-select v-model="resultFilterType" placeholder="请选择" size="small" style="width: 100px;">
<div class="device-icon-label"><span class="device-icon"></span> <span>在线</span></div> <el-option label="全部" value=""></el-option>
<div class="device-icon-label"><span class="device-icon offline"></span> <span>离线</span></div> <el-option label="有线" value="1"></el-option>
</div> <el-option label="无线" value="0"></el-option>
</div> </el-select>
<div class="filter-dialog animated " :class="resultDialogHidden?'fadeOut':'active fadeIn'"> <el-button type="primary" plain size="small" @click="addMonitorByGroup">批量监控</el-button>
<div class="filter-dialog-header"> </el-row>
查询结果 <ul class="monitor-list">
<i class="el-icon-close pull-right" @click.stop="resultDialogHidden=true"></i> <li class="monitor-list-item" v-for="item in resultList" :key="item.id" v-show="item.source==resultFilterType||resultFilterType==''">
</div> <div class="user-info">
<div class="filter-dialog-body"> <p><span class="name">{{item.name}}</span><span>{{item.sn}}({{item.sourceType}})</span></p>
<el-row type="flex" class="sub-filter" justify="space-between"> <p>车架号:{{item.standNo}}</p>
<el-select v-model="resultFilterType" placeholder="请选择" size="small" style="width: 100px;"> </div>
<el-option label="全部" value=""></el-option> <el-button type="text" @click.prevent="addMonitor(item)">监控</el-button>
<el-option label="有线" value="1"></el-option> </li>
<el-option label="无线" value="0"></el-option> <li v-show="!resultList.length">
</el-select> <p class="text-center">无数据</p>
<el-button type="primary" plain size="small" @click="addMonitorByGroup">批量监控</el-button> </li>
</el-row> </ul>
<ul class="monitor-list"> </div>
<li class="monitor-list-item" v-for="item in resultList" :key="item.id" v-show="item.source==resultFilterType||resultFilterType==''"> </div>
<div class="user-info"> <div class="filter-dialog" :class="treeHidden?'fadeOut':'active fadeIn'">
<p><span class="name">{{item.name}}</span><span>{{item.sn}}({{item.sourceType}})</span></p> <div class="filter-dialog-header">
<p>车架号:{{item.standNo}}</p> 组织
</div> <i class="el-icon-close pull-right" @click.stop="treeHidden=true"></i>
<el-button type="text" @click.prevent="addMonitor(item)">监控</el-button> </div>
</li> <div class="filter-dialog-body">
<li v-show="!resultList.length"> <div class="monitor-list">
<p class="text-center">无数据</p> <el-tree ref="tree" :data="treeData" :props="treeProps" lazy :load="loadNode" show-checkbox node-key="id" :render-content="renderTreeContent" :default-expanded-keys="expandedKeys" :default-checked-keys="checkedKeys" @check="handleCheck" v-loading="treeLoading" @check-change="handleCheckChange">
</li> </el-tree>
</ul> </div>
</div>
</div> </div>
<div class="filter-dialog" :class="treeHidden?'fadeOut':'active fadeIn'"> </div>
<div class="filter-dialog-header"> </div>
组织 </div>
<i class="el-icon-close pull-right" @click.stop="treeHidden=true"></i> </div>
</div> </template>
<div class="filter-dialog-body"> </v-full-layout>
<div class="monitor-list">
<el-tree
ref="tree"
:data="treeData"
:props="treeProps"
lazy
:load="loadNode"
show-checkbox
node-key="id"
:render-content="renderTreeContent"
:default-expanded-keys="expandedKeys"
:default-checked-keys="checkedKeys"
@check="handleCheck"
v-loading="treeLoading"
@check-change="handleCheckChange">
</el-tree>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
</v-full-layout>
</template> </template>
<script> <script>
import '../../assets/spritesmith-generated/sprite.css' import "../../assets/spritesmith-generated/sprite.css";
import store from '../../vuex/store.js' import store from "../../vuex/store.js";
import remoteLoad from 'utils/remoteLoad.js' import remoteLoad from "utils/remoteLoad.js";
import mapService from 'utils/mapService.js' import mapService from "utils/mapService.js";
import 'utils/mapEvent.js' import "utils/mapEvent.js";
import EventBus from '../../event-bus' import EventBus from "../../event-bus";
import {services} from '../../api' import { services } from "../../api";
import mock from '../../mock' import mock from "../../mock";
const MONITOR_SERVICE = services.monitor; const MONITOR_SERVICE = services.monitor;
import {CONSTANT} from '../../constant' import { CONSTANT } from "../../constant";
import MapControll from './MapControll.vue' import MapControll from "./MapControll.vue";
import {exportExcel} from 'utils' import { exportExcel } from "utils";
export default{ export default {
data(){ data() {
let checkFilename = (rule, vaule, cb)=>{ let checkFilename = (rule, vaule, cb) => {
if(this.form.filename === ''){ if (this.form.filename === "") {
cb('') cb("");
} }
cb() cb();
} };
return { return {
AMap: null, AMap: null,
mapObj: null,
mapLoading: false,
isInitMap: false,
flag:false,
searchText: '',//65MA08605HG349105 75108160001 1510112899
searchType: '2',
isSearching: false,
monitorFilterType: '',
resultFilterType: '',
importDialogHidden: true,
listDialogHidden: true,
resultDialogHidden: true,
resultList: [],
monitorList: {
count: 0,
itemArr: []
},
importing: false,
form: {
uploadType: '1',
filename: '',
},
rules: {
//filename: [{validator: checkFilename, trigger: 'change'}],
},
uploadData: {},
remainSearchSnStr: '',
refreshCount: 1,
resetRefreshCount: false,
autoOpenLastInfoWindow: false,
treeHidden: false, mapObj: null,
treeProps: { mapLoading: false,
label: 'label', isInitMap: false,
children: 'children', flag: false,
isLeaf: 'leaf', searchText: "", //65MA08605HG349105 75108160001 1510112899
['node-key']: 'id' searchType: "2",
}, isSearching: false,
treeData: [], monitorFilterType: "",
expandedKeys: [], resultFilterType: "",
isTreeChecked: false, importDialogHidden: true,
checkedKeys: [], listDialogHidden: true,
autocompleteHide: true, resultDialogHidden: true,
treeLoading: true, resultList: [],
} monitorList: {
}, count: 0,
computed:{ itemArr: [],
'uploadDisabled'(){ },
return this.form.filename === '' importing: false,
}, form: {
getMonitorListVisibleCount(){ uploadType: "1",
if(this.monitorFilterType === ''){ filename: "",
return this.monitorList.count },
}else{
let count = 0;
for(let key in this.monitorList){
if(key !== 'count' || key !== 'itemArr'){
if(this.monitorList[key].source == this.monitorFilterType){
count++;
}
}
}
return count;
}
}
},
watch: {
'monitorFilterType'(newVal){
EventBus.$emit('uiMap.monitor.changeSourceType', newVal);
},
searchType() {
if(this.searchText) {
this.searchSubmit()
}
}
},
methods: {
renderTreeContent(h, { node, data, store }) {
if(data.leaf) {
return h('div', {class: 'custom-tree-node'},[
h('div', {
domProps: {
innerHTML: '姓名:'+node.data.label1||'--'
}
}),
h('div', {
domProps: {
innerHTML: '设备号:'+node.data.label
}
}),
h('div', {
domProps: {
innerHTML: '车架号:'+node.data.label2
}
})
])
}
return h('span', {
domProps: {
innerHTML: node.data.label
}
})
},
getTreeData() {
MONITOR_SERVICE.getVehicleTree().then(({data})=>{
this.treeLoading = false
this.treeData = data
})
},
handleCheckChange(data, checked, indeterminate) {
//console.log(data, checked, indeterminate);
if(checked) {
//console.log(this.$refs.tree.getNode(data))
let node = this.$refs.tree.getNode(data)
console.log(indeterminate)
//this.getAllChild(node)
//this.$refs.tree.store.defaultExpandAll = true
//this.$refs.tree.setCheckedKeys(['u8121'])
}
this.isTreeChecked = checked
this.expandedKeys = []
},
handleCheck(data, node) {
console.log('node', data)
if(data.leaf) {
const item = {
sn: data.label,
name: data.label1,
standNo: data.label2,
online: data.online,
id: data.id,
source: data.source==='有线'?'1':'0',
sourceType: data.source
}
if(this.isTreeChecked) {
this.addMonitor(item)
}else{
this.removeMonitor(item)
}
} else {
if(this.isTreeChecked) {
this.$confirm('当所选分组包含车辆过多时,请尝试分多次查询,以防等待时间过久。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.checkFlow(data,node)
})
}else{
this.checkFlow(data,node)
}
}
},
checkFlow(data, node) {
let action = MONITOR_SERVICE.getVehicleTreeUserIds
let params = {oId: data.id}
if(data.origin.type === 'u') { rules: {
action = MONITOR_SERVICE.getVehicleTreeUserList //filename: [{validator: checkFilename, trigger: 'change'}],
params = {uId: data.id} },
} uploadData: {},
this.treeLoading = true remainSearchSnStr: "",
action(params).then((res)=>{ refreshCount: 1,
this.treeLoading = false resetRefreshCount: false,
autoOpenLastInfoWindow: false,
let items = [] treeHidden: false,
if(!res.tips) { treeProps: {
items = res.data.map((item)=>{ label: "label",
return { children: "children",
sn: item.label, isLeaf: "leaf",
name: item.label1, ["node-key"]: "id",
standNo: item.label2, },
online: item.online, treeData: [],
id: item.id, expandedKeys: [],
source: item.source==='有线'?'1':'0', isTreeChecked: false,
sourceType: item.source checkedKeys: [],
} autocompleteHide: true,
}) treeLoading: true,
}else { };
if(this.isTreeChecked) { },
this.$message({ computed: {
type: 'info', uploadDisabled() {
message: res.tips return this.form.filename === "";
}); },
this.$refs.tree.setChecked(data, false) getMonitorListVisibleCount() {
if (data.children !== undefined) { if (this.monitorFilterType === "") {
data.children.forEach((item, i) => { return this.monitorList.count;
this.$refs.tree.setChecked(item, false, true) } else {
}) let count = 0;
} for (let key in this.monitorList) {
} if (key !== "count" || key !== "itemArr") {
if (this.monitorList[key].source == this.monitorFilterType) {
} count++;
}
if(items.length) { }
if(this.isTreeChecked) { }
this.addMonitorByGroup(items) return count;
}else{ }
this.removeMonitorByGroup(items) },
} },
} watch: {
monitorFilterType(newVal) {
}) EventBus.$emit("uiMap.monitor.changeSourceType", newVal);
}, },
getAllChild(node) { searchType() {
if(node.childNodes.length === 0 && !node.data.test) { if (this.searchText) {
let nodeData = node.data this.searchSubmit();
let origin = nodeData.origin }
if(nodeData.children) { },
if(nodeData.children.length) { },
nodeData.children.forEach((item)=>{ methods: {
this.$refs.tree.append(item, node) renderTreeContent(h, { node, data, store }) {
let childNode = this.$refs.tree.getNode(item) if (data.leaf) {
this.getAllChild(childNode) return h("div", { class: "custom-tree-node" }, [
}) h("div", {
node.data.test = true domProps: {
}else { innerHTML: "姓名:" + node.data.label1 || "--",
if(origin.type === 'u') { },
console.log('u') }),
MONITOR_SERVICE.getVehicleTreeUserList({uId: nodeData.id}).then(({data})=>{ h("div", {
if(data.length) { domProps: {
data.map((item)=>{ innerHTML: "设备号:" + node.data.label,
item.leaf = true },
this.$refs.tree.append(item, node) }),
}) h("div", {
} domProps: {
innerHTML: "车架号:" + node.data.label2,
}) },
node.data.test = true }),
} ]);
} }
} return h("span", {
} domProps: {
}, innerHTML: node.data.label,
loadNode(node, resolve) {console.log(node); },
const nodeData = node.data });
const origin = nodeData.origin },
if(nodeData.children){ getTreeData() {
if(nodeData.children.length) { MONITOR_SERVICE.getVehicleTree().then(({ data }) => {
return resolve(nodeData.children) this.treeLoading = false;
}else { this.treeData = data;
if(origin.type === 'u') { });
console.log('u') },
MONITOR_SERVICE.getVehicleTreeUserList({uId: nodeData.id}).then(({data})=>{ handleCheckChange(data, checked, indeterminate) {
if(data.length) { //console.log(data, checked, indeterminate);
data.map((item)=>{ if (checked) {
item.leaf = true //console.log(this.$refs.tree.getNode(data))
}) let node = this.$refs.tree.getNode(data);
return resolve(data) console.log(indeterminate);
} //this.getAllChild(node)
//this.$refs.tree.store.defaultExpandAll = true
return resolve([]) //this.$refs.tree.setCheckedKeys(['u8121'])
}) }
return; this.isTreeChecked = checked;
} this.expandedKeys = [];
} },
handleCheck(data, node) {
} console.log("node", data);
return resolve([]) if (data.leaf) {
const item = {
if (node.level === 0) { sn: data.label,
return resolve([{ name: 'region1' }, { name: 'region2' }]); name: data.label1,
} standNo: data.label2,
if (node.level > 3) return resolve([]); online: data.online,
id: data.id,
source: data.source === "有线" ? "1" : "0",
sourceType: data.source,
};
if (this.isTreeChecked) {
this.addMonitor(item);
} else {
this.removeMonitor(item);
}
} else {
if (this.isTreeChecked) {
this.$confirm(
"当所选分组包含车辆过多时,请尝试分多次查询,以防等待时间过久。",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
).then(() => {
this.checkFlow(data, node);
});
} else {
this.checkFlow(data, node);
}
}
},
checkFlow(data, node) {
let action = MONITOR_SERVICE.getVehicleTreeUserIds;
let params = { oId: data.id };
var hasChild; if (data.origin.type === "u") {
if (node.data.name === 'region1') { action = MONITOR_SERVICE.getVehicleTreeUserList;
hasChild = true; params = { uId: data.id };
} else if (node.data.name === 'region2') { }
hasChild = false; this.treeLoading = true;
} else { action(params).then((res) => {
hasChild = Math.random() > 0.5; this.treeLoading = false;
}
setTimeout(() => { let items = [];
var data; if (!res.tips) {
if (hasChild) { items = res.data.map((item) => {
data = [{ return {
name: 'zone' + this.count++ sn: item.label,
}, { name: item.label1,
name: 'zone' + this.count++ standNo: item.label2,
}]; online: item.online,
} else { id: item.id,
data = []; source: item.source === "有线" ? "1" : "0",
} sourceType: item.source,
};
});
} else {
if (this.isTreeChecked) {
this.$message({
type: "info",
message: res.tips,
});
this.$refs.tree.setChecked(data, false);
if (data.children !== undefined) {
data.children.forEach((item, i) => {
this.$refs.tree.setChecked(item, false, true);
});
}
}
}
if (items.length) {
if (this.isTreeChecked) {
this.addMonitorByGroup(items);
} else {
this.removeMonitorByGroup(items);
}
}
});
},
getAllChild(node) {
if (node.childNodes.length === 0 && !node.data.test) {
let nodeData = node.data;
let origin = nodeData.origin;
if (nodeData.children) {
if (nodeData.children.length) {
nodeData.children.forEach((item) => {
this.$refs.tree.append(item, node);
let childNode = this.$refs.tree.getNode(item);
this.getAllChild(childNode);
});
node.data.test = true;
} else {
if (origin.type === "u") {
console.log("u");
MONITOR_SERVICE.getVehicleTreeUserList({ uId: nodeData.id }).then(
({ data }) => {
if (data.length) {
data.map((item) => {
item.leaf = true;
this.$refs.tree.append(item, node);
});
}
}
);
node.data.test = true;
}
}
}
}
},
loadNode(node, resolve) {
console.log(node);
const nodeData = node.data;
const origin = nodeData.origin;
if (nodeData.children) {
if (nodeData.children.length) {
return resolve(nodeData.children);
} else {
if (origin.type === "u") {
console.log("u");
MONITOR_SERVICE.getVehicleTreeUserList({ uId: nodeData.id }).then(
({ data }) => {
if (data.length) {
data.map((item) => {
item.leaf = true;
});
return resolve(data);
}
return resolve([]);
}
);
return;
}
}
}
return resolve([]);
if (node.level === 0) {
return resolve([{ name: "region1" }, { name: "region2" }]);
}
if (node.level > 3) return resolve([]);
var hasChild;
if (node.data.name === "region1") {
hasChild = true;
} else if (node.data.name === "region2") {
hasChild = false;
} else {
hasChild = Math.random() > 0.5;
}
resolve(data); setTimeout(() => {
}, 500); var data;
}, if (hasChild) {
initMap(){ data = [
let check = ()=>{ {
this.checkLoadedTimeoutId && window.clearTimeout(this.checkLoadedTimeoutId); name: "zone" + this.count++,
},
{
name: "zone" + this.count++,
},
];
} else {
data = [];
}
return setTimeout(()=>{ resolve(data);
if('AMap' in window && typeof AMap.Map == 'function' && !this.mapObj){ }, 500);
window.AMap = AMap; },
this.mapObj = mapService.init('map'); initMap() {
let check = () => {
//this.bindEvent(); this.checkLoadedTimeoutId &&
this.isInitMap = true; window.clearTimeout(this.checkLoadedTimeoutId);
if(this.$route.query.snArr){
let routeQuery = JSON.parse(this.$route.query.snArr); return setTimeout(() => {
if(routeQuery.length>0){ if (
/* this.addMonitor(routeQuery[0]); "AMap" in window &&
typeof AMap.Map == "function" &&
!this.mapObj
) {
window.AMap = AMap;
this.mapObj = mapService.init("map");
//this.bindEvent();
this.isInitMap = true;
if (this.$route.query.snArr) {
let routeQuery = JSON.parse(this.$route.query.snArr);
if (routeQuery.length > 0) {
/* this.addMonitor(routeQuery[0]);
this.autoOpenLastInfoWindow = true; */ this.autoOpenLastInfoWindow = true; */
routeQuery.forEach((item)=>{ routeQuery.forEach((item) => {
this.addMonitor(item); this.addMonitor(item);
});
}) this.autoOpenLastInfoWindow = true;
this.autoOpenLastInfoWindow = true; this.listDialogHidden = false;
this.listDialogHidden = false }
} }
} if (this.$route.query.vin) {
if(this.$route.query.vin){ MONITOR_SERVICE.getVehicleTree({
MONITOR_SERVICE.getVehicleTree({ termType: 2,
termType: 2, term: this.$route.query.vin,
term: this.$route.query.vin, returnTrees: true,
returnTrees: true }).then((res) => {
}).then((res)=>{ const items = res.data;
const items = res.data
this.expandTreeItems(items);
this.expandTreeItems(items) });
}) this.treeHidden = true;
this.treeHidden = true }
} } else {
}else{ this.checkLoadedTimeoutId = check();
this.checkLoadedTimeoutId = check() }
} }, 100);
}, 100) };
} this.checkLoadedTimeoutId = check();
this.checkLoadedTimeoutId = check(); },
}, keyupSubmit() {
keyupSubmit(){ document.onkeydown = (e) => {
document.onkeydown=e=>{ let _key = window.event.keyCode;
let _key=window.event.keyCode; if (_key === 13) {
if(_key===13){ this.searchSubmit();
this.searchSubmit() }
} };
} },
}, searchSubmit() {
searchSubmit(){ /* this.addMonitor({
/* this.addMonitor({
sn: '75108160001' sn: '75108160001'
}) })
return */ return */
//if(!this.searchText) return; //if(!this.searchText) return;
switch(this.searchType){ switch (this.searchType) {
case '1': case "1":
case '2': case "2":
case '4': case "4":
let relObj = { let relObj = {
'1': '设备号', 1: "设备号",
'2': '车架号', 2: "车架号",
'4': '工单号' 4: "工单号",
} };
if(this.searchText.length<6){ if (this.searchText.length < 6) {
this.$message({ this.$message({
type: 'error', type: "error",
message: `请输入至少6位的${relObj[this.searchType]}` message: `请输入至少6位的${relObj[this.searchType]}`,
}); });
return; return;
} }
break; break;
case '3': case "3":
if(this.searchText.length<2){ if (this.searchText.length < 2) {
this.$message({ this.$message({
type: 'error', type: "error",
message: '请输入至少2位的姓名' message: "请输入至少2位的姓名",
}); });
return; return;
} }
break; break;
} }
this.isSearching = true; this.isSearching = true;
this.$refs.autocomplete.activated = true // this.$refs.autocomplete.activated = true
this.$refs.autocomplete.getData(this.searchText) // this.$refs.autocomplete.getData(this.searchText)
/* MONITOR_SERVICE.getVehicleDeviceList({
this.querySearch();
/* MONITOR_SERVICE.getVehicleDeviceList({
term: this.searchText, term: this.searchText,
type: this.searchType type: this.searchType
}).then((res)=>{ }).then((res)=>{
...@@ -615,174 +601,191 @@ ...@@ -615,174 +601,191 @@
} }
}); */ }); */
}, },
querySearch(queryString, cb) { querySearch() {
this.autocompleteHide = true let _this = this;
if(this.isSearching) { //this.autocompleteHide = true
MONITOR_SERVICE.getVehicleTree({ if (this.isSearching) {
termType: this.searchType, MONITOR_SERVICE.getVehicleTree({
term: this.searchText, termType: this.searchType,
}).then((res)=>{ term: this.searchText,
this.isSearching = false; }).then((res) => {
cb(res.data) this.isSearching = false;
if(!res.data.length) { console.log(res);
cb([{ let list = res.data || [];
tip: '无数据' if (!list || list.length <= 0) {
}]) return false;
} }
this.autocompleteHide = false
})
}
},
handleSelect(item) {
if(!item.tip) {
MONITOR_SERVICE.getVehicleTree({
termType: 1,
term: item.label,
returnTrees: true
}).then((res)=>{
const items = res.data
this.expandTreeItems(items)
})
}
},
expandTreeItems(arr, isDevice) {
arr.forEach((item)=>{
if(isDevice) {
this.$refs.tree.setCheckedKeys(this.$refs.tree.getCheckedKeys().concat(item.id))
this.addMonitor({
sn: item.label,
name: item.label1,
standNo: item.label2,
online: item.online,
id: item.id,
source: item.source==='有线'?'1':'0',
sourceType: item.source
})
} else {
this.expandedKeys.push(item.id)
}
if(item.children &&item.children.length) {
this.expandTreeItems(item.children, item.origin.type === 'u'?true:false)
}
/* else{ for (var i = 0, len = list.length; i < len; i++) {
if() { _this.handleSelect(list[i]);
this.checkedKeys.push(item.id) }
} //cb(res.data)
} */ // if(!res.data.length) {
}) // cb([{
}, // tip: '无数据'
hasSameStandNo(arr){ // }])
let isSame = true; // }
for(let i=0,len=arr.length; i<len-2; i++){ //this.autocompleteHide = false
if(arr[i].standNo !== arr[i+1].standNo){ });
isSame = false; }
break; },
}
} // 查询树node
return isSame handleSelect(item) {
}, if (!item.tip) {
/*searchSubmit(){ MONITOR_SERVICE.getVehicleTree({
termType: 1,
term: item.label,
returnTrees: true,
}).then((res) => {
const items = res.data;
this.expandTreeItems(items);
});
}
},
// 展开树节点
expandTreeItems(arr, isDevice) {
arr.forEach((item) => {
if (isDevice) {
this.$refs.tree.setCheckedKeys(
this.$refs.tree.getCheckedKeys().concat(item.id)
);
this.addMonitor({
sn: item.label,
name: item.label1,
standNo: item.label2,
online: item.online,
id: item.id,
source: item.source === "有线" ? "1" : "0",
sourceType: item.source,
});
} else {
this.expandedKeys.push(item.id);
}
if (item.children && item.children.length) {
this.expandTreeItems(
item.children,
item.origin.type === "u" ? true : false
);
}
});
},
// hasSameStandNo(arr){
// let isSame = true;
// for(let i=0,len=arr.length; i<len-2; i++){
// if(arr[i].standNo !== arr[i+1].standNo){
// isSame = false;
// break;
// }
// }
// return isSame
// },
/*searchSubmit(){
console.log(mock.getMonitorDataByGroup) console.log(mock.getMonitorDataByGroup)
EventBus.$emit('uiMap.monitor.draw', mock.getMonitorDataByGroup) EventBus.$emit('uiMap.monitor.draw', mock.getMonitorDataByGroup)
},*/ },*/
successUpload(res){
this.importing = false;
if(typeof res === 'object'){
if(res.returnCode == 0){
const data = res.data; // 导入成功
this.resultList = data; successUpload(res) {
this.resultDialogHidden = false; this.importing = false;
this.importDialogHidden = true; if (typeof res === "object") {
setTimeout(()=>this.form.filename = '', 0); if (res.returnCode == 0) {
//this.$refs.upload.clearFiles(); const data = res.data;
}else{ this.resultList = data;
this.resultDialogHidden = false;
this.$message({ this.importDialogHidden = true;
type: 'error', setTimeout(() => (this.form.filename = ""), 0);
message: res.message //this.$refs.upload.clearFiles();
}); } else {
setTimeout(()=>this.form.filename = '', 0); this.$message({
type: "error",
} message: res.message,
}else{ });
window.location.href = '../ots/login'; setTimeout(() => (this.form.filename = ""), 0);
} }
} else {
}, window.location.href = "../ots/login";
submitUpload() { }
this.$refs.form.validate((valid) => { },
if(valid){
this.uploadData.type = this.form.uploadType // 开始上传
this.$refs.upload.submit(); submitUpload() {
} this.$refs.form.validate((valid) => {
}) if (valid) {
}, this.uploadData.type = this.form.uploadType;
changeFile(file, filelist) { this.$refs.upload.submit();
this.form.filename = file.name; }
}, });
beforeUpload(file){ },
/*if(!/^.*\.(?:xlsx)$/.test(file.name)){
// 监听文件上传改变
changeFile(file, filelist) {
this.form.filename = file.name;
},
// 文件上传前的钩子
beforeUpload(file) {
/*if(!/^.*\.(?:xlsx)$/.test(file.name)){
this.$message({ this.$message({
type: 'info', type: 'info',
message: '只能导入后缀为.xlsx的文件' message: '只能导入后缀为.xlsx的文件'
}); });
return false return false
}*/ }*/
if(file.name == this.form.filename){ if (file.name == this.form.filename) {
this.importing = true; this.importing = true;
return true return true;
} }
return false return false;
}, },
addMonitor(item){
if(this.monitorList.count === 100){ // 添加监控
this.$message({ addMonitor(item) {
type: 'error', if (this.monitorList.count === 100) {
message: '监控设备数最大100台,无法添加' this.$message({
}); type: "error",
}else{ message: "监控设备数最大100台,无法添加",
if(this.monitorList[item.sn]){ });
this.$message({ } else {
type: 'error', if (this.monitorList[item.sn]) {
message: '该列表中有设备正在监控中,请勿重复监控' this.$message({
}); type: "error",
}else{ message: "该列表中有设备正在监控中,请勿重复监控",
this.resetRefreshCount = true; });
this.monitorList.count++; } else {
item.eLocateType = 'gpsLocation' this.resetRefreshCount = true;
this.monitorList[item.sn] = item; this.monitorList.count++;
this.monitorList.itemArr.unshift(item.sn) item.eLocateType = "gpsLocation";
this.getPositionData(); this.monitorList[item.sn] = item;
} this.monitorList.itemArr.unshift(item.sn);
} this.getPositionData();
}, }
standNoMonitor(item){ }
this.resetRefreshCount = true; },
this.monitorList.count++; // standNoMonitor(item){
for (let i in item) { // this.resetRefreshCount = true;
this.monitorList[item.sn] = item[i].sn; // this.monitorList.count++;
} // for (let i in item) {
// this.monitorList[item.sn] = item[i].sn;
this.getPositionData(); // }
},
addMonitorByGroup(items){ // this.getPositionData();
if(this.resultList.length>100-this.monitorList.count){ // },
this.$message({
type: 'error', // 批量监控
message: '监控设备数最大100台,无法添加' addMonitorByGroup(items) {
}); if (this.resultList.length > 100 - this.monitorList.count) {
}else{ this.$message({
/* let findExistItem = this.resultList.find((item)=>this.monitorList[item.sn]); type: "error",
message: "监控设备数最大100台,无法添加",
});
} else {
/* let findExistItem = this.resultList.find((item)=>this.monitorList[item.sn]);
if(findExistItem){ if(findExistItem){
this.$message({ this.$message({
type: 'error', type: 'error',
...@@ -797,241 +800,282 @@ ...@@ -797,241 +800,282 @@
}); });
this.getPositionData(this.resultList) this.getPositionData(this.resultList)
} */ } */
let filterList = items.filter((item)=>{ let filterList = items.filter((item) => {
return !this.monitorList[item.sn] return !this.monitorList[item.sn];
}); });
filterList.forEach((item)=>{ filterList.forEach((item) => {
item.eLocateType = 'gpsLocation' item.eLocateType = "gpsLocation";
this.monitorList[item.sn] = item; this.monitorList[item.sn] = item;
this.monitorList.count++; this.monitorList.count++;
this.monitorList.itemArr.unshift(item.sn) this.monitorList.itemArr.unshift(item.sn);
}); });
this.getPositionData() this.getPositionData();
} }
},
}, // 单个删除监控列表
removeMonitor(item, ifUpdateTreeKeys){ removeMonitor(item, ifUpdateTreeKeys) {
delete this.monitorList[item.sn]; let obj = this.monitorList;
this.monitorList.itemArr.splice(this.monitorList.itemArr.indexOf(item.sn), 1) let list = obj.itemArr;
this.monitorList = Object.assign({}, this.monitorList); if (obj[item.sn]) {
this.monitorList.count--; delete obj[item.sn];
EventBus.$emit('uiMap.monitor.destroy', `${item.sn}:${item.source}`); }
if(ifUpdateTreeKeys) {
console.log(item) this.monitorList.itemArr = list.filter((k) => k != item.sn);
let checkedKeys = this.$refs.tree.getCheckedKeys() //this.monitorList.itemArr.splice(this.monitorList.itemArr.indexOf(item.sn||item), 1)
let arr = checkedKeys.filter((id)=>id!==item.id) this.monitorList = Object.assign({}, obj);
console.log(arr) this.monitorList.count--;
this.$refs.tree.setCheckedKeys(arr) EventBus.$emit(
} "uiMap.monitor.destroy",
}, `${item.sn || item}:${item.source || item}`
removeMonitorByGroup(arr){ );
arr.forEach((item)=>{ console.log(this.monitorList);
if(this.monitorList[item.sn]) { if (ifUpdateTreeKeys) {
this.removeMonitor(item) console.log(item);
} let checkedKeys = this.$refs.tree.getCheckedKeys();
}) let arr = checkedKeys.filter((id) => id !== item.id);
}, console.log(arr);
getPositionData(arr){ this.$refs.tree.setCheckedKeys(arr);
/* let _this = this; }
},
// 批量删除 监控列表
removeMonitorByGroup(arr) {
let _this = this;
console.log(this.monitorList);
let o = this.monitorList;
arr.forEach((item) => {
let n = o[item];
if (n) {
_this.removeMonitor(n);
}
// if(this.monitorList[item.sn||item]) {
// this.removeMonitor(item)
// }
});
},
getPositionData(arr) {
/* let _this = this;
arr = arr.filter((item)=>this.monitorList[item.sn]); */ arr = arr.filter((item)=>this.monitorList[item.sn]); */
let snStr = this.monitorList.itemArr.join(',');//arr.map((item)=>item.sn).join(','); let snStr = this.monitorList.itemArr.join(","); //arr.map((item)=>item.sn).join(',');
if(!snStr) return; if (!snStr) return;
if(this.resetRefreshCount || this.remainSearchSnStr != snStr){ if (this.resetRefreshCount || this.remainSearchSnStr != snStr) {
this.refreshCount = 1; this.refreshCount = 1;
}else{ } else {
this.refreshCount++; this.refreshCount++;
} }
this.resetRefreshCount = false; this.resetRefreshCount = false;
this.remainSearchSnStr = snStr; this.remainSearchSnStr = snStr;
MONITOR_SERVICE.getDevicesLocation({ MONITOR_SERVICE.getDevicesLocation({
sns: snStr, sns: snStr,
deviceCode: 'gps', deviceCode: "gps",
//refreshCount: this.refreshCount //refreshCount: this.refreshCount
}).then((res)=>{ }).then((res) => {
if(res.code == 200){ if (res.code == 200) {
//this.monitorList['1570222001'].isOnLine = true; //this.monitorList['1570222001'].isOnLine = true;
const data = res.data; const data = res.data;
if(data.length){ if (data.length) {
data.forEach((item)=>{ data.forEach((item) => {
let relItem = this.monitorList[item.sn]; let relItem = this.monitorList[item.sn];
if(relItem){ if (relItem) {
relItem.isOnLine = item.status === 2? false: true; relItem.isOnLine = item.status === 2 ? false : true;
relItem.isHasPosition = true; relItem.isHasPosition = true;
item.name = relItem.name; item.name = relItem.name;
item.standNo = relItem.standNo; item.standNo = relItem.standNo;
} }
item.eLocateType = relItem.eLocateType item.eLocateType = relItem.eLocateType;
item = this.filterGpsBase(item)
item.isSource = relItem.source
});
this.monitorList = Object.assign({}, this.monitorList);
let drawData = data.filter((item)=>(this.monitorList.itemArr.indexOf(item.sn)>-1)&&item.eLocateType)
this.monitorList.count && EventBus.$emit('uiMap.monitor.draw', drawData, this.autoOpenLastInfoWindow);
if(this.autoOpenLastInfoWindow){
this.autoOpenLastInfoWindow = false;
}
this.isSearching = false;
}else{
this.drawDoneCb();
}
}
});
},
filterGpsBase(item){
//item.bsLocation = {}
console.log(item)
let gpsLocation = item.gpsLocation
let bsLocation = item.bsLocation
/* 如果基站,gps其中一个没数据,自动切换到另一个,如果都没有eLocateType为null */
if(item.eLocateType === 'gpsLocation' && (!gpsLocation || !gpsLocation.elng || !gpsLocation.elat)){
if(bsLocation && bsLocation.elng && bsLocation.elat){
item.eLocateType = 'bsLocation'
}else{
item.eLocateType = null
}
}else if(item.eLocateType === 'bsLocation' && (!bsLocation || !bsLocation.elng || !bsLocation.elat)){
if(gpsLocation && gpsLocation.elng && gpsLocation.elat){
item.eLocateType = 'gpsLocation'
}else{
item.eLocateType = null
}
}
if(item.eLocateType === 'gpsLocation' && (!bsLocation || !bsLocation.elng || !bsLocation.elat)){ item = this.filterGpsBase(item);
item.eLocateSingle = true item.isSource = relItem.source;
}else if(item.eLocateType === 'bsLocation' && (!gpsLocation || !gpsLocation.elng || !gpsLocation.elat)){ });
item.eLocateSingle = true this.monitorList = Object.assign({}, this.monitorList);
} let drawData = data.filter(
(item) =>
this.monitorList.itemArr.indexOf(item.sn) > -1 &&
item.eLocateType
);
if(!item.eLocateSingle){ this.monitorList.count &&
if(moment(gpsLocation.dateTime).format('x') >= moment(bsLocation.dateTime).format('x')){ EventBus.$emit(
item.eLocateType = 'gpsLocation' "uiMap.monitor.draw",
}else{ drawData,
item.eLocateType = 'bsLocation' this.autoOpenLastInfoWindow
} );
// if(moment(gpsLocation.dateTime).isAfter(moment(bsLocation.dateTime))){ if (this.autoOpenLastInfoWindow) {
// item.eLocateType = 'gpsLocation' this.autoOpenLastInfoWindow = false;
// }else{ }
// item.eLocateType = 'bsLocation' this.isSearching = false;
// } } else {
} this.drawDoneCb();
}
}
});
},
filterGpsBase(item) {
//item.bsLocation = {}
console.log(item);
let gpsLocation = item.gpsLocation;
let bsLocation = item.bsLocation;
/* 如果基站,gps其中一个没数据,自动切换到另一个,如果都没有eLocateType为null */
if (
item.eLocateType === "gpsLocation" &&
(!gpsLocation || !gpsLocation.elng || !gpsLocation.elat)
) {
if (bsLocation && bsLocation.elng && bsLocation.elat) {
item.eLocateType = "bsLocation";
} else {
item.eLocateType = null;
}
} else if (
item.eLocateType === "bsLocation" &&
(!bsLocation || !bsLocation.elng || !bsLocation.elat)
) {
if (gpsLocation && gpsLocation.elng && gpsLocation.elat) {
item.eLocateType = "gpsLocation";
} else {
item.eLocateType = null;
}
}
if (
item.eLocateType === "gpsLocation" &&
(!bsLocation || !bsLocation.elng || !bsLocation.elat)
) {
item.eLocateSingle = true;
} else if (
item.eLocateType === "bsLocation" &&
(!gpsLocation || !gpsLocation.elng || !gpsLocation.elat)
) {
item.eLocateSingle = true;
}
if (!item.eLocateSingle) {
if (
moment(gpsLocation.dateTime).format("x") >=
moment(bsLocation.dateTime).format("x")
) {
item.eLocateType = "gpsLocation";
} else {
item.eLocateType = "bsLocation";
}
// if(moment(gpsLocation.dateTime).isAfter(moment(bsLocation.dateTime))){
// item.eLocateType = 'gpsLocation'
// }else{
// item.eLocateType = 'bsLocation'
// }
}
return item return item;
}, },
errorUpload(err){ errorUpload(err) {
console.log(err) console.log(err);
//window.location.href = '../ots/login'; //window.location.href = '../ots/login';
}, },
drawDoneCb(){ drawDoneCb() {
console.log('drawDoneCb') console.log("drawDoneCb");
this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId); this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId);
/* let arr = []; /* let arr = [];
for(let key in this.monitorList){ for(let key in this.monitorList){
if(key !== 'count'){ if(key !== 'count'){
arr.push(this.monitorList[key]) arr.push(this.monitorList[key])
} }
} */ } */
this._drawTimeoutId = setTimeout(()=>{ this._drawTimeoutId = setTimeout(() => {
this.getPositionData() this.getPositionData();
}, 10*1000) }, 10 * 1000);
},
}, terminate() {
terminate(){ this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId);
this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId); },
}, openMapInfoWindow(sn, source) {
openMapInfoWindow(sn, source){ EventBus.$emit("uiMap.monitor.openInfoWindow", `${sn}:${source}`);
EventBus.$emit('uiMap.monitor.openInfoWindow', `${sn}:${source}`) },
}, downloadTpl() {
downloadTpl(){ exportExcel("vehicle/downLoadImportSearchModel");
exportExcel('vehicle/downLoadImportSearchModel') },
}, changeELocate(item) {
changeELocate(item){ this.monitorList[item.sn].eLocateType = item.eLocateType;
this.monitorList[item.sn].eLocateType = item.eLocateType //item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation'
//item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation' },
} },
}, created() {
created () { if (window.AMap) {
this.initMap();
if(window.AMap){ } else {
this.initMap(); remoteLoad(`${CONSTANT.AMAP_URL}`).then(() => {
}else{ remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(
remoteLoad(`${CONSTANT.AMAP_URL}`).then(()=>{ () => {
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(()=>{ this.initMap();
this.initMap(); }
}) );
}) });
}
} this.keyupSubmit();
this.keyupSubmit(); EventBus.$on("uiMap.monitor.drawDone", this.drawDoneCb);
EventBus.$on('uiMap.monitor.drawDone', this.drawDoneCb); EventBus.$on("uiMap.monitor.changeELocate", this.changeELocate);
EventBus.$on('uiMap.monitor.changeELocate', this.changeELocate); EventBus.$on("uiMap.monitor.terminate", this.terminate);
EventBus.$on('uiMap.monitor.terminate', this.terminate);
this.getTreeData();
this.getTreeData() },
beforeDestroy() {
}, EventBus.$emit("uiMap.monitor.destroy");
beforeDestroy(){ EventBus.$off("uiMap.monitor.drawDone", this.drawDoneCb);
EventBus.$emit('uiMap.monitor.destroy'); this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId);
EventBus.$off('uiMap.monitor.drawDone', this.drawDoneCb); this.checkLoadedTimeoutId && window.clearTimeout(this.checkLoadedTimeoutId);
this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId); },
this.checkLoadedTimeoutId && window.clearTimeout(this.checkLoadedTimeoutId); components: {
}, MapControll,
components: { },
MapControll };
}
}
</script> </script>
<style scoped> <style scoped>
/*样式写在 scss/monitor.scss*/ /*样式写在 scss/monitor.scss*/
.none_tip{ .none_tip {
align-self: center; align-self: center;
font-size: 12px; font-size: 12px;
color: red; color: red;
padding: 0 5px; padding: 0 5px;
} }
</style> </style>
<style> <style>
.el-tree-node__content{ .el-tree-node__content {
height: auto; height: auto;
padding: 2px; padding: 2px;
} }
.custom-tree-node { .custom-tree-node {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
font-size: 12px; font-size: 12px;
padding-right: 8px; padding-right: 8px;
line-height: 26px; line-height: 26px;
} }
.map-wrap .el-tree-node > .el-tree-node__children { .map-wrap .el-tree-node > .el-tree-node__children {
overflow: visible; overflow: visible;
} }
.search_auto{ .search_auto {
font-size: 12px; font-size: 12px;
} }
.search_auto_hide{ .search_auto_hide {
display: none; display: none;
} }
.search_auto .el-autocomplete-suggestion li{ .search_auto .el-autocomplete-suggestion li {
padding: 0; padding: 0;
} }
.search_auto .el-autocomplete-suggestion li div{ .search_auto .el-autocomplete-suggestion li div {
line-height: 20px; line-height: 20px;
} }
.el-autocomplete-suggestion li{ .el-autocomplete-suggestion li {
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
padding-bottom: 4px; padding-bottom: 4px;
} }
.el-autocomplete-suggestion li:last-child{ .el-autocomplete-suggestion li:last-child {
border-bottom: none; border-bottom: none;
} }
.full-width .main-wrap.full-width{ .full-width .main-wrap.full-width {
left: 0; left: 0;
width: 100%; width: 100%;
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!