2
0

2 Коммиты 189121d6be ... 8188f35b93

Автор SHA1 Сообщение Дата
  haodingding 8188f35b93 Merge branch 'master' of http://app.tjzhxx.cn:3001/yyky/yyky_web 1 год назад
  haodingding 58d6c3375a 09-21 新增设备设置保存 1 год назад
1 измененных файлов с 105 добавлено и 37 удалено
  1. 105 37
      src/views/system/device/index.vue

+ 105 - 37
src/views/system/device/index.vue

@@ -149,12 +149,12 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="设备标识ID" prop="deviceId">
-              <el-input v-model="form.deviceId" placeholder="请输入设备标识ID" class="setting-inp" />
+              <el-input v-model="form.deviceId" type="number" placeholder="请输入设备标识ID" class="setting-inp" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="SIM卡号" prop="simCode">
-              <el-input v-model="form.simCode" placeholder="请输入SIM卡号" class="setting-inp" />
+              <el-input v-model="form.simCode" type="number" placeholder="请输入SIM卡号" class="setting-inp" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -396,7 +396,7 @@
             </el-form-item>
           </el-form>
           <el-form v-if="settingPage == 'intercept'" label-width="120px">
-            <el-form-item label="佩戴提醒状态">
+            <el-form-item label="陌生人拦截">
               <el-switch v-model="intercept"></el-switch>
             </el-form-item>
           </el-form>
@@ -667,7 +667,8 @@ import {
   addFence,
   getFenceList,
   deleteFence,
-  updateFence
+  updateFence,
+  setDevice
 }
   from "@/api/system/device";
 import { listProfile, getProfile } from "@/api/system/profile";
@@ -738,6 +739,12 @@ export default {
         ],
         grantType: [
           { required: true, message: '请选择发放方式', trigger: 'change' }
+        ],
+        name: [
+          {required: true, message: '请选择用户'}
+        ],
+        deviceId: [
+          {required: true, message: '请输入设备ID', trigger: 'blur'}
         ]
       },
       menuInfo: [],
