Bläddra i källkod

1、视频云监控
2、图片上传

slowslo 4 år sedan
förälder
incheckning
379a84add8

+ 70 - 0
src/api/smartapplication/videocloudaccount.js

@@ -0,0 +1,70 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/vcaccount/videocloudaccount/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+    url: '/api/vcaccount/videocloudaccount/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/vcaccount/videocloudaccount/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/vcaccount/videocloudaccount/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/vcaccount/videocloudaccount/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const login = (accountName) => {
+  return request({
+    url: '/api/vcaccount/videocloudaccount/login',
+    method: 'post',
+    params: {
+      accountName,
+    }
+  })
+}
+
+export const syncByAccount = (accountName) => {
+  return request({
+    url: '/api/yc_video_cloud_device/videoclouddevice/syncByAccount',
+    method: 'post',
+    params:{
+      accountName
+    }
+  })
+}
+

+ 22 - 0
src/api/smartapplication/videoclouddevice.js

@@ -100,3 +100,25 @@ export const updateVideoDevice = (row) => {
     data: row
   })
 }
+
+export const getVideoUrl = (accountName, deviceNum) => {
+  return request({
+    url: '/api/yc_video_cloud_device/videoclouddevice/getVideoUrl',
+    method: 'get',
+    params: {
+      accountName,
+      deviceNum
+    }
+  })
+}
+
+export const syncByDevice = (accountName, deviceNum) => {
+  return request({
+    url: '/api/yc_video_cloud_device/videoclouddevice/syncByDevice',
+    method: 'post',
+    params: {
+      accountName,
+      deviceNum
+    }
+  })
+}

+ 2 - 3
src/const/user/info.js

