From 8aa3edd56c279100c9053576f3e90fa55459fe77 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Mon, 16 Jan 2023 16:15:55 +0800
Subject: [PATCH] 修改

---
 src/views/clientManagement/clientManagement.vue | 1781 ++++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 1,202 insertions(+), 579 deletions(-)

diff --git a/src/views/clientManagement/clientManagement.vue b/src/views/clientManagement/clientManagement.vue
index fba887a..b80cc8f 100644
--- a/src/views/clientManagement/clientManagement.vue
+++ b/src/views/clientManagement/clientManagement.vue
@@ -18,6 +18,9 @@
                    @row-update="rowUpdate"
                    @row-save="rowSave"
                    :row-style="rowStyle"
+                   @contextmenu.prevent.native=""
+                   @row-contextmenu="rightClick"
+                   row-class-name="tabFontSize"
                    :before-open="beforeOpen"
                    @search-change="searchChange"
                    @search-reset="searchReset"
@@ -25,58 +28,82 @@
                    @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="small"
+                       size="mini"
                        icon="el-icon-delete"
                        plain
                        v-if="permission.clientManagement_delete"
                        @click="handleDelete">删 除
             </el-button>
+            <span><!--图例 components-->
+              <Legend :datas="datalistLIU"></Legend>
+            </span>
           </template>
-
 
           <template slot-scope="{ row }" slot="devicestate">
             <el-tag>{{
-                row.devicestate == "0" ? "撤防" : row.devicestate == "1" ? "布防" : "无"
+              row.devicestate == "0" ? "撤防" : row.devicestate == "1" ? "布防" : "无"
               }}
             </el-tag>
           </template>
+<!--          <template slot-scope="{ type, size, row }" slot="menu">-->
+<!--            <el-button-->
+<!--              icon="el-icon-video-camera-solid"-->
+<!--              :size="size"-->
+<!--              :type="type"-->
+<!--              @click.stop="handleStart(row)"-->
+<!--            >视频-->
+<!--            </el-button>-->
+<!--            <el-button-->
+<!--              icon="el-icon-location-outline"-->
+<!--              :size="size"-->
+<!--              :type="type"-->
+<!--              @click.stop="handleMap(row)"-->
+<!--            >定位-->
+<!--            </el-button>-->
+<!--          </template>-->
+
+          <template class="tdtype" slot-scope="{ row }" slot="dxzt">
+            <el-tag class="dtype">
+              {{
+              row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "正常" :row.dxzt == "2" ? "预警":row.dxzt == "3" ? "故障":"无"
+              }}
+              <i class="dx" v-if="row.dxzt == '0' "></i>
+              <i class="zc" v-if="row.dxzt == '1' "></i>
+              <i class="yj" v-if="row.dxzt == '2' "></i>
+              <i class="gz" v-if="row.dxzt == '3' "></i>
+            </el-tag>
+
+          </template>
+
+          <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>
+
           <template slot-scope="{ type, size, row }" slot="menu">
             <el-button
-              icon="el-icon-video-camera-solid"
+              v-if="row.dtype == 2"
+              icon="el-icon-s-order"
               :size="size"
               :type="type"
-              @click.stop="handleStart(row)"
-            >视频
+              @click.stop="updateDtype(row)"
+            >办结
             </el-button>
-            <el-button
-              icon="el-icon-location-outline"
-              :size="size"
-              :type="type"
-              @click.stop="handleMap(row)"
-            >定位
-            </el-button>
-          </template>
-
-          <template slot-scope="{ row }" slot="dxzt">
-            <el-tag>{{
-                row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "在线" : "无"
-              }}
-            </el-tag>
-          </template>
-
-          <template slot-scope="{ row }" slot="expireTime">
-            <span>
-              {{
-                row.expireTime == "" ? row.expireTime : row.expireTime == null ? row.expireTime : row.expireTime.split(" ")[0]
-              }}
-            </span>
-            <i class="el-icon-warning" v-if="row.type == 1"></i>
           </template>
 
         </avue-crud>
+
+        <div v-show="menuVisible">
+          <ul id="menu" class="menu">
+            <li class="menu_item" @click.stop="handleStart">视频</li>
+            <li class="menu_item" @click.stop="handleMap">定位</li>
+          </ul>
+        </div>
 
 
         <el-drawer
@@ -132,13 +159,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"
@@ -148,7 +177,7 @@
         <el-table-column
           prop="deviceName"
           label="设备名称"
-          width="150">
+          width="180">
         </el-table-column>
         <el-table-column
           prop="deviceNumber"
@@ -156,7 +185,7 @@
           width="150">
         </el-table-column>
         <el-table-column
-          prop="street"
+          prop="ownership"
           label="所属单位"
           width="160">
         </el-table-column>
