211 lines
9.7 KiB
Vue
211 lines
9.7 KiB
Vue
<template>
|
|
<el-dialog :title="title" :visible.sync="dialogVisible" width="1200px" :before-close="doClose" center custom-class="sceneModifyOut">
|
|
<el-form ref="form" :model="formModel" label-width="120px" class="sceneModify">
|
|
<!-- :rules="rules" -->
|
|
<el-table :data="actionList" border style="width: 661px;">
|
|
<el-table-column label="步骤名称" width="100">
|
|
{{ '' }}
|
|
</el-table-column>
|
|
<el-table-column label="动作内容" width="300">
|
|
<template slot-scope="scope">
|
|
<!-- v-model="scope.row.id" -->
|
|
<el-checkbox v-if="isModify" class="checkBoxAction" />
|
|
<div>{{ covert(scope.row) }}</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="语音识别关键词列表" width="300">
|
|
<template slot-scope="scope">
|
|
<div v-if="formModel.commandEvaluationRuleVOs[scope.row.id]&&formModel.commandEvaluationRuleVOs[scope.row.id].keyWords">
|
|
<el-tag v-for="(tag,index) in formModel.commandEvaluationRuleVOs[scope.row.id].keyWords" :key="index" closable :disable-transitions="false" @close="handleClose(scope.$index,index)">{{ tag }}</el-tag>
|
|
<el-input
|
|
v-if="formModel.commandEvaluationRuleVOs[scope.row.id].inputVisible"
|
|
:ref="'saveTagInput'+scope.row.id"
|
|
v-model="formModel.commandEvaluationRuleVOs[scope.row.id].inputValue"
|
|
size="small"
|
|
class="input-new-tag"
|
|
@keyup.enter.native="handleInputConfirm(scope.row.id)"
|
|
@blur="handleInputConfirm(scope.row.id)"
|
|
/>
|
|
<el-button v-else class="button-new-tag" size="small" @click="showInput(scope.row.id)">add添加</el-button>
|
|
</div>
|
|
<div v-else>
|
|
<el-button class="button-new-tag" size="small" @click="addKeyWord(scope.row.id)">添加</el-button>
|
|
</div>
|
|
<!-- scope.$index; -->
|
|
|
|
<!-- -->
|
|
|
|
</template>
|
|
<!-- keyWords -->
|
|
<!-- formModel.commandEvaluationRuleVOs[] -->
|
|
</el-table-column>
|
|
<!-- <el-form-item :prop="'stepVOs+[' + scope.$index + '].startActionId'">
|
|
</el-form-item> -->
|
|
</el-table>
|
|
</el-form>
|
|
</el-dialog>
|
|
</template>
|
|
<script>
|
|
// import store from '@/store/index_APP_TARGET';
|
|
import ConstConfig from '@/scripts/ConstConfig';
|
|
import Cookies from 'js-cookie';
|
|
import {getScriptByIdNew} from '@/api/script';
|
|
import {covertOperate} from '@/views/newMap/displayNew/scriptDisplay/component/covertOperation';
|
|
import {getPublishMapDetailById} from '@/api/jmap/map';
|
|
export default {
|
|
name:'ModifyStep',
|
|
props: {
|
|
title:{
|
|
type: String,
|
|
default() {
|
|
return '';
|
|
}
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
isModify:false,
|
|
dialogVisible:false,
|
|
actionList:[],
|
|
memberList:[],
|
|
formModel:{
|
|
commandEvaluationRuleVOs:{},
|
|
stepVOs:[],
|
|
operationStatisticVOs:[]
|
|
}
|
|
};
|
|
},
|
|
methods:{
|
|
doShow(row) {
|
|
// 加载剧本数据
|
|
getScriptByIdNew(row.scriptId).then(res=>{
|
|
this.actionList = res.data.actionList;
|
|
// 加载地图数据
|
|
getPublishMapDetailById(res.data.mapId).then(resp => {
|
|
this.$store.dispatch('map/setMapData', resp.data);
|
|
const stationMap = {};
|
|
resp.data.stationList.forEach(station=>{
|
|
stationMap[station.code] = station;
|
|
});
|
|
let lastData = JSON.stringify(res.data.memberList);
|
|
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
|
|
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);
|
|
const lastMemberList = [];
|
|
lastData.forEach((member, index)=>{
|
|
const userName = member.userName ? '-' + member.userName : '';
|
|
const name = member.name ? '-' + member.name : '';
|
|
if (member.deviceCode && member.type == '行值') {
|
|
const device = stationMap[member.deviceCode];
|
|
member.deviceName = device.name;
|
|
// || device.groupNumber
|
|
member.label = member.type + member.deviceName + name + userName;
|
|
member.normalName = member.type + member.deviceName + name;
|
|
} else if (member.deviceCode && member.type == '司机') {
|
|
member.deviceName = member.deviceCode;
|
|
member.label = member.type + member.deviceName + name + userName;
|
|
} else {
|
|
member.deviceName = '';
|
|
member.label = member.type + name + userName;
|
|
member.normalName = member.type + name;
|
|
}
|
|
lastMemberList.push(member);
|
|
this.memberList = lastMemberList;
|
|
this.dialogVisible = true;
|
|
});
|
|
});
|
|
});
|
|
},
|
|
doClose() {
|
|
// this.$refs.dataform.resetForm();
|
|
this.$store.dispatch('map/mapClear');
|
|
this.dialogVisible = false;
|
|
},
|
|
covert(element) {
|
|
const member = this.memberList[element.memberId];
|
|
let resultData = '';
|
|
if (element.type == 'Conversation') {
|
|
resultData = member.label + '说:' + element.content;
|
|
} else if (element.type == 'Operation') {
|
|
resultData = covertOperate(element.operationType, element.operationParamMap);
|
|
resultData = resultData.replace('请', member.label);
|
|
// this.scriptTipMessage = '请找到' + deviceName + ',执行【' + operateName.label + '】操作';
|
|
} else if (element.type == 'Exit_Conversation') {
|
|
resultData = member.label + '结束当前会话';
|
|
} else if (element.type == 'Start_Conversation' ) {
|
|
const inviteMember = [];
|
|
// this.$emit('allowCreatCoversition');
|
|
element.conversationMemberIds.forEach(id=>{
|
|
if (element.memberId != id) {
|
|
inviteMember.push((this.memberList[id] || {label: ''}).label);
|
|
}
|
|
});
|
|
resultData = member.label + '创建会话,选择' + inviteMember.toString();
|
|
} else if (element.type == 'Command') {
|
|
const targetName = this.memberList[element.commandInitiateVO.targetMemberId];
|
|
const CommandList = {
|
|
Drive_Ahead:'确认运行至前方站',
|
|
Route_Block_Drive:'进路闭塞法行车',
|
|
Drive_Through_The_Guide_Signal:'越引导信号行驶',
|
|
Drive_Through_The_Red_Light:'越红灯行驶',
|
|
Drive_In_Urm_Mode:'URM模式驾驶',
|
|
Set_Speed_Limit:'设置限速',
|
|
Open_Or_Close_Door:'开关门',
|
|
Switch_Hook_Lock: '道岔钩锁'
|
|
};
|
|
resultData = member.label + '对【' + targetName.label + '】下达【' + CommandList[element.commandInitiateVO.commandType] + '】指令';
|
|
} else if (element.type == 'Drive') {
|
|
if (element.targetSectionCode) {
|
|
const section = this.$store.getters['map/getDeviceByCode'](element.targetSectionCode);
|
|
if (section && section.name) {
|
|
resultData = member.label + '把车开到区段' + section.name;
|
|
}
|
|
}
|
|
}
|
|
return resultData;
|
|
},
|
|
addKeyWord(actionId) {
|
|
// debugger;
|
|
if (!this.formModel.commandEvaluationRuleVOs[actionId]) {
|
|
this.formModel.commandEvaluationRuleVOs[actionId] = {};
|
|
}
|
|
this.formModel.commandEvaluationRuleVOs[actionId].inputValue = '';
|
|
this.formModel.commandEvaluationRuleVOs[actionId].keyWords = [];
|
|
this.formModel.commandEvaluationRuleVOs[actionId].inputVisible = true;
|
|
// this.$nextTick(_ => {
|
|
// this.$refs['saveTagInput' + actionId].$refs.input.focus();
|
|
// });
|
|
},
|
|
showInput(actionId) {
|
|
this.formModel.commandEvaluationRuleVOs[actionId].inputVisible = true;
|
|
this.$nextTick(_ => {
|
|
this.$refs['saveTagInput' + actionId].$refs.input.focus();
|
|
});
|
|
},
|
|
handleInputConfirm(actionId) {
|
|
const inputValue = this.formModel.commandEvaluationRuleVOs[actionId].inputValue;
|
|
if (inputValue) {
|
|
this.formModel.commandEvaluationRuleVOs[actionId].keyWords.push(inputValue);
|
|
}
|
|
this.formModel.commandEvaluationRuleVOs[actionId].inputVisible = false;
|
|
this.formModel.commandEvaluationRuleVOs[actionId].inputValue = '';
|
|
}
|
|
}
|
|
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.checkBoxAction{
|
|
display: inline-block;
|
|
float: left;
|
|
margin-right: 8px;
|
|
}
|
|
</style>
|