fix: 修正 apiHandler 大小寫造成 Docker 部屬失敗問題
This commit is contained in:
parent
b986d1b8dd
commit
9e9d67dfcd
123
.dockerignore
Normal file
123
.dockerignore
Normal file
@ -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
|
44
Dockerfile
Normal file
44
Dockerfile
Normal file
@ -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;"]
|
20
Scripts/.env
Normal file
20
Scripts/.env
Normal file
@ -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=新創賦能
|
40
Scripts/11.build-image.bat
Normal file
40
Scripts/11.build-image.bat
Normal file
@ -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=<version.txt
|
||||||
|
REM ====================================
|
||||||
|
|
||||||
|
REM === 檢查變數 ========================
|
||||||
|
echo -----------------------------------
|
||||||
|
echo VERSION=!VERSION!
|
||||||
|
echo IMAGE_PROJ_NAME=!IMAGE_PROJ_NAME!
|
||||||
|
echo IMAGE_NAME=!IMAGE_NAME!
|
||||||
|
echo -----------------------------------
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM === 流程 ============================
|
||||||
|
|
||||||
|
@REM for /f "usebackq tokens=*" %%i in (`git describe --tags --always`) do (
|
||||||
|
@REM set VERSION=%%i
|
||||||
|
@REM )
|
||||||
|
@REM echo Building version !VERSION!
|
||||||
|
|
||||||
|
:: 0. 移除舊 Image
|
||||||
|
docker rmi !IMAGE_PROJ_NAME!/!IMAGE_NAME!:!VERSION!
|
||||||
|
|
||||||
|
:: 1. 打包 映像檔 ( -f: 文件位置(注:是相對於目錄) -t: 標簽 ..: 上一層作爲根目錄(.: 表示當前當作根目錄))
|
||||||
|
docker build --no-cache -f ../Dockerfile -t !IMAGE_PROJ_NAME!/!IMAGE_NAME!:!VERSION! ../
|
53
Scripts/12.push-image.bat
Normal file
53
Scripts/12.push-image.bat
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
@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 === 讀取版本 ========================
|
||||||
|
set /p VERSION=<version.txt
|
||||||
|
REM ====================================
|
||||||
|
|
||||||
|
REM === 檢查變數 ========================
|
||||||
|
echo -----------------------------------
|
||||||
|
echo VERSION=!VERSION!
|
||||||
|
echo IMAGE_PROJ_NAME=!IMAGE_PROJ_NAME!
|
||||||
|
echo IMAGE_NAME=!IMAGE_NAME!
|
||||||
|
echo REMOTE_URL=!REMOTE_URL!
|
||||||
|
echo -----------------------------------
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM === 設定目標 image tag ==============
|
||||||
|
set "LOCAL_TAG=!IMAGE_PROJ_NAME!/!IMAGE_NAME!:!VERSION!"
|
||||||
|
set "REMOTE_TAG=!REMOTE_URL!/!IMAGE_PROJ_NAME!/!IMAGE_NAME!:!VERSION!"
|
||||||
|
set "REMOTE_TAG_LATEST=!REMOTE_URL!/!IMAGE_PROJ_NAME!/!IMAGE_NAME!:latest"
|
||||||
|
|
||||||
|
REM === 流程 ============================
|
||||||
|
|
||||||
|
:: 1. 登入 遠端倉庫
|
||||||
|
echo.
|
||||||
|
echo Login...
|
||||||
|
docker login !REMOTE_URL!
|
||||||
|
|
||||||
|
:: 2. 標簽 標記映像檔
|
||||||
|
echo.
|
||||||
|
echo Tagging image...
|
||||||
|
docker tag !LOCAL_TAG! !REMOTE_TAG!
|
||||||
|
docker tag !LOCAL_TAG! !REMOTE_TAG_LATEST!
|
||||||
|
|
||||||
|
:: 3. 推送 映像檔
|
||||||
|
echo.
|
||||||
|
echo Pushing image...
|
||||||
|
docker push !REMOTE_TAG!
|
||||||
|
docker push !REMOTE_TAG_LATEST!
|
||||||
|
|
||||||
|
:: 4. 完成
|
||||||
|
echo Done.
|
||||||
|
pause
|
24
Scripts/docker-entrypoint.sh
Normal file
24
Scripts/docker-entrypoint.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# 目標檔案
|
||||||
|
ENV_FILE=/usr/share/nginx/html/env.js
|
||||||
|
|
||||||
|
# 確保目錄存在
|
||||||
|
mkdir -p /usr/share/nginx/html
|
||||||
|
|
||||||
|
# 寫入環境變數
|
||||||
|
cat <<EOF > "$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 "$@"
|
69
Scripts/version-inc.bat
Normal file
69
Scripts/version-inc.bat
Normal file
@ -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
|
||||||
|
for /f "tokens=* delims= " %%v in ("%VERSION%") do set VERSION=%%v
|
||||||
|
echo Current version: %VERSION%
|
||||||
|
|
||||||
|
:: 拆字串(主.次.修訂)
|
||||||
|
for /f "tokens=1,2,3 delims=.-" %%a in ("%VERSION%") do (
|
||||||
|
set MAJOR=%%a
|
||||||
|
set MINOR=%%b
|
||||||
|
set PATCH=%%c
|
||||||
|
)
|
||||||
|
|
||||||
|
:: inc 模式:遞增 patch,不動 minor
|
||||||
|
if /i "%~1"=="inc" (
|
||||||
|
set /a PATCH=!PATCH!+1
|
||||||
|
set VERSION=!MAJOR!.!MINOR!.!PATCH!
|
||||||
|
)
|
||||||
|
|
||||||
|
:: time 模式:遞增 patch,並加上 -time
|
||||||
|
:: time 模式:加上時間戳
|
||||||
|
if /i "%~1"=="time" (
|
||||||
|
set /a PATCH=!PATCH!+1
|
||||||
|
|
||||||
|
rem ---- 抽取數字日期 (YYMMDD) ----
|
||||||
|
set "RAW_DATE=%date%"
|
||||||
|
set "NUM_DATE="
|
||||||
|
for /l %%i in (0,1,19) do (
|
||||||
|
set "ch=!RAW_DATE:~%%i,1!"
|
||||||
|
for %%c in (0 1 2 3 4 5 6 7 8 9) do if "!ch!"=="%%c" set "NUM_DATE=!NUM_DATE!!ch!"
|
||||||
|
)
|
||||||
|
rem 只取最後6位 (YYMMDD)
|
||||||
|
set "YYMMDD=!NUM_DATE:~-6!"
|
||||||
|
|
||||||
|
rem ---- 抽取時間數字 (HHMM) ----
|
||||||
|
set "RAW_TIME=%time%"
|
||||||
|
set "NUM_TIME="
|
||||||
|
for /l %%i in (0,1,19) do (
|
||||||
|
set "ch=!RAW_TIME:~%%i,1!"
|
||||||
|
for %%c in (0 1 2 3 4 5 6 7 8 9) do if "!ch!"=="%%c" set "NUM_TIME=!NUM_TIME!!ch!"
|
||||||
|
)
|
||||||
|
rem 只取前4位 (HHMM)
|
||||||
|
set "HHMM=!NUM_TIME:~0,4!"
|
||||||
|
|
||||||
|
rem ---- 組合完整時間戳 ----
|
||||||
|
set "DT=!YYMMDD!!HHMM!"
|
||||||
|
set VERSION=!MAJOR!.!MINOR!.!PATCH!-!DT!
|
||||||
|
)
|
||||||
|
|
||||||
|
:: major 模式:遞增 major,不動 minor 和 patch
|
||||||
|
if /i "%~1"=="major" (
|
||||||
|
set /a MAJOR=!MAJOR!+1
|
||||||
|
set VERSION=!MAJOR!.!MINOR!.!PATCH!
|
||||||
|
)
|
||||||
|
|
||||||
|
echo New version: %VERSION%
|
||||||
|
|
||||||
|
:: 寫回檔案
|
||||||
|
>version.txt echo %VERSION%
|
||||||
|
|
||||||
|
endlocal
|
1
Scripts/version.txt
Normal file
1
Scripts/version.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.0.1-2510091042
|
@ -5,11 +5,12 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.css"
|
href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.css"
|
||||||
/>
|
/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>新創賦能</title>
|
<title>新創賦能</title>
|
||||||
|
<script src="/env.js"></script>
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||||
<!-- <script src="https://code.jquery.com/ui/1.13.3/jquery-ui.js"></script> -->
|
<!-- <script src="https://code.jquery.com/ui/1.13.3/jquery-ui.js"></script> -->
|
||||||
<!-- <script type="text/javascript" src="/requirejs/config.js"></script> -->
|
<!-- <script type="text/javascript" src="/requirejs/config.js"></script> -->
|
||||||
|
@ -10,12 +10,12 @@ import {
|
|||||||
DELETE_ACCOUNT_USER_API,
|
DELETE_ACCOUNT_USER_API,
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
|
|
||||||
export const getAccountUserList = async (search_condition = {}) => {
|
export const getAccountUserList = async (search_condition = {}) => {
|
||||||
const res = await instance.post(GET_ACCOUNT_USERLIST_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -27,7 +27,7 @@ export const getAccountRoleList = async (search_condition = {}) => {
|
|||||||
...search_condition,
|
...search_condition,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -38,7 +38,7 @@ export const getAccountRoleAuthList = async (SelectedRoleId) => {
|
|||||||
SelectedRoleId,
|
SelectedRoleId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -47,7 +47,7 @@ export const getAccountRoleAuthList = async (SelectedRoleId) => {
|
|||||||
export const getAccountRoleAuthPageList = async () => {
|
export const getAccountRoleAuthPageList = async () => {
|
||||||
const res = await instance.post(GET_ACCOUNT_ROLEAUTHPAGELIST_API);
|
const res = await instance.post(GET_ACCOUNT_ROLEAUTHPAGELIST_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -60,7 +60,7 @@ export const postAccountRole = async ({ Id, Name, SaveCheckAuth }) => {
|
|||||||
SaveCheckAuth,
|
SaveCheckAuth,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -71,7 +71,7 @@ export const delRole = async (Id) => {
|
|||||||
Id,
|
Id,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -91,7 +91,7 @@ export const getAccountOneUser = async (Id) => {
|
|||||||
Id,
|
Id,
|
||||||
};
|
};
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -140,7 +140,7 @@ export const changePassword = async ({ Id, Password }) => {
|
|||||||
Password,
|
Password,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -151,7 +151,7 @@ export const delAccount = async (Id) => {
|
|||||||
Id,
|
Id,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
|
@ -23,11 +23,11 @@ import {
|
|||||||
POST_ALERT_MQTT_REFRESH,
|
POST_ALERT_MQTT_REFRESH,
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
|
|
||||||
export const getAlertFormId = async (uuid) => {
|
export const getAlertFormId = async (uuid) => {
|
||||||
const res = await instance.post(GET_ALERT_FORMID_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -45,7 +45,7 @@ export const getAlertLog = async ({
|
|||||||
isRecovery,
|
isRecovery,
|
||||||
device_name_tag,
|
device_name_tag,
|
||||||
});
|
});
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -55,7 +55,7 @@ export const getAlertLogList = async (building_guid) => {
|
|||||||
const res = await instance.post(GET_ALERT_LOG_LIST_API, {
|
const res = await instance.post(GET_ALERT_LOG_LIST_API, {
|
||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -64,7 +64,7 @@ export const getAlertLogList = async (building_guid) => {
|
|||||||
export const postOperationRecord = async (formData) => {
|
export const postOperationRecord = async (formData) => {
|
||||||
const res = await instance.post(POST_OPERATION_RECORD_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -75,7 +75,7 @@ export const getAlertSubList = async (building_guid) => {
|
|||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -84,7 +84,7 @@ export const getAlertSubList = async (building_guid) => {
|
|||||||
export const getAlarmMemberList = async () => {
|
export const getAlarmMemberList = async () => {
|
||||||
const res = await instance.post(GET_ALERT_MEMBER_LIST_API, {});
|
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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -93,7 +93,7 @@ export const getAlarmMemberList = async () => {
|
|||||||
export const getNoticeList = async (lang) => {
|
export const getNoticeList = async (lang) => {
|
||||||
const res = await instance.post(GET_NOTICE_LIST_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -102,7 +102,7 @@ export const getNoticeList = async (lang) => {
|
|||||||
export const postAlertMember = async (data) => {
|
export const postAlertMember = async (data) => {
|
||||||
const res = await instance.post(POST_ALERT_MEMBER, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -135,7 +135,7 @@ export const getAlarmMember = async (data) => {
|
|||||||
export const getOutliersList = async (id) => {
|
export const getOutliersList = async (id) => {
|
||||||
const res = await instance.post(GET_OUTLIERS_LIST_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -144,7 +144,7 @@ export const getOutliersList = async (id) => {
|
|||||||
export const getOutliersDevList = async (id) => {
|
export const getOutliersDevList = async (id) => {
|
||||||
const res = await instance.post(GET_OUTLIERS_DEVLIST_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -153,7 +153,7 @@ export const getOutliersDevList = async (id) => {
|
|||||||
export const getOutliersPoints = async (id) => {
|
export const getOutliersPoints = async (id) => {
|
||||||
const res = await instance.post(GET_OUTLIERS_POINTS_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -162,7 +162,7 @@ export const getOutliersPoints = async (id) => {
|
|||||||
export const getFactors = async () => {
|
export const getFactors = async () => {
|
||||||
const res = await instance.post(GET_FACTOR_API);
|
const res = await instance.post(GET_FACTOR_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -171,7 +171,7 @@ export const getFactors = async () => {
|
|||||||
export const postOutliersSetting = async (data) => {
|
export const postOutliersSetting = async (data) => {
|
||||||
const res = await instance.post(POST_OUTLIERS_SETTING_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -182,7 +182,7 @@ export const delOutliersSetting = async (Id) => {
|
|||||||
Id,
|
Id,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -191,7 +191,7 @@ export const delOutliersSetting = async (Id) => {
|
|||||||
export const getShowAlarm = async () => {
|
export const getShowAlarm = async () => {
|
||||||
const res = await instance.post(GET_SHOW_ALERT_API);
|
const res = await instance.post(GET_SHOW_ALERT_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -200,7 +200,7 @@ export const getShowAlarm = async () => {
|
|||||||
export const getAlarmScheduleList = async () => {
|
export const getAlarmScheduleList = async () => {
|
||||||
const res = await instance.post(GET_ALERT_SCHEDULE_LIST_API, {});
|
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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -209,7 +209,7 @@ export const getAlarmScheduleList = async () => {
|
|||||||
export const postAlertSchedule = async (data) => {
|
export const postAlertSchedule = async (data) => {
|
||||||
const res = await instance.post(POST_ALERT_SCHEDULE, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -231,7 +231,7 @@ export const deleteAlarmSchedule = async (id) => {
|
|||||||
export const postMQTTRefresh = async () => {
|
export const postMQTTRefresh = async () => {
|
||||||
const res = await instance.post(POST_ALERT_MQTT_REFRESH);
|
const res = await instance.post(POST_ALERT_MQTT_REFRESH);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
|
@ -28,13 +28,13 @@ import {
|
|||||||
POST_ASSET_ELEC_SETTING_API,
|
POST_ASSET_ELEC_SETTING_API,
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
import { object } from "yup";
|
import { object } from "yup";
|
||||||
|
|
||||||
export const getAssetMainList = async (building_guid) => {
|
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, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -43,7 +43,7 @@ export const getAssetMainList = async (building_guid) => {
|
|||||||
export const deleteAssetMainItem = async (id) => {
|
export const deleteAssetMainItem = async (id) => {
|
||||||
const res = await instance.post(DELETE_ASSET_MAIN_LIST_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -57,7 +57,7 @@ export const postAssetMainList = async ({ id, system_key, system_value, building
|
|||||||
building_guid
|
building_guid
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -66,7 +66,7 @@ export const postAssetMainList = async ({ id, system_key, system_value, building
|
|||||||
export const getAssetSubList = async (id) => {
|
export const getAssetSubList = async (id) => {
|
||||||
const res = await instance.post(GET_ASSET_SUB_LIST_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -75,7 +75,7 @@ export const getAssetSubList = async (id) => {
|
|||||||
export const postAssetSubList = async (formData) => {
|
export const postAssetSubList = async (formData) => {
|
||||||
const res = await instance.post(POST_ASSET_SUB_LIST_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -84,7 +84,7 @@ export const postAssetSubList = async (formData) => {
|
|||||||
export const deleteAssetSubItem = async (id) => {
|
export const deleteAssetSubItem = async (id) => {
|
||||||
const res = await instance.post(DELETE_ASSET_SUB_LIST_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -95,7 +95,7 @@ export const getAssetList = async (variable_id) => {
|
|||||||
variable_id: parseInt(variable_id),
|
variable_id: parseInt(variable_id),
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -104,7 +104,7 @@ export const getAssetList = async (variable_id) => {
|
|||||||
export const getAssetSingle = async (main_id) => {
|
export const getAssetSingle = async (main_id) => {
|
||||||
const res = await instance.post(GET_ASSET_SINGLE_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -140,13 +140,13 @@ export const postAssetSingle = async (data) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const res = await instance.post(POST_ASSET_SINGLE_API, formData);
|
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) => {
|
export const deleteAssetItem = async (main_id) => {
|
||||||
const res = await instance.post(DELETE_ASSET_ITEM_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -155,7 +155,7 @@ export const deleteAssetItem = async (main_id) => {
|
|||||||
export const getAssetFloorList = async (building_guid) => {
|
export const getAssetFloorList = async (building_guid) => {
|
||||||
const res = await instance.post(GET_ASSET_FLOOR_LIST_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -164,7 +164,7 @@ export const getAssetFloorList = async (building_guid) => {
|
|||||||
export const postAssetFloor = async (formData) => {
|
export const postAssetFloor = async (formData) => {
|
||||||
const res = await instance.post(POST_ASSET_FLOOR_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -173,7 +173,7 @@ export const postAssetFloor = async (formData) => {
|
|||||||
export const deleteAssetFloor = async (formData) => {
|
export const deleteAssetFloor = async (formData) => {
|
||||||
const res = await instance.post(DELETE_ASSET_FLOOR_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -185,7 +185,7 @@ export const getAssetIOTList = async (sub_system_tag, points) => {
|
|||||||
points,
|
points,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -196,7 +196,7 @@ export const getAssetSubPoint = async (sub_system_tag) => {
|
|||||||
sub_system_tag,
|
sub_system_tag,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -205,7 +205,7 @@ export const getAssetSubPoint = async (sub_system_tag) => {
|
|||||||
export const getIOTSchema = async (variable_id) => {
|
export const getIOTSchema = async (variable_id) => {
|
||||||
const res = await instance.post(GET_ASSET_IOT_SCHEMA_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -218,7 +218,7 @@ export const postIOTSchema = async ({ name, variable_id, points }) => {
|
|||||||
points,
|
points,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -227,7 +227,7 @@ export const postIOTSchema = async ({ name, variable_id, points }) => {
|
|||||||
export const getDeviceItem = async (variable_id) => {
|
export const getDeviceItem = async (variable_id) => {
|
||||||
const res = await instance.post(GET_ASSET_DEVICE_ITEM_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -252,7 +252,7 @@ export const postDeviceItem = async ({
|
|||||||
is_link,
|
is_link,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -261,7 +261,7 @@ export const postDeviceItem = async ({
|
|||||||
export const deleteDeviceItem = async (id) => {
|
export const deleteDeviceItem = async (id) => {
|
||||||
const res = await instance.post(DELETE_ASSET_DEVICE_ITEM_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -270,7 +270,7 @@ export const deleteDeviceItem = async (id) => {
|
|||||||
export const getDepartmentList = async () => {
|
export const getDepartmentList = async () => {
|
||||||
const res = await instance.post(GET_ASSET_DEPARTMENT_API, {});
|
const res = await instance.post(GET_ASSET_DEPARTMENT_API, {});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -282,7 +282,7 @@ export const postDepartmentList = async ({ name, id }) => {
|
|||||||
id,
|
id,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -291,7 +291,7 @@ export const postDepartmentList = async ({ name, id }) => {
|
|||||||
export const deleteDepartmentItem = async (id) => {
|
export const deleteDepartmentItem = async (id) => {
|
||||||
const res = await instance.post(DELETE_ASSET_DEPARTMENT_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -300,7 +300,7 @@ export const deleteDepartmentItem = async (id) => {
|
|||||||
export const getElecTypeList = async () => {
|
export const getElecTypeList = async () => {
|
||||||
const res = await instance.post(GET_ASSET_ELECTYPE_API, {});
|
const res = await instance.post(GET_ASSET_ELECTYPE_API, {});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -312,7 +312,7 @@ export const postElecTypeList = async ({ name, id }) => {
|
|||||||
id,
|
id,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -321,7 +321,7 @@ export const postElecTypeList = async ({ name, id }) => {
|
|||||||
export const deleteElecTypeItem = async (id) => {
|
export const deleteElecTypeItem = async (id) => {
|
||||||
const res = await instance.post(DELETE_ASSET_ELECTYPE_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -330,7 +330,7 @@ export const deleteElecTypeItem = async (id) => {
|
|||||||
export const postAssetElecSetting = async (formData) => {
|
export const postAssetElecSetting = async (formData) => {
|
||||||
const res = await instance.post(POST_ASSET_ELEC_SETTING_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
|
@ -7,12 +7,12 @@ import {
|
|||||||
GET_ALL_DEVICE_API,
|
GET_ALL_DEVICE_API,
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
|
|
||||||
export const getBuildings = async () => {
|
export const getBuildings = async () => {
|
||||||
const res = await instance.post(GET_BUILDING_API);
|
const res = await instance.post(GET_BUILDING_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -24,7 +24,7 @@ export const postBuildings = async ({ full_name, building_guid }) => {
|
|||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -33,7 +33,7 @@ export const postBuildings = async ({ full_name, building_guid }) => {
|
|||||||
export const deleteBuildings = async (building_guid) => {
|
export const deleteBuildings = async (building_guid) => {
|
||||||
const res = await instance.post(DELETE_BUILDING_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -43,7 +43,7 @@ export const getAuth = async (lang) => {
|
|||||||
const res = await instance.post(GET_AUTHPAGE_API, {
|
const res = await instance.post(GET_AUTHPAGE_API, {
|
||||||
lang,
|
lang,
|
||||||
});
|
});
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -51,7 +51,7 @@ export const getAuth = async (lang) => {
|
|||||||
|
|
||||||
export const getAllSysSidebar = async (building_guid) => {
|
export const getAllSysSidebar = async (building_guid) => {
|
||||||
const res = await instance.post(GET_SUBAUTHPAGE_API, {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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -62,7 +62,7 @@ export const getSysSidebar = async (building_tag) => {
|
|||||||
building_tag,
|
building_tag,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -71,7 +71,7 @@ export const getSysSidebar = async (building_tag) => {
|
|||||||
export const getAllDevice = async () => {
|
export const getAllDevice = async () => {
|
||||||
const res = await instance.post(GET_ALL_DEVICE_API);
|
const res = await instance.post(GET_ALL_DEVICE_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -83,7 +83,7 @@ export const ackSingleAlarm = async (uuid) => {
|
|||||||
'<obj is="obix:AckAlarmIn"><str name="ackUser" val="obix" /></obj>'
|
'<obj is="obix:AckAlarmIn"><str name="ackUser" val="obix" /></obj>'
|
||||||
);
|
);
|
||||||
console.log("acked", res);
|
console.log("acked", res);
|
||||||
return apihandler(res.code, res, {
|
return apiHandler(res.code, res, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
|
@ -13,14 +13,14 @@ import {
|
|||||||
GET_DASHBOARD_ALARMOPERATION_INFO_API,
|
GET_DASHBOARD_ALARMOPERATION_INFO_API,
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
|
|
||||||
export const getDashboardInit = async (page_type = "SR") => {
|
export const getDashboardInit = async (page_type = "SR") => {
|
||||||
const res = await instance.post(GET_DASHBOARD_INIT_API, {
|
const res = await instance.post(GET_DASHBOARD_INIT_API, {
|
||||||
page_type, // SR:戰情室;PS:生產設定
|
page_type, // SR:戰情室;PS:生產設定
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -31,7 +31,7 @@ export const getDashboardDevice = async ({ option }) => {
|
|||||||
option: parseInt(option),
|
option: parseInt(option),
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -40,7 +40,7 @@ export const getDashboardDevice = async ({ option }) => {
|
|||||||
export const getDashboardProductCompletion = async () => {
|
export const getDashboardProductCompletion = async () => {
|
||||||
const res = await instance.post(GET_DASHBOARD_PRODUCT_COMPLETE_API);
|
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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -49,7 +49,7 @@ export const getDashboardProductCompletion = async () => {
|
|||||||
export const getDashboardEnergy = async () => {
|
export const getDashboardEnergy = async () => {
|
||||||
const res = await instance.post(GET_DASHBOARD_ENERGY_API);
|
const res = await instance.post(GET_DASHBOARD_ENERGY_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -60,7 +60,7 @@ export const getDashboardFormulaRoom = async ({ timeInterval, typeOption }) => {
|
|||||||
timeInterval,
|
timeInterval,
|
||||||
typeOption,
|
typeOption,
|
||||||
});
|
});
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -79,7 +79,7 @@ export const getDashboardTemp = async ({
|
|||||||
option
|
option
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
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,
|
msg: res.msg,
|
||||||
code: res.code,
|
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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -129,7 +129,7 @@ export const getDashboardProductRecord = async ({ start_time, end_time }) => {
|
|||||||
end_time,
|
end_time,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -140,7 +140,7 @@ export const getEnergyInfo = async (building_guid) => {
|
|||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -157,7 +157,7 @@ export const getEnergyCost = async ({
|
|||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -168,7 +168,7 @@ export const getAlarmOperationInfo = async (building_guid) => {
|
|||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
|
@ -18,13 +18,13 @@ import {
|
|||||||
POST_TIME_ELEC_API,
|
POST_TIME_ELEC_API,
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance, { fileInstance } from "@/util/request";
|
import instance, { fileInstance } from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
import downloadExcel from "@/util/downloadExcel";
|
import downloadExcel from "@/util/downloadExcel";
|
||||||
|
|
||||||
export const getRealTimeData = async () => {
|
export const getRealTimeData = async () => {
|
||||||
const res = await instance.post(GET_REALTIME_DATA_API);
|
const res = await instance.post(GET_REALTIME_DATA_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -33,7 +33,7 @@ export const getRealTimeData = async () => {
|
|||||||
export const getElecUseMonth = async () => {
|
export const getElecUseMonth = async () => {
|
||||||
const res = await instance.post(GET_ELEC_MONTH_API);
|
const res = await instance.post(GET_ELEC_MONTH_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -42,7 +42,7 @@ export const getElecUseMonth = async () => {
|
|||||||
export const getElecUseofDay = async () => {
|
export const getElecUseofDay = async () => {
|
||||||
const res = await instance.post(GET_ELEC_DAY_API);
|
const res = await instance.post(GET_ELEC_DAY_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -59,7 +59,7 @@ export const getRealTimeDist = async ({
|
|||||||
floor_guid_list,
|
floor_guid_list,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -76,7 +76,7 @@ export const getElecUseDay = async ({
|
|||||||
floor_guid_list,
|
floor_guid_list,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -95,7 +95,7 @@ export const getTaipower = async ({
|
|||||||
floor_guid_list,
|
floor_guid_list,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -104,7 +104,7 @@ export const getTaipower = async ({
|
|||||||
export const getSideBar = async (system_type) => {
|
export const getSideBar = async (system_type) => {
|
||||||
const res = await instance.post(GET_SIDEBAR_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -113,7 +113,7 @@ export const getSideBar = async (system_type) => {
|
|||||||
export const getEnergySearch = async (type) => {
|
export const getEnergySearch = async (type) => {
|
||||||
const res = await instance.post(GET_SEARCH_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -136,7 +136,7 @@ export const getReport = async ({
|
|||||||
type,
|
type,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -163,7 +163,7 @@ export const getExcel = async ({
|
|||||||
{ responseType: "blob" }
|
{ responseType: "blob" }
|
||||||
);
|
);
|
||||||
|
|
||||||
return apihandler(
|
return apiHandler(
|
||||||
res.code,
|
res.code,
|
||||||
res,
|
res,
|
||||||
{
|
{
|
||||||
@ -177,7 +177,7 @@ export const getExcel = async ({
|
|||||||
export const getDemand = async (building_guid) => {
|
export const getDemand = async (building_guid) => {
|
||||||
const res = await instance.post(GET_DEMAND_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -198,7 +198,7 @@ export const postEditDemand = async ({
|
|||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -207,7 +207,7 @@ export const postEditDemand = async ({
|
|||||||
export const getCarbonValue = async (building_guid) => {
|
export const getCarbonValue = async (building_guid) => {
|
||||||
const res = await instance.post(GET_CARBON_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -224,7 +224,7 @@ export const postEditCarbonValue = async ({
|
|||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -233,7 +233,7 @@ export const postEditCarbonValue = async ({
|
|||||||
export const getRealTimeDemand = async (building_guid) => {
|
export const getRealTimeDemand = async (building_guid) => {
|
||||||
const res = await instance.post(GET_REALTIME_DEMAND_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -242,7 +242,7 @@ export const getRealTimeDemand = async (building_guid) => {
|
|||||||
export const getTimeElec = async (building_guid) => {
|
export const getTimeElec = async (building_guid) => {
|
||||||
const res = await instance.post(GET_TIME_ELEC_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -255,7 +255,7 @@ export const postTimeElec = async ({ sheet, cost, building_guid }) => {
|
|||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import { GET_FORGETOKEN_API, GET_FORGEURN_API } from "./api";
|
import { GET_FORGETOKEN_API, GET_FORGEURN_API } from "./api";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
|
|
||||||
export const getUrn = async () => {
|
export const getUrn = async () => {
|
||||||
const res = await instance.post(GET_FORGEURN_API);
|
const res = await instance.post(GET_FORGEURN_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
|
@ -11,12 +11,12 @@ import {
|
|||||||
UPDATE_GRAPH_TABLE_API
|
UPDATE_GRAPH_TABLE_API
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apiHandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
|
|
||||||
export const getSideBar = async () => {
|
export const getSideBar = async () => {
|
||||||
const res = await instance.post(GET_GRAPH_SIDEBAR_API);
|
const res = await instance.post(GET_GRAPH_SIDEBAR_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -25,7 +25,7 @@ export const getSideBar = async () => {
|
|||||||
export const addSideBarTreeName = async ({ parent_id, name }) => {
|
export const addSideBarTreeName = async ({ parent_id, name }) => {
|
||||||
const res = await instance.post(POST_GRAPH_SIDEBAR_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -34,7 +34,7 @@ export const addSideBarTreeName = async ({ parent_id, name }) => {
|
|||||||
export const updateSideBarTreeName = async ({ id, name }) => {
|
export const updateSideBarTreeName = async ({ id, name }) => {
|
||||||
const res = await instance.post(UPDATE_GRAPH_SIDEBAR_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -43,7 +43,7 @@ export const updateSideBarTreeName = async ({ id, name }) => {
|
|||||||
export const removeSideBarTreeName = async (id) => {
|
export const removeSideBarTreeName = async (id) => {
|
||||||
const res = await instance.post(REMOVE_GRAPH_SIDEBAR_API, { id });
|
const res = await instance.post(REMOVE_GRAPH_SIDEBAR_API, { id });
|
||||||
|
|
||||||
return apihandler(
|
return apiHandler(
|
||||||
res.code,
|
res.code,
|
||||||
{ isSuccess: true },
|
{ isSuccess: true },
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ export const removeSideBarTreeName = async (id) => {
|
|||||||
export const getGraphData = async (id) => {
|
export const getGraphData = async (id) => {
|
||||||
const res = await instance.post(GET_GRAPH_TABLE_API, { layer_id: 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
@ -68,7 +68,7 @@ export const getGraphData = async (id) => {
|
|||||||
export const getGraphAddParamOption = async () => {
|
export const getGraphAddParamOption = async () => {
|
||||||
const res = await instance.post(GET_GRAPH_PARAM_OPTION_API);
|
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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
@ -78,7 +78,7 @@ export const getGraphAddParamOption = async () => {
|
|||||||
export const addGraphTableData = async (formData) => {
|
export const addGraphTableData = async (formData) => {
|
||||||
const res = await instance.post(POST_GRAPH_TABLE_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
@ -88,7 +88,7 @@ export const addGraphTableData = async (formData) => {
|
|||||||
export const delGraphData = async (id, hard_delete = false, recover_delete = false) => {
|
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 });
|
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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
@ -99,7 +99,7 @@ export const delGraphData = async (id, hard_delete = false, recover_delete = fal
|
|||||||
export const addGraphTableDataWithoutSubSys = async (formData) => {
|
export const addGraphTableDataWithoutSubSys = async (formData) => {
|
||||||
const res = await instance.post(POST_GRAPH_TABLE_API_2, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
@ -109,7 +109,7 @@ export const addGraphTableDataWithoutSubSys = async (formData) => {
|
|||||||
export const editGraphTableDataWithoutSubSys = async (formData) => {
|
export const editGraphTableDataWithoutSubSys = async (formData) => {
|
||||||
const res = await instance.post(UPDATE_GRAPH_TABLE_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
GET_HISTORY_EXPORT_API,
|
GET_HISTORY_EXPORT_API,
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance, { fileInstance } from "@/util/request";
|
import instance, { fileInstance } from "@/util/request";
|
||||||
import apihandler from "@/util/apiHandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
import downloadExcel from "@/util/downloadExcel";
|
import downloadExcel from "@/util/downloadExcel";
|
||||||
|
|
||||||
export const getHistorySideBar = async ({
|
export const getHistorySideBar = async ({
|
||||||
@ -25,7 +25,7 @@ export const getHistorySideBar = async ({
|
|||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -36,7 +36,7 @@ export const getHistoryPoints = async (Device_list) => {
|
|||||||
Device_list,
|
Device_list,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -74,7 +74,7 @@ export const getHistoryData = async ({
|
|||||||
table_type: parseInt(table_type),
|
table_type: parseInt(table_type),
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -116,7 +116,7 @@ export const getHistoryExportData = async ({
|
|||||||
{ responseType: "blob" }
|
{ responseType: "blob" }
|
||||||
);
|
);
|
||||||
|
|
||||||
return apihandler(
|
return apiHandler(
|
||||||
res.code,
|
res.code,
|
||||||
res,
|
res,
|
||||||
{
|
{
|
||||||
@ -130,7 +130,7 @@ export const getHistoryExportData = async ({
|
|||||||
export const getHistoryFavorite = async () => {
|
export const getHistoryFavorite = async () => {
|
||||||
const res = await instance.post(GET_HISTORY_FAVORITE_API);
|
const res = await instance.post(GET_HISTORY_FAVORITE_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -147,7 +147,7 @@ export const addHistoryFavorite = async (value) => {
|
|||||||
Type: parseInt(value.Type),
|
Type: parseInt(value.Type),
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -158,7 +158,7 @@ export const deleteHistoryFavorite = async (favorite_guid) => {
|
|||||||
favorite_guid,
|
favorite_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -170,7 +170,7 @@ export const editHistoryFavorite = async ({ favorite_guid, favorite_name }) => {
|
|||||||
favorite_name,
|
favorite_name,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { POST_LOGIN } from "./api";
|
import { POST_LOGIN } from "./api";
|
||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
|
|
||||||
export async function Login({ account, password }) {
|
export async function Login({ account, password }) {
|
||||||
const res = await instance.post(POST_LOGIN, {
|
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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
DELETE_OPERATION_COMPANY_API,
|
DELETE_OPERATION_COMPANY_API,
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
export const getOperationRecord = async ({
|
export const getOperationRecord = async ({
|
||||||
@ -34,7 +34,7 @@ export const getOperationRecord = async ({
|
|||||||
typeof sub_system_tag === "string" ? [sub_system_tag] : sub_system_tag,
|
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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -53,7 +53,7 @@ export const getOperationExportRecord = async ({
|
|||||||
.format("YYYY-MM-DDTHH:mm:ss"),
|
.format("YYYY-MM-DDTHH:mm:ss"),
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -64,7 +64,7 @@ export const getOperationCompanyList = async () => {
|
|||||||
sub_system_tag: [],
|
sub_system_tag: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -84,7 +84,7 @@ export const getOperationDeviceList = async ({
|
|||||||
device_area_tag,
|
device_area_tag,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -95,7 +95,7 @@ export const getOperationEditRecord = async (formId) => {
|
|||||||
formId,
|
formId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -104,7 +104,7 @@ export const getOperationEditRecord = async (formId) => {
|
|||||||
export const postOperationRecord = async (formData) => {
|
export const postOperationRecord = async (formData) => {
|
||||||
const res = await instance.post(POST_OPERATION_RECORD_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -112,7 +112,7 @@ export const postOperationRecord = async (formData) => {
|
|||||||
|
|
||||||
export const getOperationFormId = async () => {
|
export const getOperationFormId = async () => {
|
||||||
const res = await instance.post(GET_OPERATION_FORMID_API, {});
|
const res = await instance.post(GET_OPERATION_FORMID_API, {});
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -120,7 +120,7 @@ export const getOperationFormId = async () => {
|
|||||||
|
|
||||||
export const deleteOperationRecord = async (id) => {
|
export const deleteOperationRecord = async (id) => {
|
||||||
const res = await instance.post(DELETE_OPERATION_RECORD_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -147,7 +147,7 @@ export const postOperationCompany = async ({
|
|||||||
tax_id_number,
|
tax_id_number,
|
||||||
remark,
|
remark,
|
||||||
});
|
});
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -175,7 +175,7 @@ export const updateOperationCompany = async ({
|
|||||||
tax_id_number,
|
tax_id_number,
|
||||||
remark,
|
remark,
|
||||||
});
|
});
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -183,7 +183,7 @@ export const updateOperationCompany = async ({
|
|||||||
|
|
||||||
export const deleteOperationCompany = async (id) => {
|
export const deleteOperationCompany = async (id) => {
|
||||||
const res = await instance.post(DELETE_OPERATION_COMPANY_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
import {
|
import {
|
||||||
POST_SETTING_POINT_API,
|
POST_SETTING_POINT_API,
|
||||||
GET_SETTING_TYPE_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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
@ -27,7 +27,7 @@ export const postProductSettingPoint = async (type, devices) => {
|
|||||||
export const getProductSettingType = async () => {
|
export const getProductSettingType = async () => {
|
||||||
const res = await instance.post(GET_SETTING_TYPE_API);
|
const res = await instance.post(GET_SETTING_TYPE_API);
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
@ -37,7 +37,7 @@ export const getProductSettingType = async () => {
|
|||||||
export const postProductSettingType = async (data) => {
|
export const postProductSettingType = async (data) => {
|
||||||
const res = await instance.post(POST_SETTING_TYPE_API, 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
POST_SET_SAMBA_DIRECTORY,
|
POST_SET_SAMBA_DIRECTORY,
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 開關 RTSP
|
* 開關 RTSP
|
||||||
@ -12,7 +12,7 @@ import apihandler from "@/util/apihandler";
|
|||||||
*/
|
*/
|
||||||
export const setRtspEnable = async ({ main_id, enable }) => {
|
export const setRtspEnable = async ({ main_id, enable }) => {
|
||||||
const res = await instance.post(POST_SET_RTSP_ENABLE, { 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,
|
main_id,
|
||||||
directory,
|
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 });
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
POST_MQTT_TOPIC_STOP_API,
|
POST_MQTT_TOPIC_STOP_API,
|
||||||
} from "./api";
|
} from "./api";
|
||||||
import instance from "@/util/request";
|
import instance from "@/util/request";
|
||||||
import apihandler from "@/util/apihandler";
|
import apiHandler from "@/util/apiHandler";
|
||||||
|
|
||||||
export const getSystemFloors = async (building_tag, sub_system_tag) => {
|
export const getSystemFloors = async (building_tag, sub_system_tag) => {
|
||||||
const res = await instance.post(GET_SYSTEM_FLOOR_LIST_API, {
|
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,
|
sub_system_tag,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -26,7 +26,7 @@ export const getSystemDevices = async ({ building_guid }) => {
|
|||||||
building_guid,
|
building_guid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apiHandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -34,7 +34,7 @@ export const getSystemDevices = async ({ building_guid }) => {
|
|||||||
|
|
||||||
export const getSystemRealTime = async (device_list) => {
|
export const getSystemRealTime = async (device_list) => {
|
||||||
const res = await instance.post(GET_SYSTEM_REALTIME_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -42,7 +42,7 @@ export const getSystemRealTime = async (device_list) => {
|
|||||||
|
|
||||||
export const getSystemConfig = async (building_guid) => {
|
export const getSystemConfig = async (building_guid) => {
|
||||||
const res = await instance.post(GET_SYSTEM_CONFIG_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -51,7 +51,7 @@ export const getSystemConfig = async (building_guid) => {
|
|||||||
export const postMqttTopic = async ({ iotTag, Topic }) => {
|
export const postMqttTopic = async ({ iotTag, Topic }) => {
|
||||||
const res = await instance.post(POST_MQTT_TOPIC_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
@ -60,7 +60,7 @@ export const postMqttTopic = async ({ iotTag, Topic }) => {
|
|||||||
export const postMqttTopicStop = async ({ iotTag, Topic }) => {
|
export const postMqttTopicStop = async ({ iotTag, Topic }) => {
|
||||||
const res = await instance.post(POST_MQTT_TOPIC_STOP_API, { 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,
|
msg: res.msg,
|
||||||
code: res.code,
|
code: res.code,
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const apihandler = (code, successData, errorData, cb = null) => {
|
const apiHandler = (code, successData, errorData, cb = null) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (code === "0000") {
|
if (code === "0000") {
|
||||||
cb && cb(successData);
|
cb && cb(successData);
|
||||||
@ -8,4 +8,4 @@ const apihandler = (code, successData, errorData, cb = null) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export default apihandler;
|
export default apiHandler;
|
||||||
|
@ -38,7 +38,7 @@ const loadSystemConfig = async () => {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const res = await getSystemConfig(building_guid);
|
const res = await getSystemConfig(building_guid);
|
||||||
// 你的 apihandler 可能回傳 { data, code, msg } 或直接回 data,兩者都兼容:
|
// 你的 apiHandler 可能回傳 { data, code, msg } 或直接回 data,兩者都兼容:
|
||||||
const data = res?.data ?? res;
|
const data = res?.data ?? res;
|
||||||
showRefrigeration.value = !!data?.show_refrigeration;
|
showRefrigeration.value = !!data?.show_refrigeration;
|
||||||
// 若未來還要控制其他區塊(如 show_room、show_production_indicator),也可一併在這裡設定
|
// 若未來還要控制其他區塊(如 show_room、show_production_indicator),也可一併在這裡設定
|
||||||
|
Loading…
Reference in New Issue
Block a user