Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
# Conflicts:
# springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
| | |
| | | "moment": "^2.29.4", |
| | | "vue": "^2.6.11", |
| | | "vue-i18n": "^8.26.5", |
| | | "vue-router": "^3.3.4", |
| | | "vuex": "^3.6.2" |
| | | "vue-router": "^3.3.4" |
| | | }, |
| | | "devDependencies": { |
| | | "@vue/cli-plugin-babel": "~4.5.0", |
| | |
| | | "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", |
| | |
| | | "resolved": "https://registry.npm.taobao.org/vue-template-es2015-compiler/download/vue-template-es2015-compiler-1.9.1.tgz", |
| | | "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", |
| | |
| | | "moment": "^2.29.4", |
| | | "vue": "^2.6.11", |
| | | "vue-i18n": "^8.26.5", |
| | | "vue-router": "^3.3.4", |
| | | "vuex": "^3.6.2" |
| | | "vue-router": "^3.3.4" |
| | | }, |
| | | "devDependencies": { |
| | | "@vue/cli-plugin-babel": "~4.5.0", |
| | |
| | | <!--路由占位符--> |
| | | <router-view/> |
| | | <div class="custom-icon"> |
| | | |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value": 1, |
| | | "value": 0,
|
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "未回零", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "回零", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | } |
| | | ], |
| | |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "未回零", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "回零", |
| | | "value": 0, |
| | | "address": "DB10.0", |
| | | "state": 0 |
| | | } |
| | | } |
| | | ], |
| | |
| | | { |
| | | "button": { |
| | | "name": "故障", |
| | | "value": 1, |
| | | "value": 0,
|
| | | "address": "DB10.0", |
| | | "state": 1 |
| | | } |
| | |
| | | [ |
| | | [ |
| | | { |
| | | "name": "手动位置", |
| | | "name": "A01手动位置",
|
| | | "value": 0, |
| | | "sending": 0, |
| | | "type": "0", |
| | |
| | | "count": 3 |
| | | }, |
| | | { |
| | | "name": "定位速度", |
| | | "name": "A01定位速度",
|
| | | "value": 0, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | |
| | | ], |
| | | [ |
| | | { |
| | | "name": "手动位置", |
| | | "name": "A02手动位置",
|
| | | "value": 0, |
| | | "sending": 0, |
| | | "type": "0", |
| | |
| | | "count": 3 |
| | | }, |
| | | { |
| | | "name": "定位速度", |
| | | "name": "A02定位速度",
|
| | | "value": 0, |
| | | "sending": 0, |
| | | "address": "DB100.0", |
| | |
| | | |
| | | |
| | | }, |
| | | { |
| | | "name": "进片ID", |
| | | "read": 33, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | |
| | | }, |
| | | { |
| | | "name": "长度", |
| | | "read": 33, |
| | |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | }, |
| | | { |
| | | "name": "进片ID", |
| | | "read": 9999, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | | |
| | | |
| | | }, |
| | | { |
| | | "button": { |
| | |
| | | }, |
| | | { |
| | | "name": "取片ID", |
| | | "read": 33, |
| | | "read": 8888, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value":0 |
| | |
| | | "button": { |
| | | "name": "未回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | "address":"DB10.0", |
| | | "type":"66" |
| | | } |
| | | }, |
| | | { |
| | |
| | | "button": { |
| | | "name": "未回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | "address":"DB10.0", |
| | | "type":"66" |
| | | } |
| | | }, |
| | | { |
| | |
| | | } ,{ |
| | | "button": { |
| | | "name": "未回零", |
| | | |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | "address":"DB10.0", |
| | | "type":"66" |
| | | } |
| | | }, |
| | | { |
| | |
| | | "button": { |
| | | "name": "未回零", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | "address":"DB10.0", |
| | | "type":"66" |
| | | } |
| | | }, |
| | | { |
| | |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | |
| | | ], |
| | | |
| | | [ |
| | | { |
| | | "button": { |
| | |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "name": "A02ID", |
| | | "read": "ID28", |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | |
| | | { |
| | | "button": { |
| | | "name": "B01手动状态", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | "value": 0 |
| | | |
| | | }, |
| | | "type": "4" |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | "value": 0 |
| | | |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "name": "B01ID", |
| | | "read": "ID29", |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | |
| | | { |
| | | "button": { |
| | | "name": "清除ID", |
| | | "value": 0, |
| | | "address": "DB10.0" |
| | | "value": 0 |
| | | |
| | | }, |
| | | "type": "3" |
| | | }, |
| | | { |
| | | "name": "ID", |
| | | "read": 33, |
| | | "name": "B02ID", |
| | | "read": "ID210", |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | |
| | | [ |
| | | { |
| | | "name": "扫描枪扫码的ID", |
| | | "read": 0, |
| | | "sending": 0, |
| | | |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "ID1", |
| | | "read": 66, |
| | | "sending": 0, |
| | | "type": "0", |
| | |
| | | ], |
| | | [ |
| | | { |
| | | "name": "扫描枪扫码的ID", |
| | | "read": 0, |
| | | "sending": 0, |
| | | |
| | | "value": 0 |
| | | }, |
| | | { |
| | | "name": "ID2", |
| | | "read": 666, |
| | | "sending": 0, |
| | | "type": "0", |
| | | "value": 0 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | "name": "A01当前格子", |
| | | "read": 333, |
| | | "sending": 0, |
| | |
| | | "Outing":"Outing",
|
| | | "Suspend":"Suspend",
|
| | | "Stop":"Stop",
|
| | | "Start":"Start"
|
| | | "Start":"Start",
|
| | | "ServoManualone": {
|
| | | "A01 所在格子": "A01 Current Grid",
|
| | | "数量": "Quantity",
|
| | | "进片ID": "IncomingId",
|
| | | "长度": "Length",
|
| | | "高度": "Height",
|
| | | "取片格子": "Pickupgrid address",
|
| | | "存片格子": "Storagegrid address",
|
| | | "A01翻转实时位置": "A01FlipPosition",
|
| | | "A02翻转实时位置": "A02FlipPosition",
|
| | | "故障": "Fault",
|
| | | "复位": "Reset",
|
| | | "未回零": "NotZero",
|
| | | "回零": "Home",
|
| | | "目标格子": "Target Grid",
|
| | | "A02 所在格子": "A02 Current Grid",
|
| | | "取片ID": "PickupId",
|
| | | "A01半自动": "A01 Semi-Auto",
|
| | | "A01半自动启动": "A01 Semi-Auto Start",
|
| | | "A02半自动": "A02 Semi-Auto",
|
| | | "A02半自动启动": "A02 Semi-Auto Start",
|
| | | "B01 所在格子": "B01 Current Grid",
|
| | | "B02 所在格子": "B02 Current Grid"
|
| | | },
|
| | | "langParameter1": {
|
| | |
|
| | | "A01~A02输送": "A01~A02 Conveying",
|
| | | "B01~B02输送": "B01~B02 Conveying",
|
| | | "D01~D02输送": "D01~D02 Conveying",
|
| | | "翻转点动速度": "Flip Jog Speed",
|
| | | "小车点动速度": "Cart Jog Speed",
|
| | | "最高速度": "Max Speed",
|
| | | "高速线速度": "High-Speed Line Speed",
|
| | | "低速线速度": "Low-Speed Line Speed",
|
| | | "手动速度": "Manual Speed"
|
| | | },
|
| | | |
| | | "langParameter2": {
|
| | | "D01手动状态": "D01 Manual Status",
|
| | | "清除ID": "Clear ID",
|
| | | "ID": "ID",
|
| | | "A02ID": "ID",
|
| | | "B01ID": "ID",
|
| | | "B02ID": "ID",
|
| | | "D02手动状态": "D02 Manual Status",
|
| | | "D03手动状态": "D03 Manual Status",
|
| | | "D04手动状态": "D04 Manual Status",
|
| | | "D05手动状态": "D05 Manual Status",
|
| | | "D06手动状态": "D06 Manual Status",
|
| | | "A01手动状态": "A01 Manual Status",
|
| | | "ID1": "ID1",
|
| | | "ID2": "ID2",
|
| | | "A02手动状态": "A02 Manual Status",
|
| | | "B01手动状态": "B01 Manual Status",
|
| | | "B02手动状态": "B02 Manual Status",
|
| | | "扫描枪扫码的ID": "Scanned ID",
|
| | | "A01当前格子": "A01 Current Grid",
|
| | | "A02所在格子": "A02 Current Grid",
|
| | | "B01所在格子": "B01 Current Grid",
|
| | | "B02所在格子": "B02 Current Grid"
|
| | | },
|
| | | "langPositioning1": {
|
| | | "格子间距": "GridSpacing",
|
| | | "存片接片地址": "StorageReceivingAddress",
|
| | | "出片接片地址": "OutgoingReceivingAddress",
|
| | | "存片格位置设定": "StorageGridPositionSetting",
|
| | | "1#格地址": "grid address1# ",
|
| | | "22#格地址": "grid address22#",
|
| | | "43#格地址": "grid address43#",
|
| | | "64#格地址": "grid address64#",
|
| | | "85#格地址": "grid address85#",
|
| | | "106#格地址": "grid address106#",
|
| | | "127#格地址": "grid address127#",
|
| | | "148#格地址": "grid address148#",
|
| | | "169#格地址": "grid address169#",
|
| | | "190#格地址": "grid address190#",
|
| | | "出片格位置设定": "OutgoingGridPositionSetting",
|
| | | "A01所在格子": "A01 grid address",
|
| | | "数量": "Quantity",
|
| | | "进片ID": "IncomingId",
|
| | | "长度": "Length",
|
| | | "高度": "Height",
|
| | | "取片格子": "Pickupgrid address",
|
| | | "翻转实时位置": "FlipPosition",
|
| | | "故障": "Fault",
|
| | | "复位": "Reset",
|
| | | "未回零": "NotZero",
|
| | | "回零": "Zero",
|
| | | "目标格子": "Target Grid"
|
| | | },
|
| | | "langPositioning2": {
|
| | | "格子间距": "GridSpacing",
|
| | | "存片接片地址": "StorageReceivingAddress",
|
| | | "出片接片地址": "OutgoingReceivingAddress",
|
| | | "存片格位置设定": "StorageGridPositionSetting",
|
| | | "1#格地址": "grid address1# ",
|
| | | "22#格地址": "grid address22#",
|
| | | "43#格地址": "grid address43#",
|
| | | "64#格地址": "grid address64#",
|
| | | "85#格地址": "grid address85#",
|
| | | "106#格地址": "grid address106#",
|
| | | "127#格地址": "grid address127#",
|
| | | "148#格地址": "grid address148#",
|
| | | "169#格地址": "grid address169#",
|
| | | "190#格地址": "grid address190#",
|
| | | "出片格位置设定": "OutgoingGridPositionSetting",
|
| | | "B01格位置设定":"B01PositionSetting",
|
| | | "B02位置设定":"B02PositionSetting"
|
| | | }, "ManualonePositionlang": {
|
| | | "A01手动格子": "A01 Target grid(Manual)",
|
| | | "A01定位速度": "A01 TRAVEL POS Velocity manual",
|
| | | "A01当前格子": "A01 Current Grid",
|
| | | "A01启动": "A01 Start",
|
| | | "故障": "Fault",
|
| | | "复位": "Reset",
|
| | | "A02手动格子": "A02 Target grid(Manual)",
|
| | | "A02定位速度": "A02 TRAVEL POS Velocity manual",
|
| | | "A02当前格子": "A02 Current Grid",
|
| | | "A02启动": "A02 Start",
|
| | | "复位": "Reset",
|
| | | "B01手动格子": "B01 Target grid(Manual)",
|
| | | "B01定位速度": "B01 TRAVEL POS Velocity manual",
|
| | | "B01当前格子": "B01 Current Grid",
|
| | | "B01启动": "Start",
|
| | | "复位": "Reset",
|
| | | "回零": "Zero",
|
| | | "未回零": "NotZero",
|
| | | "B02手动格子": "B02 Target grid(Manual)",
|
| | | "B02定位速度": "B02 TRAVEL POS Velocity manual",
|
| | | "B02当前格子": "B02 Current Grid",
|
| | | "B02启动": "Start",
|
| | | "复位": "Reset",
|
| | | "A01实时位置": "A01 tavel Actual Position",
|
| | | "A02实时位置": "A02 tavel Actual Position",
|
| | | "B01实时位置": "B02 tavel Actual Position",
|
| | | "B02实时位置": "B02 tavel Actual Position"
|
| | | },
|
| | | "Manualoneposition2lang": {
|
| | | "A01手动位置": "A01 turn Target Angle(Manual)",
|
| | | "A01定位速度": "A01 TURN POS Velocity manual",
|
| | | "A01翻转实时位置": "A01 turn Actual angle",
|
| | | "A01翻转启动": "A01 SERVE TURN",
|
| | | "故障": "Fault",
|
| | | "复位": "Reset",
|
| | | "未回零": "NotZero",
|
| | | "回零": "Zero",
|
| | | "A02手动位置": "A02 turn Target Angle(Manual)",
|
| | | "A02定位速度": "A02 TURN POS Velocity manual",
|
| | | "A02翻转实时位置": "A02 turn Actual angle",
|
| | | "A02翻转启动": "SERVE TURN",
|
| | | "A02复位": "Reset",
|
| | | "未回零": "NotZero",
|
| | | "回零": "Zero"
|
| | | },
|
| | | "AutomaticParameterSettinglang": {
|
| | | "A01行走高速角度": "A01 turn Angle1",
|
| | | "A01行走低速角度": "A01 turn Angle2",
|
| | | "A01输送接片角度": "A01 turn Angle3",
|
| | | "A01笼子角度": "A01 turn Angle4",
|
| | | "A02行走高速角度": "A02 turn Angle1",
|
| | | "A02行走低速角度": "A02 turn Angle2",
|
| | | "A02输送接片角度": "A02 turn Angle3",
|
| | | "A02笼子角度": "A02 turn Angle4",
|
| | | "大车自动速度": "A01 A02 TRAVEL POS Velocity AUTO",
|
| | | "小车自动速度": "B01 B02 TRAVEL POS Velocity AUTO",
|
| | | "自动翻转速度": "A01 A02 TURN POS Velocity AUTO"
|
| | | },
|
| | | "ManualJoglang": {
|
| | | "D01输送": "D01 VFD conveyor",
|
| | | "D02输送": "D02 VFD conveyor",
|
| | | "D03输送": "D03 VFD conveyor",
|
| | | "D04输送": "D04 VFD conveyor",
|
| | | "D05输送": "D05 VFD conveyor",
|
| | | "D06输送": "D06 VFD conveyor",
|
| | | "A01输送正向": "A01 VFD conveyor",
|
| | | "A02输送正向": "A02 VFD conveyor",
|
| | | "B01输送": "B01 VFD conveyor",
|
| | | "B02输送": "B02 VFD conveyor",
|
| | | "A01翻转": "A01 SERVE TURN",
|
| | | "A02翻转": "A02 SERVE TURN",
|
| | | "A01行走点动": "A01 SERVE TRAVEL",
|
| | | "A02行走点动": "A02 SERVE TRAVEL",
|
| | | "B01行走点动": "B01 SERVE TRAVEL",
|
| | | "B02行走点动": "B02 SERVE TRAVEL",
|
| | | "B02翻转气缸": "B02 YV TURN",
|
| | | "B02升降气缸": "B02 YV UP DOWN",
|
| | | "B02电磁阀": "B02 YV Gassing",
|
| | | "B01翻转气缸": "B01 YV TURN",
|
| | | "B01升降气缸": "B01 YV UP DOWN",
|
| | | "B01电磁阀": "B01 YV Gassing",
|
| | | "A01输送反向": "A01 VFD conveyor reverse",
|
| | | "A02输送反向": "A02 VFD conveyor reverse",
|
| | | "A01注电泵": "A01 oil pump",
|
| | | "A02注电泵": "A02 oil pump"
|
| | | }
|
| | | |
| | |
|
| | | |
| | | |
| | | } |
| | |
| | | |
| | | <el-menu-item :index="'/'+menu.router" |
| | | v-for="menu in item.menuLists" :key="menu.id" |
| | | @click="addTag(menu.router)"> |
| | | > |
| | | <template slot="title"> |
| | | <!--图标--> |
| | | <i :class="menu.icon"></i> |
| | |
| | | <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" style="display: flex;"> |
| | | <!-- <div class="tagContainer" style="display: flex;"> |
| | | <tag v-for="(tag, index) in tags" :key="index" :tag="tag" @removeTag="removeTag(index)" @switchTag="switchTag(index)"></tag> |
| | | </div> |
| | | </div> --> |
| | | <template> |
| | | <el-submenu index="1" class="custom-submenu" > |
| | | <template slot="title"> |
| | |
| | | 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 { mapState, mapMutations } from 'vuex'; |
| | | // import Tag from '../layout/tag.vue'; |
| | | // import store from '../store'; |
| | | |
| | | export default { |
| | | name: "Layout", |
| | | store, |
| | | // store, |
| | | mixins: [LanguageMixin], |
| | | data() { |
| | | return { |
| | |
| | | } |
| | | } |
| | | }, |
| | | components: { |
| | | Tag |
| | | }, |
| | | // components: { |
| | | // Tag |
| | | // }, |
| | | created() { |
| | | selectList(this.menuListForm).then(res => { |
| | | this.menuList = res.data |
| | |
| | | this.replaceChineseWithEnglish(this.menuList); |
| | | } |
| | | // 记录上一次激活的菜单 |
| | | this.activePath = window.sessionStorage.getItem('activePath') |
| | | // this.activePath = window.sessionStorage.getItem('activePath') |
| | | }); |
| | | }, |
| | | computed: { |
| | | ...mapState('tags', ['tags']) |
| | | // ...mapState('tags', ['tags']) |
| | | }, |
| | | methods: { |
| | | |
| | |
| | | this.$router.push('/home'); |
| | | }, |
| | | |
| | | ...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); |
| | | } |
| | | // ...mapMutations('tags', ['addTag', 'removeTag', 'switchTag']), |
| | | addTag() { |
| | | // 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 中移除标签 |
| | | removeTag() { |
| | | // this.$store.commit('tags/removeTag', index); // 从 Vuex Store 中移除标签 |
| | | }, |
| | | showChangePasswordDialog() { |
| | | this.dialogVisible = true; |
| | |
| | | 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' |
| | | |
| | | // import store from './store' |
| | | Vue.use(VueI18n) |
| | |
| | | new Vue({ |
| | | router, |
| | | i18n, |
| | | store, |
| | | // store, |
| | | |
| | | render: h => h(App) |
| | | }).$mount('#app'); |
| | |
| | | path: '/Electrical/Positioning2', |
| | | component: () => import('../views/Electrical/Positioning2') |
| | | }, |
| | | { |
| | | path: '/Electrical/ManualonePosition', |
| | | component: () => import('../views/Electrical/ManualonePosition') |
| | | }, |
| | | { |
| | | path: '/Electrical/ManualonePosition2', |
| | | component: () => import('../views/Electrical/ManualonePosition2') |
| | | }, |
| | | { |
| | | path: '/Electrical/AutomaticParameterSetting', |
| | | component: () => import('../views/Electrical/AutomaticParameterSetting') |
| | | }, |
| | | { |
| | | path: '/Electrical/ManualJog', |
| | | component: () => import('../views/Electrical/ManualJog') |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | |
| | | const router = new VueRouter({ |
| | | // base: '/canadames/', |
| | | routes |
| | | routes, |
| | | meta:{ |
| | | keepAlive:false |
| | | } |
| | | }); |
| | | |
| | | // 路由控制守卫,解决需要登录才可以访问的页面 |
| | | |
| | | |
| | | router.beforeEach((to, from, next) => { |
| | | // 如果访问的是登录或注册页面直接放行 |
| | | if (to.path === '/login' || to.path === '/register') return next(); |
| | | |
| | | // 获取token |
| | | const hasToken = getToken(); |
| | | |
| | | |
| | | |
| | | |
| | | const isExist = Vue.prototype.$tagList.some(tag => tag.path === to.fullPath); |
| | |
| | | <div class="app"> |
| | | <!--面包屑导航区域--> |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') |
| | | <router-link to="/Electrical/ServoManualone" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ServoManual') |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual') |
| | | }}</router-link> |
| | | </el-breadcrumb> |
| | | |
| | |
| | | jsonData: data, |
| | | activeButton: '', |
| | | record: { |
| | | params: [], |
| | | |
| | | 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], |
| | | canshu: [ |
| | | 'D01 VFD conveyor', |
| | | 'D02 VFD conveyor', |
| | | 'D03 VFD conveyor', |
| | | 'D04 VFD conveyor', |
| | | 'D05 VFD conveyor', |
| | | 'D06 VFD conveyor', |
| | | 'A01 VFD conveyor', |
| | | 'A02 VFD conveyor', |
| | | 'B01 VFD conveyor', |
| | | 'B02 VFD conveyor', |
| | | 'A01 SERVE TURN JOG+', |
| | | 'A02 SERVE TURN JOG-', |
| | | 'A01 SERVE TRAVEL JOG+', |
| | | 'A02 SERVE TRAVEL JOG-', |
| | | 'B01 SERVE TRAVEL JOG+', |
| | | 'B02 SERVE TRAVEL JOG-', |
| | | 'A01 SERVE TURN POS', |
| | | 'A02 SERVE TURN POS', |
| | | 'A01 SERVE TRAVEL POS', |
| | | 'A02 SERVE TRAVEL POS', |
| | | 'B01 SERVE TRAVEL POS', |
| | | 'B02 SERVE TRAVEL POS', |
| | | 'B01 YV TURN', |
| | | 'B01 YV UP DOWN', |
| | | 'B02 YV TURN', |
| | | '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: '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" }, |
| | | ] |
| | | , |
| | | }, |
| | |
| | | |
| | | } |
| | | }, |
| | | created () { |
| | | // created () { |
| | | // this.init(); |
| | | // }, |
| | | activated(){ |
| | | |
| | | this.init(); |
| | | }, |
| | | methods: { |
| | |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | this.record.params[0] = obj.params[0]; |
| | | // console.log(obj.params); |
| | | |
| | | if (obj.params) { |
| | | |
| | | this.record.xyData = this.jsonData.action; |
| | | |
| | | for (let a = 0; a < this.record.xyData.length; a++) { |
| | | if (this.record.params[0][a]) { |
| | | this.record.params[0] = obj.params[0]; |
| | | for (let a = 0; a <= this.record.params[0].length - 1; a++) { |
| | | this.record.xyData[a].name = this.jsonData.action[a].name; |
| | | this.record.xyData[a].value = this.record.params[0][a].toString(); |
| | | } |
| | | |
| | | } |
| | | |
| | | this.record.xyData = this.jsonData.action.filter(item => { |
| | | return item.state != 0; |
| | | } |
| | | |
| | | ); |
| | | |
| | | const language = this.$i18n.locale; |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | } |
| | | this.$router.afterEach(function(){ |
| | | socket.close(); |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | send () { |
| | | this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 转换为整数数组 |
| | | console.log(this.messagepack); |
| | | //console.log(this.messagepack); |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | }, |
| | | //语言转换 |
| | | replaceChineseWithEnglish () { |
| | | const translation = this.$t('langActions'); |
| | | this.record.xyData = this.record.xyData.map(item => { return { name: translation[item.name] || item.name, value: item.value }; }); |
| | | |
| | | console.log(translation); |
| | | }, |
| | | |
| | | } |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Positioning1') |
| | | }}</router-link> |
| | |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-card class="json-block" style="width:485px;"> |
| | | <el-card class="json-block" style="width:585px;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container"> |
| | | <div class="item-row" v-if="item.type === '0'"> |
| | | <span class="name" v-if="item.type === '0'" style="width:150px;">{{ item.name }}</span> |
| | | <span class="name" v-if="item.type === '0'" style="width:300px;">{{ item.name }}</span> |
| | | <el-input style="width:250px;" v-if="item.type === '0'" v-model="item.value" class="input-box" |
| | | @keyup.enter.native="submitDataToBackend"></el-input> |
| | | </div> |
| | |
| | | jsonData: data // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | activated () { |
| | | |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | const language = this.$i18n.locale; |
| | | console.log(language); |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | | } |
| | | this.$forceUpdate(); |
| | | |
| | | |
| | | }, |
| | | methods: { |
| | | closeSocket () { |
| | | // 关闭 WebSocket 连接 |
| | | socket.close(); |
| | | }, |
| | | updateButtonValue (dataGroup, itemIndex) { |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); // 点击按钮后将值改为1 |
| | | }, |
| | |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | const jsonData2 = this.jsonData; |
| | | console.log(obj); |
| | | // console.log(obj); |
| | | const handleMouseMove = throttle(function (event) { |
| | | |
| | | const inputBox = document.querySelectorAll('.el-card__body'); |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | this.$router.afterEach(function () { |
| | | socket.close(); |
| | | }) |
| | | |
| | | |
| | | } |
| | | |
| | | }, |
| | | replaceChineseWithEnglish () { |
| | | const translation = this.$t('AutomaticParameterSetting'); |
| | | this.jsonData = this.jsonData.map(item => { return { name: translation[item.name] || item.name, value: item.value }; }); |
| | | // console.log(translation); |
| | | }, |
| | | send () { |
| | | |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | }, |
| | | replaceChineseWithEnglish () { |
| | | |
| | | |
| | | const nameMap = this.$t('AutomaticParameterSettinglang') |
| | | this.jsonData = this.jsonData.map((item) => { |
| | | return item.map((obj) => { |
| | | if (obj.name) { |
| | | const newName = nameMap[obj.name] || obj.name; |
| | | return { ...obj, name: newName }; |
| | | } else if (obj.button && obj.button.name) { |
| | | const newName = nameMap[obj.button.name] || obj.button.name; |
| | | return { ...obj, button: { ...obj.button, name: newName } }; |
| | | } else { |
| | | return obj; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | console.log(this.jsonData) |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Positioning1') |
| | | }}</router-link> |
| | |
| | | jsonData: data // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | activated () { |
| | | |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | const language = this.$i18n.locale; |
| | | console.log(language); |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | | } |
| | | this.$forceUpdate(); |
| | | |
| | | |
| | | }, |
| | | methods: { |
| | | closeSocket () { |
| | | // 关闭 WebSocket 连接 |
| | | socket.close(); |
| | | }, |
| | | updateButtonValue (dataGroup, itemIndex) { |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); // 点击按钮后将值改为1 |
| | | if (dataGroup[itemIndex].button.value === 1) { |
| | | // 如果当前按钮的值是 0,将其设为 1 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 0); |
| | | } else { |
| | | // 否则将其设为 0 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | } |
| | | }, |
| | | submitDataToBackend () { |
| | | const inputData = this.jsonData.map(dataGroup => { |
| | |
| | | }, |
| | | //根据读取PLC的值,根据名称改变颜色1打开,0关闭 |
| | | getStatusClass (zhuangtai) { |
| | | |
| | | console.log(zhuangtai); |
| | | if (zhuangtai === 1) { |
| | | return "op"; |
| | | } |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | this.$router.afterEach(function () { |
| | | socket.close(); |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | send () { |
| | | |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | }, |
| | | replaceChineseWithEnglish () { |
| | | |
| | | |
| | | const nameMap = this.$t('ManualJoglang') |
| | | this.jsonData = this.jsonData.map((item) => { |
| | | return item.map((obj) => { |
| | | if (obj.name) { |
| | | const newName = nameMap[obj.name] || obj.name; |
| | | return { ...obj, name: newName }; |
| | | } else if (obj.button && obj.button.name) { |
| | | const newName = nameMap[obj.button.name] || obj.button.name; |
| | | return { ...obj, button: { ...obj.button, name: newName } }; |
| | | } else { |
| | | return obj; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | // console.log(this.jsonData) |
| | | |
| | | } |
| | | }, |
| | | |
| | | } |
| | | </script> |
| | | |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | | }}</router-link> -->
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('Positioning1') |
| | | }}</router-link> |
| | |
| | | |
| | | <el-row :gutter="10"> |
| | | <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-card class="json-block" style="width:485px;"> |
| | | <el-card class="json-block" style="width:585px;">
|
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container"> |
| | | <div class="item-row"> |
| | | <span class="name" style="width:100px;">{{ item.name }}</span> |
| | | <span class="name" style="width:300px;">{{ item.name }}</span>
|
| | | <el-input style="width:250px;" v-if="item.state != 0 && item.type === '0'" v-model="item.value" |
| | | class="input-box"></el-input> |
| | | </div> |
| | | </div> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button && item.button.state != 0" :name="item.button.name" v-model="item.button.value" |
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1 }" |
| | | <el-button v-if="item.button && language === 'en-US' && item.state != 0" :name="item.button.name"
|
| | | v-model="item.button.value"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0 }"
|
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
|
| | | item.button.name }}</el-button>
|
| | | <el-button v-if="item.button && language === 'zh-CN' && item.state != 0" :name="item.button.name"
|
| | | v-model="item.button.value"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1, 'error-button2': item.button.name === '未回零' && item.button.value === 0 }"
|
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ |
| | | item.button.name }}</el-button> |
| | | </div> |
| | |
| | | data () { |
| | | return { |
| | | jsonData: data, |
| | | language: this.$i18n.locale,
|
| | | |
| | | // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | activated () {
|
| | |
|
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | const language = this.$i18n.locale;
|
| | | //console.log(language);
|
| | | if (language === 'en-US') {
|
| | | this.replaceChineseWithEnglish();
|
| | | }
|
| | | this.$forceUpdate();
|
| | |
|
| | | |
| | | }, |
| | | methods: { |
| | | closeSocket () {
|
| | | // 关闭 WebSocket 连接
|
| | | socket.close();
|
| | | },
|
| | | updateButtonValue (dataGroup, itemIndex) { |
| | | // 将当前按钮的值设为1 |
| | | |
| | |
| | | |
| | | }, |
| | | submitDataToBackend (currentButtonName) { |
| | | if (currentButtonName === 'A01启动') { |
| | | if (currentButtonName === 'A01启动' || currentButtonName === 'A01 Start') {
|
| | | const data = []; |
| | | |
| | | for (let i = 0; i < 1; i++) { |
| | |
| | | |
| | | data.push(values); |
| | | } |
| | | data.push([], [], [],[],[],[]);
|
| | | |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === 'A02启动') { |
| | | if (currentButtonName === 'A02启动' || currentButtonName === 'A02 Start') {
|
| | | const data = []; |
| | | |
| | | for (let i = 1; i < 2; i++) { |
| | |
| | | data.unshift([]); |
| | | data.push(values); |
| | | } |
| | | data.push([], [], [],[],[]);
|
| | | |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === 'B01启动') { |
| | | if (currentButtonName === 'B01启动' || currentButtonName === 'B01 Start') {
|
| | | const data = []; |
| | | |
| | | for (let i = 2; i < 3; i++) { |
| | |
| | | data.unshift([], []); |
| | | data.push(values); |
| | | } |
| | | //data.unshift([]);
|
| | | |
| | | data.push([], [], [],[]);
|
| | | |
| | | |
| | | const jsonObject = { data }; |
| | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === 'B02启动') { |
| | | if (currentButtonName === 'B02启动' || currentButtonName === 'B02 Start') {
|
| | | const data = []; |
| | | |
| | | for (let i = 3; i < 4; i++) { |
| | |
| | | data.push(values); |
| | | } |
| | | |
| | | data.push([], [],[]);
|
| | |
|
| | | |
| | | |
| | | const jsonObject = { data }; |
| | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '故障') { |
| | | if (currentButtonName === '故障' || currentButtonName === 'Fault') {
|
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '故障'); |
| | | // const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '故障' || subItem.button.name === 'Fault');
|
| | | const buttonItem = item.find(subItem => subItem.button && ['故障', 'Fault'].includes(subItem.button.name));
|
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | data2.unshift([], [], [], []); |
| | | const jsonObject2 = { data2 }; |
| | | const jsonObject2 = { data:data2 };
|
| | | data.push([],[]);
|
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '复位') { |
| | | if (currentButtonName === '复位' || currentButtonName === 'Reset') {
|
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '复位'); |
| | | const buttonItem = item.find(subItem => subItem.button && ['复位', 'Reset'].includes(subItem.button.name));
|
| | |
|
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | data2.push(resetButtonValues.flat());
|
| | | data2.unshift([], [], [], [], []); |
| | | const jsonObject2 = { data2 }; |
| | | const jsonObject2 = { data:data2 };
|
| | | data2.push([]);
|
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有复位的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | |
| | | // setTimeout(() =>
|
| | | // window.location.reload(), 2000
|
| | | // )
|
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '回零') { |
| | | if (currentButtonName === '回零' || currentButtonName === 'Zero') {
|
| | | |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '回零'); |
| | | const buttonItem = item.find(subItem => subItem.button && ['回零', 'Zero'].includes(subItem.button.name));
|
| | |
|
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | data2.push(resetButtonValues.flat());
|
| | | data2.unshift([], [], [], [], [], []); |
| | | const jsonObject2 = { data2 }; |
| | | const jsonObject2 = { data:data2 };
|
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有回零的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | |
| | | // setTimeout(() =>
|
| | | // window.location.reload(), 2000
|
| | | // )
|
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | // console.log(obj) |
| | | // console.log(obj);
|
| | | const jsonData2 = this.jsonData; |
| | | |
| | | const weihuiling = obj.weihuiling;
|
| | | const handleMouseMove = throttle(function (event) { |
| | | const inputBox = document.querySelectorAll('.el-card__body'); |
| | | const target = event.target; |
| | |
| | | }); |
| | | |
| | | // 遍历guzhang数组 |
| | | for (let i = 0; i < obj.guzhang[0].length; i++) { |
| | | const guzhangValue = obj.guzhang[0][i]; |
| | | |
| | | // 查找jsonData2中带有"button"的对象,并且name等于"故障" |
| | | for (let j = 0; j < jsonData2.length; j++) { |
| | | const section = jsonData2[j]; |
| | | |
| | | for (let k = 0; k < section.length; k++) { |
| | | const item = section[k]; |
| | | |
| | | if (item.button && item.button.name === "故障") { |
| | | // 更新value属性 |
| | | item.button.value = guzhangValue; |
| | | break; |
| | | for (let i = 0; i < jsonData2.length; i++) {
|
| | | let arr = jsonData2[i];
|
| | | for (let j = 0; j < arr.length; j++) {
|
| | | let obj2 = arr[j];
|
| | | if (obj2.button && (obj2.button.name === "故障" || obj2.button.name === "Fault")) {
|
| | | obj2.button.value = obj.guzhang[0][i];
|
| | | // console.log(obj2.button.value)
|
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
|
| | | for (let i = 2; i < jsonData2.length; i++) {
|
| | | let arr2 = jsonData2[i];
|
| | | for (let j = 2; j < arr2.length; j++) {
|
| | | let obj3 = arr2[j];
|
| | | if (obj3.button) {
|
| | | if (obj3.button && (obj3.button.name === "未回零" || obj3.button.name === "NotZero")) {
|
| | | obj3.button.value = weihuiling[0][i];
|
| | | console.log(obj3.button.value)
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | } |
| | | |
| | | |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | this.$router.afterEach(function () {
|
| | | socket.close();
|
| | | })
|
| | | |
| | | } |
| | | }, |
| | |
| | | |
| | | |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | },
|
| | | replaceChineseWithEnglish () {
|
| | |
|
| | |
|
| | | const nameMap = this.$t('ManualonePositionlang')
|
| | | this.jsonData = this.jsonData.map((item) => {
|
| | | return item.map((obj) => {
|
| | | if (obj.name) {
|
| | | const newName = nameMap[obj.name] || obj.name;
|
| | | return { ...obj, name: newName };
|
| | | } else if (obj.button && obj.button.name) {
|
| | | const newName = nameMap[obj.button.name] || obj.button.name;
|
| | | return { ...obj, button: { ...obj.button, name: newName } };
|
| | | } else if (obj.title && obj.title.name) {
|
| | | const newName = nameMap[obj.title.name] || obj.title.name;
|
| | | return { ...obj, title: { ...obj.title, name: newName } };
|
| | | } else {
|
| | | return obj;
|
| | | }
|
| | | });
|
| | | });
|
| | |
|
| | |
|
| | |
|
| | | } |
| | | |
| | | } |
| | |
| | | .error-button { |
| | | background-color: red; |
| | | } |
| | |
|
| | | .error-button2 {
|
| | | background-color: red;
|
| | | }
|
| | | </style> |
| | |
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | | }}</router-link>
|
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | | }}</router-link> -->
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{
|
| | |
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1')
|
| | | }}</router-link>
|
| | | <!-- <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2')
|
| | | }}</router-link> -->
|
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2')
|
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{
|
| | | $t('Positioning1')
|
| | | }}</router-link>
|
| | |
| | |
|
| | | <el-row :gutter="20">
|
| | | <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex">
|
| | | <el-card class="json-block" style="width:485px;">
|
| | | <el-card class="json-block" style="width:600px;">
|
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container">
|
| | | <div class="item-row">
|
| | | <span class="name" style="width:100px;">{{ item.name }}</span>
|
| | | <span class="name" style="width:300px;">{{ item.name }}</span>
|
| | | <el-input style="width:250px;" v-if="item.state != 0 && item.type === '0'" v-model="item.value"
|
| | | class="input-box"></el-input>
|
| | | </div>
|
| | | </div>
|
| | | <div class="button-row" style="display: flex; justify-content: space-between;">
|
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex">
|
| | | <el-button v-if="item.button && item.button.state != 0" :name="item.button.name" v-model="item.button.value"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1 }"
|
| | | <el-button v-if="item.button && language === 'en-US'" :name="item.button.name" v-model="item.button.value"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1, 'error-button2': item.button.name === 'NotZero' && item.button.value === 0 }"
|
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
|
| | | item.button.name }}</el-button>
|
| | | <el-button v-if="item.button && language === 'zh-CN'" :name="item.button.name" v-model="item.button.value"
|
| | | :class="{ 'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1, 'error-button2': item.button.name === '未回零' && item.button.value === 0 }"
|
| | | @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{
|
| | | item.button.name }}</el-button>
|
| | | </div>
|
| | |
| | | mixins: [LanguageMixin],
|
| | | data () {
|
| | | return {
|
| | | jsonData: data // 加载整个data.json文件作为jsonData
|
| | | jsonData: data, // 加载整个data.json文件作为jsonData
|
| | | language: this.$i18n.locale,
|
| | | }
|
| | | },
|
| | | created () {
|
| | |
|
| | | activated () {
|
| | |
|
| | | this.initWebSocket();
|
| | | // console.log('jsonData:', this.jsonData); |
| | | const language = this.$i18n.locale;
|
| | | console.log(language);
|
| | | if (language === 'en-US') {
|
| | | this.replaceChineseWithEnglish();
|
| | | }
|
| | | this.$forceUpdate();
|
| | |
|
| | |
|
| | | },
|
| | |
|
| | | methods: {
|
| | | closeSocket () {
|
| | | // 关闭 WebSocket 连接
|
| | | socket.close();
|
| | | },
|
| | | updateButtonValue (dataGroup, itemIndex) {
|
| | | // 将当前按钮的值设为1
|
| | |
|
| | | if (dataGroup[itemIndex].button.value === 1) {
|
| | | // 如果当前按钮的值是 0,将其设为 1
|
| | | this.$set(dataGroup[itemIndex].button, 'value', 0);
|
| | | } else {
|
| | | // 否则将其设为 0
|
| | | this.$set(dataGroup[itemIndex].button, 'value', 1);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | },
|
| | | submitDataToBackend (currentButtonName) {
|
| | | if (currentButtonName === 'A01翻转启动') {
|
| | | if (currentButtonName === 'A01翻转启动' || currentButtonName === 'A01 SERVE TURN') {
|
| | | const data = [];
|
| | |
|
| | | for (let i = 0; i < 1; i++) {
|
| | |
| | |
|
| | | data.push(values);
|
| | | }
|
| | | data.push([], [], [],[]);
|
| | |
|
| | |
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | if (currentButtonName === 'A02翻转启动') {
|
| | | if (currentButtonName === 'A02翻转启动' || currentButtonName === 'A02 SERVE TURN') {
|
| | | const data = [];
|
| | |
|
| | | for (let i = 1; i < 2; i++) {
|
| | |
| | | data.unshift([]);
|
| | | data.push(values);
|
| | | }
|
| | |
|
| | | data.push([], [], []);
|
| | |
|
| | |
|
| | | const jsonObject = { data };
|
| | |
| | |
|
| | | }
|
| | |
|
| | | if (currentButtonName === '故障') {
|
| | | if (currentButtonName === '故障' || currentButtonName === 'Fault') {
|
| | |
|
| | | const data2 = [];
|
| | | const resetButtonValues = this.jsonData.map(item => {
|
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '故障');
|
| | | const buttonItem = item.find(subItem => subItem.button && ['故障', 'Fault'].includes(subItem.button.name));
|
| | |
|
| | | return buttonItem ? buttonItem.button.value : null;
|
| | | }).filter(value => value !== null);
|
| | |
|
| | |
| | | data2.push(...resetButtonValues);
|
| | | data2.unshift([], []);
|
| | | const jsonObject2 = { data2 };
|
| | | data2.push([], []);
|
| | |
|
| | | // 提交数据到后端
|
| | | const jsonString2 = JSON.stringify(jsonObject2);
|
| | |
| | |
|
| | | }
|
| | |
|
| | | if (currentButtonName === '复位') {
|
| | | if (currentButtonName === '复位' || currentButtonName === 'Reset') {
|
| | |
|
| | | const data2 = [];
|
| | | const resetButtonValues = this.jsonData.map(item => {
|
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '复位');
|
| | | const buttonItem = item.find(subItem => subItem.button && ['复位', 'Reset'].includes(subItem.button.name));
|
| | |
|
| | | return buttonItem ? buttonItem.button.value : null;
|
| | | }).filter(value => value !== null);
|
| | |
|
| | | // 将得到的值添加到 data 数组中
|
| | | data2.push(...resetButtonValues);
|
| | | data2.push(resetButtonValues.flat());
|
| | | data2.unshift([], [], []);
|
| | | const jsonObject2 = { data2 };
|
| | | const jsonObject2 = { data:data2 };
|
| | | data2.push([]);
|
| | |
|
| | | // 提交数据到后端
|
| | | const jsonString2 = JSON.stringify(jsonObject2);
|
| | |
| | |
|
| | | }
|
| | |
|
| | | if (currentButtonName === '回零') {
|
| | | if (currentButtonName === '回零' || currentButtonName === 'Zero') {
|
| | |
|
| | | const data2 = [];
|
| | | const resetButtonValues = this.jsonData.map(item => {
|
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '回零');
|
| | | const buttonItem = item.find(subItem => subItem.button && ['回零', 'Zero'].includes(subItem.button.name));
|
| | |
|
| | | return buttonItem ? buttonItem.button.value : null;
|
| | | }).filter(value => value !== null);
|
| | |
|
| | | // 将得到的值添加到 data 数组中
|
| | | data2.push(...resetButtonValues);
|
| | | data2.push(resetButtonValues.flat());
|
| | | data2.unshift([], [], [], []);
|
| | | const jsonObject2 = { data2 };
|
| | |
|
| | | const jsonObject2 = { data:data2 };
|
| | | // 提交数据到后端
|
| | | const jsonString2 = JSON.stringify(jsonObject2);
|
| | | console.log('所有Type为0的value:', jsonString2);
|
| | |
| | | let obj = JSON.parse(msg.data);
|
| | | // console.log(obj)
|
| | | const jsonData2 = this.jsonData;
|
| | |
|
| | | const weihuiling = obj.weihuiling;
|
| | | const handleMouseMove = throttle(function (event) {
|
| | | const inputBox = document.querySelectorAll('.el-card__body');
|
| | | const target = event.target;
|
| | |
| | | });
|
| | |
|
| | | // 遍历guzhang数组
|
| | | for (let i = 0; i < obj.guzhang[0].length; i++) {
|
| | | const guzhangValue = obj.guzhang[0][i];
|
| | |
|
| | | // 查找jsonData2中带有"button"的对象,并且name等于"故障"
|
| | | for (let j = 0; j < jsonData2.length; j++) {
|
| | | const section = jsonData2[j];
|
| | |
|
| | | for (let k = 0; k < section.length; k++) {
|
| | | const item = section[k];
|
| | |
|
| | | if (item.button && item.button.name === "故障") {
|
| | | // 更新value属性
|
| | | item.button.value = guzhangValue;
|
| | | break;
|
| | | for (let i = 0; i < jsonData2.length; i++) {
|
| | | let arr = jsonData2[i];
|
| | | for (let j = 0; j < arr.length; j++) {
|
| | | let obj2 = arr[j];
|
| | | if (obj2.button && (obj2.button.name === "故障" || obj2.button.name === "Fault")) {
|
| | | obj2.button.value = obj.guzhang[0][i];
|
| | | // console.log(obj2.button.value)
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | for (let i = 0; i < jsonData2.length; i++) {
|
| | | let arr2 = jsonData2[i];
|
| | | for (let j = 0; j < arr2.length; j++) {
|
| | | let obj3 = arr2[j];
|
| | | if (obj3.button) {
|
| | | if (obj3.button && (obj3.button.name === "未回零" || obj3.button.name === "NotZero")) {
|
| | | obj3.button.value = weihuiling[0][i];
|
| | | // console.log(obj3.button.value)
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | }
|
| | | }, 200);
|
| | | }, 50);
|
| | |
|
| | | document.addEventListener('mouseover', handleMouseMove);
|
| | | };
|
| | |
| | | socket.onerror = function () {
|
| | | console.log("websocket发生了错误");
|
| | | };
|
| | | this.$router.afterEach(function () {
|
| | | socket.close();
|
| | | })
|
| | |
|
| | | }
|
| | | },
|
| | |
| | |
|
| | |
|
| | | socket?.send(JSON.stringify(this.messagepack));
|
| | | },
|
| | | replaceChineseWithEnglish () {
|
| | |
|
| | |
|
| | | const nameMap = this.$t('Manualoneposition2lang')
|
| | | this.jsonData = this.jsonData.map((item) => {
|
| | | return item.map((obj) => {
|
| | | if (obj.name) {
|
| | | const newName = nameMap[obj.name] || obj.name;
|
| | | return { ...obj, name: newName };
|
| | | } else if (obj.button && obj.button.name) {
|
| | | const newName = nameMap[obj.button.name] || obj.button.name;
|
| | | return { ...obj, button: { ...obj.button, name: newName } };
|
| | | } else if (obj.title && obj.title.name) {
|
| | | const newName = nameMap[obj.title.name] || obj.title.name;
|
| | | return { ...obj, title: { ...obj.title, name: newName } };
|
| | | } else {
|
| | | return obj;
|
| | | }
|
| | | });
|
| | | });
|
| | |
|
| | |
|
| | | console.log(this.jsonData)
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | .blue-button {
|
| | | background-color: skyblue;
|
| | | }
|
| | |
|
| | | .error-button {
|
| | | background-color: red;
|
| | | }
|
| | |
|
| | | .error-button2 {
|
| | | background-color: red;
|
| | | }
|
| | | </style> |
| | |
| | | this.isButtonDisabled = true;
|
| | |
|
| | | },
|
| | | mounted() {
|
| | | window.addEventListener('beforeunload', this.closeSocket);
|
| | | },
|
| | |
|
| | | beforeUnmount() {
|
| | | window.removeEventListener('beforeunload', this.closeSocket);
|
| | | },
|
| | | methods: {
|
| | | closeSocket() {
|
| | | // 关闭 WebSocket 连接
|
| | | socket.close();
|
| | | },
|
| | | showdata () {
|
| | |
|
| | |
|
| | |
| | | socket.onerror = function () {
|
| | | console.log("websocket发生了错误");
|
| | | };
|
| | | this.$router.afterEach(function(){
|
| | | socket.close();
|
| | | })
|
| | | }
|
| | | },
|
| | | send () {
|
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | |
| | | return { |
| | | jsonData: data // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, created () { |
| | | }, |
| | | activated(){ |
| | | |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | const language = this.$i18n.locale; |
| | | console.log(language); |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | | } |
| | | this.$forceUpdate(); |
| | | |
| | | }, |
| | | methods: { |
| | |
| | | const parms = obj.params; |
| | | const fanzhuan = obj.fanzhuan; |
| | | const xiaoche = obj.xiaoche; |
| | | console.log(obj); |
| | | // console.log(obj); |
| | | // console.log('parms:', parms); |
| | | // console.log('fanzhuan:', fanzhuan); |
| | | // console.log('xiaoche:', xiaoche); |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 关闭事件 |
| | | socket.onclose = function () { |
| | | console.log("websocket已关闭"); |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | |
| | | this.$router.afterEach(function(){ |
| | | socket.close(); |
| | | }) |
| | | |
| | | } |
| | | |
| | | }, |
| | | replaceChineseWithEnglish () { |
| | | const translation = this.$t('Parameter1'); |
| | | this.jsonData = this.jsonData.map(item => { return { name: translation[item.name] || item.name, value: item.value }; }); |
| | | // console.log(translation); |
| | | |
| | | |
| | | const nameMap= this.$t('langParameter1') |
| | | |
| | | this.jsonData = this.jsonData.map((item) => { |
| | | return item.map((obj) => { |
| | | if (obj.name) { |
| | | const newName = nameMap[obj.name] || obj.name; |
| | | return { ...obj, name: newName }; |
| | | } else if (obj.button && obj.button.name) { |
| | | const newName = nameMap[obj.button.name] || obj.button.name; |
| | | return { ...obj, button: { ...obj.button, name: newName } }; |
| | | } else if (obj.title && obj.title.name) { |
| | | const newName = nameMap[obj.title.name] || obj.title.name; |
| | | return { ...obj, title: { ...obj.title, name: newName } }; |
| | | } else { |
| | | return obj; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | // console.log(this.jsonData) |
| | | |
| | | }, |
| | | send () { |
| | | |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual') |
| | |
| | | </el-breadcrumb> |
| | | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" active-class="blue-button">{{ $t('Servomanualone') |
| | | <router-link to="/Electrical/Servomanualone" tag="el-button" type="text" @click="closeSocket()" active-class="blue-button">{{ $t('Servomanualone') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1') |
| | | }}</router-link> |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/ManualonePosition" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ManualonePosition') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ManualonePosition2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('AutomaticParameterSetting') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ManualJog') |
| | | }}</router-link> |
| | | </el-breadcrumb> |
| | | |
| | | <el-row :gutter="40"> |
| | | <el-col :span="6" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" style="margin-bottom: -20px;"> |
| | | <el-card class="json-block" style="width:260px;margin-bottom: 2px;"> |
| | | <el-card class="json-block" style="width:300px;margin-bottom: 2px;"> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <span v-if="item.title" :name="item.title.name" class="action-button" >{{ item.title.name }}</span> |
| | |
| | | |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" class="action-button" |
| | | <el-button v-if="item.button && language==='en-US'" :name="item.button.name" v-model="item.button.value" class="action-button" |
| | | @click="updateButtonValue(dataGroup, itemIndex);submitDataToBackend(item.button.name)" |
| | | :class="{ 'green-button': item.button.value === 0 && item.button.name !== '清除ID','red-button': item.button.value === 2 && item.button.name !== '清除ID' ,'yellow-button': item.button.value === 1 && item.button.name !== '清除ID' }">{{ item.button.name }}</el-button> |
| | | :class="{ 'green-button': (item.button.value === 0 && item.button.name !== 'Clear ID' ) ,'red-button': item.button.value === 2 && (item.button.name !== 'Clear ID' ) ,'yellow-button': item.button.value === 1 && (item.button.name !== 'Clear ID' ) }">{{ item.button.name }}</el-button> |
| | | |
| | | |
| | | <el-button v-if="item.button && language==='zh-CN'" :name="item.button.name" v-model="item.button.value" class="action-button" |
| | | @click="updateButtonValue(dataGroup, itemIndex);submitDataToBackend(item.button.name)" |
| | | :class="{ 'green-button': (item.button.value === 0 && item.button.name !== '清除ID' ) ,'red-button': item.button.value === 2 && (item.button.name !== '清除ID' ) ,'yellow-button': item.button.value === 1 && (item.button.name !== '清除ID' ) }">{{ item.button.name }}</el-button> |
| | | |
| | | </div> |
| | | </div> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container"> |
| | | <div class="item-row"> |
| | | |
| | | <span class="name" style="width:150px;">{{ item.name }}</span> |
| | | |
| | | <span class="name" v-if="groupIndex === 13" style="width:250px;">{{ item.name }}</span> |
| | | <span class="name" v-else style="width:150px;">{{ item.name }}</span> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:400px;" class="input-box"></el-input> |
| | | |
| | | |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | import data from '../../configuration/parameter2' |
| | | let socket; |
| | | |
| | | // window.onload=function(){ |
| | | // console.log("44"); |
| | | // } |
| | | export default { |
| | | destroyed() { |
| | | socket.close(); |
| | |
| | | data() { |
| | | return { |
| | | jsonData: data , |
| | | inputValue: '', |
| | | language:this.$i18n.locale, |
| | | |
| | | // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | |
| | | activated(){ |
| | | |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | this.filteredData(); |
| | | const language = this.$i18n.locale; |
| | | console.log(language); |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | | } |
| | | this.$forceUpdate(); |
| | | }, |
| | | |
| | | |
| | | computed: { |
| | | |
| | | |
| | | }, |
| | | |
| | | |
| | | |
| | | methods: { |
| | | filteredData() { |
| | | return this.jsonData.map(item => { |
| | | const filteredValue = item.map(obj => { |
| | | if (typeof obj.button !== 'undefined' && typeof obj.button.value !== 'undefined') { |
| | | obj.button.value = obj.button.value.toString().replace(/[^a-zA-Z0-9]/g, ''); |
| | | } else if (typeof obj.value !== 'undefined') { |
| | | obj.value = obj.value.toString().replace(/[^a-zA-Z0-9]/g, ''); |
| | | } |
| | | return obj; |
| | | }); |
| | | return filteredValue; |
| | | }); |
| | | }, |
| | | |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | // 将当前按钮的值设为1 |
| | | |
| | | if (dataGroup[itemIndex].button.value === 1) { |
| | | // 如果当前按钮的值是 0,将其设为 1 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 0); |
| | | } else { |
| | | // 否则将其设为 0 |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | |
| | | // 将其他按钮的值全部设为0 |
| | | |
| | | } |
| | | }, |
| | | submitDataToBackend(currentButtonName) { |
| | | if (currentButtonName === '清除ID') { |
| | | const inputData = this.jsonData.map(dataGroup => { |
| | | return dataGroup.map(item => { |
| | | if (item.type === '3') { |
| | | return { value: item.button.value }; |
| | | } |
| | | return null; |
| | | }); |
| | | }); |
| | | |
| | | const values = inputData.flat().filter(item => item !== null).map(item => item.value); |
| | | const jsonObject = { data: values }; |
| | | |
| | | |
| | | if (currentButtonName === '清除ID' || currentButtonName === 'Clear ID' ) { |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && ['清除ID', 'Clear ID'].includes(subItem.button.name)); |
| | | |
| | | |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(resetButtonValues.flat()); |
| | | |
| | | // 在 data2 数组前面添加两个空数组 |
| | | |
| | | |
| | | // 创建 jsonObject2 对象,并添加 data2 属性 |
| | | const jsonObject2 = { data: data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('Type为3的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | window.location.reload(); |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有Type为0的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | |
| | | |
| | | } |
| | | }, |
| | | initWebSocket () { |
| | |
| | | let obj = JSON.parse(msg.data); |
| | | |
| | | const jsonData2 = this.jsonData; |
| | | |
| | | // console.log(jsonData2); |
| | | // 如果鼠标不在输入框内,更新输入框的值 |
| | | // this.submitDataToBackend() |
| | | const parms = obj.params; |
| | | // const xiaoche = obj.params[3]; |
| | | |
| | | // console.log(parms); |
| | | // console.log(obj); |
| | | //清除id |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | |
| | | let obj = arr[j]; |
| | | if (obj.type === '3') { |
| | | obj.button.value = parms[0][i]; |
| | | // console.log(obj.button.value); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | //ID |
| | | const specialChars = /[^\w\s]/g; // 正则表达式匹配非字母、数字、下划线和空格的字符 |
| | | |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj = arr[j]; |
| | | |
| | | if (obj.type === '0') { |
| | | obj.value = parms[1][i]; |
| | | if (parms[1] && parms[1][i]) { |
| | | obj.value = parms[1][i].replace(specialChars, ''); |
| | | // console.log(obj.value); |
| | | } |
| | | if (obj.name === 'ID2') { |
| | | obj.value = parms[1][7].replace(specialChars, ''); // 将ID2对应的值赋为parms[1][6] |
| | | } |
| | | |
| | | if (obj.name === 'A02ID') { |
| | | obj.value = parms[1][8].replace(specialChars, ''); // 将ID2对应的值赋为parms[1][6] |
| | | } |
| | | if (obj.name === 'B01ID') { |
| | | obj.value = parms[1][9].replace(specialChars, ''); // 将ID2对应的值赋为parms[1][6] |
| | | } |
| | | if (obj.name === 'B02ID') { |
| | | obj.value = parms[1][10].replace(specialChars, ''); // 将ID2对应的值赋为parms[1][6] |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | //手动状态 |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | |
| | | |
| | | } |
| | | //扫描枪扫码的ID |
| | | |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 66) { |
| | | subItem.value = parms[3][0]; |
| | | subItem.value = parms[3][0].replace(specialChars, ''); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 666) { |
| | | subItem.value = parms[3][1].replace(specialChars, ''); |
| | | } |
| | | }); |
| | | }); |
| | |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | |
| | | this.$router.afterEach(function(){ |
| | | socket.close(); |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | replaceChineseWithEnglish() { |
| | | |
| | | |
| | | const nameMap= this.$t('langParameter2') |
| | | this.jsonData = this.jsonData.map((item) => { |
| | | return item.map((obj) => { |
| | | if (obj.name) { |
| | | const newName = nameMap[obj.name] || obj.name; |
| | | return { ...obj, name: newName }; |
| | | } else if (obj.button && obj.button.name) { |
| | | const newName = nameMap[obj.button.name] || obj.button.name; |
| | | return { ...obj, button: { ...obj.button, name: newName } }; |
| | | } else { |
| | | return obj; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | // console.log(this.jsonData) |
| | | |
| | | }, |
| | | send () { |
| | | |
| | | |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | |
| | | jsonData: data // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | activated(){ |
| | | |
| | | this.initWebSocket (); |
| | | const language = this.$i18n.locale; |
| | | console.log(language); |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | | } |
| | | this.$forceUpdate(); |
| | | }, |
| | | methods: { |
| | | updateButtonValue (dataGroup, itemIndex) { |
| | |
| | | // 如果鼠标不在输入框内,更新输入框的值 |
| | | // this.submitDataToBackend() |
| | | const parms = obj.params; |
| | | console.log(parms) |
| | | // console.log(parms) |
| | | |
| | | |
| | | let index = 0; |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | this.$router.afterEach(function(){ |
| | | socket.close(); |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | replaceChineseWithEnglish() { |
| | | |
| | | |
| | | const nameMap= this.$t('langPositioning1') |
| | | this.jsonData = this.jsonData.map((item) => { |
| | | return item.map((obj) => { |
| | | if (obj.name) { |
| | | const newName = nameMap[obj.name] || obj.name; |
| | | return { ...obj, name: newName }; |
| | | } else if (obj.button && obj.button.name) { |
| | | const newName = nameMap[obj.button.name] || obj.button.name; |
| | | return { ...obj, button: { ...obj.button, name: newName } }; |
| | | } else if (obj.title && obj.title.name) { |
| | | const newName = nameMap[obj.title.name] || obj.title.name; |
| | | return { ...obj, title: { ...obj.title, name: newName } }; |
| | | } else { |
| | | return obj; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | // console.log(this.jsonData) |
| | | |
| | | }, |
| | | send () { |
| | | |
| | | |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | |
| | | jsonData: data // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | activated(){ |
| | | |
| | | this.initWebSocket (); |
| | | const language = this.$i18n.locale; |
| | | console.log(language); |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | | } |
| | | this.$forceUpdate(); |
| | | }, |
| | | methods: { |
| | | updateButtonValue (dataGroup, itemIndex) { |
| | |
| | | // this.submitDataToBackend() |
| | | const parms = obj.params; |
| | | |
| | | console.log(parms) |
| | | // console.log(parms) |
| | | let index = 0; |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | this.$router.afterEach(function(){ |
| | | socket.close(); |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | replaceChineseWithEnglish() { |
| | | |
| | | |
| | | const nameMap= this.$t('langPositioning2') |
| | | this.jsonData = this.jsonData.map((item) => { |
| | | return item.map((obj) => { |
| | | if (obj.name) { |
| | | const newName = nameMap[obj.name] || obj.name; |
| | | return { ...obj, name: newName }; |
| | | } else if (obj.button && obj.button.name) { |
| | | const newName = nameMap[obj.button.name] || obj.button.name; |
| | | return { ...obj, button: { ...obj.button, name: newName } }; |
| | | } else if (obj.title && obj.title.name) { |
| | | const newName = nameMap[obj.title.name] || obj.title.name; |
| | | return { ...obj, title: { ...obj.title, name: newName } }; |
| | | } else { |
| | | return obj; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | // console.log(this.jsonData) |
| | | |
| | | }, |
| | | send () { |
| | | |
| | | |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual') |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter1" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter1') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter2') |
| | | <router-link to="/Electrical/Parameter2" tag="el-button" type="text" @click="closeSocket()" active-class="blue-button">{{ $t('Parameter2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning1" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning1') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Positioning2" tag="el-button" type="text" active-class="blue-button">{{ $t('Positioning2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/ManualonePosition" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ManualonePosition') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/ManualonePosition2" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ManualonePosition2') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/AutomaticParameterSetting" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('AutomaticParameterSetting') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/ManualJog" tag="el-button" type="text" active-class="blue-button">{{ |
| | | $t('ManualJog') |
| | | }}</router-link> |
| | | </el-breadcrumb> |
| | | |
| | |
| | | </el-row> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | |
| | | <el-button v-if="item.button && language === 'en-US' " :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === 'Fault' && item.button.value === 1,'error-button2': item.button.name === 'NotZero' && item.button.value === 0}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | <el-button v-if="item.button && language === 'zh-CN' " :name="item.button.name" v-model="item.button.value" :class="{'action-button': true, 'error-button': item.button.name === '故障' && item.button.value === 1,'error-button2': item.button.name === '未回零' && item.button.value === 0}" @click="updateButtonValue(dataGroup, itemIndex); submitDataToBackend(item.button.name);">{{ item.button.name }}</el-button> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | |
| | | data() { |
| | | return { |
| | | jsonData: data , |
| | | |
| | | language:this.$i18n.locale, |
| | | // 加载整个data.json文件作为jsonData |
| | | } |
| | | }, |
| | | created () { |
| | | |
| | | activated(){ |
| | | |
| | | this.initWebSocket(); |
| | | // console.log('jsonData:', this.jsonData); |
| | | const language = this.$i18n.locale; |
| | | console.log(language); |
| | | if (language === 'en-US') { |
| | | this.replaceChineseWithEnglish(); |
| | | } |
| | | this.$forceUpdate(); |
| | | |
| | | |
| | | }, |
| | | |
| | | // destroyed(){ |
| | | // this.close(); |
| | | // this.$router.go(0); |
| | | // }, |
| | | methods: { |
| | | closeSocket() { |
| | | // 关闭 WebSocket 连接 |
| | | socket.close(); |
| | | }, |
| | | |
| | | |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | |
| | | // }); |
| | | }, |
| | | submitDataToBackend(currentButtonName) { |
| | | if (currentButtonName === 'A01半自动启动') { |
| | | if (currentButtonName === 'A01半自动启动' ||currentButtonName === 'A01 Semi-Auto Start') { |
| | | const data = []; |
| | | |
| | | for (let i = 0; i < 1; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read !== 9999).map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | |
| | | data.push(values); |
| | | |
| | | } |
| | | |
| | | |
| | | data.push([], [], []); |
| | | |
| | | for (let i = 0; i < 1; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read == 9999).map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values = inputData.map(item => item.value); |
| | | |
| | | data.push(values); |
| | | |
| | | } |
| | | data.push([]); |
| | | |
| | | const jsonObject = { data }; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === 'A02半自动启动') { |
| | | if (currentButtonName === 'A02半自动启动' ||currentButtonName === 'A02 Semi-Auto Start') { |
| | | const data2 = []; |
| | | |
| | | for (let i = 1; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read !== 8888).map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | |
| | | |
| | | } |
| | | data2.unshift([]); |
| | | |
| | | data2.push([], [], []); |
| | | |
| | | for (let i = 1; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0' && item.read == 8888).map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | const values2 = inputData.map(item => item.value); |
| | | |
| | | data2.push(values2); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | const jsonObject = { data:data2 }; |
| | | |
| | | // 提交数据到后端 |
| | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '复位') { |
| | | if (currentButtonName === '复位' || currentButtonName === 'Reset') { |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '复位'); |
| | | const buttonItem = item.find(subItem => subItem.button && ['复位', 'Reset'].includes(subItem.button.name)); |
| | | |
| | | |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有Type为0的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | window.location.reload(); |
| | | setTimeout(()=> |
| | | window.location.reload(),2000 |
| | | ) |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '回零') { |
| | | if (currentButtonName === '回零' || currentButtonName === 'Home') { |
| | | const data3 = []; |
| | | const resetButtonValues3 = this.jsonData.map(item => { |
| | | const buttonItem3 = item.find(subItem => subItem.button && subItem.button.name === '回零'); |
| | | const buttonItem3 = item.find(subItem => subItem.button && ['回零', 'Home'].includes(subItem.button.name)); |
| | | |
| | | return buttonItem3 ? buttonItem3.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | |
| | | const jsonString3 = JSON.stringify(jsonObject3); |
| | | console.log('回零:', jsonString3); |
| | | socket?.send(jsonString3); |
| | | window.location.reload(); |
| | | setTimeout(()=> |
| | | window.location.reload(),2000 |
| | | ) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (currentButtonName === 'A01半自动') { |
| | | if (currentButtonName === 'A01半自动' || currentButtonName === 'A01 Semi-Auto' ) { |
| | | const elements = document.getElementsByClassName('special-class'); |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (currentButtonName === 'A02半自动') { |
| | | if (currentButtonName === 'A02半自动' || currentButtonName === 'A02 Semi-Auto' ) { |
| | | const elements = document.getElementsByClassName('special-class2'); |
| | | for (let i = 0; i < elements.length; i++) { |
| | | if (elements[i].style.display === 'none') { |
| | |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | console.log(obj) |
| | | // console.log(obj) |
| | | const weihuiling=obj.weihuiling; |
| | | const jsonData2 = this.jsonData; |
| | | |
| | | const handleMouseMove = throttle(function(event) { |
| | |
| | | // 执行更新逻辑 |
| | | for (let i = 0; i < 6; i++) { |
| | | jsonData2[i].forEach((item, index) => { |
| | | if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i+1}`][0][index] !== 'undefined') { |
| | | if (typeof item.value !== 'undefined' && typeof obj[`zuhe${i+1}`][0][index] !== 'undefined'&& item.read !== '9999' && item.read !== '8888') { |
| | | item.value = obj[`zuhe${i+1}`][0][index]; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 遍历guzhang数组 |
| | | for (let i = 0; i < obj.guzhang[0].length; i++) { |
| | | const guzhangValue = obj.guzhang[0][i]; |
| | | |
| | | // 查找jsonData2中带有"button"的对象,并且name等于"故障" |
| | | for (let j = 0; j < jsonData2.length; j++) { |
| | | const section = jsonData2[j]; |
| | | |
| | | for (let k = 0; k < section.length; k++) { |
| | | const item = section[k]; |
| | | |
| | | if (item.button && item.button.name === "故障") { |
| | | // 更新value属性 |
| | | item.button.value = guzhangValue; |
| | | break; |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | | let obj2 = arr[j]; |
| | | if (obj2.button && (obj2.button.name === "故障" || obj2.button.name === "Fault")) { |
| | | obj2.button.value = obj.guzhang[0][i]; |
| | | // console.log(obj2.button.value) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | for (let i = 3; i < jsonData2.length; i++) { |
| | | let arr2 = jsonData2[i]; |
| | | for (let j = 3; j < arr2.length; j++) { |
| | | let obj3 = arr2[j]; |
| | | if(obj3.button){ |
| | | if (obj3.button && (obj3.button.name === "未回零" || obj3.button.name === "NotZero" )) { |
| | | obj3.button.value = weihuiling[0][i]; |
| | | // console.log(obj3.button.value) |
| | | } |
| | | |
| | | for (let i = 0; i < obj.weihuiling[0].length; i++) { |
| | | const weihuilingValue = obj.weihuiling[0][i]; |
| | | |
| | | // 查找jsonData2中带有"button"的对象,并且name等于"故障" |
| | | for (let j = 0; j < jsonData2.length; j++) { |
| | | const section = jsonData2[j]; |
| | | |
| | | for (let k = 0; k < section.length; k++) { |
| | | const item = section[k]; |
| | | |
| | | if (item.button && item.button.name === "未回零") { |
| | | // 更新value属性 |
| | | item.button.value = weihuilingValue; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | // console.log(jsonData2) |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 9999) { |
| | | subItem.value = obj.jinpianid[0]; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 8888) { |
| | | subItem.value = obj.qupianid[0]; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | |
| | | } |
| | | }, 500); |
| | | }, 50); |
| | | |
| | | document.addEventListener('mouseover', handleMouseMove); |
| | | |
| | | }; |
| | | |
| | | |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | }; |
| | | this.$router.afterEach(function(){ |
| | | socket.close(); |
| | | }) |
| | | |
| | | } |
| | | }, |
| | |
| | | |
| | | |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | }, |
| | | replaceChineseWithEnglish() { |
| | | |
| | | |
| | | const nameMap= this.$t('ServoManualone') |
| | | this.jsonData = this.jsonData.map((item) => { |
| | | return item.map((obj) => { |
| | | if (obj.name) { |
| | | const newName = nameMap[obj.name] || obj.name; |
| | | return { ...obj, name: newName }; |
| | | } else if (obj.button && obj.button.name) { |
| | | const newName = nameMap[obj.button.name] || obj.button.name; |
| | | return { ...obj, button: { ...obj.button, name: newName } }; |
| | | } else if (obj.title && obj.title.name) { |
| | | const newName = nameMap[obj.title.name] || obj.title.name; |
| | | return { ...obj, title: { ...obj.title, name: newName } }; |
| | | } else { |
| | | return obj; |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | // console.log(this.jsonData) |
| | | |
| | | }, |
| | | |
| | | } |
| | | } |
| | |
| | | background-color: red; |
| | | } |
| | | |
| | | .error-button2 { |
| | | background-color: red; |
| | | } |
| | | |
| | | |
| | | </style> |
| | |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | | }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ |
| | |
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | | }}</router-link>
|
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | | }}</router-link> -->
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
|
| | |
| | | }
|
| | | },
|
| | | created () {
|
| | | this.init();
|
| | | |
| | | //this.showdata();
|
| | | },
|
| | | activated(){
|
| | | this.init();
|
| | |
|
| | | },
|
| | | methods: {
|
| | | showdata () {
|
| | | console.log(1111);
|
| | |
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | | }}</router-link>
|
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | | }}</router-link> -->
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual')
|
| | |
| | |
|
| | | }
|
| | | },
|
| | | created () {
|
| | | // created () {
|
| | | // this.init();
|
| | | // this.replaceChineseWithEnglish();
|
| | | // },
|
| | |
|
| | | activated(){
|
| | | this.init();
|
| | | this.replaceChineseWithEnglish();
|
| | | },
|
| | | |
| | | methods: {
|
| | | onButtonClick () {
|
| | | this.isButtonClicked = true; // 将按钮颜色设置为蓝色
|
| | |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') }}</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') }}</router-link> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') }}</router-link> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') }}</router-link> |
| | | <router-link to="/Electrical/Servomanual" tag="el-button" type="text" active-class="blue-button">{{ $t('Servo Manual') |
| | | }}</router-link> |
| | |
| | | |
| | | |
| | | }, |
| | | created () { |
| | | // created () { |
| | | // this.init(); |
| | | |
| | | |
| | | // if (this.shijian1 == "" || this.shijian2 == "") { |
| | | // //查询当天报警信息 |
| | | // this.load(); |
| | | // } |
| | | // else { |
| | | // //根据时间查询报警信息 |
| | | // this.selectTime(); |
| | | // } |
| | | |
| | | // }, |
| | | activated(){ |
| | | |
| | | this.init(); |
| | | |
| | | |
| | | if (this.shijian1 == "" || this.shijian2 == "") { |
| | | //查询当天报警信息 |
| | | this.load(); |
| | |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | } |
| | | this.$router.afterEach(function(){ |
| | | socket.close(); |
| | | }) |
| | | } |
| | | |
| | | }, |
| | |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.google.code.gson</groupId> |
| | | <artifactId>gson</artifactId> |
| | | <version>2.8.7</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | <version>2.10.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | |
| | | // Integer Plccount = this.count;
|
| | |
|
| | | // System.out.println(stt);
|
| | | List<Boolean> arraylist = S7control.getinstance().ReadBits("DB101.0.0", 16);
|
| | | List<Boolean> arraylist2 = S7control.getinstance().ReadBits("DB101.2.6", 8);
|
| | |
|
| | | List<String> addressList0 = new ArrayList<>();
|
| | | addressList0.add("DB101.2.6");
|
| | | addressList0.add("DB101.2.7");
|
| | | addressList0.add("DB101.3.0");
|
| | | addressList0.add("DB101.3.1");
|
| | | addressList0.add("DB101.3.2");
|
| | | addressList0.add("DB101.3.3");
|
| | | addressList0.add("DB101.3.4");
|
| | | addressList0.add("DB101.3.5");
|
| | |
|
| | | List<String> addressList21 = new ArrayList<>();
|
| | | addressList21.add("DB101.0.0");
|
| | | addressList21.add("DB101.0.1");
|
| | | addressList21.add("DB101.0.2");
|
| | | addressList21.add("DB101.0.3");
|
| | | addressList21.add("DB101.0.4");
|
| | | addressList21.add("DB101.0.5");
|
| | | addressList21.add("DB101.0.6");
|
| | | addressList21.add("DB101.0.7");
|
| | | addressList21.add("DB101.1.0");
|
| | | addressList21.add("DB101.1.1");
|
| | | addressList21.add("DB101.1.2");
|
| | | addressList21.add("DB101.1.3");
|
| | | addressList21.add("DB101.1.4");
|
| | | addressList21.add("DB101.1.5");
|
| | | addressList21.add("DB101.1.6");
|
| | | addressList21.add("DB101.1.7");
|
| | | List<Boolean> arraylist = S7control.getinstance().readBits(addressList21);
|
| | | List<Boolean> arraylist2 = S7control.getinstance().readBits(addressList0);
|
| | | List<Boolean> arraylist3 = S7control.getinstance().ReadBits("DB101.5.2", 2);
|
| | | // Boolean[] values1 = { false, true, true, true, false, false, true, false,
|
| | | // false, true, true, true, false, false,
|
| | |
| | |
|
| | | jsonObject.append("params", params);
|
| | |
|
| | | // System.out.println("messageValue:" + arraylist +"messageValue2:" + arraylist2 );
|
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualJog");
|
| | | if (sendwServer != null) {
|
| | | sendwServer.sendMessage(jsonObject.toString());
|
| | |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("ManualJog");
|
| | |
|
| | | if (webSocketServer != null) {
|
| | | String addressList1 = "DB101.0.0";
|
| | | String addressList2 = "DB101.2.6";
|
| | | // String addressList1 = "DB101.0.0";
|
| | | // String addressList2 = "DB101.2.6";
|
| | | String addressList3 = "DB101.5.2";
|
| | |
|
| | |
|
| | | List<String> addressList2 = new ArrayList<>();
|
| | | addressList2.add("DB101.2.6");
|
| | | addressList2.add("DB101.2.7");
|
| | | addressList2.add("DB101.3.0");
|
| | | addressList2.add("DB101.3.1");
|
| | | addressList2.add("DB101.3.2");
|
| | | addressList2.add("DB101.3.3");
|
| | | addressList2.add("DB101.3.4");
|
| | | addressList2.add("DB101.3.5");
|
| | |
|
| | |
|
| | | List<String> addressList211 = new ArrayList<>();
|
| | | addressList211.add("DB101.0.0");
|
| | | addressList211.add("DB101.0.1");
|
| | | addressList211.add("DB101.0.2");
|
| | | addressList211.add("DB101.0.3");
|
| | | addressList211.add("DB101.0.4");
|
| | | addressList211.add("DB101.0.5");
|
| | | addressList211.add("DB101.0.6");
|
| | | addressList211.add("DB101.0.7");
|
| | | addressList211.add("DB101.1.0");
|
| | | addressList211.add("DB101.1.1");
|
| | | addressList211.add("DB101.1.2");
|
| | | addressList211.add("DB101.1.3");
|
| | | addressList211.add("DB101.1.4");
|
| | | addressList211.add("DB101.1.5");
|
| | | addressList211.add("DB101.1.6");
|
| | | addressList211.add("DB101.1.7");
|
| | |
|
| | | List<String> addressList311 = new ArrayList<>();
|
| | | addressList311.add("DB101.5.2");
|
| | | addressList311.add("DB101.5.3");
|
| | |
|
| | | List<String> messages = webSocketServer.getMessages();
|
| | | if (!messages.isEmpty()) {
|
| | |
| | | // System.out.println(bolList2);
|
| | | // System.out.println(bolList3);
|
| | | if (!bolList.isEmpty()) {
|
| | | S7control.getinstance().WriteBit(addressList1, bolList);
|
| | | System.out.println("messageValue:" + bolList + " written to PLC at address " + addressList1);
|
| | | S7control.getinstance().WriteBit(addressList211, bolList);
|
| | | System.out.println("messageValue:" + bolList + " written to PLC at address " + addressList211);
|
| | | }
|
| | | if (!bolList2.isEmpty()) {
|
| | | S7control.getinstance().WriteBit(addressList2, bolList2);
|
| | | System.out.println("messageValue:" + bolList2 + " written to PLC at address " + addressList2);
|
| | | }
|
| | | if (!bolList3.isEmpty()) {
|
| | | S7control.getinstance().WriteBit(addressList3, bolList3);
|
| | | System.out.println("messageValue:" + bolList3 + " written to PLC at address " + addressList3);
|
| | | S7control.getinstance().WriteBit(addressList311, bolList3);
|
| | | System.out.println("messageValue:" + bolList3 + " written to PLC at address " + addressList311);
|
| | | }
|
| | | webSocketServer.clearMessages();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | // Integer Plccount = this.count; |
| | | |
| | | // System.out.println(stt); |
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 72); |
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 60); |
| | | List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10); |
| | | // Short[] values1 = { 1231, 1, 1, 1, 1, 1, 2, 33, 2, 3, 4, 5 ,1231, 1, 1, 1, 1, 1, 2, 33, 2, 3, 4, 5 }; |
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | |
| | | |
| | | |
| | | List<String> addressList1 = new ArrayList<>(); |
| | | // addressList1.add("DB103.32~45"); |
| | | // addressList1.add("DB103.46~59"); |
| | | // addressList1.add("DB103.60~73"); |
| | | // addressList1.add("DB103.74~101"); |
| | | // addressList1.add("DB103.102~115"); |
| | | // addressList1.add("DB103.116~143"); |
| | | // addressList1.add("DB103.144~157"); |
| | | // addressList1.add("DB103.158~171"); |
| | | // addressList1.add("DB103.172~185"); |
| | | // addressList1.add("DB103.200~213"); |
| | | // addressList1.add("DB103.228~241"); |
| | | |
| | | addressList1.add("DB103.44");//D01 |
| | | addressList1.add("DB103.58");//D02 |
| | | addressList1.add("DB103.72");//D03 |
| | |
| | | addressList1.add("DB103.100");//D05 |
| | | addressList1.add("DB103.114");//D06 |
| | | addressList1.add("DB103.128");//A01 |
| | | addressList1.add("DB103.156");//A01 2 |
| | | addressList1.add("DB103.142");//A02 |
| | | addressList1.add("DB103.212");//B01 |
| | | addressList1.add("DB103.184");//B02 |
| | | addressList1.add("DB103.142");//A01 2 |
| | | addressList1.add("DB103.156");//A02 |
| | | addressList1.add("DB103.184");//B01 |
| | | addressList1.add("DB103.212");//B02 |
| | | |
| | | |
| | | List<String> paramlist = S7control.getinstance().readStrings(addressList1); |
| | | |
| | | |
| | | |
| | | List<String> addresses = new ArrayList<>(); |
| | |
| | | addresses.add("DB103.6"); |
| | | List<Short> data = S7control.getinstance().readWords(addresses); |
| | | |
| | | List<String> addressList0 = new ArrayList<>(); |
| | | |
| | | addressList0.add("DB101.9.2"); |
| | | addressList0.add("DB101.9.3"); |
| | | addressList0.add("DB101.9.4"); |
| | | addressList0.add("DB101.9.5"); |
| | | addressList0.add("DB101.9.6"); |
| | | addressList0.add("DB101.9.7"); |
| | | |
| | | addressList0.add("DB101.10.0"); |
| | | addressList0.add("DB101.10.1"); |
| | | addressList0.add("DB101.10.2"); |
| | | addressList0.add("DB101.10.3"); |
| | | |
| | | |
| | | List<Boolean> data2 = S7control.getinstance().ReadBits("DB101.9.2", 10); |
| | | List<Boolean> data2 = S7control.getinstance().readBits(addressList0); |
| | | List<String> addressList3 = new ArrayList<>(); |
| | | addressList3.add("DB106.64"); |
| | | addressList3.add("DB103.256"); |
| | | addressList3.add("DB103.270"); |
| | | List<String> data3 = S7control.getinstance().readStrings(addressList3); |
| | | |
| | | List<String> addresses4 = new ArrayList<>(); |
| | |
| | | |
| | | List<Short> data4 = S7control.getinstance().readWords(addresses4); |
| | | |
| | | |
| | | // Boolean[] values = { false, true, true, true, true, true, true, true, true, |
| | | // true}; |
| | | // List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values)); |
| | | // |
| | | // String[] values6 = { ".x1 ","x2 ","x3",";;x4","x5","x6","x7","x8","x9","x10","x11"}; |
| | | // List<String> paramlist = new ArrayList<>(Arrays.asList(values6)); |
| | | // Short[] values1 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
| | | // List<Short> data = new ArrayList<>(Arrays.asList(values1)); |
| | | // Short[] values2 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
| | | // List<Short> data2 = new ArrayList<>(Arrays.asList(values2)); |
| | | // Short[] values3 = { 11}; |
| | | // List<Short> data3 = new ArrayList<>(Arrays.asList(values3)); |
| | | // Boolean[] value4 = { true, true, true, true, true, true, true, true, true, |
| | | // true}; |
| | | // List<Boolean> data2 = new ArrayList<>(Arrays.asList(value4)); |
| | | // String[] values3 = { ".x11 ","x21 "}; |
| | | // List<String> data3 = new ArrayList<>(Arrays.asList(values3)); |
| | | // Short[] values4 = { 2,2,3,4}; |
| | | // List<Short> data4 = new ArrayList<>(Arrays.asList(values4)); |
| | | |
| | | |
| | | // |
| | | // |
| | | JSONObject jsonObject = new JSONObject(); |
| | | short[] params = new short[data2.size()]; |
| | | for (int i = 0; i < data2.size(); i++) { |
| | | boolean value = data2.get(i); |
| | | params[i] = value ? (short) 1 : (short) 0; |
| | | } |
| | | |
| | | jsonObject.append("params", params); |
| | | jsonObject.append("params", paramlist); |
| | | jsonObject.append("params", data); |
| | |
| | | if (webSocketServer != null) { |
| | | |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | List<String> addressList = new ArrayList<>(); |
| | | |
| | | String addressList = "DB101.9.2"; |
| | | addressList.add("DB101.9.2"); |
| | | addressList.add("DB101.9.3"); |
| | | addressList.add("DB101.9.4"); |
| | | addressList.add("DB101.9.5"); |
| | | addressList.add("DB101.9.6"); |
| | | addressList.add("DB101.9.7"); |
| | | addressList.add("DB101.10.0"); |
| | | addressList.add("DB101.10.1"); |
| | | addressList.add("DB101.10.2"); |
| | | addressList.add("DB101.10.3"); |
| | | |
| | | |
| | | |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为整数类型的列表 |
| | |
| | |
|
| | | // 写入第yi个地址
|
| | | if (!mergedList.isEmpty()) {
|
| | | // S7control.getinstance().WriteWord(addressList3, mergedList);
|
| | | S7control.getinstance().WriteWord(addressList3, mergedList);
|
| | | System.out.println("messageValue:" + mergedList + " written to PLC at address " + addressList3);
|
| | | }
|
| | |
|
| | |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.google.common.primitives.Bytes; |
| | | import org.apache.commons.io.FileUtils; |
| | | |
| | | import java.io.*; |
| | |
| | | |
| | | |
| | | |
| | | public void insertDataToList(List<Short> list, String rangeAddress, int insertIndex) { |
| | | if (list.size() >= insertIndex + 14) { |
| | | List<Short> rangeData = new ArrayList<>(); |
| | | byte[] byteData = S7control.getinstance().ReadByte(rangeAddress, 14); |
| | | if (byteData != null && byteData.length == 14) { |
| | | for (byte b : byteData) { |
| | | rangeData.add((short) b); |
| | | // public void insertDataToList(List<Short> list, String rangeAddress, int insertIndex) { |
| | | // if (list.size() >= insertIndex + 14) { |
| | | // List<Short> rangeData = new ArrayList<>(); |
| | | // byte[] byteData = S7control.getinstance().ReadByte(rangeAddress, 14); |
| | | // if (byteData != null && byteData.length >= 13) { |
| | | // for (byte b : byteData) { |
| | | // rangeData.add((short) b); |
| | | // } |
| | | // } else { |
| | | // // 读取数据失败,添加默认值 |
| | | // for (int i = 0; i < 14; i++) { |
| | | // rangeData.add((short) -1); |
| | | // } |
| | | // } |
| | | // |
| | | // list.addAll(insertIndex, rangeData); |
| | | // }else{ |
| | | // List<Short> rangeData = new ArrayList<>(); |
| | | // rangeData.add((short) 0); |
| | | // list.addAll(insertIndex, rangeData); |
| | | // } |
| | | // } |
| | | |
| | | public StringBuilder queGlassid(String address,int count) { |
| | | StringBuilder writedstrIdOut = new StringBuilder(); |
| | | byte[] writedglassidbytesOut = S7control.getinstance().ReadByte(address, count); |
| | | if (writedglassidbytesOut != null) { |
| | | // 获取玻璃id |
| | | for (byte iditem : writedglassidbytesOut) { |
| | | writedstrIdOut.append((char) iditem); |
| | | } |
| | | } else { |
| | | // 读取数据失败,添加默认值 |
| | | for (int i = 0; i < 14; i++) { |
| | | rangeData.add((short) -1); |
| | | } |
| | | return writedstrIdOut; |
| | | } |
| | | |
| | | list.addAll(insertIndex, rangeData); |
| | | public void outmesid(String glassid,String address) { |
| | | //System.out.println("outmesid:" + glassid); |
| | | List<Byte> glassidlist = new ArrayList(); |
| | | char ds[]=glassid.toCharArray(); |
| | | for (char iditem : ds) { |
| | | glassidlist.add((byte)iditem); |
| | | } |
| | | byte[] bytes = Bytes.toArray(glassidlist); |
| | | System.out.println("outmesidbytes:" + bytes.length); |
| | | S7control.getinstance().WriteByte(address, bytes);// 派发出片id |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | |
| | | // List<String> addresses = new ArrayList<>(); |
| | | // addresses.add("DB103.25"); |
| | | // addresses.add("DB100.144"); |
| | | // |
| | | // addresses.add("DB100.184"); |
| | | // addresses.add("DB100.186"); |
| | | // addresses.add("DB100.180"); |
| | | // addresses.add("DB100.182"); |
| | | // |
| | | // List<Short> arraylist = S7control.getinstance().readWords(addresses); |
| | | // |
| | | //// String rangeAddress = "DB100.148-161"; |
| | | List<String> addresses = new ArrayList<>(); |
| | | addresses.add("DB103.32"); |
| | | addresses.add("DB100.144"); |
| | | addresses.add("DB100.184"); |
| | | addresses.add("DB100.186"); |
| | | addresses.add("DB100.180"); |
| | | addresses.add("DB100.182"); |
| | | |
| | | List<Short> arraylist = S7control.getinstance().readWords(addresses); |
| | | |
| | | // String rangeAddress = "DB100.148-161"; |
| | | // String rangeAddress = "DB100.148"; |
| | | // int insertIndex = 2; |
| | | // insertDataToList(arraylist, rangeAddress, insertIndex); |
| | | // |
| | | // |
| | | // List<String> addresses2 = new ArrayList<>(); |
| | | // addresses2.add("DB103.26"); |
| | | // addresses2.add("DB100.188"); |
| | | // addresses2.add("DB100.190"); |
| | | // addresses2.add("DB100.146"); |
| | | //// addresses2.add("DB100.162-175"); |
| | | // List<Short> arraylist2 = S7control.getinstance().readWords(addresses2); |
| | | //// String rangeAddress2 = "DB100.148-161"; |
| | | |
| | | |
| | | List<String> addresses2 = new ArrayList<>(); |
| | | addresses2.add("DB103.26"); |
| | | addresses2.add("DB100.188"); |
| | | addresses2.add("DB100.190"); |
| | | addresses2.add("DB100.146"); |
| | | // addresses2.add("DB100.162-175"); |
| | | List<Short> arraylist2 = S7control.getinstance().readWords(addresses2); |
| | | // String rangeAddress2 = "DB100.148-161"; |
| | | // String rangeAddress2 = "DB100.162"; |
| | | // int insertIndex2 = 4; |
| | | // insertDataToList(arraylist2, rangeAddress2, insertIndex2); |
| | | //// System.out.println(arraylist2); |
| | | // List<String> addresses3 = new ArrayList<>(); |
| | | // addresses3.add("DB103.42"); |
| | | // List<Short> arraylist3 = S7control.getinstance().readWords(addresses3); |
| | | // System.out.println(arraylist2); |
| | | List<String> addresses3 = new ArrayList<>(); |
| | | addresses3.add("DB103.42"); |
| | | List<Short> arraylist3 = S7control.getinstance().readWords(addresses3); |
| | | |
| | | List<String> addresses4 = new ArrayList<>(); |
| | | addresses4.add("DB103.46"); |
| | | List<Short> arraylist4 = S7control.getinstance().readWords(addresses4); |
| | | |
| | | List<Short> arraylist5 = S7control.getinstance().ReadWord("DB103.27", 2); |
| | | List<Short> arraylist6 = S7control.getinstance().ReadWord("DB103.29", 2); |
| | | List<String> addresses7 = new ArrayList<>(); |
| | | addresses7.add("DB104.1.4"); |
| | | addresses7.add("DB104.1.5"); |
| | | addresses7.add("DB104.1.2"); |
| | | addresses7.add("DB104.1.3"); |
| | | addresses7.add("DB104.1.6"); |
| | | addresses7.add("DB104.1.7"); |
| | | List<Boolean> arraylist7 = S7control.getinstance().readBits(addresses7); |
| | | |
| | | |
| | | short[] params2 = new short[arraylist7.size()]; |
| | | for (int i = 0; i < arraylist7.size(); i++) { |
| | | boolean value = arraylist7.get(i); |
| | | params2[i] = value ? (short) 1 : (short) 0; |
| | | } |
| | | |
| | | List<String> addresses8 = new ArrayList<>(); |
| | | addresses8.add("DB104.9.0"); |
| | | addresses8.add("DB104.9.1"); |
| | | addresses8.add("DB104.9.0"); |
| | | addresses8.add("DB104.9.1"); |
| | | addresses8.add("DB104.9.4"); |
| | | addresses8.add("DB104.9.5"); |
| | | List<Boolean> arraylist8 = S7control.getinstance().readBits(addresses8); |
| | | short[] params = new short[arraylist8.size()]; |
| | | for (int i = 0; i < arraylist8.size(); i++) { |
| | | boolean value = arraylist8.get(i); |
| | | params[i] = value ? (short) 1 : (short) 0; |
| | | } |
| | | |
| | | |
| | | StringBuilder queueid1 = queGlassid("DB100.148", 14); |
| | | StringBuilder queueid2 = queGlassid("DB100.162", 14); |
| | | |
| | | |
| | | |
| | | // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7}; |
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | | // Short[] values2 = { 1, 2, 3, 4, 5}; |
| | | // List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2)); |
| | | // |
| | | // List<String> addresses4 = new ArrayList<>(); |
| | | // addresses4.add("DB103.46"); |
| | | // List<Short> arraylist4 = S7control.getinstance().readWords(addresses4); |
| | | // Short[] values3 = {1}; |
| | | // List<Short> arraylist3 = new ArrayList<>(Arrays.asList(values3)); |
| | | // Short[] values4 = {2}; |
| | | // List<Short> arraylist4 = new ArrayList<>(Arrays.asList(values4)); |
| | | // Short[] values5 = {3,3}; |
| | | // List<Short> arraylist5 = new ArrayList<>(Arrays.asList(values5)); |
| | | // Short[] values6 = { 4,4}; |
| | | // List<Short> arraylist6 = new ArrayList<>(Arrays.asList(values6)); |
| | | // Boolean[] values7 = { false, true, true, true, true, true}; |
| | | // List<Boolean> arraylist7 = new ArrayList<>(Arrays.asList(values7)); |
| | | // Boolean[] values8 = { false, true, true, true, true, true}; |
| | | // List<Boolean> arraylist8 = new ArrayList<>(Arrays.asList(values8)); |
| | | // |
| | | // List<Short> arraylist5 = S7control.getinstance().ReadWord("DB103.27", 2); |
| | | // List<Short> arraylist6 = S7control.getinstance().ReadWord("DB103.29", 2); |
| | | // List<String> addresses7 = new ArrayList<>(); |
| | | // addresses7.add("DB104.1.4"); |
| | | // addresses7.add("DB104.1.5"); |
| | | // addresses7.add("DB104.1.2"); |
| | | // addresses7.add("DB104.1.3"); |
| | | // addresses7.add("DB104.1.6"); |
| | | // addresses7.add("DB104.1.7"); |
| | | // List<Boolean> arraylist7 = S7control.getinstance().readBits(addresses7); |
| | | // |
| | | // String queueid1 = "x1234567890123"; |
| | | // String queueid2 = "x1234567890123"; |
| | | // |
| | | // short[] params2 = new short[arraylist7.size()]; |
| | | // for (int i = 0; i < arraylist7.size(); i++) { |
| | |
| | | // params2[i] = value ? (short) 1 : (short) 0; |
| | | // } |
| | | // |
| | | // List<String> addresses8 = new ArrayList<>(); |
| | | // addresses8.add("DB101.3.7"); |
| | | // addresses8.add("DB101.4.2"); |
| | | // addresses8.add("DB101.4.5"); |
| | | // addresses8.add("DB101.4.7"); |
| | | // List<Boolean> arraylist8 = S7control.getinstance().readBits(addresses8); |
| | | // |
| | | // short[] params = new short[arraylist8.size()]; |
| | | // for (int i = 0; i < arraylist8.size(); i++) { |
| | | // boolean value = arraylist8.get(i); |
| | | // params[i] = value ? (short) 1 : (short) 0; |
| | | // } |
| | | |
| | | |
| | | Short[] values1 = { 1, 2, 3, 4, 5, 6, 7}; |
| | | List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | | Short[] values2 = { 1, 2, 3, 4, 5}; |
| | | List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2)); |
| | | |
| | | Short[] values3 = {1}; |
| | | List<Short> arraylist3 = new ArrayList<>(Arrays.asList(values3)); |
| | | Short[] values4 = {2}; |
| | | List<Short> arraylist4 = new ArrayList<>(Arrays.asList(values4)); |
| | | Short[] values5 = {3,3}; |
| | | List<Short> arraylist5 = new ArrayList<>(Arrays.asList(values5)); |
| | | Short[] values6 = { 4,4}; |
| | | List<Short> arraylist6 = new ArrayList<>(Arrays.asList(values6)); |
| | | Short[] values7 = { 1,1,1,1,1,1}; |
| | | List<Short> arraylist7 = new ArrayList<>(Arrays.asList(values7)); |
| | | Short[] values8 = { 1,1,1,1,1,1}; |
| | | List<Short> arraylist8 = new ArrayList<>(Arrays.asList(values8)); |
| | | |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | |
| | |
| | | jsonObject.append("zuhe4", arraylist4); |
| | | jsonObject.append("zuhe5", arraylist5); |
| | | jsonObject.append("zuhe6", arraylist6); |
| | | // jsonObject.append("guzhang", params2); |
| | | // jsonObject.append("weihuiling", params); |
| | | jsonObject.append("guzhang", params2); |
| | | jsonObject.append("weihuiling", params); |
| | | jsonObject.append("jinpianid", queueid1); |
| | | jsonObject.append("qupianid", queueid2); |
| | | |
| | | |
| | | |
| | |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | List<String> waddresses1 = new ArrayList<>(); |
| | | waddresses1.add("DB103.25"); |
| | | waddresses1.add("DB103.32"); |
| | | waddresses1.add("DB100.144"); |
| | | waddresses1.add("DB100.148-161"); |
| | | // waddresses1.add("DB100.148-161"); |
| | | waddresses1.add("DB100.184"); |
| | | waddresses1.add("DB100.186"); |
| | | waddresses1.add("DB100.180"); |
| | |
| | | waddresses2.add("DB100.188"); |
| | | waddresses2.add("DB100.190"); |
| | | waddresses2.add("DB100.146"); |
| | | waddresses2.add("DB100.162-175"); |
| | | // waddresses2.add("DB100.162-175"); |
| | | |
| | | List<String> waddresses3 = new ArrayList<>(); |
| | | waddresses3.add("DB101.4.0"); |
| | |
| | | |
| | | |
| | | |
| | | |
| | | String waddresses5="DB100.148"; |
| | | String waddresses6="DB100.162"; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (messageArray.getJSONArray(4).size() > 0) { |
| | | // JSONArray jsonArray5 = messageArray.getJSONArray(4); |
| | | String jsonArray5 = String.valueOf(messageArray.getJSONArray(4)); |
| | | if (!jsonArray5.isEmpty()) { |
| | | // String value = (String) jsonArray5.get(0); |
| | | jsonArray5 = jsonArray5.replaceAll("[\\[\\]\"]", ""); // 去除方括号和双引号 |
| | | outmesid( jsonArray5,waddresses5); |
| | | System.out.println("Values " + jsonArray5 + " written to PLC at address " + waddresses5); |
| | | } |
| | | } |
| | | |
| | | if (messageArray.getJSONArray(5).size() > 0) { |
| | | JSONArray jsonArray6 = messageArray.getJSONArray(5); |
| | | |
| | | if (!jsonArray6.isEmpty()) { |
| | | String value2 = (String) jsonArray6.get(0); |
| | | outmesid( value2,waddresses6); |
| | | System.out.println("Values " + value2 + " written to PLC at address " + waddresses6); |
| | | } |
| | | } |
| | | |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | |
| | | // Integer Plccount = this.count;
|
| | | // System.out.println(PlcAddress);
|
| | |
|
| | | List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.0.0", 26);
|
| | | List<Boolean> paramlist = S7control.getinstance().ReadBits("DB102.0.0", 10);
|
| | | // Boolean[] values = { false, true, true, true, true, true, true, true, true,
|
| | | // true, true, true, true, true, true, true, true, true, true, true, true, true, true,
|
| | | // true, false, true };
|
| | |
| | | import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.S7PLC; |
| | | import com.google.common.primitives.Bytes; |
| | | import org.apache.ibatis.jdbc.Null; |
| | | |
| | | public class S7control { |
| | | |
| | |
| | | |
| | | for (String address : addressList) { |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | |
| | | // System.out.println(bytes.toString()); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.US_ASCII); |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | // System.out.println(str); |
| | | // if(str == null ){ |
| | | // str = ""; |
| | | // } |
| | | result.add(str); |
| | | } |
| | | // if ( bytes.toString().contains("@")) { |
| | | // String str = ""; |
| | | // |
| | | // result.add(str); |
| | | // }else{ |
| | | // |
| | | // String str = new String(bytes, StandardCharsets.US_ASCII); |
| | | // result.add(str); |
| | | // } |
| | | // System.out.println(bytes.toString()); |
| | | } |
| | | |
| | | return result; |
| | |
| | | } |
| | | |
| | | public void outmesid(String data, String addr) { |
| | | System.out.println("outmesid: " + data); |
| | | // System.out.println("outmesid: " + data); |
| | | List<Byte> glassidlist = new ArrayList<>(); |
| | | String[] parts = addr.split("-"); |
| | | if (parts.length == 2) { |
| | |
| | | if (stringdatas.length == 2) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | } else if (stringdatas.length == 3) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | bitindex = Integer.parseInt(stringdatas[2]); |
| | | } else |
| | | return null; |
| | |
| | | System.out.println("启动完成"); |
| | | |
| | | // new PlcHold().start(); |
| | | |
| | | // |
| | | new Plchome().start(); |
| | | // |
| | | // new PlcParameter().start(); |
| | | // new Plchome().start(); |
| | | // // |
| | | // // new Plcalarm().start(); |
| | | // // |
| | | // new Plcsign().start(); |
| | | // // |
| | | // new Plcaction().start(); |
| | | // new Plcstate().start(); |
| | | // new PlcPositioning1().start(); |
| | | // new PlcPositioning2().start(); |
| | | // new PlcParameter2().start(); |
| | | // new PlcParameter1().start(); |
| | | // new PLCAutomaticParameterSetting().start(); |
| | | new PlcParameter().start(); |
| | | // |
| | | // new Plcalarm().start(); |
| | | // |
| | | new Plcsign().start(); |
| | | // |
| | | new Plcaction().start(); |
| | | new Plcstate().start(); |
| | | new PlcPositioning1().start(); |
| | | new PlcPositioning2().start(); |
| | | new PlcParameter2().start(); |
| | | new PlcParameter1().start(); |
| | | new PLCAutomaticParameterSetting().start(); |
| | | |
| | | // new PlcManualonePosition().start(); |
| | | // new PlcManualonePosition2().start(); |
| | | // new PlcServoManualone().start(); |
| | | // new PLCManualJog().start(); |
| | | new PlcManualonePosition().start(); |
| | | new PlcManualonePosition2().start(); |
| | | new PlcServoManualone().start(); |
| | | new PLCManualJog().start(); |
| | | } |
| | | } |