From 2dfc2e5297119235702b7004c1ffa009d0c67c42 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Mon, 25 Aug 2025 11:57:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B3=87=E7=94=A2=E7=AE=A1=E7=90=86=20:=20?= =?UTF-8?q?=E9=81=8E=E6=BF=BE=E7=84=A1=E6=95=88=E6=AA=94=E6=A1=88=E3=80=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B3=87=E7=94=A2=E7=B7=A8=E8=BC=AF=E5=92=8C?= =?UTF-8?q?=E5=9C=96=E8=A1=A8=E8=B3=87=E6=96=99=E4=BE=86=E6=BA=90=E7=9A=84?= =?UTF-8?q?=E8=99=95=E7=90=86=E9=82=8F=E8=BC=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssetManagement/components/AssetTable.vue | 16 +++++++++------- .../components/AssetTableModalLeftInfoGraph.vue | 4 +++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/views/AssetManagement/components/AssetTable.vue b/src/views/AssetManagement/components/AssetTable.vue index 03391b1..b2bff26 100644 --- a/src/views/AssetManagement/components/AssetTable.vue +++ b/src/views/AssetManagement/components/AssetTable.vue @@ -148,13 +148,15 @@ const edit = async (id) => { // changeParams({ ...searchParams.value, main_id: record.id }); const res = await getAssetSingle(id); if (res.isSuccess) { - res.data.oriFile = res.data.oriFile.map((file, index) => ({ - ...file, - key: index, - src: file.file_url, - name: file.orgName, - ext: file.saveName.split(".")[file.saveName.split(".").length - 1], - })); + res.data.oriFile = res.data.oriFile + .filter((file) => file.saveName) + .map((file, index) => ({ + ...file, + key: index, + src: file.file_url, + name: file.orgName, + ext: file.saveName.split(".")[file.saveName.split(".").length - 1], + })); res.data.sub_device = res.data.sub_device?.map( ({ device_number, points }) => ({ device_number, diff --git a/src/views/AssetManagement/components/AssetTableModalLeftInfoGraph.vue b/src/views/AssetManagement/components/AssetTableModalLeftInfoGraph.vue index 55ccf75..95729e9 100644 --- a/src/views/AssetManagement/components/AssetTableModalLeftInfoGraph.vue +++ b/src/views/AssetManagement/components/AssetTableModalLeftInfoGraph.vue @@ -32,7 +32,9 @@ const getMenuData = async () => { const getData = async (id) => { const res = await getGraphData(id); if (res.isSuccess) { - dataSource.value = res.data.map((d) => ({ ...d, key: d.id })); + dataSource.value = res.data + .filter((d) => d.oriSavName) + .map((d) => ({ ...d, key: d.id })); } }; From 64f35db51b598dc04cb0eb790f99e56827eb9aa5 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Fri, 29 Aug 2025 10:18:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=92=B0=E5=A2=83?= =?UTF-8?q?=E8=AE=8A=E6=95=B8=E8=A8=AD=E5=AE=9A=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=20MQTT=20=E7=9B=B8=E9=97=9C=20API=EF=BC=8C=E4=B8=A6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=B8=BD=E9=83=A8=E5=B8=B3=E6=88=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=88=9D=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.production | 2 +- .env.staging | 2 +- src/apis/asset/api.js | 4 +- src/apis/asset/index.js | 20 ++ src/apis/headquarters/api.js | 2 + src/apis/headquarters/index.js | 20 ++ src/config/cn.json | 2 + src/config/tw.json | 2 + src/config/us.json | 4 +- src/hooks/forge/useForgeHeatmap.js | 1 + src/router/index.js | 6 + src/views/AssetManagement/AssetManagement.vue | 13 +- .../AssetTableModalLeftInfoMQTT.vue | 209 +++++++++++------- .../accountManagement/components/Account.vue | 7 +- .../HeadquartersAccountManagement.vue | 123 +++++++++++ src/views/system/System.vue | 2 +- 17 files changed, 332 insertions(+), 89 deletions(-) create mode 100644 src/views/headquarters/HeadquartersAccountManagement.vue diff --git a/.env.development b/.env.development index 6da8916..2c88424 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ VITE_API_BASEURL = "https://ibms-cvilux-api.production.mjmtech.com.tw" VITE_FILE_API_BASEURL = "https://cgems.cvilux-group.com:8088" -VITE_MQTT_BASEURL = "wss://mqttwss.mjm-staging.developers-homelab.net" +# VITE_MQTT_BASEURL = "wss://mqttwss.mjm-staging.developers-homelab.net" VITE_FORGE_BASEURL = "https://cgems.cvilux-group.com:8088/dist" \ No newline at end of file diff --git a/.env.production b/.env.production index 41e8aa1..009679a 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,4 @@ VITE_API_BASEURL = "https://ibms-cvilux-api.production.mjmtech.com.tw" VITE_FILE_API_BASEURL = "https://cgems.cvilux-group.com:8088" -VITE_MQTT_BASEURL = "wss://mqttwss.mjm-staging.developers-homelab.net" +# VITE_MQTT_BASEURL = "wss://mqttwss.mjm-staging.developers-homelab.net" # VITE_FORGE_BASEURL = "https://cgems.cvilux-group.com:8088/dist" \ No newline at end of file diff --git a/.env.staging b/.env.staging index 3e57378..5c16c27 100644 --- a/.env.staging +++ b/.env.staging @@ -1,3 +1,3 @@ VITE_API_BASEURL = "https://ibms-cvilux-demo-api.production.mjmtech.com.tw" VITE_FILE_API_BASEURL = "https://cgems.cvilux-group.com:8088" -VITE_MQTT_BASEURL = "wss://mqttwss.mjm-staging.developers-homelab.net" \ No newline at end of file +# VITE_MQTT_BASEURL = "wss://mqttwss.mjm-staging.developers-homelab.net" \ No newline at end of file diff --git a/src/apis/asset/api.js b/src/apis/asset/api.js index 234d100..87766aa 100644 --- a/src/apis/asset/api.js +++ b/src/apis/asset/api.js @@ -36,4 +36,6 @@ export const DELETE_ASSET_ELECTYPE_API = `/AssetManage/DeleteElecType`; export const POST_ASSET_ELEC_SETTING_API = `/AssetManage/SaveAssetSetting`; -export const POST_ASSET_MQTT_PUBLISH_API = `/api/mqtt/publish`; \ No newline at end of file +export const POST_ASSET_MQTT_PUBLISH_API = `/api/mqtt/publish`; +export const POST_MQTT_TOPIC_API = `api/Device/MQTTTopicTest`; +export const POST_MQTT_TOPIC_STOP_API = `api/Device/MQTTTopicTestStop`; \ No newline at end of file diff --git a/src/apis/asset/index.js b/src/apis/asset/index.js index 24eac42..1c8bfbe 100644 --- a/src/apis/asset/index.js +++ b/src/apis/asset/index.js @@ -27,6 +27,8 @@ import { DELETE_ASSET_ELECTYPE_API, POST_ASSET_ELEC_SETTING_API, POST_ASSET_MQTT_PUBLISH_API, + POST_MQTT_TOPIC_API, + POST_MQTT_TOPIC_STOP_API, } from "./api"; import instance from "@/util/request"; import apihandler from "@/util/apihandler"; @@ -359,3 +361,21 @@ export const postMQTTpublish = async ({ Topic, Payload }) => { code: res.code, }); }; + +export const postMqttTopic = async ({ iotTag, Topic }) => { + const res = await instance.post(POST_MQTT_TOPIC_API, { iotTag, Topic }); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; + +export const postMqttTopicStop = async ({ iotTag, Topic }) => { + const res = await instance.post(POST_MQTT_TOPIC_STOP_API, { iotTag, Topic }); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; diff --git a/src/apis/headquarters/api.js b/src/apis/headquarters/api.js index 517ce4f..351ef49 100644 --- a/src/apis/headquarters/api.js +++ b/src/apis/headquarters/api.js @@ -3,4 +3,6 @@ export const GET_SITES_SYSTEM_ENERGY_COST_RANK_API = `/api/energy-manager/all-si export const GET_SITES_SYSTEM_ENERGY_COST_TREND_API = `/api/energy-manager/all-site/energy-cost-trend`; export const GET_SITES_SYSTEM_ENERGY_COST_GROWTH_API = `/api/energy-manager/all-site/energy-cost-growth-rate`; +export const GET_USER_API = `/api/user/user-list`; + diff --git a/src/apis/headquarters/index.js b/src/apis/headquarters/index.js index 8cd7485..625bd35 100644 --- a/src/apis/headquarters/index.js +++ b/src/apis/headquarters/index.js @@ -3,6 +3,7 @@ import { GET_SITES_SYSTEM_ENERGY_COST_RANK_API, GET_SITES_SYSTEM_ENERGY_COST_TREND_API, GET_SITES_SYSTEM_ENERGY_COST_GROWTH_API, + GET_USER_API, } from "./api"; import instance from "@/util/request"; import apihandler from "@/util/apihandler"; @@ -37,6 +38,25 @@ export const getSystemEnergyCostTrend = async (building_ids) => { export const getSystemEnergyCostGrowth = async (building_ids) => { const res = await instance.get(GET_SITES_SYSTEM_ENERGY_COST_GROWTH_API, building_ids); + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +} + +export const getUserList = async (params = {}) => { + const { + page = 1, + pageSize = 9999999 + } = params; + + const requestData = { + Page: page, + PageSize: pageSize + }; + + const res = await instance.post(GET_USER_API, requestData); + return apihandler(res.code, res.data, { msg: res.msg, code: res.code, diff --git a/src/config/cn.json b/src/config/cn.json index 2a661ef..51672fa 100644 --- a/src/config/cn.json +++ b/src/config/cn.json @@ -23,6 +23,7 @@ "graphManagement": "图资管理", "AssetManagement": "资产管理", "accountManagement": "帐号管理", + "UserManagement": "帐号管理", "Setting": "系统设定", "energy_analysis": "能源分析", "consumption_report": "用电报表", @@ -430,6 +431,7 @@ }, "msg": { "sure_to_delete": "是否确认删除该项目?", + "is_headquarters": "该帐号为总部帐号,是否仍要删除该项目?", "sure_to_delete_permanent": "是否确认永久删除该项目?", "delete_success": "删除成功", "delete_failed": "删除失败", diff --git a/src/config/tw.json b/src/config/tw.json index d07a7bb..7d3ba29 100644 --- a/src/config/tw.json +++ b/src/config/tw.json @@ -23,6 +23,7 @@ "graphManagement": "圖資管理", "AssetManagement": "資產管理", "accountManagement": "帳號管理", + "UserManagement": "帳號管理", "Setting": "系統設定", "energy_analysis": "能耗分析", "consumption_report": "用電報表", @@ -430,6 +431,7 @@ }, "msg": { "sure_to_delete": "是否確認刪除該項目?", + "is_headquarters": "該帳號為總部帳號,是否仍要刪除該項目?", "sure_to_delete_permanent": "是否確認永久刪除該項目?", "delete_success": "刪除成功", "delete_failed": "刪除失敗", diff --git a/src/config/us.json b/src/config/us.json index 371f346..41a6b87 100644 --- a/src/config/us.json +++ b/src/config/us.json @@ -23,8 +23,9 @@ "graphManagement": "Graph", "AssetManagement": "Devices", "accountManagement": "Account", + "UserManagement": "Account", "Setting": "Setting", - "energy_analysis": "Energy Analysis", + "energy_analysis": "Energy Analysis", "consumption_report": "Consumption Report", "chart_analysis": "Chart Analysis", "historical_curve": "Historical Curve", @@ -430,6 +431,7 @@ }, "msg": { "sure_to_delete": "Are you sure to delete this item?", + "is_headquarters": "This account is a headquarters account. Are you sure you want to delete this item?", "sure_to_delete_permanent": "Are you sure you want to permanently delete this item?", "delete_success": "Delete successfully", "delete_failed": "Delete failed", diff --git a/src/hooks/forge/useForgeHeatmap.js b/src/hooks/forge/useForgeHeatmap.js index 7ae588c..81e159d 100644 --- a/src/hooks/forge/useForgeHeatmap.js +++ b/src/hooks/forge/useForgeHeatmap.js @@ -18,6 +18,7 @@ export default function useForgeHeatmap() { //create the heatmap function getSensorValue(device, sensorType, pointData) { + console.log("heatmap", device, realtimeData.value); const dev = realtimeData.value.find( ({ device_number }) => device_number === device.id ); diff --git a/src/router/index.js b/src/router/index.js index 5558e27..f1c3588 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -10,6 +10,7 @@ import ProductSetting from "@/views/productSetting/ProductSetting.vue"; import EnergyManagement from "@/views/energyManagement/EnergyManagement.vue"; import SettingManagement from "@/views/setting/SettingManagement.vue"; import HeadquartersManagement from "@/views/headquarters/HeadquartersManagement.vue"; +import UserManagement from "@/views/headquarters/HeadquartersAccountManagement.vue"; import Login from "@/views/login/Login.vue"; import useUserInfoStore from "@/stores/useUserInfoStore"; import useBuildingStore from "@/stores/useBuildingStore"; @@ -97,6 +98,11 @@ const router = createRouter({ name: "headquarters", component: HeadquartersManagement, }, + { + path: "/UserManagement", + name: "UserManagement", + component: UserManagement, + }, { path: "/mytestfile/mjm", name: "mytestfile", diff --git a/src/views/AssetManagement/AssetManagement.vue b/src/views/AssetManagement/AssetManagement.vue index acf2863..6fcc882 100644 --- a/src/views/AssetManagement/AssetManagement.vue +++ b/src/views/AssetManagement/AssetManagement.vue @@ -12,13 +12,23 @@ const { searchParams, changeParams } = useSearchParam(); const companyOptions = ref([]); const iotSchemaOptions = ref([]); const elecTypeOptions = ref([]); +const iotSchemaTag = ref(""); // 儲存 IOT Schema 的 tagIoT const getCompany = async () => { const res = await getOperationCompanyList(); companyOptions.value = res.data.map((d) => ({ ...d, key: d.id })); }; const getIOTSchemaOptions = async (id) => { const res = await getIOTSchema(Number(id)); - iotSchemaOptions.value = res.data.map((d) => ({ ...d, key: d.id })); + const data = res.data || []; + + iotSchemaOptions.value = data.map((d) => ({ ...d, key: d.id })); + + // 取出第一筆的 tagIoT,提供給最深層元件使用 + if (data.length > 0 && data[0].tagIoT) { + iotSchemaTag.value = data[0].tagIoT; + } else { + iotSchemaTag.value = ""; + } }; const getElecType = async () => { const res = await getElecTypeList(); @@ -51,6 +61,7 @@ provide("asset_modal_options", { elecTypeOptions, departmentList, floors, + iotSchemaTag }); diff --git a/src/views/AssetManagement/components/AssetTableModalLeftInfoMQTT.vue b/src/views/AssetManagement/components/AssetTableModalLeftInfoMQTT.vue index c481bbd..a7c79eb 100644 --- a/src/views/AssetManagement/components/AssetTableModalLeftInfoMQTT.vue +++ b/src/views/AssetManagement/components/AssetTableModalLeftInfoMQTT.vue @@ -1,98 +1,122 @@ + + + + diff --git a/src/views/system/System.vue b/src/views/system/System.vue index f8441ff..f528f77 100644 --- a/src/views/system/System.vue +++ b/src/views/system/System.vue @@ -191,7 +191,7 @@ const getAllDeviceRealtime = async () => { const res = await getSystemRealTime( subscribeData.value.map((d) => d.device_number) ); - console.log(res.data); + console.log("realtimeData",res.data); realtimeData.value = res.data; }; await fetchData(); // 立即執行一次