新版剧本编制接口调整

This commit is contained in:
joylink_cuiweidong 2020-03-27 17:29:01 +08:00
parent c30eae5b1e
commit 93dc9a6983
7 changed files with 167 additions and 112 deletions

View File

@ -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) { export function updateMapLocation(group, data) {
return request({ 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) { export function deleteScriptAction(group, actionId) {
return request({ return request({

View File

@ -246,7 +246,7 @@
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler'; import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
import Handler from '@/scripts/cmdPlugin/Handler'; import Handler from '@/scripts/cmdPlugin/Handler';
import CMD from '@/scripts/cmdPlugin/CommandEnum'; // import CMD from '@/scripts/cmdPlugin/CommandEnum';
// import { deepAssign } from '@/utils/index'; // import { deepAssign } from '@/utils/index';
export default { export default {
@ -341,6 +341,7 @@ export default {
selectedChange() { selectedChange() {
const model = this.$store.state.menuOperation.selected; const model = this.$store.state.menuOperation.selected;
if (model && model._type) { if (model && model._type) {
} else { } else {
Handler.clear(); Handler.clear();
this.$store.dispatch('menuOperation/setButtonOperation', null); this.$store.dispatch('menuOperation/setButtonOperation', null);

View File

@ -6,8 +6,8 @@ export function getBaseUrl() {
// 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.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.41:9000'; // 张赛
BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -31,7 +31,7 @@ import Vue from 'vue';
import AddAction from '../scriptRecord/addAction'; import AddAction from '../scriptRecord/addAction';
import GetAction from '../scriptRecord/getAction'; import GetAction from '../scriptRecord/getAction';
import AddRole from '../scriptRecord/addRole'; 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 { export default {
name: 'TipScriptRecord', name: 'TipScriptRecord',
@ -134,19 +134,36 @@ export default {
}, },
saveScenesData() { saveScenesData() {
this.isSavingScript = true; this.isSavingScript = true;
saveScriptData(this.group).then(resp => {
this.$message.success(this.$t('scriptRecord.saveDataSucess')); if (this.$route.query.drawWay == 'true') {
this.isSavingScript = false; saveScriptDataNew(this.group).then(resp => {
this.initAutoSaveScript(); this.$message.success(this.$t('scriptRecord.saveDataSucess'));
}).catch(error => { this.isSavingScript = false;
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(); 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() { dumpScenesData() {
this.clearAutoSave(); this.clearAutoSave();

View File

@ -7,12 +7,12 @@
<div class="itemGroup"> <div class="itemGroup">
<el-form-item :label="$t('scriptRecord.narrator')" class="conditionVO" prop="actionVO.memberId"> <el-form-item :label="$t('scriptRecord.narrator')" class="conditionVO" prop="actionVO.memberId">
<el-select v-model="modalData.actionVO.memberId" :placeholder="$t('scriptRecord.narratorRules')" :disabled="isPause&&isNotModify"> <el-select v-model="modalData.actionVO.memberId" :placeholder="$t('scriptRecord.narratorRules')" :disabled="isPause&&isNotModify">
<el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id" /> <el-option v-for="member in memberList" :key="member.id" :label="member.name" :value="member.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('scriptRecord.receiver')" class="conditionVO" prop="actionVO.targetId"> <el-form-item :label="$t('scriptRecord.receiver')" class="conditionVO" prop="actionVO.targetId">
<el-select v-model="modalData.actionVO.targetId" :placeholder="$t('scriptRecord.receiverRules')" :disabled="isPause&&isNotModify"> <el-select v-model="modalData.actionVO.targetId" :placeholder="$t('scriptRecord.receiverRules')" :disabled="isPause&&isNotModify">
<el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id" /> <el-option v-for="member in memberList" :key="member.id" :label="member.name" :value="member.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</div> </div>
@ -35,7 +35,7 @@
<el-form ref="commandData" size="mini" :model="commandData" :rules="commandRules" label-width="120px" class="actionInfo" label-position="right"> <el-form ref="commandData" size="mini" :model="commandData" :rules="commandRules" label-width="120px" class="actionInfo" label-position="right">
<el-form-item :label="$t('scriptRecord.executor')" class="conditionVO" prop="action.memberId"> <el-form-item :label="$t('scriptRecord.executor')" class="conditionVO" prop="action.memberId">
<el-select v-model="commandData.action.memberId" :placeholder="$t('scriptRecord.executorRules')" :disabled="isPause" @change="changeRole"> <el-select v-model="commandData.action.memberId" :placeholder="$t('scriptRecord.executorRules')" :disabled="isPause" @change="changeRole">
<el-option v-for="member in memberList" :key="member.id" :label="member.role+(member.name==undefined?'':member.name)" :value="member.id" /> <el-option v-for="member in memberList" :key="member.id" :label="member.name" :value="member.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('scriptRecord.executeCommand')" class="conditionVO" prop="action.deviceCommand"> <el-form-item :label="$t('scriptRecord.executeCommand')" class="conditionVO" prop="action.deviceCommand">
@ -58,7 +58,7 @@ import Vue from 'vue';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import CommandOperation from './command'; import CommandOperation from './command';
import {addScriptAction, modifyScriptAction, getAvailableDeviceCommand, getScriptPlayMember} from '@/api/simulation'; import {addScriptAction, addScriptActionNew, modifyScriptAction, getAvailableDeviceCommand, getScriptPlayMember, getScriptPlayMemberNew} from '@/api/simulation';
export default { export default {
name: 'AddAction', name: 'AddAction',
components:{ components:{
@ -175,25 +175,40 @@ export default {
initData() { initData() {
this.buttonName = this.$t('scriptRecord.addConversitionButton'); this.buttonName = this.$t('scriptRecord.addConversitionButton');
this.operateType = 'add'; this.operateType = 'add';
getScriptPlayMember(this.group).then(resp => { if (this.$route.query.drawWay == 'true') {
const roleTypeList = ConstConfig.ConstSelect.roleType; getScriptPlayMemberNew(this.group).then(resp => {
this.orginMemberList = resp.data; this.orginMemberList = resp.data;
let lastData = JSON.stringify(resp.data); this.memberList = resp.data;
roleTypeList.forEach(function(element) { this.resetDisabled();
const rolename = element.value; this.initCommandActionData();
if (Cookies.get('user_lang') == 'en') { }).catch(error => {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel); this.$message(error.message);
} else {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.label);
}
}); });
lastData = JSON.parse(lastData); } else {
this.memberList = lastData; getScriptPlayMember(this.group).then(resp => {
this.resetDisabled(); const roleTypeList = ConstConfig.ConstSelect.roleType;
this.initCommandActionData(); this.orginMemberList = resp.data;
}).catch(error => { let lastData = JSON.stringify(resp.data);
this.$message(error.message); 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) { changeRole(index) {
const role = this.orginMemberList.find(elem=>{ return elem.id == index; }).role; const role = this.orginMemberList.find(elem=>{ return elem.id == index; }).role;
@ -279,17 +294,32 @@ export default {
const data = this.modalData.actionVO; const data = this.modalData.actionVO;
this.modifying = true; this.modifying = true;
if (this.operateType == 'add') { if (this.operateType == 'add') {
addScriptAction(group, data).then(response=>{ if (this.$route.query.drawWay == 'true') {
this.modifying = false; addScriptActionNew(group, data).then(response=>{
this.$message.success(this.$t('scriptRecord.addConversitionSuccess')); this.modifying = false;
this.$emit('create'); this.$message.success(this.$t('scriptRecord.addConversitionSuccess'));
this.$emit('create');
// [this.modalData.actionVO.memberId] // [this.modalData.actionVO.memberId]
// this.initActionData(); // this.initActionData();
// this.$parent.$parent.$refs['addRole'].resetData([this.modalData.actionVO.memberId,this.modalData.actionVO.targetId]); // this.$parent.$parent.$refs['addRole'].resetData([this.modalData.actionVO.memberId,this.modalData.actionVO.targetId]);
}).catch(error => { }).catch(error => {
this.modifying = false; this.modifying = false;
this.$messageBox(`${this.$t('scriptRecord.addConversitionFail')}: ${error.message}`); 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 { } else {
const actionId = this.modalData.actionVO.id; const actionId = this.modalData.actionVO.id;
modifyScriptAction(group, actionId, data).then(response=>{ modifyScriptAction(group, actionId, data).then(response=>{

View File

@ -2,7 +2,7 @@
<el-card class="scriptTop"> <el-card class="scriptTop">
<el-transfer v-model="selectRoleData" :data="allRoleData" class="script-player-choose" :titles="[$t('scriptRecord.allRoles'), $t('scriptRecord.actors')]" @change="handleChange"> <el-transfer v-model="selectRoleData" :data="allRoleData" class="script-player-choose" :titles="[$t('scriptRecord.allRoles'), $t('scriptRecord.actors')]" @change="handleChange">
<span slot-scope="{option}"> <span slot-scope="{option}">
<span>{{ option.role+(option.name==undefined?'':option.name) }}</span> <span>{{ option.name }}</span>
<el-radio-group v-model="option.gender" size="mini" class="sexGroup" @change="changeSex($event,option.key)"> <el-radio-group v-model="option.gender" size="mini" class="sexGroup" @change="changeSex($event,option.key)">
<el-radio-button label="Male">{{ $t('scriptRecord.roleSexMale') }}</el-radio-button> <el-radio-button label="Male">{{ $t('scriptRecord.roleSexMale') }}</el-radio-button>
<el-radio-button label="Female">{{ $t('scriptRecord.roleSexFemale') }}</el-radio-button> <el-radio-button label="Female">{{ $t('scriptRecord.roleSexFemale') }}</el-radio-button>
@ -45,9 +45,10 @@ export default {
const group = this.$props.group; const group = this.$props.group;
if (this.$route.query.drawWay == 'true') { if (this.$route.query.drawWay == 'true') {
getScriptMemberDataNew(group).then(response=>{ getScriptMemberDataNew(group).then(response=>{
debugger; let lastData = JSON.stringify(response.data);
const lastData = JSON.stringify(response.data); lastData = lastData.replace(new RegExp('id', 'g'), 'key');
this.allRoleData = this.coverDataNew(lastData); lastData = JSON.parse(lastData);
this.allRoleData = lastData;
getScriptPlayMemberNew(group).then(response=>{ getScriptPlayMemberNew(group).then(response=>{
const last = response.data; const last = response.data;
// let userdata=JSON.stringify(response.data) // let userdata=JSON.stringify(response.data)
@ -89,21 +90,9 @@ export default {
} }
}); });
lastData = JSON.parse(lastData); lastData = JSON.parse(lastData);
return lastData; lastData.forEach(each=>{
}, each.name = each.role + (each.name == undefined ? '' : each.name);
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 = JSON.parse(lastData);
return lastData; return lastData;
}, },
handleChange(value, direction, movedKeys) { handleChange(value, direction, movedKeys) {

View File

@ -29,7 +29,8 @@
</el-scrollbar> </el-scrollbar>
</template> </template>
<script> <script>
import {getScriptRecord, deleteScriptAction, getAvailableDeviceCommand } from '@/api/simulation'; import {deleteScriptAction, getAvailableDeviceCommand } from '@/api/simulation';
// getScriptRecord
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
export default { export default {
name: 'GetAction', name: 'GetAction',
@ -75,57 +76,57 @@ export default {
}, },
loadOtherData(obj) { loadOtherData(obj) {
const group = obj.group; const group = obj.group;
getScriptRecord(group).then(response=>{ // getScriptRecord(group).then(response=>{
this.$store.dispatch('scriptRecord/updateBgSet', response.data.bgSet); // this.$store.dispatch('scriptRecord/updateBgSet', response.data.bgSet);
this.actionInfoList = []; // this.actionInfoList = [];
const roleTypeList = ConstConfig.ConstSelect.roleType; // const roleTypeList = ConstConfig.ConstSelect.roleType;
let memberVOList = JSON.stringify(response.data.memberVOList); // let memberVOList = JSON.stringify(response.data.memberVOList);
roleTypeList.forEach(function(element) { // roleTypeList.forEach(function(element) {
const rolename = element.value; // const rolename = element.value;
memberVOList = memberVOList.replace(new RegExp(rolename, 'g'), element.label); // memberVOList = memberVOList.replace(new RegExp(rolename, 'g'), element.label);
}); // });
memberVOList = JSON.parse(memberVOList); // memberVOList = JSON.parse(memberVOList);
const actionList = response.data.actionVOList; // const actionList = response.data.actionVOList;
actionList.forEach(element => { // actionList.forEach(element => {
const member = memberVOList.find(elem=>{ return elem.id == element.memberId; }); // const member = memberVOList.find(elem=>{ return elem.id == element.memberId; });
const memberName = member.name ? ' - ' + member.name : ''; // const memberName = member.name ? ' - ' + member.name : '';
switch (element.type) { // switch (element.type) {
case 'Conversation': // case 'Conversation':
{ // {
const target = memberVOList.find(elem=>{ return elem.id == element.targetId; }); // const target = memberVOList.find(elem=>{ return elem.id == element.targetId; });
const targetName = target.name ? ' - ' + target.name : ''; // const targetName = target.name ? ' - ' + target.name : '';
this.actionInfoList.push({id: element.id, isCoversition: true, memberName: member.role + memberName, targetName: target.role + targetName, reply: element.reply, row: element, visible: true}); // this.actionInfoList.push({id: element.id, isCoversition: true, memberName: member.role + memberName, targetName: target.role + targetName, reply: element.reply, row: element, visible: true});
break; // break;
} // }
case 'Command': // case 'Command':
{ // {
const deviceCommand = this.deviceCommandList.find(elem=>{ return elem.deviceCommand == element.deviceCommand; }); // const deviceCommand = this.deviceCommandList.find(elem=>{ return elem.deviceCommand == element.deviceCommand; });
this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role + memberName, command: deviceCommand.label, row: element, visible: false}); // this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role + memberName, command: deviceCommand.label, row: element, visible: false});
// switch (element.deviceCommand) { // // switch (element.deviceCommand) {
// case 'Train_Manual_Route_Blocking_Drive': // // case 'Train_Manual_Route_Blocking_Drive':
// { // // {
// this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role + memberName, command: deviceCommand.label, row: element, visible: false}); // // this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role + memberName, command: deviceCommand.label, row: element, visible: false});
// break; // // break;
// } // // }
// case 'Train_Manual_Limit_Drive': // // case 'Train_Manual_Limit_Drive':
// { // // {
// this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role + memberName, command: deviceCommand.label, row: element, visible: false}); // // this.actionInfoList.push({id: element.id, isCoversition: false, memberName: member.role + memberName, command: deviceCommand.label, row: element, visible: false});
// break; // // break;
// } // // }
// } // // }
} // }
} // }
}); // });
if (response.data.mapLocation) { // if (response.data.mapLocation) {
const mapLocation = {'offsetX': response.data.mapLocation.x, 'offsetY': response.data.mapLocation.y, 'scaleRate': response.data.mapLocation.scale}; // const mapLocation = {'offsetX': response.data.mapLocation.x, 'offsetY': response.data.mapLocation.y, 'scaleRate': response.data.mapLocation.scale};
this.$store.dispatch('scriptRecord/updateMapLocation', mapLocation); // this.$store.dispatch('scriptRecord/updateMapLocation', mapLocation);
} // }
this.loading = false; // this.loading = false;
}); // });
}, },
deleteAction(row) { deleteAction(row) {
const group = this.$props.group; const group = this.$props.group;