diff --git a/src/api/simulation.js b/src/api/simulation.js index b8eccf7d6..7716515c6 100644 --- a/src/api/simulation.js +++ b/src/api/simulation.js @@ -193,6 +193,14 @@ export function saveScriptData(group) { }); } +/** 保存录制任务数据(新版)*/ +export function saveScriptDataNew(group) { + return request({ + url: `/api/scriptSimulation/${group}/saveData`, + method: 'put' + }); +} + /** 更新任务地图定位信息*/ export function updateMapLocation(group, data) { return request({ @@ -310,6 +318,15 @@ export function addScriptAction(group, data) { }); } +/** 添加剧本动作(新版) */ +export function addScriptActionNew(group, data) { + return request({ + url: `/api/scriptSimulation/${group}/addAction`, + method: 'PUT', + data + }); +} + /** 删除剧本动作 */ export function deleteScriptAction(group, actionId) { return request({ diff --git a/src/jmapNew/theme/foshan_01/menus/menuButton.vue b/src/jmapNew/theme/foshan_01/menus/menuButton.vue index 6399648d5..c566bfb5b 100644 --- a/src/jmapNew/theme/foshan_01/menus/menuButton.vue +++ b/src/jmapNew/theme/foshan_01/menus/menuButton.vue @@ -246,7 +246,7 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import OperationHandler from '@/scripts/cmdPlugin/OperationHandler'; import Handler from '@/scripts/cmdPlugin/Handler'; -import CMD from '@/scripts/cmdPlugin/CommandEnum'; +// import CMD from '@/scripts/cmdPlugin/CommandEnum'; // import { deepAssign } from '@/utils/index'; export default { @@ -341,6 +341,7 @@ export default { selectedChange() { const model = this.$store.state.menuOperation.selected; if (model && model._type) { + } else { Handler.clear(); this.$store.dispatch('menuOperation/setButtonOperation', null); diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 4a0fe9bcf..5e119f4f0 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -6,8 +6,8 @@ export function getBaseUrl() { // 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.41:9000'; // 张赛 - BASE_API = 'http://192.168.3.82:9000'; // 杜康 + BASE_API = 'http://192.168.3.41:9000'; // 张赛 + // BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 diff --git a/src/views/scriptManage/display/tipScriptRecord.vue b/src/views/scriptManage/display/tipScriptRecord.vue index 8b3d7e9d8..e8c34c051 100644 --- a/src/views/scriptManage/display/tipScriptRecord.vue +++ b/src/views/scriptManage/display/tipScriptRecord.vue @@ -31,7 +31,7 @@ import Vue from 'vue'; import AddAction from '../scriptRecord/addAction'; import GetAction from '../scriptRecord/getAction'; import AddRole from '../scriptRecord/addRole'; -import {saveScriptScenes, saveScriptData, dumpScriptData, updateMapLocation, scriptPause, executeScript} from '@/api/simulation'; +import {saveScriptScenes, saveScriptData, saveScriptDataNew, dumpScriptData, updateMapLocation, scriptPause, executeScript} from '@/api/simulation'; export default { name: 'TipScriptRecord', @@ -134,19 +134,36 @@ export default { }, saveScenesData() { this.isSavingScript = true; - saveScriptData(this.group).then(resp => { - this.$message.success(this.$t('scriptRecord.saveDataSucess')); - this.isSavingScript = false; - this.initAutoSaveScript(); - }).catch(error => { - this.$messageBox(`${this.$t('scriptRecord.saveDataFail')}: ${error.message}`); - this.isSavingScript = false; - if (error.code === 40004 || error.code === 40005 || error.code === 40003) { - this.clearAutoSave(); - } else { + + if (this.$route.query.drawWay == 'true') { + saveScriptDataNew(this.group).then(resp => { + this.$message.success(this.$t('scriptRecord.saveDataSucess')); + this.isSavingScript = false; this.initAutoSaveScript(); - } - }); + }).catch(error => { + this.$messageBox(`${this.$t('scriptRecord.saveDataFail')}: ${error.message}`); + this.isSavingScript = false; + if (error.code === 40004 || error.code === 40005 || error.code === 40003) { + this.clearAutoSave(); + } else { + this.initAutoSaveScript(); + } + }); + } else { + saveScriptData(this.group).then(resp => { + this.$message.success(this.$t('scriptRecord.saveDataSucess')); + this.isSavingScript = false; + this.initAutoSaveScript(); + }).catch(error => { + this.$messageBox(`${this.$t('scriptRecord.saveDataFail')}: ${error.message}`); + this.isSavingScript = false; + if (error.code === 40004 || error.code === 40005 || error.code === 40003) { + this.clearAutoSave(); + } else { + this.initAutoSaveScript(); + } + }); + } }, dumpScenesData() { this.clearAutoSave(); diff --git a/src/views/scriptManage/scriptRecord/addAction.vue b/src/views/scriptManage/scriptRecord/addAction.vue index ac3236e7c..2c0f7d1a8 100644 --- a/src/views/scriptManage/scriptRecord/addAction.vue +++ b/src/views/scriptManage/scriptRecord/addAction.vue @@ -7,12 +7,12 @@
- + - +
@@ -35,7 +35,7 @@ - + @@ -58,7 +58,7 @@ import Vue from 'vue'; import Cookies from 'js-cookie'; import ConstConfig from '@/scripts/ConstConfig'; import CommandOperation from './command'; -import {addScriptAction, modifyScriptAction, getAvailableDeviceCommand, getScriptPlayMember} from '@/api/simulation'; +import {addScriptAction, addScriptActionNew, modifyScriptAction, getAvailableDeviceCommand, getScriptPlayMember, getScriptPlayMemberNew} from '@/api/simulation'; export default { name: 'AddAction', components:{ @@ -175,25 +175,40 @@ export default { initData() { this.buttonName = this.$t('scriptRecord.addConversitionButton'); this.operateType = 'add'; - getScriptPlayMember(this.group).then(resp => { - const roleTypeList = ConstConfig.ConstSelect.roleType; - this.orginMemberList = resp.data; - let lastData = JSON.stringify(resp.data); - roleTypeList.forEach(function(element) { - const rolename = element.value; - if (Cookies.get('user_lang') == 'en') { - lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel); - } else { - lastData = lastData.replace(new RegExp(rolename, 'g'), element.label); - } + if (this.$route.query.drawWay == 'true') { + getScriptPlayMemberNew(this.group).then(resp => { + this.orginMemberList = resp.data; + this.memberList = resp.data; + this.resetDisabled(); + this.initCommandActionData(); + }).catch(error => { + this.$message(error.message); }); - lastData = JSON.parse(lastData); - this.memberList = lastData; - this.resetDisabled(); - this.initCommandActionData(); - }).catch(error => { - this.$message(error.message); - }); + } else { + getScriptPlayMember(this.group).then(resp => { + const roleTypeList = ConstConfig.ConstSelect.roleType; + this.orginMemberList = resp.data; + let lastData = JSON.stringify(resp.data); + roleTypeList.forEach(function(element) { + const rolename = element.value; + if (Cookies.get('user_lang') == 'en') { + lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel); + } else { + lastData = lastData.replace(new RegExp(rolename, 'g'), element.label); + } + }); + lastData = JSON.parse(lastData); + lastData.forEach(each=>{ + each.name = each.role + (each.name == undefined ? '' : each.name); + }); + this.memberList = lastData; + this.resetDisabled(); + this.initCommandActionData(); + }).catch(error => { + this.$message(error.message); + }); + } + }, changeRole(index) { const role = this.orginMemberList.find(elem=>{ return elem.id == index; }).role; @@ -279,17 +294,32 @@ export default { const data = this.modalData.actionVO; this.modifying = true; if (this.operateType == 'add') { - addScriptAction(group, data).then(response=>{ - this.modifying = false; - this.$message.success(this.$t('scriptRecord.addConversitionSuccess')); - this.$emit('create'); + if (this.$route.query.drawWay == 'true') { + addScriptActionNew(group, data).then(response=>{ + this.modifying = false; + this.$message.success(this.$t('scriptRecord.addConversitionSuccess')); + this.$emit('create'); // [this.modalData.actionVO.memberId] // this.initActionData(); // this.$parent.$parent.$refs['addRole'].resetData([this.modalData.actionVO.memberId,this.modalData.actionVO.targetId]); - }).catch(error => { - this.modifying = false; - this.$messageBox(`${this.$t('scriptRecord.addConversitionFail')}: ${error.message}`); - }); + }).catch(error => { + this.modifying = false; + this.$messageBox(`${this.$t('scriptRecord.addConversitionFail')}: ${error.message}`); + }); + } else { + addScriptAction(group, data).then(response=>{ + this.modifying = false; + this.$message.success(this.$t('scriptRecord.addConversitionSuccess')); + this.$emit('create'); + // [this.modalData.actionVO.memberId] + // this.initActionData(); + // this.$parent.$parent.$refs['addRole'].resetData([this.modalData.actionVO.memberId,this.modalData.actionVO.targetId]); + }).catch(error => { + this.modifying = false; + this.$messageBox(`${this.$t('scriptRecord.addConversitionFail')}: ${error.message}`); + }); + } + } else { const actionId = this.modalData.actionVO.id; modifyScriptAction(group, actionId, data).then(response=>{ diff --git a/src/views/scriptManage/scriptRecord/addRole.vue b/src/views/scriptManage/scriptRecord/addRole.vue index d8a74499b..8614e2c66 100644 --- a/src/views/scriptManage/scriptRecord/addRole.vue +++ b/src/views/scriptManage/scriptRecord/addRole.vue @@ -2,7 +2,7 @@ - {{ option.role+(option.name==undefined?'':option.name) }} + {{ option.name }} {{ $t('scriptRecord.roleSexMale') }} {{ $t('scriptRecord.roleSexFemale') }} @@ -45,9 +45,10 @@ export default { const group = this.$props.group; if (this.$route.query.drawWay == 'true') { getScriptMemberDataNew(group).then(response=>{ - debugger; - const lastData = JSON.stringify(response.data); - this.allRoleData = this.coverDataNew(lastData); + let lastData = JSON.stringify(response.data); + lastData = lastData.replace(new RegExp('id', 'g'), 'key'); + lastData = JSON.parse(lastData); + this.allRoleData = lastData; getScriptPlayMemberNew(group).then(response=>{ const last = response.data; // let userdata=JSON.stringify(response.data) @@ -89,21 +90,9 @@ export default { } }); lastData = JSON.parse(lastData); - return lastData; - }, - coverDataNew(data) { - const roleTypeList = ConstConfig.ConstSelect.roleTypeNew; - let lastData = data.replace(new RegExp('id', 'g'), 'key'); - roleTypeList.forEach(function(element) { - const rolename = element.value; - if (Cookies.get('user_lang') == 'en') { - lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel); - } else { - - lastData = lastData.replace(new RegExp(rolename, 'g'), element.label); - } + lastData.forEach(each=>{ + each.name = each.role + (each.name == undefined ? '' : each.name); }); - lastData = JSON.parse(lastData); return lastData; }, handleChange(value, direction, movedKeys) { diff --git a/src/views/scriptManage/scriptRecord/getAction.vue b/src/views/scriptManage/scriptRecord/getAction.vue index 17f404998..a4e9608ff 100644 --- a/src/views/scriptManage/scriptRecord/getAction.vue +++ b/src/views/scriptManage/scriptRecord/getAction.vue @@ -29,7 +29,8 @@