增添使用指北

This commit is contained in:
Yu Sun
2022-07-14 11:47:44 +08:00
parent cea11228cd
commit 460e5fd916
6 changed files with 93 additions and 3 deletions

View File

@@ -4,6 +4,9 @@
- [API](#api)
- [class `EDataCapture`](#class-edatacapture)
- [0. HTTP POST: `set_node_data`](#0-http-post-set_node_data)
- [使用指北](#使用指北)
- [后端](#后端)
- [前端](#前端)
- [开发环境](#开发环境)
- [技术细节](#技术细节)
- [0. `EdgeManager\EDataCapture\EDataCapture -> set_data()`为什么是以`6710885`为大小chunked的](#0-edgemanageredatacaptureedatacapture---set_data为什么是以6710885为大小chunked的)
@@ -91,7 +94,94 @@
}
```
## 使用指北
本项目可独立运行也可作为MES的插件使用。
下文简要介绍如何将代码合并入MES中。
### 后端
目录结构:
```pre
📦EdgeManager
┣ 📂EDataCapture
┃ ┣ 📜EDataCapture.php
┃ ┗ 📜ENodeConfigure.php
┣ 📜Init.php
┗ 📜Utils.php
```
建议使用composer autoload引入。
将目录`EdgeManager`复制至项目后在composer.json内写入
```json
"autoload": {
"psr-4": {
"EdgeManager\\": "EdgeManager/"
},
"files": [
"EdgeManager/Utils.php",
"EdgeManager/Init.php"
]
},
```
运行`composer dump-autoload`即可正常调用EdgeManager的代码。
### 前端
需要在`main.js`中增加(全局引入组件):
```js
// D2-Crud
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import D2Crud from '@d2-projects/d2-crud'
// Cheetah-Grid
import vueCheetahGrid from 'vue-cheetah-grid'
Vue.use(ElementUI)
Vue.use(D2Crud)
Vue.use(vueCheetahGrid)
```
此外请参照目录结构中注释进行代码合并:
```pre
📦src
┣ 📂api
┃ ┣ 📂modules
┃ ┃ ┣ 📜scada.configure.api.js # 增添Axios请求
┃ ┃ ┗ 📜sys.user.api.js
┃ ┣ 📜index.js
┃ ┣ 📜service.js
┃ ┗ 📜tools.js
┣ 📂assets
┣ 📂components
┣ 📂libs
┣ 📂locales
┣ 📂menu
┃ ┗ 📜index.js # 增添菜单
┣ 📂plugin
┣ 📂router
┃ ┣ 📜index.js
┃ ┗ 📜routes.js # 增添路由
┣ 📂store
┣ 📂views
┃ ┣ 📂scada # 增添页面
┃ ┃ ┣ 📂scadaConfigure
┃ ┃ ┃ ┗ 📜index.vue
┃ ┃ ┗ 📂scadaQuery
┃ ┃ ┃ ┗ 📜index.vue
┃ ┗ 📂system
┣ 📜App.vue
┣ 📜i18n.js
┣ 📜main.js
┗ 📜setting.js
```
## 开发环境

View File

@@ -4,11 +4,11 @@
},
"autoload": {
"psr-4": {
"EdgeManager\\": "app/"
"EdgeManager\\": "EdgeManager/"
},
"files": [
"app/Utils.php",
"app/Init.php"
"EdgeManager/Utils.php",
"EdgeManager/Init.php"
]
},
"require-dev": {