Prechádzať zdrojové kódy

1、东方德思手表久坐报警开发;
2、其他优化;

wenningning 2 rokov pred
rodič
commit
e6fa8de524

+ 6 - 1
languages/en.js

@@ -209,7 +209,10 @@ module.exports = {
     param: 'Parameter',
     inputParamName: 'Please enter the parameter name',
     inputParamValue: 'Please enter the parameter value',
-    addParam: 'New parameter'
+    addParam: 'New parameter',
+    openWatchSosInfo: 'Whether to turn off the watch sedentary alarm. If it is turned off, the watch will not trigger the sedentary alarm again',
+    closeWatchSos: 'Turn off the watch sedentary alarm',
+    openWatchSos: 'Turn on the alarm for long sitting'
   },
   member: {
     face: 'Avatar',
@@ -376,6 +379,8 @@ module.exports = {
     sosDeviceSettingTime: 'Alarm time',
     sosDeviceSettingUnit: 'Alarm time unit',
     sosDeviceSettingEdit: 'Modify device alarm',
+    sosMonitoringTime: 'Monitoring time',
+    allDay: 'all day long',
     ledResolutionRatio: 'Corridor screen specification',
     ledVoice: 'Voice playback',
     ledVoiceStatus: 'Enable voice',

+ 6 - 1
languages/es.js

@@ -209,7 +209,10 @@ module.exports = {
     param: 'Parámetros',
     inputParamName: 'Introduzca el nombre del parámetro',
     inputParamValue: 'Introduzca el valor del parámetro',
-    addParam: 'Nuevos parámetros'
+    addParam: 'Nuevos parámetros',
+    openWatchSosInfo: 'Si apagar la alarma de sedentarismo del reloj. Si se cierra, el reloj no volverá a activar la alarma sedentaria',
+    closeWatchSos: 'Apague la alarma de sedentarismo del reloj',
+    openWatchSos: 'Sentarse durante mucho tiempo y encender la alarma'
   },
   member: {
     face: 'Avatar',
@@ -377,6 +380,8 @@ module.exports = {
     sosDeviceSettingTime: 'Hora de alarma',
     sosDeviceSettingUnit: 'Unidad de tiempo de alarma',
     sosDeviceSettingEdit: 'Modificar alarma del dispositivo',
+    sosMonitoringTime: 'Tiempo de monitoreo',
+    allDay: 'Todo el día',
     ledResolutionRatio: 'Especificación de pantalla de corredor',
     ledVoice: 'Reproducción de voz',
     ledVoiceStatus: 'Habilitar voz',

+ 11 - 6
languages/zh-CN.js

@@ -209,7 +209,10 @@ module.exports = {
     param: '参数',
     inputParamName: '请输入参数名',
     inputParamValue: '请输入参数值',
-    addParam: '新增参数'
+    addParam: '新增参数',
+    openWatchSosInfo: '是否关闭手表久坐报警,关闭的话手表不会再触发久坐报警',
+    closeWatchSos: '关闭手表久坐报警',
+    openWatchSos: '开启手表久坐报警'
   },
   member: {
     face: '头像',
@@ -371,11 +374,13 @@ module.exports = {
     inputRe485SipId: '请输入485地址',
     sosDeviceSettingType: '报警模式',
     sosDeviceSettingStatusFalse: '不开启',
-    sosDeviceSettingControlModel: '疫情防控模式',
-    sosDeviceSettingElderlyModel: '关爱老人模式',
-    sosDeviceSettingTime: '报警时间',
+    sosDeviceSettingControlModel: '防控模式',
+    sosDeviceSettingElderlyModel: '关爱模式',
+    sosDeviceSettingTime: '报警周期',
     sosDeviceSettingUnit: '报警时间单位',
     sosDeviceSettingEdit: '修改设备报警',
+    sosMonitoringTime: '监测时间',
+    allDay: '全天',
     ledResolutionRatio: '点阵屏规格',
     ledVoice: '语音播放',
     ledVoiceStatus: '启用语音',
@@ -1059,8 +1064,8 @@ module.exports = {
   },
   sosDeviceSettingType: {
     NOT_START: '不启动',
-    EPIDEMIC_PATTERN: '疫情防控模式',
-    CARING_PATTERN: '关爱老人模式'
+    EPIDEMIC_PATTERN: '防控模式',
+    CARING_PATTERN: '关爱模式'
   },
   tcpType: {
     CALLBACK: 'TCP反馈',

+ 16 - 2
src/api/ncs_sos_device_settings.js

@@ -20,9 +20,9 @@ export function deleteByDeviceId(id) {
 }
 
 /** 更新设备报警 */
-export function updateByDeviceId(id, params) {
+export function updateById(id, params) {
   return request({
-    url: `/ncs/sos_device_settings/update_by_device_id/${id}`,
+    url: `/ncs/sos_device_settings/${id}`,
     method: 'put',
     data: params
   })
@@ -47,3 +47,17 @@ export function getSosDeviceSettingList(params) {
     headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
   })
 }
+
+export function changeWatchSos(param) {
+  return request({
+    url: `/ncs/sos_device_settings/change_watch_sos/${param}`,
+    method: 'GET'
+  })
+}
+
+export function getWatchSos(param) {
+  return request({
+    url: `/ncs/sos_device_settings/get_watch_sos`,
+    method: 'GET'
+  })
+}

+ 1 - 1
src/router/index.js

@@ -133,7 +133,7 @@ export const partRoutes = [
         path: 'ncs-user-watch',
         component: () => import('@/views/ncs-device/user_watch'),
         name: 'user_watch',
-        meta: { title: i18n.t('tab.userLocationManage'), icon: 'el-icon-watch', noCache: true } // 用户设备
+        meta: { title: i18n.t('tab.userLocationManage'), icon: 'el-icon-watch-1', noCache: true } // 用户设备
       },
       {
         path: 'ncs-sos-device',

+ 2 - 0
src/views/dashboard/calling/index.vue

@@ -295,6 +295,8 @@ export default {
           return this.$t('tcpType.BROADCAST')
         case 'TIME':
           return this.$t('tcpType.TIME')
+        case 'SOS':
+          return this.$t('tcpType.SOS')
         default:
           return this.$t('tcpType.UNKNOWN')
       }

+ 3 - 13
src/views/hospital/ncs_device/deviceManager.vue

@@ -395,10 +395,10 @@ export default {
           label: '不开启'
         }, {
           value: 1,
-          label: '疫情防控模式'
+          label: '防控模式'
         }, {
           value: 2,
-          label: '关爱老人模式'
+          label: '关爱模式'
         }
       ],
       isLedDevice: false,
@@ -858,18 +858,8 @@ export default {
 
             if (this.hasSosDeviceSettings) {
               this.sosDeviceSetting.device_id = this.deviceModel.id
-              API_SosDeviceSetting.updateByDeviceId(this.deviceModel.id, this.sosDeviceSetting).then(() => {
+              API_SosDeviceSetting.updateById(this.sosDeviceSetting.id, this.sosDeviceSetting).then(() => {
                 this.$message.success(this.$t('action.saveSuccess'))
-
-                if (this.hasSosDeviceSettings) {
-                  this.sosDeviceSetting.device_id = this.deviceModel.id
-                  this.sosDeviceSetting.part_id = this.deviceModel.part_id
-                  API_SosDeviceSetting.updateByDeviceId(this.deviceModel.id, this.sosDeviceSetting).then(() => {
-                    this.$message.success(this.$t('action.saveSuccess'))
-                    this.hasSosDeviceSettings = false
-                  })
-                }
-
                 this.hasSosDeviceSettings = false
                 this.getList()
               })

+ 78 - 37
src/views/ncs-device/components/deviceManager.vue

@@ -227,35 +227,54 @@
                         </el-form-item>
                     </el-col>
                 </el-row>
-                <el-row v-if="hasSosDeviceSettings">
+                <div v-if="hasSosDeviceSettings">
+                  <el-row>
                     <el-col :span="12">
-                        <el-form-item :label="this.$t('deviceManage.sosDeviceSettingType')" prop="type">
-                            <el-select v-model="sosDeviceSetting.type"
-                                       :placeholder="this.$t('deviceManage.sosDeviceSettingType')" clearable>
-                                <!--                <el-option v-for="item in sosDeviceSettingsTypeOptions" :key="item.value" :label="item.label" :value="item.value" /><el-option v-for="(item, index) in Object.keys(sosDeviceSettingEnum)" :key="index" :label="sosDeviceSettingEnum[item]" :value="parseInt(item)" />-->
-                                <el-option v-for="(item, index) in Object.keys(sosDeviceSettingEnum)" v-if="deviceModel.device_type === DEVICE_TYPE.SIMULATE_BED_DEVICE " :key="index"
-                                           :label="sosDeviceSettingEnum[item]" :value="parseInt(item)"/>
-                            </el-select>
-                        </el-form-item>
+                      <el-form-item :label="this.$t('deviceManage.sosDeviceSettingType')" prop="type">
+                        <el-select v-model="sosDeviceSetting.type"
+                                   :placeholder="this.$t('deviceManage.sosDeviceSettingType')" clearable>
+                          <!--                <el-option v-for="item in sosDeviceSettingsTypeOptions" :key="item.value" :label="item.label" :value="item.value" /><el-option v-for="(item, index) in Object.keys(sosDeviceSettingEnum)" :key="index" :label="sosDeviceSettingEnum[item]" :value="parseInt(item)" />-->
+                          <el-option v-for="(item, index) in Object.keys(sosDeviceSettingEnum)" v-if="(deviceModel.device_type === getDeviceType().BREASTPLATE &&  item !== '1') || deviceModel.device_type !==  getDeviceType().BREASTPLATE" :key="index"
+                                     :label="sosDeviceSettingEnum[item]" :value="parseInt(item)"/>
+                        </el-select>
+                      </el-form-item>
                     </el-col>
-                </el-row>
-                <el-row v-if="sosDeviceSetting.type === 2">
-                    <el-col :span="12">
+                  </el-row>
+                  <el-row v-if="sosDeviceSetting.type === 2">
+                    <div v-if="deviceModel.device_type === getDeviceType().BREASTPLATE">
+                      <el-col :span="8">
+                        <el-form-item :label="this.$t('deviceManage.sosDeviceSettingTime') + '/' + this.$t('action.minute')" prop="setting_time">
+                          <el-input-number v-model="sosDeviceSetting.setting_time" controls-position="right" :min="60" :step="10" step-strictly :max="720"/>
+                        </el-form-item>
+                      </el-col>
+                      <el-col :span="16">
+                        <el-form-item :label="this.$t('deviceManage.sosMonitoringTime')">
+                          <el-time-select placeholder="起始时间" v-model="startTime" :picker-options="{start: '04:00',step: '01:00',end: '23:00'}" />
+                          <el-time-select placeholder="结束时间" v-model="endTime" :picker-options="{start: '04:00',step: '01:00',end: '23:00', minTime: startTime }" />
+                        </el-form-item>
+                      </el-col>
+                    </div>
+                    <div v-else>
+                      <el-col :span="12">
                         <el-form-item :label="this.$t('deviceManage.sosDeviceSettingTime')" prop="setting_time">
-                            <el-input-number v-model="sosDeviceSetting.setting_time" controls-position="right" :min="0"
-                                             :max="60"/>
+                          <el-input-number v-model="sosDeviceSetting.setting_time" controls-position="right" :min="0"
+                                           :max="60"/>
                         </el-form-item>
-                    </el-col>
-                    <el-col :span="12">
+                      </el-col>
+                      <el-col :span="12">
                         <el-form-item :label="this.$t('deviceManage.sosDeviceSettingUnit')" prop="unit">
-                            <el-radio-group v-model="sosDeviceSetting.unit" size="mini" prop="unit">
-                                <el-radio :label="this.$t('action.time')">{{ this.$t('action.time') }}</el-radio>
-                                <el-radio :label="this.$t('action.minute')">{{ this.$t('action.minute') }}</el-radio>
-                                <el-radio :label="this.$t('action.second')">{{ this.$t('action.second') }}</el-radio>
-                            </el-radio-group>
+                          <el-radio-group v-model="sosDeviceSetting.unit" size="mini" prop="unit">
+                            <el-radio :label="this.$t('action.time')">{{ this.$t('action.time') }}</el-radio>
+                            <el-radio :label="this.$t('action.minute')">{{ this.$t('action.minute') }}</el-radio>
+                            <el-radio :label="this.$t('action.second')">{{ this.$t('action.second') }}</el-radio>
+                          </el-radio-group>
                         </el-form-item>
-                    </el-col>
-                </el-row>
+                      </el-col>
+                    </div>
+
+                  </el-row>
+                </div>
+
                 <el-row v-if="isLedDevice">
                     <el-col :span="12">
                         <el-form-item :label="this.$t('deviceManage.ledResolutionRatio')" prop="led_resolution_ratio">
@@ -441,10 +460,10 @@
                         label: '不开启'
                     }, {
                         value: 1,
-                        label: '疫情防控模式'
+                        label: '防控模式'
                     }, {
                         value: 2,
-                        label: '关爱老人模式'
+                        label: '关爱模式'
                     }
                 ],
                 sosDeviceSettingEnum: SOS_DEVICE_SETTING_TYPE.getValueList(),
@@ -466,7 +485,9 @@
                     serverPort: [
                         this.MixinRequired(this.$t('deviceManage.inputServerPort'))
                     ]
-                }
+                },
+              startTime: "06:00",
+              endTime: "18:00"
             }
         },
         computed: {
@@ -922,7 +943,7 @@
                 this.isVitalSigns = val === DEVICE_TYPE.VITAL_SIGNS_DEVICE
                 this.hasSosDeviceSettings = val === DEVICE_TYPE.ALARM_BODY_INDUCTIVE ||
                     val === DEVICE_TYPE.DOOR_LOCK ||
-                    val === DEVICE_TYPE.ALARM_RESTRAINT_BAND
+                    val === DEVICE_TYPE.ALARM_RESTRAINT_BAND || val === DEVICE_TYPE.BREASTPLATE
                 this.isLedDevice = val === DEVICE_TYPE.LED_SCREEN
             },
             /** 设备类型选中对应的空间结构  **/
@@ -971,7 +992,7 @@
                 this.sosDeviceSetting = {
                     type: 0,
                     unit: '小时',
-                    setting_time: 0,
+                    setting_time: 120
                 }
                 if (Object.keys(this.frame).length > 0) {
                     this.$set(this.deviceModel, 'frame_id', this.frame.id)
@@ -1015,7 +1036,7 @@
 
                 if (params.device_type === DEVICE_TYPE.ALARM_BODY_INDUCTIVE ||
                     params.device_type === DEVICE_TYPE.DOOR_LOCK ||
-                    params.device_type === DEVICE_TYPE.ALARM_RESTRAINT_BAND) {
+                    params.device_type === DEVICE_TYPE.ALARM_RESTRAINT_BAND || params.device_type === DEVICE_TYPE.BREASTPLATE) {
                     this.hasSosDeviceSettings = true
                     this.getSosDeviceSetting(params.id)
                 } else {
@@ -1048,14 +1069,19 @@
                                 _this.device = r
                                 this.sosDeviceSetting.device_id = _this.device.id
                                 this.sosDeviceSetting.part_id = _this.device.part_id
-
+                                // 是报警设备
                                 if (this.hasSosDeviceSettings) {
-                                    API_SosDeviceSetting.add(this.sosDeviceSetting).then(() => {
-                                        this.$message.success(this.$t('action.saveSuccess'))
-                                        this.hasSosDeviceSettings = false
-                                    })
+                                  // 是胸牌/手表
+                                  if (this.deviceModel.device_type === DEVICE_TYPE.BREASTPLATE) {
+                                    this.sosDeviceSetting.cron_str = this.startTime + ',' + this.endTime
+                                  }
+                                  this.sosDeviceSetting.device_type = this.deviceModel.device_type
+                                  this.sosDeviceSetting.device_eth_mac = this.deviceModel.eth_mac
+                                  API_SosDeviceSetting.add(this.sosDeviceSetting).then(() => {
+                                    this.$message.success(this.$t('action.saveSuccess'))
+                                    this.hasSosDeviceSettings = false
+                                  })
                                 }
-
                                 this.deviceDialogVisible = false
                                 this.getList()
                             })
@@ -1067,7 +1093,12 @@
                                 if (this.hasSosDeviceSettings) {
                                     this.sosDeviceSetting.device_id = this.deviceModel.id
                                     this.sosDeviceSetting.part_id = this.deviceModel.part_id
-                                    API_SosDeviceSetting.updateByDeviceId(this.deviceModel.id, this.sosDeviceSetting).then(() => {
+                                  this.sosDeviceSetting.device_type = this.deviceModel.device_type
+                                  // 是胸牌/手表
+                                  if (this.deviceModel.device_type === DEVICE_TYPE.BREASTPLATE) {
+                                    this.sosDeviceSetting.cron_str = this.startTime + ',' + this.endTime
+                                  }
+                                    API_SosDeviceSetting.updateById(this.sosDeviceSetting.id, this.sosDeviceSetting).then(() => {
                                         this.$message.success(this.$t('action.saveSuccess'))
                                         this.hasSosDeviceSettings = false
                                     })
@@ -1109,6 +1140,13 @@
             getSosDeviceSetting(deviceId) {
                 API_SosDeviceSetting.getSosDeviceSetting(deviceId).then(r => {
                     this.sosDeviceSetting = r;
+                    if (r.cron_str) {
+                      let str = r.cron_str.split(',')
+                      if (str.length === 2) {
+                        this.startTime = str[0]
+                        this.endTime = str[1]
+                      }
+                    }
                 })
             },
             getShop(shopId) {
@@ -1195,7 +1233,10 @@
                     val === DEVICE_TYPE.OWON_X5_GATEWAY ||
                     val === DEVICE_TYPE.HUMAN_DETECTION_RADAR ||
                     val === DEVICE_TYPE.INFORMATION_BOARD;
-            }
+            },
+          getDeviceType() {
+              return DEVICE_TYPE;
+          }
         }
     }
 </script>

+ 0 - 71
src/views/ncs-device/user_watch.vue

@@ -114,7 +114,6 @@ export default {
       role_name: '',
       member_id: null,
       member_name:'',
-      onlineDevice: [],
       locationShow: false,
       deviceId: null
     }
@@ -142,34 +141,6 @@ export default {
       { headerName: this.$t('deviceManage.deviceName'), field: 'name', sortable: true, filter: 'agTextColumnFilter', minWidth: 150 },
       { headerName: this.$t('watch.deviceMember'), field: 'member_name', sortable: true, filter: 'agTextColumnFilter', minWidth: 220, valueFormatter: this.formatterName },
       { headerName: this.$t('watch.ethMac'), field: 'eth_mac', sortable: true, filter: 'agTextColumnFilter', minWidth: 150 },
-      { headerName: this.$t('deviceManage.connect'), field: 'online_state', sortable: false, filter: 'agTextColumnFilter', minWidth: 120,
-        filterParams: {
-          textCustomComparator: (filter, value, filterText) => {
-            const filterTextLowerCase = filterText.toLowerCase()
-            const valueLowerCase = value.toString().toLowerCase()
-            switch (filter) {
-              case 'contains':
-                return valueLowerCase.indexOf(filterTextLowerCase) >= 0
-              case 'notContains':
-                return valueLowerCase.indexOf(filterTextLowerCase) === -1
-              case 'equals':
-                return valueLowerCase === filterTextLowerCase
-              case 'notEqual':
-                return valueLowerCase !== filterTextLowerCase
-              case 'startsWith':
-                return valueLowerCase.indexOf(filterTextLowerCase) === 0
-              case 'endsWith':
-                var index = valueLowerCase.lastIndexOf(filterTextLowerCase)
-                return index >= 0 && index === (valueLowerCase.length - filterTextLowerCase.length)
-              default:
-                // should never happen
-                console.warn('invalid filter type ' + filter)
-                return false
-            }
-          }
-        },
-        cellRenderer: this.onlineStateFormatter
-      },
       { headerName: this.$t('deviceManage.ethIp'), field: 'eth_ip', sortable: true, filter: 'agTextColumnFilter', minWidth: 150 },
       { headerName: this.$t('deviceManage.model'), field: 'model', sortable: true, filter: 'agTextColumnFilter', minWidth: 150 },
       { headerName: this.$t('deviceManage.code'), field: 'code', sortable: true, filter: 'agTextColumnFilter', minWidth: 150 },
@@ -237,40 +208,11 @@ export default {
     window.onresize = this.windowResize()
     this.gridApi = this.gridOptions.api
     this.getList()
-    this.deviceOnlineWebSocket()
   },
   methods: {
     windowResize() {
       this.$set(this, 'mainAreaHeight', Number(document.documentElement.clientHeight) - 84)
     },
-    deviceOnlineWebSocket: function() {
-      var stockbase = DeviceUrl.replace('http', 'ws')
-      this.websock1 = new WebSocket(stockbase + '/deviceonline/' + this.$store.getters.uuid)
-      this.websock1.onopen = this.deviceOnlineWebsocketonopen
-      this.websock1.onerror = this.deviceOnlineWebsocketonerror
-      this.websock1.onmessage = this.deviceOnlineWebsocketonmessage
-      this.websock1.onclose = this.deviceOnlineWebsocketclose
-    },
-    deviceOnlineWebsocketonopen: function() {
-      console.log(this.$t('deviceManage.webSocketSuccess'))
-    },
-    deviceOnlineWebsocketonerror: function(e) {
-      console.log(this.$t('deviceManage.webSocketError'))
-    },
-    deviceOnlineWebsocketonmessage: function(e) {
-      this.onlineDevice = JSON.parse(e.data)
-      if (this.tableData !== null) {
-        this.tableData.forEach(item => {
-          const mac = this.onlineDevice.filter(p => p.toLowerCase() === item.eth_mac.toLowerCase())[0]
-          item.online_state = (mac !== undefined && mac !== null) ? '在线' : '离线'
-        })
-        const tableData = [...this.tableData]
-        this.$set(this, 'tableData', tableData)
-      }
-    },
-    deviceOnlineWebsocketclose: function(e) {
-      console.log('connection closed (' + e.code + ')')
-    },
     /** 选择行变化时,记录选中的行数据 */
     selectFun(val) {
       this.multipleSelection = val
@@ -292,19 +234,6 @@ export default {
       this.gridApi.sizeColumnsToFit()
       API_Device.getList(this.params).then(response => {
         this.loading = false
-        response.data.forEach(item => {
-          if (this.onlineDevice.length > 0) {
-            const mac = this.onlineDevice.filter(p => p.toLowerCase() === item.eth_mac.toLowerCase())[0]
-            // console.log('在线设备1', mac)
-            if (mac !== undefined && mac !== null) {
-              item['online_state'] = this.$t('deviceManage.connectTrue')
-            } else {
-              item['online_state'] = this.$t('deviceManage.connectFalse')
-            }
-          } else {
-            item['online_state'] = this.$t('deviceManage.connectFalse')
-          }
-        })
         this.tableData = response.data
         this.pageData = {
           page_no: response.page_no,

+ 88 - 26
src/views/ncs-sos-device-setting/sos_device_setting.vue

@@ -19,7 +19,13 @@
         <div class="toolbar-search">
           <en-table-search :placeholder="this.$t('action.keywords')" @search="handlerSearch" />
         </div>
+        <div>
+            <el-tooltip class="item" effect="dark" :content="$t('action.openWatchSosInfo')" placement="top-start">
+              <el-switch v-model="boolOpenWatchSos" :active-text="$t('action.closeWatchSos')" :inactive-text="$t('action.openWatchSos')" style="margin-bottom: 10px;margin-left: 10px;" @change="openWatchSos"></el-switch>
+            </el-tooltip>
+        </div>
       </div>
+
       <el-pagination
         v-if="pageData"
         slot="pagination"
@@ -40,24 +46,43 @@
             <el-form-item :label="this.$t('deviceManage.sosDeviceSettingType')" prop="type">
               <el-select v-model="sosDeviceSettingModel.type" :placeholder="this.$t('deviceManage.sosDeviceSettingType')" clearable>
 <!--                <el-option v-for="item in sosDeviceSettingsTypeOptions" :key="item.value" :label="item.key" :value="item.value" />-->
-                <el-option v-for="(item, index) in Object.keys(sosDeviceSettingEnum)" :key="index" :label="sosDeviceSettingEnum[item]" :value="parseInt(item)" />
+<!--                <el-option v-for="(item, index) in Object.keys(sosDeviceSettingEnum)" :key="index" :label="sosDeviceSettingEnum[item]" :value="parseInt(item)" />-->
+                <el-option v-for="(item, index) in Object.keys(sosDeviceSettingEnum)" v-if="(sosDeviceSettingModel.device_type === getDeviceType().BREASTPLATE &&  item !== '1') || sosDeviceSettingModel.device_type !==  getDeviceType().BREASTPLATE" :key="index"
+                           :label="sosDeviceSettingEnum[item]" :value="parseInt(item)"/>
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
-            <el-form-item :label="this.$t('deviceManage.sosDeviceSettingTime')" prop="setting_time">
-              <el-input-number v-model="sosDeviceSettingModel.setting_time" controls-position="right" :min="0" :max="60" />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item :label="this.$t('deviceManage.sosDeviceSettingUnit')" prop="unit">
-              <el-radio-group v-model="sosDeviceSettingModel.unit" size="mini" prop="unit">
-                <el-radio label="小时">{{ this.$t('action.time') }}</el-radio>
-                <el-radio label="分钟">{{ this.$t('action.minute') }}</el-radio>
-                <el-radio label="秒">{{ this.$t('action.second') }}</el-radio>
-              </el-radio-group>
-            </el-form-item>
-          </el-col>
+          <div v-if="sosDeviceSettingModel.type === 2">
+            <div v-if="sosDeviceSettingModel.device_type === getDeviceType().BREASTPLATE">
+              <el-col :span="8">
+                <el-form-item :label="this.$t('deviceManage.sosDeviceSettingTime') + '/' + this.$t('action.minute')" prop="setting_time">
+                  <el-input-number v-model="sosDeviceSettingModel.setting_time" controls-position="right" :min="60" :step="10" step-strictly :max="720"/>
+                </el-form-item>
+              </el-col>
+              <el-col :span="16">
+                <el-form-item :label="this.$t('deviceManage.sosMonitoringTime')">
+                  <el-time-select placeholder="起始时间" v-model="startTime" :picker-options="{start: '04:00',step: '01:00',end: '23:00'}" />
+                  <el-time-select placeholder="结束时间" v-model="endTime" :picker-options="{start: '04:00',step: '01:00',end: '23:00', minTime: startTime }" />
+                </el-form-item>
+              </el-col>
+            </div>
+            <div v-else>
+              <el-col :span="12">
+                <el-form-item :label="this.$t('deviceManage.sosDeviceSettingTime')" prop="setting_time">
+                  <el-input-number v-model="sosDeviceSettingModel.setting_time" controls-position="right" :min="0" :max="60" />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item :label="this.$t('deviceManage.sosDeviceSettingUnit')" prop="unit">
+                  <el-radio-group v-model="sosDeviceSettingModel.unit" size="mini" prop="unit">
+                    <el-radio label="小时">{{ this.$t('action.time') }}</el-radio>
+                    <el-radio label="分钟">{{ this.$t('action.minute') }}</el-radio>
+                    <el-radio label="秒">{{ this.$t('action.second') }}</el-radio>
+                  </el-radio-group>
+                </el-form-item>
+              </el-col>
+            </div>
+          </div>
         </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -76,6 +101,7 @@ import RadioFilter from '@/components/AgGridCustomFilter/RadioFilter'
 import * as API_SosDeviceSetting from "@/api/ncs_sos_device_settings";
 import {DEVICE_TYPE} from "@/utils/enum/DeviceTypeEnum";
 import {SOS_DEVICE_SETTING_TYPE} from "@/utils/enum/SosDeviceSettingTypeEnum";
+import { changeWatchSos, getWatchSos } from '@/api/ncs_sos_device_settings'
 
 export default {
   name: 'Index',
@@ -130,6 +156,9 @@ export default {
         { key: this.$t('deviceManage.sosDeviceSettingElderlyModel'), value: 2 }
       ],
       sosDeviceSettingEnum: SOS_DEVICE_SETTING_TYPE.getValueList(),
+      startTime: "06:00",
+      endTime: "18:00",
+      boolOpenWatchSos: false
     }
   },
   computed: {
@@ -151,20 +180,19 @@ export default {
         resizable: false,
         valueGetter: this.hashValueGetter
       },
-      { headerName: 'ID', field: 'id', sortable: true, filter: 'agNumberColumnFilter', width: 100 },
-      { headerName: this.$t('deviceManage.sosDeviceSettingTime'), field: 'setting_time', sortable: false, filter: false , width: 120, valueGetter: this.settingTimeGetter},
+      { headerName: this.$t('deviceManage.deviceName'), field: 'device_name', sortable: false, filter: false , minWidth: 150 },
+      { headerName: this.$t('deviceManage.deviceType'), field: 'device_type', sortable: false, filter: false, minWidth: 120, valueFormatter: this.deviceTypeGetter},
+      { headerName: this.$t('deviceManage.ethMac'), field: 'device_eth_mac', sortable: false, filter: false, minWidth: 200  },
       { headerName: this.$t('deviceManage.sosDeviceSettingType'), field: 'type', sortable: true,
-        filterFramework: 'ListFilter', width: 150,
+        filterFramework: 'ListFilter', minWidth: 220,
         filterParams: {
           listData: this.sosDeviceSettingsTypeOptions
         },
         valueGetter: this.sosDeviceSettingTypeGetter
       },
-      { headerName: this.$t('deviceManage.deviceId'), field: 'device_id', sortable: true, filter: 'agNumberColumnFilter' , width: 100 },
-      { headerName: this.$t('deviceManage.deviceName'), field: 'device_name', sortable: false, filter: false , width: 150 },
-      { headerName: this.$t('deviceManage.deviceType'), field: 'device_type', sortable: false, filter: false, width: 120, valueFormatter: this.deviceTypeGetter},
-      { headerName: this.$t('deviceManage.ethMac'), field: 'device_eth_mac', sortable: false, filter: false, width: 200  },
-      { headerName: this.$t('deviceManage.frameName'), field: 'frame_full_name', sortable: false, filter: false , width: 150 },
+      { headerName: this.$t('deviceManage.sosDeviceSettingTime'), field: 'setting_time', sortable: false, filter: false , minWidth: 120, valueGetter: this.settingTimeGetter},
+      { headerName: this.$t('deviceManage.sosMonitoringTime'), field: 'cron_str', sortable: false, filter: false , minWidth: 120, valueGetter: this.cronStrGetter},
+      { headerName: this.$t('deviceManage.frameName'), field: 'frame_full_name', sortable: false, filter: false , minWidth: 160 },
       {
         headerName: this.$t('action.edit'), field: 'id',
         cellRendererFramework: 'ButtonCellRender',
@@ -196,9 +224,9 @@ export default {
     this.rowSelection = 'multiple'
   },
   mounted() {
-    // window.onresize = this.windowResize()
     this.gridApi = this.gridOptions.api
     this.getList()
+    this.API_getWatchSos()
   },
   methods: {
     /** 分页大小发生改变 */
@@ -216,6 +244,7 @@ export default {
       this.loading = true
       const param = this.MixinClone(this.params)
       this.gridApi.showLoadingOverlay()
+      this.gridApi.sizeColumnsToFit()
       API_SosDeviceSetting.getSosDeviceSettingList(param).then(response => {
         this.loading = false
         this.tableData = response.data
@@ -294,6 +323,13 @@ export default {
       this.sosDeviceSettingModel = {
         ...params
       }
+      if (params.cron_str) {
+        let str = params.cron_str.split(',')
+        if (str.length === 2) {
+          this.startTime = str[0]
+          this.endTime = str[1]
+        }
+      }
       this.sosDeviceSettingEditTitle = this.$t('deviceManage.sosDeviceSettingEdit')
       this.sosDeviceSettingFormShow = true
     },
@@ -303,7 +339,11 @@ export default {
         if (valid) {
           const _this = this;
           /** 修改 */
-          API_SosDeviceSetting.updateByDeviceId(this.sosDeviceSettingModel.device_id, this.sosDeviceSettingModel).then(() => {
+          // 是胸牌/手表
+          if (this.sosDeviceSettingModel.device_type === DEVICE_TYPE.BREASTPLATE) {
+            this.sosDeviceSettingModel.cron_str = this.startTime + ',' + this.endTime
+          }
+          API_SosDeviceSetting.updateById(this.sosDeviceSettingModel.id, this.sosDeviceSettingModel).then(() => {
             this.$message.success( this.$t('action.saveSuccess'))
             this.sosDeviceSettingFormShow = false
             this.getList()
@@ -326,7 +366,29 @@ export default {
       const settingTime = params.data.setting_time
       const unit = params.data.unit
       return this.$t('action.every') + settingTime + unit + '/' + this.$t('action.times')
-    }
+    },
+    cronStrGetter(params) {
+      if (params.data.device_type === DEVICE_TYPE.BREASTPLATE) {
+        let str = params.data.cron_str.split(',')
+        return str[0] + '-' + str[1]
+      } else {
+        return this.$t('deviceManage.allDay')
+      }
+    },
+    getDeviceType() {
+      return DEVICE_TYPE
+    },
+    openWatchSos() {
+      const s = this.boolOpenWatchSos ? 1 : 0
+      changeWatchSos(s).then(res =>{
+        this.$message.success(this.$t('action.editSuccess'))
+      })
+    },
+    API_getWatchSos() {
+      getWatchSos().then(res => {
+        this.boolOpenWatchSos = res
+      })
+    },
     // fanhui() {
     //   this.sosDeviceSettingFormShow = false
     // },