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 @@ + + + + {{ $t("accountManagement.account_title") }} + + + + + + + + + {{ $t("button.search") }} + + + {{ $t("button.reset") }} + + + + + {{ index + 1 }} + + getUser(record.userinfo_guid)" + > + {{ $t("button.edit") }} + + + + {{ record[column.key] }} + + + + + + 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(); // 立即執行一次