Commit b8cbf386 authored by sven's avatar sven

Merge remote-tracking branch 'origin/master'

parents 0acbb4e6 336787b0
......@@ -1775,6 +1775,63 @@
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true
},
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
"integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"ssri": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
......@@ -1783,6 +1840,28 @@
"requires": {
"minipass": "^3.1.1"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
}
}
},
......@@ -5121,6 +5200,11 @@
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
"dev": true
},
"ezuikit-js": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/ezuikit-js/-/ezuikit-js-0.6.3.tgz",
"integrity": "sha512-nFaQXHALzGgXop4aZ23g96EmKT+IRfvibx4I4jLIcNAjXWI+PZk3g/365end7trMY646+5BeP0kn9CXzHH9s1g=="
},
"fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
......@@ -10709,87 +10793,6 @@
}
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
"integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-router": {
"version": "4.0.12",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.0.12.tgz",
......
......@@ -11,6 +11,7 @@
"core-js": "^3.6.5",
"dayjs": "^1.10.7",
"element-plus": "^2.0.1",
"ezuikit-js": "^0.6.3",
"pinia": "^2.0.14",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0",
......
<template>
<div class="hello-ezuikit-js">
<div id="video-container" style="flex: 1;"></div>
<div style="flex-shrink: 0;padding:5px 0;text-align: right">
<el-button type="primary" @click="stop">暂停</el-button>
<el-button type="primary" @click="play">播放</el-button>
<!--<el-button @click="openSound">openSound</el-button>-->
<!--<el-button @click="closeSound">closeSound</el-button>-->
<!--<el-button @click="startSave">startSave</el-button>-->
<!--<el-button @click="stopSave">stopSave</el-button>-->
<!--<el-button @click="capturePicture">capturePicture</el-button>-->
<!--<el-button @click="fullScreen">fullScreen</el-button>-->
<!--<el-button @click="getOSDTime">getOSDTime</el-button>-->
<!--<el-button @click="ezopenStartTalk">开始对讲</el-button>-->
<!--<el-button @click="ezopenStopTalk">结束对讲</el-button>-->
<!--<el-button @click="destroy">销毁</el-button>-->
</div>
</div>
</template>
<script>
import EZUIKit from "ezuikit-js";
let player = null;
export default {
name: "esu",
props: {
url: String,
accessToken: String,
},
data(){
return {
next_time:Date.now()
}
},
mounted(){
this.init();
window.addEventListener('onresize',this.resize);
},
methods: {
play() {
const playPromise = player.play();
playPromise.then((data) => {
console.log("promise 获取 数据", data)
})
},
stop() {
const stopPromise = player.stop();
stopPromise.then((data) => {
console.log("promise 获取 数据", data)
})
},
getOSDTime() {
const getOSDTimePromise = player.getOSDTime();
getOSDTimePromise.then((data) => {
console.log("promise 获取 数据", data)
})
},
capturePicture() {
const capturePicturePromise = player.capturePicture(`${new Date().getTime()}`);
capturePicturePromise.then((data) => {
console.log("promise 获取 数据", data)
})
},
openSound() {
const openSoundPromise = player.openSound();
openSoundPromise.then((data) => {
console.log("promise 获取 数据", data)
})
},
closeSound() {
const openSoundPromise = player.closeSound();
openSoundPromise.then((data) => {
console.log("promise 获取 数据", data)
})
},
startSave() {
const startSavePromise = player.startSave(`${new Date().getTime()}`);
startSavePromise.then((data) => {
console.log("promise 获取 数据", data)
})
},
stopSave() {
const stopSavePromise = player.stopSave();
stopSavePromise.then((data) => {
console.log("promise 获取 数据", data)
})
},
ezopenStartTalk() {
player.startTalk();
},
ezopenStopTalk() {
player.stopTalk();
},
fullScreen() {
player.fullScreen();
},
destroy() {
const destroyPromise = player.destroy();
destroyPromise.then((data) => {
console.log("promise 获取 数据", data)
})
},
resize(){
if(Date.now() - this.next_time>600){
this.next_time = Date.now();
}
},
init(){
player = new EZUIKit.EZUIKitPlayer({
id: 'video-container', // 视频容器ID
accessToken: this.accessToken,
url: this.url,
// simple - 极简版; pcLive-pc直播;pcRec-pc回放;mobileLive-移动端直播;mobileRec-移动端回放;security - 安防版;voice-语音版;
// template: 'simple',
// plugin: ['talk'], // 加载插件,talk-对讲
// width: 600,
// height: 400,
});
this.$nextTick(()=>{
player.play();
});
}
}
};
</script>
<style lang="less" scoped>
.hello-ezuikit-js{
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
</style>
......@@ -135,7 +135,7 @@
</div>
</div>
<div class="body-one monitor" v-else-if="tab=='monitor'">
<esu :url="detail.url" :accessToken="detail.accessToken"></esu>
</div>
<div class="body-one process" v-else-if="tab=='process'">
<div class="process-box">
......@@ -278,12 +278,15 @@
setup(props, {emit}) {
const state = reactive({
show:false,
url:'ezopen://open.ys7.com/E77565052/1.hd.live',
order_id:'',
detail: {
poster:[],
index: 0,
yewei:0.7,
type:1
type:1,
accessToken:'at.bvx2ea007tfqqdvkcb9iuhk70q6gjodm-7smdnjfh9j-1wdmw5f-mal3go2vz',
url:'ezopen://open.ys7.com/E77565052/1.live',
},
showBanner:false,
tabs: [
......@@ -613,7 +616,8 @@
}
},
components: {
orderDetail:defineAsyncComponent(()=>import("@/views/order-detail.vue"))
orderDetail:defineAsyncComponent(()=>import("@/views/order-detail.vue")),
esu:defineAsyncComponent(()=>import("@/components/EZUIKitJs.vue")),
}
}
</script>
......
......@@ -5,5 +5,6 @@ type ApiGroup struct {
QshToiletApi
QshPartolApi
QshMonitorDataApi
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
adminReq "github.com/flipped-aurora/gin-vue-admin/server/model/admin/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type QshMonitorDataApi struct {
}
var qshMonitorDataService = service.ServiceGroupApp.AdminServiceGroup.QshMonitorDataService
// CreateQshMonitorData 创建QshMonitorData
// @Tags QshMonitorData
// @Summary 创建QshMonitorData
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body admin.QshMonitorData true "创建QshMonitorData"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshMonitorData/createQshMonitorData [post]
func (qshMonitorDataApi *QshMonitorDataApi) CreateQshMonitorData(c *gin.Context) {
var qshMonitorData admin.QshMonitorData
_ = c.ShouldBindJSON(&qshMonitorData)
if err := qshMonitorDataService.CreateQshMonitorData(qshMonitorData); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithMessage("创建成功", c)
}
}
// DeleteQshMonitorData 删除QshMonitorData
// @Tags QshMonitorData
// @Summary 删除QshMonitorData
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body admin.QshMonitorData true "删除QshMonitorData"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /qshMonitorData/deleteQshMonitorData [delete]
func (qshMonitorDataApi *QshMonitorDataApi) DeleteQshMonitorData(c *gin.Context) {
var qshMonitorData admin.QshMonitorData
_ = c.ShouldBindJSON(&qshMonitorData)
if err := qshMonitorDataService.DeleteQshMonitorData(qshMonitorData); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
} else {
response.OkWithMessage("删除成功", c)
}
}
// DeleteQshMonitorDataByIds 批量删除QshMonitorData
// @Tags QshMonitorData
// @Summary 批量删除QshMonitorData
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除QshMonitorData"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
// @Router /qshMonitorData/deleteQshMonitorDataByIds [delete]
func (qshMonitorDataApi *QshMonitorDataApi) DeleteQshMonitorDataByIds(c *gin.Context) {
var IDS request.IdsReq
_ = c.ShouldBindJSON(&IDS)
if err := qshMonitorDataService.DeleteQshMonitorDataByIds(IDS); err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败", c)
} else {
response.OkWithMessage("批量删除成功", c)
}
}
// UpdateQshMonitorData 更新QshMonitorData
// @Tags QshMonitorData
// @Summary 更新QshMonitorData
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body admin.QshMonitorData true "更新QshMonitorData"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /qshMonitorData/updateQshMonitorData [put]
func (qshMonitorDataApi *QshMonitorDataApi) UpdateQshMonitorData(c *gin.Context) {
var qshMonitorData admin.QshMonitorData
_ = c.ShouldBindJSON(&qshMonitorData)
if err := qshMonitorDataService.UpdateQshMonitorData(qshMonitorData); err != nil {
global.GVA_LOG.Error("更新失败!", zap.Error(err))
response.FailWithMessage("更新失败", c)
} else {
response.OkWithMessage("更新成功", c)
}
}
// FindQshMonitorData 用id查询QshMonitorData
// @Tags QshMonitorData
// @Summary 用id查询QshMonitorData
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query admin.QshMonitorData true "用id查询QshMonitorData"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /qshMonitorData/findQshMonitorData [get]
func (qshMonitorDataApi *QshMonitorDataApi) FindQshMonitorData(c *gin.Context) {
var qshMonitorData admin.QshMonitorData
_ = c.ShouldBindQuery(&qshMonitorData)
if reqshMonitorData, err := qshMonitorDataService.GetQshMonitorData(qshMonitorData.ID); err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败", c)
} else {
response.OkWithData(gin.H{"reqshMonitorData": reqshMonitorData}, c)
}
}
// GetQshMonitorDataList 分页获取QshMonitorData列表
// @Tags QshMonitorData
// @Summary 分页获取QshMonitorData列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query adminReq.QshMonitorDataSearch true "分页获取QshMonitorData列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshMonitorData/getQshMonitorDataList [get]
func (qshMonitorDataApi *QshMonitorDataApi) GetQshMonitorDataList(c *gin.Context) {
var pageInfo adminReq.QshMonitorDataSearch
_ = c.ShouldBindQuery(&pageInfo)
if list, total, err := qshMonitorDataService.GetQshMonitorDataInfoList(pageInfo); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
} else {
response.OkWithDetailed(response.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, "获取成功", c)
}
}
package web
import (
"gitee.com/zjlsliupei/ghelp"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/request"
"github.com/flipped-aurora/gin-vue-admin/server/service/web"
"github.com/gin-gonic/gin"
)
var DataService = new(web.DataService)
func DataIn(c *gin.Context) {
}
//GetYewei 获取液位数据
func GetYewei(c *gin.Context) {
var arg request.GetYewei
_ = c.ShouldBindJSON(&arg)
data, err := DataService.GetYewei(arg)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData(data, c)
}
//GetHistoryDataList 获取历史数据列表
func GetHistoryDataList(c *gin.Context) {
var arg request.GetHistoryDataList
_ = c.ShouldBindJSON(&arg)
list, total, err := DataService.GetHistoryDataList(arg)
if err != nil {
response.FailWithMessage(err.Error(), c)
return
}
response.OkWithData(ghelp.MAP{
"list": list,
"total": total,
}, c)
}
......@@ -55,6 +55,7 @@ func RegisterTables(db *gorm.DB) {
admin.QshToilet{},
admin.QshPatrol{},
admin.QshMonitorData{},
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
)
if err != nil {
......
......@@ -74,6 +74,7 @@ func Routers() *gin.Engine {
adminRouter.InitQshToiletRouter(PrivateGroup)
adminRouter.InitQshPartolRouter(PrivateGroup)
adminRouter.InitQshMonitorDataRouter(PrivateGroup)
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
......
package main
import (
"fmt"
"github.com/flipped-aurora/gin-vue-admin/server/core"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/initialize"
"github.com/flipped-aurora/gin-vue-admin/server/server"
"github.com/flipped-aurora/gin-vue-admin/server/service/web"
"go.uber.org/zap"
)
......@@ -38,9 +38,9 @@ func main() {
// dtu服务器
if global.GVA_VP.GetBool("dtuServer.enable") {
server.OnDtuMessage(func(data server.YeWeiData) error {
fmt.Println(data)
service := new(web.DataService)
// {9.300 860059054444117}
return nil
return service.DataInYeWei(data)
})
go server.InitDtuServer(global.GVA_VP.GetString("dtuServer.addr"))
}
......
// 自动生成模板QshMonitorData
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
)
// QshMonitorData 结构体
type QshMonitorData struct {
global.GVA_MODEL
RawDeviceId string `json:"rawDeviceId" form:"rawDeviceId" gorm:"column:raw_device_id;comment:原始设备id;size:50;"`
ToiletId int `json:"toiletId" form:"toiletId" gorm:"column:toilet_id;comment:公厕id;size:10;"`
TypeName string `json:"typeName" form:"typeName" gorm:"column:type_name;comment:数据类型;size:50;"`
Unit string `json:"unit" form:"unit" gorm:"column:unit;comment:数据值单位;size:50;"`
Value string `json:"value" form:"value" gorm:"column:value;comment:数据值;size:50;"`
}
// TableName QshMonitorData 表名
func (QshMonitorData) TableName() string {
return "qsh_monitor_data"
}
......@@ -3,7 +3,6 @@ package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
)
// QshToilet 结构体
......@@ -15,15 +14,15 @@ type QshToilet struct {
Lng string `json:"lng" form:"lng" gorm:"column:lng;comment:经度;size:255;"`
Manager string `json:"manager" form:"manager" gorm:"column:manager;comment:管理人员;size:200;"`
ManagerPhone string `json:"managerPhone" form:"managerPhone" gorm:"column:manager_phone;comment:管理员联系电话;size:100;"`
Monitor string `json:"monitor" form:"monitor" gorm:"column:monitor;comment:监控信息;size:255;"`
MonitorId string `json:"monitor_id" form:"monitor_id" gorm:"column:monitor_id;comment:监控信息;size:255;"`
MonitorAc string `json:"monitor_ac" form:"monitor_ac" gorm:"column:monitor_ac;comment:监控设备账号;size:255;"`
YeweiDevice string `json:"yewei_device" form:"yewei_device" gorm:"column:yewei_device;comment:液位设备id;"`
Name string `json:"name" form:"name" gorm:"column:name;comment:点位名称;size:198;"`
ShowImage string `json:"showImage" form:"showImage" gorm:"column:show_image;comment:展示图片;size:300;"`
Type *int `json:"type" form:"type" gorm:"column:type;comment:公厕类型 1=>有动力 2=>无动力;"`
}
// TableName QshToilet 表名
func (QshToilet) TableName() string {
return "qsh_toilet"
}
package request
import (
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
)
type QshMonitorDataSearch struct {
admin.QshMonitorData
request.PageInfo
}
package request
import "github.com/flipped-aurora/gin-vue-admin/server/utils"
type GetYewei struct {
ToiletID int `json:"toilet_id"`
YeweiDeviceID string `json:"yewei_device_id"`
}
type GetHistoryDataList struct {
utils.PageInfo
TypeName string `json:"type_name"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
ToiletID int `json:"toilet_id"`
}
......@@ -5,5 +5,6 @@ type RouterGroup struct {
QshToiletRouter
QshPartolRouter
QshMonitorDataRouter
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/api/v1"
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
"github.com/gin-gonic/gin"
)
type QshMonitorDataRouter struct {
}
// InitQshMonitorDataRouter 初始化 QshMonitorData 路由信息
func (s *QshMonitorDataRouter) InitQshMonitorDataRouter(Router *gin.RouterGroup) {
qshMonitorDataRouter := Router.Group("qshMonitorData").Use(middleware.OperationRecord())
qshMonitorDataRouterWithoutRecord := Router.Group("qshMonitorData")
var qshMonitorDataApi = v1.ApiGroupApp.AdminApiGroup.QshMonitorDataApi
{
qshMonitorDataRouter.POST("createQshMonitorData", qshMonitorDataApi.CreateQshMonitorData) // 新建QshMonitorData
qshMonitorDataRouter.DELETE("deleteQshMonitorData", qshMonitorDataApi.DeleteQshMonitorData) // 删除QshMonitorData
qshMonitorDataRouter.DELETE("deleteQshMonitorDataByIds", qshMonitorDataApi.DeleteQshMonitorDataByIds) // 批量删除QshMonitorData
qshMonitorDataRouter.PUT("updateQshMonitorData", qshMonitorDataApi.UpdateQshMonitorData) // 更新QshMonitorData
}
{
qshMonitorDataRouterWithoutRecord.GET("findQshMonitorData", qshMonitorDataApi.FindQshMonitorData) // 根据ID获取QshMonitorData
qshMonitorDataRouterWithoutRecord.GET("getQshMonitorDataList", qshMonitorDataApi.GetQshMonitorDataList) // 获取QshMonitorData列表
}
}
......@@ -27,4 +27,9 @@ func InitWebRouter(router *gin.Engine) {
{
oss.POST("getOssConfig", web.GetOssConfig)
}
data := webRouter.Group("data")
{
data.POST("getHistoryDataList", web.GetHistoryDataList)
data.POST("getYewei", web.GetYewei)
}
}
package admin
type ServiceGroup struct {
// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
QshToiletService
QshPartolService
QshMonitorDataService
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
package admin
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
adminReq "github.com/flipped-aurora/gin-vue-admin/server/model/admin/request"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
)
type QshMonitorDataService struct {
}
// CreateQshMonitorData 创建QshMonitorData记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshMonitorDataService *QshMonitorDataService) CreateQshMonitorData(qshMonitorData admin.QshMonitorData) (err error) {
err = global.GVA_DB.Create(&qshMonitorData).Error
return err
}
// DeleteQshMonitorData 删除QshMonitorData记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshMonitorDataService *QshMonitorDataService) DeleteQshMonitorData(qshMonitorData admin.QshMonitorData) (err error) {
err = global.GVA_DB.Delete(&qshMonitorData).Error
return err
}
// DeleteQshMonitorDataByIds 批量删除QshMonitorData记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshMonitorDataService *QshMonitorDataService) DeleteQshMonitorDataByIds(ids request.IdsReq) (err error) {
err = global.GVA_DB.Delete(&[]admin.QshMonitorData{}, "id in ?", ids.Ids).Error
return err
}
// UpdateQshMonitorData 更新QshMonitorData记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshMonitorDataService *QshMonitorDataService) UpdateQshMonitorData(qshMonitorData admin.QshMonitorData) (err error) {
err = global.GVA_DB.Save(&qshMonitorData).Error
return err
}
// GetQshMonitorData 根据id获取QshMonitorData记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshMonitorDataService *QshMonitorDataService) GetQshMonitorData(id uint) (qshMonitorData admin.QshMonitorData, err error) {
err = global.GVA_DB.Where("id = ?", id).First(&qshMonitorData).Error
return
}
// GetQshMonitorDataInfoList 分页获取QshMonitorData记录
// Author [piexlmax](https://github.com/piexlmax)
func (qshMonitorDataService *QshMonitorDataService) GetQshMonitorDataInfoList(info adminReq.QshMonitorDataSearch) (list interface{}, total int64, err error) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
// 创建db
db := global.GVA_DB.Model(&admin.QshMonitorData{})
var qshMonitorDatas []admin.QshMonitorData
// 如果有条件搜索 下方会自动创建搜索语句
if info.RawDeviceId != "" {
db = db.Where("raw_device_id = ?", info.RawDeviceId)
}
if info.TypeName != "" {
db = db.Where("type_name LIKE ?", "%"+info.TypeName+"%")
}
err = db.Count(&total).Error
if err != nil {
return
}
err = db.Limit(limit).Offset(offset).Find(&qshMonitorDatas).Error
return qshMonitorDatas, total, err
}
package web
import (
"errors"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
"github.com/flipped-aurora/gin-vue-admin/server/request"
"github.com/flipped-aurora/gin-vue-admin/server/server"
)
type DataService struct {
}
//DataInYeWei 接受液位数据
func (s *DataService) DataInYeWei(arg server.YeWeiData) error {
//先查询设备绑定厕所
var toiletInfo admin.QshToilet
err := global.GVA_DB.Model(admin.QshToilet{}).Where("yewei_device = ?", arg.DeviceId).First(&toiletInfo).Error
if err != nil {
return errors.New("设备ID未绑定公厕信息!")
}
return global.GVA_DB.Create(&admin.QshMonitorData{
ToiletId: int(toiletInfo.ID),
RawDeviceId: arg.DeviceId,
TypeName: "液位",
Value: arg.YeWei,
Unit: "m",
}).Error
}
//GetYewei 获取液位
func (s *DataService) GetYewei(arg request.GetYewei) (admin.QshMonitorData, error) {
var data admin.QshMonitorData
err := global.GVA_DB.Model(admin.QshMonitorData{}).Where("toilet_id = ?", arg.ToiletID).Where("type_name = ?", "液位").Last(&data).Error
if err != nil {
return data, err
}
return data, nil
}
//GetHistoryDataList 获取历史数据
func (s *DataService) GetHistoryDataList(arg request.GetHistoryDataList) ([]admin.QshMonitorData, int64, error) {
var count int64
var data []admin.QshMonitorData
limit := arg.PageSize
offset := (arg.Page - 1) * arg.PageSize
db := global.GVA_DB.Model(admin.QshMonitorData{})
if arg.ToiletID != 0 {
db.Where("toilet_id = ?", arg.ToiletID)
}
if arg.TypeName != "" {
db.Where("type_name = ?", arg.TypeName)
}
if arg.StartTime != "" {
db.Where("created_at >= ?", arg.StartTime)
}
if arg.EndTime != "" {
db.Where("created_at <= ?", arg.EndTime)
}
db.Count(&count)
err := db.Limit(limit).Offset(offset).Find(&data).Error
if err != nil {
return data, count, err
}
return data, count, nil
}
import service from '@/utils/request'
// @Tags QshMonitorData
// @Summary 创建QshMonitorData
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.QshMonitorData true "创建QshMonitorData"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshMonitorData/createQshMonitorData [post]
export const createQshMonitorData = (data) => {
return service({
url: '/qshMonitorData/createQshMonitorData',
method: 'post',
data
})
}
// @Tags QshMonitorData
// @Summary 删除QshMonitorData
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.QshMonitorData true "删除QshMonitorData"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /qshMonitorData/deleteQshMonitorData [delete]
export const deleteQshMonitorData = (data) => {
return service({
url: '/qshMonitorData/deleteQshMonitorData',
method: 'delete',
data
})
}
// @Tags QshMonitorData
// @Summary 删除QshMonitorData
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除QshMonitorData"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /qshMonitorData/deleteQshMonitorData [delete]
export const deleteQshMonitorDataByIds = (data) => {
return service({
url: '/qshMonitorData/deleteQshMonitorDataByIds',
method: 'delete',
data
})
}
// @Tags QshMonitorData
// @Summary 更新QshMonitorData
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.QshMonitorData true "更新QshMonitorData"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /qshMonitorData/updateQshMonitorData [put]
export const updateQshMonitorData = (data) => {
return service({
url: '/qshMonitorData/updateQshMonitorData',
method: 'put',
data
})
}
// @Tags QshMonitorData
// @Summary 用id查询QshMonitorData
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query model.QshMonitorData true "用id查询QshMonitorData"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /qshMonitorData/findQshMonitorData [get]
export const findQshMonitorData = (params) => {
return service({
url: '/qshMonitorData/findQshMonitorData',
method: 'get',
params
})
}
// @Tags QshMonitorData
// @Summary 分页获取QshMonitorData列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.PageInfo true "分页获取QshMonitorData列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /qshMonitorData/getQshMonitorDataList [get]
export const getQshMonitorDataList = (params) => {
return service({
url: '/qshMonitorData/getQshMonitorDataList',
method: 'get',
params
})
}
This diff is collapsed.
<template>
<div>
<div class="gva-form-box">
<el-form :model="formData" label-position="right" label-width="80px">
<el-form-item label="原始设备id:">
<el-input v-model="formData.rawDeviceId" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="公厕id:">
<el-input v-model.number="formData.toiletId" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="数据类型:">
<el-input v-model="formData.typeName" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="数据值单位:">
<el-input v-model="formData.unit" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="数据值:">
<el-input v-model="formData.value" clearable placeholder="请输入" />
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" @click="save">保存</el-button>
<el-button size="mini" type="primary" @click="back">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
export default {
name: 'QshMonitorData'
}
</script>
<script setup>
import {
createQshMonitorData,
updateQshMonitorData,
findQshMonitorData
} from '@/api/qshMonitorData'
// 自动获取字典
import { getDictFunc } from '@/utils/format'
import { useRoute, useRouter } from "vue-router"
import { ElMessage } from 'element-plus'
import { ref } from 'vue'
const route = useRoute()
const router = useRouter()
const type = ref('')
const formData = ref({
rawDeviceId: '',
toiletId: 0,
typeName: '',
unit: '',
value: '',
})
// 初始化方法
const init = async () => {
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
if (route.query.id) {
const res = await findQshMonitorData({ ID: route.query.id })
if (res.code === 0) {
formData.value = res.data.reqshMonitorData
type.value = 'update'
}
} else {
type.value = 'create'
}
}
init()
// 保存按钮
const save = async() => {
let res
switch (type.value) {
case 'create':
res = await createQshMonitorData(formData.value)
break
case 'update':
res = await updateQshMonitorData(formData.value)
break
default:
res = await createQshMonitorData(formData.value)
break
}
if (res.code === 0) {
ElMessage({
type: 'success',
message: '创建/更改成功'
})
}
}
// 返回按钮
const back = () => {
router.go(-1)
}
</script>
<style>
</style>
......@@ -45,14 +45,14 @@
>
<el-table-column type="selection" width="55"/>
<el-table-column align="left" label="点位名称" prop="name" min-width="180"/>
<el-table-column align="left" label="公厕地址" prop="address" min-width="180"/>
<el-table-column align="left" label="公厕地址" prop="address" min-width="200"/>
<el-table-column align="left" label="公厕类型" prop="type" min-width="120">
<template #default="scope">
{{ filterDict(scope.row.type,typeOptions) }}
</template>
</el-table-column>
<el-table-column align="left" label="纬度" prop="lat" min-width="120"/>
<el-table-column align="left" label="经度" prop="lng" min-width="120"/>
<el-table-column align="left" label="纬度" prop="lat" min-width="180"/>
<el-table-column align="left" label="经度" prop="lng" min-width="180"/>
<el-table-column align="left" label="管理人员" prop="manager" min-width="120"/>
<el-table-column align="left" label="管理员联系电话" prop="managerPhone" min-width="140"/>
<el-table-column align="left" label="创建时间" min-width="180">
......@@ -80,7 +80,7 @@
/>
</div>
</div>
<el-dialog v-model="dialogFormVisible" :before-close="closeDialog" title="弹窗操作">
<el-dialog v-model="dialogFormVisible" :before-close="closeDialog" title="公厕详情">
<el-form :model="formData" label-position="right" label-width="120px">
<el-form-item label="点位名称:">
<el-input v-model="formData.name" clearable placeholder="请输入"/>
......@@ -92,7 +92,7 @@
</el-select>
</el-form-item>
<el-form-item label="公厕地址:">
<el-input v-model="formData.address" clearable placeholder="请输入"/>
<el-input v-model="formData.address" type="textarea" resize="none" clearable placeholder="请输入"/>
</el-form-item>
<el-form-item label="展示图片:">
<new-upload v-if="dialogFormVisible" :list="[formData.showImage]" @upload="(file)=>formData.showImage = file[0]"></new-upload>
......@@ -112,8 +112,14 @@
<el-form-item label="管理员联系电话:">
<el-input v-model="formData.managerPhone" clearable placeholder="请输入"/>
</el-form-item>
<el-form-item label="监控信息:">
<el-input v-model="formData.monitor" clearable placeholder="请输入"/>
<el-form-item label="监控账号:">
<el-input v-model="formData.monitor_ac" clearable placeholder="请输入"/>
</el-form-item>
<el-form-item label="监控ID:">
<el-input v-model="formData.monitor_id" clearable placeholder="请输入"/>
</el-form-item>
<el-form-item label="设备ID:">
<el-input v-model="formData.yewei_device" clearable placeholder="请输入"/>
</el-form-item>
</el-form>
<template #footer>
......@@ -156,7 +162,9 @@
lng: '',
manager: '',
managerPhone: '',
monitor: '',
monitor_ac: '',//监控账号
monitor_id: '',//监控ID
yewei_device: '',//设备ID
name: '',
showImage: '',
type: undefined,
......@@ -315,7 +323,9 @@
lng: '',
manager: '',
managerPhone: '',
monitor: '',
monitor_ac: '',//监控账号
monitor_id: '',//监控ID
yewei_device: '',//设备ID
name: '',
showImage: '',
type: undefined,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment