|
@@ -112,8 +112,20 @@
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
import { ref, computed, onMounted, onUnmounted, nextTick, h, defineAsyncComponent } from 'vue'
|
|
import { ref, computed, onMounted, onUnmounted, nextTick, h, defineAsyncComponent } from 'vue'
|
|
|
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
|
|
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
|
|
|
-import fetchHttp from '@/config/axios/fetchHttp'
|
|
|
|
|
-import { getAccessToken, getLoginForm } from '@/utils/auth'
|
|
|
|
|
|
|
+import { getLoginForm } from '@/utils/auth'
|
|
|
|
|
+import {
|
|
|
|
|
+ deviceScreenBindDevice,
|
|
|
|
|
+ deviceScreenUnbindDevice,
|
|
|
|
|
+ deviceScreenAddElder,
|
|
|
|
|
+ deviceScreenProcessAlert,
|
|
|
|
|
+ deviceScreenGetStatistics,
|
|
|
|
|
+ deviceScreenGetElderList,
|
|
|
|
|
+ deviceScreenGetDeviceDetail,
|
|
|
|
|
+ deviceScreenGetElderHealthAndDeviceInfo,
|
|
|
|
|
+ deviceScreenGetAllWarning,
|
|
|
|
|
+ deviceScreenGetAllDeviceTypes,
|
|
|
|
|
+ deviceScreenGetOrganizationDevices
|
|
|
|
|
+} from '@/api/living-home/home-device'
|
|
|
import { useWebSocket } from './composables/useWebSocket'
|
|
import { useWebSocket } from './composables/useWebSocket'
|
|
|
import { amapReverseGeocode } from '@/utils/amapService'
|
|
import { amapReverseGeocode } from '@/utils/amapService'
|
|
|
|
|
|
|
@@ -375,11 +387,7 @@ const openAddDeviceFromList = (elderly: Elderly) => {
|
|
|
|
|
|
|
|
const addDevice = async (data: any) => {
|
|
const addDevice = async (data: any) => {
|
|
|
try {
|
|
try {
|
|
|
- const res = await fetchHttp.post('/api/pc/admin/bindDevice', data, {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const res = await deviceScreenBindDevice(data)
|
|
|
if (res) {
|
|
if (res) {
|
|
|
ElMessage.success('设备添加成功!')
|
|
ElMessage.success('设备添加成功!')
|
|
|
getElderDeviceMessage(selectedElderly.value.id)
|
|
getElderDeviceMessage(selectedElderly.value.id)
|
|
@@ -401,18 +409,10 @@ const removeDevice = (elderly: any, device: DetailDevice) => {
|
|
|
type: 'warning'
|
|
type: 'warning'
|
|
|
})
|
|
})
|
|
|
.then(async () => {
|
|
.then(async () => {
|
|
|
- const res = await fetchHttp.post(
|
|
|
|
|
- '/api/pc/admin/unbindDevice',
|
|
|
|
|
- {
|
|
|
|
|
- deviceCode: device.deviceCode,
|
|
|
|
|
- elderId: Number(elderly.id)
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const res = await deviceScreenUnbindDevice({
|
|
|
|
|
+ deviceCode: device.deviceCode,
|
|
|
|
|
+ elderId: Number(elderly.id)
|
|
|
|
|
+ })
|
|
|
if (res) {
|
|
if (res) {
|
|
|
ElMessage.success('设备删除成功!')
|
|
ElMessage.success('设备删除成功!')
|
|
|
getElderDeviceMessage(selectedElderly.value.id)
|
|
getElderDeviceMessage(selectedElderly.value.id)
|
|
@@ -439,11 +439,7 @@ const openElderWarningServiceDialog = (elderly: any) => {
|
|
|
|
|
|
|
|
const submitAddElder = async (data: any) => {
|
|
const submitAddElder = async (data: any) => {
|
|
|
try {
|
|
try {
|
|
|
- const res = await fetchHttp.post('/api/pc/admin/addElder', data, {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const res = await deviceScreenAddElder(data)
|
|
|
if (res) {
|
|
if (res) {
|
|
|
ElMessage.success('长者添加成功!')
|
|
ElMessage.success('长者添加成功!')
|
|
|
await getElderList()
|
|
await getElderList()
|
|
@@ -469,11 +465,7 @@ const submitHandleWarning = async (data: any) => {
|
|
|
remarks: data.message || ''
|
|
remarks: data.message || ''
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
|
- const res = await fetchHttp.post('/api/pc/admin/processAlert', params, {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const res = await deviceScreenProcessAlert(params)
|
|
|
if (res) {
|
|
if (res) {
|
|
|
ElMessage.success(data.handleType === 'report' ? '告警情况已上报!' : '电话回访已确认!')
|
|
ElMessage.success(data.handleType === 'report' ? '告警情况已上报!' : '电话回访已确认!')
|
|
|
clearWarningFlag(data.elderId)
|
|
clearWarningFlag(data.elderId)
|
|
@@ -561,15 +553,7 @@ const onHandleWarningFromDrawer = (record: WarningHistory) => {
|
|
|
|
|
|
|
|
// API 调用
|
|
// API 调用
|
|
|
const getStatistics = async () => {
|
|
const getStatistics = async () => {
|
|
|
- const res = await fetchHttp.get(
|
|
|
|
|
- '/api/pc/admin/getStatistics?organizationId=' + organizationId,
|
|
|
|
|
- {},
|
|
|
|
|
- {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const res = await deviceScreenGetStatistics({ organizationId })
|
|
|
if (res.list && res.list.length) {
|
|
if (res.list && res.list.length) {
|
|
|
res.list.forEach((v: any) => {
|
|
res.list.forEach((v: any) => {
|
|
|
const index = largeScreenStats.value.findIndex((z) => z.indicator == v.indicator)
|
|
const index = largeScreenStats.value.findIndex((z) => z.indicator == v.indicator)
|
|
@@ -583,15 +567,7 @@ const getStatistics = async () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const getElderList = async () => {
|
|
const getElderList = async () => {
|
|
|
- const res = await fetchHttp.get(
|
|
|
|
|
- '/api/pc/admin/getElderList?organizationId=' + organizationId,
|
|
|
|
|
- {},
|
|
|
|
|
- {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const res = await deviceScreenGetElderList({ organizationId })
|
|
|
if (res?.length) {
|
|
if (res?.length) {
|
|
|
elderlyList.value = res
|
|
elderlyList.value = res
|
|
|
if (elderlyList.value.length) {
|
|
if (elderlyList.value.length) {
|
|
@@ -604,30 +580,14 @@ const getElderList = async () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const getDeviceDetail = async (deviceCode: string) => {
|
|
const getDeviceDetail = async (deviceCode: string) => {
|
|
|
- const res = await fetchHttp.get(
|
|
|
|
|
- '/api/pc/admin/getDeviceDetail?deviceCode=' + deviceCode,
|
|
|
|
|
- {},
|
|
|
|
|
- {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const res = await deviceScreenGetDeviceDetail({ deviceCode })
|
|
|
if (res) {
|
|
if (res) {
|
|
|
deviceDetail.value = res
|
|
deviceDetail.value = res
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const getElderDeviceMessage = async (elderId: number) => {
|
|
const getElderDeviceMessage = async (elderId: number) => {
|
|
|
- const res = await fetchHttp.get(
|
|
|
|
|
- '/api/pc/admin/getElderHealthAndDeviceInfo?elderId=' + elderId,
|
|
|
|
|
- {},
|
|
|
|
|
- {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const res = await deviceScreenGetElderHealthAndDeviceInfo({ elderId })
|
|
|
if (res) {
|
|
if (res) {
|
|
|
selectedElderly.value.healthList = res.healthList
|
|
selectedElderly.value.healthList = res.healthList
|
|
|
selectedElderly.value.deviceList = res.deviceList
|
|
selectedElderly.value.deviceList = res.deviceList
|
|
@@ -639,11 +599,7 @@ const getAllWarning = async () => {
|
|
|
pageNum: pageNum.value,
|
|
pageNum: pageNum.value,
|
|
|
pageSize: pageSize.value
|
|
pageSize: pageSize.value
|
|
|
}
|
|
}
|
|
|
- const res = await fetchHttp.get('/api/pc/admin/getAllWarning', params, {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const res = await deviceScreenGetAllWarning(params)
|
|
|
if (res) {
|
|
if (res) {
|
|
|
total.value = res.total
|
|
total.value = res.total
|
|
|
warningData.value = res.list || []
|
|
warningData.value = res.list || []
|
|
@@ -651,15 +607,7 @@ const getAllWarning = async () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const getAllDevices = async () => {
|
|
const getAllDevices = async () => {
|
|
|
- const res = await fetchHttp.get(
|
|
|
|
|
- '/api/pc/admin/getAllDeviceTypes',
|
|
|
|
|
- {},
|
|
|
|
|
- {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const res = await deviceScreenGetAllDeviceTypes()
|
|
|
if (res && res?.length) {
|
|
if (res && res?.length) {
|
|
|
deviceTypeOptions.value = res
|
|
deviceTypeOptions.value = res
|
|
|
}
|
|
}
|
|
@@ -682,15 +630,7 @@ const handelDeviceRefresh = async () => {
|
|
|
// 全部设备视图相关方法
|
|
// 全部设备视图相关方法
|
|
|
const refreshAllDevices = async () => {
|
|
const refreshAllDevices = async () => {
|
|
|
try {
|
|
try {
|
|
|
- const res = await fetchHttp.get(
|
|
|
|
|
- '/api/pc/admin/getOrganizationDevices',
|
|
|
|
|
- {},
|
|
|
|
|
- {
|
|
|
|
|
- headers: {
|
|
|
|
|
- Authorization: `Bearer ${getAccessToken()}`
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const res = await deviceScreenGetOrganizationDevices()
|
|
|
console.log('res', res)
|
|
console.log('res', res)
|
|
|
if (res?.deviceList && Array.isArray(res.deviceList)) {
|
|
if (res?.deviceList && Array.isArray(res.deviceList)) {
|
|
|
allDevices.value = res.deviceList
|
|
allDevices.value = res.deviceList
|