This commit is contained in:
zyy 2020-10-16 11:07:59 +08:00
commit 297bb88d91
18 changed files with 1081 additions and 257 deletions

47
src/api/company.js Normal file
View File

@ -0,0 +1,47 @@
import request from '@/utils/request';
/** 获取公司列表 */
export function getCompanyList() {
return request({
url: '/api/company',
method: 'get'
});
}
/** 添加公司信息 */
export function addCompany(data) {
return request({
url: '/api/company',
method: 'post',
data: data
});
}
/** 删除公司信息 */
export function deleteCompany(id) {
return request({
url: `/api/company/${id}`,
method: 'delete'
});
}
/** 根据id查询公司信心 */
export function getCompanyById(id) {
return request({
url: `/api/company/${id}`,
method: 'get'
});
}
/** 更新公司信息 */
export function updateCompany(id, data) {
return request({
url: `/api/company/${id}`,
method: 'put',
data
});
}
/** 分页查询公司列表 */
export function getCompanyListPaging(params) {
return request({
url: `/api/company/paging`,
method: 'get',
params
});
}

47
src/api/questionsRule.js Normal file
View File

@ -0,0 +1,47 @@
import request from '@/utils/request';
/** 获取出题规则列表 */
export function getQuestionRuleList() {
return request({
url: `/api/questionsRule`,
method: 'get'
});
}
/** 添加出题规则 */
export function addQuestionRule(data) {
return request({
url: `/api/questionsRule`,
method: 'post',
data
});
}
/** 分页获取规则列表 */
export function getQustionRuleListPage(params) {
return request({
url: `/api/questionsRule/paging`,
method: 'get',
params
});
}
/** 删除出题规则 */
export function deleteQuestionRule(id) {
return request({
url: `/api/questionsRule/${id}`,
method: 'delete'
});
}
/** 查询单个出题规则 */
export function selectedQuestionRule(id) {
return request({
url: `/api/questionsRule/${id}`,
method: 'get'
});
}
/** 更改出题规则内容 */
export function updateQuestionRule(id, data) {
return request({
url: `/api/questionsRule/${id}`,
method: 'put',
data: data
});
}

View File

@ -81,5 +81,6 @@ export default {
raceManage: 'Race manage', raceManage: 'Race manage',
practiceManage:'Practice manage', practiceManage:'Practice manage',
bankManage: 'Bank manage', bankManage: 'Bank manage',
sceneManage:'Scene manage' sceneManage:'Scene manage',
companyManage: 'Company manage'
}; };

View File

@ -86,5 +86,6 @@ export default {
recaList: '报名列表', recaList: '报名列表',
bankManage: '题库列表', bankManage: '题库列表',
practiceManage:'实操列表', practiceManage:'实操列表',
sceneManage:'场景列表' sceneManage:'场景列表',
companyManage: '单位管理'
}; };

View File

@ -0,0 +1,139 @@
import { createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan';
export default {
/** 边缘高度*/
EdgeHeight: 600,
/** 间隔高度*/
CoordMultiple: 1,
/** 偏移时间*/
TranslationTime: 0,
/** 将后台数据解析成图表*/
convertDataToModels(tripList, stations, kmRangeCoordMap, lineStyle) {
var models = [];
/** 按车次遍历数据*/
if (tripList && tripList.length) {
tripList.forEach(trip => {
const opt = {
name: `run-${trip.tripNo}`,
type: 'line',
legendHoverLink: false,
symbolSize: 6,
lineStyle: {
color: '#000',
width: 1,
},
markPoint: { data: [] },
data: []
};
// const length = trip.stationTimeList.length;
// if (trip.tripNo &&
// trip.stationTimeList.length) {
// opt.markPoint.data.push(createMartPointReverse({
// name: `${trip.tripNo}`,
// color: '#000' || lineStyle.color,
// coord: [
// trip.stationTimeList[0].arrivalTime,
// this.getCoordYByElem(stations, kmRangeCoordMap, trip.stationTimeList[0])
// ]
// }));
// }
/** 计算停站点坐标集合*/
trip.stationTimeList.forEach((elem,idx) => {
if (elem.arrivalTime) {
opt.data.push([elem.arrivalTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]);
}
if (elem.departureTime) {
opt.data.push([elem.departureTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem), elem.stationCode, trip.tripNo]);
}
});
models.push(opt);
});
}
return models;
},
/** 更新数据并解析成图表*/
updateDataToModels(tripList, stations, kmRangeCoordMap, runPlanData, series, lineStyle) {
if (tripList && tripList.length) {
}
return series;
},
/** 初始化Y轴*/
initializeYaxis(stations) {
return createMarkLineModels(stations, (elem) => {
return this.EdgeHeight + elem.kmRange * this.CoordMultiple;
});
},
/** 将后台数据转换为试图序列模型*/
convertStationsToMap(stations) {
var map = {};
if (stations && stations.length) {
stations.forEach((elem) => {
map[`${elem.kmRange}`] = this.EdgeHeight + elem.kmRange * this.CoordMultiple;
});
}
return map;
},
/** 计算y轴最小值*/
computedYaxisMinValue(stations) {
return stations[0].kmRange * this.CoordMultiple;
},
/** 计算y轴最大值*/
computedYaxisMaxValue(stations) {
return stations[stations.length - 1].kmRange * this.CoordMultiple + this.EdgeHeight * 2;
},
/** 格式化y轴数据*/
computedFormatYAxis(stations, params) {
var yText = '0m';
stations.forEach(elem => {
if (elem.kmRange < parseInt(params.value) / this.CoordMultiple - this.EdgeHeight) {
yText = Math.floor(elem.kmRange) + 'm';
}
});
return yText;
},
/** 根据是否和上一个车次是否相交,计算下一个车次的折返的高度*/
computedReentryNumber(code) {
// return parseInt(code || 1) % 2 ? 1 : 2;
return 1;
},
/** 根据方向计算y折返偏移量*/
getYvalueByDirectionCode(defaultVlue, directionCode, num) {
if (directionCode === '1') {
defaultVlue += this.EdgeHeight / 2 * num;
} else if (directionCode === '2') {
defaultVlue -= this.EdgeHeight / 2 * num;
}
return defaultVlue;
},
/** 根据elem计算y值*/
getCoordYByElem(stations, kmRangeCoordMap, elem) {
var defaultVlue = 0;
var station = stations.find(it => { return it.code == elem.stationCode; });
if (station) {
defaultVlue = kmRangeCoordMap[`${station.kmRange}`];
}
return defaultVlue;
}
};

View File

