From bcdf41a43daff31d342e6cd2a39fbd28bb00b61b Mon Sep 17 00:00:00 2001
From: zy <zy@123>
Date: 星期一, 21 七月 2025 09:52:55 +0800
Subject: [PATCH] #
---
src/main/webapp/views/index.html | 403 ++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 325 insertions(+), 78 deletions(-)
diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html
index 74db576..6402c85 100644
--- a/src/main/webapp/views/index.html
+++ b/src/main/webapp/views/index.html
@@ -1,98 +1,345 @@
<!DOCTYPE html>
<html lang="en">
+
<head>
- <meta charset="utf-8">
- <title>鑷姩浠撳簱WCS绯荤粺</title>
- <link rel="stylesheet" href="../static/css/index.css">
- <link rel="stylesheet" href="../static/css/layx.min.css" type="text/css" />
- <script src="../static/js/jquery/jquery-3.3.1.min.js"></script>
- <script src="../static/js/tools/layx.min.js"></script>
+ <meta charset="UTF-8">
+ <title>Gateway</title>
+ <link rel="stylesheet" href="../static/vue/element/element.css">
+ <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
+ <script type="text/javascript" src="../static/js/common.js"></script>
+ <script type="text/javascript" src="../static/vue/js/vue.min.js"></script>
+ <script type="text/javascript" src="../static/vue/element/element.js"></script>
<style>
- .layx-window.layx-skin-news .layx-control-bar {
- background-color: #333333;
+ .el-table .success-row {
+ background: #b6ff8e;
}
</style>
</head>
+
<body>
-<!-- 瀵艰埅鏍� -->
-<div class="sidebar">
- <div class="nav">
- <ul class="cl-effect-4">
- <li><a id="console" onclick="nav(this.id)" class="nav-select" href="#">涓绘帶鍥�</a></li>
- <li><a id="pipeline" onclick="nav(this.id)" class="nav-unselect" href="#">杈撻�佽澶�</a></li>
- <li><a id="lift" onclick="nav(this.id)" class="nav-unselect" href="#">鎻愬崌鏈�</a></li>
-<!-- <li><a id="ste" onclick="nav(this.id)" class="nav-unselect" href="#">绌挎杞�</a></li>-->
- <li><a id="shuttle" onclick="nav(this.id)" class="nav-unselect" href="#">鍥涘悜绌挎杞�</a></li>
- <li><a id="task" onclick="nav(this.id)" class="nav-unselect" href="#">浠诲姟绠$悊</a></li>
- </ul>
+<div id="app" style="display: flex;justify-content: center;flex-wrap: wrap;">
+ <div style="width: 40%;">
+ <el-card class="box-card">
+ <div slot="header" class="clearfix">
+ <span>妯℃嫙璁惧 - {{ systemInfo.gatewayId }}鍙风綉鍏�</span>
+<!-- <el-button style="float: right; padding: 3px 0" type="text" @click="addDeviceVisible = true">娣诲姞璁惧</el-button>-->
+ </div>
+
+ <div style="display: flex;flex-wrap: wrap;justify-content: space-between;">
+ <div v-for="item in deviceList" style="width: 49%;margin-top: 20px">
+ <el-card class="box-card" >
+ <div slot="header" class="clearfix">
+ <span>{{ item.deviceType }} - {{ item.deviceNo }}</span>
+<!-- <el-button style="float: right; padding: 3px 0" type="text" @click="delDevice(item)">鍒犻櫎璁惧</el-button>-->
+ <el-button style="float: right; padding: 3px 0" type="text" @click="setCurrentDeviceConfig(item)">鐘舵��</el-button>
+ </div>
+
+ <div>
+ <div>IP: {{ item.ip }}</div>
+ <div>绔彛: {{ item.port }}</div>
+ <div>铏氭嫙: {{ item.fake }}</div>
+ <div>瀹炵幇绫�: {{ item.threadImpl }}</div>
+ </div>
+ </el-card>
+ </div>
+ </div>
+ </el-card>
</div>
+
+ <div v-if="currentDeviceConfig != null" style="width: 30%;margin-left: 30px;">
+ <el-card class="box-card">
+ <div slot="header" class="clearfix">
+ <span>妯℃嫙璁惧鐘舵��</span>
+ </div>
+
+ <div style="display: flex;flex-wrap: wrap;justify-content: space-between;">
+ <div v-if="currentDeviceData != null" style="width: 100%;margin-top: 20px">
+ <el-card class="box-card" >
+ <div slot="header" class="clearfix">
+ <span>{{ currentDeviceData.deviceType }} - {{ currentDeviceData.deviceNo }}</span>
+ <el-button v-if="currentDeviceDataForm == null" style="float: right; padding: 3px 0" type="text" @click="updateCurrentDeviceStatus(currentDeviceData)">鏇存柊鐘舵��</el-button>
+ <el-button v-else style="float: right; padding: 3px 0" type="text" @click="submitUpdateCurrentDeviceStatus(currentDeviceDataForm)">鎻愪氦鏇存柊</el-button>
+ </div>
+
+ <div v-if="currentDeviceDataForm == null">
+ <div>妯″紡: {{ currentDeviceData.data.mode }}</div>
+ <div>鐘舵��: {{ currentDeviceData.data.deviceStatus }}</div>
+ <div>椤跺崌: {{ currentDeviceData.data.hasLift }}</div>
+ <div>鎵樼洏: {{ currentDeviceData.data.hasPallet }}</div>
+ <div>鍧愭爣: {{ currentDeviceData.data.currentCode }}</div>
+ <div>寮傚父: {{ currentDeviceData.data.errorCode }}</div>
+ <div>鍏呯數: {{ currentDeviceData.data.hasCharge }}</div>
+ <div>鐢甸噺: {{ currentDeviceData.data.batteryPower }}</div>
+ <div>鐢靛帇: {{ currentDeviceData.data.batteryVoltage }}</div>
+ <div>杩愯鏂瑰悜: {{ currentDeviceData.data.runDirection }}</div>
+ <div>閫熷害: {{ currentDeviceData.data.speed }}</div>
+ </div>
+
+ <div v-else>
+ <div>妯″紡: <el-input v-model="currentDeviceDataForm.data.mode"></el-input></div>
+ <div>鐘舵��: <el-input v-model="currentDeviceDataForm.data.deviceStatus"></el-input></div>
+ <div>椤跺崌: <el-input v-model="currentDeviceDataForm.data.hasLift"></el-input></div>
+ <div>鎵樼洏: <el-input v-model="currentDeviceDataForm.data.hasPallet"></el-input></div>
+ <div>鍧愭爣: <el-input v-model="currentDeviceDataForm.data.currentCode"></el-input></div>
+ <div>寮傚父: <el-input v-model="currentDeviceDataForm.data.errorCode"></el-input></div>
+ <div>鍏呯數: <el-input v-model="currentDeviceDataForm.data.hasCharge"></el-input></div>
+ <div>鐢甸噺: <el-input v-model="currentDeviceDataForm.data.batteryPower"></el-input></div>
+ <div>鐢靛帇: <el-input v-model="currentDeviceDataForm.data.batteryVoltage"></el-input></div>
+ <div>杩愯鏂瑰悜: <el-input v-model="currentDeviceDataForm.data.runDirection"></el-input></div>
+ <div>閫熷害: <el-input v-model="currentDeviceDataForm.data.speed"></el-input></div>
+ </div>
+
+ <div>
+ 鍘熷鏁版嵁锛�
+ {{ currentDeviceData }}
+ </div>
+ </el-card>
+ </div>
+ </div>
+ </el-card>
+ </div>
+
+ <el-dialog title="娣诲姞妯℃嫙璁惧" :visible.sync="addDeviceVisible">
+ <el-form :model="addDeviceParam">
+ <el-form-item label="璁惧缂栧彿" :label-width="formLabelWidth">
+ <el-input v-model="addDeviceParam.deviceNo"></el-input>
+ </el-form-item>
+ <el-form-item label="IP" :label-width="formLabelWidth">
+ <el-input v-model="addDeviceParam.ip"></el-input>
+ </el-form-item>
+ <el-form-item label="绔彛" :label-width="formLabelWidth">
+ <el-input v-model="addDeviceParam.port"></el-input>
+ </el-form-item>
+ <el-form-item label="瀹炵幇绫�" :label-width="formLabelWidth">
+ <el-input v-model="addDeviceParam.threadImpl"></el-input>
+ </el-form-item>
+ <el-form-item label="璁惧绫诲瀷" :label-width="formLabelWidth">
+ <el-input v-model="addDeviceParam.deviceType"></el-input>
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="addDeviceVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="addDevice">纭� 瀹�</el-button>
+ </div>
+ </el-dialog>
+
</div>
-<!-- 涓讳綋鍐呭 -->
-<iframe id="content" src="console.html"></iframe>
-<!-- 灏鹃儴 -->
-<footer class="footer">
- Copyright 漏 2015~2023 All Rights Reserved. 娴欐睙涓壃绔嬪簱鎶�鏈湁闄愬叕鍙� 淇濈暀鎵�鏈夋潈鍒�
-</footer>
-</body>
<script>
- // 瀵艰埅鏍�
- function nav(id) {
- $('.nav-select').attr("class", "nav-unselect");
- $('#'+id).attr("class", "nav-select");
- $('#content').attr("src", id+".html");
- }
+ var app = new Vue({
+ el: '#app',
+ data: {
+ addDeviceVisible: false,
+ addDeviceParam: {
+ deviceNo: '',
+ ip: '',
+ port: '',
+ threadImpl: '',
+ deviceType: ''
+ },
+ systemInfo: {
+ gatewayId: 0,
+ gatewayPort: 0
+ },
+ formLabelWidth: '120px',
+ deviceList: [],
+ currentDeviceConfig: null,
+ currentDeviceData: null,
+ currentDeviceDataForm: null
+ },
+ created() {
+ this.init()
+ },
+ methods: {
+ init() {
+ this.getSystemInfo();
- // 绯荤粺杩愯鐘舵��
- var systemRunning = true;
-
- // news by http://chuange.gitee.io/vue-layx/
- news();layx.min('wcs-news');
- function news() {
- layx.iframe(
- 'wcs-news' // id
- , '绯荤粺鍒嗘瀽鎶ュ憡'
- , "news.html"
- , {
- shadow:false
- , storeStatus:false
- // , skin: 'news'
- , width:800
- , height:600
- , position:'rb'
- // , control:false
- , opacity:0.9
- , border:false
- , icon:'<img src="../static/images/favicon.ico" style="height:22px;display:block;" alt=""/>'
- , stickMenu:true
- , maxMenu:false
- , closeMenu:false
- , moveLimit:{
- leftOut: false,
- rightOut: false,
- topOut: false,
- bottomOut: false,
- }
- , minWidth:300
- , minHeight:300
- , borderRadius: '8px'
- , shadeDestroy:true
- , escKey: false
- , event:{
- onmin: {
- after: function () {
- $('.layx-min-statu').css("left", "inherit").css("right", "10px")
+ setInterval(() => {
+ this.getDeviceList()
+ this.getFakeThreadStatus()
+ }, 1000);
+ },
+ getSystemInfo() {
+ let that = this;
+ $.ajax({
+ url: baseUrl + "/open/getSystemInfo",
+ headers: {
+ 'token': localStorage.getItem('token')
+ },
+ data: {},
+ dataType: 'json',
+ contentType: 'application/json;charset=UTF-8',
+ method: 'GET',
+ success: function(res) {
+ if (res.code == 200) {
+ let data = res.data;
+ that.systemInfo = data
+ } else {
+ that.$message({
+ message: res.msg,
+ type: 'error'
+ });
}
}
- , onrestore:{
- after: function () {
- let win = layx.getFrameContext('wcs-news');
- win.autoScroll = true
+ });
+ },
+ setCurrentDeviceConfig(deviceConfig) {
+ this.currentDeviceConfig = deviceConfig
+ this.currentDeviceDataForm = null;
+ },
+ updateCurrentDeviceStatus(currentDeviceData) {
+ if (this.currentDeviceDataForm == null) {
+ this.currentDeviceDataForm = currentDeviceData;
+ }else {
+ this.currentDeviceDataForm = null;
+ }
+ },
+ submitUpdateCurrentDeviceStatus(currentDeviceDataForm) {
+ let that = this;
+ $.ajax({
+ url: baseUrl + "/open/updateFakeThreadStatus",
+ headers: {
+ 'token': localStorage.getItem('token')
+ },
+ data: JSON.stringify({
+ deviceType: currentDeviceDataForm.deviceType,
+ deviceNo: currentDeviceDataForm.deviceNo,
+ data: JSON.stringify(currentDeviceDataForm.data)
+ }),
+ dataType: 'json',
+ contentType: 'application/json;charset=UTF-8',
+ method: 'POST',
+ success: function (res) {
+ if (res.code == 200) {
+ that.currentDeviceDataForm = null;
+ that.$message({
+ message: res.msg,
+ type: 'success'
+ });
+ } else {
+ that.$message({
+ message: res.msg,
+ type: 'error'
+ });
}
}
+ });
+ },
+ getFakeThreadStatus() {
+ let that = this;
+ if (this.currentDeviceConfig == null) {
+ return;
}
+
+ $.ajax({
+ url: baseUrl + "/open/getFakeThreadStatus",
+ headers: {
+ 'token': localStorage.getItem('token')
+ },
+ data: JSON.stringify({
+ deviceType: this.currentDeviceConfig.deviceType,
+ deviceNo: this.currentDeviceConfig.deviceNo
+ }),
+ dataType: 'json',
+ contentType: 'application/json;charset=UTF-8',
+ method: 'POST',
+ success: function (res) {
+ if (res.code == 200) {
+ let data = res.data;
+ let result = {
+ deviceType: that.currentDeviceConfig.deviceType,
+ deviceNo: that.currentDeviceConfig.deviceNo,
+ data: data
+ }
+
+ that.currentDeviceData = result
+ } else {
+ that.currentDeviceConfig = null;
+ that.$message({
+ message: res.msg,
+ type: 'error'
+ });
+ }
+ }
+ });
+ },
+ addDevice() {
+ //娣诲姞璁惧
+ let that = this;
+ $.ajax({
+ url: baseUrl + "/open/addFakeDevice",
+ headers: {
+ 'token': localStorage.getItem('token')
+ },
+ data: JSON.stringify(this.addDeviceParam),
+ dataType: 'json',
+ contentType: 'application/json;charset=UTF-8',
+ method: 'POST',
+ success: function(res) {
+ if (res.code == 200) {
+ console.log(res)
+ } else {
+ that.$message({
+ message: res.msg,
+ type: 'error'
+ });
+ }
+ }
+ });
+ },
+ getDeviceList() {
+ let that = this;
+ $.ajax({
+ url: baseUrl + "/open/getDeviceList",
+ headers: {
+ 'token': localStorage.getItem('token')
+ },
+ data: {},
+ dataType: 'json',
+ contentType: 'application/json;charset=UTF-8',
+ method: 'GET',
+ success: function(res) {
+ if (res.code == 200) {
+ let data = res.data;
+ that.deviceList = data
+ } else {
+ that.$message({
+ message: res.msg,
+ type: 'error'
+ });
+ }
+ }
+ });
+ },
+ delDevice(config) {
+ let that = this;
+ $.ajax({
+ url: baseUrl + "/open/deleteFakeDevice",
+ headers: {
+ 'token': localStorage.getItem('token')
+ },
+ data: JSON.stringify({
+ deviceNo: config.deviceNo,
+ deviceType: config.deviceType
+ }),
+ dataType: 'json',
+ contentType: 'application/json;charset=UTF-8',
+ method: 'POST',
+ success: function(res) {
+ if (res.code == 200) {
+ let data = res.data;
+ that.deviceList = data
+ } else {
+ that.$message({
+ message: res.msg,
+ type: 'error'
+ });
+ }
+ }
+ });
}
- );
- }
-
+ },
+ })
</script>
+</body>
+
</html>
--
Gitblit v1.9.1