@@ -9,14 +9,13 @@ export default {
         type: 'upload',
         listType: 'picture-img',
         propsHttp: {
-          res: 'data',
-          url: 'link',
+          url: 'data',
         },
         canvasOption: {
           text: ' ',
           ratio: 0.1
         },
-        action: '/api/blade-resource/oss/endpoint/put-file',
+        action: '/api/upload/putfile',
         tip: '只能上传jpg/png用户头像,且不超过500kb',
         span: 12,
         row: true,

+ 3 - 3
src/views/desk/notice.vue

@@ -134,10 +134,10 @@
               prop: "content",
               component: 'ueditor',
               options: {
-                action: '/api/blade-resource/oss/endpoint/put-file',
+                action: '/api/upload/putfile',
                 props: {
-                  res: "data",
-                  url: "link",
+                  // res: "data",
+                  url: "data",
                 }
               },
               hide: true,

+ 6 - 6
src/views/party/activity.vue

@@ -80,10 +80,10 @@ export default {
     let _this = this;
     return {
       upload: {
-        action: '/api/blade-resource/oss/endpoint/put-file',
+        action: '/api/upload/putfile',
         props: {
-          res: "data",
-          url: "link",
+          // res: "data",
+          url: "data",
         }
       },
       showEnroll: false,
@@ -142,10 +142,10 @@ export default {
             prop: "content",
             component: 'ueditor',
             options: {
-              action: '/api/blade-resource/oss/endpoint/put-file',
+              action: '/api/upload/putfile',
               props: {
-                res: "data",
-                url: "link",
+                // res: "data",
+                url: "data",
               }
             },
             minRows: 6,

+ 6 - 6
src/views/party/meetinglist.vue

@@ -69,10 +69,10 @@ export default {
   data() {
     return {
       upload: {
-        action: '/api/blade-resource/oss/endpoint/put-file',
+        action: '/api/upload/putfile',
         props: {
-          res: "data",
-          url: "link",
+          // res: "data",
+          url: "data",
         }
       },
       commentVisible: false,
@@ -128,10 +128,10 @@ export default {
             prop: "content",
             component: 'ueditor',
             options: {
-              action: '/api/blade-resource/oss/endpoint/put-file',
+              action: '/api/upload/putfile',
               props: {
-                res: "data",
-                url: "link",
+                // res: "data",
+                url: "data",
               }
             },
             minRows: 6,

+ 6 - 6
src/views/party/newslist.vue

@@ -75,10 +75,10 @@
     data() {
       return {
         upload: {
-          action: '/api/blade-resource/oss/endpoint/put-file',
+          action: '/api/upload/putfile',
           props: {
-            res: "data",
-            url: "link",
+            // res: "data",
+            url: "data",
           }
         },
         commentVisible: false,
@@ -134,10 +134,10 @@
               prop: "content",
               component: 'ueditor',
               options: {
-                action: '/api/blade-resource/oss/endpoint/put-file',
+                action: '/api/upload/putfile',
                 props: {
-                  res: "data",
-                  url: "link",
+                  // res: "data",
+                  url: "data",
                 }
               },
               minRows: 6,

+ 4 - 4
src/views/resource/oss.vue

@@ -224,10 +224,10 @@
               prop: "backgroundUrl",
               type: 'upload',
               listType: 'picture-img',
-              action: '/api/blade-resource/oss/endpoint/put-file',
+              action: '/api/upload/putfile',
               propsHttp: {
-                res: 'data',
-                url: 'link',
+                // res: 'data',
+                url: 'data',
               },
               span: 24,
             },
@@ -249,7 +249,7 @@
       },
       'debugForm.code'() {
         const column = this.findObject(this.debugOption.column, "backgroundUrl");
-        column.action = `/api/blade-resource/oss/endpoint/put-file?code=${this.debugForm.code}`;
+        column.action = `/api/upload/putfile?code=${this.debugForm.code}`;
       }
     },
     computed: {

+ 319 - 0
src/views/smartapplication/videocloudaccount.vue

@@ -0,0 +1,319 @@
+<template>
+  <basic-container>
+    <avue-crud :option="option"
+               :table-loading="loading"
+               :data="data"
+               :page.sync="page"
+               :permission="permissionList"
+               :before-open="beforeOpen"
+               v-model="form"
+               ref="crud"
+               @row-update="rowUpdate"
+               @row-save="rowSave"
+               @row-del="rowDel"
+               @search-change="searchChange"
+               @search-reset="searchReset"
+               @selection-change="selectionChange"
+               @current-change="currentChange"
+               @size-change="sizeChange"
+               @refresh-change="refreshChange"
+               @on-load="onLoad">
+      <template slot="menuLeft">
+        <el-button type="danger"
+                   size="small"
+                   icon="el-icon-delete"
+                   plain
+                   v-if="permission.videocloudaccount_delete"
+                   @click="handleDelete">删 除
+        </el-button>
+      </template>
+
+      <template slot="menu" slot-scope="scope">
+        <el-button size="mini" type="text" icon="el-icon-setting">
+          <el-dropdown>
+            <span class="el-dropdown-link">
+              更多<i class="el-icon-arrow-down el-icon--right"></i>
+            </span>
+            <el-dropdown-menu slot="dropdown">
+              <el-dropdown-item v-if="permission.videocloudaccount_login" type="text" @click.native="vcLogin(scope.row.accountName)">登录</el-dropdown-item>
+              <el-dropdown-item v-if="permission.videocloudaccount_syncdevice" type="text" @click.native="syncDevices(scope.row.accountName)">同步设备</el-dropdown-item>
+              <el-dropdown-item v-if="permission.videocloudaccount_delete" type="text" @click.native="rowDel(scope.row)">删除</el-dropdown-item>
+            </el-dropdown-menu>
+
+          </el-dropdown>
+        </el-button>
+      </template>
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+  import {getList, getDetail, add, update, remove, login, syncByAccount} from "../../api/smartapplication/videocloudaccount.js";
+  import {mapGetters} from "vuex";
+
+  export default {
+    data() {
+      return {
+        form: {},
+        query: {},
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        selectionList: [],
+        option: {
+          menuWidth:300,
+          height:'auto',
+          calcHeight: 30,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 6,
+          border: true,
+          index: true,
+          viewBtn: true,
+          selection: true,
+          dialogClickModal: false,
+          column: [
+            {
+              label: "账号",
+              prop: "accountName",
+              width: 140,
+              search: true,
+              rules: [{
+                required: true,
+                message: "请输入用户名称",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "密码",
+              prop: "pwd",
+              width: 140,
+              rules: [{
+                required: true,
+                message: "请输入密码",
+                trigger: "blur"
+              }],
+              hide: true,
+              viewDisplay: false,
+            },
+            {
+              label: "appKey",
+              prop: "appKey",
+              width: 140,
+              rules: [{
+                required: true,
+                message: "请输入appKey",
+                trigger: "blur"
+              }],
+              hide: true,
+              viewDisplay: false,
+            },
+            {
+              label: "城市名称",
+              prop: "cityName",
+              rules: [{
+                required: false,
+                message: "请输入城市名称",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "行政区域名称",
+              prop: "countryName",
+              labelWidth: 100,
+              rules: [{
+                required: false,
+                message: "请输入行政区域名称",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "最近登录时间",
+              prop: "lastLoginTimeString",
+              labelWidth: 120,
+              editDisplay: false,
+              addDisplay: false,
+              rules: [{
+                required: false,
+                message: "请输入最近登录时间",
+                trigger: "blur"
+              }]
+            },
+          ]
+        },
+        data: []
+      };
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.videocloudaccount_add, false),
+          viewBtn: this.vaildData(this.permission.videocloudaccount_view, false),
+          delBtn: this.vaildData(this.permission.videocloudaccount_delete, false),
+          editBtn: this.vaildData(this.permission.videocloudaccount_edit, false),
+          loginBtn: this.vaildData(this.permission.videocloudaccount_login, false),
+          syncDeviceBtn: this.vaildData(this.permission.videocloudaccount_syncdevice, false),
+        };
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    methods: {
+      vcLogin(accountName){
+        login(accountName).then(res => {
+          if (res.data.success) {
+            this.$message({
+              type: "success",
+              message: "登录成功"
+            });
+            this.onLoad(this.page);
+          } else {
+            this.$message({
+              type: "error",
+              message: res.msg
+            });
+          }
+        });
+      },
+      syncDevices(accountName){
+        syncByAccount(accountName).then(res => {
+          if (res.data.success) {
+            this.$message({
+              type: "success",
+              message: res.data.msg
+            });
+          } else {
+            this.$message({
+              type: "error",
+              message: res.data.msg
+            });
+          }
+        })
+      },
+      delete(id){
+        remove(id)
+      },
+      rowSave(row, done, loading) {
+        add(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });
+      },
+      rowUpdate(row, index, done, loading) {
+        update(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then(res => {
+            this.form = res.data.data;
+          });
+        }
+        done();
+      },
+      searchReset() {
+        this.query = {};
+        this.onLoad(this.page);
+      },
+      searchChange(params, done) {
+        this.query = params;
+        this.page.currentPage = 1;
+        this.onLoad(this.page, params);
+        done();
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      selectionClear() {
+        this.selectionList = [];
+        this.$refs.crud.toggleSelection();
+      },
+      currentChange(currentPage){
+        this.page.currentPage = currentPage;
+      },
+      sizeChange(pageSize){
+        this.page.pageSize = pageSize;
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query);
+      },
+      onLoad(page, params = {}) {
+        this.loading = true;
+        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.data = data.records;
+          this.loading = false;
+          this.selectionClear();
+        });
+      }
+    }
+  };
+</script>
+
+<style>
+</style>

+ 382 - 616
src/views/smartapplication/videoclouddevice.vue

@@ -1,12 +1,12 @@
 <template>
   <basic-container>
     <avue-crud :option="option" :table-loading="loading" :data="data" :page="page" :permission="permissionList"
-      :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
-      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
-      @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
+               :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
+               @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
+               @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
       <template slot="menuLeft">
         <el-button type="danger" size="small" icon="el-icon-delete" plain v-if="permission.videoclouddevice_delete"
-          @click="handleDelete">删 除
+                   @click="handleDelete">删 除
         </el-button>
         <el-button type="success" icon="el-icon-paperclip" size="small" @click="showDeviceBindBatch()">批量绑定</el-button>
       </template>
@@ -18,10 +18,12 @@
               操作<i class="el-icon-arrow-down el-icon--right"></i>
             </span>
             <el-dropdown-menu slot="dropdown">
-              <el-dropdown-item icon="el-icon-view" type="text" @click.native="view(scope.row)">查看</el-dropdown-item>
-              <el-dropdown-item icon="el-icon-edit" type="text" @click.native="edit(scope.row)">编辑</el-dropdown-item>
-              <el-dropdown-item icon="el-icon-video-camera" type="text" @click.native="showVideo(scope.row)">查看监控</el-dropdown-item>
+              <!--              <el-dropdown-item icon="el-icon-view" type="text" @click.native="view(scope.row)">查看</el-dropdown-item>-->
+              <!--              <el-dropdown-item icon="el-icon-edit" type="text" @click.native="edit(scope.row)">编辑</el-dropdown-item>-->
+              <el-dropdown-item icon="el-icon-video-camera" type="text" @click.native="syncDevice(scope.row.accountName, scope.row.deviceNum)">同步设备状态</el-dropdown-item>
               <el-dropdown-item icon="el-icon-paperclip" type="text" @click.native="showDeviceBind(scope.row)">{{!scope.row.residentialId ? '设备绑定' : '设备改绑'}}</el-dropdown-item>
+              <el-dropdown-item icon="el-icon-paperclip" type="text" @click.native="syncVideoUrl(scope.row.accountName, scope.row.deviceNum)">同步播放地址</el-dropdown-item>
+              <el-dropdown-item icon="el-icon-video-camera" type="text" @click.native="showVideo(scope.row)">查看监控</el-dropdown-item>
             </el-dropdown-menu>
 
           </el-dropdown>
@@ -29,10 +31,14 @@
         <!--<el-button icon="el-icon-paperclip" type="text" @click="showDeviceBind(scope.row)">{{!scope.row.residentialId ? '设备绑定' : '设备改绑'}}</el-button>-->
         <!--<el-button icon="el-icon-video-camera" type="text" @click="showVideo(scope.row)">查看监控</el-button>-->
       </template>
+      <template slot="isOnline" slot-scope="scope">
+        <el-tag v-if="scope.row.isOnline == 1" type="success">在线</el-tag>
+        <el-tag v-else type="info">离线</el-tag>
+      </template>
 
     </avue-crud>
 
-    <!--    小区列表-->
+    <!--    区列表-->
     <el-dialog :modal-append-to-body="false" append-to-body :visible.sync="bindVisible" title="设备绑定" center width="20%">
       <div style="text-align: center;">
         <!-- <el-select v-model="selectValue" filterable placeholder="请选择">
@@ -49,7 +55,7 @@
     </el-dialog>
 
     <el-dialog :modal-append-to-body="false" append-to-body :visible.sync="bindBatchVisible" title="设备批量绑定" center
-      width="50%">
+               width="50%">
       <div style="text-align: center;">
         <avue-form v-model="bindBatchForm" :option="bindOption" @submit="bindBatchDevice">
 
@@ -66,9 +72,9 @@
 
     <el-dialog :modal-append-to-body="false" append-to-body :visible.sync="videoVisible" title="视频监控" center width="50%">
       <div>
-      <div align="center">{{video.name}}</div>
-      <video :id="videoId" controls="true" width="100%" height="100%">
-      </video>
+        <div align="center">{{video.name}}</div>
+        <video :id="videoId" id="videoId" controls="true" width="100%" height="100%">
+        </video>
       </div>
     </el-dialog>
     <el-dialog :modal-append-tobody="false" append-to-body :visible.sync="editVisiable" title="编辑" width="60%">
@@ -89,7 +95,9 @@
     update,
     remove,
     updateVideoDevice,
-    bindResidentialBatch
+    bindResidentialBatch,
+    getVideoUrl,
+    syncByDevice
   } from "../../api/smartapplication/videoclouddevice.js";
   import {
     mapGetters
@@ -97,6 +105,7 @@
   import {
     getAllList
   } from "@/api/community/residential";
+  import {syncByAccount} from "../../api/smartapplication/videocloudaccount";
 
   export default {
     data() {
@@ -133,27 +142,16 @@
           labelWidth: 150,
           border: true,
           index: true,
-          viewBtn: false,
-          editBtn: false,
-          delBtn: true,
+          delBtn: false,
+          addBtn: false,
+          viewBtn: true,
           selection: true,
           dialogClickModal: false,
-          column: [{
-              label: "设备编号",
-              prop: "deviceId",
-              hide: true,
-              span: 12,
-              rules: [{
-                required: true,
-                message: "请输入设备编号",
-                trigger: "blur"
-              }]
-            },
+          column: [
             {
               label: "设备名称",
               prop: "deviceName",
               search: true,
-              span: 12,
               rules: [{
                 required: true,
                 message: "请输入设备名称",
@@ -163,421 +161,164 @@
             {
               label: "设备号",
               prop: "deviceNum",
-              span: 12,
-              rules: [{
-                required: true,
-                message: "请输入设备号",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "设备密码",
-              prop: "devicePassword",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入设备密码",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "设备类型",
-              prop: "deviceType",
-              span: 12,
-              search: true,
-              dataType: "number",
-              type: "select",
-              dicUrl: "/api/blade-system/dict-biz/dictionary?code=video_device_type",
-              props: {
-                label: 'dictValue',
-                value: 'dictKey'
-              },
-              rules: [{
-                required: true,
-                message: "请输入设备类型(132:IPC;111:DVR;118:NVR,114:解码器)",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "型号",
-              prop: "modelSequence",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入型号",
-                trigger: "blur"
-              }]
-            },
-            {
-              // label: "协议类型(1:GB28181,2:ONVIF)",
-              label: "协议类型",
-              prop: "protocolType",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入协议类型(1:GB28181,2:ONVIF)",
-                trigger: "blur"
-              }]
+              width: 180
             },
             {
               label: "是否在线",
               prop: "isOnline",
-              span: 12,
               dataType: "number",
               type: "select",
+              slot: true,
+              align: "center",
               search: true,
+              width: 90,
               dicUrl: "/api/blade-system/dict-biz/dictionary?code=online_or_offline",
               props: {
                 label: 'dictValue',
                 value: 'dictKey'
               },
-              rules: [{
-                required: true,
-                message: "请输入是否在线(0:不在线,1:在线)",
-                trigger: "blur"
-              }]
-            },
-            {
-              // label: "是否支持云存储(0:不支持,1:支持)",
-              label: "是否支持云存储",
-              prop: "isSupportCloudStorage",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入是否支持云存储(0:不支持,1:支持)",
-                trigger: "blur"
-              }]
             },
             {
-              // label: "是否支持本地存储(0:不支持,1:支持)",
-              label: "是否支持本地存储",
-              prop: "isSupportLocalStorage",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入是否支持本地存储(0:不支持,1:支持)",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "是否支持云台",
-              prop: "isSupportPtz",
-              span: 12,
-              dataType: "number",
-              type: "select",
-              dicUrl: "/api/blade-system/dict-biz/dictionary?code=is_support",
+              label: "所属园区",
+              prop: "agencyId",
+              type: 'select',
+              hide:true,
+              editDisplay: false,
+              addDisplya: false,
+              width: 150,
+              overHidden: true,
+              search: true,
+              remote: true,
+              dicFlag :false,
+              // slot: true,
+              dicUrl: "/api/agency/agency/select?size=500&agencyName={{key}}",
+              cascaderItem: ['residentialId'],
               props: {
-                label: 'dictValue',
-                value: 'dictKey'
+                label: 'agencyName',
+                value: 'id'
               },
               rules: [{
                 required: true,
-                message: "请输入是否支持云台(0:不支持,1:支持)",
-                trigger: "blur"
-              }]
-            },
-            {
-              // label: "是否支持移动侦测(0:不支持,1:支持)",
-              label: "是否支持移动侦测",
-              prop: "isSupportMotionDetection",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入是否支持移动侦测(0:不支持,1:支持)",
+                message: "请输入所属园区",
                 trigger: "blur"
               }]
             },
             {
-              // label: "是否支持手动报警(0:不支持,1:支持)",
-              label: "是否支持手动报警",
-              prop: "isSupportManualAlarm",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入是否支持手动报警(0:不支持,1:支持)",
-                trigger: "blur"
-              }]
-            },
-            {
-              // label: "是否支持外部开关报警(0:不支持,1:支持)",
-              label: "是否支持外部开关报警",
-              prop: "isSupportExternalAlarmSwitch",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入是否支持外部开关报警(0:不支持,1:支持)",
-                trigger: "blur"
-              }]
+              label: "所属园区",
+              prop: "agencyName",
+              hide: false,
+              viewDisplay: true,
             },
             {
-              // label: "设备是否有反转倒置能力(0:否,1:是)",
-              label: "设备是否有反转倒置能力",
-              prop: "isHaveInversion",
-              span: 12,
+              label: "所属区域",
+              prop: "residentialId",
+              type: 'select',
               hide: true,
-              rules: [{
-                required: true,
-                message: "请输入设备是否有反转倒置能力(0:否,1:是)",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "云存储类别",
-              prop: "cloudStorageType",
-              span: 12,
-              type: "select",
-              dataType: "number",
-              dicUrl: "/api/blade-system/dict-biz/dictionary?code=cloud_storage_type",
+              editDisplay: false,
+              addDisplay: false,
+              width: 150,
+              overHidden: true,
+              search: true,
+              dicFlag :false,
+              cascaderItem: ['buildingId'],
+              dicUrl: "/api/community/residential/select?agencyId={{key}}",
               props: {
-                label: 'dictValue',
-                value: 'dictKey'
+                label: 'name',
+                value: 'id'
               },
               rules: [{
                 required: true,
-                message: "请输入云存储类别(0:无云存储,1:电信分布式存储,2:21cn存储)",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "云存储配置id",
-              prop: "cloudStorageConfId",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入云存储配置id",
-                trigger: "blur"
-              }]
-            },
-            {
-              // label: "视频流获取方式(0:主动推流,1:主动拉取流)",
-              label: "视频流获取方式",
-              prop: "streamType",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入视频流获取方式(0:主动推流,1:主动拉取流)",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "设备地址",
-              prop: "address",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入设备地址",
-                trigger: "blur"
-              }]
-            },
-            {
-              // label: "是否拥有者(0:否,1:是)",
-              label: "是否拥有者",
-              prop: "isOwner",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入是否拥有者(0:否,1:是)",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "所属NVR的编号",
-              prop: "parentNvrNum",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入所属NVR的编号",
-                trigger: "blur"
-              }]
-            },
-            {
-              // label: "告警状态(0:正常;1:告警)",
-              label: "告警状态",
-              prop: "alarmStatus",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入告警状态(0:正常;1:告警)",
+                message: "请输入所属区域",
                 trigger: "blur"
               }]
             },
             {
-              label: "经度",
-              prop: "longitude",
-              span: 12,
-              rules: [{
-                required: true,
-                message: "请输入经度",
-                trigger: "blur"
-              }]
+              label: "所属区域",
+              prop: "residentialName",
+              hide: false,
+              viewDisplay: true,
             },
             {
-              label: "纬度",
-              prop: "latitude",
-              span: 12,
-              rules: [{
-                required: true,
-                message: "请输入纬度",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "维护人员信息",
-              prop: "maintainer",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入维护人员信息",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "是否封存,true封存",
-              prop: "block",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入是否封存,true封存",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "封存时间",
-              prop: "blockTime",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入封存时间",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "路由器id",
-              prop: "routeId",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入路由器id",
-                trigger: "blur"
-              }]
-            },
-            {
-              // label: "摄像头类型 G:枪机 D:球机",
-              label: "摄像头类型",
-              prop: "equipType",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入摄像头类型 G:枪机 D:球机",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "设备最后状态更新时间",
-              prop: "updateStateTimeString",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入设备最后状态更新时间",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "设备监控位id",
-              prop: "districtId",
-              span: 12,
+              label: "所属楼栋",
+              prop: "buildingId",
+              type: 'select',
               hide: true,
+              editDisplay: false,
+              addDisplay: false,
+              width: 150,
+              overHidden: true,
+              search: true,
+              dicFlag :false,
+              dicUrl: "/api/building/building/select?residentialId={{key}}",
+              props: {
+                label: 'name',
+                value: 'id'
+              },
               rules: [{
                 required: true,
-                message: "请输入设备监控位id",
+                message: "请输入所属区域",
                 trigger: "blur"
               }]
             },
             {
-              // label: "存储位置(通过该字段快速查询,所有的子节点)机构树位置",
-              label: "存储位置",
-              prop: "orgPosition",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入存储位置(通过该字段快速查询,所有的子节点)机构树位置",
-                trigger: "blur"
-              }]
+              label: "所属楼栋",
+              prop: "buildingName",
+              hide: false,
+              viewDisplay: true,
             },
             {
               label: "rtsp视频播放地址",
               prop: "rtspUrl",
-              span: 12,
-              hide: true,
-              rules: [{
-                required: true,
-                message: "请输入rtsp视频播放地址",
-                trigger: "blur"
-              }]
             },
             {
-              label: "http-flv视频播放地址",
-              prop: "httpFlvUrl",
-              span: 12,
-              hide: true,
+              label: "安装位置",
+              prop: "address",
               rules: [{
-                required: true,
-                message: "请输入http-flv视频播放地址",
+                required: false,
+                message: "请输入安装位置",
                 trigger: "blur"
               }]
             },
+          ]
+        },
+        bindOption: {
+          column: [
             {
-              label: "所属账户",
-              prop: "accountName",
-              span: 12,
-              hide: true,
+              label: "所属园区",
+              prop: "agencyId",
+              type: 'select',
+              span:24,
+              overHidden: true,
+              search: true,
+              remote: true,
+              dicUrl: "/api/agency/agency/select?agencyName={{key}}",
+              cascaderItem: ['residentialId'],
+              props: {
+                label: 'agencyName',
+                value: 'id'
+              },
               rules: [{
                 required: true,
-                message: "请输入所属账户",
+                message: "请输入所属园区",
                 trigger: "blur"
               }]
             },
-          ]
-        },
-        bindOption: {
-          column: [{
-              label: "所属小区",
+            {
+              label: "所属区域",
               prop: "residentialId",
               search: true,
               span:24,
               cascaderItem: ['buildingId'],
               type: "select",
               remote: true,
-
-              dicUrl: "/api/community/residential/select?name={{key}}",
+              dicUrl: "/api/building/residential/select?agencyId={{key}}",
               props: {
                 label: "name",
                 value: "id"
               },
               rules: [{
                 required: true,
-                message: "请选择所属区",
+                message: "请选择所属区域",
                 trigger: "blur"
               }]
             },
@@ -597,260 +338,285 @@
                 value: "id"
               },
 
-              }]
+            }]
 
