This commit is contained in:
joylink_cuiweidong 2020-05-27 19:03:54 +08:00
commit 9fb51bd047
16 changed files with 290 additions and 125 deletions

View File

@ -49,7 +49,7 @@ export function getQuestionListByMapId(params) {
// 加载试卷 // 加载试卷
export function loadingPaper(competitionId, data) { export function loadingPaper(competitionId, data) {
return request({ return request({
url: `api/v1/competition/${competitionId}/testPaper`, url: `/api/v1/competition/${competitionId}/testPaper`,
method: 'post', method: 'post',
data data
}); });
@ -91,9 +91,9 @@ export function getRaceUserList(params) {
// } // }
/** 提交试卷 */ /** 提交试卷 */
export function postCompetitionTheory(theoryId, data) { export function postCompetitionTheory(data) {
return request({ return request({
url: `/api/v1/competitionTheory/${theoryId}/submit`, url: `/api/v1/competitionTheory/submit`,
method: 'post', method: 'post',
data data
}); });
@ -131,6 +131,14 @@ export function getTheoryQuestion(competitionId) {
}); });
} }
/** 查询理论题作答详情 */
export function getCompetitionDetail(competitionId) {
return request({
url: `/api/v1/competitionTheory/detail/competition/${competitionId}`,
method: 'get'
});
}
/** 根据id查询竞赛信息 */ /** 根据id查询竞赛信息 */
export function getRaceById(id) { export function getRaceById(id) {
return request({ return request({

View File

@ -685,3 +685,11 @@ export function simulationLoadRunPlan(group, templateId) {
method: 'put' method: 'put'
}); });
} }
/** 根据车次号获取列车信息 */
export function getTrainDetailBytripNumber(group, params) {
return request({
url: `/simulation/${group}/planTripInfo`,
method: 'get',
params: params
});
}

View File

@ -49,6 +49,20 @@
:sortable="column.sortable" :sortable="column.sortable"
:sort-by="column.sortBy" :sort-by="column.sortBy"
/> />
<el-table-column
v-else-if="checkColumnTyep(column, 'html')"
:key="index"
:prop="column.prop"
:label="column.title"
:width="column.width"
show-overflow-tooltip
:sortable="column.sortable"
:sort-by="column.sortBy"
>
<template slot-scope="scope">
<div v-html="scope.row[column.prop]" />
</template>
</el-table-column>
<el-table-column <el-table-column
v-else-if="checkColumnTyep(column, 'basicText')" v-else-if="checkColumnTyep(column, 'basicText')"
:key="index" :key="index"

View File

@ -378,7 +378,6 @@ class Jlmap {
update(list) { update(list) {
this.setUpdateMapDevice(list || []); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息 this.setUpdateMapDevice(list || []); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息
const signalDeviceList = []; const signalDeviceList = [];
const signalStatusList = [];
(list || []).forEach(elem => { (list || []).forEach(elem => {
const code = elem.code; const code = elem.code;
const type = elem._type; const type = elem._type;
@ -393,13 +392,9 @@ class Jlmap {
} }
} }
const signalDevice = this.mapDevice[route.startSignalCode]; const signalDevice = this.mapDevice[route.startSignalCode];
const signalStatus = {atsControl: elem.atsControl, fleetMode: elem.fleetMode};
const index = signalDeviceList.indexOf(signalDevice); const index = signalDeviceList.indexOf(signalDevice);
if (index === -1) { if (index === -1) {
signalDeviceList.push(signalDevice); signalDeviceList.push(signalDevice);
signalStatusList.push(signalStatus);
} else {
signalStatusList[index] = {atsControl: signalStatusList[index].atsControl && elem.atsControl, fleetMode: signalStatusList[index].fleetMode || elem.fleetMode};
} }
} else if (elem.deviceType === 'CYCLE') { } else if (elem.deviceType === 'CYCLE') {
store.dispatch('map/updateAutoReentryState', elem); store.dispatch('map/updateAutoReentryState', elem);
@ -438,15 +433,28 @@ class Jlmap {
} }
} }
}); });
this.handleRouteSignalStatus(signalDeviceList, signalStatusList); this.handleRouteSignalStatus(signalDeviceList);
// 状态后处理 // 状态后处理
this.postHandle(list || []); this.postHandle(list || []);
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); } if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
} }
handleRouteSignalStatus(signalDeviceList, signalStatusList) { handleRouteSignalStatus(signalDeviceList) {
const routeStartSignalData = store.state.map.routeStartSignalData;
signalDeviceList.forEach((item, index)=> { signalDeviceList.forEach((item, index)=> {
if (item && this.hookHandle(item, signalStatusList[index])) { const status = {};
if (routeStartSignalData[item.code] && routeStartSignalData[item.code].length) {
routeStartSignalData[item.code].forEach((elem, index)=> {
if (index) {
status.atsControl = status.atsControl && elem.atsControl;
status.fleetMode = status.fleetMode || elem.fleetMode;
} else {
status.atsControl = elem.atsControl;
status.fleetMode = elem.fleetMode;
}
});
}
if (item && this.hookHandle(item, status)) {
this.$painter.update(item); this.$painter.update(item);
} }
}); });

View File

@ -29,7 +29,7 @@
<el-radio :label="'MANUAL'" style="margin-top:5px;">{{ $t('menu.artificialTrain') }}</el-radio> <el-radio :label="'MANUAL'" style="margin-top:5px;">{{ $t('menu.artificialTrain') }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item v-if="formModel.type == 'PLAN'" prop="serviceNumber"> <el-form-item v-if="formModel.type == 'PLAN'|| formModel.type == 'HEAD'" prop="serviceNumber">
<span slot="label">{{ $t('menu.serviceNumber') + '' }}</span> <span slot="label">{{ $t('menu.serviceNumber') + '' }}</span>
<el-input <el-input
:id="domIdServerNo" :id="domIdServerNo"
@ -37,7 +37,7 @@
:disabled="serverNoIsDisabled" :disabled="serverNoIsDisabled"
/> />
</el-form-item> </el-form-item>
<el-form-item v-if="formModel.type == 'PLAN'|| formModel.type == 'HEAD'" :label="this.$t('menu.tripNumber')+this.$t('global.colon')" prop="tripNumber"> <el-form-item v-if="formModel.type == 'PLAN'" :label="this.$t('menu.tripNumber')+this.$t('global.colon')" prop="tripNumber">
<el-input <el-input
:id="domIdTrainNo" :id="domIdTrainNo"
v-model="formModel.tripNumber" v-model="formModel.tripNumber"
@ -48,8 +48,24 @@
<el-input <el-input
:id="domIdTargetCode" :id="domIdTargetCode"
v-model="formModel.destinationCode" v-model="formModel.destinationCode"
:disabled="formModel.type !== 'HEAD'"
/> />
</el-form-item> </el-form-item>
<el-form-item v-if="formModel.type == 'MANUAL'" :label="this.$t('menu.category')+this.$t('global.colon')" prop="category">
<el-select
:id="domIdTrainNumber"
v-model="formModel.category"
filterable
:disabled="true"
>
<el-option
v-for="item in categoryList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form> </el-form>
<el-row justify="center" class="button-group"> <el-row justify="center" class="button-group">
<el-col :span="10" :offset="2"> <el-col :span="10" :offset="2">
@ -67,11 +83,11 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import ConfirmTrain from './childDialog/confirmTrain'; import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from './childDialog/childDialog/noticeInfo'; import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Handler from '@/scripts/cmdPlugin/Handler'; import Handler from '@/scripts/cmdPlugin/Handler';
import { menuOperate, commitOperate } from '../utils/menuOperate'; import { menuOperate, commitOperate } from '../utils/menuOperate';
import {getTrainDetailBytripNumber} from '@/api/simulation';
export default { export default {
name: 'TrainControl', name: 'TrainControl',
@ -82,6 +98,7 @@ export default {
data() { data() {
return { return {
trainList: [], trainList: [],
serviceNumber:'',
formModel: { formModel: {
tripNumber: '', tripNumber: '',
groupNumber: '', groupNumber: '',
@ -90,7 +107,9 @@ export default {
destinationCode: '', destinationCode: '',
category: 'MM' category: 'MM'
}, },
categoryList: [
{ name: 'MM', value: '01' }
],
rules: { rules: {
groupNumber: [ groupNumber: [
{ required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'change' } { required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'change' }
@ -98,9 +117,6 @@ export default {
type: [ type: [
{ required: true, message: this.$t('rules.selectATrainType'), trigger: 'change' } { required: true, message: this.$t('rules.selectATrainType'), trigger: 'change' }
], ],
serviceNumber: [
{ required: true, message: this.$t('rules.enterTheServiceNumber'), trigger: 'blur' }
],
tripNumber: [ tripNumber: [
{ required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' } { required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' }
], ],
@ -214,7 +230,22 @@ export default {
return ''; return '';
} }
}, },
watch: {}, watch: {
'formModel.tripNumber': function(val) {
if (val.length == 4) {
this.trainNoChange(val);
} else {
this.formModel = {
groupNumber: this.formModel.groupNumber,
tripNumber: val,
type: this.formModel.type,
serviceNumber: '',
targetCode: '',
category: 'MM'
};
}
}
},
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
@ -228,6 +259,7 @@ export default {
this.operation = operate.operation; this.operation = operate.operation;
} }
const model = this.$store.getters['map/getDeviceByCode'](selected.code); const model = this.$store.getters['map/getDeviceByCode'](selected.code);
this.serviceNumber = model.serviceNumber;
this.formModel = { this.formModel = {
groupNumber: model.groupNumber, groupNumber: model.groupNumber,
tripNumber: model.tripNumber, tripNumber: model.tripNumber,
@ -267,6 +299,11 @@ export default {
}); });
}, },
trainTypeChange(trainType) { trainTypeChange(trainType) {
if (trainType === 'HEAD') {
this.formModel.serviceNumber = '';
} else if (trainType === 'PLAN' && this.serviceNumber) {
this.formModel.serviceNumber = this.serviceNumber;
}
const operate = { const operate = {
type: trainType, type: trainType,
operation: '' operation: ''
@ -293,6 +330,14 @@ export default {
operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation; operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation;
} }
Handler.undo(1); Handler.undo(1);
getTrainDetailBytripNumber(this.$route.query.group, {tripNumber:tripNumber}).then(resp => {
if (resp.data) {
this.formModel.serviceNumber = resp.data.serviceNumber;
this.formModel.destinationCode = resp.data.destinationCode;
}
}).catch(() => {
this.$message.error('获取列车信息失败!');
});
this.$store.dispatch('training/tripNumber', operate).then(({ valid }) => { this.$store.dispatch('training/tripNumber', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });

View File

@ -181,6 +181,7 @@ const map = {
state: { state: {
routeData: {}, // 进路数据 routeData: {}, // 进路数据
routeList: [], // 进路list routeList: [], // 进路list
routeStartSignalData: {}, // 进路始端信号机数据
autoReentryData: {}, // 自动折返数据 autoReentryData: {}, // 自动折返数据
autoReentryList: [], // 自动折返list autoReentryList: [], // 自动折返list
signalApproachSectionData: {}, // 信号机接近区段数据 signalApproachSectionData: {}, // 信号机接近区段数据
@ -232,6 +233,13 @@ const map = {
routeData: (state) => { routeData: (state) => {
return state.routeData; return state.routeData;
}, },
routeStartSignalData: (state) => {
if (state.map) {
return state.map.routeStartSignalData || {};
} else {
return {};
}
},
overlapData: (state) => { overlapData: (state) => {
return state.overlapData; return state.overlapData;
}, },
@ -719,6 +727,11 @@ const map = {
setRouteData: (state, routeDataList) => { setRouteData: (state, routeDataList) => {
routeDataList.forEach(data => { routeDataList.forEach(data => {
state.routeData[data.code] = data; state.routeData[data.code] = data;
if (state.routeStartSignalData[data.startSignalCode] && state.routeStartSignalData[data.startSignalCode].length) {
state.routeStartSignalData[data.startSignalCode].push(data);
} else {
state.routeStartSignalData[data.startSignalCode] = [data];
}
}); });
state.map.automaticRouteButtonList && state.map.automaticRouteButtonList.forEach(item => { state.map.automaticRouteButtonList && state.map.automaticRouteButtonList.forEach(item => {
state.routeData[item.automaticRouteCode].automaticRouteCode = item.code; state.routeData[item.automaticRouteCode].automaticRouteCode = item.code;

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -14,37 +14,30 @@
:data="theoryQuestionList" :data="theoryQuestionList"
style="width: 100%" style="width: 100%"
height="100%" height="100%"
:summary-method="getSummaries"
:show-summary="showSummary"
:row-style="handleRowStyle"
> >
<el-table-column <el-table-column prop="type" label="类型" width="100">
prop="type"
label="类型"
width="100"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag <el-tag type="primary" disable-transitions>{{ QuestionTypeMap[scope.row.type] }}</el-tag>
type="primary"
disable-transitions
>{{ QuestionTypeMap[scope.row.type] }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="topic" label="题目" show-overflow-tooltip="">
prop="topic" <template slot-scope="scope">
label="题目" <span v-html="scope.row.topic" />
/> </template>
<el-table-column </el-table-column>
prop="score" <el-table-column prop="score" label="分值" width="100">
label="分值"
width="100"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="!scope.row.editScope" @click="editScope(scope.row)">{{ scope.row.score }}</span> <span v-if="!scope.row.editScope" @click="editScope(scope.row)">{{ scope.row.score }}</span>
<i v-if="!scope.row.editScope" class="el-icon-edit" @click="editScope(scope.row)" /> <i v-if="!scope.row.editScope" class="el-icon-edit" @click="editScope(scope.row)" />
<el-input v-if="scope.row.editScope" v-model="scope.row.score" v-focus="scope.row.editFocus" size="small" style="width: 50px;" @blur="editScopeBlur(scope.row)" /> <el-input-number v-if="scope.row.editScope" v-model="scope.row.score" v-focus="scope.row.editFocus" :controls="noControls" :min="0" size="mini" style="width: 90px" @blur="editScopeBlur(scope.row)" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="operate" label="操作" width="100"> <el-table-column prop="operate" label="操作" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="warning" size="mini" @click="removeTheoryQuestion(scope)">移出</el-button> <el-button type="warning" size="mini" @click="removeTheoryQuestion(scope.row)">移出</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -59,25 +52,22 @@
:data="operateQuestionList" :data="operateQuestionList"
style="width: 100%" style="width: 100%"
height="100%" height="100%"
:row-style="handleRowStyle"
:summary-method="getSummaries"
:show-summary="showSummary"
> >
<el-table-column <el-table-column prop="name" label="实操名称" />
prop="name" <el-table-column prop="creatorName" label="创建人" />
label="实操名称"
/>
<el-table-column
prop="creatorName"
label="创建人"
/>
<el-table-column prop="score" label="分值"> <el-table-column prop="score" label="分值">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="!scope.row.editScope" @click="editScope(scope.row)">{{ scope.row.score }}</span> <span v-if="!scope.row.editScope" @click="editScope(scope.row)">{{ scope.row.score }}</span>
<i v-if="!scope.row.editScope" class="el-icon-edit" @click="editScope(scope.row)" /> <i v-if="!scope.row.editScope" class="el-icon-edit" @click="editScope(scope.row)" />
<el-input v-if="scope.row.editScope" v-model="scope.row.score" v-focus="scope.row.editFocus" size="small" style="width: 50px;" @blur="editScopeBlur(scope.row)" /> <el-input-number v-if="scope.row.editScope" v-model="scope.row.score" v-focus="scope.row.editFocus" :controls="noControls" :min="0" size="mini" @blur="editScopeBlur(scope.row)" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="operate" label="操作"> <el-table-column prop="operate" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="warning" size="mini" @click="removeOperateQuestion(scope)">移出</el-button> <el-button type="warning" size="mini" @click="removeOperateQuestion(scope.row)">移出</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -108,6 +98,8 @@ export default {
select: '选择题', select: '选择题',
judge: '判断题' judge: '判断题'
}, },
showSummary: true,
noControls: false,
theoryQuestionList: [], // theoryQuestionList: [], //
operateQuestionList: [], // operateQuestionList: [], //
theoryIndexList: [], // theoryIndexList: [], //
@ -126,12 +118,22 @@ export default {
this.theoryQuestionList.splice(index, 1); this.theoryQuestionList.splice(index, 1);
}, },
addTheoryQuestionList(row) { addTheoryQuestionList(row) {
if (this.theoryQuestionList.length) {
this.theoryIndexList.push(row.id); this.theoryIndexList.push(row.id);
this.theoryQuestionList.push(row); this.theoryQuestionList.push(row);
} else {
this.theoryIndexList = [row.id];
this.theoryQuestionList = [row];
}
}, },
addOperateQuestionList(row) { addOperateQuestionList(row) {
if (this.operateQuestionList.length) {
this.operateIndexList.push(row.id); this.operateIndexList.push(row.id);
this.operateQuestionList.push(row); this.operateQuestionList.push(row);
} else {
this.operateIndexList = [row.id];
this.operateQuestionList = [row];
}
}, },
addTheoryQuestion() { addTheoryQuestion() {
this.$refs.theoryQuestion.doShow(); this.$refs.theoryQuestion.doShow();
@ -156,17 +158,68 @@ export default {
editScopeBlur(row) { editScopeBlur(row) {
this.$set(row, 'editScope', false); this.$set(row, 'editScope', false);
this.$set(row, 'editFocus', true); this.$set(row, 'editFocus', true);
if (row.score > 0) {
this.$set(row, 'isError', false);
}
this.showSummary = false;
this.$nextTick(() => {
this.getSummaries({data: this.theoryQuestionList});
});
},
handleRowStyle({row, rowIndex}) {
return row.isError ? {background: '#F00'} : {background: '#FFF'};
},
getSummaries(param) {
const { data } = param;
const sums = [];
sums[0] = '总分';
const values = data.map(item => Number(item.score));
if (!values.every(value => isNaN(value))) {
sums[2] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[2] += ' 分';
}
this.showSummary = true;
return sums;
}, },
exportPaper() { exportPaper() {
let flag = false;
this.theoryQuestionList.forEach((item) => {
if (item.score <= 0) {
flag = true;
this.$set(item, 'isError', true);
}
});
this.operateQuestionList.forEach((item) => {
if (item.score <= 0) {
flag = true;
this.$set(item, 'isError', true);
}
});
if (flag) {
this.$message.error('试题分分值不得为0');
} else {
this.$refs.setExamTime.doShow(); this.$refs.setExamTime.doShow();
} }
} }
}
}; };
</script> </script>
<style scoped> <style scoped>
/deep/ /deep/
.el-card__body{ .el-card__body{
height: calc(100% - 50px); height: calc(100% - 47px);
}
/deep/
.el-table__body-wrapper {
height: calc(100% - 97px) !important;
} }
</style> </style>

View File

@ -100,6 +100,7 @@ export default {
}, },
addQuestion(index, row) { addQuestion(index, row) {
this.$set(row, 'paper', true); this.$set(row, 'paper', true);
row.score = 0;
this.$emit('addQuestion', row); this.$emit('addQuestion', row);
}, },
afterQuery(data) { afterQuery(data) {

View File

@ -71,13 +71,12 @@ export default {
handleExport() { handleExport() {
getRaceById(this.$route.query.raceId).then(resp => { getRaceById(this.$route.query.raceId).then(resp => {
const exportData = { const exportData = {
operateQuestionList: this.operateQuestionList, practicalQuestions: this.operateQuestionList,
theoryQuestionList: this.theoryQuestionList, theoryQuestions: this.theoryQuestionList,
raceId: this.$route.query.raceId, competitionId: this.$route.query.raceId,
theoryExamTime: this.form.theoryExamTime, theoryExamTime: this.form.theoryExamTime,
operateExamTime: this.form.operateExamTime operateExamTime: this.form.operateExamTime
}; };
console.log(exportData, '11111111');
const content = new Blob([JSON.stringify(exportData)]); const content = new Blob([JSON.stringify(exportData)]);
const urlObject = window.URL || window.webkitURL || window; const urlObject = window.URL || window.webkitURL || window;
const url = urlObject.createObjectURL(content); const url = urlObject.createObjectURL(content);

View File

@ -64,7 +64,8 @@ export default {
}, },
{ {
title: '题 目', title: '题 目',
prop: 'topic' prop: 'topic',
type: 'html'
}, },
{ {
title: '答 案', title: '答 案',
@ -124,6 +125,7 @@ export default {
}, },
addQuestion(index, row) { addQuestion(index, row) {
this.$set(row, 'paper', true); this.$set(row, 'paper', true);
row.score = 0;
this.$emit('addQuestion', row); this.$emit('addQuestion', row);
}, },
afterQuery(data) { afterQuery(data) {

View File

@ -159,7 +159,6 @@ export default {
async getUserStatus() { async getUserStatus() {
this.resultFlag = false; this.resultFlag = false;
const res = await getRaceUserById(this.$route.query.raceId); const res = await getRaceUserById(this.$route.query.raceId);
// console.log(res.data.status);
if (this.$route.query.type == 'theory' && (res.data.status == 4 || res.data.status == 5)) { if (this.$route.query.type == 'theory' && (res.data.status == 4 || res.data.status == 5)) {
this.$router.replace({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } }); this.$router.replace({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } });
} else if (this.$route.query.type == 'operation' && (res.data.status == 4 || res.data.status == 6)) { } else if (this.$route.query.type == 'operation' && (res.data.status == 4 || res.data.status == 6)) {
@ -177,19 +176,21 @@ export default {
this.$messageBox('试卷还没被加载'); this.$messageBox('试卷还没被加载');
} }
}).catch(()=>{}); }).catch(()=>{
this.$messageBox('试卷还没被加载');
});
} else { } else {
getPracticalQuestion(this.$route.query.raceId).then((responese)=>{ getPracticalQuestion(this.$route.query.raceId).then((responese)=>{
if (responese.data) { if (responese.data) {
participantCreatTrainingRoom(this.$route.query.raceId, {mapId: 41, prdType: '02'}).then(resp => { participantCreatTrainingRoom(this.$route.query.raceId, {mapId: 41, prdType: '02'}).then(resp => {
// const query = { lineCode: '11', mapId: '41', group: resp.data, prdType: '03', raceId: this.$route.query.raceId};
// this.$router.replace({ path: `/displayNew/demon`, query: query});
const query = { lineCode: '11', mapId: '41', group: resp.data, raceId: this.$route.query.raceId}; const query = { lineCode: '11', mapId: '41', group: resp.data, raceId: this.$route.query.raceId};
this.$router.replace({ path: `/jointTrainingNew`, query: query}); this.$router.replace({ path: `/jointTrainingNew`, query: query});
}); });
} else { } else {
this.$messageBox('试卷还没被加载'); this.$messageBox('试卷还没被加载');
} }
}).catch(()=>{
this.$messageBox('试卷还没被加载');
}); });
} }
} }

View File

@ -4,23 +4,19 @@
<span style="font-weight:bold ">{{ $t('exam.examResultsDetails') }}</span> <span style="font-weight:bold ">{{ $t('exam.examResultsDetails') }}</span>
</div> </div>
<div class="context"> <div class="context">
<el-form ref="form" :model="resultModel" size="mini"> <!-- <el-form ref="form" :model="resultModel" size="mini">
<el-form-item :label="this.$t('exam.testScores')+':'" prop="score"> <el-form-item :label="this.$t('exam.testScores')+':'" prop="score">
<span>{{ resultModel.score + ' '+ $t('exam.points') }}</span> <span>{{ resultModel.score + ' '+ $t('exam.points') }}</span>
</el-form-item> </el-form-item>
<el-form-item :label="this.$t('exam.examTime')+':'" prop="detail"> <el-form-item :label="this.$t('exam.examTime')+':'" prop="detail">
<span>{{ Math.ceil((resultModel.usedTime || 0)/60) + ' '+ $t('global.minutes') }}</span> <span>{{ Math.ceil((resultModel.usedTime || 0)/60) + ' '+ $t('global.minutes') }}</span>
</el-form-item> </el-form-item>
</el-form> </el-form> -->
<el-table :data="tableData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary :span-method="objectSpanMethod"> <el-table :data="tableData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary :span-method="objectSpanMethod">
<el-table-column prop="title" label="题数"> <el-table-column prop="title" label="题目" />
<template slot-scope="scope"> <el-table-column prop="score" label="分值" />
<span>{{ '第'+scope.row.title + '题' }}</span> <el-table-column prop="goal" label="得分" />
</template> <el-table-column v-if="this.$route.query.type ==='theory'" prop="correctAnswer" label="答题结果" />
</el-table-column>
<el-table-column prop="score" label="分值(分)" />
<el-table-column prop="goal" label="得分(分)" />
<el-table-column v-if="this.$route.query.type ==='theory'" prop="correctAnswer" label="正确答案" />
<el-table-column v-if="this.$route.query.type ==='theory'" prop="explain" label="说明" /> <el-table-column v-if="this.$route.query.type ==='theory'" prop="explain" label="说明" />
<el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointIndex" label="得分点"> <el-table-column v-if="this.$route.query.type ==='operate'" prop="scoringPointIndex" label="得分点">
<template slot-scope="scope"> <template slot-scope="scope">
@ -40,6 +36,7 @@
<script> <script>
// import { submitExam } from '@/api/management/userexam'; // import { submitExam } from '@/api/management/userexam';
// import { UrlConfig } from '@/scripts/ConstDic'; // import { UrlConfig } from '@/scripts/ConstDic';
import { getCompetitionDetail } from '@/api/competition';
export default { export default {
name: 'ExamResult', name: 'ExamResult',
@ -76,11 +73,11 @@ export default {
return this.$store.state.app.height - 50; return this.$store.state.app.height - 50;
} }
}, },
mounted() { created() {
this.submitExamData(); this.submitExamData();
}, },
methods: { methods: {
getSummaries(param) { getSummaries(param) { //
const { columns, data } = param; const { columns, data } = param;
const sums = []; const sums = [];
columns.forEach((column, index) => { columns.forEach((column, index) => {
@ -109,9 +106,21 @@ export default {
}, },
submitExamData() { submitExamData() {
this.loading = false; this.loading = false;
if (this.$route.query.type === 'theory') { if (this.$route.query.type == 'theory') {
this.tableData = this.theoryData; getCompetitionDetail(this.$route.query.raceId).then(res => {
} else if (this.$route.query.type === 'operate') { console.log(res);
this.tableData = [];
res.data.forEach(item => {
this.tableData.push({
title: item.topic,
score: item.totalScore,
goal: item.score,
correctAnswer: item.correct ? '正确' : '错误',
explain: item.remarks
});
});
});
} else if (this.$route.query.type == 'operate') {
this.tableData = []; this.tableData = [];
this.operateData.forEach(item => { this.operateData.forEach(item => {
if (item.scoringPoints && item.scoringPoints.length) { if (item.scoringPoints && item.scoringPoints.length) {

View File

@ -26,7 +26,7 @@
// import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js'; // import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js';
// import WindowResizeHandler from '@/mixin/WindowResizeHandler'; // import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import Question from './question'; import Question from './question';
import {postCompetitionTheory} from '@/api/competition'; import { postCompetitionTheory, getTheoryQuestion } from '@/api/competition';
export default { export default {
components: { components: {
@ -48,26 +48,8 @@ export default {
totalScore: 0, totalScore: 0,
passScore: 10 passScore: 10
}, },
examQuestions: [ examQuestions: [],
{ theoryAnswers: []
topic: 'PH玻璃电极只能在5~60℃范围内使用而且还应通过温度校正装置来消除影响。',
type: 'judge',
optionList: [
{id: '160', content: '√', correct: true},
{id: '161', content: '×', correct: false}
]
},
{
topic: '调度工作是( ___ )工作中的一个重要组成部分。',
type: 'select',
optionList: [
{id: '40', content: '<span style="color: windowtext;">煤矿管理</span>', correct: false},
{id: '41', content: '<span style="color: windowtext;">企业管理</span>', correct: true},
{id: '42', content: '<span style="color: windowtext;">安全生产</span>', correct: false},
{id: '43', content: '<span style="color: windowtext;">生产组织</span>', correct: false}
]
}
]
}; };
}, },
computed: { computed: {
@ -106,18 +88,15 @@ export default {
}, },
methods: { methods: {
loadInitData() { loadInitData() {
console.log('获取试题详情'); this.theoryAnswers = [];
// getExamInfo(this.examId).then(resp => { getTheoryQuestion(this.$route.query.raceId).then((resp)=>{
// this.formModel = resp.data; if (resp.data) {
// getUserExam(this.userExamId).then(rest => { this.examQuestions = resp.data.questions.map((el, i) => {
// this.examQuestions = rest.data.map((el, i) => { el.index = i;
// el.index = i; return el;
// return el; });
// }); }
// }); }).catch(error => { this.$message.error(`加载考试详情失败:${error.message}`); });
// }).catch(error => {
// this.$message.error(`${error.message}`);
// });
}, },
resizeHandler() { resizeHandler() {
this.height = this._clientHeight; this.height = this._clientHeight;
@ -154,15 +133,20 @@ export default {
} }
}, },
doEnd() { doEnd() {
// console.log(''); const params = {
// this.$router.push({ path: `/jsxt/home`}); competitionId: this.$route.query.raceId,
const params = {competitionId:this.$route.query.raceId}; theoryAnswers: this.theoryAnswers
postCompetitionTheory(1, params).then(()=>{ };
postCompetitionTheory(params).then(()=>{
this.$router.push({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } }); this.$router.push({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } });
}); });
}, },
onSave(data) { onSave(data) {
console.log(data, '问答题'); // console.log(data, '');
this.theoryAnswers.push({
answerOptionId: data.answer,
questionId: data.userExamQuestionId
});
} }
} }
}; };

View File

@ -113,7 +113,7 @@ export default {
} }
], ],
actions: [ actions: [
{ text: '导入试题', handler: this.handleAdd } { text: '导入试题', handler: this.handleAdd, fileType: 'file' }
] ]
}, },
isLeaving:false, isLeaving:false,
@ -149,10 +149,31 @@ export default {
}); });
}, },
handleAdd() { handleAdd() {
loadingPaper(this.$route.query.raceId, {}).then((response)=>{ const loading = this.$loading({
this.$message('试题加载成功'); lock: true,
}).catch(()=>{ text: '正在导入中...',
this.$message('试题加载失败'); spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
setTimeout(() => {
const obj = document.getElementById('queryFormFilesInput');
if (!obj.files) return;
const f = obj.files[0];
const reader = new FileReader();
const that = this;
reader.readAsText(f, 'utf-8');
reader.onload = function(e) {
const data = e.target.result;
console.log(JSON.parse(data));
loadingPaper(that.$route.query.raceId, JSON.parse(data)).then(res => {
that.$message.success('试题加载成功');
loading.close();
}).catch(error => {
loading.close();
that.$message.error('试题加载失败' + error.message);
});
obj.value = '';
};
}); });
}, },
// //

View File

@ -43,7 +43,6 @@ export default {
this.trainList = this.$store.state.map.map.trainList.filter((train)=>{ this.trainList = this.$store.state.map.map.trainList.filter((train)=>{
return train.serviceNumber != '' && train.serviceNumber != undefined; return train.serviceNumber != '' && train.serviceNumber != undefined;
}); });
console.log(this.trainList);
}, },
'$store.state.map.runPlanStatus': function (val) { '$store.state.map.runPlanStatus': function (val) {
if (!val) { if (!val) {