2
0

2 コミット bd26022367 ... 2f7d384410

作者 SHA1 メッセージ 日付
  haodingding 2f7d384410 Merge branch 'master' of http://app.tjzhxx.cn:3001/yyky/yyky_web 1 年間 前
  haodingding 23bae3c984 09-22 15:18 提交 1 年間 前
2 ファイル変更137 行追加99 行削除
  1. 1 2
      src/api/system/device.js
  2. 136 97
      src/views/system/device/index.vue

+ 1 - 2
src/api/system/device.js

@@ -154,8 +154,7 @@ export function getClock(data) {
 }
 export function deleteClock(data) {
   return request({
-    url: '/system/deviceclock/list',
+    url: `/system/deviceclock/${data}`,
     method: 'delete',
-    params: data
   })
 }

+ 136 - 97
src/views/system/device/index.vue

@@ -5,7 +5,10 @@
         <el-input v-model="queryParams.deviceId" placeholder="请输入设备标识ID" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="设备型号" prop="deviceModel">
-        <el-input v-model="queryParams.deviceModel" placeholder="请输入设备型号" clearable @keyup.enter.native="handleQuery" />
+        <!-- <el-input v-model="queryParams.deviceModel" placeholder="请输入设备型号" clearable @keyup.enter.native="handleQuery" /> -->
+        <el-select v-model="queryParams.deviceModel" class="setting-inp" style="width: 200px;">
+          <el-option v-for="i in deviceModel" :key="i.dictValue" :value="i.dictValue" :label="i.dictLabel"></el-option>
+        </el-select>
       </el-form-item>
       <el-form-item label="用户姓名" prop="name">
         <el-input v-model="queryParams.name" placeholder="请输入用户姓名" clearable @keyup.enter.native="handleQuery" />
@@ -106,10 +109,10 @@
     <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="100px">
         <el-form-item label="设备属性">
-          <!-- <el-radio-group v-model="form.deviceProper">
+          <el-radio-group v-model="form.deviceProper">
             <el-radio v-for="i in deviceAttribute" :key="i.dictValue" :label="i.dictValue">{{ i.dictLabel }}</el-radio>
-          </el-radio-group> -->
-          <el-radio v-model="deviceProp" label="1">个人</el-radio>
+          </el-radio-group>
+          <!-- <el-radio v-model="deviceProp" label="1">个人</el-radio> -->
         </el-form-item>
         <el-form-item label="用户姓名" prop="name" class="inp">
           <el-input v-model="form.name" placeholder="请选择" disabled class="setting-inp">
@@ -238,7 +241,7 @@
           </el-col>
         </el-row>
       </el-form>
-      <el-table :data="userList" v-loading="loading" @selection-change="checkUser">
+      <el-table :data="userList" v-loading="loading" @selection-change="checkUser" :row-style="{ height: '50px' }">
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column label="姓名" align="center" prop="name" />
         <el-table-column label="性别" align="center" prop="sex" />
@@ -346,7 +349,7 @@
                 <el-input class="clock-input" v-model="item.clockName"></el-input>
                 <el-time-picker :editable="false" value-format="HH:mm" placeholder="请选择时间"
                   v-model="item.time"></el-time-picker>
-                <el-switch class="clock-switch" v-model="item.isopen" active-value="1" inactive-value="0"></el-switch>
+                <el-switch class="clock-switch" v-model="item.isopen" :active-value="1" :inactive-value="0"></el-switch>
                 <el-button type="danger" icon="el-icon-delete" circle @click="deleteClock(item.clockId)"></el-button>
               </el-form-item>
               <el-form-item label="日期">
@@ -390,8 +393,8 @@
             </el-form-item>
             <el-form-item label="跌倒灵敏度">
               <el-radio-group v-model="fallForm.lsset_type">
-                <el-radio v-for="i in sensitivityList" :key="i.dictValue" :label="i.dictValue"
-                  >{{ i.dictLabel }}</el-radio>
+                <el-radio v-for="i in sensitivityList" :key="i.dictValue" :label="i.dictValue">{{ i.dictLabel
+                }}</el-radio>
               </el-radio-group>
             </el-form-item>
           </el-form>
@@ -410,63 +413,63 @@
       </el-row>
     </el-dialog>
     <el-dialog title="健康阈值设置" :visible.sync="healthInterval" width="1000px" append-to-body :before-close="closeHealth">
