From 3eced65b14a858329fd2b7f4c8bc6c5d66710c78 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期三, 06 九月 2023 16:57:01 +0800
Subject: [PATCH] Merge branch 'master' of ssh://10.153.19.150:29418/CanadaMes
---
CanadaMes-ui/src/views/role/index.vue | 28
CanadaMes-ui/src/router/index.js | 8
CanadaMes-ui/src/store/index.js | 24 +
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java | 77 ++-
CanadaMes-ui/src/views/Electrical/Parameter.vue | 290 +++++------
CanadaMes-ui/src/views/power/index.vue | 64 +-
CanadaMes-ui/src/views/user/index.vue | 7
CanadaMes-ui/src/layout/tag.vue | 93 ++-
CanadaMes-ui/src/layout/index.vue | 265 +++++------
CanadaMes-ui/src/lang/locales/zh-CN.json | 54 ++
CanadaMes-ui/run.bat | 5
CanadaMes-ui/src/store/module/tags.js | 21
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java | 82 +++
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java | 31
springboot-vue3/pom.xml | 3
springboot-vue3/src/main/resources/application.properties | 2
CanadaMes-ui/src/views/Electrical/Action.vue | 105 ++-
springboot-vue3/src/main/resources/sql/canadames.sql | 35
CanadaMes-ui/src/lang/locales/en-US.json | 54 ++
springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java | 2
springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java | 128 +++--
21 files changed, 843 insertions(+), 535 deletions(-)
diff --git a/CanadaMes-ui/run.bat b/CanadaMes-ui/run.bat
new file mode 100644
index 0000000..f2d44dc
--- /dev/null
+++ b/CanadaMes-ui/run.bat
@@ -0,0 +1,5 @@
+@echo off
+echo Starting frontend development server...
+cd /d %~dp0 // 鍒囨崲鍒板綋鍓嶆壒澶勭悊鑴氭湰鎵�鍦ㄧ殑鐩綍
+cd ..\CanadaMes-ui // 鍋囪CanadaMes-ui鍦ㄤ笌鎵瑰鐞嗚剼鏈浉鍚岀殑鐩綍涓�
+npm run serve
\ No newline at end of file
diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index 3ae9217..c91ba66 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -69,5 +69,57 @@
"paginationPrev": "Previous",
"paginationPager": "{currentPage}/{pageCount}",
"paginationNext": "Next",
- "paginationJumper": "Jump to"
+ "paginationJumper": "Jump to",
+ "breadcrumb": {
+ "home": "Home",
+ "permissionManagement": "Permission Management",
+ "permissionList": "Permission List"
+ },
+ "search": {
+ "placeholder": "Enter keywords"
+ },
+ "button": {
+ "addPermission": "Add Permission",
+ "cancel": "Cancel",
+ "confirm": "Confirm"
+ },
+ "table": {
+ "role": "Role",
+ "permissionDescription": "Permission Description",
+ "permissionValue": "Permission Value",
+ "createTime": "Create Time",
+ "isActive": "Is Active",
+ "operation": "Operation"
+ },
+ "tooltip": {
+ "edit": "Edit",
+ "delete": "Delete"
+ },
+ "dialog": {
+ "addPermission": "Add Permission",
+ "editPermission": "Edit Permission"
+ },
+ "form": {
+ "role": "Role",
+ "select": "Please Select",
+ "permission": "Permission",
+ "isActive": "Is Active"
+ },
+ "鎿嶄綔": "Operation",
+ "鏈夋晥": "Valid",
+ "鏃犳晥": "Invalid",
+ "璇疯緭鍏ュ悕绉�": "Please enter a name",
+ "闀垮害鍦� 2 鍒� 15 涓瓧绗�": "Length between 2 and 15 characters",
+ "璇疯緭鍏ョ姸鎬�": "Please enter the status",
+ "娣诲姞瑙掕壊": "Add Role",
+ "淇敼瑙掕壊": "Edit Role",
+ "鍒犻櫎瑙掕壊": "Delete Role",
+ "姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ヨ鑹�, 鏄惁缁х画?": "This operation will permanently delete the role. Continue?",
+ "鎻愮ず": "Reminder",
+ "纭畾": "Confirm",
+ "鍙栨秷": "Cancel",
+ "娣诲姞瑙掕壊鎴愬姛": "Successfully added role",
+ "鏇存柊鐘舵�佹垚鍔�": "Successfully updated status",
+ "淇敼瑙掕壊鎴愬姛": "Successfully modified role",
+ "鍒犻櫎瑙掕壊鎴愬姛": "Successfully deleted role"
}
\ 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 be273d6..7d56999 100644
--- a/CanadaMes-ui/src/lang/locales/zh-CN.json
+++ b/CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -72,6 +72,58 @@
"paginationPrev": "涓婁竴椤�",
"paginationPager": "{currentPage}/{pageCount}",
"paginationNext": "涓嬩竴椤�",
- "paginationJumper": "璺宠嚦"
+ "paginationJumper": "璺宠嚦",
+ "breadcrumb": {
+ "home": "棣栭〉",
+ "permissionManagement": "鏉冮檺绠$悊",
+ "permissionList": "鏉冮檺鍒楄〃"
+ },
+ "search": {
+ "placeholder": "璇疯緭鍏ュ叧閿瓧"
+ },
+ "button": {
+ "addPermission": "娣诲姞鏉冮檺",
+ "cancel": "鍙栨秷",
+ "confirm": "纭"
+ },
+ "table": {
+ "role": "瑙掕壊",
+ "permissionDescription": "鏉冮檺鎻忚堪",
+ "permissionValue": "鏉冮檺鍊�",
+ "createTime": "鍒涘缓鏃堕棿",
+ "isActive": "鏄惁婵�娲�",
+ "operation": "鎿嶄綔"
+ },
+ "tooltip": {
+ "edit": "淇敼",
+ "delete": "鍒犻櫎"
+ },
+ "dialog": {
+ "addPermission": "娣诲姞鏉冮檺",
+ "editPermission": "缂栬緫鏉冮檺"
+ },
+ "form": {
+ "role": "瑙掕壊",
+ "select": "璇烽�夋嫨",
+ "permission": "鏉冮檺",
+ "isActive": "鏄惁婵�娲�"
+ },
+ "鎿嶄綔": "鎿嶄綔",
+ "鏈夋晥": "鏈夋晥",
+ "鏃犳晥": "鏃犳晥",
+ "璇疯緭鍏ュ悕绉�": "璇疯緭鍏ュ悕绉�",
+ "闀垮害鍦� 2 鍒� 15 涓瓧绗�": "闀垮害鍦� 2 鍒� 15 涓瓧绗�",
+ "璇疯緭鍏ョ姸鎬�": "璇疯緭鍏ョ姸鎬�",
+ "娣诲姞瑙掕壊": "娣诲姞瑙掕壊",
+ "淇敼瑙掕壊": "淇敼瑙掕壊",
+ "鍒犻櫎瑙掕壊": "鍒犻櫎瑙掕壊",
+ "姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ヨ鑹�, 鏄惁缁х画?": "姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ヨ鑹�, 鏄惁缁х画?",
+ "鎻愮ず": "鎻愮ず",
+ "纭畾": "纭畾",
+ "鍙栨秷": "鍙栨秷",
+ "娣诲姞瑙掕壊鎴愬姛": "娣诲姞瑙掕壊鎴愬姛",
+ "鏇存柊鐘舵�佹垚鍔�": "鏇存柊鐘舵�佹垚鍔�",
+ "淇敼瑙掕壊鎴愬姛": "淇敼瑙掕壊鎴愬姛",
+ "鍒犻櫎瑙掕壊鎴愬姛": "鍒犻櫎瑙掕壊鎴愬姛"
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index f886453..8ae46e0 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -1,29 +1,27 @@
<template>
<el-container style="flex: 1;">
-
<div style="width: 200px;background-color: #222f3e" :style="{width: isCollapse?'70px':'250px'}">
<el-aside :width="isCollapse?'70px':'250px'">
<el-col :gutter="20">
<el-row :span="4">
<div class="logo" @click="goToHome">
- <div class="sys-name" v-show="!isCollapse">{{ $t('northglassMESsystem') }}</div>
-</div>
+ <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>
-
- <!--涓�绾ц彍鍗�-->
+ 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">
@@ -35,7 +33,7 @@
<!--浜岀骇鑿滃崟-->
<el-menu-item :index="'/'+menu.router"
v-for="menu in item.menuLists" :key="menu.id"
- @click="saveNavState('/'+menu.router)" @select="saveNavState" :default-active="$route.path">
+ @click="addTag(menu.router)">
<template slot="title">
<!--鍥炬爣-->
<i :class="menu.icon"></i>
@@ -43,76 +41,71 @@
<span>{{ menu.name }}</span>
</template>
</el-menu-item>
-
</el-submenu>
-
</el-menu>
</el-row>
</el-col>
</el-aside>
</div>
- <el-container >
-
- <el-header class="header-container" >
-
+ <el-container>
+ <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" style="height:30px"></el-button>
- </div>
- <template >
- <el-submenu index="1" class="custom-submenu" >
-
- <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>
- </el-submenu>
- </template>
+ <div class="header-left">
+ <el-button :icon="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'" @click="toggleCollapse" style="height:30px"></el-button>
+ </div>
+ <div class="tagContainer">
+ <tag v-for="(tag, index) in tags" :key="index" :tag="tag" @removeTag="removeTag(index)" @switchTag="switchTag(index)"></tag>
+ <!-- <el-button icon="el-icon-circle-close" class="close-all-btn" @click="removeAllTags"></el-button> -->
+ </div>
<template>
- <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>
- <el-form-item label="鏂板瘑鐮�">
- <el-input v-model="formData.newPassword" type="password" show-password></el-input>
- </el-form-item>
- <el-form-item label="纭鏂板瘑鐮�">
- <el-input v-model="formData.confirmPassword" type="password" show-password></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">鍙栨秷</el-button>
- <el-button type="primary" @click="savePassword">淇濆瓨</el-button>
- </div>
- </el-dialog>
-</template>
+ <el-submenu index="1" class="custom-submenu">
+ <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>
+ </el-submenu>
+ </template>
+ <template>
+ <el-dialog title="淇敼瀵嗙爜" :visible.sync="dialogVisible" width="30%">
+ <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>
+ <el-form-item label="鏂板瘑鐮�">
+ <el-input v-model="formData.newPassword" type="password" show-password></el-input>
+ </el-form-item>
+ <el-form-item label="纭鏂板瘑鐮�">
+ <el-input v-model="formData.confirmPassword" type="password" show-password></el-input>
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="dialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="savePassword">淇濆瓨</el-button>
+ </div>
+ </el-dialog>
+ </template>
</el-menu>
</el-header>
<el-main>
- <router-view/>
+ <keep-alive>
+ <router-view/>
+ </keep-alive>
</el-main>
</el-container>
</el-container>
</template>
-
-
<script>
-import {selectList} from '../api/menuList'
-import {changePassword} from '../api/user'
-import {removeToken} from "../utils/auth";
+import { selectList } from '../api/menuList'
+import { changePassword } from '../api/user'
+import { removeToken } from "../utils/auth";
import LanguageMixin from '../lang/LanguageMixin'
import { mapState, mapMutations } from 'vuex';
- import Tag from '../layout/tag.vue';
- import store from '../store';
+import Tag from '../layout/tag.vue';
+import store from '../store';
export default {
name: "Layout",
@@ -120,7 +113,6 @@
mixins: [LanguageMixin],
data() {
return {
-
activeTag: '', // 褰撳墠婵�娲荤殑鏍囩
dialogVisible: false,
formData: {
@@ -128,7 +120,6 @@
newPassword: '',
confirmPassword: ''
},
-
menuList: [],
isCollapse: false,
activePath: '',
@@ -139,13 +130,13 @@
}
}
},
- components: {
- Tag
- },
+ components: {
+ Tag
+ },
created() {
selectList(this.menuListForm).then(res => {
this.menuList = res.data
-
+
const language = this.$i18n.locale;
if (language === 'en-US') {
this.replaceChineseWithEnglish(this.menuList);
@@ -163,29 +154,24 @@
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
- }
- }
+ this.$router.push('/home');
},
- // 鍏抽棴鏍囩鏃惰Е鍙戠殑鏂规硶
- removeTag(tag) {
- this.removeTag(tag); // 浠� Vuex Store 涓Щ闄ゆ爣绛�
- },
-
+ ...mapMutations('tags', ['addTag', 'removeTag', 'switchTag']),
+ addTag(router) {
+ let submenuItem;
+ const menuItem = this.menuList.find(item => item.menuLists.some(menu => menu.router === router));
+ if (menuItem) {
+ submenuItem = menuItem.menuLists.find(menu => menu.router === router);
+ }
+ if (submenuItem) {
+ const tag = submenuItem.router;
+ this.$store.commit('tags/addTag', tag);
+ }
+},
+ removeTag(index) {
+ this.$store.commit('tags/removeTag', index); // 浠� Vuex Store 涓Щ闄ゆ爣绛�
+ },
showChangePasswordDialog() {
this.dialogVisible = true;
},
@@ -200,25 +186,16 @@
console.log(res.data);
this.$message.success('瀵嗙爜淇敼鎴愬姛');
removeToken()
- this.$router.push('/login')
-
+ this.$router.push('/login')
}).catch(() => {
});
this.dialogVisible = false;
},
-
-
-
-
-
toggleCollapse: function () {
this.isCollapse = !this.isCollapse;
},
- // saveNavState: function (activePath) {
- // window.sessionStorage.setItem('activePath', activePath)
- // },
replaceChineseWithEnglish(menuData) {
// 瀹氫箟涓嫳鏂囧鐓у叧绯诲璞�
const translation = {
@@ -232,7 +209,8 @@
'鏉冮檺绠$悊': 'PermissionManagement',
'鏉冮檺鍒楄〃': 'PermissionList',
'瑙掕壊绠$悊': 'RoleManagement',
- '瑙掕壊鍒楄〃': 'RoleList'
+ '瑙掕壊鍒楄〃': 'RoleList',
+ '鐢垫皵绠$悊': 'Electrical management'
// 鏍规嵁瀹為檯闇�姹傜户缁坊鍔犲鐓у叧绯�
};
@@ -242,79 +220,78 @@
subMenu.name = translation[subMenu.name] || subMenu.name;
});
});
-
-
+ }
+ },
+ watch: {
+ '$route'(to) {
+ // 鍒囨崲璺敱鏃舵洿鏂版縺娲荤殑鏍囩
+ const tag = this.menuList.some(item => item.menuLists.some(menu => '/' + menu.router === to.path));
+ if (tag) {
+ this.activeTag = tag;
+ }
}
}
- }
-
-
+}
</script>
<style scoped lang="less">
-// .header-container {
-// display: flex;
-// justify-content: flex-start;
-// height: 10px; /* 璁剧疆杈冨皬鐨勯珮搴� */
-// }
-
.custom-submenu {
- height: 90px !important;
+ height: 90px !important;
}
.header-container {
-
- height: 30px !important; /* 璁剧疆杈冨皬鐨勯珮搴� */
- }
+
+ height: 30px !important; /* 璁剧疆杈冨皬鐨勯珮搴� */
+}
.header-left {
- margin-right: auto;
-
+ margin-right: auto;
+
}
.el-aside {
- height: 100vh;
- background-color: #222f3e;
- line-height: 200px;
+ height: 100vh;
+ background-color: #222f3e;
+ line-height: 200px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
- width: 200px;
- min-height: 400px;
+ width: 200px;
+ min-height: 400px;
}
.el-menu-demo {
- display: flex;
- width: 100%;
- height: 100%;
- justify-content: flex-end;
- align-items: center;
+ display: flex;
+ width: 100%;
+ height: 100%;
+ justify-content: flex-end;
+ align-items: center;
}
.el-menu-vertical-demo {
- border: 0;
+ border: 0;
}
.logo {
- background-color: #222f3e;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 60px;
+ background-color: #222f3e;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 60px;
- .sys-name {
- font-size: 20px;
- color: #ffffff;
- margin-left: 10px;
- }
+ .sys-name {
+ font-size: 20px;
+ color: #ffffff;
+ margin-left: 10px;
+ }
}
.el-header {
- background-color: #576574;
+ background-color: #576574;
}
-</style>
+</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/layout/tag.vue b/CanadaMes-ui/src/layout/tag.vue
index ccf38fd..01a1b7d 100644
--- a/CanadaMes-ui/src/layout/tag.vue
+++ b/CanadaMes-ui/src/layout/tag.vue
@@ -1,59 +1,70 @@
<template>
- <div class="tagContainer">
- <div v-for="(tag, index) in tags" :key="index" class="tagItem">
- {{ tag }}
- <span class="closeBtn" @click="removeTag(index)">x</span>
+ <keep-alive>
+ <div
+ class="tag"
+ :class="{ active: isActive }"
+ @click="switchTag(tag)">
+ <span>{{ tag }}</span>
+ <i class="el-icon-close" @click.stop="removeTag(tag)"></i>
</div>
- </div>
+ </keep-alive>
</template>
<script>
-import { mapState, mapMutations } from 'vuex';
-
export default {
+ props: {
+ tag: {
+ type: String,
+ required: true
+ },
+ activeTag: {
+ type: String,
+ required: true
+ }
+ },
computed: {
- ...mapState('tags', { // 杩欓噷娣诲姞浜� 'tags' 妯″潡鐨勫懡鍚嶇┖闂村墠缂�
- tags: state => state.tags.tags
- })
+ isActive() {
+ return this.tag === this.activeTag;
+ },
+ tagData() {
+ return this.$store.getters.getTagData(this.tag);
+ }
},
methods: {
- ...mapMutations('tag', ['removeTag']),
- saveNavState(activePath) {
- window.sessionStorage.setItem('activePath', activePath);
+ removeTag(tag) {
+ this.$emit('removeTag', tag);
+ },
+ switchTag(tag) {
+ this.$emit('switchTag', tag);
+ this.$router.push('/' + tag); // 鍒囨崲鍒版寚瀹氳矾鐢�
+}
- 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>
-.tagContainer {
- display: flex;
- flex-wrap: wrap;
- margin-bottom: 10px;
-}
-
-.tagItem {
- background-color: #eee;
+.tag {
+ display: inline-block;
+ margin-right: 10px;
+ padding: 4px 10px;
border-radius: 4px;
- padding: 4px 8px;
- margin-right: 8px;
- margin-bottom: 8px;
- display: flex;
- align-items: center;
-}
-
-.closeBtn {
- margin-left: 4px;
- color: red;
+ background-color: #f0f0f0;
cursor: pointer;
}
-</style>
+
+.tag.active {
+ background-color: #409eff;
+ color: #fff;
+}
+
+.tag span {
+ margin-right: 5px;
+}
+
+.tag i {
+ margin-left: 5px;
+ font-size: 12px;
+ cursor: pointer;
+}
+</style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/router/index.js b/CanadaMes-ui/src/router/index.js
index 83e8e75..7cc714b 100644
--- a/CanadaMes-ui/src/router/index.js
+++ b/CanadaMes-ui/src/router/index.js
@@ -62,6 +62,10 @@
component: () => import('../views/device/iostate')
},
{
+ path: '/device/talkvue',
+ component: () => import('../views/device/talkvue')
+ },
+ {
path: '/device/control',
component: () => import('../views/device/control')
},
@@ -81,6 +85,10 @@
path: '/Electrical/State',
component: () => import('../views/Electrical/State')
},
+ {
+ path: '/Electrical/alarm',
+ component: () => import('../views/Electrical/alarm')
+ },
diff --git a/CanadaMes-ui/src/store/index.js b/CanadaMes-ui/src/store/index.js
index 150cead..9b88426 100644
--- a/CanadaMes-ui/src/store/index.js
+++ b/CanadaMes-ui/src/store/index.js
@@ -10,5 +10,29 @@
modules: {
tags,
},
+ state: {
+ tagData: {} // 瀛樺偍鏍囩鏁版嵁鐨勫璞�
+ },
+ mutations: {
+ // 鏇存柊鏍囩鏁版嵁
+ updateTagData(state, payload) {
+ state.tagData[payload.tag] = payload.data;
+ }
+ },
+ actions: {
+ // 寮傛鎿嶄綔鏇存柊鏍囩鏁版嵁
+ updateTagDataAsync({ commit }, payload) {
+ // 鎵ц寮傛鎿嶄綔锛屾瘮濡傚彂閫佽姹傝幏鍙栨暟鎹�
+ // 鐒跺悗閫氳繃commit瑙﹀彂mutation鏉ユ洿鏂版暟鎹�
+ setTimeout(() => {
+ commit('updateTagData', payload);
+ }, 1000);
+ }
+ },
+ getters: {
+ getTagData: (state) => (tag) => {
+ return state.tagData[tag] || null; // 鑾峰彇鎸囧畾鏍囩鐨勬暟鎹�
+ }
+ }
// 鍏朵粬閰嶇疆
});
diff --git a/CanadaMes-ui/src/store/module/tags.js b/CanadaMes-ui/src/store/module/tags.js
index 3e3b974..a16623a 100644
--- a/CanadaMes-ui/src/store/module/tags.js
+++ b/CanadaMes-ui/src/store/module/tags.js
@@ -1,6 +1,6 @@
const state = {
tags: []
-};
+}
const mutations = {
addTag(state, tag) {
@@ -8,15 +8,20 @@
state.tags.push(tag);
}
},
- removeTag(state, tag) {
- const index = state.tags.indexOf(tag);
- if (index !== -1) {
- state.tags.splice(index, 1);
- }
+ removeTag(state, index) {
+ state.tags.splice(index, 1);
+ },
+ removeAllTags(state) {
+ state.tags = [];
+ },
+ switchTag(tag) {
+ this.$emit('switchTag', tag);
+ this.$router.push('/' + tag); // 娣诲姞杩欒浠g爜浠ュ垏鎹㈣矾鐢�
}
-};
+}
export default {
+ namespaced: true,
state,
mutations
-};
\ No newline at end of file
+}
diff --git a/CanadaMes-ui/src/views/Electrical/Action.vue b/CanadaMes-ui/src/views/Electrical/Action.vue
index 48df874..e546681 100644
--- a/CanadaMes-ui/src/views/Electrical/Action.vue
+++ b/CanadaMes-ui/src/views/Electrical/Action.vue
@@ -12,11 +12,15 @@
</el-breadcrumb>
<div>Action</div>
<el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ messagepack }">
- <div class="kuai_div" v-for="item in this.record.xyData" :key="item.name">
+ <!-- <div class="kuai_div" v-for="item in record.xyData" :key="item.value">
<el-input v-model="item.name" style="width: 240px;" class="in_mc"></el-input>
- <!-- <el-input v-model="item[0]" style="width: 80px;"></el-input> -->
<el-switch v-model="item.value" active-value="0" inactive-value="1"></el-switch>
- </div>
+ </div> -->
+
+ <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index">
+ <el-input v-model="item.name" style="width: 240px;" class="in_mc" readonly></el-input>
+ <el-switch v-model="item.value" active-value="1" inactive-value="0" @change="send()"></el-switch>
+ </div>
</el-form>
@@ -31,7 +35,7 @@
data () {
return {
record: {
- params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ params: [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
canshu: [
'D01 VFD conveyor',
'D02 VFD conveyor',
@@ -61,13 +65,34 @@
'B02 YV UP DOWN',
],
xyData: [
- { name: 'D01 VFD conveyor', value: 0 },
- { name: "D02 VFD conveyor", value: 0 },
- { name: "D03 VFD conveyor", value: 0 },
- { name: "D04 VFD conveyor", value: 0 },
- { name: "B01 B02 TRAVEL JOG Velocity", value: 0 },
- { name: "conveyor Velocity(Manual)", value: 0 },
- ],
+ { name: 'D01 VFD conveyor', value: "0" },
+ { name: 'D02 VFD conveyor', value: "0" },
+ { name: 'D03 VFD conveyor', value: "1" },
+ { name: 'D04 VFD conveyor', value: "0" },
+ { name: 'D05 VFD conveyor', value: "0" },
+ { name: 'D06 VFD conveyor', value: "0" },
+ { name: 'A01 VFD conveyor', value: "0" },
+ { name: 'A02 VFD conveyor', value: "0" },
+ { name: 'B01 VFD conveyor', value: "0" },
+ { name: 'B02 VFD conveyor', value: "0" },
+ { name: 'A01 SERVE TURN JOG+', value: "0" },
+ { name: 'A02 SERVE TURN JOG-', value: "0" },
+ { name: 'A01 SERVE TRAVEL JOG+', value: "0" },
+ { name: 'A02 SERVE TRAVEL JOG-', value: "0" },
+ { name: 'B01 SERVE TRAVEL JOG+', value: "0" },
+ { name: 'B02 SERVE TRAVEL JOG-', value: "0" },
+ { name: 'A01 SERVE TURN POS', value: "0" },
+ { name: 'A02 SERVE TURN POS', value: "0" },
+ { name: 'A01 SERVE TRAVEL POS', value: "0" },
+ { name: 'A02 SERVE TRAVEL POS', value: "0" },
+ { name: 'B01 SERVE TRAVEL POS', value: "0" },
+ { name: 'B02 SERVE TRAVEL POS', value: "0" },
+ { name: 'B01 YV TURN', value: "0" },
+ { name: 'B01 YV UP DOWN', value: "0" },
+ { name: 'B02 YV TURN', value: "0" },
+ { name: 'B02 YV UP DOWN', value: "0" },
+]
+,
},
@@ -86,7 +111,7 @@
},
methods: {
init () {
- let viewname = "Action";
+ let viewname = "action";
if (typeof (WebSocket) == "undefined") {
console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
@@ -105,25 +130,26 @@
console.log("websocket宸叉墦寮�");
};
// 娴忚鍣ㄧ鏀舵秷鎭紝鑾峰緱浠庢湇鍔$鍙戦�佽繃鏉ョ殑鏂囨湰娑堟伅
- socket.onmessage = function (msg) {
+ socket.onmessage = (msg) => {
+ if (!msg.data) {
+ return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+ }
- //console.log("鏀跺埌鏁版嵁====" + msg.data);
- let obj = JSON.parse(msg.data);
+ let obj = JSON.parse(msg.data);
+ this.record.params[0] = obj.params[0];
- this.record.params[0] = obj.acion[0].join(",");
- this.record.params[0] = this.record.params[0].split(",");
+ 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].toString() };
+ } else {
+ this.record.xyData[a].value = this.record.params[0][a].toString();
+ }
+ }
- for (let a = 0; a <= this.record.params.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];
- // }
- this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
- }
- console.log(this.record.xyData)
- this.$forceUpdate();
- }.bind(this);
+ console.log(this.record.xyData);
+ this.$forceUpdate();
+};
+
//鍏抽棴浜嬩欢
socket.onclose = function () {
console.log("websocket宸插叧闂�");
@@ -135,10 +161,11 @@
}
},
- send () {
- this.messagepack.data = { taskname: "鍓嶇鍒板悗鍙�" };
- socket?.send(JSON.stringify(this.messagepack)); // 灏嗙粍瑁呭ソ鐨刯son鍙戦�佺粰鏈嶅姟绔紝鐢辨湇鍔$杩涜杞彂
- }
+ send() {
+ this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 杞崲涓烘暣鏁版暟缁�
+ console.log(this.messagepack);
+ socket?.send(JSON.stringify(this.messagepack));
+}
}
@@ -161,16 +188,18 @@
border: none;
- .el-input__inner {
+
+
+
+}
+.el-input__inner {
border: 1 solid black;
}
-
-}
-
.in_mc {
- .el-input__inner {
+
+}
+.el-input__inner {
border: none;
}
-}
</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 12506fb..85fce27 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -1,177 +1,155 @@
<template>
<div class="app">
- <!--闈㈠寘灞戝鑸尯鍩�-->
- <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>
- <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</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()">Distribute</el-button>
- <!-- <button @click="send()">娴嬭瘯鍙戦��</button> -->
- </div>
- <div class="kuai_div" v-for="item in this.record.xyData" :key="item.name">
- <el-input style="width: 280px;" class="in_mc" v-model="item.name"></el-input>
- <el-input v-model="item.value" style="width: 80px;"></el-input>
- </div>
-
-
-
- </el-form>
-
-
-
-
+ <!--闈㈠寘灞戝鑸尯鍩�-->
+ <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>
+ <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</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.number="item.value" style="width: 80px;" @input="handleChange(index, $event.target.value)"></el-input>
+ </div>
+ </el-form>
</div>
-</template>
-
-<script >
-
-let socket;
-export default {
+ </template>
+
+ <script>
+ let socket;
+
+ export default {
name: "Parameter",
- data () {
- return {
- record: {
- params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- xyData: [
- { name: 'conveyor Velocity(Auto FAST)', value: 0 },
- { name: 'conveyor Velocity(Manual)', value: 0 },
- { name: 'A01 A02 TURN JOG Velocity', value: 0 },
- { name: 'A01 A02 TRAVEL JOG Velocity', value: 0 },
- { name: 'A01 A02 TURN POS Velocity AUTO', value: 0 },
- { name: 'A01 A02 TURN POS Velocity manual', value: 0 },
- { name: '01 A02 TRAVEL POS Velocity AUTO', value: 0 },
- { name: 'A01 A02 TRAVEL POS Velocity manual', value: 0 },
- { name: 'B01 B02 TRAVEL POS Velocity AUTO', value: 0 },
- { name: 'B01 B02 TRAVEL POS Velocity manual', value: 0 },
-
- ],
- canshu: [
- 'conveyor Velocity(Auto FAST)',
- 'B01 B02 TRAVEL JOG Velocity',
- 'A01 A02 TURN POS Velocity AUTO',
- 'A01 A02 TURN POS Velocity manual',
- 'A01 A02 TRAVEL POS Velocity AUTO',
- 'A01 A02 TRAVEL POS Velocity manual',
- 'B01 B02 TRAVEL POS Velocity AUTO',
- 'B01 B02 TRAVEL POS Velocity manual',
- ],
-
- },
-
-
- messagepack: {
- data: { taskname: "" }
- },
- queryInfo: {
- data: "1",
- pageSize: 10
- },
-
- }
+ data() {
+ return {
+ record: {
+ params: [100, 200, 10, 10, 10, 10],
+ xyData: [
+ { name: "conveyor Velocity(Auto FAST)", value: 0 },
+ { name: "conveyor Velocity(Auto SLOW)", value: 0 },
+ { name: "conveyor Velocity(Manual)", value: 0 },
+ { name: "A01 A02 TURN JOG Velocity", value: 0 },
+ { name: "A01 A02 TRAVEL JOG Velocity", value: 0 },
+ { name: "B01 B02 TRAVEL JOG Velocity", value: 0 },
+ { name: "A01 A02 TURN POS Velocity AUTO", value: 0 },
+ { name: "A01 A02 TURN POS Velocity manual", value: 0 },
+ { name: "A01 A02 TRAVEL POS Velocity AUTO", value: 0 },
+ { name: "A01 A02 TRAVEL POS Velocity manual", value: 0 },
+ { name: "B01 B02 TRAVEL POS Velocity AUTO", value: 0 },
+ { name: "B01 B02 TRAVEL POS Velocity manual", value: 0 }
+ ],
+ canshu: []
},
- created () {
- this.init();
+ messagepack: {
+ data: { taskname: "" }
+ },
+ queryInfo: {
+ data: "1",
+ pageSize: 10
+ }
+ };
+ },
+ created() {
+ this.initWebSocket();
},
methods: {
- init () {
- let viewname = "Parameter";
-
- 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;
+ initWebSocket() {
+ let viewname = "Parameter";
+
+ if (typeof WebSocket === "undefined") {
+ console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
+ } else {
+ 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; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
}
- // 寮�鍚竴涓獁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]);
- this.record.params[0] = obj.params[0];
- for (let a = 0; a <= this.record.params.length - 1; a++) {
- // this.record.xyData[a] = [this.record.canshu[a], this.record.params[0][a]];
- // this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
+
+ let obj = JSON.parse(msg.data);
+ this.record.params[0] = obj.params[0];
+
+ 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];
}
- this.$forceUpdate();
-
- }.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鍙戦�佺粰鏈嶅姟绔紝鐢辨湇鍔$杩涜杞彂
+
+ 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));
+ },
+ handleChange(index, value) {
+ this.record.xyData[index].value = value;
}
-
-}
-
-
-
-
-
-</script>
-
-<style>
-.kuai_div {
+ }
+ };
+ </script>
+
+ <style>
+ .kuai_div {
width: 30%;
margin-bottom: 15px;
-}
-
-.el-input {
+ }
+
+ .el-input {
border: none;
-
-
- .el-input__inner {
- border: 1 solid black;
}
-
-
-}
-
-.in_mc {
+
.el-input__inner {
- border: none;
+ border: 1px solid black;
}
-}
-
-#btn_div {
-
+
+ .in_mc .el-input__inner {
+ border: none;
+ }
+
+ #btn_div {
width: 100%;
-
-}
-
-#btn_div .el-button {
+ }
+
+ #btn_div .el-button {
float: right;
-}
-</style>
+ }
+ </style>
\ No newline at end of file
diff --git a/CanadaMes-ui/src/views/power/index.vue b/CanadaMes-ui/src/views/power/index.vue
index 567af94..7488cf8 100644
--- a/CanadaMes-ui/src/views/power/index.vue
+++ b/CanadaMes-ui/src/views/power/index.vue
@@ -2,32 +2,32 @@
<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('breadcrumb.home')}}</el-breadcrumb-item>
+ <el-breadcrumb-item>{{$t('breadcrumb.permissionManagement')}}</el-breadcrumb-item>
+ <el-breadcrumb-item>{{$t('breadcrumb.permissionList')}}</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="getPowerList()">
+ <el-input :placeholder="$t('search.placeholder')" v-model="queryInfo.name" clearable @clear="getPowerList()">
<el-button slot="append" icon="el-icon-search" @click="getPowerList()"></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('button.addPermission')}}</el-button>
</el-col>
</el-row>
<!--鏉冮檺鍒楄〃鍖哄煙-->
<el-table :data="powerList.records" border stripe>
<el-table-column label="#" type="index"></el-table-column>
- <el-table-column label="瑙掕壊" prop="role.name"></el-table-column>
- <el-table-column label="鏉冮檺鎻忚堪" prop="permission.description"></el-table-column>
- <el-table-column label="鏉冮檺鍊�" prop="permission.name"></el-table-column>
- <el-table-column label="鍒涘缓鏃堕棿" prop="createTime"></el-table-column>
- <el-table-column label="鏄惁鐢熸晥">
+ <el-table-column :label="$t('table.role')" prop="role.name"></el-table-column>
+ <el-table-column :label="$t('table.permissionDescription')" prop="permission.description"></el-table-column>
+ <el-table-column :label="$t('table.permissionValue')" prop="permission.name"></el-table-column>
+ <el-table-column :label="$t('table.createTime')" prop="createTime"></el-table-column>
+ <el-table-column :label="$t('table.isActive')">
<template slot-scope="scope">
<el-switch :active-value=1
:inactive-value=0
@@ -36,15 +36,15 @@
</el-switch>
</template>
</el-table-column>
- <el-table-column label="鎿嶄綔">
+ <el-table-column :label="$t('table.operation')">
<template slot-scope="scope">
<!--淇敼-->
- <el-tooltip effect="dark" content="淇敼" placement="top" :enterable="false">
+ <el-tooltip effect="dark" :content="$t('tooltip.edit')" 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-tooltip effect="dark" :content="$t('tooltip.delete')" placement="top" :enterable="false">
<el-button type="danger" icon="el-icon-delete" size="mini"
@click="removeById(scope.row)"></el-button>
</el-tooltip>
@@ -64,14 +64,14 @@
</el-card>
<!--娣诲姞鏉冮檺鐨勫璇濇-->
<el-dialog
- title="娣诲姞鏉冮檺"
+ :title="$t('dialog.addPermission')"
:visible.sync="addDialogVisible"
width="50%"
@close="addDialogClosed">
<!--鍐呭涓讳綋鍖哄煙-->
<el-form :model="addPowerForm" :rules="powerRules" ref="powerRef" label-width="70px">
- <el-form-item label="瑙掕壊" prop="roleId">
- <el-select filterable v-model="addPowerForm.roleId" placeholder="璇烽�夋嫨">
+ <el-form-item :label="$t('form.role')" prop="roleId">
+ <el-select filterable v-model="addPowerForm.roleId" :placeholder="$t('form.select')">
<el-option v-for="item in roleList"
:key="item.id"
:value="item.id"
@@ -79,8 +79,8 @@
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="鏉冮檺" prop="permissionId">
- <el-select filterable v-model="addPowerForm.permissionId" placeholder="璇烽�夋嫨">
+ <el-form-item :label="$t('form.permission')" prop="permissionId">
+ <el-select filterable v-model="addPowerForm.permissionId" :placeholder="$t('form.select')">
<el-option v-for="item in permissionList"
:key="item.id"
:value="item.id"
@@ -88,8 +88,8 @@
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="鏄惁鐢熸晥" prop="state">
- <el-select v-model="addPowerForm.state" placeholder="璇烽�夋嫨">
+ <el-form-item :label="$t('form.isActive')" prop="state">
+ <el-select v-model="addPowerForm.state" :placeholder="$t('form.select')">
<el-option v-for="(item,index) in options"
:key="index"
:value="item.value"
@@ -99,19 +99,19 @@
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
- <el-button @click="addDialogVisible = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="addPower">纭� 瀹�</el-button>
+ <el-button @click="addDialogVisible = false">{{$t('button.cancel')}}</el-button>
+ <el-button type="primary" @click="addPower">{{$t('button.confirm')}}</el-button>
</span>
</el-dialog>
<!--淇敼鏉冮檺鐨勫璇濇-->
<el-dialog
- title="淇敼鏉冮檺"
+ :title="$t('dialog.editPermission')"
:visible.sync="editDialogVisible"
width="50%">
<!--鍐呭涓讳綋鍖哄煙-->
<el-form :model="editRoleForm" :rules="powerRules" ref="powerRef" label-width="70px">
- <el-form-item label="瑙掕壊" prop="roleId">
- <el-select filterable v-model="editRoleForm.roleId" placeholder="璇烽�夋嫨">
+ <el-form-item :label="$t('form.role')" prop="roleId">
+ <el-select filterable v-model="editRoleForm.roleId" :placeholder="$t('form.select')">
<el-option v-for="item in roleList"
:key="item.id"
:value="item.id"
@@ -119,8 +119,8 @@
</el-option>
</el-select>
</el-form-item>
- <el-form-item filterable label="鏉冮檺" prop="permissionId">
- <el-select v-model="editRoleForm.permissionId" placeholder="璇烽�夋嫨">
+ <el-form-item filterable :label="$t('form.permission')" prop="permissionId">
+ <el-select v-model="editRoleForm.permissionId" :placeholder="$t('form.select')">
<el-option v-for="item in permissionList"
:key="item.id"
:value="item.id"
@@ -128,8 +128,8 @@
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="鏄惁鐢熸晥" prop="state">
- <el-select v-model="editRoleForm.state" placeholder="璇烽�夋嫨">
+ <el-form-item :label="$t('form.isActive')" prop="state">
+ <el-select v-model="editRoleForm.state" :placeholder="$t('form.select')">
<el-option v-for="(item,index) in options"
:key="index"
:value="item.value"
@@ -139,8 +139,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('button.cancel')}}</el-button>
+ <el-button type="primary" @click="editRoleInfo">{{$t('button.confirm')}}</el-button>
</span>
</el-dialog>
</div>
@@ -150,9 +150,11 @@
import {getById, removeById, saveOrUpdate, selectPage} from "../../api/rolePermission";
import {select} from "../../api/role";
import {selectPermission} from "../../api/permission";
+import LanguageMixin from '../../lang/LanguageMixin'
export default {
name: "Power",
+ mixins: [LanguageMixin],
data() {
return {
queryInfo: {
diff --git a/CanadaMes-ui/src/views/role/index.vue b/CanadaMes-ui/src/views/role/index.vue
index ebcc35a..c663906 100644
--- a/CanadaMes-ui/src/views/role/index.vue
+++ b/CanadaMes-ui/src/views/role/index.vue
@@ -137,12 +137,13 @@
addRoleForm: {
state: 1
},
+
// 淇敼鐨勮鑹插璞�
editRoleForm: {},
// 娣诲姞瑙掕壊鐨勯獙璇佽鍒�
addRoleRules: {
name: [
- {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'},
+ {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'},
{min: 2, max: 15, message: '闀垮害鍦� 2 鍒� 15 涓瓧绗�', trigger: 'blur'}
],
state: [
@@ -177,7 +178,8 @@
},
stateChange(info) {
saveOrUpdate(info).then(() => {
- this.$message.success("鏇存柊鐘舵�佹垚鍔�")
+ const 鏇存柊鐘舵�佹垚鍔� = this.$t('鏇存柊鐘舵�佹垚鍔�');
+ this.$message.success(鏇存柊鐘舵�佹垚鍔�)
});
},
@@ -195,7 +197,8 @@
this.getRoleList();
// 闅愯棌娣诲姞瑙掕壊瀵硅瘽妗�
this.addDialogVisible = false;
- this.$message.success("娣诲姞瑙掕壊鎴愬姛");
+ const 娣诲姞瑙掕壊鎴愬姛 = this.$t('娣诲姞瑙掕壊鎴愬姛');
+ this.$message.success(娣诲姞瑙掕壊鎴愬姛);
});
})
},
@@ -220,26 +223,33 @@
this.getRoleList();
// 闅愯棌娣诲姞瑙掕壊瀵硅瘽妗�
this.editDialogVisible = false;
- this.$message.success("淇敼瑙掕壊鎴愬姛");
+ const 淇敼瑙掕壊鎴愬姛 = this.$t('淇敼瑙掕壊鎴愬姛');
+ this.$message.success(淇敼瑙掕壊鎴愬姛);
});
})
},
// 鏍规嵁id鍒犻櫎瑙掕壊淇℃伅
removeById(role) {
// 寮规璇㈤棶鐢ㄦ埛鏄惁鍒犻櫎瑙掕壊
- this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ヨ鑹�, 鏄惁缁х画?', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
+ const 姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ヨ鑹叉槸鍚︾户缁� = this.$t('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ヨ鑹�, 鏄惁缁х画?');
+ const 鎻愮ず = this.$t('鎻愮ず');
+ const 纭畾 = this.$t('纭畾');
+ const 鍙栨秷 = this.$t('鍙栨秷');
+ this.$confirm(姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ヨ鑹叉槸鍚︾户缁�, 鎻愮ず, {
+ confirmButtonText: 纭畾,
+ cancelButtonText: 鍙栨秷,
type: 'warning'
}).then(() => {
// 鍒犻櫎瑙掕壊
removeById({id: role.id}).then(() => {
// 閲嶆柊鑾峰彇瑙掕壊鍒楄〃
this.getRoleList();
- this.$message.success("鍒犻櫎瑙掕壊鎴愬姛");
+ const 鍒犻櫎瑙掕壊鎴愬姛 = this.$t('鍒犻櫎瑙掕壊鎴愬姛');
+ this.$message.success(鍒犻櫎瑙掕壊鎴愬姛);
});
}).catch(() => {
- this.$message('宸插彇娑堝垹闄�');
+ const 宸插彇娑堝垹闄� = this.$t('宸插彇娑堝垹闄�');
+ this.$message(宸插彇娑堝垹闄�);
});
}
}
diff --git a/CanadaMes-ui/src/views/user/index.vue b/CanadaMes-ui/src/views/user/index.vue
index b2bf51c..c91da6e 100644
--- a/CanadaMes-ui/src/views/user/index.vue
+++ b/CanadaMes-ui/src/views/user/index.vue
@@ -11,11 +11,11 @@
<el-row :gutter="20">
<!--鎼滅储涓庢坊鍔犲尯鍩�-->
<el-col :span="6">
- <el-input placeholder="璇疯緭鍏ョ敤鎴峰悕绉�" v-model="queryInfo.username" clearable @clear="getUserList">
+ <el-input :placeholder= "$t('langUsernamePlaceholder')" v-model="queryInfo.username" clearable @clear="getUserList">
</el-input>
</el-col>
<el-col :span="6">
- <el-input placeholder="璇疯緭鍏ラ偖绠�" v-model="queryInfo.email" clearable @clear="getUserList">
+ <el-input :placeholder="$t('langEmailPlaceholder')" v-model="queryInfo.email" clearable @clear="getUserList">
</el-input>
</el-col>
<!--鎼滅储鎸夐挳-->
@@ -74,8 +74,7 @@
: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"
>
diff --git a/springboot-vue3/pom.xml b/springboot-vue3/pom.xml
index 26c55e1..37d5977 100644
--- a/springboot-vue3/pom.xml
+++ b/springboot-vue3/pom.xml
@@ -118,6 +118,9 @@
<artifactId>poi-tl</artifactId>
<version>1.12.1</version>
</dependency>
+
+
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
diff --git a/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java b/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java
index ac10b17..9f03c3a 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java
@@ -2,8 +2,10 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
+
public class AuthorityApplication {
public static void main(String[] args) {
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 6eae7f5..bf88fbb 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,40 +2,65 @@
import java.util.List;
+import javax.websocket.Session;
+
+import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
public class PlcHold extends Thread {
- @Override
- public void run() {
- while (this != null) {
- try {
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- List<Boolean> bitlist = S7control.getinstance().ReadBits("DB2.0.0", 100);
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ List<Boolean> bitlist = S7control.getinstance().ReadBits("DB2.0.0", 100);
- List<Short> paramlist = S7control.getinstance().ReadWord("DB100.6", 1);
+ List<Short> paramlist = S7control.getinstance().ReadWord("DB100.6", 1);
- //鏌ヨ鏁版嵁搴�
- //鎺ㄩ�佸埌鍓嶇
+ // 鏌ヨ鏁版嵁搴�
+ // 鎺ㄩ�佸埌鍓嶇
- JSONObject jsonObject = new JSONObject();
- jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5 });
- WebSocketServer sendwServer = WebSocketServer.sessionMap.get("talkvue");
- if (sendwServer != null) {
- sendwServer.sendMessage(jsonObject.toString());
- }
+ // Parameter
+// JSONObject jsonObject = new JSONObject();
+// jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, });
+// WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
+// if (sendwServer != null) {
+// sendwServer.sendMessage(jsonObject.toString());
+// }
+ // Action
+ // JSONObject jsonObject2 = new JSONObject();
+ // jsonObject2.append("acion",
+ // new short[] { 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ // 1, 1, 1, 0, 0, });
+ // WebSocketServer sendwServer2 = WebSocketServer.sessionMap.get("Action");
+ // if (sendwServer2 != null) {
+ // sendwServer2.sendMessage(jsonObject2.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());
- }
- }
+ // Sign
+ JSONObject jsonObject3 = new JSONObject();
+ jsonObject3.append("sig",
+ new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0,
+ 1, });
+ WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign");
+ if (sendwServer3 != null) {
+ sendwServer3.sendMessage(jsonObject3.toString());
+ }
+
+ // State
+ JSONObject jsonObject4 = new JSONObject();
+ jsonObject4.append("sta", new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, });
+ WebSocketServer sendwServer4 = WebSocketServer.sessionMap.get("State");
+ if (sendwServer4 != null) {
+ sendwServer4.sendMessage(jsonObject4.toString());
+ }
+
}
+ }
}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
new file mode 100644
index 0000000..b7c1ae4
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
@@ -0,0 +1,82 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlcParameter extends Thread {
+ private static final int SEND_INTERVAL = 10000;
+ private static final int WRITE_INTERVAL = 100;
+
+ @Override
+
+ public void run() {
+ try {
+ // 鍙戦�佷竴娆℃秷鎭�
+ sendMessages();
+
+ // 寤惰繜涓�娈垫椂闂�
+ Thread.sleep(SEND_INTERVAL);
+
+ while (true) {
+ // 鍐欏叆PLC
+ writeToPlc();
+ Thread.sleep(WRITE_INTERVAL);
+
+ // 鍙戦�佹秷鎭�
+ sendMessages();
+ Thread.sleep(SEND_INTERVAL);
+ }
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void sendMessages() {
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
+ if (sendwServer != null) {
+ List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12);
+ JSONObject jsonObject = new JSONObject();
+// new short[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0}
+ jsonObject.append("params", new short[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0});
+ sendwServer.sendMessage(jsonObject.toString());
+ }
+ }
+
+ private void writeToPlc() {
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter");
+ if (webSocketServer != null) {
+ List<String> messages = webSocketServer.getMessages();
+
+ String addressList = "DB100.DBW0";
+
+ 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);
+ System.out.println("addressList锛�" + addressList);
+ // 娓呯┖娑堟伅鍒楄〃
+ webSocketServer.clearMessages();
+ }
+ }
+ }
+}
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
index 2437cd4..4fc251a 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
@@ -6,68 +6,96 @@
import java.util.List;
public class Plcaction extends Thread {
+ private static final long SEND_INTERVAL = 2000; // 鍙戦�佹秷鎭殑鏃堕棿闂撮殧
+ private static final long WRITE_INTERVAL = 100; // 鍐欏叆PLC鐨勬椂闂撮棿闅�
+
@Override
public void run() {
- while (this != null) {
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ try {
+ // 鍙戦�佷竴娆℃秷鎭�
+ sendMessages();
+
+ // 寤惰繜涓�娈垫椂闂�
+ Thread.sleep(SEND_INTERVAL);
+
+ while (true) {
+ // 鍐欏叆PLC
+ writeToPlc();
+ Thread.sleep(WRITE_INTERVAL);
+
+ // 鍙戦�佹秷鎭�
+ sendMessages();
+ Thread.sleep(SEND_INTERVAL);
}
- List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void sendMessages() {
+ WebSocketServer sendwServer = WebSocketServer.sessionMap.get("action");
+ if (sendwServer != null) {
+
+ List<Boolean> paramlist = S7control.getinstance().ReadBits("DB100.DBW", 12);
+ // new short[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0}
JSONObject jsonObject = new JSONObject();
- jsonObject.append("params", paramlist);
- WebSocketServer sendwServer = WebSocketServer.sessionMap.get("action");
- if (sendwServer != null) {
- sendwServer.sendMessage(jsonObject.toString());
- }
+ jsonObject.append("params", new short[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0});
- WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
- if (webSocketServer != null) {
- List<String> messages = webSocketServer.getMessages();
+ sendwServer.sendMessage(jsonObject.toString());
+ }
- 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();
- }
+
+ }
+
+ private void writeToPlc() {
+ WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
+ if (webSocketServer != null) {
+ List<String> messages = webSocketServer.getMessages();
+
+ String addressList = "DB100.DBW0";
+
+ if (!messages.isEmpty()) {
+ // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+ String lastMessage = messages.get(messages.size() - 1);
+ System.out.println("messages锛�" + messages);
+ String[] parts = lastMessage.split(",");
+ List<Integer> messageValues = new ArrayList<>();
+ for (String part : parts) {
+ try {
+ // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
+ String cleanedPart = part.replaceAll("[^0-9-]", "");
+ Integer value = Integer.parseInt(cleanedPart.trim());
+ messageValues.add(value);
+ } catch (NumberFormatException e) {
+ // 濡傛灉鏃犳硶瑙f瀽涓烘暣鏁扮被鍨嬶紝鍒欏拷鐣ヨ閮ㄥ垎
+ e.printStackTrace();
}
-
- // 灏嗘秷鎭�煎啓鍏� PLC
-// S7control.getinstance().WriteWord(addressList, messageValues);
- System.out.println("messageValues锛�" + messageValues);
- // 娓呯┖娑堟伅鍒楄〃
- messages.clear();
}
+
+ // 灏嗘秷鎭�艰浆鎹负甯冨皵鍒楄〃
+ List<Boolean> messageBooleans = new ArrayList<>();
+ for (Integer value : messageValues) {
+ messageBooleans.add(value == 0 ? true : false);
+ }
+
+ // 灏嗗竷灏斿垪琛ㄥ啓鍏� PLC
+ S7control.getinstance().WriteBit(addressList, messageBooleans);
+ System.out.println("messageValues锛�" + messageBooleans);
+ System.out.println("addressList锛�" + addressList);
+
+ // 娓呯┖娑堟伅鍒楄〃
+ webSocketServer.clearMessages();
}
}
}
-}
+
+ private List<Boolean> paramList() {
+ // 鑾峰彇鍙傛暟鍒楄〃鐨勯�昏緫
+
+ return new ArrayList<>(); // 鍋囪杩斿洖绌哄垪琛�
+ }
+}
\ No newline at end of file
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 83af3f6..a931db3 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
@@ -1,23 +1,36 @@
package com.example.springboot.config;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
-
+import com.example.springboot.component.PlcHold;
import com.example.springboot.component.Plcaction;
+import com.example.springboot.component.PlcParameter;
@Component
@Order(1)
-public class AppRunnerConfig implements ApplicationRunner{
- @Override
- public void run(ApplicationArguments args) throws Exception {
- // TODO Auto-generated method stub
- //
- System.out.println("鍚姩瀹屾垚");
+
+public class AppRunnerConfig implements ApplicationRunner {
- new Plcaction().start();
+ @Override
+ public void run(ApplicationArguments args) throws Exception {
+ // TODO Auto-generated method stub
+ //
+ System.out.println("鍚姩瀹屾垚");
+
+ new PlcHold().start();
+ new Plcaction().start();
+ new PlcParameter().start();
+
+
+
+
}
-}
+
+ }
+
+
diff --git a/springboot-vue3/src/main/resources/application.properties b/springboot-vue3/src/main/resources/application.properties
index cf44da0..a6a6607 100644
--- a/springboot-vue3/src/main/resources/application.properties
+++ b/springboot-vue3/src/main/resources/application.properties
@@ -6,7 +6,7 @@
#\u6570\u636E\u5E93\u9A71\u52A8
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#\u6570\u636E\u5E93\u8FDE\u63A5\u5730\u5740
-spring.datasource.url=jdbc:mysql://localhost:3306/canadames?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
+spring.datasource.url=jdbc:mysql://10.153.19.150:3306/canadames?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
#\u6570\u636E\u5E93\u7528\u6237\u540D
spring.datasource.username=root
#\u6570\u636E\u5E93\u7528\u6237\u5BC6\u7801
diff --git a/springboot-vue3/src/main/resources/sql/canadames.sql b/springboot-vue3/src/main/resources/sql/canadames.sql
index bfddca1..15a9308 100644
--- a/springboot-vue3/src/main/resources/sql/canadames.sql
+++ b/springboot-vue3/src/main/resources/sql/canadames.sql
@@ -11,7 +11,7 @@
Target Server Version : 80022
File Encoding : 65001
- Date: 30/08/2023 16:14:36
+ Date: 05/09/2023 16:20:45
*/
SET NAMES utf8mb4;
@@ -32,7 +32,7 @@
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '鍒涘缓鏃堕棿',
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '鏇存柊鏃堕棿',
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '鍟嗗搧鍒嗙被' ROW_FORMAT = Dynamic;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '鍟嗗搧鍒嗙被' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of category
@@ -62,7 +62,7 @@
`last_product_count_date` date NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `device_id_idx`(`device_id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 53 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
+) ENGINE = InnoDB AUTO_INCREMENT = 46 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of device
@@ -102,16 +102,16 @@
-- Records of menu_list
-- ----------------------------
INSERT INTO `menu_list` VALUES (1, NULL, '鐢ㄦ埛绠$悊', 'el-icon-user-solid', 1, '', 1, '2021-11-28 14:30:27', '2021-11-28 15:06:04');
-INSERT INTO `menu_list` VALUES (2, NULL, '璁惧绠$悊', 'el-icon-lollipop', 2, '', 1, '2023-08-23 20:11:38', '2023-08-28 08:16:00');
+INSERT INTO `menu_list` VALUES (2, NULL, '鐢垫皵绠$悊', 'el-icon-lollipop', 2, '', 1, '2023-08-23 20:11:38', '2023-09-01 16:34:36');
INSERT INTO `menu_list` VALUES (5, NULL, '鏉冮檺绠$悊', 'el-icon-collection-tag', 5, '', 1, '2021-11-28 14:30:27', '2021-11-28 15:06:04');
INSERT INTO `menu_list` VALUES (6, NULL, '瑙掕壊绠$悊', 'el-icon-s-flag', 6, '', 1, '2021-11-28 14:30:27', '2021-11-28 15:06:04');
INSERT INTO `menu_list` VALUES (7, 1, '鐢ㄦ埛鍒楄〃', '', 7, 'user', 1, '2021-11-28 14:30:27', '2021-11-28 15:06:04');
INSERT INTO `menu_list` VALUES (11, 5, '鏉冮檺鍒楄〃', '', 11, 'power', 1, '2021-11-28 14:30:28', '2021-11-28 15:06:04');
INSERT INTO `menu_list` VALUES (12, 6, '瑙掕壊鍒楄〃', '', 12, 'role', 1, '2021-11-28 14:30:28', '2021-11-28 15:06:04');
-INSERT INTO `menu_list` VALUES (49, 2, '鎶ヨ淇℃伅', '', 49, 'device/alarm', 1, '2021-11-28 14:30:28', '2023-08-25 14:05:05');
-INSERT INTO `menu_list` VALUES (51, 2, 'I/O鐘舵��', NULL, 51, 'device/iostate', 1, '2023-08-25 13:29:13', '2023-08-25 14:07:04');
-INSERT INTO `menu_list` VALUES (52, 2, '寮�鍏虫帶鍒�', NULL, 52, 'device/control', 1, '2023-08-25 13:29:18', '2023-08-25 14:06:48');
-INSERT INTO `menu_list` VALUES (53, 2, '鍙傛暟涓嬪彂', NULL, 53, 'device/parameter', 1, '2023-08-25 13:29:22', '2023-08-25 14:06:33');
+INSERT INTO `menu_list` VALUES (49, 2, '鎶ヨ淇℃伅', '', 49, 'Electrical/Action', 1, '2021-11-28 14:30:28', '2023-09-01 16:33:29');
+INSERT INTO `menu_list` VALUES (51, 2, 'I/O鐘舵��', NULL, 51, 'Electrical/State', 1, '2023-08-25 13:29:13', '2023-09-01 16:34:03');
+INSERT INTO `menu_list` VALUES (52, 2, '寮�鍏虫帶鍒�', NULL, 52, 'Electrical/Sign', 1, '2023-08-25 13:29:18', '2023-09-01 16:33:48');
+INSERT INTO `menu_list` VALUES (53, 2, '鍙傛暟涓嬪彂', NULL, 53, 'Electrical/Parameter', 1, '2023-08-25 13:29:22', '2023-09-01 16:32:29');
-- ----------------------------
-- Table structure for permission
@@ -188,7 +188,7 @@
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '鍒涘缓鏃堕棿',
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '鏇存柊鏃堕棿',
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 52 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '瑙掕壊鍜岃彍鍗曞叧鑱旇〃' ROW_FORMAT = Dynamic;
+) ENGINE = InnoDB AUTO_INCREMENT = 54 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '瑙掕壊鍜岃彍鍗曞叧鑱旇〃' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of role_menu_list
@@ -229,6 +229,8 @@
INSERT INTO `role_menu_list` VALUES (47, 2, 60, 1, '2023-08-28 15:14:27', '2023-08-28 15:53:34');
INSERT INTO `role_menu_list` VALUES (50, 2, 2, 1, '2023-08-28 15:14:27', '2023-08-28 15:53:34');
INSERT INTO `role_menu_list` VALUES (51, 2, 49, 1, '2023-08-28 15:14:27', '2023-08-28 15:53:34');
+INSERT INTO `role_menu_list` VALUES (52, 2, 1, 1, '2023-08-30 16:28:57', '2023-08-30 16:28:57');
+INSERT INTO `role_menu_list` VALUES (53, 2, 7, 1, '2023-08-30 16:29:05', '2023-08-30 16:29:05');
-- ----------------------------
-- Table structure for role_permission
@@ -242,7 +244,7 @@
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '鍒涘缓鏃堕棿',
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '鏇存柊鏃堕棿',
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 74 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '瑙掕壊鏉冮檺' ROW_FORMAT = Dynamic;
+) ENGINE = InnoDB AUTO_INCREMENT = 76 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '瑙掕壊鏉冮檺' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of role_permission
@@ -276,7 +278,7 @@
INSERT INTO `role_permission` VALUES (43, 1, 29, 1, '2023-08-24 08:56:15', '2023-08-24 08:56:15');
INSERT INTO `role_permission` VALUES (44, 1, 31, 1, '2023-08-24 08:56:23', '2023-08-24 08:56:23');
INSERT INTO `role_permission` VALUES (53, 2, 2, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
-INSERT INTO `role_permission` VALUES (54, 2, 3, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
+INSERT INTO `role_permission` VALUES (54, 2, 3, 0, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (56, 2, 8, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (57, 2, 9, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (58, 2, 10, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
@@ -285,7 +287,7 @@
INSERT INTO `role_permission` VALUES (63, 2, 17, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (64, 2, 18, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (65, 2, 19, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
-INSERT INTO `role_permission` VALUES (66, 2, 20, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
+INSERT INTO `role_permission` VALUES (66, 2, 20, 0, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (67, 2, 22, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (68, 2, 25, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (69, 2, 26, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
@@ -293,6 +295,7 @@
INSERT INTO `role_permission` VALUES (71, 2, 28, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (72, 2, 30, 1, '2023-08-24 08:55:34', '2023-08-24 08:55:34');
INSERT INTO `role_permission` VALUES (73, 2, 29, 1, '2023-08-24 08:56:15', '2023-08-28 15:33:14');
+INSERT INTO `role_permission` VALUES (74, 2, 1, 1, '2023-08-30 16:29:46', '2023-08-30 16:29:46');
-- ----------------------------
-- Table structure for storage_rack
@@ -759,19 +762,19 @@
-- ----------------------------
-- Records of user
-- ----------------------------
-INSERT INTO `user` VALUES (1, 0, '', 0, 1, 'admin', 'b2f0c414a5ffb6944c424bc18ae3a8a0', NULL, NULL, NULL, 1, '2023-08-25 08:58:58', '2023-08-29 16:02:56');
+INSERT INTO `user` VALUES (1, 0, '', 0, 1, 'admin', 'b2f0c414a5ffb6944c424bc18ae3a8a0', NULL, NULL, NULL, 1, '2023-08-25 08:58:58', '2023-09-05 16:12:28');
INSERT INTO `user` VALUES (2, 1, '1-', 1, 2, 'user1', '601b99523f82de29f87771d5f95accdc', 'user1@qq.com', NULL, NULL, 1, '2021-11-28 14:31:39', '2021-11-28 15:09:36');
INSERT INTO `user` VALUES (3, 1, '1-', 1, 2, 'user2', 'f403c87893db29eb71b21905b57bbd0d', 'user2@qq.com', NULL, NULL, 1, '2021-11-28 14:31:39', '2021-11-28 15:09:36');
INSERT INTO `user` VALUES (8, 1, '1-', 1, 5, 'yyyyy', 'fca7e8e6b2fca165de912bd617c8df3c', '2265557248@qq.com', NULL, NULL, 1, '2023-08-23 20:08:44', '2023-08-23 20:08:44');
-INSERT INTO `user` VALUES (9, 1, '1-', 1, 1, 'yttttttttttt', '16de30ab81d69e8cc479a05cad599657', '666@qq.com', NULL, NULL, 1, '2023-08-23 20:35:32', '2023-08-23 20:35:32');
+INSERT INTO `user` VALUES (9, 1, '1-', 1, 1, 'yttttttttttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '666@qq.com', NULL, NULL, 1, '2023-08-23 20:35:32', '2023-08-23 20:35:32');
INSERT INTO `user` VALUES (10, 1, '1-', 1, 2, '767655555', '500637c0d48b442a3be6d4fce12e0910', NULL, NULL, NULL, 1, '2023-08-23 20:42:58', '2023-08-23 20:42:58');
INSERT INTO `user` VALUES (11, 1, '1-', 1, 5, 'uiuyiuy', 'e046c4175152aa3001d2c71c5bc1aee5', '767676767tt@qq.com', NULL, NULL, 1, '2023-08-23 20:43:42', '2023-08-23 20:43:42');
INSERT INTO `user` VALUES (13, 1, '1-', 1, 2, 'user3', '500637c0d48b442a3be6d4fce12e0910', '2265557345@qq.com', NULL, NULL, 1, '2023-08-24 09:58:40', '2023-08-24 09:58:40');
INSERT INTO `user` VALUES (15, 1, '1-', 1, 2, '99999', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '2267666@qq.com', NULL, NULL, 1, '2023-08-25 09:37:05', '2023-08-28 14:37:27');
-INSERT INTO `user` VALUES (16, 1, '1-', 1, 1, '5656tttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '5454@qq.com', NULL, NULL, 1, '2023-08-28 14:17:44', '2023-08-28 14:37:24');
+INSERT INTO `user` VALUES (16, 1, '1-', 1, 2, '5656tttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '5454@qq.com', NULL, NULL, 1, '2023-08-28 14:17:44', '2023-08-28 14:37:24');
INSERT INTO `user` VALUES (17, 1, '1-', 1, 2, '6767ttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '225@qq.com', NULL, NULL, 1, '2023-08-28 14:20:05', '2023-08-28 14:23:53');
INSERT INTO `user` VALUES (18, 1, '1-', 1, 2, '8989ttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '224@qq.com', NULL, NULL, 1, '2023-08-28 14:26:17', '2023-08-28 14:37:22');
-INSERT INTO `user` VALUES (19, 1, '1-', 1, 2, '8080ttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '87@qq.com', NULL, NULL, 1, '2023-08-28 14:34:39', '2023-08-29 16:03:38');
+INSERT INTO `user` VALUES (19, 1, '1-', 1, 5, '8080ttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '87@qq.com', NULL, NULL, 1, '2023-08-28 14:34:39', '2023-08-29 16:03:38');
-- ----------------------------
-- Procedure structure for Your_Stored_Procedure
--
Gitblit v1.8.0