Commit 88af1937 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 6f8d0b07 f15cabc1
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
const { siteTree } = res.data; const { siteTree } = res.data;
this.sitelist = siteTree; this.sitelist = siteTree;
let arr = []; let arr = [];
const treeFn = function (e) { const treeFn = function(e) {
e.forEach((element) => { e.forEach((element) => {
arr.push(element); arr.push(element);
if (element.children && element.children.length > 0) { if (element.children && element.children.length > 0) {
...@@ -145,6 +145,14 @@ export default { ...@@ -145,6 +145,14 @@ export default {
}, },
clickSite(obj) { clickSite(obj) {
session.setSession("siteid", obj.id); session.setSession("siteid", obj.id);
let path = this.$route.path;
let query = this.$route.query;
if (query.siteId) {
this.$router.push({
path,
query: { ...query, siteId: obj.id },
});
}
this.show = false; this.show = false;
if (location.href.search(/token/gi) >= 0) { if (location.href.search(/token/gi) >= 0) {
setTimeout(() => { setTimeout(() => {
......
...@@ -5,20 +5,26 @@ ...@@ -5,20 +5,26 @@
<el-card> <el-card>
<div slot="header"> <div slot="header">
<span><b class="cardTitle">站点分布</b></span> <span><b class="cardTitle">站点分布</b></span>
<el-button style="float: right" @click="switchStat" type="text">切换为地图模式</el-button> <el-button style="float: right" @click="switchStat" type="text"
>切换为地图模式</el-button
>
</div> </div>
<el-scrollbar style="height: 100%"> <el-scrollbar style="height: 100%">
<el-tree size="mini" <el-tree
ref="siteTree" size="mini"
:data="areaData" ref="siteTree"
id="el-tree" :data="areaData"
node-key="id" id="el-tree"
indent="4" node-key="id"
:props="treeProps" indent="4"
:load="loadNode" :props="treeProps"
highlight-current default-expand-all :expand-on-click-node="false" :load="loadNode"
:render-content="renderContent" highlight-current
@node-click="handleNodeClick"> default-expand-all
:expand-on-click-node="false"
:render-content="renderContent"
@node-click="handleNodeClick"
>
</el-tree> </el-tree>
</el-scrollbar> </el-scrollbar>
</el-card> </el-card>
...@@ -27,9 +33,22 @@ ...@@ -27,9 +33,22 @@
<el-col :span="18" :xs="12"> <el-col :span="18" :xs="12">
<el-card> <el-card>
<el-row> <el-row>
<LayoutTable ref="layoutTable" :data="tableData" notAdd notDel :config="tableConfig"> <LayoutTable
<el-button slot="table-head-left2" style="margin-left: 10px" type="primary" class="addclass" size="mini" @click="doExport" ref="layoutTable"
:disabled="isExport">导出 :data="tableData"
notAdd
notDel
:config="tableConfig"
>
<el-button
slot="table-head-left2"
style="margin-left: 10px"
type="primary"
class="addclass"
size="mini"
@click="doExport"
:disabled="isExport"
>导出
</el-button> </el-button>
</LayoutTable> </LayoutTable>
</el-row> </el-row>
...@@ -37,7 +56,7 @@ ...@@ -37,7 +56,7 @@
</el-col> </el-col>
</el-row> </el-row>
<dialog-show ref="dialogform" @ok="getData"/> <dialog-show ref="dialogform" @ok="getData" />
</div> </div>
</template> </template>
...@@ -49,44 +68,43 @@ import tree from "@/assets/mixins/tree"; ...@@ -49,44 +68,43 @@ import tree from "@/assets/mixins/tree";
export default { export default {
name: "Sitestat", name: "Sitestat",
components: {dialogShow}, components: { dialogShow },
mixins: [table, tree], mixins: [table, tree],
created() { created() {
this.$get("/sitestat/siteTree", {}).then(({data}) => { this.$get("/sitestat/siteTree", {}).then(({ data }) => {
// this.areaData = data.siteTree; // this.areaData = data.siteTree;
this.areaData = data.data; this.areaData = data.data;
console.log("areaData1",data.data) console.log("areaData1", data.data);
}); });
}, },
methods: { methods: {
/** 下载模板操作 */ /** 下载模板操作 */
downloadTemplate() { downloadTemplate() {
this.isExport = true; this.isExport = true;
this.$download("/sitestat/downloadTemplate", {}, {type: "excel"}) this.$download("/sitestat/downloadTemplate", {}, { type: "excel" })
.then(() => (this.isExport = false)) .then(() => (this.isExport = false))
.catch((error) => { .catch((error) => {
this.isExport = false; this.isExport = false;
this.$message.error(error.message); this.$message.error(error.message);
}); });
}, },
/** 导出Excel */ /** 导出Excel */
doExport() { doExport() {
this.isExport = true; this.isExport = true;
this.$download( this.$download(
"/sitestat/exportExcel", "/sitestat/exportExcel",
{ {
siteId: this.$route.query["siteId"], siteId: this.$route.query["siteId"],
siteName: this.$route.query["siteName"], siteName: this.$route.query["siteName"],
}, },
{type: "excel"} { type: "excel" }
) )
.then(() => (this.isExport = false)) .then(() => (this.isExport = false))
.catch((error) => { .catch((error) => {
this.isExport = false; this.isExport = false;
this.$message.error(error.message); this.$message.error(error.message);
}); });
}, },
/** 重写新增方法 */ /** 重写新增方法 */
...@@ -99,11 +117,13 @@ export default { ...@@ -99,11 +117,13 @@ export default {
}, },
/** 重写查看方法 */ /** 重写查看方法 */
toView(row) { toView(row) {
let path = this.$route.path;
sessionStorage.setItem("sitestat", path);
//console.log(row) //console.log(row)
//进入设备列表页面 //进入设备列表页面
this.$router.push({ this.$router.push({
path: "/device/list", path: "/device/list",
query: {sitestatId: row.id, siteId: row.siteId}, query: { sitestatId: row.id, siteId: row.siteId },
}); });
}, },
...@@ -126,12 +146,12 @@ export default { ...@@ -126,12 +146,12 @@ export default {
siteIdList: node.id.split(",").map((i) => parseInt(i)), siteIdList: node.id.split(",").map((i) => parseInt(i)),
}; };
} else { } else {
this.query = {siteId: node.id}; this.query = { siteId: node.id };
} }
this.getData(); this.getData();
} else if (node.type === "area") { } else if (node.type === "area") {
this.query = {areaCode: node.areaCode}; this.query = { areaCode: node.areaCode };
this.getData(); this.getData();
} }
...@@ -162,9 +182,9 @@ export default { ...@@ -162,9 +182,9 @@ export default {
width: 50, width: 50,
}, },
{label: "站点名称", align: "center", prop: "siteName"}, { label: "站点名称", align: "center", prop: "siteName" },
{label: "站点编号", align: "center", prop: "siteCode"}, { label: "站点编号", align: "center", prop: "siteCode" },
{ {
label: "设备总数", label: "设备总数",
...@@ -206,15 +226,15 @@ export default { ...@@ -206,15 +226,15 @@ export default {
width: 240, width: 240,
formatter: (row) => { formatter: (row) => {
return ( return (
<table-buttons <table-buttons
noAdd noAdd
noEdit noEdit
noDel noDel
row={row} row={row}
onEdit={this.toEdit} onEdit={this.toEdit}
onView={this.toView} onView={this.toView}
onDel={this.toDel} onDel={this.toDel}
/> />
); );
}, },
}, },
...@@ -249,12 +269,18 @@ export default { ...@@ -249,12 +269,18 @@ export default {
} }
.mytree ::v-deep { .mytree ::v-deep {
.el-tree--highlight-current ::v-deep .el-tree-node.is-checked > .el-tree-node__content { .el-tree--highlight-current
::v-deep
.el-tree-node.is-checked
> .el-tree-node__content {
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
color: rgb(64, 158, 255); color: rgb(64, 158, 255);
} }
.el-tree--highlight-current ::v-deep .el-tree-node.is-current > .el-tree-node__content { .el-tree--highlight-current
::v-deep
.el-tree-node.is-current
> .el-tree-node__content {
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
color: rgb(64, 158, 255); color: rgb(64, 158, 255);
} }
......
...@@ -146,7 +146,10 @@ ...@@ -146,7 +146,10 @@
justify="space-between" justify="space-between"
> >
<!-- <img src="../../assets/images/排队机.png" alt="" /> --> <!-- <img src="../../assets/images/排队机.png" alt="" /> -->
<img :src="require(`../../assets/images/${label}.png`)" /> <img
v-if="label"
:src="require(`../../assets/images/${label}.png`)"
/>
<!-- <i style="font-size: 20px" class="el-icon-location-information"></i> --> <!-- <i style="font-size: 20px" class="el-icon-location-information"></i> -->
<span style="font-size: 12px">{{ label }}</span> <span style="font-size: 12px">{{ label }}</span>
<el-switch <el-switch
...@@ -223,6 +226,8 @@ export default { ...@@ -223,6 +226,8 @@ export default {
this.$refs.drawerform.add(row); this.$refs.drawerform.add(row);
}, },
switchList() { switchList() {
let path = this.$route.path;
sessionStorage.setItem("sitestat", path);
//进入设备列表页面 //进入设备列表页面
this.$router.push({ this.$router.push({
path: "/device/list", path: "/device/list",
...@@ -462,4 +467,4 @@ export default { ...@@ -462,4 +467,4 @@ export default {
font-size: 18px; font-size: 18px;
color: deepskyblue; color: deepskyblue;
} }
</style> </style>
\ No newline at end of file
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
> >
</el-tree> </el-tree>
</el-scrollbar> </el-scrollbar>
</el-card> </el-card>
</el-row> </el-row>
<el-row :gutter="20" slot="rightTop" class="mytree"> <el-row :gutter="20" slot="rightTop" class="mytree">
<el-card> <el-card>
...@@ -37,23 +37,29 @@ ...@@ -37,23 +37,29 @@
<div class="listbody"> <div class="listbody">
<div class="listtop"> <div class="listtop">
<div class="item sbzs"> <div class="item sbzs">
<div>{{listNum.all}}</div> <div>{{ listNum.all }}</div>
<div class="wz">设备总数(台)</div> <div class="wz">设备总数(台)</div>
</div> </div>
<div class="item zx"> <div class="item zx">
<div>{{listNum.online}}</div> <div>{{ listNum.online }}</div>
<div class="wz">在线(台)</div> <div class="wz">在线(台)</div>
</div> </div>
<div class="item lx"> <div class="item lx">
<div>{{listNum.unline}}</div> <div>{{ listNum.unline }}</div>
<div class="wz">离线(台)</div> <div class="wz">离线(台)</div>
</div> </div>
</div> </div>
<div class="maplist"> <div class="maplist">
<div v-for="(item,index) in rightShowList" :key="index" class="deployitem"> <div
v-for="(item, index) in rightShowList"
:key="index"
class="deployitem"
>
<div class="top"> <div class="top">
<div class="title">{{ item.label }}</div> <div class="title">{{ item.label }}</div>
<div class="ckxq pointer" @click="getDetailData(item)">查看详情</div> <div class="ckxq pointer" @click="getDetailData(item)">
查看详情
</div>
</div> </div>
<div class="are">{{ item.detailAddress }}</div> <div class="are">{{ item.detailAddress }}</div>
<div class="data"> <div class="data">
...@@ -67,10 +73,10 @@ ...@@ -67,10 +73,10 @@
离线:<span>{{ item.offlineTotal }}</span> 离线:<span>{{ item.offlineTotal }}</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</el-card> </el-card>
</el-row> </el-row>
</Map> </Map>
<dialog-show ref="dialogform" @ok="getData" /> <dialog-show ref="dialogform" @ok="getData" />
...@@ -89,44 +95,44 @@ export default { ...@@ -89,44 +95,44 @@ export default {
mounted() { mounted() {
this.pageInfo.list = "/sitestat/list"; this.pageInfo.list = "/sitestat/list";
}, },
watch:{ watch: {
originData(newval){ originData(newval) {
let val = JSON.parse(JSON.stringify(newval)) let val = JSON.parse(JSON.stringify(newval));
let arr = this.flatten(val).filter((v) => { let arr = this.flatten(val).filter((v) => {
return v.type == "site"; return v.type == "site";
}); });
this.rightShowList = arr this.rightShowList = arr;
let all = 0; let all = 0;
let online = 0; let online = 0;
let unline = 0; let unline = 0;
arr.forEach(v=>{ arr.forEach((v) => {
all += parseInt(v.deviceTotal) all += parseInt(v.deviceTotal);
online += parseInt(v.onlineTotal) online += parseInt(v.onlineTotal);
unline += parseInt(v.offlineTotal) unline += parseInt(v.offlineTotal);
}) });
this.listNum.all = all this.listNum.all = all;
this.listNum.online = online this.listNum.online = online;
this.listNum.unline = unline this.listNum.unline = unline;
} },
}, },
created() { created() {
this.pageInfo.list = "/sitestat/list"; this.pageInfo.list = "/sitestat/list";
// this.$get("/sitestat/maplist", {}).then(({ data }) => { // this.$get("/sitestat/maplist", {}).then(({ data }) => {
// this.originData = data; // this.originData = data;
// this.$refs.map.refresh(this.originData); // this.$refs.map.refresh(this.originData);
// }); // });
this.$get("/sitestat/siteTree", {}).then(({ data }) => { this.$get("/sitestat/siteTree", {}).then(({ data }) => {
let arr = [] let arr = [];
data.data.forEach(i=>{ data.data.forEach((i) => {
arr.push({ arr.push({
...i, ...i,
lat:i.latitude, lat: i.latitude,
lng:i.longitude, lng: i.longitude,
level:1 level: 1,
}) });
}) });
this.originData = arr this.originData = arr;
this.areaData = JSON.parse(JSON.stringify(arr)); this.areaData = JSON.parse(JSON.stringify(arr));
this.$refs.map.refresh(this.originData); this.$refs.map.refresh(this.originData);
}); });
...@@ -173,7 +179,7 @@ export default { ...@@ -173,7 +179,7 @@ export default {
this.$router.push({ this.$router.push({
path: "/sitestat/mapDetail", path: "/sitestat/mapDetail",
// query: info, // query: info,
query: { sitestatId: info.id, siteId: info.siteId }, query: { sitestatId: info.id, siteId: info.siteId || info.id },
}); });
}, },
...@@ -211,37 +217,39 @@ export default { ...@@ -211,37 +217,39 @@ export default {
obj.lat = node.latitude; obj.lat = node.latitude;
this.$refs.map.relocate(obj); this.$refs.map.relocate(obj);
} }
if(node.level==1){ if (node.level == 1) {
let arr = [] let arr = [];
arr.push(JSON.parse(JSON.stringify(node))) arr.push(JSON.parse(JSON.stringify(node)));
this.originData = arr this.originData = arr;
this.$refs.map.refresh(this.originData); this.$refs.map.refresh(this.originData);
this.$refs.map.zoom = 6 this.$refs.map.zoom = 6;
}else{ } else {
let children = JSON.parse(JSON.stringify(node.children)) let children = JSON.parse(JSON.stringify(node.children));
children = this.$refs.map.flatten(children) children = this.$refs.map.flatten(children);
children.unshift(JSON.parse(JSON.stringify(node))) children.unshift(JSON.parse(JSON.stringify(node)));
children = children.filter((v) => { children = children.filter((v) => {
return v.type == "site"; return v.type == "site";
}); });
children = children.map(i=> {return { children = children.map((i) => {
...i, return {
lat:i.latitude, ...i,
lng:i.longitude, lat: i.latitude,
}}) lng: i.longitude,
this.originData = children };
});
this.originData = children;
this.$refs.map.refresh(this.originData); this.$refs.map.refresh(this.originData);
} }
}, },
}, },
data() { data() {
return { return {
listNum:{ listNum: {
all:0, all: 0,
online:0, online: 0,
unline:0 unline: 0,
}, },
rightShowList:[], rightShowList: [],
isExport: false, isExport: false,
originData: [], originData: [],
config: { config: {
...@@ -300,69 +308,69 @@ export default { ...@@ -300,69 +308,69 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.deployitem { .deployitem {
padding: 10px 0; padding: 10px 0;
color: #223333; color: #223333;
border-bottom: 1px solid gainsboro; border-bottom: 1px solid gainsboro;
.top{ .top {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
}
.ckxq {
font-size: 10px;
margin-right: 20px;
margin-top: 8px;
color: #1890ff;
flex-shrink: 0;
}
.data {
display: flex;
font-size: 12px;
font-weight: 500;
color: #999999;
margin: 4px 0;
.dataitem {
margin-right: 16px;
} }
.ckxq { .sbzs > span {
font-size: 10px; color: #223333;
margin-right: 20px;
margin-top: 8px;
color: #1890ff;
flex-shrink: 0;
} }
.data { .zx > span {
display: flex; color: #0064e9;
font-size: 12px; }
font-weight: 500; .zx {
color: #999999; position: relative;
margin: 4px 0;
.dataitem {
margin-right: 16px;
}
.sbzs > span {
color: #223333;
}
.zx > span {
color: #0064e9;
}
.zx {
position: relative;
}
.zx::before {
content: "";
position: absolute;
width: 4px;
height: 4px;
background: #0064e9;
border-radius: 50%;
top: 6px;
left: -6px;
}
.lx > span {
color: #fa4d4c;
}
} }
.title { .zx::before {
font-size: 14px; content: "";
font-weight: 600; position: absolute;
padding: 4px 0; width: 4px;
height: 4px;
background: #0064e9;
border-radius: 50%;
top: 6px;
left: -6px;
} }
.are { .lx > span {
font-size: 12px; color: #fa4d4c;
} }
} }
.title {
font-size: 14px;
font-weight: 600;
padding: 4px 0;
}
.are {
font-size: 12px;
}
}
.listbody::-webkit-scrollbar { .listbody::-webkit-scrollbar {
width: 0; width: 0;
} }
.listbody{ .listbody {
max-height: 700px; max-height: 700px;
overflow: auto; overflow: auto;
.listtop{ .listtop {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 20px 0 10px; padding: 20px 0 10px;
...@@ -376,7 +384,7 @@ export default { ...@@ -376,7 +384,7 @@ export default {
flex-direction: column; flex-direction: column;
color: #fff; color: #fff;
padding-bottom: 6px; padding-bottom: 6px;
font-size: 8px; font-size: 12px;
.wz { .wz {
margin-left: 14px; margin-left: 14px;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment