This commit is contained in:
lxd 2025-06-16 17:18:31 +08:00
commit d677d215ad
4 changed files with 124 additions and 12 deletions

View File

@ -11,6 +11,7 @@ export interface DeviceuserVO {
updateby: string // 更新人
username: string // 用户姓名
devicetype: string // 设备类型
familyid: number // 家庭组号
}
// 设备人员关联 API

View File

@ -122,6 +122,25 @@
</div>
</div>
</div>
<!-- 添加医生通知输入框和发送按钮 -->
<div class="doctor-notification">
<el-input
v-model="doctorMessage"
type="textarea"
:rows="3"
placeholder="请输入医生通知内容"
resize="none"
/>
<el-button
type="primary"
@click="sendDoctorNotification"
:disabled="!doctorMessage.trim()"
class="doctor-send-btn"
>
<span>发送</span>
<span>通知</span>
</el-button>
</div>
</el-card>
</div>
</div>
@ -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('发送通知失败')
}
},
}
}
</script>
@ -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;
}
</style>

View File

@ -55,13 +55,14 @@
<el-table
v-loading="boundLoading"
:data="boundList"
style="height: 100%"
style="height: 400px"
max-height="400px"
>
<el-table-column
label="设备名称"
align="center"
prop="devicename"
width="100"
width="110"
/>
<el-table-column
label="设备编号"
@ -148,7 +149,8 @@
<el-table
v-loading="loading"
:data="list"
style="height: 100%"
style="height: 400px"
max-height="400px"
>
<el-table-column
label="设备名称"
@ -229,11 +231,14 @@ const list = ref<DeviceVO[]>([])
const boundList = ref<DeviceVO[]>([])
const personId = ref<number>()
const personName = ref<string>()
const familyId = ref<number>()
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()

View File

@ -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)
}