Merge remote-tracking branch 'origin/dev' into test

# Conflicts:
#	src/router/index.js
This commit is contained in:
fan 2019-10-31 16:04:57 +08:00
commit a250d54cb4
11 changed files with 1387 additions and 1427 deletions

File diff suppressed because one or more lines are too long

View File

@ -12,297 +12,296 @@ const renderer = 'canvas';
const devicePixelRatio = 1;
class IbpPan {
constructor(opts) {
this.methods = opts.methods;
constructor(opts) {
this.methods = opts.methods;
// 鼠标事件
this.events = { __Pan: 'pan', Selected: 'selected', Contextmenu: 'contextmenu'};
// 鼠标事件
this.events = { __Pan: 'pan', Selected: 'selected', Contextmenu: 'contextmenu'};
// 设备数据
this.ibpDevice = {};
// 设备数据
this.ibpDevice = {};
// 展示的画布大小
this.canvasSize = {};
// 展示的画布大小
this.canvasSize = {};
this.initIbpPage(opts);
}
initIbpPage(opts) {
const width = opts.config.width;
const height = opts.config.height;
this.isAllowDragging=false;
this.$ibpZr = 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.$mouseController = new MouseController(this);
this.initIbpPage(opts);
}
initIbpPage(opts) {
const width = opts.config.width;
const height = opts.config.height;
this.isAllowDragging = false;
this.$ibpZr = 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.$mouseController = new MouseController(this);
this.$mouseController.enable();
this.$mouseController.enable();
this.$painter = new Painter(this);
this.$painter.updateZrSize({width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight()});
this.$painter.updateTransform(this.$options, this.canvasSize);
this.$painter = new Painter(this);
this.$painter.updateZrSize({width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight()});
this.$painter.updateTransform(this.$options, this.canvasSize);
this.optionsHandler = this.setOptions.bind(this);
this.optionsHandler = this.setOptions.bind(this);
this.$mouseController.on(this.events.__Pan, this.optionsHandler);
}
this.$mouseController.on(this.events.__Pan, this.optionsHandler);
}
setMap(config, ibpDevice) {
// 保存平移缩放数据
if (config.config) {
this.$options.scaleRate = config.scaling;
this.$options.offsetX = config.origin.x;
this.$options.offsetY = config.origin.y;
}
setMap(config, ibpDevice) {
// 保存平移缩放数据
if (config.config) {
this.$options.scaleRate = config.scaling;
this.$options.offsetX = config.origin.x;
this.$options.offsetY = config.origin.y;
}
// 保存原始数据
this.data = config;
// 保存原始数据
this.data = config;
// 保存需展现的画布大小
this.canvasSize = {
x: 0,
y: 0,
width: config.background.width,
height: config.background.height
};
// 保存需展现的画布大小
this.canvasSize = {
x: 0,
y: 0,
width: config.background.width,
height: config.background.height
};
// 地图数据
this.ibpDevice = ibpDevice;
// 地图数据
this.ibpDevice = ibpDevice;
// 数据加载完成 回调
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.ibpDevice); }
// 数据加载完成 回调
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.ibpDevice); }
// 初次渲染视图
this.$painter.repaint(this.ibpDevice);
// 初次渲染视图
this.$painter.repaint(this.ibpDevice);
// 视图加载完成 回调
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.ibpDevice); }
// 视图加载完成 回调
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.ibpDevice); }
this.$painter.updateTransform(this.$options, this.canvasSize);
}
this.$painter.updateTransform(this.$options, this.canvasSize);
}
setDefaultState() {
const list = [];
Object.values(this.mapDevice).forEach(elem => {
const type = elem.model._type;
list.push(deviceFactory(type, Object.assign(elem.model, this.defaultStateDict[type]) ));
});
setDefaultState() {
const list = [];
Object.values(this.mapDevice).forEach(elem => {
const type = elem.model._type;
list.push(deviceFactory(type, Object.assign(elem.model, this.defaultStateDict[type]) ));
});
this.update(list);
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
}
this.update(list);
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
}
setOptions(opts) {
const options = this.pullBack(opts);
this.$options.update(options);
this.$painter.updateTransform(this.$options, this.canvasSize);
setOptions(opts) {
const options = this.pullBack(opts);
this.$options.update(options);
this.$painter.updateTransform(this.$options, this.canvasSize);
if (this.$options.disabled == true) {
this.$mouseController.disable();
} else {
this.$mouseController.enable(opts);
}
if (this.$options.disabled == true) {
this.$mouseController.disable();
} else {
this.$mouseController.enable(opts);
}
if (this.methods.optionsUpdate instanceof Function) { this.methods.optionsUpdate(this.$options); }
}
if (this.methods.optionsUpdate instanceof Function) { this.methods.optionsUpdate(this.$options); }
}
setCenter(deviceCode) {
const device = this.ibpDevice[deviceCode];
if (device && device.instance) {
var rect = createBoundingRect(device.instance);
var dcenter = calculateDCenter(rect, { width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight() });
this.setOptions(dcenter);
}
}
setCenter(deviceCode) {
const device = this.ibpDevice[deviceCode];
if (device && device.instance) {
var rect = createBoundingRect(device.instance);
var dcenter = calculateDCenter(rect, { width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight() });
this.setOptions(dcenter);
}
}
setLevelVisible(list) {
this.$painter.setLevelVisible(list);
}
setLevelVisible(list) {
this.$painter.setLevelVisible(list);
}
render(list) {
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
if (type === deviceType.Background) {
this.canvasSize = {
x: 0,
y: 0,
width: elem.width,
height: elem.height
};
}
updateIbpData(elem);
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem);
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
delete this.ibpDevice[code];
this.$painter.delete(oDevice);
if (!elem._dispose) {
this.ibpDevice[code] = nDevice;
this.$painter.add(nDevice);
}
});
if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); }
}
render(list) {
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
if (type === deviceType.Background) {
this.canvasSize = {
x: 0,
y: 0,
width: elem.width,
height: elem.height
};
}
updateIbpData(elem);
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem);
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
delete this.ibpDevice[code];
this.$painter.delete(oDevice);
if (!elem._dispose) {
this.ibpDevice[code] = nDevice;
this.$painter.add(nDevice);
}
});
if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); }
}
// 中间处理
hookHandle(model, elem) {
const code = elem.code;
const type = elem._type;
// 如果是延时计时,需要保存计数值到全局
if (type === deviceType.StationCounter) {
let val = '' + elem.val;
if (val === '0' || !elem.val) {
val = elem.val = localStore.get(code) || '0';
}
// 中间处理
hookHandle(model, elem) {
const code = elem.code;
const type = elem._type;
// 如果是延时计时,需要保存计数值到全局
if (type === deviceType.StationCounter) {
let val = '' + elem.val;
if (val === '0' || !elem.val) {
val = elem.val = localStore.get(code) || '0';
}
localStore(code, val);
}
for (var prop in elem) {
if (elem[prop] != model[prop]) {
Object.assign(model, elem);
return true;
}
}
localStore(code, val);
}
for (var prop in elem) {
if (elem[prop] != model[prop]) {
Object.assign(model, elem);
return true;
}
}
return false;
}
return false;
}
update(list) {
(list || []).forEach(elem => {
const code = elem.code;
const oDevice = this.ibpDevice[code];
if (elem.dispose) {
this.$painter.delete(oDevice);
} else {
if (this.hookHandle(oDevice.model, elem)) {
this.$painter.update(oDevice);
}
}
});
update(list) {
(list || []).forEach(elem => {
const code = elem.code;
const oDevice = this.ibpDevice[code];
if (elem.dispose) {
this.$painter.delete(oDevice);
} else {
if (this.hookHandle(oDevice.model, elem)) {
this.$painter.update(oDevice);
}
}
});
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
}
setStatus(code, model) {
const oDevcie = this.ibpDevice[code].instance;
oDevcie.setStatus(model);
}
setDeviceStatus(list) {
const deviceList = Object.values(this.ibpDevice);
console.log(list, deviceList);
deviceList.forEach(elem =>{
(list || []).forEach(it =>{
if (elem.model.linkDevice === it.code) {
elem.instance.setStatus(it);
}
});
});
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
}
setStatus(code, model) {
const oDevcie = this.ibpDevice[code].instance;
oDevcie.setStatus(model);
}
setDeviceStatus(list) {
const deviceList = Object.values(this.ibpDevice);
deviceList.forEach(elem =>{
(list || []).forEach(it =>{
if (elem.model.linkDevice === it.code) {
elem.instance.setStatus(it);
}
});
});
}
drawIbpInit() {
this.$mouseController.setAllowDragging(true);
}
}
drawIbpInit() {
this.$mouseController.setAllowDragging(true);
}
pullBack(payload) {
if (payload.type === 'zoom') {
const zrWidth = this.$ibpZr.getWidth();
const zrHeight = this.$ibpZr.getHeight();
const originX = payload.originX || zrWidth / 2;
const originY = payload.originY || zrHeight / 2;
const x = (this.$options.offsetX + originX) / this.$options.scaleRate;
const y = (this.$options.offsetY + originY) / this.$options.scaleRate;
const newScaleRate = this.$options.getScaleRate(payload.scale);
const dx = originX - (x * newScaleRate - this.$options.offsetX);
const dy = originY - (y * newScaleRate - this.$options.offsetY);
payload.dx = dx;
payload.dy = dy;
}
pullBack(payload) {
if (payload.type === 'zoom') {
const zrWidth = this.$ibpZr.getWidth();
const zrHeight = this.$ibpZr.getHeight();
const originX = payload.originX || zrWidth / 2;
const originY = payload.originY || zrHeight / 2;
const x = (this.$options.offsetX + originX) / this.$options.scaleRate;
const y = (this.$options.offsetY + originY) / this.$options.scaleRate;
const newScaleRate = this.$options.getScaleRate(payload.scale);
const dx = originX - (x * newScaleRate - this.$options.offsetX);
const dy = originY - (y * newScaleRate - this.$options.offsetY);
payload.dx = dx;
payload.dy = dy;
}
return payload || {};
}
return payload || {};
}
getZr() {
return this.$ibpZr;
}
getZr() {
return this.$ibpZr;
}
getEvents() {
return this.events;
}
getEvents() {
return this.events;
}
getDeviceByCode(code) {
return this.ibpDevice[code];
}
getDeviceByCode(code) {
return this.ibpDevice[code];
}
resize(opt) {
this.$ibpZr.resize(opt);
this.$painter.updateZrSize(opt);
}
resize(opt) {
this.$ibpZr.resize(opt);
this.$painter.updateZrSize(opt);
}
refresh() {
this.$painter.refresh();
}
clear() {
this.skinCode = '';
this.style = {};
this.ibpDevice = {};
this.$painter.clear();
}
initClockTime(initTime) {
Object.values(this.ibpDevice)
.forEach(elem => {
if (elem.model._type === deviceType.Clock) {
this.$painter.initClockTime(elem, initTime);
}
});
}
setClockStart(started) {
Object.values(this.ibpDevice)
.forEach(elem => {
if (elem.model._type === deviceType.Clock) {
this.$painter.setClockStart(elem, started);
}
});
}
dispose() {
this.off(this.events.Pan, this.optionsHandler);
this.off(this.events.Zoom, this.optionsHandler);
refresh() {
this.$painter.refresh();
}
clear() {
this.skinCode = '';
this.style = {};
this.ibpDevice = {};
this.$painter.clear();
}
initClockTime(initTime) {
Object.values(this.ibpDevice)
.forEach(elem => {
if (elem.model._type === deviceType.Clock) {
this.$painter.initClockTime(elem, initTime);
}
});
}
setClockStart(started) {
Object.values(this.ibpDevice)
.forEach(elem => {
if (elem.model._type === deviceType.Clock) {
this.$painter.setClockStart(elem, started);
}
});
}
dispose() {
this.off(this.events.Pan, this.optionsHandler);
this.off(this.events.Zoom, this.optionsHandler);
this.clear();
this.clear();
this.$mouseController.dispose();
this.$ibpZr && zrender.dispose(this.$ibpZr);
this.$painter.dispose();
}
this.$mouseController.dispose();
this.$ibpZr && zrender.dispose(this.$ibpZr);
this.$painter.dispose();
}
on(eventname, cb, context) {
const idx = Object.values(this.events).indexOf(eventname);
if (idx >= 0) {
switch (eventname) {
case this.events.Selected:
this.$mouseController.on(this.events.Selected, cb, context);
break;
case this.events.Contextmenu:
this.$mouseController.on(this.events.Contextmenu, cb, context);
break;
case this.events.DataZoom:
this.$mouseController.on(this.events.DataZoom, cb, context);
break;
}
}
}
on(eventname, cb, context) {
const idx = Object.values(this.events).indexOf(eventname);
if (idx >= 0) {
switch (eventname) {
case this.events.Selected:
this.$mouseController.on(this.events.Selected, cb, context);
break;
case this.events.Contextmenu:
this.$mouseController.on(this.events.Contextmenu, cb, context);
break;
case this.events.DataZoom:
this.$mouseController.on(this.events.DataZoom, cb, context);
break;
}
}
}
off(eventname, cb) {
const idx = Object.values(this.events).indexOf(eventname);
if (idx >= 0) {
switch (eventname) {
case this.events.Selected:
this.$mouseController.off(this.events.Selected, cb);
break;
case this.events.Contextmenu:
this.$mouseController.off(this.events.Contextmenu, cb);
break;
case this.events.DataZoom:
this.$mouseController.off(this.events.DataZoom, cb);
break;
}
}
}
off(eventname, cb) {
const idx = Object.values(this.events).indexOf(eventname);
if (idx >= 0) {
switch (eventname) {
case this.events.Selected:
this.$mouseController.off(this.events.Selected, cb);
break;
case this.events.Contextmenu:
this.$mouseController.off(this.events.Contextmenu, cb);
break;
case this.events.DataZoom:
this.$mouseController.off(this.events.DataZoom, cb);
break;
}
}
}
}
export default IbpPan;

