From 14e02654e0545ee69456d64aef2f35c7c219d708 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 07 May 2021 11:26:49 +0800
Subject: [PATCH] 地图模式设备状态修改
---
src/views/system/cs.vue | 444 ++++++++++++++++++++++++++++++++++++------------------
1 files changed, 294 insertions(+), 150 deletions(-)
diff --git a/src/views/system/cs.vue b/src/views/system/cs.vue
index 84ef43c..15c292f 100644
--- a/src/views/system/cs.vue
+++ b/src/views/system/cs.vue
@@ -91,57 +91,51 @@
</el-dialog>
<!-- 右侧弹窗,业主的设备 -->
<el-dialog
- :title="onceData.tenantName"
+ :title="onceData.tenantName"
:visible.sync="dialogVisible"
- width="620px"
+ width="780px"
:before-close="handleClose"
modal-append-to-body="false"
append-to-body="true"
class="right-open"
>
- <el-divider content-position="left">点击查看详情</el-divider>
+ <el-divider></el-divider>
<div class="r-o-our">
- <!-- <avue-crud :data="datas" :option="options" @row-click="rowClicks">
- <template slot-scope="{ row }" slot="devicestate">
- <el-tag
- >{{
- row.devicestate == "0"
- ? "撤防"
- : row.devicestate == "1"
- ? "布防"
- : "无"
- }}
- </el-tag>
- </template>
- <template slot-scope="{ row }" slot="dxzt">
- <el-tag
- >{{ row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "在线" : "无" }}
- </el-tag>
- </template>
- </avue-crud> -->
- <el-table
+ <avue-crud
+ :option="options"
+ @on-load="onLoads"
:data="datas"
- style="width: 603px; height: auto"
- stripe="true"
+ :page="pages"
+ @search-change="searchChanges"
+ @search-reset="searchResets"
@row-click="rowClicks"
- class="r-o-o-table"
- border="true"
+ @current-change="currentChanges"
+ @size-change="sizeChanges"
>
- <el-table-column prop="deviceName" label="设备名称" width="300">
- </el-table-column>
- <el-table-column prop="deviceNumber" label="设备编号" width="120">
- </el-table-column>
- <el-table-column prop="stateSevicestate" label="布撤防状态" width="100">
- </el-table-column>
- <el-table-column prop="stateOnline" ref="stateOnline" label="设备状态" width="80"> </el-table-column>
- </el-table>
+ <template slot="states" slot-scope="scope">
+ <el-tag
+ :class="[
+ scope.row.states == '掉线'
+ ? 'diaoxianl'
+ : scope.row.states == '在线'
+ ? 'zaixianl'
+ : scope.row.states == '故障'
+ ? 'guzhagnl'
+ : scope.row.states == '预警'
+ ? 'baojinl'
+ : '',
+ ]"
+ >{{ scope.row.states }}</el-tag
+ >
+ </template>
+ </avue-crud>
</div>
</el-dialog>
</basic-container>
</template>
<script>
-import { getAll } from "@/api/client/client";
+import { getListliu, getListliuc } from "@/api/client/client";
import {
getList,
getDetail,
@@ -180,67 +174,87 @@
datasourceBox: false,
dialogVisible: false, //右侧弹窗
onceData: {}, //数据
- win: {}, //样式
- datas: "", //cc
- // options: {
- // addBtn: false,
- // height: 'auto',
- // menu: false,
- // header: false,
- // calcHeight: 80,
- // stripe:true,
- // title: "表格的标题",
- // titleSize: "h3",
- // titleStyle: {
- // color: "red",
- // },
- // page: false,
- // align: "center",
- // menuAlign: "center",
- // column: [
- // {
- // label: "设备名称",
- // prop: "deviceName",
- // width: 180,
- // },
- // {
- // label: "设备编号",
- // prop: "deviceNumber",
- // width: 150,
- // },
- // {
- // label: "布撤防状态",
- // prop: "devicestate",
- // type: "select",
- // slot: true,
- // width: 100,
- // rules: [
- // {
- // required: true,
- // message: "请选择布撤防状态",
- // trigger: "blur",
- // },
- // ],
- // dicData: [
- // {
- // label: "撤防",
- // value: "0",
- // },
- // {
- // label: "布防",
- // value: "1",
- // },
- // ],
- // },
- // {
- // label: "设备状态",
- // prop: "dxzt",
- // slot: true,
- // addDisplay: false,
- // editDisplay: false,
- // },
- // ],
- // },
+ datas: [], //cc
+ loadings: true, //等待
+ querys: {}, //搜索
+ isEdit:false,
+ pages: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ options: {
+ //表格数据
+ addBtn: false,
+ height: "auto",
+ indexLabel: "序号",
+ index: true,
+ card: true,
+ menu: false,
+ header: false,
+ searchShow: true,
+ searchMenuSpan: 8,
+ searchSpan: 8,
+ searchEnter: true,
+ calcHeight: 80,
+ stripe: true,
+ title: "表格的标题",
+ titleSize: "h3",
+ titleStyle: {
+ color: "red",
+ },
+ align: "center",
+ menuAlign: "center",
+ column: [
+ {
+ label: "设备名称",
+ width: 200,
+ prop: "deviceName",
+ searchPlaceholder: "设备名称/编号",
+ search: true,
+ sortable: false,
+ rules: [
+ {
+ required: true,
+ message: "请输入设备名称",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "设备编号",
+ prop: "deviceNumber",
+ width: 110,
+ },
+ {
+ label: "使用方",
+ prop: "pid",
+ width: 200,
+ search: true,
+ hide: true,
+ type: "select",
+ // dicUrl: "/api/blade-system/dept/trees",
+ dicData: [], //getUser中直接赋值
+ },
+ {
+ label: "使用方",
+ prop: "deptName",
+ width: 200,
+ },
+ {
+ label: "布撤防状态",
+ prop: "stateSevicestate",
+ width: 110,
+ },
+ {
+ label: "设备状态",
+ prop: "states",
+ width: 90,
+ slot: true,
+ // className: "cityClass1",
+ },
+ ],
+ },
page: {
pageSize: 10,
currentPage: 1,
@@ -364,30 +378,30 @@
labelWidth: "0",
className: "cityClass3",
},
- {
- label: "地址",
- prop: "address",
- span:10,
- // labelWidth: '60',
- hide: true,
- },
- {
- label: null,
- prop: "map",
- labelWidth: "0",
- searchSpan:0,
- maxlength:0,
- hide: true,
- span: 2,
- // display:false,
- component: "AvueMap"
- },
+ {
+ label: "地址",
+ prop: "address",
+ span: 10,
+ // labelWidth: '60',
+ hide: true,
+ },
+ {
+ label: null,
+ prop: "map",
+ labelWidth: "0",
+ searchSpan: 0,
+ maxlength: 0,
+ hide: true,
+ span: 2,
+ // display:false,
+ component: "AvueMap",
+ },
{
label: "纬度",
hide: true,
addDisplay: false,
prop: "wd",
- span:6
+ span: 6,
},
{
label: "经度",
@@ -395,7 +409,7 @@
hide: true,
addDisplay: false,
prop: "jd",
- span:5
+ span: 5,
},
{
label: "账号额度",
@@ -714,22 +728,34 @@
// form是表单或者表格绑定的数据集,v-model='form'
handler(val) {
if (val) {
- getDetail(this.form.id).then((res) => {
- this.form = res.data.data;
- })
- this.form.wd = val.latitude;
- this.form.jd = val.longitude;
+ if(that.isEdit){
+ getDetail(this.form.id).then((res) => {
+ this.form = res.data.data;
+ this.form.wd = val.latitude;
+ this.form.jd = val.longitude;
+ });
+ }
//地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
var address = val.formattedAddress.toString();
- if(address.search("县") != -1){
- this.form.address = address.substring(address.indexOf("县")+1,address.length);
+ if (address.search("县") != -1) {
+ this.form.address = address.substring(
+ address.indexOf("县") + 1,
+ address.length
+ );
}
- if(address.search("区") != -1){
- this.form.address = address.substring(address.indexOf("区")+1,address.length);
+ if (address.search("区") != -1) {
+ this.form.address = address.substring(
+ address.indexOf("区") + 1,
+ address.length
+ );
}
//写入新的省市区
that.form.province = val.addressComponent.province;
- that.form.city = val.addressComponent.city;
+ if (val.addressComponent.city == "") {
+ that.form.city = val.addressComponent.province;
+ } else {
+ that.form.city = val.addressComponent.city;
+ }
that.form.district = val.addressComponent.district;
}
},
@@ -879,6 +905,7 @@
},
beforeOpen(done, type) {
if (["edit"].includes(type)) {
+ that.isEdit=true;
getDetail(this.form.id).then((res) => {
if (this.form.type == "1") {
const data = res.data.data;
@@ -970,6 +997,10 @@
});
}
});
+ }
+
+ if (["edit"].includes(type)) {
+ that.isEdit=false;
}
done();
},
@@ -1094,7 +1125,7 @@
Object.assign(params, this.query)
).then((res) => {
// console.log(res);
- this.onceData = res.data.data.records[0];
+ // this.onceData = res.data.data.records[0];
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
@@ -1104,33 +1135,131 @@
},
rowClick(val) {
//行点击事件 //右侧弹窗事件
- // console.log(val);
this.onceData = val;
this.dialogVisible = true;
},
rowClicks(val) {
//弹窗行点击事件
// console.log(val);
- this.$router.push({ path: "/dataL/dataL", query: val });
+ // this.$router.push({ path: "/dataL/dataL", query: val });
+ let routeData = this.$router.resolve({
+ path: "/datalOnce",
+ query: val,
+ });
+ window.open(routeData.href, "_blank");
},
- changeDataOpen(det){
- if(det.length > 0){
- for(var key in det){
-
- det[key].stateOnline = det[key].onlineStatus == "0" ? "掉线" : det[key].onlineStatus == "1" ? "在线" : "无"
- det[key].stateSevicestate = det[key].devicestate == "0" ? "撤防" : det[key].devicestate == "1" ? "布防" : "无"
+ changeDataOpen(dat) {
+ //处理弹出框数据
+ console.log(dat);
+ if (dat.length > 0) {
+ for (var key in dat) {
+ let states;
+ if (dat[key].state != "") {
+ states = "故障";
+ } else {
+ if (dat[key].jtype != 1) {
+ if (dat[key].onlineStatus == 1) {
+ states = "在线";
+ } else {
+ states = "掉线";
+ }
+ } else {
+ states = "预警";
+ }
+ }
+ // console.log(states);
+ dat[key].states = states;
+ dat[key].stateSevicestate =
+ dat[key].devicestate == "0"
+ ? "撤防"
+ : dat[key].devicestate == "1"
+ ? "布防"
+ : "无";
}
}
- }
+ },
+ getMout(fid) {
+ getListliuc(fid).then((res) => {
+ // console.log(res.data.data);
+ this.getUser(res.data.data);
+ });
+ },
+ getUser(dat) {
+ //建立使用方搜索关键词
+ // console.log(dat);
+ if (dat.length > 0) {
+ this.users = [];
+ for (var key in dat) {
+ this.users.push({
+ label: dat[key].title,
+ value: dat[key].id,
+ });
+ }
+ }
+ // this.users.push([
+ // {
+
+ // }
+ // ])
+ this.options.column[2].dicData = this.users;
+ },
+ searchResets() {
+ //清空搜索框中的内容
+ this.querys = {};
+ //清空this.$route.query
+ this.$router.push({ querys: {} });
+ this.onLoads(this.pages);
+ },
+ searchChanges(params, done) {
+ //搜索
+ console.log(params, done, 222);
+ this.querys = params;
+ this.pages.currentPage = 1;
+ this.onLoads(this.pages, params);
+ done();
+ },
+ currentChanges(currentPage) {
+ //分页改变时候触发
+ this.pages.currentPage = currentPage;
+ },
+ sizeChanges(pageSize) {
+ this.pages.pageSize = pageSize;
+ },
+ onLoads(pages, params = {}) {
+ // this.$message.success("分页信息:" + JSON.stringify(pages));
+ // this.pages.total = 40;
+ // console.log(1)
+ this.loadings = true;
+ // console.log(2)
+ let values = {
+ ...params,
+ };
+ // console.log(3)
+ // getListliu(1, 10, {}, val.id).then((res) => {
+ var useId = this.onceData.deptId;
+ // console.log(4)
+ getListliu(pages.currentPage, pages.pageSize, values, useId).then(
+ (res) => {
+ // console.log(5)
+ // console.log(pages.currentPage, pages.pageSize, values, useId,332332)
+ // console.log(this.datas);
+ // getListliu('1', '10', {}, '1353972967828533249').then((res) => {
+ //拿到数据
+ this.datas = res.data.data.records;
+ // console.log(this.datas);
+ // console.log(pages.currentPage);
+ // console.log(pages.pageSize);
+ // console.log(this.onceData);
+ const data = res.data.data;
+ this.pages.total = data.total;
+ this.changeDataOpen(this.datas);
+ this.getMout(this.onceData.deptId);
+ this.loadings = false;
+ }
+ );
+ },
},
- mounted() {
- getAll().then((res) => {
- //测试数据
- this.datas = res.data.data;
- this.changeDataOpen(this.datas)
- console.log(this.datas);
- });
- },
+ mounted() {},
};
</script>
@@ -1257,10 +1386,10 @@
.el-dialog {
margin: 0 auto !important;
- height: 98%;
+ height: 100%;
overflow: hidden;
position: fixed;
- top: 1%;
+ top: 0;
right: 0;
.el-dialog__body {
position: absolute;
@@ -1301,9 +1430,24 @@
overflow: auto;
}
}
-.r-o-o-table{
- // border: rgb(69, 36, 146) 1px solid;
- position: relative;
- left: 8px;
+.diaoxianl {
+ border: 1px solid #fff;
+ color: #fff;
+ background-color: #cdcdcd;
+}
+.zaixianl {
+ border: 1px solid #fff;
+ color: #fff;
+ background-color: #32c1a2;
+}
+.guzhagnl {
+ border: 1px solid #fff;
+ color: #fff;
+ background-color: #f49966;
+}
+.baojinl {
+ border: 1px solid #fff;
+ color: #fff;
+ background-color: #f35b5b;
}
</style>
--
Gitblit v1.9.3