From e022b00a00140fca01fccae58da09712bd79fd51 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Fri, 3 Jan 2020 11:18:18 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=BB=BC=E5=90=88=E6=BC=94=E7=BB=83=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/chat.js | 17 ++ src/api/project.js | 8 + src/utils/baseUrl.js | 4 +- src/views/jointTraining/menuDemon.vue | 13 +- .../jointTraining/menuDraft/realDevice.vue | 245 ++++++++++++++++++ src/views/system/deviceManage/editConfig.vue | 22 +- src/views/trainRoom/e-roles.vue | 5 + src/views/trainRoom/index.vue | 2 +- 8 files changed, 305 insertions(+), 11 deletions(-) create mode 100644 src/views/jointTraining/menuDraft/realDevice.vue diff --git a/src/api/chat.js b/src/api/chat.js index 0fafefea0..7c0f69385 100644 --- a/src/api/chat.js +++ b/src/api/chat.js @@ -255,3 +255,20 @@ export function getRealDevices(group) { method: 'get' }); } + +// 获取房间真实设备连接关系 +export function getRealDevicesNew(group) { + return request({ + url: `/api/jointTraining/room/${group}/realDevice/connect`, + method: 'get' + }); +} + +// 更新真实设备的连接关系 +export function undateRealDevicesNew(group, data) { + return request({ + url: `/api/jointTraining/room/${group}/realDevice`, + method: 'put', + data: data + }); +} diff --git a/src/api/project.js b/src/api/project.js index bdfcbd098..337853df6 100644 --- a/src/api/project.js +++ b/src/api/project.js @@ -61,3 +61,11 @@ export function setSwitchConfig(id, data) { data: data }); } +/** 查询项目下的所有设备 */ +export function getAllDeviceInProject(params) { + return request({ + url: `/api/project/device/project`, + method: 'get', + params + }); +} diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 1e9afea51..9c6445483 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -3,9 +3,9 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { // BASE_API = 'https://joylink.club/jlcloud'; - BASE_API = 'https://test.joylink.club/jlcloud'; + // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.3.5:9000'; // 袁琪 - // BASE_API = 'http://192.168.3.6:9000'; // 旭强 + BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.82:9000'; // 杜康 } else { diff --git a/src/views/jointTraining/menuDemon.vue b/src/views/jointTraining/menuDemon.vue index 8dc49bf5c..b3fa9a1cc 100644 --- a/src/views/jointTraining/menuDemon.vue +++ b/src/views/jointTraining/menuDemon.vue @@ -2,6 +2,7 @@
+ 设置真实设备 {{ $t('joinTraining.driverPerspective') }} @@ -23,12 +25,15 @@ import { exitFullscreen } from '@/utils/screen'; import { putJointTrainingSimulationUser } from '@/api/chat'; import { timeFormat } from '@/utils/date'; import { EventBus } from '@/scripts/event-bus'; +import { getSessionStorage } from '@/utils/auth'; +import RealDevice from './menuDraft/realDevice'; export default { name: 'MenuDemonJoint', components: { QrCode, - SetTime + SetTime, + RealDevice }, props: { group: { @@ -83,6 +88,9 @@ export default { }, isBigScreen() { return this.userRole == 'BigScreen'; + }, + isProject() { + return getSessionStorage('project').endsWith('gzb'); } }, watch: { @@ -308,6 +316,9 @@ export default { }, jumpjlmap3d() { this.$emit('hidepanel'); + }, + setRelDevice() { + this.$refs.realDevice.doShow(); } } }; diff --git a/src/views/jointTraining/menuDraft/realDevice.vue b/src/views/jointTraining/menuDraft/realDevice.vue new file mode 100644 index 000000000..723c1aeef --- /dev/null +++ b/src/views/jointTraining/menuDraft/realDevice.vue @@ -0,0 +1,245 @@ + + + + + diff --git a/src/views/system/deviceManage/editConfig.vue b/src/views/system/deviceManage/editConfig.vue index 58dbc9b57..257ff5f13 100644 --- a/src/views/system/deviceManage/editConfig.vue +++ b/src/views/system/deviceManage/editConfig.vue @@ -120,7 +120,6 @@ export default { methods: { initForm(row) { var validateDevice = (rule, value, callback) => { - console.log(value); const list = []; rule.list.forEach(item=> { if (item.value !== rule.field && this.formModel[item.value] === value) { @@ -144,6 +143,15 @@ export default { callback(); } }; + var validateAddr = (rule, value, callback) => { + if (!value) { + callback(new Error(rule.messageEmpty)); + } else if (this.formModel.i_addr === this.formModel.o_addr) { + callback(new Error('输入网关字地址与输出网关字地址不能相同!')); + } else { + callback(); + } + }; switch (row.type) { case 'PSD': { this.setDeviceConfigFunction = setPsdConfig; @@ -162,7 +170,7 @@ export default { }; this.leftRules = { i_addr: [ - { required: true, message: '请填写输入网关字地址', trigger: 'blur' } + { validator: validateAddr, messageEmpty: '请填写输入网关字地址', trigger: 'blur' } ], i_c: [ { validator: validateDevice, messageEmpty: '请填写输入-是否关门位', list: this.psdLeftValue, trigger: 'blur' } @@ -202,7 +210,7 @@ export default { }; this.rightRules = { o_addr: [ - { required: true, message: '请填写输出网关字地址', trigger: 'blur' } + { validator: validateAddr, messageEmpty: '请填写输出网关字地址', trigger: 'blur' } ], o_c: [ { validator: validateDevice, messageEmpty: '请填写输入-关门位', list: this.psdRightValue, trigger: 'blur' } @@ -246,7 +254,7 @@ export default { }; this.leftRules = { i_addr: [ - { required: true, message: '请填写输入网关字地址', trigger: 'blur' } + { validator: validateAddr, messageEmpty: '请填写输入网关字地址', trigger: 'blur' } ], i_f: [ { validator: validateDevice, messageEmpty: '请填写输入-故障表示位', list: this.signalLeftValue, trigger: 'blur' } @@ -274,7 +282,7 @@ export default { }; this.rightRules = { o_addr: [ - { required: true, message: '请填写输出网关字地址', trigger: 'blur' } + { validator: validateAddr, messageEmpty: '请填写输出网关字地址', trigger: 'blur' } ], o_f: [ { validator: validateDevice, messageEmpty: '请填写输入-故障控制位', list: this.signalRightValue, trigger: 'blur' } @@ -305,7 +313,7 @@ export default { }; this.leftRules = { i_addr: [ - { required: true, message: '请填写输入网关字地址', trigger: 'blur' } + { validator: validateAddr, messageEmpty: '请填写输入网关字地址', trigger: 'blur' } ], i_f: [ { validator: validateDevice, messageEmpty: '请填写输入-故障挤岔表示位', list: this.switchLeftValue, trigger: 'blur' } @@ -328,7 +336,7 @@ export default { }; this.rightRules = { o_addr: [ - { required: true, message: '请填写输出网关字地址', trigger: 'blur' } + { validator: validateAddr, messageEmpty: '请填写输出网关字地址', trigger: 'blur' } ], o_f: [ { validator: validateDevice, messageEmpty: '请填写输出-故障挤岔控制位', list: this.switchRightValue, trigger: 'blur' } diff --git a/src/views/trainRoom/e-roles.vue b/src/views/trainRoom/e-roles.vue index 1be30c355..89d0b41b7 100644 --- a/src/views/trainRoom/e-roles.vue +++ b/src/views/trainRoom/e-roles.vue @@ -75,6 +75,7 @@ @delUser="handleDelUser" /> Date: Fri, 3 Jan 2020 11:32:27 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=8F=96=E6=B6=88=E7=9C=9F=E5=AE=9E?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=8E=A5=E5=8F=A3=E5=86=99=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/jointTraining/menuDraft/realDevice.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/jointTraining/menuDraft/realDevice.vue b/src/views/jointTraining/menuDraft/realDevice.vue index 723c1aeef..ff799591e 100644 --- a/src/views/jointTraining/menuDraft/realDevice.vue +++ b/src/views/jointTraining/menuDraft/realDevice.vue @@ -86,6 +86,7 @@ import { getRealDevicesNew, undateRealDevicesNew } from '@/api/chat'; import { hasDoorStationList } from '@/api/jmap/map'; import {getAllDeviceInProject} from '@/api/project'; import { mapGetters } from 'vuex'; +import { getSessionStorage } from '@/utils/auth'; export default { name: 'RealDevice', data() { @@ -149,8 +150,9 @@ export default { doShow() { this.dialogShow = true; this.options = []; + const projectCode = getSessionStorage('project').toUpperCase(); this.getDoorList(this.$route.query.mapId, this.stationList); - getAllDeviceInProject({projectCode: 'GZB'}).then(resp => { + getAllDeviceInProject({projectCode: projectCode}).then(resp => { getRealDevicesNew(this.$route.query.group).then(res => { resp.data.forEach((it, index) => { this.options.push({ From cb0f21a183d50d17ff69560ea883d8dbb68593a4 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Fri, 3 Jan 2020 13:49:40 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=BD=91=E5=85=B3=E5=AD=97=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E5=8F=AF=E4=BB=A5=E4=B8=BA0=EF=BC=8C=E6=89=80?= =?UTF-8?q?=E6=9C=89=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=8F=AF=E4=B8=BA=E5=B0=8F?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/QueryListPage/DataForm.vue | 11 +++ src/views/system/deviceManage/editConfig.vue | 70 ++++++++++---------- 2 files changed, 46 insertions(+), 35 deletions(-) diff --git a/src/components/QueryListPage/DataForm.vue b/src/components/QueryListPage/DataForm.vue index 9d1ef4c04..0e67d3636 100644 --- a/src/components/QueryListPage/DataForm.vue +++ b/src/components/QueryListPage/DataForm.vue @@ -53,6 +53,17 @@