-      <el-form label-width="100px" :data="deviceInterval">
+      <el-form label-width="100px" :data="deviceInterval" :rules="intervalRules">
         <el-row>
           <el-col :span="12">
-            <el-form-item label="最大心率">
+            <el-form-item label="最大心率" prop="shouhuan_heart_max">
               <el-input v-model="deviceInterval.shouhuan_heart_max"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="最小心率">
+            <el-form-item label="最小心率" prop="shouhuan_heart_min">
               <el-input v-model="deviceInterval.shouhuan_heart_min"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="最大高压">
+            <el-form-item label="最大高压" prop="shouhuan_blood_high_max">
               <el-input v-model="deviceInterval.shouhuan_blood_high_max" type="number"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="最小高压">
+            <el-form-item label="最小高压" prop="shouhuan_blood_high_min">
               <el-input v-model="deviceInterval.shouhuan_blood_high_min" type="number"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="最大低压">
+            <el-form-item label="最大低压" prop="shouhuan_blood_low_max">
               <el-input v-model="deviceInterval.shouhuan_blood_low_max" type="number"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="最小低压">
+            <el-form-item label="最小低压" prop="shouhuan_blood_low_min">
               <el-input v-model="deviceInterval.shouhuan_blood_low_min" type="number"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="最大血氧">
+            <el-form-item label="最大血氧" prop="shouhuan_oxygen_max">
               <el-input v-model="deviceInterval.shouhuan_oxygen_max" type="number"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="最小血氧">
+            <el-form-item label="最小血氧" prop="shouhuan_oxygen_min">
               <el-input v-model="deviceInterval.shouhuan_oxygen_min" type="number"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="最大体温">
+            <el-form-item label="最大体温" prop="shouhuan_body_max">
               <el-input v-model="deviceInterval.shouhuan_body_max" type="number"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="最小体温">
+            <el-form-item label="最小体温" prop="shouhuan_body_min">
               <el-input v-model="deviceInterval.shouhuan_body_min" type="number"></el-input>
             </el-form-item>
           </el-col>
@@ -574,7 +577,8 @@
           <el-select size="mini" v-model="fenceName" @change="selectFence">
             <el-option v-for="item in fenceList" :key="item.name" :label="item.name" :value="item.name"></el-option>
           </el-select>
-          <el-button size="mini" type="primary" style="margin-left: 10px;" v-hasPermi="['system:device:add']" @click="editAdd">新增</el-button>
+          <el-button size="mini" type="primary" style="margin-left: 10px;" v-hasPermi="['system:device:add']"
+            @click="editAdd">新增</el-button>
           <el-button size="mini" type="warning" @click="editUpdate" v-hasPermi="['system:device:edit']">修改</el-button>
           <el-button size="mini" type="danger" @click="editDelete" v-hasPermi="['system:device:remove']">删除</el-button>
         </el-row>
