rt-sim-training-client/src/views/drts/scene/modify.vue

699 lines
31 KiB
Vue
Raw Normal View History

<template>
2020-10-10 19:28:15 +08:00
<el-dialog :title="title" :visible.sync="dialogVisible" :before-close="doClose" top="50px" center custom-class="sceneModifyOut" fullscreen>
<el-form ref="form" :model="formModel" label-width="120px" class="sceneModify" @submit.native.prevent>
<!-- :rules="rules" -->
2020-10-10 19:28:15 +08:00
<el-table :data="actionList" border style="width:1250px;margin: 0 auto;" height="500" :span-method="objectSpanMethod">
<el-table-column label="步骤名称" width="100">
2020-09-28 20:54:34 +08:00
<template slot-scope="scope">
<div v-if="stepVOs[scope.row.id]">
{{ stepVOs[scope.row.id].description||'' }}
</div>
</template>
</el-table-column>
2020-10-10 19:28:15 +08:00
<el-table-column label="动作内容" width="350">
<template slot-scope="scope">
<!-- v-model="scope.row.id" -->
2020-09-29 09:31:29 +08:00
<el-checkbox v-if="isModify" v-model="checkBoxActionList[scope.row.id].status" :disabled="checkBoxActionList[scope.row.id].disabled" class="checkBoxAction" @change="((val)=>{changeSelectActionId(val, scope.row.id, scope.$index)})" />
2020-10-10 19:28:15 +08:00
<el-radio v-if="isOperate" v-model="radioBoxAction" :label="scope.row.id" name="operateAction" class="checkBoxAction" @change="((val)=>{changeSelectRadioActionId(val, scope.row.id, scope.$index)})">{{ '' }}</el-radio>
2020-09-28 20:54:34 +08:00
<div v-if="dialogVisible">{{ covert(scope.row) }}</div>
</template>
</el-table-column>
2020-10-10 19:28:15 +08:00
<el-table-column label="语音识别关键词列表" width="350">
<template slot-scope="scope">
2020-09-28 20:54:34 +08:00
<div v-if="commandEvaluationRuleVOs[scope.row.id]&&commandEvaluationRuleVOs[scope.row.id].keyWords">
<el-tag v-for="(tag,index) in commandEvaluationRuleVOs[scope.row.id].keyWords" :key="index" closable :disable-transitions="false" @close="handleClose(scope.row.id,index)">{{ tag }}</el-tag>
<el-input
2020-09-28 20:54:34 +08:00
v-if="commandEvaluationRuleVOs[scope.row.id].inputVisible"
:ref="'saveTagInput'+scope.row.id"
2020-09-28 20:54:34 +08:00
v-model="commandEvaluationRuleVOs[scope.row.id].inputValue"
size="small"
class="input-new-tag"
@keyup.enter.native="handleInputConfirm(scope.row.id)"
@blur="handleInputConfirm(scope.row.id)"
/>
2020-09-28 20:54:34 +08:00
<el-button v-else class="button-new-tag" size="small" @click="showInput(scope.row.id)">添加</el-button>
</div>
<div v-else>
<el-button class="button-new-tag" size="small" @click="addKeyWord(scope.row.id)">添加</el-button>
</div>
</template>
</el-table-column>
2020-09-28 20:54:34 +08:00
<el-table-column label="总分值" width="149">
<template slot-scope="scope">
<div v-if="commandEvaluationRuleVOs[scope.row.id]&&commandEvaluationRuleVOs[scope.row.id].score!=undefined">
<el-input-number
v-if="commandEvaluationRuleVOs[scope.row.id].scoreVisible"
:ref="'saveScoreInput'+scope.row.id"
v-model="commandEvaluationRuleVOs[scope.row.id].score"
:min="0"
size="small"
:max="Infinity"
:step="1"
@keyup.enter.native="handleScoreConfirm(scope.row.id)"
@blur="handleScoreConfirm(scope.row.id)"
/>
<div v-else style="cursor:pointer" @click="modifyScore(scope.row.id)">
{{ commandEvaluationRuleVOs[scope.row.id].score }}
</div>
</div>
<div v-else>
<el-button class="button-new-tag" size="small" @click="addScore(scope.row.id)">编辑</el-button>
</div>
</template>
</el-table-column>
<el-table-column label="超时时间" width="150">
<template slot-scope="scope">
<div v-if="commandEvaluationRuleVOs[scope.row.id]&&commandEvaluationRuleVOs[scope.row.id].timeOut!=undefined">
<el-input-number
v-if="commandEvaluationRuleVOs[scope.row.id].timeOutVisible"
:ref="'saveTimeOutInput'+scope.row.id"
v-model="commandEvaluationRuleVOs[scope.row.id].timeOut"
:min="0"
size="small"
:max="Infinity"
:step="1"
@keyup.enter.native="handleTimeOutConfirm(scope.row.id)"
@blur="handleTimeOutConfirm(scope.row.id)"
/>
<div v-else style="cursor:pointer" @click="modifyTimeOut(scope.row.id)">
{{ commandEvaluationRuleVOs[scope.row.id].timeOut }}
</div>
</div>
<div v-else>
<el-button class="button-new-tag" size="small" @click="addTimeOut(scope.row.id)">编辑</el-button>
</div>
</template>
</el-table-column>
<el-table-column label="扣除分值" width="150">
<template slot-scope="scope">
<div v-if="commandEvaluationRuleVOs[scope.row.id]&&commandEvaluationRuleVOs[scope.row.id].deductScore!=undefined">
<el-input-number
v-if="commandEvaluationRuleVOs[scope.row.id].deductScoreVisible"
:ref="'saveDeductScoreInput'+scope.row.id"
v-model="commandEvaluationRuleVOs[scope.row.id].deductScore"
:min="0"
size="small"
:max="Infinity"
:step="1"
@keyup.enter.native="handleDeductScoreConfirm(scope.row.id)"
@blur="handleDeductScoreConfirm(scope.row.id)"
/>
<div v-else style="cursor:pointer" @click="modifyDeductScore(scope.row.id)">
{{ commandEvaluationRuleVOs[scope.row.id].deductScore }}
</div>
</div>
<div v-else>
<el-button class="button-new-tag" size="small" @click="addDeductScore(scope.row.id)">编辑</el-button>
</div>
</template>
</el-table-column>
</el-table>
2020-10-10 19:28:15 +08:00
<table class="operateStatistic">
<thead>
<tr>
<th class="operateStatisticLT">
<div class="operateStatisticLIn">每一项分值</div>
</th>
<th class="operateStatisticRT">
<div class="operateStatisticLIn">运营统计项列表</div>
</th>
</tr>
</thead>
<tr>
<td class="operateStatisticLB">
<el-input-number
v-model="formModel.operationStatisticVO.score"
:style="{width: '130px'}"
:min="0"
size="small"
:max="100"
:step="1"
/>
</td>
<td class="operateStatisticRB">
<el-table :data="formModel.operationStatisticVO.itemVOS" border style="width:651px;float:left;" height="240">
<el-table-column prop="description" label="简介" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.description" type="text" :style="{width: '125px'}" size="small" :maxlength="100" />
</template>
</el-table-column>
<el-table-column prop="type" label="类型" width="150">
<template slot-scope="scope">
<el-select v-model="scope.row.type" :style="{width: '125px'}" size="small">
<el-option
v-for="option in operationItemType"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="actionId" label="关联步骤" width="150">
<template slot-scope="scope">
<el-button v-if="scope.row.type=='Time'" type="primary" size="small" class="selectStep" @click="selectStep(scope.row.actionId,scope.$index)">选择步骤</el-button>
<div v-if="scope.row.actionId">步骤id:{{ scope.row.actionId }}</div>
<!-- <el-select v-model="scope.row.stepId" :style="{width: '125px'}" size="small">
<el-option
v-for="option in stepVOs"
:key="option.id"
:label="option.description"
:value="option.id"
/>
</el-select> -->
</template>
</el-table-column>
<el-table-column prop="standardAnswer" label="非时间标准答案" width="150">
<template slot-scope="scope">
<el-input v-if="scope.row.type=='Non_Time'" v-model="scope.row.standardAnswer" type="text" :style="{width: '125px'}" size="small" :maxlength="100" />
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<span class="el-icon-error deleteScene" @click="handleDelete(scope.$index)" />
</template>
</el-table-column>
</el-table>
<el-button type="primary" size="small" class="addOperateItem" @click="addItemVO">添加</el-button>
</td>
</tr>
</table>
</el-form>
2020-10-10 19:28:15 +08:00
<div style="margin-top:15px;width:1250px;margin-left:auto;margin-right:auto;">
2020-09-28 20:54:34 +08:00
<el-button v-if="!isModify" type="primary" @click="doModifyDes">编辑步骤描述</el-button>
<el-button v-if="isModify" type="success" @click="cancleModifyDes">取消编辑步骤描述</el-button>
2020-10-10 19:28:15 +08:00
<!-- <el-button v-if="idOperateStatistic" type="success" @click="doOperateStatistic">编辑运营统计</el-button> -->
2020-09-28 20:54:34 +08:00
</div>
<step-description
ref="addStepDescription"
@cancleDescription="cancleDescription"
@submitDescription="submitDescription"
/>
2020-10-10 19:28:15 +08:00
<!-- <operate-statistic ref="operateStatistic" @submitOperateStatistic="submitOperateStatistic" /> -->
2020-09-30 15:19:02 +08:00
2020-09-28 20:54:34 +08:00
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">保存</el-button>
<el-button type="primary" @click="doConfirm">{{ $t('global.confirm') }}</el-button>
2020-09-28 20:54:34 +08:00
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</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';
2020-09-28 20:54:34 +08:00
import StepDescription from './stepDescription';
2020-10-10 19:28:15 +08:00
// import OperateStatistic from './operateStatistic';
import {covertOperate} from '@/views/newMap/displayNew/scriptDisplay/component/covertOperation';
2020-09-28 20:54:34 +08:00
import {updateCompetitionPracticalStep, getCompetitionPracticalSceneById} from '@/api/competition';
import {getPublishMapDetailById} from '@/api/jmap/map';
export default {
name:'ModifyStep',
2020-09-28 20:54:34 +08:00
components:{
2020-10-10 19:28:15 +08:00
StepDescription
// OperateStatistic
2020-09-28 20:54:34 +08:00
},
props: {
title:{
type: String,
default() {
return '';
}
}
},
data() {
return {
isModify:false,
2020-10-10 19:28:15 +08:00
isOperate:false,
dialogVisible:false,
2020-10-10 19:28:15 +08:00
currentSelectStep:'',
actionList:[],
memberList:[],
2020-10-10 19:28:15 +08:00
operationItemType:[{label:'时间', value:'Time'}, {label:'非时间', value:'Non_Time'}],
2020-09-28 20:54:34 +08:00
checkBoxActionList:[],
2020-10-10 19:28:15 +08:00
radioBoxAction:'',
2020-09-28 20:54:34 +08:00
commandEvaluationRuleVOs:{},
currentstepAction:[],
startArray:[],
endArray:[],
stepVOs:{},
formModel:{
2020-09-28 20:54:34 +08:00
id:'',
name:'',
main:true,
description:'',
disposalProcesses:'',
operationScore:'',
scriptId:'',
commandEvaluationRuleVOs:[],
stepVOs:[],
2020-10-10 19:44:58 +08:00
operationStatisticVO:{
score:'',
itemVOS:[]
}
}
};
},
2020-09-30 15:19:02 +08:00
computed: {
idOperateStatistic() {
return Object.values(this.stepVOs).length > 2;
}
},
methods:{
doShow(row) {
// 加载剧本数据
2020-09-28 20:54:34 +08:00
this.formModel.id = row.id;
this.formModel.name = row.name;
this.formModel.main = row.main;
this.formModel.description = row.description;
this.formModel.disposalProcesses = row.disposalProcesses;
this.formModel.operationScore = row.operationScore;
this.formModel.scriptId = row.scriptId;
getScriptByIdNew(row.scriptId).then(res=>{
this.actionList = res.data.actionList;
2020-09-28 21:00:14 +08:00
getCompetitionPracticalSceneById(row.id).then(response=>{
const commandEvaluationRuleVOs = {};
2020-09-30 15:19:02 +08:00
if (response.data.commandEvaluationRuleVOs) {
response.data.commandEvaluationRuleVOs.forEach(data=>{
commandEvaluationRuleVOs[data.actionId] = data;
// commandEvaluationRuleVOs[data.actionId].inputVisible = false;
2020-09-30 15:19:02 +08:00
});
}
2020-09-28 21:00:14 +08:00
const stepVOs = {};
2020-09-30 15:19:02 +08:00
if (response.data.stepVOs) {
response.data.stepVOs.forEach(data=>{
stepVOs[data.startActionId] = data;
const dataIndex = this.actionList.findIndex((value, index, arr)=>{ return value.id == data.startActionId; });
const dataIndex1 = this.actionList.findIndex((value, index, arr)=>{ return value.id == data.endActionId; });
this.startArray.push(dataIndex);
this.endArray.push(dataIndex1);
});
}
2020-09-28 21:00:14 +08:00
this.commandEvaluationRuleVOs = commandEvaluationRuleVOs;
2020-09-30 15:19:02 +08:00
if (response.data.operationStatisticVO) {
this.formModel.operationStatisticVO = response.data.operationStatisticVO;
}
2020-09-28 21:00:14 +08:00
this.stepVOs = stepVOs;
});
// 加载地图数据
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);
2020-09-30 18:16:08 +08:00
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;
}
2020-09-30 18:16:08 +08:00
lastMemberList[member.id] = member;
this.memberList = lastMemberList;
this.dialogVisible = true;
});
});
});
},
doClose() {
// this.$refs.dataform.resetForm();
this.dialogVisible = false;
2020-09-28 20:54:34 +08:00
this.$store.dispatch('map/mapClear');
},
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;
},
2020-09-28 20:54:34 +08:00
initCommandEvaluationRuleVOs(actionId) {
if (!this.commandEvaluationRuleVOs[actionId]) {
this.$set(this.commandEvaluationRuleVOs, actionId, {});
this.$set(this.commandEvaluationRuleVOs[actionId], 'actionId', actionId);
}
2020-09-28 20:54:34 +08:00
},
addKeyWord(actionId) {
this.initCommandEvaluationRuleVOs(actionId);
this.$set(this.commandEvaluationRuleVOs[actionId], 'inputValue', '');
this.$set(this.commandEvaluationRuleVOs[actionId], 'keyWords', []);
this.$set(this.commandEvaluationRuleVOs[actionId], 'inputVisible', true);
this.$nextTick(_ => {
this.$refs['saveTagInput' + actionId].$refs.input.focus();
});
},
addScore(actionId) {
this.initCommandEvaluationRuleVOs(actionId);
this.$set(this.commandEvaluationRuleVOs[actionId], 'score', 0);
this.$set(this.commandEvaluationRuleVOs[actionId], 'scoreVisible', true);
this.$nextTick(_ => {
this.$refs['saveScoreInput' + actionId].$refs.input.focus();
});
},
addTimeOut(actionId) {
this.initCommandEvaluationRuleVOs(actionId);
this.$set(this.commandEvaluationRuleVOs[actionId], 'timeOut', 0);
this.$set(this.commandEvaluationRuleVOs[actionId], 'timeOutVisible', true);
this.$nextTick(_ => {
this.$refs['saveTimeOutInput' + actionId].$refs.input.focus();
});
},
handleTimeOutConfirm(actionId) {
this.$set(this.commandEvaluationRuleVOs[actionId], 'timeOutVisible', false);
},
modifyTimeOut(actionId) {
this.$set(this.commandEvaluationRuleVOs[actionId], 'timeOutVisible', true);
this.$nextTick(_ => {
this.$refs['saveTimeOutInput' + actionId].$refs.input.focus();
});
},
showInput(actionId) {
const self = this;
// this.commandEvaluationRuleVOs[actionId].inputVisible = true;
this.$set(this.commandEvaluationRuleVOs[actionId], 'inputVisible', true);
this.$nextTick(_ => {
self.$refs['saveTagInput' + actionId].$refs.input.focus();
});
},
handleInputConfirm(actionId) {
2020-09-28 20:54:34 +08:00
const inputValue = this.commandEvaluationRuleVOs[actionId].inputValue;
if (inputValue) {
2020-09-28 20:54:34 +08:00
this.commandEvaluationRuleVOs[actionId].keyWords.push(inputValue);
}
this.$set(this.commandEvaluationRuleVOs[actionId], 'inputVisible', false);
this.$set(this.commandEvaluationRuleVOs[actionId], 'inputValue', '');
},
handleScoreConfirm(actionId) {
this.$set(this.commandEvaluationRuleVOs[actionId], 'scoreVisible', false);
},
modifyScore(actionId) {
this.$set(this.commandEvaluationRuleVOs[actionId], 'scoreVisible', true);
this.$nextTick(_ => {
this.$refs['saveScoreInput' + actionId].$refs.input.focus();
});
},
handleClose(index, tagIndex) {
const keyWords = this.commandEvaluationRuleVOs[index].keyWords;
keyWords.splice(tagIndex, 1);
},
handleDeductScoreConfirm(actionId) {
this.$set(this.commandEvaluationRuleVOs[actionId], 'deductScoreVisible', false);
},
modifyDeductScore(actionId) {
this.$set(this.commandEvaluationRuleVOs[actionId], 'deductScoreVisible', true);
this.$nextTick(_ => {
this.$refs['saveDeductScoreInput' + actionId].$refs.input.focus();
});
},
addDeductScore(actionId) {
this.initCommandEvaluationRuleVOs(actionId);
this.$set(this.commandEvaluationRuleVOs[actionId], 'deductScore', 0);
this.$set(this.commandEvaluationRuleVOs[actionId], 'deductScoreVisible', true);
this.$nextTick(_ => {
this.$refs['saveDeductScoreInput' + actionId].$refs.input.focus();
});
},
doConfirm() {
2020-10-10 19:28:15 +08:00
this.doUpdate();
this.doClose();
},
doSave() {
2020-10-10 19:28:15 +08:00
this.doUpdate();
},
2020-10-10 19:28:15 +08:00
doUpdate() {
2020-09-28 20:54:34 +08:00
let commandEvaluationRuleVOs = Object.values(this.commandEvaluationRuleVOs);
const stepVOs = Object.values(this.stepVOs);
commandEvaluationRuleVOs = commandEvaluationRuleVOs.filter(eachData=>{
return (eachData.keyWords && eachData.keyWords.length > 0) || eachData.timeOut || eachData.score || eachData.deductScore;
});
if (stepVOs.length > 0) {
stepVOs.sort(this.objectSort('startActionId'));
stepVOs.map((step, index)=>{
2020-09-30 15:19:02 +08:00
step.id = (index + 1);
2020-09-28 20:54:34 +08:00
});
}
if (commandEvaluationRuleVOs.length > 0) {
commandEvaluationRuleVOs.map(data=>{
delete data.inputValue;
delete data.inputVisible;
delete data.scoreVisible;
delete data.timeOutVisible;
delete data.deductScoreVisible;
});
}
2020-10-10 19:28:15 +08:00
const itemVOS = this.formModel.operationStatisticVO.itemVOS;
if (itemVOS.length > 0) {
let result = true;
itemVOS.forEach(item=>{
delete item.id;
if (item.description && (item.actionId || item.standardAnswer)) {
result = result && true;
} else {
result = result && false;
}
});
if (!result) {
this.$messageBox('请填写运营统计项列表');
return false;
}
2020-09-30 15:19:02 +08:00
}
2020-10-10 19:28:15 +08:00
// if (operationStatisticVO) {
// this.formModel.operationStatisticVO = operationStatisticVO;
// }
2020-09-28 20:54:34 +08:00
this.formModel.commandEvaluationRuleVOs = commandEvaluationRuleVOs;
this.formModel.stepVOs = stepVOs;
updateCompetitionPracticalStep(this.formModel).then(res=>{
this.$message.success('编辑步骤信息成功');
}).catch(error=>{
this.$message.success('编辑步骤信息失败:' + error.message);
});
},
doModifyDes() {
this.actionList.forEach(action=>{
this.$set(this.checkBoxActionList, action.id, {status:false});
});
2020-09-29 09:31:29 +08:00
this.startArray.forEach((start, index)=>{
for (var i = start; i <= this.endArray[index]; i++) {
this.$set(this.checkBoxActionList, this.actionList[i].id, {disabled:true});
}
});
2020-09-28 20:54:34 +08:00
this.isModify = true;
},
cancleModifyDes() {
this.isModify = false;
},
changeSelectActionId(val, actionId, index) {
if (val) {
this.currentstepAction.push({'actionId':actionId, 'index':index});
if (this.currentstepAction.length >= 2) {
this.$refs.addStepDescription.doShow();
}
} else {
const data = this.currentstepAction.findIndex((value, index, arr)=>{ return value.actionId == actionId; });
this.currentstepAction.splice(data, 1);
}
},
2020-10-10 19:28:15 +08:00
changeSelectRadioActionId(val, actionId, index) {
this.formModel.operationStatisticVO.itemVOS[this.currentSelectStep].actionId = actionId;
this.isOperate = false;
this.currentSelectStep = '';
},
2020-09-28 20:54:34 +08:00
cancleDescription() {
this.currentstepAction.forEach(data=>{
this.checkBoxActionList[data.actionId].status = false;
});
this.currentstepAction = [];
},
submitDescription(stepDescription) {
this.currentstepAction.sort(this.objectSort('actionId'));
2020-09-29 09:31:29 +08:00
let start, end;
2020-09-28 20:54:34 +08:00
this.currentstepAction.forEach((data, index)=>{
if (index % 2 == 0) {
this.startArray.push(data.index);
2020-09-29 09:31:29 +08:00
start = data.index;
2020-09-28 20:54:34 +08:00
} else {
this.endArray.push(data.index);
2020-09-29 09:31:29 +08:00
end = data.index;
2020-09-28 20:54:34 +08:00
}
});
2020-09-29 09:31:29 +08:00
for (var i = start; i <= end; i++) {
this.$set(this.checkBoxActionList, this.actionList[i].id, {disabled:true});
}
2020-09-28 20:54:34 +08:00
this.$set(this.stepVOs, this.currentstepAction[0].actionId, {description:stepDescription, startActionId:parseInt(this.currentstepAction[0].actionId), endActionId:parseInt(this.currentstepAction[1].actionId)});
this.cancleDescription();
},
2020-09-30 15:19:02 +08:00
submitOperateStatistic(formModel) {
this.doUpdate(formModel);
},
2020-09-28 20:54:34 +08:00
objectSort(keyName) {
return function (objectN, objectM) {
2020-09-30 18:36:05 +08:00
var valueN = parseInt(objectN[keyName]);
var valueM = parseInt(objectM[keyName]);
2020-09-28 20:54:34 +08:00
if (valueN > valueM) return 1;
else if (valueN < valueM) return -1;
else return 0;
};
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (this.startArray.length > 0) {
if (columnIndex === 0) {
let rowspan = 1;
let colspan = 1;
for (var i = 0; i < this.startArray.length; i++) {
if (rowIndex == this.startArray[i]) {
rowspan = this.endArray[i] - this.startArray[i] + 1;
colspan = 1;
} else if (rowIndex > this.startArray[i] && rowIndex <= this.endArray[i]) {
rowspan = 0;
colspan = 0;
}
}
return {
rowspan:rowspan,
colspan:colspan
};
}
}
2020-09-30 15:19:02 +08:00
},
2020-10-10 19:28:15 +08:00
// doOperateStatistic() {
// this.$refs.operateStatistic.doShow(this.stepVOs, this.formModel.operationStatisticVO);
// },
handleDelete(index) {
this.formModel.operationStatisticVO.itemVOS.splice(index, 1);
},
addItemVO() {
this.formModel.operationStatisticVO.itemVOS.push({'description':'', actionId:'', type:'Time'});
},
selectStep(actionId, index) {
this.currentSelectStep = index;
this.radioBoxAction = actionId;
this.isOperate = true;
}
}
};
</script>
<style lang="scss" scoped>
.checkBoxAction{
display: inline-block;
float: left;
margin-right: 8px;
}
2020-09-28 20:54:34 +08:00
.input-new-tag {
width: 60px;
margin-left: 10px;
margin-bottom: 10px;
vertical-align: bottom;
}
.button-new-tag{
margin-bottom:10px;
2020-10-10 19:28:15 +08:00
}
.operateStatistic{
width: 1250px;
margin: 15px auto;
border: 1px #EBEEF5 solid;
}
.operateStatisticLT{
width: 300px;
padding: 10px;
border-bottom: 1px #EBEEF5 solid;
border-right: 1px solid #EBEEF5;
}
.operateStatisticLB{
padding: 10px;
border-right: 1px solid #EBEEF5;
}
.operateStatisticRT{
width: 950px;
padding: 10px;
border-bottom: 1px #EBEEF5 solid;
}
.operateStatisticRB{
padding: 10px;
}
.operateStatisticLIn{
text-align: left;
padding-left: 5px;
color: #909399;
}
.addOperateItem{
margin-left: 20px;
margin-top: 200px;
}
.deleteScene{
font-size: 24px;
color: #f00;
cursor: pointer;
}
.selectStep{
2020-09-28 20:54:34 +08:00
}
</style>
<style lang="scss">
.el-tag {
margin-right: 10px;
margin-bottom: 10px;
vertical-align:top;
}
</style>