View File

@ -10,7 +10,7 @@
<!-- </el-scrollbar> -->
</section>
<el-footer class="footers" style="height:30px;">
<div style="font-size:14px;float:left;">北京玖琏科技有限公司 &nbsp;联系电话: 13201793090 </div>
<div style="font-size:14px;float:left;">北京玖琏科技有限公司 &nbsp;联系电话: 13201793090 </div>
<div style="font-size:14px;float:right;">Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号</div>
</el-footer>
</div>
@ -21,47 +21,47 @@
import { Navbar } from './components'; // Sidebar
export default {
name: 'Layout',
components: {
Navbar
},
data() {
return {
};
},
computed: {
sidebar() {
return this.$store.state.app.sidebar;
},
device() {
return this.$store.state.app.device;
},
classObj() {
return {
withoutAnimation: this.sidebar.withoutAnimation,
mobile: this.device === 'mobile'
};
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height - 90;
}
},
created() {
this.watchRouterUpdate();
},
methods: {
handleClickOutside() {
this.$store.dispatch('CloseSideBar', { withoutAnimation: false });
},
watchRouterUpdate() {
this.$router.beforeEach((to, from, next) => {
next();
});
}
}
name: 'Layout',
components: {
Navbar
},
data() {
return {
};
},
computed: {
sidebar() {
return this.$store.state.app.sidebar;
},
device() {
return this.$store.state.app.device;
},
classObj() {
return {
withoutAnimation: this.sidebar.withoutAnimation,
mobile: this.device === 'mobile'
};
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height - 90;
}
},
created() {
this.watchRouterUpdate();
},
methods: {
handleClickOutside() {
this.$store.dispatch('CloseSideBar', { withoutAnimation: false });
},
watchRouterUpdate() {
this.$router.beforeEach((to, from, next) => {
next();
});
}
}
};
</script>

View File

@ -3,9 +3,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// 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.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
} else {
BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -60,7 +60,7 @@
import { createLesson, updateLesson, getLessonDetail } from '@/api/jmap/lessondraft';
import { getCommodityMapProduct } from '@/api/management/mapprd';
import { getSkinCodeList } from '@/api/management/mapskin';
import { UrlConfig } from '@/router/index';
// import { UrlConfig } from '@/router/index';
export default {
name: 'CourseEdit',
@ -187,7 +187,8 @@ export default {
}
},
back() {
this.$router.push({ path: `${UrlConfig.design.lessonHome}/${this.$route.query.mapId}/${this.$route.query.skinCode}`, query: {cityCode: this.$route.query.cityCode} });
// this.$router.push({ path: `${UrlConfig.design.lessonHome}/${this.$route.query.mapId}/${this.$route.query.skinCode}`, query: {cityCode: this.$route.query.cityCode} });
this.$router.go(-1);
}
}
};

View File

@ -145,7 +145,7 @@ export default {
.box{
height: 100%;
display: -webkit-box;
width: 100%;
width: 100%;
}
}
</style>

View File

