试卷规则调整

This commit is contained in:
joylink_fanyuhong 2020-04-10 20:46:17 +08:00
parent bcee763b85
commit f6be5ef329
3 changed files with 129 additions and 29 deletions

View File

@ -33,6 +33,10 @@
<script>
import { getLessonTypeNum, getCourseTypeList } from '@/api/management/exam';
import { getDetailList } from '@/api/management/dictionary';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { getCmdList } from '@/api/management/dictionary';
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
export default {
name: 'EditRule',
@ -44,7 +48,15 @@ export default {
editCourse: {
type: Object,
required: true
}
},
drawWay: {
type: Boolean,
default: false
},
lineCode: {
type: String,
default: ''
}
},
data() {
var number = (rule, value, callback) => {
@ -120,28 +132,93 @@ export default {
async mounted() {
await this.getList();
await this.refresh();
this.trainingOperateTypeMap = {};
this.$Dictionary.stationControl().then(list => {
this.trainingOperateTypeMap['01'] = list; //
});
this.$Dictionary.signalOperation().then(list => {
this.trainingOperateTypeMap['02'] = list; //
});
this.$Dictionary.switchOperation().then(list => {
this.trainingOperateTypeMap['03'] = list; //
});
this.$Dictionary.sectionOperation().then(list => {
this.trainingOperateTypeMap['04'] = list; //
});
this.$Dictionary.stationStandOperation().then(list => {
this.trainingOperateTypeMap['05'] = list; //
});
this.$Dictionary.trainPlanOperation().then(list => {
this.trainingOperateTypeMap['06'] = list; //
});
this.$Dictionary.trainOperation().then(list => {
this.trainingOperateTypeMap['07'] = list; //
});
if (this.drawWay) {
this.trainingOperateTypeMap = {
Switch: [],
Section: [],
Signal: [],
Stand: [],
Station: [],
ControlConvertMenu: [],
TrainWindow: []
};
let val;
for ( val in CMD['Switch']) {
this.trainingOperateTypeMap['Switch'].push(CMD['Switch'][val]);
}
for ( val in CMD['Section']) {
this.trainingOperateTypeMap['Section'].push(CMD['Section'][val]);
}
for ( val in CMD['Signal']) {
this.trainingOperateTypeMap['Signal'].push(CMD['Signal'][val]);
}
for ( val in CMD['Stand']) {
this.trainingOperateTypeMap['Stand'].push(CMD['Stand'][val]);
}
for ( val in CMD['Station']) {
this.trainingOperateTypeMap['Station'].push(CMD['Station'][val]);
}
for ( val in CMD['ControlConvertMenu']) {
this.trainingOperateTypeMap['ControlConvertMenu'].push(CMD['ControlConvertMenu'][val]);
}
for ( val in CMD['Train']) {
this.trainingOperateTypeMap['TrainWindow'].push(CMD['Train'][val]);
}
const lineCode = this.lineCode;
const res = await getCmdList(lineCode, {});
const trainingOperateList = [];
const trainingOperateConfigList = [];
const operateTypeMap = {
Switch: [],
Section: [],
Signal: [],
Stand: [],
Station: [],
ControlConvertMenu: [],
TrainWindow: []
};
if (res && res.code === 200) {
res.data.forEach(item => {
this.trainingOperateTypeMap[item.operateObject].forEach(ele => {
if (ele.value == item.operate && !operateTypeMap[item.operateObject].includes(ele)) {
operateTypeMap[item.operateObject].push({name: ele.label, code: ele.value});
}
});
if (!trainingOperateList.includes(item.operateObject)) {
trainingOperateList.push(item.operateObject);
const objectLabel = ConstConfig.ConstSelect.trainingDeviceType[item.operateObject] || {};
trainingOperateConfigList.push({code: item.operateObject, name: Cookies.get('user_lang') == 'en' ? objectLabel.enlabel : objectLabel.label});
}
});
this.options = trainingOperateConfigList;
this.trainingOperateTypeMap = operateTypeMap;
} else {
this.$message.error(this.$t('error.failedToObtainTrainingType'));
}
} else {
this.trainingOperateTypeMap = {};
this.$Dictionary.stationControl().then(list => {
this.trainingOperateTypeMap['01'] = list; //
});
this.$Dictionary.signalOperation().then(list => {
this.trainingOperateTypeMap['02'] = list; //
});
this.$Dictionary.switchOperation().then(list => {
this.trainingOperateTypeMap['03'] = list; //
});
this.$Dictionary.sectionOperation().then(list => {
this.trainingOperateTypeMap['04'] = list; //
});
this.$Dictionary.stationStandOperation().then(list => {
this.trainingOperateTypeMap['05'] = list; //
});
this.$Dictionary.trainPlanOperation().then(list => {
this.trainingOperateTypeMap['06'] = list; //
});
this.$Dictionary.trainOperation().then(list => {
this.trainingOperateTypeMap['07'] = list; //
});
}
},
methods: {
show() {
@ -165,7 +242,7 @@ export default {
}, 300);
} else {
//
this.$emit('addRuleList', this.form);
this.$emit('addRuleList', this.form, this.options);
setTimeout(() => {
this.handleCancel();
}, 300);

View File

@ -13,7 +13,7 @@
<exam-from ref="exam" @definition="definition" />
</template>
<template v-else class="rule">
<rule-from ref="rule" :course="course" @regulation="regulation" />
<rule-from ref="rule" :course="course" :drawWay="drawWay" :lineCode="lineCode" @regulation="regulation" />
</template>
</div>
<div class="draft">
@ -33,6 +33,7 @@
import { getPublishLessonList } from '@/api/jmap/lesson';
import RuleFrom from './rule';
import ExamFrom from './examFrom';
import { getPublishMapInfo } from '@/api/jmap/map';
export default {
name: 'ExamRule',
@ -45,7 +46,10 @@ export default {
display: 1,
course: {},
lessonName: '',
formData: {}
formData: {},
mapId: '',
drawWay: false,
lineCode: ''
};
},
computed: {
@ -80,6 +84,16 @@ export default {
this.course = data;
this.formData = {};
this.display = 2;
console.log(this.OrganizationList, data);
this.OrganizationList.forEach(elem => {
if (elem.id == data.region) {
this.mapId = elem.mapId;
}
});
getPublishMapInfo(this.mapId).then(res=>{
this.drawWay = res.data.drawWay;
this.lineCode = res.data.lineCode;
});
},
regulation(data) {
this.formData = data;

View File

@ -17,6 +17,8 @@
<edit-rule
ref="addRule"
:course-id="courseId"
:drawWay="drawWay"
:lineCode="lineCode"
:edit-course="editCourse"
@addRuleList="addRuleList"
@editRuleList="editRuleList"
@ -39,7 +41,15 @@ export default {
course: {
type: Object,
default: null
}
},
drawWay: {
type: Boolean,
default: false
},
lineCode: {
type: String,
default: ''
}
},
data() {
return {
@ -180,8 +190,7 @@ export default {
this.$messageBox(`${this.$t('publish.saveRuleFailed')} ${error.message}`);
});
},
addRuleList(data) {
var arr = this.$store.state.exam.courseList;
addRuleList(data, arr) {
let value;
arr.forEach(res => {
if (res.code == data.course) {