2025年04月15日15:01:39

This commit is contained in:
luojiayi 2025-04-15 15:01:40 +08:00
parent 69da74f447
commit 628e7abd80
9 changed files with 106 additions and 77 deletions

1
components.d.ts vendored
View File

@ -26,6 +26,7 @@ declare module '@vue/runtime-core' {
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']

11
src/api/index.d.ts vendored
View File

@ -26,13 +26,9 @@ export interface TbindWeb {
devices: number[]
accountId: number
}
export interface TStatisticsDevice {
addCount: number
deviceTotal: number
onlineCount: number
warnCount: number
export interface TAccountSetStatus {
accountId: number
status: number
}
export interface TStatisticsCount {
@ -155,6 +151,7 @@ export namespace TAccount {
id: number
orgId: number
roleId: number
status: number
flag: boolean
name: string
username: string

View File

@ -1,11 +1,18 @@
import request from '../utils/request';
import { TLogin, TAccount, IpagingRes, TDevice, TOrg, TRoleList, TStatisticsDevice, statisticsContentReq, statisticsContentRes, TStatisticsCount, TWarnRecord, TWarningDetail, TWarningConfirm, TDeviceConfigModify, TDeviceConfig, THealthLatestData, TLocateRecord, TSetUseStatus, TRoleMenuList, TRoleModify, TbindWeb, TstatisticsUseCount } from "./index.d";
import { TLogin, TAccount, IpagingRes, TDevice, TOrg, TRoleList, statisticsContentReq, statisticsContentRes, TStatisticsCount, TWarnRecord, TWarningDetail, TWarningConfirm, TDeviceConfigModify, TDeviceConfig, THealthLatestData, TLocateRecord, TSetUseStatus, TRoleMenuList, TRoleModify, TbindWeb, TstatisticsUseCount, TAccountSetStatus } from "./index.d";
export const fetchLogin = (p: TLogin.Ireq): Promise<TLogin.IRes> => {
return request({
url: '/v1/api/login',
method: 'post',
data: p
url: '/v1/api/web/login',
method: 'get',
params: p
});
};
// 登出
export const fetchLogout = (): Promise<null> => {
return request({
url: '/v1/api/logout',
method: 'get',
});
};
@ -188,6 +195,14 @@ export const orgAllList = (): Promise<TOrg.IOrgRecordRes[]> => {
method: 'get',
});
};
// 设置状态
export const accountSetStatus = (p?: TAccountSetStatus): Promise<null> => {
return request({
url: '/v1/api/account/setStatus',
method: 'get',
params: p
});
};
// 删除机构
export const orgDelete = (p?: TOrg.Idel): Promise<null> => {
@ -233,14 +248,6 @@ export const roleAdd = (p: TRoleModify.Ireq): Promise<null> => {
});
};
// 设备在线统计
export const statisticsDevice = (): Promise<TStatisticsDevice> => {
return request({
url: '/v1/api/statistics/device',
method: 'get',
});
};
// 内容数据
export const statisticsContent = (p: statisticsContentReq): Promise<statisticsContentRes> => {
return request({

View File

@ -57,6 +57,7 @@ import imgurl from "../assets/img/avatar.png";
import { useTabsStore } from "@/store/tabs";
import { routes } from "@/router/index";
import { format } from "@/utils";
import { fetchLogout } from "@/api/index";
const ws: any = inject("ws");
const tab = useTabsStore();
@ -77,11 +78,11 @@ const comm = useCommonStore();
const router = useRouter();
const handleCommand = (command: string) => {
if (command == "loginout") {
fetchLogout().then(() => {
comm.clearStore();
router.push("/login");
ws.close();
} else if (command == "user") {
router.push("/ucenter");
});
}
};
const toPage = (index: number) => {

View File

@ -9,6 +9,7 @@
<el-option label="户外押送" value="2" />
</el-select>
</div>
<template v-if="props.list.length">
<div v-infinite-scroll="load" :infinite-scroll-immediate="false" class="device-list noScrollbar infinite-list" style="overflow: auto">
<el-popover :width="350" class="box-item" placement="right" v-for="item in props.list" :key="item.id">
<template #reference>
@ -57,6 +58,10 @@
</template>
</el-popover>
</div>
</template>
<template v-else>
<el-empty description="暂无数据" />
</template>
</div>
</template>
<script setup lang="ts">

View File

@ -107,6 +107,7 @@ const devicePaging = reactive({
page: 1,
size: 10,
mode: undefined,
useStatus: 1,
});
const HealthData = ref<THealthLatestData.TRes>();

View File

@ -39,7 +39,7 @@ import StatisticsWarning from "./statisticsWarning.vue";
import EmergencyList from "./emergencyList.vue";
import * as echarts from "echarts";
import { MapCustom } from "@/utils/mapCustom";
import { statisticsDevice, statisticsContent, statisticsCount, statisticsWarningapi, warnRecord, statisticsUseCount } from "@/api/index";
import { statisticsContent, statisticsCount, statisticsWarningapi, warnRecord, statisticsUseCount } from "@/api/index";
import { onMounted, ref, reactive, onDeactivated, onUnmounted } from "vue";
import { debounce, format } from "@/utils";
import { TWarnRecord } from "@/api/index.d";
@ -142,12 +142,10 @@ const getData = async () => {
paging.total = res.total;
} catch (error) {}
};
const getStatisticsDevice = () => {
statisticsDevice().then((res) => {});
};
const getStatisticsWarningApi = () => {
statisticsWarningapi().then((res) => {
option1.value.series.data = [
option2.value.series.data = [
{ value: res?.sosCount, name: "SOS告警" },
{ value: res?.railCount, name: "围栏告警" },
{ value: res?.destroyCount, name: "破坏告警" },

View File

@ -1,7 +1,7 @@
<template>
<div class="deviceStatistics card">
<div class="card-head">
<div class="title">在线设备统计</div>
<div class="title">使用设备统计</div>
</div>
<slot name="chart"></slot>
</div>

View File

@ -12,7 +12,7 @@
</template>
<template #status="{ rows }">
<el-switch v-model="rows.status" :active-value="1" :inactive-value="0" />
<el-switch v-model="rows.status" :active-value="1" :inactive-value="0" @click="accountSetStatusFn(rows)" />
</template>
<template #roleId="{ rows }">
@ -53,7 +53,19 @@
<script setup lang="ts" name="basetable">
import { ref, reactive, onMounted } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { accountAdd, accountModify, accountList, accountDeletet, passwordReset, roleList, roleMenuList, roleModify, roleAdd, orgAllList } from "@/api/index";
import {
accountAdd,
accountModify,
accountList,
accountDeletet,
passwordReset,
roleList,
roleMenuList,
roleModify,
roleAdd,
orgAllList,
accountSetStatus,
} from "@/api/index";
import TableCustom from "@/components/table-custom.vue";
import TableSearch from "@/components/table-search.vue";
import TableEdit from "@/components/table-edit.vue";
@ -159,6 +171,13 @@ const getData = async () => {
paging.total = res.total;
};
const accountSetStatusFn = (row: TAccount.IListRes) => {
accountSetStatus({ accountId: row.id, status: row.status }).then((res) => {
ElMessage.success("操作成功");
getData();
});
};
const getOrgAllList = () => {
orgAllList().then((res) => {
orgAllData.value = res;