diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b3ecca1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,123 @@ +# Node.js +node_modules +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* +.npm +.yarn +.pnp +.pnp.js + +# Build outputs +dist +dist-ssr +build +*.local + +# Environment files +.env +.env.local +.env.development +.env.test +.env.production +.env.*.local + +# Editor and IDE +.vscode +.idea +*.swp +*.swo +*~ +.DS_Store +Thumbs.db + +# Git +.git +.gitignore +.gitattributes + +# Documentation +README.md +CHANGELOG.md +LICENSE +*.md + +# Testing +coverage +.nyc_output +test-results +junit.xml + +# Docker related +Dockerfile* +.dockerignore +docker-compose*.yml +.docker + +# Scripts (開發用腳本,但保留 docker- 開頭的文件) +Scripts/* +*.bat +*.sh +!Scripts/docker-* +!Scripts/docker-*.sh + +# Logs +logs +*.log + +# Temporary files +tmp +temp +.tmp + +# Cache +.cache +.parcel-cache +.vite + +# OS generated files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# ESLint cache +.eslintcache + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c903013 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ + +# 使用 Node.js 作為基礎映像 +FROM node:18-slim AS builder + +# git +RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* + +# 設定工作目錄 +WORKDIR /app + +# 複製 package.json 和 package-lock.json (或 yarn.lock) 到工作目錄 +COPY package*.json ./ + +# 安裝依賴 +RUN npm install --legacy-peer-deps + +# 額外補上 rollup binary (避免 npm optional bug) +RUN npm install @rollup/rollup-linux-x64-gnu --force + +# 複製專案原始碼 +COPY . . + +# 構建前端應用 +RUN npm run build + +# 使用一個更小的映像來提供靜態文件 (例如 Nginx) +FROM nginx:alpine + +# 將構建好的檔案複製到 Nginx 預設目錄 +COPY --from=builder /app/dist /usr/share/nginx/html + +# (可選) 複製自定義 Nginx 設定檔 +# COPY nginx.conf /etc/nginx/conf.d/default.conf + +# 複製 entrypoint 腳本 并轉成 LF 及 賦予執行權限 +COPY Scripts/docker-entrypoint.sh /docker-entrypoint.sh +RUN sed -i 's/\r$//' /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh + +# 暴露 Nginx 預設的 80 端口 +EXPOSE 80 + +# 啟動 Nginx +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/Scripts/.env b/Scripts/.env new file mode 100644 index 0000000..4f11cb3 --- /dev/null +++ b/Scripts/.env @@ -0,0 +1,20 @@ +# Project +PROJ_NAME=proj_bims_empower + +# Network 網路環境 +NET_TRAEFIK=net-traefik_svc + +# Image: org/name +IMAGE_PROJ_NAME=proj_bims_empower +IMAGE_NAME=empower-front +TAG_VERSION=0.1.11 + +# Remote +REMOTE_URL=harbor.mjm-staging.developers-homelab.net + +# ------------------------------------------------------------------------------ +# Basic 基本配置 + +HOST_DOMAIN=ibms.mjmtech.com.tw +CUSTOMER_ID=empower1 +WEB_TITLE=新創賦能 diff --git a/Scripts/11.build-image.bat b/Scripts/11.build-image.bat new file mode 100644 index 0000000..c5b137c --- /dev/null +++ b/Scripts/11.build-image.bat @@ -0,0 +1,40 @@ +@echo off +cd /d "%~dp0" +setlocal enabledelayedexpansion + +REM === 載入 .env 變數(忽略註解與空行) === +for /f "usebackq tokens=1,* delims==" %%a in (".env") do ( + if "%%a" neq "" ( + if not "%%a"=="REM" ( + set "%%a=%%b" + ) + ) +) + +REM === 讀取版本 ======================== +:: 呼叫 version-inc.bat 來更新版本(參數傳遞 inc 或 time) +call version-inc.bat time +:: 再次讀取 version.txt +set /p VERSION= "$ENV_FILE" +window.env = { + VITE_API_BASEURL: "${VITE_API_BASEURL:-http://localhost:8080}", + VITE_FILE_API_BASEURL: "${VITE_FILE_API_BASEURL:-http://localhost:8081}", + VITE_MQTT_BASEURL: "${VITE_MQTT_BASEURL:-ws://localhost:1883}", + VITE_APP_TITLE: "${VITE_APP_TITLE:-MyApp}" +}; +EOF + +echo "[Entrypoint] Generated $ENV_FILE:" +cat "$ENV_FILE" + +# 執行傳入的 CMD,例如 "nginx -g 'daemon off;'" +exec "$@" diff --git a/Scripts/version-inc.bat b/Scripts/version-inc.bat new file mode 100644 index 0000000..20221dd --- /dev/null +++ b/Scripts/version-inc.bat @@ -0,0 +1,69 @@ +@echo off +setlocal enabledelayedexpansion + +:: 檢查輸入參數 +if "%~1"=="" ( + echo 使用方式: version-inc.bat [inc ^| time ^| major] + exit /b 1 +) + +:: 讀版本號(移除前後空白) +set /p VERSION=version.txt echo %VERSION% + +endlocal diff --git a/Scripts/version.txt b/Scripts/version.txt new file mode 100644 index 0000000..b3a9566 --- /dev/null +++ b/Scripts/version.txt @@ -0,0 +1 @@ +1.0.1-2510091042 diff --git a/index.html b/index.html index 05d6236..60bc59c 100644 --- a/index.html +++ b/index.html @@ -5,11 +5,12 @@ 新創賦能 + diff --git a/src/apis/account/index.js b/src/apis/account/index.js index 210b375..3e42b2d 100644 --- a/src/apis/account/index.js +++ b/src/apis/account/index.js @@ -10,12 +10,12 @@ import { DELETE_ACCOUNT_USER_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; export const getAccountUserList = async (search_condition = {}) => { const res = await instance.post(GET_ACCOUNT_USERLIST_API, search_condition); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -27,7 +27,7 @@ export const getAccountRoleList = async (search_condition = {}) => { ...search_condition, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -38,7 +38,7 @@ export const getAccountRoleAuthList = async (SelectedRoleId) => { SelectedRoleId, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -47,7 +47,7 @@ export const getAccountRoleAuthList = async (SelectedRoleId) => { export const getAccountRoleAuthPageList = async () => { const res = await instance.post(GET_ACCOUNT_ROLEAUTHPAGELIST_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -60,7 +60,7 @@ export const postAccountRole = async ({ Id, Name, SaveCheckAuth }) => { SaveCheckAuth, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -71,7 +71,7 @@ export const delRole = async (Id) => { Id, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -91,7 +91,7 @@ export const getAccountOneUser = async (Id) => { Id, }; - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -128,7 +128,7 @@ export const postAccountUser = async ({ } ); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -140,7 +140,7 @@ export const changePassword = async ({ Id, Password }) => { Password, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -151,7 +151,7 @@ export const delAccount = async (Id) => { Id, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); diff --git a/src/apis/alert/index.js b/src/apis/alert/index.js index d2f19e3..7a1cced 100644 --- a/src/apis/alert/index.js +++ b/src/apis/alert/index.js @@ -23,11 +23,11 @@ import { POST_ALERT_MQTT_REFRESH, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; export const getAlertFormId = async (uuid) => { const res = await instance.post(GET_ALERT_FORMID_API, uuid); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -45,7 +45,7 @@ export const getAlertLog = async ({ isRecovery, device_name_tag, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -55,7 +55,7 @@ export const getAlertLogList = async (building_guid) => { const res = await instance.post(GET_ALERT_LOG_LIST_API, { building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -64,7 +64,7 @@ export const getAlertLogList = async (building_guid) => { export const postOperationRecord = async (formData) => { const res = await instance.post(POST_OPERATION_RECORD_API, formData); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -75,7 +75,7 @@ export const getAlertSubList = async (building_guid) => { building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -84,7 +84,7 @@ export const getAlertSubList = async (building_guid) => { export const getAlarmMemberList = async () => { const res = await instance.post(GET_ALERT_MEMBER_LIST_API, {}); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -93,7 +93,7 @@ export const getAlarmMemberList = async () => { export const getNoticeList = async (lang) => { const res = await instance.post(GET_NOTICE_LIST_API, { lang }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -102,7 +102,7 @@ export const getNoticeList = async (lang) => { export const postAlertMember = async (data) => { const res = await instance.post(POST_ALERT_MEMBER, data); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -135,7 +135,7 @@ export const getAlarmMember = async (data) => { export const getOutliersList = async (id) => { const res = await instance.post(GET_OUTLIERS_LIST_API, id); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -144,7 +144,7 @@ export const getOutliersList = async (id) => { export const getOutliersDevList = async (id) => { const res = await instance.post(GET_OUTLIERS_DEVLIST_API, id); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -153,7 +153,7 @@ export const getOutliersDevList = async (id) => { export const getOutliersPoints = async (id) => { const res = await instance.post(GET_OUTLIERS_POINTS_API, id); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -162,7 +162,7 @@ export const getOutliersPoints = async (id) => { export const getFactors = async () => { const res = await instance.post(GET_FACTOR_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -171,7 +171,7 @@ export const getFactors = async () => { export const postOutliersSetting = async (data) => { const res = await instance.post(POST_OUTLIERS_SETTING_API, data); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -182,7 +182,7 @@ export const delOutliersSetting = async (Id) => { Id, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -191,7 +191,7 @@ export const delOutliersSetting = async (Id) => { export const getShowAlarm = async () => { const res = await instance.post(GET_SHOW_ALERT_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -200,7 +200,7 @@ export const getShowAlarm = async () => { export const getAlarmScheduleList = async () => { const res = await instance.post(GET_ALERT_SCHEDULE_LIST_API, {}); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -209,7 +209,7 @@ export const getAlarmScheduleList = async () => { export const postAlertSchedule = async (data) => { const res = await instance.post(POST_ALERT_SCHEDULE, data); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -231,7 +231,7 @@ export const deleteAlarmSchedule = async (id) => { export const postMQTTRefresh = async () => { const res = await instance.post(POST_ALERT_MQTT_REFRESH); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); diff --git a/src/apis/asset/index.js b/src/apis/asset/index.js index e124482..4bec0af 100644 --- a/src/apis/asset/index.js +++ b/src/apis/asset/index.js @@ -28,13 +28,13 @@ import { POST_ASSET_ELEC_SETTING_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +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}); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -43,7 +43,7 @@ export const getAssetMainList = async (building_guid) => { export const deleteAssetMainItem = async (id) => { const res = await instance.post(DELETE_ASSET_MAIN_LIST_API, { id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -57,7 +57,7 @@ export const postAssetMainList = async ({ id, system_key, system_value, building building_guid }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -66,7 +66,7 @@ export const postAssetMainList = async ({ id, system_key, system_value, building export const getAssetSubList = async (id) => { const res = await instance.post(GET_ASSET_SUB_LIST_API, { id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -75,7 +75,7 @@ export const getAssetSubList = async (id) => { export const postAssetSubList = async (formData) => { const res = await instance.post(POST_ASSET_SUB_LIST_API, formData); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -84,7 +84,7 @@ export const postAssetSubList = async (formData) => { export const deleteAssetSubItem = async (id) => { const res = await instance.post(DELETE_ASSET_SUB_LIST_API, { id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -95,7 +95,7 @@ export const getAssetList = async (variable_id) => { variable_id: parseInt(variable_id), }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -104,7 +104,7 @@ export const getAssetList = async (variable_id) => { export const getAssetSingle = async (main_id) => { const res = await instance.post(GET_ASSET_SINGLE_API, { main_id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -140,13 +140,13 @@ export const postAssetSingle = async (data) => { } const res = await instance.post(POST_ASSET_SINGLE_API, formData); - return apihandler(res.code, res.data, { msg: res.msg, code: res.code }); + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code }); }; export const deleteAssetItem = async (main_id) => { const res = await instance.post(DELETE_ASSET_ITEM_API, { main_id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -155,7 +155,7 @@ export const deleteAssetItem = async (main_id) => { export const getAssetFloorList = async (building_guid) => { const res = await instance.post(GET_ASSET_FLOOR_LIST_API, { building_guid }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -164,7 +164,7 @@ export const getAssetFloorList = async (building_guid) => { export const postAssetFloor = async (formData) => { const res = await instance.post(POST_ASSET_FLOOR_API, formData); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -173,7 +173,7 @@ export const postAssetFloor = async (formData) => { export const deleteAssetFloor = async (formData) => { const res = await instance.post(DELETE_ASSET_FLOOR_API, formData); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -185,7 +185,7 @@ export const getAssetIOTList = async (sub_system_tag, points) => { points, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -196,7 +196,7 @@ export const getAssetSubPoint = async (sub_system_tag) => { sub_system_tag, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -205,7 +205,7 @@ export const getAssetSubPoint = async (sub_system_tag) => { export const getIOTSchema = async (variable_id) => { const res = await instance.post(GET_ASSET_IOT_SCHEMA_API, { variable_id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -218,7 +218,7 @@ export const postIOTSchema = async ({ name, variable_id, points }) => { points, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -227,7 +227,7 @@ export const postIOTSchema = async ({ name, variable_id, points }) => { export const getDeviceItem = async (variable_id) => { const res = await instance.post(GET_ASSET_DEVICE_ITEM_API, { variable_id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -252,7 +252,7 @@ export const postDeviceItem = async ({ is_link, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -261,7 +261,7 @@ export const postDeviceItem = async ({ export const deleteDeviceItem = async (id) => { const res = await instance.post(DELETE_ASSET_DEVICE_ITEM_API, { id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -270,7 +270,7 @@ export const deleteDeviceItem = async (id) => { export const getDepartmentList = async () => { const res = await instance.post(GET_ASSET_DEPARTMENT_API, {}); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -282,7 +282,7 @@ export const postDepartmentList = async ({ name, id }) => { id, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -291,7 +291,7 @@ export const postDepartmentList = async ({ name, id }) => { export const deleteDepartmentItem = async (id) => { const res = await instance.post(DELETE_ASSET_DEPARTMENT_API, { id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -300,7 +300,7 @@ export const deleteDepartmentItem = async (id) => { export const getElecTypeList = async () => { const res = await instance.post(GET_ASSET_ELECTYPE_API, {}); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -312,7 +312,7 @@ export const postElecTypeList = async ({ name, id }) => { id, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -321,7 +321,7 @@ export const postElecTypeList = async ({ name, id }) => { export const deleteElecTypeItem = async (id) => { const res = await instance.post(DELETE_ASSET_ELECTYPE_API, { id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -330,7 +330,7 @@ export const deleteElecTypeItem = async (id) => { export const postAssetElecSetting = async (formData) => { const res = await instance.post(POST_ASSET_ELEC_SETTING_API, formData); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); diff --git a/src/apis/building/index.js b/src/apis/building/index.js index 0c3579e..1d321f6 100644 --- a/src/apis/building/index.js +++ b/src/apis/building/index.js @@ -7,12 +7,12 @@ import { GET_ALL_DEVICE_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; export const getBuildings = async () => { const res = await instance.post(GET_BUILDING_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -24,7 +24,7 @@ export const postBuildings = async ({ full_name, building_guid }) => { building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -33,7 +33,7 @@ export const postBuildings = async ({ full_name, building_guid }) => { export const deleteBuildings = async (building_guid) => { const res = await instance.post(DELETE_BUILDING_API, { building_guid }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -43,7 +43,7 @@ export const getAuth = async (lang) => { const res = await instance.post(GET_AUTHPAGE_API, { lang, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -51,7 +51,7 @@ export const getAuth = async (lang) => { export const getAllSysSidebar = async (building_guid) => { const res = await instance.post(GET_SUBAUTHPAGE_API, {building_guid}); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -62,7 +62,7 @@ export const getSysSidebar = async (building_tag) => { building_tag, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -71,7 +71,7 @@ export const getSysSidebar = async (building_tag) => { export const getAllDevice = async () => { const res = await instance.post(GET_ALL_DEVICE_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -83,7 +83,7 @@ export const ackSingleAlarm = async (uuid) => { '' ); console.log("acked", res); - return apihandler(res.code, res, { + return apiHandler(res.code, res, { msg: res.msg, code: res.code, }); diff --git a/src/apis/dashboard/index.js b/src/apis/dashboard/index.js index b6bc297..a27dc78 100644 --- a/src/apis/dashboard/index.js +++ b/src/apis/dashboard/index.js @@ -13,14 +13,14 @@ import { GET_DASHBOARD_ALARMOPERATION_INFO_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; export const getDashboardInit = async (page_type = "SR") => { const res = await instance.post(GET_DASHBOARD_INIT_API, { page_type, // SR:戰情室;PS:生產設定 }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -31,7 +31,7 @@ export const getDashboardDevice = async ({ option }) => { option: parseInt(option), }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -40,7 +40,7 @@ export const getDashboardDevice = async ({ option }) => { export const getDashboardProductCompletion = async () => { const res = await instance.post(GET_DASHBOARD_PRODUCT_COMPLETE_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -49,7 +49,7 @@ export const getDashboardProductCompletion = async () => { export const getDashboardEnergy = async () => { const res = await instance.post(GET_DASHBOARD_ENERGY_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -60,7 +60,7 @@ export const getDashboardFormulaRoom = async ({ timeInterval, typeOption }) => { timeInterval, typeOption, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -79,7 +79,7 @@ export const getDashboardTemp = async ({ option }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -103,7 +103,7 @@ export const postDashboardProductTarget = async ({ date, type, data }) => { }, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -117,7 +117,7 @@ export const getDashboardProductTarget = async ({ date, type }) => { }, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -129,7 +129,7 @@ export const getDashboardProductRecord = async ({ start_time, end_time }) => { end_time, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -140,7 +140,7 @@ export const getEnergyInfo = async (building_guid) => { building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -157,7 +157,7 @@ export const getEnergyCost = async ({ building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -168,7 +168,7 @@ export const getAlarmOperationInfo = async (building_guid) => { building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); diff --git a/src/apis/energy/index.js b/src/apis/energy/index.js index b739a40..e41891b 100644 --- a/src/apis/energy/index.js +++ b/src/apis/energy/index.js @@ -18,13 +18,13 @@ import { POST_TIME_ELEC_API, } from "./api"; import instance, { fileInstance } from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; import downloadExcel from "@/util/downloadExcel"; export const getRealTimeData = async () => { const res = await instance.post(GET_REALTIME_DATA_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -33,7 +33,7 @@ export const getRealTimeData = async () => { export const getElecUseMonth = async () => { const res = await instance.post(GET_ELEC_MONTH_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -42,7 +42,7 @@ export const getElecUseMonth = async () => { export const getElecUseofDay = async () => { const res = await instance.post(GET_ELEC_DAY_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -59,7 +59,7 @@ export const getRealTimeDist = async ({ floor_guid_list, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -76,7 +76,7 @@ export const getElecUseDay = async ({ floor_guid_list, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -95,7 +95,7 @@ export const getTaipower = async ({ floor_guid_list, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -104,7 +104,7 @@ export const getTaipower = async ({ export const getSideBar = async (system_type) => { const res = await instance.post(GET_SIDEBAR_API, { system_type }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -113,7 +113,7 @@ export const getSideBar = async (system_type) => { export const getEnergySearch = async (type) => { const res = await instance.post(GET_SEARCH_API, { type }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -136,7 +136,7 @@ export const getReport = async ({ type, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -163,7 +163,7 @@ export const getExcel = async ({ { responseType: "blob" } ); - return apihandler( + return apiHandler( res.code, res, { @@ -177,7 +177,7 @@ export const getExcel = async ({ export const getDemand = async (building_guid) => { const res = await instance.post(GET_DEMAND_API, { building_guid }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -198,7 +198,7 @@ export const postEditDemand = async ({ building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -207,7 +207,7 @@ export const postEditDemand = async ({ export const getCarbonValue = async (building_guid) => { const res = await instance.post(GET_CARBON_API, { building_guid }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -224,7 +224,7 @@ export const postEditCarbonValue = async ({ building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -233,7 +233,7 @@ export const postEditCarbonValue = async ({ export const getRealTimeDemand = async (building_guid) => { const res = await instance.post(GET_REALTIME_DEMAND_API, { building_guid }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -242,7 +242,7 @@ export const getRealTimeDemand = async (building_guid) => { export const getTimeElec = async (building_guid) => { const res = await instance.post(GET_TIME_ELEC_API, { building_guid }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -255,7 +255,7 @@ export const postTimeElec = async ({ sheet, cost, building_guid }) => { building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); diff --git a/src/apis/forge/index.js b/src/apis/forge/index.js index d13d4bb..d1f2caa 100644 --- a/src/apis/forge/index.js +++ b/src/apis/forge/index.js @@ -1,11 +1,11 @@ import instance from "@/util/request"; import { GET_FORGETOKEN_API, GET_FORGEURN_API } from "./api"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; export const getUrn = async () => { const res = await instance.post(GET_FORGEURN_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); diff --git a/src/apis/graph/index.js b/src/apis/graph/index.js index de9be1f..32b49c9 100644 --- a/src/apis/graph/index.js +++ b/src/apis/graph/index.js @@ -11,12 +11,12 @@ import { UPDATE_GRAPH_TABLE_API } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apiHandler"; +import apiHandler from "@/util/apiHandler"; export const getSideBar = async () => { const res = await instance.post(GET_GRAPH_SIDEBAR_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -25,7 +25,7 @@ export const getSideBar = async () => { export const addSideBarTreeName = async ({ parent_id, name }) => { const res = await instance.post(POST_GRAPH_SIDEBAR_API, { parent_id, name }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -34,7 +34,7 @@ export const addSideBarTreeName = async ({ parent_id, name }) => { export const updateSideBarTreeName = async ({ id, name }) => { const res = await instance.post(UPDATE_GRAPH_SIDEBAR_API, { id, name }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -43,7 +43,7 @@ export const updateSideBarTreeName = async ({ id, name }) => { export const removeSideBarTreeName = async (id) => { const res = await instance.post(REMOVE_GRAPH_SIDEBAR_API, { id }); - return apihandler( + return apiHandler( res.code, { isSuccess: true }, { @@ -58,7 +58,7 @@ export const removeSideBarTreeName = async (id) => { export const getGraphData = async (id) => { const res = await instance.post(GET_GRAPH_TABLE_API, { layer_id: id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, isSuccess: false, @@ -68,7 +68,7 @@ export const getGraphData = async (id) => { export const getGraphAddParamOption = async () => { const res = await instance.post(GET_GRAPH_PARAM_OPTION_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, isSuccess: false, @@ -78,7 +78,7 @@ export const getGraphAddParamOption = async () => { export const addGraphTableData = async (formData) => { const res = await instance.post(POST_GRAPH_TABLE_API, formData); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, isSuccess: false, @@ -88,7 +88,7 @@ export const addGraphTableData = async (formData) => { export const delGraphData = async (id, hard_delete = false, recover_delete = false) => { const res = await instance.post(DELETE_GRAPH_TABLE_API, { id, hard_delete, recover_delete }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, isSuccess: false, @@ -99,7 +99,7 @@ export const delGraphData = async (id, hard_delete = false, recover_delete = fal export const addGraphTableDataWithoutSubSys = async (formData) => { const res = await instance.post(POST_GRAPH_TABLE_API_2, formData); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, isSuccess: false, @@ -109,7 +109,7 @@ export const addGraphTableDataWithoutSubSys = async (formData) => { export const editGraphTableDataWithoutSubSys = async (formData) => { const res = await instance.post(UPDATE_GRAPH_TABLE_API, formData); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, isSuccess: false, diff --git a/src/apis/history/index.js b/src/apis/history/index.js index c393159..d6e285a 100644 --- a/src/apis/history/index.js +++ b/src/apis/history/index.js @@ -9,7 +9,7 @@ import { GET_HISTORY_EXPORT_API, } from "./api"; import instance, { fileInstance } from "@/util/request"; -import apihandler from "@/util/apiHandler"; +import apiHandler from "@/util/apiHandler"; import downloadExcel from "@/util/downloadExcel"; export const getHistorySideBar = async ({ @@ -25,7 +25,7 @@ export const getHistorySideBar = async ({ building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -36,7 +36,7 @@ export const getHistoryPoints = async (Device_list) => { Device_list, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -74,7 +74,7 @@ export const getHistoryData = async ({ table_type: parseInt(table_type), }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -116,7 +116,7 @@ export const getHistoryExportData = async ({ { responseType: "blob" } ); - return apihandler( + return apiHandler( res.code, res, { @@ -130,7 +130,7 @@ export const getHistoryExportData = async ({ export const getHistoryFavorite = async () => { const res = await instance.post(GET_HISTORY_FAVORITE_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -147,7 +147,7 @@ export const addHistoryFavorite = async (value) => { Type: parseInt(value.Type), }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -158,7 +158,7 @@ export const deleteHistoryFavorite = async (favorite_guid) => { favorite_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -170,7 +170,7 @@ export const editHistoryFavorite = async ({ favorite_guid, favorite_name }) => { favorite_name, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); diff --git a/src/apis/login/index.js b/src/apis/login/index.js index 2bb6498..a8a19af 100644 --- a/src/apis/login/index.js +++ b/src/apis/login/index.js @@ -1,6 +1,6 @@ import { POST_LOGIN } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; export async function Login({ account, password }) { const res = await instance.post(POST_LOGIN, { @@ -19,7 +19,7 @@ export async function Login({ account, password }) { }`; } - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, isSuccess: false, diff --git a/src/apis/operation/index.js b/src/apis/operation/index.js index c7c9d1b..e3e7235 100644 --- a/src/apis/operation/index.js +++ b/src/apis/operation/index.js @@ -12,7 +12,7 @@ import { DELETE_OPERATION_COMPANY_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; import dayjs from "dayjs"; export const getOperationRecord = async ({ @@ -34,7 +34,7 @@ export const getOperationRecord = async ({ typeof sub_system_tag === "string" ? [sub_system_tag] : sub_system_tag, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -53,7 +53,7 @@ export const getOperationExportRecord = async ({ .format("YYYY-MM-DDTHH:mm:ss"), }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -64,7 +64,7 @@ export const getOperationCompanyList = async () => { sub_system_tag: [], }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -84,7 +84,7 @@ export const getOperationDeviceList = async ({ device_area_tag, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -95,7 +95,7 @@ export const getOperationEditRecord = async (formId) => { formId, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -104,7 +104,7 @@ export const getOperationEditRecord = async (formId) => { export const postOperationRecord = async (formData) => { const res = await instance.post(POST_OPERATION_RECORD_API, formData); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -112,7 +112,7 @@ export const postOperationRecord = async (formData) => { export const getOperationFormId = async () => { const res = await instance.post(GET_OPERATION_FORMID_API, {}); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -120,7 +120,7 @@ export const getOperationFormId = async () => { export const deleteOperationRecord = async (id) => { const res = await instance.post(DELETE_OPERATION_RECORD_API, { id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -147,7 +147,7 @@ export const postOperationCompany = async ({ tax_id_number, remark, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -175,7 +175,7 @@ export const updateOperationCompany = async ({ tax_id_number, remark, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -183,7 +183,7 @@ export const updateOperationCompany = async ({ export const deleteOperationCompany = async (id) => { const res = await instance.post(DELETE_OPERATION_COMPANY_API, { id }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); diff --git a/src/apis/productSetting/index.js b/src/apis/productSetting/index.js index 1ed4d46..f192685 100644 --- a/src/apis/productSetting/index.js +++ b/src/apis/productSetting/index.js @@ -1,5 +1,5 @@ import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; import { POST_SETTING_POINT_API, GET_SETTING_TYPE_API, @@ -17,7 +17,7 @@ export const postProductSettingPoint = async (type, devices) => { ], }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, isSuccess: false, @@ -27,7 +27,7 @@ export const postProductSettingPoint = async (type, devices) => { export const getProductSettingType = async () => { const res = await instance.post(GET_SETTING_TYPE_API); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, isSuccess: false, @@ -37,7 +37,7 @@ export const getProductSettingType = async () => { export const postProductSettingType = async (data) => { const res = await instance.post(POST_SETTING_TYPE_API, data); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, isSuccess: false, diff --git a/src/apis/rtsp/index.js b/src/apis/rtsp/index.js index 9e11747..efd9e66 100644 --- a/src/apis/rtsp/index.js +++ b/src/apis/rtsp/index.js @@ -3,7 +3,7 @@ import { POST_SET_SAMBA_DIRECTORY, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; /** * 開關 RTSP @@ -12,7 +12,7 @@ import apihandler from "@/util/apihandler"; */ export const setRtspEnable = async ({ main_id, enable }) => { const res = await instance.post(POST_SET_RTSP_ENABLE, { main_id, enable }); - return apihandler(res.code, res.data, { msg: res.msg, code: res.code }); + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code }); }; /** @@ -25,5 +25,5 @@ export const setSambaDirectory = async ({ main_id, directory }) => { main_id, directory, }); - return apihandler(res.code, res.data, { msg: res.msg, code: res.code }); + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code }); }; diff --git a/src/apis/system/index.js b/src/apis/system/index.js index 9756bdc..0cc3028 100644 --- a/src/apis/system/index.js +++ b/src/apis/system/index.js @@ -7,7 +7,7 @@ import { POST_MQTT_TOPIC_STOP_API, } from "./api"; import instance from "@/util/request"; -import apihandler from "@/util/apihandler"; +import apiHandler from "@/util/apiHandler"; export const getSystemFloors = async (building_tag, sub_system_tag) => { const res = await instance.post(GET_SYSTEM_FLOOR_LIST_API, { @@ -15,7 +15,7 @@ export const getSystemFloors = async (building_tag, sub_system_tag) => { sub_system_tag, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -26,7 +26,7 @@ export const getSystemDevices = async ({ building_guid }) => { building_guid, }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -34,7 +34,7 @@ export const getSystemDevices = async ({ building_guid }) => { export const getSystemRealTime = async (device_list) => { const res = await instance.post(GET_SYSTEM_REALTIME_API, { device_list }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -42,7 +42,7 @@ export const getSystemRealTime = async (device_list) => { export const getSystemConfig = async (building_guid) => { const res = await instance.post(GET_SYSTEM_CONFIG_API, { building_guid }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -51,7 +51,7 @@ export const getSystemConfig = async (building_guid) => { export const postMqttTopic = async ({ iotTag, Topic }) => { const res = await instance.post(POST_MQTT_TOPIC_API, { iotTag, Topic }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); @@ -60,7 +60,7 @@ export const postMqttTopic = async ({ iotTag, Topic }) => { export const postMqttTopicStop = async ({ iotTag, Topic }) => { const res = await instance.post(POST_MQTT_TOPIC_STOP_API, { iotTag, Topic }); - return apihandler(res.code, res.data, { + return apiHandler(res.code, res.data, { msg: res.msg, code: res.code, }); diff --git a/src/util/apiHandler.js b/src/util/apiHandler.js index 788c2d3..13af089 100644 --- a/src/util/apiHandler.js +++ b/src/util/apiHandler.js @@ -1,4 +1,4 @@ -const apihandler = (code, successData, errorData, cb = null) => { +const apiHandler = (code, successData, errorData, cb = null) => { return new Promise((resolve, reject) => { if (code === "0000") { cb && cb(successData); @@ -8,4 +8,4 @@ const apihandler = (code, successData, errorData, cb = null) => { }); }; -export default apihandler; +export default apiHandler; diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index cb55793..f02ede3 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -38,7 +38,7 @@ const loadSystemConfig = async () => { } try { const res = await getSystemConfig(building_guid); - // 你的 apihandler 可能回傳 { data, code, msg } 或直接回 data,兩者都兼容: + // 你的 apiHandler 可能回傳 { data, code, msg } 或直接回 data,兩者都兼容: const data = res?.data ?? res; showRefrigeration.value = !!data?.show_refrigeration; // 若未來還要控制其他區塊(如 show_room、show_production_indicator),也可一併在這裡設定