|
@@ -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
|
|
|
// },
|