Jelajahi Sumber

增加海康威视设备参数设置。

zhengqiang 4 tahun lalu
induk
melakukan
10b0f7eac0

+ 33 - 0
src/api/base/ehome.js

@@ -0,0 +1,33 @@
+import request from '@/utils/request'
+import constant from '@/constant'
+
+
+function getXMLConfig(deviceNo,url){
+  var encUrl = encodeURIComponent(url);
+
+  return request.get(constant.serverUrl + `/ehome/getXMLConfig?deviceNo=${deviceNo}&url=${encUrl}`);
+}
+
+function putXMLConfig(deviceNo,url,jsonData){  
+  var encUrl = encodeURIComponent(url);
+
+  return request.put(constant.serverUrl + `/ehome/setXMLConfig?deviceNo=${deviceNo}&url=${encUrl}`, jsonData,{
+    headers: {
+      "Content-Type": "application/json"
+    }
+  });
+}
+
+function postXMLConfig(deviceNo,url,jsonData){
+    var encUrl = encodeURIComponent(url);
+
+    return request.post(constant.serverUrl + `/ehome/setXMLConfig?deviceNo=${deviceNo}&url=${encUrl}`, jsonData,{
+      headers: {
+        "Content-Type": "application/json"
+      }
+    });
+}
+
+export default {
+    getXMLConfig,putXMLConfig,postXMLConfig
+}

+ 205 - 0
src/views/base/deviceInfo-ehome.vue

@@ -0,0 +1,205 @@
+
+<style scoped>
+.user-panel {
+  margin: 10px auto;
+}
+</style>
+<template>
+  <el-dialog
+    :visible.sync="showDialog"
+    :title="title"
+    :modal-append-to-body="false"
+    style="text-align:left;"
+    @close="closeDialog"
+    :close-on-click-modal="false"
+  >
+    <div class="user-panel" v-loading="loading">
+      <el-form ref="form" :model="formModel" :rules="ruleValidate" :label-width="'150px'">
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="显示抓拍图片" prop="deviceNo">
+              <el-switch
+                v-model="formModel.showCapPic"
+                active-color="#13ce66"
+                active-text="是"
+                inactive-color="#ff4949"
+                inactive-text="否"
+                ></el-switch>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="显示用户信息" prop="deviceNo">
+              <el-switch
+                v-model="formModel.showUserInfo"
+                active-color="#13ce66"
+                active-text="是"
+                inactive-color="#ff4949"
+                inactive-text="否"
+                ></el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="叠加用户信息" prop="deviceNo">
+              <el-switch
+                v-model="formModel.overlayUserInfo"
+                active-color="#13ce66"
+                active-text="是"
+                inactive-color="#ff4949"
+                inactive-text="否"
+                ></el-switch>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="启用语音提示" prop="deviceNo">
+              <el-switch
+                v-model="formModel.voicePrompt"
+                active-color="#13ce66"
+                active-text="是"
+                inactive-color="#ff4949"
+                inactive-text="否"
+                ></el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="保存抓拍图片" prop="deviceNo">
+              <el-switch
+                v-model="formModel.saveCapPic"
+                active-color="#13ce66"
+                active-text="是"
+                inactive-color="#ff4949"
+                inactive-text="否"
+                ></el-switch>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="测温开关使能" prop="deviceNo">
+              <el-switch
+                v-model="formModel.thermalEnabled"
+                active-color="#13ce66"
+                active-text="开"
+                inactive-color="#ff4949"
+                inactive-text="关"
+                ></el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="温度阈值上限" prop="deviceNo">
+                <el-input
+                    v-model="formModel.highestThermalThreshold"
+                    style="width: 100px"
+                >
+                <template slot="append">度</template>
+                </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="温度阈值下限" prop="deviceNo">
+                <el-input
+                    v-model="formModel.lowestThermalThreshold"
+                    style="width: 100px"
+                >
+                <template slot="append">度</template>
+                </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="体温超标允许开门" prop="deviceNo">
+                <el-switch
+                    v-model="formModel.thermalDoorEnabled"
+                    active-color="#13ce66"
+                    active-text="是"
+                    inactive-color="#ff4949"
+                    inactive-text="否"
+                ></el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="closeDialog">取 消</el-button>
+      <el-button type="primary" @click="handleSubmit" :loading="submitting">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+<script>
+import Constant from "@/constant";
+import ehomeApi from "@/api/base/ehome";
+
+export default {
+  props: ["deviceNo", "title", "companyResult"],
+  data() {
+    return {
+      formModel: {},
+      ruleValidate: {},
+      showDialog: true,
+      loading: false,
+      submitting: false,
+      cfgUrl: "/ISAPI/AccessControl/AcsCfg?format=json"
+    }
+  },
+  methods: {
+    closeDialog() {
+      this.$emit("close", false);
+    },
+    handleSubmit() {
+      var self = this;
+
+      this.$refs["form"].validate(valid => {
+        ehomeApi.putXMLConfig(
+            self.deviceNo,self.cfgUrl,{
+                "AcsCfg": self.formModel
+            },
+        ).then(function(response) {
+            self.loading = false;
+            var jsonData = response.data;
+
+            if (jsonData.success) {
+              self.$message({
+                message: "保存成功!",
+                type: "success"
+              });
+
+              self.$emit("close", true);
+            } else {
+              self.$message({
+                message: jsonData.message + "",
+                type: "warning"
+              });
+            }
+          });
+        });
+    },
+  },
+  mounted: function() {
+    var self = this;
+    
+    self.loading = true;
+
+    ehomeApi.getXMLConfig(self.deviceNo,self.cfgUrl)
+    .then(response => {
+        var jsonData = response.data;
+        self.loading = false;
+
+        if (jsonData.success) {
+            var data = eval('(' + jsonData.data + ')');
+
+            self.formModel = data.AcsCfg;
+        } else {
+            self.$message.error(jsonData.message + "");
+        }
+    })
+    .catch(error => {
+        self.$message.error(error + "");
+    });
+  }
+};
+</script>

