设备调整

This commit is contained in:
Flow 2025-07-28 16:44:45 +08:00
parent b6eee4f0a8
commit 8ccb82843b
4 changed files with 100 additions and 39 deletions

View File

@ -193,6 +193,7 @@ import PatientSelect from '@/patientcom/index.vue'
import { abpmApi, abpmVO } from '@/api/abpm'
import { getUserProfile } from '@/api/system/user/profile'
import { OrgApi } from '@/api/org'
import { DeviceApi } from '@/api/system/device'
import { AbpmdataApi } from '@/api/abpmdata'
import dayjs from 'dayjs'
@ -222,15 +223,20 @@ const tableData = ref<abpmVO[]>([])
//
const deviceList = ref<any[]>([])
//
const fetchDeviceList = () => {
setTimeout(() => {
deviceList.value = [
{ label: '动态血压-1001', value: '1001' },
{ label: '动态血压-1002', value: '1002' },
{ label: '动态血压-1003', value: '1003' }
]
}, 500)
//
const fetchDeviceList = async () => {
try {
//
const userinfo = await getUserProfile()
//
const data = await DeviceApi.getDeviceByType('dtxya', userinfo.orgid.toString())
deviceList.value = data.map((item: any) => ({
label: item.devicename,
value: item.deviceid
}))
} catch (error) {
console.error('获取设备列表失败:', error)
}
}
onMounted(() => {
@ -334,17 +340,25 @@ const handlePatientCancel = () => {
const editDevice = (row: any, index: number) => {
//
row.originalDevice = row.device
row.originalDeviceName = row.devicename
row.editingDevice = true
}
const saveDevice = async (row: any, index: number) => {
try {
// ID
const selectedDevice = deviceList.value.find((device) => device.value === row.device)
if (selectedDevice) {
row.devicename = selectedDevice.label
}
// API
const updateData = { ...row }
await abpmApi.updateabpm(updateData)
row.editingDevice = false
delete row.originalDevice
delete row.originalDeviceName
ElMessage.success(`已更新设备为:${getDeviceLabel(row.device)}`)
} catch (error) {
console.error('更新设备失败:', error)
@ -353,6 +367,9 @@ const saveDevice = async (row: any, index: number) => {
if (row.originalDevice !== undefined) {
row.device = row.originalDevice
}
if (row.originalDeviceName !== undefined) {
row.devicename = row.originalDeviceName
}
}
}
@ -361,8 +378,12 @@ const cancelEditDevice = (row: any, index: number) => {
if (row.originalDevice !== undefined) {
row.device = row.originalDevice
}
if (row.originalDeviceName !== undefined) {
row.devicename = row.originalDeviceName
}
row.editingDevice = false
delete row.originalDevice
delete row.originalDeviceName
}
//

View File

@ -192,6 +192,7 @@ import { ElMessage } from 'element-plus'
import PatientSelect from '@/patientcom/index.vue'
import { getUserProfile } from '@/api/system/user/profile'
import { OrgApi } from '@/api/org'
import { DeviceApi } from '@/api/system/device'
import { arterialApi } from '@/api/arterial'
import { arterialdataApi } from '@/api/arterialdata'
import { Search, Refresh, Plus, Edit, Check, Close } from '@element-plus/icons-vue'
@ -221,14 +222,24 @@ const tableData = ref<any[]>([])
const patientSelectRef = ref()
const arterAnalysisRef = ref()
//
//
const deviceList = ref<any[]>([])
const getDeviceList = () => {
deviceList.value = [
{ id: '1001', deviceName: '动脉硬化检测仪-1001' },
{ id: '1002', deviceName: '动脉硬化检测仪-1002' },
{ id: '1003', deviceName: '动脉硬化检测仪-1003' }
]
//
const getDeviceList = async () => {
try {
//
const userinfo = await getUserProfile()
//
const orgid = userinfo.orgid
const data = await DeviceApi.getDeviceByType('dmyh', orgid)
deviceList.value = data.map((item: any) => ({
id: item.deviceid,
deviceName: item.devicename
}))
} catch (error) {
console.error('获取设备列表失败:', error)
}
}
onMounted(() => {
@ -400,7 +411,8 @@ const cancelEditWearTime = (row: any, index: number) => {
//
const editDevice = (row: any, index: number) => {
row.editingDevice = true
row.originalDeviceId = row.deviceid //
row.originalDeviceId = row.deviceid // ID
row.originalDeviceName = row.devicename //
}
//
const saveDevice = async (row: any, index: number) => {
@ -409,6 +421,11 @@ const saveDevice = async (row: any, index: number) => {
return
}
try {
// ID
const selectedDevice = deviceList.value.find((device) => device.id === row.deviceid)
if (selectedDevice) {
row.devicename = selectedDevice.deviceName
}
await arterialApi.updatearterial(row)
ElMessage.success('设备更新成功')
row.editingDevice = false
@ -422,6 +439,7 @@ const saveDevice = async (row: any, index: number) => {
//
const cancelEditDevice = (row: any, index: number) => {
row.deviceid = row.originalDeviceId
row.devicename = row.originalDeviceName
row.editingDevice = false
}
</script>

View File

@ -194,6 +194,7 @@ import ECGWorkstation from './ECG_workstation.vue'
import { StaticecgApi, StaticecgVO } from '@/api/staticecg'
import { getUserProfile } from '@/api/system/user/profile'
import { OrgApi } from '@/api/org'
import { DeviceApi } from '@/api/system/device'
import { Search, Refresh, Plus, Edit, Check, Close } from '@element-plus/icons-vue'
import dayjs from 'dayjs'
import { StaticdataApi } from '@/api/staticdata'
@ -272,21 +273,17 @@ const getList = async () => {
//
const getDeviceList = async () => {
try {
// 使
const testData = [
{ id: '1001', deviceName: '心电设备-1001' },
{ id: '1002', deviceName: '心电设备-1002' },
{ id: '1003', deviceName: '心电设备-1003' }
]
deviceList.value = testData
//
const userinfo = await getUserProfile()
//
const orgid = userinfo.orgid
const data = await DeviceApi.getDeviceByType('jtxd', orgid)
deviceList.value = data.map((item: any) => ({
id: item.deviceid,
deviceName: item.devicename
}))
} catch (error) {
console.error('获取设备列表失败:', error)
deviceList.value = [
{ id: '1001', deviceName: '心电设备-1001' },
{ id: '1002', deviceName: '心电设备-1002' },
{ id: '1003', deviceName: '心电设备-1003' }
]
ElMessage.error('获取设备列表失败,已加载测试数据')
}
}
@ -408,7 +405,8 @@ const cancelEditMeasureTime = (row: any, index: number) => {
//
const editDevice = (row: any, index: number) => {
row.editingDevice = true
row.originalDeviceId = row.deviceid //
row.originalDeviceId = row.deviceid // ID
row.originalDeviceName = row.devicename //
}
//
@ -418,6 +416,11 @@ const saveDevice = async (row: any, index: number) => {
return
}
try {
// ID
const selectedDevice = deviceList.value.find((device) => device.id === row.deviceid)
if (selectedDevice) {
row.devicename = selectedDevice.deviceName
}
await StaticecgApi.updateStaticecg(row)
ElMessage.success('设备更新成功')
row.editingDevice = false
@ -432,6 +435,7 @@ const saveDevice = async (row: any, index: number) => {
//
const cancelEditDevice = (row: any, index: number) => {
row.deviceid = row.originalDeviceId
row.devicename = row.originalDeviceName
row.editingDevice = false
}
</script>

View File

@ -192,6 +192,7 @@ import { ElMessage } from 'element-plus'
import PatientSelect from '@/patientcom/index.vue'
import { getUserProfile } from '@/api/system/user/profile'
import { OrgApi } from '@/api/org'
import { DeviceApi } from '@/api/system/device'
import { PftApi } from '@/api/pft'
import { PftdataApi } from '@/api/pftdata'
import { Search, Refresh, Plus, Edit, Check, Close } from '@element-plus/icons-vue'
@ -221,14 +222,24 @@ const tableData = ref<any[]>([])
const patientSelectRef = ref()
const pftAnalysisRef = ref()
//
//
const deviceList = ref<any[]>([])
const getDeviceList = () => {
deviceList.value = [
{ id: '1001', deviceName: '肺功能检测仪-1001' },
{ id: '1002', deviceName: '肺功能检测仪-1002' },
{ id: '1003', deviceName: '肺功能检测仪-1003' }
]
//
const getDeviceList = async () => {
try {
//
const userinfo = await getUserProfile()
//
const orgid = userinfo.orgid
const data = await DeviceApi.getDeviceByType('fgn', orgid)
deviceList.value = data.map((item: any) => ({
id: item.deviceid,
deviceName: item.devicename
}))
} catch (error) {
console.error('获取设备列表失败:', error)
}
}
onMounted(() => {
@ -400,7 +411,8 @@ const cancelEditWearTime = (row: any, index: number) => {
//
const editDevice = (row: any, index: number) => {
row.editingDevice = true
row.originalDeviceId = row.deviceid //
row.originalDeviceId = row.deviceid // ID
row.originalDeviceName = row.devicename //
}
//
const saveDevice = async (row: any, index: number) => {
@ -409,6 +421,11 @@ const saveDevice = async (row: any, index: number) => {
return
}
try {
// ID
const selectedDevice = deviceList.value.find((device) => device.id === row.deviceid)
if (selectedDevice) {
row.devicename = selectedDevice.deviceName
}
await PftApi.updatePft(row)
ElMessage.success('设备更新成功')
row.editingDevice = false
@ -422,6 +439,7 @@ const saveDevice = async (row: any, index: number) => {
//
const cancelEditDevice = (row: any, index: number) => {
row.deviceid = row.originalDeviceId
row.devicename = row.originalDeviceName
row.editingDevice = false
}
</script>