feat:新增场景ID配置
This commit is contained in:
parent
8dfb91e748
commit
40a1a836d7
@ -16,6 +16,7 @@ export const styleConfig = {
|
||||
}
|
||||
}
|
||||
export const option = {
|
||||
secneID: '01',
|
||||
dataset: dataJson,
|
||||
rowNum: 4,
|
||||
waitTime: 0.5,
|
||||
|
@ -1,28 +1,24 @@
|
||||
<template>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="场景ID" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.secneID" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<collapse-item name="滚动列表三" :expanded="true">
|
||||
<SettingItem name="表行数">
|
||||
<n-input-number
|
||||
v-model:value="optionData.rowNum"
|
||||
:min="1"
|
||||
size="small"
|
||||
placeholder="请输入自动计算"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
<SettingItem name="轮播时间(s)">
|
||||
<n-input-number
|
||||
v-model:value="optionData.waitTime"
|
||||
:min="0"
|
||||
size="small"
|
||||
placeholder="请输入轮播时间"
|
||||
></n-input-number>
|
||||
</SettingItem>
|
||||
<setting-item >
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.showRankNum" size="small" />
|
||||
<n-text>显示排行数字</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
|
||||
<n-input-number v-model:value="optionData.rowNum" :min="1" size="small" placeholder="请输入自动计算"></n-input-number>
|
||||
</SettingItem>
|
||||
<SettingItem name="轮播时间(s)">
|
||||
<n-input-number v-model:value="optionData.waitTime" :min="0" size="small" placeholder="请输入轮播时间"></n-input-number>
|
||||
</SettingItem>
|
||||
<setting-item>
|
||||
<n-space>
|
||||
<n-switch v-model:value="optionData.showRankNum" size="small" />
|
||||
<n-text>显示排行数字</n-text>
|
||||
</n-space>
|
||||
</setting-item>
|
||||
</collapse-item>
|
||||
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
[
|
||||
{
|
||||
"alarmTime": "2025-08-24T23:36:39.000+00:00",
|
||||
"alarmLevel": "较大风险",
|
||||
"compName": "长客安网系统",
|
||||
"alarmDescname": "鲁UH9206于2025-08-22T07:36:39发生行人碰撞报警"
|
||||
"alarmLevel": "测试风险",
|
||||
"compName": "测试系统",
|
||||
"alarmDescname": "XXXX于2025-08-22T07:36:39发生XXXX"
|
||||
},
|
||||
{
|
||||
"alarmTime": "2025-08-24T23:34:32.000+00:00",
|
||||
"alarmLevel": "较大风险",
|
||||
"compName": "大连安网系统",
|
||||
"alarmDescname": "鲁UH9206于2025-08-22T07:34:32发生行人碰撞报警"
|
||||
"alarmLevel": "测试风险",
|
||||
"compName": "测试系统",
|
||||
"alarmDescname": "XXXX于2025-08-22T07:34:32发生XXXX"
|
||||
}
|
||||
]
|
@ -273,7 +273,8 @@ const formatAlarmItem = (item) => {
|
||||
const fetchRecentAlarms = async () => {
|
||||
try {
|
||||
isLoading.value = true
|
||||
const res = await axiosInstance.get('/awjt/space/getRecentAlarms', {responseType: 'json', baseURL: '' });
|
||||
const res = await axiosInstance.get(`/awjt/space/getRecentAlarms/${props.chartConfig.option.secneID}`, { responseType: 'json', baseURL: '' });
|
||||
|
||||
if (res.state === true) {
|
||||
let rawData = [];
|
||||
if (Array.isArray(res.value.items)) {
|
||||
|
@ -9,6 +9,7 @@ export const includes = ['legend']
|
||||
|
||||
// 其它配置
|
||||
const otherConfig = {
|
||||
secneID: '01',
|
||||
dateTime: {
|
||||
selectValue: 'day',
|
||||
dataset: [
|
||||
@ -45,11 +46,12 @@ dataJson.source.forEach(item => {
|
||||
const series = getPie3D(dataJson.source, 0.8);
|
||||
|
||||
|
||||
const option = {
|
||||
export const option = {
|
||||
...otherConfig,
|
||||
renderer: 'canvas',
|
||||
backgroundColor: 'transparent',
|
||||
legend: {
|
||||
show: true,
|
||||
data: dataJson.source.map(item => item.name),
|
||||
top: '84%',
|
||||
left: 'center',
|
||||
|
@ -1,5 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="场景ID" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.secneID" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<!-- 基础配置可以复用PieCommon的配置面板 -->
|
||||
<CollapseItem name="基础配置" :expanded="true">
|
||||
<SettingItemBox name="图例">
|
||||
|
@ -132,7 +132,8 @@ export class BarOption {
|
||||
Object.assign(this, opts);
|
||||
}
|
||||
}
|
||||
const option = {
|
||||
export const option = {
|
||||
secneID:"01",
|
||||
dataset: { ...dataJson }
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,25 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="场景ID" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.secneID" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<!-- 基础配置可以复用PieCommon的配置面板 -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
import { option } from './config'
|
||||
|
||||
</script>
|
||||
defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
@ -53,39 +53,37 @@ const selectButton = (id: number) => {
|
||||
* @param buttonId 当前激活的按钮ID
|
||||
*/
|
||||
const updateChartData = async (buttonId: number) => {
|
||||
let dataToRender: BarOption[] = [];
|
||||
let dataToRender: any = [];
|
||||
if (buttonId === 1) {
|
||||
dataToRender = await fetchData('/spaceMapMock');
|
||||
} else if (buttonId === 2) {
|
||||
dataToRender = await fetchData('/dayMapMock');
|
||||
} else {
|
||||
console.warn(`未知的按钮ID: ${buttonId},将使用默认数据。`);
|
||||
console.warn(`未知的按钮ID: ${buttonId}`);
|
||||
}
|
||||
// 更新 chartConfig 中的数据,这将触发 BarOptionsData computed 和 watch
|
||||
props.chartConfig.option.dataset.barOptions = dataToRender;
|
||||
console.log(`已为按钮 ${buttonId} 加载 ${dataToRender.length} 条数据。`);
|
||||
};
|
||||
const fetchData = async (url: string) => {
|
||||
if (url == '/spaceMapMock') {
|
||||
return dataJson.barOptions;
|
||||
} else if (url == '/dayMapMock') {
|
||||
} else {
|
||||
return [{ "location": "四川省.成都市", "items": [{ "tall": 120, "color": "#ff4757" }, { "tall": 50, "color": "#3A86FF" }] }, { "location": "广东省.深圳市", "items": [{ "tall": 90, "color": "#5352ed" }, { "tall": 40, "color": "#5352ed" }] }, { "location": "浙江省.杭州市", "items": [{ "tall": 150, "color": "#ff4757" }, { "tall": 70, "color": "#4ECDC4" }] }, { "location": "江苏省.南京市", "items": [{ "tall": 100, "color": "#ff4757" }, { "tall": 45, "color": "#FFD166" }] }, { "location": "湖北省.武汉市", "items": [{ "tall": 110, "color": "#ff4757" }, { "tall": 52, "color": "#6A0572" }] }, { "location": "陕西省.西安市", "items": [{ "tall": 85, "color": "#ff4757" }, { "tall": 38, "color": "#1A535C" }] }, { "location": "山东省.青岛市", "items": [{ "tall": 130, "color": "#ff4757" }, { "tall": 60, "color": "#FF8C42" }] }, { "location": "河南省.郑州市", "items": [{ "tall": 95, "color": "#ff4757" }, { "tall": 43, "color": "#7209B7" }] }, { "location": "福建省.厦门市", "items": [{ "tall": 140, "color": "#ff4757" }, { "tall": 65, "color": "#06D6A0" }] }, { "location": "辽宁省.大连市", "items": [{ "tall": 88, "color": "#ff4757" }, { "tall": 41, "color": "#118AB2" }] }]
|
||||
}
|
||||
try {
|
||||
// 无后端接口, 此为预留
|
||||
const response: any = await axiosInstance.get(`/dev${url}`, { baseURL: '' });
|
||||
if (response.state === true && response.value && response.value.length > 0) {
|
||||
return response.value; // 返回原始数据
|
||||
} else {
|
||||
console.warn('API调用失败或返回空数据,将使用静态数据。');
|
||||
return dataJson.barOptions;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取图表数据失败将使用静态数据:', error);
|
||||
return dataJson.barOptions;
|
||||
}
|
||||
// try {
|
||||
// // 无后端接口, 此为预留
|
||||
// const response: any = await axiosInstance.get(`/dev${url}`, { baseURL: '' });
|
||||
// if (response.state === true && response.value && response.value.length > 0) {
|
||||
// return response.value; // 返回原始数据
|
||||
// } else {
|
||||
// console.warn('API调用失败或返回空数据,将使用静态数据。');
|
||||
// return dataJson.barOptions;
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('获取图表数据失败将使用静态数据:', error);
|
||||
// return dataJson.barOptions;
|
||||
// }
|
||||
};
|
||||
|
||||
const BarOptionsData = computed(() => {
|
||||
return props.chartConfig.option.dataset.barOptions.map((item: unknown) =>
|
||||
new BarOption(item as unknown as Partial<BarOption>)
|
||||
@ -100,7 +98,7 @@ onMounted(() => {
|
||||
iframeApi = (iframe.contentWindow as any).g.active3d;
|
||||
isIframeReady.value = true;
|
||||
|
||||
const data = await fetchData('/map');
|
||||
const data = await fetchData('/spaceMapMock');
|
||||
props.chartConfig.option.dataset.barOptions = data;
|
||||
|
||||
} else {
|
||||
|
@ -14,6 +14,7 @@ export const selectStyleOption = {
|
||||
borderRadius: '2px',
|
||||
}
|
||||
const otherConfig = {
|
||||
secneID: '01',
|
||||
// 轮播动画
|
||||
isCarousel: false,
|
||||
color: ['#3B72E8', '#45B5E3', '#50D4A8', '#F8B55B'],
|
||||
|
@ -1,5 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="场景ID" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.secneID" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<!-- 基础配置可以复用PieCommon的配置面板 -->
|
||||
<CollapseItem name="基础配置" :expanded="true">
|
||||
<SettingItemBox name="图例">
|
||||
|
@ -5,20 +5,8 @@
|
||||
],
|
||||
"source": [
|
||||
{
|
||||
"alarmLevel": "分类一",
|
||||
"alarm_count": 94
|
||||
},
|
||||
{
|
||||
"alarmLevel": "分类3",
|
||||
"alarm_count": 4
|
||||
},
|
||||
{
|
||||
"alarmLevel": "分类2",
|
||||
"alarm_count": 30
|
||||
},
|
||||
{
|
||||
"alarmLevel": "分类4",
|
||||
"alarm_count": 40
|
||||
"alarmLevel": "数据",
|
||||
"alarm_count": 0
|
||||
}
|
||||
]
|
||||
}
|
@ -190,7 +190,7 @@ const fetchAlarmData = async ({ startTime, endTime }: { startTime: string; endTi
|
||||
};
|
||||
try {
|
||||
const res: any = await axiosInstance.get(
|
||||
`/awjt/space/getNumberByAlarmLevel`,
|
||||
`/awjt/space/getNumberByAlarmLevel/${props.chartConfig.option.secneID}`,
|
||||
{
|
||||
params: { startTime, endTime },
|
||||
responseType: 'json',
|
||||
|
@ -5,6 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
|
||||
import dataJson from './cameratree.json'
|
||||
import { chartInitConfig } from '@/settings/designSetting'
|
||||
export const option = {
|
||||
secneID: '01',
|
||||
// 摄像头id
|
||||
dataset: {
|
||||
defaultValue: '中国中车集团有限公司',
|
||||
|
@ -1,6 +1,13 @@
|
||||
<!-- eslint-disable vue/multi-word-component-names -->
|
||||
<!-- eslint-disable vue/no-mutating-props -->
|
||||
<template>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="场景ID" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.secneID" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<collapse-item name="视频" expanded>
|
||||
<setting-item-box name="源" alone>
|
||||
<!-- <setting-item name="自定义源">
|
||||
|
@ -72,7 +72,7 @@ const findParentPath = (targetKey, nodes, path = []) => {
|
||||
// 当前路径快照
|
||||
const currentPath = [...path, { key: node.key, label: node.label }]
|
||||
|
||||
console.log(node)
|
||||
// console.log(node)
|
||||
// 找到目标节点时返回完整路径(排除自身)
|
||||
if (node.key === targetKey) return [...path, { key: node.key, label: node.label }]
|
||||
|
||||
@ -528,7 +528,7 @@ const getDataSource = (newData: any) => {
|
||||
const fetchCameraTree = async () => {
|
||||
console.log('fetchCameraTree: 正在获取摄像头树数据...');
|
||||
try {
|
||||
const res = await axiosInstance.get('/awjt/api/camera/tree', { baseURL: '' ,responseType: 'json' });
|
||||
const res = await axiosInstance.get(`/awjt/api/camera/tree/${option.secneID}`, { baseURL: '', responseType: 'json' });
|
||||
console.log("API 响应数据 (Camera Tree):", res);
|
||||
if (res && res.state === true) {
|
||||
console.log("API 响应数据 (Camera Tree):", res.value);
|
||||
|
@ -22,6 +22,7 @@ export const FontStyleObject = {
|
||||
[FontStyleEnum.ITALIC]: 'italic',
|
||||
}
|
||||
export const option = {
|
||||
secneID: '04',
|
||||
dataset: dataJson,
|
||||
header: ['报警事件', '时间', '所属企业', '状态'],
|
||||
headerTextColor: '#B4B4B4',
|
||||
|
@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="场景ID" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.secneID" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="标题" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.title" type="textarea" size="small"></n-input>
|
||||
|
@ -88,11 +88,11 @@ const convertTimestampToDateTime = (timestamp: number | string) => {
|
||||
|
||||
const fetchRecentAlarms = async () => {
|
||||
try {
|
||||
const res:any = await axiosInstance.get(
|
||||
`/awjt/space/getRecentAlarms`,
|
||||
const res: any = await axiosInstance.get(
|
||||
`/awjt/space/getRecentAlarms/${option.value.secneID}`,
|
||||
{
|
||||
responseType: 'json',
|
||||
baseURL:''
|
||||
baseURL: ''
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -8,6 +8,7 @@ export const includes = ['legend']
|
||||
|
||||
// 其它配置
|
||||
const otherConfig = {
|
||||
secneID:'04',
|
||||
dateTime: {
|
||||
selectValue: 'day',
|
||||
dataset: [
|
||||
@ -36,7 +37,7 @@ const otherConfig = {
|
||||
|
||||
}
|
||||
|
||||
const option = {
|
||||
export const option = {
|
||||
...otherConfig,
|
||||
backgroundColor: 'transparent',
|
||||
legend: {
|
||||
|
@ -1,5 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="场景ID" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.secneID" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<!-- 基础配置可以复用PieCommon的配置面板 -->
|
||||
<CollapseItem name="基础配置" :expanded="true">
|
||||
<SettingItemBox name="图例">
|
||||
|
@ -239,7 +239,7 @@ function generateTimeRange(period: string): { startTime: string; endTime: string
|
||||
async function fetchAlarmData({ startTime, endTime }: { startTime: string; endTime: string }) {
|
||||
try {
|
||||
const res: any = await axiosInstance.get(
|
||||
`/awjt/space/getNumberByAlarmLevel`,
|
||||
`/awjt/space/getNumberByAlarmLevel/${props.chartConfig.option.sceneID}`,
|
||||
{
|
||||
params: { startTime, endTime }, // 请求参数
|
||||
responseType: 'json',
|
||||
|
@ -4,6 +4,7 @@ import { yushiVideoConfig } from './index'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
export const option = {
|
||||
secneID: '04',
|
||||
// 摄像头id
|
||||
dataset: {
|
||||
defaultValue: '',
|
||||
|
@ -1,6 +1,13 @@
|
||||
<!-- eslint-disable vue/multi-word-component-names -->
|
||||
<!-- eslint-disable vue/no-mutating-props -->
|
||||
<template>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="场景ID" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.secneID" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<collapse-item name="视频" expanded>
|
||||
<setting-item-box name="源" alone>
|
||||
<!-- <setting-item name="自定义源">
|
||||
|
@ -3,6 +3,7 @@ import { CreateComponentType } from '@/packages/index.d'
|
||||
import { DeviceStatusConfig } from './index'
|
||||
import dataJson from './data.json'
|
||||
export const option = {
|
||||
secneID:"",
|
||||
dataset: dataJson.source,
|
||||
header: ['所属企业', '设备类型', '设备名称'],
|
||||
headerTextColor: '#7F9DB4',
|
||||
|
@ -1,4 +1,11 @@
|
||||
<template>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="场景ID" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="option.secneID" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<div class="go-device-status-config">
|
||||
<n-form-item label="标题">
|
||||
<n-input v-model:value="option.title" />
|
||||
|
@ -4,6 +4,7 @@ import { ParkingSceneConfig } from './index'
|
||||
import dataJson from './data.json'
|
||||
|
||||
export const option = {
|
||||
secneID: "",
|
||||
dataset: dataJson.source,
|
||||
title: '场景分布概况',
|
||||
titleColor: '#eee',
|
||||
|
@ -1,5 +1,13 @@
|
||||
<template>
|
||||
<div class="go-parking-scene-config">
|
||||
|
||||
<div>
|
||||
<collapse-item name="信息" :expanded="true">
|
||||
<setting-item-box name="场景ID" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="option.secneID" type="textarea" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
<n-form-item label="标题">
|
||||
<n-input v-model:value="option.title" />
|
||||
</n-form-item>
|
||||
@ -20,11 +28,12 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { option } from './config'
|
||||
import { option as optionConfig } from './config'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||
|
||||
defineProps({
|
||||
option: {
|
||||
type: Object as PropType<typeof option>,
|
||||
type: Object as PropType<typeof optionConfig>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user