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/clientManagement/clientManagement.vue | 357 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 309 insertions(+), 48 deletions(-)
diff --git a/src/views/clientManagement/clientManagement.vue b/src/views/clientManagement/clientManagement.vue
index 3e8b720..bc94ea0 100644
--- a/src/views/clientManagement/clientManagement.vue
+++ b/src/views/clientManagement/clientManagement.vue
@@ -28,7 +28,9 @@
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
- @on-load="onLoad">
+ @on-load="onLoad"
+ @row-click="rowClick">
+
<template slot="menuLeft">
<el-button type="danger"
size="mini"
@@ -41,7 +43,6 @@
<Legend :datas="datalistLIU"></Legend>
</span>
</template>
-
<template slot-scope="{ row }" slot="devicestate">
<el-tag>{{
@@ -68,14 +69,14 @@
<template slot-scope="{ row }" slot="dxzt">
<el-tag>{{
- row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "在线" : "无"
+ row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "正常" :row.dxzt == "2" ? "报警":row.dxzt == "3" ? "故障":"无"
}}
</el-tag>
</template>
- <template slot-scope="{ row }" slot="jfzt">
- <i class="el-icon-check client-jf" v-if="row.type == 0"></i>
- <i class="el-icon-close client-qf" v-else-if="row.type == 1"></i>
+ <template slot-scope="{ row }" slot="type">
+ <i class="el-icon-check client-jf" v-if="row.type == '0' "></i>
+ <i class="el-icon-close client-qf" v-else-if="row.type == '1' "></i>
</template>
</avue-crud>
@@ -140,13 +141,15 @@
</el-form-item>
</el-col>
</el-form>
+
</el-dialog>
<el-table
:data="gridData"
border
- style="width: 100%">
+ style="width: 100%"
+ >
<el-table-column
fixed
prop="xb"
@@ -194,10 +197,12 @@
<script>
import {getList, remove, update, add, getclient, getDeptLazyTree, getAll, updates,getBaTree} from "@/api/client/client";
+ // import {getDeptTree} from "@/api/system/dept";
import {mapGetters} from "vuex";
import axios from "axios";
import Legend from '../../components/liu-legend/Legend'
import AvueMap from "avue-plugin-map";
+ import website from '@/config/website';
export default {
components:{
@@ -226,6 +231,7 @@
initFlag: true,
loading: true,
menuVisible:false,
+ isEdit:false,
page: {
pageSize: 10,
currentPage: 1,
@@ -264,9 +270,9 @@
option: {
height: 'auto',
indexLabel: '序号',
- calcHeight: 80,
- labelWidth: '100',
- dialogWidth: 950,
+ calcHeight: 54,
+ labelWidth: '125',
+ dialogWidth: 1150,
menuWidth: 150,
align:"center",
size: "mini",
@@ -289,6 +295,11 @@
searchPlaceholder: "设备名称/编号",
search: true,
sortable:true,
+ rules: [{
+ required: true,
+ message: "请输入设备名称",
+ trigger: "blur"
+ }],
},
{
label: "到期时间",
@@ -318,7 +329,7 @@
width: 130,
rules: [
{
- required: false,
+ required: true,
message: "请输入设备编号",
trigger: "click"
}
@@ -326,21 +337,49 @@
},
{
label: "使用方",
+ prop: "deptName",
+ display: false
+ },
+ {
+ label: "使用方",
prop: "deptId",
width: 200,
- type: "tree",
+ type: "cascader",
dicUrl: "/api/blade-system/dept/trees",
+ dicData: [],
+ checkStrictly:true,
+ hide:true,
props: {
label: "title"
},
rules: [
{
- required: false,
+ required: true,
message: "请选择使用方",
trigger: "click"
}
]
},
+ // {
+ // label: "使用方",
+ // prop: "deptId",
+ // width: 200,
+ // type: "cascader",
+ // dicUrl: "/api/blade-system/dept/trees",
+ // multiple: true,
+ // checkStrictly:true,
+ // dicData: [],
+ // props: {
+ // label: "title"
+ // },
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择使用方",
+ // trigger: "click"
+ // }
+ // ]
+ // },
{
label: "序列号",
prop: "serialNumber",
@@ -348,6 +387,11 @@
addDisplay: true,
editDisplay: true,
viewDisplay: true,
+ rules: [{
+ required: true,
+ message: "请输入序列号",
+ trigger: "blur"
+ }],
},
{
label: "通道号",
@@ -356,12 +400,36 @@
addDisplay: true,
editDisplay: true,
viewDisplay: true,
+ rules: [{
+ required: true,
+ message: "请输入通道号",
+ trigger: "blur"
+ }],
}, {
label: "缴费状态",
- prop: "jfzt",
+ prop: "type",
slot: true,
+ sortable:true,
addDisplay: false,
editDisplay: false,
+ }, {
+ label: "设备厂商",
+ prop: "manufacturers",
+ addDisplay: true,
+ editDisplay: true,
+ viewDisplay: true,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=manufacturers",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ search:true,
+ type:"select",
+ rules: [{
+ required: true,
+ message: "请选择设备厂商",
+ trigger: "blur"
+ }],
}, {
label: "布撤防状态",
prop: "devicestate",
@@ -388,6 +456,7 @@
label: "设备状态",
prop: "dxzt",
slot: true,
+ sortable:true,
addDisplay: false,
editDisplay: false,
},
@@ -395,7 +464,8 @@
label: "故障状态",
prop: "state",
addDisplay: false,
- editDisplay: false
+ editDisplay: false,
+ hide:true
},
{
label: "故障原因",
@@ -403,12 +473,12 @@
addDisplay: false,
editDisplay: false
},
-
{
label: "省份",
prop: "province",
search: true,
- searchSpan: 3,
+ searchSpan: 2,
+ labelWidth: '110',
searchLabelWidth: 45,
placeholder: "省份",
type: "select",
@@ -418,10 +488,9 @@
},
cascaderItem: ["city", "district"],
dicUrl: "/api/blade-system/region/select",
- span: 6,
+ span: 8,
className: "city1",
hide: true,
- // width: 10,
addDisplay: true,
editDisplay: true,
viewDisplay: true,
@@ -440,7 +509,7 @@
value: "code"
},
dicUrl: "/api/blade-system/region/select?code={{key}}",
- span: 3,
+ span: 2,
labelWidth: "0",
className: "city2",
hide: true,
@@ -462,7 +531,7 @@
value: "code"
},
dicUrl: "/api/blade-system/region/select?code={{key}}",
- span: 3,
+ span: 2,
labelWidth: "0",
className: "city3",
hide: true,
@@ -470,36 +539,80 @@
editDisplay: true,
viewDisplay: true,
}, {
- label: "街道",
+ label: "地址",
prop: "street",
- width: 200,
+ span:10,
hide: true,
- addDisplay: true,
- editDisplay: true,
- viewDisplay: true,
},
{
- label: "地址",
+ label: null,
prop: "map",
+ labelWidth: "0",
+ searchSpan:0,
+ maxlength:0,
hide: true,
- span: 24,
- component: "AvueMap",
+ span: 2,
+ // display:false,
+ component: "AvueMap"
},
{
label: "经度",
hide: true,
- addDisplay: false,
prop: "jd",
+ searchSpan:2,
+ width:"100",
+ labelWidth: "120",
+ formatter: (row,value,label,column)=>{
+ return value = value.substring(0,11);
+ },
+ span:7,
},
{
label: "纬度",
+ labelWidth: "45",
hide: true,
- addDisplay: false,
prop: "wd",
+ formatter: (row,value,label,column) => {
+ return value = value.substring(0,10);
+ },
+ span:5,
+ },
+
+ {
+ label: "主要负责人",
+ prop: "oneId",
+ type: "tree",
+ dicUrl: "/api/blade-system/dept/Batrees",
+ props: {
+ label: "title"
+ },
+ width: 72,
+ hide: true,
+ addDisplay: true,
+ editDisplay: true,
+ viewDisplay: true,
+ rules: [{
+ required: true,
+ message: "请选择主要负责人",
+ trigger: "blur"
+ }],
},
{
- label: "负责人",
- prop: "oneId",
+ label: "主要负责人电话",
+ prop: "onePhone",
+ width: 110,
+ hide: true,
+ addDisplay: true,
+ editDisplay: true,
+ viewDisplay: true,
+ rules: [{
+ required: true,
+ message: "请输入负责人电话",
+ trigger: "blur"
+ }],
+ }, {
+ label: "负责人1",
+ prop: "twoId",
type: "tree",
dicUrl: "/api/blade-system/dept/Batrees",
props: {
@@ -512,8 +625,30 @@
viewDisplay: true,
},
{
- label: "负责人电话",
- prop: "onePhone",
+ label: "负责人1电话",
+ prop: "twoPhone",
+ width: 110,
+ hide: true,
+ addDisplay: true,
+ editDisplay: true,
+ viewDisplay: true,
+ }, {
+ label: "负责人2",
+ prop: "threeId",
+ type: "tree",
+ dicUrl: "/api/blade-system/dept/Batrees",
+ props: {
+ label: "title"
+ },
+ width: 72,
+ hide: true,
+ addDisplay: true,
+ editDisplay: true,
+ viewDisplay: true,
+ },
+ {
+ label: "负责人2电话",
+ prop: "threePhone",
width: 110,
hide: true,
addDisplay: true,
@@ -548,7 +683,8 @@
addDisplay: true,
editDisplay: true,
viewDisplay: true,
- }, {
+ },
+ {
label: "心跳时间",
prop: "heartbeat",
type: "datetime",
@@ -559,7 +695,7 @@
addDisplay: true,
editDisplay: true,
viewDisplay: true,
- },
+ }
]
},
@@ -570,11 +706,37 @@
"form.map": {
// form是表单或者表格绑定的数据集,v-model='form'
handler(val) {
- debugger
if (val) {
+ var that = this;
+ //重新加载一次页面详情数据,解决新的省市区无法写入问题
+ //判断是新增还是修改
+ if(that.isEdit){
+ getclient(this.form.id).then(res => {
+ // that.province = res.data.data.province;
+ // that.city = res.data.data.city;
+ // that.district = res.data.data.district;
+ });
+ }
+
+ //经纬度替换
this.form.wd = val.latitude;
this.form.jd = val.longitude;
- this.form.street = val.formattedAddress;
+ //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
+ var address = val.formattedAddress.toString();
+ if(address.search("县") != -1){
+ this.form.street = address.substring(address.indexOf("县")+1,address.length);
+ }
+ if(address.search("区") != -1){
+ this.form.street = address.substring(address.indexOf("区")+1,address.length);
+ }
+ //写入新的省市区
+ that.form.province = val.addressComponent.province;
+ if(val.addressComponent.city==""){
+ that.form.city = val.addressComponent.province;
+ }else{
+ that.form.city = val.addressComponent.city;
+ }
+ that.form.district = val.addressComponent.district;
}
},
immediate: true,
@@ -582,14 +744,50 @@
"form.oneId":{
handler(val) {
var that = this;
- getBaTree(val).then(res => {
- if (res) {
- that.form.onePhone = res.data.data.records[0].phone;
- that.form.oneContacts = res.data.data.records[0].name;
- }
- });
+ if (val != null && val !=""){
+ getBaTree(val).then(res => {
+ if (res) {
+ that.form.onePhone = res.data.data.records[0].phone;
+ that.form.oneContacts = res.data.data.records[0].name;
+ }
+ });
+ }
},
- }
+ },
+ "form.twoId":{
+ handler(val) {
+ var that = this;
+ if (val != null && val !=""){
+ getBaTree(val).then(res => {
+ if (res) {
+ that.form.twoPhone = res.data.data.records[0].phone;
+ that.form.twoContacts = res.data.data.records[0].name;
+ }
+ });
+ }
+ },
+ },
+ "form.threeId":{
+ handler(val) {
+ var that = this;
+ if (val != null && val !=""){
+ getBaTree(val).then(res => {
+ if (res) {
+ that.form.threePhone = res.data.data.records[0].phone;
+ that.form.threeContacts = res.data.data.records[0].name;
+ }
+ });
+ }
+ },
+ },
+
+ //随意一个
+ // 'form.deviceName'() {
+ // if (this.initFlag) {
+ // this.initData();
+ // }
+ // }
+
},
computed: {
...mapGetters(["permission"]),
@@ -609,6 +807,11 @@
return ids.join(",");
}
},
+ mounted(){
+ // 租户模式默认加载管理组数据
+ // var that = this;
+ //that.tenantId = website.tenantId;
+ },
methods: {
generate(row) {
updates(row.expireTime, row.deviceNumber).then(() => {
@@ -623,11 +826,20 @@
window.console.log(error);
});
},
+
+ //初始化数据
+ // initData() {
+ // //部门tree数据
+ // getDeptTree().then(res => {
+ // const column = this.findObject(this.option.column, "deptId");
+ // column.dicData = res.data.data;
+ // });
+ // },
+
handleClick(row) {
this.form = row;
this.dialogTableVisible = true;
this.realjf = true;
-
},
nodeClick(data) {
this.treeDeptId = data.id;
@@ -635,6 +847,7 @@
this.onLoad(this.page);
},
rowSave(row, done, loading) {
+ row.deptId = row.deptId.join(",");
add(row).then(() => {
this.onLoad(this.page);
this.$message({
@@ -648,7 +861,11 @@
});
},
rowUpdate(row, index, done, loading) {
+ if(Array.isArray(row.deptId)){
+ row.deptId = row.deptId.join(",");
+ }
update(row).then(() => {
+ // this.initFlag = false;
this.onLoad(this.page);
this.$message({
type: "success",
@@ -683,6 +900,7 @@
this.onLoad(this.page);
},
searchChange(params, done) {
+ console.log(params,done)
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
@@ -721,8 +939,13 @@
if (["edit", "view"].includes(type)) {
getclient(this.form.id).then(res => {
this.form = res.data.data;
+ this.isEdit=true;
});
}
+ if (["add"].includes(type)) {
+ this.isEdit=false;
+ }
+ // this.initFlag = true;
done();
},
currentChange(currentPage) {
@@ -777,7 +1000,19 @@
} else if (data.records[i].heartbeat == "") {
data.records[i].dxzt = 0;
} else {
- data.records[i].dxzt = 1;
+ if(data.records[i].dtype==1){
+ data.records[i].dxzt = data.records[i].dtype;
+ }
+ if(data.records[i].dtype==2){
+ data.records[i].dxzt = 2;
+ }
+ if(data.records[i].dtype==3){
+ data.records[i].dxzt = 3;
+ }
+ if(data.records[i].dtype=="" || data.records[i].dtype==0){
+ data.records[i].dxzt = 1;
+ }
+
}
}
@@ -829,14 +1064,19 @@
});
}, handleStart(row) {
+
+ console.log(row,11111111111);
row = this.selectRow;
+ console.log(row,22222222222);
var arr = [];
+ console.log(this.$store.state.tags.tagList,3333333);
this.$store.state.tags.tagList.forEach(item => {
if (item.label != "视频") {
arr.push(item);
}
});
this.$store.state.tags.tagList = arr;
+ console.log(arr,444444444444);
this.$router.push({
path: `/real/video/`, query: row
});
@@ -871,6 +1111,10 @@
}
menu.style.left = event.clientX + 10 - (60) + 'px'
document.addEventListener('click', this.foo); // 给整个document新增监听鼠标事件,点击任何位置执行foo方法
+ },
+ rowClick(val){//行点击事件
+ // console.log(val);
+ this.$router.push({ path: "/dataL/dataL", query: val });
}
}
};
@@ -1017,4 +1261,21 @@
padding-right: 5px;
}
+
+
+</style>
+
+
+<style>
+ .avue-map input{
+ position: relative !important;
+ left: 30px !important;
+ }
+
+ .avue-map .el-input-group__append{
+ position: relative !important;
+ left: -51px !important;
+ }
+
+
</style>
--
Gitblit v1.9.3