diff --git a/.env.development b/.env.development index 8988210..6da8916 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -VITE_API_BASEURL = "https://ibms-cvilux-demo-api.production.mjmtech.com.tw" +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_FORGE_BASEURL = "https://cgems.cvilux-group.com:8088/dist" \ No newline at end of file diff --git a/src/apis/asset/api.js b/src/apis/asset/api.js index 94f08e1..234d100 100644 --- a/src/apis/asset/api.js +++ b/src/apis/asset/api.js @@ -34,4 +34,6 @@ export const GET_ASSET_ELECTYPE_API = `/AssetManage/GetElecType`; export const POST_ASSET_ELECTYPE_API = `/AssetManage/SaveElecType`; export const DELETE_ASSET_ELECTYPE_API = `/AssetManage/DeleteElecType`; -export const POST_ASSET_ELEC_SETTING_API = `/AssetManage/SaveAssetSetting`; \ No newline at end of file +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 diff --git a/src/apis/asset/index.js b/src/apis/asset/index.js index e124482..24eac42 100644 --- a/src/apis/asset/index.js +++ b/src/apis/asset/index.js @@ -26,13 +26,14 @@ import { POST_ASSET_ELECTYPE_API, DELETE_ASSET_ELECTYPE_API, POST_ASSET_ELEC_SETTING_API, + POST_ASSET_MQTT_PUBLISH_API, } from "./api"; import instance from "@/util/request"; import apihandler from "@/util/apihandler"; import { object } from "yup"; export const getAssetMainList = async (building_guid) => { - const res = await instance.post(GET_ASSET_MAIN_LIST_API,{building_guid}); + const res = await instance.post(GET_ASSET_MAIN_LIST_API, { building_guid }); return apihandler(res.code, res.data, { msg: res.msg, @@ -49,12 +50,17 @@ export const deleteAssetMainItem = async (id) => { }); }; -export const postAssetMainList = async ({ id, system_key, system_value, building_guid }) => { +export const postAssetMainList = async ({ + id, + system_key, + system_value, + building_guid, +}) => { const res = await instance.post(POST_ASSET_MAIN_LIST_API, { id, system_key, system_value, - building_guid + building_guid, }); return apihandler(res.code, res.data, { @@ -241,6 +247,9 @@ export const postDeviceItem = async ({ decimals, is_bool, is_link, + show_event_switch_btn, + event_switch_on_message, + event_switch_off_message, }) => { const res = await instance.post(POST_ASSET_DEVICE_ITEM_API, { id, @@ -250,6 +259,9 @@ export const postDeviceItem = async ({ decimals, is_bool, is_link, + show_event_switch_btn, + event_switch_on_message, + event_switch_off_message, }); return apihandler(res.code, res.data, { @@ -335,3 +347,15 @@ export const postAssetElecSetting = async (formData) => { code: res.code, }); }; + +export const postMQTTpublish = async ({ Topic, Payload }) => { + const res = await instance.post(POST_ASSET_MQTT_PUBLISH_API, { + Topic, + Payload, + }); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; diff --git a/src/apis/dashboard/api.js b/src/apis/dashboard/api.js index 1d914f6..9be814d 100644 --- a/src/apis/dashboard/api.js +++ b/src/apis/dashboard/api.js @@ -10,4 +10,8 @@ export const GET_DASHBOARD_PRODUCT_HISTORY_API = `/SituationRoom/GetProductionHi export const GET_DASHBOARD_ENERGY_INFO_API = `api/dashboard/GetEnergyInfo` export const GET_DASHBOARD_ENERGY_COST_API = `api/dashboard/GetEnergyCost` -export const GET_DASHBOARD_ALARMOPERATION_INFO_API = `api/dashboard/GetAlarmOperationInfo` \ No newline at end of file +export const GET_DASHBOARD_ALARMOPERATION_INFO_API = `api/dashboard/GetAlarmOperationInfo` + +export const GET_DASHBOARD_2D3DINFO_API = `api/setting/visual/query` +export const POST_DASHBOARD_2D3DINFO_API = `api/setting/visual/update` + diff --git a/src/apis/dashboard/index.js b/src/apis/dashboard/index.js index e238c40..d578640 100644 --- a/src/apis/dashboard/index.js +++ b/src/apis/dashboard/index.js @@ -11,6 +11,8 @@ import { GET_DASHBOARD_ENERGY_INFO_API, GET_DASHBOARD_ENERGY_COST_API, GET_DASHBOARD_ALARMOPERATION_INFO_API, + GET_DASHBOARD_2D3DINFO_API, + POST_DASHBOARD_2D3DINFO_API } from "./api"; import instance from "@/util/request"; import apihandler from "@/util/apihandler"; @@ -176,3 +178,22 @@ export const getAlarmOperationInfo = async (building_guid) => { code: res.code, }); }; + +export const getDashboard2D3D = async (BuildingId) => { + const res = await instance.post(GET_DASHBOARD_2D3DINFO_API, { + BuildingId}); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; + +export const posttDashboard2D3D = async (formData) => { + const res = await instance.post(POST_DASHBOARD_2D3DINFO_API, formData); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; \ No newline at end of file diff --git a/src/config/cn.json b/src/config/cn.json index 0143d23..9d76a4a 100644 --- a/src/config/cn.json +++ b/src/config/cn.json @@ -400,9 +400,13 @@ "delete_success": "删除成功", "delete_failed": "删除失败", "mqtt_refresh": "重新设定成功", - "schema_name_required": "架构名称栏位必填" + "schema_name_required": "架构名称栏位必填", + "incorrect_format":"格式不正确", + "send_successfully":"送出成功", + "edit_successfully":"修改成功" }, "setting": { + "electricity_meter": "电表", "MQTT_parse": "MQTT 解析", "schema": "架构", "point": "点位", @@ -412,6 +416,9 @@ "number_of_decimal_places": "小数位数", "boolean_value": "布林值", "hide_point": "点位显示", + "hide_switch": "switch 功能", + "switch_on_message": "switch 开启时传送的讯息", + "switch_off_message": "switch 关闭时传送的讯息", "schema_name": "架构名称", "IoT_point_structure": "IoT点位结构", "system_point_name": "系统点位名称", diff --git a/src/config/tw.json b/src/config/tw.json index 9114167..fb9f6f0 100644 --- a/src/config/tw.json +++ b/src/config/tw.json @@ -400,9 +400,13 @@ "delete_success": "刪除成功", "delete_failed": "刪除失敗", "mqtt_refresh": "重新設定成功", - "schema_name_required": "架構名稱欄位必填" + "schema_name_required": "架構名稱欄位必填", + "incorrect_format":"格式不正確", + "send_successfully":"送出成功", + "edit_successfully":"修改成功" }, "setting": { + "electricity_meter":"電表", "MQTT_parse": "MQTT 解析", "schema": "架構", "point": "點位", @@ -412,6 +416,9 @@ "number_of_decimal_places": "小數位數", "boolean_value": "布林值", "hide_point": "點位顯示", + "hide_switch": "switch 功能", + "switch_on_message": "switch 開啟時傳送的訊息", + "switch_off_message": "switch 關閉時傳送的訊息", "schema_name": "架構名稱", "IoT_point_structure": "IoT點位結構", "system_point_name": "系統點位名稱", diff --git a/src/config/us.json b/src/config/us.json index 95f0f08..126e924 100644 --- a/src/config/us.json +++ b/src/config/us.json @@ -400,9 +400,13 @@ "delete_success": "Delete successfully", "delete_failed": "Delete failed", "mqtt_refresh": "MQTT reset successful", - "schema_name_required": "The schema name field is required" + "schema_name_required": "The schema name field is required", + "incorrect_format":"Incorrect format", + "send_successfully":"Sent successfully", + "edit_successfully":"Edited successfully" }, "setting": { + "electricity_meter": "Electricity Meter", "MQTT_parse": "MQTT Parse", "schema": "Schema", "point": "Point", @@ -412,6 +416,9 @@ "number_of_decimal_places": "Number of Decimal Places", "boolean_value": "Boolean Value", "hide_point": "Point Display", + "hide_switch": "Switch Function", + "switch_on_message": "Switch On Message", + "switch_off_message": "Switch Off Message", "schema_name": "Schema name", "IoT_point_structure": "IoT Point Structure", "system_point_name": "System Point Name", diff --git a/src/stores/useBuildingStore.js b/src/stores/useBuildingStore.js index feb0623..12e670c 100644 --- a/src/stores/useBuildingStore.js +++ b/src/stores/useBuildingStore.js @@ -2,6 +2,7 @@ import { defineStore } from "pinia"; import { ref, computed, watch } from "vue"; import { useRoute } from "vue-router"; import { getBuildings } from "@/apis/building"; +import { getDashboard2D3D } from "@/apis/dashboard"; import { getAssetFloorList, getDepartmentList } from "@/apis/asset"; const useBuildingStore = defineStore("buildingInfo", () => { @@ -11,6 +12,9 @@ const useBuildingStore = defineStore("buildingInfo", () => { const floorList = ref([]); const deptList = ref([]); const mainSubSys = ref([]); + // 控制顯示2D/3D切換與內容 + const showForgeArea = ref(true); + const previewImageExt = ref(""); // 計算屬性 const mainSys = computed(() => @@ -77,22 +81,29 @@ const useBuildingStore = defineStore("buildingInfo", () => { })) || []; }; + // 獲取2D、3D顯示與否 + const fetchDashboard2D3D = async (BuildingId) => { + const res = await getDashboard2D3D(BuildingId); + showForgeArea.value = res.data.is3DEnabled; + previewImageExt.value = res.data.previewImageExt || ""; + }; + // 清除localStorage建築物 const deleteBuilding = () => { localStorage.removeItem("CviBuildingList"); localStorage.removeItem("CviBuilding"); buildings.value = []; selectedBuilding.value = null; - } - + }; // 當 selectedBuilding 改變時,更新 floorList 和 deptList watch(selectedBuilding, async (newBuilding) => { if (newBuilding) { - localStorage.setItem("CviBuilding", JSON.stringify(newBuilding)) + localStorage.setItem("CviBuilding", JSON.stringify(newBuilding)); await Promise.all([ fetchFloorList(newBuilding.building_guid), fetchDepartmentList(), + fetchDashboard2D3D(newBuilding.building_guid), ]); } }); @@ -111,10 +122,13 @@ const useBuildingStore = defineStore("buildingInfo", () => { mainSys, subSys, selectedSystem, + showForgeArea, + previewImageExt, deleteBuilding, fetchBuildings, fetchFloorList, fetchDepartmentList, + fetchDashboard2D3D, initialize, }; }); diff --git a/src/views/AssetManagement/components/AssetTableModalLeftInfoMQTT.vue b/src/views/AssetManagement/components/AssetTableModalLeftInfoMQTT.vue index 7ae94ee..321a818 100644 --- a/src/views/AssetManagement/components/AssetTableModalLeftInfoMQTT.vue +++ b/src/views/AssetManagement/components/AssetTableModalLeftInfoMQTT.vue @@ -1,6 +1,7 @@