|
@@ -19,7 +19,7 @@
|
|
|
<div class="toolbar-search">
|
|
|
<en-table-search placeholder="请输入搜索关键字" @search="handlerSearch" />
|
|
|
</div>
|
|
|
- <div v-if="hasAdd" class="toolbar-btns">
|
|
|
+ <div class="toolbar-btns">
|
|
|
<el-button type="primary" size="mini" @click="handleAdd">新增设备</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -193,7 +193,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row v-if="hasSosDeviceSettings">
|
|
|
+ <el-row v-if="sosDeviceSetting.type === 2">
|
|
|
<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" />
|
|
@@ -231,6 +231,32 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+
|
|
|
+ <el-row v-if="groupHostDevices.length > 0">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="护士主机列表">
|
|
|
+ <div class="text item">
|
|
|
+ <el-row>
|
|
|
+ <el-checkbox-group v-model="newCheckList">
|
|
|
+ <el-col v-for="(bed,_index) in groupHostDeviceList" :key="_index" :xs="8" :sm="8" :md="6" :lg="6" :xl="6">
|
|
|
+ <el-checkbox :label="bed.id" @change="handleCheckboxChanged(bed)">
|
|
|
+ <span v-if="bed.group_id && !bed.checked" style="color: #13ce66">{{ bed.name }} <span style="color: #302db4">{{ bed.group_name }}</span></span>
|
|
|
+ <span v-else>{{ bed.name }}</span>
|
|
|
+ </el-checkbox>
|
|
|
+ </el-col>
|
|
|
+ </el-checkbox-group>
|
|
|
+ <el-col v-for="(bed,_index) in groupHostDeviceList" :key="_index" :xs="8" :sm="8" :md="6" :lg="6" :xl="6">
|
|
|
+ <!-- <el-checkbox v-model="bed.checked">-->
|
|
|
+ <!-- <span v-if="bed.group_id && !bed.checked" style="color: #13ce66">{{ bed.clerk_name }} <span style="color: #302db4">{{ bed.group_name }}</span></span>-->
|
|
|
+ <!-- <span v-else>{{ bed.clerk_name }}</span>-->
|
|
|
+ <!-- </el-checkbox>-->
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="handlerFormSubmit('deviceEditForm')">确 定</el-button>
|
|
@@ -253,6 +279,7 @@ 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";
|
|
|
+import * as API_GroupHostManage from "@/api/ncs_group_host_manage";
|
|
|
export default {
|
|
|
name: 'DeviceManager',
|
|
|
components: { ButtonCellRender, ListFilter, RadioFilter },
|
|
@@ -390,7 +417,12 @@ export default {
|
|
|
label: '关爱老人模式'
|
|
|
}
|
|
|
],
|
|
|
- isLedDevice: false
|
|
|
+ isLedDevice: false,
|
|
|
+ newCheckList: [],
|
|
|
+ newPartIds: [],
|
|
|
+ oldCheckList: [],
|
|
|
+ groupHostDevices: [],
|
|
|
+ groupHostDeviceList: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -543,9 +575,15 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
/** 将partFrames做分割 */
|
|
|
- getFramesByType(device_type) {
|
|
|
+ getFramesByType(frame_type) {
|
|
|
+ let list = [];
|
|
|
if (this.partFrames != null) {
|
|
|
- this.typeFrames = this.partFrames.filter(item => item.type === device_type)
|
|
|
+ if (frame_type === FRAME_TYPE.HOSPITAL) {
|
|
|
+ list = this.partFrames.filter(item => item.type === frame_type)
|
|
|
+ this.typeFrames = list.concat(this.typeFrames.filter(item => item.type === FRAME_TYPE.PART))
|
|
|
+ } else {
|
|
|
+ this.typeFrames = this.partFrames.filter(item => item.type === frame_type)
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
@@ -689,8 +727,9 @@ export default {
|
|
|
},
|
|
|
/** 设备类型选中对应的空间结构 **/
|
|
|
deviceTypeChangeToFrameTypeChange(val) {
|
|
|
- if (val === DEVICE_TYPE.NURSE_HOST ||
|
|
|
- val === DEVICE_TYPE.DOCTOR_HOST ||
|
|
|
+ if (val === DEVICE_TYPE.NURSE_HOST) {
|
|
|
+ this.getFramesByType(FRAME_TYPE.HOSPITAL)
|
|
|
+ } else if (val === DEVICE_TYPE.DOCTOR_HOST ||
|
|
|
val === DEVICE_TYPE.LED_SCREEN ||
|
|
|
val === DEVICE_TYPE.LCD_SCREEN ||
|
|
|
val === DEVICE_TYPE.NURSE_WATCH ||
|
|
@@ -720,6 +759,7 @@ export default {
|
|
|
},
|
|
|
/** 添加设备事件 **/
|
|
|
handleAdd() {
|
|
|
+ this.groupHostDevices = []
|
|
|
this.deviceModel = {
|
|
|
soft_ver: 'SV1.0',
|
|
|
hard_ver: 'HV1.0',
|
|
@@ -752,7 +792,8 @@ export default {
|
|
|
},
|
|
|
/** 修改设备 **/
|
|
|
handleEdit(params) {
|
|
|
- this.getRoles({ page_size: 200, page_no: 1, fixedCondition: ' shop_id = -1', sort: ' role_id', dir: 'desc' })
|
|
|
+ this.groupHostDevices = []
|
|
|
+ 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)
|
|
@@ -768,6 +809,9 @@ export default {
|
|
|
this.deviceModel = {
|
|
|
...params
|
|
|
}
|
|
|
+ if (params.device_type === DEVICE_TYPE.NURSE_HOST && params.part_id == this.$store.getters.partId) {
|
|
|
+ this.getGroupHost(params.id, params.part_id)
|
|
|
+ }
|
|
|
this.deviceEditTitle = '修改设备'
|
|
|
this.deviceDialogVisible = true
|
|
|
this.deviceTypeDisabled = true // 修改设备时,不能改变设备类型
|
|
@@ -777,9 +821,10 @@ export default {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
const _this = this;
|
|
|
+ this.deviceModel.part_id = this.getPartId(this.deviceModel.frame_id)
|
|
|
/** 新增 */
|
|
|
if (!this.deviceModel.id) {
|
|
|
- API_Device.add(this.deviceModel).then(() => {
|
|
|
+ API_Device.add(this.deviceModel).then(r => {
|
|
|
this.$message.success('保存成功!')
|
|
|
_this.device = r
|
|
|
this.sosDeviceSetting.device_id = _this.device.id
|
|
@@ -803,6 +848,23 @@ export default {
|
|
|
this.getList()
|
|
|
})
|
|
|
|
|
|
+ if (this.deviceModel.device_type === DEVICE_TYPE.NURSE_HOST && this.deviceModel.part_id === this.$store.getters.partId) {
|
|
|
+ const addIds = this.newCheckList.filter(function(val) { return _this.oldCheckList.indexOf(val) === -1 })
|
|
|
+ console.log('addIds=', addIds)
|
|
|
+ this.getPartIds(addIds)
|
|
|
+ console.log('partIds=', this.newPartIds)
|
|
|
+ const delIds = this.oldCheckList.filter(function(val) { return _this.newCheckList.indexOf(val) === -1 })
|
|
|
+ console.log('delIds=', delIds)
|
|
|
+ const data = {
|
|
|
+ deviceId: this.deviceModel.id,
|
|
|
+ addIds: addIds.join(','),
|
|
|
+ partIds: this.newPartIds.join(','),
|
|
|
+ delIds: delIds.join(',')
|
|
|
+ }
|
|
|
+ console.log('data==', data)
|
|
|
+ API_GroupHostManage.updateParentById(data)
|
|
|
+ }
|
|
|
+
|
|
|
if (this.hasSosDeviceSettings) {
|
|
|
this.sosDeviceSetting.device_id = this.deviceModel.id
|
|
|
API_SosDeviceSetting.updateByDeviceId(this.deviceModel.id, this.sosDeviceSetting).then(() => {
|
|
@@ -821,10 +883,46 @@ export default {
|
|
|
this.getList()
|
|
|
})
|
|
|
}
|
|
|
+ this.deviceDialogVisible = false
|
|
|
+ this.getList()
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ getGroupHost(id, hospitalId) {
|
|
|
+ const _this = this
|
|
|
+ this.newCheckList = []
|
|
|
+ this.newPartIds = []
|
|
|
+ this.oldCheckList = []
|
|
|
+
|
|
|
+ API_Device.getManageHostDeviceByHospitalId(hospitalId).then(r => {
|
|
|
+ _this.groupHostDevices = r
|
|
|
+ _this.getGroupHostDeviceList(id, hospitalId)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getGroupHostDeviceList(id, hospitalId) {
|
|
|
+
|
|
|
+ const _this = this
|
|
|
+ API_GroupHostManage.getGroupHostByHospitalId(hospitalId).then(r => {
|
|
|
+ r.forEach(item => {
|
|
|
+ _this.groupHostDevices.forEach(t => {
|
|
|
+ if (t.id === item.manage_host_device_id) {
|
|
|
+ t.group_name = item.host_device_name
|
|
|
+ t.group_id = item.host_device_id
|
|
|
+ if (item.host_device_id === id) {
|
|
|
+ t.checked = true
|
|
|
+ _this.oldCheckList.push(item.manage_host_device_id)
|
|
|
+ _this.newCheckList.push(item.manage_host_device_id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ _this.groupHostDeviceList = _this.groupHostDevices
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleCheckboxChanged(item) {
|
|
|
+ item.checked = !item.checked
|
|
|
+ },
|
|
|
/** 分页大小发生改变 */
|
|
|
handlePageSizeChange(size) {
|
|
|
this.params.page_size = size
|
|
@@ -860,6 +958,24 @@ export default {
|
|
|
shop_API.getShopList(part_id).then(res => {
|
|
|
this.shopOptions = res
|
|
|
})
|
|
|
+ },
|
|
|
+ getPartId(frame_id) {
|
|
|
+ let frame= {}
|
|
|
+ frame = this.partFrames.filter(p => p.id === frame_id)[0]
|
|
|
+ if (frame.part_id != null) {
|
|
|
+ return frame.part_id
|
|
|
+ } else {
|
|
|
+ return this.$store.getters.partId
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getPartIds(addIds) {
|
|
|
+ const partIds = []
|
|
|
+ let device = {}
|
|
|
+ for (let i = 0; i < addIds.length; i++) {
|
|
|
+ device = this.groupHostDevices.filter(p => p.id === addIds[i])[0]
|
|
|
+ partIds.push(device.part_id)
|
|
|
+ }
|
|
|
+ this.newPartIds = partIds
|
|
|
}
|
|
|
}
|
|
|
}
|