+ 20 - 1
src/views/base/deviceInfo-list.vue

@@ -193,6 +193,9 @@
             <el-col :span="8" v-if="row.manufacturer=='1'">
               <el-link type="primary" @click="handleEditRule(row)">验证规则</el-link>
             </el-col>
+            <el-col :span="8" v-if="row.manufacturer=='2'">
+              <el-link type="primary" @click="handleAcsCfg(row)">参数设置</el-link>
+            </el-col>
             <el-col :span="8">
               <el-link type="primary" @click="handleReboot(row)">重启设备</el-link>
             </el-col>
@@ -351,6 +354,12 @@
       </span>
     </el-dialog>
     <!-------------设备验证规则end------------------>
+    <deviceInfo-ehome
+      v-if="showEhomeModal"
+      :deviceNo="selectedDevice.deviceNo"
+      title="海康设备设置"
+      @close="onEhomeModalClose"
+    ></deviceInfo-ehome>
     <deviceInfo-map
       v-if="showMapModal"
       :businessKey="businessKey"
@@ -373,6 +382,7 @@
 <script>
 import Constant from "@/constant";
 import DeviceInfoDetail from "./deviceInfo-detail";
+import DeviceInfoEhome from "./deviceInfo-ehome";
 import DeviceInfoChannelList from "./deviceInfo-channelList";
 import DevicePhotoList from "./devicePhoto-list";
 import DeviceInfoMap from "./deviceInfo-amap";
@@ -447,6 +457,7 @@ export default {
       showMapModal: false,
       showChannelListModal: false,
       showPhotoListModal: false,
+      showEhomeModal: false,
       selectedDevice: {},
       columnColorList: [],
       columnHeightList: [],
@@ -927,6 +938,13 @@ export default {
     onDevicePhotoListClose (){
       this.showPhotoListModal = false;
     },
+    handleAcsCfg(device) {
+      this.selectedDevice = device;
+      this.showEhomeModal = true;
+    },
+    onEhomeModalClose() {
+      this.showEhomeModal = false;
+    },
     exportXls() {
       this.changePage(1,true);
     }
@@ -944,7 +962,8 @@ export default {
     "deviceInfo-channelList": DeviceInfoChannelList,
     "deviceInfo-map": DeviceInfoMap,
     "el-select-tree": SelectTree,
-    "devicePhoto-list": DevicePhotoList
+    "devicePhoto-list": DevicePhotoList,
+    "deviceInfo-ehome": DeviceInfoEhome
   }
 };
 </script>