xsh пре 1 година
родитељ
комит
bdac626ea4
35 измењених фајлова са 1414 додато и 241 уклоњено
  1. 7 5
      public/static/dahua/index.html
  2. 127 10
      src/components/HeaderElement.vue
  3. 1 1
      src/components/SideMenu.vue
  4. 0 18
      src/components/erp/ProductionDonut.vue
  5. 3 3
      src/main.js
  6. 30 0
      src/router/ChildrenRouters.js
  7. 2 2
      src/store/index.js
  8. 127 1
      src/utils/api.js
  9. 15 15
      src/utils/chenApi.js
  10. 21 19
      src/utils/http.js
  11. 9 7
      src/views/BioSafety/BenconAdmin.vue
  12. 12 10
      src/views/BioSafety/CarAdmin.vue
  13. 8 5
      src/views/BioSafety/DeadPig.vue
  14. 9 7
      src/views/BioSafety/DoorAdmin.vue
  15. 36 20
      src/views/BioSafety/PersonAdmin.vue
  16. 9 8
      src/views/BioSafety/SaleAdmin.vue
  17. 17 14
      src/views/BioSafety/personAdmin/AddOrEdit.vue
  18. 13 13
      src/views/BioSafety/personAdmin/queryCondition.config.js
  19. 12 6
      src/views/DeviceMana/device/AddOrEdit.vue
  20. 3 3
      src/views/Env/DrinkWater.vue
  21. 4 4
      src/views/Env/PigHouseEnv.vue
  22. 1 1
      src/views/Env/chart/ChartStarkBar.vue
  23. 1 0
      src/views/MainLayout.vue
  24. 12 6
      src/views/PdcData/Analysis.vue
  25. 19 5
      src/views/PdcData/analysis/ChartInventoryLines.vue
  26. 2 1
      src/views/PdcData/analysis/ChartInventoryPie.vue
  27. 52 25
      src/views/PdcData/analysis/SalesChart.vue
  28. 1 0
      src/views/SystemAdmin/AuthAdmin.vue
  29. 91 6
      src/views/SystemAdmin/UserAdmin.vue
  30. 291 0
      src/views/Video/FunctionArea.vue
  31. 271 0
      src/views/Video/FunctionMonit.vue
  32. 31 1
      src/views/Video/VideoAdmin.vue
  33. 113 0
      src/views/Video/VideoBack.vue
  34. 14 1
      src/views/Video/VideoLook.vue
  35. 50 24
      src/views/dashboard/chart/ChartPig.vue

+ 7 - 5
public/static/dahua/index.html

@@ -22,17 +22,19 @@
   </body>
   <script type="module">
     import WSPlayer from "./src/WSPlayer/WSPlayer.js";
+    let url = location.href;
+    console.log(url)
+    let rtsps = url.split("?")[1];
+    let token = url.split("?")[2];
+    let serveIp = url.split('?')[3];
+    let rtsp = rtsps + "?" + token;
     let recordPlayer = new WSPlayer({
       el: "ws-record-player", // 必传
       type: "record", // real | record
-      serverIp: "36.26.62.70",
+      serverIp: serveIp,
       num: 1,
       showControl: true,
     });