@@ -996,7 +1003,14 @@ export default {
           data: obj,
         }).then(res => {
           if (res.data && res.data.code == 200) {
-            this.$modal.msgSuccess('设置成功')
+            let data = {
+              deviceIdCode: this.setUser.deviceId,
+              sostelno1: this.sosForm.tel1,
+              sostelno2: this.sosForm.tel2
+            }
+            setDevice(data).then(res1 => {
+              this.$modal.msgSuccess('设置成功')
+            })
           } else {
             this.$modal.msgError('SOS设置失败')
           }
@@ -1016,7 +1030,17 @@ export default {
           data: obj,
         }).then(res => {
           if (res.data && res.data.code == 200) {
-            this.$modal.msgSuccess('设置成功')
+            let data = {
+              deviceIdCode: this.setUser.deviceId,
+              gpsInterval: this.intervalForm.cr_interval,
+              heartInterval: this.intervalForm.hrt_interval,
+              bodyInterval: this.intervalForm.wd_interval,
+              bloodInterval: this.intervalForm.bld_interval,
+              oxygenInterval: this.intervalForm.ox_interval,
+            }
+            setDevice(data).then(res1 => {
+              this.$modal.msgSuccess('设置成功')
+            })
           } else {
             this.$modal.msgError('测量间隔设置失败')
           }
@@ -1037,7 +1061,13 @@ export default {
           data: obj,
         }).then(res => {
           if (res.data && res.data.code == 200) {
-            this.$modal.msgSuccess('设置成功')
+            let data = {
+              deviceIdCode: this.setUser.deviceId,
+              stepStatus: this.pedoForm.isopen
+            }
+            setDevice(data).then(res1 => {
+              this.$modal.msgSuccess('设置成功')
+            })
           } else {
             this.$modal.msgError('计步设置失败')
           }
@@ -1067,7 +1097,24 @@ export default {
           data: obj,
         }).then(res => {
           if (res.data && res.data.code == 200) {
-            this.$modal.msgSuccess('设置成功')
+            let data = {
+              deviceIdCode: this.setUser.deviceId
+            }
+            if (this.telForm.tel1 && this.telForm.name1) {
+              data.contactPer1 = this.telForm.tel1
+              data.contactTel1 = this.this.telForm.name1
+            }
+            if (this.telForm.tel2 && this.telForm.name2) {
+              data.contactPer2 = this.telForm.tel2
+              data.contactTel2 = this.this.telForm.name2
+            }
+            if (this.telForm.tel3 && this.telForm.name3) {
+              data.contactPer3 = this.telForm.tel3
+              data.contactTel3 = this.this.telForm.name3
+            }
+            this.setDevice(data).then(res1 => {
+              this.$modal.msgSuccess('设置成功')
+            })
           } else {
             this.$modal.msgError('通讯录设置失败')
           }
@@ -1088,7 +1135,15 @@ export default {
           data: obj,
         }).then(res => {
           if (res.data && res.data.code == 200) {
-            this.$modal.msgSuccess('设置成功')
+            let data = {
+              deviceIdCode: this.setUser.deviceId,
+              timeStatus: this.onoffForm.is_open,
+              timeBegin: this.onoffForm.bootup_time,
+              timeEnd: this.onoffForm.shutdown_time
+            }
+            setDevice(data).then(res1 => {
+              this.$modal.msgSuccess('设置成功')
+            })
           } else {
             this.$modal.msgError('定时开关机设置失败')
           }
@@ -1109,7 +1164,13 @@ export default {
           data: obj,
         }).then(res => {
           if (res.data && res.data.code == 200) {
-            this.$modal.msgSuccess('设置成功')
+            let data = {
+              deviceIdCode: this.setUser.deviceId,
+              useStatus: this.wearForm.is_open,
+            }
+            setDevice(data).then(res1 => {
+              this.$modal.msgSuccess('设置成功')
+            })
           } else {
             this.$modal.msgError('定时开关机设置失败')
           }
@@ -1157,7 +1218,14 @@ export default {
           data: obj,
         }).then(res => {
           if (res.data && res.data.code == 200) {
-            this.$modal.msgSuccess('设置成功')
+            let data = {
+              deviceIdCode: this.setUser.deviceId,
+              fallStatus: this.fallForm.is_open,
+              levelStatus: this.fallForm.lsset_type
+            }
+            setDevice(data).then(res1 => {
+              this.$modal.msgSuccess('设置成功')
+            })
           } else {
             this.$modal.msgError('跌倒提醒设置失败')
           }
@@ -1766,31 +1834,31 @@ export default {
               position: 'RT'
             }))
             this.map.addControl(new AMap.Scale())
-            // var geolocation = new AMap.Geolocation({
-            //   enableHighAccuracy: true, // 是否使用高精度定位,默认:true
-            //   timeout: 10000, // 设置定位超时时间,默认:无穷大
-            //   offset: [10, 20],  // 定位按钮的停靠位置的偏移量
-            //   zoomToAccuracy: true,  //  定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
-            //   position: 'RB' //  定位按钮的排放位置,  RB表示右下
-            // })
+            var geolocation = new AMap.Geolocation({
+              enableHighAccuracy: true, // 是否使用高精度定位,默认:true
+              timeout: 10000, // 设置定位超时时间,默认:无穷大
+              offset: [10, 20],  // 定位按钮的停靠位置的偏移量
+              zoomToAccuracy: true,  //  定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
+              position: 'RB' //  定位按钮的排放位置,  RB表示右下
+            })
 
-            // geolocation.getCurrentPosition((status, result) => {
-            //   if (status == 'complete') {
-            //     this.$modal.msgSuccess('定位成功')
-            //     this.map.setCenter([result.position.lng, result.position.lat])
-            //   } else {
-            //     this.$modal.msgError('获取定位失败')
-            //   }
-            //   this.getFence()
-            // });
-            let citySearch = new AMap.CitySearch()
-            citySearch.getLocalCity((status, result) => {
-              if (status === 'complete' && result.info === 'OK') {
-                console.log(result);
-                let bounds = result.bounds;
-                this.map.setBounds(bounds);
+            geolocation.getCurrentPosition((status, result) => {
+              if (status == 'complete') {
+                this.$modal.msgSuccess('定位成功')
+                this.map.setCenter([result.position.lng, result.position.lat])
+              } else {
+                // this.$modal.msgError('获取定位失败')
               }
-            })
+              this.getFence()
+            });
+            // let citySearch = new AMap.CitySearch()
+            // citySearch.getLocalCity((status, result) => {
+            //   if (status === 'complete' && result.info === 'OK') {
+            //     console.log(result);
+            //     let bounds = result.bounds;
+            //     this.map.setBounds(bounds);
+            //   }
+            // })
           })
       })
     },
@@ -2043,9 +2111,9 @@ export default {
               this.getList();
             });
           } else {
-            if (!this.form.name) {
-              this.$modal.msgError('请选择用户')
-            }
+            // if (!this.form.name) {
+            //   this.$modal.msgError('请选择用户')
+            // }
             addDevice(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;