设备调整
This commit is contained in:
parent
b6eee4f0a8
commit
8ccb82843b
@ -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
|
||||
}
|
||||
|
||||
// 佩戴时间编辑相关方法
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user