From 8d3e9c9480ebc4ae95bdb5854de80d068c467343 Mon Sep 17 00:00:00 2001
From: wangrong <wangrong@shsening.com>
Date: 星期二, 29 九月 2026 22:45:32 +0800
Subject: [PATCH] Merge branch 'fix-home-logo'
---
src/modules/operation/views/wastesale.vue | 4
src/modules/report/views/screen/overview.vue | 22 +++---
src/modules/report/views/screen/participation.vue | 2
src/modules/report/views/screen/carbon.vue | 14 ++--
public/bak.png | 0
.env | 2
src/modules/maps/hooks/use-map.ts | 46 +++++++++++++++
src/modules/report/components/screen-map-panel.vue | 45 ++++++++++++--
src/modules/report/views/screen/map.vue | 20 +++---
public/logo.png | 0
10 files changed, 115 insertions(+), 40 deletions(-)
diff --git a/.env b/.env
index 367cecc..87a62d9 100644
--- a/.env
+++ b/.env
@@ -1,5 +1,5 @@
# 搴旂敤鍚嶇О
-VITE_NAME = " WOMP "
+VITE_NAME = " 鏃犲簾鏍″洯 "
# 缃戠粶瓒呮椂璇锋眰鏃堕棿
VITE_TIMEOUT = 30000
\ No newline at end of file
diff --git a/public/bak.png b/public/bak.png
new file mode 100644
index 0000000..a75c618
--- /dev/null
+++ b/public/bak.png
Binary files differ
diff --git a/public/logo.png b/public/logo.png
index a75c618..b05b6d0 100644
--- a/public/logo.png
+++ b/public/logo.png
Binary files differ
diff --git a/src/modules/maps/hooks/use-map.ts b/src/modules/maps/hooks/use-map.ts
index 5f91ca5..645d2d6 100644
--- a/src/modules/maps/hooks/use-map.ts
+++ b/src/modules/maps/hooks/use-map.ts
@@ -4,6 +4,52 @@
export const MAP_TK = '51915011aa0997aa2ddd7e38504fa8bc';
export const MAP_LOAD = { v: '4.0', tk: MAP_TK };
export const DEFAULT_CENTER: LngLat = [121.280637, 32.125178];
+export const DEFAULT_ZOOM = 16;
+export const MAP_ZOOM_KEY = 'map.zoomlevel';
+export const MAP_COORD_KEY = 'map.coordinates';
+
+function paramText(raw: unknown): string {
+ if (raw == null) return '';
+ if (typeof raw === 'string' || typeof raw === 'number') return String(raw).trim();
+ if (Array.isArray(raw)) return raw.map(e => String(e).trim()).join(',');
+ return '';
+}
+
+export function parseMapZoom(raw: unknown, fallback = DEFAULT_ZOOM) {
+ const n = Number(paramText(raw));
+ return Number.isFinite(n) && n > 0 ? n : fallback;
+}
+
+export function parseMapCenter(raw: unknown, fallback: LngLat = DEFAULT_CENTER): LngLat {
+ const text = paramText(raw);
+ const parts = text.split(/[,锛宂/).map(s => Number(s.trim()));
+ if (parts.length >= 2 && Number.isFinite(parts[0]) && Number.isFinite(parts[1])) {
+ return [parts[0], parts[1]];
+ }
+ return fallback;
+}
+
+/** 浠� base_sys_param 璇诲彇瀛︽牎鍦板浘榛樿瑙嗚锛歮ap.zoomlevel銆乵ap.coordinates锛坙on,lat锛� */
+export async function loadMapView(service: any): Promise<{ center: LngLat; zoom: number }> {
+ const read = async (key: string) => {
+ try {
+ if (service?.base?.sys?.param?.stringbykey) {
+ return await service.base.sys.param.stringbykey({ key });
+ }
+ return await service.request({
+ url: 'admin/base/sys/param/stringbykey',
+ params: { key }
+ });
+ } catch {
+ return '';
+ }
+ };
+ const [zoomRaw, coordRaw] = await Promise.all([read(MAP_ZOOM_KEY), read(MAP_COORD_KEY)]);
+ return {
+ center: parseMapCenter(coordRaw),
+ zoom: parseMapZoom(zoomRaw)
+ };
+}
export function pinIcon(color: string) {
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 0 28 40"><path fill="${color}" stroke="#fff" stroke-width="1.5" d="M14 1C7.4 1 2 6.4 2 13c0 8.8 12 25 12 25s12-16.2 12-25C26 6.4 20.6 1 14 1z"/><circle cx="14" cy="13" r="5" fill="#fff"/></svg>`;
diff --git a/src/modules/operation/views/wastesale.vue b/src/modules/operation/views/wastesale.vue
index 83867a0..08c37d7 100644
--- a/src/modules/operation/views/wastesale.vue
+++ b/src/modules/operation/views/wastesale.vue
@@ -139,7 +139,7 @@
required: true
},
{
- label: t('閲嶉噺'),
+ label: t('閲嶉噺(kg)'),
prop: "weight",
hook: "number",
component: {
@@ -233,7 +233,7 @@
sortable: "custom",
component: { name: "cl-date-text" }
},
- { label: t('閲嶉噺'), prop: "weight", minWidth: 140, sortable: "custom" },
+ { label: t('閲嶉噺(kg)'), prop: "weight", minWidth: 140, sortable: "custom" },
{ label: t('鍗曚环'), prop: "unitPrice", minWidth: 140, sortable: "custom" },
{ label: t('鎬讳环'), prop: "totalPrice", minWidth: 140, sortable: "custom" },
{
diff --git a/src/modules/report/components/screen-map-panel.vue b/src/modules/report/components/screen-map-panel.vue
index b86dd28..4d72cd2 100755
--- a/src/modules/report/components/screen-map-panel.vue
+++ b/src/modules/report/components/screen-map-panel.vue
@@ -11,9 +11,16 @@
</div>
</div>
- <!-- 鍦板浘涓讳綋 -->
+ <!-- 鍦板浘涓讳綋锛氱瓑鍙傛暟灏辩华鍐嶅垱寤猴紝閬垮厤澶╁湴鍥惧彧鍦ㄥ垵濮嬪寲鏃跺悆 center/zoom -->
<div class="map-panel__map">
- <tdt-map :center="center" :zoom="zoom" :controls="controls" :loadConfig="MAP_LOAD">
+ <tdt-map
+ v-if="viewReady"
+ :center="center"
+ :zoom="zoom"
+ :controls="controls"
+ :loadConfig="MAP_LOAD"
+ @init="onMapInit"
+ >
<tdt-marker
v-for="item in list"
:key="keyOf(item)"
@@ -40,12 +47,15 @@
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { TdtMap, TdtMarker, type LngLat } from 'vue-tianditu2';
+import { useCool } from '/@/cool';
import {
DEFAULT_CENTER,
+ DEFAULT_ZOOM,
MAP_LOAD,
SORTER_ICON,
VEHICLE_ICON,
formatTime,
+ loadMapView,
siteIcon,
useMapsApi
} from '../../maps/hooks/use-map';
@@ -97,12 +107,14 @@
}
};
+const { service } = useCool();
const api = useMapsApi();
const layer = ref<LayerKey>('site');
const list = ref<any[]>([]);
const center = ref<LngLat>(DEFAULT_CENTER);
-const zoom = ref(12);
+const zoom = ref(DEFAULT_ZOOM);
+const viewReady = ref(false);
const lastUpdate = ref('');
const controls = ['Zoom', 'Scale'];
@@ -131,14 +143,29 @@
return cfg.value.icon(item);
}
+function applyView(map: any) {
+ const [lon, lat] = center.value;
+ if (!map || !Number.isFinite(lon) || !Number.isFinite(lat)) return;
+ const TMap = (window as any).T;
+ const lnglat = TMap?.LngLat ? new TMap.LngLat(lon, lat) : [lon, lat];
+ if (typeof map.centerAndZoom === 'function') {
+ map.centerAndZoom(lnglat, zoom.value);
+ } else {
+ map.panTo?.(lnglat);
+ map.setZoom?.(zoom.value);
+ }
+ map.checkResize?.();
+}
+
+function onMapInit(map: any) {
+ applyView(map);
+ window.setTimeout(() => applyView(map), 200);
+}
+
async function load() {
const res = await cfg.value.load();
list.value = Array.isArray(res) ? res : [];
lastUpdate.value = formatTime(new Date());
- if (list.value[0]) {
- center.value = pos(list.value[0]);
- zoom.value = 13;
- }
}
// 杞﹁締 / 鍒嗘嫞鍛樹负瀹炴椂浣嶇疆锛�30s 杞锛涚珯鐐规槸闈欐�佸彴璐︼紝涓嶈疆璇�
@@ -162,6 +189,10 @@
});
onMounted(async () => {
+ const view = await loadMapView(service);
+ center.value = view.center;
+ zoom.value = view.zoom;
+ viewReady.value = true;
await load();
startPolling();
});
diff --git a/src/modules/report/views/screen/carbon.vue b/src/modules/report/views/screen/carbon.vue
index 17e6a2e..09763ed 100644
--- a/src/modules/report/views/screen/carbon.vue
+++ b/src/modules/report/views/screen/carbon.vue
@@ -1,6 +1,6 @@
<template>
<div class="screen-page">
- <div class="kpi-grid" style="--kpi-cols: 5">
+ <div class="kpi-grid" style="--kpi-cols: 3">
<kpi-card v-for="item in kpis" :key="item.label" v-bind="item" />
</div>
@@ -58,11 +58,9 @@
);
const kpis = computed(() => [
- { field: 'kpis.totalCarbonTon', label: '绱纰冲噺鎺�', value: data.value.kpis.totalCarbonTon, suffix: '鍚–O鈧俥', fixed: 1 },
- { field: 'kpis.periodCarbonTon', label: `${rangeLabel.value}纰冲噺鎺抈, value: data.value.kpis.periodCarbonTon, suffix: '鍚–O鈧俥', fixed: 2 },
- { field: 'kpis.totalWeightTon', label: '绱璧勬簮鍥炴敹', value: data.value.kpis.totalWeightTon, suffix: '鍚�', fixed: 1 },
- { field: 'kpis.totalParticipants', label: '绱鍙備笌甯堢敓', value: data.value.kpis.totalParticipants, suffix: '浜�', fixed: 0 },
- { field: 'kpis.greenActions', label: '绱鐜繚琛屼负', value: data.value.kpis.greenActions, suffix: '娆�', fixed: 0 }
+ { field: 'kpis.periodWeightTon', label: `${rangeLabel.value}璧勬簮鍥炴敹`, value: data.value.kpis.periodWeightTon, suffix: '鍚�', fixed: 2, hint: '褰撳墠鏃堕棿鑼冨洿' },
+ { field: 'kpis.newParticipants', label: `${rangeLabel.value}鍙備笌甯堢敓`, value: data.value.kpis.newParticipants, suffix: '浜�', fixed: 0, hint: '鍖洪棿鍐呭嚭鐜拌繃鐨勫幓閲嶇敤鎴�' },
+ { field: 'kpis.greenActions', label: `${rangeLabel.value}鐜繚琛屼负`, value: data.value.kpis.greenActions, suffix: '娆�', fixed: 0, hint: '鍖洪棿鍐呭凡瀹屾垚璁㈠崟鏁�' }
]);
const carbonTrendDemo = computed(() =>
@@ -81,7 +79,7 @@
},
yAxis: {
type: 'value',
- name: '鍚–O鈧俥',
+ name: 'tCO鈧俥',
nameTextStyle: { color: mutedColor.value },
splitLine: { lineStyle: { color: splitColor.value, type: 'dashed' } },
axisLabel: { color: mutedColor.value },
@@ -112,7 +110,7 @@
},
yAxis: {
type: 'value',
- name: '鍚–O鈧俥',
+ name: 'tCO鈧俥',
nameTextStyle: { color: mutedColor.value },
splitLine: { lineStyle: { color: splitColor.value, type: 'dashed' } },
axisLabel: { color: mutedColor.value },
diff --git a/src/modules/report/views/screen/map.vue b/src/modules/report/views/screen/map.vue
index 213582e..669366f 100755
--- a/src/modules/report/views/screen/map.vue
+++ b/src/modules/report/views/screen/map.vue
@@ -97,21 +97,21 @@
const itemMetric = ref<'weight' | 'value' | 'carbon'>('weight');
const mixOptions = [
- { label: '閲嶉噺', value: 'weight' },
- { label: '浠峰��', value: 'value' },
- { label: '鏁伴噺', value: 'count' }
+ { label: '閲嶉噺(kg)', value: 'weight' },
+ { label: '浠峰��(鍏�)', value: 'value' },
+ { label: '璁℃暟(娆�)', value: 'count' }
];
const trendOptions = [
- { label: '閲嶉噺', value: 'weight' },
- { label: '浠峰��', value: 'value' },
- { label: '纰冲噺鎺�', value: 'carbon' }
+ { label: '閲嶉噺(kg)', value: 'weight' },
+ { label: '浠峰��(鍏�)', value: 'value' },
+ { label: '纰冲噺鎺�(kgCO鈧俥)', value: 'carbon' }
];
const itemOptions = [
- { label: '閲嶉噺', value: 'weight' },
- { label: '浠峰��', value: 'value' },
- { label: '纰冲噺鎺�', value: 'carbon' }
+ { label: '閲嶉噺(kg)', value: 'weight' },
+ { label: '浠峰��(鍏�)', value: 'value' },
+ { label: '纰冲噺鎺�(kgCO鈧俥)', value: 'carbon' }
];
const rangeLabel = computed(
@@ -123,7 +123,7 @@
{ field: 'kpis.periodWeightTon', label: `${rangeLabel.value}鍥炴敹閲廯, value: data.value.kpis.periodWeightTon, suffix: '鍚�', fixed: 2 },
{ field: 'kpis.resourceRate', label: '璧勬簮鍖栫巼', value: data.value.kpis.resourceRate, suffix: '%', fixed: 1 },
{ field: 'kpis.periodValue', label: '鍥炴敹浠峰��', value: data.value.kpis.periodValue, suffix: '鍏�', fixed: 0 },
- { field: 'kpis.periodCarbonTon', label: '纰冲噺鎺�', value: data.value.kpis.periodCarbonTon, suffix: '鍚–O鈧俥', fixed: 2 },
+ { field: 'kpis.periodCarbonTon', label: '纰冲噺鎺�(tCO鈧俥)', value: data.value.kpis.periodCarbonTon, suffix: 'tCO鈧俥', fixed: 2 },
{ field: 'kpis.totalWeightTon', label: '绱鍥炴敹閲�', value: data.value.kpis.totalWeightTon, suffix: '鍚�', fixed: 1 },
{ field: 'kpis.totalParticipants', label: '绱鍙備笌浜烘暟', value: data.value.kpis.totalParticipants, suffix: '浜�', fixed: 0 },
{ field: 'kpis.totalPoints', label: '绱纰崇Н鍒�', value: data.value.kpis.totalPoints, suffix: '鍒�', fixed: 0 }
diff --git a/src/modules/report/views/screen/overview.vue b/src/modules/report/views/screen/overview.vue
index 9e201e3..87601a2 100644
--- a/src/modules/report/views/screen/overview.vue
+++ b/src/modules/report/views/screen/overview.vue
@@ -63,15 +63,15 @@
const trendMetric = ref<'weight' | 'value' | 'carbon'>('weight');
const mixOptions = [
- { label: '閲嶉噺', value: 'weight' },
- { label: '浠峰��', value: 'value' },
- { label: '鏁伴噺', value: 'count' }
+ { label: '閲嶉噺(kg)', value: 'weight' },
+ { label: '浠峰��(鍏�)', value: 'value' },
+ { label: '璁℃暟(娆�)', value: 'count' }
];
const trendOptions = [
- { label: '閲嶉噺', value: 'weight' },
- { label: '浠峰��', value: 'value' },
- { label: '纰冲噺鎺�', value: 'carbon' }
+ { label: '閲嶉噺(kg)', value: 'weight' },
+ { label: '浠峰��(鍏�)', value: 'value' },
+ { label: '纰冲噺鎺�(kgCO鈧俥)', value: 'carbon' }
];
const rangeLabel = computed(
@@ -79,13 +79,13 @@
);
const kpis = computed(() => [
- { field: 'kpis.periodWeightTon', label: `${rangeLabel.value}鍥炴敹閲廯, value: data.value.kpis.periodWeightTon, suffix: '鍚�', fixed: 2, hint: '褰撳墠鏃堕棿鑼冨洿' },
+ { field: 'kpis.periodWeightTon', label: `${rangeLabel.value}鍥炴敹閲廯, value: data.value.kpis.periodWeightTon, suffix: 't', fixed: 2, hint: '褰撳墠鏃堕棿鑼冨洿' },
{ field: 'kpis.resourceRate', label: '璧勬簮鍖栫巼', value: data.value.kpis.resourceRate, suffix: '%', fixed: 1, hint: '鍙洖鏀剁墿閲嶉噺/鎬婚噸閲忥紝涓嶅惈澶т欢' },
{ field: 'kpis.periodValue', label: '鍥炴敹浠峰��', value: data.value.kpis.periodValue, suffix: '鍏�', fixed: 0, hint: '鏃ヨ〃浼扮畻閿�鍞' },
- { field: 'kpis.periodCarbonTon', label: '纰冲噺鎺�', value: data.value.kpis.periodCarbonTon, suffix: '鍚–O鈧俥', fixed: 2, hint: '鍒嗙被閲嶉噺 脳 纰冲噺鍥犳暟' },
- { field: 'kpis.totalWeightTon', label: '绱鍥炴敹閲�', value: data.value.kpis.totalWeightTon, suffix: '鍚�', fixed: 1, hint: '涓婄嚎浠ユ潵绱' },
- { field: 'kpis.totalParticipants', label: '绱鍙備笌浜烘暟', value: data.value.kpis.totalParticipants, suffix: '浜�', fixed: 0, hint: '鍘婚噸鏍″洯鐢ㄦ埛' },
- { field: 'kpis.totalPoints', label: '绱纰崇Н鍒�', value: data.value.kpis.totalPoints, suffix: '鍒�', fixed: 0, hint: '璐︽埛浣欓鍚堣' }
+ { field: 'kpis.periodCarbonTon', label: '纰冲噺鎺�', value: data.value.kpis.periodCarbonTon, suffix: 'tCO鈧俥', fixed: 2, hint: '鍒嗙被閲嶉噺 脳 纰冲噺鍥犳暟' },
+ { field: 'kpis.totalWeightTon', label: '绱鍥炴敹閲�', value: data.value.kpis.totalWeightTon, suffix: 't', fixed: 1, hint: '涓婄嚎浠ユ潵绱' },
+ { field: 'kpis.totalPoints', label: '绱纰崇Н鍒�', value: data.value.kpis.totalPoints, suffix: '鍒�', fixed: 0, hint: '璐︽埛浣欓鍚堣' },
+ { field: 'kpis.totalParticipants', label: '绱鍙備笌浜烘暟', value: data.value.kpis.totalParticipants, suffix: '浜�', fixed: 0, hint: '鍘婚噸鏍″洯鐢ㄦ埛' }
]);
const mixOption = computed(() => ({
diff --git a/src/modules/report/views/screen/participation.vue b/src/modules/report/views/screen/participation.vue
index 270153c..d72a047 100644
--- a/src/modules/report/views/screen/participation.vue
+++ b/src/modules/report/views/screen/participation.vue
@@ -96,7 +96,7 @@
{ label: '鍥炴敹閲嶉噺', value: 'weight' },
{ label: '浜哄潎鍥炴敹閲�', value: 'weightPerCapita' },
{ label: '浜哄潎绉垎', value: 'pointPerCapita' },
- { label: '纰冲噺鎺�', value: 'carbon' }
+ { label: '纰冲噺鎺�(kgCO鈧俥)', value: 'carbon' }
];
const rangeLabel = computed(
--
Gitblit v1.9.1