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'] ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm'] ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon'] 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[] devices: number[]
accountId: number accountId: number
} }
export interface TAccountSetStatus {
accountId: number
export interface TStatisticsDevice { status: number
addCount: number
deviceTotal: number
onlineCount: number
warnCount: number
} }
export interface TStatisticsCount { export interface TStatisticsCount {
@ -155,6 +151,7 @@ export namespace TAccount {
id: number id: number
orgId: number orgId: number
roleId: number roleId: number
status: number
flag: boolean flag: boolean
name: string name: string
username: string username: string

View File

@ -1,11 +1,18 @@
import request from '../utils/request'; 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> => { export const fetchLogin = (p: TLogin.Ireq): Promise<TLogin.IRes> => {
return request({ return request({
url: '/v1/api/login', url: '/v1/api/web/login',
method: 'post', method: 'get',
data: p 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', 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> => { 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> => { export const statisticsContent = (p: statisticsContentReq): Promise<statisticsContentRes> => {
return request({ return request({

View File

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

View File

@ -9,6 +9,7 @@
<el-option label="户外押送" value="2" /> <el-option label="户外押送" value="2" />
</el-select> </el-select>
</div> </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"> <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"> <el-popover :width="350" class="box-item" placement="right" v-for="item in props.list" :key="item.id">
<template #reference> <template #reference>
@ -57,6 +58,10 @@
</template> </template>
</el-popover> </el-popover>
</div> </div>
</template>
<template v-else>
<el-empty description="暂无数据" />
</template>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
</template> </template>
<template #status="{ rows }"> <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>
<template #roleId="{ rows }"> <template #roleId="{ rows }">
@ -53,7 +53,19 @@
<script setup lang="ts" name="basetable"> <script setup lang="ts" name="basetable">
import { ref, reactive, onMounted } from "vue"; import { ref, reactive, onMounted } from "vue";
import { ElMessage, ElMessageBox } from "element-plus"; 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 TableCustom from "@/components/table-custom.vue";
import TableSearch from "@/components/table-search.vue"; import TableSearch from "@/components/table-search.vue";
import TableEdit from "@/components/table-edit.vue"; import TableEdit from "@/components/table-edit.vue";
@ -159,6 +171,13 @@ const getData = async () => {
paging.total = res.total; paging.total = res.total;
}; };
const accountSetStatusFn = (row: TAccount.IListRes) => {
accountSetStatus({ accountId: row.id, status: row.status }).then((res) => {
ElMessage.success("操作成功");
getData();
});
};
const getOrgAllList = () => { const getOrgAllList = () => {
orgAllList().then((res) => { orgAllList().then((res) => {
orgAllData.value = res; orgAllData.value = res;