Compare commits
No commits in common. "feature/dockerAndLocal" and "main" have entirely different histories.
feature/do
...
main
123
.dockerignore
123
.dockerignore
@ -1,123 +0,0 @@
|
|||||||
# 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
|
|
@ -1,7 +0,0 @@
|
|||||||
node_modules
|
|
||||||
.git
|
|
||||||
.gitignore
|
|
||||||
Dockerfile
|
|
||||||
docker-compose.yml
|
|
||||||
README.md
|
|
||||||
.vs
|
|
@ -1,13 +1,13 @@
|
|||||||
# Project
|
# Project
|
||||||
PROJ_NAME=proj_bims_empower
|
PROJ_NAME=proj_bims_ils-svc
|
||||||
|
|
||||||
# Network 網路環境
|
# Network 網路環境
|
||||||
NET_TRAEFIK=net-traefik_svc
|
NET_TRAEFIK=net-traefik_svc
|
||||||
|
|
||||||
# Image: org/name
|
# Image: org/name
|
||||||
IMAGE_PROJ_NAME=proj_bims_empower
|
IMAGE_PROJ_NAME=proj_bims_ils
|
||||||
IMAGE_NAME=empower-front
|
IMAGE_NAME=empower-front
|
||||||
TAG_VERSION=0.1.11
|
TAG_VERSION=0.1.0
|
||||||
|
|
||||||
# Remote
|
# Remote
|
||||||
REMOTE_URL=harbor.mjm-staging.developers-homelab.net
|
REMOTE_URL=harbor.mjm-staging.developers-homelab.net
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
#!/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 "$@"
|
|
44
Dockerfile
44
Dockerfile
@ -1,44 +0,0 @@
|
|||||||
|
|
||||||
# 使用 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
20
Scripts/.env
@ -1,20 +0,0 @@
|
|||||||
# 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=新創賦能
|
|
@ -1,40 +0,0 @@
|
|||||||
@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! ../
|
|
@ -1,53 +0,0 @@
|
|||||||
@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
|
|
@ -1,24 +0,0 @@
|
|||||||
#!/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 "$@"
|
|
@ -1,69 +0,0 @@
|
|||||||
@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 +0,0 @@
|
|||||||
1.0.2-2510091649
|
|
@ -5,12 +5,11 @@
|
|||||||
<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,
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
// 本地開發 BASEURL
|
// graph
|
||||||
// const BASEURL = import.meta.env.VITE_API_BASEURL;
|
const BASEURL = import.meta.env.VITE_API_BASEURL;
|
||||||
// docker 部屬 BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const BASEURL = window.env?.VITE_API_BASEURL;
|
|
||||||
|
|
||||||
export const GET_GRAPH_SIDEBAR_API = `/GraphManage/GraphManageTreeList`;
|
export const GET_GRAPH_SIDEBAR_API = `/GraphManage/GraphManageTreeList`;
|
||||||
|
|
||||||
export const UPDATE_GRAPH_SIDEBAR_API = `/GraphManage/EditGraphManageTree`;
|
export const UPDATE_GRAPH_SIDEBAR_API = `/GraphManage/EditGraphManageTree`;
|
||||||
|
@ -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,
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
// history
|
// history
|
||||||
// 本地開發 BASEURL
|
const BASEURL = import.meta.env.VITE_API_BASEURL;
|
||||||
// const BASEURL = import.meta.env.VITE_API_BASEURL;
|
|
||||||
// docker 部屬 BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const BASEURL = window.env?.VITE_API_BASEURL;
|
|
||||||
|
|
||||||
export const GET_HISTORY_SIDEBAR_API = `/api/History/GetDeviceInfo`;
|
export const GET_HISTORY_SIDEBAR_API = `/api/History/GetDeviceInfo`;
|
||||||
export const GET_HISTORY_POINT_API = `/api/History/GetAllDevPoi`;
|
export const GET_HISTORY_POINT_API = `/api/History/GetAllDevPoi`;
|
||||||
export const GET_HISTORY_DATA_API = `/api/History/GetHistoryData`;
|
export const GET_HISTORY_DATA_API = `/api/History/GetHistoryData`;
|
||||||
|
@ -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,
|
||||||
});
|
});
|
||||||
|
@ -202,7 +202,7 @@ watch(
|
|||||||
class="flex flex-col justify-center w-3 mx-2 relative"
|
class="flex flex-col justify-center w-3 mx-2 relative"
|
||||||
@click="() => sort(column.key)"
|
@click="() => sort(column.key)"
|
||||||
>
|
>
|
||||||
<!-- <font-awesome-icon
|
<font-awesome-icon
|
||||||
:icon="['fas', 'sort-up']"
|
:icon="['fas', 'sort-up']"
|
||||||
:class="
|
:class="
|
||||||
twMerge(
|
twMerge(
|
||||||
@ -221,19 +221,30 @@ watch(
|
|||||||
)
|
)
|
||||||
"
|
"
|
||||||
size="lg"
|
size="lg"
|
||||||
/> -->
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-2 relative" v-if="column.filter">
|
<div class="ml-2 relative" v-if="column.filter">
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="['fas', 'filter']"
|
||||||
|
:class="
|
||||||
|
twMerge(
|
||||||
|
filterColumn[column.key] ||
|
||||||
|
selectedFilterItem[column.key].length > 0
|
||||||
|
? 'text-success'
|
||||||
|
: ''
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@click="() => toggleFilterModal(column.key)"
|
||||||
|
/>
|
||||||
<div class="fixed z-50" v-if="filterColumn[column.key]">
|
<div class="fixed z-50" v-if="filterColumn[column.key]">
|
||||||
<div class="card min-w-max bg-body shadow-xl px-10 py-5">
|
<div class="card min-w-max bg-body shadow-xl px-10 py-5">
|
||||||
<label
|
<label
|
||||||
class="input input-bordered bg-transparent rounded-lg flex items-center px-2 mb-4 border-success focus-within:border-success"
|
class="input input-bordered bg-transparent rounded-lg flex items-center px-2 mb-4 border-success focus-within:border-success"
|
||||||
>
|
>
|
||||||
<!-- <font-awesome-icon
|
<font-awesome-icon
|
||||||
:icon="['fas', 'search']"
|
:icon="['fas', 'search']"
|
||||||
class="w-6 h-6 mr-2 text-success"
|
class="w-6 h-6 mr-2 text-success"
|
||||||
/> -->
|
/>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
:placeholder="t('operation.enter_text')"
|
:placeholder="t('operation.enter_text')"
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted } from "vue";
|
import { ref, onMounted, onUnmounted } from "vue";
|
||||||
|
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
|
|
||||||
const forgeDom = ref(null);
|
const forgeDom = ref(null);
|
||||||
let viewer = null;
|
let viewer = null;
|
||||||
|
@ -164,10 +164,7 @@ const initForge = async () => {
|
|||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const viewer = await initViewer(forgeDom.value)
|
const viewer = await initViewer(forgeDom.value)
|
||||||
const filePath = `${FILE_BASEURL}/upload/forge/0.svf`;
|
const filePath = `${FILE_BASEURL}/upload/forge/0.svf`;
|
||||||
await loadModel(viewer, filePath)
|
await loadModel(viewer, filePath)
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
// 本地開發 BASEURL
|
const BASEURL = import.meta.env.VITE_API_BASEURL;
|
||||||
// const BASEURL = import.meta.env.VITE_API_BASEURL;
|
|
||||||
// docker 部屬 BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const BASEURL = window.env?.VITE_API_BASEURL;;
|
|
||||||
|
|
||||||
export const POST_LOGIN = `${BASEURL}/api/Login/`;
|
export const POST_LOGIN = `${BASEURL}/api/Login/`;
|
||||||
export const GET_AUTHPAGE_API = `${BASEURL}/api/GetUsrFroList`;
|
export const GET_AUTHPAGE_API = `${BASEURL}/api/GetUsrFroList`;
|
||||||
export const GET_SUBAUTHPAGE_API = `${BASEURL}/api/Device/GetMainSub`;
|
export const GET_SUBAUTHPAGE_API = `${BASEURL}/api/Device/GetMainSub`;
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
// 本地開發 BASEURL
|
const BASEURL = import.meta.env.VITE_API_BASEURL;
|
||||||
// const BASEURL = import.meta.env.VITE_API_BASEURL;
|
|
||||||
// docker 部屬 BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const BASEURL = window.env?.VITE_API_BASEURL;;
|
|
||||||
|
|
||||||
export const GET_FORGETOKEN_API = `${BASEURL}/api/forge/oauth/token`;
|
export const GET_FORGETOKEN_API = `${BASEURL}/api/forge/oauth/token`;
|
||||||
|
|
||||||
export const GET_FORGEURN_API = `${BASEURL}/api/Device/GetBuild`;
|
export const GET_FORGEURN_API = `${BASEURL}/api/Device/GetBuild`;
|
||||||
|
@ -4,14 +4,13 @@ const moveModal = (elmnt) => {
|
|||||||
pos2 = 0,
|
pos2 = 0,
|
||||||
pos3 = 0,
|
pos3 = 0,
|
||||||
pos4 = 0;
|
pos4 = 0;
|
||||||
elmnt.addEventListener("mousedown", dragMouseDown, {
|
document.body.addEventListener("mousedown", dragMouseDown, {
|
||||||
passive: false,
|
passive: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
function dragMouseDown(e) {
|
function dragMouseDown(e) {
|
||||||
console.log("dragMouseDown", e);
|
console.log("dragMouseDown", e);
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
if (e.button !== 0) return;
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// get the mouse cursor position at startup:
|
// get the mouse cursor position at startup:
|
||||||
pos3 = e.clientX;
|
pos3 = e.clientX;
|
||||||
|
Binary file not shown.
@ -5,10 +5,7 @@ import System from "@/views/system/System.vue";
|
|||||||
import SystemFloor from "@/views/system/SystemFloor.vue";
|
import SystemFloor from "@/views/system/SystemFloor.vue";
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
// 本地開發 BASE_URL
|
history: createWebHashHistory(import.meta.env.BASE_URL),
|
||||||
// history: createWebHashHistory(import.meta.env.BASE_URL),
|
|
||||||
// docker 部屬 BASE_URL (兩者視部屬方式擇一保留)
|
|
||||||
history: createWebHashHistory(window.env?.BASE_URL),
|
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: "/login",
|
path: "/login",
|
||||||
|
@ -11,10 +11,9 @@ const useHeatmapBarStore = defineStore("heatmap", () => {
|
|||||||
|
|
||||||
const getConfig = async () => {
|
const getConfig = async () => {
|
||||||
const api =
|
const api =
|
||||||
// 本地開發 MODE
|
import.meta.env.MODE === "production"
|
||||||
// import.meta.env.MODE === "production"
|
? "/dist/config.json"
|
||||||
// docker 部屬 MODE (兩者視部屬方式擇一保留)
|
: "/config.json";
|
||||||
window.env?.MODE === "production" ? "/dist/config.json" : "/config.json";
|
|
||||||
const res = await axios.get(api);
|
const res = await axios.get(api);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
allHeatMaps.value = res.data.heatmap;
|
allHeatMaps.value = res.data.heatmap;
|
||||||
|
@ -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;
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
// 本地開發 BASEURL
|
const BASEURL = import.meta.env.VITE_API_BASEURL;
|
||||||
// const BASEURL = import.meta.env.VITE_API_BASEURL;
|
|
||||||
// docker 部屬 BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const BASEURL = window.env?.VITE_API_BASEURL;;
|
|
||||||
|
|
||||||
export default function downloadExcel(res) {
|
export default function downloadExcel(res) {
|
||||||
let disposition = res.headers.get("Content-Disposition");
|
let disposition = res.headers.get("Content-Disposition");
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
import useGetCookie from "@/hooks/useGetCookie";
|
import useGetCookie from "@/hooks/useGetCookie";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
// 本地開發 BASEURL
|
const BASEURL = import.meta.env.VITE_API_BASEURL;
|
||||||
// const BASEURL = import.meta.env.VITE_API_BASEURL;
|
|
||||||
// docker 部屬 BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const BASEURL = window.env?.VITE_API_BASEURL;;
|
|
||||||
|
|
||||||
const instance = axios.create({
|
const instance = axios.create({
|
||||||
baseURL: BASEURL,
|
baseURL: BASEURL,
|
||||||
|
@ -10,10 +10,7 @@ import { useI18n } from "vue-i18n";
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openToast, cancelToastOpen } = inject("app_toast");
|
const { openToast, cancelToastOpen } = inject("app_toast");
|
||||||
const { companyOptions, departmentList, floors } = inject("asset_modal_options");
|
const { companyOptions, departmentList, floors } = inject("asset_modal_options");
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const { searchParams, changeParams } = useSearchParam();
|
const { searchParams, changeParams } = useSearchParam();
|
||||||
|
|
||||||
const totalCoordinates = ref({});
|
const totalCoordinates = ref({});
|
||||||
|
@ -10,10 +10,7 @@ import useUserInfoStore from "@/stores/useUserInfoStore";
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const { searchParams, changeParams } = useSearchParam();
|
const { searchParams, changeParams } = useSearchParam();
|
||||||
const { updateLeftFields, formErrorMsg, formState } = inject(
|
const { updateLeftFields, formErrorMsg, formState } = inject(
|
||||||
"asset_table_modal_form"
|
"asset_table_modal_form"
|
||||||
|
@ -4,10 +4,7 @@ import { ref, computed, inject, watch, onMounted } from "vue";
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import Menu from "@/components/customUI/Menu.vue";
|
import Menu from "@/components/customUI/Menu.vue";
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const { formState } = inject("asset_table_modal_form");
|
const { formState } = inject("asset_table_modal_form");
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -7,10 +7,7 @@ import { twMerge } from "tailwind-merge";
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const { totalCoordinates } = inject("asset_table_data");
|
const { totalCoordinates } = inject("asset_table_data");
|
||||||
const { floors } = inject("asset_modal_options");
|
const { floors } = inject("asset_modal_options");
|
||||||
const { updateRightFields, formErrorMsg, formState } = inject(
|
const { updateRightFields, formErrorMsg, formState } = inject(
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, defineProps, watch, inject, onMounted } from "vue";
|
import {
|
||||||
|
ref,
|
||||||
|
defineProps,
|
||||||
|
watch,
|
||||||
|
inject,
|
||||||
|
nextTick,
|
||||||
|
onMounted,
|
||||||
|
toRaw,
|
||||||
|
} from "vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { postOperationRecord } from "@/apis/alert";
|
import { postOperationRecord } from "@/apis/alert";
|
||||||
import * as yup from "yup";
|
import * as yup from "yup";
|
||||||
@ -7,10 +15,7 @@ import "yup-phone-lite";
|
|||||||
import useFormErrorMessage from "@/hooks/useFormErrorMessage";
|
import useFormErrorMessage from "@/hooks/useFormErrorMessage";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
editRecord: Object,
|
editRecord: Object,
|
||||||
@ -88,6 +93,28 @@ const updateFileList = (files) => {
|
|||||||
formState.value.lorf = files;
|
formState.value.lorf = files;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ---------------------- 告警影片儲存位置:顯示 API 的 video_url ----------------------
|
||||||
|
// 重要:你的 <Input name="videoLocation" :value="..."> 會從 value[name] 取值
|
||||||
|
// 所以我們把 videoLocation 寫成 { videoLocation: string } 的物件
|
||||||
|
const videoLocation = ref({ videoLocation: "" });
|
||||||
|
const showTooltip = ref(false);
|
||||||
|
|
||||||
|
async function copyToClipboard() {
|
||||||
|
const text = videoLocation.value.videoLocation || "";
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(text);
|
||||||
|
// 觸發 tooltip 動畫
|
||||||
|
showTooltip.value = false;
|
||||||
|
await nextTick();
|
||||||
|
showTooltip.value = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
showTooltip.value = false;
|
||||||
|
}, 1500);
|
||||||
|
} catch (err) {
|
||||||
|
console.error("複製失敗:", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const onOk = async () => {
|
const onOk = async () => {
|
||||||
const formData = new FormData(form.value);
|
const formData = new FormData(form.value);
|
||||||
formData.delete("oriFile");
|
formData.delete("oriFile");
|
||||||
@ -150,12 +177,14 @@ const onCancel = () => {
|
|||||||
description: "",
|
description: "",
|
||||||
lorf: [],
|
lorf: [],
|
||||||
};
|
};
|
||||||
|
// 重置顯示用的影片路徑
|
||||||
|
videoLocation.value.videoLocation = "";
|
||||||
handleErrorReset();
|
handleErrorReset();
|
||||||
updateEditRecord?.(null);
|
updateEditRecord?.(null);
|
||||||
alert_action_item.close();
|
alert_action_item.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 同步 props.editRecord -> formState / 日期 / 維修項目
|
// 同步 props.editRecord -> formState / 日期 / 維修項目 / 影片網址
|
||||||
watch(
|
watch(
|
||||||
() => props.editRecord,
|
() => props.editRecord,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
@ -174,6 +203,10 @@ watch(
|
|||||||
formState.value.fix_do = value ?? "";
|
formState.value.fix_do = value ?? "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 取 API 回傳的影片位址(與 device_number 同來源物件)
|
||||||
|
videoLocation.value.videoLocation =
|
||||||
|
newVal?.video_url ?? newVal?.videoUrl ?? newVal?.video_path ?? "";
|
||||||
|
debugLog("derived videoLocation", videoLocation.value.videoLocation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
@ -225,8 +258,16 @@ watch(
|
|||||||
name="work_type"
|
name="work_type"
|
||||||
Attribute="title"
|
Attribute="title"
|
||||||
:options="[
|
:options="[
|
||||||
{ key: 1, value: 1, title: $t('alert.maintenance') },
|
{
|
||||||
{ key: 2, value: 2, title: $t('alert.repair') },
|
key: 1,
|
||||||
|
value: 1,
|
||||||
|
title: $t('alert.maintenance'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 2,
|
||||||
|
value: 2,
|
||||||
|
title: $t('alert.repair'),
|
||||||
|
},
|
||||||
]"
|
]"
|
||||||
:required="true"
|
:required="true"
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
@ -235,8 +276,8 @@ watch(
|
|||||||
</Select>
|
</Select>
|
||||||
<Input class="my-2" :value="formState" name="fix_do" :required="true">
|
<Input class="my-2" :value="formState" name="fix_do" :required="true">
|
||||||
<template #topLeft>{{ $t("alert.repair_item") }}</template>
|
<template #topLeft>{{ $t("alert.repair_item") }}</template>
|
||||||
<template #bottomLeft>
|
<template #bottomLeft
|
||||||
<span class="text-error text-base">
|
><span class="text-error text-base">
|
||||||
{{ formErrorMsg.fix_do }}
|
{{ formErrorMsg.fix_do }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
@ -249,11 +290,11 @@ watch(
|
|||||||
:disabled="true"
|
:disabled="true"
|
||||||
>
|
>
|
||||||
<template #topLeft>{{ $t("alert.repair_item_code") }}</template>
|
<template #topLeft>{{ $t("alert.repair_item_code") }}</template>
|
||||||
<template #bottomLeft>
|
<template #bottomLeft
|
||||||
<span class="text-error text-base">
|
><span class="text-error text-base">
|
||||||
{{ formErrorMsg.fix_do_code }}
|
{{ formErrorMsg.fix_do_code }}
|
||||||
</span>
|
</span></template
|
||||||
</template>
|
>
|
||||||
</Input>
|
</Input>
|
||||||
<Select
|
<Select
|
||||||
:value="formState"
|
:value="formState"
|
||||||
@ -265,19 +306,27 @@ watch(
|
|||||||
:required="true"
|
:required="true"
|
||||||
>
|
>
|
||||||
<template #topLeft>{{ $t("alert.responsible_vendor") }}</template>
|
<template #topLeft>{{ $t("alert.responsible_vendor") }}</template>
|
||||||
<template #bottomLeft>
|
<template #bottomLeft
|
||||||
<span class="text-error text-base">
|
><span class="text-error text-base">
|
||||||
{{ formErrorMsg.fix_firm }}
|
{{ formErrorMsg.fix_firm }}
|
||||||
</span>
|
</span></template
|
||||||
</template>
|
>
|
||||||
</Select>
|
</Select>
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
class="my-2"
|
class="my-2"
|
||||||
name="status"
|
name="status"
|
||||||
:value="formState"
|
:value="formState"
|
||||||
:items="[
|
:items="[
|
||||||
{ key: 0, value: 0, title: $t('alert.not_completed') },
|
{
|
||||||
{ key: 1, value: 1, title: $t('alert.completed') },
|
key: 0,
|
||||||
|
value: 0,
|
||||||
|
title: $t('alert.not_completed'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 1,
|
||||||
|
value: 1,
|
||||||
|
title: $t('alert.completed'),
|
||||||
|
},
|
||||||
]"
|
]"
|
||||||
:required="true"
|
:required="true"
|
||||||
>
|
>
|
||||||
@ -293,11 +342,11 @@ watch(
|
|||||||
:required="true"
|
:required="true"
|
||||||
>
|
>
|
||||||
<template #topLeft>{{ $t("alert.worker_id") }}</template>
|
<template #topLeft>{{ $t("alert.worker_id") }}</template>
|
||||||
<template #bottomLeft>
|
<template #bottomLeft
|
||||||
<span class="text-error text-base">
|
><span class="text-error text-base">
|
||||||
{{ formErrorMsg.work_person_id }}
|
{{ formErrorMsg.work_person_id }}
|
||||||
</span>
|
</span></template
|
||||||
</template>
|
>
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
<!-- 注意事項 -->
|
<!-- 注意事項 -->
|
||||||
@ -305,11 +354,45 @@ watch(
|
|||||||
<template #topLeft>{{ $t("alert.notice") }}</template>
|
<template #topLeft>{{ $t("alert.notice") }}</template>
|
||||||
</Textarea>
|
</Textarea>
|
||||||
|
|
||||||
|
<!-- 告警影片儲存位置-->
|
||||||
|
<div class="my-4 w-full">
|
||||||
|
<label class="text-lg">
|
||||||
|
{{ $t("alert.video_storage_location") }}
|
||||||
|
</label>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<Input
|
||||||
|
class="flex-1"
|
||||||
|
name="videoLocation"
|
||||||
|
:value="videoLocation"
|
||||||
|
readonly
|
||||||
|
/>
|
||||||
|
<div class="relative inline-flex items-center">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-success"
|
||||||
|
@click.stop="copyToClipboard"
|
||||||
|
>
|
||||||
|
{{ $t("alert.copy") }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<transition name="fade">
|
||||||
|
<span
|
||||||
|
v-if="showTooltip"
|
||||||
|
class="absolute left-full ml-4 top-1/2 -translate-y-1/2 text-white text-xs px-2 py-1 bg-gray-800 rounded shadow whitespace-nowrap"
|
||||||
|
role="status"
|
||||||
|
aria-live="polite"
|
||||||
|
>
|
||||||
|
{{ $t("alert.copied") }}
|
||||||
|
</span>
|
||||||
|
</transition>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 結果描述 -->
|
<!-- 結果描述 -->
|
||||||
<Textarea :value="formState" name="description" class="w-full my-2">
|
<Textarea :value="formState" name="description" class="w-full my-2">
|
||||||
<template #topLeft>{{ $t("alert.result_description") }}</template>
|
<template #topLeft>{{ $t("alert.result_description") }}</template>
|
||||||
</Textarea>
|
</Textarea>
|
||||||
|
|
||||||
<Upload
|
<Upload
|
||||||
class="my-2"
|
class="my-2"
|
||||||
name="oriFile"
|
name="oriFile"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { inject, defineProps, watch, ref } from "vue";
|
import { inject, defineProps, watch, ref, provide } from "vue";
|
||||||
import useSearchParam from "@/hooks/useSearchParam";
|
import useSearchParam from "@/hooks/useSearchParam";
|
||||||
import useFormErrorMessage from "@/hooks/useFormErrorMessage";
|
import useFormErrorMessage from "@/hooks/useFormErrorMessage";
|
||||||
import AlertNoticesTable from "./AlertNoticesTable.vue";
|
import AlertNoticesTable from "./AlertNoticesTable.vue";
|
||||||
@ -9,7 +9,7 @@ import { useI18n } from "vue-i18n";
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openToast } = inject("app_toast");
|
const { openToast } = inject("app_toast");
|
||||||
const { timesList, noticeList } = inject("notify_table");
|
const { timesList, noticeList } = inject("notify_table");
|
||||||
const { searchParams } = useSearchParam();
|
const { searchParams, changeParams } = useSearchParam();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
openModal: Function,
|
openModal: Function,
|
||||||
@ -19,8 +19,8 @@ const props = defineProps({
|
|||||||
OptionsData: Object,
|
OptionsData: Object,
|
||||||
});
|
});
|
||||||
|
|
||||||
// ---- 初始表單狀態(統一使用此物件重置) ----
|
const form = ref(null);
|
||||||
const initialFormState = () => ({
|
const formState = ref({
|
||||||
id: 0,
|
id: 0,
|
||||||
device_number: "",
|
device_number: "",
|
||||||
device_name_tag: searchParams.value?.subSys_id,
|
device_name_tag: searchParams.value?.subSys_id,
|
||||||
@ -28,7 +28,7 @@ const initialFormState = () => ({
|
|||||||
enable: 0,
|
enable: 0,
|
||||||
factor: 1,
|
factor: 1,
|
||||||
alarm_value: "",
|
alarm_value: "",
|
||||||
delay: null,
|
delay: 0,
|
||||||
highLimit: null,
|
highLimit: null,
|
||||||
lowLimit: null,
|
lowLimit: null,
|
||||||
highDelay: null,
|
highDelay: null,
|
||||||
@ -36,35 +36,20 @@ const initialFormState = () => ({
|
|||||||
notices: [],
|
notices: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const form = ref(null);
|
let scheme = yup.object({
|
||||||
const formState = ref(initialFormState());
|
|
||||||
|
|
||||||
/** 將數字欄位統一做「可空值」轉換:空字串/undefined/null -> null,其餘轉 number */
|
|
||||||
const numNullable = () =>
|
|
||||||
yup
|
|
||||||
.number()
|
|
||||||
.transform((value, originalValue) =>
|
|
||||||
originalValue === "" || originalValue === undefined || originalValue === null
|
|
||||||
? null
|
|
||||||
: value
|
|
||||||
)
|
|
||||||
.nullable();
|
|
||||||
|
|
||||||
// ---- 驗證規則:上下限/延遲一律非必填 ----
|
|
||||||
const scheme = yup.object({
|
|
||||||
device_number: yup.string().required(t("button.required")),
|
device_number: yup.string().required(t("button.required")),
|
||||||
points: yup.string().required(t("button.required")),
|
points: yup.string().required(t("button.required")),
|
||||||
factor: numNullable(),
|
factor: yup.number().nullable(),
|
||||||
enable: numNullable().required(),
|
enable: yup.number().required(),
|
||||||
delay: numNullable(),
|
highLimit: yup.number().nullable(),
|
||||||
highLimit: numNullable(),
|
lowLimit: yup.number().nullable(),
|
||||||
lowLimit: numNullable(),
|
highDelay: yup.number().nullable(),
|
||||||
highDelay: numNullable(),
|
lowDelay: yup.number().nullable(),
|
||||||
lowDelay: numNullable(),
|
|
||||||
// alarm_value 如不需驗證可不放 schema;若要限制型別可在此補上
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const { formErrorMsg, handleSubmit, handleErrorReset } = useFormErrorMessage(scheme);
|
const { formErrorMsg, handleSubmit, handleErrorReset } = useFormErrorMessage(
|
||||||
|
scheme.value
|
||||||
|
);
|
||||||
|
|
||||||
const SaveCheckAuth = ref([]);
|
const SaveCheckAuth = ref([]);
|
||||||
const factorNum = ref(1);
|
const factorNum = ref(1);
|
||||||
@ -73,30 +58,15 @@ watch(
|
|||||||
() => props.editRecord,
|
() => props.editRecord,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
// 將不存在或空字串的數字欄位正規化為 null,避免編輯時被當作「必填」
|
|
||||||
const normalize = (v) =>
|
|
||||||
v === "" || v === undefined ? null : v;
|
|
||||||
|
|
||||||
formState.value = {
|
formState.value = {
|
||||||
...initialFormState(),
|
|
||||||
...newValue,
|
...newValue,
|
||||||
delay: normalize(newValue.delay),
|
|
||||||
highLimit: normalize(newValue.highLimit),
|
|
||||||
lowLimit: normalize(newValue.lowLimit),
|
|
||||||
highDelay: normalize(newValue.highDelay),
|
|
||||||
lowDelay: normalize(newValue.lowDelay),
|
|
||||||
};
|
};
|
||||||
|
console.log('formState.value',formState.value);
|
||||||
|
|
||||||
SaveCheckAuth.value = Array.isArray(newValue.notices)
|
SaveCheckAuth.value = newValue.notices ? [...newValue.notices] : [];
|
||||||
? [...newValue.notices]
|
|
||||||
: newValue.notices
|
|
||||||
? [newValue.notices]
|
|
||||||
: [];
|
|
||||||
|
|
||||||
if (newValue.factor) {
|
if (newValue.factor) {
|
||||||
onFactorsChange(newValue.factor);
|
onFactorsChange(newValue.factor);
|
||||||
} else {
|
|
||||||
factorNum.value = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,9 +81,7 @@ const onNoticesChange = (value, checked) => {
|
|||||||
if (SaveCheckAuth.value.length === 1 && SaveCheckAuth.value[0] === "") {
|
if (SaveCheckAuth.value.length === 1 && SaveCheckAuth.value[0] === "") {
|
||||||
SaveCheckAuth.value = [];
|
SaveCheckAuth.value = [];
|
||||||
}
|
}
|
||||||
if (!SaveCheckAuth.value.includes(value)) {
|
SaveCheckAuth.value = [...SaveCheckAuth.value, value];
|
||||||
SaveCheckAuth.value = [...SaveCheckAuth.value, value];
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
SaveCheckAuth.value = SaveCheckAuth.value.filter((v) => v !== value);
|
SaveCheckAuth.value = SaveCheckAuth.value.filter((v) => v !== value);
|
||||||
}
|
}
|
||||||
@ -128,7 +96,6 @@ const onOk = async () => {
|
|||||||
device_name_tag: searchParams.value?.subSys_id,
|
device_name_tag: searchParams.value?.subSys_id,
|
||||||
notices: SaveCheckAuth.value ? SaveCheckAuth.value : [],
|
notices: SaveCheckAuth.value ? SaveCheckAuth.value : [],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.isSuccess) {
|
if (res.isSuccess) {
|
||||||
props.getData();
|
props.getData();
|
||||||
closeModal();
|
closeModal();
|
||||||
@ -138,11 +105,10 @@ const onOk = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
formState.value = initialFormState();
|
formState.value = {};
|
||||||
SaveCheckAuth.value = [];
|
|
||||||
factorNum.value = 1;
|
|
||||||
handleErrorReset();
|
handleErrorReset();
|
||||||
props.onCancel();
|
props.onCancel();
|
||||||
|
factorNum.value = 1;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -168,11 +134,12 @@ const closeModal = () => {
|
|||||||
:options="OptionsData.devList"
|
:options="OptionsData.devList"
|
||||||
>
|
>
|
||||||
<template #topLeft>{{ $t("alert.device_name") }}</template>
|
<template #topLeft>{{ $t("alert.device_name") }}</template>
|
||||||
<template #bottomLeft>
|
<template #bottomLeft
|
||||||
<span class="text-error text-base">{{ formErrorMsg.device_number }}</span>
|
><span class="text-error text-base">
|
||||||
</template>
|
{{ formErrorMsg.device_number }}
|
||||||
|
</span></template
|
||||||
|
>
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
:value="formState"
|
:value="formState"
|
||||||
class="my-2"
|
class="my-2"
|
||||||
@ -182,11 +149,12 @@ const closeModal = () => {
|
|||||||
:options="OptionsData.alarmPoints"
|
:options="OptionsData.alarmPoints"
|
||||||
>
|
>
|
||||||
<template #topLeft>{{ $t("alert.item") }}</template>
|
<template #topLeft>{{ $t("alert.item") }}</template>
|
||||||
<template #bottomLeft>
|
<template #bottomLeft
|
||||||
<span class="text-error text-base">{{ formErrorMsg.points }}</span>
|
><span class="text-error text-base">
|
||||||
</template>
|
{{ formErrorMsg.points }}
|
||||||
|
</span></template
|
||||||
|
>
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
:value="formState"
|
:value="formState"
|
||||||
class="my-2"
|
class="my-2"
|
||||||
@ -198,63 +166,84 @@ const closeModal = () => {
|
|||||||
>
|
>
|
||||||
<template #topLeft>{{ $t("alert.qualifications") }}</template>
|
<template #topLeft>{{ $t("alert.qualifications") }}</template>
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
class="my-2"
|
class="my-2"
|
||||||
name="enable"
|
name="enable"
|
||||||
:value="formState"
|
:value="formState"
|
||||||
:items="[
|
:items="[
|
||||||
{ key: 1, value: 1, title: $t('alert.enable') },
|
{
|
||||||
{ key: 0, value: 0, title: $t('alert.not_enabled') },
|
key: 1,
|
||||||
|
value: 1,
|
||||||
|
title: $t('alert.enable'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 0,
|
||||||
|
value: 0,
|
||||||
|
title: $t('alert.not_enabled'),
|
||||||
|
},
|
||||||
]"
|
]"
|
||||||
:required="true"
|
:required="true"
|
||||||
>
|
>
|
||||||
<template #topLeft>{{ $t('alert.status') }}</template>
|
<template #topLeft>{{ $t("alert.status") }}</template>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<template v-if="factorNum == 1">
|
<template v-if="factorNum == 1">
|
||||||
<InputNumber :value="formState" class="my-2" name="delay">
|
<InputNumber :value="formState" class="my-2" name="delay">
|
||||||
<template #topLeft>{{ $t('alert.delay') }}</template>
|
<template #topLeft>{{ $t("alert.delay") }}</template>
|
||||||
</InputNumber>
|
</InputNumber>
|
||||||
<span class="text-error text-base ml-1">{{ formErrorMsg.delay }}</span>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="factorNum == 2">
|
<template v-if="factorNum == 2">
|
||||||
<div class="flex gap-4 w-full">
|
<div class="flex gap-4 w-full">
|
||||||
<InputNumber :value="formState" class="my-2" name="highLimit">
|
<InputNumber :value="formState" class="my-2" name="highLimit">
|
||||||
<template #topLeft>{{ $t('alert.upper_limit') }}(>=)</template>
|
<template #topLeft>{{ $t("alert.upper_limit") }}(>=)</template>
|
||||||
</InputNumber>
|
</InputNumber>
|
||||||
<InputNumber :value="formState" class="my-2" name="lowLimit">
|
<InputNumber :value="formState" class="my-2" name="lowLimit">
|
||||||
<template #topLeft>{{ $t('alert.lower_limit') }}(<=)</template>
|
<template #topLeft>{{ $t("alert.lower_limit") }}(<=)</template>
|
||||||
</InputNumber>
|
</InputNumber>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-4 w-full -mt-2">
|
|
||||||
<span class="text-error text-base flex-1 ml-1">{{ formErrorMsg.highLimit }}</span>
|
|
||||||
<span class="text-error text-base flex-1 ml-1">{{ formErrorMsg.lowLimit }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex gap-4 w-full">
|
<div class="flex gap-4 w-full">
|
||||||
<InputNumber :value="formState" class="my-2" name="highDelay">
|
<InputNumber :value="formState" class="my-2" name="highDelay">
|
||||||
<template #topLeft>{{ $t('alert.highDelay') }}</template>
|
<template #topLeft>{{ $t("alert.highDelay") }}</template>
|
||||||
</InputNumber>
|
</InputNumber>
|
||||||
<InputNumber :value="formState" class="my-2" name="lowDelay">
|
<InputNumber :value="formState" class="my-2" name="lowDelay">
|
||||||
<template #topLeft>{{ $t('alert.lowDelay') }}</template>
|
<template #topLeft>{{ $t("alert.lowDelay") }}</template>
|
||||||
</InputNumber>
|
</InputNumber>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-4 w-full -mt-2">
|
|
||||||
<span class="text-error text-base flex-1 ml-1">{{ formErrorMsg.highDelay }}</span>
|
|
||||||
<span class="text-error text-base flex-1 ml-1">{{ formErrorMsg.lowDelay }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="factorNum == 3">
|
<template v-if="factorNum == 3">
|
||||||
<Input :value="formState" class="my-2" name="alarm_value">
|
<Input :value="formState" class="my-2" name="alarm_value">
|
||||||
<template #topLeft>{{ $t('alert.warning_value') }}</template>
|
<template #topLeft>{{ $t("alert.warning_value") }}</template>
|
||||||
</Input>
|
</Input>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- <Select
|
||||||
|
:value="formState"
|
||||||
|
class="my-2"
|
||||||
|
selectClass="border-info focus-within:border-info"
|
||||||
|
name="schedule_id"
|
||||||
|
Attribute="schedule_name"
|
||||||
|
:options="timesList"
|
||||||
|
>
|
||||||
|
<template #topLeft>{{ $t("alert.warning_time") }}</template>
|
||||||
|
<template #topRight
|
||||||
|
><button
|
||||||
|
v-if="formState.schedule_id"
|
||||||
|
class="text-base btn-text-without-border"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
formState.schedule_id = null;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="['fas', 'times']"
|
||||||
|
class="text-[#a5abb1] me-1"
|
||||||
|
/>{{ $t("alert.clear") }}
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</Select> -->
|
||||||
<div class="w-full mt-5">
|
<div class="w-full mt-5">
|
||||||
<p class="text-light text-lg ml-1">{{ $t('alert.warning_method') }}</p>
|
<p class="text-light text-lg ml-1">
|
||||||
|
{{ $t("alert.warning_method") }}
|
||||||
|
</p>
|
||||||
<AlertNoticesTable
|
<AlertNoticesTable
|
||||||
:SaveCheckAuth="SaveCheckAuth"
|
:SaveCheckAuth="SaveCheckAuth"
|
||||||
:NoticeData="noticeList"
|
:NoticeData="noticeList"
|
||||||
@ -263,12 +252,19 @@ const closeModal = () => {
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #modalAction>
|
<template #modalAction>
|
||||||
<button type="reset" class="btn btn-outline-success mr-2" @click.prevent="closeModal">
|
<button
|
||||||
|
type="reset"
|
||||||
|
class="btn btn-outline-success mr-2"
|
||||||
|
@click.prevent="closeModal"
|
||||||
|
>
|
||||||
{{ $t("button.cancel") }}
|
{{ $t("button.cancel") }}
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" class="btn btn-outline-success" @click.prevent="onOk">
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="btn btn-outline-success"
|
||||||
|
@click.prevent="onOk"
|
||||||
|
>
|
||||||
{{ $t("button.submit") }}
|
{{ $t("button.submit") }}
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -5,51 +5,38 @@ import DashboardSysCard from "./components/DashboardSysCard.vue";
|
|||||||
import DashboardProduct from "./components/DashboardProduct.vue";
|
import DashboardProduct from "./components/DashboardProduct.vue";
|
||||||
import DashboardProductComplete from "./components/DashboardProductComplete.vue";
|
import DashboardProductComplete from "./components/DashboardProductComplete.vue";
|
||||||
import DashboardIndoor from "./components/DashboardIndoor.vue";
|
import DashboardIndoor from "./components/DashboardIndoor.vue";
|
||||||
|
// import DashboardRefrigTemp from "./components/DashboardRefrigTemp.vue";
|
||||||
|
// import DashboardIndoorTemp from "./components/DashboardIndoorTemp.vue";
|
||||||
import DashboardElectricity from "./components/DashboardElectricity.vue";
|
import DashboardElectricity from "./components/DashboardElectricity.vue";
|
||||||
import DashboardEmission from "./components/DashboardEmission.vue";
|
import DashboardEmission from "./components/DashboardEmission.vue";
|
||||||
import DashboardAlert from "./components/DashboardAlert.vue";
|
import DashboardAlert from "./components/DashboardAlert.vue";
|
||||||
import DashboardRefrig from "./components/DashboardRefrig.vue";
|
|
||||||
|
|
||||||
import { computed, inject, ref, watch, onMounted, onUnmounted } from "vue";
|
import { computed, inject, ref, watch, onMounted, onUnmounted } from "vue";
|
||||||
import useBuildingStore from "@/stores/useBuildingStore";
|
import useBuildingStore from "@/stores/useBuildingStore";
|
||||||
import { getSystemDevices, getSystemRealTime } from "@/apis/system";
|
import { getSystemDevices, getSystemRealTime } from "@/apis/system";
|
||||||
// 引入 getSystemConfig
|
import DashboardRefrig from "./components/DashboardRefrig.vue";
|
||||||
import { getSystemConfig } from "@/apis/system";
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
|
|
||||||
// 本地開發 FILE_BASEURL
|
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const buildingStore = useBuildingStore();
|
const buildingStore = useBuildingStore();
|
||||||
|
|
||||||
const subscribeData = ref([]);
|
const subscribeData = ref([]);
|
||||||
const systemData = ref({});
|
const systemData = ref({});
|
||||||
let intervalId = null;
|
let intervalId = null;
|
||||||
|
|
||||||
const productVisible = ref(false);
|
const productVisible = ref(false); // 產品產量儀表是否顯示
|
||||||
const productCompleteVisible = ref(false);
|
const productCompleteVisible = ref(false); // 今日達成率是否顯示
|
||||||
|
|
||||||
// 冷凍空調卡片顯示狀態(預設 false)
|
// 開始定時器
|
||||||
const showRefrigeration = ref(false);
|
const startInterval = () => {
|
||||||
|
// 清除之前的定時器(如果存在)
|
||||||
|
if (intervalId) {
|
||||||
|
clearInterval(intervalId);
|
||||||
|
}
|
||||||
|
|
||||||
// 讀取系統配置
|
// 每5秒呼叫一次 getData
|
||||||
const loadSystemConfig = async () => {
|
intervalId = setInterval(() => {
|
||||||
const building_guid = buildingStore.selectedBuilding?.building_guid;
|
getData();
|
||||||
if (!building_guid) {
|
}, 5000);
|
||||||
showRefrigeration.value = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const res = await getSystemConfig(building_guid);
|
|
||||||
const data = res?.data ?? res;
|
|
||||||
showRefrigeration.value = !!data?.show_refrigeration;
|
|
||||||
} catch (err) {
|
|
||||||
console.error("[Dashboard] getSystemConfig error:", err);
|
|
||||||
showRefrigeration.value = false; // 失敗時保守處理:不顯示
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 取得設備資料
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
const res = await getSystemDevices({
|
const res = await getSystemDevices({
|
||||||
building_guid: buildingStore.selectedBuilding?.building_guid,
|
building_guid: buildingStore.selectedBuilding?.building_guid,
|
||||||
@ -58,16 +45,20 @@ const getData = async () => {
|
|||||||
subscribeData.value = res.data;
|
subscribeData.value = res.data;
|
||||||
console.log("devices", subscribeData.value);
|
console.log("devices", subscribeData.value);
|
||||||
|
|
||||||
|
// 轉換資料格式
|
||||||
const transformedData = {};
|
const transformedData = {};
|
||||||
|
|
||||||
subscribeData.value.forEach((floor) => {
|
subscribeData.value.forEach((floor) => {
|
||||||
if (floor.device_list && floor.device_list.length > 0) {
|
if (floor.device_list && floor.device_list.length > 0) {
|
||||||
const fullUrl = floor.floor_map_name;
|
const fullUrl = floor.floor_map_name;
|
||||||
const uuid = fullUrl ? fullUrl.replace(/\.svg$/, "") : "";
|
const uuid = fullUrl ? fullUrl.replace(/\.svg$/, "") : "";
|
||||||
transformedData[uuid] = floor.device_list.map((device) => {
|
transformedData[uuid] = floor.device_list.map((device) => {
|
||||||
|
// 解析座標
|
||||||
const coordinates = JSON.parse(device.device_coordinate || "[0,0]");
|
const coordinates = JSON.parse(device.device_coordinate || "[0,0]");
|
||||||
const x = coordinates[0];
|
const x = coordinates[0];
|
||||||
const y = coordinates[1];
|
const y = coordinates[1];
|
||||||
|
|
||||||
|
// 決定設備狀態和顏色
|
||||||
let state = "Online";
|
let state = "Online";
|
||||||
let bgColor = device.device_normal_color;
|
let bgColor = device.device_normal_color;
|
||||||
|
|
||||||
@ -87,10 +78,10 @@ const getData = async () => {
|
|||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
{
|
{
|
||||||
device_number: device.device_number || "",
|
device_number: device.device_number || "", // 設備編號
|
||||||
device_coordinate: device.device_coordinate || "",
|
device_coordinate: device.device_coordinate || "", // 設備座標
|
||||||
device_image_url: device.device_image_url,
|
device_image_url: device.device_image_url,
|
||||||
full_name: device.full_name,
|
full_name: device.full_name, // 設備名稱
|
||||||
main_id: device.main_id,
|
main_id: device.main_id,
|
||||||
points: device.points || [],
|
points: device.points || [],
|
||||||
floor: floor.full_name,
|
floor: floor.full_name,
|
||||||
@ -121,32 +112,24 @@ const getData = async () => {
|
|||||||
systemData.value = transformedData;
|
systemData.value = transformedData;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 每 5 秒輪詢設備資料
|
|
||||||
const startInterval = () => {
|
|
||||||
if (intervalId) clearInterval(intervalId);
|
|
||||||
intervalId = setInterval(() => {
|
|
||||||
getData();
|
|
||||||
}, 5000);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 當切換建物時:同時載入系統設定 + 設備資料
|
|
||||||
watch(
|
watch(
|
||||||
() => buildingStore.selectedBuilding,
|
() => buildingStore.selectedBuilding,
|
||||||
async (newBuilding) => {
|
(newBuilding) => {
|
||||||
if (newBuilding) {
|
if (newBuilding) {
|
||||||
await loadSystemConfig(); // 先載設定(避免先渲染出不該顯示的卡片)
|
|
||||||
getData();
|
getData();
|
||||||
startInterval();
|
startInterval();
|
||||||
} else {
|
|
||||||
showRefrigeration.value = false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{
|
||||||
|
immediate: true,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// 卸載時清除定時器
|
// 組件卸載時清除定時器
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
if (intervalId) clearInterval(intervalId);
|
if (intervalId) {
|
||||||
|
clearInterval(intervalId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -158,9 +141,7 @@ onUnmounted(() => {
|
|||||||
<div class="flex flex-col gap-5">
|
<div class="flex flex-col gap-5">
|
||||||
<DashboardIndoor />
|
<DashboardIndoor />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-col gap-5">
|
||||||
<!-- 依 show_refrigeration 決定是否渲染 -->
|
|
||||||
<div class="flex flex-col gap-5" v-if="showRefrigeration">
|
|
||||||
<DashboardRefrig />
|
<DashboardRefrig />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -171,7 +152,9 @@ onUnmounted(() => {
|
|||||||
<DashboardFloorBar />
|
<DashboardFloorBar />
|
||||||
<DashboardEffectScatter :data="systemData" />
|
<DashboardEffectScatter :data="systemData" />
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <div class="order-2 w-full lg:hidden my-3">
|
||||||
|
<DashboardSysCard :data="systemData" />
|
||||||
|
</div> -->
|
||||||
<div
|
<div
|
||||||
class="order-last w-full lg:w-1/4 flex flex-col justify-start border-dashboard z-20 gap-12"
|
class="order-last w-full lg:w-1/4 flex flex-col justify-start border-dashboard z-20 gap-12"
|
||||||
>
|
>
|
||||||
|
@ -10,10 +10,7 @@ import { useI18n } from "vue-i18n";
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { searchParams, changeParams } = useSearchParam();
|
const { searchParams, changeParams } = useSearchParam();
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
|
@ -1,101 +1,56 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
// Tab 切換仍然緩慢 → 加上「快取 + 動畫關閉 + 更小抽樣 + 輕量 setOption」
|
|
||||||
// 1) 先用快取立即顯示,再背景刷新(體感超快)。
|
|
||||||
// 2) 關閉 ECharts 動畫、縮短 update 動畫時間,減少重排成本。
|
|
||||||
// 3) 抽樣點從 30 → 20,計算更輕。
|
|
||||||
// 4) Tab 切換不重啟輪詢,避免重設計時器造成 jank。
|
|
||||||
|
|
||||||
import LineChart from "@/components/chart/LineChart.vue";
|
import LineChart from "@/components/chart/LineChart.vue";
|
||||||
import { SECOND_CHART_COLOR } from "@/constant";
|
import { SECOND_CHART_COLOR } from "@/constant";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { ref, watch, onUnmounted, computed, nextTick } from "vue";
|
import { ref, watch, onUnmounted, computed } from "vue";
|
||||||
import useActiveBtn from "@/hooks/useActiveBtn";
|
import useActiveBtn from "@/hooks/useActiveBtn";
|
||||||
import { getDashboardTemp } from "@/apis/dashboard";
|
import { getDashboardTemp } from "@/apis/dashboard";
|
||||||
|
import useSearchParams from "@/hooks/useSearchParam";
|
||||||
import useBuildingStore from "@/stores/useBuildingStore";
|
import useBuildingStore from "@/stores/useBuildingStore";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
const { searchParams } = useSearchParams();
|
||||||
const buildingStore = useBuildingStore();
|
const buildingStore = useBuildingStore();
|
||||||
|
const timeoutTimer = ref(null); // 定時器參考
|
||||||
|
|
||||||
// --- UI:溫/濕度切換狀態 ---
|
|
||||||
const { items, changeActiveBtn, setItems, selectedBtn } = useActiveBtn();
|
const { items, changeActiveBtn, setItems, selectedBtn } = useActiveBtn();
|
||||||
const currentOptionType = ref(1); // 1 = 溫度、2 = 濕度
|
|
||||||
|
|
||||||
// --- 資料與顯示控制 ---
|
|
||||||
const allTempData = ref([]);
|
const allTempData = ref([]);
|
||||||
const noData = ref(false);
|
const currentOptionType = ref(1); // 當前顯示類型:1 = 溫度,2 = 濕度
|
||||||
|
const noData = ref(false); // 無資料顯示控制
|
||||||
const indoorChartRef = ref(null);
|
const indoorChartRef = ref(null);
|
||||||
|
|
||||||
// --- 計時器與請求序列控制 ---
|
// 確認是否有資料,無則不呼叫 getDashboardTemp 也不顯示 chart
|
||||||
const POLL_MS = 60000; // 每 60 秒輪詢
|
watch(
|
||||||
const timeoutTimer = ref(null);
|
() => buildingStore.selectedBuilding?.building_guid,
|
||||||
let lastAcceptedSeq = 0; // 最新被接受的請求序號
|
async (guid) => {
|
||||||
let seqCounter = 0; // 連增序號,避免併發覆蓋
|
if (!guid) return;
|
||||||
|
|
||||||
function clearPolling() {
|
await buildingStore.getSysConfig(guid);
|
||||||
if (timeoutTimer.value) {
|
const showRoom = buildingStore.sysConfig?.value?.show_room;
|
||||||
clearInterval(timeoutTimer.value);
|
|
||||||
timeoutTimer.value = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function startPolling() {
|
|
||||||
if (timeoutTimer.value) return; // 不要重複啟動
|
|
||||||
timeoutTimer.value = setInterval(() => safeGetData(false), POLL_MS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- 簡易快取(大樓 + 類型) ---
|
if (timeoutTimer.value) clearInterval(timeoutTimer.value);
|
||||||
const cache = new Map();
|
|
||||||
const cacheKey = (guid, opt) => `${guid}__${opt}`;
|
|
||||||
function writeCache(guid, opt, data) {
|
|
||||||
cache.set(cacheKey(guid, opt), data);
|
|
||||||
}
|
|
||||||
function readCache(guid, opt) {
|
|
||||||
return cache.get(cacheKey(guid, opt));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 只接受最後一筆回應的取數封裝(並寫入快取)
|
if (showRoom === false) {
|
||||||
async function safeGetData(force = true) {
|
noData.value = true;
|
||||||
const buildingGuid = buildingStore.selectedBuilding?.building_guid;
|
return; // 不呼叫 getData
|
||||||
if (!buildingGuid) return;
|
}
|
||||||
|
|
||||||
const mySeq = ++seqCounter; // 本次請求的序號
|
// 允許顯示圖表+呼叫資料
|
||||||
|
noData.value = false;
|
||||||
|
getData();
|
||||||
|
timeoutTimer.value = setInterval(getData, 60000); // 每分鐘自動更新
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
// 預設圖表設定
|
||||||
const res = await getDashboardTemp({
|
|
||||||
building_guid: buildingGuid,
|
|
||||||
tempOption: 1, // 室溫區域
|
|
||||||
timeInterval: 1,
|
|
||||||
option: currentOptionType.value,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (mySeq < lastAcceptedSeq) return; // 舊回應丟棄
|
|
||||||
lastAcceptedSeq = mySeq;
|
|
||||||
|
|
||||||
const key = "室溫";
|
|
||||||
const data = res?.isSuccess ? res.data?.[key] ?? [] : [];
|
|
||||||
|
|
||||||
allTempData.value = data;
|
|
||||||
noData.value = data.length === 0;
|
|
||||||
|
|
||||||
writeCache(buildingGuid, currentOptionType.value, data);
|
|
||||||
} catch (err) {
|
|
||||||
if (mySeq < lastAcceptedSeq) return; // 舊錯誤丟棄
|
|
||||||
console.error("getDashboardTemp error", err);
|
|
||||||
allTempData.value = [];
|
|
||||||
noData.value = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 預設圖表設定:關閉動畫以縮短切換延遲
|
|
||||||
const defaultChartOption = ref({
|
const defaultChartOption = ref({
|
||||||
animation: false,
|
|
||||||
animationDuration: 0,
|
|
||||||
animationDurationUpdate: 150,
|
|
||||||
animationEasingUpdate: "linear",
|
|
||||||
tooltip: { trigger: "axis" },
|
tooltip: { trigger: "axis" },
|
||||||
legend: {
|
legend: {
|
||||||
data: [],
|
data: [],
|
||||||
top: 0,
|
top: 0, // 靠最上方
|
||||||
textStyle: { color: "#ffffff", fontSize: 12 },
|
textStyle: { color: "#ffffff", fontSize: 12 },
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
@ -119,143 +74,129 @@ const defaultChartOption = ref({
|
|||||||
series: [],
|
series: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
// 設定資料點顯示數量(更小抽樣,預設 20)
|
const getData = async () => {
|
||||||
function sampleData(data = [], maxCount = 20) {
|
const buildingGuid = buildingStore.selectedBuilding?.building_guid;
|
||||||
const len = data.length;
|
if (!buildingGuid) return;
|
||||||
if (len <= maxCount) return data;
|
|
||||||
const sampled = [];
|
|
||||||
const step = (len - 1) / (maxCount - 1);
|
|
||||||
for (let i = 0; i < maxCount; i++) {
|
|
||||||
const index = Math.round(i * step);
|
|
||||||
sampled.push(data[index]);
|
|
||||||
}
|
|
||||||
return sampled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 多語系切換時更新按鈕文字
|
try {
|
||||||
|
const res = await getDashboardTemp({
|
||||||
|
building_guid: buildingGuid,
|
||||||
|
tempOption: 1, // 室溫區域
|
||||||
|
timeInterval: 1,
|
||||||
|
option: currentOptionType.value,
|
||||||
|
});
|
||||||
|
|
||||||
|
const key = "室溫";
|
||||||
|
allTempData.value = res.isSuccess ? res.data?.[key] ?? [] : [];
|
||||||
|
noData.value = allTempData.value.length === 0;
|
||||||
|
} catch (e) {
|
||||||
|
console.error("getDashboardTemp error", e);
|
||||||
|
allTempData.value = [];
|
||||||
|
noData.value = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 溫度與濕度切換按鈕
|
||||||
const buttonItems = computed(() => [
|
const buttonItems = computed(() => [
|
||||||
{ key: 1, title: t("dashboard.temperature"), active: true },
|
{ key: 1, title: t("dashboard.temperature"), active: true },
|
||||||
{ key: 2, title: t("dashboard.humidity"), active: false },
|
{ key: 2, title: t("dashboard.humidity"), active: false },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// 多語系切換時更新按鈕文字
|
||||||
watch(
|
watch(
|
||||||
() => locale.value,
|
() => locale.value,
|
||||||
() => setItems(buttonItems.value),
|
() => setItems(buttonItems.value),
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
// 切換溫/濕度:
|
// 切換溫度/濕度按鈕後更新資料與啟動定時器
|
||||||
// 1) 先讀快取直接畫(立即回饋)
|
// 切換溫度/濕度按鈕
|
||||||
// 2) 再觸發安全取數刷新
|
|
||||||
watch(
|
watch(
|
||||||
() => selectedBtn.value?.key,
|
selectedBtn,
|
||||||
async (key) => {
|
(newVal) => {
|
||||||
if (!(key === 1 || key === 2)) return;
|
if ([1, 2].includes(newVal?.key)) {
|
||||||
currentOptionType.value = key;
|
currentOptionType.value = newVal.key;
|
||||||
|
|
||||||
const guid = buildingStore.selectedBuilding?.building_guid;
|
// 再次確認 show_room 為 true 才重新取資料
|
||||||
if (!guid || buildingStore.sysConfig?.value?.show_room === false) return;
|
if (buildingStore.sysConfig?.value?.show_room) {
|
||||||
|
getData();
|
||||||
const cached = readCache(guid, key);
|
if (timeoutTimer.value) clearInterval(timeoutTimer.value);
|
||||||
if (cached) {
|
timeoutTimer.value = setInterval(getData, 60000);
|
||||||
allTempData.value = cached;
|
}
|
||||||
noData.value = cached.length === 0;
|
|
||||||
// 用 nextTick 確保 DOM/Chart 就緒再 setOption(體感更順)
|
|
||||||
await nextTick();
|
|
||||||
applyToChart(cached);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 背景刷新最新資料(回來後仍會覆蓋)
|
|
||||||
safeGetData(false);
|
|
||||||
// ⚠ 不重啟輪詢,避免 timer 抖動
|
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true, deep: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
// 監看建築切換:統一流程(取消舊輪詢 → 讀取配置 → 先用快取 → 再取數 → 啟動輪詢)
|
// 設定資料點顯示數量
|
||||||
watch(
|
function sampleData(data = [], maxCount = 30) {
|
||||||
() => buildingStore.selectedBuilding?.building_guid,
|
const len = data.length;
|
||||||
async (guid) => {
|
if (len <= maxCount) return data;
|
||||||
if (!guid) return;
|
|
||||||
|
|
||||||
clearPolling();
|
const sampled = [];
|
||||||
lastAcceptedSeq = 0;
|
const step = (len - 1) / (maxCount - 1);
|
||||||
seqCounter = 0;
|
|
||||||
|
|
||||||
await buildingStore.getSysConfig(guid);
|
for (let i = 0; i < maxCount; i++) {
|
||||||
const showRoom = buildingStore.sysConfig?.value?.show_room;
|
const index = Math.round(i * step);
|
||||||
|
sampled.push(data[index]);
|
||||||
|
}
|
||||||
|
|
||||||
if (showRoom === false) {
|
return sampled;
|
||||||
noData.value = true;
|
|
||||||
return; // 不取資料、不顯示圖
|
|
||||||
}
|
|
||||||
|
|
||||||
noData.value = false;
|
|
||||||
|
|
||||||
const cached = readCache(guid, currentOptionType.value);
|
|
||||||
if (cached) {
|
|
||||||
allTempData.value = cached;
|
|
||||||
noData.value = cached.length === 0;
|
|
||||||
await nextTick();
|
|
||||||
applyToChart(cached);
|
|
||||||
}
|
|
||||||
|
|
||||||
await safeGetData();
|
|
||||||
startPolling();
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
// 將資料套到圖表(輕量 setOption,關閉動畫)
|
|
||||||
function applyToChart(newVal) {
|
|
||||||
const chart = indoorChartRef.value?.chart;
|
|
||||||
if (!chart || !newVal?.length) return;
|
|
||||||
|
|
||||||
const firstValid = newVal.find((d) => d.data?.length);
|
|
||||||
if (!firstValid) return;
|
|
||||||
|
|
||||||
const sampledXAxis = sampleData(firstValid.data).map(({ time }) =>
|
|
||||||
dayjs(time).format("HH:mm:ss")
|
|
||||||
);
|
|
||||||
|
|
||||||
const series = newVal.map((d, i) => ({
|
|
||||||
name: d.full_name,
|
|
||||||
type: "line",
|
|
||||||
data: sampleData(d.data).map(({ value }) => value),
|
|
||||||
showSymbol: false,
|
|
||||||
// 關閉單序列動畫
|
|
||||||
animation: false,
|
|
||||||
itemStyle: { color: SECOND_CHART_COLOR[i % SECOND_CHART_COLOR.length] },
|
|
||||||
}));
|
|
||||||
|
|
||||||
const vals = series.flatMap((s) => s.data).filter((v) => v != null);
|
|
||||||
if (!vals.length) return;
|
|
||||||
|
|
||||||
chart.setOption(
|
|
||||||
{
|
|
||||||
animation: false,
|
|
||||||
animationDurationUpdate: 150,
|
|
||||||
animationEasingUpdate: "linear",
|
|
||||||
legend: { data: newVal.map((d) => d.full_name) },
|
|
||||||
xAxis: { data: sampledXAxis },
|
|
||||||
yAxis: {
|
|
||||||
min: Math.floor(Math.min(...vals)) - 1,
|
|
||||||
max: Math.ceil(Math.max(...vals)) + 1,
|
|
||||||
},
|
|
||||||
series,
|
|
||||||
},
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 資料變動 → 更新圖表(不 deep)
|
// 更新圖表資料
|
||||||
watch(allTempData, (newVal) => {
|
watch(
|
||||||
applyToChart(newVal);
|
allTempData,
|
||||||
});
|
(newVal) => {
|
||||||
|
if (!newVal?.length || !indoorChartRef.value?.chart) return;
|
||||||
|
|
||||||
|
const firstValid = newVal.find((d) => d.data?.length);
|
||||||
|
if (!firstValid) return;
|
||||||
|
|
||||||
|
const sampledXAxis = sampleData(firstValid.data).map(({ time }) =>
|
||||||
|
dayjs(time).format("HH:mm:ss")
|
||||||
|
);
|
||||||
|
|
||||||
|
const allValues = newVal
|
||||||
|
.flatMap((d) => sampleData(d.data))
|
||||||
|
.map((d) => d.value)
|
||||||
|
.filter((v) => v != null);
|
||||||
|
|
||||||
|
if (!allValues.length) return;
|
||||||
|
|
||||||
|
const minVal = Math.min(...allValues);
|
||||||
|
const maxVal = Math.max(...allValues);
|
||||||
|
|
||||||
|
const yMin = Math.floor(minVal) - 1;
|
||||||
|
const yMax = Math.ceil(maxVal) + 1;
|
||||||
|
|
||||||
|
indoorChartRef.value.chart.setOption({
|
||||||
|
legend: {
|
||||||
|
data: newVal.map((d) => d.full_name),
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
data: sampledXAxis,
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
min: yMin,
|
||||||
|
max: yMax,
|
||||||
|
},
|
||||||
|
series: newVal.map((d, i) => ({
|
||||||
|
name: d.full_name,
|
||||||
|
type: "line",
|
||||||
|
data: sampleData(d.data).map(({ value }) => value),
|
||||||
|
showSymbol: false,
|
||||||
|
itemStyle: {
|
||||||
|
color: SECOND_CHART_COLOR[i % SECOND_CHART_COLOR.length],
|
||||||
|
},
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
// 離開元件時清除定時器
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
clearPolling();
|
if (timeoutTimer.value) clearInterval(timeoutTimer.value);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -263,21 +204,18 @@ onUnmounted(() => {
|
|||||||
<h3 class="text-info text-xl text-center">
|
<h3 class="text-info text-xl text-center">
|
||||||
{{ $t("dashboard.indoor_chart") }}
|
{{ $t("dashboard.indoor_chart") }}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="w-full flex justify-center items-center relative">
|
<div class="w-full flex justify-center items-center relative">
|
||||||
<ButtonConnectedGroup
|
<ButtonConnectedGroup
|
||||||
:items="items"
|
:items="items"
|
||||||
:onclick="(e, item) => changeActiveBtn(item)"
|
:onclick="(e, item) => changeActiveBtn(item)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="noData"
|
v-if="noData"
|
||||||
class="text-center text-white text-lg min-h-[260px] flex items-center justify-center"
|
class="text-center text-white text-lg min-h-[260px] flex items-center justify-center"
|
||||||
>
|
>
|
||||||
{{ $t("dashboard.no_data") }}
|
{{ $t("dashboard.no_data") }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LineChart
|
<LineChart
|
||||||
v-if="!noData"
|
v-if="!noData"
|
||||||
id="dashboard_other_real_temp"
|
id="dashboard_other_real_temp"
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
import { ref, computed } from "vue";
|
import { ref, computed } from "vue";
|
||||||
import useSearchParam from "@/hooks/useSearchParam";
|
import useSearchParam from "@/hooks/useSearchParam";
|
||||||
const { searchParams, changeParams } = useSearchParam();
|
const { searchParams, changeParams } = useSearchParam();
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -8,10 +8,7 @@ import { useI18n } from "vue-i18n";
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openToast, cancelToastOpen } = inject("app_toast");
|
const { openToast, cancelToastOpen } = inject("app_toast");
|
||||||
const { sidebar_data } = inject("current_dir");
|
const { sidebar_data } = inject("current_dir");
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -8,10 +8,7 @@ import useSearchParam from "@/hooks/useSearchParam";
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openToast, cancelToastOpen } = inject("app_toast");
|
const { openToast, cancelToastOpen } = inject("app_toast");
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const { searchParams } = useSearchParam();
|
const { searchParams } = useSearchParam();
|
||||||
|
|
||||||
const { dataSource, openModal, updateEditRecord, search, tableLoading } =
|
const { dataSource, openModal, updateEditRecord, search, tableLoading } =
|
||||||
|
@ -12,10 +12,7 @@ import Select from "@/components/customUI/Select.vue";
|
|||||||
import SearchSelect from "@/components/customUI/SearchSelect.vue";
|
import SearchSelect from "@/components/customUI/SearchSelect.vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
editRecord: Object,
|
editRecord: Object,
|
||||||
|
@ -70,10 +70,7 @@ import { getSystemDevices } from "@/apis/system";
|
|||||||
import { setRtspEnable } from "@/apis/rtsp"; // 已移除 setSambaDirectory
|
import { setRtspEnable } from "@/apis/rtsp"; // 已移除 setSambaDirectory
|
||||||
import useActiveBtn from "@/hooks/useActiveBtn";
|
import useActiveBtn from "@/hooks/useActiveBtn";
|
||||||
|
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const DEFAULT_MONITOR_URL =
|
const DEFAULT_MONITOR_URL =
|
||||||
"http://192.168.0.219:8026/?url=rtsp://admin02:mjmAdmin_99@192.168.0.200:554/stream1?tcp";
|
"http://192.168.0.219:8026/?url=rtsp://admin02:mjmAdmin_99@192.168.0.200:554/stream1?tcp";
|
||||||
|
|
||||||
|
@ -7,10 +7,7 @@ import { useI18n } from "vue-i18n";
|
|||||||
import useBuildingStore from "@/stores/useBuildingStore";
|
import useBuildingStore from "@/stores/useBuildingStore";
|
||||||
|
|
||||||
const storeBuild = useBuildingStore();
|
const storeBuild = useBuildingStore();
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openToast, cancelToastOpen } = inject("app_toast");
|
const { openToast, cancelToastOpen } = inject("app_toast");
|
||||||
|
|
||||||
|
@ -11,10 +11,7 @@ const { currentFloor, subscribeData } = inject("system_deviceList");
|
|||||||
const { getCurrentInfoModalData, selected_dbid } = inject(
|
const { getCurrentInfoModalData, selected_dbid } = inject(
|
||||||
"system_selectedDevice"
|
"system_selectedDevice"
|
||||||
);
|
);
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
|
|
||||||
const asset_floor_chart = ref(null);
|
const asset_floor_chart = ref(null);
|
||||||
const sameOption = {
|
const sameOption = {
|
||||||
|
@ -8,10 +8,7 @@ const { getCurrentInfoModalData, selected_dbid } = inject(
|
|||||||
const { subscribeData } = inject("system_deviceList");
|
const { subscribeData } = inject("system_deviceList");
|
||||||
|
|
||||||
const { showData } = useSystemShowData();
|
const { showData } = useSystemShowData();
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
|
|
||||||
const fitToView = (forge_dbid, spriteDbId) => {
|
const fitToView = (forge_dbid, spriteDbId) => {
|
||||||
selected_dbid.value = [forge_dbid, spriteDbId];
|
selected_dbid.value = [forge_dbid, spriteDbId];
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
import { computed, inject, watch, ref } from "vue";
|
import { computed, inject, watch, ref } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
// 本地開發 FILE_BASEURL
|
const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
||||||
// const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL;
|
|
||||||
// docker 部屬 FILE_BASEURL (兩者視部屬方式擇一保留)
|
|
||||||
const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL;
|
|
||||||
const { selectedDeviceCog } = inject("system_selectedDevice");
|
const { selectedDeviceCog } = inject("system_selectedDevice");
|
||||||
const imgData = ref([]);
|
const imgData = ref([]);
|
||||||
|
|
||||||
|
@ -13,17 +13,15 @@ export default defineConfig({
|
|||||||
outDir: "./dist",
|
outDir: "./dist",
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
},
|
},
|
||||||
// 本地開發:有 server
|
server: {
|
||||||
// docker 部屬:註解整個 server
|
proxy: {
|
||||||
// server: {
|
"/upload": {
|
||||||
// proxy: {
|
target: "https://ibms-Empower.production.mjmtech.com.tw",
|
||||||
// "/upload": {
|
changeOrigin: true,
|
||||||
// target: "https://ibms-Empower.production.mjmtech.com.tw",
|
secure: false,
|
||||||
// changeOrigin: true,
|
},
|
||||||
// secure: false,
|
},
|
||||||
// },
|
},
|
||||||
// },
|
|
||||||
// },
|
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
Components({
|
Components({
|
||||||
|
Loading…
Reference in New Issue
Block a user