├── src ├── config │ ├── env │ │ ├── .env │ │ ├── .env.mock │ │ ├── .env.pre │ │ ├── .env.pro │ │ ├── .env.test │ │ └── .env.dev │ ├── types │ │ ├── vite.d.ts │ │ ├── type.d.ts │ │ ├── vue.d.ts │ │ └── axios.d.ts │ ├── constant │ │ └── common.ts │ ├── plugins │ │ ├── element │ │ │ ├── element-variables.scss │ │ │ └── element.ts │ │ ├── index.ts │ │ └── highlight │ │ │ └── highlight.ts │ ├── entity │ │ └── index.ts │ ├── router │ │ ├── common │ │ │ └── index.ts │ │ ├── views │ │ │ └── index.ts │ │ └── index.ts │ └── axios │ │ └── index.ts ├── views │ ├── driver │ │ ├── card │ │ │ ├── style.scss │ │ │ └── index.ts │ │ ├── Driver.vue │ │ ├── tool │ │ │ ├── index.ts │ │ │ └── DriverTool.vue │ │ └── detail │ │ │ └── index.ts │ ├── home │ │ ├── Home.vue │ │ └── style.scss │ ├── dashboard │ │ ├── Dashboard.vue │ │ ├── index.ts │ │ └── card │ │ │ └── DashboardCard.vue │ ├── application │ │ ├── Application.vue │ │ ├── index.ts │ │ └── card │ │ │ └── ApplicationCard.vue │ ├── point │ │ ├── value │ │ │ ├── detail │ │ │ │ ├── index.ts │ │ │ │ └── PointValueDetail.vue │ │ │ ├── edit │ │ │ │ ├── PointValueEditForm.vue │ │ │ │ └── index.ts │ │ │ └── card │ │ │ │ └── index.ts │ │ ├── info │ │ │ ├── PointInfoCard.vue │ │ │ └── index.ts │ │ ├── Point.vue │ │ └── detail │ │ │ └── PointDetail.vue │ ├── profile │ │ ├── Profile.vue │ │ ├── add │ │ │ ├── ProfileAddForm.vue │ │ │ └── index.ts │ │ ├── card │ │ │ └── index.ts │ │ ├── detail │ │ │ ├── ProfileDetail.vue │ │ │ └── index.ts │ │ ├── tool │ │ │ ├── index.ts │ │ │ └── ProfileTool.vue │ │ └── edit │ │ │ └── ProfileEdit.vue │ ├── login │ │ └── style.scss │ └── device │ │ ├── card │ │ └── index.ts │ │ └── Device.vue ├── api │ ├── rule.ts │ ├── attribute.ts │ ├── driver.ts │ ├── token.ts │ ├── dictionary.ts │ ├── profile.ts │ └── info.ts ├── store │ ├── index.ts │ └── modules │ │ ├── interval.ts │ │ └── auth.ts ├── main.ts ├── App.vue ├── utils │ ├── CommonUtil.ts │ ├── LogUtil.ts │ ├── MessageUtil.ts │ └── NotificationUtil.ts └── components │ ├── error │ ├── 403.vue │ ├── 404.vue │ ├── 500.vue │ └── style.scss │ ├── card │ ├── detail │ │ └── DetailCard.vue │ ├── blank │ │ └── BlankCard.vue │ ├── styles │ │ ├── edit-card.scss │ │ └── tool-card.scss │ ├── base │ │ └── BaseCard.vue │ └── title │ │ └── TitleCard.vue │ ├── dialog │ └── styles │ │ └── things-dialog.scss │ └── layout │ └── style.scss ├── src-tauri ├── build.rs ├── icons │ ├── 32.png │ ├── 128.png │ ├── 256.png │ ├── 512.png │ ├── icon.ico │ ├── icon.icns │ └── icon.svg ├── .gitignore ├── src │ ├── main.rs │ └── lib.rs ├── capabilities │ └── default.json ├── Cargo.toml └── tauri.conf.json ├── .browserslistrc ├── public ├── favicon.ico ├── images │ ├── app │ │ ├── app1.png │ │ ├── app2.png │ │ ├── app3.png │ │ └── application.png │ ├── logo │ │ ├── logo.png │ │ └── logo-white.png │ ├── common │ │ ├── avatar.png │ │ ├── device.png │ │ ├── driver.png │ │ ├── gateway.png │ │ ├── point.png │ │ ├── profile.png │ │ ├── point-info.png │ │ ├── point-info-disable.png │ │ └── loading-init.svg │ └── dashboard │ │ └── dashboard.jpg └── css │ └── index │ └── index.min.css ├── .husky └── pre-commit ├── .prettierignore ├── .dockerignore ├── dc3 ├── dependencies │ ├── conf.crt │ │ └── dc3.site │ │ │ ├── dc3.site.key │ │ │ └── fullchain.cer │ └── README.md ├── bin │ ├── deploy.sh │ └── tag.sh ├── nginx │ ├── location │ │ └── default.env │ ├── conf.d │ │ └── default.conf │ └── nginx.conf ├── docker-compose.yml └── docker-compose-aliyun.yml ├── README.md ├── .gitignore ├── COPYRIGHT ├── dc3.code-workspace ├── babel.config.js ├── Makefile ├── .github └── workflows │ ├── docker-ci-web.yml │ └── docker-ci-web-aliyun.yml ├── .prettierrc.cjs ├── Dockerfile ├── index.html ├── package.json └── vite.config.ts /src/config/env/.env: -------------------------------------------------------------------------------- 1 | APP_CLI_PORT = "8080" -------------------------------------------------------------------------------- /src-tauri/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | tauri_build::build() 3 | } 4 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | not ie 11 5 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx lint-staged -------------------------------------------------------------------------------- /src-tauri/icons/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/src-tauri/icons/32.png -------------------------------------------------------------------------------- /src-tauri/icons/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/src-tauri/icons/128.png -------------------------------------------------------------------------------- /src-tauri/icons/256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/src-tauri/icons/256.png -------------------------------------------------------------------------------- /src-tauri/icons/512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/src-tauri/icons/512.png -------------------------------------------------------------------------------- /src-tauri/icons/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/src-tauri/icons/icon.ico -------------------------------------------------------------------------------- /public/images/app/app1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/app/app1.png -------------------------------------------------------------------------------- /public/images/app/app2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/app/app2.png -------------------------------------------------------------------------------- /public/images/app/app3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/app/app3.png -------------------------------------------------------------------------------- /public/images/logo/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/logo/logo.png -------------------------------------------------------------------------------- /src-tauri/icons/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/src-tauri/icons/icon.icns -------------------------------------------------------------------------------- /src/config/env/.env.mock: -------------------------------------------------------------------------------- 1 | APP_API_PATH = "http://dc3-gateway" 2 | APP_API_PORT = "8000" 3 | APP_API_PREFIX = "/api" -------------------------------------------------------------------------------- /src/config/env/.env.pre: -------------------------------------------------------------------------------- 1 | APP_API_PATH = "http://dc3-gateway" 2 | APP_API_PORT = "8000" 3 | APP_API_PREFIX = "/api" -------------------------------------------------------------------------------- /src/config/env/.env.pro: -------------------------------------------------------------------------------- 1 | APP_API_PATH = "http://dc3-gateway" 2 | APP_API_PORT = "8000" 3 | APP_API_PREFIX = "/api" -------------------------------------------------------------------------------- /src/config/env/.env.test: -------------------------------------------------------------------------------- 1 | APP_API_PATH = "http://dc3-gateway" 2 | APP_API_PORT = "8000" 3 | APP_API_PREFIX = "/api" -------------------------------------------------------------------------------- /public/images/common/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/common/avatar.png -------------------------------------------------------------------------------- /public/images/common/device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/common/device.png -------------------------------------------------------------------------------- /public/images/common/driver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/common/driver.png -------------------------------------------------------------------------------- /public/images/common/gateway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/common/gateway.png -------------------------------------------------------------------------------- /public/images/common/point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/common/point.png -------------------------------------------------------------------------------- /public/images/common/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/common/profile.png -------------------------------------------------------------------------------- /src/config/env/.env.dev: -------------------------------------------------------------------------------- 1 | APP_API_PATH = "http://localhost" 2 | APP_API_PORT = "8000" 3 | APP_API_PREFIX = "/api" 4 | -------------------------------------------------------------------------------- /public/images/app/application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/app/application.png -------------------------------------------------------------------------------- /public/images/logo/logo-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/logo/logo-white.png -------------------------------------------------------------------------------- /src-tauri/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | /gen/schemas 5 | -------------------------------------------------------------------------------- /public/images/common/point-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/common/point-info.png -------------------------------------------------------------------------------- /public/images/dashboard/dashboard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/dashboard/dashboard.jpg -------------------------------------------------------------------------------- /public/images/common/point-info-disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pnoker/iot-dc3-web/HEAD/public/images/common/point-info-disable.png -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dc3 2 | dist 3 | public 4 | src-tauri 5 | node_modules 6 | 7 | .github 8 | .vscode 9 | .idea 10 | 11 | *.min.js 12 | *.min.css -------------------------------------------------------------------------------- /src-tauri/src/main.rs: -------------------------------------------------------------------------------- 1 | // Prevents additional console window on Windows in release, DO NOT REMOVE!! 2 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] 3 | 4 | fn main() { 5 | app_lib::run(); 6 | } 7 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.git 2 | **/.idea 3 | **/*.iml 4 | **/Dockerfile 5 | 6 | node_modules 7 | /dist 8 | 9 | **/.vs 10 | **/.vscode 11 | 12 | **/.settings 13 | **/.project 14 | 15 | **/*.iws 16 | **/*.ipr 17 | **/*.md 18 | 19 | -------------------------------------------------------------------------------- /src-tauri/capabilities/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../gen/schemas/desktop-schema.json", 3 | "identifier": "default", 4 | "description": "enables the default permissions", 5 | "windows": ["main"], 6 | "permissions": ["core:default"] 7 | } 8 | -------------------------------------------------------------------------------- /dc3/dependencies/conf.crt/dc3.site/dc3.site.key: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MHcCAQEEIFl2dIVmp3A3aAX46Im1vUuwCIYTf1y1pBIVUQBno1B2oAoGCCqGSM49 3 | AwEHoUQDQgAE63SlUpy5sp1r1zHDKeeNP3jBPlbwGn3/mK0bKqgXYwUKm+0ZUBP8 4 | PIh6eX+FnA7ZFkUvkXFRD3Q8POyzRwMgCA== 5 | -----END EC PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 1. Prepare 2 | 3 | - `git` 4 | - `Visual Studio Code` 5 | - `nodejs` >= 18, recommended to use 22 6 | - `yarn`, install using `npm install -g yarn` 7 | 8 | ## 2. Source code 9 | 10 | ```bash 11 | git clone https://github.com/pnoker/iot-dc3-web.git 12 | ``` 13 | 14 | ## 3. Develop 15 | 16 | ```bash 17 | cd iot-dc3-web 18 | 19 | # install 20 | yarn 21 | 22 | # run 23 | yarn serve 24 | ``` 25 | -------------------------------------------------------------------------------- /src-tauri/src/lib.rs: -------------------------------------------------------------------------------- 1 | #[cfg_attr(mobile, tauri::mobile_entry_point)] 2 | pub fn run() { 3 | tauri::Builder::default() 4 | .setup(|app| { 5 | if cfg!(debug_assertions) { 6 | app.handle().plugin( 7 | tauri_plugin_log::Builder::default() 8 | .level(log::LevelFilter::Info) 9 | .build(), 10 | )?; 11 | } 12 | Ok(()) 13 | }) 14 | .run(tauri::generate_context!()) 15 | .expect("error while running iot dc3 application"); 16 | } 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | /express/node_modules 6 | /express/public 7 | 8 | # local env files 9 | .env.local 10 | .env.*.local 11 | 12 | # Log files 13 | npm-debug.log* 14 | yarn-debug.log* 15 | yarn-error.log* 16 | pnpm-debug.log* 17 | 18 | # Editor directories and files 19 | .idea 20 | .vscode 21 | *.suo 22 | *.ntvs* 23 | *.njsproj 24 | *.sln 25 | *.sw? 26 | 27 | # Lock files 28 | yarn.lock 29 | pnpm-lock.yaml 30 | 31 | components.d.ts 32 | auto-imports.d.ts 33 | /.history/ 34 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 2016-present the IoT DC3 original author or authors. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | https://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /dc3.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "src", 5 | "name": "web" 6 | }, 7 | { 8 | "path": "dc3", 9 | "name": "dc3" 10 | }, 11 | { 12 | "path": ".", 13 | "name": "root" 14 | } 15 | ], 16 | "launch": { 17 | "version": "2025.9.0", 18 | "configurations": [ 19 | { 20 | "type": "node", 21 | "request": "launch", 22 | "cwd": "${workspaceFolder:web}", 23 | "name": "yarn serve", 24 | "runtimeExecutable": "yarn", 25 | "runtimeArgs": ["serve"] 26 | } 27 | ] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src-tauri/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "iot_dc3" 3 | version = "2025.9.0" 4 | description = "IoT DC3 Application" 5 | authors = ["pnoker"] 6 | license = "Apache 2.0" 7 | repository = "https://github.com/pnoker/iot-dc3" 8 | edition = "2021" 9 | rust-version = "1.83.0" 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [lib] 14 | name = "app_lib" 15 | crate-type = ["staticlib", "cdylib", "rlib"] 16 | 17 | [build-dependencies] 18 | tauri-build = { version = "2.0.2", features = [] } 19 | 20 | [dependencies] 21 | serde_json = "1.0" 22 | serde = { version = "1.0", features = ["derive"] } 23 | log = "0.4" 24 | tauri = { version = "2.1.0", features = [ "devtools"] } 25 | tauri-plugin-log = "2.0.0-rc" 26 | -------------------------------------------------------------------------------- /src/config/types/vite.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /// 18 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | presets: ['@vue/cli-plugin-babel/preset'] 19 | } 20 | -------------------------------------------------------------------------------- /src/views/driver/card/style.scss: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .active { 18 | border-left: 5px solid #409eff; 19 | } 20 | -------------------------------------------------------------------------------- /dc3/bin/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright 2016-present the IoT DC3 original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | set -e 20 | 21 | cd ../../ 22 | 23 | yarn 24 | yarn build 25 | cp -r ./dist/* /usr/share/nginx/html/ 26 | -------------------------------------------------------------------------------- /src/config/constant/common.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export default { 18 | X_AUTH_TENANT: 'X-Auth-Tenant', 19 | X_AUTH_LOGIN: 'X-Auth-Login', 20 | X_AUTH_TOKEN: 'X-Auth-Token' 21 | } 22 | -------------------------------------------------------------------------------- /src/config/types/type.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * 统一返回 19 | */ 20 | declare type R = { 21 | ok: boolean 22 | code: number 23 | message: string 24 | data: T 25 | } 26 | -------------------------------------------------------------------------------- /src/config/types/vue.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | declare module '*.vue' { 18 | import type { DefineComponent } from 'vue' 19 | 20 | const component: DefineComponent<{}, {}, any> 21 | export default component 22 | } 23 | -------------------------------------------------------------------------------- /src-tauri/tauri.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", 3 | "productName": "IoT DC3", 4 | "version": "2025.9.0", 5 | "identifier": "io.github.pnoker.dc3.client", 6 | "build": { 7 | "frontendDist": "../dist", 8 | "devUrl": "http://localhost:8080", 9 | "beforeDevCommand": "yarn dev", 10 | "beforeBuildCommand": "yarn build" 11 | }, 12 | "app": { 13 | "windows": [ 14 | { 15 | "title": "IoT DC3", 16 | "width": 1366, 17 | "height": 768, 18 | "resizable": true, 19 | "fullscreen": false 20 | } 21 | ], 22 | "security": { 23 | "csp": null 24 | } 25 | }, 26 | "bundle": { 27 | "active": true, 28 | "targets": "all", 29 | "icon": [ 30 | "icons/32.png", 31 | "icons/128.png", 32 | "icons/256.png", 33 | "icons/512.png" 34 | ] 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/api/rule.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import request from '@/config/axios' 18 | 19 | export const getFlowsList = (flowsQuery: any) => 20 | request({ 21 | url: 'api/v3/manager/ruleengine/flowsList', 22 | method: 'post', 23 | data: flowsQuery 24 | }) 25 | -------------------------------------------------------------------------------- /src/store/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { createStore } from 'vuex' 18 | 19 | import auth from '@/store/modules/auth' 20 | import interval from '@/store/modules/interval' 21 | 22 | export default createStore({ 23 | modules: { 24 | auth, 25 | interval 26 | } 27 | }) 28 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2016-present the IoT DC3 original author or authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | Default: 18 | @echo "make serve: npm run serve" 19 | @echo "make build: npm run build" 20 | @echo "make lint: npn run lint" 21 | 22 | .PHONY: serve build lint 23 | 24 | serve: 25 | npm run serve 26 | build: 27 | npm run build 28 | cd ./dc3 29 | docker-compose build 30 | lint: 31 | npm run lint 32 | -------------------------------------------------------------------------------- /.github/workflows/docker-ci-web.yml: -------------------------------------------------------------------------------- 1 | name: Docker Image 2 | on: 3 | push: 4 | tags: 5 | - 'dc3.release.*' 6 | jobs: 7 | build-push: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v4 12 | 13 | - name: Login Docker 14 | uses: docker/login-action@v3 15 | with: 16 | username: ${{ vars.DOCKERHUB_USERNAME }} 17 | password: ${{ secrets.DOCKERHUB_TOKEN }} 18 | 19 | - name: Set QEMU 20 | uses: docker/setup-qemu-action@v3 21 | 22 | - name: Set Docker Buildx 23 | uses: docker/setup-buildx-action@v3 24 | with: 25 | platforms: linux/arm64,linux/amd64 26 | 27 | - name: Build and Push 28 | uses: docker/build-push-action@v6 29 | with: 30 | push: true 31 | file: Dockerfile 32 | context: '{{defaultContext}}:/' 33 | platforms: linux/arm64,linux/amd64 34 | tags: pnoker/dc3-web:2025.9.0 35 | -------------------------------------------------------------------------------- /src/config/types/axios.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* eslint-disable */ 18 | 19 | declare module 'axios' { 20 | type MyAxiosPromise = Promise 21 | 22 | interface AxiosInstance extends Axios { 23 | (config: AxiosRequestConfig): MyAxiosPromise 24 | 25 | (url: string, config?: AxiosRequestConfig): MyAxiosPromise 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import App from '@/App.vue' 18 | import plugins from '@/config/plugins/index' 19 | import router from '@/config/router' 20 | import store from '@/store' 21 | import { createApp } from 'vue' 22 | 23 | // config app 24 | const app = createApp(App) 25 | app.use(router) 26 | app.use(store) 27 | plugins(app) 28 | app.mount('#app') 29 | 30 | export default app 31 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 34 | -------------------------------------------------------------------------------- /src/views/home/Home.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | 25 | 28 | 29 | 57 | -------------------------------------------------------------------------------- /src-tauri/icons/icon.svg: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 22 | 24 | -------------------------------------------------------------------------------- /src/utils/MessageUtil.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { ElMessage } from 'element-plus' 18 | 19 | export const info = (message: string, grouping = true, showClose = true) => { 20 | ElMessage({ 21 | type: 'info', 22 | grouping: grouping, 23 | showClose: showClose, 24 | message: message 25 | }) 26 | } 27 | 28 | export const success = (message: string, grouping = true, showClose = true) => { 29 | ElMessage({ 30 | type: 'success', 31 | grouping: grouping, 32 | showClose: showClose, 33 | message: message 34 | }) 35 | } 36 | 37 | export const error = (message: string, grouping = true, showClose = true) => { 38 | ElMessage({ 39 | type: 'error', 40 | grouping: grouping, 41 | showClose: showClose, 42 | message: message 43 | }) 44 | } 45 | 46 | export const warning = (message: string, grouping = true, showClose = true) => { 47 | ElMessage({ 48 | type: 'warning', 49 | grouping: grouping, 50 | showClose: showClose, 51 | message: message 52 | }) 53 | } 54 | -------------------------------------------------------------------------------- /src/config/router/common/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { RouteRecordRaw } from 'vue-router' 18 | 19 | const routes: Array = [ 20 | { 21 | name: 'login', 22 | path: '/login', 23 | meta: { 24 | title: 'IoT DC3 Web' 25 | }, 26 | component: () => import('@/views/login/Login.vue') 27 | }, 28 | { 29 | name: '403', 30 | path: '/403', 31 | meta: { 32 | title: '403' 33 | }, 34 | component: () => import('@/components/error/403.vue') 35 | }, 36 | { 37 | name: '404', 38 | path: '/404', 39 | meta: { 40 | title: '404' 41 | }, 42 | component: () => import('@/components/error/404.vue') 43 | }, 44 | { 45 | name: '500', 46 | path: '/500', 47 | meta: { 48 | title: '500' 49 | }, 50 | component: () => import('@/components/error/500.vue') 51 | }, 52 | { 53 | path: '/:catchAll(.*)', 54 | redirect: '/404' 55 | } 56 | ] 57 | 58 | export default routes 59 | -------------------------------------------------------------------------------- /src/components/card/blank/BlankCard.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 26 | 27 | 28 | 29 | 61 | -------------------------------------------------------------------------------- /src/components/card/styles/edit-card.scss: -------------------------------------------------------------------------------- 1 | /*! 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .edit-card { 18 | margin-top: 1px; 19 | } 20 | 21 | .edit-card-header { 22 | margin-bottom: 4px; 23 | 24 | :deep(.el-card) { 25 | border: 0; 26 | } 27 | } 28 | 29 | .edit-card-body { 30 | .edit-form-item { 31 | display: flex; 32 | margin: 10px 0; 33 | justify-content: center; 34 | 35 | :deep(.el-row) { 36 | justify-content: center; 37 | } 38 | 39 | :deep(.el-alert) { 40 | margin-bottom: 10px; 41 | } 42 | 43 | :deep(.el-textarea__inner) { 44 | height: 80px; 45 | } 46 | } 47 | 48 | .edit-form-button { 49 | display: flex; 50 | margin-top: 10px; 51 | 52 | :deep(.el-form-item__content) { 53 | justify-content: center; 54 | } 55 | } 56 | } 57 | 58 | :deep(.el-form-item__label) { 59 | display: block; 60 | width: 100px; 61 | height: 32px; 62 | text-align: justify; 63 | 64 | &::after { 65 | display: inline-block; 66 | width: 100%; 67 | content: ''; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/views/driver/Driver.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 37 | 38 | 28 | 29 | 67 | -------------------------------------------------------------------------------- /src/api/dictionary.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import request from '@/config/axios' 18 | 19 | /** 20 | * 查询驱动字典 21 | * 22 | * @param dictionary Dictionary 23 | * @returns MyAxiosPromise 24 | */ 25 | export const getDriverDictionary = (dictionary: any) => 26 | request({ 27 | url: `api/v3/manager/dictionary/driver`, 28 | method: 'post', 29 | data: dictionary 30 | }) 31 | 32 | /** 33 | * 查询设备字典 34 | * 35 | * @param dictionary Dictionary 36 | * @returns MyAxiosPromise 37 | */ 38 | export const getDeviceDictionary = (dictionary: any) => 39 | request({ 40 | url: `api/v3/manager/dictionary/device`, 41 | method: 'post', 42 | data: dictionary 43 | }) 44 | 45 | /** 46 | * 查询模板字典 47 | * 48 | * @param dictionary Dictionary 49 | * @returns MyAxiosPromise 50 | */ 51 | export const getProfileDictionary = (dictionary: any) => 52 | request({ 53 | url: `api/v3/manager/dictionary/profile`, 54 | method: 'post', 55 | data: dictionary 56 | }) 57 | 58 | /** 59 | * 查询位号字典 60 | * 61 | * @param dictionary Dictionary 62 | * @returns MyAxiosPromise 63 | */ 64 | export const getPointDictionary = (dictionary: any) => 65 | request({ 66 | url: `api/v3/manager/dictionary/device_point`, 67 | method: 'post', 68 | data: dictionary 69 | }) 70 | -------------------------------------------------------------------------------- /src/config/plugins/highlight/highlight.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import hljs from 'highlight.js' 18 | import 'highlight.js/styles/atom-one-dark.css' 19 | 20 | export default (app: any) => { 21 | app.directive('highlight', { 22 | // Directive has a set of lifecycle hooks: 23 | // called before bound element's parent component is mounted 24 | beforeMount(el: any) { 25 | // on first bind, highlight all targets 26 | const blocks = el.querySelectorAll('pre code') 27 | for (let i = 0; i < blocks.length; i++) { 28 | const item = blocks[i] 29 | console.log(item) 30 | hljs.highlightBlock(item) 31 | } 32 | }, 33 | // called after the containing component's VNode and the VNodes of its children // have updated 34 | updated(el: any, binding: any) { 35 | // after an update, re-fill the content and then highlight 36 | const targets = el.querySelectorAll('code') 37 | for (let i = 0; i < targets.length; i += 1) { 38 | const target = targets[i] 39 | if (typeof binding.value === 'string') { 40 | target.textContent = binding.value 41 | } 42 | hljs.highlightBlock(target) 43 | } 44 | } 45 | }) 46 | } 47 | -------------------------------------------------------------------------------- /src/views/profile/Profile.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 48 | 49 | 38 | 39 | 74 | -------------------------------------------------------------------------------- /src/views/point/value/edit/PointValueEditForm.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 45 | 46 | 42 | 43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/views/point/Point.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 59 | 60 | 68 | 69 | 103 | -------------------------------------------------------------------------------- /src/api/info.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import request from '@/config/axios' 18 | 19 | /** 20 | * 新增驱动配置 21 | * 22 | * @param driverInfo DriverInfo 23 | * @returns MyAxiosPromise 24 | */ 25 | export const addDriverInfo = (driverInfo: any) => 26 | request({ 27 | url: `api/v3/manager/driver_attribute_config/add`, 28 | method: 'post', 29 | data: driverInfo 30 | }) 31 | 32 | /** 33 | * 更新驱动配置 34 | * 35 | * @param driverInfo DriverInfo 36 | * @returns MyAxiosPromise 37 | */ 38 | export const updateDriverInfo = (driverInfo: any) => 39 | request({ 40 | url: `api/v3/manager/driver_attribute_config/update`, 41 | method: 'post', 42 | data: driverInfo 43 | }) 44 | 45 | /** 46 | * 通过设备ID和属性ID查询驱动配置 47 | * 48 | * @param deviceId DeviceId 49 | * @param attributeId AttributeId 50 | * @returns MyAxiosPromise 51 | */ 52 | export const getDriverInfoByDeviceIdAndAttributeId = (deviceId: string, attributeId: string) => 53 | request({ 54 | url: `api/v3/manager/driver_attribute_config/device_id/${deviceId}/attribute_id/${attributeId}`, 55 | method: 'get' 56 | }) 57 | 58 | /** 59 | * 通过设备ID查询驱动配置 60 | * 61 | * @param deviceId DeviceId 62 | * @returns MyAxiosPromise 63 | */ 64 | export const getDriverInfoByDeviceId = (deviceId: string) => 65 | request({ 66 | url: `api/v3/manager/driver_attribute_config/device_id/${deviceId}`, 67 | method: 'get' 68 | }) 69 | 70 | /** 71 | * 新增位号配置 72 | * 73 | * @param pointInfo PointInfo 74 | * @returns MyAxiosPromise 75 | */ 76 | export const addPointInfo = (pointInfo: any) => 77 | request({ 78 | url: `api/v3/manager/point_attribute_config/add`, 79 | method: 'post', 80 | data: pointInfo 81 | }) 82 | 83 | /** 84 | * 更新位号配置 85 | * 86 | * @param pointInfo PointInfo 87 | * @returns MyAxiosPromise 88 | */ 89 | export const updatePointInfo = (pointInfo: any) => 90 | request({ 91 | url: `api/v3/manager/point_attribute_config/update`, 92 | method: 'post', 93 | data: pointInfo 94 | }) 95 | 96 | /** 97 | * 通过设备ID和位号ID查询位号配置 98 | * 99 | * @param deviceId DeviceId 100 | * @param pointId PointId 101 | * @returns MyAxiosPromise 102 | */ 103 | export const getPointInfoByDeviceIdAndPointId = (deviceId: string, pointId: string) => 104 | request({ 105 | url: `api/v3/manager/point_attribute_config/device_id/${deviceId}/point_id/${pointId}`, 106 | method: 'get' 107 | }) 108 | 109 | /** 110 | * 通过设备ID查询位号配置 111 | * 112 | * @param deviceId DeviceId 113 | * @returns MyAxiosPromise 114 | */ 115 | export const getPointInfoByDeviceId = (deviceId: string) => 116 | request({ 117 | url: `api/v3/manager/point_attribute_config/device_id/${deviceId}`, 118 | method: 'get' 119 | }) 120 | -------------------------------------------------------------------------------- /src/views/profile/tool/ProfileTool.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 64 | 65 | 68 | 69 | 107 | -------------------------------------------------------------------------------- /src/views/device/card/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-present the IoT DC3 original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { CircleCheck, CircleClose, Coin, Edit, List, Promotion, Sunset, SwitchButton } from '@element-plus/icons-vue' 18 | import { defineComponent } from 'vue' 19 | 20 | import router from '@/config/router' 21 | 22 | import { copy, timestamp } from '@/utils/CommonUtil' 23 | import { successMessage } from '@/utils/NotificationUtil' 24 | 25 | export default defineComponent({ 26 | name: 'DeviceCard', 27 | components: { 28 | Promotion, 29 | List, 30 | Coin, 31 | Edit, 32 | Sunset 33 | }, 34 | props: { 35 | embedded: { 36 | type: Boolean, 37 | default: () => { 38 | return false 39 | } 40 | }, 41 | status: { 42 | type: String, 43 | default: () => { 44 | return '' 45 | } 46 | }, 47 | data: { 48 | type: Object, 49 | default: () => { 50 | return {} 51 | } 52 | }, 53 | driver: { 54 | type: Object, 55 | default: () => { 56 | return {} 57 | } 58 | }, 59 | icon: { 60 | type: String, 61 | default: 'images/common/device.png' 62 | } 63 | }, 64 | emits: ['disable-thing', 'enable-thing', 'delete-thing'], 65 | setup(props, { emit }) { 66 | // 图标 67 | const Icon = { 68 | SwitchButton, 69 | CircleCheck, 70 | CircleClose 71 | } 72 | 73 | const disableThing = () => { 74 | emit('disable-thing', props.data.id, props.data.driverId, () => { 75 | successMessage() 76 | }) 77 | } 78 | 79 | const enableThing = () => { 80 | emit('enable-thing', props.data.id, props.data.driverId, () => { 81 | successMessage() 82 | }) 83 | } 84 | 85 | const deleteThing = () => { 86 | emit('delete-thing', props.data.id, () => { 87 | successMessage() 88 | }) 89 | } 90 | 91 | const edit = () => { 92 | router.push({ name: 'deviceEdit', query: { id: props.data.id, active: '0' } }).catch(() => { 93 | // nothing to do 94 | }) 95 | } 96 | 97 | const detail = () => { 98 | router.push({ name: 'deviceDetail', query: { id: props.data.id, active: 'detail' } }).catch(() => { 99 | // nothing to do 100 | }) 101 | } 102 | 103 | return { 104 | disableThing, 105 | enableThing, 106 | deleteThing, 107 | edit, 108 | detail, 109 | copyId: copy, 110 | timestamp, 111 | ...Icon 112 | } 113 | } 114 | }) 115 | -------------------------------------------------------------------------------- /src/views/device/Device.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 76 | 77 |