浏览代码

2021-12-20

East 3 年之前
父节点
当前提交
a25edf5403
共有 3 个文件被更改,包括 821 次插入614 次删除
  1. 4 12
      src/views/Env/SalePig.vue
  2. 341 225
      src/views/Video/VideoAdmin.vue
  3. 476 377
      src/views/dashboard/dashboard.vue

+ 4 - 12
src/views/Env/SalePig.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-12-07 10:07:56
- * @LastEditTime: 2021-12-08 19:48:21
+ * @LastEditTime: 2021-12-20 14:05:31
  * @LastEditors: Please set LastEditors
  * @Description: 电子秤
  * @FilePath: \hyyfClient\src\views\Env\SalePig.vue
@@ -104,18 +104,10 @@ export default {
         },
       ],
       day: 1,
-      elecAllCount: "123.1",
+      elecAllCount: "0",
       elecData: {
-        month: [
-          "07-01周六",
-          "07-02周日",
-          "07-03周一",
-          "07-04周二",
-          "07-05周三",
-          "07-06周四",
-          "07-07周五",
-        ],
-        elecList: [36.5, 37.8, 38.5, 37.7, 37.9, 37.4, 36.4],
+        month: [],
+        elecList: [],
       },
       elecDataList: [],
       tableItems: [

+ 341 - 225
src/views/Video/VideoAdmin.vue

@@ -1,50 +1,112 @@
 <template>
   <div class="videoAdmin">
     <!-- 查询   -->
-    <query-conditions :formItems="searchList" @getQueryParams="handleQuery"></query-conditions>
+    <query-conditions
+      :formItems="searchList"
+      @getQueryParams="handleQuery"
+    ></query-conditions>
     <!-- 表格   -->
-    <new-table :height="600" :title="title" :listData="videoLists" :tableItems="tableItems" :shows="tableShows" @selectionChange="selectionChange">
+    <new-table
+      :height="600"
+      :title="title"
+      :listData="videoLists"
+      :tableItems="tableItems"
+      :shows="tableShows"
+      @selectionChange="selectionChange"
+    >
       <template #right>
-        <el-button size="mini" type="primary" v-if="hasPerm('video:add')" style="margin-right: 10px" @click="add">添加监控</el-button>
-        <el-button size="mini" type="danger" v-if="hasPerm('video:del')" @click="delAll">批量删除</el-button>
+        <el-button
+          size="mini"
+          type="primary"
+          v-if="hasPerm('video:add')"
+          style="margin-right: 10px"
+          @click="add"
+          >添加监控</el-button
+        >
+        <el-button
+          size="mini"
+          type="danger"
+          v-if="hasPerm('video:del')"
+          @click="delAll"
+          >批量删除</el-button
+        >
       </template>
       <template #start="scope">
-        <el-switch v-model="scope.row.runStatus" @change="onSwitch(scope.row)"></el-switch>
+        <el-switch
+          v-model="scope.row.runStatus"
+          @change="onSwitch(scope.row)"
+        ></el-switch>
       </template>
       <template #handler="scope">
-        <el-button size="mini" style="margin-right: 10px" v-if="hasPerm('video:edit')" @click="edit(scope.row)">编辑</el-button>
+        <el-button
+          size="mini"
+          style="margin-right: 10px"
+          v-if="hasPerm('video:edit')"
+          @click="edit(scope.row)"
+          >编辑</el-button
+        >
         <el-popconfirm
-            title=" 确定要删除这个区域吗?"
-            @confirm="del(scope.row)"
+          title=" 确定要删除这个区域吗?"
+          @confirm="del(scope.row)"
         >
-          <el-button type="danger"  v-if="hasPerm('video:del')" size="mini" slot="reference">删除</el-button>
+          <el-button
+            type="danger"
+            v-if="hasPerm('video:del')"
+            size="mini"
+            slot="reference"
+            >删除</el-button
+          >
         </el-popconfirm>
-        <el-button size="mini" type="primary" style="margin-left: 10px" @click="open(scope.row)">查看摄像头</el-button>
+        <el-button
+          size="mini"
+          type="primary"
+          style="margin-left: 10px"
+          @click="open(scope.row)"
+          >查看摄像头</el-button
+        >
       </template>
     </new-table>
     <table-footer
-        :totals="total"
-        :size="pageSize"
-        @sizeChange="sizeChange"
-        @pageChange="pageChange"></table-footer>
+      :totals="total"
+      :size="pageSize"
+      @sizeChange="sizeChange"
+      @pageChange="pageChange"
+    ></table-footer>
     <!-- 新增编辑   -->
     <el-dialog
-        :title="showType ? '编 辑' : '新 增'"
-        :visible.sync="dialogVisible"
-        width="30%">
+      :title="showType ? '编 辑' : '新 增'"
+      :visible.sync="dialogVisible"
+      width="30%"
+    >
       <div>
-        <el-form ref="form" :model="form" :rules="rules" label-width="100px" size="mini">
+        <el-form
+          ref="form"
+          :model="form"
+          :rules="rules"
+          label-width="100px"
+          size="mini"
+        >
           <el-form-item label="摄像头名称" prop="cameraName">
             <el-input v-model="form.cameraName"></el-input>
           </el-form-item>
           <el-form-item label="所属区域" prop="areaId">
             <el-select v-model="form.areaId">
-              <el-option v-for="item in searchList[0].options" :key="item.value" :label="item.label" :value="item.value"></el-option>
+              <el-option
+                v-for="item in searchList[0].options"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              ></el-option>
             </el-select>
           </el-form-item>
           <el-form-item label="所属品牌" prop="brandId">
             <el-select v-model="form.brandId">
-              <el-option v-for="item in searchList[1].options" :key="item.value" :label="item.label" :value="item.value"></el-option>
+              <el-option
+                v-for="item in searchList[1].options"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              ></el-option>
             </el-select>
           </el-form-item>
           <el-form-item label="ip地址" prop="cameraIp">
@@ -59,26 +121,52 @@
           <el-form-item label="斯高德房间id">
             <el-input v-model="form.roomId"></el-input>
           </el-form-item>
-<!--          <el-form-item label="排序" prop="sort">-->
-<!--            <el-input v-model="form.sort"></el-input>-->
-<!--          </el-form-item>-->
+          <!--          <el-form-item label="排序" prop="sort">-->
+          <!--            <el-input v-model="form.sort"></el-input>-->
+          <!--          </el-form-item>-->
         </el-form>
       </div>
       <span slot="footer" class="dialog-footer">
-          <el-button @click="reset">重 置</el-button>
-          <el-button @click="dialogVisible = false">取 消</el-button>
-          <el-button type="primary" @click="onSubmit('form')">{{showType ? '更 新' : '新 增'}}</el-button>
-        </span>
+        <el-button @click="reset">重 置</el-button>
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="onSubmit('form')">{{
+          showType ? "更 新" : "新 增"
+        }}</el-button>
+      </span>
     </el-dialog>
-    <el-dialog
-        :title="cameraTitle"
-        :visible.sync="isVideo"
-        width="50%">
+    <el-dialog :title="cameraTitle" :visible.sync="isVideo" width="50%">
       <div style="width: 100%; height: 560px; text-align: center;">
-        <iframe v-if="isVideo" :src="'static/jinm/index.html?'+'1'+','+ cameraOne +','+ cameraTwo + ',' +'100%' + ',' + '0'" style="width: 100%; height: 530px;" frameborder="0"  allowfullscreen="true"></iframe>
+        <iframe
+          v-if="isVideo"
+          :src="
+            'static/jinm/index.html?' +
+              '1' +
+              ',' +
+              cameraOne +
+              ',' +
+              cameraTwo +
+              ',' +
+              '100%' +
+              ',' +
+              '0'
+          "
+          style="width: 100%; height: 530px;"
+          frameborder="0"
+          allowfullscreen="true"
+        ></iframe>
         <div>
-          <el-button :disabled="last === null" size="small" @click="getNext(last)">上一个</el-button>
-          <el-button :disabled="next === null" size="small" @click="getNext(next)">下一个</el-button>
+          <el-button
+            :disabled="last === null"
+            size="small"
+            @click="getNext(last)"
+            >上一个</el-button
+          >
+          <el-button
+            :disabled="next === null"
+            size="small"
+            @click="getNext(next)"
+            >下一个</el-button
+          >
         </div>
       </div>
     </el-dialog>
@@ -89,8 +177,17 @@
 import QueryConditions from "@/components/bioSafety/QueryConditions";
 import NewTable from "@/components/newTable/NewTable";
 import TableFooter from "@/components/TableFooter";
-import {areaList, brandList, videoList, videoSwitch, delVideo, addVideo, editVideo, getVideo} from '../../utils/api'
-import {arrToIds} from "@/utils";
+import {
+  areaList,
+  brandList,
+  videoList,
+  videoSwitch,
+  delVideo,
+  addVideo,
+  editVideo,
+  getVideo,
+} from "../../utils/api";
+import { arrToIds } from "@/utils";
 export default {
   name: "VideoAdmin",
   components: {
@@ -102,18 +199,18 @@ export default {
     return {
       searchList: [
         {
-          type: 'select',
-          label: '区域搜索:',
-          placeholder: '请选择区域',
-          field: 'areaId',
-          options: []
+          type: "select",
+          label: "区域搜索:",
+          placeholder: "请选择区域",
+          field: "areaId",
+          options: [],
         },
         {
-          type: 'select',
-          label: '摄像头品牌:',
-          placeholder: '请选择品牌',
-          field: 'brandId',
-          options: []
+          type: "select",
+          label: "摄像头品牌:",
+          placeholder: "请选择品牌",
+          field: "brandId",
+          options: [],
         },
         // {
         //   type: 'select',
@@ -132,63 +229,63 @@ export default {
         //   ]
         // },
         {
-          type: 'input',
-          label: '名称搜索:',
-          placeholder: '请输入摄像头名称',
-          field: 'keyWord'
+          type: "input",
+          label: "名称搜索:",
+          placeholder: "请输入摄像头名称",
+          field: "keyWord",
         },
       ],
-      keyWord: '',
-      areaId: '',
-      brandId: '',
-      sort: '',
+      keyWord: "",
+      areaId: "",
+      brandId: "",
+      sort: "",
       pageNum: 1,
       pageSize: 20,
       total: 0,
       videoLists: [],
-      title: '监控列表',
+      title: "监控列表",
       tableItems: [
         {
-          prop: 'id',
-          label: 'ID',
-          minWidth: '50',
-          slotName: 'id'
+          prop: "id",
+          label: "ID",
+          minWidth: "50",
+          slotName: "id",
         },
         {
-          prop: 'cameraName',
-          label: '摄像头名称',
-          minWidth: '100',
-          slotName: 'cameraName'
+          prop: "cameraName",
+          label: "摄像头名称",
+          minWidth: "100",
+          slotName: "cameraName",
         },
         {
-          prop: 'areaName',
-          label: '所属区域',
-          minWidth: '100',
-          slotName: 'areaName'
+          prop: "areaName",
+          label: "所属区域",
+          minWidth: "100",
+          slotName: "areaName",
         },
         {
-          prop: 'brandName',
-          label: '所属品牌',
-          minWidth: '100',
-          slotName: 'brandName'
+          prop: "brandName",
+          label: "所属品牌",
+          minWidth: "100",
+          slotName: "brandName",
         },
         {
-          prop: 'cameraIp',
-          label: 'ip地址',
-          minWidth: '100',
-          slotName: 'cameraIp'
+          prop: "cameraIp",
+          label: "ip地址",
+          minWidth: "100",
+          slotName: "cameraIp",
         },
         {
-          prop: 'account',
-          label: '用户名',
-          minWidth: '100',
-          slotName: 'account'
+          prop: "account",
+          label: "用户名",
+          minWidth: "100",
+          slotName: "account",
         },
         {
-          prop: 'password',
-          label: '密码',
-          minWidth: '100',
-          slotName: 'password'
+          prop: "password",
+          label: "密码",
+          minWidth: "100",
+          slotName: "password",
         },
         // {
         //   prop: 'sort',
@@ -197,49 +294,61 @@ export default {
         //   slotName: 'sort'
         // },
         {
-          label: '是否启用',
-          minWidth: '80',
-          slotName: 'start'
+          label: "是否启用",
+          minWidth: "80",
+          slotName: "start",
         },
         {
-          label: '操作',
-          minWidth: '150',
-          slotName: 'handler'
-        }
+          label: "操作",
+          minWidth: "150",
+          slotName: "handler",
+        },
       ],
       tableShows: {
         showIndex: false,
-        showSelect: true
+        showSelect: true,
       },
       dialogVisible: false,
       showType: false,
       form: {
-        cameraName: '',
-        areaId: '',
-        brandId: '',
-        cameraIp: '',
-        account: '',
-        password: '',
-        sort: '',
-        roomId: '',
+        cameraName: "",
+        areaId: 26,
+        brandId: 2,
+        cameraIp: "",
+        account: "admin",
+        password: "a12345678",
+        sort: "",
+        roomId: "",
       },
       rules: {
-        cameraName: [ { required: true, message: '摄像头名称不能为空', trigger: 'blur' } ],
-        areaId: [ { required: true, message: '区域不能为空', trigger: 'change' } ],
-        brandId: [ { required: true, message: '品牌不能为空', trigger: 'change' } ],
-        cameraIp: [ { required: true, message: 'ip地址不能为空', trigger: 'blur' } ],
-        account: [ { required: true, message: '用户名不能为空', trigger: 'blur' } ],
-        password: [ { required: true, message: '密码不能为空', trigger: 'blur' } ],
-        sort:  [ { required: true, message: '请输入排序', trigger: 'blur' } ],
+        cameraName: [
+          { required: true, message: "摄像头名称不能为空", trigger: "blur" },
+        ],
+        areaId: [
+          { required: true, message: "区域不能为空", trigger: "change" },
+        ],
+        brandId: [
+          { required: true, message: "品牌不能为空", trigger: "change" },
+        ],
+        cameraIp: [
+          { required: true, message: "ip地址不能为空", trigger: "blur" },
+        ],
+        account: [
+          { required: true, message: "用户名不能为空", trigger: "blur" },
+        ],
+        password: [
+          { required: true, message: "密码不能为空", trigger: "blur" },
+        ],
+        sort: [{ required: true, message: "请输入排序", trigger: "blur" }],
       },
       selectList: [],
-      cameraOne: '',
-      cameraTwo: '',
-      cameraTitle: '',
+      cameraOne: "",
+      cameraTwo: "",
+      cameraTitle: "",
       isVideo: false,
-      last: '',
-      next: '',
-    }
+      last: "",
+      next: "",
+    };
   },
   methods: {
     // 修改size
@@ -249,7 +358,7 @@ export default {
     },
     // 修改页数
     pageChange(val) {
-      this.pageNum= val;
+      this.pageNum = val;
       this.init();
     },
     init() {
@@ -260,18 +369,18 @@ export default {
         brandId: this.brandId,
         strchStr: this.keyWord,
         // sort: this.sort
-      }
-      videoList(params).then(res => {
-        if(res.code === 10000) {
+      };
+      videoList(params).then((res) => {
+        if (res.code === 10000) {
           this.videoLists = res.data.records;
           this.total = res.data.total;
         }
-      })
+      });
     },
     handleQuery(data) {
-      this.areaId = data.areaId ? data.areaId : '';
-      this.keyWord = data.keyWord ? data.keyWord : '';
-      this.brandId = data.brandId ? data.brandId : '';
+      this.areaId = data.areaId ? data.areaId : "";
+      this.keyWord = data.keyWord ? data.keyWord : "";
+      this.brandId = data.brandId ? data.brandId : "";
       this.sort = data.sort;
       this.pageNum = 1;
       this.init();
@@ -281,40 +390,46 @@ export default {
       let params = {
         current: 1,
         size: 100,
-        areaName: ''
-      }
-      areaList(params).then(res => {
-        if(res.code === 10000) {
-          res.data.records.forEach(item => {
-            this.searchList[0].options.push({label: item.areaName, value: item.id})
-          })
+        areaName: "",
+      };
+      areaList(params).then((res) => {
+        if (res.code === 10000) {
+          res.data.records.forEach((item) => {
+            this.searchList[0].options.push({
+              label: item.areaName,
+              value: item.id,
+            });
+          });
         }
-      })
+      });
       let params1 = {
         current: 1,
         size: 100,
-        brandName: ''
-      }
-      brandList(params1).then(res => {
-        if(res.code === 10000) {
-          res.data.records.forEach(item => {
-            this.searchList[1].options.push({label: item.brandName, value: item.id})
-          })
+        brandName: "",
+      };
+      brandList(params1).then((res) => {
+        if (res.code === 10000) {
+          res.data.records.forEach((item) => {
+            this.searchList[1].options.push({
+              label: item.brandName,
+              value: item.id,
+            });
+          });
         }
-      })
+      });
     },
     // 是否启用
     onSwitch(row) {
       let params = {
-        id: row.id
-      }
-      videoSwitch(params).then(res => {
-        if(res.code === 10000) {
+        id: row.id,
+      };
+      videoSwitch(params).then((res) => {
+        if (res.code === 10000) {
           this.$message.success(res.message);
         } else {
-          this.$message.error('失败');
+          this.$message.error("失败");
         }
-      })
+      });
     },
     // 批量选择
     selectionChange(rows) {
@@ -341,72 +456,74 @@ export default {
     // 单个删除
     del(row) {
       let params = {
-        ids: row.id
-      }
-      delVideo(params).then(res => {
-        if(res.code === 10000) {
-          this.init()
-          this.$message.success(res.message)
+        ids: row.id,
+      };
+      delVideo(params).then((res) => {
+        if (res.code === 10000) {
+          this.init();
+          this.$message.success(res.message);
         } else {
-          this.$message('删除失败')
+          this.$message("删除失败");
         }
-      })
+      });
     },
     // 批量删除
     delAll() {
-      if(this.selectList.length > 0) {
-        this.$confirm('此操作将永久删除这些品牌,是否继续?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          let ids = arrToIds(this.selectList);
-          let params = {
-            ids: ids
-          }
-          delVideo(params).then(res => {
-            if(res.code === 10000) {
-              this.init();
-              this.$message.success(res.message)
-            } else {
-              this.$message.error('删除失败')
-            }
+      if (this.selectList.length > 0) {
+        this.$confirm("此操作将永久删除这些品牌,是否继续?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+          .then(() => {
+            let ids = arrToIds(this.selectList);
+            let params = {
+              ids: ids,
+            };
+            delVideo(params).then((res) => {
+              if (res.code === 10000) {
+                this.init();
+                this.$message.success(res.message);
+              } else {
+                this.$message.error("删除失败");
+              }
+            });
           })
-        }).catch(() => {
-          this.$message({
-            type: 'info',
-            message: '已取消删除'
+          .catch(() => {
+            this.$message({
+              type: "info",
+              message: "已取消删除",
+            });
           });
-        })
         // delArea()
       } else {
-        this.$message.error('请勾选需要删除的区域');
+        this.$message.error("请勾选需要删除的区域");
         return;
       }
     },
     // 查看摄像头
     open(row) {
-      if(row.runStatus) {
+      if (row.runStatus) {
         let params = {
           cameraIds: [row.id],
           strchStr: this.keyWord,
           areaId: this.areaId,
           brandId: this.brandId,
           // sort: this.sort
-        }
-       getVideo(params).then(res => {
-         if(res.code === 10000) {
-           this.isVideo = true;
-           this.cameraOne = res.data[0].wsUrl;
-           this.cameraTwo = res.data[0].rtspUrl;
-           this.last = res.data[0].lastId;
-           this.next = res.data[0].nextId;
-         } else {
-           this.$message.error(res.message);
-         }
-       })
+        };
+        getVideo(params).then((res) => {
+          if (res.code === 10000) {
+            this.isVideo = true;
+            this.cameraOne = res.data[0].wsUrl;
+            this.cameraTwo = res.data[0].rtspUrl;
+            this.last = res.data[0].lastId;
+            this.next = res.data[0].nextId;
+          } else {
+            this.$message.error(res.message);
+          }
+        });
       } else {
-        this.$message.error('该摄像头未启用');
+        this.$message.error("该摄像头未启用");
       }
     },
     // 新增、编辑
@@ -425,17 +542,16 @@ export default {
               password: this.form.password,
               roomId: this.form.roomId,
               // sort: this.form.sort
-            }
-            editVideo(params).then(res => {
+            };
+            editVideo(params).then((res) => {
               this.dialogVisible = false;
-              if(res.code === 10000) {
+              if (res.code === 10000) {
                 this.init();
-                this.$message.success(res.message)
+                this.$message.success(res.message);
               } else {
-                this.$message.error(res.message)
+                this.$message.error(res.message);
               }
-            })
-
+            });
           } else {
             // 新增
             let params = {
@@ -447,34 +563,34 @@ export default {
               password: this.form.password,
               roomId: this.form.roomId,
               // sort: this.form.sort
-            }
-            addVideo(params).then(res => {
+            };
+            addVideo(params).then((res) => {
               this.dialogVisible = false;
-              if(res.code === 10000) {
+              if (res.code === 10000) {
                 this.init();
                 this.$message.success(res.message);
               } else {
-                this.$message.error(res.message)
+                this.$message.error(res.message);
               }
-            })
+            });
           }
         } else {
-          console.log('error submit!!');
+          console.log("error submit!!");
           return false;
         }
-      })
+      });
     },
     // 重置
     reset() {
       this.form = {
-        cameraName: '',
-        areaId: '',
-        brandId: '',
-        cameraIp: '',
-        account: '',
-        password: '',
-        roomId: '',
-      }
+        cameraName: "",
+        areaId: "",
+        brandId: "",
+        cameraIp: "",
+        account: "",
+        password: "",
+        roomId: "",
+      };
     },
     // 上一个下一个
     getNext(id) {
@@ -483,10 +599,10 @@ export default {
         strchStr: this.keyWord,
         areaId: this.areaId,
         brandId: this.brandId,
-        sort: this.sort
-      }
-      getVideo(params).then(res => {
-        if(res.code === 10000) {
+        sort: this.sort,
+      };
+      getVideo(params).then((res) => {
+        if (res.code === 10000) {
           this.isVideo = true;
           this.cameraTitle = res.data[0].cameraName;
           this.cameraOne = res.data[0].wsUrl;
@@ -496,21 +612,21 @@ export default {
         } else {
           this.$message.error(res.message);
         }
-      })
-    }
+      });
+    },
   },
   mounted() {
-    this.getArea()
-    this.init()
-  }
-}
+    this.getArea();
+    this.init();
+  },
+};
 </script>
 
 <style scoped>
-  .videoAdmin {
-    width: 100%;
-    height: 100%;
-    box-sizing: border-box;
-    padding: 20px;
-  }
+.videoAdmin {
+  width: 100%;
+  height: 100%;
+  box-sizing: border-box;
+  padding: 20px;
+}
 </style>

文件差异内容过多而无法显示
+ 476 - 377
src/views/dashboard/dashboard.vue