-    let url = location.href;
-    let rtsps = url.split("?")[1];
-    let token = url.split("?")[2];
-    let rtsp = rtsps + "?" + token;
     recordPlayer.playRecord({
       rtspURL: rtsp, // String | Array[String] 可以传入多个rtsp地址,将会按照顺序在播放器中播放,最多播放四个
       decodeMode: "canvas", // 解码方式, video|canvas 可以不传,自动识别,h264使用video播放,265使用canvas播放

+ 127 - 10
src/components/HeaderElement.vue

@@ -46,6 +46,7 @@
                       <span class="user-right">账户设置</span>
                     </div>
                     <el-divider></el-divider>
+                    <el-button type="text" @click="dialogVisible = true">修改密码</el-button>
 <!--                    <ul>-->
 <!--                      <li>职位: <span class="user-color">厂长</span></li>-->
 <!--                      <li>本次登录: <span class="user-color">厂长</span></li>-->
@@ -91,12 +92,37 @@
         </div>
       </el-col>
     </el-row>
+    <el-dialog
+      title="修改密码"
+      ref="passForms"
+      width="30%"
+      :visible.sync="dialogVisible"
+      @close="passReset"
+    >
+      <div>
+        <el-form :model="passWordForm" :rules="passWordRules" label-width="80px" ref="passForms">
+          <el-form-item label="原密码" prop="password">
+            <el-input type="password" v-model="passWordForm.password"></el-input>
+          </el-form-item>
+          <el-form-item label="新密码" prop="onePassWord">
+            <el-input type="password" v-model="passWordForm.onePassWord"></el-input>
+          </el-form-item>
+          <el-form-item label="确认密码" prop="checkPass">
+            <el-input type="password" v-model="passWordForm.checkPass" autocomplete="off"></el-input>
+          </el-form-item>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+                <el-button @click="passReset">取 消</el-button>
+                <el-button type="primary" @click="onPassSubmit('passForms')">保 存</el-button>
+              </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { mapState, mapActions } from 'vuex'
-import { findUpdate, getFarmId } from '../utils/api';
+import {findUpdate, getFarmId, findOne, editPassWord} from '../utils/api';
 import { Chrome } from 'vue-color';
 import { Debounce } from "../utils";
 
@@ -125,8 +151,54 @@ export default {
     }
   },
   data() {
+    let validPassword=(rule,value,callback)=>{
+      let reg= /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/
+      if(!reg.test(value)){callback(new Error('密码必须是字母+数字组合6-16位密码'))
+      }else{
+        callback()
+      }
+    };
+    let validatePass2 = (rule, value, callback) => {
+      if (value === '') {
+        callback(new Error('请再次输入密码'));
+      } else if (value !== this.passWordForm.onePassWord) {
+        callback(new Error('两次输入密码不一致!'));
+      } else {
+        callback();
+      }
+    };
+    let validatePass3 = (rule, value, callback) => {
+      let password = localStorage.getItem('password')
+      if(value === '') {
+        callback(new Error('请输入原密码'));
+      } else if (value !== password) {
+        callback(new Error('原密码错误!'));
+      } else {
+        callback();
+      }
+    }
     return {
       getFarmList: [],
+      dialogVisible: false,
+      passWordForm: {
+        account: '',
+        password: '',
+        onePassWord: '',
+        checkPass: ''
+      },
+      passWordRules: {
+        password: [
+          { validator: validatePass3, trigger: 'blur' }
+        ],
+        onePassWord: [
+          { validator: validPassword, trigger: 'blur' }
+        ],
+        checkPass: [
+          { validator: validatePass2, trigger: 'blur' }
+        ],
+      },
+      account: '',
+      password: '',
     }
   },
   methods: {
@@ -138,7 +210,9 @@ export default {
         color: data.hex
       }
       findUpdate(params).then(res => {
-        console.log(res)
+        if(res.code === 10000) {
+          console.log(res)
+        }
       })
     }),
     changeMode(val) {
@@ -156,16 +230,26 @@ export default {
       localStorage.removeItem('accessToken');
       localStorage.removeItem('UserId');
       localStorage.removeItem('lastFarmId')
+      localStorage.removeItem('password')
       this.$router.replace('/login');
     },
     // 拿到farmid
     init() {
-      getFarmId().then(res => {
-        if(res.code === 10000) {
+      getFarmId({}).then(res => {
+        console.log(res)
+        if(res.code == 10000) {
           this.setFarmIdAsync(res.data);
           localStorage.setItem('lastFarmId', res.data);
         }
       })
+      let params = {
+        id: localStorage.getItem('UserId'),
+      }
+      findOne(params).then(res => {
+          if(res.code == 10000) {
+            localStorage.setItem('password', res.data.password);
+          }
+      })
     },
     // 选择牧场
     onChange(val) {
@@ -175,18 +259,51 @@ export default {
       }
       localStorage.setItem('lastFarmId', val)
       findUpdate(params).then(res => {
-        console.log(res)
+        console.log(res.data)
+        setTimeout(() => {
+          location.reload();
+        }, 1000)
       })
       this.setFarmIdAsync(val);
-      setTimeout(() => {
-        location.reload();
-      }, 100)
     },
+    passReset() {
+      this.dialogVisible = false;
+      this.passWordForm = {
+        account: '',
+        password: '',
+        onePassWord: '',
+        checkPass: '',
+      }
+    },
+    onPassSubmit(ElForm) {
+      this.$refs[ElForm].validate((valid) => {
+        if(valid) {
+          let params = {
+            account: localStorage.getItem('UserName'),
+            password: this.passWordForm.password,
+            newPassword: this.passWordForm.onePassWord
+          }
+          editPassWord(params).then(res => {
+            if(res.code === 10000) {
+              this.$message.success('修改密码成功!将重新登录')
+              setTimeout(() => {
+                this.logout()
+              }, 1000);
+            } else {
+              this.$message.error('修改密码失败!')
+            }
+          }).finally(() => {
+            this.passReset()
+          })
+        }
+      })
+    }
+  },
+  created() {
+    this.GetFarm()
   },
   mounted() {
     this.init();
-    this.GetFarm()
-    console.log(this.farmId)
   }
 }
 </script>

+ 1 - 1
src/components/SideMenu.vue

@@ -129,7 +129,7 @@ export default {
       }
       let parentName = this.$route.meta.parentName;
       getUserMenu(params).then(res => {
-        if(res.code === 10000) {
+        if(res.code == 10000) {
           this.menuList = res.data;
           this.selectItem = this.getFilter(this.menuList, parentName)[0];
           if (this.selectItem.children.length > 0) {

+ 0 - 18
src/components/erp/ProductionDonut.vue

@@ -51,24 +51,6 @@ export default {
           x: 100,
           y: 200,
         },
-        // tooltip: {
-        //   trigger: 'item',
-        //   formatter: function ({name, value, percent}) {
-        //     return name + ':' + value + '头&nbsp;&nbsp;&nbsp;&nbsp;' + percent + '%'
-        //   }
-        // },
-        // legend: {
-        //   top: '15%',
-        //   left: '55%',
-        //   orient: 'vertical',
-        //   icon: "circle",
-        //   selectedMode: false, // 取消右侧项选中
-        //   itemGap: 20, // 各项间隔
-        //   textStyle: {
-        //     fontSize: 15,
-        //     color: '#666'
-        //   },
-        // },
         graphic: [
           {
             type: "text",

+ 3 - 3
src/main.js

@@ -7,18 +7,18 @@ import 'element-ui/lib/theme-chalk/index.css';
 import { hasBtnPermission } from './utils/permission';
 import { Modal } from 'ant-design-vue';
 import './assets/ttf/font.css';
-import echart from 'echarts';
+import echarts from 'echarts';
 
 Vue.config.productionTip = false
 Vue.use(ElementUI);
 Vue.use(Modal);
 Vue.prototype.hasPerm = hasBtnPermission
-Vue.prototype.$echarts = echart
+Vue.prototype.$echarts = echarts
 
 router.beforeEach((to, from, next) => {
   next();
   document.body.scrollTop = 0;
-  document.getElementById('operant').scrollTop = 0;
+  // document.getElementById('operant').scrollTop = 0;
   document.documentElement.scrollTop = 0;
   // 兼容ie
   window.scrollTo(0 ,0);

+ 30 - 0
src/router/ChildrenRouters.js

@@ -331,6 +331,36 @@ const childrenRouters = [
       parentName: '视频监控'
     }
   },
+  {
+    path: '/videoPlayBack',
+    name: 'VideoBack',
+    component: () => import('../views/Video/VideoBack.vue'),
+    meta: {
+      title: '视频回放',
+      permission: 'videoPlayBack',
+      parentName: '视频监控'
+    }
+  },
+  {
+    path: '/functionMonit',
+    name: 'FunctionMonit',
+    component: () => import('../views/Video/FunctionMonit.vue'),
+    meta: {
+      title: '功能区监控',
+      permission: 'functionMonit',
+      parentName: '视频监控'
+    }
+  },
+  {
+    path: '/functionArea',
+    name: 'FunctionArea',
+    component: () => import('../views/Video/FunctionArea.vue'),
+    meta: {
+      title: '功能区区域',
+      permission: 'functionArea',
+      parentName: '视频监控'
+    }
+  },
 
   /*
   *

+ 2 - 2
src/store/index.js

@@ -53,7 +53,7 @@ export default new Vuex.Store({
     GetButtons({ commit }) {
       return new Promise((resolve, reject) => {
         getMyButton({userId: localStorage.getItem('UserId')}).then(res => {
-          if(res.code === 10000) {
+          if(res.code == 10000) {
             commit('SET_BUTTONS', res.data)
             resolve(res.data)
           } else {
@@ -68,7 +68,7 @@ export default new Vuex.Store({
     GetFarm({ commit }){
       return new Promise((resolve, reject) => {
         getFarm().then(res => {
-          if (res.code === 10000) {
+          if (res.code == 10000) {
             commit('SET_FARMLIST', res.data);
             resolve(res.data);
           } else {

+ 127 - 1
src/utils/api.js

@@ -479,7 +479,16 @@ export function getFaceToken(data) {
 /** 人员管理 - 人脸门禁 - 查询 */
 export function getFaceGuard(data) {
   return axios({
-    url: '/video/person/get_person_record',
+    url: '/video/personTest/get_person_record',
+    method: 'post',
+    data: data
+  })
+}
+
+// 人员管理 部门查询
+export function getDepart(data) {
+  return axios({
+    url: '/video/personTest/departmentList',
     method: 'post',
     data: data
   })
@@ -952,5 +961,122 @@ export function saveAccountGroupScreen(data) {
   })
 }
 
+// 更改密码
+export function editPassWord(data) {
+  return axios({
+    url: '/admin/accountMultilevel/updatePassword',
+    method: 'post',
+    data: data
+  })
+}
+
+// 拿到回放
+export function getVideoBack(data) {
+  return axios({
+    url: '/video/clientAllVideoPlayBack/startPlaybackByTime',
+    method: 'post',
+    data: data
+  })
+}
+
+// 功能区监控
+export function getFunctionMonitList(data) {
+  return axios({
+    url: '/video/cameraFunction/list',
+    method: 'post',
+    data: data
+  })
+}
+
+export function addFunctionMonit(data) {
+  return axios({
+    url: '/video/cameraFunction/add',
+    method: 'post',
+    data: data
+  })
+}
+
+export function editFunctionMonit(data) {
+  return axios({
+    url: '/video/cameraFunction/update',
+    method: 'post',
+    data: data
+  })
+}
+
+export function delFunctionMonit(data) {
+  return axios({
+    url: '/video/cameraFunction/remove',
+    method: 'get',
+    params: data
+  })
+}
+
+export function addCameraFunction(data) {
+  return axios({
+    url: '/video/cameraFunction/addCamera',
+    method: 'post',
+    data: data
+  })
+}
+
+export function cameraFunctionList(data) {
+  return axios({
+    url: '/video/cameraFunction/listCamera',
+    method: 'post',
+    data: data
+  })
+}
+
+export function getAreaFunctionList(data) {
+  return axios({
+    url: '/video/cameraFunctionArea/list',
+    method: 'post',
+    data: data
+  })
+}
+
+
+export function addAreaFunction(data) {
+  return axios({
+    url: '/video/cameraFunctionArea/add',
+    method: 'post',
+    data: data
+  })
+}
+
+
+export function editAreaFunction(data) {
+  return axios({
+    url: '/video/cameraFunctionArea/update',
+    method: 'post',
+    data: data
+  })
+}
+
+export function delAreaFunction(data) {
+  return axios({
+    url: '/video/cameraFunctionArea/remove',
+    method: 'get',
+    params: data
+  })
+}
+
+export function saveCameraFunctionArea(data) {
+  return axios({
+    url: '/video/cameraFunctionArea/addFunction',
+    method: 'post',
+    data: data
+  })
+}
+
+export function getCameraFunctionArea(data) {
+  return axios({
+    url: '/video/cameraFunctionArea/getFunctionById',
+    method: 'post',
+    data: data
+  })
+}
+
 
 

+ 15 - 15
src/utils/chenApi.js

@@ -50,7 +50,7 @@ export function delPerson(data) {
 /** 车辆档案列表 **/
 export function getCarList(data) {
   return axios({
-    url: '/video/car/geCarList',
+    url: '/video/carTest/geCarList',
     method: 'get',
     params: data
   })
@@ -58,7 +58,7 @@ export function getCarList(data) {
 /** 新增车辆档案 **/
 export function addCarBase(data) {
   return axios({
-    url: '/video/car/addCarBase',
+    url: '/video/carTest/addCarBase',
     method: 'get',
     params: data
   })
@@ -66,7 +66,7 @@ export function addCarBase(data) {
 /** 车辆档案删除 **/
 export function delCarBase(data) {
   return axios({
-    url: '/video/car/deleteFromCarBase',
+    url: '/video/carTest/deleteFromCarBase',
     method: 'post',
     data: data
   })
@@ -74,7 +74,7 @@ export function delCarBase(data) {
 /** 车辆档案添加白名单 **/
 export function addCarWhite(data) {
   return axios({
-    url: 'video/car/addCarWhiteList',
+    url: 'video/carTest/addCarWhiteList',
     method: 'post',
     data: data
   })
@@ -83,7 +83,7 @@ export function addCarWhite(data) {
 /** 车辆档案添加黑名单 **/
 export function addCarBlack(data) {
   return axios({
-    url: 'video/car/addCarBlackList',
+    url: 'video/carTest/addCarBlackList',
     method: 'post',
     data: data
   })
@@ -92,7 +92,7 @@ export function addCarBlack(data) {
 /** 添加 白黑 名单 **/
 export function addWandB(data) {
   return axios({
-    url: '/video/car/ShowUnSendCar',
+    url: '/video/carTest/ShowUnSendCar',
     method: 'post',
     params: data
   })
@@ -101,7 +101,7 @@ export function addWandB(data) {
 /** 车辆档案白名单 **/
 export function showCarWhite(data) {
   return axios({
-    url: 'video/car/ShowCarWhiteList',
+    url: 'video/carTest/ShowCarWhiteList',
     method: 'get',
     params: data
   })
@@ -110,7 +110,7 @@ export function showCarWhite(data) {
 /** 车辆档案黑名单 **/
 export function showCarBlack(data) {
   return axios({
-    url: 'video/car/ShowCarBlackList',
+    url: 'video/carTest/ShowCarBlackList',
     method: 'get',
     params: data
   })
@@ -119,7 +119,7 @@ export function showCarBlack(data) {
 /** 移出白名单 **/
 export function delCarWhite(data) {
   return axios({
-    url: 'video/car/deleteFromCarWhiteList',
+    url: 'video/carTest/deleteFromCarWhiteList',
     method: 'post',
     data: data
   })
@@ -128,7 +128,7 @@ export function delCarWhite(data) {
 /** 移出黑名单 **/
 export function delCarBlack(data) {
   return axios({
-    url: 'video/car/deleteFromCarBlackList',
+    url: 'video/carTest/deleteFromCarBlackList',
     method: 'post',
     data: data
   })
@@ -136,7 +136,7 @@ export function delCarBlack(data) {
 /* 获取门禁所有 - 人脸门禁 +  */
 export function getFaceGuardTotal(data) {
   return axios({
-    url: '/video/person/get_person_record_totalpage',
+    url: '/video/personTest/get_person_record_totalpage',
     method: 'post',
     data: data
   })
@@ -145,7 +145,7 @@ export function getFaceGuardTotal(data) {
 /* 车辆管理 - 车辆通行 */
 export function getCarPassage(data) {
   return axios({
-    url: '/video/car/get_car_record',
+    url: '/video/carTest/get_car_record',
     method: 'get',
     params: data
   })
@@ -154,7 +154,7 @@ export function getCarPassage(data) {
 /* 车辆管理 - 车辆洗消 */
 export function getCarWash(params) {
   return axios({
-    url: '/video/accident/accident_record_xixiao',
+    url: '/video/event',
     method: 'post',
     data: params
   })
@@ -172,7 +172,7 @@ export function getCarWashTotal(params) {
 /* 车辆洗消 - 视频回放 */
 export function getCarWashVideo(params) {
   return axios({
-    url: '/video/video/getVideoRecord',
+    url: '/video/videoTest/getVideoRecord',
     method: 'post',
     data: params
   })
@@ -207,7 +207,7 @@ export function getCarDryingTemp(params) {
 // 档案管理
 export function getPersonFiles(params) {
   return axios({
-    url: '/video/person/ge_person_list',
+    url: '/video/personTest/ge_person_list',
     method: 'post',
     data: params
   })

+ 21 - 19
src/utils/http.js

@@ -2,21 +2,16 @@ import axios from "axios";
 import router from "../router";
 import { Message } from 'element-ui';
 
-let pending = []; //声明一个数组用于存储每个ajax请求的取消函数和ajax标识
-let cancelToken = axios.CancelToken;
-let removePending = (ever) => {
-  for(let p in pending) {
-    if(pending[p].u === ever.url + '&' + ever.method) { //当当前请求在数组中存在时执行函数体
-      pending[p].f(); //执行取消操作
-      pending.splice(p, 1); //把这条记录从数组中移除
-    }
-  }
-}
+
+
+let axiosPromiseCancel = [];
+const CancelToken = axios.CancelToken;
+
 // 创建axios实例
 var instance = axios.create({
   timeout: 1000 * 12,
   baseURL: 'http://120.27.234.126:8010'
-  // baseURL: 'http://192.168.1.165:8010'
+  // baseURL: 'http://192.168.1.15:8010'
 })
 
 // 请求拦截器
@@ -29,10 +24,9 @@ instance.interceptors.request.use(
     const token = localStorage.getItem('accessToken')
     const lastFarmId = Number(localStorage.getItem('lastFarmId'));
     token && (config.headers.accessToken = token)
-    removePending(config); //在一个ajax发送前执行一下取消操作
-    config.cancelToken = new cancelToken((c)=>{
-      // 这里的ajax标识我是用请求地址&请求方式拼接的字符串,当然你可以选择其他的一些方式
-      pending.push({ u: config.url + '&' + config.method, f: c });
+
+    config.cancelToken = new CancelToken((cancel) => {
+      axiosPromiseCancel.push(cancel);
     });
 
     let data = config.data || config.params || {}
@@ -45,7 +39,7 @@ instance.interceptors.request.use(
 // 响应拦截器
 instance.interceptors.response.use(
   // 请求成功
-  res => res.status === 200 ? Promise.resolve(res.data) : Promise.reject(res),
+  res =>  {   return res.data},
   // 请求失败
   error => {
     const { response } = error;
@@ -73,6 +67,14 @@ const toLogin = () => {
   });
 }
 
+const cancel = () => {
+  axiosPromiseCancel.forEach(e=>{
+    e && e()
+  });
+  axiosPromiseCancel = [];
+}
+
+
 /**
  * 请求失败后的错误统一处理
  * @param {Number} status 请求失败的状态码
@@ -84,17 +86,17 @@ const errorHandle = (status, other) => {
     // 401: 未登录状态,跳转登录页
     case 401:
       toLogin();
+      cancel()
       break;
     // 403 token过期
     // 清除token并跳转登录页
     case 403:
+      toLogin();
+      cancel()
       Message.error('登录过期,请重新登录');
       localStorage.removeItem('accessToken');
       localStorage.removeItem('UserName');
       localStorage.removeItem('UserId');
-      setTimeout(() => {
-        toLogin();
-      }, 1000);
       break;
     // 404请求不存在
     case 404:

+ 9 - 7
src/views/BioSafety/BenconAdmin.vue

@@ -87,7 +87,7 @@ import { mapState } from "vuex";
 import { timeDate } from "../../utils/index";
 
 import {
-  getBenconAdmin,
+  getCarWash,
   // getCarWashTotal,
   getCarWashVideo,
 } from "../../utils/chenApi";
@@ -133,7 +133,7 @@ export default {
     this.tableItems = tableItems;
     this.tableShows = tableShows;
     this.pigManage();
-    this.pigTotal();
+    // this.pigTotal();
   },
   methods: {
     // 获取查询条件
@@ -141,7 +141,7 @@ export default {
       this.params = params;
       this.pageNum = 1;
       this.pigManage();
-      this.pigTotal();
+      // this.pigTotal();
     },
     // 修改size
     sizeChange(val) {
@@ -175,14 +175,15 @@ export default {
         pageSize: this.size,
         alarmStartDateString: this.params.time[0] + " 00:00:00",
         alarmEndDateString: this.params.time[1] + " 23:59:59",
+        eventType: 3
       };
-      getBenconAdmin(queryParams).then(async (res) => {
+      getCarWash(queryParams).then(async (res) => {
         loading.close();
         if (res && res.code === 0) {
-          const result = JSON.parse(res.data.result);
+          const result = JSON.parse(res.data);
           this.listData = result.data.pageData;
           this.listData.forEach((item) => {
-            item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}`;
+            item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}&farmId=${localStorage.getItem('lastFarmId')}`;
           });
           this.total = parseInt(res.total);
         } else {
@@ -286,9 +287,10 @@ export default {
       getCarWashVideo({
         happendTime: row.alarmDate,
         channelName: row.alarmPosition,
+        nodeCode: row.nodeCode
       }).then((res) => {
         if (res.code === 0) {
-          this.rtsp = res.URL;
+          this.rtsp = res.data.url;
           this.videoVisible = true;
         } else {
           this.$message.error("视频获取失败");

+ 12 - 10
src/views/BioSafety/CarAdmin.vue

@@ -426,7 +426,7 @@ export default {
       const fns = {
         1: [this.getCarList], // 档案
         2: [this.carPassage], // 车辆通行
-        3: [this.carWash, this.carWashTotal], // 车辆洗消
+        3: [this.carWash], // 车辆洗消
         4: [this.carDrying], // 车辆烘干
         5: [this.ShowCarWhite], // 白名单
         6: [this.ShowCarBlack], // 黑名单
@@ -484,13 +484,13 @@ export default {
         carNum: this.params.name || undefined,
       };
       getCarPassage(queryParams).then((res) => {
-        const result = JSON.parse(res.result);
-        this.listData = result.data.pageData;
+        // const result = JSON.parse(res.data);
+        this.listData = res.data.pageData;
         this.listData.forEach((item) => {
-          item.originalPicPath = `${this.ip}/video/picture/get?fileUrl=${item.originalPicPath}`;
+          item.originalPicPath = `${this.ip}/video/picture/get?fileUrl=${item.originalPicPath}&farmId=${localStorage.getItem('lastFarmId')}`;
           item.devChnName = item.devChnName.split("_")[0];
         });
-        this.total = parseInt(result.data.totalRows);
+        this.total = parseInt(res.data.totalRows);
       });
     },
     // 点击图片放大
@@ -506,9 +506,9 @@ export default {
       };
       getCarList(params).then((res) => {
         if (res.code == 200) {
-          const result = JSON.parse(res.result);
-          this.total = parseInt(result.data.totalRows);
-          this.listData = result.data.pageData;
+          // const result = JSON.parse(res.result);
+          this.total = parseInt(res.data.totalRows);
+          this.listData = res.data.pageData;
         }
       });
     },
@@ -733,13 +733,15 @@ export default {
         deviceCategory: 1,
         alarmType: 303,
         dbType: 0,
+        eventType: 5
       };
       getCarWash(queryParams).then(async (res) => {
-        const result = JSON.parse(res.result);
+        const result = JSON.parse(res.data);
         this.listData = result.data.pageData;
         this.listData.forEach((item) => {
-          item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}`;
+          item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}&farmId=${localStorage.getItem('lastFarmId')}`;
         });
+        this.total = parseInt(res.total);
       });
     },
     // 车辆洗消 - 按钮

+ 8 - 5
src/views/BioSafety/DeadPig.vue

@@ -133,7 +133,7 @@ export default {
     this.tableItems = tableItems;
     this.tableShows = tableShows;
     this.pigManage();
-    this.pigTotal();
+    // this.pigTotal();
   },
   methods: {
     // 获取查询条件
@@ -141,7 +141,7 @@ export default {
       this.params = params;
       this.pageNum = 1;
       this.pigManage();
-      this.pigTotal();
+      // this.pigTotal();
     },
     // 修改size
     sizeChange(val) {
@@ -244,15 +244,17 @@ export default {
         deviceCategory: 1,
         alarmType: 303,
         dbType: 0,
+        eventType: 1
       };
       getCarWash(queryParams).then(async (res) => {
         if (res) {
           loading.close();
-          const result = JSON.parse(res.result);
+          const result = JSON.parse(res.data);
           this.listData = result.data.pageData;
           this.listData.forEach((item) => {
-            item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}`;
+            item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}&farmId=${localStorage.getItem('lastFarmId')}`;
           });
+          this.total = res.total;
         }
         loading.close();
       });
@@ -359,9 +361,10 @@ export default {
       getCarWashVideo({
         happendTime: row.alarmDate,
         channelName: row.alarmPosition,
+        nodeCode: row.nodeCode
       }).then((res) => {
         if (res.code === 0) {
-          this.rtsp = res.URL;
+          this.rtsp = res.data.url;
           this.videoVisible = true;
         } else {
           this.$message.error("视频获取失败");

+ 9 - 7
src/views/BioSafety/DoorAdmin.vue

@@ -87,7 +87,7 @@ import { mapState } from "vuex";
 import { timeDate } from "../../utils/index";
 
 import {
-  getDoorAdmin,
+  getCarWash,
   // getCarWashTotal,
   getCarWashVideo,
 } from "../../utils/chenApi";
@@ -129,7 +129,7 @@ export default {
     this.tableItems = tableItems;
     this.tableShows = tableShows;
     this.pigManage();
-    this.pigTotal();
+    // this.pigTotal();
   },
   methods: {
     // 获取查询条件
@@ -137,7 +137,7 @@ export default {
       this.params = params;
       this.pageNum = 1;
       this.pigManage();
-      this.pigTotal();
+      // this.pigTotal();
     },
     // 修改size
     sizeChange(val) {
@@ -171,14 +171,15 @@ export default {
         pageSize: this.size,
         alarmStartDateString: this.params.time[0] + " 00:00:00",
         alarmEndDateString: this.params.time[1] + " 23:59:59",
+        eventType: 2
       };
-      getDoorAdmin(queryParams).then(async (res) => {
+      getCarWash(queryParams).then(async (res) => {
         loading.close();
         if (res && res.code === 0) {
-          const result = JSON.parse(res.data.result);
+          const result = JSON.parse(res.data);
           this.listData = result.data.pageData;
           this.listData.forEach((item) => {
-            item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}`;
+            item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}&farmId=${localStorage.getItem('lastFarmId')}`;
           });
           this.total = parseInt(res.total);
         } else {
@@ -282,9 +283,10 @@ export default {
       getCarWashVideo({
         happendTime: row.alarmDate,
         channelName: row.alarmPosition,
+        nodeCode: row.nodeCode
       }).then((res) => {
         if (res.code === 0) {
-          this.rtsp = res.URL;
+          this.rtsp = res.data.url;
           this.videoVisible = true;
         } else {
           this.$message.error("视频获取失败");

+ 36 - 20
src/views/BioSafety/PersonAdmin.vue

@@ -139,7 +139,7 @@
         </el-button>
       </span>
     </el-dialog>
-    <add-or-edit ref="addOrEdit" @reflash="reflash"></add-or-edit>
+    <add-or-edit  ref="addOrEdit" @reflash="reflash"></add-or-edit>
   </div>
 </template>
 
@@ -156,7 +156,7 @@ import AddOrEdit from "./personAdmin/AddOrEdit.vue";
 
 import { formItems, propFormData } from "./personAdmin/queryCondition.config";
 import { titles, tableItems, tableShows } from "./personAdmin/table.config";
-import { getFaceGuard } from "../../utils/api";
+import { getFaceGuard, getDepart } from "../../utils/api";
 import {
   getFaceGuardTotal,
   getPersonFiles,
@@ -212,6 +212,9 @@ export default {
       rows: [], // 人员列表 selection
     };
   },
+  created() {
+    this.initDepart()
+  },
   mounted() {
     this.formItems = formItems[this.btnSelected - 1];
     this.propFormData = propFormData[this.btnSelected - 1];
@@ -222,6 +225,18 @@ export default {
     this.initPersonFiles();
   },
   methods: {
+    initDepart() {
+      getDepart({}).then(res =>{
+        let result = JSON.parse(res.data);
+        if(result.data.pageData.length > 0) {
+          result.data.pageData.forEach(item => {
+            item.label =  item.name;
+            item.value = item.id;
+          })
+        }
+        formItems[0][0].options = result.data.pageData;
+      })
+    },
     // 获取选中的按钮情况
     getBtnSelected(id) {
       this.btnSelected = id;
@@ -281,21 +296,22 @@ export default {
         openType: 61, // 进门,刷脸
       };
       getFaceGuard(queryParams).then(async (res) => {
-        if (!res.result) {
-          return;
-        }
+        // if (!res.result) {
+        //   return;
+        // }
         // 结果是 JSON 格式
-        this.listData = JSON.parse(res.result).data.pageData;
+        // this.listData = JSON.parse(res.result).data.pageData;
+        this.listData = res.data.pageData;
         this.listData.forEach((item) => {
           item.channelName = item.channelName.split("人脸门禁")[0];
           // item.recordImage = `https://36.26.62.70:447/evo-pic/${item.recordImage}?token=${token}&oss_addr=172.16.3.223:8925`;
-          item.recordImage = `${this.ip}/video/picture/get?alarmPicture=${item.recordImage}`;
+          item.recordImage = `${this.ip}/video/picture/get?alarmPicture=${item.recordImage}&farmId=${localStorage.getItem('lastFarmId')}`;
         });
         // 近 7 小时进出统计
         const recordRes = await getRecord({});
-        if (!res.result) {
-          return;
-        }
+        // if (!res.result) {
+        //   return;
+        // }
         if (recordRes.code === 0) {
           const timeList = [];
           const dataList = [];
@@ -325,12 +341,12 @@ export default {
         openType: 61, // 进门,刷脸
       };
       getFaceGuardTotal(queryParams).then((res) => {
-        if (!res.result) {
-          return;
-        }
-        this.total = JSON.parse(res.result).data;
+        // if (!res.result) {
+        //   return;
+        // }
+        this.total = res.data.count;
         if (this.isTotal === false) {
-          this.total1 = JSON.parse(res.result).data;
+          this.total1 = res.data.count;
           this.isTotal = true;
         }
       });
@@ -341,17 +357,17 @@ export default {
         searchKey: "",
         pageNum: this.pageNum,
         pageSize: this.size,
-        departmentId: this.params.departmentId || 5,
+        departmentId: this.params.departmentId || '',
         isContain: true,
         statusList: [1, 2],
-      }).then(async ({ success, result }) => {
-        if (success) {
-          const listData = JSON.parse(result);
+      }).then(async (res) => {
+        if (res.code == 0) {
+          const listData = res;
           this.listData = listData.data.pageData;
           this.total = listData.data.totalRows;
           this.listData.forEach((item) => {
             if (item.personBiosignatures) {
-              item.personBiosignatures[0].path = `${this.ip}/video/picture/get?path=${item.personBiosignatures[0].path}`;
+              item.personBiosignatures[0].path = `${this.ip}/video/picture/get?path=${item.personBiosignatures[0].path}&farmId=${localStorage.getItem('lastFarmId')}`;
             }
           });
         }

+ 9 - 8
src/views/BioSafety/SaleAdmin.vue

@@ -87,7 +87,7 @@ import { mapState } from "vuex";
 import { timeDate } from "../../utils/index";
 
 import {
-  getSaleAdmin,
+  getCarWash,
   // getCarWashTotal,
   getCarWashVideo,
 } from "../../utils/chenApi";
@@ -133,7 +133,7 @@ export default {
     this.tableItems = tableItems;
     this.tableShows = tableShows;
     this.pigManage();
-    this.pigTotal();
+    // this.pigTotal();
   },
   methods: {
     // 获取查询条件
@@ -141,7 +141,7 @@ export default {
       this.params = params;
       this.pageNum = 1;
       this.pigManage();
-      this.pigTotal();
+      // this.pigTotal();
     },
     // 修改size
     sizeChange(val) {
@@ -175,15 +175,15 @@ export default {
         pageSize: this.size,
         alarmStartDateString: this.params.time[0] + " 00:00:00",
         alarmEndDateString: this.params.time[1] + " 23:59:59",
+        eventType: 4
       };
-      getSaleAdmin(queryParams).then(async (res) => {
+      getCarWash(queryParams).then(async (res) => {
         loading.close();
         if (res && res.code === 0) {
-          const result = JSON.parse(res.data.result);
+          const result = JSON.parse(res.data);
           this.listData = result.data.pageData;
-          console.log(this.listData);
           this.listData.forEach((item) => {
-            item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}`;
+            item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}&farmId=${localStorage.getItem('lastFarmId')}`;
           });
           this.total = parseInt(res.total);
         } else {
@@ -287,9 +287,10 @@ export default {
       getCarWashVideo({
         happendTime: row.alarmDate,
         channelName: row.alarmPosition,
+        nodeCode: row.nodeCode
       }).then((res) => {
         if (res.code === 0) {
-          this.rtsp = res.URL;
+          this.rtsp = res.data.url;
           this.videoVisible = true;
         } else {
           this.$message.error("视频获取失败");

+ 17 - 14
src/views/BioSafety/personAdmin/AddOrEdit.vue

@@ -68,6 +68,7 @@
 <script>
 import { addPerson, addPersonPicture, addPictureToPerson } from "@/utils/chenApi.js";
 import { getFaceToken } from "@/utils/api.js";
+import {getDepart} from "../../../utils/api";
 export default {
   data() {
     return {
@@ -84,24 +85,26 @@ export default {
           { required: true, message: "部门需要选择", trigger: "blur" },
         ],
       },
-      departmentList: [
-        {
-          value: 4,
-          label: "维修部门",
-        },
-        {
-          value: 2,
-          label: "技术部门",
-        },
-        {
-          value: 5,
-          label: "基层部门",
-        },
-      ],
       file: [],
+      departmentList: [],
     };
   },
+  created() {
+    this.initDepart()
+  },
   methods: {
+    initDepart() {
+      getDepart({}).then(res =>{
+        let result = JSON.parse(res.data);
+        if(result.data.pageData.length > 0) {
+          result.data.pageData.forEach(item => {
+            item.label =  item.name;
+            item.value = item.id;
+          })
+        }
+        this.departmentList = result.data.pageData;
+      })
+    },
     init(row) {
       if (row) {
         this.title = "编辑人员";

+ 13 - 13
src/views/BioSafety/personAdmin/queryCondition.config.js

@@ -15,24 +15,24 @@ const formItems1 = [
     placeholder: '请选择部门',
     field: 'departmentId',
     options: [
-      {
-        value: 4,
-        label: '维修部门'
-      },
-      {
-        value: 2,
-        label: '技术部门'
-      },
-      {
-        value: 5,
-        label: '基层部门'
-      }
+      // {
+      //   value: 4,
+      //   label: '维修部门'
+      // },
+      // {
+      //   value: 2,
+      //   label: '技术部门'
+      // },
+      // {
+      //   value: 5,
+      //   label: '基层部门'
+      // }
     ]
   }
 ]
 
 const propFormData1 = {
-  departmentId: 5
+  departmentId: ''
 }
 
 const formItems2 = [

+ 12 - 6
src/views/DeviceMana/device/AddOrEdit.vue

@@ -128,18 +128,24 @@ export default {
         loading.close();
         if (res.code === 10000) {
           this.$message.success(`${this.form.id ? "修改" : "添加"}成功`);
-          this.handleCancel();
           this.$emit("reflash");
         }
-      });
+        this.handleCancel();
+      })
     },
     // 取消
     handleCancel() {
       this.dialogVisible = false;
-      if (this.form.id) {
-        this.$nextTick(() => {
-          this.$refs["form"].resetFields();
-        });
+      this.form = {
+          id: undefined,
+          deviceName: "",
+          deviceCode: "",
+          deviceType: "",
+          factory: "",
+          worker: "",
+          mainParams: "",
+          state: "",
+          record: "",
       }
     },
   },

+ 3 - 3
src/views/Env/DrinkWater.vue

@@ -16,7 +16,7 @@
       </div>
     </div>
     <div class="echarts" v-else>
-      <el-empty description="设备已掉线" style="width: 100%;"></el-empty>
+      <el-empty description="设备维护中" style="width: 100%;"></el-empty>
     </div>
     <br />
     <div class="reply" :style="{ color: color }">饮用水详情</div>
@@ -40,7 +40,7 @@
                 </div>
                 <div>
                   <span>{{
-                    item.water == null ? "设备已掉线" : item.water + "吨"
+                    item.water == null ? "设备维护中" : item.water + "吨"
                   }}</span>
                 </div>
               </div>
@@ -74,7 +74,7 @@
       </div>
     </div>
     <div class="echarts" v-else>
-      <el-empty description="设备已掉线" style="width: 100%;"></el-empty>
+      <el-empty description="设备维护中" style="width: 100%;"></el-empty>
     </div>
   </div>
 </template>

+ 4 - 4
src/views/Env/PigHouseEnv.vue

@@ -20,7 +20,7 @@
                 </div>
                 <div>
                   <span>{{
-                    item.temperature !== null ? item.temperature + "℃" : "设备已掉线"
+                    item.temperature !== null ? item.temperature + "℃" : "设备维护中"
                   }}</span>
                 </div>
               </div>
@@ -30,7 +30,7 @@
                 </div>
                 <div>
                   <span>{{
-                    item.humidity !== null ? item.humidity + "RH" : "设备已掉线"
+                    item.humidity !== null ? item.humidity + "RH" : "设备维护中"
                   }}</span>
                 </div>
               </div>
@@ -40,7 +40,7 @@
           <div class="swiper-button-prev" slot="button-prev"></div>
           <div class="swiper-button-next" slot="button-next"></div>
         </swiper>
-        <el-empty v-else description="设备已掉线" style="height: 90%"></el-empty>
+        <el-empty v-else description="设备维护中" style="height: 90%"></el-empty>
       </div>
     </el-skeleton>
     <br />
@@ -64,7 +64,7 @@
         v-if="humList.list.length > 0"
         :humList="humList"
       ></chart-pig-hum>
-      <el-empty v-else description="设备已掉线"></el-empty>
+      <el-empty v-else description="设备维护中"></el-empty>
     </div>
   </div>
 </template>

+ 1 - 1
src/views/Env/chart/ChartStarkBar.vue

@@ -84,7 +84,7 @@ export default {
             type: "value",
             name: "用料统计情况",
             axisLabel: {
-              formatter: "{value} ",
+              formatter: "{value} kg",
             },
             axisLine: {
               show: false,

+ 1 - 0
src/views/MainLayout.vue

@@ -61,6 +61,7 @@ export default {
           this.setModeAsync(res.data.mode);
           this.setColorAsync(res.data.color);
           this.setUserNameAsync(res.data.userName)
+          localStorage.setItem('password', res.data.password);
         }
       })
     },

+ 12 - 6
src/views/PdcData/Analysis.vue

@@ -327,6 +327,9 @@ export default {
         {
           stockQuantity: 0,
         },
+        {
+          stockQuantity: 0,
+        }
       ], // 环形图数据
       inventoryItemsData: [], // 下面块图的数据
       // 生产情况
@@ -506,6 +509,7 @@ export default {
             month: [],
             pigletStock: [],
             sowStock: [],
+            backPigStock: [],
           };
         }
       });
@@ -526,7 +530,9 @@ export default {
             res.data["grice_stock"] || undefinedData,
             res.data["piglet_stock"] || undefinedData,
             res.data["fatpig_stock"] || undefinedData,
+            res.data['sow_stock_5'] || undefinedData
           ];
+          // console.log(this.inventoryPieData)
           // console.log("object", this.inventoryPieData);
           this.inventoryItemsData = [
             res.data["sow_stock"] ? res.data["sow_stock"].stockQuantity : 0,
@@ -768,12 +774,12 @@ export default {
         endDate: this.getSalesDates[1] || undefined,
       }).then((res) => {
         if (res.code === 10000) {
-          this.monthSales = res.data.nowMoney.toLocaleString();
-          this.monthAmount = res.data.nowQuantity.toLocaleString();
-          this.weekSales = res.data.money;
-          this.weekSalesChange = res.data.moneyPercent;
-          this.weekSalesVolume = res.data.quantity;
-          this.weekSalesVolumeChange = res.data.quantityPercent;
+          this.monthSales = res.data.nowMoney ? res.data.nowMoney.toLocaleString(): 0;
+          this.monthAmount = res.data.nowQuantity ? res.data.nowQuantity.toLocaleString() : 0;
+          this.weekSales = res.data.money ? res.data.money : 0;
+          this.weekSalesChange = res.data.moneyPercent ? res.data.moneyPercent : 0;
+          this.weekSalesVolume = res.data.quantity ? res.data.quantity : 0;
+          this.weekSalesVolumeChange = res.data.quantityPercent ? res.data.quantityPercent : 0;
           // console.log("救命");
           this.salesChartData = {
             moneyList: res.data.moneyList,

+ 19 - 5
src/views/PdcData/analysis/ChartInventoryLines.vue

@@ -115,7 +115,7 @@ export default {
         //],
         series: [
           {
-            name: "",
+            name: "母猪存栏",
             type: "line",
             smooth: false,
             data: this.data.sowStock,
@@ -129,7 +129,7 @@ export default {
             },
           },
           {
-            name: "",
+            name: "公猪存栏",
             type: "line",
             smooth: false,
             data: this.data.boarStock,
@@ -143,7 +143,7 @@ export default {
             },
           },
           {
-            name: "",
+            name: "哺乳猪存栏",
             type: "line",
             smooth: false,
             data: this.data.griceStock,
@@ -157,7 +157,7 @@ export default {
             },
           },
           {
-            name: "",
+            name: "保育猪存栏",
             type: "line",
             smooth: false,
             data: this.data.pigletStock,
@@ -171,7 +171,7 @@ export default {
             },
           },
           {
-            name: "",
+            name: "育肥猪存栏",
             type: "line",
             smooth: false,
             data: this.data.fatpigStock,
@@ -184,6 +184,20 @@ export default {
               },
             },
           },
+          {
+            name: '后备猪存栏',
+            type: 'line',
+            smooth: false,
+            data: this.data.backPigStock,
+            itemStyle: {
+              normal: {
+                color: "#666666",
+                lineStyle: {
+                  color: "#666666",
+                },
+              },
+            },
+          }
           // {
           //   name: '湿度',
           //   type: 'line',

+ 2 - 1
src/views/PdcData/analysis/ChartInventoryPie.vue

@@ -62,7 +62,7 @@ export default {
           },
         },
         legend: {
-          top: "25%",
+          top: "15%",
           left: "55%",
           orient: "vertical",
           icon: "circle",
@@ -145,6 +145,7 @@ export default {
               { value: this.data[2].stockQuantity, name: "哺乳猪存栏" },
               { value: this.data[3].stockQuantity, name: "保育猪存栏" },
               { value: this.data[4].stockQuantity, name: "育肥猪存栏" },
+              { value: this.data[5].stockQuantity, name: '后备猪存栏' }
             ],
           },
         ],

+ 52 - 25
src/views/PdcData/analysis/SalesChart.vue

@@ -58,29 +58,8 @@ export default {
         },
         tooltip: {
           trigger: "axis",
-          formatter: (params) => {
-            var res = "<div>" + params[0].name + "</div>"; // 字符串形式的html标签会被echarts转换渲染成数据,这个res主要是画的tooltip里的上部分的标题部分
-            const index = this.data.moneyList.findIndex(
-              (item) => item === params[0].value
-            );
-            for (var i = 0; i < params.length; i++) {
-              // console.log(moneyListTooltip[i]);
-              //因为是个数组,所以要遍历拿到里面的数据,并加入到tooltip的数据内容部分里面去
-              res +=
-                `<div style="color: #fff;font-size: 14px; padding:0 12px;">
-                  <span style="display:inline-block;margin-right:5px;border-radius:5px;width:10px;height:10px;background-color:${[
-                    params[i].color, // 默认是小圆点,我们将其修改成有圆角的正方形,这里用的是模板字符串。并拿到对应颜色、名字、数据
-                  ]};"></span>
-                  ${moneyListTooltip[index]}元
-                </div>` +
-                `<div style="color: #fff;font-size: 14px; padding:0 12px;"><span style="display:inline-block;margin-right:5px;border-radius:5px;width:10px;height:10px;background-color:${[
-                  params[i].color,
-                ]};"></span>${quantityList[index]}头</div>`;
-            }
-            return res;
-          },
         },
-        color: [this.color],
+        color: ["#289df5", '#45C3A6'],
         dataZoom: [
           {
             type: "inside",
@@ -125,10 +104,30 @@ export default {
               show: false,
             },
           },
+          {
+            type: "value",
+            name: "头",
+            axisLabel: {
+              // formatter: "{value} 元",
+              show: true,
+            },
+            axisLine: {
+              show: true,
+              lineStyle: {
+                color: "#6e7079",
+              },
+            },
+            axisTick: {
+              show: false,
+            },
+            splitLine: {
+              show: false,
+            },
+          },
         ],
         series: [
           {
-            name: "元",
+            name: "销售",
             type: "line",
             // stack: 'Total',
             smooth: true,
@@ -137,8 +136,8 @@ export default {
               focus: "series",
             },
             itemStyle: {
-              color: this.color,
-              borderColor: this.color,
+              color: '#289df5',
+              borderColor: '#289df5',
               normal: {
                 label: {
                   show: false,
@@ -150,6 +149,34 @@ export default {
             },
             data: this.data.moneyList,
           },
+          {
+            name: "头数",
+            type: "line",
+            yAxisIndex: 1,
+            // stack: 'Total',
+            smooth: true,
+            areaStyle: {},
+            emphasis: {
+              focus: "series",
+            },
+            itemStyle: {
+              color: "#45C3A6",
+              borderColor: "#45C3A6",
+              normal: {
+                label: {
+                  show: false,
+                  textStyle: {
+                    fontSize: 14,
+                  },
+                },
+                areaStyle: {
+                  type: "default",
+                  opacity: 0.2,
+                },
+              },
+            },
+            data: this.data.quantityList,
+          },
         ],
       };
       this.myChart.setOption(options, true);

+ 1 - 0
src/views/SystemAdmin/AuthAdmin.vue

@@ -1,3 +1,4 @@
+<script src="../../../vue.config.js"></script>
 <template>
   <div class="box">
     <div class="box-content">

+ 91 - 6
src/views/SystemAdmin/UserAdmin.vue

@@ -66,8 +66,9 @@
               </el-switch>
             </template>
           </el-table-column>
-          <el-table-column label="操作">
+          <el-table-column min-width="120" label="操作">
             <template slot-scope="scope">
+              <el-button v-if="hasPerm('user:edit')" size="mini" @click="setPassWord(scope.row)">修改密码</el-button>
               <el-button type="primary" v-if="hasPerm('user:edit')" size="mini" @click="edit(scope.row)">编辑</el-button>
               <el-button type="success" style="margin-right: 5px" @click="handleFarm(scope.row)" size="mini" >分配牧场</el-button>
               <el-popconfirm
@@ -100,6 +101,7 @@
         <table-footer
             :totals="total"
             :size="size"
+            :page-num="pageNum"
             @sizeChange="sizeChange"
             @pageChange="pageChange"></table-footer>
 
@@ -114,9 +116,9 @@
           <el-form-item label="登录名" prop="account">
             <el-input v-model="forms.account" :disabled="showType" placeholder=""></el-input>
           </el-form-item>
-          <el-form-item label="密码" prop="password">
-            <el-input type="password" v-model="forms.password" ></el-input>
-          </el-form-item>
+<!--          <el-form-item label="密码" prop="password">-->
+<!--            <el-input type="password" v-model="forms.password" ></el-input>-->
+<!--          </el-form-item>-->
           <el-form-item label="用户姓名" prop="userName">
             <el-input  v-model="forms.userName" ></el-input>
           </el-form-item>
@@ -164,6 +166,22 @@
                 <el-button type="primary" @click="onSubmit('form')">{{showType ? '更 新' : '新 增'}}</el-button>
               </span>
     </el-dialog>
+    <el-dialog title="修改密码" ref="passForm" :visible.sync="dialogPassWord" width="30%" @close="passReset">
+      <div>
+        <el-form :model="passWordForm" :rules="passWordRules" label-width="80px" ref="passForm">
+          <el-form-item label="新密码" prop="onePassWord">
+            <el-input type="password" v-model="passWordForm.onePassWord"></el-input>
+          </el-form-item>
+          <el-form-item label="确认密码" prop="checkPass">
+            <el-input type="password" v-model="passWordForm.checkPass" autocomplete="off"></el-input>
+          </el-form-item>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+                <el-button @click="passReset">取 消</el-button>
+                <el-button type="primary" @click="onPassSubmit('passForm')">保 存</el-button>
+              </span>
+    </el-dialog>
     <el-dialog
         title="牧场分配"
         :visible.sync="dialogFarm"
@@ -198,7 +216,7 @@
 
 <script>
 import TableFooter from '../../components/TableFooter';
-import {getUserList, addUser, editUser, isUser, delUser, getAuthApp, getAuth, getAuthScreen, editUserFarm} from '../../utils/api';
+import {getUserList, addUser, editUser, isUser, delUser, getAuthApp, getAuth, getAuthScreen, editUserFarm, editPassWord} from '../../utils/api';
 import { mapState, mapActions } from 'vuex';
 export default {
   name: "UserAdmin",
@@ -209,6 +227,22 @@ export default {
     ...mapState(['farmList'])
   },
   data() {
+    let validPassword=(rule,value,callback)=>{
+      let reg= /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/
+      if(!reg.test(value)){callback(new Error('密码必须是字母+数字组合6-16位密码'))
+      }else{
+        callback()
+      }
+    };
+    let validatePass2 = (rule, value, callback) => {
+      if (value === '') {
+        callback(new Error('请再次输入密码'));
+      } else if (value !== this.passWordForm.onePassWord) {
+        callback(new Error('两次输入密码不一致!'));
+      } else {
+        callback();
+      }
+    };
     return {
       dialogVisible: false,
       showType: false,
@@ -250,6 +284,22 @@ export default {
       authAppList: [],
       authList: [],
       screenList: [],
+      dialogPassWord: false,
+      passWordForm: {
+        account: '',
+        password: '',
+        onePassWord: '',
+        checkPass: ''
+      },
+      passWordRules: {
+        onePassWord: [
+          { required: true, message: '请输入确认密码', trigger: 'blur' },
+          { validator: validPassword, trigger: 'blur' }
+        ],
+        checkPass: [
+          { validator: validatePass2, trigger: 'blur' }
+        ],
+      }
     };
   },
   created() {
@@ -289,7 +339,7 @@ export default {
     init() {
       let params = {
         pageNum: this.pageNum,
-        pageSize: 100,
+        pageSize: this.size,
         searchStr: this.keyword
       };
       getUserList(params)
@@ -544,6 +594,41 @@ export default {
         this.screenList = res.records;
       });
     },
+    setPassWord(row) {
+      this.passWordForm.account = row.account;
+      this.passWordForm.password = row.password
+      this.dialogPassWord = true;
+    },
+    passReset() {
+      this.dialogPassWord = false;
+      this.passWordForm = {
+        account: '',
+        password: '',
+        onePassWord: '',
+        checkPass: '',
+      }
+    },
+    onPassSubmit(ElForm) {
+      this.$refs[ElForm].validate((valid) => {
+        if(valid) {
+          let params = {
+            account: this.passWordForm.account,
+            password: this.passWordForm.password,
+            newPassword: this.passWordForm.onePassWord
+          }
+          editPassWord(params).then(res => {
+            if(res.code === 10000) {
+              this.$message.success('修改密码成功!')
+              this.init()
+            } else {
+              this.$message.error('修改密码失败!')
+            }
+          }).finally(() => {
+            this.passReset()
+          })
+        }
+      })
+    }
   },
   mounted() {
     this.init();

+ 291 - 0
src/views/Video/FunctionArea.vue

@@ -0,0 +1,291 @@
+<template>
+  <div style="padding: 20px;">
+    <el-form inline>
+      <el-form-item label="区域">
+        <el-input v-model="name"></el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="search">查询</el-button>
+        <el-button type="success" @click="add">新 增 区 域</el-button>
+      </el-form-item>
+    </el-form>
+    <br>
+    <el-table
+      height="600"
+      :data="list"
+      border>
+      <el-table-column label="区域名称" prop="functionName"></el-table-column>
+      <el-table-column label="操作">
+        <template slot-scope="scope">
+          <el-button @click="open(scope.row)" size="mini" type="primary">添加下级功能区</el-button>
+          <el-button @click="edit(scope.row)" size="mini" >编辑</el-button>
+          <el-popconfirm
+            title=" 确定要删除这个功能区吗?"
+            @confirm="del(scope.row)"
+          >
+            <el-button style="margin-left: 10px" type="danger" size="mini" slot="reference">删除</el-button>
+          </el-popconfirm>
+        </template>
+      </el-table-column>
+    </el-table>
+    <table-footer
+      :page-num="pageNum"
+      :totals="total"
+      :size="pageSize"
+      @sizeChange="sizeChange"
+      @pageChange="pageChange"></table-footer>
+    <el-dialog
+      :title="showType ? '编 辑' : '新 增'"
+      :visible.sync="dialogVisible"
+      @close="reset"
+      width="20%">
+      <div>
+        <el-form ref="form" :model="form" :rules="rules" label-width="80px" size="mini">
+          <el-form-item label="功能名称" prop="functionName">
+            <el-input v-model="form.functionName"></el-input>
+          </el-form-item>
+          <el-form-item label="备注">
+            <el-input v-model="form.remark"></el-input>
+          </el-form-item>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+          <el-button @click="reset">取 消</el-button>
+          <el-button type="primary" @click="onSubmit('form')">{{showType ? '更 新' : '新 增'}}</el-button>
+        </span>
+    </el-dialog>
+    <el-dialog title="选择功能区" :visible.sync="showModal" @close="modalReset">
+      <el-table  ref="multipleTable" :data="functionList" @selection-change="handleSelectionChange">
+        <el-table-column
+          type="selection"
+          width="55">
+        </el-table-column>
+        <el-table-column label="功能区名称" prop="functionName"></el-table-column>
+      </el-table>
+      <span slot="footer" class="dialog-footer">
+          <el-button @click="modalReset">取 消</el-button>
+          <el-button type="primary" :disabled="isButton" @click="onCheckSave">保存</el-button>
+        </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+
+import {getFunctionMonitList, getAreaFunctionList, addAreaFunction, editAreaFunction, delAreaFunction, saveCameraFunctionArea, getCameraFunctionArea} from "../../utils/api";
+import TableFooter from "../../components/TableFooter";
+
+export default {
+  name: "FunctionArea",
+  components: {
+    TableFooter
+  },
+  data() {
+    return {
+      name: '',
+      pageNum: 1,
+      pageSize: 20,
+      list: [],
+      total: 0,
+      showType: false,
+      dialogVisible: false,
+      rules: {
+        functionName: [ { required: true, message: '区域名称不能为空', trigger: 'blur' } ],
+      },
+      form: {
+        functionName: '',
+        remark: '',
+      },
+      functionList: [],
+      showModal: false,
+      isButton: true,
+      selectIdList: [],
+      selectId: '',
+    }
+  },
+  methods: {
+    // 修改size
+    sizeChange(val) {
+      this.pageSize = val;
+      this.init();
+    },
+    // 修改页数
+    pageChange(val) {
+      this.pageNum= val;
+      this.init();
+    },
+    init() {
+      let params = {
+        current: this.pageNum,
+        size: this.pageSize,
+        functionName: this.name,
+      }
+      getAreaFunctionList(params).then(res => {
+        if(res.code === 10000) {
+          this.list = res.data.records;
+          this.total = res.data.total;
+        }
+      })
+    },
+    search() {
+      this.pageNum = 1;
+      this.init()
+    },
+    reset() {
+      this.form = {
+        functionName: '',
+        remark: '',
+      }
+      this.dialogVisible = false;
+      this.showType = false;
+    },
+    add() {
+      this.dialogVisible = true;
+      this.showType = false;
+    },
+    edit(row) {
+      this.dialogVisible = true;
+      this.showType = true;
+      this.form = {
+        id: row.id,
+        functionName: row.functionName,
+        remark: row.remark
+      }
+    },
+    del(row) {
+      let params = {
+        ids: row.id
+      }
+      delAreaFunction(params).then(res => {
+        if(res.code === 10000) {
+          this.init();
+          this.$message.success(res.message)
+        } else {
+          this.$message.error(res.message)
+        }
+      })
+    },
+    onSubmit(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          if (this.showType) {
+            // 编辑
+            let params = {
+              id: this.form.id,
+              functionName: this.form.functionName,
+              remark: this.form.remark
+            }
+            editAreaFunction(params).then(res => {
+              this.reset()
+              if (res.code === 10000) {
+                this.init();
+                this.$message.success(res.message)
+              } else {
+                this.$message.error(res.message)
+              }
+            })
+          } else {
+            // 新增
+            let params = {
+              functionName: this.form.functionName,
+              remark: this.form.remark
+            }
+            addAreaFunction(params).then(res => {
+              if(res.code === 10000) {
+                this.init();
+                this.$message.success(res.message);
+              } else {
+                this.$message.error(res.message)
+              }
+            }).finally(() => {
+              this.reset()
+            })
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      })
+    },
+
+    initFunction() {
+      let params = {
+        current: 1,
+        size: 2000
+      }
+      getFunctionMonitList(params).then(res => {
+        if(res.code === 10000) {
+          this.functionList = res.data.records;
+        }
+      })
+    },
+    handleSelectionChange(val) {
+      this.isButton = false;
+
+      let arr = []
+      val.forEach(item => {
+        arr.push(item.id)
+      })
+
+      this.selectIdList = arr;
+    },
+    open(row) {
+      this.selectId = row.id;
+      this.showModal = true;
+      let params = {
+        id: row.id
+      }
+      getCameraFunctionArea(params).then(res => {
+        if(res.code === 10000) {
+          if(res.data.length > 0) {
+            let list = [];
+            this.functionList.forEach(item => {
+              res.data.forEach(val => {
+                if(item.id == val) {
+                  list.push(item)
+                }
+              })
+            })
+            if(list) {
+              list.forEach((row) => {
+                this.$refs.multipleTable.toggleRowSelection(row, true)
+              })
+            }
+          }
+        }
+      })
+    },
+    modalReset() {
+      this.showModal = false;
+      this.selectIdList = [];
+      this.selectId = '';
+      this.$refs.multipleTable.clearSelection();
+    },
+    onCheckSave() {
+      let params = {
+        functionAreaId: this.selectId,
+        functionIds: this.selectIdList.join(',')
+      }
+      saveCameraFunctionArea(params).then(res => {
+        if(res.code === 10000) {
+          this.$message.success(res.message);
+        } else {
+          this.$message.error(res.message);
+        }
+      }).finally(() => {
+        this.modalReset()
+      })
+    }
+
+  },
+  mounted() {
+    this.init()
+    this.initFunction()
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 271 - 0
src/views/Video/FunctionMonit.vue

@@ -0,0 +1,271 @@
+<template>
+  <div style="padding: 20px; box-sizing: border-box">
+    <el-form inline>
+      <el-form-item label="功能区名称">
+        <el-input v-model="name"></el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary">查询</el-button>
+        <el-button type="success" @click="add">新增功能区</el-button>
+      </el-form-item>
+    </el-form>
+    <br>
+    <el-table height="600" :data="list" border>
+      <el-table-column label="功能区名称" prop="functionName"></el-table-column>
+      <el-table-column label="备注" prop="remark"></el-table-column>
+      <el-table-column label="操作">
+        <template slot-scope="scope">
+          <el-button @click="open(scope.row)" size="mini" type="primary">添加摄像头</el-button>
+          <el-button @click="edit(scope.row)" size="mini" >编辑</el-button>
+          <el-popconfirm
+            title=" 确定要删除这个功能区吗?"
+            @confirm="del(scope.row)"
+          >
+            <el-button style="margin-left: 10px" type="danger" size="mini" slot="reference">删除</el-button>
+          </el-popconfirm>
+        </template>
+      </el-table-column>
+    </el-table>
+    <table-footer
+      :page-num="pageNum"
+      :totals="total"
+      :size="pageSize"
+      @sizeChange="sizeChange"
+      @pageChange="pageChange"></table-footer>
+    <!-- 新增编辑   -->
+    <el-dialog
+      :title="showType ? '编 辑' : '新 增'"
+      :visible.sync="dialogVisible"
+      @close="reset"
+      width="20%">
+      <div>
+        <el-form ref="form" :model="form" :rules="rules" label-width="80px" size="mini">
+          <el-form-item label="功能名称" prop="functionName">
+            <el-input v-model="form.functionName"></el-input>
+          </el-form-item>
+          <el-form-item label="备注">
+            <el-input v-model="form.remark"></el-input>
+          </el-form-item>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+          <el-button @click="reset">取 消</el-button>
+          <el-button type="primary" @click="onSubmit('form')">{{showType ? '更 新' : '新 增'}}</el-button>
+        </span>
+    </el-dialog>
+    <el-dialog title="选择监控" :visible.sync="showModal" @close="modalReset">
+      <el-tree
+        ref="myTree"
+        node-key="id"
+        show-checkbox
+        default-expand-all
+        check-strictly
+        :default-checked-keys="checkedKeys"
+        :data="monitList"
+        :props="{ label: 'cameraName', children: 'cameraList', disabled: 'selectable'}"
+        @check="handlerSelect"
+        ></el-tree>
+      <span slot="footer" class="dialog-footer">
+          <el-button @click="modalReset">取 消</el-button>
+          <el-button type="primary" :disabled="isButton" @click="onCheckSave">保存</el-button>
+        </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {addFunctionMonit, editFunctionMonit, getFunctionMonitList, delFunctionMonit , getVideoAll, cameraFunctionList, addCameraFunction} from "../../utils/api";
+import TableFooter from "../../components/TableFooter";
+// import { Tree as ATree } from "ant-design-vue";
+
+export default {
+  name: "FunctionMonit",
+  components: {
+    TableFooter,
+    // ATree
+  },
+  data() {
+    return {
+      name: '',
+      pageNum: 1,
+      pageSize: 20,
+      list: [],
+      total: 0,
+      dialogVisible: false,
+      showType: false,
+      rules: {
+        functionName: [ { required: true, message: '区域名称不能为空', trigger: 'blur' } ],
+      },
+      form: {
+        functionName: '',
+        remark: '',
+      },
+      showModal: false,
+      monitList: [],
+      checkedKeys: [],
+      isButton: true,
+      selectId: ''
+    }
+  },
+  methods: {
+    // 修改size
+    sizeChange(val) {
+      this.pageSize = val;
+      this.init();
+    },
+    // 修改页数
+    pageChange(val) {
+      this.pageNum= val;
+      this.init();
+    },
+    init() {
+      let params = {
+        current: this.pageNum,
+        size: this.pageSize,
+        functionName: this.name
+      }
+      getFunctionMonitList(params).then(res => {
+        if(res.code === 10000) {
+          this.list = res.data.records;
+          this.total = res.data.total;
+        }
+      })
+    },
+    reset() {
+      this.form = {
+        functionName: '',
+        remark: '',
+      }
+      this.dialogVisible = false;
+      this.showType = false;
+    },
+    add() {
+      this.dialogVisible = true;
+      this.showType = false;
+    },
+    edit(row) {
+      this.dialogVisible = true;
+      this.showType = true;
+      this.form = {
+        id: row.id,
+        functionName: row.functionName,
+        remark: row.remark
+      }
+    },
+    del(row) {
+      let params = {
+        ids: row.id
+      }
+      delFunctionMonit(params).then(res => {
+        if(res.code === 10000) {
+          this.init();
+          this.$message.success(res.message)
+        } else {
+          this.$message.error(res.message)
+        }
+      })
+    },
+    onSubmit(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          if (this.showType) {
+            // 编辑
+            let params = {
+              id: this.form.id,
+              functionName: this.form.functionName,
+              remark: this.form.remark
+            }
+            editFunctionMonit(params).then(res => {
+              this.reset()
+              if(res.code === 10000) {
+                this.init();
+                this.$message.success(res.message)
+              } else {
+                this.$message.error(res.message)
+              }
+            })
+          } else {
+            // 新增
+            let params = {
+              functionName: this.form.functionName,
+              remark: this.form.remark
+            }
+            addFunctionMonit(params).then(res => {
+              if(res.code === 10000) {
+                this.init();
+                this.$message.success(res.message);
+              } else {
+                this.$message.error(res.message)
+              }
+            }).finally(() => {
+              this.reset()
+            })
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      })
+    },
+    initMonit() {
+      getVideoAll({}).then(res => {
+        if(res.code === 10000) {
+          res.data.forEach(items => {
+            items.selectable = true
+            items.cameraList.forEach(item => {
+              item.selectable = false
+            })
+          })
+          this.monitList = res.data;
+          console.log(this.monitList)
+        }
+      })
+    },
+    open(row) {
+      this.selectId = row.id;
+      this.showModal = true;
+      let params = {
+        functionId: this.selectId,
+      }
+      cameraFunctionList(params).then(res => {
+        if(res.code === 10000) {
+          this.checkedKeys = res.data;
+        }
+      })
+    },
+    handlerSelect(val, check) {
+      this.checkedKeys = check.checkedKeys;
+      this.isButton = false;
+    },
+    onCheckSave() {
+      let params = {
+        functionId: this.selectId,
+        carmeraId: this.checkedKeys.join(',')
+      }
+      addCameraFunction(params).then(res => {
+        if(res.code === 10000) {
+          this.$message.success(res.message);
+        } else {
+          this.$message.error(res.message);
+        }
+      }).finally(() => {
+        this.checkedKeys = [];
+        this.showModal = false;
+      })
+    },
+    modalReset() {
+      this.checkedKeys = [];
+      this.showModal = false;
+      this.$refs.myTree.setCheckedKeys([]);
+    }
+  },
+  mounted() {
+    this.init()
+    this.initMonit()
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 31 - 1
src/views/Video/VideoAdmin.vue

@@ -65,6 +65,10 @@
           >查看摄像头</el-button
         >
       </template>
+      <template #isOnline="scope">
+        <span v-if="lastFarmId == 11">{{scope.row.isOnline == 1 ? '在线' : '离线'}}</span>
+        <span v-else>未实现巡检</span>
+      </template>
     </new-table>
     <table-footer
       :totals="total"
@@ -212,6 +216,22 @@ export default {
           field: "brandId",
           options: [],
         },
+        {
+          type: 'select',
+          label: '摄像头状态',
+          placeholder: '请选择状态',
+          field: 'isOnline',
+          options: [
+            {
+              label: '在线',
+              value: 1
+            },
+            {
+              label: '离线',
+              value: 0
+            }
+          ]
+        },
         // {
         //   type: 'select',
         //   label: '摄像头排序:',
@@ -239,6 +259,7 @@ export default {
       areaId: "",
       brandId: "",
       sort: "",
+      isOnline: '',
       pageNum: 1,
       pageSize: 20,
       total: 0,
@@ -287,6 +308,11 @@ export default {
           minWidth: "100",
           slotName: "password",
         },
+        {
+          slotName: 'isOnline',
+          label: '是否在线',
+          minWidth: "100"
+        },
         // {
         //   prop: 'sort',
         //   label: '排序',
@@ -300,7 +326,7 @@ export default {
         },
         {
           label: "操作",
-          minWidth: "150",
+          minWidth: "200",
           slotName: "handler",
         },
       ],
@@ -348,6 +374,7 @@ export default {
       isVideo: false,
       last: "",
       next: "",
+      lastFarmId: '',
     };
   },
   methods: {
@@ -368,6 +395,7 @@ export default {
         areaId: this.areaId,
         brandId: this.brandId,
         strchStr: this.keyWord,
+        isOnline: this.isOnline
         // sort: this.sort
       };
       videoList(params).then((res) => {
@@ -383,6 +411,7 @@ export default {
       this.brandId = data.brandId ? data.brandId : "";
       this.sort = data.sort;
       this.pageNum = 1;
+      this.isOnline = data.isOnline;
       this.init();
     },
     // 获取区域,摄像头品牌
@@ -617,6 +646,7 @@ export default {
     },
   },
   mounted() {
+    this.lastFarmId = localStorage.getItem('lastFarmId');
     this.getArea();
     this.init();
   },

+ 113 - 0
src/views/Video/VideoBack.vue

@@ -0,0 +1,113 @@
+<template>
+  <div class="video">
+    <el-card>
+      <el-form :inline="true" label-width="100px" size="mini">
+        <el-form-item label="选择监控">
+          <el-cascader
+            v-model="videoId"
+            :options="options"
+            @change="handleChange"
+            ref="cascader"
+            size="mini"
+            :props="{value: 'id', label: 'cameraName', children: 'cameraList', expandTrigger: 'hover', disabled: 'runStatus'}"
+            :show-all-levels="false"></el-cascader>
+        </el-form-item>
+        <el-form-item label="选择回放时间">
+          <el-date-picker
+            v-model="value"
+            type="datetimerange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="timestamp">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="search">查询</el-button>
+          <el-button @click="reset">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </el-card>
+    <br>
+    <el-card>
+      <div style="width: 90%; height: 700px; margin: 0 auto;">
+        <iframe
+          v-if="videoVisible"
+          :src="'static/dahua/index.html?' + rtsp"
+          frameborder="0"
+          style="width: 100%; height: 100%"
+        >
+        </iframe>
+      </div>
+    </el-card>
+  </div>
+</template>
+
+<script>
+import { getVideoAll, getVideoBack } from "../../utils/api";
+
+export default {
+  name: "VideoBack",
+  data() {
+    return {
+      videoId: '',
+      options: [],
+      value: [],
+      name: '',
+      rtsp: '',
+      videoVisible: false,
+    }
+  },
+  methods: {
+    initVideoAll() {
+      getVideoAll({}).then(res => {
+        if(res.code === 10000) {
+          res.data.forEach(item => {
+            item.cameraList.forEach(items => {
+              items.runStatus = !items.runStatus
+            })
+          })
+          this.options = res.data
+        }
+      })
+    },
+    search() {
+      if(this.videoId && this.value.length > 0) {
+        this.videoVisible = false;
+        let params = {
+          id: this.videoId[1],
+          startTime: this.value[0] / 1000,
+          endTime: this.value[1] / 1000
+        }
+        getVideoBack(params).then(res => {
+          if(res.code === 0) {
+            this.rtsp = res.URL;
+            this.videoVisible = true;
+          }
+        })
+      } else {
+        this.$message.error('监控和时间必填!')
+      }
+    },
+    reset() {
+      this.value = [];
+      this.videoId = '';
+      this.name = '';
+    },
+    handleChange() {
+      this.name =  this.$refs["cascader"].getCheckedNodes()[0].label;
+    }
+
+  },
+  mounted() {
+    this.initVideoAll()
+  }
+}
+</script>
+
+<style scoped>
+  .video {
+    box-sizing: border-box;
+    padding: 20px;
+  }
+</style>

+ 14 - 1
src/views/Video/VideoLook.vue

@@ -77,7 +77,7 @@
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="reset">重 置</el-button>
-        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button @click="reset">取 消</el-button>
         <el-button type="primary" @click="onSubmit('form')">{{
             showType ? "更 新" : "新 增"
           }}</el-button>
@@ -156,6 +156,10 @@ export default {
         {
           id: 2,
           name: '环境监测'
+        },
+        {
+          id: 3,
+          name: '报警信息'
         }
       ],
       showType: false,
@@ -243,6 +247,13 @@ export default {
     handleChange(value) {
        this.form.videoId = value[value.length - 1];
     },
+    reset() {
+      this.dialogVisible = false;
+      this.form = {
+        videoId: '',
+        type: ''
+      }
+    },
     onSubmit(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
@@ -261,6 +272,7 @@ export default {
                 this.$message.error(res.message);
               }
               this.dialogVisible = false;
+              this.reset()
             })
           } else {
             let params = {
@@ -276,6 +288,7 @@ export default {
                 this.$message.error(res.message);
               }
               this.dialogVisible = false;
+              this.reset()
             })
           }
         } else {

+ 50 - 24
src/views/dashboard/chart/ChartPig.vue

@@ -45,8 +45,6 @@ export default {
       let dataAxis = this.data.timeList;
       let start = dataAxis.length - 12;
       let end = dataAxis.length - 1;
-      let quantityList = this.data.quantityList;
-      let moneyListTooltip = this.data.moneyList1;
       let options = {
         title: {
           x: 60,
@@ -59,28 +57,8 @@ export default {
         },
         tooltip: {
           trigger: "axis",
-          formatter: (params) => {
-            var res = "<div>" + params[0].name + "</div>"; // 字符串形式的html标签会被echarts转换渲染成数据,这个res主要是画的tooltip里的上部分的标题部分
-            const index = this.data.moneyList.findIndex(
-              (item) => item === params[0].value
-            );
-            for (var i = 0; i < params.length; i++) {
-              //因为是个数组,所以要遍历拿到里面的数据,并加入到tooltip的数据内容部分里面去
-              res +=
-                `<div style="color: #fff;font-size: 14px; padding:0 12px;">
-                  <span style="display:inline-block;margin-right:5px;border-radius:5px;width:10px;height:10px;background-color:${[
-                    params[i].color, // 默认是小圆点,我们将其修改成有圆角的正方形,这里用的是模板字符串。并拿到对应颜色、名字、数据
-                  ]};"></span>
-                  ${moneyListTooltip[index]}元
-                </div>` +
-                `<div style="color: #fff;font-size: 14px; padding:0 12px;"><span style="display:inline-block;margin-right:5px;border-radius:5px;width:10px;height:10px;background-color:${[
-                  params[i].color,
-                ]};"></span>${quantityList[index]}头</div>`;
-            }
-            return res;
-          },
         },
-        color: [this.color],
+        color: [this.color, '#45C3A6'],
         dataZoom: [
           {
             type: "inside",
@@ -127,10 +105,30 @@ export default {
               show: false,
             },
           },
+          {
+            type: "value",
+            name: "头",
+            axisLabel: {
+              // formatter: "{value} 元",
+              show: true,
+            },
+            axisLine: {
+              show: true,
+              lineStyle: {
+                color: "#6e7079",
+              },
+            },
+            axisTick: {
+              show: false,
+            },
+            splitLine: {
+              show: false,
+            },
+          },
         ],
         series: [
           {
-            name: "元",
+            name: "销售",
             type: "line",
             // stack: 'Total',
             smooth: true,
@@ -152,6 +150,34 @@ export default {
             },
             data: this.data.moneyList,
           },
+          {
+            name: "头数",
+            type: "line",
+            yAxisIndex: 1,
+            // stack: 'Total',
+            smooth: true,
+            areaStyle: {},
+            emphasis: {
+              focus: "series",
+            },
+            itemStyle: {
+              color: "#45C3A6",
+              borderColor: "#45C3A6",
+              normal: {
+                label: {
+                  show: false,
+                  textStyle: {
+                    fontSize: 14,
+                  },
+                },
+                areaStyle: {
+                  type: "default",
+                  opacity: 0.2,
+                },
+              },
+            },
+            data: this.data.quantityList,
+          },
         ],
       };
       this.myChart.setOption(options);