@@ -849,7 +853,39 @@ export default {
       fenceName: null,
       add_flag: true,
       checkedFence: null,
-      items: []
+      items: [],
+      intervalRules: {
+        shouhuan_heart_max: [
+          {required: true, message: '请输入最大心率', trigger: 'blur'}
+        ],
+        shouhuan_heart_min: [
+          {required: true, message: '请输入最小心率', trigger: 'blur'}
+        ],
+        shouhuan_blood_high_max: [
+          {required: true, message: '请输入最大高压', trigger: 'blur'}
+        ],
+        shouhuan_blood_high_min: [
+          {required: true, message: '请输入最小高压', trigger: 'blur'}
+        ],
+        shouhuan_blood_low_max: [
+          {required: true, message: '请输入最大低压', trigger: 'blur'}
+        ],
+        shouhuan_blood_low_min: [
+          {required: true, message: '请输入最小低压', trigger: 'blur'}
+        ],
+        shouhuan_oxygen_max: [
+          {required: true, message: '请输入最大血氧', trigger: 'blur'}
+        ],
+        shouhuan_oxygen_min: [
+          {required: true, message: '请输入最小血氧', trigger: 'blur'}
+        ],
+        shouhuan_body_max: [
+          {required: true, message: '请输入最大体温', trigger: 'blur'}
+        ],
+        shouhuan_body_min: [
+          {required: true, message: '请输入最小体温', trigger: 'blur'}
+        ],
+      }
     };
   },
   created() {
@@ -868,6 +904,9 @@ export default {
       this.sensitivityList = res.data
     })
     this.getDicts('sys_device_attribute').then(res => {
+      res.data.map(item => {
+        item.dictValue = Number(item.dictValue)
+      })
       this.deviceAttribute = res.data
     })
     this.getDicts('sys_factory').then(res => {
@@ -1011,7 +1050,7 @@ export default {
         }
         getClock(data).then(res => {
           if (res.rows.length) {
-            let info = res.rows[0]
+            let info = res.rows
             if (info.length == 0) {
               if (this.clockList.length == 0) {
                 this.clockList.push({
@@ -1031,6 +1070,7 @@ export default {
                 item.weeks = i.clockWeek.split(',')
                 item.clockId = i.id
                 this.clockList.push(item)
+                console.log(this.clockList);
               })
             }
           } else {
@@ -1047,21 +1087,20 @@ export default {
         })
       }
     },
-
-    isEmpty(object){
+    isEmpty(object) {
       var isEmpty = true;
       if (Object.keys(object).length) {
-        Object.keys(object).forEach(function(x) {
-          if(object[x] != null && object[x] != ""){
+        Object.keys(object).forEach(function (x) {
+          if (object[x] != null && object[x] != "") {
             isEmpty = false;
           }
-      });
+        });
       }
       return isEmpty;
     },
     async setDeviceInfo() {
       if (!this.isEmpty(this.sosForm) && this.settingPage == 'sos') {
-          let arr = []
+        let arr = []
         if (this.sosForm.tel1) {
           arr.push(this.sosForm.tel1)
         }
@@ -1613,7 +1652,6 @@ export default {
         addFence(this.fenceInfo).then(res => {
           if (res.code == 200) {
             this.$modal.msgSuccess('添加成功')
-            this.fence = {}
             this.getFence()
           }
         })
@@ -1753,6 +1791,7 @@ export default {
         delete this.fenceInfo.type
         delete this.fenceInfo.state
         if (this.fence) {
+          console.log(this.fence);
           this.map.remove(this.fence)
           this.fence = null
         }
@@ -2019,10 +2058,10 @@ export default {
     },
     checkUserConfirm() {
       if (Object.keys(this.userInfo).length) {
-        this.form.name = this.userInfo.name
-        this.form.sfzid = this.userInfo.sfzid
-        this.form.telno = this.userInfo.telOne
-        this.form.userid = this.userInfo.id
+        this.$set(this.form, 'name', this.userInfo.name)
+        this.$set(this.form, 'sfzid', this.userInfo.sfzid)
+        this.$set(this.form, 'telno', this.userInfo.telOne)
+        this.$set(this.form, 'userid', this.userInfo.id)
         this.selectUser = false
       } else {
         this.$modal.msgError('请选择用户')
@@ -2062,8 +2101,8 @@ export default {
       this.clockList.map((item, index) => {
         if (item.clockId == e) {
           this.clockList.splice(index, 1)
-          if (typeof e == 'string') {
-            deleteClock({ id: e }).then(res => {
+          if (e.length < 13) {
+            deleteClock(e).then(res => {
               this.$modal.msgSuccess('删除成功')
             })
           }
@@ -2090,66 +2129,66 @@ export default {
         getDeviceSetting(data).then(res => {
           if (res.rows.length) {
             let info = res.rows[0]
-          if (info.sostelno1) {
-            this.$set(this.sosForm, 'tel1', info.sostelno1)
-          }
-          if (info.sostelno2) {
-            this.$set(this.sosForm, 'tel2', info.sostelno2)
-          }
-          if (info.gpsInterval) {
-            this.$set(this.intervalForm, 'cr_interval', info.gpsInterval)
-          }
-          if (info.heartInterval) {
-            this.$set(this.intervalForm, 'hrt_interval', info.heartInterval)
-          }
-          if (info.bodyInterval) {
-            this.$set(this.intervalForm, 'wd_interval', info.bodyInterval)
-          }
-          if (info.bloodInterval) {
-            this.$set(this.intervalForm, 'bld_interval', info.bloodInterval)
-          }
-          if (info.oxygenInterval) {
-            this.$set(this.intervalForm, 'ox_interval', info.oxygenInterval)
-          }
-          if (info.stepStatus) {
-            this.$set(this.pedoForm, 'isopen', info.stepStatus)
-          }
-          if (info.contactPer1) {
-            this.$set(this.telForm, 'name1', info.contactPer1)
-          }
-          if (info.contactTel1) {
-            this.$set(this.telForm, 'tel1', info.contactTel1)
-          }
-          if (info.contactPer2) {
-            this.$set(this.telForm, 'name2', info.contactPer2)
-          }
-          if (info.contactTel2) {
-            this.$set(this.telForm, 'tel2', info.contactTel2)
-          }
-          if (info.contactPer3) {
-            this.$set(this.telForm, 'name3', info.contactPer3)
-          }
-          if (info.contactTel3) {
-            this.$set(this.telForm, 'tel3', info.contactTel3)
-          }
-          if (info.timeStatus) {
-            this.$set(this.onoffForm, 'is_open', info.timeStatus)
-          }
-          if (info.timeBegin) {
-            this.$set(this.onoffForm, 'bootup_time', info.timeBegin)
-          }
-          if (info.timeEnd) {
-            this.$set(this.onoffForm, 'shutdown_time', info.timeEnd)
-          }
-          if (info.useStatus) {
-            this.$set(this.wearForm, 'is_open', info.useStatus)
-          }
-          if (info.fallStatus) {
-            this.$set(this.fallForm, 'is_open', info.fallStatus)
-          }
-          if (info.levelStatus) {
-            this.$set(this.fallForm, 'lsset_type', info.levelStatus)
-          }
+            if (info.sostelno1) {
+              this.$set(this.sosForm, 'tel1', info.sostelno1)
+            }
+            if (info.sostelno2) {
+              this.$set(this.sosForm, 'tel2', info.sostelno2)
+            }
+            if (info.gpsInterval) {
+              this.$set(this.intervalForm, 'cr_interval', info.gpsInterval)
+            }
+            if (info.heartInterval) {
+              this.$set(this.intervalForm, 'hrt_interval', info.heartInterval)
+            }
+            if (info.bodyInterval) {
+              this.$set(this.intervalForm, 'wd_interval', info.bodyInterval)
+            }
+            if (info.bloodInterval) {
+              this.$set(this.intervalForm, 'bld_interval', info.bloodInterval)
+            }
+            if (info.oxygenInterval) {
+              this.$set(this.intervalForm, 'ox_interval', info.oxygenInterval)
+            }
+            if (info.stepStatus) {
+              this.$set(this.pedoForm, 'isopen', info.stepStatus)
+            }
+            if (info.contactPer1) {
+              this.$set(this.telForm, 'name1', info.contactPer1)
+            }
+            if (info.contactTel1) {
+              this.$set(this.telForm, 'tel1', info.contactTel1)
+            }
+            if (info.contactPer2) {
+              this.$set(this.telForm, 'name2', info.contactPer2)
+            }
+            if (info.contactTel2) {
+              this.$set(this.telForm, 'tel2', info.contactTel2)
+            }
+            if (info.contactPer3) {
+              this.$set(this.telForm, 'name3', info.contactPer3)
+            }
+            if (info.contactTel3) {
+              this.$set(this.telForm, 'tel3', info.contactTel3)
+            }
+            if (info.timeStatus) {
+              this.$set(this.onoffForm, 'is_open', info.timeStatus)
+            }
+            if (info.timeBegin) {
+              this.$set(this.onoffForm, 'bootup_time', info.timeBegin)
+            }
+            if (info.timeEnd) {
+              this.$set(this.onoffForm, 'shutdown_time', info.timeEnd)
+            }
+            if (info.useStatus) {
+              this.$set(this.wearForm, 'is_open', info.useStatus)
+            }
+            if (info.fallStatus) {
+              this.$set(this.fallForm, 'is_open', info.fallStatus)
+            }
+            if (info.levelStatus) {
+              this.$set(this.fallForm, 'lsset_type', info.levelStatus)
+            }
           }
         })
       } else if (e == 'healthInterval') {
@@ -2217,7 +2256,7 @@ export default {
     reset() {
       this.form = {
         id: null,
-        deviceProper: null,
+        deviceProper: 0,
         userid: null,
         sfzid: null,
         telno: null,
@@ -2226,7 +2265,7 @@ export default {
         deviceId: null,
         simCode: null,
         serialNumber: null,
-        grantType: null,
+        grantType: this.grantType[0].dictValue,
         price: null,
         cost: null,
         payment: null,