This commit is contained in:
fan 2020-09-30 15:22:47 +08:00
commit 46dca0d34b
9 changed files with 212 additions and 19 deletions

View File

@ -33,7 +33,8 @@ class Iscs {
const height = opts.config.height;
this.isAllowDragging = false;
this.$iscsZr = zrender.init(opts.dom, Object.assign({ renderer, devicePixelRatio, width, height }, opts.config));
this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {})); // 缩放
this.$iscsZr.dom.setAttribute('tabIndex', -1);
this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {})); // 缩放
this.$mouseController = new MouseController(this);
this.$mouseController.enable();

View File

@ -19,7 +19,8 @@ class KeyboardController extends Eventful {
opts = opts || {};
this._keyOnDownUp = opts.keyOnDownUp || true;
dom.addEventListener('keyup', keydownHandle, false);
dom.addEventListener('keyup', keydownHandle, false);
dom.focus();
};
this.disable = function () {

View File

@ -22,6 +22,7 @@ class KeyboardController extends Eventful {
dom.addEventListener('keydown', keydownHandle, false);
dom.addEventListener('keyup', keyupHandle, false);
dom.focus();
};
this.disable = function () {

View File

@ -44,7 +44,7 @@ class Jlmap {
this.zoomOnMouseWheel = opts.options.zoomOnMouseWheel;
this.$zr = zrender.init(opts.dom, deepAssign({ renderer, devicePixelRatio, width, height }, opts.config));
this.$zr.dom.setAttribute('tabIndex', -1);
this.$options = new Options(deepAssign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {}), (dataZoom) => { this.$mouseController.trigger(this.events.DataZoom, dataZoom); }); // 缩放
this.$painter = new Painter(this);
this.$painter.updateZrSize({width: this.$zr.getWidth(), height: this.$zr.getHeight()});

View File

@ -20,7 +20,8 @@ class KeyboardController extends Eventful {
opts = opts || {};
this._keyOnDownUp = opts.keyOnDownUp || true;
dom.addEventListener('keyup', keydownHandle, false);
dom.addEventListener('keyup', keydownHandle, false);
dom.focus();
};
this.disable = function () {

View File

@ -54,6 +54,7 @@ class Jlmap {
this.previewOrMapDraw = opts.showConfig.previewOrMapDraw;
this.$zr = zrender.init(opts.dom, deepAssign({ renderer, devicePixelRatio, width, height }, opts.config));
this.$zr.dom.setAttribute('tabIndex', -1);
this.$options = new Options(deepAssign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {}), (dataZoom) => { this.$mouseController.trigger(this.events.DataZoom, dataZoom); }); // 缩放
this.$painter = new Painter(this);

View File

@ -111,12 +111,15 @@
<div style="margin-top:15px;">
<el-button v-if="!isModify" type="primary" @click="doModifyDes">编辑步骤描述</el-button>
<el-button v-if="isModify" type="success" @click="cancleModifyDes">取消编辑步骤描述</el-button>
<el-button v-if="idOperateStatistic" type="success" @click="doOperateStatistic">编辑运营统计</el-button>
</div>
<step-description
ref="addStepDescription"
@cancleDescription="cancleDescription"
@submitDescription="submitDescription"
/>
<operate-statistic ref="operateStatistic" @submitOperateStatistic="submitOperateStatistic" />
<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>
@ -129,13 +132,15 @@ import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
import {getScriptByIdNew} from '@/api/script';
import StepDescription from './stepDescription';
import OperateStatistic from './operateStatistic';
import {covertOperate} from '@/views/newMap/displayNew/scriptDisplay/component/covertOperation';
import {updateCompetitionPracticalStep, getCompetitionPracticalSceneById} from '@/api/competition';
import {getPublishMapDetailById} from '@/api/jmap/map';
export default {
name:'ModifyStep',
components:{
StepDescription
StepDescription,
OperateStatistic
},
props: {
title:{
@ -167,11 +172,15 @@ export default {
scriptId:'',
commandEvaluationRuleVOs:[],
stepVOs:[],
operationStatisticVOs:[]
operationStatisticVO:{}
}
};
},
computed: {
idOperateStatistic() {
return Object.values(this.stepVOs).length > 2;
}
},
methods:{
doShow(row) {
//
@ -186,18 +195,25 @@ export default {
this.actionList = res.data.actionList;
getCompetitionPracticalSceneById(row.id).then(response=>{
const commandEvaluationRuleVOs = {};
response.data.commandEvaluationRuleVOs.forEach(data=>{
commandEvaluationRuleVOs[data.actionId] = data;
});
if (response.data.commandEvaluationRuleVOs) {
response.data.commandEvaluationRuleVOs.forEach(data=>{
commandEvaluationRuleVOs[data.actionId] = data;
});
}
const 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);
});
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);
});
}
this.commandEvaluationRuleVOs = commandEvaluationRuleVOs;
if (response.data.operationStatisticVO) {
this.formModel.operationStatisticVO = response.data.operationStatisticVO;
}
this.stepVOs = stepVOs;
});
//
@ -375,7 +391,7 @@ export default {
this.$refs['saveDeductScoreInput' + actionId].$refs.input.focus();
});
},
doUpdate() {
doUpdate(operationStatisticVO = null) {
let commandEvaluationRuleVOs = Object.values(this.commandEvaluationRuleVOs);
const stepVOs = Object.values(this.stepVOs);
commandEvaluationRuleVOs = commandEvaluationRuleVOs.filter(eachData=>{
@ -384,7 +400,7 @@ export default {
if (stepVOs.length > 0) {
stepVOs.sort(this.objectSort('startActionId'));
stepVOs.map((step, index)=>{
step.id = index;
step.id = (index + 1);
});
}
if (commandEvaluationRuleVOs.length > 0) {
@ -396,6 +412,9 @@ export default {
delete data.deductScoreVisible;
});
}
if (operationStatisticVO) {
this.formModel.operationStatisticVO = operationStatisticVO;
}
this.formModel.commandEvaluationRuleVOs = commandEvaluationRuleVOs;
this.formModel.stepVOs = stepVOs;
updateCompetitionPracticalStep(this.formModel).then(res=>{
@ -453,6 +472,9 @@ export default {
this.$set(this.stepVOs, this.currentstepAction[0].actionId, {description:stepDescription, startActionId:parseInt(this.currentstepAction[0].actionId), endActionId:parseInt(this.currentstepAction[1].actionId)});
this.cancleDescription();
},
submitOperateStatistic(formModel) {
this.doUpdate(formModel);
},
objectSort(keyName) {
return function (objectN, objectM) {
var valueN = objectN[keyName];
@ -482,6 +504,9 @@ export default {
};
}
}
},
doOperateStatistic() {
this.$refs.operateStatistic.doShow(this.stepVOs, this.formModel.operationStatisticVO);
}
}

View File

@ -0,0 +1,162 @@
<template>
<div v-if="dialogShow" class="OperateStatistic">
<div class="OperateStatisticIn">
<div class="OperateStatisticInName">编辑运营统计</div>
<div class="OperateStatisticContent">
<el-form ref="form" :rules="rules" :model="formModel" label-width="140px" class="statisticForm">
<el-form-item label="每一项分值" :required="true" prop="score">
<el-input-number
v-model="formModel.score"
:style="{width: '130px'}"
:min="0"
size="medium"
:max="100"
:step="1"
/>
</el-form-item>
<el-form-item label="运营统计项列表" :required="true" prop="itemVOS">
<el-button type="primary" size="small" style="margin-bottom:10px" @click="addItemVO">添加</el-button>
<el-table :data="formModel.itemVOS" border style="width:351px;" height="200">
<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="stepId" label="关联步骤" width="150">
<template slot-scope="scope">
<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 label="操作" width="50">
<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>
</div>
<div class="OperateStatistic-footer">
<el-button @click="roleDoClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" @click="confirm">{{ $t('global.confirm') }}</el-button>
</div>
</div>
</div>
</template>
<script>
export default {
name:'OperateStatistic',
data() {
return {
dialogShow:false,
stepVOs:[],
formModel:{
score:0,
itemVOS:[]
// private String description;
// private Long stepId;
}
};
},
computed:{
rules() {
const crules = {
score: [
{ required: true, message: '请输入每一项分值', trigger: 'blur' },
{ required: true, message: '请输入每一项分值', trigger: 'change' }
]};
return crules;
// itemVOS
}
},
methods:{
roleDoClose() {
this.dialogShow = false;
},
confirm() {
const self = this;
this.$refs.dataform.validateForm(() => {
const itemVOS = self.formModel.itemVOS;
if (itemVOS.length > 0) {
let result = true;
itemVOS.forEach(item=>{
if (item.description && item.stepId) {
result = result && true;
} else {
result = result && false;
}
});
if (!result) {
this.$messageBox('请填写运营统计项列表');
}
}
this.dialogShow = false;
this.$emit('submitOperateStatistic', this.formModel);
});
},
doShow(stepVOs, operationStatisticVO) {
if (JSON.stringify(operationStatisticVO) != '{}') {
this.formModel = operationStatisticVO;
}
this.stepVOs = Object.values(stepVOs);
this.stepDescription = '';
this.dialogShow = true;
},
addItemVO() {
this.formModel.itemVOS.push({'description':'', stepId:''});
},
handleDelete(index) {
this.formModel.itemVOS.splice(index, 1);
}
}
};
</script>
<style lang="scss">
.OperateStatistic{
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: rgba(0,0,0,0.7);
z-index: 2;
}
.OperateStatisticIn{
width: 600px;
background: #fff;
left: 50%;
position: absolute;
transform: translate(-50%,-50%);
top: 40%;
height: 450px;
border-radius:4px;
}
.OperateStatistic-footer{
text-align: center;
}
.OperateStatisticInName{
font-size: 17px;
margin-top: 16px;
text-align: center;
}
.OperateStatisticContent{
padding: 20px 0px 0px 0px;
}
.statisticForm{
display: table;
margin-left: auto;
margin-right: auto;
}
.deleteScene{
font-size: 24px;
color: #f00;
cursor: pointer;
}
</style>

View File

@ -73,6 +73,7 @@ export default {
transform: translate(-50%,-50%);
top: 40%;
height: 240px;
border-radius:4px;
}
.StepDescription-footer{
text-align: center;