@ -2,37 +2,13 @@
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogShow" :before-close="handleCancel" :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
<el-form-item :label="$t('publish.trainingType')" prop="course">
<el-select
v-model="form.course"
:placeholder="$t('publish.selectTypeScope')"
:disabled="editOk"
style="width:240px;"
@change="changeCourse(form.course)"
>
<el-option
v-for="nor in options"
:key="nor.id"
:label="nor.name"
:value="nor.code"
:disabled="nor.disabled"
/>
<el-select v-model="form.course" :placeholder="$t('publish.selectTypeScope')" :disabled="editOk" style="width:240px;" @change="changeCourse(form.course)">
<el-option v-for="nor in options" :key="nor.id" :label="nor.name" :value="nor.code" :disabled="nor.disabled" />
</el-select>
</el-form-item>
<el-form-item :label="$t('publish.operationType')">
<el-select
v-model="form.operateType"
clearable
:placeholder="$t('publish.selectScope')"
:disabled="editOk"
@change="changeOperation(form.operateType)"
>
<el-option
v-for="nor in operationTypeList"
:key="nor.id"
:label="nor.name"
:value="nor.code"
:disabled="nor.disabled"
/>
<el-select v-model="form.operateType" clearable :placeholder="$t('publish.selectScope')" :disabled="editOk" @change="changeOperation(form.operateType)">
<el-option v-for="nor in operationTypeList" :key="nor.id" :label="nor.name" :value="nor.code" :disabled="nor.disabled" />
</el-select>
</el-form-item>
<el-form-item :label="$t('publish.questionNumbers')" prop="number">
@ -59,254 +35,254 @@ import { getLessonTypeNum, getCourseTypeList } from '@/api/management/exam';
import { getDetailList } from '@/api/management/dictionary';
export default {
name: 'EditRule',
props: {
courseId: {
type: String,
required: true
},
editCourse: {
type: Object,
required: true
}
},
data() {
var number = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputQuestionNumber')));
}
setTimeout(() => {
if (Number(value) == 0) {
callback(new Error(this.$t('publish.inputQuestionNumberError')));
} else if (!Number(value)) {
callback(new Error(this.$t('publish.inputValidNumber')));
} else if (Number(value) > this.topicNum) {
callback(new Error(this.$t('publish.inputNumberError')));
} else {
callback();
}
}, 100);
};
var mark = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputScorePerQuestion')));
}
setTimeout(() => {
if (!Number(value)) {
callback(new Error(this.$t('publish.inputNumericType')));
} else {
callback();
}
}, 100);
};
return {
title: this.$t('publish.addRules'),
form: {
course: '',
operateType: '',
number: '',
mark: ''
},
topicNum: 0,
dialogShow: false,
editOk: false,
rules: {
course: [
{ required: true, message: this.$t('publish.selectTestType'), trigger: 'change' }
],
number: [
{ required: true, validator: number, trigger: 'blur' }
],
mark: [
{ required: true, validator: mark, trigger: 'blur' }
]
},
options: this.$store.state.exam.courseList,
typeList: [],
operationTypeList: [],
trainingOperateTypeMap: {}
};
},
watch: {
editCourse: function (val) {
this.title = this.$t('publish.modifyRules');
this.editOk = true;
this.form = {
course: val.trainingType,
operateType: val.operateType,
number: val.num,
mark: val.point
};
this.changeCourse(val.trainingType);
this.changeOperation(val.operateType);
}
},
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; //
});
},
methods: {
show() {
this.dialogShow = true;
},
handleOk() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.operationTypeList.forEach(item => {
if (item.code == this.form.operateType) {
this.form.name = item.name;
return;
}
});
if (this.editOk) {
//
this.$emit('editRuleList', this.form);
this.editOk = false;
setTimeout(() => {
this.handleCancel();
}, 300);
} else {
//
this.$emit('addRuleList', this.form);
setTimeout(() => {
this.handleCancel();
}, 300);
}
this.topicNum = 0;
} else {
this.dialogShow = true;
return false;
}
});
},
handleCancel() {
this.$refs['form'].resetFields();
this.clearBoth();
this.dialogShow = false;
this.editOk = false;
this.topicNum = 0;
this.operationTypeList = [];
},
clearBoth() {
this.form = {
course: '',
number: '',
mark: ''
};
},
//
async refresh() {
await getCourseTypeList({ lessonId: this.courseId }).then(res => {
const list = [];
res.data.sort();
res.data.forEach(ele => {
this.typeList.forEach(v => {
if (ele == v.code) {
list.push(v);
}
});
});
this.options = list;
this.changeCourseDisable();
this.$store.dispatch('exam/setCourse', this.options);
}).catch(() => {
this.$messageBox(this.$t('publish.refreshFailed'));
});
},
async getList() {
this.typeList = [];
await getDetailList('training_type').then(res => {
this.typeList = res.data;
}).catch((error) => { console.log(error.message); });
},
async changeCourse(val) {
const param = {
lessonId: this.courseId,
trainingType: val,
operateType: ''
};
this.operationTypeList = this.trainingOperateTypeMap[val];
if (this.operationTypeList) {
this.operationTypeList.forEach(item => {
item.disabled = false;
this.changeOperationDisabled(); //
});
}
this.form.operateType='';
const resp = await getLessonTypeNum(param);
if (resp.code == 200) {
this.topicNum = resp.data;
return this.topicNum;
}
this.$store.dispatch('exam/setCourse', this.options);
},
async changeOperation(val) {
const param = {
lessonId: this.courseId,
trainingType: this.form.course,
operateType: val
};
const resp = await getLessonTypeNum(param);
if (resp.code == 200) {
this.topicNum = resp.data;
return this.topicNum;
}
this.$store.dispatch('exam/setCourse', this.options);
},
//
changeCourseDisable() {
const arr = this.$store.state.exam.ruleList;
arr.forEach(ele => {
this.options.forEach(res => {
// operateType
if (ele.trainingType == res.code && !ele.operateType) {
res.disabled = true;
}
});
name: 'EditRule',
props: {
courseId: {
type: String,
required: true
},
editCourse: {
type: Object,
required: true
}
},
data() {
var number = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputQuestionNumber')));
}
setTimeout(() => {
if (Number(value) == 0) {
callback(new Error(this.$t('publish.inputQuestionNumberError')));
} else if (!Number(value)) {
callback(new Error(this.$t('publish.inputValidNumber')));
} else if (Number(value) > this.topicNum) {
callback(new Error(this.$t('publish.inputNumberError')));
} else {
callback();
}
}, 100);
};
var mark = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputScorePerQuestion')));
}
setTimeout(() => {
if (!Number(value)) {
callback(new Error(this.$t('publish.inputNumericType')));
} else {
callback();
}
}, 100);
};
return {
title: this.$t('publish.addRules'),
form: {
course: '',
operateType: '',
number: '',
mark: ''
},
topicNum: 0,
dialogShow: false,
editOk: false,
rules: {
course: [
{ required: true, message: this.$t('publish.selectTestType'), trigger: 'change' }
],
number: [
{ required: true, validator: number, trigger: 'blur' }
],
mark: [
{ required: true, validator: mark, trigger: 'blur' }
]
},
options: this.$store.state.exam.courseList,
typeList: [],
operationTypeList: [],
trainingOperateTypeMap: {}
};
},
watch: {
editCourse: function (val) {
this.title = this.$t('publish.modifyRules');
this.editOk = true;
this.form = {
course: val.trainingType,
operateType: val.operateType,
number: val.num,
mark: val.point
};
this.changeCourse(val.trainingType);
this.changeOperation(val.operateType);
}
},
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; //
});
},
methods: {
show() {
this.dialogShow = true;
},
handleOk() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.operationTypeList.forEach(item => {
if (item.code == this.form.operateType) {
this.form.name = item.name;
return;
}
});
if (this.editOk) {
//
this.$emit('editRuleList', this.form);
this.editOk = false;
setTimeout(() => {
this.handleCancel();
}, 300);
} else {
//
this.$emit('addRuleList', this.form);
setTimeout(() => {
this.handleCancel();
}, 300);
}
this.topicNum = 0;
} else {
this.dialogShow = true;
return false;
}
});
},
handleCancel() {
this.$refs['form'].resetFields();
this.clearBoth();
this.dialogShow = false;
this.editOk = false;
this.topicNum = 0;
this.operationTypeList = [];
},
clearBoth() {
this.form = {
course: '',
number: '',
mark: ''
};
},
//
async refresh() {
await getCourseTypeList({ lessonId: this.courseId }).then(res => {
const list = [];
res.data.sort();
res.data.forEach(ele => {
this.typeList.forEach(v => {
if (ele == v.code) {
list.push(v);
}
});
});
this.options = list;
this.changeCourseDisable();
this.$store.dispatch('exam/setCourse', this.options);
}).catch(() => {
this.$messageBox(this.$t('publish.refreshFailed'));
});
},
async getList() {
this.typeList = [];
await getDetailList('training_type').then(res => {
this.typeList = res.data;
}).catch((error) => { console.log(error.message); });
},
async changeCourse(val) {
const param = {
lessonId: this.courseId,
trainingType: val,
operateType: ''
};
this.operationTypeList = this.trainingOperateTypeMap[val];
if (this.operationTypeList) {
this.operationTypeList.forEach(item => {
item.disabled = false;
this.changeOperationDisabled(); //
});
}
this.form.operateType = '';
const resp = await getLessonTypeNum(param);
if (resp.code == 200) {
this.topicNum = resp.data;
return this.topicNum;
}
this.$store.dispatch('exam/setCourse', this.options);
},
async changeOperation(val) {
const param = {
lessonId: this.courseId,
trainingType: this.form.course,
operateType: val
};
const resp = await getLessonTypeNum(param);
if (resp.code == 200) {
this.topicNum = resp.data;
return this.topicNum;
}
this.$store.dispatch('exam/setCourse', this.options);
},
//
changeCourseDisable() {
const arr = this.$store.state.exam.ruleList;
arr.forEach(ele => {
this.options.forEach(res => {
// operateType
if (ele.trainingType == res.code && !ele.operateType) {
res.disabled = true;
}
});
});
},
changeOperationDisabled() {
const arr = this.$store.state.exam.ruleList;
arr.forEach(ele => {
this.operationTypeList.forEach(res => {
if (ele.operateType == res.code) {
res.disabled = true;
}
});
});
},
changeListDisabled(val) {
this.options.forEach(res => {
if (res.code == val) {
res.disabled = false;
}
});
this.$store.dispatch('exam/setCourse', this.options);
}
}
});
},
changeOperationDisabled() {
const arr = this.$store.state.exam.ruleList;
arr.forEach(ele => {
this.operationTypeList.forEach(res => {
if (ele.operateType == res.code) {
res.disabled = true;
}
});
});
},
changeListDisabled(val) {
this.options.forEach(res => {
if (res.code == val) {
res.disabled = false;
}
});
this.$store.dispatch('exam/setCourse', this.options);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,77 +1,65 @@
<template>
<div class="exam-rule">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height + 'px'}">
<el-form ref="form" :model="form" :rules="rules" label-width="120px" class="demo-form">
<el-form-item :label="$t('publish.testName')" prop="name">
<el-input v-model="form.name" :placeholder="$t('publish.inputTestName')" />
</el-form-item>
<el-form-item :label="$t('publish.testScope')" prop="region">
<el-select
v-model="form.region"
:placeholder="$t('publish.selectTestScope')"
style="width: 100%;"
:disabled="isEdit || selectDisable"
>
<el-option v-for="nor in options" :key="nor.id" :label="nor.name" :value="nor.id" />
</el-select>
</el-form-item>
<el-form-item :label="$t('publish.testDuration')" prop="duration">
<el-input
v-model="form.duration"
placeholder="90"
style="float: left; width: calc(100% - 80px);"
:disabled="isEdit"
/>
<span style="width:80px; display: block;float: left; text-align: center;">&nbsp;{{ $t('publish.durationMinutes') }}</span>
</el-form-item>
<el-form-item :label="$t('publish.testDate')">
<el-col :span="11">
<el-form-item prop="startDate">
<el-date-picker
v-model="form.startDate"
type="datetime"
:placeholder="$t('publish.startTestTime')"
style="width: 100%;"
value-format="timestamp"
:disabled="isEdit"
/>
</el-form-item>
</el-col>
<el-col class="line" :span="2">-</el-col>
<el-col :span="11">
<el-form-item prop="endDate">
<el-date-picker
v-model="form.endDate"
type="datetime"
:placeholder="$t('publish.endTestTime')"
style="width: 100%;"
value-format="timestamp"
:disabled="isEdit"
/>
</el-form-item>
</el-col>
</el-form-item>
<el-form-item :label="$t('publish.fullScore')" prop="fullMark">
<el-input v-model="form.fullMark" placeholder="" :disabled="isEdit" />
</el-form-item>
<el-form-item :label="$t('publish.passingScore')" prop="passMark">
<el-input v-model="form.passMark" placeholder="" :disabled="isEdit" />
</el-form-item>
<el-form-item v-if="trialShow" :label="$t('publish.whetherToTry')" required>
<el-radio-group v-model="trial">
<el-radio label="1">{{ $t('publish.trialNo') }}</el-radio>
<el-radio label="2">{{ $t('publish.trialYes') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('publish.testDescription')" prop="desc">
<el-input v-model="form.desc" type="textarea" :placeholder="$t('publish.inputTestDescription')" :disabled="isEdit" />
</el-form-item>
<!-- <el-form-item>
<el-form ref="form" :model="form" :rules="rules" label-width="120px" class="demo-form">
<el-form-item :label="$t('publish.testName')" prop="name">
<el-input v-model="form.name" :placeholder="$t('publish.inputTestName')" />
</el-form-item>
<el-form-item :label="$t('publish.testScope')" prop="region">
<el-select v-model="form.region" :placeholder="$t('publish.selectTestScope')" style="width: 100%;" :disabled="isEdit || selectDisable">
<el-option v-for="nor in options" :key="nor.id" :label="nor.name" :value="nor.id" />
</el-select>
</el-form-item>
<el-form-item :label="$t('publish.testDuration')" prop="duration">
<el-input v-model="form.duration" placeholder="90" style="float: left; width: calc(100% - 80px);" :disabled="isEdit" />
<span style="width:80px; display: block;float: left; text-align: center;">&nbsp;{{ $t('publish.durationMinutes') }}</span>
</el-form-item>
<el-form-item :label="$t('publish.testDate')">
<el-col :span="11">
<el-form-item prop="startDate">
<el-date-picker
v-model="form.startDate"
type="datetime"
:placeholder="$t('publish.startTestTime')"
style="width: 100%;"
value-format="timestamp"
:disabled="isEdit"
/>
</el-form-item>
</el-col>
<el-col class="line" :span="2">-</el-col>
<el-col :span="11">
<el-form-item prop="endDate">
<el-date-picker
v-model="form.endDate"
type="datetime"
:placeholder="$t('publish.endTestTime')"
style="width: 100%;"
value-format="timestamp"
:disabled="isEdit"
/>
</el-form-item>
</el-col>
</el-form-item>
<el-form-item :label="$t('publish.fullScore')" prop="fullMark">
<el-input v-model="form.fullMark" placeholder="" :disabled="isEdit" />
</el-form-item>
<el-form-item :label="$t('publish.passingScore')" prop="passMark">
<el-input v-model="form.passMark" placeholder="" :disabled="isEdit" />
</el-form-item>
<el-form-item v-if="trialShow" :label="$t('publish.whetherToTry')" required>
<el-radio-group v-model="trial">
<el-radio label="1">{{ $t('publish.trialNo') }}</el-radio>
<el-radio label="2">{{ $t('publish.trialYes') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('publish.testDescription')" prop="desc">
<el-input v-model="form.desc" type="textarea" :placeholder="$t('publish.inputTestDescription')" :disabled="isEdit" />
</el-form-item>
<!-- <el-form-item>
<el-button type="primary" @click="updateForm" v-if="isEdit">{{ $t('error.edit') }}</el-button>
<el-button type="primary" @click="submitForm" v-else>{{ $t('error.nextStep') }}</el-button>
</el-form-item> -->
</el-form>
</el-scrollbar>
</el-form>
</div>
</template>
@ -80,211 +68,205 @@ import { getPublishLessonList } from '@/api/jmap/lesson';
import { getExamLessonDetail, updateExamRules } from '@/api/management/exam';
export default {
name: 'ExamFrom',
props: {
height: {
type: Number,
default: 800
}
},
data() {
var fullMark = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputFullScore')));
}
setTimeout(() => {
if (!Number(value)) {
callback(new Error(this.$t('publish.inputNumericType')));
} else {
callback();
}
}, 100);
};
var passMark = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputPassingScore')));
}
setTimeout(() => {
if (!Number(value)) {
callback(new Error(this.$t('publish.inputNumericType')));
} else {
if (Number(value) > this.form.fullMark) {
callback(new Error(this.$t('publish.inputScoreError')));
} else {
callback();
}
}
}, 100);
};
var duration = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputTestDuration')));
}
setTimeout(() => {
if (!Number(value)) {
callback(new Error(this.$t('publish.inputNumericType')));
} else {
callback();
}
}, 100);
};
return {
formDetail: {
name: '',
region: '',
startDate: '',
endDate: '',
desc: '',
type: '',
duration: '',
fullMark: '',
passMark: ''
},
trial: '1',
trialShow: false,
form: this.$store.state.exam.courseDetail,
options: [],
selectDisable: false,
rules: {
name: [
{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }
],
region: [
{ required: true, message: this.$t('publish.selectTestScope'), trigger: 'change' }
],
duration: [
{ required: true, validator: duration, trigger: 'blur' }
],
fullMark: [
{ required: true, validator: fullMark, trigger: 'blur' }
],
trial: [
{ required: true, message: this.$t('publish.selectWetherTrial'), trigger: 'blur' }
],
passMark: [
{ required: true, validator: passMark, trigger: 'blur' }
]
}
};
},
computed: {
isEdit() {
return this.$route.params.mode == 'edit';
}
},
watch: {
'form.startDate': function (val) {
if (val) {
this.form.endDate = val + Number(this.form.duration * 60000);
} else {
this.form.endDate = '';
}
},
'form.duration': function (val) {
if (this.form.startDate) {
this.form.endDate = this.form.startDate + Number(val * 60000);
} else {
this.form.endDate = '';
}
}
},
created() {
this.refresh();
},
mounted() {
const user = this.$store.state.user;
const roles = user.roles;
this.trialShow = roles.indexOf('04') != -1;
this.init();
},
methods: {
setData(data) {
this.form = {
name: data.name,
region: data.region,
startDate: Date.parse(new Date(data.startDate)),
endDate: Date.parse(new Date(data.endDate)),
desc: data.desc,
type: data.type,
duration: Number(data.duration),
fullMark: data.fullMark,
passMark: data.passMark
};
},
init() {
this.$nextTick(() => {
if (this.$route.params.ruleId != 0) {
getExamLessonDetail(this.$route.params.ruleId).then(res => {
this.formDetail = {
name: res.data.name,
region: `${res.data.lessonId}`,
startDate: Date.parse(new Date(res.data.startTime)),
endDate: Date.parse(new Date(res.data.endTime)),
desc: res.data.remarks,
type: res.data.type,
duration: Number(res.data.duration) / 60,
fullMark: res.data.fullPoint,
passMark: res.data.passingPoint
};
name: 'ExamFrom',
data() {
var fullMark = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputFullScore')));
}
setTimeout(() => {
if (!Number(value)) {
callback(new Error(this.$t('publish.inputNumericType')));
} else {
callback();
}
}, 100);
};
var passMark = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputPassingScore')));
}
setTimeout(() => {
if (!Number(value)) {
callback(new Error(this.$t('publish.inputNumericType')));
} else {
if (Number(value) > this.form.fullMark) {
callback(new Error(this.$t('publish.inputScoreError')));
} else {
callback();
}
}
}, 100);
};
var duration = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('publish.inputTestDuration')));
}
setTimeout(() => {
if (!Number(value)) {
callback(new Error(this.$t('publish.inputNumericType')));
} else {
callback();
}
}, 100);
};
return {
formDetail: {
name: '',
region: '',
startDate: '',
endDate: '',
desc: '',
type: '',
duration: '',
fullMark: '',
passMark: ''
},
trial: '1',
trialShow: false,
form: this.$store.state.exam.courseDetail,
options: [],
selectDisable: false,
rules: {
name: [
{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }
],
region: [
{ required: true, message: this.$t('publish.selectTestScope'), trigger: 'change' }
],
duration: [
{ required: true, validator: duration, trigger: 'blur' }
],
fullMark: [
{ required: true, validator: fullMark, trigger: 'blur' }
],
trial: [
{ required: true, message: this.$t('publish.selectWetherTrial'), trigger: 'blur' }
],
passMark: [
{ required: true, validator: passMark, trigger: 'blur' }
]
}
};
},
computed: {
isEdit() {
return this.$route.params.mode == 'edit';
}
},
watch: {
'form.startDate': function (val) {
if (val) {
this.form.endDate = val + Number(this.form.duration * 60000);
} else {
this.form.endDate = '';
}
},
'form.duration': function (val) {
if (this.form.startDate) {
this.form.endDate = this.form.startDate + Number(val * 60000);
} else {
this.form.endDate = '';
}
}
},
created() {
this.refresh();
},
mounted() {
const user = this.$store.state.user;
const roles = user.roles;
this.trialShow = roles.indexOf('04') != -1;
this.init();
},
methods: {
setData(data) {
this.form = {
name: data.name,
region: data.region,
startDate: Date.parse(new Date(data.startDate)),
endDate: Date.parse(new Date(data.endDate)),
desc: data.desc,
type: data.type,
duration: Number(data.duration),
fullMark: data.fullMark,
passMark: data.passMark
};
},
init() {
this.$nextTick(() => {
if (this.$route.params.ruleId != 0) {
getExamLessonDetail(this.$route.params.ruleId).then(res => {
this.formDetail = {
name: res.data.name,
region: `${res.data.lessonId}`,
startDate: Date.parse(new Date(res.data.startTime)),
endDate: Date.parse(new Date(res.data.endTime)),
desc: res.data.remarks,
type: res.data.type,
duration: Number(res.data.duration) / 60,
fullMark: res.data.fullPoint,
passMark: res.data.passingPoint
};
if (!this.form.name) {
this.$store.dispatch('exam/setCourseDetail', this.formDetail);
this.form = this.formDetail;
} else {
this.$store.dispatch('exam/setCourseDetail', this.form);
}
});
}
if (!this.form.name) {
this.$store.dispatch('exam/setCourseDetail', this.formDetail);
this.form = this.formDetail;
} else {
this.$store.dispatch('exam/setCourseDetail', this.form);
}
});
}
this.$refs.form.clearValidate();
});
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.form['trial'] = this.trial;
this.$store.dispatch('exam/setCourseDetail', this.form);
this.$emit('definition', this.form);
}
});
},
updateForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
const model = {
id: this.$route.params.ruleId,
name: this.form.name,
trial: this.trial == 2
};
this.$refs.form.clearValidate();
});
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.form['trial'] = this.trial;
this.$store.dispatch('exam/setCourseDetail', this.form);
this.$emit('definition', this.form);
}
});
},
updateForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
const model = {
id: this.$route.params.ruleId,
name: this.form.name,
trial: this.trial == 2
};
updateExamRules(model).then(response => {
this.$store.dispatch('exam/setCourseDetail', this.form);
this.$message.success(this.$t('publish.updateExamRuleSuccess'));
}).catch(() => {
this.$messageBox(this.$t('publish.updateExamRuleFailed'));
});
}
});
updateExamRules(model).then(response => {
this.$store.dispatch('exam/setCourseDetail', this.form);
this.$message.success(this.$t('publish.updateExamRuleSuccess'));
}).catch(() => {
this.$messageBox(this.$t('publish.updateExamRuleFailed'));
});
}
});
},
refresh() {
getPublishLessonList().then(response => {
this.options = response.data;
if (parseInt(this.$route.params.lessonId)) {
this.form.region = this.$route.params.lessonId;
this.selectDisable = true;
}
this.$nextTick(() => { this.$refs.form.clearValidate(); });
}).catch(() => {
this.$messageBox(this.$t('publish.refreshFailed'));
});
}
}
},
refresh() {
getPublishLessonList().then(response => {
this.options = response.data;
if (parseInt(this.$route.params.lessonId)) {
this.form.region = this.$route.params.lessonId;
this.selectDisable = true;
}
this.$nextTick(() => { this.$refs.form.clearValidate(); });
}).catch(() => {
this.$messageBox(this.$t('publish.refreshFailed'));
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.exam-rule {
overflow-y: auto;
height: 100%;
}
.line {

View File

@ -1,32 +1,32 @@
<template>
<!-- <el-card> -->
<!-- <div v-if="lessonName" slot="header" style="text-align: center;">
<div class="joylink-card" :class="lessonName ? 'card-box' : ''">
<div v-if="lessonName" class="card-title">
<b>{{ $t('publish.lessonName') }} {{ lessonName }}</b>
</div> -->
<div class="exam-box">
<el-steps class="steps" :active="display">
<el-step :title="$t('publish.testDefinitionMaking')" icon="el-icon-edit" />
<el-step :title="$t('publish.examRuleMaking')" icon="el-icon-setting" />
</el-steps>
<div class="joylink-card forms">
<template v-if="display == 1" class="definition">
<exam-from ref="exam" @definition="definition" />
</template>
<template v-else class="rule">
<rule-from ref="rule" :course="course" @regulation="regulation" />
</template>
</div>
<div class="draft">
<el-button-group>
<el-button v-if="isPrevStep" type="primary" @click="prevStep">{{ this.$t('global.lastStep') }}</el-button>
<el-button v-if="isNextStep" type="primary" @click="nextStep">{{ this.$t('global.nextStep') }}</el-button>
<el-button v-if="isUpdate" type="warning" @click="update">{{ $t('global.update') }}</el-button>
<el-button v-if="isCreate" type="primary" @click="create">{{ $t('global.create') }}</el-button>
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
</el-button-group>
<div class="exam-box" :style="{ 'height': lessonName ? 'calc(100% - 47px)' : '' }">
<el-steps class="steps" :active="display">
<el-step :title="$t('publish.testDefinitionMaking')" icon="el-icon-edit" />
<el-step :title="$t('publish.examRuleMaking')" icon="el-icon-setting" />
</el-steps>
<div class="joylink-card forms">
<template v-if="display == 1" class="definition">
<exam-from ref="exam" @definition="definition" />
</template>
<template v-else class="rule">
<rule-from ref="rule" :course="course" @regulation="regulation" />
</template>
</div>
<div class="draft">
<el-button-group>
<el-button v-if="isPrevStep" type="primary" @click="prevStep">{{ this.$t('global.lastStep') }}</el-button>
<el-button v-if="isNextStep" type="primary" @click="nextStep">{{ this.$t('global.nextStep') }}</el-button>
<el-button v-if="isUpdate" type="warning" @click="update">{{ $t('global.update') }}</el-button>
<el-button v-if="isCreate" type="primary" @click="create">{{ $t('global.create') }}</el-button>
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
</el-button-group>
</div>
</div>
</div>
<!-- </el-card> -->
</template>
<script>
@ -44,7 +44,7 @@ export default {
return {
display: 1,
course: {},
// lessonName: '',
lessonName: '',
formData: {}
};
},
@ -69,11 +69,11 @@ export default {
loadInitData() {
getPublishLessonList().then(response => {
this.OrganizationList = response.data;
// this.OrganizationList.forEach(elem => {
// if (elem.id == this.$route.params.lessonId) {
// this.lessonName = elem.name;
// }
// });
this.OrganizationList.forEach(elem => {
if (elem.id == this.$route.params.lessonId) {
this.lessonName = elem.name;
}
});
});
},
definition(data) {
@ -109,9 +109,21 @@ export default {
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.joylink-card{
.card-title{
text-align: center;
height: 47px;
line-height: 47px;
border-bottom: 1px solid #e6e6e6;
}
}
.card-box{
overflow: hidden;
height: 100%;
}
.exam-box {
padding-top: 10px;
height: 100%;
overflow: auto;
/deep/ {
.el-step__icon.is-icon {

View File

@ -1,8 +1,8 @@
<template>
<div class="exam-rule">
<span>{{$t('publish.fullScoreTips')}} {{ course.fullMark }} {{$t('publish.scorePoints')}}</span>
<el-button class="addList" size="small" @click="handleAdd">{{$t('publish.addRules')}}</el-button>
<el-table :data="ruleList" border show-summary style="width: 100%" :height="height">
<span>{{ $t('publish.fullScoreTips') }} {{ course.fullMark }} {{ $t('publish.scorePoints') }}</span>
<el-button class="addList" size="small" @click="handleAdd">{{ $t('publish.addRules') }}</el-button>
<el-table :data="ruleList" border show-summary style="width: 100%; min-height: 300px;">
<el-table-column prop="name" :label="$t('publish.trainingType')" />
<el-table-column prop="num" :label="$t('publish.questionsNumber')" width="100" />
<el-table-column prop="point" :label="$t('publish.eachScore')" width="100" />
@ -14,10 +14,6 @@
</template>
</el-table-column>
</el-table>
<!-- <div class="btn-footer">
<el-button @click="regulation">上一步</el-button>
<el-button type="primary" @click="creatOk">新增</el-button>
</div> -->
<edit-rule
ref="addRule"
:course-id="courseId"
@ -35,244 +31,240 @@ import { UrlConfig } from '@/router/index';
import editRule from './editRule';
export default {
name: 'Rule',
components: {
editRule
},
props: {
course: {
type: Object,
default: null
},
height: {
type: Number,
default: 800
}
},
data() {
return {
ruleList: this.$store.state.exam.ruleList,
courseId: this.course.region,
editCourse: {},
formDetail: {
name: '',
region: '',
startDate: '',
endDate: '',
desc: '',
type: '',
duration: '',
fullMark: '',
passMark: ''
},
form: {
course: '',
number: '',
mark: ''
},
typeList: [],
trainingOperateTypeMap: {}
};
},
watch: {
},
async mounted() {
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; //
});
await this.getList();
await this.init();
},
methods: {
async getList() {
this.typeList = [];
await getDetailList('training_type').then(res => {
this.typeList = res.data;
}).catch(error => {
console.error(error);
});
},
async init() {
if (this.$route.params.ruleId != 0 && this.ruleList.length == 0) {
await getExamLessonDetail(this.$route.params.ruleId).then(res => {
if (res.code == 200) {
const arr = res.data.examDefinitionRulesVOList;
arr.forEach((ele, index) => {
this.typeList.forEach(v => {
if (ele.trainingType == v.code) {
arr[index].name = v.name;
if (ele.operateType) {
this.trainingOperateTypeMap[ele.trainingType].forEach(item => {
if (item.code == ele.operateType) {
arr[index].name = `${v.name}-${item.name}`;
return;
}
});
}
}
});
});
this.ruleList = arr;
this.$store.dispatch('exam/setRuleList', this.ruleList);
this.ruleList.forEach(res => {
res.chapterIdLong = Number(res.num) * Number(res.point);
});
this.changeCourseDisable();
}
});
}
},
handleAdd() {
this.$refs.addRule.show();
},
async creatOk() {
if (this.ruleList.length) {
let flag = 0;
this.ruleList.forEach(res => {
flag += Number(res.chapterIdLong);
});
if (flag == this.course.fullMark) {
const result = {
duration: Number(this.course.duration) * 60, //
examDefinitionRulesVOList: this.ruleList, //
fullPoint: Number(this.course.fullMark), //
lessonId: this.course.region, // id
name: this.course.name, //
passingPoint: Number(this.course.passMark), //
remarks: this.course.desc, //
endTime: this.course.endDate,
startTime: this.course.startDate,
type: this.course.type, //
trial: this.course.trial == 2 //
};
await this.save(result);
} else {
this.$messageBox(this.$t('publish.addExamRluesError'));
}
} else {
this.$messageBox(this.$t('publish.addExamRules'));
}
},
save(data) {
setCourseList(data).then(res => {
this.$message.success({ message: res.message });
this.$store.dispatch('exam/setCourseDetail', this.formDetail); // form
this.$store.dispatch('exam/setRuleList', []); //
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`;
const lessonId = this.$route.params.lessonId;
if (parseInt(lessonId)) {
this.$router.push({ path: `${path}`, query: { lessonId: lessonId } });
} else {
this.$router.push({ path: `${path}` });
}
}).catch(error => {
this.$messageBox(`${this.$t('publish.saveRuleFailed')} ${error.message}`);
});
},
addRuleList(data) {
var arr = this.$store.state.exam.courseList;
let value;
arr.forEach(res => {
if (res.code == data.course) {
value = res;
return value;
}
});
let titleName = value.name;
if (data.name) {
titleName = `${value.name}-${data.name}`;
}
const element = {
trainingType: data.course,
operateType: data.operateType,
num: Number(data.number),
point: Number(data.mark),
name: titleName,
chapterIdLong: Number(data.number) * Number(data.mark)
};
this.ruleList.push(element);
this.$store.dispatch('exam/setRuleList', this.ruleList);
this.changeCourseDisable();
},
//
changeCourseDisable() {
const arr = this.$store.state.exam.courseList;
this.ruleList.forEach(ele => {
arr.forEach(res => {
if (ele.trainingType == res.code && !ele.operateType) {
res.disabled = true;
}
});
});
},
editRuleList(data) {
var arr = this.$store.state.exam.courseList;
let value;
arr.forEach(res => {
if (res.code == data.course) {
value = res;
return value;
}
});
let titleName = value.name;
if (data.name) {
titleName = `${value.name}-${data.name}`;
}
const element = {
trainingType: data.course,
operateType: data.operateType,
num: Number(data.number),
point: Number(data.mark),
name: titleName,
chapterIdLong: data.number * data.mark
};
this.ruleList.splice(this.indexCourse, 1, element);
},
handleForm(data) {
// editCourse
this.indexCourse = data.$index;
const list = JSON.stringify(data.row);
const detail = JSON.parse(list);
var arr = this.$store.state.exam.courseList;
arr.forEach(res => {
if (res.name == detail.name) {
detail.name = res.id;
return detail.name;
}
});
this.editCourse = detail;
this.handleAdd();
},
deleteForm(data) {
const index = data.$index;
this.ruleList.splice(index, 1);
this.$refs.addRule.changeListDisabled(data.row.trainingType);
this.$store.dispatch('exam/setRuleList', this.ruleList);
},
regulation() {
this.$store.dispatch('exam/setRuleList', this.ruleList);
this.$emit('regulation', this.course);
}
}
name: 'Rule',
components: {
editRule
},
props: {
course: {
type: Object,
default: null
}
},
data() {
return {
ruleList: this.$store.state.exam.ruleList,
courseId: this.course.region,
editCourse: {},
formDetail: {
name: '',
region: '',
startDate: '',
endDate: '',
desc: '',
type: '',
duration: '',
fullMark: '',
passMark: ''
},
form: {
course: '',
number: '',
mark: ''
},
typeList: [],
trainingOperateTypeMap: {}
};
},
watch: {
},
async mounted() {
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; //
});
await this.getList();
await this.init();
},
methods: {
async getList() {
this.typeList = [];
await getDetailList('training_type').then(res => {
this.typeList = res.data;
}).catch(error => {
console.error(error);
});
},
async init() {
if (this.$route.params.ruleId != 0 && this.ruleList.length == 0) {
await getExamLessonDetail(this.$route.params.ruleId).then(res => {
if (res.code == 200) {
const arr = res.data.examDefinitionRulesVOList;
arr.forEach((ele, index) => {
this.typeList.forEach(v => {
if (ele.trainingType == v.code) {
arr[index].name = v.name;
if (ele.operateType) {
this.trainingOperateTypeMap[ele.trainingType].forEach(item => {
if (item.code == ele.operateType) {
arr[index].name = `${v.name}-${item.name}`;
return;
}
});
}
}
});
});
this.ruleList = arr;
this.$store.dispatch('exam/setRuleList', this.ruleList);
this.ruleList.forEach(res => {
res.chapterIdLong = Number(res.num) * Number(res.point);
});
this.changeCourseDisable();
}
});
}
},
handleAdd() {
this.$refs.addRule.show();
},
async creatOk() {
if (this.ruleList.length) {
let flag = 0;
this.ruleList.forEach(res => {
flag += Number(res.chapterIdLong);
});
if (flag == this.course.fullMark) {
const result = {
duration: Number(this.course.duration) * 60, //
examDefinitionRulesVOList: this.ruleList, //
fullPoint: Number(this.course.fullMark), //
lessonId: this.course.region, // id
name: this.course.name, //
passingPoint: Number(this.course.passMark), //
remarks: this.course.desc, //
endTime: this.course.endDate,
startTime: this.course.startDate,
type: this.course.type, //
trial: this.course.trial == 2 //
};
await this.save(result);
} else {
this.$messageBox(this.$t('publish.addExamRluesError'));
}
} else {
this.$messageBox(this.$t('publish.addExamRules'));
}
},
save(data) {
setCourseList(data).then(res => {
this.$message.success({ message: res.message });
this.$store.dispatch('exam/setCourseDetail', this.formDetail); // form
this.$store.dispatch('exam/setRuleList', []); //
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`;
const lessonId = this.$route.params.lessonId;
if (parseInt(lessonId)) {
this.$router.push({ path: `${path}`, query: { lessonId: lessonId } });
} else {
this.$router.push({ path: `${path}` });
}
}).catch(error => {
this.$messageBox(`${this.$t('publish.saveRuleFailed')} ${error.message}`);
});
},
addRuleList(data) {
var arr = this.$store.state.exam.courseList;
let value;
arr.forEach(res => {
if (res.code == data.course) {
value = res;
return value;
}
});
let titleName = value.name;
if (data.name) {
titleName = `${value.name}-${data.name}`;
}
const element = {
trainingType: data.course,
operateType: data.operateType,
num: Number(data.number),
point: Number(data.mark),
name: titleName,
chapterIdLong: Number(data.number) * Number(data.mark)
};
this.ruleList.push(element);
this.$store.dispatch('exam/setRuleList', this.ruleList);
this.changeCourseDisable();
},
//
changeCourseDisable() {
const arr = this.$store.state.exam.courseList;
this.ruleList.forEach(ele => {
arr.forEach(res => {
if (ele.trainingType == res.code && !ele.operateType) {
res.disabled = true;
}
});
});
},
editRuleList(data) {
var arr = this.$store.state.exam.courseList;
let value;
arr.forEach(res => {
if (res.code == data.course) {
value = res;
return value;
}
});
let titleName = value.name;
if (data.name) {
titleName = `${value.name}-${data.name}`;
}
const element = {
trainingType: data.course,
operateType: data.operateType,
num: Number(data.number),
point: Number(data.mark),
name: titleName,
chapterIdLong: data.number * data.mark
};
this.ruleList.splice(this.indexCourse, 1, element);
},
handleForm(data) {
// editCourse
this.indexCourse = data.$index;
const list = JSON.stringify(data.row);
const detail = JSON.parse(list);
var arr = this.$store.state.exam.courseList;
arr.forEach(res => {
if (res.name == detail.name) {
detail.name = res.id;
return detail.name;
}
});
this.editCourse = detail;
this.handleAdd();
},
deleteForm(data) {
const index = data.$index;
this.ruleList.splice(index, 1);
this.$refs.addRule.changeListDisabled(data.row.trainingType);
this.$store.dispatch('exam/setRuleList', this.ruleList);
},
regulation() {
this.$store.dispatch('exam/setRuleList', this.ruleList);
this.$emit('regulation', this.course);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,20 +1,14 @@
<template>
<el-card>
<div v-if="lessonName" slot="header" style="text-align: center;">
<div class="joylink-card">
<div v-if="lessonName" class="card-title">
<b>{{ $t('publish.lessonName') }} {{ lessonName }}</b>
</div>
<div :style="{ height: height +'px' }">
<el-scrollbar wrap-class="scrollbar-wrapper" style="">
<QueryListPage
ref="queryListPage"
:pager-config="pagerConfig"
:query-form="queryForm"
:query-list="queryList"
style="height: 100%;"
/>
<div :style="{ 'height': lessonName ? 'calc(100% - 47px)' : '100%' }">
<el-scrollbar wrap-class="scrollbar-wrapper">
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-scrollbar>
</div>
</el-card>
</div>
</template>
<script>
@ -23,307 +17,311 @@ import { getPublishLessonList } from '@/api/jmap/lesson';
import { UrlConfig } from '@/router/index';
export default {
name: 'List',
data() {
return {
BizTypeList: [],
OrderTypeList: [],
PayTypeList: [],
PayStatusList: [],
OrganizationList: [],
EffectiveTypeList: [],
userId: this.$store.state.user.id,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
lessonName: '',
queryForm: {
labelWidth: '160px',
queryObject: {
'lessonId': {
type: this.$route.query.lessonId ? '' : 'select',
label: this.$t('publish.lessonName'),
config: {
data: []
}
},
'name': {
type: 'text',
label: this.$t('publish.paperName')
},
'creatorName': {
type: 'text',
label: this.$t('publish.creator')
}
},
reset: !this.$route.query.lessonId
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('publish.lessonName'),
prop: 'lessonId',
type: 'tag',
show: !this.$route.query.lessonId,
columnValue: (row) => { return this.$convertField(row.lessonId, this.OrganizationList, ['id', 'name']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('publish.paperName'),
prop: 'name'
},
{
title: this.$t('publish.creator'),
prop: 'creatorName'
},
{
title: this.$t('global.isTry'),
prop: 'trial',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.trial, 'Whether'); },
tagType: (row) => {
switch (row.trial) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('global.duration'),
prop: 'duration',
type: 'tag',
columnValue: (row) => { return this.durationField(row.duration); },
tagType: (row) => { return ''; }
},
{
title: this.$t('publish.examTime'),
prop: 'startTime',
type: 'formatter',
format: 'yyyy-MM-dd hh:ss'
},
{
title: this.$t('publish.fullMark'),
prop: 'fullPoint'
},
{
title: this.$t('publish.passScore'),
prop: 'passingPoint'
},
{
title: this.$t('global.status'),
prop: 'status',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
tagType: (row) => {
switch (row.status) {
case '1': return 'success';
default: return 'danger';
}
}
},
{
type: 'button',
title: this.$t('global.operate'),
width: '380',
buttons: [
{
name: this.$t('global.fastCreate'),
type: 'primary',
handleClick: this.handleDistribute,
showControl: (row) => { return row.bizType !== '02'; }
},
{
name: this.$t('global.edit'),
type: 'primary',
showControl: (row) => { return row.creatorId == this.userId; },
handleClick: this.handleUpdate
},
{
name: this.$t('global.soldOut'),
type: 'warning',
handleClick: this.handleEfficacy,
showControl: (row) => {
return !this.$route.query.lessonId && row.status == 1;
}
},
{
name: this.$t('publish.lessonDeleteBtn'),
type: 'warning',
handleClick: this.handleDelete,
showControl: (row) => {
return this.$route.query.lessonId && row.status == 1 && row.creatorId == this.userId;
}
},
{
name: this.$t('global.putaway'),
type: 'primary',
handleClick: this.handleEffective,
showControl: (row) => {
return (this.$route.query.lessonId ? row.creatorId == this.userId : true) && row.status != 1;
}
},
{
name: this.$t('global.delete'),
type: 'danger',
handleClick: this.deleteList,
showControl: (row) => { return row.creatorId == this.userId; }
}
]
}
],
actions: [
{ text: this.$t('global.add'), btnCode: 'employee_insert', handler: this.handleNormalAdd },
{ text: this.$t('global.back'), btnCode: 'employee_back', handler: this.handlerBack }
]
}
};
},
computed: {
height() {
return /\/exam\//.test(`${this.$route.path}`)? this.$store.state.app.height - 92: this.$store.state.app.height - 65;
}
},
created() {
this.loadInitData();
},
mounted() {
this.$store.dispatch('exam/setCourseDetail', {});
this.$store.dispatch('exam/setRuleList', []);
},
methods: {
loadInitData() {
this.queryForm.queryObject.lessonId.config.data.length = 0;
getPublishLessonList().then(response => {
this.OrganizationList = response.data;
this.OrganizationList.forEach(elem => {
if (elem.id == this.$route.query.lessonId) {
this.lessonName = elem.name;
}
this.queryForm.queryObject.lessonId.config.data.push({ value: elem.id, label: elem.name });
});
});
name: 'List',
data() {
return {
BizTypeList: [],
OrderTypeList: [],
PayTypeList: [],
PayStatusList: [],
OrganizationList: [],
EffectiveTypeList: [],
userId: this.$store.state.user.id,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
lessonName: '',
queryForm: {
labelWidth: '160px',
queryObject: {
'lessonId': {
type: this.$route.query.lessonId ? '' : 'select',
label: this.$t('publish.lessonName'),
config: {
data: []
}
},
'name': {
type: 'text',
label: this.$t('publish.paperName')
},
'creatorName': {
type: 'text',
label: this.$t('publish.creator')
}
},
reset: !this.$route.query.lessonId
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('publish.lessonName'),
prop: 'lessonId',
type: 'tag',
show: !this.$route.query.lessonId,
columnValue: (row) => { return this.$convertField(row.lessonId, this.OrganizationList, ['id', 'name']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('publish.paperName'),
prop: 'name'
},
{
title: this.$t('publish.creator'),
prop: 'creatorName'
},
{
title: this.$t('global.isTry'),
prop: 'trial',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.trial, 'Whether'); },
tagType: (row) => {
switch (row.trial) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('global.duration'),
prop: 'duration',
type: 'tag',
columnValue: (row) => { return this.durationField(row.duration); },
tagType: (row) => { return ''; }
},
{
title: this.$t('publish.examTime'),
prop: 'startTime',
type: 'formatter',
format: 'yyyy-MM-dd hh:ss'
},
{
title: this.$t('publish.fullMark'),
prop: 'fullPoint'
},
{
title: this.$t('publish.passScore'),
prop: 'passingPoint'
},
{
title: this.$t('global.status'),
prop: 'status',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
tagType: (row) => {
switch (row.status) {
case '1': return 'success';
default: return 'danger';
}
}
},
{
type: 'button',
title: this.$t('global.operate'),
width: '380',
buttons: [
{
name: this.$t('global.fastCreate'),
type: 'primary',
handleClick: this.handleDistribute,
showControl: (row) => { return row.bizType !== '02'; }
},
{
name: this.$t('global.edit'),
type: 'primary',
showControl: (row) => { return row.creatorId == this.userId; },
handleClick: this.handleUpdate
},
{
name: this.$t('global.soldOut'),
type: 'warning',
handleClick: this.handleEfficacy,
showControl: (row) => {
return !this.$route.query.lessonId && row.status == 1;
}
},
{
name: this.$t('publish.lessonDeleteBtn'),
type: 'warning',
handleClick: this.handleDelete,
showControl: (row) => {
return this.$route.query.lessonId && row.status == 1 && row.creatorId == this.userId;
}
},
{
name: this.$t('global.putaway'),
type: 'primary',
handleClick: this.handleEffective,
showControl: (row) => {
return (this.$route.query.lessonId ? row.creatorId == this.userId : true) && row.status != 1;
}
},
{
name: this.$t('global.delete'),
type: 'danger',
handleClick: this.deleteList,
showControl: (row) => { return row.creatorId == this.userId; }
}
]
}
],
actions: [
{ text: this.$t('global.add'), btnCode: 'employee_insert', handler: this.handleNormalAdd },
{ text: this.$t('global.back'), btnCode: 'employee_back', handler: this.handlerBack }
]
}
};
},
created() {
this.loadInitData();
},
mounted() {
this.$store.dispatch('exam/setCourseDetail', {});
this.$store.dispatch('exam/setRuleList', []);
},
methods: {
loadInitData() {
this.queryForm.queryObject.lessonId.config.data.length = 0;
getPublishLessonList().then(response => {
this.OrganizationList = response.data;
this.OrganizationList.forEach(elem => {
if (elem.id == this.$route.query.lessonId) {
this.lessonName = elem.name;
}
this.queryForm.queryObject.lessonId.config.data.push({ value: elem.id, label: elem.name });
});
});
this.$Dictionary.effectiveType().then(list => {
this.$convertList(list, this.EffectiveTypeList, elem => {
return true;
});
});
},
durationField(fieldValue) {
if (fieldValue) {
const time = Number(fieldValue) / 60;
return `${time} ${this.$t('publish.durationMinutes')}`;
}
},
queryFunction(params) {
if (this.$route.query.lessonId) {
params.lessonId = this.$route.query.lessonId;
params.status = '1';
}
return getExamList(params);
},
handleNormalAdd() {
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
this.$router.push({ path: `${path}/add/0/${lessonId}` });
},
handleUpdate(index, data) {
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
this.$router.push({ path: `${path}/edit/${data.id}/${lessonId}` });
},
handleDistribute(index, data) {
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
this.$router.push({ path: `${path}/add/${data.id}/${lessonId}` });
},
//
deleteList(index, data) {
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteExam(data).then(res => {
this.queryList.reload();
this.$message({
type: 'success',
message: this.$t('publish.setSuccess')
});
}).catch(res => {
if (res.code == '500009') {
this.$message({ type: 'warning', message: this.$t('error.paperHasUseNotDel') });
} else {
this.$message({ type: 'error', message: this.$t('error.deleteException') });
}
});
}).catch(() => { });
},
//
handleDelete(index, data) {
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
setExamEfficacy(data).then(res => {
this.queryList.reload();
this.$message({
type: 'success',
message: this.$t('publish.setSuccess')
});
}).catch(res => {
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
});
}).catch(() => { });
},
//
handleEfficacy(index, data) {
this.$confirm(this.$t('publish.wellSoldOutPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
setExamEfficacy(data).then(res => {
this.queryList.reload();
this.$message({
type: 'success',
message: this.$t('publish.setSuccess')
});
}).catch(res => {
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
});
}).catch(() => { });
},
//
handleEffective(index, data) {
this.$confirm(this.$t('publish.wellPutawayPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
setExamEffectivey(data).then(res => {
this.queryList.reload();
this.$message({
type: 'success',
message: this.$t('publish.setSuccess')
});
}).catch(res => {
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
});
}).catch(() => { });
},
handlerBack() {
this.$router.back();
}
}
this.$Dictionary.effectiveType().then(list => {
this.$convertList(list, this.EffectiveTypeList, elem => {
return true;
});
});
},
durationField(fieldValue) {
if (fieldValue) {
const time = Number(fieldValue) / 60;
return `${time} ${this.$t('publish.durationMinutes')}`;
}
},
queryFunction(params) {
if (this.$route.query.lessonId) {
params.lessonId = this.$route.query.lessonId;
params.status = '1';
}
return getExamList(params);
},
handleNormalAdd() {
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
this.$router.push({ path: `${path}/add/0/${lessonId}` });
},
handleUpdate(index, data) {
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
this.$router.push({ path: `${path}/edit/${data.id}/${lessonId}` });
},
handleDistribute(index, data) {
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
this.$router.push({ path: `${path}/add/${data.id}/${lessonId}` });
},
//
deleteList(index, data) {
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteExam(data).then(res => {
this.queryList.reload();
this.$message({
type: 'success',
message: this.$t('publish.setSuccess')
});
}).catch(res => {
if (res.code == '500009') {
this.$message({ type: 'warning', message: this.$t('error.paperHasUseNotDel') });
} else {
this.$message({ type: 'error', message: this.$t('error.deleteException') });
}
});
}).catch(() => { });
},
//
handleDelete(index, data) {
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
setExamEfficacy(data).then(res => {
this.queryList.reload();
this.$message({
type: 'success',
message: this.$t('publish.setSuccess')
});
}).catch(res => {
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
});
}).catch(() => { });
},
//
handleEfficacy(index, data) {
this.$confirm(this.$t('publish.wellSoldOutPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
setExamEfficacy(data).then(res => {
this.queryList.reload();
this.$message({
type: 'success',
message: this.$t('publish.setSuccess')
});
}).catch(res => {
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
});
}).catch(() => { });
},
//
handleEffective(index, data) {
this.$confirm(this.$t('publish.wellPutawayPaper'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
setExamEffectivey(data).then(res => {
this.queryList.reload();
this.$message({
type: 'success',
message: this.$t('publish.setSuccess')
});
}).catch(res => {
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
});
}).catch(() => { });
},
handlerBack() {
this.$router.back();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.joylink-card {
height: 100%;
}
.card-title{
text-align: center;
height: 47px;
line-height: 47px;
border-bottom: 1px solid #e6e6e6;
}
/deep/ {
.is-always-shadow {
box-shadow: none;