diff --git a/src/api/deviceuser/index.ts b/src/api/deviceuser/index.ts
index 64c9faa5f..d16263dab 100644
--- a/src/api/deviceuser/index.ts
+++ b/src/api/deviceuser/index.ts
@@ -11,6 +11,7 @@ export interface DeviceuserVO {
updateby: string // 更新人
username: string // 用户姓名
devicetype: string // 设备类型
+ familyid: number // 家庭组号
}
// 设备人员关联 API
diff --git a/src/views/devices/Device_Data_Components/ECG_datas.vue b/src/views/devices/Device_Data_Components/ECG_datas.vue
index 07473a6c3..a1fa1f269 100644
--- a/src/views/devices/Device_Data_Components/ECG_datas.vue
+++ b/src/views/devices/Device_Data_Components/ECG_datas.vue
@@ -122,6 +122,25 @@
+
+
+
+
+ 发送
+ 通知
+
+
@@ -146,6 +165,7 @@ export default {
currentDeviceName: '',
selectedPersonData: null, // 新增:存储选中人员的心电数据
activeTab: 'basic', // 新增:当前激活的标签页
+ doctorMessage: '', // 新增:医生通知内容
basicFields: [
{ key: 'heartrate', label: '心率(次/分)' },
{ key: 'rhythm', label: '心律类型' },
@@ -208,6 +228,7 @@ export default {
this.activeTime = ''
this.timeList = []
this.dateFilter = null // 重置日期筛选
+ this.doctorMessage = '' // 重置医生通知内容
// 打开对话框并设置设备信息
this.dialogVisible = true
@@ -267,6 +288,26 @@ export default {
this.selectedPersonData = null
this.hasData = false
},
+ // 新增:发送医生通知方法
+ async sendDoctorNotification() {
+ if (!this.doctorMessage.trim()) {
+ this.$message.warning('请输入通知内容')
+ return
+ }
+ try {
+ // TODO: 这里需要调用后端API发送通知
+ // await NotificationApi.sendDoctorNotification({
+ // userId: this.selectedPerson.userid,
+ // message: this.doctorMessage,
+ // deviceId: this.currentDeviceId
+ // })
+ this.$message.success('通知发送成功')
+ this.doctorMessage = '' // 清空输入框
+ } catch (error) {
+ console.error('发送通知失败:', error)
+ this.$message.error('发送通知失败')
+ }
+ },
}
}
@@ -330,10 +371,13 @@ export default {
.data-display {
flex: 1;
+ position: relative;
}
.box-card {
height: 100%;
+ display: flex;
+ flex-direction: column;
}
.card-header {
@@ -355,6 +399,9 @@ export default {
.ecg-data-content {
min-height: 200px;
+ flex: 1;
+ overflow-y: auto;
+ padding-bottom: 120px;
}
.el-scrollbar {
@@ -377,7 +424,7 @@ export default {
border-radius: 8px;
padding: 12px;
transition: all 0.3s ease;
- min-width: 0; /* 防止内容溢出 */
+ min-width: 0;
}
.ecg-grid-item:hover {
@@ -446,4 +493,35 @@ export default {
color: #909399;
font-size: 14px;
}
+
+.doctor-notification {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ padding: 20px;
+ background-color: #fff;
+ display: flex;
+ gap: 15px;
+ align-items: flex-start;
+ z-index: 1;
+ margin-top: 20px;
+}
+
+.doctor-notification :deep(.el-textarea__inner) {
+ flex: 1;
+ height: 80px !important;
+}
+
+.doctor-send-btn {
+ height: 80px !important;
+ min-width: 60px;
+ white-space: pre-line;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 16px;
+ line-height: 1.1;
+ padding: 0 16px;
+}
diff --git a/src/views/person/devicebind.vue b/src/views/person/devicebind.vue
index 0de490e81..8ff47e04b 100644
--- a/src/views/person/devicebind.vue
+++ b/src/views/person/devicebind.vue
@@ -55,13 +55,14 @@
([])
const boundList = ref([])
const personId = ref()
const personName = ref()
+const familyId = ref()
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
orgid: undefined,
+ devicecode: undefined as string | undefined,
+ devicetype: undefined as string | undefined
})
const queryFormRef = ref()
@@ -278,7 +283,8 @@ const getBoundList = async () => {
const deviceInfo = await DeviceApi.getDeviceId(item.deviceid)
return {
...deviceInfo,
- devicecode: item.deviceid // 确保devicecode字段存在
+ devicecode: item.deviceid, // 确保devicecode字段存在
+ familyid: item.familyid // 添加familyid字段
}
})
boundList.value = await Promise.all(devicePromises)
@@ -338,19 +344,43 @@ const getDeviceStatusType = (status: number) => {
}
/** 绑定设备 */
-const handleBind = async (row: DeviceVO) => {
+const handleBind = async (row: DeviceVO & { familyid?: number }) => {
try {
if (!personId.value) {
message.error('人员ID不能为空')
return
}
- // 检查是否已经绑定
- const bindData = await DeviceuserApi.getDeviceuserByDeviceId(row.id)
- if (bindData && bindData.some((item: DeviceuserVO) => item.userid === personId.value)) {
- message.error('该设备已经绑定过此用户')
+
+ // 检查家庭组号匹配情况
+ if (familyId.value && row.familyid && familyId.value !== row.familyid) {
+ message.error('该设备属于其他家庭组,无法绑定')
return
}
+ // 检查主页面传递的家庭组号为空,但设备有家庭组号的情况
+ if (!familyId.value && row.familyid) {
+ message.error('当前人员未分配家庭组,无法绑定已有家庭组的设备')
+ return
+ }
+
+ // 检查设备是否已被绑定
+ const bindData = await DeviceuserApi.getDeviceuserByDeviceId(row.devicecode)
+ if (bindData && bindData.length > 0) {
+ // 检查是否已经被当前用户绑定
+ const isBoundByCurrentUser = bindData.some(item => item.userid === personId.value)
+ if (isBoundByCurrentUser) {
+ message.error('该设备已经绑定过此用户')
+ return
+ }
+
+ // 检查是否被同一家庭组的其他用户绑定
+ const isBoundBySameFamily = bindData.some(item => item.familyid === familyId.value)
+ if (!isBoundBySameFamily) {
+ message.error('该设备已被其他家庭组的用户绑定')
+ return
+ }
+ }
+
const datetime = dayjs().format('YYYY-MM-DD HH:mm:ss')
const data: DeviceuserVO = {
id: 0, // 新增时后端会自动生成
@@ -358,6 +388,7 @@ const handleBind = async (row: DeviceVO) => {
devicetype: row.devicetype,
userid: personId.value,
username: personName.value || '',
+ familyid: familyId.value || 0,
createtime: datetime,
updatetime: datetime,
createby: userProfile.value.nickname,
@@ -398,9 +429,10 @@ const handleUnbind = async (row: DeviceVO) => {
}
/** 打开弹窗 */
-const open = (id: number, name: string) => {
+const open = (id: number, name: string, familyid: string) => {
personId.value = id
personName.value = name
+ familyId.value = parseInt(familyid)
dialogVisible.value = true
getList()
getBoundList()
diff --git a/src/views/person/index.vue b/src/views/person/index.vue
index a8e69c85c..922541725 100644
--- a/src/views/person/index.vue
+++ b/src/views/person/index.vue
@@ -224,7 +224,8 @@ const memberRef = ref()
const deviceBindRef = ref()
const openForm = (type: string, id?: number, name?: string) => {
if (type === 'bind') {
- deviceBindRef.value?.open(id, name)
+ const row = list.value.find(item => item.id === id)
+ deviceBindRef.value?.open(id, name, row?.familyid)
} else {
formRef.value?.open(type, id,userProfile.value)
}