yf_zd hace 4 años
padre
commit
599d52bb5c

+ 3 - 2
config/index.js

@@ -11,7 +11,8 @@ module.exports = {
     assetsPublicPath: '/',
     proxyTable: {
       '/api': {
-        target: 'http://182.92.193.64:8002/',
+        // target: 'http://182.92.193.64:8002/',
+        target: 'http://192.168.1.77:8000/',
         changeOrigin: true,
         pathRewrite: {
           '^/api': '/api' //重写接口
@@ -20,7 +21,7 @@ module.exports = {
     },
 
     // Various Dev Server settings
-    host: '192.168.1.10', // can be overwritten by process.env.HOST
+    host: '192.168.1.5', // can be overwritten by process.env.HOST
     port: 8000, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: false,
     errorOverlay: true,

+ 8 - 3
index.html

@@ -2,12 +2,17 @@
 <html>
   <head>
     <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width,initial-scale=1.0">
+    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
     <title>大数据平台</title>
+    <!-- 可隐藏地址栏,仅针对IOS的Safari(注:IOS7.0版本以后,safari上已看不到效果) -->
+    <meta name="apple-mobile-web-app-capable" content="yes"/>
+    <!-- 仅针对IOS的Safari顶端状态条的样式(可选default/black/black-translucent ) -->
+    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
+    <!-- IOS中禁用将数字识别为电话号码/忽略Android平台中对邮箱地址的识别 -->
+    <meta name="format-detection" content="telephone=no, email=no"/>
     <script src="./static/js/ezuikit.js"></script>
   </head>
   <body>
     <div id="app"></div>
-    <!-- built files will be auto injected -->
   </body>
-</html>
+</html>

+ 6 - 0
package-lock.json

@@ -370,6 +370,12 @@
       "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz",
       "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM="
     },
+    "animate.css": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npm.taobao.org/animate.css/download/animate.css-4.1.1.tgz",
+      "integrity": "sha1-YU7FqBEx1+TcNipYFD90BqvWgHU=",
+      "dev": true
+    },
     "ansi-colors": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz",

+ 2 - 1
package.json

@@ -35,7 +35,8 @@
     "vue-lazyload": "^1.3.3",
     "vue-photo-preview": "^1.1.3",
     "vue-picture-bd-marker": "^1.3.8",
-    "vue-router": "^3.0.1"
+    "vue-router": "^3.0.1",
+    "vuex": "^3.6.2"
   },
   "devDependencies": {
     "animate.css": "^4.1.1",

+ 4 - 4
src/components/DateSearch/index.vue

@@ -1,25 +1,25 @@
 <template>
 	<div>
 		<el-button
-			:type="btnSelected == '1' ? 'primary' : 'default'"
+			:type="btnSelected == '1' ? 'blueInfo' : 'grayInfo'"
 			size="mini"
 			@click="timeBtnClick(1)"
 			>24小时</el-button
 		>
 		<el-button
-			:type="btnSelected == '2' ? 'primary' : 'default'"
+			:type="btnSelected == '2' ? 'blueInfo' : 'grayInfo'"
 			size="mini"
 			@click="timeBtnClick(2)"
 			>近一月</el-button
 		>
 		<el-button
-			:type="btnSelected == '3' ? 'primary' : 'default'"
+			:type="btnSelected == '3' ? 'blueInfo' : 'grayInfo'"
 			size="mini"
 			@click="timeBtnClick(3)"
 			>近半年</el-button
 		>
 		<el-button
-			:type="btnSelected == '4' ? 'primary' : 'default'"
+			:type="btnSelected == '4' ? 'blueInfo' : 'grayInfo'"
 			size="mini"
 			@click="timeBtnClick(4)"
 			>近一年</el-button

+ 3 - 5
src/components/Login.vue

@@ -1,8 +1,6 @@
 <template>
-	<div
-		class="login_container"
-		:style="{ backgroundImage: 'url(' + $imghost + bjImage + ')' }"
-	>
+	<div>
+		<video src="../../static/images/loginMp3.mp4"></video>
 		<div class="login_box">
 			<div class="tit-box">
 				<div class="tit-con">
@@ -95,7 +93,7 @@ export default {
 					if (selHome) {
 						this.$router.push(selHome) //登录后默认选择首页
 					} else {
-						this.$router.push('/index/home')
+						this.$router.push('/plantGuard')
 					}
 					localStorage.setItem('cUsername',res.data.params.username)
 				} else {

+ 21 - 3
src/components/highStand/equipList.vue

@@ -15,10 +15,30 @@
 export default {
   data: function () {
     return {
-      open: false,
+      open: true,
     };
   },
   methods: {
+    //获取设备列表
+    getList() {
+      this.$axios({
+        method: "POST",
+        url: "/api/api_gateway?method=device.device_manage.device_info",
+        data: this.qs.stringify({
+          device_id: this.queryInfo.f_id,
+          page: this.queryInfo.page,
+          page_size: 12,
+          device_type_id: '',
+          start_time: '',
+          end_time: ''
+        }),
+      }).then((res) => {
+        if (res.data.message == "") {
+          this.dataList = res.data.data.data;
+          this.totalNum = res.data.data.counts;
+        }
+      });
+    },
     toggleMenu() {
       this.open = !this.open;
     },
@@ -65,10 +85,8 @@ export default {
     border-radius: 6px;
     color: #212121;
     .content {
-      padding: 20px;
       box-sizing: border-box;
       height: 100%;
-      width: 440px;
     }
   }
 }

+ 5 - 15
src/components/highStand/sidebar.vue

@@ -1,8 +1,6 @@
 <template>
   <div :class="['legend', sidebarState ? 'open' : '']">
-    <div class="legend-menu" @click="toggleMenu" v-show="sidebarState">
-      {{sidebarState?"隐藏":"显示"}}
-    </div>
+    <div class="legend-menu" @click="toggleMenu" v-show="sidebarState"></div>
     <div class="legend-detail">
       <div class="content">
         <el-tabs tab-position="left" v-model="slidactiveName" @tab-click="tabshandleClick">
@@ -121,19 +119,11 @@ export default {
   align-items: flex-start;
   z-index: 9;
   .legend-menu {
-    background: #242424;
-    color: #fff;
-    opacity: .7;
-    width: 23px;
-    // height: 58px;
-    border-top-left-radius: 4px;
-    border-bottom-left-radius: 4px;
-    font-size: 14px;
-    line-height: 20px;
-    text-align: center;
+    width: 21px;
+    height: 103px;
     cursor: pointer;
-    margin-top: calc(100vh - 198px);
-    padding: 6px;
+    margin-top: calc(50vh - 100px);
+    background: url('../../../static/images/sliderBtn.png') no-repeat center;
     i {
       transition: 0.5s;
     }

+ 411 - 113
src/components/index.vue

@@ -5,7 +5,9 @@
       <div class="headMenu">
         <!-- logo -->
         <div class="logoinfo">
-          <img :src="$imghost + logoIcon" width="40" alt />
+          <img :src="$imghost + logoIcon" width="40" alt v-if="loginInfo.role_logo" />
+          <img :src="loginInfo.role_logo" v-else />
+          <!-- <span>{{ loginInfo.role_header || "河南省高标准农田管理系统" }}</span> -->
           <span>河南省高标准农田管理系统</span>
         </div>
         <!-- 菜单 -->
@@ -15,16 +17,39 @@
             :key="item.index"
             :class="{'active':item.name==currTopMenuId}"
             :id="'nav' + index"
+            v-trigger="(that)"
+            @click="topMenuClick(item,index)"
+          >
+            <div class="navContent">
+              <div class="a1">
+                <div class="blueMenu">
+                  <img src="../../static/images/indexTab.png" alt="">
+                </div>
+              </div>
+              <div class="a2">
+                <div class="blueMenu indexTabActive">
+                  <img src="../../static/images/indexTabActive.png" alt="">
+                </div>
+              </div>
+              
+              <div class="navTxt">{{item.name}}</div>
+            </div>
+          </li>
+          <!-- <li
+            v-for="(item,index) in menuList"
+            :key="item.index"
+            :class="{'active':item.name==currTopMenuId}"
+            :id="'nav' + index"
             v-trigger
             @click="topMenuClick(item,index)"
           >
             <img v-if="item.id" :src="iconimgs[item.id]" alt />
             <div>{{item.name}}</div>
-          </li>
+          </li> -->
         </ul>
         <div class="userInfo">
-          欢迎您!
-          <el-dropdown>
+          欢迎您! {{username}} 
+          <!-- <el-dropdown >
             <span class="el-dropdown-link">
               {{username}}
               <i class="el-icon-arrow-down el-icon--right"></i>
@@ -33,7 +58,7 @@
               <el-dropdown-item>个人中心</el-dropdown-item>
               <el-dropdown-item>修改密码</el-dropdown-item>
             </el-dropdown-menu>
-          </el-dropdown>
+          </el-dropdown> -->
           <div class="exit">
             <i class="el-icon-edit"></i>
           </div>
@@ -70,7 +95,6 @@
           </el-tabs>
         </div>
         <div class="content">
-          <!-- {{menuTabs}} -->
             <!-- <div>{{menuTabsValue}}</div> -->
             <!-- <keep-alive> -->
               <router-view></router-view>
@@ -91,119 +115,136 @@ export default {
   data() {
     //这里存放数据
     return {
+      that: this,
       logoIcon: "/images/logo.png",
       menuList: [
-        {
-          name: "数据监测",
-          id: "1",
-          children: [
-            {
-              name: "设备列表",
-              path: "/page1",
-              id: "11"
-            },
-            {
-              name: "数据目录管理",
-              path: "/page2",
-              id: "12"
-            },
-          ]
-        },
-        {
-          name: "智能灌溉系统",
-          id: "2",
-          children: [
-            {
-              name: "系统管理",
-              path: "/page3",
-              id: "22"
-            }
-          ]
-        },
-        {
-          name: "农业水价改革",
-          id: "3",
-          children: [
-            {
-              name: "设备列表",
-              path: ""
-            }
-          ]
-        },
-        {
-          name: "农业地理信息",
-          id: "4",
-          children: [
-            {
-              name: "设备列表",
-              path: ""
-            }
-          ]
-        },
-        {
-          name: "农产品追溯",
-          id: "5",
-          children: [
-            {
-              name: "设备列表",
-              path: ""
-            }
-          ]
-        },
-        {
-          name: "系统管理",
-          id: "6",
-          children: [
-            {
-              name: "用户管理",
-              path: "/page4",
-              id: "22"
-            },
-            {
-              name: "角色管理",
-              path: "/page6",
-              id: "22"
-            },
-            {
-              name: "主题定制",
-              path: "/page7",
-              id: "22"
-            },
-          ]
-        },
-        {
-          name: "设备管理",
-          id: "6",
-          children: [
-            {
-              name: "设备列表",
-              path: "/page8",
-              id: "22"
-            }
-          ]
-        }
+        // {
+        //   name: "数据监测",
+        //   id: "1",
+        //   children: [
+        //     {
+        //       name: "设备列表",
+        //       path: "/page1",
+        //       id: "11"
+        //     },
+        //   ]
+        // },
+        // {
+        //   name: "可视化系统",
+        //   id: "8",
+        //   children: [
+        //     {
+        //       name: "可视化系统",
+        //       path: "/monitor",
+        //       id: "88"
+        //     }
+        //   ]
+        // },
+        // {
+        //   name: "智能灌溉系统",
+        //   id: "2",
+        //   children: [
+        //     {
+        //       name: "系统管理",
+        //       path: "/page3",
+        //       id: "22"
+        //     }
+        //   ]
+        // },
+        // {
+        //   name: "农业水价改革",
+        //   id: "3",
+        //   children: [
+        //     {
+        //       name: "设备列表",
+        //       path: "/page1"
+        //     }
+        //   ]
+        // },
+        // {
+        //   name: "农业地理信息",
+        //   id: "4",
+        //   children: [
+        //     {
+        //       name: "设备列表",
+        //       path: "/page1"
+        //     }
+        //   ]
+        // },
+        // {
+        //   name: "农产品追溯",
+        //   id: "5",
+        //   children: [
+        //     {
+        //       name: "设备列表",
+        //       path: "/page1"
+        //     }
+        //   ]
+        // },
+        // {
+        //   name: "系统管理",
+        //   id: "6",
+        //   children: [
+        //     {
+        //       name: "用户管理",
+        //       path: "/page4",
+        //       id: "22"
+        //     },
+        //     {
+        //       name: "角色管理",
+        //       path: "/page6",
+        //       id: "22"
+        //     },
+        //     {
+        //       name: "主题定制",
+        //       path: "/page7",
+        //       id: "22"
+        //     },
+        //   ]
+        // },
+        // {
+        //   name: "设备管理",
+        //   id: "6",
+        //   children: [
+        //     {
+        //       name: "设备管理",
+        //       path: "/page8",
+        //       id: "22"
+        //     }
+        //   ]
+        // }
       ],
       leftMenuList: [],
       currTopMenuId: '数据监测',
       currLeftMenuId: '设备列表',
       iconimgs: {
-        "2": require("@/assets/images/home/home02/scd.png"),
-        "22": require("@/assets/images/home/home02/scd.png"),
         "1": require("@/assets/images/home/home02/scd.png"),
-        "11": require("@/assets/images/home/home02/scd.png"),
-        "12": require("@/assets/images/home/home02/scd.png"),
         "2": require("@/assets/images/home/home02/scd.png"),
         "3": require("@/assets/images/home/home02/scd.png"),
         "4": require("@/assets/images/home/home02/scd.png"),
         "5": require("@/assets/images/home/home02/scd.png"),
         "6": require("@/assets/images/home/home02/scd.png"),
-        "7": require("@/assets/images/home/home02/scd.png")
+        "7": require("@/assets/images/home/home02/scd.png"),
+        "8": require("@/assets/images/home/home02/scd.png"),
+        "9": require("@/assets/images/home/home02/scd.png"),
+        "10": require("@/assets/images/home/home02/scd.png"),
+        "11": require("@/assets/images/home/home02/scd.png"),
+        "12": require("@/assets/images/home/home02/scd.png"),
+        "13": require("@/assets/images/home/home02/scd.png"),
+        "14": require("@/assets/images/home/home02/scd.png"),
+        "15": require("@/assets/images/home/home02/scd.png"),
+        "16": require("@/assets/images/home/home02/scd.png"),
+        "17": require("@/assets/images/home/home02/scd.png"),
+        "18": require("@/assets/images/home/home02/scd.png"),
+        "19": require("@/assets/images/home/home02/scd.png"),
       },
       //动态标签
       // menuTabs:[{ "path": "/plantGuard/page1", "name": "设备列表", "par": "数据监测", "order": 0 } ],
       menuTabs:[],
       menuTabsValue:'',
       username:"",
+      // 用户信息
+      loginInfo:{},
     };
   },
   //监听属性 类似于data概念
@@ -225,6 +266,9 @@ export default {
         this.add_tabs({path: to.path, name: to.meta.navname,par:to.meta.title,order:to.meta.order})
         this.menuTabsValue = to.meta.navname
       }
+
+      sessionStorage.setItem("menuTabs", JSON.stringify(this.menuTabs));
+      sessionStorage.setItem("menuTabsValue", this.menuTabsValue);
       
     }
   },
@@ -232,8 +276,15 @@ export default {
   directives: {
     trigger: {
       inserted(el, binging) {
-        el.id == "nav0" ? el.click() : null; // 只点击第一个,id是在循环中手动添加的
-      }
+        var menuTabsValue = sessionStorage.getItem("menuTabsValue");
+        var menuTabs = sessionStorage.getItem("menuTabs");
+        if(menuTabs){
+          binging.value.that.menuTabs = JSON.parse(menuTabs)
+          binging.value.that.menuTabsValue = menuTabsValue
+        }else{
+          el.id == "nav0" ? el.click() : null; // 只点击第一个,id是在循环中手动添加的
+        }
+      },
     },
   },
   //方法集合
@@ -253,6 +304,7 @@ export default {
     //添加tab标签
     add_tabs (data) {
       this.menuTabs.push(data)
+      console.log(data);
     },
     //移除tab标签
     removeTab(targetName) {
@@ -285,30 +337,223 @@ export default {
       this.menuTabsValue = this.menuTabs[tab.index].name
       this.currTopMenuId=this.menuTabs[tab.index].par;
       this.currLeftMenuId=this.menuTabs[tab.index].name;
+      // sessionStorage.setItem("menuTabsValue", this.menuTabsValue);
     
     },
+    // 获取用户主题
+    getUserInfo() {
+      this.$axios({
+        method: "POST",
+        url: "/api/api_gateway?method=home.homes.user_theme",
+      }).then((res) => {
+        if (res.data.message == "") {
+          this.loginInfo = res.data.data[0];
+        } else {
+          this.$message.error(res.data.message);
+        }
+      });
+    },
+    // 获取用户菜单列表
+    getNavList() {
+      this.$axios({
+        method: "POST",
+        url: "/api/api_gateway?method=user.login.user_login_info",
+      }).then((res) => {
+        if (res.data.message == "") {
+          var menuLists=[
+            {
+                  "name": "数据监测",
+                  "id": "1",
+                  "children": [
+                     {
+                     "name": "设备列表",
+                     "path": "/page1",
+                     "id": "2"
+                     },
+                     {
+                     "name": "项目列表",
+                     "path": "/baseAll",
+                     "id": "19"
+                     },
+                  ]
+               },
+               {
+                  "name": "可视农业",
+                  "id": "3",
+                  "children": [
+                     {
+                     "name": "可视化系统",
+                     "path": "/monitor",
+                     "id": "4"
+                     }
+                  ]
+               },
+               {
+                  "name": "智能灌溉",
+                  "id": "5",
+                  "children": [
+                     {
+                     "name": "系统管理",
+                     "path": "/page3",
+                     "id": "6"
+                     }
+                  ]
+               },
+               {
+                  "name": "水价管理",
+                  "id": "7",
+                  "children": [
+                     {
+                     "name": "地图展示",
+                     "path": "/page9",
+                     "id": "20"
+                    },
+                    {
+                     "name": "水井信息",
+                     "path": "/page10",
+                     "id": "21"
+                    },
+                    {
+                     "name": "用户信息",
+                     "path": "/page11",
+                     "id": "22"
+                    },
+                  ]
+               },
+               {
+                  "name": "农业地理信息",
+                  "id": "9",
+                  "children": [
+                     {
+                     "name": "设备列表",
+                     "path": "/page1",
+                     "id": "10"
+                    }
+                  ]
+               },
+               {
+                  "name": "农产品追溯",
+                  "id": "11",
+                  "children": [
+                     {
+                     "name": "设备列表",
+                     "path": "/page1",
+                     "id": "12"
+                    }
+                  ]
+               },
+               {
+                  "name": "系统管理",
+                  "id": "13",
+                  "children": [
+                     {
+                     "name": "用户管理",
+                     "path": "/page4",
+                     "id": "14"
+                     },
+                     {
+                     "name": "角色管理",
+                     "path": "/page6",
+                     "id": "15"
+                     },
+                     {
+                     "name": "主题定制",
+                     "path": "/page7",
+                     "id": "16"
+                     },
+                  ]
+               },
+               {
+                  "name": "设备管理",
+                  "id": "17",
+                  "children": [
+                     {
+                     "name": "设备列表",
+                     "path": "/page8",
+                     "id": "18"
+                     }
+                  ]
+               }
+          ];
+          
+          let userType = res.data.data.myuser_type; //用户类型
+          let userName = res.data.data.username; //用户名
+          let myuid = res.data.data.myuid; //用户id
+          
+          sessionStorage.setItem("myuser_type", userType);
+          sessionStorage.setItem("myuid", myuid);
+
+          if(menuLists[0].name=='数据监测'){
+            if(userType == 4){
+              menuLists[0].children= [
+                {
+                  "name": "设备列表",
+                  "path": "/page1",
+                  "id": "2"
+                }
+              ]
+            }else{
+              menuLists[0].children= [
+                {
+                  "name": "项目列表",
+                  "path": "/baseAll",
+                  "id": "19"
+                },
+              ]
+            }
+          }
+          this.menuList = menuLists;
+        }
+      });
+    },
+    beforeunloadHandler (e) {
+      //  alert(1)
+       console.log(e);
+       
+      // e = e || window.event
+      // if (e) {
+      //   e.returnValue = '关闭提示'
+      // }
+      // return '关闭提示'
+    }
 
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
+    this.getNavList();
+    this.getUserInfo();
     this.username = localStorage.getItem("cUsername");
+    // window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
   },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeMount() {}, //生命周期 - 挂载之前
   beforeUpdate() {}, //生命周期 - 更新之前
   updated() {}, //生命周期 - 更新之后
   beforeDestroy() {}, //生命周期 - 销毁之前
-  destroyed() {}, //生命周期 - 销毁完成
+  destroyed() {
+    // window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
+  }, //生命周期 - 销毁完成
   activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
 <style scoped lang="less">
+@keyframes step {
+    0% {
+        -webkit-transform: translateX(0);
+        transform: translateX(0)
+    }
+
+    to {
+        -webkit-transform: translate3d(-3330px, 0, 0);
+        transform: translate3d(-3330px, 0, 0)
+    }
+}
 .el-header {
-  background-color: #252b37;
+  background-color: #182037;
   color: #eee;
-  z-index: 9999999;
+  z-index: 3500;
   .headMenu {
     height: 80px;
     display: flex;
@@ -331,17 +576,63 @@ export default {
       align-items: center;
       li {
         cursor: pointer;
-        padding: 14px 0;
-        width: 100px;
-        text-align: center;
+        // padding: 10px 0;
+        // width: 100px;
+        width: 111px;
+        // text-align: center;
         margin: 0 10px;
-        line-height: 20px;
+        // line-height: 20px;
+
+        height: 100%;
+        // background: red;
+        .navContent{
+          position: relative;
+          margin-top: 20px;
+        }
+        .blueMenu{
+          position: absolute;
+          width: 100%;
+          height: 39px;
+          overflow: hidden;
+          // background: url(../../../static/images/indexTab.png);
+          img{
+            animation: step 5s steps(30) infinite;
+          }
+        }
+        // .indexTabActive{
+        //   display: none;
+        // }
+        .a2{
+          // display: none;
+          visibility:hidden
+        }
+        .navTxt{
+          line-height: 39px;
+          padding-left: 30px;
+          font-size: 14px;
+        }
       }
       .active {
-        background: #0195ff;
+        // background: #0195ff;
+        .a1{
+          // display: none;
+          visibility:hidden
+        }
+        .a2{
+          // display: block;
+          visibility:visible
+        }
       }
       li:hover {
-        background: #003e66;
+        .a1{
+          // display: none;
+          visibility:hidden
+        }
+        .a2{
+          // display: block;
+          visibility:visible
+        }
+        // background: #003e66;
       }
     }
     .userInfo {
@@ -363,7 +654,7 @@ export default {
 }
 
 .el-aside {
-  background-color: #252b37;
+  background-color: #182037;
   color: #eee;
   .leftMenu {
     text-align: center;
@@ -388,7 +679,7 @@ export default {
   .tabsNav{
     position: fixed;
     background: #fff;
-    z-index: 9999999;
+    z-index: 3000;
     width: 100%;
   }
   .content{
@@ -410,4 +701,11 @@ export default {
   /deep/.el-tabs__item:hover{
     color: #0295ff;
   }
+  /deep/.el-radio__input.is-checked .el-radio__inner{
+    border-color: #0195ff;
+    background: #0195ff;
+  }
+  /deep/.el-radio__input.is-checked + .el-radio__label {
+    color: #0195ff;
+  }
 </style>

+ 53 - 0
src/main.js

@@ -20,6 +20,34 @@ Vue.prototype.qs = qs //全局注册,使用方法为:this.qs
 Vue.prototype.$EventBus = new Vue() //中央时间总线
 Vue.use(ElementUI);
 
+
+import { Message } from 'element-ui';
+//定义一个新的Message方法,多传入一个offset参数
+const $message = options => {
+  return Message({
+    ...options,
+    offset: 160,
+    type: options.type
+  });
+};
+//重写一遍success的方法,将offset写入options
+['success', 'warning', 'info', 'error'].forEach(type => {
+  $message[type] = options => {
+    if (typeof options === 'string') {
+      options = {
+        message: options,
+        offset: 160
+      };
+    }
+    options.type = type;
+    return Message(options);
+  };
+});
+
+//将$message挂载到this上
+Vue.prototype.$message = $message;
+
+
 //节流
 function throttle(){
   let prev=0
@@ -135,6 +163,27 @@ Vue.filter('equipType', function (i) {
     case '9':
       return '糖醋测报';
       break;
+    case 2:
+      return '杀虫灯';
+      break;
+    case 3:
+      return '虫情测报灯';
+      break;
+    case 4:
+      return '性诱测报';
+      break;
+    case 5:
+      return '环境监测';
+      break;
+    case 6:
+      return '监控';
+      break;
+    case 7:
+      return '孢子仪';
+      break;
+    case 9:
+      return '糖醋测报';
+      break;
   }
 })
 
@@ -172,10 +221,14 @@ router.beforeEach((to, from, next) => {
   }
 })
 
+// 引入vuex-store
+import store from './store/store';
+
 /* eslint-disable no-new */
 new Vue({
   el: '#app',
   router,
+  store,
   components: { App },
   template: '<App/>'
 })

+ 1 - 1
src/pages/equipmanger/EquipDistribute.vue

@@ -220,7 +220,7 @@ export default {
       }).then((res) => {
         if (res.data.message == "") {
           this.$message.success("分配设备成功!");
-          this.$router.go(-1);
+          // this.$router.go(-1);
         }
       });
     },

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 634 - 317
src/pages/monitor/monitorSystem/Monitor.vue


+ 98 - 46
src/pages/monitor/monitorSystem/PhotoView.vue

@@ -1,44 +1,54 @@
 <template>
-   <div style="cursor: default">
-      <el-breadcrumb separator-class="el-icon-arrow-right">
-            <el-breadcrumb-item :to="{path:'/index/monitor'}">监控</el-breadcrumb-item>
-            <el-breadcrumb-item>查看图片</el-breadcrumb-item>
-     </el-breadcrumb> 
-     <div class="opt-box">
-         <div>
-            <el-button type="primary" size="mini">刷新</el-button>
-            <el-button type="primary" size="mini">批量删除</el-button>
-         </div>
-        <el-date-picker
-        size="small"
-        align="right"
-        v-model="timeRange"
-        type="daterange"
-        @change="timeRangChange"
-        range-separator="至"
-        start-placeholder="开始日期"
-        end-placeholder="结束日期">
-        </el-date-picker>
-     </div>
-     <el-row :gutter="20">
-            <viewer :images="images" class="images clearfix">
-              <template slot-scope="scope">
-                  <el-col :span="6"  v-for="(src,index) in scope.images" :key="index">
-                      <el-card>
-                            <img :src="src"  class="image">
-                            <span class="time">2020-12-25 12:00:00</span>
-                            <span class="del iconfont icon-shanchu" @click="delPhoto()"></span>
-                            <div class="bottom">
-                                <img src="@/assets/images/forecasting/monitor/icon.png" >
-                                病情识别
-                            </div>
-                      </el-card>
-                  </el-col>
-             </template>
-            </viewer>
-    </el-row>
-    
-   </div>
+    <div class="innerMargin">
+        <el-card class="box-card">
+        <div style="cursor: default">
+            <div class="opt-box">
+                <div>
+                    <el-button type="primary" size="mini" @click="getImageList()"
+                    >刷新</el-button
+                    >
+                    <!-- <el-button type="primary" size="mini">批量删除</el-button> -->
+                </div>
+                <el-date-picker
+                size="small"
+                align="right"
+                v-model="timeRange"
+                type="daterange"
+                @change="timeRangChange"
+                range-separator="至"
+                start-placeholder="开始日期"
+                end-placeholder="结束日期">
+                </el-date-picker>
+            </div>
+            <el-row :gutter="20">
+                <viewer :images="images" class="images clearfix">
+                    <template slot-scope="scope">
+                        <el-col :span="6"  v-for="(src,index) in scope.images" :key="index">
+                            <el-card>
+                                    <img :src="src"  class="image">
+                                    <span class="time">2020-12-25 12:00:00</span>
+                                    <span class="del iconfont icon-shanchu" @click="delPhoto()"></span>
+                                    <div class="bottom">
+                                        <img src="@/assets/images/forecasting/monitor/icon.png" >
+                                        病情识别
+                                    </div>
+                            </el-card>
+                        </el-col>
+                    </template>
+                </viewer>
+                <!-- 暂无数据 -->
+                <div class="expertDiagnosis_referral_units_not" v-if="images.length <= 0">
+                    <img
+                    :src="$imghost + zanwu"
+                    alt
+                    class="expertDiagnosis_referral_units_notImg"
+                    />
+                </div>
+            </el-row>
+            
+        </div>
+        </el-card>
+    </div>
 </template>
 
 <script>
@@ -47,6 +57,7 @@
             return {
                 timeRange:'',
                 imei:this.$route.params.id,
+                zanwu: "/images/expertDiagnosis/zanwu.png",
                 page:1,
                 images:[]
             }
@@ -58,7 +69,7 @@
             getImageList(){
                 this.$axios({
                     method:'POST',
-                    url:'jk_image',
+                    url:'/api/api_gateway?method=camera.camera_manage.camera_photo',
                     data:this.qs.stringify({
                         imei:this.imei,
                         page:this.page
@@ -67,12 +78,53 @@
 
                 })
             },
-            timeRangChange(){
-
+            timeRangChange() {
+                this.page = 1;
+                if (this.timeRange) {
+                    this.begin = parseInt(new Date(this.timeRange[0]).getTime() / 1000);
+                    this.end = parseInt(new Date(this.timeRange[1]).getTime() / 1000);
+                } else {
+                    this.begin = "";
+                    this.end = "";
+                }
+                  this.getImageList();
+            },
+            // 删除图片
+            delPhoto(data) {
+            var arr = [];
+            console.log(arr);
+            this.$confirm("此操作将删除该图片, 是否继续?", "提示", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+            })
+                .then(() => {
+                this.$axios({
+                    method: "POST",
+                    url:
+                    "/api/api_gateway?method=camera.camera_manage.del_camera_photo",
+                    data: this.qs.stringify({
+                    photo_id_list: arr,
+                    }),
+                })
+                    .then((res) => {
+                    console.log(res);
+                    this.$message({
+                        type: "success",
+                        message: "删除成功!",
+                    });
+                    this.getImageList()
+                    })
+                    .catch((err) => {
+                    console.log(err);
+                    this.$message({
+                        type: "info",
+                        message: "已取消删除",
+                    });
+                    });
+                })
+                .catch(() => {});
             },
-            delPhoto(){
-
-            }
         }
    }
 </script>

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1286 - 38
src/pages/plantGuard/cbdPhoto/cbdPhoto.vue


+ 11 - 13
src/pages/plantGuard/dialog.vue

@@ -1,10 +1,10 @@
 <!-- 弹出框公共组件 -->
 <template>
-  <div class='DialogVisible'>
-    <!-- <div class="mask">
+  <div class='DialogVisible' :style="{marginLeft:-width/2+'px'}">
+    <div class="mask">
       <slot name="mask"></slot>
-    </div> -->
-    <div class="dialog__wrapper" :style="{width:width}">
+    </div>
+    <div class="dialog__wrapper" :style="{width:width+'px'}">
       <div class="dialog-header">
         <slot name="header">
           <span class="dialog-title">数据详情</span>
@@ -62,13 +62,11 @@ activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
 <style scoped lang="less">
 .DialogVisible{
   position: fixed;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    left: 0;
-    overflow: auto;
-    margin: 0;
-    z-index: 555;
+  top: 215px;
+  left: 50%;
+  overflow: auto;
+  margin: 0;
+  z-index: 555;
   .mask{
     position: fixed;
     left: 0;
@@ -81,7 +79,7 @@ activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
   .dialog__wrapper{
     border-radius: 5px;
     margin: 0 auto 50px;
-    margin-top: 23vh;
+    margin-top: 0vh;
     // width: 500px;
     position: relative;
     background: #FFFFFF;
@@ -114,7 +112,7 @@ activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
     }
   }
   .dialog-body{
-    padding: 30px 20px;
+    padding: 20px 20px;
     color: #606266;
     font-size: 14px;
   }

+ 2 - 2
src/pages/plantGuard/equipCtrls/cbdctrl.vue

@@ -41,7 +41,7 @@
 								:picker-options="{
 									start: '00:00',
 									step: '01:00',
-									end: '24:00'
+									end: '23:00'
 								}"
 							></el-time-select>
 						</el-col>
@@ -53,7 +53,7 @@
 								:picker-options="{
 									start: '00:00',
 									step: '01:00',
-									end: '24:00'
+									end: '23:00'
 								}"
 							></el-time-select>
 						</el-col>

+ 4 - 2
src/pages/plantGuard/equipInfo.vue

@@ -3,7 +3,7 @@
   <div class="equipInfo">
     <div class="equipImg">
       <img src="@/assets/images/newImg/12.jpg" alt="">
-      <p>设类型:{{equipType|equipType}}</p>
+      <p>设类型:{{equipType|equipType}}</p>
     </div>
     <div class="equipMsg">
       <div class="title">
@@ -44,7 +44,9 @@
           <i v-else class="el-icon-edit controlIcon" @click="setTime()"></i>
         </div>
       </template>
-      <div>最新上报时间:{{info.status_time*1000|formatTime}} <span><i class="el-icon-refresh controlIcon" v-if="info.d_id"></i></span></div>
+      <div>最新上报时间:{{info.addtime*1000|formatTime}} 
+        <!-- <span><i class="el-icon-refresh controlIcon" v-if="info.d_id"></i></span> -->
+      </div>
       <div>设备定位:{{info.address || '--'}}</div>
     </div>
     <div class="equipState">

+ 343 - 79
src/pages/plantGuard/page1.vue

@@ -34,13 +34,42 @@
     <components :is="sidebarComponents" @sidebarClear="sidebarClear()" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='queryInfo.type' :model="queryInfo.model"></components>
     <!-- 设备列表 -->
     <equip-list>
-      <p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p><p>1</p>
-      <button @click="detailsShow == 3">ceshi</button>
+      <div class="searchEquipBox">
+        <el-input
+					style="cursor: pointer"
+					placeholder="请输入内容"
+					size="mini"
+					clearable
+					v-model="searchEquipVal"
+					suffix-icon="el-icon-search"
+					class="input-with-select"
+          @change="getEquipList()"
+				></el-input>
+      </div>
+      <div class="equipListBox" id="equipListBox"  v-loading="equipListloading" >
+        <div class="equipList" >
+          <div v-for="(item,index) in equipListCurr" :key="index" :class="[index==equipListActive?'active':'','equipItem']" @click="equipMarkerClick(item)">
+            <div>
+              <div class="equipId">
+                <span :class="item.device_status?'online':'offline'"></span>
+                {{item.device_id}}
+              </div>
+              <div class="equipCity">{{item.city}}</div>
+            </div>
+            <div>
+              <div class="equipType">{{item.device_type_id | equipType}}</div>
+              <div>{{item.addtime*1000 | formatTime}}</div>
+
+            </div>
+          </div>
+        </div>
+      </div>
+      
     </equip-list>
     <!-- 杀虫灯数据框 -->
     <transition
         enter-active-class="animate__animated animate__zoomIn" 
-        leave-active-class="animate__animated animate__rotateOut"
+        leave-active-class="animate__animated animate__zoomOut"
     >
       <dialog-box v-if="detailsShow==2" width='800'>
           <template v-slot:header>
@@ -50,7 +79,7 @@
             </button>
           </template>
           <template v-slot:inner>
-            <equip-info :equipId="queryInfo.equip_id" :equipType='detailsShow'>
+            <equip-info v-if="hackReset" :equipId="queryInfo.equip_id" :equipType='detailsShow'>
               <template v-solt:equipStateInner></template>
             </equip-info>
             <div class="equipData">
@@ -64,7 +93,7 @@
                     :name="pages.name"
                   > 
                     <!-- <keep-alive> -->
-                      <components :is="pages.name" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='detailsShow' v-if="pages.name == nowPage"></components>
+                      <components :is="pages.name" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='detailsShow' v-if="pages.name == nowPage && hackReset"></components>
                     <!-- </keep-alive> -->
                   </el-tab-pane>
                 </el-tabs>
@@ -76,7 +105,7 @@
     <!-- 测报灯数据框 -->
     <transition
         enter-active-class="animate__animated animate__zoomIn" 
-        leave-active-class="animate__animated animate__rotateOut"
+        leave-active-class="animate__animated animate__zoomOut"
     >
       <dialog-box v-if="detailsShow==3" width='800'>
           <template v-slot:header>
@@ -86,7 +115,7 @@
             </button>
           </template>
           <template v-slot:inner>
-            <equip-info :equipId="queryInfo.equip_id" :equipType='detailsShow'>
+            <equip-info v-if="hackReset" :equipId="queryInfo.equip_id" :equipType='detailsShow'>
               <template v-solt:equipStateInner></template>
             </equip-info>
             <div class="equipData">
@@ -100,7 +129,7 @@
                     :name="pages.name"
                   > 
                     <keep-alive>
-                      <components :is="pages.name" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='detailsShow' v-if="pages.name == nowPage"></components>
+                      <components :is="pages.name" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='detailsShow' v-if="pages.name == nowPage && hackReset"></components>
                     </keep-alive>
                   </el-tab-pane>
                 </el-tabs>
@@ -112,7 +141,7 @@
     <!-- 性诱设备数据框 -->
     <transition
         enter-active-class="animate__animated animate__zoomIn" 
-        leave-active-class="animate__animated animate__rotateOut"
+        leave-active-class="animate__animated animate__zoomOut"
     >
       <dialog-box v-if="detailsShow==4" width='800'>
           <template v-slot:header>
@@ -122,7 +151,7 @@
             </button>
           </template>
           <template v-slot:inner>
-            <equip-info :equipId="queryInfo.equip_id" :equipType='detailsShow'>
+            <equip-info v-if="hackReset" :equipId="queryInfo.equip_id" :equipType='detailsShow'>
               <template v-solt:equipStateInner></template>
             </equip-info>
             <div class="equipData">
@@ -136,7 +165,7 @@
                     :name="pages.name"
                   > 
                     <keep-alive>
-                      <components :is="pages.name" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='detailsShow' v-if="pages.name == nowPage"></components>
+                      <components :is="pages.name" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='detailsShow' v-if="pages.name == nowPage && hackReset"></components>
                     </keep-alive>
                   </el-tab-pane>
                 </el-tabs>
@@ -148,7 +177,7 @@
     <!-- 气象站数据框 -->
     <transition
         enter-active-class="animate__animated animate__zoomIn" 
-        leave-active-class="animate__animated animate__rotateOut"
+        leave-active-class="animate__animated animate__zoomOut"
     >
       <dialog-box v-if="detailsShow==5" width='800'>
           <template v-slot:header>
@@ -158,7 +187,7 @@
             </button>
           </template>
           <template v-slot:inner>
-            <equip-info :equipId='queryInfo.equip_id' :equipType='detailsShow'>
+            <equip-info v-if="hackReset" :equipId='queryInfo.equip_id' :equipType='detailsShow'>
               <template v-solt:equipStateInner></template>
             </equip-info>
             <div class="equipData">
@@ -172,7 +201,7 @@
                     :name="pages.name"
                   > 
                     <keep-alive>
-                      <components :is="pages.name" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='detailsShow' v-if="pages.name == nowPage"></components>
+                      <components :is="pages.name" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='detailsShow' v-if="pages.name == nowPage && hackReset"></components>
                     </keep-alive>
                   </el-tab-pane>
                 </el-tabs>
@@ -181,10 +210,32 @@
           </template>
       </dialog-box>
     </transition>
+    <!-- 监控数据框 -->
+    <transition
+        enter-active-class="animate__animated animate__zoomIn" 
+        leave-active-class="animate__animated animate__zoomOut"
+    >
+      <div v-if="detailsShow==6" class="jkDialog">
+            <el-button type="blueInfo" size="small" @click="jkClose2()" >停止</el-button>
+            <el-button type="blueInfo" size="small" @click="jkClose()" >刷新</el-button>
+        <div id="videoCon"></div>
+      </div>
+      <!-- <dialog-box v-if="detailsShow==6" width='800'>
+          <template v-slot:header>
+            <span class="dialog-title">监控</span>
+            <button type="button" @click="detailsShow=''" class="dialog-headerbtn">
+              <i class="el-icon el-icon-close"></i>
+            </button>
+          </template>
+          <template v-slot:inner>
+            <div id="videoCon"></div>
+          </template>
+      </dialog-box> -->
+    </transition>
     <!-- 孢子仪数据框 -->
     <transition
         enter-active-class="animate__animated animate__zoomIn" 
-        leave-active-class="animate__animated animate__rotateOut"
+        leave-active-class="animate__animated animate__zoomOut"
     >
       <dialog-box v-if="detailsShow==7" width='800'>
           <template v-slot:header>
@@ -194,7 +245,7 @@
             </button>
           </template>
           <template v-slot:inner>
-            <equip-info @child-event="setTimeDialogShow" :equipId='queryInfo.equip_id' :equipType='detailsShow'>
+            <equip-info v-if="hackReset" @child-event="setTimeDialogShow" :equipId='queryInfo.equip_id' :equipType='detailsShow'>
               <template v-solt:equipStateInner></template>
             </equip-info>
             <div class="equipData">
@@ -208,7 +259,7 @@
                     :name="pages.name"
                   > 
                     <keep-alive>
-                      <components :is="pages.name" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='detailsShow' v-if="pages.name == nowPage"></components>
+                      <components :is="pages.name" :equipId="queryInfo.equip_id" :d_id="queryInfo.d_id" :equipType='detailsShow' v-if="pages.name == nowPage && hackReset"></components>
                     </keep-alive>
                   </el-tab-pane>
                 </el-tabs>
@@ -262,7 +313,8 @@ import equipInfo from './equipInfo' //设备基础信息
 import equipHistoryDate from './equipHistoryDate' //设备历史数据
 import qxzEquipHistoryDate from './equipHistoryDateQxz' //气象站设备历史数据
 import twentyFourHistoryDate from './twentyFourHistoryDate' //气象站24小时数据
-import cbdPhoto from './cbdPhoto/cbdPhoto' //测报灯图片
+import cbdTabPhoto from './cbdPhoto/cbdTabPhoto' //测报灯图片
+import cbdTabPestStat from './cbdTabPestStat' //测报灯害虫统计
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {
@@ -275,15 +327,17 @@ export default {
       equipHistoryDate,
       qxzEquipHistoryDate,
       twentyFourHistoryDate,
-      cbdPhoto,
+      cbdTabPhoto,
+      cbdTabPestStat,
   },
   data() {
     //这里存放数据
     return {
+      user_id:'',
       sidebarComponents:'',
       amapManager,
-      center: [120.298433, 31.680335],
-      zoom: 6,
+      center: [106.323527,29.541514],
+      zoom: 5,
       mapType: 1,
       plugin: [
         // {
@@ -354,18 +408,18 @@ export default {
           type:5,
           name:"环境监测",
         },
-        {
-          type:4,
-          name:"性诱设备",
-        },
-        {
-          type:3,
-          name:"虫情测报",
-        },
-        {
-          type:2,
-          name:"杀虫灯"
-        },
+        // {
+        //   type:4,
+        //   name:"性诱设备",
+        // },
+        // {
+        //   type:3,
+        //   name:"虫情测报",
+        // },
+        // {
+        //   type:2,
+        //   name:"杀虫灯"
+        // },
       ],
       currSelectType:0,
       currSelectSite:0,
@@ -443,8 +497,8 @@ export default {
       // 孢子仪配置载玻片时间did
       currbzyGlass:"",
       // 设备tabs标签
-      activeName: "equipState",
-      nowPage: "equipState",
+      activeName: "",
+      nowPage: "",
       pages:{
         "2":[{
           name:"equipState",
@@ -458,17 +512,17 @@ export default {
           label:"实时状态",
         },
         {
-          name:"cbdPhoto",
+          name:"cbdTabPhoto",
           label:"查看图片",
         },
         {
           name:"equipHistoryDate",
           label:"历史数据",
         },
-        // {
-        //   name:"equipState",
-        //   label:"害虫统计",
-        // }
+        {
+          name:"cbdTabPestStat",
+          label:"害虫统计",
+        }
         ],
         "4":[{
           name:"equipState",
@@ -497,14 +551,107 @@ export default {
       },
       // 右侧控制
       sidebarState:false,
+      // 设备列表
+      searchEquipVal:'',
+      equipList:[],
+      equipListCurr:[],
+      equipListActive:'',
+      hackReset:false,
+      equipListloading: false,
     };
   },
   //监听属性 类似于data概念
   computed: {},
   //监控data中的数据变化
-  watch: {},
+  watch: {
+    detailsShow(val){
+      if(val != 0){
+        this.activeName = this.pages[val][0].name
+        this.nowPage = this.pages[val][0].name
+      }else{
+        if(val== 5){
+          this.activeName = 'qxzEquipState'
+          this.nowPage = 'qxzEquipState'
+        }else{
+          this.activeName = 'equipState'
+          this.nowPage = 'equipState'
+        }
+      }
+    }
+  },
   //方法集合
   methods: {
+    getUserEquipType(){
+      this.$axios({
+        method: "POST",
+        url: "/api/api_gateway?method=user.login.user_device_type",
+        data: this.qs.stringify({
+          user_id:this.user_id
+        })
+      }).then(res => {
+        if (res.data.message == "") {
+          this.equipType=[{
+            type:'',
+            name:'全部'
+          }]
+          for(let i of res.data.data.type_list){
+            this.equipType.push({
+              type:i,
+              name:this.equipsTypeSwitch(i)
+            })
+          }
+          
+        } else {
+          this.$message.error(res.data.message);
+        }
+      });
+    },
+    equipsTypeSwitch(i){
+      switch (i) {
+        case '2':
+          return '杀虫灯';
+          break;
+        case '3':
+          return '虫情测报灯';
+          break;
+        case '4':
+          return '性诱测报';
+          break;
+        case '5':
+          return '环境监测';
+          break;
+        case '6':
+          return '监控';
+          break;
+        case '7':
+          return '孢子仪';
+          break;
+        case '9':
+          return '糖醋测报';
+          break;
+        case 2:
+          return '杀虫灯';
+          break;
+        case 3:
+          return '虫情测报灯';
+          break;
+        case 4:
+          return '性诱测报';
+          break;
+        case 5:
+          return '环境监测';
+          break;
+        case 6:
+          return '监控';
+          break;
+        case 7:
+          return '孢子仪';
+          break;
+        case 9:
+          return '糖醋测报';
+          break;
+      }
+    },
     changeMapType(val){
       let o = amapManager.getMap();
       if(val==0){
@@ -519,11 +666,8 @@ export default {
       this.currSelectType = item.type;
       this.currSelectSite = index;
       this.detailsShow = ''
-      this.getEquipList(item.type)
-      console.log(item.type);
-      
-      this.activeName = this.pages[item.type][0].name
-      this.nowPage = this.pages[item.type][0].name
+      this.searchEquipVal = ''
+      this.getEquipList()
     },
     mouseOve(index,item){
       this.equipStyleLeft = 80*index
@@ -558,66 +702,71 @@ export default {
           break;
       }
     },
-    getEquipList(type) {
+    getEquipList() {
+      this.equipListloading = true;
       this.componentMarker.position = []
-      if(this.infoWindow){
-        this.infoWindow.close()
-      }
-      let o = amapManager.getMap();
-      o.setZoom(4);
+      // if(this.infoWindow){
+      //   this.infoWindow.close()
+      // }
+      var equip_type = this.currSelectType || '';
+      this.setZoom = 4;
       this.$axios({
         method: "POST",
         url: "/api/api_gateway?method=home.homes.equip_map_location",
         data: this.qs.stringify({
-          equip_type: type,
+          equip_type: equip_type,
+          device_id:this.searchEquipVal,
+          user_id:this.user_id
         })
       }).then(res => {
         if (res.data.message == "") {
           let data = res.data.data;
           this.equipShow = false;
-          this.equips = data.map(item => {
+          this.equips = data.map((item,index) => {
             this.iconFormat(item.device_type_id, item);
             item.style = item.device_type_id
             if(item.gps_type == 1){ //GPS
-              console.log(wgs84togcj02)
               item.lnglat = wgs84togcj02(item.lng,item.lat)
             }else{
               // this.lnglatFormat(item);
             }
+            item.index = index
             return item;
           });
+          
           if(this.massMarks){
             this.massMarks.clear()
           }
-          console.log(this.equips)
-          this.massMarks = new AMap.MassMarks(this.equips, {
-            zIndex: 199, // 海量点图层叠加的顺序
-            zooms: [3, 19], // 在指定地图缩放级别范围内展示海量点图层
-            style: this.equipStyleObject // 设置样式对象
-          });
-          this.massMarks.setMap(o)
-          var _this = this
-          this.massMarks.on('click',e =>{
-            this.equipMarkerClick(e.data)
-            // this.openInfo(e.data)
-            console.log(e.data)
+          this.$nextTick(()=>{
+            console.log(this.equips)
+            this.equipList = this.equips;
+            this.equipListloading = false;
+            this.equipListCurr = this.equips;
+            this.massMarks = new AMap.MassMarks(this.equips, {
+              zIndex: 199, // 海量点图层叠加的顺序
+              zooms: [3, 19], // 在指定地图缩放级别范围内展示海量点图层
+              style: this.equipStyleObject // 设置样式对象
+            });
+            var o = amapManager.getMap();
+            this.massMarks.setMap(o)
+            this.massMarks.on('click',e =>{
+              this.$nextTick(()=>{
+                document.getElementById("equipListBox").scrollTop = 87*e.data.index;
+                
+                this.equipMarkerClick(e.data)
+              })
+            })
           })
-
-          // this.equipPoints = []
-          // this.equips.forEach((item) =>{
-          //   this.equipPoints.push(new AMap.Marker({
-          //     position: item.lnglat
-          //   }))
-          // }) 
-          // this.$nextTick(()=>{
-          //   o.setFitView(this.equipPoints)
-          // })
         } else {
           this.$message.error(res.data.message);
         }
       });
     },
     equipMarkerClick(item) {
+      this.hackReset = false
+      this.$nextTick(() => {
+        this.hackReset = true
+      })
       this.equipShow = true; //图标上设备信息框
       this.equipsVisible = true; //右侧设备弹框
       this.detailsShow = item.device_type_id; //右侧弹框根据不同设备类型,显示设备信息
@@ -626,7 +775,49 @@ export default {
       this.queryInfo.d_id = item.d_id
       this.queryInfo.type = item.device_type_id
       this.queryInfo.model = item.device_model
+      this.equipListActive = item.index
       this.sidebarComponents = "" //siderbar为空
+      if (item.device_type_id == 6) {
+        //监控
+        this.$axios({
+          url: "/api/api_gateway?method=camera.camera_manage.addr_camera",
+          method: "POST",
+          data: this.qs.stringify({ 
+            device_id: item.device_id,
+           }),
+        }).then((res) => {
+          if (res.data.message == "") {
+            let data = eval("(" + res.data.data + ")");
+            let hlsHd = data.hlsHd;
+            // this.jkSrc = hlsHd
+            // console.log(this.jkSrc)
+            let playHtml = `<video id="myPlayer"  muted autoplay  poster='' controls playsInline  webkit-playsinline src="${hlsHd}"  style="width:100%; height:100%;"></video>`;
+            console.log(hlsHd);
+            document.getElementById("videoCon").innerHTML = playHtml;
+            setTimeout(() => {
+              console.log(document.getElementById("myPlayer"));
+              this.player = new EZUIPlayer("myPlayer");
+              console.log(player);
+              this.player.play();
+              // let player = videojs('myPlayer')
+              // player.src({ src: hlsHd, type: 'application/x-mpegURL' })
+              // player.play()
+            }, 1000);
+          }
+        });
+      }
+    },
+    jkClose(){
+      this.player.stop()
+      this.detailsShow='';
+      console.log(this.player);
+      
+    },
+    jkClose2(){
+      // this.detailsShow='';
+      console.log(this.player);
+      
+      this.player.stop()
     },
      //载玻片、培养液更换时间展示
     setTimeDialogShow(data){
@@ -680,12 +871,16 @@ export default {
   created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
-    // this.getEquipList('')
+    this.user_id = this.$store.state.user_id || sessionStorage.getItem("myuid");
+    this.getUserEquipType()
+    this.changeEquip(0,this.equipType[0])
   },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeMount() {}, //生命周期 - 挂载之前
   beforeUpdate() {}, //生命周期 - 更新之前
-  updated() {}, //生命周期 - 更新之后
+  updated() {
+    
+  }, //生命周期 - 更新之后
   beforeDestroy() {}, //生命周期 - 销毁之前
   destroyed() {}, //生命周期 - 销毁完成
   activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
@@ -775,4 +970,73 @@ export default {
   background-color: #0295ff;
 }
 
+// 监控弹框样式
+.jkDialog{
+  position: fixed;
+  width: 750px;
+  background: #323a47;
+  top: 200px;
+  left: 30%;
+}
+// 设备列表
+.searchEquipBox{
+    padding: 20px;
+    background: #0195ff;
+}
+.equipListBox{
+    position: absolute;
+    left: 0;
+    right: 35px;
+    top: 69px;
+    bottom: 0;
+    overflow: auto;
+  .equipList{
+    // padding: 20px;
+    .equipItem{
+      padding: 10px 7px;
+      cursor: pointer;
+      display: flex;
+      justify-content: space-between;
+      margin: 15px;
+      border: 1px dashed transparent;
+      border-bottom: 1px dashed #ddd;
+      padding-bottom: 10px;
+      color: #8b8b8b;
+      .equipId{
+        line-height: 34px;
+        font-size: 14px;
+        color: #000;
+        font-weight: 700;
+        span{
+          display: inline-block;
+          width: 9px;
+          height: 9px;
+          border-radius: 50%;
+          margin-right: 3px;
+        }
+        span.online{
+          background: #0195ff;
+        }
+        span.offline{
+          background: red;
+        }
+      }
+      .equipCity{
+        text-indent: 16px;
+      }
+      .equipType{
+        line-height: 34px;
+        font-size: 14px;
+        color: #0195ff;
+        font-weight: 700;
+        text-align: right;
+      }
+    }
+    .equipItem.active{
+      border: 1px dashed #0195ff;
+      box-shadow: 0px 0px 5px 1px #39acff;
+    }
+  }
+}
+
 </style>

+ 39 - 23
src/pages/plantGuard/page4.vue

@@ -75,19 +75,19 @@
           <el-table-column prop="expire_time" width="200" label="到期时间">
               <template slot-scope="scope">{{ ( scope.row.expire_time * 1000) | formatTime }}</template>
           </el-table-column>
-          <el-table-column prop label="操作" fixed="right" width="350">
+          <el-table-column prop label="操作" fixed="right" width="450">
             <template slot-scope="scope">
               <el-button type="blueInfo" size="mini" title="一键登录" plain @click="login(scope.row.uid, scope.row.username)">
-                <i class="el-icon-edit"></i>
+                一键登录
               </el-button>
               <el-button type="greenInfo" v-if="scope.row.user_type!=3" size="mini" title="分配设备" plain @click="distribute(scope.row.uid, scope.row.username)">
-                <i class="el-icon-edit"></i>
+                分配设备
               </el-button>
               <el-button type="redInfo" size="mini" title="充值" plain @click="recharge(scope.row.uid)">
-                <i class="el-icon-edit"></i>
+                充值
               </el-button>
               <el-button type="blueInfo" size="mini" title="编辑" plain @click="edit(scope.row)">
-                <i class="el-icon-edit"></i>
+                编辑
               </el-button>
               <template v-if="scope.row.state == 1">
                 <el-button type="greenInfo" size="mini" title="禁用" plain @click="forbidUse(scope.row.uid,4, '确认禁用该用户?')">
@@ -100,7 +100,7 @@
                 </el-button>
               </template>
               <el-button type="blueInfo" size="mini" title="重置密码" plain @click="resetPassword(scope.row.uid, scope.row.username)">
-                <i class="el-icon-edit"></i>
+                重置密码
               </el-button>
             </template>
             
@@ -122,12 +122,13 @@
 			title="添加新用户"
 			:visible.sync="addUserDialogVisible"
 			width="30%"
+			top="180px"
 			@close="addUserDialogClosed"
 		>
 			<el-form
 				ref="addUserFormRef"
 				:model="addUserForm"
-				label-width="80px"
+				label-width="100px"
 				:rules="addUserFormRules"
 			>
 				<el-form-item label="用户名 : " prop="username">
@@ -139,7 +140,10 @@
 				<el-form-item label="密码  : " prop="pass">
 					<el-input type="password" v-model="addUserForm.pass"></el-input>
 				</el-form-item>
-				<el-form-item label="角色类型 : ">
+				<el-form-item label="项目名称 : " prop="projectname">
+					<el-input v-model="addUserForm.projectname"></el-input>
+				</el-form-item>
+				<el-form-item label="角色类型 : " prop="role_id">
 					<el-select
 						style="width: 100%"
 						size="small"
@@ -237,6 +241,7 @@
 			title="用户信息编辑"
 			:visible.sync="editUserDialogVisible"
 			width="500px"
+			top="180px"
 			@close="editUserDialogClosed"
 		>
 			<el-form
@@ -251,6 +256,9 @@
 				<el-form-item label="电话 : " prop="mobile">
 					<el-input v-model="editUserForm.mobile"></el-input>
 				</el-form-item>
+				<el-form-item label="项目名称 : ">
+					<el-input v-model="editUserForm.projectname"></el-input>
+				</el-form-item>
 				<el-form-item label="角色类型 : " prop="role_id">
 					<el-select
 						style="width: 100%"
@@ -410,7 +418,7 @@ export default {
       username: "",
       txtInner:"筛选测试用户",
       userList: [],
-			userGroupList: [],
+		userGroupList: [],
       roleList: [],
       page: 1,
       totalNum: 0,
@@ -418,15 +426,16 @@ export default {
       tets_user: '', //测试用户筛选
       addUserDialogVisible: false,
       addUserForm: {
-				username: '',
-				mobile: '',
-				pass: '',
-				role_id: '',
-				user_type: '',
-				pcd: '',
-				user_area: '',
-				cs_user: false, //1为普通用户
-				user_group_id: '' //用户组id
+			username: '',
+			mobile: '',
+			pass: '',
+			role_id: '',
+			user_type: '',
+			pcd: '',
+			user_area: '',
+			projectname:'',
+			cs_user: false, //1为普通用户
+			user_group_id: '' //用户组id
       },
       cityData,
       areaList: [],//省市县
@@ -447,7 +456,13 @@ export default {
 					{ required: true, trigger: 'blur', message: '手机号不能为空' },
 					{ validator: checkMobile, trigger: 'blur' }
 				],
-				pass: [{ required: true, message: '请填写用户密码', trigger: 'blur' }]
+				pass: [{ required: true, message: '请填写用户密码', trigger: 'blur' }],
+				projectname: [
+					{ required: true, message: '请填写项目名称', trigger: 'blur' }
+				],
+				role_id:[
+					{ required: true, message: '请选择角色类型', trigger: 'blur' }
+				]
 			},
 			//重置密码格规则
 			resetPassFormRules: {
@@ -608,6 +623,7 @@ export default {
 						pcd: this.addUserForm.pcd,
 						user_area: this.addUserForm.user_area,
 						user_group_id: this.addUserForm.user_group_id,
+						projectname:this.addUserForm.projectname,
 						cs_user
 					})
 				}).then((res) => {
@@ -657,6 +673,7 @@ export default {
 					user_type: this.editUserForm.user_type,
 					pcd: this.editUserForm.pcd,
 					user_area: this.editUserForm.user_area,
+					projectname:this.editUserForm.projectname,
 					user_group_id: this.editUserForm.user_group_id=='0'?'':this.editUserForm.user_group_id
 				})
 			}).then((res) => {
@@ -741,10 +758,9 @@ export default {
 			})
 	},
 	distribute(id, username) {
-		this.$router.push({
-			name: 'page5',
-			params: {id:id, username: username }
-		})
+		this.$store.state.allo_equip_user_id = id
+		this.$store.state.allo_equip_usename = username
+		this.$router.push('page5')
 	},
 	recharge(id) {
 			this.$confirm('是否向该用户充值一年费用?', '信息', {

+ 3 - 3
src/pages/plantGuard/page5.vue

@@ -123,7 +123,7 @@
             />
           </div>
           <div class="userTip">
-            *注:以上所选设备分配给用户:{{ this.$route.params.username }}
+            *注:以上所选设备分配给用户:{{ this.$store.state.allo_equip_usename }}
           </div>
           <el-pagination
             v-if="dataList.length > 0"
@@ -144,7 +144,7 @@ export default {
   data() {
     return {
       zanwu: "/images/expertDiagnosis/zanwu.png",
-      uid: this.$route.params.id,
+      uid: this.$store.state.allo_equip_user_id,
       timeRange: "",
       equipId: "",
       begin: "",
@@ -221,7 +221,7 @@ export default {
       }).then((res) => {
         if (res.data.message == "") {
           this.$message.success("分配设备成功!");
-          this.$router.go(-1);
+          // this.$router.go(-1);
         }
       });
     },

+ 102 - 4
src/pages/plantGuard/page6.vue

@@ -76,15 +76,16 @@
             title="分配权限"
             :visible.sync="setRightDialogVisible"
             width="50%"
+            top="180px"
             @close="setRightDialogClosed"
           > 
-            <div style="height:500px;overflow-y:scroll">
+            <div style="height:500px;overflow-y:auto">
               <el-tree
               :data="rightsList"
               :props="treeProps"
               ref="treeRef"
               show-checkbox
-              node-key="pur_id"
+              node-key="id"
               default-expand-all
               :default-checked-keys="defKeys"
               ></el-tree>
@@ -108,12 +109,109 @@
             editRoleDialogVisible:false,
             setRightDialogVisible:false,
             roleList:[],
+            menuList: [
+               {
+                  name: "数据监测",
+                  id: "1",
+                  children: [
+                     {
+                     name: "设备列表",
+                     path: "/page1",
+                     id: "11"
+                     },
+                  ]
+               },
+               {
+                  name: "可视化系统",
+                  id: "8",
+                  children: [
+                     {
+                     name: "可视化系统",
+                     path: "/monitor",
+                     id: "88"
+                     }
+                  ]
+               },
+               {
+                  name: "智能灌溉系统",
+                  id: "2",
+                  children: [
+                     {
+                     name: "系统管理",
+                     path: "/page3",
+                     id: "22"
+                     }
+                  ]
+               },
+               {
+                  name: "农业水价改革",
+                  id: "3",
+                  children: [
+                     {
+                     name: "设备列表",
+                     path: "/page1"
+                     }
+                  ]
+               },
+               {
+                  name: "农业地理信息",
+                  id: "4",
+                  children: [
+                     {
+                     name: "设备列表",
+                     path: "/page1"
+                     }
+                  ]
+               },
+               {
+                  name: "农产品追溯",
+                  id: "5",
+                  children: [
+                     {
+                     name: "设备列表",
+                     path: "/page1"
+                     }
+                  ]
+               },
+               {
+                  name: "系统管理",
+                  id: "6",
+                  children: [
+                     {
+                     name: "用户管理",
+                     path: "/page4",
+                     id: "22"
+                     },
+                     {
+                     name: "角色管理",
+                     path: "/page6",
+                     id: "22"
+                     },
+                     {
+                     name: "主题定制",
+                     path: "/page7",
+                     id: "22"
+                     },
+                  ]
+               },
+               {
+                  name: "设备管理",
+                  id: "6",
+                  children: [
+                     {
+                     name: "设备列表",
+                     path: "/page8",
+                     id: "22"
+                     }
+                  ]
+               }
+            ],
             rightsList:[],
             // 当前即将分配权限的Id
             roleId:'',
             //  树形控件的属性绑定对象
             treeProps: {
-               label: 'purview_name',
+               label: 'name',
                children: 'children'
             },
             //  默认选中节点ID值
@@ -227,7 +325,7 @@
          },
          getLeafkeys(node,arr){
             if(!node.children){
-               return arr.push(node.pur_id) 
+               return arr.push(node.id) 
             }
             node.children.forEach(item=>this.getLeafkeys(item,arr))
          },

+ 277 - 244
src/pages/plantGuard/page8.vue

@@ -1,246 +1,248 @@
-<!-- 主题订制 -->
+<!-- 设备管理 -->
 <template>
-  <div style="cursor: default">
-    <el-breadcrumb separator-class="el-icon-arrow-right">
-      <el-breadcrumb-item>设备管理</el-breadcrumb-item>
-      <el-breadcrumb-item>设备列表</el-breadcrumb-item>
-    </el-breadcrumb>
-    <div class="search-box">
-      <div class="filter-box">
-        <el-select
-          size="small"
-          v-model="queryInfo.device_type_id"
-          clearable
-          placeholder="请选择设备类型"
-          @change="searchChange()"
-        >
-          <el-option label="杀虫灯" value="2"></el-option>
-          <el-option label="测报灯" value="3"></el-option>
-          <el-option label="智能性诱" value="4"></el-option>
-          <el-option label="环境监测" value="5"></el-option>
-          <el-option label="监控设备" value="6"></el-option>
-          <el-option label="孢子仪" value="7"></el-option>
-          <el-option label="性诱设备" value="8"></el-option>
-          <el-option label="糖醋测报" value="9"></el-option>
-        </el-select>
-        <el-input
-          style="cursor: pointer"
-          size="small"
-          clearable
-          @change="searchChange()"
-          placeholder="请输入设备ID"
-          v-model="queryInfo.f_id"
-        >
-          <i slot="suffix" class="el-input__icon el-icon-search"></i>
-        </el-input>
-      </div>
-      <el-date-picker
-        style="cursor: pointer"
-        size="small"
-        @change="DateChange()"
-        v-model="timeRange"
-        type="daterange"
-        range-separator="至"
-        start-placeholder="开始日期"
-        end-placeholder="结束日期"
-      ></el-date-picker>
-    </div>
-    <el-row :gutter="10">
-      <el-col
-        :xs="24"
-        :sm="24"
-        :md="12"
-        :lg="6"
-        :xl="4"
-        v-for="item in dataList"
-        :key="item.id"
-      >
-        <el-card class="box-card pad0">
-          <i class="del-icon el-icon-delete" @click="delEquip(item.d_id)"></i>
-          <div class="img-box">
-            <template v-if="item.device_type_id == '2'">
-              <img src="@/assets/images/equipdistribute/scdIconOn.png" />
-              <p>杀虫灯</p>
-            </template>
-            <template v-if="item.device_type_id == '3'">
-              <img src="@/assets/images/equipdistribute/cbdIconOn.png" />
-              <p>测报灯</p>
-            </template>
-            <template v-if="item.device_type_id == '4'">
-              <img src="@/assets/images/equipdistribute/znxyOn.png" />
-              <p>智能性诱</p>
-            </template>
-            <template v-if="item.device_type_id == '5'">
-              <img src="@/assets/images/equipdistribute/hjjcIconOn.png" />
-              <p>环境监测</p>
-            </template>
-            <template v-if="item.device_type_id == '6'">
-              <img src="@/assets/images/equipdistribute/jkIconOn.png" />
-              <p>监控设备</p>
-            </template>
-            <template v-if="item.device_type_id == '7'">
-              <img src="@/assets/images/equipdistribute/bzyIconOn.png" />
-              <p>孢子仪</p>
-            </template>
-            <template v-if="item.device_type_id == '8'">
-              <img src="@/assets/images/equipdistribute/xyOn.png" />
-              <p>性诱设备</p>
-            </template>
-            <template v-if="item.device_type_id == 9">
-              <img src="@/assets/images/equipdistribute/tccbOn.png" />
-              <p>糖醋测报</p>
-            </template>
+  <div class="innerMargin">
+      <el-card class="box-card">
+        <div style="cursor: default">
+          <div class="search-box">
+            <div class="filter-box">
+              <el-select
+                size="small"
+                v-model="queryInfo.device_type_id"
+                clearable
+                placeholder="请选择设备类型"
+                @change="searchChange()"
+              >
+                <el-option label="杀虫灯" value="2"></el-option>
+                <el-option label="测报灯" value="3"></el-option>
+                <el-option label="智能性诱" value="4"></el-option>
+                <el-option label="环境监测" value="5"></el-option>
+                <el-option label="监控设备" value="6"></el-option>
+                <el-option label="孢子仪" value="7"></el-option>
+                <el-option label="性诱设备" value="8"></el-option>
+                <el-option label="糖醋测报" value="9"></el-option>
+              </el-select>
+              <el-input
+                style="cursor: pointer"
+                size="small"
+                clearable
+                @change="searchChange()"
+                placeholder="请输入设备ID"
+                v-model="queryInfo.f_id"
+              >
+                <i slot="suffix" class="el-input__icon el-icon-search"></i>
+              </el-input>
+            </div>
+            <el-date-picker
+              style="cursor: pointer"
+              size="small"
+              @change="DateChange()"
+              v-model="timeRange"
+              type="daterange"
+              range-separator="至"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+            ></el-date-picker>
           </div>
-          <div class="detail">
-            <p>
-              设备ID
-              <span>{{ item.device_id }}</span>
-            </p>
-            <p>
-              适配用户
-              <span>{{ item.device_user || "无" }}</span>
-            </p>
-            <p>
-              设备名称
-              <span>{{ item.device_name || "无" }}</span>
-            </p>
-            <p>
-              位置
-              <span>{{ item.device_location || "无" }}</span>
-            </p>
-            <p>
-              设备添加时间
-              <span>{{ (item.creat_time * 1000) | formatTime }}</span>
-            </p>
+          <el-row :gutter="10">
+            <el-col
+              :xs="24"
+              :sm="24"
+              :md="12"
+              :lg="6"
+              :xl="4"
+              v-for="item in dataList"
+              :key="item.id"
+            >
+              <el-card class="box-card pad0">
+                <i class="del-icon el-icon-delete" @click="delEquip(item.d_id)"></i>
+                <div class="img-box">
+                  <template v-if="item.device_type_id == '2'">
+                    <img src="@/assets/images/equipdistribute/scdIconOn.png" />
+                    <p>杀虫灯</p>
+                  </template>
+                  <template v-if="item.device_type_id == '3'">
+                    <img src="@/assets/images/equipdistribute/cbdIconOn.png" />
+                    <p>测报灯</p>
+                  </template>
+                  <template v-if="item.device_type_id == '4'">
+                    <img src="@/assets/images/equipdistribute/znxyOn.png" />
+                    <p>智能性诱</p>
+                  </template>
+                  <template v-if="item.device_type_id == '5'">
+                    <img src="@/assets/images/equipdistribute/hjjcIconOn.png" />
+                    <p>环境监测</p>
+                  </template>
+                  <template v-if="item.device_type_id == '6'">
+                    <img src="@/assets/images/equipdistribute/jkIconOn.png" />
+                    <p>监控设备</p>
+                  </template>
+                  <template v-if="item.device_type_id == '7'">
+                    <img src="@/assets/images/equipdistribute/bzyIconOn.png" />
+                    <p>孢子仪</p>
+                  </template>
+                  <template v-if="item.device_type_id == '8'">
+                    <img src="@/assets/images/equipdistribute/xyOn.png" />
+                    <p>性诱设备</p>
+                  </template>
+                  <template v-if="item.device_type_id == 9">
+                    <img src="@/assets/images/equipdistribute/tccbOn.png" />
+                    <p>糖醋测报</p>
+                  </template>
+                </div>
+                <div class="detail">
+                  <p>
+                    设备ID
+                    <span>{{ item.device_id }}</span>
+                  </p>
+                  <p>
+                    适配用户
+                    <span>{{ item.device_user || "无" }}</span>
+                  </p>
+                  <p>
+                    设备名称
+                    <span>{{ item.device_name || "无" }}</span>
+                  </p>
+                  <p>
+                    位置
+                    <span>{{ item.device_location || "无" }}</span>
+                  </p>
+                  <p>
+                    设备添加时间
+                    <span>{{ (item.creat_time * 1000) | formatTime }}</span>
+                  </p>
+                </div>
+                <div class="bottom">
+                  <span @click="modifyName(item.device_id, item.device_name)">
+                    <i class="el-icon-edit-outline"></i> 修改名称
+                  </span>
+                  <span @click="addPosition(item.device_id, item.lng, item.lat)">
+                    <i class="el-icon-location-outline"></i> 添加位置
+                  </span>
+                  <span @click="addFault(item.device_id, item.device_type_id)">
+                    <i class="el-icon-edit-outline"></i> 故障上报
+                  </span>
+                </div>
+              </el-card>
+            </el-col>
+          </el-row>
+          <!-- 暂无数据 -->
+          <div class="expertDiagnosis_referral_units_not" v-if="dataList.length <= 0">
+            <img
+              :src="$imghost + zanwu"
+              alt
+              class="expertDiagnosis_referral_units_notImg"
+            />
           </div>
-          <div class="bottom">
-            <span @click="modifyName(item.device_id, item.device_name)">
-              <i class="el-icon-edit-outline"></i> 修改名称
-            </span>
-            <span @click="addPosition(item.device_id, item.lng, item.lat)">
-              <i class="el-icon-location-outline"></i> 添加位置
-            </span>
-            <span @click="addFault(item.device_id, item.device_type_id)">
-              <i class="el-icon-edit-outline"></i> 故障上报
+          <el-pagination
+            v-if="dataList.length > 0"
+            background
+            layout="prev, pager, next"
+            :page-size="12"
+            :total="totalNum"
+            @current-change="changePage"
+          ></el-pagination>
+          <!-- 添加定位弹框 -->
+          <el-dialog
+            class="map_dialog"
+            title="添加定位"
+            v-if="addLocationDialogVisible"
+            :visible.sync="addLocationDialogVisible"
+            width="800px"
+            top="180px"
+            @closed="addLocationDialogClosed"
+          >
+            <el-form
+              :inline="true"
+              :model="locationForm"
+              class="demo-form-inline"
+              size="mini"
+            >
+              <el-form-item label="经度">
+                <el-input clearable v-model="locationForm.lng"></el-input>
+              </el-form-item>
+              <el-form-item label="维度">
+                <el-input clearable v-model="locationForm.lat"></el-input>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" size="mini" @click="locationSearch"
+                  >定位</el-button
+                >
+              </el-form-item>
+              <el-form-item label="">
+                <el-input
+                  placeholder="请输入地区检索"
+                  v-model="addr"
+                  clearable
+                  @change="addrChange()"
+                ></el-input>
+              </el-form-item>
+            </el-form>
+            <el-amap
+              class="bm-view"
+              vid="amapDemo"
+              :center="center"
+              :amap-manager="amapManager"
+              :zoom="mapZoom"
+              :plugin="plugin"
+              :events='mapEvents'
+            >
+              <el-amap-marker vid="component-marker" v-if="point.length" :position="point"  ></el-amap-marker>
+            </el-amap>
+            <!-- <baidu-map
+              class="Bmap"
+              :center="center"
+              :zoom="mapZoom"
+              :scroll-wheel-zoom="true"
+              @ready="handlerBMap"
+              @click="locationPoint"
+            >
+              <bm-marker :position="point" :dragging="true"></bm-marker>
+            </baidu-map> -->
+            <span slot="footer" class="dialog-footer">
+              <el-button @click="addLocationDialogVisible = false">取 消</el-button>
+              <el-button type="primary" @click="addLocationSubm">确 定</el-button>
             </span>
-          </div>
-        </el-card>
-      </el-col>
-    </el-row>
-    <!-- 暂无数据 -->
-    <div class="expertDiagnosis_referral_units_not" v-if="dataList.length <= 0">
-      <img
-        :src="$imghost + zanwu"
-        alt
-        class="expertDiagnosis_referral_units_notImg"
-      />
-    </div>
-    <el-pagination
-      v-if="dataList.length > 0"
-      background
-      layout="prev, pager, next"
-      :page-size="12"
-      :total="totalNum"
-      @current-change="changePage"
-    ></el-pagination>
-    <!-- 添加定位弹框 -->
-    <el-dialog
-      class="map_dialog"
-      title="添加定位"
-      v-if="addLocationDialogVisible"
-      :visible.sync="addLocationDialogVisible"
-      width="800px"
-      @closed="addLocationDialogClosed"
-    >
-      <el-form
-        :inline="true"
-        :model="locationForm"
-        class="demo-form-inline"
-        size="mini"
-      >
-        <el-form-item label="经度">
-          <el-input clearable v-model="locationForm.lng"></el-input>
-        </el-form-item>
-        <el-form-item label="维度">
-          <el-input clearable v-model="locationForm.lat"></el-input>
-        </el-form-item>
-        <el-form-item>
-          <el-button type="primary" size="mini" @click="locationSearch"
-            >定位</el-button
+          </el-dialog>
+          <!-- 故障上报  -->
+          <el-dialog
+            class="map_dialog"
+            title="故障上报"
+            v-if="addFaultDialogVisible"
+            :visible.sync="addFaultDialogVisible"
+            width="500px"
+            top="180px"
+            @closed="addLocationDialogClosed"
           >
-        </el-form-item>
-        <el-form-item label="">
-          <el-input
-            placeholder="请输入地区检索"
-            v-model="addr"
-            clearable
-            @change="addrChange()"
-          ></el-input>
-        </el-form-item>
-      </el-form>
-      <el-amap
-        class="bm-view"
-        vid="amapDemo"
-        :center="center"
-        :amap-manager="amapManager"
-        :zoom="mapZoom"
-        :plugin="plugin"
-        :events='mapEvents'
-      >
-        <el-amap-marker vid="component-marker" v-if="point.length" :position="point"  ></el-amap-marker>
-      </el-amap>
-      <!-- <baidu-map
-        class="Bmap"
-        :center="center"
-        :zoom="mapZoom"
-        :scroll-wheel-zoom="true"
-        @ready="handlerBMap"
-        @click="locationPoint"
-      >
-        <bm-marker :position="point" :dragging="true"></bm-marker>
-      </baidu-map> -->
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="addLocationDialogVisible = false">取 消</el-button>
-        <el-button type="primary" @click="addLocationSubm">确 定</el-button>
-      </span>
-    </el-dialog>
-    <!-- 故障上报  -->
-    <el-dialog
-      class="map_dialog"
-      title="故障上报"
-      v-if="addFaultDialogVisible"
-      :visible.sync="addFaultDialogVisible"
-      width="500px"
-      @closed="addLocationDialogClosed"
-    >
-      <el-form
-        ref="editFaultform"
-        :rules="editFaultrules"
-        :model="editFault"
-        label-width="80px"
-      >
-        <el-form-item label="设备ID">
-          <el-input v-model="editFault.imei" disabled></el-input>
-        </el-form-item>
-        <el-form-item label="联系人" prop="user">
-          <el-input v-model="editFault.user"></el-input>
-        </el-form-item>
-        <el-form-item label="联系电话" prop="tel">
-          <el-input
-            type="text"
-            maxlength="11"
-            v-model="editFault.tel"
-          ></el-input>
-        </el-form-item>
-        <el-form-item label="故障原因" prop="detail">
-          <el-input type="textarea" v-model="editFault.detail"></el-input>
-        </el-form-item>
-      </el-form>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="addFaultDialogVisible = false">取 消</el-button>
-        <el-button type="primary" @click="addFaultSubm">确 定</el-button>
-      </span>
-    </el-dialog>
+            <el-form
+              ref="editFaultform"
+              :rules="editFaultrules"
+              :model="editFault"
+              label-width="80px"
+            >
+              <el-form-item label="设备ID">
+                <el-input v-model="editFault.imei" disabled></el-input>
+              </el-form-item>
+              <el-form-item label="联系人" prop="user">
+                <el-input v-model="editFault.user"></el-input>
+              </el-form-item>
+              <el-form-item label="联系电话" prop="tel">
+                <el-input
+                  type="text"
+                  maxlength="11"
+                  v-model="editFault.tel"
+                ></el-input>
+              </el-form-item>
+              <el-form-item label="故障原因" prop="detail">
+                <el-input type="textarea" v-model="editFault.detail"></el-input>
+              </el-form-item>
+            </el-form>
+            <span slot="footer" class="dialog-footer">
+              <el-button @click="addFaultDialogVisible = false">取 消</el-button>
+              <el-button type="primary" @click="addFaultSubm">确 定</el-button>
+            </span>
+          </el-dialog>
+        </div>
+      </el-card>
   </div>
 </template>
 
@@ -343,13 +345,23 @@ export default {
         tel: { required: true, validator: checkphone, trigger: "blur" },
         detail: { required: true, message: "请输入故障原因", trigger: "blur" },
       },
+      prompt:'',
     };
   },
   mounted() {
     this.getList();
+    // window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
   },
   beforeMount() {},
   methods: {
+     beforeunloadHandler (e) {
+       alert(1)
+      e = e || window.event
+      if (e) {
+        e.returnValue = '关闭提示'
+      }
+      return '关闭提示'
+    },
     //获取设备列表
     getList() {
       this.$axios({
@@ -420,10 +432,19 @@ export default {
     // 修改设备名称
     modifyName(id, device_name) {
       let value = device_name;
-      this.$prompt("", "修改名字", {
+      this.prompt = this.$prompt("", "修改名字", {
+        customClass: 'picc-message-box', // 必填
+        cancelButtonClass:'cancelPromptButton',
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        inputPlaceholder: device_name,
+        inputPlaceholder: '请输入设备名称',
+        inputErrorMessage: '输入不能为空',
+        inputValidator: (value)=>{
+          if(value.trim().length < 1){
+                return '输入不能为空'
+            }
+        },
+        inputValue: device_name,
       })
         .then(({ value }) => {
           if (value) {
@@ -447,14 +468,16 @@ export default {
             this.$message({
               type: "info",
               message: "内容不能为空",
+              duration:0
             });
+            return false;
           }
         })
         .catch(() => {
-          this.$message({
-            type: "info",
-            message: "取消输入",
-          });
+          // this.$message({
+          //   type: "info",
+          //   message: "取消输入",
+          // });
         });
     },
     //通过经纬度搜索定位
@@ -603,6 +626,16 @@ export default {
         });
     },
   },
+  destroyed() {
+    this.timer = setTimeout(function() {
+      let closeBtn = document.body.getElementsByClassName("cancelPromptButton")[0]
+      if(closeBtn){
+        closeBtn.click()
+      }
+    })
+    // window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
+
+  }
 };
 </script>
 

+ 75 - 17
src/router/index.js

@@ -60,8 +60,8 @@ const TcDataPhotos = () => import( /* webpackChunkName: "tccb" */ '@/Pages/forec
 
 
 //---------------------------------------监控模块---------------------------监控-------------------------
-const Monitor = () => import( /* webpackChunkName: "monitor" */ '@/Pages/monitor/monitorSystem/Monitor')
-const PhotoView = () => import( /* webpackChunkName: "monitor" */ '@/Pages/monitor/monitorSystem/PhotoView')
+// const Monitor = () => import( /* webpackChunkName: "monitor" */ '@/Pages/monitor/monitorSystem/Monitor')
+// const PhotoView = () => import( /* webpackChunkName: "monitor" */ '@/Pages/monitor/monitorSystem/PhotoView')
 
 //---------------------------------------防治模块---------------------------杀虫灯-------------------------
 const Scd = () => import( /* webpackChunkName: "scd" */ '@/Pages/cure/scd/scd')
@@ -134,7 +134,16 @@ const Page4 = () => import('@/Pages/plantGuard/page4') //系统管理-用户管
 const Page5 = () => import('@/Pages/plantGuard/page5') //系统管理-设备分配
 const Page6 = () => import('@/Pages/plantGuard/page6') //系统管理-角色管理
 const Page7 = () => import('@/Pages/plantGuard/page7') //系统管理-主题定制
-const Page8 = () => import('@/Pages/plantGuard/page8') //设备管理-设备列表
+const Page8 = () => import('@/Pages/plantGuard/page8') //设备管理-设备列表 
+const CbdPhoto = () => import('@/Pages/plantGuard/cbdphoto/cbdphoto') //测报灯图片
+const CbdPestStats = () => import('@/Pages/plantGuard/cbdPestStats') //测报灯图片
+const Monitor = () => import('@/Pages/monitor/monitorSystem/Monitor')
+const BaseAll = () => import('@/Pages/plantGuard/baseAll') //管理员查看项目基地
+const PhotoView = () => import( /* webpackChunkName: "monitor" */ '@/Pages/monitor/monitorSystem/PhotoView')
+
+const Page9 = () => import('@/Pages/plantGuard/page9') //水价管理-地图展示
+const Page10 = () => import('@/Pages/plantGuard/page10') //水价管理-地图展示
+const Page11 = () => import('@/Pages/plantGuard/page11') //水价管理-地图展示
 
 Vue.use(Router)
 
@@ -154,6 +163,12 @@ export default new Router({
       component: PlantGuard,
       children:[
         {
+          path: 'baseAll',
+          name: 'BaseAll',
+          component: BaseAll,
+          meta: { title: '数据监测',order:1,navname: '项目基地', }
+        },
+        {
           path: 'page1',
           name:'page1',
           component: Page1,
@@ -169,38 +184,81 @@ export default new Router({
           path: 'page3',
           name: 'page3',
           component: Page3,
-          meta: { title: '智能灌溉系统',order:1 ,navname:'系统管理',}
+          meta: { title: '智能灌溉系统',order:2 ,navname:'系统管理',}
         },
         {
           path: 'page4',
           name: 'page4',
           component: Page4,
-          meta: { title: '系统管理',order:5, navname: '用户管理',}
+          meta: { title: '系统管理',order:6, navname: '用户管理',}
         },
         {
           path: 'page5',
           name: 'page5',
           component: Page5,
-          meta: { title: '系统管理',order:5,navname: '设备分配', }
+          meta: { title: '系统管理',order:6,navname: '设备分配', }
         },
         {
           path: 'page6',
           name: 'page6',
           component: Page6,
-          meta: { title: '系统管理',order:5,navname: '角色管理', }
+          meta: { title: '系统管理',order:6,navname: '角色管理', }
         },
         {
           path: 'page7',
           name: 'page7',
           component: Page7,
-          meta: { title: '系统管理',order:5,navname: '主题定制', }
+          meta: { title: '系统管理',order:6,navname: '主题定制', }
         },
         {
           path: 'page8',
           name: 'page8',
           component: Page8,
-          meta: { title: '设备管理',order:6,navname: '设备列表', }
+          meta: { title: '设备管理',order:7,navname: '设备管理', }
+        },
+        {
+          path: 'cbdPhoto',
+          name: 'cbdPhoto',
+          component: CbdPhoto,
+          meta: { title: '',order:0,navname: '测报灯图片', }
+        },
+        {
+          path: 'cbdPestStats',
+          name: 'CbdPestStats',
+          component: CbdPestStats,
+          meta: { title: '',order:0,navname: '害虫统计', }
         },
+        {
+          path: 'monitor',
+          name: 'Monitor',
+          component: Monitor,
+          meta: { title: '',order:1,navname: '可视化系统', }
+        },
+        {
+          path: 'photoView/:id',
+          name: 'PhotoView',
+          component: PhotoView,
+          meta: { title: '',order:0,navname: '图片详情', }
+        },
+        {
+          path: 'page9',
+          name: 'page9',
+          component: Page9,
+          meta: { title: '水价管理',order:3,navname: '地图展示', }
+        },
+        {
+          path: 'page10',
+          name: 'page10',
+          component: Page10,
+          meta: { title: '水价管理',order:3,navname: '水井信息', }
+        },
+        {
+          path: 'page11',
+          name: 'page11',
+          component: Page11,
+          meta: { title: '水价管理',order:3,navname: '用户信息', }
+        },
+        
       ]
     },
     // -----------------大数据平台------------------------ 
@@ -297,14 +355,14 @@ export default new Router({
           component: MessageWarn
         },
         //------------------测报模块-------------监控-------------
-        {
-          path: 'monitor',
-          component: Monitor,
-        },
-        {
-          path: 'photoView/:id',
-          component: PhotoView
-        },
+        // {
+        //   path: 'monitor',
+        //   component: Monitor,
+        // },
+        // {
+        //   path: 'photoView/:id',
+        //   component: PhotoView
+        // },
         //------------------测报模块-------------孢子仪-------------
         {
           path: 'bzy',