@ -1,14 +1,14 @@
import { createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan'; import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, prefixTime, convertSheetToList } from '@/utils/runPlan';
export default { export default {
/** 边缘高度*/ /** 边缘高度*/
EdgeHeight: 600, EdgeHeight: 3,
/** 间隔高度*/ /** 间隔高度*/
CoordMultiple: 1, CoordMultiple: 3,
/** 偏移时间*/ /** 偏移时间*/
TranslationTime: 0, TranslationTime: 0,
/** 将后台数据解析成图表*/ /** 将后台数据解析成图表*/
convertDataToModels(tripList, stations, kmRangeCoordMap, lineStyle) { convertDataToModels(tripList, stations, kmRangeCoordMap, lineStyle) {
@ -16,20 +16,18 @@ export default {
/** 按车次遍历数据*/ /** 按车次遍历数据*/
if (tripList && tripList.length) { if (tripList && tripList.length) {
tripList.forEach(trip => { tripList.forEach(trip => {
const opt = { name: `run-${trip.tripNo}`, type: 'line', showAllSymbol:true, symbolKeepAspect: false, symbolSize: 6, markPoint: { data: [] }, data: []}; const opt = {
name: `run-${trip.tripNo}`,
// const length = trip.stationTimeList.length; type: 'line',
// if (trip.tripNo && legendHoverLink: false,
// trip.stationTimeList.length) { symbolSize: 6,
// opt.markPoint.data.push(createMartPointReverse({ lineStyle: {
// name: `${trip.tripNo}`, color: '#000',
// color: '#000' || lineStyle.color, width: 1,
// coord: [ },
// trip.stationTimeList[0].arrivalTime, markPoint: { data: [] },
// this.getCoordYByElem(stations, kmRangeCoordMap, trip.stationTimeList[0]) data: []
// ] };
// }));
// }
/** 计算停站点坐标集合*/ /** 计算停站点坐标集合*/
trip.stationTimeList.forEach((elem,idx) => { trip.stationTimeList.forEach((elem,idx) => {
@ -47,7 +45,7 @@ export default {
} }
return models; return models;
}, },
/** 更新数据并解析成图表*/ /** 更新数据并解析成图表*/
updateDataToModels(tripList, stations, kmRangeCoordMap, runPlanData, series, lineStyle) { updateDataToModels(tripList, stations, kmRangeCoordMap, runPlanData, series, lineStyle) {
@ -56,71 +54,64 @@ export default {
return series; return series;
}, },
/** 初始化Y轴*/
initializeYaxis(stations) {
return createMarkLineModels(stations, (elem) => {
return this.EdgeHeight + elem.kmRange * this.CoordMultiple;
});
},
/** 将后台数据转换为试图序列模型*/ /** 将后台数据转换为试图序列模型*/
convertStationsToMap(stations) { convertStationsToMap(stations) {
var map = {}; var map = {};
if (stations && stations.length) { if (stations && stations.length) {
stations.forEach((elem) => { stations.forEach((elem, index) => {
map[`${elem.kmRange}`] = this.EdgeHeight + elem.kmRange * this.CoordMultiple; map[`${elem.kmRange}`] = this.EdgeHeight + index * this.CoordMultiple;
}); });
} }
return map; return map;
}, },
/** 初始化Y轴*/
initializeYaxis(stations) {
return createMarkLineModels(stations, (elem, index) => {
return this.EdgeHeight + index * this.CoordMultiple;
});
},
/** 计算y轴最小值*/ /** 计算y轴最小值*/
computedYaxisMinValue(stations) { computedYaxisMinValue() {
return stations[0].kmRange * this.CoordMultiple; return 0;
}, },
/** 计算y轴最大值*/ /** 计算y轴最大值*/
computedYaxisMaxValue(stations) { computedYaxisMaxValue(stations) {
return stations[stations.length - 1].kmRange * this.CoordMultiple + this.EdgeHeight * 2; return this.EdgeHeight * 2 + (stations.length - 1) * this.CoordMultiple;
}, },
/** 格式化y轴数据*/ /** 格式化y轴数据*/
computedFormatYAxis(stations, params) { computedFormatYAxis(stations, params) {
var yText = '0m'; var yText = '0m';
var index = Math.floor((parseInt(params.value) - this.EdgeHeight) / this.CoordMultiple);
stations.forEach(elem => { if (index >= 0 && index < stations.length) {
if (elem.kmRange < parseInt(params.value) / this.CoordMultiple - this.EdgeHeight) { yText = Math.floor(stations[index].kmRange) + 'm';
yText = Math.floor(elem.kmRange) + 'm'; }
}
});
return yText; return yText;
}, },
/** 根据是否和上一个车次是否相交,计算下一个车次的折返的高度*/
computedReentryNumber(code) {
// return parseInt(code || 1) % 2 ? 1 : 2;
return 1;
},
/** 根据方向计算y折返偏移量*/ /** 根据方向计算y折返偏移量*/
getYvalueByDirectionCode(defaultVlue, directionCode, num) { getYvalueByDirectionCode(defaultVlue, directionCode) {
if (directionCode === '1') { if (directionCode === '1') {
defaultVlue += this.EdgeHeight / 2 * num; defaultVlue -= this.EdgeHeight / 2;
} else if (directionCode === '2') { } else if (directionCode === '2') {
defaultVlue -= this.EdgeHeight / 2 * num; defaultVlue += this.EdgeHeight / 2;
} }
return defaultVlue; return defaultVlue;
}, },
/** 根据elem计算y值*/ /** 根据elem计算y值*/
getCoordYByElem(stations, kmRangeCoordMap, elem) { getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, isSpecial) {
var defaultVlue = 0; var defaultVlue = 0;
var station = stations.find(it => { return it.code == elem.stationCode; }); var station = stations.find(it => { return it.code == elem.stationCode; });
if (station) { if (station) {
defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; defaultVlue = kmRangeCoordMap[`${station.kmRange}`];
if (isSpecial) {
defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode);
}
} }
return defaultVlue; return defaultVlue;

View File

@ -14,7 +14,7 @@ import localStore from 'storejs';
// return roles.some(role => permissionRoles.indexOf(role) >= 0); // return roles.some(role => permissionRoles.indexOf(role) >= 0);
// } // }
const whiteList = ['/login', '/design/login', '/gzzbxy/relay']; // 不重定向白名单 const whiteList = ['/login', '/design/login', '/gzzbxy/relay', '/AUStool']; // 不重定向白名单
// const designPageRegex = [/^\/design/, /^\/scriptDisplay/, /^\/publish/, /^\/orderauthor/, /^\/system/, /^\/iscs/, /^\/display\/record/, /^\/display\/manage/, /^\/apply/, /^\/plan/, /^\/display\/plan/, /^\/displayNew\/record/, /^\/displayNew\/manage/, /^\/displayNew\/plan/, /^\/practiceDisplayNew/, /^\/bigSplitScreen/]; // const designPageRegex = [/^\/design/, /^\/scriptDisplay/, /^\/publish/, /^\/orderauthor/, /^\/system/, /^\/iscs/, /^\/display\/record/, /^\/display\/manage/, /^\/apply/, /^\/plan/, /^\/display\/plan/, /^\/displayNew\/record/, /^\/displayNew\/manage/, /^\/displayNew\/plan/, /^\/practiceDisplayNew/, /^\/bigSplitScreen/];

View File

@ -147,6 +147,7 @@ const JsxtApply = () => import('@/views/jsxt/apply/index');
const RefereeList = () => import('@/views/jsxt/refereeList/index'); const RefereeList = () => import('@/views/jsxt/refereeList/index');
const RefereeDisplay = () => import('@/views/jsxt/refereeList/display'); const RefereeDisplay = () => import('@/views/jsxt/refereeList/display');
const Approval = () => import('@/views/approval/index'); const Approval = () => import('@/views/approval/index');
const CompanyManage = () => import('@/views/system/companyManage/index');
import { GenerateRouteProjectList } from '@/scripts/ProjectConfig'; import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
// import { getSessionStorage } from '@/utils/auth'; // import { getSessionStorage } from '@/utils/auth';
@ -217,6 +218,11 @@ export const constantRoutes = [
path: '/design/jlmap3d/assetmanager', path: '/design/jlmap3d/assetmanager',
component: Jlmap3dAssetManager, component: Jlmap3dAssetManager,
hidden: true hidden: true
},
{ // 运行图编辑
path: '/AUStool',
component: PlanMonitorEditAUSTool,
hidden: true
}, },
{ {
path: '/jlmap3d/sandbox', path: '/jlmap3d/sandbox',
@ -371,16 +377,11 @@ export const publicAsyncRoute = [
component: PlanMonitorEditUserTool, component: PlanMonitorEditUserTool,
hidden: true hidden: true
}, },
{ // 运行图编辑
path: '/plan/AUStool',
component: PlanMonitorEditAUSTool,
hidden: true
},
{ // 运行图编辑 { // 运行图编辑
path: '/plan/tool', path: '/plan/tool',
component: PlanMonitorEditTool, component: PlanMonitorEditTool,
hidden: true hidden: true
}, },
{ {
path: '/displayIscs/system', path: '/displayIscs/system',
component: IscsSystem, component: IscsSystem,
@ -796,6 +797,15 @@ export const asyncRouter = [
i18n: 'router.userManage' i18n: 'router.userManage'
} }
}, },
{
// 单位管理
path: 'companyManage',
hidden: true,
component: CompanyManage,
meta: {
i18n: 'router.companyManage'
}
},
{ {
// 缓存管理 // 缓存管理
path: 'cache', path: 'cache',
@ -948,8 +958,8 @@ export const asyncRouter = [
}, },
children: [ children: [
{ {
path:'design', path:'design',
redirect: '/iscs/design/edit', redirect: '/iscs/design/edit',
component: IscsDesign, component: IscsDesign,
meta: { meta: {
i18n: 'router.iscsDraw', i18n: 'router.iscsDraw',
@ -962,8 +972,8 @@ export const asyncRouter = [
hidden: true hidden: true
} }
] ]
}, },
{ {
path: 'system', path: 'system',
component: IscsSystem, component: IscsSystem,
meta: { meta: {

View File

@ -10,7 +10,7 @@
<div class="userBubble" @click="playAudio(baseUrl+chatContent.src)"> <div class="userBubble" @click="playAudio(baseUrl+chatContent.src)">
<div class="userMessage"> <div class="userMessage">
<!-- <span class="el-icon-video-play playicon" /> --> <!-- <span class="el-icon-video-play playicon" /> -->
<img :src="yuyin" alt="playicon1"> <img :src="yuyin" class="playicon1">
<!-- <span class="messageText">{{ chatContent.content }}</span> --> <!-- <span class="messageText">{{ chatContent.content }}</span> -->
</div> </div>
</div> </div>

View File

@ -75,6 +75,8 @@
<operational-statistic ref="operationalStatistic" @finishTraining="finishTraining" /> <operational-statistic ref="operationalStatistic" @finishTraining="finishTraining" />
<test-result ref="testResult" />
</div> </div>
</template> </template>
@ -106,6 +108,7 @@ import { launchFullscreen } from '@/utils/screen';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import { createSimulationNew } from '@/api/simulation'; import { createSimulationNew } from '@/api/simulation';
import OperationalStatistic from './operationalStatistic.vue'; import OperationalStatistic from './operationalStatistic.vue';
import TestResult from './testResult.vue';
import Vue from 'vue'; import Vue from 'vue';
export default { export default {
@ -119,6 +122,7 @@ export default {
TheoryExamSelect, TheoryExamSelect,
TheoryExam, TheoryExam,
OperationalStatistic, OperationalStatistic,
TestResult,
// TheoryQuiz, // TheoryQuiz,
// ThroryResult, // ThroryResult,
SelectRole SelectRole
@ -166,6 +170,7 @@ export default {
scriptMode: ScriptMode.TEACH, scriptMode: ScriptMode.TEACH,
mapLocation:{}, mapLocation:{},
playerList:[], playerList:[],
actionList:[],
currentPlayList:[], currentPlayList:[],
// formatUsedTime:'', // formatUsedTime:'',
formatScore:0, formatScore:0,
@ -449,11 +454,12 @@ export default {
// this.$refs.menuScript.initLoadPage(); // this.$refs.menuScript.initLoadPage();
// } // }
}, },
selectScript({playerList, mapLocation}) { selectScript({playerList, mapLocation, actionList}) {
this.changeScriptMode(this.scriptMode); this.changeScriptMode(this.scriptMode);
this.isScriptLoad = true; this.isScriptLoad = true;
this.playerList = playerList; this.playerList = playerList;
this.mapLocation = mapLocation; this.mapLocation = mapLocation;
this.actionList = actionList;
this.userRole = 'AUDIENCE'; this.userRole = 'AUDIENCE';
this.$store.dispatch('training/setRoles', 'AUDIENCE'); this.$store.dispatch('training/setRoles', 'AUDIENCE');
}, },
@ -463,15 +469,21 @@ export default {
(this.$store.state.training.memberData[role.id] || {}).disabled = true; (this.$store.state.training.memberData[role.id] || {}).disabled = true;
this.runScriptMode(memberId); this.runScriptMode(memberId);
}, },
finishTraining() { finishTraining(data) {
this.isScriptRun = false; this.isScriptRun = false;
this.showResultData(data);
},
showResultData(data) {
this.$refs.testResult.doShow({data:data, actionList:this.actionList});
}, },
endTraining() { endTraining() {
competitionPracticalSceneFinish(this.group, {operationStatisticVO:{}}).then(res=>{ competitionPracticalSceneFinish(this.group, {operationStatisticVO:{}}).then(res=>{
this.isScriptRun = false; this.isScriptRun = false;
// if (this.scriptMode == ScriptMode.TEST) { // if (this.scriptMode == ScriptMode.TEST) {
this.formatScore = res.data; // this.formatScore = res.data;
this.$messageBox('得分:' + this.formatScore); // this.
this.showResultData(res.data);
// this.$messageBox('' + this.formatScore);
// } // }
// this.userRole = 'AUDIENCE'; // this.userRole = 'AUDIENCE';
// this.$store.dispatch('training/setRoles', 'AUDIENCE'); // this.$store.dispatch('training/setRoles', 'AUDIENCE');

View File

@ -78,9 +78,9 @@ export default {
} else { } else {
competitionPracticalSceneFinish(this.$route.query.group, this.resultData).then(res=>{ competitionPracticalSceneFinish(this.$route.query.group, this.resultData).then(res=>{
this.$message.success('运营统计数据提交成功'); this.$message.success('运营统计数据提交成功');
this.formatScore = res.data; // this.formatScore = res.data;
this.$messageBox('得分:' + this.formatScore); // this.$messageBox('' + this.formatScore);
this.$emit('finishTraining'); this.$emit('finishTraining', res.data);
this.$store.dispatch('scriptRecord/updateOperationalItemVOs', this.resultData.itemVOS); this.$store.dispatch('scriptRecord/updateOperationalItemVOs', this.resultData.itemVOS);
this.dialogShow = false; this.dialogShow = false;
}).catch(error=>{ }).catch(error=>{

View File

@ -120,6 +120,7 @@ export default {
const playerList = []; const playerList = [];
EventBus.$emit('clearRunSeries'); EventBus.$emit('clearRunSeries');
EventBus.$emit('loadScene'); EventBus.$emit('loadScene');
const actionList = {};
if (res.data.memberList && res.data.memberList.length > 0) { if (res.data.memberList && res.data.memberList.length > 0) {
this.form.type = ''; this.form.type = '';
res.data.memberList.sort((a, b) => { res.data.memberList.sort((a, b) => {
@ -128,6 +129,7 @@ export default {
this.$store.dispatch('training/setMemberList', {memberList:res.data.memberList, userId:this.$store.state.user.id}); this.$store.dispatch('training/setMemberList', {memberList:res.data.memberList, userId:this.$store.state.user.id});
const activeMemberList = []; const activeMemberList = [];
res.data.actionList.forEach((activeMember)=>{ res.data.actionList.forEach((activeMember)=>{
actionList[activeMember.id] = activeMember;
if (!(activeMemberList.length > 0 && activeMemberList.includes(activeMember.memberId))) { if (!(activeMemberList.length > 0 && activeMemberList.includes(activeMember.memberId))) {
activeMemberList.push(activeMember.memberId); activeMemberList.push(activeMember.memberId);
} }
@ -177,14 +179,14 @@ export default {
if (res.data.mapLocation) { if (res.data.mapLocation) {
this.mapLocation = res.data.mapLocation; this.mapLocation = res.data.mapLocation;
} }
this.confirm(playerList); this.confirm(playerList, actionList);
} }
} }
}, },
confirm(playerList) { confirm(playerList, actionList) {
// this.$store.dispatch('training/setScriptOperationType', this.operationType); // this.$store.dispatch('training/setScriptOperationType', this.operationType);
// operationType:ScriptMode[this.operationType] // operationType:ScriptMode[this.operationType]
this.$emit('selectScript', {playerList:playerList, mapLocation:this.mapLocation}); this.$emit('selectScript', {playerList:playerList, mapLocation:this.mapLocation, actionList:actionList});
this.doClose(); this.doClose();
}, },
objectSpanMethod({ row, column, rowIndex, columnIndex }) { objectSpanMethod({ row, column, rowIndex, columnIndex }) {

View File

@ -0,0 +1,268 @@
<template>
<el-dialog
title="竞赛结果详情"
:visible.sync="dialogShow"
top="50px"
width="900px"
:before-do-close="doClose"
class="OSResult"
:close-on-click-modal="false"
>
<div class="operationStatisticResult">
<div class="OSTcompleted">
<span v-if="completed" style="font-size:16px;color:green">完成</span>
<span v-else style="font-size:16px;color:red">未完成</span>
<span style="margin-left:20px;font-size:16px;">满分{{ fullScore }} </span>
<span style="margin-left:20px;font-size:16px;">得分{{ userScore }} </span>
</div>
<div class="OSTitle"><span>关键步骤信息</span><span style="margin-left:10px;">{{ '(得分: '+userScoreOfCommand+' / 满分: '+ fullScoreOfCommand+')' }}</span></div>
<el-table :data="commandPublishStatisticVO" border class="OSTTable3">
<!-- height="400" -->
<el-table-column prop="actionId" label="步骤描述" width="230">
<template slot-scope="scope">
{{ covert(scope.row.actionId) }}
</template>
</el-table-column>
<el-table-column prop="keyWords" label="关键字" width="200">
<template slot-scope="scope">
<el-tag v-for="(tag,index) in scope.row.keyWords" :key="index" class="eachTag">{{ tag }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="timeConsumed" label="用时" width="100" />
<el-table-column prop="timeOut" label="超时时间" width="100">
<template slot-scope="scope">
{{ scope.row.timeOut?scope.row.timeOut+'s':'' }}
</template>
</el-table-column>
<el-table-column prop="score" label="步骤总分" width="100" />
<el-table-column prop="finalPointsDeducted" label="用户扣分" width="100" />
</el-table>
<div class="OSTitle">
<span>运营统计信息</span>
<span style="margin-left:10px;">{{ '(得分: '+userScoreOfOperationStatistic+' / 满分: '+ fullScoreOfOperationStatistic+')' }}</span>
</div>
<el-table :data="operationStaticItemVOs" border class="OSTTable">
<el-table-column prop="description" label="数据名称" width="300" />
<el-table-column label="正确答案" width="150">
<template slot-scope="scope">
<div v-if="scope.row.type=='Time'">{{ covertTime(scope.row.time) }}</div>
<div v-else-if="scope.row.type=='Non_Time'">{{ scope.row.standardAnswer }}</div>
</template>
</el-table-column>
<el-table-column label="用户填写" width="150">
<template slot-scope="scope">
<div v-if="scope.row.type=='Time'">{{ covertTime(scope.row.timeFilledInByUser) }}</div>
<div v-else-if="scope.row.type=='Non_Time'">{{ scope.row.userAnswer }}</div>
</template>
</el-table-column>
<el-table-column prop="finalPointsDeducted" label="扣分" />
</el-table>
<div class="OSTSignInfo">
<span>运营指标信息</span>
<span style="margin-left:10px;">{{ '(得分: '+fullScoreOfOperationIndex+' / 满分: '+ userScoreOfOperationIndex+')' }}</span>
</div>
<div class="OSTSignInfoTips">
<span class="el-icon-info" style="font-size: 16px;" /> 若竞赛未完成运营指标不得分
</div>
<div class="OSTSignInfoTips">晚点列车信息</div>
<el-table :data="finalLateStatistics" border class="OSTTable1">
<el-table-column prop="groupNumber" label="车组号" width="300" />
<el-table-column prop="dt" label="晚点时间" width="300">
<template slot-scope="scope">
{{ scope.row.dt }} s
</template>
</el-table-column>
<el-table-column prop="finalPointsDeducted" label="扣分" width="230" />
</el-table>
<div class="OSTSignInfoTips">区间停车信息</div>
<el-table :data="finalStopInSectionStatistics" border class="OSTTable2">
<el-table-column prop="groupNumber" label="车组号" width="300" />
<el-table-column prop="duration" label="停车时长" width="300">
<template slot-scope="scope">
{{ scope.row.duration }} s
</template>
</el-table-column>
<el-table-column prop="finalPointsDeducted" label="扣分" width="230" />
</el-table>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doClose">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import {covertOperate} from '@/views/newMap/displayNew/scriptDisplay/component/covertOperation';
export default {
name:'TestResult',
data() {
return {
dialogShow:false,
operationStaticItemVOs:[],
finalLateStatistics:[],
finalStopInSectionStatistics:[],
commandPublishStatisticVO:[],
completed:false,
fullScore:'',
userScore:'',
actionList:[],
fullScoreOfCommand:0, //
userScoreOfCommand:0, //
fullScoreOfOperationStatistic:0, //
userScoreOfOperationStatistic:0, //
fullScoreOfOperationIndex:0, //
userScoreOfOperationIndex:0 //
};
},
methods:{
doShow({data, actionList}) {
this.dialogShow = true;
this.completed = data.completed;
this.operationStaticItemVOs = data.operationStatisticVO.itemVOS;
this.finalLateStatistics = data.operationIndexStatisticVO.finalLateStatistics;
this.finalStopInSectionStatistics = data.operationIndexStatisticVO.finalStopInSectionStatistics;
this.commandPublishStatisticVO = data.commandPublishStatisticVO;
this.actionList = actionList;
this.fullScore = data.fullScore;
this.userScore = data.userScore;
this.fullScoreOfCommand = data.fullScoreOfCommand;
this.userScoreOfCommand = data.userScoreOfCommand;
this.fullScoreOfOperationStatistic = data.fullScoreOfOperationStatistic;
this.userScoreOfOperationStatistic = data.userScoreOfOperationStatistic;
this.fullScoreOfOperationIndex = data.fullScoreOfOperationIndex;
this.userScoreOfOperationIndex = data.userScoreOfOperationIndex;
},
doClose() {
this.dialogShow = false;
},
covertTime(time) {
return time.slice(0, time.length - 3);
},
covert(actionId) {
// return actionId;
const element = this.actionList[actionId];
// this.$store.state.training.memberData[memberId]
const member = this.$store.state.training.memberData[element.memberId];
let resultData = '';
if (element.type == 'Accept_Conversation_Invitation') {
resultData = member.label + '请接受会话邀请';
} else 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');
if (element.communicationObject) {
if (element.communicationObject == 'ALL_STATION') {
inviteMember.push('所有车站');
} else if (element.communicationObject == 'ALL_TRAIN') {
inviteMember.push('所有司机');
}
} else {
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;
}
}
};
</script>
<style lang="scss" scoped>
.operationStatisticResult{
height: 500px;
overflow: auto;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #c3c3c3;
}
&::-webkit-scrollbar-track {
border-radius: 0;
background: #f0f0f0;
}
}
.OSTitle{
padding: 10px 5px;
font-size: 15px;
font-weight: bold;
}
.OSTTable{
width:832px;
}
.OSTTable1,.OSTTable2{
width:832px;
}
.OSTTable3{
width:832px;
}
.OSTcompleted{
padding: 5px 5px;
font-size: 15px;
}
.OSTSignInfo{
padding: 15px 5px 10px 5px;
font-size: 15px;
font-weight: bold;
}
.OSTSignInfoTips{
padding: 10px 5px;
font-size: 15px;
}
.eachTag{
margin-left:10px;
}
</style>
<style lang="scss">
.OSResult .el-dialog__body{
padding: 10px 20px;
}
// .OSTTable3 .el-table__body-wrapper.is-scrolling-none {
// &::-webkit-scrollbar{
// width: 4px !important;
// }
// &::-webkit-scrollbar-thumb {
// border-radius: 10px;
// background: #c3c3c3;
// }
// &::-webkit-scrollbar-track {
// border-radius: 0;
// background: #f0f0f0;
// }
// }
</style>

View File

@ -23,29 +23,51 @@ export default {
this.listenersOff(); this.listenersOff();
}, },
methods: { methods: {
getStationByCoord1(stations, y) {
for(var i = stations.length-1; i >= 0; i--) {
const station = stations[i];
const edge = this.planConvert.EdgeHeight
const preKm = i == 0? edge*2: Math.abs(station.kmRange-stations[i-1].kmRange)/2;
const nxtKm = i == stations.length-1? edge: Math.abs(station.kmRange-stations[i+1].kmRange)/2;
const min = edge + station.kmRange - preKm;
const max = edge + station.kmRange + nxtKm;
if (y >= min && y <= max) {
return station;
}
}
return null;
},
getStationByCoord(stations, y) { getStationByCoord(stations, y) {
for(var i = stations.length-1; i >= 0; i--) { for(var i = stations.length-1; i >= 0; i--) {
const station = stations[i]; const station = stations[i];
if (station.kmRange <= y) { const edge = this.planConvert.EdgeHeight;
const rate = this.planConvert.CoordMultiple;
const preKm = i == 0? edge*2: rate/2;
const nxtKm = i == stations.length-1? edge: rate/2;
const min = edge + i*rate - preKm;
const max = edge + i*rate + nxtKm;
if (y >= min && y <= max) {
return station; return station;
} }
} }
return null; return null;
}, },
pixelExecCb(e, cb) { pixelExecCb(e, cb) {
let myChart = this.myChart; const event = e.componentType ? e.event: e;
let pointInPixel= [e.offsetX, e.offsetY]; const myChart = this.myChart;
const pointInPixel = [event.offsetX, event.offsetY]
if (myChart.containPixel('grid', pointInPixel) && this.planConvert) { if (myChart.containPixel('grid', pointInPixel) && this.planConvert) {
let pointInGrid = myChart.convertFromPixel({seriesIndex:0},pointInPixel); const pointInGrid = myChart.convertFromPixel({seriesIndex:0},pointInPixel);
let xIndex = pointInGrid[0]; const xIndex = pointInGrid[0];
let yIndex = pointInGrid[1]; const yIndex = pointInGrid[1];
let op = myChart.getOption(); const option = myChart.getOption();
let minY = op.yAxis[0].min; const minY = option.yAxis[0].min;
let xVal = op.xAxis[0].data[xIndex]; const xVal = option.xAxis[0].data[xIndex];
let edgeOffset = this.planConvert.EdgeHeight/6; const yObj = this.getStationByCoord(this.stations, yIndex-minY);
let yObj = this.getStationByCoord(this.stations, yIndex-minY-edgeOffset);
if (yObj && cb) { if (yObj && cb) {
cb(yObj, xVal, pointInPixel); cb({yObj, xVal, pointInPixel, e});
} }
} }
}, },
@ -54,9 +76,10 @@ export default {
const zr = this.myChart.getZr(); const zr = this.myChart.getZr();
zr.on('click', this.onClick, this) zr.on('click', this.onClick, this)
this.myChart.on('contextmenu', this.onContextMenu);
this.myChart.on('mousedown', this.onMouseDown); this.myChart.on('mousedown', this.onMouseDown);
this.myChart.on('datazoom', this.onUpdateZoom); this.myChart.on('mouseover', this.onMouseOver);
this.myChart.on('mouseup', this.onMouseUP);
this.myChart.on('datazoom', this.onUpdatePosition);
window.addEventListener('resize', this.onUpdatePosition); window.addEventListener('resize', this.onUpdatePosition);
} }
}, },
@ -65,100 +88,153 @@ export default {
const zr = this.myChart.getZr(); const zr = this.myChart.getZr();
zr.off('click', this.onClick); zr.off('click', this.onClick);
this.myChart.off('contextmenu', this.onContextMenu)
this.myChart.off('mousedown', this.onMouseDown); this.myChart.off('mousedown', this.onMouseDown);
this.myChart.off('datazoom', this.onUpdateZoom); this.myChart.off('mouseover', this.onMouseOver);
this.myChart.off('mouseup', this.onMouseUP);
this.myChart.off('datazoom', this.onUpdatePosition);
window.removeEventListener('resize', this.onUpdatePosition); window.removeEventListener('resize', this.onUpdatePosition);
} }
}, },
loadInitGraphic() {
const option = this.myChart.getOption();
const graphic = option.series.map((el,i) => {
return {
id: el.name,
elements: echarts.util.map(el.data||[], (el, dataIndex) => {
return {
type: 'circle',
position: this.myChart.convertToPixel('grid', el),
shape: {
cx: 0,
cy: 0,
r: 10
},
invisible: true,
draggable: true,
ondrag: echarts.util.curry(this.onPointDragging, dataIndex),
onmousemove: echarts.util.curry(this.onShowTooltip, dataIndex),
onmouseout: echarts.util.curry(this.onHideTooltip, dataIndex),
z: 100
};
})
}
})
graphic.push({ id: 'operate', elements: [] })
this.myChart.setOption({ graphic });
},
onPointDragging(dataIndex, dx, dy) {
//
},
onShowTooltip(dataIndex) {
this.myChart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: dataIndex
});
},
onHideTooltip(dataIndex) {
this.myChart.dispatchAction({type: 'hideTip'});
},
onUpdatePosition(e) { onUpdatePosition(e) {
const option = this.myChart.getOption(); const option = this.myChart.getOption();
const shapes = option.graphic; const elements = option.graphic[0].elements
// const graphic = shapes.map(el => { const graphic = echarts.util.map(elements, (item) => {
// return echarts.util.map(el.elements||[], function (item, dataIndex) { return { position: this.myChart.convertToPixel('grid', item.data) };
// console.log(item, this.myChart.convertToPixel('grid', item.point)) })
// return { this.myChart.setOption({graphic});
// position: this.myChart.convertToPixel('grid', item.point)
// };
// })
// })
// this.myChart.setOption({graphic});
},
onUpdateZoom(e) {;
const option = this.myChart.getOption();
const shapes = option.graphic;
// const graphic = shapes.map(el => {
// console.log(el)
// const points = (el.elements||[]).map(el => { return el.point; });
// return echarts.util.map(points, function (point, dataIndex) {
// console.log(point, this.myChart.convertToPixel('grid', point))
// return {
// position: this.myChart.convertToPixel('grid', point)
// };
// })
// })
// this.myChart.setOption({graphic});
}, },
onClick(e) { onClick(e) {
switch(this.action) { switch(this.action) {
case 'Plan': case 'Plan':
this.pixelExecCb(e, this.handleMarkPoint); this.pixelExecCb(e, this.handleCreateMark);
break;
}
},
onMouseDown(e) {
switch(this.action) {
case 'Edit':
this.pixelExecCb(e, this.handlePopDialog);
break;
}
},
onMouseOver(e) {
this.pixelExecCb(e, this.handleSetLineLight);
},
onMouseUP(e) {
switch(this.action) {
case 'Translate':
if (this.dragging) {
this.dragging = false;
this.handleTranslate(this.createModel)
}
break; break;
} }
}, },
onContextMenu(e) { onShapePointDragging(e) {
const event = e.event; if (this.selected) {
const point = { this.dragging = true;
x: event.clientX, this.pixelExecCb(e, this.handleDragging);
y: event.clientY
} }
},
setLineLight() {
if (this.selected) {
this.myChart.setOption({
series: {
name: this.selected.seriesName,
symbolSize: 10,
showAllSymbol: true,
lineStyle: {
width: 2,
color: 'red'
}
}
});
}
},
setLineReset() {
if (this.selected) {
this.myChart.setOption({
series: {
name: this.selected.seriesName,
symbolSize: 6,
showAllSymbol: 'auto',
lineStyle: {
width: 1,
color: '#000'
}
}
});
}
},
clearGraphic(labels) {
const option = this.myChart.getOption();
const elements = option.graphic[0].elements;
option.graphic[0].elements = elements.filter(el => { return !labels.includes(el.subType)});
this.myChart.setOption(option, {notMerge: true});
},
createDragGraphicObj(point) {
return {
type: 'circle',
subType: 'drag',
position: this.myChart.convertToPixel('grid', point),
data: [...point],
shape: {
cx: 0,
cy: 0,
r: 10
},
style: {
fill: 'rgba(0,0,0,0.0)'
},
draggable: 'horizontal',
ondrag: echarts.util.curry(this.onShapePointDragging),
z: 100
}
},
createMarkPointObj(point) {
return {
type: 'group',
subType: 'mark',
z: 100,
position: point,
point,
children: [
{
type: 'circle',
z: 100,
shape: {
cx: 0,
cy: 0,
r: 5
},
style: {
fill: 'rgba(0,0,0,0.3)'
}
},
{
type: 'circle',
z: 100,
shape: {
cx: 0,
cy: 0,
r: 10
},
style: {
fill: 'rgba(0,0,0,0.3)'
}
}
]
}
},
handlePopDialog({e, pointInPixel}) {
if (e.componentType == "series" && if (e.componentType == "series" &&
e.componentSubType == "line" && e.componentSubType == "line" &&
e.seriesName.includes('run-')) { e.seriesName.includes('run-')) {
const value = e.value; const value = e.value;
const point = {
x: pointInPixel[0],
y: pointInPixel[1]
}
const option = this.myChart.getOption(); const option = this.myChart.getOption();
const dataList = option.series[e.seriesIndex].data; const dataList = option.series[e.seriesIndex].data;
const length = dataList.length; const length = dataList.length;
@ -166,10 +242,15 @@ export default {
const pre = dataList[e.dataIndex-1]; const pre = dataList[e.dataIndex-1];
this.selected = { this.selected = {
seriesIndex: e.seriesIndex,
seriesName: e.seriesName,
seriesId: e.seriesName.replace('run-', ''), seriesId: e.seriesName.replace('run-', ''),
depTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, depTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0,
runTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, runTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0,
stationCode: value[2] stationCode: value[2],
_x: value[0],
dx: 0,
time: 0
} }
if (e.dataIndex == length - 1 || if (e.dataIndex == length - 1 ||
@ -181,11 +262,10 @@ export default {
} }
} }
}, },
onMouseDown(e) { handleSetLineLight({e}) {
if (e.componentType == "series" && if (e.componentType == "series" &&
e.componentSubType == "line" && e.componentSubType == "line" &&
e.seriesName.includes('run-')) { e.seriesName.includes('run-')) {
const value = e.value; const value = e.value;
const option = this.myChart.getOption(); const option = this.myChart.getOption();
const dataList = option.series[e.seriesIndex].data; const dataList = option.series[e.seriesIndex].data;
@ -193,91 +273,79 @@ export default {
const nxt = dataList[e.dataIndex+1]; const nxt = dataList[e.dataIndex+1];
const pre = dataList[e.dataIndex-1]; const pre = dataList[e.dataIndex-1];
if (this.selected &&
this.selected.seriesName != e.seriesName) {
this.setLineReset();
}
this.selected = { this.selected = {
seriesIndex: e.seriesIndex,
seriesName: e.seriesName,
seriesId: e.seriesName.replace('run-', ''), seriesId: e.seriesName.replace('run-', ''),
depTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, depTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0,
runTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0, runTime: e.dataIndex < length - 1? nxt[0] - value[0]: 0,
stationCode: value[2] stationCode: value[2],
_x: value[0],
dx: 0,
time: 0
} }
this.dragging = true; this.setLineLight();
switch(this.action) {
case 'Translate':
this.handleCreateDrag({e})
break;
}
} }
}, },
clearMarks() { handleCreateDrag({e}) {
const option = this.myChart.getOption(); const option = this.myChart.getOption();
const graphic = option.graphic; const filters = option.graphic[0].elements.filter(el => { return el.subType != 'drag'});
const index = graphic.findIndex(el => { return el.id == 'operate'});
if (index >= 0) { filters.push(this.createDragGraphicObj(e.value))
graphic[index].elements = []; option.graphic[0].elements = filters;
}
this.myChart.setOption(option, {notMerge: true}); this.myChart.setOption(option, {notMerge: true});
}, },
createMarkPoint(point, text) { handleCreateMark({pointInPixel, yObj, xVal}) {
return { const myChart = this.myChart;
type: 'circle', const option = this.myChart.getOption();
z: 100, const graphic = option.graphic;
position: point, const elements = graphic[0].elements;
point,
shape: { elements.push(this.createMarkPointObj(pointInPixel))
cx: 0,
cy: 0, myChart.setOption(option, {notMerge: true});
r: 10
}, const filters = elements.filter(el => { return el.subType == 'mark'});
style: {
fill: 'rgba(0,0,0,0.3)' if (filters.length == 1) {
} this.createModel.startStationCode = yObj.code;
this.createModel.startTime = timeFormat(xVal);
} else if (filters.length >= 2) {
this.createModel.endStationCode = yObj.code;
this.handleCreate(this.createModel);
}
},
handleDragging({e, xVal}) {
this.selected.dx = xVal - this.selected._x;
this.selected.time += this.selected.dx;
this.selected._x = xVal;
const option = this.myChart.getOption();
const model = option.series[this.selected.seriesIndex]
if (model) {
model.data.forEach(el => {
el[0] += this.selected.dx;
});
} }
// return { if (e.target && e.target.position) {
// type: 'group', e.target.data.x += this.selected.dx;
// z: 100,
// position: point,
// point,
// children: [
// {
// type: 'circle',
// z: 100,
// shape: {
// cx: 0,
// cy: 0,
// r: 5
// },
// style: {
// fill: 'rgba(0,0,0,0.3)'
// }
// },
// {
// type: 'circle',
// z: 100,
// shape: {
// cx: 0,
// cy: 0,
// r: 10
// },
// style: {
// fill: 'rgba(0,0,0,0.3)'
// }
// }
// ]
// }
},
handleMarkPoint(yObj, xVal, pointInPixel) {
let myChart = this.myChart;
if (myChart) {
let op = myChart.getOption();
let graphic = op.graphic[0];
if (graphic) {
graphic.elements.push(this.createMarkPoint(pointInPixel, 'hello world'))
myChart.setOption(op);
if (graphic.elements.length == 1) {
this.createModel.startStationCode = yObj.code;
this.createModel.startTime = timeFormat(xVal);
} else if (graphic.elements.length >= 2) {
this.createModel.endStationCode = yObj.code;
this.handleCreate(this.createModel);
}
}
} }
this.myChart.setOption(option, {notMerge: true});
} }
} }
} }

View File

@ -3,12 +3,12 @@
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<div class="menus"> <div class="menus">
<span style="font-size:22px;padding:0 17px;">计划</span>
<el-button-group v-model="active"> <el-button-group v-model="active">
<el-button v-for="(el,i) in buttonList" <el-button v-for="(el,i) in buttonList"
:type="active == i? 'primary':''" :type="active == i? 'primary':''"
:key="i" @click="handleBtnSelect(el,i)">{{el.name}}</el-button> :key="i" @click="handleBtnSelect(el,i)">{{el.name}}</el-button>
</el-button-group> </el-button-group>
<el-button @click="handleCancle">Reset</el-button>
<el-button-group style="margin-left: 20px"> <el-button-group style="margin-left: 20px">
<el-button :type="selected?'danger':'info'" icon="el-icon-delete" @click="handleRemove" /> <el-button :type="selected?'danger':'info'" icon="el-icon-delete" @click="handleRemove" />
</el-button-group> </el-button-group>
@ -29,8 +29,7 @@ import Monitor from './monitor.js';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { getStationList } from '@/api/runplan'; import { getStationList } from '@/api/runplan';
import { getRpTools, addRpTrip, delRpTrip, justTripNoRunning, justTripNoStop} from '@/api/rpTools'; import { getRpTools, addRpTrip, delRpTrip, justTripNoRunning, justTripNoStop, translateTripNo} from '@/api/rpTools';
import { loadMapDataById } from '@/utils/loaddata';
import { getPublishMapInfo } from '@/api/jmap/map'; import { getPublishMapInfo } from '@/api/jmap/map';
export default { export default {
@ -79,7 +78,16 @@ export default {
{ {
name: 'Plan', name: 'Plan',
type: 'Plan' type: 'Plan'
} ] },
{
name: 'Translate',
type: 'Translate'
},
{
name: 'Edit',
type: 'Edit'
}
]
}; };
}, },
computed: { computed: {
@ -180,7 +188,7 @@ export default {
max: 0 max: 0
}, },
graphic: [{ graphic: [{
id: 'operate', id: 'shape',
elements: [] elements: []
}], }],
series: [], series: [],
@ -260,7 +268,6 @@ export default {
this.$store.dispatch('rpTools/clear').then(() => { this.$store.dispatch('rpTools/clear').then(() => {
this.loadInitChart().then(() => { this.loadInitChart().then(() => {
if (this.mapId) { if (this.mapId) {
loadMapDataById(this.mapId);
getStationList(this.mapId).then(resp => { getStationList(this.mapId).then(resp => {
const stations = resp.data.filter(el => { const stations = resp.data.filter(el => {
return ['车辆段', '停车场'].findIndex(it => { return ['车辆段', '停车场'].findIndex(it => {
@ -309,12 +316,13 @@ export default {
const option = this.myChart.getOption(); const option = this.myChart.getOption();
option.series = []; option.series = [];
option.graphic = [{ id: 'operate', elements: [] }]; option.graphic[0].elements = [];
this.kmRangeCoordMap = this.planConvert.convertStationsToMap(stations); this.kmRangeCoordMap = this.planConvert.convertStationsToMap(stations);
this.pushModels(option.series, [this.planConvert.initializeYaxis(this.stations)]); this.pushModels(option.series, [this.planConvert.initializeYaxis(this.stations)]);
this.pushModels(option.series, this.planConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 0.5, color: '#000' })); this.pushModels(option.series, this.planConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 0.5, color: '#000' }));
this.myChart.setOption(option, {notMerge: true}); this.myChart.setOption(option, {notMerge: true});
this.loadInitGraphic();
} catch (error) { } catch (error) {
this.$messageBox(this.$t('error.loadingOperationGraphFailed') + this.$t('global.colon') + error.message); this.$messageBox(this.$t('error.loadingOperationGraphFailed') + this.$t('global.colon') + error.message);
} }
@ -416,14 +424,18 @@ export default {
} }
}, },
handleBtnSelect(el, i) { handleBtnSelect(el, i) {
this.active = i; this.handleCancle();
this.action = el.type; if (this.active != i) {
this.active = i;
this.action = el.type;
}
}, },
handleCancle() { handleCancle() {
this.clearGraphic(['drag', 'mark']);
this.setLineReset();
this.active = -1; this.active = -1;
this.action = ''; this.action = '';
this.selected = null; this.selected = null;
this.clearMarks();
}, },
handleCreate(data) { handleCreate(data) {
if (this.myChart) { if (this.myChart) {
@ -437,26 +449,29 @@ export default {
}); });
}).catch(error => { }).catch(error => {
this.$message(error.message); this.$message(error.message);
this.clearMarks(); this.clearGraphic(['mark']);
}) })
} }
}, },
handleRemove() { handleTranslate(data) {
if (this.myChart && this.selected) { if (this.selected) {
delRpTrip(this.selected.seriesId).then(resp => { const model = {
seconds : this.selected.time
}
translateTripNo(this.selected.seriesId, model).then(resp => {
getRpTools().then(rest => { getRpTools().then(rest => {
this.$store.dispatch('rpTools/setPlanData', rest.data).then(() => { this.$store.dispatch('rpTools/setPlanData', rest.data).then(() => {
this.loadChartData(); this.loadChartData();
this.handleCancle();
}); });
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('error.obtainOperationGraphFailed')); this.$messageBox(this.$t('error.obtainOperationGraphFailed'));
}); });
}).catch(error => { }).catch(error => {
this.$message(error.message); this.$message(error.message);
}) });
} }
}, },
handleJustRunning(time) { handleJustRunning(time) {
if (this.selected) { if (this.selected) {
const model = { const model = {
@ -496,6 +511,22 @@ export default {
this.$message(error.message); this.$message(error.message);
}) })
} }
},
handleRemove() {
if (this.myChart && this.selected) {
delRpTrip(this.selected.seriesId).then(resp => {
getRpTools().then(rest => {
this.$store.dispatch('rpTools/setPlanData', rest.data).then(() => {
this.loadChartData();
this.handleCancle();
});
}).catch(() => {
this.$messageBox(this.$t('error.obtainOperationGraphFailed'));
});
}).catch(error => {
this.$message(error.message);
})
}
} }
} }
}; };

View File

@ -0,0 +1,106 @@
<template>
<el-dialog v-dialogDrag title="添加单位" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ update? '修改' : $t('global.confirm') }}</el-button>
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { addCompany, updateCompany } from '@/api/company';
export default {
name: 'Add',
data() {
return {
dialogVisible: false,
formModel: {
address: '',
name: '',
phone: '',
id: ''
},
update: false
};
},
computed:{
form() {
const form = {
labelWidth: '100px',
items: [
{ prop: 'name', label: '昵称', type: 'text' },
{ prop: 'phone', label: '电话', type: 'text' },
{ prop: 'address', label: '地址', type: 'text' }
]
};
return form;
},
rules() {
const crules = {
name: [
{ required: true, message: '请输入单位名称', trigger: 'blur' },
{ min: 1, max: 25, message: this.$t('rules.strLength1To25'), trigger: 'blur' }
],
phone: [
{ required: true, message: '请输入公司电话', trigger: 'blur' }
],
address:[
{ required: true, message: '请输入公司地址', trigger: 'blur'}
]
};
return crules;
}
},
methods: {
doShow(data) {
this.dialogVisible = true;
this.update = false;
if (data) {
this.update = true;
this.formModel = {
id: data.id,
name: data.name,
phone: data.phone,
address: data.address
};
} else {
this.formModel = {
address: '',
name: '',
phone: '',
id: ''
};
}
},
handleClose() {
this.dialogVisible = false;
},
doSave() {
this.$refs.dataform.validateForm(() => {
if (this.update) {
updateCompany(this.formModel.id, this.formModel).then(resp => {
this.$message.success('更新单位信息成功!');
this.dialogVisible = false;
this.$emit('reloadTable');
}).catch(e => {
this.$message.error('更新单位信息失败!');
});
} else {
addCompany(this.formModel).then(resp => {
this.$message.success('添加单位信息成功!');
this.dialogVisible = false;
this.$emit('reloadTable');
}).catch(e => {
this.$message.error('添加单位信息失败!');
});
}
});
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,97 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-company ref="editCompany" @reloadTable="reloadTable" />
</div>
</template>
<script>
import { getCompanyListPaging, deleteCompany } from '@/api/company';
import EditCompany from './add';
export default {
name: 'CompanyManage',
components: {
EditCompany
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
}
},
queryList: {
query: getCompanyListPaging,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '公司名称',
prop: 'name'
},
{
title: '公司电话',
prop: 'phone'
},
{
title: '公司地址',
prop: 'address'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: this.$t('global.edit'),
handleClick: this.handleUpdate
},
{
name: '删除',
handleClick: this.handleDeleteCompany,
type: 'danger'
}
]
}
],
actions: [
{ text: '添加', btnCode: 'employee_auto', handler: this.handlerAddCompany },
{ text: '返回', btnCode: 'employee_auto', handler: this.handlerBack}
]
},
currentModel: {}
};
},
methods: {
handlerAddCompany() {
this.$refs.editCompany.doShow();
},
handleDeleteCompany(index, row) {
deleteCompany(row.id).then(resp => {
this.$message.success('删除单位信息成功!');
this.reloadTable();
}).catch(() => {
this.$message.error('删除单位信息失败!');
});
},
handleUpdate(index, row) {
this.$refs.editCompany.doShow(row);
},
reloadTable() {
this.queryList.reload();
},
handlerBack() {
this.$router.go(-1);
}
}
};
</script>
<style scoped>
</style>

View File

@ -90,7 +90,8 @@ export default {
} }
], ],
actions: [ actions: [
{ text: '创建本地用户', btnCode: 'employee_auto', handler: this.createLocalUsers } { text: '创建本地用户', btnCode: 'employee_auto', handler: this.createLocalUsers },
{ text: '单位管理', btnCode: 'company_manage', handler: this.companyManage }
] ]
}, },
currentModel: {} currentModel: {}
@ -132,6 +133,9 @@ export default {
}, },
createLocalUsers() { createLocalUsers() {
this.$refs.createUser.doShow(); this.$refs.createUser.doShow();
},
companyManage() {
this.$router.push({ path: `/system/companyManage`});
} }
} }
}; };