竞赛 理论考试代码调整 / 竞赛 场景更新代码调整
This commit is contained in:
parent
c5fbc578db
commit
bca528df88
@ -277,7 +277,7 @@ export function getCompetitionPracticalScene(params) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取场景列表 */
|
||||
/** 添加场景 */
|
||||
export function addCompetitionPracticalScene(data) {
|
||||
return request({
|
||||
url: `/api/v1/competitionPractical`,
|
||||
@ -286,3 +286,27 @@ export function addCompetitionPracticalScene(data) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除场景 */
|
||||
export function deleteCompetitionPracticalScene(sceneId) {
|
||||
return request({
|
||||
url: `/api/v1/competitionPractical/${sceneId}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新场景 */
|
||||
export function updateCompetitionPracticalScene(data) {
|
||||
return request({
|
||||
url: `/api/v1/competitionPractical`,
|
||||
method: 'PUT',
|
||||
data
|
||||
});
|
||||
}
|
||||
/** 获取场景 */
|
||||
export function getCompetitionPracticalSceneById(id) {
|
||||
return request({
|
||||
url: `/api/v1/competitionPractical/detail/${id}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog title="创建场景" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
|
||||
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
|
||||
@ -8,11 +8,18 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import {addCompetitionPracticalScene, getCompetitionPracticalSceneById, updateCompetitionPracticalScene} from '@/api/competition';
|
||||
export default {
|
||||
name:'SceneCreate',
|
||||
props: {
|
||||
scriptList:{
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
title:{
|
||||
type: String,
|
||||
default() {
|
||||
return '';
|
||||
}
|
||||
@ -21,7 +28,9 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible:false,
|
||||
isEdit:false,
|
||||
formModel: {
|
||||
id:'',
|
||||
name:'', // 场景名称
|
||||
description:'', // 场景描述
|
||||
disposalProcesses:'', // 处置流程
|
||||
@ -37,7 +46,7 @@ export default {
|
||||
const form = {
|
||||
labelWidth: '120px',
|
||||
items: [
|
||||
{ prop: 'name', label: '场景名称', type: 'text' },
|
||||
{ prop: 'name', label: '场景名称', type: 'text', maxlength:80 },
|
||||
{ prop: 'description', label: '场景描述', type: 'textarea' },
|
||||
{ prop: 'disposalProcesses', label: '处置流程', type: 'textarea' },
|
||||
{ prop: 'operationScore', label: '运营部分总分', type: 'number', min: 0, max: 100, step:1, precision:1 },
|
||||
@ -50,16 +59,16 @@ export default {
|
||||
rules() {
|
||||
const crules = {
|
||||
name: [
|
||||
{ validator: this.validateSceneName, trigger: 'blur' },
|
||||
{ validator: this.validateSceneName, trigger: 'change' }
|
||||
{ required: true, validator: this.validateSceneName, trigger: 'blur' },
|
||||
{ required: true, validator: this.validateSceneName, trigger: 'change' }
|
||||
],
|
||||
description: [
|
||||
{ validator: this.validateDescription, trigger: 'blur' },
|
||||
{ validator: this.validateDescription, trigger: 'change' }
|
||||
{ required: true, validator: this.validateDescription, trigger: 'blur' },
|
||||
{ required: true, validator: this.validateDescription, trigger: 'change' }
|
||||
],
|
||||
disposalProcesses: [
|
||||
{ validator: this.validateDisposalProcesses, trigger: 'blur' },
|
||||
{ validator: this.validateDisposalProcesses, trigger: 'change' }
|
||||
{ required: true, validator: this.validateDisposalProcesses, trigger: 'blur' },
|
||||
{ required: true, validator: this.validateDisposalProcesses, trigger: 'change' }
|
||||
],
|
||||
scriptId:[
|
||||
{ required: true, message: '请选择剧本', trigger: 'change' }
|
||||
@ -96,26 +105,45 @@ export default {
|
||||
return callback();
|
||||
}
|
||||
},
|
||||
doShow(questid) {
|
||||
this.dialogVisible = true;
|
||||
// if (questid) {
|
||||
// getScriptByIdBasic(questid).then(resp=>{
|
||||
// const data = {'name':resp.data.name, 'description':resp.data.description, 'mapId':resp.data.mapId, isRace:resp.data.isRace};
|
||||
// this.formModel = data;
|
||||
// this.formModel.id = questid;
|
||||
// this.dialogVisible = true;
|
||||
// this.isEdit = true;
|
||||
// });
|
||||
// } else {
|
||||
// this.formModel.isRace = true;
|
||||
// this.dialogVisible = true;
|
||||
// this.isEdit = false;
|
||||
// }
|
||||
doShow(sceneId) {
|
||||
// this.dialogVisible = true;
|
||||
if (sceneId) {
|
||||
getCompetitionPracticalSceneById(sceneId).then(resp=>{
|
||||
const data = {'name':resp.data.name,
|
||||
'description':resp.data.description,
|
||||
'disposalProcesses':resp.data.disposalProcesses,
|
||||
'scriptId':resp.data.scriptId,
|
||||
'operationScore':resp.data.operationScore,
|
||||
'main':resp.data.main};
|
||||
this.formModel = data;
|
||||
this.formModel.id = sceneId;
|
||||
this.dialogVisible = true;
|
||||
this.isEdit = true;
|
||||
});
|
||||
} else {
|
||||
this.dialogVisible = true;
|
||||
this.isEdit = false;
|
||||
}
|
||||
},
|
||||
doCreate() {
|
||||
const self = this;
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
self.$emit('create', Object.assign({}, this.formModel));
|
||||
if (this.isEdit) {
|
||||
updateCompetitionPracticalScene(Object.assign({}, this.formModel)).then(resp => {
|
||||
this.$emit('reloadTable');
|
||||
this.$message.success('更新场景成功');
|
||||
}).catch(error => {
|
||||
this.$messageBox(`更新场景失败: ${error.message}`);
|
||||
});
|
||||
} else {
|
||||
delete this.formModel.id;
|
||||
addCompetitionPracticalScene(Object.assign({}, this.formModel)).then(resp => {
|
||||
this.$emit('reloadTable');
|
||||
this.$message.success('创建场景成功');
|
||||
}).catch(error => {
|
||||
this.$messageBox(`创建场景失败: ${error.message}`);
|
||||
});
|
||||
}
|
||||
self.doClose();
|
||||
});
|
||||
},
|
||||
|
@ -1,19 +1,22 @@
|
||||
<template>
|
||||
<div>
|
||||
<query-list-page ref="user" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<create-scene ref="createScene" :script-list="scriptList" title="创建场景" @create="handleConfirmCreate" />
|
||||
<!-- <create-practice ref="modifyPractice" :map-list="mapList" title="修改实操" @reloadTable="reloadTable" @create="handleConfirmModify" /> -->
|
||||
<create-scene ref="createScene" title="创建场景" :script-list="scriptList" @reloadTable="reloadTable" />
|
||||
<create-scene ref="updateScene" title="更新场景" :script-list="scriptList" @reloadTable="reloadTable" />
|
||||
<modify-step ref="modifyStep" title="更新场景" />
|
||||
<!-- <update-scene ref="modifyScene" :script-list="scriptList" @reloadTable="reloadTable" /> -->
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import { getCompetitionPracticalScene, addCompetitionPracticalScene } from '@/api/competition';
|
||||
import { getCompetitionPracticalScene, deleteCompetitionPracticalScene } from '@/api/competition';
|
||||
import { getScriptPageListOnlineNew } from '@/api/script';
|
||||
import CreateScene from './create';
|
||||
import ModifyStep from './modify';
|
||||
export default {
|
||||
name:'SceneManage',
|
||||
components:{
|
||||
CreateScene
|
||||
CreateScene,
|
||||
ModifyStep
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -72,6 +75,11 @@ export default {
|
||||
handleClick: this.doUpdate,
|
||||
type: 'primary'
|
||||
},
|
||||
{
|
||||
name: '编辑步骤数据',
|
||||
handleClick: this.doModify,
|
||||
type: 'success'
|
||||
},
|
||||
{
|
||||
name: '删 除',
|
||||
handleClick: this.doDelete,
|
||||
@ -93,27 +101,34 @@ export default {
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
doUpdate() {
|
||||
|
||||
// 修改
|
||||
doUpdate(index, row) {
|
||||
this.$refs.updateScene.doShow(row.id);
|
||||
},
|
||||
doDelete() {
|
||||
|
||||
doDelete(index, row) {
|
||||
this.$confirm('此操作将删除此场景, 是否继续?', this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteCompetitionPracticalScene(row.id).then(response => {
|
||||
this.$message.success('删除场景成功');
|
||||
this.reloadTable();
|
||||
}).catch((error) => {
|
||||
this.$messageBox(`删除场景失败: ${error.message}`);
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
doCreate() {
|
||||
this.$refs.createScene.doShow();
|
||||
this.$refs.createScene.doShow(null);
|
||||
},
|
||||
reloadTable() {
|
||||
if (this.queryList && this.queryList.reload) {
|
||||
this.queryList.reload();
|
||||
}
|
||||
},
|
||||
handleConfirmCreate(data) {
|
||||
addCompetitionPracticalScene(data).then(resp => {
|
||||
this.reloadTable();
|
||||
this.$message.success('创建场景成功');
|
||||
}).catch(error => {
|
||||
this.$messageBox(`创建场景失败: ${error.message}`);
|
||||
});
|
||||
doModify(index, row) {
|
||||
this.$refs.modifyStep.doShow(row);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
210
src/views/drts/scene/modify.vue
Normal file
210
src/views/drts/scene/modify.vue
Normal file
@ -0,0 +1,210 @@
|
||||
<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>
|
275
src/views/drts/scene/update.vue
Normal file
275
src/views/drts/scene/update.vue
Normal file
@ -0,0 +1,275 @@
|
||||
<template>
|
||||
<el-dialog title="修改场景" :visible.sync="dialogVisible" width="1000px" :before-close="doClose" center custom-class="sceneModifyOut">
|
||||
<el-form ref="form" :rules="rules" :model="formModel" label-width="120px" class="sceneModify">
|
||||
<el-form-item label="场景名称" :required="true" prop="name">
|
||||
<el-input v-model="formModel.name" type="text" :style="{width: '80%'}" :maxlength="80" />
|
||||
</el-form-item>
|
||||
<el-form-item label="场景描述" :required="true" prop="description">
|
||||
<el-input v-model="formModel.description" type="textarea" :style="{width: '80%'}" />
|
||||
</el-form-item>
|
||||
<el-form-item label="处置流程" :required="true" prop="disposalProcesses">
|
||||
<el-input v-model="formModel.disposalProcesses" type="textarea" :style="{width: '80%'}" />
|
||||
</el-form-item>
|
||||
<el-form-item label="步骤描述" :required="true" prop="stepVOs">
|
||||
<el-button type="primary" size="small" style="margin-bottom:10px" @click="addStepVO">添加</el-button>
|
||||
<el-table :data="formModel.stepVOs" border style="width: 661px;">
|
||||
<el-table-column prop="description" label=" 简介" width="200">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-form-item :prop="'stepVOs[' + scope.$index + '].description'"> -->
|
||||
<el-input v-model="scope.row.description" type="text" :style="{width: '170px'}" size="small" />
|
||||
<!-- </el-form-item> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="startActionId" label=" 首动作" width="200">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-form-item :prop="'stepVOs+[' + scope.$index + '].startActionId'"> -->
|
||||
<el-select v-model="scope.row.startActionId" type="textarea" :style="{width: '170px'}" size="small">
|
||||
<el-option
|
||||
v-for="option in actionList"
|
||||
:key="option.id"
|
||||
:label="option.name"
|
||||
:value="option.id"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- </el-form-item> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="endActionId" label=" 尾动作" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.endActionId" type="textarea" :style="{width: '170px'}" size="small">
|
||||
<el-option
|
||||
v-for="option in actionList"
|
||||
:key="option.id"
|
||||
:label="option.name"
|
||||
:value="option.id"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="60">
|
||||
<template slot-scope="scope">
|
||||
<span class="el-icon-error deleteScene" @click="handleDelete(scope.$index)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
<el-form-item label=" 指令下达规则" :required="true" prop="commandPublishStatistics">
|
||||
<el-button type="primary" size="small" style="margin-bottom:10px" @click="addStatistics">添加</el-button>
|
||||
<el-table :data="formModel.commandPublishStatistics" border style="width: 751px;">
|
||||
<el-table-column prop="keyWords" label=" 语音识别关键词列表" width="250">
|
||||
<template slot-scope="scope" style="font-size:0">
|
||||
<el-tag v-for="(tag,index) in scope.row.keyWords" :key="index" closable :disable-transitions="false" @close="handleClose(scope.$index,index)">{{ tag }}</el-tag>
|
||||
<el-input
|
||||
v-if="scope.row.inputVisible"
|
||||
:ref="'saveTagInput'+scope.$index"
|
||||
v-model="scope.row.inputValue"
|
||||
size="small"
|
||||
class="input-new-tag"
|
||||
@keyup.enter.native="handleInputConfirm(scope.$index)"
|
||||
@blur="handleInputConfirm(scope.$index)"
|
||||
/>
|
||||
<el-button v-else class="button-new-tag" size="small" @click="showInput(scope.$index)">添加</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="actionId" label="动作" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.actionId" type="textarea" :style="{width: '170px'}" size="small">
|
||||
<el-option
|
||||
v-for="option in actionList"
|
||||
:key="option.id"
|
||||
:label="option.name"
|
||||
:value="option.id"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="timeOut" label="超时时间" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.timeOut"
|
||||
:style="{width: '100px'}"
|
||||
:min="0"
|
||||
size="small"
|
||||
:max="Infinity"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="score" label="总分值" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.score"
|
||||
:style="{width: '100px'}"
|
||||
:min="0"
|
||||
size="small"
|
||||
:max="Infinity"
|
||||
:step="1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
<el-form-item label="运营部分总分" :required="true" prop="operationScore">
|
||||
<el-input-number v-model="formModel.operationScore" :controls="true" :min="0" :max="100" :step="1" />
|
||||
</el-form-item>
|
||||
<el-form-item label="关联剧本" :required="true" prop="scriptId">
|
||||
<!-- <el-input-number v-model="formModel.scriptId" :controls="true" :min="0" :max="100" :step="1" /> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doUpdate">{{ $t('global.confirm') }}</el-button>
|
||||
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name:'UpdateScene',
|
||||
props: {
|
||||
scriptList:{
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible:false,
|
||||
sceneId:'',
|
||||
actionList:[],
|
||||
formModel:{
|
||||
name:'', // 场景名称
|
||||
description:'', // 场景描述
|
||||
disposalProcesses:'', // 处置流程
|
||||
scriptId:'', // 剧本id
|
||||
operationScore:0, // 运营部分总分(站间停车等)
|
||||
main:true, // 是否主场景
|
||||
stepVOs:[], // 步骤描述
|
||||
commandPublishStatistics:[] // 指令下达规则列表
|
||||
}
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
rules() {
|
||||
const crules = {
|
||||
name: [
|
||||
{ required: true, validator: this.validateSceneName, trigger: 'blur' },
|
||||
{ required: true, validator: this.validateSceneName, trigger: 'change' }
|
||||
],
|
||||
description: [
|
||||
{ required: true, validator: this.validateDescription, trigger: 'blur' },
|
||||
{ required: true, validator: this.validateDescription, trigger: 'change' }
|
||||
],
|
||||
disposalProcesses: [
|
||||
{ required: true, validator: this.validateDisposalProcesses, trigger: 'blur' },
|
||||
{ required: true, validator: this.validateDisposalProcesses, trigger: 'change' }
|
||||
],
|
||||
scriptId:[
|
||||
{ required: true, message: '请选择剧本', trigger: 'change' }
|
||||
],
|
||||
operationScore:[
|
||||
{ required: true, message: '请输入运营部分总分', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
validateSceneName(rule, value, callback) {
|
||||
if (value.trim().length === 0) {
|
||||
this.formModel.name = this.formModel.name.replace(/\s/g, '');
|
||||
return callback(new Error('请输入场景名称'));
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
},
|
||||
validateDescription(rule, value, callback) {
|
||||
if (value.trim().length === 0) {
|
||||
this.formModel.description = this.formModel.description.replace(/\s/g, '');
|
||||
return callback(new Error('请输入场景描述'));
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
},
|
||||
validateDisposalProcesses(rule, value, callback) {
|
||||
if (value.trim().length === 0) {
|
||||
this.formModel.disposalProcesses = this.formModel.disposalProcesses.replace(/\s/g, '');
|
||||
return callback(new Error('请输入处置流程'));
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
},
|
||||
doShow(sceneId) {
|
||||
this.dialogVisible = true;
|
||||
this.sceneId = sceneId;
|
||||
|
||||
},
|
||||
doClose() {
|
||||
this.$refs.form.resetFields();
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
doUpdate() {
|
||||
|
||||
},
|
||||
addStepVO() {
|
||||
this.formModel.stepVOs.push({competitionId:this.sceneId, description:'', startActionId:'', endActionId:''});
|
||||
},
|
||||
addStatistics() {
|
||||
this.formModel.commandPublishStatistics.push({competitionId:this.sceneId, keyWords:[], actionId:'', timeOut:0, inputVisible:false, inputValue:'', score:0 });
|
||||
},
|
||||
handleDelete(index) {
|
||||
this.formModel.stepVOs.splice(index, 1);
|
||||
},
|
||||
handleClose(index, tagIndex) {
|
||||
const keyWords = this.formModel.commandPublishStatistics[index].keyWords;
|
||||
keyWords.splice(tagIndex, 1);
|
||||
},
|
||||
handleInputConfirm(index) {
|
||||
const inputValue = this.formModel.commandPublishStatistics[index].inputValue;
|
||||
if (inputValue) {
|
||||
this.formModel.commandPublishStatistics[index].keyWords.push(inputValue);
|
||||
}
|
||||
this.formModel.commandPublishStatistics[index].inputVisible = false;
|
||||
this.formModel.commandPublishStatistics[index].inputValue = '';
|
||||
},
|
||||
showInput(index) {
|
||||
this.formModel.commandPublishStatistics[index].inputVisible = true;
|
||||
this.$nextTick(_ => {
|
||||
this.$refs['saveTagInput' + index].$refs.input.focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.deleteScene{
|
||||
font-size: 24px;
|
||||
color: #f00;
|
||||
cursor: pointer;
|
||||
}
|
||||
.sceneModify{
|
||||
height:500px;
|
||||
overflow: auto;
|
||||
}
|
||||
.input-new-tag {
|
||||
width: 60px;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.button-new-tag{
|
||||
margin-bottom:10px;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.sceneModifyOut.el-dialog--center .el-dialog__body {
|
||||
text-align: initial;
|
||||
padding: 25px 10px 30px 10px;
|
||||
}
|
||||
.el-tag {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
vertical-align:top;
|
||||
}
|
||||
</style>
|
@ -58,9 +58,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="theoryExamBody">
|
||||
<div class="theoryExamScore">{{ '测验得分:' }}<span class="resultScoreStyle">{{ resultScore+' 分' }}</span></div>
|
||||
<div class="theoryExamWrongListName">错题列表</div>
|
||||
<div class="theoryExamWrongList">
|
||||
<div v-if="theoryExamWrongList.length>0" class="theoryExamWrongList">
|
||||
<div class="theoryExamScore">{{ '测验得分:' }}<span class="resultScoreStyle">{{ resultScore+' 分' }}</span></div>
|
||||
<div class="theoryExamWrongListName">错题列表</div>
|
||||
<div class="theoryExamWrongListL">
|
||||
<div class="QuestionName">{{ covertWrong() }}</div>
|
||||
<div class="choiceList">
|
||||
@ -98,6 +98,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="el-icon-success theoryExamEnd" />
|
||||
<div class="theoryExamScore1">{{ '测验得分:' }}<span class="resultScoreStyle">{{ resultScore+' 分' }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@ -293,10 +297,20 @@ export default {
|
||||
this.theoryExamWrongList = writeList.filter(wrong=>{
|
||||
return wrong.correct == false;
|
||||
});
|
||||
this.resultScore = writeList.reduce((prev, cur, index, arr)=>{
|
||||
return prev.score == undefined ? prev + cur.score : prev.score + cur.score;
|
||||
});
|
||||
this.getWrongDataOption();
|
||||
if (writeList.length > 0) {
|
||||
if (writeList.length >= 2) {
|
||||
this.resultScore = writeList.reduce((prev, cur, index, arr)=>{
|
||||
return prev.score == undefined ? prev + cur.score : prev.score + cur.score;
|
||||
});
|
||||
} else {
|
||||
this.resultScore = writeList[0].score;
|
||||
}
|
||||
} else {
|
||||
this.resultScore = 0;
|
||||
}
|
||||
if (this.theoryExamWrongList.length > 0) {
|
||||
this.getWrongDataOption();
|
||||
}
|
||||
|
||||
}).catch(()=>{
|
||||
this.$message.error('提交失败,请稍后再试');
|
||||
@ -419,6 +433,8 @@ export default {
|
||||
overflow:auto;
|
||||
padding-left: 10px;
|
||||
width: 256px;
|
||||
border: 1px #ececec solid;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.eachQuestionNum{
|
||||
color: #8f7f70;
|
||||
@ -524,6 +540,17 @@ export default {
|
||||
margin-top: 10px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.theoryExamScore1{
|
||||
text-align: center;
|
||||
font-size: 17px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.theoryExamEnd{
|
||||
font-size: 90px;
|
||||
color: #007b00;
|
||||
margin-left: 340px;
|
||||
margin-top: 115px;
|
||||
}
|
||||
.theoryExamWrongList{}
|
||||
.theoryExamWrongListL{
|
||||
width: 500px;
|
||||
|
@ -1,5 +1,6 @@
|
||||
import CMD from '@/scripts/cmdPlugin/CommandEnum';
|
||||
import store from '@/store/index_APP_TARGET';
|
||||
import { deviceFaultType, deviceType} from '@/scripts/cmdPlugin/Config';
|
||||
// 操作
|
||||
export const operateEnum = {
|
||||
Set_Fault:{
|
||||
@ -146,7 +147,28 @@ export const operateEnum = {
|
||||
// 转换函数
|
||||
export function covertOperate(operationType, operationParamMap) {
|
||||
if (operationType == 'Set_Fault' || operationType == 'Cancel_Fault') {
|
||||
// covertOperation(operationType);
|
||||
let deviceName = '';
|
||||
const device = store.getters['map/getDeviceByCode'](operationParamMap.code);
|
||||
if (device._type == 'StationStand') {
|
||||
const station = store.getters['map/getDeviceByCode'](device.stationCode);
|
||||
deviceName += '【车站-' + station.name + '】/';
|
||||
} else {
|
||||
deviceName = '' + device.name;
|
||||
}
|
||||
let tip = '请找到' + deviceType[device._type] + deviceName + ',';
|
||||
if (operationType == 'Set_Fault') {
|
||||
tip += '设置故障,';
|
||||
} else {
|
||||
tip += '取消故障,';
|
||||
}
|
||||
const data = deviceFaultType[device._type];
|
||||
data.forEach(each=>{
|
||||
if (each.value == operationParamMap.faultType) {
|
||||
tip += '参数为:' + each.label;
|
||||
}
|
||||
});
|
||||
return tip;
|
||||
|
||||
} else {
|
||||
let device = operationType.split('_')[0];
|
||||
if (device == 'CM') {
|
||||
|
Loading…
Reference in New Issue
Block a user