Commit 6ce922e1 by 张杰

修改

1 parent 89a36cfb
<template>
<v-full-layout>
<template slot="breadcrumb">
<el-breadcrumb-item>车辆监控</el-breadcrumb-item>
</template>
<template slot="main">
<div class="map-wrap" v-loading="mapLoading">
<div id="map" class="map-container"></div>
<map-controll isShowFullsize="true"></map-controll>
<div class="controll-wrap">
<div class="menu-search">
<el-autocomplete
<v-full-layout>
<template slot="breadcrumb">
<el-breadcrumb-item>车辆监控</el-breadcrumb-item>
</template>
<template slot="main">
<div class="map-wrap" v-loading="mapLoading">
<div id="map" class="map-container"></div>
<map-controll isShowFullsize="true"></map-controll>
<div class="controll-wrap">
<div class="menu-search">
<!-- <el-autocomplete
ref="autocomplete"
size="small"
:popper-class="'search_auto'+(autocompleteHide?' search_auto_hide':'')"
......@@ -18,17 +18,17 @@
:fetch-suggestions="querySearch"
:trigger-on-focus="false"
:placeholder="'请输入'+['6位以上设备号','6位以上车架号','2位以上姓名'][searchType-1]"
@select="handleSelect">
<!-- <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-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
<!-- <el-option label="工单号" value="4"></el-option> -->
</el-select>
<el-button icon="el-icon-search" size="mini" slot="append" :loading="isSearching" @click="searchSubmit" >
</el-button>
<template slot-scope="{ item }">
@select="handleSelect"> -->
<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-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
<!-- <el-option label="工单号" value="4"></el-option> -->
</el-select>
<el-button icon="el-icon-search" size="mini" slot="append" :loading="isSearching" @click="searchSubmit">
</el-button>
<!-- <template slot-scope="{ item }">
<div style="margin: 0 -20px; font-size: 12px; " class="auto_item">
<template v-if="item.tip">
{{item.tip}}
......@@ -39,558 +39,544 @@
</template>
</div>
</template>
</el-autocomplete>
<!-- </el-input> -->
</div>
<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="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-row>
<div class="filter-dialog-set">
<div class="filter-dialog animated " :class="importDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header">
导入查询
<i class="el-icon-close pull-right" @click.stop="importDialogHidden=true"></i>
</div>
<div class="filter-dialog-body">
<el-form ref="form" :model="form" :rules="rules" :inline="false" size="mini">
<el-form-item label="" prop="filename">
<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">
<el-input v-model="form.filename" placeholder="未选取任何文件" class="input-with-select" size="small" >
<el-select v-model="form.uploadType" slot="prepend" placeholder="请选择" size="small" >
<el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
<el-option label="工单号" value="4"></el-option>
</el-select>
</el-input>
<div slot="tip" class="el-upload__tip">仅支持同时监控100台设备,还可导入{{100-monitorList.count}}台设备</div>
</el-upload>
</el-form-item>
<el-button type="primary" class="upload-sure-btn" size="small" @click="submitUpload" :loading="importing" :disabled="uploadDisabled">确认</el-button>
<el-button size="mini" type="text" @click="downloadTpl" style="margin-left: 0px;">下载模板</el-button>
</el-form>
</div>
</div>
<div class="filter-dialog animated " :class="listDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header">
监控列表({{monitorList.count}})
<i class="el-icon-close pull-right" @click.stop="listDialogHidden=true"></i>
</div>
<div class="filter-dialog-body">
<el-row type="flex" class="sub-filter" justify="space-between">
<el-select v-model="monitorFilterType" placeholder="请选择" size="small" style="width: 100px;">
<el-option label="全部" value=""></el-option>
<el-option label="有线" value="1"></el-option>
<el-option label="无线" value="0"></el-option>
</el-select>
<!-- <el-button type="primary" plain size="small" @click="removeMonitorByGroup(monitorList.itemArr)">批量删除</el-button> -->
</el-row>
<ul class="monitor-list" style="max-height:calc(100vh - 380px);">
<li class="monitor-list-item"
v-for="(sn, key) in monitorList.itemArr"
:key="sn"
@click="openMapInfoWindow(sn, monitorList[sn].source)"
v-show="key!=='count' && (monitorList[sn].source==monitorFilterType||monitorFilterType=='')">
<span class="device-icon" :class="monitorList[sn].online?'':'offline'" v-show="monitorList[sn].online !== undefined"></span>
<div class="user-info">
<p>
<span class="name">{{monitorList[sn].name||'--'}}</span>
<span>{{sn}}({{monitorList[sn].sourceType}})</span>
</p>
<p>车架号:{{monitorList[sn].standNo}}</p>
</div>
<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> -->
</li>
</ul>
</div>
<div class="filter-dialog-footer">
<div class="device-icon-label"><span class="device-icon"></span> <span>在线</span></div>
<div class="device-icon-label"><span class="device-icon offline"></span> <span>离线</span></div>
</div>
</div>
<div class="filter-dialog animated " :class="resultDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header">
查询结果
<i class="el-icon-close pull-right" @click.stop="resultDialogHidden=true"></i>
</div>
<div class="filter-dialog-body">
<el-row type="flex" class="sub-filter" justify="space-between">
<el-select v-model="resultFilterType" placeholder="请选择" size="small" style="width: 100px;">
<el-option label="全部" value=""></el-option>
<el-option label="有线" value="1"></el-option>
<el-option label="无线" value="0"></el-option>
</el-select>
<el-button type="primary" plain size="small" @click="addMonitorByGroup">批量监控</el-button>
</el-row>
<ul class="monitor-list">
<li class="monitor-list-item" v-for="item in resultList" :key="item.id" v-show="item.source==resultFilterType||resultFilterType==''">
<div class="user-info">
<p><span class="name">{{item.name}}</span><span>{{item.sn}}({{item.sourceType}})</span></p>
<p>车架号:{{item.standNo}}</p>
</div>
<el-button type="text" @click.prevent="addMonitor(item)">监控</el-button>
</li>
<li v-show="!resultList.length">
<p class="text-center">无数据</p>
</li>
</ul>
</div>
</div>
<div class="filter-dialog" :class="treeHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header">
组织
<i class="el-icon-close pull-right" @click.stop="treeHidden=true"></i>
</div>
<div class="filter-dialog-body">
<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> -->
<!-- </el-autocomplete> -->
</el-input>
</div>
<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="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-row>
<div class="filter-dialog-set">
<div class="filter-dialog animated " :class="importDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header">
导入查询
<i class="el-icon-close pull-right" @click.stop="importDialogHidden=true"></i>
</div>
<div class="filter-dialog-body">
<el-form ref="form" :model="form" :rules="rules" :inline="false" size="mini">
<el-form-item label="" prop="filename">
<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">
<el-input v-model="form.filename" placeholder="未选取任何文件" class="input-with-select" size="small">
<el-select v-model="form.uploadType" slot="prepend" placeholder="请选择" size="small">
<el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
<el-option label="工单号" value="4"></el-option>
</el-select>
</el-input>
<div slot="tip" class="el-upload__tip">仅支持同时监控100台设备,还可导入{{100-monitorList.count}}台设备</div>
</el-upload>
</el-form-item>
<el-button type="primary" class="upload-sure-btn" size="small" @click="submitUpload" :loading="importing" :disabled="uploadDisabled">确认</el-button>
<el-button size="mini" type="text" @click="downloadTpl" style="margin-left: 0px;">下载模板</el-button>
</el-form>
</div>
</div>
<div class="filter-dialog animated " :class="listDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header">
监控列表({{monitorList.count}})
<i class="el-icon-close pull-right" @click.stop="listDialogHidden=true"></i>
</div>
<div class="filter-dialog-body">
<el-row type="flex" class="sub-filter" justify="space-between">
<el-select v-model="monitorFilterType" placeholder="请选择" size="small" style="width: 100px;">
<el-option label="全部" value=""></el-option>
<el-option label="有线" value="1"></el-option>
<el-option label="无线" value="0"></el-option>
</el-select>
<el-button type="primary" plain size="small" @click="removeMonitorByGroup(monitorList.itemArr)">批量删除</el-button>
</el-row>
<ul class="monitor-list" style="max-height:calc(100vh - 380px);">
<template v-for="(sn, key) in monitorList.itemArr">
<li class="monitor-list-item" :key="sn" @click="openMapInfoWindow(sn, monitorList[sn].source)" v-if="key!=='count' && monitorList[sn]&&(monitorList[sn].source==monitorFilterType||monitorFilterType=='')">
<span class="device-icon" :class="monitorList[sn].online?'':'offline'" v-show="monitorList[sn].online !== undefined"></span>
<div class="user-info">
<p>
<span class="name">{{monitorList[sn].name||'--'}}</span>
<span>{{sn}}({{monitorList[sn].sourceType}})</span>
</p>
<p>车架号:{{monitorList[sn].standNo}}</p>
</div>
<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>
</li>
</template>
</ul>
</div>
<div class="filter-dialog-footer">
<div class="device-icon-label"><span class="device-icon"></span> <span>在线</span></div>
<div class="device-icon-label"><span class="device-icon offline"></span> <span>离线</span></div>
</div>
</div>
<div class="filter-dialog animated " :class="resultDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header">
查询结果
<i class="el-icon-close pull-right" @click.stop="resultDialogHidden=true"></i>
</div>
<div class="filter-dialog-body">
<el-row type="flex" class="sub-filter" justify="space-between">
<el-select v-model="resultFilterType" placeholder="请选择" size="small" style="width: 100px;">
<el-option label="全部" value=""></el-option>
<el-option label="有线" value="1"></el-option>
<el-option label="无线" value="0"></el-option>
</el-select>
<el-button type="primary" plain size="small" @click="addMonitorByGroup">批量监控</el-button>
</el-row>
<ul class="monitor-list">
<li class="monitor-list-item" v-for="item in resultList" :key="item.id" v-show="item.source==resultFilterType||resultFilterType==''">
<div class="user-info">
<p><span class="name">{{item.name}}</span><span>{{item.sn}}({{item.sourceType}})</span></p>
<p>车架号:{{item.standNo}}</p>
</div>
<el-button type="text" @click.prevent="addMonitor(item)">监控</el-button>
</li>
<li v-show="!resultList.length">
<p class="text-center">无数据</p>
</li>
</ul>
</div>
</div>
<div class="filter-dialog" :class="treeHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header">
组织
<i class="el-icon-close pull-right" @click.stop="treeHidden=true"></i>
</div>
<div class="filter-dialog-body">
<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>
<script>
import '../../assets/spritesmith-generated/sprite.css'
import store from '../../vuex/store.js'
import remoteLoad from 'utils/remoteLoad.js'
import mapService from 'utils/mapService.js'
import 'utils/mapEvent.js'
import EventBus from '../../event-bus'
import {services} from '../../api'
import mock from '../../mock'
const MONITOR_SERVICE = services.monitor;
import "../../assets/spritesmith-generated/sprite.css";
import store from "../../vuex/store.js";
import remoteLoad from "utils/remoteLoad.js";
import mapService from "utils/mapService.js";
import "utils/mapEvent.js";
import EventBus from "../../event-bus";
import { services } from "../../api";
import mock from "../../mock";
const MONITOR_SERVICE = services.monitor;
import {CONSTANT} from '../../constant'
import MapControll from './MapControll.vue'
import {exportExcel} from 'utils'
export default{
data(){
let checkFilename = (rule, vaule, cb)=>{
if(this.form.filename === ''){
cb('')
}
cb()
}
return {
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,
import { CONSTANT } from "../../constant";
import MapControll from "./MapControll.vue";
import { exportExcel } from "utils";
export default {
data() {
let checkFilename = (rule, vaule, cb) => {
if (this.form.filename === "") {
cb("");
}
cb();
};
return {
AMap: null,
treeHidden: false,
treeProps: {
label: 'label',
children: 'children',
isLeaf: 'leaf',
['node-key']: 'id'
},
treeData: [],
expandedKeys: [],
isTreeChecked: false,
checkedKeys: [],
autocompleteHide: true,
treeLoading: true,
}
},
computed:{
'uploadDisabled'(){
return this.form.filename === ''
},
getMonitorListVisibleCount(){
if(this.monitorFilterType === ''){
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}
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: "",
},
if(data.origin.type === 'u') {
action = MONITOR_SERVICE.getVehicleTreeUserList
params = {uId: data.id}
}
this.treeLoading = true
action(params).then((res)=>{
this.treeLoading = false
rules: {
//filename: [{validator: checkFilename, trigger: 'change'}],
},
uploadData: {},
remainSearchSnStr: "",
refreshCount: 1,
resetRefreshCount: false,
autoOpenLastInfoWindow: false,
let items = []
if(!res.tips) {
items = res.data.map((item)=>{
return {
sn: item.label,
name: item.label1,
standNo: item.label2,
online: item.online,
id: item.id,
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;
}
}
}
treeHidden: false,
treeProps: {
label: "label",
children: "children",
isLeaf: "leaf",
["node-key"]: "id",
},
treeData: [],
expandedKeys: [],
isTreeChecked: false,
checkedKeys: [],
autocompleteHide: true,
treeLoading: true,
};
},
computed: {
uploadDisabled() {
return this.form.filename === "";
},
getMonitorListVisibleCount() {
if (this.monitorFilterType === "") {
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);
return resolve([])
if (node.level === 0) {
return resolve([{ name: 'region1' }, { name: 'region2' }]);
}
if (node.level > 3) return resolve([]);
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 };
var hasChild;
if (node.data.name === 'region1') {
hasChild = true;
} else if (node.data.name === 'region2') {
hasChild = false;
} else {
hasChild = Math.random() > 0.5;
}
if (data.origin.type === "u") {
action = MONITOR_SERVICE.getVehicleTreeUserList;
params = { uId: data.id };
}
this.treeLoading = true;
action(params).then((res) => {
this.treeLoading = false;
setTimeout(() => {
var data;
if (hasChild) {
data = [{
name: 'zone' + this.count++
}, {
name: 'zone' + this.count++
}];
} else {
data = [];
}
let items = [];
if (!res.tips) {
items = res.data.map((item) => {
return {
sn: item.label,
name: item.label1,
standNo: item.label2,
online: item.online,
id: item.id,
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);
}, 500);
},
initMap(){
let check = ()=>{
this.checkLoadedTimeoutId && window.clearTimeout(this.checkLoadedTimeoutId);
setTimeout(() => {
var data;
if (hasChild) {
data = [
{
name: "zone" + this.count++,
},
{
name: "zone" + this.count++,
},
];
} else {
data = [];
}
return setTimeout(()=>{
if('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]);
resolve(data);
}, 500);
},
initMap() {
let check = () => {
this.checkLoadedTimeoutId &&
window.clearTimeout(this.checkLoadedTimeoutId);
return setTimeout(() => {
if (
"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; */
routeQuery.forEach((item)=>{
this.addMonitor(item);
})
this.autoOpenLastInfoWindow = true;
this.listDialogHidden = false
}
}
if(this.$route.query.vin){
MONITOR_SERVICE.getVehicleTree({
termType: 2,
term: this.$route.query.vin,
returnTrees: true
}).then((res)=>{
const items = res.data
this.expandTreeItems(items)
})
this.treeHidden = true
}
}else{
this.checkLoadedTimeoutId = check()
}
}, 100)
}
this.checkLoadedTimeoutId = check();
},
keyupSubmit(){
document.onkeydown=e=>{
let _key=window.event.keyCode;
if(_key===13){
this.searchSubmit()
}
}
},
searchSubmit(){
/* this.addMonitor({
routeQuery.forEach((item) => {
this.addMonitor(item);
});
this.autoOpenLastInfoWindow = true;
this.listDialogHidden = false;
}
}
if (this.$route.query.vin) {
MONITOR_SERVICE.getVehicleTree({
termType: 2,
term: this.$route.query.vin,
returnTrees: true,
}).then((res) => {
const items = res.data;
this.expandTreeItems(items);
});
this.treeHidden = true;
}
} else {
this.checkLoadedTimeoutId = check();
}
}, 100);
};
this.checkLoadedTimeoutId = check();
},
keyupSubmit() {
document.onkeydown = (e) => {
let _key = window.event.keyCode;
if (_key === 13) {
this.searchSubmit();
}
};
},
searchSubmit() {
/* this.addMonitor({
sn: '75108160001'
})
return */
//if(!this.searchText) return;
switch(this.searchType){
case '1':
case '2':
case '4':
let relObj = {
'1': '设备号',
'2': '车架号',
'4': '工单号'
}
if(this.searchText.length<6){
this.$message({
type: 'error',
message: `请输入至少6位的${relObj[this.searchType]}`
});
return;
}
break;
case '3':
if(this.searchText.length<2){
this.$message({
type: 'error',
message: '请输入至少2位的姓名'
});
return;
}
break;
}
this.isSearching = true;
this.$refs.autocomplete.activated = true
this.$refs.autocomplete.getData(this.searchText)
/* MONITOR_SERVICE.getVehicleDeviceList({
//if(!this.searchText) return;
switch (this.searchType) {
case "1":
case "2":
case "4":
let relObj = {
1: "设备号",
2: "车架号",
4: "工单号",
};
if (this.searchText.length < 6) {
this.$message({
type: "error",
message: `请输入至少6位的${relObj[this.searchType]}`,
});
return;
}
break;
case "3":
if (this.searchText.length < 2) {
this.$message({
type: "error",
message: "请输入至少2位的姓名",
});
return;
}
break;
}
this.isSearching = true;
// this.$refs.autocomplete.activated = true
// this.$refs.autocomplete.getData(this.searchText)
this.querySearch();
/* MONITOR_SERVICE.getVehicleDeviceList({
term: this.searchText,
type: this.searchType
}).then((res)=>{
......@@ -615,174 +601,191 @@
}
}); */
},
querySearch(queryString, cb) {
this.autocompleteHide = true
if(this.isSearching) {
MONITOR_SERVICE.getVehicleTree({
termType: this.searchType,
term: this.searchText,
}).then((res)=>{
this.isSearching = false;
cb(res.data)
if(!res.data.length) {
cb([{
tip: '无数据'
}])
}
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)
}
},
querySearch() {
let _this = this;
//this.autocompleteHide = true
if (this.isSearching) {
MONITOR_SERVICE.getVehicleTree({
termType: this.searchType,
term: this.searchText,
}).then((res) => {
this.isSearching = false;
console.log(res);
let list = res.data || [];
if (!list || list.length <= 0) {
return false;
}
/* else{
if() {
this.checkedKeys.push(item.id)
}
} */
})
},
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(){
for (var i = 0, len = list.length; i < len; i++) {
_this.handleSelect(list[i]);
}
//cb(res.data)
// if(!res.data.length) {
// cb([{
// tip: '无数据'
// }])
// }
//this.autocompleteHide = false
});
}
},
// 查询树node
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
);
}
});
},
// 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)
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;
this.resultDialogHidden = false;
this.importDialogHidden = true;
setTimeout(()=>this.form.filename = '', 0);
//this.$refs.upload.clearFiles();
}else{
this.$message({
type: 'error',
message: res.message
});
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();
}
})
},
changeFile(file, filelist) {
this.form.filename = file.name;
},
beforeUpload(file){
/*if(!/^.*\.(?:xlsx)$/.test(file.name)){
// 导入成功
successUpload(res) {
this.importing = false;
if (typeof res === "object") {
if (res.returnCode == 0) {
const data = res.data;
this.resultList = data;
this.resultDialogHidden = false;
this.importDialogHidden = true;
setTimeout(() => (this.form.filename = ""), 0);
//this.$refs.upload.clearFiles();
} else {
this.$message({
type: "error",
message: res.message,
});
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();
}
});
},
// 监听文件上传改变
changeFile(file, filelist) {
this.form.filename = file.name;
},
// 文件上传前的钩子
beforeUpload(file) {
/*if(!/^.*\.(?:xlsx)$/.test(file.name)){
this.$message({
type: 'info',
message: '只能导入后缀为.xlsx的文件'
});
return false
}*/
if(file.name == this.form.filename){
this.importing = true;
return true
}
if (file.name == this.form.filename) {
this.importing = true;
return true;
}
return false
},
addMonitor(item){
if(this.monitorList.count === 100){
this.$message({
type: 'error',
message: '监控设备数最大100台,无法添加'
});
}else{
if(this.monitorList[item.sn]){
this.$message({
type: 'error',
message: '该列表中有设备正在监控中,请勿重复监控'
});
}else{
this.resetRefreshCount = true;
this.monitorList.count++;
item.eLocateType = 'gpsLocation'
this.monitorList[item.sn] = item;
this.monitorList.itemArr.unshift(item.sn)
this.getPositionData();
}
}
},
standNoMonitor(item){
this.resetRefreshCount = true;
this.monitorList.count++;
for (let i in item) {
this.monitorList[item.sn] = item[i].sn;
}
this.getPositionData();
},
addMonitorByGroup(items){
if(this.resultList.length>100-this.monitorList.count){
this.$message({
type: 'error',
message: '监控设备数最大100台,无法添加'
});
}else{
/* let findExistItem = this.resultList.find((item)=>this.monitorList[item.sn]);
return false;
},
// 添加监控
addMonitor(item) {
if (this.monitorList.count === 100) {
this.$message({
type: "error",
message: "监控设备数最大100台,无法添加",
});
} else {
if (this.monitorList[item.sn]) {
this.$message({
type: "error",
message: "该列表中有设备正在监控中,请勿重复监控",
});
} else {
this.resetRefreshCount = true;
this.monitorList.count++;
item.eLocateType = "gpsLocation";
this.monitorList[item.sn] = item;
this.monitorList.itemArr.unshift(item.sn);
this.getPositionData();
}
}
},
// standNoMonitor(item){
// this.resetRefreshCount = true;
// this.monitorList.count++;
// for (let i in item) {
// this.monitorList[item.sn] = item[i].sn;
// }
// this.getPositionData();
// },
// 批量监控
addMonitorByGroup(items) {
if (this.resultList.length > 100 - this.monitorList.count) {
this.$message({
type: "error",
message: "监控设备数最大100台,无法添加",
});
} else {
/* let findExistItem = this.resultList.find((item)=>this.monitorList[item.sn]);
if(findExistItem){
this.$message({
type: 'error',
......@@ -797,241 +800,282 @@
});
this.getPositionData(this.resultList)
} */
let filterList = items.filter((item)=>{
return !this.monitorList[item.sn]
});
filterList.forEach((item)=>{
item.eLocateType = 'gpsLocation'
this.monitorList[item.sn] = item;
this.monitorList.count++;
this.monitorList.itemArr.unshift(item.sn)
});
this.getPositionData()
}
let filterList = items.filter((item) => {
return !this.monitorList[item.sn];
});
filterList.forEach((item) => {
item.eLocateType = "gpsLocation";
this.monitorList[item.sn] = item;
this.monitorList.count++;
this.monitorList.itemArr.unshift(item.sn);
});
this.getPositionData();
}
},
},
removeMonitor(item, ifUpdateTreeKeys){
delete this.monitorList[item.sn];
this.monitorList.itemArr.splice(this.monitorList.itemArr.indexOf(item.sn), 1)
this.monitorList = Object.assign({}, this.monitorList);
this.monitorList.count--;
EventBus.$emit('uiMap.monitor.destroy', `${item.sn}:${item.source}`);
if(ifUpdateTreeKeys) {
console.log(item)
let checkedKeys = this.$refs.tree.getCheckedKeys()
let arr = checkedKeys.filter((id)=>id!==item.id)
console.log(arr)
this.$refs.tree.setCheckedKeys(arr)
}
},
removeMonitorByGroup(arr){
arr.forEach((item)=>{
if(this.monitorList[item.sn]) {
this.removeMonitor(item)
}
})
},
getPositionData(arr){
/* let _this = this;
// 单个删除监控列表
removeMonitor(item, ifUpdateTreeKeys) {
let obj = this.monitorList;
let list = obj.itemArr;
if (obj[item.sn]) {
delete obj[item.sn];
}
this.monitorList.itemArr = list.filter((k) => k != item.sn);
//this.monitorList.itemArr.splice(this.monitorList.itemArr.indexOf(item.sn||item), 1)
this.monitorList = Object.assign({}, obj);
this.monitorList.count--;
EventBus.$emit(
"uiMap.monitor.destroy",
`${item.sn || item}:${item.source || item}`
);
console.log(this.monitorList);
if (ifUpdateTreeKeys) {
console.log(item);
let checkedKeys = this.$refs.tree.getCheckedKeys();
let arr = checkedKeys.filter((id) => id !== item.id);
console.log(arr);
this.$refs.tree.setCheckedKeys(arr);
}
},
// 批量删除 监控列表
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]); */
let snStr = this.monitorList.itemArr.join(',');//arr.map((item)=>item.sn).join(',');
if(!snStr) return;
if(this.resetRefreshCount || this.remainSearchSnStr != snStr){
this.refreshCount = 1;
}else{
this.refreshCount++;
}
this.resetRefreshCount = false;
this.remainSearchSnStr = snStr;
MONITOR_SERVICE.getDevicesLocation({
sns: snStr,
deviceCode: 'gps',
//refreshCount: this.refreshCount
}).then((res)=>{
if(res.code == 200){
//this.monitorList['1570222001'].isOnLine = true;
const data = res.data;
if(data.length){
data.forEach((item)=>{
let relItem = this.monitorList[item.sn];
if(relItem){
relItem.isOnLine = item.status === 2? false: true;
relItem.isHasPosition = true;
item.name = relItem.name;
item.standNo = relItem.standNo;
}
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
}
}
let snStr = this.monitorList.itemArr.join(","); //arr.map((item)=>item.sn).join(',');
if (!snStr) return;
if (this.resetRefreshCount || this.remainSearchSnStr != snStr) {
this.refreshCount = 1;
} else {
this.refreshCount++;
}
this.resetRefreshCount = false;
this.remainSearchSnStr = snStr;
MONITOR_SERVICE.getDevicesLocation({
sns: snStr,
deviceCode: "gps",
//refreshCount: this.refreshCount
}).then((res) => {
if (res.code == 200) {
//this.monitorList['1570222001'].isOnLine = true;
const data = res.data;
if (data.length) {
data.forEach((item) => {
let relItem = this.monitorList[item.sn];
if (relItem) {
relItem.isOnLine = item.status === 2 ? false : true;
relItem.isHasPosition = true;
item.name = relItem.name;
item.standNo = relItem.standNo;
}
item.eLocateType = relItem.eLocateType;
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
}
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
);
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'
// }
}
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.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
},
errorUpload(err){
console.log(err)
//window.location.href = '../ots/login';
},
drawDoneCb(){
console.log('drawDoneCb')
this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId);
/* let arr = [];
return item;
},
errorUpload(err) {
console.log(err);
//window.location.href = '../ots/login';
},
drawDoneCb() {
console.log("drawDoneCb");
this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId);
/* let arr = [];
for(let key in this.monitorList){
if(key !== 'count'){
arr.push(this.monitorList[key])
}
} */
this._drawTimeoutId = setTimeout(()=>{
this.getPositionData()
}, 10*1000)
},
terminate(){
this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId);
},
openMapInfoWindow(sn, source){
EventBus.$emit('uiMap.monitor.openInfoWindow', `${sn}:${source}`)
},
downloadTpl(){
exportExcel('vehicle/downLoadImportSearchModel')
},
changeELocate(item){
this.monitorList[item.sn].eLocateType = item.eLocateType
//item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation'
}
},
created () {
if(window.AMap){
this.initMap();
}else{
remoteLoad(`${CONSTANT.AMAP_URL}`).then(()=>{
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(()=>{
this.initMap();
})
})
}
this.keyupSubmit();
EventBus.$on('uiMap.monitor.drawDone', this.drawDoneCb);
EventBus.$on('uiMap.monitor.changeELocate', this.changeELocate);
EventBus.$on('uiMap.monitor.terminate', this.terminate);
this.getTreeData()
},
beforeDestroy(){
EventBus.$emit('uiMap.monitor.destroy');
EventBus.$off('uiMap.monitor.drawDone', this.drawDoneCb);
this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId);
this.checkLoadedTimeoutId && window.clearTimeout(this.checkLoadedTimeoutId);
},
components: {
MapControll
}
}
this._drawTimeoutId = setTimeout(() => {
this.getPositionData();
}, 10 * 1000);
},
terminate() {
this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId);
},
openMapInfoWindow(sn, source) {
EventBus.$emit("uiMap.monitor.openInfoWindow", `${sn}:${source}`);
},
downloadTpl() {
exportExcel("vehicle/downLoadImportSearchModel");
},
changeELocate(item) {
this.monitorList[item.sn].eLocateType = item.eLocateType;
//item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation'
},
},
created() {
if (window.AMap) {
this.initMap();
} else {
remoteLoad(`${CONSTANT.AMAP_URL}`).then(() => {
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(
() => {
this.initMap();
}
);
});
}
this.keyupSubmit();
EventBus.$on("uiMap.monitor.drawDone", this.drawDoneCb);
EventBus.$on("uiMap.monitor.changeELocate", this.changeELocate);
EventBus.$on("uiMap.monitor.terminate", this.terminate);
this.getTreeData();
},
beforeDestroy() {
EventBus.$emit("uiMap.monitor.destroy");
EventBus.$off("uiMap.monitor.drawDone", this.drawDoneCb);
this._drawTimeoutId && window.clearTimeout(this._drawTimeoutId);
this.checkLoadedTimeoutId && window.clearTimeout(this.checkLoadedTimeoutId);
},
components: {
MapControll,
},
};
</script>
<style scoped>
/*样式写在 scss/monitor.scss*/
.none_tip{
align-self: center;
font-size: 12px;
color: red;
padding: 0 5px;
}
/*样式写在 scss/monitor.scss*/
.none_tip {
align-self: center;
font-size: 12px;
color: red;
padding: 0 5px;
}
</style>
<style>
.el-tree-node__content{
height: auto;
padding: 2px;
}
.custom-tree-node {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
font-size: 12px;
padding-right: 8px;
line-height: 26px;
}
.map-wrap .el-tree-node > .el-tree-node__children {
overflow: visible;
}
.search_auto{
font-size: 12px;
}
.search_auto_hide{
display: none;
}
.search_auto .el-autocomplete-suggestion li{
padding: 0;
}
.search_auto .el-autocomplete-suggestion li div{
line-height: 20px;
}
.el-autocomplete-suggestion li{
border-bottom: 1px solid #eee;
padding-bottom: 4px;
}
.el-autocomplete-suggestion li:last-child{
border-bottom: none;
}
.full-width .main-wrap.full-width{
left: 0;
width: 100%;
}
.el-tree-node__content {
height: auto;
padding: 2px;
}
.custom-tree-node {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
font-size: 12px;
padding-right: 8px;
line-height: 26px;
}
.map-wrap .el-tree-node > .el-tree-node__children {
overflow: visible;
}
.search_auto {
font-size: 12px;
}
.search_auto_hide {
display: none;
}
.search_auto .el-autocomplete-suggestion li {
padding: 0;
}
.search_auto .el-autocomplete-suggestion li div {
line-height: 20px;
}
.el-autocomplete-suggestion li {
border-bottom: 1px solid #eee;
padding-bottom: 4px;
}
.el-autocomplete-suggestion li:last-child {
border-bottom: none;
}
.full-width .main-wrap.full-width {
left: 0;
width: 100%;
}
</style>
\ 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!