Commit 1f872198 authored by lei's avatar lei

删除log

parent f787c894
......@@ -74,10 +74,14 @@ VITE_STORAGE_PREFIX=SOY_
# ============================================ old
# 开发环境 - 视频流地址
VITE_VIDEO_URL=ws://10.0.20.81:9999
VITE_VIDEO_URL=ws://192.168.3.248:9999
# 开发环境 - 所有服务接口地址
VITE_SERVICE_URL=http://10.0.20.81:9996
VITE_SERVICE_URL=http://192.168.3.248:9996
# 开发环境 - WebSocket 全局地址
VITE_WEBSOCKET_URL=ws://10.0.20.81:9996
VITE_WEBSOCKET_URL=ws://192.168.3.248:9999
VITE_OTHER_SERVICE_BASE_URL= `{
"demo": "http://192.168.3.248:9999"
}`
\ No newline at end of file
# backend service base url, prod environment
# VITE_SERVICE_BASE_URL=https://192.168.5.223:
# VITE_SERVICE_BASE_URL=http://192.168.5.223:9999
VITE_VIDEO_URL=ws://192.168.5.223:9999
VITE_SERVICE_URL=https://192.168.5.223:9996
VITE_SERVICE_URL=http://192.168.5.223:9996
VITE_WEBSOCKET_URL=ws://192.168.5.223:9999
# other backend service base url, prod environment
VITE_OTHER_SERVICE_BASE_URL= `{
"demo": "http://192.168.5.223:9999"
}`
# VITE_OTHER_SERVICE_BASE_URL= `{
# "demo": "http://192.168.5.223:9999"
# }`
import { extend } from 'dayjs';
import axios from 'axios';
import type { IArea, ItablePagination } from '../views/AlgorithmConfiguration/index';
import { localStg } from '@/utils/storage';
import { useRouter } from 'vue-router';
import { useMessage } from 'naive-ui';
import { Windows } from '@vicons/fa';
axios.defaults.baseURL = '/v1';
import { extend } from "dayjs";
import axios from "axios";
import type {
IArea,
ItablePagination,
} from "../views/AlgorithmConfiguration/index";
import { localStg } from "@/utils/storage";
import { useRouter } from "vue-router";
import { useMessage } from "naive-ui";
import { Windows } from "@vicons/fa";
axios.defaults.baseURL = "/v1";
const router = useRouter();
const message = useMessage();
......@@ -16,24 +18,18 @@ const message = useMessage();
// return window.href = '/login';
// };
const gloabalReqErrorMsg = (e) => {
switch (e.code) {
case "ERR_BAD_REQUEST":
return window.$message.error("权限过期!")
return window.$message.error("权限过期!");
}
};
axios.interceptors.request.use(
(req) => {
let token = localStg.get("token");
}
axios.interceptors.request.use((req) => {
let token = localStg.get('token');
if (token) req.headers['token'] = `${token}`;
if (token) req.headers["token"] = `${token}`;
// let whiteRouteList = ['login']
......@@ -42,68 +38,80 @@ axios.interceptors.request.use((req) => {
// }
return req;
}, (e) => Promise.reject(e));
},
(e) => Promise.reject(e),
);
axios.interceptors.response.use((res) => {
console.log('------------------------- res', res)
axios.interceptors.response.use(
(res) => {
if (res.status === 401) {
window.location.href = '/login'
};
window.location.href = "/login";
}
return res;
}, (e) => {
window.location.href = '/login'
});
},
(e) => {
window.location.href = "/login";
},
);
// 区域 - 查
export const api_getAreaNode = async (): Promise<any> => await axios.get('/menus/tree');
export const api_getAreaNode = async (): Promise<any> =>
await axios.get("/menus/tree");
// 区域 - 增
export const api_addAreaNode = async (data: IArea): Promise<any> => await axios.post('/menus', data);
export const api_addAreaNode = async (data: IArea): Promise<any> =>
await axios.post("/menus", data);
// 区域 - 改
export const api_modifyAreaNode = async (data: IArea): Promise<any> => await axios.put('/menus', data);
export const api_modifyAreaNode = async (data: IArea): Promise<any> =>
await axios.put("/menus", data);
// 区域 - 删
export const api_deleteAreaNode = async (id: number | string): Promise<any> => await axios.delete(`/menus/${id}`);
export const api_deleteAreaNode = async (id: number | string): Promise<any> =>
await axios.delete(`/menus/${id}`);
// 区域 = 查
export const api_getCameras = async (): Promise<any> => await axios.get(`/menus`);
export const api_getCameras = async (): Promise<any> =>
await axios.get(`/menus`);
// 摄像头 - 查
export const api_getCameraList = async (params: ItablePagination): Promise<any> =>
await axios.get(`/cameras/page`, { params });
export const api_getCameraList = async (
params: ItablePagination,
): Promise<any> => await axios.get(`/cameras/page`, { params });
// 摄像头 - 增
export const api_addCameras = async (data: any): Promise<any> => await axios.post(`/cameras`, data);
export const api_addCameras = async (data: any): Promise<any> =>
await axios.post(`/cameras`, data);
// 摄像头 - 改
export const api_modifyCameras = async (data: any): Promise<any> => await axios.put(`/cameras`, data);
export const api_modifyCameras = async (data: any): Promise<any> =>
await axios.put(`/cameras`, data);
// 摄像头 - 删
export const api_delCameras = async (id: any): Promise<any> => await axios.delete(`/cameras/${id}`);
export const api_delCameras = async (id: any): Promise<any> =>
await axios.delete(`/cameras/${id}`);
// 模板下载
export const api_downWebCam = async (id: string): Promise<any> => await axios.get(`/export/${id}`);
export const api_downWebCam = async (id: string): Promise<any> =>
await axios.get(`/export/${id}`);
// 导出 - blob
export const api_exportBlobFile = async (ids: string): Promise<any> =>
await axios.get(`/export/${ids}`, { responseType: 'blob' });
await axios.get(`/export/${ids}`, { responseType: "blob" });
// 文件上传 - base64 -> ip
export const api_base64ToWebURl = async (image: string): Promise<any> => await axios.post(`/common/image`, { image });
export const api_base64ToWebURl = async (image: string): Promise<any> =>
await axios.post(`/common/image`, { image });
// 算法 - 查
export const api_algorithms = async (params: ItablePagination): Promise<any> =>
axios.get(`/algorithms/page`, { params });
// 算法 - 改
export const api_modifyAlgorithms = async (id: string, grade: string): Promise<any> =>
axios.put(`/algorithms/${id}/${grade}`);
export const api_modifyAlgorithms = async (
id: string,
grade: string,
): Promise<any> => axios.put(`/algorithms/${id}/${grade}`);
// ============================================================================================ 新增分析任务
// ================ 临时 | S
......@@ -125,32 +133,38 @@ interface IModifyTaskParam {
videoVo: IAnalyItemParam[];
}
// ================ 临时 | E
// 新增类
type IAddTaskParam = IModifyTaskParam;
// 视频分析任务-新增任务
export const api_addTask = async (data: IAddTaskParam): Promise<any> => axios.post(`/videos`, data);
export const api_addTask = async (data: IAddTaskParam): Promise<any> =>
axios.post(`/videos`, data);
// 视频分析任务-编辑任务
export const api_modifyTask = async (data: IModifyTaskParam): Promise<any> => axios.put(`/videos`, data);
export const api_modifyTask = async (data: IModifyTaskParam): Promise<any> =>
axios.put(`/videos`, data);
// 视频分析任务分页查询
export const api_getTask = async (data: ItablePagination): Promise<any> =>
axios.get(`/videos/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}&taskName=${data.taskName}`);
axios.get(
`/videos/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}&taskName=${data.taskName}`,
);
// 视频分析任务-单删
export const api_delTask = async (id: string): Promise<any> => axios.delete(`/videos/${id}`);
export const api_delTask = async (id: string): Promise<any> =>
axios.delete(`/videos/${id}`);
// 视频分析任务-变更任务状态
export const api_modifyTaskStatus = async (id: string, status: string): Promise<any> =>
axios.put(`/videos/${id}/${status}`);
export const api_modifyTaskStatus = async (
id: string,
status: string,
): Promise<any> => axios.put(`/videos/${id}/${status}`);
// 视频分析任务 - 单条数据
export const api_findModifyTaskInfo = async (id: string): Promise<any> => axios.get(`/videos/${id}`);
export const api_findModifyTaskInfo = async (id: string): Promise<any> =>
axios.get(`/videos/${id}`);
// ================================================================================= 报警分页日志查询 | S
interface IAlarmLogParam {
......@@ -162,17 +176,19 @@ interface IAlarmLogParam {
status?: string;
}
// 获取报警日志
export const api_getAlarmLog = async (params: IAlarmLogParam): Promise<any> => axios.get(`/alarm/logs/page`, { params });
export const api_getAlarmLog = async (params: IAlarmLogParam): Promise<any> =>
axios.get(`/alarm/logs/page`, { params });
// 删除日志记录
export const api_delAlarmLog = async (id: string): Promise<any> => axios.delete(`/alarm/logs/${id}`);
export const api_delAlarmLog = async (id: string): Promise<any> =>
axios.delete(`/alarm/logs/${id}`);
// 修改报警日志状态
export const api_modifyAlarmLog = async (id: string, status: string): Promise<any> => axios.put(`/alarm/logs/${id}/${status}`);
export const api_modifyAlarmLog = async (
id: string,
status: string,
): Promise<any> => axios.put(`/alarm/logs/${id}/${status}`);
// ================================================================================= 报警分页日志查询 | E
......@@ -182,9 +198,6 @@ interface IPushParamTask {
videoTaskName?: string;
}
interface IPushParamResult {
contentName?: string;
contentRemark?: string;
......@@ -192,9 +205,6 @@ interface IPushParamResult {
pushId?: string;
}
interface IPushParamCamera {
contentName: string;
contentRemark: string;
......@@ -202,9 +212,6 @@ interface IPushParamCamera {
pushId: string;
}
interface IPushParamAlgorithm {
contentName: string;
contentRemark: string;
......@@ -212,82 +219,75 @@ interface IPushParamAlgorithm {
pushId: string;
}
interface IPushParam {
algorithmList?: IPushParamAlgorithm[],
cameraList?: IPushParamCamera[],
algorithmList?: IPushParamAlgorithm[];
cameraList?: IPushParamCamera[];
id?: string;
pushAddress?: string;
pushName?: string;
resultList?: IPushParamResult[],
resultList?: IPushParamResult[];
status?: string;
videoTaskVoList?: IPushParamTask[]
videoTaskVoList?: IPushParamTask[];
}
// 新增报警推送
export const api_addAlarmPush = async (data: IPushParam) => {
return await axios.post(`/pushs`, data)
return await axios.post(`/pushs`, data);
};
// 修改报警推送
export const api_modifyAlarmPush = async (data: IPushParam) => {
return await axios.put(`/pushs`, data)
return await axios.put(`/pushs`, data);
};
// 报警推送查单全部
export const api_findPushItem = async (id) => {
return await axios.get(`/pushs/${id}`)
}
return await axios.get(`/pushs/${id}`);
};
// 推送删除
export const api_delPushItem = async (id) => {
return await axios.delete(`/pushs/${id}`)
}
return await axios.delete(`/pushs/${id}`);
};
// 算法信息
export const api_getKeyOfAnaly = async () => {
return await axios.get(`/pushs/algorithm`)
return await axios.get(`/pushs/algorithm`);
};
// 视频源信息
export const api_getKeyOfVideoSource = async () => {
return await axios.get(`/pushs/camera`)
return await axios.get(`/pushs/camera`);
};
// 视频任务信息
export const api_getKeyTaskInfo = async () => {
return await axios.get(`/pushs/video_task`)
return await axios.get(`/pushs/video_task`);
};
// 推送 - 测试
export const api_test = async () => {
return await axios.get('/pushs/test')
}
return await axios.get("/pushs/test");
};
// 视频推送 - 视频任务列表
export const api_videoTaskKey = async () => {
return await axios.get(`/videos/list`)
}
return await axios.get(`/videos/list`);
};
// 视频推送 - 分页查询
export const api_pushList = async (data) => {
return await axios.get(`/pushs/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`)
}
return await axios.get(
`/pushs/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
);
};
// ===================================================== 报警提醒 | E
// 报警提醒 - 算法列表
export const api_algorithmsList = async () => {
return await axios.get(`/algorithms/list`)
}
return await axios.get(`/algorithms/list`);
};
interface popUpsConfigParam {
ids: string;
......@@ -298,71 +298,67 @@ interface popUpsConfigParam {
// 报警提醒 - 修改弹窗相关配置
export const api_algorithmsPopUpsConfig = async (data: popUpsConfigParam) => {
await axios.put(`/algorithms/popUps`, data)
}
await axios.put(`/algorithms/popUps`, data);
};
// 算法提醒 - 分页查询
export const api_algorithmsPopUpsPage = async (data: any) => {
return await axios.get(`/algorithms/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`)
}
return await axios.get(
`/algorithms/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
);
};
// 算法提醒 - 修改弹窗配置回显
export const api_algorithmsPopUpsFind = async () => {
// /algorithms/list
return await axios.get(`/algorithms/list`)
}
return await axios.get(`/algorithms/list`);
};
// 算法提醒 - 删除语音
export const api_algorithmsPopUpsDel = async (id: string) => {
return await axios.put(`/algorithms/audio/${id}`)
}
return await axios.put(`/algorithms/audio/${id}`);
};
// 视频回放 - 临时测试
// /videos/test
export const api_videoTest = async () => {
return await axios.get(`/videos/test`)
}
return await axios.get(`/videos/test`);
};
// ========================================================= 用户角色管理 | S
// 用户分页查询
export const api_userList = async (data: any) => {
return await axios.get(`/users/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}&userName=${data.userName}`)
}
return await axios.get(
`/users/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}&userName=${data.userName}`,
);
};
// 新增用户
export const api_addUserInfo = async (data: any) => {
return await axios.post(`/users`, data)
}
return await axios.post(`/users`, data);
};
// 修改用户信息
export const api_modifyUserInfo = async (data: any) => {
return await axios.put(`/users`, data)
}
return await axios.put(`/users`, data);
};
// 删除用户信息
export const api_delUserInfo = async (id: string) => {
return await axios.delete(`/users/${id}`)
}
return await axios.delete(`/users/${id}`);
};
// 修改密码
export const api_modifyUserPass = async (id: string, password: string) => {
return await axios.put(`/users/${id}/${password}`)
}
return await axios.put(`/users/${id}/${password}`);
};
// 查询角色管理
export const api_roleList = async () => {
return await axios.get('/roles/list')
}
return await axios.get("/roles/list");
};
// ======================================================== 角色管理 | E
......@@ -374,98 +370,88 @@ interface IRoleParam {
// 新增角色
export const api_addRole = async (data: IRoleParam) => {
return await axios.post('/roles', data)
}
return await axios.post("/roles", data);
};
// 查询角色详情
export const api_findfRoleInfo = async (id: string) => {
return await axios.post(`/roles/${id}`)
}
return await axios.post(`/roles/${id}`);
};
// ============================== 音视频相关 | S
// 音频文件
export const getAudioFile = async (audioId: string) => {
return await axios.get(`/play/${audioId}`)
return await axios.get(`/play/${audioId}`);
// return await axios.get(`/play/${audioId}?audioId=${audioId}`)
}
};
// 视频文件
export const getVideoFile = async (fileName: string) => {
return await axios.get(`/playVideo/${fileName}`)
}
return await axios.get(`/playVideo/${fileName}`);
};
// 修改角色信息
export const api_modifyRoleInfo = async (data: any) => {
return await axios.put(`/roles`, data)
}
return await axios.put(`/roles`, data);
};
// 删除角色
export const api_delRoleInfo = async (id: string) => {
return await axios.delete(`/roles/${id}`)
}
return await axios.delete(`/roles/${id}`);
};
// 权限 - 权限树列表
export const api_permissionTreeList = async () => {
return await axios.get(`/permission/tree`)
}
return await axios.get(`/permission/tree`);
};
// ======================================== 首页 - /datas/points-count
export const api_pointsCount = async () => {
return await axios.get(`/datas/points-count`)
}
return await axios.get(`/datas/points-count`);
};
export const api_taskCount = async () => {
return await axios.get(`/datas/task-count`)
}
return await axios.get(`/datas/task-count`);
};
export const api_logCount = async (date) => {
return await axios.get(`/datas/log-count/${date[0]}/${date[1]}`)
}
return await axios.get(`/datas/log-count/${date[0]}/${date[1]}`);
};
// ================================= 登录注册
// 登录
export const api_login = async (data: any) => {
return await axios.post('/logins/login', data)
}
return await axios.post("/logins/login", data);
};
// 权限查询
export const api_permission = async () => {
return await axios.get('/logins/list')
}
return await axios.get("/logins/list");
};
// 查询详情
// /v1/roles/{id}
export const api_roleInfo = async (id: string) => {
return axios.get(`/roles/${id}`)
}
return axios.get(`/roles/${id}`);
};
// 视频任务分析 - 接口
export const api_videosPage = async (data) => {
return axios.get(`/videos/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`)
}
return axios.get(
`/videos/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
);
};
// 报警累计
export const api_getAlarmResultData = async () => {
return axios.get(`/datas/day`)
}
return axios.get(`/datas/day`);
};
// 根据ID查询信息
export const api_getUserInfo = async (id: string) => {
return axios.get(`/users/${id}`)
}
return axios.get(`/users/${id}`);
};
......@@ -4,8 +4,6 @@
* @param env The current env
*/
export function createServiceConfig(env: Env.ImportMeta) {
const { VITE_SERVICE_BASE_URL, VITE_OTHER_SERVICE_BASE_URL } = env;
......@@ -14,28 +12,31 @@ export function createServiceConfig(env: Env.ImportMeta) {
other = JSON.parse(VITE_OTHER_SERVICE_BASE_URL);
} catch (error) {
// eslint-disable-next-line no-console
} console.error('VITE_OTHER_SERVICE_BASE_URL is not a valid JSON string');
}
const httpConfig: App.Service.SimpleServiceConfig = {
baseURL: VITE_SERVICE_BASE_URL,
other
other,
};
const otherHttpKeys = Object.keys(httpConfig.other) as App.Service.OtherBaseURLKey[];
const otherHttpKeys = Object.keys(
httpConfig.other,
) as App.Service.OtherBaseURLKey[];
const otherConfig: App.Service.OtherServiceConfigItem[] = otherHttpKeys.map(key => {
const otherConfig: App.Service.OtherServiceConfigItem[] = otherHttpKeys.map(
(key) => {
return {
key,
baseURL: httpConfig.other[key],
proxyPattern: createProxyPattern(key)
proxyPattern: createProxyPattern(key),
};
});
},
);
const config: App.Service.ServiceConfig = {
baseURL: httpConfig.baseURL,
proxyPattern: createProxyPattern(),
other: otherConfig
other: otherConfig,
};
return config;
......@@ -52,13 +53,13 @@ export function getServiceBaseURL(env: Env.ImportMeta, isProxy: boolean) {
const otherBaseURL = {} as Record<App.Service.OtherBaseURLKey, string>;
other.forEach(item => {
other.forEach((item) => {
otherBaseURL[item.key] = isProxy ? item.proxyPattern : item.baseURL;
});
return {
baseURL: isProxy ? createProxyPattern() : baseURL,
otherBaseURL
otherBaseURL,
};
}
......@@ -69,7 +70,7 @@ export function getServiceBaseURL(env: Env.ImportMeta, isProxy: boolean) {
*/
function createProxyPattern(key?: App.Service.OtherBaseURLKey) {
if (!key) {
return '/proxy-default';
return "/proxy-default";
}
return `/proxy-${key}`;
......
......@@ -494,9 +494,9 @@ onMounted(() => {
<!-- ======================= 状态 | E -->
</NFlex>
<NButton @click.stop="() => {
<!-- <NButton @click.stop="() => {
isDefaultPreview = false;
}" strong secondary type="info" size="small">回放</NButton>
}" strong secondary type="info" size="small">回放</NButton> -->
</NFlex>
</template>
<!-- 图片区域 -->
......
<template>
<div id="alarmreminder">
<!-- 音频文件 | S -->
<!-- <audio ref="audioE" id="aWrap" controls>
......@@ -7,31 +6,50 @@
</source>
</audio> -->
<div style="border: 1px solid red; position: fixed; top: -1000px" v-html="htmlStr"></div>
<div
style="border: 1px solid red; position: fixed; top: -1000px"
v-html="htmlStr"
></div>
<!-- 音频文件 | E -->
<!-- 替换文件上传 -->
<NModal v-model:show="updateFileModal">
<NCard title="替换/上传文件" style="width: 600px" closable @close="() => {
updateFileModal = false
}">
<NCard
title="替换/上传文件"
style="width: 600px"
closable
@close="
() => {
updateFileModal = false;
}
"
>
<NForm label-align="left">
<NForm-item label="选择音频" path="file" required>
<NUpload :headers="{
<NUpload
:headers="{
'token': localStg.get('token') as string
}" :data="{
'id': audioId,
}" :max="1" :action="'/v1/upload/' + audioId" @before-upload="beforeUpload" name="audioFile"
@finish="handleFinish">
}"
:data="{
id: audioId,
}"
:max="1"
:action="'/v1/upload/' + audioId"
@before-upload="beforeUpload"
name="audioFile"
@finish="handleFinish"
>
<NButton>上传</NButton>
</NUpload>
</NForm-item>
</NForm>
<template #footer>
<div style="display: flex; justify-content: end;">
<div style="display: flex; justify-content: end">
<NSpace>
<NButton @click="updateFileModal = false">取消</NButton>
<NButton type="primary" @click="updateFileModal = false">确定</NButton>
<NButton type="primary" @click="updateFileModal = false"
>确定</NButton
>
</NSpace>
</div>
</template>
......@@ -47,34 +65,62 @@
<!-- 标题 -->
<NSpace justify="space-between" class="sum-title">
<span>选择开启提醒的算法</span>
<span><i class="sum-style">{{ modifyForm.ids.length || 0 }} </i> 个算法开启提醒</span>
<span
>
<i class="sum-style">{{ modifyForm.ids.length || 0 }} </i>
个算法开启提醒</span
>
</NSpace>
<!-- ========================================== 算法下拉 | S -->
<n-select style="margin-bottom: 10px;" v-model:value="modifyForm.ids" label-field="algorithmName"
value-field="id" placeholder="算法" @update-value="(val) => {
modifyForm.ids = val
<n-select
style="margin-bottom: 10px"
v-model:value="modifyForm.ids"
label-field="algorithmName"
value-field="id"
placeholder="算法"
@update-value="
(val) => {
modifyForm.ids = val;
onSubmit();
}" filterable multiple tag :options="algorithmsList" />
}
"
filterable
multiple
tag
:options="algorithmsList"
/>
<!-- ========================================== 算法下拉 | E -->
<div class="_t" style="padding-top: 10px;">提醒方式</div>
<div class="_t" style="padding-top: 10px">提醒方式</div>
<NSpace justify="space-between" style="margin: 5px 0;">
<NSpace justify="space-between" style="margin: 5px 0">
<span>系统报警语音</span>
<NSwitch @update:value="val => {
<NSwitch
@update:value="
(val) => {
modifyForm.isVoice = val;
onSubmit();
}" v-model:value="modifyForm.isVoice" :round="modifyForm.isVoice">
}
"
v-model:value="modifyForm.isVoice"
:round="modifyForm.isVoice"
>
</NSwitch>
</NSpace>
<NSpace justify="space-between" style="margin: 5px 0;">
<NSpace justify="space-between" style="margin: 5px 0">
<span>系统报警弹窗</span>
<NSwitch @update:value="val => {
<NSwitch
@update:value="
(val) => {
modifyForm.isRemind = val;
onSubmit();
}" v-model:value="modifyForm.isRemind" :round="modifyForm.isRemind">
}
"
v-model:value="modifyForm.isRemind"
:round="modifyForm.isRemind"
>
</NSwitch>
</NSpace>
......@@ -82,8 +128,19 @@
<div v-if="modifyForm.isRemind" class="flex-wrap">
<div>
<!-- 最外层区分左右 -->
<div @click="() => { modifyForm.reminderType = 1; onSubmit(); }"
:class="[modifyForm.reminderType !== 1 ? 'left-warp' : 'left-warp sel-left-warp']">
<div
@click="
() => {
modifyForm.reminderType = 1;
onSubmit();
}
"
:class="[
modifyForm.reminderType !== 1
? 'left-warp'
: 'left-warp sel-left-warp',
]"
>
<!-- 外层盒子 -->
<div>
<!-- 弹窗盒子 -->
......@@ -100,8 +157,19 @@
</div>
<!-- 右侧盒子 -->
<div>
<div @click="() => { modifyForm.reminderType = 2; onSubmit(); }"
:class="[modifyForm.reminderType !== 2 ? 'right-warp' : 'right-warp sel-right-warp']">
<div
@click="
() => {
modifyForm.reminderType = 2;
onSubmit();
}
"
:class="[
modifyForm.reminderType !== 2
? 'right-warp'
: 'right-warp sel-right-warp',
]"
>
<div></div>
</div>
<br />
......@@ -115,8 +183,15 @@
<NCol span="16">
<NCard title="提醒语音管理">
<template #action>
<NDataTable :ellipsis="true" striped bottom-bordered :row-key="row => row.id" :columns="tableColumn"
:data="tableData" :bordered="true" />
<NDataTable
:ellipsis="true"
striped
bottom-bordered
:row-key="(row) => row.id"
:columns="tableColumn"
:data="tableData"
:bordered="true"
/>
<div style="display: flex; justify-content: end">
<!-- <NPagination key="alarmReminder________iiuiiiiiiiiiiiiiiiiiiiii" v-model:page="page"
......@@ -130,9 +205,15 @@
<NPagination
:item-count="total"
v-model:page="page" v-model:page-size="pageSize" style="margin-top: 20px"
:display-order="['quick-jumper', 'pages', 'size-picker']" :page-count="100" show-quick-jumper
show-size-picker :page-sizes="pageSizes" />
v-model:page="page"
v-model:page-size="pageSize"
style="margin-top: 20px"
:display-order="['quick-jumper', 'pages', 'size-picker']"
:page-count="100"
show-quick-jumper
show-size-picker
:page-sizes="pageSizes"
/>
</div>
</template>
</NCard>
......@@ -140,18 +221,31 @@
<!-- <NButton @click="onSubmit">提交</NButton> -->
</NRow>
</div>
</template>
<script lang="tsx" setup>
import { h, nextTick, onMounted, onUpdated, reactive, ref, watch } from 'vue';
import type { TreeOverrideNodeClickBehavior, UploadFileInfo } from 'naive-ui';
import { NButton, NImage, NSpace, NTag, useMessage, useNotification, NDropdown, NRow, NCol, NEllipsis } from 'naive-ui';
import JSMpeg from '@cycjimmy/jsmpeg-player';
import html2canvas from 'html2canvas';
import { Add28Filled as AddIcon, Delete16Regular as DelICon, CalendarEdit24Regular as EditIcon } from '@vicons/fluent';
import { localStg } from '@/utils/storage';
import { h, nextTick, onMounted, onUpdated, reactive, ref, watch } from "vue";
import type { TreeOverrideNodeClickBehavior, UploadFileInfo } from "naive-ui";
import {
NButton,
NImage,
NSpace,
NTag,
useMessage,
useNotification,
NDropdown,
NRow,
NCol,
NEllipsis,
} from "naive-ui";
import JSMpeg from "@cycjimmy/jsmpeg-player";
import html2canvas from "html2canvas";
import {
Add28Filled as AddIcon,
Delete16Regular as DelICon,
CalendarEdit24Regular as EditIcon,
} from "@vicons/fluent";
import { localStg } from "@/utils/storage";
// api_algorithmsPopUpsConfig 弹窗配置
// api_algorithmsList 算法列
// api_getKeyOfAnaly
......@@ -159,43 +253,50 @@ import { localStg } from '@/utils/storage';
// api_getKeyTaskInfo
// api_algorithmsPopUpsDel api_algorithmsPopUpsFind
import { api_permissionTreeList, api_delRoleInfo, api_modifyRoleInfo, getAudioFile, api_algorithmsPopUpsConfig, api_videoTest, api_algorithmsList, api_algorithmsPopUpsPage, api_algorithmsPopUpsFind, api_algorithmsPopUpsDel } from '@/api/index.ts'
import {
api_permissionTreeList,
api_delRoleInfo,
api_modifyRoleInfo,
getAudioFile,
api_algorithmsPopUpsConfig,
api_videoTest,
api_algorithmsList,
api_algorithmsPopUpsPage,
api_algorithmsPopUpsFind,
api_algorithmsPopUpsDel,
} from "@/api/index.ts";
const updateFileModal = ref(false);
const message = useMessage();
const tableData = ref([]);
const selTipType = ref('0');
const selTipType = ref("0");
const notification = useNotification();
let algorithmsList = reactive([]);
const apiUrl = import.meta.env.VITE_SERVICE_URL;
// const page = ref(1);
// const pageSize = ref(10);
// ========================================== 分页 | S
const pageSizes = [
{
label: '10 每页',
value: 10
label: "10 每页",
value: 10,
},
{
label: '20 每页',
value: 20
label: "20 每页",
value: 20,
},
{
label: '30 每页',
value: 30
label: "30 每页",
value: 30,
},
{
label: '40 每页',
value: 40
}
label: "40 每页",
value: 40,
},
];
const page = ref(1);
const pageSize = ref(10);
......@@ -204,12 +305,11 @@ const pageSize = ref(10);
const next = (val: number) => {
page.value = val;
}
};
const prev = (val: number) => {
pageSize.value = val;
}
};
// ========================================== 分页 | E
......@@ -217,7 +317,7 @@ const prev = (val: number) => {
const sourceE = ref(null);
const audioE = ref(null);
const htmlStr = ref('')
const htmlStr = ref("");
const playAudio = async () => {
/**
......@@ -226,20 +326,19 @@ const playAudio = async () => {
* 3. 动态js网络链接不上
*/
htmlStr.value = `<audio ref="audioE" id="aWrap" controls>
<source id="audio" src="${apiUrl}/v1/play/${audioId.value}" type="audio/mpeg"></source>
</audio>`;
nextTick(() => {
let a = document.getElementById('aWrap');
let a = document.getElementById("aWrap");
a?.play();
});
};
// 临时测试播放
const videoTest = async () => {
return await api_videoTest().then(res => {
return await api_videoTest().then((res) => {
// console.log("================== videoTest", res);
// ============================= 二进制转化程 video-mp4
......@@ -247,17 +346,17 @@ const videoTest = async () => {
nextTick(() => {
console.log("================== videoTest |||| ", res);
// 创建Blob对象
var blob = new Blob([res.data.data], { type: 'video/mp4' });
console.log("============== blob", blob)
var blob = new Blob([res.data.data], { type: "video/mp4" });
console.log("============== blob", blob);
// 创建Blob URL
var blobUrl = URL.createObjectURL(blob);
console.log("============== blobUrl", blobUrl)
console.log("============== blobUrl", blobUrl);
// 设置video标签的src属性
var source = document.getElementById('videoSource');
var source = document.getElementById("videoSource");
source.src = blobUrl;
})
});
});
};
......@@ -265,24 +364,27 @@ const videoTest = async () => {
const permissionTree = ref([]);
const getPermissionTreeList = async () => {
return await api_permissionTreeList().then(res => {
return await api_permissionTreeList().then((res) => {
if (res.data.code === 200) {
return permissionTree.value = res.data.data;
return (permissionTree.value = res.data.data);
// return message.success()
}
return message.error(res.data.msg);
})
}
});
};
// 算法信息
const getAlgorithmsList = async () => {
await api_algorithmsList().then(res => {
await api_algorithmsList().then((res) => {
if (res.data.code === 200) {
console.log("================ |||||||||||||||||||||| ================ api_algorithmsList", res.data.data);
console.log(
"================ |||||||||||||||||||||| ================ api_algorithmsList",
res.data.data,
);
let ids = [];
let type = true;
algorithmsList = res.data.data.map(item => {
algorithmsList = res.data.data.map((item) => {
// 那些选中
// if (item.isRemind && item.isVoice) {
// ids.push(item?.id);
......@@ -294,7 +396,8 @@ const getAlgorithmsList = async () => {
if (item.isChecked) {
ids.push(item?.id);
type && ['isRemind', 'isVoice', 'reminderType'].forEach(key => {
type &&
["isRemind", "isVoice", "reminderType"].forEach((key) => {
type = false;
modifyForm[key] = item[key];
});
......@@ -303,8 +406,8 @@ const getAlgorithmsList = async () => {
// 选项列表
return {
algorithmName: item.algorithmName,
id: item.id
}
id: item.id,
};
});
// 修改表单
modifyForm.ids = ids;
......@@ -316,28 +419,28 @@ const getAlgorithmsList = async () => {
// 删除视频
const delAudio = async (id: string) => {
return await api_algorithmsPopUpsDel(id).then(res => {
return await api_algorithmsPopUpsDel(id).then((res) => {
console.log("================== delAudio", res);
if (res?.data.code === 200) {
getAlgorithmsPopUpsPage()
getAlgorithmsPopUpsPage();
// return message.success(res?.data.msg);
}
return message.warning(res?.data.msg);
})
});
};
// 语音提醒
const total = ref(0);
const getAlgorithmsPopUpsPage = async () => {
let param = { pageNum: page.value, pageSize: pageSize.value };
return api_algorithmsPopUpsPage(param).then(res => {
return api_algorithmsPopUpsPage(param).then((res) => {
console.log("================== tableData", res);
if (res?.data.code === 200) {
tableData.value = res?.data.data.records;
total.value = res?.data.data.total;
}
})
}
});
};
watch(page, () => {
getAlgorithmsPopUpsPage();
......@@ -350,8 +453,7 @@ watch(pageSize, () => {
// 修改弹窗配置
const onSubmit = () => {
return modifyPopUpList();
}
};
let modifyForm = reactive({
// 开启弹窗
......@@ -361,41 +463,41 @@ let modifyForm = reactive({
// 弹窗类型 报警弹窗类型(1,右侧,2,居中)
reminderType: 1,
// 算法ID
ids: []
ids: [],
});
// 弹窗配置回显数据
const getAlgorithmsPopUpsFind = async () => {
return await api_algorithmsPopUpsFind().then(res => {
console.log("================== api_algorithmsPopUpsFind", res);
return await api_algorithmsPopUpsFind().then((res) => {
if (res?.data.code === 200) {
return res?.data.data;
}
})
}
});
};
const modifyPopUpList = async () => {
console.log('============ modifyForm', modifyForm)
return await api_algorithmsPopUpsConfig(modifyForm).then(res => {
if (res.data.code === 200) {
return await api_algorithmsPopUpsConfig(modifyForm).then((res) => {
if (res?.data.code === 200) {
return message.success(res.data.msg);
}
return message.warning(res.data.msg);
})
}
});
};
// ======================= IMG 上传 | S
const beforeUpload = (data: { file: UploadFileInfo; fileList: UploadFileInfo[] }): boolean => {
console.log("=============== 上传文件", data.file.file.size)
const beforeUpload = (data: {
file: UploadFileInfo;
fileList: UploadFileInfo[];
}): boolean => {
console.log("=============== 上传文件", data.file.file.size);
if ((data.file.file.size / 1024 / 1024).toFixed(0) > 5) {
message.error('音频大小不能超过5M!');
message.error("音频大小不能超过5M!");
return false;
}
if (data.file.file?.type !== 'audio/mpeg') {
message.error('只能上传MP3格式的文件!');
if (data.file.file?.type !== "audio/mpeg") {
message.error("只能上传MP3格式的文件!");
return false;
}
return true;
......@@ -403,58 +505,75 @@ const beforeUpload = (data: { file: UploadFileInfo; fileList: UploadFileInfo[] }
const fileList = ref<UploadFileInfo[]>([]);
const handleFinish = ({ file, event }: { file: UploadFileInfo; event?: ProgressEvent }) => {
const res = event?.target && event?.target?.response && JSON.parse(event?.target?.response);
const handleFinish = ({
file,
event,
}: {
file: UploadFileInfo;
event?: ProgressEvent;
}) => {
const res =
event?.target &&
event?.target?.response &&
JSON.parse(event?.target?.response);
if (res.code === 200) {
getAlgorithmsPopUpsPage();
message.success('音频上传成功!');
message.success("音频上传成功!");
}
return file;
};
// ======================= IMG 上传 | E
const audioId = ref('');
const audioId = ref("");
const tableColumn = [
{
title: '算法ID',
align: 'center',
key: 'id',
title: "算法ID",
align: "center",
key: "id",
},
{
title: '算法名称',
align: 'center',
key: 'algorithmName',
title: "算法名称",
align: "center",
key: "algorithmName",
},
{
title: '算法等级',
key: 'grade',
align: 'center',
title: "算法等级",
key: "grade",
align: "center",
render: (row: any) => {
return row.grade === 0 ? (
<NTag bordered={false} type="error">一级</NTag>
<NTag bordered={false} type="error">
一级
</NTag>
) : row.grade === 1 ? (
<NTag bordered={false} type="warning">二级</NTag>
<NTag bordered={false} type="warning">
二级
</NTag>
) : row.grade === 2 ? (
<NTag bordered={false} type="info">三级</NTag>
<NTag bordered={false} type="info">
三级
</NTag>
) : row.grade === 3 ? (
<NTag bordered={false} type="success">四级</NTag>
<NTag bordered={false} type="success">
四级
</NTag>
) : (
<NTag bordered={false} >五级</NTag>
<NTag bordered={false}>五级</NTag>
);
}
},
},
{
title: '报警语音',
align: 'center',
key: 'audioName',
title: "报警语音",
align: "center",
key: "audioName",
render: (row: any) => {
return row.audioName || ''
}
return row.audioName || "";
},
},
{
title: '操作',
key: 'actions',
align: 'center',
title: "操作",
key: "actions",
align: "center",
render(row: any) {
return (
<div>
......@@ -472,7 +591,7 @@ const tableColumn = [
<n-button
onClick={() => {
audioId.value = row.id;
updateFileModal.value = true
updateFileModal.value = true;
}}
quaternary
type="info"
......@@ -482,7 +601,7 @@ const tableColumn = [
<n-button
onClick={() => {
delAudio(row.id)
delAudio(row.id);
}}
quaternary
type="error"
......@@ -491,24 +610,23 @@ const tableColumn = [
</n-button>
</div>
);
}
}
},
},
];
const handleSelect = () => { };
const handleSelect = () => {};
const options = [
{
label: '暂停提醒',
value: '1'
label: "暂停提醒",
value: "1",
},
{
label: '继续提醒',
value: '2'
}
label: "继续提醒",
value: "2",
},
];
onMounted(() => {
// 配置回显
getAlgorithmsList();
......@@ -519,7 +637,6 @@ onMounted(() => {
// 权限树
getPermissionTreeList();
});
</script>
<style lang="scss" scoped>
......@@ -545,18 +662,17 @@ onMounted(() => {
}
#alarmreminder {
.flex-wrap {
display: flex;
&>div {
& > div {
flex: 1;
height: 200px;
text-align: center;
&>div {
& > div {
margin-top: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, .1);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
height: 120px;
width: 210px;
background: #fff;
......@@ -567,13 +683,12 @@ onMounted(() => {
}
}
// 默认样式
.right-warp {
display: inline-block;
text-align: center;
>div {
> div {
display: inline-block;
margin-top: 30px;
border-radius: 5px;
......@@ -589,18 +704,15 @@ onMounted(() => {
}
}
// 右侧选中
.sel-right-warp {
border: 3px solid rgb(24, 114, 240);
border-left: none;
border-right: none;
>div {
> div {
background: rgb(24, 114, 240);
}
}
// 左侧选中
......@@ -621,7 +733,7 @@ onMounted(() => {
right: 0;
margin: 5px 5px 0 0;
&>div {
& > div {
height: 11px;
width: 30px;
background-color: rgb(24, 114, 240);
......@@ -636,7 +748,7 @@ onMounted(() => {
right: 0;
margin: 5px 5px 0 0;
&>div {
& > div {
height: 13px;
width: 30px;
background-color: rgb(24, 114, 240);
......@@ -645,6 +757,5 @@ onMounted(() => {
border-radius: 2px;
}
}
}
</style>
......@@ -21,6 +21,7 @@ import fullScreen from '@/utils/full'
const serviceUrl = import.meta.env.VITE_VIDEO_URL;
const apiUrl = import.meta.env.VITE_SERVICE_URL;
const webSocketUrl = import.meta.env.VITE_WEBSOCKET_URL;
......@@ -86,6 +87,7 @@ const audioId = ref('');
const playAudio = async (id: string) => {
// 创建新的音频元素并播放
const audio = new Audio(`${apiUrl}/v1/play/${id}`);
audio.play();
// 保留原始逻辑备用
......@@ -101,7 +103,6 @@ const switchVideoPalyer = (id: string) => {
cId.value = id;
let camera = cameraList.value.filter(item => item?.id === id)[0];
console.log("======================================= id", id, camera?.cameraAddress);
// if (!camera?.cameraAddress?.includes('rtsp://')) {
// return message.error('摄像头流地址格式有误!');
......@@ -125,7 +126,6 @@ const switchVideoPalyer = (id: string) => {
}
);
} catch (e) {
console.log("======================================= error", e);
}
});
};
......@@ -163,7 +163,6 @@ const options = [
}
];
const handleSelect = (key: string) => {
console.log(key);
};
// 变更状态
......@@ -205,7 +204,6 @@ let cLogInfo = reactive({});
// 切换视频播放源头
const switchVideoPlayer = () => {
console.log("switchVideoPlayer ==============", "rtsp://admin:gemho10-7@192.168.0.56:554/h264/ch1/main/av_stream`")
// nextTick(() => {
// try {
// // 临时测试
......@@ -284,14 +282,13 @@ onMounted(() => {
try {
let ws = new WebSocket(`${webSocketUrl}/ws/${localStg.get('id')}`);
// 应改为(测试用临时方案):
// let ws = new WebSocket(`ws://localhost:9999/ws/${localStg.get('id')}`);
ws.onopen = function () {
console.log('WebSocket connected --------------------------------------------------------------------------');
ws.send('Hello, Server! ------------------------- ');
};
ws.onmessage = function (event) {
console.log('---------------------- WebSocket received message:', JSON.parse(event.data));
let data = JSON.parse(event.data);
data.algorithmId && playAudio(data.algorithmId);
......@@ -359,15 +356,14 @@ onMounted(() => {
};
ws.onclose = function () {
console.log('WebSocket closed');
};
ws.onerror = function (error) {
console.error('WebSocket error:', error);
console.error('WebSocket error:', error); // 检查控制台是否有连接错误
};
} catch (e) {
console.log("error", e)
console.log(e,'error')
}
......
<script setup lang="ts">
import { watch, onMounted, defineProps } from 'vue';
import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app';
import { useEcharts } from '@/hooks/common/echarts';
import { watch, onMounted, defineProps } from "vue";
import { $t } from "@/locales";
import { useAppStore } from "@/store/modules/app";
import { useEcharts } from "@/hooks/common/echarts";
import { api_logCount } from "@/api/index.ts";
defineOptions({
name: 'LineChart'
name: "LineChart",
});
const props = defineProps({
date: {
type: Array,
default: () => []
}
default: () => [],
},
});
watch(props, () => {
getLogCount();
})
});
// 获取日志报警的数据
const getLogCount = async () => {
await api_logCount(props.date).then(res => {
await api_logCount(props.date).then((res) => {
if (res.data.code === 200) {
console.log("================= res", res.data.data);
let data = res.data.data;
console.log("=================== data", data);
updateOptions(opts => {
console.log("========================= opts", opts)
updateOptions((opts) => {
// opts.series[1].data = [2208, 2016, 2916, 4512, 8281, 2008, 1963, 2367, 2956, 678];
opts.xAxis.data = data.dateLabel;
opts.legend.data = data.result;
opts.series.forEach((item, index) => {
opts.series[index].data = [];
})
});
const service = (name = (Math.random() * 100).toFixed(0)) => {
return {
color: '#1872F0',
color: "#1872F0",
name,
type: 'line',
type: "line",
smooth: true,
stack: 'Total',
stack: "Total",
areaStyle: {
color: {
type: 'linear',
type: "linear",
x: 0,
y: 0,
x2: 0,
......@@ -58,33 +51,32 @@ const getLogCount = async () => {
colorStops: [
{
offset: 0.25,
color: '#1872F0'
color: "#1872F0",
},
{
offset: 1,
color: '#fff'
}
]
}
color: "#fff",
},
],
},
},
emphasis: {
focus: 'series'
focus: "series",
},
data: new Array(data[0].countList.length).fill(100)
data: new Array(data[0].countList.length).fill(100),
};
};
}
data.countLabel.forEach((item, index) => {
opts.series.push({
color: '#1872F0',
color: "#1872F0",
name: data.result[index],
type: 'line',
type: "line",
smooth: true,
stack: 'Total',
stack: "Total",
areaStyle: {
color: {
type: 'linear',
type: "linear",
x: 0,
y: 0,
x2: 0,
......@@ -92,21 +84,21 @@ const getLogCount = async () => {
colorStops: [
{
offset: 0.25,
color: '#1872F0'
color: "#1872F0",
},
{
offset: 1,
color: '#fff'
}
]
}
color: "#fff",
},
],
},
},
emphasis: {
focus: 'series'
focus: "series",
},
data: item
})
})
data: item,
});
});
// opts.series = new Array(data[0].countList.length).fill(
// series
......@@ -115,69 +107,64 @@ const getLogCount = async () => {
// countList 17
// opts.series[0].data = [0xxx]
// data.forEach(wrapItem => {
// wrapItem.countList.forEach((item, index) => {
// opts.series[index].name = item.algorithmName;
// })
// });
// data[0].countList((item, index) => {
// series.data[index] = item.count;
// })
console.log("========================= opts", opts.xAxis.data, opts.legend.data)
return opts;
})
});
}
})
}
});
};
onMounted(() => {
getLogCount()
})
getLogCount();
});
const appStore = useAppStore();
const { domRef, updateOptions } = useEcharts(() => ({
tooltip: {
trigger: 'axis',
trigger: "axis",
axisPointer: {
type: 'cross',
type: "cross",
label: {
backgroundColor: '#6a7985'
}
}
backgroundColor: "#6a7985",
},
},
},
legend: {
data: [$t('page.home.downloadCount'), $t('page.home.registerCount')]
data: [$t("page.home.downloadCount"), $t("page.home.registerCount")],
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
xAxis: {
type: 'category',
type: "category",
boundaryGap: false,
data: [] as string[]
data: [] as string[],
},
yAxis: {
type: 'value'
type: "value",
},
series: [
{
color: '#1872F0',
name: $t('page.home.downloadCount'),
type: 'line',
color: "#1872F0",
name: $t("page.home.downloadCount"),
type: "line",
smooth: true,
stack: 'Total',
stack: "Total",
areaStyle: {
color: {
type: 'linear',
type: "linear",
x: 0,
y: 0,
x2: 0,
......@@ -185,29 +172,29 @@ const { domRef, updateOptions } = useEcharts(() => ({
colorStops: [
{
offset: 0.25,
color: '#1872F0'
color: "#1872F0",
},
{
offset: 1,
color: '#fff'
}
]
}
color: "#fff",
},
],
},
},
emphasis: {
focus: 'series'
focus: "series",
},
data: [] as number[]
data: [] as number[],
},
{
color: '#26deca',
name: $t('page.home.registerCount'),
type: 'line',
color: "#26deca",
name: $t("page.home.registerCount"),
type: "line",
smooth: true,
stack: 'Total',
stack: "Total",
areaStyle: {
color: {
type: 'linear',
type: "linear",
x: 0,
y: 0,
x2: 0,
......@@ -215,36 +202,36 @@ const { domRef, updateOptions } = useEcharts(() => ({
colorStops: [
{
offset: 0.25,
color: '#26deca'
color: "#26deca",
},
{
offset: 1,
color: '#fff'
}
]
}
color: "#fff",
},
],
},
},
emphasis: {
focus: 'series'
focus: "series",
},
data: []
}
]
data: [],
},
],
}));
async function mockData() {
await new Promise(resolve => {
await new Promise((resolve) => {
setTimeout(resolve, 1000);
});
updateOptions(opts => {
updateOptions((opts) => {
[
{
label: "10/15",
num: 502
num: 502,
},
// ?cvxccxvxcv
]
];
// opts.xAxis.data = ['06:00', '08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00', '24:00'];
// opts.series[0].data = [4623, 6145, 6268, 6411, 1890, 4251, 2978, 3880, 3606, 4311];
// opts.series[1].data = [2208, 2016, 2916, 4512, 8281, 2008, 1963, 2367, 2956, 678];
......
......@@ -15,12 +15,12 @@ const getCardData = async () => {
updateOptions((opts) => {
opts.series[0].data = [
{
name: `已启动 ${res.data.data[1].count} 个`,
value: res.data.data[1].count,
name: `已启动 ${res.data.data[0].count} 个`,
value: res.data.data[0].count,
},
{
name: `已停用 ${res.data.data[0].count} 个`,
value: res.data.data[0].count,
name: `已停用 ${res.data.data[1].count} 个`,
value: res.data.data[1].count,
},
];
return opts;
......
......@@ -113,8 +113,8 @@ const getCardData = async () => {
if (res.data.code === 200) {
updateOptions((opts) => {
opts.series[0].data = [
{ name: `已启动`, value: res.data.data[1].count },
{ name: `已停用`, value: res.data.data[0].count },
{ name: `已启动`, value: res.data.data[0].count },
{ name: `已停用`, value: res.data.data[1].count },
];
return opts;
});
......
import process from 'node:process';
import { URL, fileURLToPath } from 'node:url';
import { defineConfig, loadEnv } from 'vite';
import { setupVitePlugins } from './build/plugins';
import { createViteProxy, getBuildTime } from './build/config';
import process from "node:process";
import { URL, fileURLToPath } from "node:url";
import { defineConfig, loadEnv } from "vite";
import { setupVitePlugins } from "./build/plugins";
import { createViteProxy, getBuildTime } from "./build/config";
// export const proxyTarget = 'http://192.168.3.248:9996';
export const proxyTarget = 'http://10.0.20.81:9996';
export const proxyTarget = "http://192.168.3.248:9996";
// export const proxyTarget = "http://192.168.3.248:9996";
// export const proxyTarget = 'http://192.168.1.119:9996';
// export const proxyTarget = 'http://192.168.1.119:9996';
// export const proxyTarget = "http://192.168.2.188:9527";
// 视频地址
export const videdUrl = 'ws://10.0.20.81:9999';
export const videdUrl = "ws://192.168.3.248:9999";
// 固定接口地址
export const apiUrl = 'http://10.0.20.81:9996';
export const apiUrl = "http://192.168.3.248:9996";
// WS 地址
export const wsUrl = 'ws://10.0.20.81:9999';
export const wsUrl = "ws://192.168.3.248:9996";
export default defineConfig(configEnv => {
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as unknown as Env.ImportMeta;
export default defineConfig((configEnv) => {
const viteEnv = loadEnv(
configEnv.mode,
process.cwd(),
) as unknown as Env.ImportMeta;
const buildTime = getBuildTime();
......@@ -30,49 +30,49 @@ export default defineConfig(configEnv => {
base: viteEnv.VITE_BASE_URL,
resolve: {
alias: {
'~': fileURLToPath(new URL('./', import.meta.url)),
'@': fileURLToPath(new URL('./src', import.meta.url))
}
"~": fileURLToPath(new URL("./", import.meta.url)),
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "./src/styles/scss/global.scss" as *;`
}
}
additionalData: `@use "./src/styles/scss/global.scss" as *;`,
},
},
},
plugins: setupVitePlugins(viteEnv, buildTime),
define: {
BUILD_TIME: JSON.stringify(buildTime)
BUILD_TIME: JSON.stringify(buildTime),
},
server: {
host: '0.0.0.0',
host: "0.0.0.0",
port: 9527,
open: true,
// 集成别人封装的代理项 & 晶合项目的代理项
proxy: {
...createViteProxy(viteEnv, configEnv.command === 'serve'),
...createViteProxy(viteEnv, configEnv.command === "serve"),
// '/menus': 'http://192.168.1.102:9995/menus',
// '/menus': 'http://192.168.1.173:10000/menus'
'/v1': {
"/v1": {
target: proxyTarget,
changeOrigin: true
}
changeOrigin: true,
},
},
fs: {
cachedChecks: false
}
cachedChecks: false,
},
},
preview: {
port: 9725
port: 9725,
},
build: {
reportCompressedSize: false,
sourcemap: viteEnv.VITE_SOURCE_MAP === 'Y',
sourcemap: viteEnv.VITE_SOURCE_MAP === "Y",
commonjsOptions: {
ignoreTryCatch: false
}
}
ignoreTryCatch: false,
},
},
};
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment