|
@@ -184,6 +184,29 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-row v-if="hasSosDeviceSettings">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="报警设备模式" prop="type">
|
|
|
+ <el-select v-model="sosDeviceSetting.type" placeholder="报警设备模式" clearable>
|
|
|
+ <el-option v-for="item in sosDeviceSettingsTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row v-if="hasSosDeviceSettings">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="报警时间" prop="setting_time">
|
|
|
+ <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-radio-group label="报警时间单位" v-model="sosDeviceSetting.unit" size="mini" prop="unit">
|
|
|
+ <el-radio label="小时">小时</el-radio>
|
|
|
+ <el-radio label="分钟">分钟</el-radio>
|
|
|
+ <el-radio label="秒">秒</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="handlerFormSubmit('deviceEditForm')">确 定</el-button>
|
|
@@ -205,6 +228,7 @@ import { DEVICE_TYPE } from '@/utils/enum/DeviceTypeEnum'
|
|
|
import * as API_Frame from '@/api/ncs_hospitalFrame'
|
|
|
import { FRAME_TYPE } from '@/utils/enum/FrameTypeEnum'
|
|
|
import * as shop_API from '@/api/ncs_shop'
|
|
|
+import * as API_SosDeviceSetting from "@/api/ncs_sos_device_settings";
|
|
|
export default {
|
|
|
name: 'DeviceManager',
|
|
|
components: { ButtonCellRender, ListFilter, RadioFilter },
|
|
@@ -319,7 +343,20 @@ export default {
|
|
|
audioOptions: [],
|
|
|
rs485Options: [],
|
|
|
hasAudioId: false,
|
|
|
- hasAdd: true
|
|
|
+ hasSosDeviceSettings: false,
|
|
|
+ sosDeviceSetting: {},
|
|
|
+ sosDeviceSettingsTypeOptions: [
|
|
|
+ {
|
|
|
+ value: 0,
|
|
|
+ label: '不开启'
|
|
|
+ }, {
|
|
|
+ value: 1,
|
|
|
+ label: '疫情防控模式'
|
|
|
+ }, {
|
|
|
+ value: 2,
|
|
|
+ label: '关爱老人模式'
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -572,6 +609,12 @@ export default {
|
|
|
message: response.message
|
|
|
})
|
|
|
})
|
|
|
+ if (this.hasSosDeviceSettings) {
|
|
|
+ API_SosDeviceSetting.deleteByDeviceId(id).then(() => {
|
|
|
+ this.hasSosDeviceSettings = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ }
|
|
|
}).catch(() => {
|
|
|
this.$message({
|
|
|
type: 'info',
|
|
@@ -605,6 +648,8 @@ export default {
|
|
|
val === DEVICE_TYPE.RS485_DOOR ||
|
|
|
val === DEVICE_TYPE.SIMULATE_EMERGENCY_BUTTON ||
|
|
|
val === DEVICE_TYPE.SIMULATE_DOOR_LIGHT
|
|
|
+ this.hasSosDeviceSettings = val === DEVICE_TYPE.ALARM_BODY_INDUCTIVE ||
|
|
|
+ val === DEVICE_TYPE.DOOR_LOCK
|
|
|
},
|
|
|
/** 设备类型选中对应的空间结构 **/
|
|
|
deviceTypeChangeToFrameTypeChange(val) {
|
|
@@ -616,31 +661,24 @@ export default {
|
|
|
val === DEVICE_TYPE.WORKER_WATCH ||
|
|
|
val === DEVICE_TYPE.TRANSFER_DEVICE ||
|
|
|
val === DEVICE_TYPE.INFORMATION_BOARD ||
|
|
|
- val === DEVICE_TYPE.RS485_TRANSFER ||
|
|
|
- val === DEVICE_TYPE.DOOR_LOCK
|
|
|
+ val === DEVICE_TYPE.RS485_TRANSFER
|
|
|
) {
|
|
|
this.getFramesByType(FRAME_TYPE.PART)
|
|
|
} else if (val === DEVICE_TYPE.DOOR_DEVICE ||
|
|
|
val === DEVICE_TYPE.SIMULATE_EMERGENCY_BUTTON ||
|
|
|
val === DEVICE_TYPE.RS485_DOOR ||
|
|
|
val === DEVICE_TYPE.SIMULATE_DOOR_LIGHT ||
|
|
|
- val === DEVICE_TYPE.BEACON ||
|
|
|
- val === DEVICE_TYPE.DOOR_LOCK
|
|
|
+ val === DEVICE_TYPE.BEACON
|
|
|
) {
|
|
|
this.getFramesByType(FRAME_TYPE.ROOM)
|
|
|
} else if (val === DEVICE_TYPE.DIGIT_BED_DEVICE ||
|
|
|
val === DEVICE_TYPE.SIMULATE_BED_DEVICE ||
|
|
|
val === DEVICE_TYPE.REMOTE_CONTROL ||
|
|
|
- val === DEVICE_TYPE.CELL_PHONE ||
|
|
|
- val === DEVICE_TYPE.ALARM_BODY_INDUCTIVE ||
|
|
|
- val === DEVICE_TYPE.ALARM_WATER_OVERFLOW ||
|
|
|
- val === DEVICE_TYPE.ALARM_HOUSEHOLD_GAS ||
|
|
|
- val === DEVICE_TYPE.ALARM_HOUSEHOLD_SMOKE ||
|
|
|
- val === DEVICE_TYPE.ALARM_BUTTON_SOS ||
|
|
|
- val === DEVICE_TYPE.DOOR_LOCK
|
|
|
+ val === DEVICE_TYPE.CELL_PHONE
|
|
|
) {
|
|
|
this.getFramesByType(FRAME_TYPE.BED)
|
|
|
} else {
|
|
|
+ this.getTypeFrame(this.$store.getters.partId)
|
|
|
this.typeFrames = this.partFrames
|
|
|
}
|
|
|
},
|
|
@@ -653,6 +691,11 @@ export default {
|
|
|
code: 'C' + parseInt(Math.random() * 100000),
|
|
|
model: 'M' + parseInt(Math.random() * 100000)
|
|
|
}
|
|
|
+ this.sosDeviceSetting = {
|
|
|
+ type: 0,
|
|
|
+ unit: '小时',
|
|
|
+ setting_time: 0,
|
|
|
+ }
|
|
|
if (Object.keys(this.frame).length > 0) {
|
|
|
this.$set(this.deviceModel, 'frame_id', this.frame.id)
|
|
|
}
|
|
@@ -660,6 +703,7 @@ export default {
|
|
|
this.hasRoleId = false
|
|
|
this.getRoles({ page_size: 200, page_no: 1, fixedCondition: ' shop_id = -1', sort: ' role_id', dir: 'desc' })
|
|
|
this.hasAudioId = false
|
|
|
+ this.hasSosDeviceSettings = false
|
|
|
this.getDevices(this.$store.getters.partId)
|
|
|
this.deviceEditTitle = '添加设备'
|
|
|
this.deviceDialogVisible = true
|
|
@@ -671,12 +715,15 @@ export default {
|
|
|
handleEdit(params) {
|
|
|
this.getRoles({ page_size: 200, page_no: 1, fixedCondition: ' shop_id = -1', sort: ' role_id', dir: 'desc' })
|
|
|
this.getDevices(this.$store.getters.partId)
|
|
|
+ this.getSosDeviceSetting(params.id)
|
|
|
this.deviceTypeChangeToFrameTypeChange(params.device_type)
|
|
|
this.hasRoleId = params.device_type === DEVICE_TYPE.NURSE_WATCH
|
|
|
this.hasAudioId = params.device_type === DEVICE_TYPE.SIMULATE_BED_DEVICE ||
|
|
|
params.device_type === DEVICE_TYPE.RS485_DOOR ||
|
|
|
params.device_type === DEVICE_TYPE.SIMULATE_EMERGENCY_BUTTON ||
|
|
|
params.device_type === DEVICE_TYPE.SIMULATE_DOOR_LIGHT
|
|
|
+ this.hasSosDeviceSettings = params.device_type === DEVICE_TYPE.ALARM_BODY_INDUCTIVE ||
|
|
|
+ params.device_type === DEVICE_TYPE.DOOR_LOCK
|
|
|
this.deviceModel = {
|
|
|
...params
|
|
|
}
|
|
@@ -688,12 +735,24 @@ export default {
|
|
|
handlerFormSubmit(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
+ const _this = this;
|
|
|
/** 新增 */
|
|
|
if (!this.deviceModel.id) {
|
|
|
this.deviceModel.part_id = this.frame.part_id
|
|
|
this.deviceModel.frame_id = this.frame.id
|
|
|
API_Device.add(this.deviceModel).then(() => {
|
|
|
this.$message.success('保存成功!')
|
|
|
+ _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.hasSosDeviceSettings = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
this.deviceDialogVisible = false
|
|
|
this.getList()
|
|
|
})
|
|
@@ -704,6 +763,25 @@ export default {
|
|
|
this.deviceDialogVisible = false
|
|
|
this.getList()
|
|
|
})
|
|
|
+
|
|
|
+ if (this.hasSosDeviceSettings) {
|
|
|
+ this.sosDeviceSetting.device_id = this.deviceModel.id
|
|
|
+ API_SosDeviceSetting.updateByDeviceId(this.deviceModel.id, this.sosDeviceSetting).then(() => {
|
|
|
+ this.$message.success('保存成功!')
|
|
|
+
|
|
|
+ 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.hasSosDeviceSettings = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ this.hasSosDeviceSettings = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -734,6 +812,11 @@ export default {
|
|
|
this.rs485Options = response
|
|
|
})
|
|
|
},
|
|
|
+ getSosDeviceSetting(deviceId) {
|
|
|
+ API_SosDeviceSetting.getSosDeviceSetting(deviceId).then(r => {
|
|
|
+ this.sosDeviceSetting = r;
|
|
|
+ })
|
|
|
+ },
|
|
|
getShopOptions(part_id) {
|
|
|
shop_API.getShopList(part_id).then(res => {
|
|
|
this.shopOptions = res
|