@@ -185,568 +214,1162 @@
 </template>
 
 <script>
-import {getList, remove, update, add, getclient, getDeptLazyTree, getAll,updates} from "@/api/client/client";
-import {mapGetters} from "vuex";
-import axios from "axios";
+  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 {
-  created() {
-    this.payWin();
-  },
-  data() {
-    return {
-      form: {},
-      query: {},
-      showMap: false,
-      initFlag: true,
-      loading: true,
-      page: {
-        pageSize: 10,
-        currentPage: 1,
-        total: 0
-      },
-      dialogTableVisible: false,
-      realjf: false,
-      gridData: null,
-      selectionList: [],
-      treeDeptId: '',
-      treeData: [],
-      treeOption: {
-        nodeKey: 'id',
-        lazy: true,
-        treeLoad: function (node, resolve) {
-          const parentId = (node.level === 0) ? 0 : node.data.id;
-          getDeptLazyTree(parentId).then(res => {
-            resolve(res.data.data.map(item => {
-              return {
-                ...item,
-                leaf: !item.hasChildren
-              }
-            }))
-          });
-        },
-        addBtn: false,
-        menu: false,
-        size: 'small',
-        props: {
-          labelText: '标题',
-          label: 'title',
-          value: 'value',
-          children: 'children'
-        }
-      },
-      option: {
-        height: 'auto',
-        indexLabel: '序号',
-        calcHeight: 80,
-        labelWidth: '100',
-        dialogWidth: 950,
-        menuWidth: 250,
-        size: "mini",
-        tip: false,
-        searchShow: true,
-        searchMenuSpan: 4,
-        searchSpan: 4,
-        border: true,
-        index: true,
-        viewBtn: true,
-        selection: false,
-        dialogClickModal: false,
-        column: [
-          {
-            label: "设备名称",
-            width: 200,
-            prop: "deviceName",
-            searchPlaceholder: "设备名称/编号",
-            search: true,
-          },
-          {
-            label: "上级菜单",
-            prop: "pid",
-            type: "tree",
-            dicUrl: "/api/blade-jfpts/catalogs/catalogs/tree",
-            hide: true,
-            props: {
-              label: "title"
-            },
-            rules: [
-              {
-                required: false,
-                message: "请选择上级菜单",
-                trigger: "click"
-              }
-            ]
-          },
-          {
-            label: "到期时间",
-            prop: "releaseTimeRange",
-            type: "datetime",
-            format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd",
-            searchRange: true,
-            searchSpan: 6,
-            hide: true,
-            addDisplay: false,
-            editDisplay: false,
-            viewDisplay: false,
-            search: true,
-            rules: [
-              {
-                required: true,
-                message: "请输入时间",
-                trigger: "blur"
-              }
-            ]
-          }
-          ,
-          {
-            label: "设备编号",
-            prop: "deviceNumber",
-            width: 130,
-            editDisabled: true,
-            rules: [
-              {
-                required: false,
-                message: "请输入设备编号",
-                trigger: "click"
-              }
-            ]
-          },
-          {
-            label: "序列号",
-            prop: "serialNumber",
-            hide: true,
-            addDisplay: true,
-            editDisplay: true,
-            viewDisplay: true,
-          },
-          {
-            label: "通道号",
-            prop: "channelNumber",
-            hide: true,
-            addDisplay: true,
-            editDisplay: true,
-            viewDisplay: true,
-          }, {
-            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,
-          },
-          {
-            label: "设备类型",
-            prop: "deviceType",
-            width: 160,
-            search: true,
-            searchSpan: 3,
-            searchLabelWidth: 80,
-            searchPlaceholder: "请选择",
-            type: "select",
-            props: {
-              label: "dictValue",
-              value: "dictValue"
-            },
-            dicUrl: "/api/blade-system/dict-biz/child-list?parentId=1357568691367661569",
-          },
-          {
-            label: "省份",
-            prop: "province",
-            search: true,
-            searchSpan: 3,
-            searchLabelWidth: 45,
-            placeholder: "省份",
-            type: "select",
-            props: {
-              label: "name",
-              value: "code"
-            },
-            cascaderItem: ["city", "district"],
-            dicUrl: "/api/blade-system/region/select",
-            span: 6,
-            className: "cityClass1"
-          },
-          {
-            label: "地市",
-            prop: "city",
-            type: "select",
-            searchPlaceholder: "地市",
-            placeholder: "地市",
-            searchLabelWidth: 1,
-            searchSpan: 2,
-            search: true,
-            props: {
-              label: "name",
-              value: "code"
-            },
-            dicUrl: "/api/blade-system/region/select?code={{key}}",
-            span: 3,
-            labelWidth: "0",
-            className: "cityClass2"
-          },
-          {
-            label: "区县",
-            searchSpan: 2,
-            searchLabelWidth: 1,
-            searchPlaceholder: "区县",
-            placeholder: "区县",
-            search: true,
-            prop: "district",
-            type: "select",
-            props: {
-              label: "name",
-              value: "code"
-            },
-            dicUrl: "/api/blade-system/region/select?code={{key}}",
-            span: 3,
-            labelWidth: "0",
-            className: "cityClass3"
-          },
-          {
-            label: "权属",
-            prop: "ownership",
-            width: 150
-          }, {
-            label: "街道",
-            prop: "street",
-            width: 200
-          }, {
-            label: "到期时间",
-            prop: "expireTime",
-            type: "datetime",
-            slot: true,
-            format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd HH:mm:ss",
-            width: 150
-          }, {
-            label: "缴费信息",
-            prop: "pay",
-          }, {
-            label: "安装时间",
-            prop: "stime",
-            type: "datetime",
-            format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd HH:mm:ss",
-            width: 130
-          }, {
-            label: "最后上传时间",
-            prop: "heartbeat",
-            type: "datetime",
-            format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd HH:mm:ss",
-            width: 130
-          },
-
-        ]
-      },
-      data: []
-    };
-  },
-  computed: {
-    ...mapGetters(["permission"]),
-    permissionList() {
+  export default {
+    components:{
+      Legend,
+    },
+    created() {
+      //this.payWin();
+    },
+    data() {
       return {
-        addBtn: this.vaildData(this.permission.clientManagement_add, false),
-        viewBtn: this.vaildData(this.permission.clientManagement_view, false),
-        delBtn: this.vaildData(this.permission.clientManagement_delete, false),
-        editBtn: this.vaildData(this.permission.clientManagement_edit, false)
-      };
-    },
-    ids() {
-      let ids = [];
-      this.selectionList.forEach(ele => {
-        ids.push(ele.id);
-      });
-      return ids.join(",");
-    }
-  },
-  methods: {
-    generate(row) {
-      updates(row.expireTime,row.deviceNumber).then(() => {
-        this.dialogTableVisible = false;
-        this.realjf = false;
-        this.onLoad(this.page);
-        this.$message({
-          type: "success",
-          message: "缴费成功!"
-        });
-      }, error => {
-        window.console.log(error);
-      });
-    },
-    handleClick(row) {
-      this.form=row;
-      this.dialogTableVisible = true;
-      this.realjf = true;
-
-    },
-    nodeClick(data) {
-      this.treeDeptId = data.id;
-      this.page.currentPage = 1;
-      this.onLoad(this.page);
-    },
-    rowSave(row, done, loading) {
-      add(row).then(() => {
-        this.onLoad(this.page);
-        this.$message({
-          type: "success",
-          message: "操作成功!"
-        });
-        done();
-      }, error => {
-        window.console.log(error);
-        loading();
-      });
-    },
-    rowUpdate(row, index, done, loading) {
-      update(row).then(() => {
-        this.onLoad(this.page);
-        this.$message({
-          type: "success",
-          message: "操作成功!"
-        });
-        done();
-      }, error => {
-        window.console.log(error);
-        loading();
-      });
-    },
-    rowDel(row) {
-      this.$confirm("确定将选择数据删除?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      })
-        .then(() => {
-          return remove(row.id);
-        })
-        .then(() => {
-          this.onLoad(this.page);
-          this.$message({
-            type: "success",
-            message: "操作成功!"
-          });
-        });
-    },
-    searchReset() {
-      this.treeDeptId = null;
-      this.query = {};
-      this.onLoad(this.page);
-    },
-    searchChange(params, done) {
-      this.query = params;
-      this.page.currentPage = 1;
-      this.onLoad(this.page, params);
-      done();
-    },
-    selectionChange(list) {
-      this.selectionList = list;
-    },
-    selectionClear() {
-      this.selectionList = [];
-      this.$refs.crud.toggleSelection();
-    },
-    handleDelete() {
-      if (this.selectionList.length === 0) {
-        this.$message.warning("请选择至少一条数据");
-        return;
-      }
-      this.$confirm("确定将选择数据删除?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      })
-        .then(() => {
-          return remove(this.ids);
-        })
-        .then(() => {
-          this.onLoad(this.page);
-          this.$message({
-            type: "success",
-            message: "操作成功!"
-          });
-          this.$refs.crud.toggleSelection();
-        });
-    },
-    beforeOpen(done, type) {
-      if (["edit", "view"].includes(type)) {
-        getclient(this.form.id).then(res => {
-          this.form = res.data.data;
-        });
-      }
-      done();
-    },
-    currentChange(currentPage) {
-      this.page.currentPage = currentPage;
-    },
-    sizeChange(pageSize) {
-      this.page.pageSize = pageSize;
-    },
-    refreshChange() {
-      this.onLoad(this.page, this.query);
-    },
-    onLoad(page, params = {}) {
-      const {releaseTimeRange} = this.query;
-      let values = {
-        ...params,
-      };
-      if (releaseTimeRange) {
-        values = {
-          ...params,
-          beginTime: releaseTimeRange[0],
-          endTime: releaseTimeRange[1],
-          ...this.query
-        };
-        values.releaseTimeRange = null;
-      } else {
-        values = {
-          ...params,
-          ...this.query
-        };
-      }
-      this.loading = true;
-      getList(page.currentPage, page.pageSize, values, this.treeDeptId).then(res => {
-        const data = res.data.data;
-        this.page.total = data.total;
-
-        var Dqdate = new Date().getTime();
-
-        for (var i = 0; i < data.records.length; i++) {
-          var date = new Date(data.records[i].heartbeat).getTime();
-          if ((Dqdate - date) >= (60 * 60 * 24 * 1000)) {
-            data.records[i].dxzt = 0;
-          } else if (data.records[i].heartbeat == "") {
-            data.records[i].dxzt = 0;
-          } else {
-            data.records[i].dxzt = 1;
+        dataLIU:{
+          color:"#DFDFDF"
+        },
+        //legend-liu数据
+        datalistLIU:[
+                {
+                    color: "#DFDFDF",
+                    text: '掉线'
+                },
+                {
+                    color: "#29C093",
+                    text: '正常'
+                },
+                {
+                    color: "#F34A4A",
+                    text: '预警'
+                },
+                {
+                    color: "#F48F57",
+                    text: '故障'
+                }
+        ],
+        form: {},
+        query: {},
+        showMap: false,
+        selectRow:null,
+        initFlag: true,
+        loading: true,
+        menuVisible:false,
+        isEdit:false,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        dialogTableVisible: false,
+        realjf: false,
+        gridData: null,
+        selectionList: [],
+        treeDeptId: '',
+        treeData: [],
+        treeOption: {
+          nodeKey: 'id',
+          lazy: true,
+          treeLoad: function (node, resolve) {
+            const parentId = (node.level === 0) ? 0 : node.data.id;
+            getDeptLazyTree(parentId).then(res => {
+              resolve(res.data.data.map(item => {
+                return {
+                  ...item,
+                  leaf: !item.hasChildren
+                }
+              }))
+            });
+          },
+          addBtn: false,
+          menu: false,
+          size: 'small',
+          props: {
+            labelText: '标题',
+            label: 'title',
+            value: 'value',
+            children: 'children'
           }
-        }
+        },
+        option: {
+          height: 'auto',
+          indexLabel: '序号',
+          calcHeight: 54,
+          labelWidth: '125',
+          dialogWidth: 1150,
+          menuWidth: 200,
+          align:"center",
+          size: "mini",
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 4,
+          searchSpan: 4,
+          border: false,
+          stripe:true,
+          index: true,
+          viewBtn: true,
+          selection: true,
+          dialogClickModal: false,
+          indexFixed:false,
+          column: [
+            {
+              label: "设备名称",
+              width: 200,
+              prop: "deviceName",
+              searchPlaceholder: "设备名称/编号",
+              search: true,
+              sortable:true,
+              rules: [{
+                required: true,
+                message: "请输入设备名称",
+                trigger: "blur"
+              }],
+            },
+            {
+              label: "到期时间",
+              prop: "releaseTimeRange",
+              type: "datetime",
+              format: "yyyy-MM-dd",
+              valueFormat: "yyyy-MM-dd",
+              searchRange: true,
+              searchSpan: 6,
+              hide: true,
+              addDisplay: false,
+              editDisplay: false,
+              viewDisplay: false,
+              search: true,
+              rules: [
+                {
+                  required: true,
+                  message: "请输入时间",
+                  trigger: "blur"
+                }
+              ]
+            }
+            ,
+            {
+              label: "设备编号",
+              prop: "deviceNumber",
+              width: 130,
+              rules: [
+                {
+                  required: true,
+                  message: "请输入设备编号",
+                  trigger: "click"
+                }
+              ]
+            },
+            {
+              label: "设备类型",
+              prop: "deviceType",
+              width: 150,
+              rules: [{
+                required: true,
+                message: "请输入设备类型",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "使用方",
+              prop: "deptName",
+              display: false
+            },
+            {
+              label: "使用方",
+              prop: "deptId",
+              width: 200,
+              type: "cascader",
+              dicUrl: "/api/blade-system/dept/trees",
+              dicData: [],
+              checkStrictly:true,
+              hide:true,
+              props: {
+                label: "title"
+              },
+              rules: [
+                {
+                  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",
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+              rules: [{
+                required: true,
+                message: "请输入序列号",
+                trigger: "blur"
+              }],
+            },
+            {
+              label: "通道号",
+              prop: "channelNumber",
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+              rules: [{
+                required: true,
+                message: "请输入通道号",
+                trigger: "blur"
+              }],
+            }, {
+              label: "缴费状态",
+              prop: "type",
+              slot: true,
+              sortable:true,
+              addDisplay: false,
+              editDisplay: false,
+            }, {
+              label: "设备厂商",
+              prop: "manufacturers",
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+              searchSpan: 3,
+              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",
+              type: "select",
+              slot: true,
+              width: 100,
+              rules: [{
+                required: true,
+                message: "请选择布撤防状态",
+                trigger: "blur"
+              }],
+              dicData: [
+                {
+                  label: "撤防",
+                  value: "0"
+                },
+                {
+                  label: "布防",
+                  value: "1"
+                }
+              ]
+            },
+            {
+              label: "设备状态",
+              prop: "dxzt",
+              slot: true,
+              sortable:true,
+              addDisplay: false,
+              editDisplay: false,
+            },
+            {
+              label: "故障状态",
+              prop: "state",
+              addDisplay: false,
+              editDisplay: false,
+              hide:true
+            },
+            {
+              label: "故障原因",
+              prop: "reason",
+              addDisplay: false,
+              editDisplay: false
+            },
+            {
+              label: "省份",
+              prop: "province",
+              search: true,
+              searchSpan: 2,
+              labelWidth: '110',
+              searchLabelWidth: 45,
+              placeholder: "省份",
+              type: "select",
+              props: {
+                label: "name",
+                value: "code"
+              },
+              cascaderItem: ["city", "district"],
+              dicUrl: "/api/blade-system/region/select",
+              span: 8,
+              className: "city1",
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+            },
+            {
+              label: "地市",
+              prop: "city",
+              type: "select",
+              searchPlaceholder: "地市",
+              placeholder: "地市",
+              searchLabelWidth: 1,
+              searchSpan: 2,
+              search: true,
+              props: {
+                label: "name",
+                value: "code"
+              },
+              dicUrl: "/api/blade-system/region/select?code={{key}}",
+              span: 2,
+              labelWidth: "0",
+              className: "city2",
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+            },
+            {
+              label: "区县",
+              searchSpan: 2,
+              searchLabelWidth: 1,
+              searchPlaceholder: "区县",
+              placeholder: "区县",
+              search: true,
+              prop: "district",
+              type: "select",
+              props: {
+                label: "name",
+                value: "code"
+              },
+              dicUrl: "/api/blade-system/region/select?code={{key}}",
+              span: 2,
+              labelWidth: "0",
+              className: "city3",
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+            }, {
+              label: "地址",
+              prop: "street",
+              span:10,
+              hide: true,
+            },
+            {
+              label: null,
+              prop: "map",
+              labelWidth: "0",
+              searchSpan:0,
+              maxlength:0,
+              hide: true,
+              span: 2,
+              // display:false,
+              component: "AvueMap"
+            },
+            {
+              label: "经度",
+              hide: true,
+              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,
+              prop: "wd",
+              formatter: (row,value,label,column) => {
+                return value = value.substring(0,10);
+              },
+              span:5,
+            },
 
-        data.records.sort((a, b) => {
-          return a.dxzt - b.dxzt;
+            {
+              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: "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: {
+                label: "title"
+              },
+              width: 72,
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+            },
+            {
+              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,
+              editDisplay: true,
+              viewDisplay: true,
+            }, {
+              label: "到期时间",
+              prop: "expireTime",
+              type: "datetime",
+              format: "yyyy-MM-dd",
+              valueFormat: "yyyy-MM-dd HH:mm:ss",
+              width: 130,
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+            }, {
+              label: "缴费信息",
+              prop: "pay",
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+            }, {
+              label: "安装时间",
+              prop: "stime",
+              type: "datetime",
+              format: "yyyy-MM-dd",
+              valueFormat: "yyyy-MM-dd HH:mm:ss",
+              width: 130,
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+            },
+            {
+              label: "心跳时间",
+              prop: "heartbeat",
+              type: "datetime",
+              format: "yyyy-MM-dd",
+              valueFormat: "yyyy-MM-dd HH:mm:ss",
+              width: 130,
+              hide: true,
+              addDisplay: true,
+              editDisplay: true,
+              viewDisplay: true,
+            }
+
+          ]
+        },
+        data: []
+      };
+    },
+    watch: {
+      "form.map": {
+        // form是表单或者表格绑定的数据集,v-model='form'
+        handler(val) {
+          if (val) {
+            var that = this;
+            //经纬度替换
+            this.form.wd = val.latitude;
+            this.form.jd = val.longitude;
+            //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
+            var address = val.formattedAddress.toString();
+            this.form.street = address;
+            // 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);
+            // }
+          }
+        },
+        immediate: true,
+      },
+      "form.oneId":{
+        handler(val) {
+          var that = this;
+          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"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.clientManagement_add, false),
+          viewBtn: this.vaildData(null, false),
+          delBtn: this.vaildData(this.permission.clientManagement_delete, false),
+          editBtn: this.vaildData(this.permission.clientManagement_edit, false)
+        };
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
         });
+        return ids.join(",");
+      }
+    },
+    mounted(){
+      // 租户模式默认加载管理组数据
+      // var that = this;
+      //that.tenantId = website.tenantId;
+    },
+    methods: {
+      generate(row) {
+        updates(row.expireTime, row.deviceNumber).then(() => {
+          this.dialogTableVisible = false;
+          this.realjf = false;
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "缴费成功!"
+          });
+        }, error => {
+          window.console.log(error);
+        });
+      },
 
-        this.data = data.records;
-        this.loading = false;
-        this.selectionClear();
-      });
-    }, rowStyle({row, column, rowIndex}) {
-      if (row.heartbeat != null && row.heartbeat != "") {
-        var date = new Date(row.heartbeat).getTime();
-        var Dqdate = new Date().getTime();
-        if ((Dqdate - date) >= (60 * 60 * 24 * 1000)) {
-          return {
-            color: "#fe1515"
+      //初始化数据
+      // 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;
+        this.page.currentPage = 1;
+        this.onLoad(this.page);
+      },
+      rowSave(row, done, loading) {
+        row.deptId = row.deptId.join(",");
+        add(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          window.console.log(error);
+          loading();
+        });
+      },
+      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",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          window.console.log(error);
+          loading();
+        });
+      },
+      updateDtype(row){
+        row.dtype = "0";
+        update(row).then(() => {
+          // this.initFlag = false;
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          this.onLoad(this.page);
+        }, error => {
+          window.console.log(error);
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+      searchReset() {
+        this.treeDeptId = "";
+        this.query = {};
+        this.onLoad(this.page);
+      },
+      searchChange(params, done) {
+        console.log(params,done)
+        this.query = params;
+        this.page.currentPage = 1;
+        this.onLoad(this.page, params);
+        done();
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      selectionClear() {
+        this.selectionList = [];
+        this.$refs.crud.toggleSelection();
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      beforeOpen(done, type) {
+        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) {
+        this.page.currentPage = currentPage;
+      },
+      sizeChange(pageSize) {
+        this.page.pageSize = pageSize;
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query);
+      },
+      onLoad(page, params = {}) {
+        const {releaseTimeRange} = this.query;
+        let values = {
+          ...params,
+        };
+        if (releaseTimeRange) {
+          values = {
+            ...params,
+            beginTime: releaseTimeRange[0],
+            endTime: releaseTimeRange[1],
+            ...this.query
+          };
+          values.releaseTimeRange = null;
+        } else {
+          values = {
+            ...params,
+            ...this.query
           };
         }
 
-      } else if (row.heartbeat == "") {
-        return {
-          color: "#fe1515"
-        };
-      }
-    },
-    handleManage(row) {
-      this.form;
-      this.dialogTableVisible = true;
-    },
-    payWin() {
-      var that = this;
-      getAll().then(res => {
-        var data = res.data.data;
-        var lists = [];
-        var xb = 0;
-        for (var i = 0; i < data.length; i++) {
-          if (data[i].type == "1") {
-            xb++;
-            data[i].xb = xb;
-            lists.push(data[i]);
-          }
+        //在线设备
+        if(this.$route.query.dxtype != undefined){
+          values = {
+            ...params,
+            dxtype: this.$route.query.dxtype,
+            ...this.query,
+          };
         }
-        if (lists.length > 0) {
-          that.gridData = lists;
-          that.dialogTableVisible = true;
-        }
-      });
 
-    }, handleStart(row) {
-      var arr = [];
-      this.$store.state.tags.tagList.forEach(item => {
-        if (item.label != "视频") {
-          arr.push(item);
+        this.loading = true;
+        getList(page.currentPage, page.pageSize, values, this.treeDeptId).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+
+          var Dqdate = new Date().getTime();
+
+          for (var i = 0; i < data.records.length; i++) {
+            var date = new Date(data.records[i].heartbeat).getTime();
+              if(data.records[i].dtype==1){
+                  data.records[i].dxzt = 1;
+              }
+              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 = 0;
+              }
+          }
+
+          this.data = data.records;
+          this.loading = false;
+          this.selectionClear();
+        });
+      }, rowStyle({row, column, rowIndex}) {
+        // if (row.heartbeat != null && row.heartbeat != "") {
+        //   var date = new Date(row.heartbeat).getTime();
+        //   var Dqdate = new Date().getTime();
+        //   if ((Dqdate - date) >= (60 * 60 * 24 * 1000)) {
+        //     return {
+        //       color: "#fe1515"
+        //     };
+        //   }
+
+        // } else if (row.heartbeat == "") {
+        //   return {
+        //     color: "#fe1515"
+        //   };
+        // }
+
+        if(row.dtype!=null && row.dtype!=""){
+          // if(row.dtype=='0'){
+          //   return {
+          //     color: "#DFDFDF"
+          //   };
+          // }
+          // if(row.dtype=='1'){
+          //   return {
+          //     color: "#29C093"
+          //   };
+          // }
+          if(row.dtype=='2'){
+            return {
+              color: "#F34A4A"
+            };
+          }
+          // if(row.dtype=='3'){
+          //   return {
+          //     color: "#F48F57"
+          //   };
+          // }
         }
-      });
-      this.$store.state.tags.tagList = arr;
-      this.$router.push({
-        path: `/real/video/`, query: row
-      });
-    }, handleMap(row) {
-      this.showMap = true;
-      this.$nextTick(() => {
-        this.$refs.mapDiv.onload = () => {
-          window.frames[0].init("equipment", {x: row.jd, y: row.wd});
-        };
-      })
-    },
-  }
-};
+      },
+      handleManage(row) {
+        this.form;
+        this.dialogTableVisible = true;
+      },
+      payWin() {
+        var that = this;
+        getAll().then(res => {
+          var data = res.data.data;
+          var lists = [];
+          var xb = 0;
+          for (var i = 0; i < data.length; i++) {
+            if (data[i].type == "1") {
+              xb++;
+              data[i].xb = xb;
+              lists.push(data[i]);
+            }
+          }
+          if (lists.length > 0) {
+            that.gridData = lists;
+            that.dialogTableVisible = true;
+          }
+        });
+
+      }, 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
+        });
+      }, handleMap(row) {
+        row = this.selectRow;
+        this.showMap = true;
+        this.$nextTick(() => {
+          this.$refs.mapDiv.onload = () => {
+            window.frames[1].init("equipment", {x: row.jd, y: row.wd});
+          };
+        })
+      },rightClick(row, event) {
+        this.selectRow = row;
+        this.menuVisible = false; // 先把模态框关死,目的是 第二次或者第n次右键鼠标的时候 它默认的是true
+        this.menuVisible = true; // 显示模态窗口,跳出自定义菜单栏
+        var menu = document.querySelector('#menu');
+        this.styleMenu(menu);
+      },
+      foo() {
+        // 取消鼠标监听事件 菜单栏
+        this.menuVisible = false;
+        document.removeEventListener('click', this.foo); // 要及时关掉监听,不关掉的是一个坑,不信你试试,虽然前台显示的时候没有啥毛病,加一个alert你就知道了
+      },
+      styleMenu(menu) {
+        let cha = document.body.clientHeight - event.clientY
+        //console.log(document.body.clientHeight,event.clientY,cha)
+        // 防止菜单太靠底,根据可视高度调整菜单出现位置
+        if (cha < 150) {
+          menu.style.top = event.clientY -120 - (100) + 'px'
+        } else {
+          menu.style.top = event.clientY -10 - (100) + 'px'
+        }
+        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 });
+      }
+    }
+  };
 </script>
 
