From 7870c2d4fd6da5269a87f53d584a36628fd8ef12 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 05 九月 2023 16:56:58 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.150:10101/r/CanadaMes
---
CanadaMes-ui/src/utils/request.js | 19
CanadaMes-ui/src/views/Electrical/State.vue | 86 ++
springboot-vue3/.idea/libraries/Maven__com_github_xingshuangs_iot_communication_1_4_2.xml | 13
CanadaMes-ui/src/views/Electrical/Parameter.vue | 215 +++++--
CanadaMes-ui/src/views/user/index.vue | 61 +
springboot-vue3/springboot-vue3.iml | 4
CanadaMes-ui/src/layout/index.vue | 122 +++-
springboot-vue3/src/main/java/com/example/springboot/security/constant/SystemConstant.java | 3
CanadaMes-ui/package.json | 3
springboot-vue3/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_2_3_2_RELEASE.xml | 13
CanadaMes-ui/src/views/device/alarm.vue | 71 +-
springboot-vue3/pom.xml | 4
CanadaMes-ui/src/views/Electrical/Action.vue | 131 ++++
CanadaMes-ui/src/main.js | 4
CanadaMes-ui/package-lock.json | 17
CanadaMes-ui/src/views/device/talkvue.vue | 23
springboot-vue3/src/main/java/com/example/springboot/entity/vo/Result.java | 1
springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java | 73 ++
CanadaMes-ui/src/views/role/index.vue | 78 +-
CanadaMes-ui/src/views/Electrical/Sign.vue | 111 +++
CanadaMes-ui/src/store/index.js | 14
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java | 15
springboot-vue3/.idea/libraries/Maven__org_springframework_spring_messaging_5_2_8_RELEASE.xml | 13
springboot-vue3/.idea/libraries/Maven__org_springframework_spring_websocket_5_2_8_RELEASE.xml | 13
CanadaMes-ui/src/views/power/index.vue | 4
CanadaMes-ui/src/layout/tag.vue | 138 ++---
CanadaMes-ui/src/lang/locales/zh-CN.json | 42 +
/dev/null | 77 ---
springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java | 24
springboot-vue3/src/main/java/com/example/springboot/controller/UserController.java | 2
CanadaMes-ui/src/store/module/tags.js | 22
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java | 10
CanadaMes-ui/src/views/login/index.vue | 5
CanadaMes-ui/src/lang/locales/en-US.json | 35 +
springboot-vue3/src/main/java/com/example/springboot/controller/DefaultController.java | 3
35 files changed, 1,019 insertions(+), 450 deletions(-)
diff --git a/CanadaMes-ui/package-lock.json b/CanadaMes-ui/package-lock.json
index 12e4be0..f0dcccf 100644
--- a/CanadaMes-ui/package-lock.json
+++ b/CanadaMes-ui/package-lock.json
@@ -16,7 +16,8 @@
"less-loader": "^6.2.0",
"vue": "^2.6.11",
"vue-i18n": "^8.26.5",
- "vue-router": "^3.3.4"
+ "vue-router": "^3.3.4",
+ "vuex": "^3.6.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
@@ -13243,6 +13244,14 @@
"integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=",
"dev": true
},
+ "node_modules/vuex": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmmirror.com/vuex/-/vuex-3.6.2.tgz",
+ "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==",
+ "peerDependencies": {
+ "vue": "^2.0.0"
+ }
+ },
"node_modules/watchpack": {
"version": "1.7.5",
"resolved": "https://registry.npm.taobao.org/watchpack/download/watchpack-1.7.5.tgz",
@@ -25281,6 +25290,12 @@
"integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=",
"dev": true
},
+ "vuex": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmmirror.com/vuex/-/vuex-3.6.2.tgz",
+ "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==",
+ "requires": {}
+ },
"watchpack": {
"version": "1.7.5",
"resolved": "https://registry.npm.taobao.org/watchpack/download/watchpack-1.7.5.tgz",
diff --git a/CanadaMes-ui/package.json b/CanadaMes-ui/package.json
index 4f0351c..276a358 100644
--- a/CanadaMes-ui/package.json
+++ b/CanadaMes-ui/package.json
@@ -16,7 +16,8 @@
"less-loader": "^6.2.0",
"vue": "^2.6.11",
"vue-i18n": "^8.26.5",
- "vue-router": "^3.3.4"
+ "vue-router": "^3.3.4",
+ "vuex": "^3.6.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index 3f06531..3ae9217 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -36,5 +36,38 @@
"northglassMESsystem":"NorthGlassMesSystem",
"exit":"exit",
"changePassword":"changePassword",
- "resetPassword": "resetPassword"
+ "resetPassword": "resetPassword",
+ "home":"Home",
+ "role":"role",
+ "langRoleManagement": "Role Management",
+ "langRoleList": "Role List",
+ "langEnterRoleName": "Please enter role name",
+ "langAddRole": "Add Role",
+ "langName": "Name",
+ "langIsValid": "Is Valid",
+ "langOperation": "Operation",
+ "langPleaseSelect": "Please select",
+ "langValid": "Valid",
+ "langInvalid": "Invalid",
+ "langAddRoleSuccess": "Add role successfully",
+ "langEnterName": "Please enter name",
+ "langLengthBetween": "Length should be between",
+ "langAnd": "and",
+ "langCharacters": "characters",
+ "langEnterState": "Please enter state",
+ "langUpdateState": "Update state successfully",
+ "langEditRole": "Edit Role",
+ "langEditRoleSuccess": "Edit role successfully",
+ "langDeleteRoleConfirm": "Are you sure you want to delete this role?",
+ "langPrompt": "Prompt",
+ "langDeleteRoleSuccess": "Delete role successfully",
+ "langCancelDelete": "Cancelled deleting",
+ "langRoleName":"langRoleName",
+ "updateSuccessMessage":"updateSuccessMessage",
+ "paginationTotal": "Total {total}",
+ "paginationSizes": "Items per page",
+ "paginationPrev": "Previous",
+ "paginationPager": "{currentPage}/{pageCount}",
+ "paginationNext": "Next",
+ "paginationJumper": "Jump to"
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/lang/locales/zh-CN.json b/CanadaMes-ui/src/lang/locales/zh-CN.json
index 0f358a8..be273d6 100644
--- a/CanadaMes-ui/src/lang/locales/zh-CN.json
+++ b/CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -31,11 +31,47 @@
"langPassword": "瀵嗙爜",
"langState": "鐘舵��",
"langSelect": "璇烽�夋嫨",
- "langCancel": "鍙栨秷",
- "langConfirm": "纭畾",
+
+
"langEditUserTitle": "淇敼鐢ㄦ埛",
"northglassMESsystem":"鍖楃幓MES绯荤粺",
"exit":"閫�鍑�",
- "changePassword":"淇敼瀵嗙爜"
+ "changePassword":"淇敼瀵嗙爜",
+ "resetPassword": "閲嶇疆瀵嗙爜",
+ "home":"涓婚〉",
+ "role":"瑙掕壊",
+ "langRoleManagement": "瑙掕壊绠$悊",
+ "langRoleList": "瑙掕壊鍒楄〃",
+ "langEnterRoleName": "璇疯緭鍏ヨ鑹插悕绉�",
+ "langAddRole": "娣诲姞瑙掕壊",
+ "langName": "鍚嶇О",
+ "langIsValid": "鏄惁鏈夋晥",
+ "langOperation": "鎿嶄綔",
+ "langPleaseSelect": "璇烽�夋嫨",
+ "langValid": "鏈夋晥",
+ "langInvalid": "鏃犳晥",
+ "langConfirm": "纭畾",
+ "langCancel": "鍙栨秷",
+ "langAddRoleSuccess": "娣诲姞瑙掕壊鎴愬姛",
+ "langEnterName": "璇疯緭鍏ュ悕绉�",
+ "langLengthBetween": "闀垮害鍦�",
+ "langAnd": "鍜�",
+ "langCharacters": "涓瓧绗︿箣闂�",
+ "langEnterState": "璇疯緭鍏ョ姸鎬�",
+ "langUpdateState": "鐘舵�佹洿鏂版垚鍔�",
+ "langEditRole": "缂栬緫瑙掕壊",
+ "langEditRoleSuccess": "缂栬緫瑙掕壊鎴愬姛",
+ "langDeleteRoleConfirm": "纭畾瑕佸垹闄よ瑙掕壊鍚楋紵",
+ "langPrompt": "鎻愮ず",
+ "langDeleteRoleSuccess": "鍒犻櫎瑙掕壊鎴愬姛",
+ "langCancelDelete": "宸插彇娑堝垹闄�",
+ "langRoleName":"瑙掕壊鍚嶇О",
+ "updateSuccessMessage":"鏇存柊鎴愬姛",
+ "paginationTotal": "鍏� {total} 鏉�",
+ "paginationSizes": "姣忛〉鏄剧ず",
+ "paginationPrev": "涓婁竴椤�",
+ "paginationPager": "{currentPage}/{pageCount}",
+ "paginationNext": "涓嬩竴椤�",
+ "paginationJumper": "璺宠嚦"
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index 1ce7f0f..f886453 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -5,16 +5,25 @@
<el-aside :width="isCollapse?'70px':'250px'">
<el-col :gutter="20">
<el-row :span="4">
- <div class="logo">
- <div class="sys-name" v-show="!isCollapse">{{ $t('northglassMESsystem') }}</div>
- </div>
+ <div class="logo" @click="goToHome">
+ <div class="sys-name" v-show="!isCollapse">{{ $t('northglassMESsystem') }}</div>
+</div>
</el-row>
<el-row :span="20">
<el-menu :default-active="activePath" class="el-menu-vertical-demo"
background-color="#222f3e" text-color="#fff" active-text-color="#ffd04b"
:collapse="isCollapse" :unique-opened="true"
:collapse-transition="false" :router="true">
- <!--涓�绾ц彍鍗�-->
+ <el-menu-item index="/" @click="goToHome">
+ <template slot="title">
+ <!--鍥炬爣-->
+ <i class="el-icon-menu"></i>
+ <!--鏂囨湰-->
+ <span>{{ $t('home') }}</span>
+ </template>
+</el-menu-item>
+
+ <!--涓�绾ц彍鍗�-->
<el-submenu :index="item.id.toString()" v-for="item in menuList" :key="item.id">
<!--涓�绾ц彍鍗曟ā鏉垮尯鍩�-->
<template slot="title">
@@ -26,7 +35,7 @@
<!--浜岀骇鑿滃崟-->
<el-menu-item :index="'/'+menu.router"
v-for="menu in item.menuLists" :key="menu.id"
- @click="saveNavState('/'+menu.router)">
+ @click="saveNavState('/'+menu.router)" @select="saveNavState" :default-active="$route.path">
<template slot="title">
<!--鍥炬爣-->
<i :class="menu.icon"></i>
@@ -34,36 +43,41 @@
<span>{{ menu.name }}</span>
</template>
</el-menu-item>
+
</el-submenu>
+
</el-menu>
</el-row>
</el-col>
</el-aside>
</div>
- <el-container>
+ <el-container >
- <el-header class="header-container">
- <!-- <div class="tagContainer">
- <tag></tag>
-
- </div> -->
+ <el-header class="header-container" >
+
+
+ <div class="tagContainer" >
+ <tag v-for="(tag, index) in tags" :key="index" :tag="tag" @removeTag="removeTag"></tag>
+ </div>
<el-menu :default-active="activePath1" class="el-menu-demo" mode="horizontal"
background-color="#576574" text-color="#fff" active-text-color="#ffd04b">
- <div class="header-left">
- <el-button :icon="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'" @click="toggleCollapse"></el-button>
+ <div class="header-left" >
+ <el-button :icon="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'" @click="toggleCollapse" style="height:30px"></el-button>
</div>
- <el-submenu index="1" class="user-icon">
+ <template >
+ <el-submenu index="1" class="custom-submenu" >
- <template slot="title">
- <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png">
+ <template slot="title">
+ <el-avatar src="../assets/emi.png" style="width:30px;height:30px;margin-top:2px;">
</el-avatar>
- </template>
- <el-menu-item index="1-1" @click="logout">{{ $t('exit') }}</el-menu-item>
- <el-menu-item index="1-2" @click="showChangePasswordDialog">{{ $t('changePassword') }}</el-menu-item>
+ </template>
+ <el-menu-item index="1-1" @click="logout" >{{ $t('exit') }}</el-menu-item>
+ <el-menu-item index="1-2" @click="showChangePasswordDialog" >{{ $t('changePassword') }}</el-menu-item>
</el-submenu>
+ </template>
<template>
- <el-dialog title="淇敼瀵嗙爜" :visible.sync="dialogVisible" width="30%">
- <el-form ref="form" :model="formData" label-width="100px">
+ <el-dialog title="淇敼瀵嗙爜" :visible.sync="dialogVisible" width="30%" s>
+ <el-form ref="form" :model="formData" label-width="100px" >
<el-form-item label="鏃у瘑鐮�">
<el-input v-model="formData.oldPassword" type="password" show-password></el-input>
</el-form-item>
@@ -96,13 +110,18 @@
import {changePassword} from '../api/user'
import {removeToken} from "../utils/auth";
import LanguageMixin from '../lang/LanguageMixin'
-// import Tag from '../layout/tag.vue';
+import { mapState, mapMutations } from 'vuex';
+ import Tag from '../layout/tag.vue';
+ import store from '../store';
export default {
name: "Layout",
+ store,
mixins: [LanguageMixin],
data() {
return {
+
+ activeTag: '', // 褰撳墠婵�娲荤殑鏍囩
dialogVisible: false,
formData: {
oldPassword: '',
@@ -120,9 +139,9 @@
}
}
},
- // components: {
- // Tag
- // },
+ components: {
+ Tag
+ },
created() {
selectList(this.menuListForm).then(res => {
this.menuList = res.data
@@ -135,12 +154,36 @@
this.activePath = window.sessionStorage.getItem('activePath')
});
},
+ computed: {
+ ...mapState('tags', ['tags'])
+ },
methods: {
logout: function () {
removeToken()
this.$router.push('/login')
},
+ goToHome() {
+ this.$router.push('/home');
+ },
+ // 浣跨敤 mapMutations 杈呭姪鍑芥暟璋冪敤 Store 涓殑 mutations
+ ...mapMutations('tags', ['addTag', 'removeTag']),
+ // 鍒囨崲鏍囩鏃惰Е鍙戠殑鏂规硶
+ saveNavState(activePath) {
+ window.sessionStorage.setItem('activePath', activePath);
+ const menuItem = this.menuList.find(item => item.menuLists.some(menu => menu.router === activePath));
+ if (menuItem) {
+ const submenuItem = menuItem.menuLists.find(menu => menu.router === activePath);
+ if (submenuItem) {
+ const tag = submenuItem.name;
+ this.$store.commit('tags/addTag', tag); // 璋冪敤 Vuex Store 涓殑 addTag mutation
+ }
+ }
+ },
+ // 鍏抽棴鏍囩鏃惰Е鍙戠殑鏂规硶
+ removeTag(tag) {
+ this.removeTag(tag); // 浠� Vuex Store 涓Щ闄ゆ爣绛�
+ },
showChangePasswordDialog() {
@@ -173,9 +216,9 @@
toggleCollapse: function () {
this.isCollapse = !this.isCollapse;
},
- saveNavState: function (activePath) {
- window.sessionStorage.setItem('activePath', activePath)
- },
+ // saveNavState: function (activePath) {
+ // window.sessionStorage.setItem('activePath', activePath)
+ // },
replaceChineseWithEnglish(menuData) {
// 瀹氫箟涓嫳鏂囧鐓у叧绯诲璞�
const translation = {
@@ -209,13 +252,28 @@
</script>
<style scoped lang="less">
-.header-container {
- display: flex;
- justify-content: flex-start;
+// .header-container {
+// display: flex;
+// justify-content: flex-start;
+// height: 10px; /* 璁剧疆杈冨皬鐨勯珮搴� */
+// }
+
+.custom-submenu {
+
+
+ height: 90px !important;
}
+
+.header-container {
+
+ height: 30px !important; /* 璁剧疆杈冨皬鐨勯珮搴� */
+ }
+
+
.header-left {
margin-right: auto;
+
}
.el-aside {
height: 100vh;
@@ -256,7 +314,7 @@
}
.el-header {
- padding: 0;
+
background-color: #576574;
}
</style>
diff --git a/CanadaMes-ui/src/layout/tag.vue b/CanadaMes-ui/src/layout/tag.vue
index 246ce7c..ccf38fd 100644
--- a/CanadaMes-ui/src/layout/tag.vue
+++ b/CanadaMes-ui/src/layout/tag.vue
@@ -1,91 +1,59 @@
<template>
- <div class="_tag">
- <el-scrollbar style="margin-right: 6px;">
- <div class="left">
- <el-tag
- v-for="tag in tagsList"
- :key="tag.title"
- :closable="!tag.hideclose"
- :type="isActive(tag)"
- @close="removeTag(tag)"
- @click="handleTagClick(tag)"
- >
- <router-link :to="tag.path" class="tag-title">{{ tag.title }}</router-link>
- </el-tag>
- </div>
- </el-scrollbar>
-
- <el-dropdown @command="handleCloseBtn" class="_dropdown">
- <el-button type="primary" size="small">
- 鏍囩閫夐」
- <i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="closeOther">鍏抽棴鍏跺畠</el-dropdown-item>
- <el-dropdown-item command="closeAll">鍏抽棴鎵�鏈�</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
+ <div class="tagContainer">
+ <div v-for="(tag, index) in tags" :key="index" class="tagItem">
+ {{ tag }}
+ <span class="closeBtn" @click="removeTag(index)">x</span>
</div>
- </template>
-
- <script>
- import { mapState, mapMutations } from "vuex";
-
- export default {
- computed: {
- ...mapState("tags", ["tagsList"]),
- activeTag() {
- return this.tagsList.find(tag => tag.path === this.$route.fullPath);
- }
- },
- methods: {
- ...mapMutations("tags", ["removeTag"]),
- handleCloseBtn(command) {
- if (command === "closeOther") {
- const activeTag = this.activeTag;
- if (!activeTag || activeTag.hideclose) return;
- this.$store.commit("tags/removeOtherTags", activeTag);
- } else if (command === "closeAll") {
- this.$store.commit("tags/removeAllTags");
- this.$router.push({ name: "sadmasMain" });
- }
- },
- isActive(tag) {
- return tag.path === this.$route.fullPath ? "" : "info";
- },
- handleTagClick(tag) {
- this.$router.push(tag.path);
- }
- },
- watch: {
- $route(newValue) {
- const isExist = this.tagsList.some(item => item.path === newValue.fullPath);
- if (!isExist) {
- this.$store.commit("tags/addTag", {
- title: newValue.meta.title || "",
- path: newValue.fullPath,
- hideclose: newValue.meta.hideclose || false
- });
- }
+ </div>
+</template>
+
+<script>
+import { mapState, mapMutations } from 'vuex';
+
+export default {
+ computed: {
+ ...mapState('tags', { // 杩欓噷娣诲姞浜� 'tags' 妯″潡鐨勫懡鍚嶇┖闂村墠缂�
+ tags: state => state.tags.tags
+ })
+ },
+ methods: {
+ ...mapMutations('tag', ['removeTag']),
+ saveNavState(activePath) {
+ window.sessionStorage.setItem('activePath', activePath);
+
+ const menuItem = this.menuList.find(item => item.menuLists.some(menu => menu.router === activePath));
+ if (menuItem) {
+ const submenuItem = menuItem.menuLists.find(menu => menu.router === activePath);
+ if (submenuItem) {
+ const tag = submenuItem.name;
+ this.addTag(tag); // 娣诲姞鏍囩鍒� Vuex Store
}
}
- };
- </script>
-
- <style scoped>
- ._tag {
- display: flex;
- align-items: center;
- padding: 10px;
}
-
- .left {
- display: flex;
- flex-wrap: wrap;
}
-
- .tag-title {
- cursor: pointer;
- }
- </style>
-
\ No newline at end of file
+}
+</script>
+
+<style scoped>
+.tagContainer {
+ display: flex;
+ flex-wrap: wrap;
+ margin-bottom: 10px;
+}
+
+.tagItem {
+ background-color: #eee;
+ border-radius: 4px;
+ padding: 4px 8px;
+ margin-right: 8px;
+ margin-bottom: 8px;
+ display: flex;
+ align-items: center;
+}
+
+.closeBtn {
+ margin-left: 4px;
+ color: red;
+ cursor: pointer;
+}
+</style>
diff --git a/CanadaMes-ui/src/main.js b/CanadaMes-ui/src/main.js
index 0bb44ef..11d1158 100644
--- a/CanadaMes-ui/src/main.js
+++ b/CanadaMes-ui/src/main.js
@@ -8,12 +8,13 @@
import VueI18n from 'vue-i18n'
import zhCN from './lang/locales/zh-CN.json' // 涓枃璇█鍖�
import enUS from './lang/locales/en-US.json' // 鑻辨枃璇█鍖�
+import store from './store'
// import store from './store'
Vue.use(VueI18n)
const i18n = new VueI18n({
- locale: 'zh-CN', // 璁剧疆榛樿璇█涓轰腑鏂�
+ locale: 'en-US',
messages: {
'zh-CN': zhCN, // 娉ㄥ唽涓枃璇█鍖�
'en-US': enUS // 娉ㄥ唽鑻辨枃璇█鍖�
@@ -34,6 +35,7 @@
new Vue({
router,
i18n,
+ store,
render: h => h(App)
}).$mount('#app');
diff --git a/CanadaMes-ui/src/store/index.js b/CanadaMes-ui/src/store/index.js
new file mode 100644
index 0000000..150cead
--- /dev/null
+++ b/CanadaMes-ui/src/store/index.js
@@ -0,0 +1,14 @@
+// src/store/index.js
+
+import Vue from 'vue';
+import Vuex from 'vuex';
+import tags from './module/tags';
+
+Vue.use(Vuex);
+
+export default new Vuex.Store({
+ modules: {
+ tags,
+ },
+ // 鍏朵粬閰嶇疆
+});
diff --git a/CanadaMes-ui/src/store/module/tags.js b/CanadaMes-ui/src/store/module/tags.js
new file mode 100644
index 0000000..3e3b974
--- /dev/null
+++ b/CanadaMes-ui/src/store/module/tags.js
@@ -0,0 +1,22 @@
+const state = {
+ tags: []
+};
+
+const mutations = {
+ addTag(state, tag) {
+ if (!state.tags.includes(tag)) {
+ state.tags.push(tag);
+ }
+ },
+ removeTag(state, tag) {
+ const index = state.tags.indexOf(tag);
+ if (index !== -1) {
+ state.tags.splice(index, 1);
+ }
+ }
+};
+
+export default {
+ state,
+ mutations
+};
\ No newline at end of file
diff --git a/CanadaMes-ui/src/store/store,js b/CanadaMes-ui/src/store/store,js
deleted file mode 100644
index b2d2afd..0000000
--- a/CanadaMes-ui/src/store/store,js
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-import Vue from 'vue';
-import Vuex from 'vuex';
-
-Vue.use(Vuex);
-
-const store = new Vuex.Store({
- state: {
- // 鍏朵粬妯″潡鐨勭姸鎬�...
- },
- mutations: {
- // 鍏朵粬妯″潡鐨刴utations...
- },
- actions: {
- // 鍏朵粬妯″潡鐨刟ctions...
- },
- modules: {
- tag: {
- namespaced: true,
- state: {
- tags: [], // 鏍囩鍒楄〃
- selectedTag: null // 閫変腑鐨勬爣绛�
- },
- mutations: {
- SET_TAGS(state, tags) {
- state.tags = tags;
- },
- ADD_TAG(state, tag) {
- state.tags.push(tag);
- },
- REMOVE_TAG(state, tag) {
- state.tags = state.tags.filter(t => t !== tag);
- },
- CLEAR_TAGS(state) {
- state.tags = [];
- },
- SET_SELECTED_TAG(state, tag) {
- state.selectedTag = tag;
- },
- CLEAR_SELECTED_TAG(state) {
- state.selectedTag = null;
- }
- },
- actions: {
- setTags({ commit }, tags) {
- commit('SET_TAGS', tags);
- },
- addTag({ commit }, tag) {
- commit('ADD_TAG', tag);
- },
- removeTag({ commit }, tag) {
- commit('REMOVE_TAG', tag);
- },
- clearTags({ commit }) {
- commit('CLEAR_TAGS');
- },
- setSelectedTag({ commit }, tag) {
- commit('SET_SELECTED_TAG', tag);
- },
- clearSelectedTag({ commit }) {
- commit('CLEAR_SELECTED_TAG');
- }
- },
- getters: {
- getTags(state) {
- return state.tags;
- },
- getSelectedTag(state) {
- return state.selectedTag;
- }
- }
- }
- }
-});
-
-export default store;
diff --git a/CanadaMes-ui/src/utils/request.js b/CanadaMes-ui/src/utils/request.js
index 65218d5..c5b5a25 100644
--- a/CanadaMes-ui/src/utils/request.js
+++ b/CanadaMes-ui/src/utils/request.js
@@ -1,5 +1,5 @@
import axios from 'axios'
-import {Message} from 'element-ui'
+import { Message } from 'element-ui'
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API,
@@ -9,16 +9,29 @@
service.interceptors.response.use(
response => {
const res = response.data
- if (res.code !== 1 && res.code !== "200") {
+ if (res.code !== 1 && res.code !== "200" ) {
Message({
message: res.msg || 'Error',
type: 'error',
duration: 5 * 1000
})
- return Promise.reject(new Error(res.msg || 'Error'))
+ if (res == 403) {
+ window.location.href = '/login'
+ }else{
+
+ return Promise.reject(new Error(res.msg || 'Error')
+ )
+ }
+
+
+
} else {
return res
+
}
+
+
+
},
error => {
console.log('err' + error)
diff --git a/CanadaMes-ui/src/views/Electrical/Action.vue b/CanadaMes-ui/src/views/Electrical/Action.vue
index 2218ad7..8c429b9 100644
--- a/CanadaMes-ui/src/views/Electrical/Action.vue
+++ b/CanadaMes-ui/src/views/Electrical/Action.vue
@@ -2,38 +2,131 @@
<div class="app">
<!--闈㈠寘灞戝鑸尯鍩�-->
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <el-breadcrumb-item :to="{ path: '/home' }">{{ $t('langHome') }}</el-breadcrumb-item>
- <el-breadcrumb-item>璁惧绠$悊</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Parameter' }">鍙傛暟</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Action' }">寮�鍏虫帶鍒�</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Sign' }">IO鐘舵��</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/State' }">鎶ヨ淇℃伅</el-breadcrumb-item>
+ <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
+ <el-button type="text">璁惧绠$悊</el-button>
+ <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link>
+ <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
+ <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
+ <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
</el-breadcrumb>
- <div>寮�鍏虫帶鍒�</div>
+ <div>Action</div>
+ <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ records }">
+ <div class="kuai_sb" v-for="item in records" :key="item.id">
+ <el-input v-model="item.mingcheng" style="width: 280px;" class="in_mc"></el-input>
+ <!-- <el-input v-model="item.zhuangtai" style="width: 80px;"></el-input> -->
+ <el-switch v-model="item.zhuangtai" active-color="#13ce66" active-value="1" inactive-value="2"></el-switch>
+ </div>
+
+
+ <div class="kuai_div">
+ <el-input style="width: 280px;" class="in_mc" value="conveyor Velocity(Auto SLOW)"></el-input>
+ <el-input v-for="(param, index) in record.params[0]" :key="index" v-model="record.params[0][index]" style="width: 80px;"></el-input>
+</div>
+<button @click="send()">娴嬭瘯鍙戦��</button>
+ </el-form>
+
+
</div>
</template>
-<script>
-
-
+<script >
+let socket;
export default {
name: "Action",
+ data () {
+ return {
+ records: [
+ { id: 1, mingcheng: 'conveyor Velocity(Auto SLOW)', zhuangtai: "1" },
+ { id: 2, mingcheng: 'B01 B02 TRAVEL POS Velocity AUTO', zhuangtai: "2" },
+ { id: 3, mingcheng: 'B01 B02 TRAVEL JOG Velocity', zhuangtai: "2" },
+ { id: 4, mingcheng: 'conveyor Velocity(Manual)', zhuangtai: "1" }
+ ],
+ messagepack: {
+ data: { taskname: "" }
+ },
+
+ record: {
+ params: [0,0,0,0,0,0]
+ },
+
+ }
+ },
+ created () {
+ this.init();
+ //console.log(this.records);
+ },
+ methods: {
+ init () {
+ let viewname = "talkvue";
+
+ if (typeof (WebSocket) == "undefined") {
+ console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
+ } else {
+ //console.log("鎮ㄧ殑娴忚鍣ㄦ敮鎸乄ebSocket");
+
+ let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+ // 寮�鍚竴涓獁ebsocket鏈嶅姟
+ socket = new WebSocket(socketUrl);
+ //鎵撳紑浜嬩欢
+ socket.onopen = function () {
+ console.log("websocket宸叉墦寮�");
+ };
+ // 娴忚鍣ㄧ鏀舵秷鎭紝鑾峰緱浠庢湇鍔$鍙戦�佽繃鏉ョ殑鏂囨湰娑堟伅
+ socket.onmessage = function (msg) {
+ console.log("鏀跺埌鏁版嵁====" + msg.data);
+ let obj = JSON.parse(msg.data);
+ this.$set(this.record.params, 0, obj.params[0]);
+ console.log( this.record.params[0])
+}.bind(this);
+ //鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+ //鍙戠敓浜嗛敊璇簨浠�
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ }
+ }
+ },
+ send () {
+ this.messagepack.data = { taskname: "鍓嶇鍒板悗鍙�" };
+ socket?.send(JSON.stringify(this.messagepack)); // 灏嗙粍瑁呭ソ鐨刯son鍙戦�佺粰鏈嶅姟绔紝鐢辨湇鍔$杩涜杞彂
+ }
+
+ }
}
+
+
+
+
</script>
-<style lang="less" scoped>
-.el-table {
- margin-top: 15px;
- font-size: 12px;
+<style>
+.kuai_sb {
+ width: 30%;
+ margin-bottom: 15px;
}
-.el-pagination {
- margin-top: 15px;
+.el-input {
+ border: none;
+
+
+ .el-input__inner {
+ border: 1 solid black;
+ }
+
+
}
-.app .el-card {
- width: 99%;
+.in_mc {
+ .el-input__inner {
+ border: none;
+ }
}
-</style>
+</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter.vue b/CanadaMes-ui/src/views/Electrical/Parameter.vue
index e54c476..49a02c8 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -1,81 +1,152 @@
<template>
<div class="app">
- <!--闈㈠寘灞戝鑸尯鍩�-->
- <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <el-breadcrumb-item :to="{ path: '/home' }">{{ $t('langHome') }}</el-breadcrumb-item>
- <el-breadcrumb-item>璁惧绠$悊</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Parameter' }">鍙傛暟</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Action' }">寮�鍏虫帶鍒�</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Sign' }">IO鐘舵��</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/State' }">鎶ヨ淇℃伅</el-breadcrumb-item>
- </el-breadcrumb>
- <div>鍙傛暟</div>
- <el-row :gutter="40" style="display: flex;flex-wrap: wrap;">
- <el-col :span="7">
- <div class="grid-content bg-purple">
- <el-input prop="sbname"></el-input>
- <el-input prop="sbdata"></el-input>
- </div>
- </el-col>
-
- </el-row>
+ <!--闈㈠寘灞戝鑸尯鍩�-->
+ <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
+ <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
+ <el-button type="text">璁惧绠$悊</el-button>
+ <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link>
+ <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
+ <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
+ <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
+ </el-breadcrumb>
+ <div>Parameter</div>
+
+ <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="messagepack.data">
+ <div id="btn_div">
+ <el-button type="primary" @click="send()">涓嬪彂鍙傛暟</el-button>
+ </div>
+ <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index">
+ <el-input style="width: 280px;" class="in_mc" v-model="item.name" readonly></el-input>
+ <el-input v-model="item.value" style="width: 80px;"></el-input>
+ </div>
+ </el-form>
</div>
-</template>
-
-<script>
-
-
-export default {
+ </template>
+
+ <script>
+ let socket;
+
+ export default {
name: "Parameter",
- // data () {
- // return {
- // sbList: {
- // records: [],
- // }
- // }
- // }
-}
-
-</script>
-
-<style lang="less" scoped>
-.el-row {
- margin-bottom: 20px;
-
- &:last-child {
- margin-bottom: 0;
+ data() {
+ return {
+ record: {
+ params: [0, 0, 0, 0, 0, 0],
+ xyData: [{ name: "conveyor Velocity(Auto SLOW)", value: 0 },
+ { name: "B01 B02 TRAVEL POS Velocity AUTO", value: 0 },
+ { name: "B01 B02 TRAVEL JOG Velocity", value: 0 },
+ { name: "conveyor Velocity(Manual)", value: 0},
+ { name: "B01 B02 TRAVEL JOG Velocity", value: 0},
+ { name: "conveyor Velocity(Manual)", value: 0 }],
+ canshu: [
+ 'conveyor Velocity(Auto SLOW)',
+ 'B01 B02 TRAVEL POS Velocity AUTO',
+ 'B01 B02 TRAVEL JOG Velocity',
+ 'conveyor Velocity(Manual)',
+ 'B01 B02 TRAVEL JOG Velocity',
+ 'conveyor Velocity(Manual)'
+ ],
+ },
+ messagepack: {
+ data: { taskname: "" }
+ },
+ queryInfo: {
+ data: "1",
+ pageSize: 10
+ },
}
-}
+ },
+ created() {
+ this.initWebSocket();
+ },
+ methods: {
+ initWebSocket() {
+ let viewname = "action";
+
+ if (typeof WebSocket == "undefined") {
+ console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
+ } else {
+ //console.log("鎮ㄧ殑娴忚鍣ㄦ敮鎸乄ebSocket");
+
+ let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
+
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+
+ // 寮�鍚竴涓獁ebsocket鏈嶅姟
+ socket = new WebSocket(socketUrl);
+
+ // 鎵撳紑浜嬩欢
+ socket.onopen = function () {
+ console.log("websocket宸叉墦寮�");
+ };
+
+ // 鏀跺埌娑堟伅
+ socket.onmessage = (msg) => {
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
-.el-col {
- border-radius: 4px;
- margin: 10px;
-}
+ let obj = JSON.parse(msg.data);
+ this.record.params[0] = obj.params[0];
-.el-input {
- width: 70px;
- height: 30px;
-}
+ for (let a = 0; a <= this.record.params[0].length - 1; a++) {
+ if (!this.record.xyData[a]) {
+ this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
+ } else {
+ this.record.xyData[a].value = this.record.params[0][a];
+ }
+ }
-.bg-purple-dark {
- background: #99a9bf;
+ console.log(this.record.xyData);
+ this.$forceUpdate();
+};
+
+ // 鍏抽棴浜嬩欢
+ socket.onclose = function () {
+ console.log("websocket宸插叧闂�");
+ };
+
+ // 鍙戠敓閿欒浜嬩欢
+ socket.onerror = function () {
+ console.log("websocket鍙戠敓浜嗛敊璇�");
+ }
+ }
+ },
+ send() {
+ this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 杞崲涓烘暣鏁版暟缁�
+ console.log(this.messagepack);
+ socket?.send(JSON.stringify(this.messagepack));
}
-
-.bg-purple {
- background: #d3dce6;
-}
-
-.bg-purple-light {
- background: #e5e9f2;
-}
-
-.grid-content {
- border-radius: 4px;
- min-height: 36px;
-}
-
-.row-bg {
- padding: 10px 0;
- background-color: #f9fafc;
-}
-</style>
+ }
+ }
+ </script>
+
+ <style>
+ .kuai_div {
+ width: 30%;
+ margin-bottom: 15px;
+ }
+
+ .el-input {
+ border: none;
+ }
+
+ .el-input__inner {
+ border: 1px solid black;
+ }
+
+ .in_mc .el-input__inner {
+ border: none;
+ }
+
+ #btn_div {
+ width: 100%;
+ }
+
+ #btn_div .el-button {
+ float: right;
+ }
+ </style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/Sign.vue b/CanadaMes-ui/src/views/Electrical/Sign.vue
index b0dc890..2394d89 100644
--- a/CanadaMes-ui/src/views/Electrical/Sign.vue
+++ b/CanadaMes-ui/src/views/Electrical/Sign.vue
@@ -2,38 +2,113 @@
<div class="app">
<!--闈㈠寘灞戝鑸尯鍩�-->
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <el-breadcrumb-item :to="{ path: '/home' }">{{ $t('langHome') }}</el-breadcrumb-item>
- <el-breadcrumb-item>璁惧绠$悊</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Parameter' }">鍙傛暟</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Action' }">寮�鍏虫帶鍒�</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Sign' }">IO鐘舵��</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/State' }">鎶ヨ淇℃伅</el-breadcrumb-item>
+ <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
+ <el-button type="text">璁惧绠$悊</el-button>
+ <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link>
+ <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
+ <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
+ <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
</el-breadcrumb>
- <div>IO鐘舵��</div>
+ <div>Sign</div>
+ <div style="padding-right: 30px;display: flex;flex-wrap: wrap;">
+ <div class="kuai_sb" v-for="item in records" :key="item.id">
+ <el-col class="deng" :class="getStatusClass(item.zhuangtai)">
+ <!-- <el-input v-model="item.zhuangtai" style="width: 280px;display: none;"
+ class="in_mc"></el-input>-->
+ </el-col>
+ <el-input v-model="item.mingcheng" style="width: 280px;" class="in_mc"></el-input>
+
+ <!-- <el-switch v-model="item.zhuangtai" active-color="#13ce66" active-value="1" inactive-value="2"></el-switch> -->
+ </div>
+
+ </div>
+
</div>
</template>
-<script>
-
+<script >
export default {
name: "Sign",
+ data () {
+ return {
+ records: [
+ { id: 1, mingcheng: 'conveyor Velocity(Auto SLOW)', zhuangtai: "1" },
+ { id: 2, mingcheng: 'B01 B02 TRAVEL POS Velocity AUTO', zhuangtai: "2" },
+ { id: 3, mingcheng: 'B01 B02 TRAVEL JOG Velocity', zhuangtai: "2" },
+ { id: 4, mingcheng: 'conveyor Velocity(Manual)', zhuangtai: "2" }
+ ]
+
+ }
+ },
+ created () {
+ },
+ methods: {
+ getStatusClass (zhuangtai) {
+ if (zhuangtai === "2") {
+ return "dow";
+ } else {
+ return "op";
+ }
+ }
+ }
}
+
+
+
+
</script>
-<style lang="less" scoped>
-.el-table {
- margin-top: 15px;
- font-size: 12px;
+<style>
+* {
+ margin: 0;
+ padding: 0;
}
-.el-pagination {
- margin-top: 15px;
+.el-input__inner {
+ text-align: center;
+ width: 100%;
}
-.app .el-card {
- width: 99%;
+.kuai_sb {
+ text-align: center;
+ width: 30%;
+ margin-bottom: 15px;
}
-</style>
+
+.el-input {
+
+ .el-input__inner {
+ border: 1 solid black;
+ }
+
+
+}
+
+.in_mc {
+ .el-input__inner {
+ border: none;
+ }
+}
+
+.deng {
+ margin-left: 40%;
+ display: inline-block;
+ background: #A0A0A0;
+ border: 0.1875em solid white;
+ border-radius: 50%;
+ height: 5em;
+ width: 5em;
+ box-shadow: 0.375em 0.375em 0 0 rgba(214, 214, 214, 0.125);
+}
+
+.op {
+ background-color: #00ff22;
+}
+
+.dow {
+ background-color: #A0A0A0;
+}
+</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/Electrical/State.vue b/CanadaMes-ui/src/views/Electrical/State.vue
index e3e3794..979371d 100644
--- a/CanadaMes-ui/src/views/Electrical/State.vue
+++ b/CanadaMes-ui/src/views/Electrical/State.vue
@@ -2,38 +2,90 @@
<div class="app">
<!--闈㈠寘灞戝鑸尯鍩�-->
<el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <el-breadcrumb-item :to="{ path: '/home' }">{{ $t('langHome') }}</el-breadcrumb-item>
- <el-breadcrumb-item>璁惧绠$悊</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Parameter' }">鍙傛暟</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Action' }">寮�鍏虫帶鍒�</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/Sign' }">IO鐘舵��</el-breadcrumb-item>
- <el-breadcrumb-item :to="{ path: '/Electrical/State' }">鎶ヨ淇℃伅</el-breadcrumb-item>
+ <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
+ <el-button type="text">璁惧绠$悊</el-button>
+ <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link>
+ <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
+ <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
+ <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
</el-breadcrumb>
- <div>鎶ヨ淇℃伅</div>
+ <div>State</div>
+
+
+ <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ records }">
+ <div id="btn_div">
+ <el-button type="primary">涓嬪彂鍙傛暟</el-button>
+ </div>
+
+ <div class="kuai_div" v-for="item in records" :key="item.id">
+ <el-input v-model="item.mingcheng" style="width: 280px;" class="in_mc"></el-input>
+ <el-input v-model="item.zhuangtai" style="width: 80px;"></el-input>
+ </div>
+ </el-form>
+
+
+
+
</div>
</template>
-<script>
-
+<script >
export default {
name: "State",
+ data () {
+ return {
+ records: [
+ { id: 1, mingcheng: 'conveyor Velocity(Auto SLOW)', zhuangtai: "1" },
+ { id: 2, mingcheng: 'B01 B02 TRAVEL POS Velocity AUTO', zhuangtai: "2" },
+ { id: 3, mingcheng: 'B01 B02 TRAVEL JOG Velocity', zhuangtai: "2" },
+ { id: 4, mingcheng: 'conveyor Velocity(Manual)', zhuangtai: "2" }
+ ]
+
+ }
+ },
+ created () {
+ },
+ methods: {
+ }
}
+
+
+
+
</script>
-<style lang="less" scoped>
-.el-table {
- margin-top: 15px;
- font-size: 12px;
+<style>
+.kuai_div {
+ width: 30%;
+ margin-bottom: 15px;
}
-.el-pagination {
- margin-top: 15px;
+.el-input {
+ border: none;
+
+
+ .el-input__inner {
+ border: 1 solid black;
+ }
+
+
}
-.app .el-card {
- width: 99%;
+.in_mc {
+ .el-input__inner {
+ border: none;
+ }
+}
+
+#btn_div {
+ width: 100%;
+
+}
+
+#btn_div .el-button {
+ float: right;
}
</style>
diff --git a/CanadaMes-ui/src/views/device/alarm.vue b/CanadaMes-ui/src/views/device/alarm.vue
index 3967a9f..b9aa73a 100644
--- a/CanadaMes-ui/src/views/device/alarm.vue
+++ b/CanadaMes-ui/src/views/device/alarm.vue
@@ -1,41 +1,42 @@
<template>
- <div class="app">
+ <div>
+ <p>{{ receivedMessage }}</p>
+ <button @click="sendMessage">Send Message</button>
+ </div>
+</template>
+<script>
+export default {
+ name:'alarm',
+ data() {
+ return {
+ websocket: null,
+ receivedMessage: ''
+ };
+ },
+ mounted() {
+ this.websocket = new WebSocket('ws://localhost:8080');
- <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
- <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
- <el-button type="text">璁惧绠$悊</el-button>
- <router-link to="/device/iostate" tag="el-button" type="text">IO鐘舵��</router-link>
- <router-link to="/device/alarm" tag="el-button" type="text">鎶ヨ淇℃伅</router-link>
- <router-link to="/device/parameter" tag="el-button" type="text">鍙傛暟涓嬪彂</router-link>
- <router-link to="/device/control" tag="el-button" type="text">寮�鍏虫帶鍒�</router-link>
- </el-breadcrumb>
- <div>鎶ヨ淇℃伅</div>
- </div>
- </template>
-
- <script>
+ this.websocket.onopen = () => {
+ console.log('WebSocket connection opened');
+ };
-
- export default {
- name: "alarm",
-
+ this.websocket.onmessage = (event) => {
+ this.receivedMessage = event.data;
+ };
+
+ this.websocket.onclose = () => {
+ console.log('WebSocket connection closed');
+ };
+ },
+ methods: {
+ sendMessage() {
+ if (this.websocket.readyState === WebSocket.OPEN) {
+ this.websocket.send('Hello WebSocket!');
+ } else {
+ console.log('WebSocket connection is not open');
+ }
}
-
- </script>
-
- <style lang="less" scoped>
- .el-table {
- margin-top: 15px;
- font-size: 12px;
}
-
- .el-pagination {
- margin-top: 15px;
- }
-
- .app .el-card {
- width: 99%;
- }
- </style>
-
+};
+</script>
diff --git a/CanadaMes-ui/src/views/device/talkvue.vue b/CanadaMes-ui/src/views/device/talkvue.vue
index 96afec3..b1bf81f 100644
--- a/CanadaMes-ui/src/views/device/talkvue.vue
+++ b/CanadaMes-ui/src/views/device/talkvue.vue
@@ -1,6 +1,14 @@
<template>
<!-- <button v-on:click="send">娴嬭瘯鍙戦��</button> -->
- <button @click="send()">娴嬭瘯鍙戦��</button>
+
+ <div>
+ <button @click="send()">娴嬭瘯鍙戦��</button>
+ <button @click="ttt()">娴嬭瘯鍙戦��</button>
+
+ </div>
+
+
+
</template>
<script>
@@ -13,6 +21,7 @@
messagepack: {
data: { taskname:"" }
},
+ qqqq:{},
queryInfo: {
data: "1",
pageSize: 10
@@ -21,6 +30,7 @@
},
created() {
this.init();
+
},
methods:
{
@@ -47,8 +57,9 @@
socket.onmessage = function (msg) {
console.log("鏀跺埌鏁版嵁====" + msg.data)
- //let data = JSON.parse(msg.data) // 瀵规敹鍒扮殑json鏁版嵁杩涜瑙f瀽锛� 绫讳技杩欐牱鐨勶細 {"users": [{"username": "zhang"},{ "username": "admin"}]}
-
+ // 瀵规敹鍒扮殑json鏁版嵁杩涜瑙f瀽锛� 绫讳技杩欐牱鐨勶細 {"users": [{"username": "zhang"},{ "username": "admin"}]}
+ this.qqqq= JSON.parse(msg.data);
+console.log(this.qqqq);
};
//鍏抽棴浜嬩欢
socket.onclose = function () {
@@ -63,7 +74,11 @@
send() {
this.messagepack.data = {taskname:"鍓嶇鍒板悗鍙�"} ;
socket?.send(JSON.stringify(this.messagepack)); // 灏嗙粍瑁呭ソ鐨刯son鍙戦�佺粰鏈嶅姟绔紝鐢辨湇鍔$杩涜杞彂
- }
+ },
+ ttt() {
+ console.log(this.qqqq)
+ },
+
}
}
</script>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/login/index.vue b/CanadaMes-ui/src/views/login/index.vue
index 8f6f52a..b34532b 100644
--- a/CanadaMes-ui/src/views/login/index.vue
+++ b/CanadaMes-ui/src/views/login/index.vue
@@ -1,6 +1,6 @@
<template>
<div class="login_container">
- <div class="system_title">{{ $t('systemTitle') }}</div>
+ <div class="system_title" >{{ $t('northglassMESsystem') }}</div>
<div class="login_box">
<!--澶村儚鍖哄煙-->
<!-- <div class="avatar_box">
@@ -139,7 +139,8 @@
font-weight: bold;
text-align: center;
margin-bottom: 20px;
- top:50px;
+ position: relative; top: 100px;
+
}
.btns {
display: flex;
diff --git a/CanadaMes-ui/src/views/power/index.vue b/CanadaMes-ui/src/views/power/index.vue
index 7b2e488..567af94 100644
--- a/CanadaMes-ui/src/views/power/index.vue
+++ b/CanadaMes-ui/src/views/power/index.vue
@@ -56,7 +56,7 @@
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryInfo.pageNum"
- :page-sizes="[10, 20, 30, 40]"
+ :page-sizes="[6, 12, 18, 24]"
:page-size="queryInfo.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="powerList.total">
@@ -157,7 +157,7 @@
return {
queryInfo: {
pageNum: 1,
- pageSize: 10
+ pageSize: 6
},
powerList: {
records: [],
diff --git a/CanadaMes-ui/src/views/role/index.vue b/CanadaMes-ui/src/views/role/index.vue
index 1ccc221..ebcc35a 100644
--- a/CanadaMes-ui/src/views/role/index.vue
+++ b/CanadaMes-ui/src/views/role/index.vue
@@ -2,30 +2,30 @@
<div class="app">
<!--闈㈠寘灞戝鑸尯鍩�-->
<el-breadcrumb separator-class="el-icon-arrow-right">
- <el-breadcrumb-item :to="{ path: '/home' }">棣栭〉</el-breadcrumb-item>
- <el-breadcrumb-item>瑙掕壊绠$悊</el-breadcrumb-item>
- <el-breadcrumb-item>瑙掕壊鍒楄〃</el-breadcrumb-item>
+ <el-breadcrumb-item :to="{ path: '/home' }">{{$t('langHome')}}</el-breadcrumb-item>
+ <el-breadcrumb-item>{{$t('langRoleManagement')}}</el-breadcrumb-item>
+ <el-breadcrumb-item>{{$t('langRoleList')}}</el-breadcrumb-item>
</el-breadcrumb>
<!--鍗$墖瑙嗗浘鍖哄煙-->
<el-card class="el-card">
<el-row :gutter="20">
<!--鎼滅储涓庢坊鍔犲尯鍩�-->
<el-col :span="6">
- <el-input placeholder="璇疯緭鍏ヨ鑹插悕绉�" v-model="queryInfo.name" clearable @clear="getRoleList()">
- <el-button slot="append" icon="el-icon-search" @click="getRoleList()"></el-button>
- </el-input>
- </el-col>
+ <el-input :placeholder="$t('langEnterRoleName')" v-model="queryInfo.name" clearable @clear="getRoleList()">
+ <el-button slot="append" icon="el-icon-search" @click="getRoleList()"></el-button>
+ </el-input>
+</el-col>
<!--娣诲姞鍖哄煙-->
<el-col :span="4">
- <el-button type="primary" @click="showAddDialog">娣诲姞瑙掕壊</el-button>
+ <el-button type="primary" @click="showAddDialog">{{$t('langAddRole')}}</el-button>
</el-col>
</el-row>
<!--瑙掕壊鍒楄〃鍖哄煙-->
<el-table :data="roleList.records" border stripe>
<el-table-column label="#" type="index"></el-table-column>
- <el-table-column label="鍚嶇О" prop="name"></el-table-column>
- <el-table-column label="鍒涘缓鏃堕棿" prop="createTime"></el-table-column>
- <el-table-column label="鏄惁鏈夋晥">
+ <el-table-column :label="$t('langRoleName')" prop="name"></el-table-column>
+ <el-table-column :label="$t('langCreateTime')" prop="createTime"></el-table-column>
+ <el-table-column :label="$t('langIsValid')">
<template slot-scope="scope">
<el-switch :active-value=1
:inactive-value=0
@@ -34,19 +34,17 @@
</el-switch>
</template>
</el-table-column>
- <el-table-column label="鎿嶄綔">
+ <el-table-column :label="$t('langOperation')">
<template slot-scope="scope">
- <!--淇敼-->
- <el-tooltip effect="dark" content="淇敼" placement="top" :enterable="false">
- <el-button type="primary" icon="el-icon-edit" size="mini"
- @click="showEditDialog(scope.row)"></el-button>
- </el-tooltip>
- <!--鍒犻櫎-->
- <el-tooltip effect="dark" content="鍒犻櫎" placement="top" :enterable="false">
- <el-button type="danger" icon="el-icon-delete" size="mini"
- @click="removeById(scope.row)"></el-button>
- </el-tooltip>
- </template>
+ <!-- 淇敼 -->
+ <el-tooltip effect="dark" :content="$t('langEdit')" placement="top" :enterable="false">
+ <el-button type="primary" icon="el-icon-edit" size="mini" @click="showEditDialog(scope.row)"></el-button>
+ </el-tooltip>
+ <!-- 鍒犻櫎 -->
+ <el-tooltip effect="dark" :content="$t('langDelete')" placement="top" :enterable="false">
+ <el-button type="danger" icon="el-icon-delete" size="mini" @click="removeById(scope.row)"></el-button>
+ </el-tooltip>
+</template>
</el-table-column>
</el-table>
<!--鍒嗛〉鍖哄煙-->
@@ -62,17 +60,17 @@
</el-card>
<!--娣诲姞瑙掕壊鐨勫璇濇-->
<el-dialog
- title="娣诲姞瑙掕壊"
+ :title="$t('langAddRole')"
:visible.sync="addDialogVisible"
width="50%"
@close="addDialogClosed">
<!--鍐呭涓讳綋鍖哄煙-->
- <el-form :model="addRoleForm" :rules="addRoleRules" ref="addRoleRef" label-width="70px">
- <el-form-item label="鍚嶇О" prop="name">
+ <el-form :model="addRoleForm" :rules="addRoleRules" ref="addRoleRef" label-width="130px">
+ <el-form-item :label="$t('langRoleName')" prop="name">
<el-input v-model="addRoleForm.name"></el-input>
</el-form-item>
- <el-form-item label="鐘舵��" prop="state">
- <el-select v-model="addRoleForm.state" placeholder="璇烽�夋嫨">
+ <el-form-item :label="$t('langState')" prop="state">
+ <el-select v-model="addRoleForm.state" placeholder="$t('langPleaseSelect')">
<el-option v-for="(item,index) in options"
:key="index"
:value="item.value"
@@ -82,22 +80,22 @@
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
- <el-button @click="addDialogVisible = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="addRole">纭� 瀹�</el-button>
+ <el-button @click="addDialogVisible = false">{{$t('langCancel')}}</el-button>
+ <el-button type="primary" @click="addRole">{{$t('langConfirm')}}</el-button>
</span>
</el-dialog>
<!--淇敼瑙掕壊鐨勫璇濇-->
<el-dialog
- title="淇敼瑙掕壊"
+ :title="$t('langEditRole')"
:visible.sync="editDialogVisible"
width="50%">
<!--鍐呭涓讳綋鍖哄煙-->
- <el-form :model="editRoleForm" :rules="addRoleRules" ref="addRoleRef" label-width="70px">
- <el-form-item label="鍚嶇О" prop="name">
+ <el-form :model="editRoleForm" :rules="addRoleRules" ref="addRoleRef" label-width="130px">
+ <el-form-item :label="$t('langRoleName')" prop="name">
<el-input v-model="editRoleForm.name"></el-input>
</el-form-item>
- <el-form-item label="鐘舵��" prop="state">
- <el-select v-model="editRoleForm.state" placeholder="璇烽�夋嫨">
+ <el-form-item :label="$t('langState')" prop="state">
+ <el-select v-model="editRoleForm.state" placeholder="$t('langPleaseSelect')">
<el-option v-for="(item,index) in options"
:key="index"
:value="item.value"
@@ -107,8 +105,8 @@
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
- <el-button @click="editDialogVisible = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="editRoleInfo">纭� 瀹�</el-button>
+ <el-button @click="editDialogVisible = false">{{$t('langCancel')}}</el-button>
+ <el-button type="primary" @click="editRoleInfo">{{$t('langConfirm')}}</el-button>
</span>
</el-dialog>
</div>
@@ -116,9 +114,11 @@
<script>
import {getById, removeById, saveOrUpdate, selectPage} from "../../api/role";
-
+import LanguageMixin from '../../lang/LanguageMixin'
export default {
name: "Role",
+ mixins: [LanguageMixin],
+
data() {
return {
queryInfo: {
@@ -259,4 +259,4 @@
.app .el-card {
width: 99%;
}
-</style>
+</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/user/index.vue b/CanadaMes-ui/src/views/user/index.vue
index 0a0421c..b2bf51c 100644
--- a/CanadaMes-ui/src/views/user/index.vue
+++ b/CanadaMes-ui/src/views/user/index.vue
@@ -67,15 +67,19 @@
</el-table-column>
</el-table>
<!--鍒嗛〉鍖哄煙-->
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="queryInfo.pageNum"
- :page-sizes="[10, 20, 30, 40]"
- :page-size="queryInfo.pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="userList.total">
- </el-pagination>
+ <el-pagination
+ @size-change="handleSizeChange"
+ @current-change="handleCurrentChange"
+ :current-page="queryInfo.pageNum"
+ :page-sizes="[6, 12, 18, 24]"
+ :page-size="queryInfo.pageSize"
+ :total="userList.total"
+ :prev-text="$t('pagination.prev')"
+ :next-text="$t('pagination.next')"
+ :pager-count="7"
+ :layout="layout"
+ >
+ </el-pagination>
</el-card>
<!--娣诲姞鐢ㄦ埛鐨勫璇濇-->
<el-dialog
@@ -131,7 +135,7 @@
<el-form-item :label="$t('langUsername')" prop="username">
<el-input v-model="editUserForm.username" disabled></el-input>
</el-form-item>
- <el-form-item label="瑙掕壊" prop="roleId">
+ <el-form-item :label="$t('role')" prop="roleId">
<el-select filterable v-model="editUserForm.roleId" placeholder="璇烽�夋嫨">
<el-option v-for="item in roleList"
:key="item.id"
@@ -170,11 +174,13 @@
export default {
name: "User",
mixins: [LanguageMixin],
+
data() {
return {
+ layout: 'total, sizes, prev, pager, next, jumper',
queryInfo: {
pageNum: 1,
- pageSize: 10
+ pageSize: 6
},
userList: {
records: [],
@@ -227,6 +233,7 @@
this.userList.records = res.data.records;
this.userList.total = res.data.total
});
+
// test().then(res => {
// console.log(res.data)
// });
@@ -248,25 +255,39 @@
// });
},
-
+
showAddDialog() {
this.addDialogVisible = true;
select().then(res => {
this.roleList = res.data;
});
},
+ // stateChange(info) {
+ // saveOrUpdate(info).then(() => {
+ // this.$message.success("鏇存柊鐘舵�佹垚鍔�")
+ // });
+ // },
stateChange(info) {
- saveOrUpdate(info).then(() => {
- this.$message.success("鏇存柊鐘舵�佹垚鍔�")
- });
- },
+ saveOrUpdate(info).then(() => {
+ const successMessage = this.$t('updateSuccessMessage');
+ this.$message.success(successMessage);
+ });
+},
resetPassword(info) {
+ this.$confirm('纭閲嶇疆瀵嗙爜涓洪粯璁ゅ�煎悧锛�', '閲嶇疆瀵嗙爜', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ })
+ .then(() => {
resetPass(info).then(() => {
- this.$message.success("瀵嗙爜宸查噸缃负榛樿鍊�");
+ this.$message.success('瀵嗙爜宸查噸缃负榛樿鍊�');
});
-
-
- },
+ })
+ .catch(() => {
+ // 鐢ㄦ埛鍙栨秷閲嶇疆瀵嗙爜鎿嶄綔
+ });
+},
showEditDialog(id) {
getById({id: id}).then(res => {
this.editUserForm = res.data;
diff --git a/springboot-vue3/.idea/libraries/Maven__com_github_xingshuangs_iot_communication_1_4_2.xml b/springboot-vue3/.idea/libraries/Maven__com_github_xingshuangs_iot_communication_1_4_2.xml
new file mode 100644
index 0000000..0bc4dc9
--- /dev/null
+++ b/springboot-vue3/.idea/libraries/Maven__com_github_xingshuangs_iot_communication_1_4_2.xml
@@ -0,0 +1,13 @@
+<component name="libraryTable">
+ <library name="Maven: com.github.xingshuangs:iot-communication:1.4.2">
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/com/github/xingshuangs/iot-communication/1.4.2/iot-communication-1.4.2.jar!/" />
+ </CLASSES>
+ <JAVADOC>
+ <root url="jar://$MAVEN_REPOSITORY$/com/github/xingshuangs/iot-communication/1.4.2/iot-communication-1.4.2-javadoc.jar!/" />
+ </JAVADOC>
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/com/github/xingshuangs/iot-communication/1.4.2/iot-communication-1.4.2-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component>
\ No newline at end of file
diff --git a/springboot-vue3/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_2_3_2_RELEASE.xml b/springboot-vue3/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_2_3_2_RELEASE.xml
new file mode 100644
index 0000000..b90cb74
--- /dev/null
+++ b/springboot-vue3/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_websocket_2_3_2_RELEASE.xml
@@ -0,0 +1,13 @@
+<component name="libraryTable">
+ <library name="Maven: org.springframework.boot:spring-boot-starter-websocket:2.3.2.RELEASE">
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-websocket/2.3.2.RELEASE/spring-boot-starter-websocket-2.3.2.RELEASE.jar!/" />
+ </CLASSES>
+ <JAVADOC>
+ <root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-websocket/2.3.2.RELEASE/spring-boot-starter-websocket-2.3.2.RELEASE-javadoc.jar!/" />
+ </JAVADOC>
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-starter-websocket/2.3.2.RELEASE/spring-boot-starter-websocket-2.3.2.RELEASE-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component>
\ No newline at end of file
diff --git a/springboot-vue3/.idea/libraries/Maven__org_springframework_spring_messaging_5_2_8_RELEASE.xml b/springboot-vue3/.idea/libraries/Maven__org_springframework_spring_messaging_5_2_8_RELEASE.xml
new file mode 100644
index 0000000..9c030a1
--- /dev/null
+++ b/springboot-vue3/.idea/libraries/Maven__org_springframework_spring_messaging_5_2_8_RELEASE.xml
@@ -0,0 +1,13 @@
+<component name="libraryTable">
+ <library name="Maven: org.springframework:spring-messaging:5.2.8.RELEASE">
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-messaging/5.2.8.RELEASE/spring-messaging-5.2.8.RELEASE.jar!/" />
+ </CLASSES>
+ <JAVADOC>
+ <root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-messaging/5.2.8.RELEASE/spring-messaging-5.2.8.RELEASE-javadoc.jar!/" />
+ </JAVADOC>
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-messaging/5.2.8.RELEASE/spring-messaging-5.2.8.RELEASE-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component>
\ No newline at end of file
diff --git a/springboot-vue3/.idea/libraries/Maven__org_springframework_spring_websocket_5_2_8_RELEASE.xml b/springboot-vue3/.idea/libraries/Maven__org_springframework_spring_websocket_5_2_8_RELEASE.xml
new file mode 100644
index 0000000..886abd8
--- /dev/null
+++ b/springboot-vue3/.idea/libraries/Maven__org_springframework_spring_websocket_5_2_8_RELEASE.xml
@@ -0,0 +1,13 @@
+<component name="libraryTable">
+ <library name="Maven: org.springframework:spring-websocket:5.2.8.RELEASE">
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-websocket/5.2.8.RELEASE/spring-websocket-5.2.8.RELEASE.jar!/" />
+ </CLASSES>
+ <JAVADOC>
+ <root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-websocket/5.2.8.RELEASE/spring-websocket-5.2.8.RELEASE-javadoc.jar!/" />
+ </JAVADOC>
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-websocket/5.2.8.RELEASE/spring-websocket-5.2.8.RELEASE-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component>
\ No newline at end of file
diff --git a/springboot-vue3/pom.xml b/springboot-vue3/pom.xml
index c591f41..26c55e1 100644
--- a/springboot-vue3/pom.xml
+++ b/springboot-vue3/pom.xml
@@ -119,6 +119,10 @@
<version>1.12.1</version>
</dependency>
<dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-websocket</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.github.xingshuangs</groupId>
<artifactId>iot-communication</artifactId>
<version>1.4.2</version>
diff --git a/springboot-vue3/springboot-vue3.iml b/springboot-vue3/springboot-vue3.iml
index e09356e..79a8091 100644
--- a/springboot-vue3/springboot-vue3.iml
+++ b/springboot-vue3/springboot-vue3.iml
@@ -176,5 +176,9 @@
<orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-xml:1.14" level="project" />
<orderEntry type="library" name="Maven: xml-apis:xml-apis-ext:1.3.04" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-codec:1.14" level="project" />
+ <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-websocket:2.3.2.RELEASE" level="project" />
+ <orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.8.RELEASE" level="project" />
+ <orderEntry type="library" name="Maven: org.springframework:spring-websocket:5.2.8.RELEASE" level="project" />
+ <orderEntry type="library" name="Maven: com.github.xingshuangs:iot-communication:1.4.2" level="project" />
</component>
</module>
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
index abf3fff..6eae7f5 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -2,9 +2,6 @@
import java.util.List;
-import javax.websocket.Session;
-
-import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
public class PlcHold extends Thread {
@@ -13,7 +10,7 @@
while (this != null) {
try {
- Thread.sleep(15000);
+ Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -26,11 +23,19 @@
//鎺ㄩ�佸埌鍓嶇
JSONObject jsonObject = new JSONObject();
- jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, });
+ jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5 });
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("talkvue");
if (sendwServer != null) {
sendwServer.sendMessage(jsonObject.toString());
}
+
+
+ JSONObject jsonObject2 = new JSONObject();
+ jsonObject2.append("params", new short[] { 0, 3, 2, 3, 4, 5 });
+ WebSocketServer sendwServer2 = WebSocketServer.sessionMap.get("action");
+ if (sendwServer2 != null) {
+ sendwServer2.sendMessage(jsonObject2.toString());
+ }
}
}
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
new file mode 100644
index 0000000..2437cd4
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
@@ -0,0 +1,73 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Plcaction extends Thread {
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12);
+
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.append("params", paramlist);
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("action");
+ if (sendwServer != null) {
+ sendwServer.sendMessage(jsonObject.toString());
+ }
+
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
+ if (webSocketServer != null) {
+ List<String> messages = webSocketServer.getMessages();
+
+ List<String> addressList = new ArrayList<>();
+ addressList.add("DB100.DBW0");
+ addressList.add("DB100.DBW2");
+ addressList.add("DB100.DBW4");
+ addressList.add("DB100.DBW6");
+ addressList.add("DB100.DBW8");
+ addressList.add("DB100.DBW10");
+ addressList.add("DB100.DBW12");
+ addressList.add("DB100.DBW14");
+ addressList.add("DB100.DBW16");
+ addressList.add("DB100.DBW18");
+ addressList.add("DB100.DBW20");
+ addressList.add("DB100.DBW22");
+
+ if (!messages.isEmpty()) {
+ // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+ String lastMessage = messages.get(messages.size() - 1);
+ System.out.println("messages锛�" + messages);
+ String[] parts = lastMessage.split(",");
+ List<Short> messageValues = new ArrayList<>();
+ for (String part : parts) {
+ try {
+ // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
+ String cleanedPart = part.replaceAll("[^0-9-]", "");
+ short value = Short.parseShort(cleanedPart.trim());
+ messageValues.add(value);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+
+ e.printStackTrace();
+ }
+ }
+
+ // 灏嗘秷鎭�煎啓鍏� PLC
+// S7control.getinstance().WriteWord(addressList, messageValues);
+ System.out.println("messageValues锛�" + messageValues);
+ // 娓呯┖娑堟伅鍒楄〃
+ messages.clear();
+ }
+ }
+ }
+ }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java b/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
index 18785c1..697d697 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
@@ -1,5 +1,7 @@
package com.example.springboot.component;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
@@ -23,16 +25,19 @@
@ServerEndpoint(value = "/api/talk/{username}")
@Component
public class WebSocketServer {
-
- private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class);
+ private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class);
+ private List<String> messages;
/**
* 璁板綍褰撳墠鍦ㄧ嚎杩炴帴鏁�
*/
public static final Map<String, WebSocketServer> sessionMap = new ConcurrentHashMap<>();
- private String username;
- private Session session;
+ String username;
+ Session session;
+ public WebSocketServer() {
+ this.messages = new ArrayList<>();
+ }
/**
* 杩炴帴寤虹珛鎴愬姛璋冪敤鐨勬柟娉�
*/
@@ -75,11 +80,11 @@
public void onMessage(String message, Session session, @PathParam("username") String username) {
log.info("鏈嶅姟绔敹鍒扮敤鎴穟sername={}鐨勬秷鎭�:{}", username, message);
JSONObject obj = JSONUtil.parseObj(message);
-
String text = obj.getStr("data");
JSONObject jsonObject = new JSONObject();
- jsonObject.set("message", "ngng");
+ jsonObject.set("message", text);
+ this.messages.add(text);
this.sendMessage(jsonObject.toString()); //JSONUtil.toJsonStr(jsonObject)
}
@@ -115,4 +120,11 @@
}
}
+ public List<String> getMessages() {
+ return messages;
+ }
+
+ public void clearMessages() {
+ messages.clear();
+ }
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
index 0973688..83af3f6 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -5,7 +5,8 @@
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
-import com.example.springboot.component.PlcHold;
+
+import com.example.springboot.component.Plcaction;
@Component
@Order(1)
@@ -15,7 +16,8 @@
// TODO Auto-generated method stub
//
System.out.println("鍚姩瀹屾垚");
-
- new PlcHold().start();
- }
+
+
+ new Plcaction().start();
+ }
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/DefaultController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/DefaultController.java
index dc194f7..9208175 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/controller/DefaultController.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/controller/DefaultController.java
@@ -82,7 +82,8 @@
} catch (DisabledAccountException e) {
return Result.fail("甯愬彿宸茶绂佺敤");
} catch (ExpiredCredentialsException e) {
- return Result.fail("甯愬彿宸茶繃鏈�");
+ return Result.fail("璇烽噸鏂扮櫥褰�");
+
} catch (UnknownAccountException e) {
return Result.fail("甯愬彿涓嶅瓨鍦�");
} catch (UnauthorizedException e) {
diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/UserController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/UserController.java
index fdfcacd..69ffbaa 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/controller/UserController.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/controller/UserController.java
@@ -97,7 +97,7 @@
@ApiOperation(value = "鍒嗛〉鏌ヨ鐢ㄦ埛")
@GetMapping("/selectPage")
- @RequiresRoles({"admin"})
+// @RequiresRoles({"admin"})
@RequiresPermissions({"user:select"})
public Result selectPage(UserVo userVO) {
return Result.success(userService.selectPage(userVO));
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/vo/Result.java b/springboot-vue3/src/main/java/com/example/springboot/entity/vo/Result.java
index 13eeeb6..a5e1078 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/entity/vo/Result.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/vo/Result.java
@@ -8,6 +8,7 @@
private String msg;
private Object data;
+
public static Result success(Object data) {
Result result = new Result();
result.setCode(1);
diff --git a/springboot-vue3/src/main/java/com/example/springboot/security/constant/SystemConstant.java b/springboot-vue3/src/main/java/com/example/springboot/security/constant/SystemConstant.java
index 2440116..1a99f01 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/security/constant/SystemConstant.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/security/constant/SystemConstant.java
@@ -9,7 +9,8 @@
/**
* rememberMe 涓� false 鐨勬椂鍊欒繃鏈熸椂闂存槸1涓皬鏃�
*/
- public static final long EXPIRATION = 60 * 60L;
+ public static final long EXPIRATION = 60 * 60 * 24L;
+
/**
* rememberMe 涓� true 鐨勬椂鍊欒繃鏈熸椂闂存槸7澶�
*/
--
Gitblit v1.8.0