-          },
-          data: []
+        },
+        data: []
+      };
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.videoclouddevice_add, false),
+          viewBtn: this.vaildData(this.permission.videoclouddevice_view, false),
+          delBtn: this.vaildData(this.permission.videoclouddevice_delete, false),
+          editBtn: this.vaildData(this.permission.videoclouddevice_edit, false)
         };
       },
-      computed: {
-          ...mapGetters(["permission"]),
-          permissionList() {
-            return {
-              addBtn: this.vaildData(this.permission.videoclouddevice_add, false),
-              viewBtn: this.vaildData(this.permission.videoclouddevice_view, false),
-              delBtn: this.vaildData(this.permission.videoclouddevice_delete, false),
-              editBtn: this.vaildData(this.permission.videoclouddevice_edit, false)
-            };
-          },
-          ids() {
-            let ids = [];
-            this.selectionList.forEach(ele => {
-              ids.push(ele.id);
-            });
-            return ids.join(",");
-          }
-        },
-        methods: {
-          showVideo(row) {
-            // this.video.url = "http://139.9.103.171/live?port=1935&app=myapp&stream=" + row.id;
-            this.video.url = "ws://36.103.228.148:8888/live/" + row.id + ".flv";
-            this.video.name = row.deviceName;
-            this.videoVisible = true;
-            this.$nextTick(() => {
-              try {
-                let videoElement = document.getElementById('videoId');
-                let flvPlayer = flvjs.createPlayer({
-                  type: 'flv',
-                  url: this.video.url
-                });
-                flvPlayer.on(flvjs.Events.ERROR, (errType, errDetail) => {
-                  // errType是 NetworkError时,对应errDetail有:Exception、HttpStatusCodeInvalid、ConnectingTimeout、EarlyEof、UnrecoverableEarlyEof
-                  // errType是 MediaError时,对应errDetail是MediaMSEError
-                });
-                flvPlayer.on(flvjs.Events.MEDIA_SOURCE_CLOSE || flvjs.Events.MEDIA_SOURCE_ENDED, () => {})
-                flvPlayer.attachMediaElement(videoElement);
-                flvPlayer.load();
-                flvPlayer.play();
-              } catch (e) {
-                console.log(e);
-              }
-            })
-          },
-          showDeviceBindBatch() {
-            if (this.selectionList.length === 0) {
-              this.$message.warning("请选择至少一条数据");
-              return;
-            }
-            if (this.residentialList.length == 0) {
-              //  请求获取小区列表
-              getAllList().then(res => {
-                this.residentialList = res.data.data;
-                this.selectValue = "";
-                this.bindBatchVisible = true;
-              })
-            } else {
-              this.selectValue = ""
-              this.bindBatchVisible = true;
-            }
-            // this.form = row;
-          },
-          showDeviceBind(row) {
-
-            if (this.residentialList.length == 0) {
-              //  请求获取小区列表
-              getAllList().then(res => {
-                this.residentialList = res.data.data;
-                this.selectValue = ""
-                this.bindVisible = true;
-              })
-            } else {
-              this.selectValue = ""
-              this.bindVisible = true;
-            }
-            this.bindForm = row;
-          },
-          bindBatchDevice(loading,done) {
-            // if (this.selectValue == "") {
-            //   this.$message.warning("请选择所属小区");
-            //   return;
-            // }
-            //保存
-               debugger
-            bindResidentialBatch(this.ids, this.bindBatchForm.residentialId,this.bindBatchForm.buildingId).then(() => {
-              // debugger
-              this.bindBatchVisible = false;
-              this.bindBatchForm = {};
-              this.onLoad(this.page);
-
-              this.$message({
-                type: "success",
-                message: "操作成功!"
-              });
-              done();
-            }, error => {
-              loading();
-              console.log(error);
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    methods: {
+      syncDevice(accountName, deviceNum){
+        syncByDevice(accountName, deviceNum).then(res => {
+          if (res.data.success) {
+            this.$message({
+              type: "success",
+              message: res.data.msg
             });
-          },
-          bindDevice(loading,done) {
-            // this.form.residentialId = this.selectValue;
-            //保存
-            updateVideoDevice(this.bindForm).then(() => {
-              this.onLoad(this.page);
-              this.bindVisible = false;
-              this.$message({
-                type: "success",
-                message: "操作成功!"
-              });
-              done();
-            }, error => {
-              loading();
-              console.log(error);
+            this.onLoad(this.page);
+          } else {
+            this.$message({
+              type: "error",
+              message: res.data.msg
             });
-          },
-          rowSave(row, done, loading) {
-            add(row).then(() => {
-              this.onLoad(this.page);
-              this.$message({
-                type: "success",
-                message: "操作成功!"
-              });
-              done();
-            }, error => {
-              loading();
-              window.console.log(error);
+          }
+        })
+      },
+      showVideo(row) {
+        // this.video.url = "http://139.9.103.171/live?port=1935&app=myapp&stream=" + row.id;
+        this.video.url = "ws://36.103.228.148:8866/live?url=" + row.rtspUrl + "&&&ffmpeg=true";;
+        this.video.name = row.deviceName;
+        this.videoVisible = true;
+        this.$nextTick(() => {
+          try {
+            let videoElement = document.getElementById('videoId');
+            let flvPlayer = flvjs.createPlayer({
+              type: 'flv',
+              url: this.video.url
             });
-          },
-          rowUpdate(row, index, done, loading) {
-            update(row).then(() => {
-              this.onLoad(this.page);
-              this.$message({
-                type: "success",
-                message: "操作成功!"
-              });
-              done();
-            }, error => {
-              loading();
-              console.log(error);
+            flvPlayer.on(flvjs.Events.ERROR, (errType, errDetail) => {
+              // errType是 NetworkError时,对应errDetail有:Exception、HttpStatusCodeInvalid、ConnectingTimeout、EarlyEof、UnrecoverableEarlyEof
+              // errType是 MediaError时,对应errDetail是MediaMSEError
             });
-          },
-          rowDel(row) {
-            this.$confirm("确定将选择数据删除?", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning"
-              })
-              .then(() => {
-                return remove(row.id);
-              })
-              .then(() => {
-                this.onLoad(this.page);
-                this.$message({
-                  type: "success",
-                  message: "操作成功!"
-                });
-              });
-          },
-          handleDelete() {
-            if (this.selectionList.length === 0) {
-              this.$message.warning("请选择至少一条数据");
-              return;
-            }
-            this.$confirm("确定将选择数据删除?", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning"
-              })
-              .then(() => {
-                return remove(this.ids);
-              })
-              .then(() => {
-                this.onLoad(this.page);
-                this.$message({
-                  type: "success",
-                  message: "操作成功!"
-                });
-                this.$refs.crud.toggleSelection();
-              });
-          },
-          beforeOpen(done, type) {
-            if (["edit", "view"].includes(type)) {
-              getDetail(this.form.id).then(res => {
-                this.form = res.data.data;
-              });
-            }
-            done();
-          },
-          searchReset() {
-            this.query = {};
+            flvPlayer.on(flvjs.Events.MEDIA_SOURCE_CLOSE || flvjs.Events.MEDIA_SOURCE_ENDED, () => {})
+            flvPlayer.attachMediaElement(videoElement);
+            flvPlayer.load();
+            flvPlayer.play();
+          } catch (e) {
+            console.log(e);
+          }
+        })
+      },
+      showDeviceBindBatch() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        if (this.residentialList.length == 0) {
+          //  请求获取区域列表
+          getAllList().then(res => {
+            this.residentialList = res.data.data;
+            this.selectValue = "";
+            this.bindBatchVisible = true;
+          })
+        } else {
+          this.selectValue = ""
+          this.bindBatchVisible = true;
+        }
+        // this.form = row;
+      },
+      showDeviceBind(row) {
+
+        if (this.residentialList.length == 0) {
+          //  请求获取区域列表
+          getAllList().then(res => {
+            this.residentialList = res.data.data;
+            this.selectValue = ""
+            this.bindVisible = true;
+          })
+        } else {
+          this.selectValue = ""
+          this.bindVisible = true;
+        }
+        this.bindForm = row;
+      },
+      syncVideoUrl(accountName, deviceNum){
+        getVideoUrl(accountName, deviceNum).then(res =>{
+          this.$message({
+            type: "success",
+            message: res.data.msg
+          });
+          this.onLoad(this.page);
+        })
+      },
+      bindBatchDevice(loading,done) {
+        // if (this.selectValue == "") {
+        //   this.$message.warning("请选择所属区域");
+        //   return;
+        // }
+        //保存
+        bindResidentialBatch(this.ids, this.bindBatchForm.residentialId,this.bindBatchForm.buildingId).then(() => {
+          // debugger
+          this.bindBatchVisible = false;
+          this.bindBatchForm = {};
+          this.onLoad(this.page);
+
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      bindDevice(loading,done) {
+        // this.form.residentialId = this.selectValue;
+        //保存
+        updateVideoDevice(this.bindForm).then(() => {
+          this.onLoad(this.page);
+          this.bindVisible = false;
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      rowSave(row, done, loading) {
+        add(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });
+      },
+      rowUpdate(row, index, done, loading) {
+        update(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
             this.onLoad(this.page);
-          },
-          searchChange(params, done) {
-            this.query = params;
-            this.page.currentPage = 1;
-            this.onLoad(this.page, params);
-            done();
-          },
-          selectionChange(list) {
-            this.selectionList = list;
-          },
-          selectionClear() {
-            this.selectionList = [];
-            this.$refs.crud.toggleSelection();
-          },
-          currentChange(currentPage) {
-            this.page.currentPage = currentPage;
-          },
-          sizeChange(pageSize) {
-            this.page.pageSize = pageSize;
-          },
-          refreshChange() {
-            this.onLoad(this.page, this.query);
-          },
-          edit(row) {
-            this.editForm = row;
-            this.editVisiable = true;
-          },
-          view(row) {
-            this.detailForm = row;
-            this.detailVisible = true;
-          },
-          submitVideoclouddevice(row,done,loading) {
-            update(row).then(() => {
-              this.onLoad(this.page);
-              this.$message({
-                type: "success",
-                message: "操作成功!"
-              });
-              done();
-            }, error => {
-              loading();
-              console.log(error);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
             });
-          },
-          onLoad(page, params = {}) {
-            this.loading = true;
-            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
-              const data = res.data.data;
-              this.page.total = data.total;
-              this.data = data.records;
-              this.loading = false;
-              this.selectionClear();
+          });
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
             });
-          }
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then(res => {
+            this.form = res.data.data;
+          });
         }
-    };
+        done();
+      },
+      searchReset() {
+        this.query = {};
+        this.onLoad(this.page);
+      },
+      searchChange(params, done) {
+        this.query = params;
+        this.page.currentPage = 1;
+        this.onLoad(this.page, params);
+        done();
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      selectionClear() {
+        this.selectionList = [];
+        this.$refs.crud.toggleSelection();
+      },
+      currentChange(currentPage) {
+        this.page.currentPage = currentPage;
+      },
+      sizeChange(pageSize) {
+        this.page.pageSize = pageSize;
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query);
+      },
+      edit(row) {
+        this.editForm = row;
+        this.editVisiable = true;
+      },
+      view(row) {
+        this.detailForm = row;
+        this.detailVisible = true;
+      },
+      submitVideoclouddevice(row,done,loading) {
+        update(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+          this.editVisiable = false;
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      onLoad(page, params = {}) {
+        this.loading = true;
+        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.data = data.records;
+          this.loading = false;
+          this.selectionClear();
+        });
+      }
+    }
+  };
 </script>
 
 <style>

+ 3 - 3
src/views/system/tenant.vue

@@ -173,10 +173,10 @@
               prop: "backgroundUrl",
               type: 'upload',
               listType: 'picture-img',
-              action: '/api/blade-resource/oss/endpoint/put-file',
+              action: '/api/upload/putfile',
               propsHttp: {
-                res: 'data',
-                url: 'link',
+                // res: 'data',
+                url: 'data',
               },
               hide: true,
               span: 24,