Skip to content

Commit

Permalink
加入前端
Browse files Browse the repository at this point in the history
  • Loading branch information
zgwit committed May 31, 2023
1 parent ecf8cda commit 1f2e916
Show file tree
Hide file tree
Showing 1,671 changed files with 9,224 additions and 3,559 deletions.
37 changes: 13 additions & 24 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/scada",
"outputPath": "app/scada",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
Expand All @@ -49,7 +49,12 @@
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
"src/assets",
{
"glob": "**/*",
"input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
"output": "/assets/"
}
],
"styles": [
"./node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
Expand All @@ -62,8 +67,8 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "4mb"
"maximumWarning": "2mb",
"maximumError": "8mb"
},
{
"type": "anyComponentStyle",
Expand All @@ -86,6 +91,10 @@
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "scada:build",
"proxyConfig": "proxy.conf.json"
},
"configurations": {
"production": {
"browserTarget": "scada:build:production"
Expand All @@ -101,26 +110,6 @@
"options": {
"browserTarget": "scada:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
"src/styles.scss"
],
"scripts": []
}
}
}
}
Expand Down
57 changes: 25 additions & 32 deletions api/project.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package api

import (
"github.com/gin-gonic/gin"
"github.com/zgwit/iot-master/v3/pkg/curd"
"scada/types"
"github.com/gin-gonic/gin"
"github.com/iot-master-contrib/scada/types"
"github.com/zgwit/iot-master/v3/pkg/curd"
)

// @Summary 查询工程数量
Expand All @@ -24,7 +24,7 @@ func noopProjectCount() {}
// @Param search body ParamSearch true "查询参数"
// @Accept json
// @Produce json
// @Success 200 {object} ReplyList[Device] 返回工程信息
// @Success 200 {object} ReplyList[types.HmiProject] 返回工程信息
// @Router /project/search [post]
func noopProjectSearch() {}

Expand All @@ -35,20 +35,20 @@ func noopProjectSearch() {}
// @Param search query ParamList true "查询参数"
// @Accept json
// @Produce json
// @Success 200 {object} ReplyList[Device] 返回工程信息
// @Success 200 {object} ReplyList[types.HmiProject] 返回工程信息
// @Router /project/list [get]
func noopProjectList() {}

// @Summary 创建工程
// @Schemes
// @Description 创建工程
// @Tags project
// @Param search body types.Device true "工程信息"
// @Param search body types.HmiProject true "工程信息"
// @Accept json
// @Produce json
// @Success 200 {object} ReplyData[types.Device] 返回工程信息
// @Success 200 {object} ReplyData[types.HmiProject] 返回工程信息
// @Router /project/create [post]
func noopDeviceCreate() {}
func noopHmiProjectCreate() {}

// @Summary 获取工程
// @Schemes
Expand All @@ -57,7 +57,7 @@ func noopDeviceCreate() {}
// @Param id path int true "工程ID"
// @Accept json
// @Produce json
// @Success 200 {object} ReplyData[Device] 返回工程信息
// @Success 200 {object} ReplyData[types.HmiProject] 返回工程信息
// @Router /project/{id} [get]
func noopProjectGet() {}

Expand All @@ -66,10 +66,10 @@ func noopProjectGet() {}
// @Description 修改工程
// @Tags project
// @Param id path int true "工程ID"
// @Param project body Device true "工程信息"
// @Param project body types.HmiProject true "工程信息"
// @Accept json
// @Produce json
// @Success 200 {object} ReplyData[Device] 返回工程信息
// @Success 200 {object} ReplyData[types.HmiProject] 返回工程信息
// @Router /project/{id} [post]
func noopProjectUpdate() {}

Expand All @@ -80,9 +80,9 @@ func noopProjectUpdate() {}
// @Param id path int true "工程ID"
// @Accept json
// @Produce json
// @Success 200 {object} ReplyData[types.Device] 返回工程信息
// @Success 200 {object} ReplyData[types.HmiProject] 返回工程信息
// @Router /project/{id}/delete [get]
func noopDeviceDelete() {}
func noopHmiProjectDelete() {}

// @Summary 导出工程
// @Schemes
Expand All @@ -91,7 +91,7 @@ func noopDeviceDelete() {}
// @Accept json
// @Produce octet-stream
// @Router /project/export [get]
func noopDeviceExport() {}
func noopHmiProjectExport() {}

// @Summary 导入工程
// @Schemes
Expand All @@ -102,33 +102,26 @@ func noopDeviceExport() {}
// @Produce json
// @Success 200 {object} ReplyData[int64] 返回工程数量
// @Router /project/import [post]
func noopDeviceImport() {}
func noopHmiProjectImport() {}
func projectRouter(app *gin.RouterGroup) {

app.POST("/count", curd.ApiCount[types.HmiProject]())
app.POST("/count", curd.ApiCount[types.HmiProject]())

app.POST("/search", curd.ApiSearch[types.HmiProject]())
app.POST("/search", curd.ApiSearch[types.HmiProject]())

app.GET("/list", curd.ApiList[types.HmiProject]())
app.GET("/list", curd.ApiList[types.HmiProject]())

app.POST("/create", curd.ApiCreateHook[types.HmiProject](curd.GenerateRandomId[types.HmiProject](12), nil))
app.POST("/create", curd.ApiCreateHook[types.HmiProject](curd.GenerateRandomId[types.HmiProject](12), nil))

app.GET("/:id", curd.ParseParamStringId, curd.ApiGet[types.HmiProject]())
app.GET("/:id", curd.ParseParamStringId, curd.ApiGet[types.HmiProject]())

app.POST("/:id", curd.ParseParamStringId, curd.ApiUpdateHook[types.HmiProject](
nil,
nil,
"id",
"name",
"desc",
"pages",
"devices",
))
app.POST("/:id", curd.ParseParamStringId, curd.ApiUpdateHook[types.HmiProject](nil, nil,
"id", "name", "desc", "pages", "devices"))

app.POST("/:id/delete", curd.ParseParamStringId, curd.ApiDelete[types.HmiProject]())
app.POST("/:id/delete", curd.ParseParamStringId, curd.ApiDelete[types.HmiProject]())

app.GET("/export", curd.ApiExport[types.HmiProject]("hmi_project", "hmi_project"))
app.GET("/export", curd.ApiExport("hmi_project", "hmi_project"))

app.POST("/import", curd.ApiImport[types.HmiProject]("hmi_project"))
app.POST("/import", curd.ApiImport("hmi_project"))

}
Loading

0 comments on commit 1f2e916

Please sign in to comment.