+<style lang="scss" scoped>
+$city-m-l: 10px;
+
+  .payWin {
+    overflow-y: auto;
+    height: 350px;
+  }
+
+  .payWin .el-dialog__body {
+    padding-top: 0px !important;
+  }
+
+
+  // /*页面样式*/   //丢弃  因为不起作用,样式在cs.vue中  city1,2,3  liuyg改
+  // .el-card__body .cityClass1 {
+  //   width: 50px;
+  //   padding-right: 0px !important;
+  //   margin-left: $city-m-l;
+  // }
+
+  // .el-card__body .cityClass2 {
+  //   width: 50px;
+  //   padding-left: 0px !important;
+  //   padding-right: 0px !important;
+  //   margin-left: $city-m-l;
+  // }
+
+  // .el-card__body .cityClass3 {
+  //   width: 50px;
+  //   padding-left: 0px !important;
+  //   padding-right: 0px !important;
+  //   margin-left: $city-m-l;
+  // }
+
+  // /*新增窗体样式*/
+  // .el-dialog .city1 {
+  //   width: 155px;
+  //   padding-right: 0px !important;
+  //   margin-left: $city-m-l;
+  // }
+
+  // .el-dialog .city2 {
+  //   width: 100px;
+  //   padding-left: 5px !important;
+  //   padding-right: 5px !important;
+  //   margin-left: $city-m-l;
+  // }
+
+  // .el-dialog .city3 {
+  //   width: 100px;
+  //   padding-left: 0px !important;
+  //   padding-right: 0px !important;
+  //   margin-left: $city-m-l;
+  // }
+
+  // .city2 div label {
+  //   display: none;
+  // }
+
+  // .city3 div label {
+  //   display: none;
+  // }
+
+  .real-jf-dialog {
+    position: absolute !important;
+    top: 0 !important;
+    left: auto !important;
+    right: 0px !important;
+    bottom: 0 !important;
+    margin: auto !important;
+    height: 100% !important;
+    width: 800px !important;
+  }
+
+  .real-jf-dialog .el-dialog {
+    position: absolute !important;
+    top: 140px !important;
+    left: 245px !important;
+    right: 0px !important;
+    bottom: 0 !important;
+    margin: auto !important;
+    margin-top: 15vh !important;
+    height: 170px;
+  }
+
+  .real-jf-dialog .el-dialog .el-dialog__body {
+    height: calc(100% - 54px);
+    box-sizing: border-box;
+  }
+
+  .client-jf {
+    font-size: 25px;
+    color: green;
+  }
+
+  .client-qf {
+    font-size: 25px;
+    color: red;
+  }
+
+  .dtype{
+    width: 80px;
+  }
+
+  .dx{
+    position: absolute;
+    top: 50%;
+    margin-top: -5px;
+    margin-left: 6px;
+    width: 10px;
+    height: 10px;
+    border-radius: 30%;
+    background: #DFDFDF;
+  }
+  .zc{
+    position: absolute;
+    top: 50%;
+    margin-top: -5px;
+    margin-left: 6px;
+    width: 10px;
+    height: 10px;
+    border-radius: 30%;
+    background: #29C093;
+  }
+  .yj{
+    position: absolute;
+    top: 50%;
+    margin-top: -5px;
+    margin-left: 6px;
+    width: 10px;
+    height: 10px;
+    border-radius: 30%;
+    background: #F34A4A;
+  }
+  .gz{
+    position: absolute;
+    top: 50%;
+    margin-top: -5px;
+    margin-left: 6px;
+    width: 10px;
+    height: 10px;
+    border-radius: 30%;
+    background: #F48F57;
+  }
+
+  .tabFontSize{
+    font-size: 15px;
+  }
+
+  .menu_item {
+    cursor:pointer;
+    line-height: 20px;
+    text-align: center;
+    margin-top: 0px;
+  }
+
+  .menu {
+    height: auto;
+    width: 120px;
+    color: #606266;
+    position: absolute;
+    padding: 0px;
+    box-sizing: border-box;
+    /*border: 1px solid #999999;*/
+    text-align: center;
+    background-color: #fff;
+    border-radius: .25rem;
+    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
+  }
+  .menu li:hover {
+    background-color: rgba(232,237,250,.6);
+    color: darkslategrey;
+  }
+  .menu li{
+    position: relative;
+    display: flex;
+    font-size: 14px;
+    align-items: center;
+    height: 34px;
+    line-height: 34px;
+    outline: none;
+    margin-top: 0px;
+    padding-left: 20px;
+    padding-right: 5px;
+  }
+
+
+
+</style>
+
+
 <style>
-.payWin {
-  overflow-y: auto;
-  height: 350px;
-}
+  .avue-map input{
+    position: relative !important;
+    left: 30px !important;
+  }
 
-.payWin .el-dialog__body {
-  padding-top: 0px !important;
-}
+  .avue-map .el-input-group__append{
+    position: relative !important;
+    left: -51px !important;
+  }
 
-.real-jf-dialog {
-  position: absolute !important;
-  top: 0 !important;
-  left: auto !important;
-  right: 0px !important;
-  bottom: 0 !important;
-  margin: auto !important;
-  height: 100% !important;
-  width: 800px !important;
-}
 
-.real-jf-dialog .el-dialog {
-  position: absolute !important;
-  top: 140px !important;
-  left: 245px !important;
-  right: 0px !important;
-  bottom: 0 !important;
-  margin: auto !important;
-  margin-top: 15vh !important;
-  height: 170px;
-}
-
-.real-jf-dialog .el-dialog .el-dialog__body {
-  height: calc(100% - 54px);
-  box-sizing: border-box;
-}
 </style>

--
Gitblit v1.9.3