Merge remote-tracking branch 'origin/dev' into test
# Conflicts: # src/router/index.js
This commit is contained in:
commit
a250d54cb4
File diff suppressed because one or more lines are too long
@ -12,297 +12,296 @@ const renderer = 'canvas';
|
|||||||
const devicePixelRatio = 1;
|
const devicePixelRatio = 1;
|
||||||
|
|
||||||
class IbpPan {
|
class IbpPan {
|
||||||
constructor(opts) {
|
constructor(opts) {
|
||||||
this.methods = opts.methods;
|
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);
|
this.initIbpPage(opts);
|
||||||
}
|
}
|
||||||
initIbpPage(opts) {
|
initIbpPage(opts) {
|
||||||
const width = opts.config.width;
|
const width = opts.config.width;
|
||||||
const height = opts.config.height;
|
const height = opts.config.height;
|
||||||
this.isAllowDragging=false;
|
this.isAllowDragging = false;
|
||||||
this.$ibpZr = zrender.init(opts.dom, Object.assign({ renderer, devicePixelRatio, width, height }, opts.config));
|
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.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {})); // 缩放
|
||||||
this.$mouseController = new MouseController(this);
|
this.$mouseController = new MouseController(this);
|
||||||
|
|
||||||
this.$mouseController.enable();
|
this.$mouseController.enable();
|
||||||
|
|
||||||
this.$painter = new Painter(this);
|
this.$painter = new Painter(this);
|
||||||
this.$painter.updateZrSize({width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight()});
|
this.$painter.updateZrSize({width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight()});
|
||||||
this.$painter.updateTransform(this.$options, this.canvasSize);
|
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) {
|
setMap(config, ibpDevice) {
|
||||||
// 保存平移缩放数据
|
// 保存平移缩放数据
|
||||||
if (config.config) {
|
if (config.config) {
|
||||||
this.$options.scaleRate = config.scaling;
|
this.$options.scaleRate = config.scaling;
|
||||||
this.$options.offsetX = config.origin.x;
|
this.$options.offsetX = config.origin.x;
|
||||||
this.$options.offsetY = config.origin.y;
|
this.$options.offsetY = config.origin.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存原始数据
|
// 保存原始数据
|
||||||
this.data = config;
|
this.data = config;
|
||||||
|
|
||||||
// 保存需展现的画布大小
|
// 保存需展现的画布大小
|
||||||
this.canvasSize = {
|
this.canvasSize = {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: config.background.width,
|
width: config.background.width,
|
||||||
height: config.background.height
|
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() {
|
setDefaultState() {
|
||||||
const list = [];
|
const list = [];
|
||||||
Object.values(this.mapDevice).forEach(elem => {
|
Object.values(this.mapDevice).forEach(elem => {
|
||||||
const type = elem.model._type;
|
const type = elem.model._type;
|
||||||
list.push(deviceFactory(type, Object.assign(elem.model, this.defaultStateDict[type]) ));
|
list.push(deviceFactory(type, Object.assign(elem.model, this.defaultStateDict[type]) ));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.update(list);
|
this.update(list);
|
||||||
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
|
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
|
||||||
}
|
}
|
||||||
|
|
||||||
setOptions(opts) {
|
setOptions(opts) {
|
||||||
const options = this.pullBack(opts);
|
const options = this.pullBack(opts);
|
||||||
this.$options.update(options);
|
this.$options.update(options);
|
||||||
this.$painter.updateTransform(this.$options, this.canvasSize);
|
this.$painter.updateTransform(this.$options, this.canvasSize);
|
||||||
|
|
||||||
if (this.$options.disabled == true) {
|
if (this.$options.disabled == true) {
|
||||||
this.$mouseController.disable();
|
this.$mouseController.disable();
|
||||||
} else {
|
} else {
|
||||||
this.$mouseController.enable(opts);
|
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) {
|
setCenter(deviceCode) {
|
||||||
const device = this.ibpDevice[deviceCode];
|
const device = this.ibpDevice[deviceCode];
|
||||||
if (device && device.instance) {
|
if (device && device.instance) {
|
||||||
var rect = createBoundingRect(device.instance);
|
var rect = createBoundingRect(device.instance);
|
||||||
var dcenter = calculateDCenter(rect, { width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight() });
|
var dcenter = calculateDCenter(rect, { width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight() });
|
||||||
this.setOptions(dcenter);
|
this.setOptions(dcenter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setLevelVisible(list) {
|
setLevelVisible(list) {
|
||||||
this.$painter.setLevelVisible(list);
|
this.$painter.setLevelVisible(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
render(list) {
|
render(list) {
|
||||||
(list || []).forEach(elem => {
|
(list || []).forEach(elem => {
|
||||||
const code = elem.code;
|
const code = elem.code;
|
||||||
const type = elem._type;
|
const type = elem._type;
|
||||||
if (type === deviceType.Background) {
|
if (type === deviceType.Background) {
|
||||||
this.canvasSize = {
|
this.canvasSize = {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: elem.width,
|
width: elem.width,
|
||||||
height: elem.height
|
height: elem.height
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
updateIbpData(elem);
|
updateIbpData(elem);
|
||||||
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem);
|
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem);
|
||||||
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
|
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
|
||||||
delete this.ibpDevice[code];
|
delete this.ibpDevice[code];
|
||||||
this.$painter.delete(oDevice);
|
this.$painter.delete(oDevice);
|
||||||
if (!elem._dispose) {
|
if (!elem._dispose) {
|
||||||
this.ibpDevice[code] = nDevice;
|
this.ibpDevice[code] = nDevice;
|
||||||
this.$painter.add(nDevice);
|
this.$painter.add(nDevice);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); }
|
if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 中间处理
|
// 中间处理
|
||||||
hookHandle(model, elem) {
|
hookHandle(model, elem) {
|
||||||
const code = elem.code;
|
const code = elem.code;
|
||||||
const type = elem._type;
|
const type = elem._type;
|
||||||
// 如果是延时计时,需要保存计数值到全局
|
// 如果是延时计时,需要保存计数值到全局
|
||||||
if (type === deviceType.StationCounter) {
|
if (type === deviceType.StationCounter) {
|
||||||
let val = '' + elem.val;
|
let val = '' + elem.val;
|
||||||
if (val === '0' || !elem.val) {
|
if (val === '0' || !elem.val) {
|
||||||
val = elem.val = localStore.get(code) || '0';
|
val = elem.val = localStore.get(code) || '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
localStore(code, val);
|
localStore(code, val);
|
||||||
}
|
}
|
||||||
for (var prop in elem) {
|
for (var prop in elem) {
|
||||||
if (elem[prop] != model[prop]) {
|
if (elem[prop] != model[prop]) {
|
||||||
Object.assign(model, elem);
|
Object.assign(model, elem);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
update(list) {
|
update(list) {
|
||||||
(list || []).forEach(elem => {
|
(list || []).forEach(elem => {
|
||||||
const code = elem.code;
|
const code = elem.code;
|
||||||
const oDevice = this.ibpDevice[code];
|
const oDevice = this.ibpDevice[code];
|
||||||
if (elem.dispose) {
|
if (elem.dispose) {
|
||||||
this.$painter.delete(oDevice);
|
this.$painter.delete(oDevice);
|
||||||
} else {
|
} else {
|
||||||
if (this.hookHandle(oDevice.model, elem)) {
|
if (this.hookHandle(oDevice.model, elem)) {
|
||||||
this.$painter.update(oDevice);
|
this.$painter.update(oDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
|
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
|
||||||
}
|
}
|
||||||
setStatus(code, model) {
|
setStatus(code, model) {
|
||||||
const oDevcie = this.ibpDevice[code].instance;
|
const oDevcie = this.ibpDevice[code].instance;
|
||||||
oDevcie.setStatus(model);
|
oDevcie.setStatus(model);
|
||||||
}
|
}
|
||||||
setDeviceStatus(list) {
|
setDeviceStatus(list) {
|
||||||
const deviceList = Object.values(this.ibpDevice);
|
const deviceList = Object.values(this.ibpDevice);
|
||||||
console.log(list, deviceList);
|
deviceList.forEach(elem =>{
|
||||||
deviceList.forEach(elem =>{
|
(list || []).forEach(it =>{
|
||||||
(list || []).forEach(it =>{
|
if (elem.model.linkDevice === it.code) {
|
||||||
if (elem.model.linkDevice === it.code) {
|
elem.instance.setStatus(it);
|
||||||
elem.instance.setStatus(it);
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
drawIbpInit() {
|
drawIbpInit() {
|
||||||
this.$mouseController.setAllowDragging(true);
|
this.$mouseController.setAllowDragging(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pullBack(payload) {
|
pullBack(payload) {
|
||||||
if (payload.type === 'zoom') {
|
if (payload.type === 'zoom') {
|
||||||
const zrWidth = this.$ibpZr.getWidth();
|
const zrWidth = this.$ibpZr.getWidth();
|
||||||
const zrHeight = this.$ibpZr.getHeight();
|
const zrHeight = this.$ibpZr.getHeight();
|
||||||
const originX = payload.originX || zrWidth / 2;
|
const originX = payload.originX || zrWidth / 2;
|
||||||
const originY = payload.originY || zrHeight / 2;
|
const originY = payload.originY || zrHeight / 2;
|
||||||
const x = (this.$options.offsetX + originX) / this.$options.scaleRate;
|
const x = (this.$options.offsetX + originX) / this.$options.scaleRate;
|
||||||
const y = (this.$options.offsetY + originY) / this.$options.scaleRate;
|
const y = (this.$options.offsetY + originY) / this.$options.scaleRate;
|
||||||
const newScaleRate = this.$options.getScaleRate(payload.scale);
|
const newScaleRate = this.$options.getScaleRate(payload.scale);
|
||||||
const dx = originX - (x * newScaleRate - this.$options.offsetX);
|
const dx = originX - (x * newScaleRate - this.$options.offsetX);
|
||||||
const dy = originY - (y * newScaleRate - this.$options.offsetY);
|
const dy = originY - (y * newScaleRate - this.$options.offsetY);
|
||||||
payload.dx = dx;
|
payload.dx = dx;
|
||||||
payload.dy = dy;
|
payload.dy = dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
return payload || {};
|
return payload || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
getZr() {
|
getZr() {
|
||||||
return this.$ibpZr;
|
return this.$ibpZr;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEvents() {
|
getEvents() {
|
||||||
return this.events;
|
return this.events;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDeviceByCode(code) {
|
getDeviceByCode(code) {
|
||||||
return this.ibpDevice[code];
|
return this.ibpDevice[code];
|
||||||
}
|
}
|
||||||
|
|
||||||
resize(opt) {
|
resize(opt) {
|
||||||
this.$ibpZr.resize(opt);
|
this.$ibpZr.resize(opt);
|
||||||
this.$painter.updateZrSize(opt);
|
this.$painter.updateZrSize(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.$painter.refresh();
|
this.$painter.refresh();
|
||||||
}
|
}
|
||||||
clear() {
|
clear() {
|
||||||
this.skinCode = '';
|
this.skinCode = '';
|
||||||
this.style = {};
|
this.style = {};
|
||||||
this.ibpDevice = {};
|
this.ibpDevice = {};
|
||||||
this.$painter.clear();
|
this.$painter.clear();
|
||||||
}
|
}
|
||||||
initClockTime(initTime) {
|
initClockTime(initTime) {
|
||||||
Object.values(this.ibpDevice)
|
Object.values(this.ibpDevice)
|
||||||
.forEach(elem => {
|
.forEach(elem => {
|
||||||
if (elem.model._type === deviceType.Clock) {
|
if (elem.model._type === deviceType.Clock) {
|
||||||
this.$painter.initClockTime(elem, initTime);
|
this.$painter.initClockTime(elem, initTime);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setClockStart(started) {
|
setClockStart(started) {
|
||||||
Object.values(this.ibpDevice)
|
Object.values(this.ibpDevice)
|
||||||
.forEach(elem => {
|
.forEach(elem => {
|
||||||
if (elem.model._type === deviceType.Clock) {
|
if (elem.model._type === deviceType.Clock) {
|
||||||
this.$painter.setClockStart(elem, started);
|
this.$painter.setClockStart(elem, started);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
dispose() {
|
dispose() {
|
||||||
this.off(this.events.Pan, this.optionsHandler);
|
this.off(this.events.Pan, this.optionsHandler);
|
||||||
this.off(this.events.Zoom, this.optionsHandler);
|
this.off(this.events.Zoom, this.optionsHandler);
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
this.$mouseController.dispose();
|
this.$mouseController.dispose();
|
||||||
this.$ibpZr && zrender.dispose(this.$ibpZr);
|
this.$ibpZr && zrender.dispose(this.$ibpZr);
|
||||||
this.$painter.dispose();
|
this.$painter.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
on(eventname, cb, context) {
|
on(eventname, cb, context) {
|
||||||
const idx = Object.values(this.events).indexOf(eventname);
|
const idx = Object.values(this.events).indexOf(eventname);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
switch (eventname) {
|
switch (eventname) {
|
||||||
case this.events.Selected:
|
case this.events.Selected:
|
||||||
this.$mouseController.on(this.events.Selected, cb, context);
|
this.$mouseController.on(this.events.Selected, cb, context);
|
||||||
break;
|
break;
|
||||||
case this.events.Contextmenu:
|
case this.events.Contextmenu:
|
||||||
this.$mouseController.on(this.events.Contextmenu, cb, context);
|
this.$mouseController.on(this.events.Contextmenu, cb, context);
|
||||||
break;
|
break;
|
||||||
case this.events.DataZoom:
|
case this.events.DataZoom:
|
||||||
this.$mouseController.on(this.events.DataZoom, cb, context);
|
this.$mouseController.on(this.events.DataZoom, cb, context);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
off(eventname, cb) {
|
off(eventname, cb) {
|
||||||
const idx = Object.values(this.events).indexOf(eventname);
|
const idx = Object.values(this.events).indexOf(eventname);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
switch (eventname) {
|
switch (eventname) {
|
||||||
case this.events.Selected:
|
case this.events.Selected:
|
||||||
this.$mouseController.off(this.events.Selected, cb);
|
this.$mouseController.off(this.events.Selected, cb);
|
||||||
break;
|
break;
|
||||||
case this.events.Contextmenu:
|
case this.events.Contextmenu:
|
||||||
this.$mouseController.off(this.events.Contextmenu, cb);
|
this.$mouseController.off(this.events.Contextmenu, cb);
|
||||||
break;
|
break;
|
||||||
case this.events.DataZoom:
|
case this.events.DataZoom:
|
||||||
this.$mouseController.off(this.events.DataZoom, cb);
|
this.$mouseController.off(this.events.DataZoom, cb);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default IbpPan;
|
export default IbpPan;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<!-- </el-scrollbar> -->
|
<!-- </el-scrollbar> -->
|
||||||
</section>
|
</section>
|
||||||
<el-footer class="footers" style="height:30px;">
|
<el-footer class="footers" style="height:30px;">
|
||||||
<div style="font-size:14px;float:left;">北京玖琏科技有限公司 联系电话: 13201793090 </div>
|
<div style="font-size:14px;float:left;">北京玖琏科技有限公司 联系电话: 13201793090 </div>
|
||||||
<div style="font-size:14px;float:right;">Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号</div>
|
<div style="font-size:14px;float:right;">Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号</div>
|
||||||
</el-footer>
|
</el-footer>
|
||||||
</div>
|
</div>
|
||||||
@ -21,47 +21,47 @@
|
|||||||
import { Navbar } from './components'; // Sidebar
|
import { Navbar } from './components'; // Sidebar
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Layout',
|
name: 'Layout',
|
||||||
components: {
|
components: {
|
||||||
Navbar
|
Navbar
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
sidebar() {
|
sidebar() {
|
||||||
return this.$store.state.app.sidebar;
|
return this.$store.state.app.sidebar;
|
||||||
},
|
},
|
||||||
device() {
|
device() {
|
||||||
return this.$store.state.app.device;
|
return this.$store.state.app.device;
|
||||||
},
|
},
|
||||||
classObj() {
|
classObj() {
|
||||||
return {
|
return {
|
||||||
withoutAnimation: this.sidebar.withoutAnimation,
|
withoutAnimation: this.sidebar.withoutAnimation,
|
||||||
mobile: this.device === 'mobile'
|
mobile: this.device === 'mobile'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
width() {
|
width() {
|
||||||
return this.$store.state.app.width;
|
return this.$store.state.app.width;
|
||||||
},
|
},
|
||||||
height() {
|
height() {
|
||||||
return this.$store.state.app.height - 90;
|
return this.$store.state.app.height - 90;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.watchRouterUpdate();
|
this.watchRouterUpdate();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleClickOutside() {
|
handleClickOutside() {
|
||||||
this.$store.dispatch('CloseSideBar', { withoutAnimation: false });
|
this.$store.dispatch('CloseSideBar', { withoutAnimation: false });
|
||||||
},
|
},
|
||||||
watchRouterUpdate() {
|
watchRouterUpdate() {
|
||||||
this.$router.beforeEach((to, from, next) => {
|
this.$router.beforeEach((to, from, next) => {
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ 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'; // 王兴杰
|
||||||
} else {
|
} else {
|
||||||
BASE_API = process.env.VUE_APP_BASE_API;
|
BASE_API = process.env.VUE_APP_BASE_API;
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
import { createLesson, updateLesson, getLessonDetail } from '@/api/jmap/lessondraft';
|
import { createLesson, updateLesson, getLessonDetail } from '@/api/jmap/lessondraft';
|
||||||
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
||||||
import { getSkinCodeList } from '@/api/management/mapskin';
|
import { getSkinCodeList } from '@/api/management/mapskin';
|
||||||
import { UrlConfig } from '@/router/index';
|
// import { UrlConfig } from '@/router/index';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CourseEdit',
|
name: 'CourseEdit',
|
||||||
@ -187,7 +187,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
back() {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -145,7 +145,7 @@ export default {
|
|||||||
.box{
|
.box{
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -2,37 +2,13 @@
|
|||||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogShow" :before-close="handleCancel" :close-on-click-modal="false">
|
<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 ref="form" :model="form" :rules="rules" label-width="140px">
|
||||||
<el-form-item :label="$t('publish.trainingType')" prop="course">
|
<el-form-item :label="$t('publish.trainingType')" prop="course">
|
||||||
<el-select
|
<el-select v-model="form.course" :placeholder="$t('publish.selectTypeScope')" :disabled="editOk" style="width:240px;" @change="changeCourse(form.course)">
|
||||||
v-model="form.course"
|
<el-option v-for="nor in options" :key="nor.id" :label="nor.name" :value="nor.code" :disabled="nor.disabled" />
|
||||||
: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-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('publish.operationType')">
|
<el-form-item :label="$t('publish.operationType')">
|
||||||
<el-select
|
<el-select v-model="form.operateType" clearable :placeholder="$t('publish.selectScope')" :disabled="editOk" @change="changeOperation(form.operateType)">
|
||||||
v-model="form.operateType"
|
<el-option v-for="nor in operationTypeList" :key="nor.id" :label="nor.name" :value="nor.code" :disabled="nor.disabled" />
|
||||||
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-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('publish.questionNumbers')" prop="number">
|
<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';
|
import { getDetailList } from '@/api/management/dictionary';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'EditRule',
|
name: 'EditRule',
|
||||||
props: {
|
props: {
|
||||||
courseId: {
|
courseId: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
editCourse: {
|
editCourse: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
var number = (rule, value, callback) => {
|
var number = (rule, value, callback) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return callback(new Error(this.$t('publish.inputQuestionNumber')));
|
return callback(new Error(this.$t('publish.inputQuestionNumber')));
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (Number(value) == 0) {
|
if (Number(value) == 0) {
|
||||||
callback(new Error(this.$t('publish.inputQuestionNumberError')));
|
callback(new Error(this.$t('publish.inputQuestionNumberError')));
|
||||||
} else if (!Number(value)) {
|
} else if (!Number(value)) {
|
||||||
callback(new Error(this.$t('publish.inputValidNumber')));
|
callback(new Error(this.$t('publish.inputValidNumber')));
|
||||||
} else if (Number(value) > this.topicNum) {
|
} else if (Number(value) > this.topicNum) {
|
||||||
callback(new Error(this.$t('publish.inputNumberError')));
|
callback(new Error(this.$t('publish.inputNumberError')));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
var mark = (rule, value, callback) => {
|
var mark = (rule, value, callback) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return callback(new Error(this.$t('publish.inputScorePerQuestion')));
|
return callback(new Error(this.$t('publish.inputScorePerQuestion')));
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!Number(value)) {
|
if (!Number(value)) {
|
||||||
callback(new Error(this.$t('publish.inputNumericType')));
|
callback(new Error(this.$t('publish.inputNumericType')));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
title: this.$t('publish.addRules'),
|
title: this.$t('publish.addRules'),
|
||||||
form: {
|
form: {
|
||||||
course: '',
|
course: '',
|
||||||
operateType: '',
|
operateType: '',
|
||||||
number: '',
|
number: '',
|
||||||
mark: ''
|
mark: ''
|
||||||
},
|
},
|
||||||
topicNum: 0,
|
topicNum: 0,
|
||||||
dialogShow: false,
|
dialogShow: false,
|
||||||
editOk: false,
|
editOk: false,
|
||||||
rules: {
|
rules: {
|
||||||
course: [
|
course: [
|
||||||
{ required: true, message: this.$t('publish.selectTestType'), trigger: 'change' }
|
{ required: true, message: this.$t('publish.selectTestType'), trigger: 'change' }
|
||||||
],
|
],
|
||||||
number: [
|
number: [
|
||||||
{ required: true, validator: number, trigger: 'blur' }
|
{ required: true, validator: number, trigger: 'blur' }
|
||||||
],
|
],
|
||||||
mark: [
|
mark: [
|
||||||
{ required: true, validator: mark, trigger: 'blur' }
|
{ required: true, validator: mark, trigger: 'blur' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
options: this.$store.state.exam.courseList,
|
options: this.$store.state.exam.courseList,
|
||||||
typeList: [],
|
typeList: [],
|
||||||
operationTypeList: [],
|
operationTypeList: [],
|
||||||
trainingOperateTypeMap: {}
|
trainingOperateTypeMap: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
editCourse: function (val) {
|
editCourse: function (val) {
|
||||||
this.title = this.$t('publish.modifyRules');
|
this.title = this.$t('publish.modifyRules');
|
||||||
this.editOk = true;
|
this.editOk = true;
|
||||||
this.form = {
|
this.form = {
|
||||||
course: val.trainingType,
|
course: val.trainingType,
|
||||||
operateType: val.operateType,
|
operateType: val.operateType,
|
||||||
number: val.num,
|
number: val.num,
|
||||||
mark: val.point
|
mark: val.point
|
||||||
};
|
};
|
||||||
this.changeCourse(val.trainingType);
|
this.changeCourse(val.trainingType);
|
||||||
this.changeOperation(val.operateType);
|
this.changeOperation(val.operateType);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
await this.getList();
|
await this.getList();
|
||||||
await this.refresh();
|
await this.refresh();
|
||||||
this.trainingOperateTypeMap = {};
|
this.trainingOperateTypeMap = {};
|
||||||
this.$Dictionary.stationControl().then(list => {
|
this.$Dictionary.stationControl().then(list => {
|
||||||
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.signalOperation().then(list => {
|
this.$Dictionary.signalOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.switchOperation().then(list => {
|
this.$Dictionary.switchOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.sectionOperation().then(list => {
|
this.$Dictionary.sectionOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.stationStandOperation().then(list => {
|
this.$Dictionary.stationStandOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.trainPlanOperation().then(list => {
|
this.$Dictionary.trainPlanOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.trainOperation().then(list => {
|
this.$Dictionary.trainOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
show() {
|
show() {
|
||||||
this.dialogShow = true;
|
this.dialogShow = true;
|
||||||
},
|
},
|
||||||
handleOk() {
|
handleOk() {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.operationTypeList.forEach(item => {
|
this.operationTypeList.forEach(item => {
|
||||||
if (item.code == this.form.operateType) {
|
if (item.code == this.form.operateType) {
|
||||||
this.form.name = item.name;
|
this.form.name = item.name;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (this.editOk) {
|
if (this.editOk) {
|
||||||
// 修改
|
// 修改
|
||||||
this.$emit('editRuleList', this.form);
|
this.$emit('editRuleList', this.form);
|
||||||
this.editOk = false;
|
this.editOk = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.handleCancel();
|
this.handleCancel();
|
||||||
}, 300);
|
}, 300);
|
||||||
} else {
|
} else {
|
||||||
// 新增
|
// 新增
|
||||||
this.$emit('addRuleList', this.form);
|
this.$emit('addRuleList', this.form);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.handleCancel();
|
this.handleCancel();
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
this.topicNum = 0;
|
this.topicNum = 0;
|
||||||
} else {
|
} else {
|
||||||
this.dialogShow = true;
|
this.dialogShow = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
this.$refs['form'].resetFields();
|
this.$refs['form'].resetFields();
|
||||||
this.clearBoth();
|
this.clearBoth();
|
||||||
this.dialogShow = false;
|
this.dialogShow = false;
|
||||||
this.editOk = false;
|
this.editOk = false;
|
||||||
this.topicNum = 0;
|
this.topicNum = 0;
|
||||||
this.operationTypeList = [];
|
this.operationTypeList = [];
|
||||||
},
|
},
|
||||||
clearBoth() {
|
clearBoth() {
|
||||||
this.form = {
|
this.form = {
|
||||||
course: '',
|
course: '',
|
||||||
number: '',
|
number: '',
|
||||||
mark: ''
|
mark: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// 获取课题下类型
|
// 获取课题下类型
|
||||||
async refresh() {
|
async refresh() {
|
||||||
await getCourseTypeList({ lessonId: this.courseId }).then(res => {
|
await getCourseTypeList({ lessonId: this.courseId }).then(res => {
|
||||||
const list = [];
|
const list = [];
|
||||||
res.data.sort();
|
res.data.sort();
|
||||||
res.data.forEach(ele => {
|
res.data.forEach(ele => {
|
||||||
this.typeList.forEach(v => {
|
this.typeList.forEach(v => {
|
||||||
if (ele == v.code) {
|
if (ele == v.code) {
|
||||||
list.push(v);
|
list.push(v);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.options = list;
|
this.options = list;
|
||||||
this.changeCourseDisable();
|
this.changeCourseDisable();
|
||||||
this.$store.dispatch('exam/setCourse', this.options);
|
this.$store.dispatch('exam/setCourse', this.options);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$messageBox(this.$t('publish.refreshFailed'));
|
this.$messageBox(this.$t('publish.refreshFailed'));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async getList() {
|
async getList() {
|
||||||
this.typeList = [];
|
this.typeList = [];
|
||||||
await getDetailList('training_type').then(res => {
|
await getDetailList('training_type').then(res => {
|
||||||
this.typeList = res.data;
|
this.typeList = res.data;
|
||||||
}).catch((error) => { console.log(error.message); });
|
}).catch((error) => { console.log(error.message); });
|
||||||
},
|
},
|
||||||
async changeCourse(val) {
|
async changeCourse(val) {
|
||||||
const param = {
|
const param = {
|
||||||
lessonId: this.courseId,
|
lessonId: this.courseId,
|
||||||
trainingType: val,
|
trainingType: val,
|
||||||
operateType: ''
|
operateType: ''
|
||||||
};
|
};
|
||||||
this.operationTypeList = this.trainingOperateTypeMap[val];
|
this.operationTypeList = this.trainingOperateTypeMap[val];
|
||||||
if (this.operationTypeList) {
|
if (this.operationTypeList) {
|
||||||
this.operationTypeList.forEach(item => {
|
this.operationTypeList.forEach(item => {
|
||||||
item.disabled = false;
|
item.disabled = false;
|
||||||
this.changeOperationDisabled(); // 禁用设置
|
this.changeOperationDisabled(); // 禁用设置
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.form.operateType='';
|
this.form.operateType = '';
|
||||||
const resp = await getLessonTypeNum(param);
|
const resp = await getLessonTypeNum(param);
|
||||||
if (resp.code == 200) {
|
if (resp.code == 200) {
|
||||||
this.topicNum = resp.data;
|
this.topicNum = resp.data;
|
||||||
return this.topicNum;
|
return this.topicNum;
|
||||||
}
|
}
|
||||||
this.$store.dispatch('exam/setCourse', this.options);
|
this.$store.dispatch('exam/setCourse', this.options);
|
||||||
},
|
},
|
||||||
async changeOperation(val) {
|
async changeOperation(val) {
|
||||||
const param = {
|
const param = {
|
||||||
lessonId: this.courseId,
|
lessonId: this.courseId,
|
||||||
trainingType: this.form.course,
|
trainingType: this.form.course,
|
||||||
operateType: val
|
operateType: val
|
||||||
};
|
};
|
||||||
const resp = await getLessonTypeNum(param);
|
const resp = await getLessonTypeNum(param);
|
||||||
if (resp.code == 200) {
|
if (resp.code == 200) {
|
||||||
this.topicNum = resp.data;
|
this.topicNum = resp.data;
|
||||||
return this.topicNum;
|
return this.topicNum;
|
||||||
}
|
}
|
||||||
this.$store.dispatch('exam/setCourse', this.options);
|
this.$store.dispatch('exam/setCourse', this.options);
|
||||||
},
|
},
|
||||||
// 判断类型是否选择过
|
// 判断类型是否选择过
|
||||||
changeCourseDisable() {
|
changeCourseDisable() {
|
||||||
const arr = this.$store.state.exam.ruleList;
|
const arr = this.$store.state.exam.ruleList;
|
||||||
arr.forEach(ele => {
|
arr.forEach(ele => {
|
||||||
this.options.forEach(res => {
|
this.options.forEach(res => {
|
||||||
// operateType 操作类型为空或没有值存在 禁用
|
// operateType 操作类型为空或没有值存在 禁用
|
||||||
if (ele.trainingType == res.code && !ele.operateType) {
|
if (ele.trainingType == res.code && !ele.operateType) {
|
||||||
res.disabled = true;
|
res.disabled = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changeOperationDisabled() {
|
changeOperationDisabled() {
|
||||||
const arr = this.$store.state.exam.ruleList;
|
const arr = this.$store.state.exam.ruleList;
|
||||||
arr.forEach(ele => {
|
arr.forEach(ele => {
|
||||||
this.operationTypeList.forEach(res => {
|
this.operationTypeList.forEach(res => {
|
||||||
if (ele.operateType == res.code) {
|
if (ele.operateType == res.code) {
|
||||||
res.disabled = true;
|
res.disabled = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changeListDisabled(val) {
|
changeListDisabled(val) {
|
||||||
this.options.forEach(res => {
|
this.options.forEach(res => {
|
||||||
if (res.code == val) {
|
if (res.code == val) {
|
||||||
res.disabled = false;
|
res.disabled = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.$store.dispatch('exam/setCourse', this.options);
|
this.$store.dispatch('exam/setCourse', this.options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
@ -1,77 +1,65 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="exam-rule">
|
<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 ref="form" :model="form" :rules="rules" label-width="120px" class="demo-form">
|
<el-form-item :label="$t('publish.testName')" prop="name">
|
||||||
<el-form-item :label="$t('publish.testName')" prop="name">
|
<el-input v-model="form.name" :placeholder="$t('publish.inputTestName')" />
|
||||||
<el-input v-model="form.name" :placeholder="$t('publish.inputTestName')" />
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item :label="$t('publish.testScope')" prop="region">
|
||||||
<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-select
|
<el-option v-for="nor in options" :key="nor.id" :label="nor.name" :value="nor.id" />
|
||||||
v-model="form.region"
|
</el-select>
|
||||||
:placeholder="$t('publish.selectTestScope')"
|
</el-form-item>
|
||||||
style="width: 100%;"
|
<el-form-item :label="$t('publish.testDuration')" prop="duration">
|
||||||
:disabled="isEdit || selectDisable"
|
<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;"> {{ $t('publish.durationMinutes') }}</span>
|
||||||
<el-option v-for="nor in options" :key="nor.id" :label="nor.name" :value="nor.id" />
|
</el-form-item>
|
||||||
</el-select>
|
<el-form-item :label="$t('publish.testDate')">
|
||||||
</el-form-item>
|
<el-col :span="11">
|
||||||
<el-form-item :label="$t('publish.testDuration')" prop="duration">
|
<el-form-item prop="startDate">
|
||||||
<el-input
|
<el-date-picker
|
||||||
v-model="form.duration"
|
v-model="form.startDate"
|
||||||
placeholder="90"
|
type="datetime"
|
||||||
style="float: left; width: calc(100% - 80px);"
|
:placeholder="$t('publish.startTestTime')"
|
||||||
:disabled="isEdit"
|
style="width: 100%;"
|
||||||
/>
|
value-format="timestamp"
|
||||||
<span style="width:80px; display: block;float: left; text-align: center;"> {{ $t('publish.durationMinutes') }}</span>
|
:disabled="isEdit"
|
||||||
</el-form-item>
|
/>
|
||||||
<el-form-item :label="$t('publish.testDate')">
|
</el-form-item>
|
||||||
<el-col :span="11">
|
</el-col>
|
||||||
<el-form-item prop="startDate">
|
<el-col class="line" :span="2">-</el-col>
|
||||||
<el-date-picker
|
<el-col :span="11">
|
||||||
v-model="form.startDate"
|
<el-form-item prop="endDate">
|
||||||
type="datetime"
|
<el-date-picker
|
||||||
:placeholder="$t('publish.startTestTime')"
|
v-model="form.endDate"
|
||||||
style="width: 100%;"
|
type="datetime"
|
||||||
value-format="timestamp"
|
:placeholder="$t('publish.endTestTime')"
|
||||||
:disabled="isEdit"
|
style="width: 100%;"
|
||||||
/>
|
value-format="timestamp"
|
||||||
</el-form-item>
|
:disabled="isEdit"
|
||||||
</el-col>
|
/>
|
||||||
<el-col class="line" :span="2">-</el-col>
|
</el-form-item>
|
||||||
<el-col :span="11">
|
</el-col>
|
||||||
<el-form-item prop="endDate">
|
</el-form-item>
|
||||||
<el-date-picker
|
<el-form-item :label="$t('publish.fullScore')" prop="fullMark">
|
||||||
v-model="form.endDate"
|
<el-input v-model="form.fullMark" placeholder="" :disabled="isEdit" />
|
||||||
type="datetime"
|
</el-form-item>
|
||||||
:placeholder="$t('publish.endTestTime')"
|
<el-form-item :label="$t('publish.passingScore')" prop="passMark">
|
||||||
style="width: 100%;"
|
<el-input v-model="form.passMark" placeholder="" :disabled="isEdit" />
|
||||||
value-format="timestamp"
|
</el-form-item>
|
||||||
:disabled="isEdit"
|
<el-form-item v-if="trialShow" :label="$t('publish.whetherToTry')" required>
|
||||||
/>
|
<el-radio-group v-model="trial">
|
||||||
</el-form-item>
|
<el-radio label="1">{{ $t('publish.trialNo') }}</el-radio>
|
||||||
</el-col>
|
<el-radio label="2">{{ $t('publish.trialYes') }}</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
<el-form-item :label="$t('publish.fullScore')" prop="fullMark">
|
</el-form-item>
|
||||||
<el-input v-model="form.fullMark" placeholder="" :disabled="isEdit" />
|
<el-form-item :label="$t('publish.testDescription')" prop="desc">
|
||||||
</el-form-item>
|
<el-input v-model="form.desc" type="textarea" :placeholder="$t('publish.inputTestDescription')" :disabled="isEdit" />
|
||||||
<el-form-item :label="$t('publish.passingScore')" prop="passMark">
|
</el-form-item>
|
||||||
<el-input v-model="form.passMark" placeholder="" :disabled="isEdit" />
|
<!-- <el-form-item>
|
||||||
</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="updateForm" v-if="isEdit">{{ $t('error.edit') }}</el-button>
|
||||||
<el-button type="primary" @click="submitForm" v-else>{{ $t('error.nextStep') }}</el-button>
|
<el-button type="primary" @click="submitForm" v-else>{{ $t('error.nextStep') }}</el-button>
|
||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-scrollbar>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -80,211 +68,205 @@ import { getPublishLessonList } from '@/api/jmap/lesson';
|
|||||||
import { getExamLessonDetail, updateExamRules } from '@/api/management/exam';
|
import { getExamLessonDetail, updateExamRules } from '@/api/management/exam';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ExamFrom',
|
name: 'ExamFrom',
|
||||||
props: {
|
data() {
|
||||||
height: {
|
var fullMark = (rule, value, callback) => {
|
||||||
type: Number,
|
if (!value) {
|
||||||
default: 800
|
return callback(new Error(this.$t('publish.inputFullScore')));
|
||||||
}
|
}
|
||||||
},
|
setTimeout(() => {
|
||||||
data() {
|
if (!Number(value)) {
|
||||||
var fullMark = (rule, value, callback) => {
|
callback(new Error(this.$t('publish.inputNumericType')));
|
||||||
if (!value) {
|
} else {
|
||||||
return callback(new Error(this.$t('publish.inputFullScore')));
|
callback();
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
}, 100);
|
||||||
if (!Number(value)) {
|
};
|
||||||
callback(new Error(this.$t('publish.inputNumericType')));
|
var passMark = (rule, value, callback) => {
|
||||||
} else {
|
if (!value) {
|
||||||
callback();
|
return callback(new Error(this.$t('publish.inputPassingScore')));
|
||||||
}
|
}
|
||||||
}, 100);
|
setTimeout(() => {
|
||||||
};
|
if (!Number(value)) {
|
||||||
var passMark = (rule, value, callback) => {
|
callback(new Error(this.$t('publish.inputNumericType')));
|
||||||
if (!value) {
|
} else {
|
||||||
return callback(new Error(this.$t('publish.inputPassingScore')));
|
if (Number(value) > this.form.fullMark) {
|
||||||
}
|
callback(new Error(this.$t('publish.inputScoreError')));
|
||||||
setTimeout(() => {
|
} else {
|
||||||
if (!Number(value)) {
|
callback();
|
||||||
callback(new Error(this.$t('publish.inputNumericType')));
|
}
|
||||||
} else {
|
}
|
||||||
if (Number(value) > this.form.fullMark) {
|
}, 100);
|
||||||
callback(new Error(this.$t('publish.inputScoreError')));
|
};
|
||||||
} else {
|
var duration = (rule, value, callback) => {
|
||||||
callback();
|
if (!value) {
|
||||||
}
|
return callback(new Error(this.$t('publish.inputTestDuration')));
|
||||||
}
|
}
|
||||||
}, 100);
|
setTimeout(() => {
|
||||||
};
|
if (!Number(value)) {
|
||||||
var duration = (rule, value, callback) => {
|
callback(new Error(this.$t('publish.inputNumericType')));
|
||||||
if (!value) {
|
} else {
|
||||||
return callback(new Error(this.$t('publish.inputTestDuration')));
|
callback();
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
}, 100);
|
||||||
if (!Number(value)) {
|
};
|
||||||
callback(new Error(this.$t('publish.inputNumericType')));
|
return {
|
||||||
} else {
|
formDetail: {
|
||||||
callback();
|
name: '',
|
||||||
}
|
region: '',
|
||||||
}, 100);
|
startDate: '',
|
||||||
};
|
endDate: '',
|
||||||
return {
|
desc: '',
|
||||||
formDetail: {
|
type: '',
|
||||||
name: '',
|
duration: '',
|
||||||
region: '',
|
fullMark: '',
|
||||||
startDate: '',
|
passMark: ''
|
||||||
endDate: '',
|
},
|
||||||
desc: '',
|
trial: '1',
|
||||||
type: '',
|
trialShow: false,
|
||||||
duration: '',
|
form: this.$store.state.exam.courseDetail,
|
||||||
fullMark: '',
|
options: [],
|
||||||
passMark: ''
|
selectDisable: false,
|
||||||
},
|
rules: {
|
||||||
trial: '1',
|
name: [
|
||||||
trialShow: false,
|
{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }
|
||||||
form: this.$store.state.exam.courseDetail,
|
],
|
||||||
options: [],
|
region: [
|
||||||
selectDisable: false,
|
{ required: true, message: this.$t('publish.selectTestScope'), trigger: 'change' }
|
||||||
rules: {
|
],
|
||||||
name: [
|
duration: [
|
||||||
{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }
|
{ required: true, validator: duration, trigger: 'blur' }
|
||||||
],
|
],
|
||||||
region: [
|
fullMark: [
|
||||||
{ required: true, message: this.$t('publish.selectTestScope'), trigger: 'change' }
|
{ required: true, validator: fullMark, trigger: 'blur' }
|
||||||
],
|
],
|
||||||
duration: [
|
trial: [
|
||||||
{ required: true, validator: duration, trigger: 'blur' }
|
{ required: true, message: this.$t('publish.selectWetherTrial'), trigger: 'blur' }
|
||||||
],
|
],
|
||||||
fullMark: [
|
passMark: [
|
||||||
{ required: true, validator: fullMark, trigger: 'blur' }
|
{ required: true, validator: passMark, trigger: 'blur' }
|
||||||
],
|
]
|
||||||
trial: [
|
}
|
||||||
{ required: true, message: this.$t('publish.selectWetherTrial'), trigger: 'blur' }
|
};
|
||||||
],
|
},
|
||||||
passMark: [
|
computed: {
|
||||||
{ required: true, validator: passMark, trigger: 'blur' }
|
isEdit() {
|
||||||
]
|
return this.$route.params.mode == 'edit';
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
},
|
watch: {
|
||||||
computed: {
|
'form.startDate': function (val) {
|
||||||
isEdit() {
|
if (val) {
|
||||||
return this.$route.params.mode == 'edit';
|
this.form.endDate = val + Number(this.form.duration * 60000);
|
||||||
}
|
} else {
|
||||||
},
|
this.form.endDate = '';
|
||||||
watch: {
|
}
|
||||||
'form.startDate': function (val) {
|
},
|
||||||
if (val) {
|
'form.duration': function (val) {
|
||||||
this.form.endDate = val + Number(this.form.duration * 60000);
|
if (this.form.startDate) {
|
||||||
} else {
|
this.form.endDate = this.form.startDate + Number(val * 60000);
|
||||||
this.form.endDate = '';
|
} else {
|
||||||
}
|
this.form.endDate = '';
|
||||||
},
|
}
|
||||||
'form.duration': function (val) {
|
}
|
||||||
if (this.form.startDate) {
|
},
|
||||||
this.form.endDate = this.form.startDate + Number(val * 60000);
|
created() {
|
||||||
} else {
|
this.refresh();
|
||||||
this.form.endDate = '';
|
},
|
||||||
}
|
mounted() {
|
||||||
}
|
const user = this.$store.state.user;
|
||||||
},
|
const roles = user.roles;
|
||||||
created() {
|
this.trialShow = roles.indexOf('04') != -1;
|
||||||
this.refresh();
|
this.init();
|
||||||
},
|
},
|
||||||
mounted() {
|
methods: {
|
||||||
const user = this.$store.state.user;
|
setData(data) {
|
||||||
const roles = user.roles;
|
this.form = {
|
||||||
this.trialShow = roles.indexOf('04') != -1;
|
name: data.name,
|
||||||
this.init();
|
region: data.region,
|
||||||
},
|
startDate: Date.parse(new Date(data.startDate)),
|
||||||
methods: {
|
endDate: Date.parse(new Date(data.endDate)),
|
||||||
setData(data) {
|
desc: data.desc,
|
||||||
this.form = {
|
type: data.type,
|
||||||
name: data.name,
|
duration: Number(data.duration),
|
||||||
region: data.region,
|
fullMark: data.fullMark,
|
||||||
startDate: Date.parse(new Date(data.startDate)),
|
passMark: data.passMark
|
||||||
endDate: Date.parse(new Date(data.endDate)),
|
};
|
||||||
desc: data.desc,
|
},
|
||||||
type: data.type,
|
init() {
|
||||||
duration: Number(data.duration),
|
this.$nextTick(() => {
|
||||||
fullMark: data.fullMark,
|
if (this.$route.params.ruleId != 0) {
|
||||||
passMark: data.passMark
|
getExamLessonDetail(this.$route.params.ruleId).then(res => {
|
||||||
};
|
this.formDetail = {
|
||||||
},
|
name: res.data.name,
|
||||||
init() {
|
region: `${res.data.lessonId}`,
|
||||||
this.$nextTick(() => {
|
startDate: Date.parse(new Date(res.data.startTime)),
|
||||||
if (this.$route.params.ruleId != 0) {
|
endDate: Date.parse(new Date(res.data.endTime)),
|
||||||
getExamLessonDetail(this.$route.params.ruleId).then(res => {
|
desc: res.data.remarks,
|
||||||
this.formDetail = {
|
type: res.data.type,
|
||||||
name: res.data.name,
|
duration: Number(res.data.duration) / 60,
|
||||||
region: `${res.data.lessonId}`,
|
fullMark: res.data.fullPoint,
|
||||||
startDate: Date.parse(new Date(res.data.startTime)),
|
passMark: res.data.passingPoint
|
||||||
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) {
|
if (!this.form.name) {
|
||||||
this.$store.dispatch('exam/setCourseDetail', this.formDetail);
|
this.$store.dispatch('exam/setCourseDetail', this.formDetail);
|
||||||
this.form = this.formDetail;
|
this.form = this.formDetail;
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch('exam/setCourseDetail', this.form);
|
this.$store.dispatch('exam/setCourseDetail', this.form);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$refs.form.clearValidate();
|
this.$refs.form.clearValidate();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.form['trial'] = this.trial;
|
this.form['trial'] = this.trial;
|
||||||
this.$store.dispatch('exam/setCourseDetail', this.form);
|
this.$store.dispatch('exam/setCourseDetail', this.form);
|
||||||
this.$emit('definition', this.form);
|
this.$emit('definition', this.form);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateForm() {
|
updateForm() {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const model = {
|
const model = {
|
||||||
id: this.$route.params.ruleId,
|
id: this.$route.params.ruleId,
|
||||||
name: this.form.name,
|
name: this.form.name,
|
||||||
trial: this.trial == 2
|
trial: this.trial == 2
|
||||||
};
|
};
|
||||||
|
|
||||||
updateExamRules(model).then(response => {
|
updateExamRules(model).then(response => {
|
||||||
this.$store.dispatch('exam/setCourseDetail', this.form);
|
this.$store.dispatch('exam/setCourseDetail', this.form);
|
||||||
this.$message.success(this.$t('publish.updateExamRuleSuccess'));
|
this.$message.success(this.$t('publish.updateExamRuleSuccess'));
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$messageBox(this.$t('publish.updateExamRuleFailed'));
|
this.$messageBox(this.$t('publish.updateExamRuleFailed'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
refresh() {
|
refresh() {
|
||||||
getPublishLessonList().then(response => {
|
getPublishLessonList().then(response => {
|
||||||
this.options = response.data;
|
this.options = response.data;
|
||||||
if (parseInt(this.$route.params.lessonId)) {
|
if (parseInt(this.$route.params.lessonId)) {
|
||||||
this.form.region = this.$route.params.lessonId;
|
this.form.region = this.$route.params.lessonId;
|
||||||
this.selectDisable = true;
|
this.selectDisable = true;
|
||||||
}
|
}
|
||||||
this.$nextTick(() => { this.$refs.form.clearValidate(); });
|
this.$nextTick(() => { this.$refs.form.clearValidate(); });
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$messageBox(this.$t('publish.refreshFailed'));
|
this.$messageBox(this.$t('publish.refreshFailed'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
.exam-rule {
|
.exam-rule {
|
||||||
overflow-y: auto;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- <el-card> -->
|
<div class="joylink-card" :class="lessonName ? 'card-box' : ''">
|
||||||
<!-- <div v-if="lessonName" slot="header" style="text-align: center;">
|
<div v-if="lessonName" class="card-title">
|
||||||
<b>{{ $t('publish.lessonName') }}: {{ lessonName }}</b>
|
<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>
|
||||||
<div class="draft">
|
<div class="exam-box" :style="{ 'height': lessonName ? 'calc(100% - 47px)' : '' }">
|
||||||
<el-button-group>
|
<el-steps class="steps" :active="display">
|
||||||
<el-button v-if="isPrevStep" type="primary" @click="prevStep">{{ this.$t('global.lastStep') }}</el-button>
|
<el-step :title="$t('publish.testDefinitionMaking')" icon="el-icon-edit" />
|
||||||
<el-button v-if="isNextStep" type="primary" @click="nextStep">{{ this.$t('global.nextStep') }}</el-button>
|
<el-step :title="$t('publish.examRuleMaking')" icon="el-icon-setting" />
|
||||||
<el-button v-if="isUpdate" type="warning" @click="update">{{ $t('global.update') }}</el-button>
|
</el-steps>
|
||||||
<el-button v-if="isCreate" type="primary" @click="create">{{ $t('global.create') }}</el-button>
|
<div class="joylink-card forms">
|
||||||
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
<template v-if="display == 1" class="definition">
|
||||||
</el-button-group>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<!-- </el-card> -->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -44,7 +44,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
display: 1,
|
display: 1,
|
||||||
course: {},
|
course: {},
|
||||||
// lessonName: '',
|
lessonName: '',
|
||||||
formData: {}
|
formData: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -69,11 +69,11 @@ export default {
|
|||||||
loadInitData() {
|
loadInitData() {
|
||||||
getPublishLessonList().then(response => {
|
getPublishLessonList().then(response => {
|
||||||
this.OrganizationList = response.data;
|
this.OrganizationList = response.data;
|
||||||
// this.OrganizationList.forEach(elem => {
|
this.OrganizationList.forEach(elem => {
|
||||||
// if (elem.id == this.$route.params.lessonId) {
|
if (elem.id == this.$route.params.lessonId) {
|
||||||
// this.lessonName = elem.name;
|
this.lessonName = elem.name;
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
definition(data) {
|
definition(data) {
|
||||||
@ -109,9 +109,21 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<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 {
|
.exam-box {
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
height: 100%;
|
overflow: auto;
|
||||||
|
|
||||||
/deep/ {
|
/deep/ {
|
||||||
.el-step__icon.is-icon {
|
.el-step__icon.is-icon {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="exam-rule">
|
<div class="exam-rule">
|
||||||
<span>{{$t('publish.fullScoreTips')}} {{ course.fullMark }} {{$t('publish.scorePoints')}}</span>
|
<span>{{ $t('publish.fullScoreTips') }} {{ course.fullMark }} {{ $t('publish.scorePoints') }}</span>
|
||||||
<el-button class="addList" size="small" @click="handleAdd">{{$t('publish.addRules')}}</el-button>
|
<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">
|
<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="name" :label="$t('publish.trainingType')" />
|
||||||
<el-table-column prop="num" :label="$t('publish.questionsNumber')" width="100" />
|
<el-table-column prop="num" :label="$t('publish.questionsNumber')" width="100" />
|
||||||
<el-table-column prop="point" :label="$t('publish.eachScore')" width="100" />
|
<el-table-column prop="point" :label="$t('publish.eachScore')" width="100" />
|
||||||
@ -14,10 +14,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- <div class="btn-footer">
|
|
||||||
<el-button @click="regulation">上一步</el-button>
|
|
||||||
<el-button type="primary" @click="creatOk">新增</el-button>
|
|
||||||
</div> -->
|
|
||||||
<edit-rule
|
<edit-rule
|
||||||
ref="addRule"
|
ref="addRule"
|
||||||
:course-id="courseId"
|
:course-id="courseId"
|
||||||
@ -35,244 +31,240 @@ import { UrlConfig } from '@/router/index';
|
|||||||
import editRule from './editRule';
|
import editRule from './editRule';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Rule',
|
name: 'Rule',
|
||||||
components: {
|
components: {
|
||||||
editRule
|
editRule
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
course: {
|
course: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
},
|
}
|
||||||
height: {
|
},
|
||||||
type: Number,
|
data() {
|
||||||
default: 800
|
return {
|
||||||
}
|
ruleList: this.$store.state.exam.ruleList,
|
||||||
},
|
courseId: this.course.region,
|
||||||
data() {
|
editCourse: {},
|
||||||
return {
|
formDetail: {
|
||||||
ruleList: this.$store.state.exam.ruleList,
|
name: '',
|
||||||
courseId: this.course.region,
|
region: '',
|
||||||
editCourse: {},
|
startDate: '',
|
||||||
formDetail: {
|
endDate: '',
|
||||||
name: '',
|
desc: '',
|
||||||
region: '',
|
type: '',
|
||||||
startDate: '',
|
duration: '',
|
||||||
endDate: '',
|
fullMark: '',
|
||||||
desc: '',
|
passMark: ''
|
||||||
type: '',
|
},
|
||||||
duration: '',
|
form: {
|
||||||
fullMark: '',
|
course: '',
|
||||||
passMark: ''
|
number: '',
|
||||||
},
|
mark: ''
|
||||||
form: {
|
},
|
||||||
course: '',
|
typeList: [],
|
||||||
number: '',
|
trainingOperateTypeMap: {}
|
||||||
mark: ''
|
};
|
||||||
},
|
},
|
||||||
typeList: [],
|
watch: {
|
||||||
trainingOperateTypeMap: {}
|
},
|
||||||
};
|
async mounted() {
|
||||||
},
|
this.trainingOperateTypeMap = {};
|
||||||
watch: {
|
this.$Dictionary.stationControl().then(list => {
|
||||||
},
|
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
||||||
async mounted() {
|
});
|
||||||
this.trainingOperateTypeMap = {};
|
this.$Dictionary.signalOperation().then(list => {
|
||||||
this.$Dictionary.stationControl().then(list => {
|
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
||||||
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
});
|
||||||
});
|
this.$Dictionary.switchOperation().then(list => {
|
||||||
this.$Dictionary.signalOperation().then(list => {
|
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
||||||
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
});
|
||||||
});
|
this.$Dictionary.sectionOperation().then(list => {
|
||||||
this.$Dictionary.switchOperation().then(list => {
|
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
||||||
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
});
|
||||||
});
|
this.$Dictionary.stationStandOperation().then(list => {
|
||||||
this.$Dictionary.sectionOperation().then(list => {
|
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
||||||
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
});
|
||||||
});
|
this.$Dictionary.trainPlanOperation().then(list => {
|
||||||
this.$Dictionary.stationStandOperation().then(list => {
|
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
||||||
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
});
|
||||||
});
|
this.$Dictionary.trainOperation().then(list => {
|
||||||
this.$Dictionary.trainPlanOperation().then(list => {
|
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
||||||
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
});
|
||||||
});
|
await this.getList();
|
||||||
this.$Dictionary.trainOperation().then(list => {
|
await this.init();
|
||||||
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
},
|
||||||
});
|
methods: {
|
||||||
await this.getList();
|
async getList() {
|
||||||
await this.init();
|
this.typeList = [];
|
||||||
},
|
await getDetailList('training_type').then(res => {
|
||||||
methods: {
|
this.typeList = res.data;
|
||||||
async getList() {
|
}).catch(error => {
|
||||||
this.typeList = [];
|
console.error(error);
|
||||||
await getDetailList('training_type').then(res => {
|
});
|
||||||
this.typeList = res.data;
|
},
|
||||||
}).catch(error => {
|
async init() {
|
||||||
console.error(error);
|
if (this.$route.params.ruleId != 0 && this.ruleList.length == 0) {
|
||||||
});
|
await getExamLessonDetail(this.$route.params.ruleId).then(res => {
|
||||||
},
|
if (res.code == 200) {
|
||||||
async init() {
|
const arr = res.data.examDefinitionRulesVOList;
|
||||||
if (this.$route.params.ruleId != 0 && this.ruleList.length == 0) {
|
arr.forEach((ele, index) => {
|
||||||
await getExamLessonDetail(this.$route.params.ruleId).then(res => {
|
this.typeList.forEach(v => {
|
||||||
if (res.code == 200) {
|
if (ele.trainingType == v.code) {
|
||||||
const arr = res.data.examDefinitionRulesVOList;
|
arr[index].name = v.name;
|
||||||
arr.forEach((ele, index) => {
|
if (ele.operateType) {
|
||||||
this.typeList.forEach(v => {
|
this.trainingOperateTypeMap[ele.trainingType].forEach(item => {
|
||||||
if (ele.trainingType == v.code) {
|
if (item.code == ele.operateType) {
|
||||||
arr[index].name = v.name;
|
arr[index].name = `${v.name}-${item.name}`;
|
||||||
if (ele.operateType) {
|
return;
|
||||||
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.ruleList = arr;
|
});
|
||||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
this.changeCourseDisable();
|
||||||
this.ruleList.forEach(res => {
|
}
|
||||||
res.chapterIdLong = Number(res.num) * Number(res.point);
|
});
|
||||||
});
|
}
|
||||||
this.changeCourseDisable();
|
},
|
||||||
}
|
handleAdd() {
|
||||||
});
|
this.$refs.addRule.show();
|
||||||
}
|
},
|
||||||
},
|
async creatOk() {
|
||||||
handleAdd() {
|
if (this.ruleList.length) {
|
||||||
this.$refs.addRule.show();
|
let flag = 0;
|
||||||
},
|
this.ruleList.forEach(res => {
|
||||||
async creatOk() {
|
flag += Number(res.chapterIdLong);
|
||||||
if (this.ruleList.length) {
|
});
|
||||||
let flag = 0;
|
if (flag == this.course.fullMark) {
|
||||||
this.ruleList.forEach(res => {
|
const result = {
|
||||||
flag += Number(res.chapterIdLong);
|
duration: Number(this.course.duration) * 60, // 时长
|
||||||
});
|
examDefinitionRulesVOList: this.ruleList, // 规则
|
||||||
if (flag == this.course.fullMark) {
|
fullPoint: Number(this.course.fullMark), // 满分
|
||||||
const result = {
|
lessonId: this.course.region, // 课程id
|
||||||
duration: Number(this.course.duration) * 60, // 时长
|
name: this.course.name, // 名称
|
||||||
examDefinitionRulesVOList: this.ruleList, // 规则
|
passingPoint: Number(this.course.passMark), // 及格分
|
||||||
fullPoint: Number(this.course.fullMark), // 满分
|
remarks: this.course.desc, // 考试说明
|
||||||
lessonId: this.course.region, // 课程id
|
endTime: this.course.endDate,
|
||||||
name: this.course.name, // 名称
|
startTime: this.course.startDate,
|
||||||
passingPoint: Number(this.course.passMark), // 及格分
|
type: this.course.type, // 类型
|
||||||
remarks: this.course.desc, // 考试说明
|
trial: this.course.trial == 2 // 权限判断
|
||||||
endTime: this.course.endDate,
|
};
|
||||||
startTime: this.course.startDate,
|
await this.save(result);
|
||||||
type: this.course.type, // 类型
|
} else {
|
||||||
trial: this.course.trial == 2 // 权限判断
|
this.$messageBox(this.$t('publish.addExamRluesError'));
|
||||||
};
|
}
|
||||||
await this.save(result);
|
} else {
|
||||||
} else {
|
this.$messageBox(this.$t('publish.addExamRules'));
|
||||||
this.$messageBox(this.$t('publish.addExamRluesError'));
|
}
|
||||||
}
|
},
|
||||||
} else {
|
save(data) {
|
||||||
this.$messageBox(this.$t('publish.addExamRules'));
|
setCourseList(data).then(res => {
|
||||||
}
|
this.$message.success({ message: res.message });
|
||||||
},
|
this.$store.dispatch('exam/setCourseDetail', this.formDetail); // 清空 form 表单数据
|
||||||
save(data) {
|
this.$store.dispatch('exam/setRuleList', []); // 清空规则列表数据
|
||||||
setCourseList(data).then(res => {
|
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`;
|
||||||
this.$message.success({ message: res.message });
|
const lessonId = this.$route.params.lessonId;
|
||||||
this.$store.dispatch('exam/setCourseDetail', this.formDetail); // 清空 form 表单数据
|
if (parseInt(lessonId)) {
|
||||||
this.$store.dispatch('exam/setRuleList', []); // 清空规则列表数据
|
this.$router.push({ path: `${path}`, query: { lessonId: lessonId } });
|
||||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`;
|
} else {
|
||||||
const lessonId = this.$route.params.lessonId;
|
this.$router.push({ path: `${path}` });
|
||||||
if (parseInt(lessonId)) {
|
}
|
||||||
this.$router.push({ path: `${path}`, query: { lessonId: lessonId } });
|
}).catch(error => {
|
||||||
} else {
|
this.$messageBox(`${this.$t('publish.saveRuleFailed')} ${error.message}`);
|
||||||
this.$router.push({ path: `${path}` });
|
});
|
||||||
}
|
},
|
||||||
}).catch(error => {
|
addRuleList(data) {
|
||||||
this.$messageBox(`${this.$t('publish.saveRuleFailed')} ${error.message}`);
|
var arr = this.$store.state.exam.courseList;
|
||||||
});
|
let value;
|
||||||
},
|
arr.forEach(res => {
|
||||||
addRuleList(data) {
|
if (res.code == data.course) {
|
||||||
var arr = this.$store.state.exam.courseList;
|
value = res;
|
||||||
let value;
|
return value;
|
||||||
arr.forEach(res => {
|
}
|
||||||
if (res.code == data.course) {
|
});
|
||||||
value = res;
|
let titleName = value.name;
|
||||||
return value;
|
if (data.name) {
|
||||||
}
|
titleName = `${value.name}-${data.name}`;
|
||||||
});
|
}
|
||||||
let titleName = value.name;
|
const element = {
|
||||||
if (data.name) {
|
trainingType: data.course,
|
||||||
titleName = `${value.name}-${data.name}`;
|
operateType: data.operateType,
|
||||||
}
|
num: Number(data.number),
|
||||||
const element = {
|
point: Number(data.mark),
|
||||||
trainingType: data.course,
|
name: titleName,
|
||||||
operateType: data.operateType,
|
chapterIdLong: Number(data.number) * Number(data.mark)
|
||||||
num: Number(data.number),
|
};
|
||||||
point: Number(data.mark),
|
this.ruleList.push(element);
|
||||||
name: titleName,
|
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||||
chapterIdLong: Number(data.number) * Number(data.mark)
|
this.changeCourseDisable();
|
||||||
};
|
},
|
||||||
this.ruleList.push(element);
|
// 判断类型是否选择过
|
||||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
changeCourseDisable() {
|
||||||
this.changeCourseDisable();
|
const arr = this.$store.state.exam.courseList;
|
||||||
},
|
this.ruleList.forEach(ele => {
|
||||||
// 判断类型是否选择过
|
arr.forEach(res => {
|
||||||
changeCourseDisable() {
|
if (ele.trainingType == res.code && !ele.operateType) {
|
||||||
const arr = this.$store.state.exam.courseList;
|
res.disabled = true;
|
||||||
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 => {
|
||||||
editRuleList(data) {
|
if (res.code == data.course) {
|
||||||
var arr = this.$store.state.exam.courseList;
|
value = res;
|
||||||
let value;
|
return value;
|
||||||
arr.forEach(res => {
|
}
|
||||||
if (res.code == data.course) {
|
});
|
||||||
value = res;
|
let titleName = value.name;
|
||||||
return value;
|
if (data.name) {
|
||||||
}
|
titleName = `${value.name}-${data.name}`;
|
||||||
});
|
}
|
||||||
let titleName = value.name;
|
const element = {
|
||||||
if (data.name) {
|
trainingType: data.course,
|
||||||
titleName = `${value.name}-${data.name}`;
|
operateType: data.operateType,
|
||||||
}
|
num: Number(data.number),
|
||||||
const element = {
|
point: Number(data.mark),
|
||||||
trainingType: data.course,
|
name: titleName,
|
||||||
operateType: data.operateType,
|
chapterIdLong: data.number * data.mark
|
||||||
num: Number(data.number),
|
};
|
||||||
point: Number(data.mark),
|
this.ruleList.splice(this.indexCourse, 1, element);
|
||||||
name: titleName,
|
},
|
||||||
chapterIdLong: data.number * data.mark
|
handleForm(data) {
|
||||||
};
|
// 子元素监听 editCourse 每次改变值
|
||||||
this.ruleList.splice(this.indexCourse, 1, element);
|
this.indexCourse = data.$index;
|
||||||
},
|
const list = JSON.stringify(data.row);
|
||||||
handleForm(data) {
|
const detail = JSON.parse(list);
|
||||||
// 子元素监听 editCourse 每次改变值
|
var arr = this.$store.state.exam.courseList;
|
||||||
this.indexCourse = data.$index;
|
arr.forEach(res => {
|
||||||
const list = JSON.stringify(data.row);
|
if (res.name == detail.name) {
|
||||||
const detail = JSON.parse(list);
|
detail.name = res.id;
|
||||||
var arr = this.$store.state.exam.courseList;
|
return detail.name;
|
||||||
arr.forEach(res => {
|
}
|
||||||
if (res.name == detail.name) {
|
});
|
||||||
detail.name = res.id;
|
this.editCourse = detail;
|
||||||
return detail.name;
|
this.handleAdd();
|
||||||
}
|
},
|
||||||
});
|
deleteForm(data) {
|
||||||
this.editCourse = detail;
|
const index = data.$index;
|
||||||
this.handleAdd();
|
this.ruleList.splice(index, 1);
|
||||||
},
|
this.$refs.addRule.changeListDisabled(data.row.trainingType);
|
||||||
deleteForm(data) {
|
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||||
const index = data.$index;
|
},
|
||||||
this.ruleList.splice(index, 1);
|
regulation() {
|
||||||
this.$refs.addRule.changeListDisabled(data.row.trainingType);
|
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
this.$emit('regulation', this.course);
|
||||||
},
|
}
|
||||||
regulation() {
|
}
|
||||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
|
||||||
this.$emit('regulation', this.course);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
@ -1,20 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card>
|
<div class="joylink-card">
|
||||||
<div v-if="lessonName" slot="header" style="text-align: center;">
|
<div v-if="lessonName" class="card-title">
|
||||||
<b>{{ $t('publish.lessonName') }}: {{ lessonName }}</b>
|
<b>{{ $t('publish.lessonName') }}: {{ lessonName }}</b>
|
||||||
</div>
|
</div>
|
||||||
<div :style="{ height: height +'px' }">
|
<div :style="{ 'height': lessonName ? 'calc(100% - 47px)' : '100%' }">
|
||||||
<el-scrollbar wrap-class="scrollbar-wrapper" style="">
|
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||||
<QueryListPage
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||||
ref="queryListPage"
|
|
||||||
:pager-config="pagerConfig"
|
|
||||||
:query-form="queryForm"
|
|
||||||
:query-list="queryList"
|
|
||||||
style="height: 100%;"
|
|
||||||
/>
|
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -23,307 +17,311 @@ import { getPublishLessonList } from '@/api/jmap/lesson';
|
|||||||
import { UrlConfig } from '@/router/index';
|
import { UrlConfig } from '@/router/index';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'List',
|
name: 'List',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
BizTypeList: [],
|
BizTypeList: [],
|
||||||
OrderTypeList: [],
|
OrderTypeList: [],
|
||||||
PayTypeList: [],
|
PayTypeList: [],
|
||||||
PayStatusList: [],
|
PayStatusList: [],
|
||||||
OrganizationList: [],
|
OrganizationList: [],
|
||||||
EffectiveTypeList: [],
|
EffectiveTypeList: [],
|
||||||
userId: this.$store.state.user.id,
|
userId: this.$store.state.user.id,
|
||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
pageSize: 'pageSize',
|
pageSize: 'pageSize',
|
||||||
pageIndex: 'pageNum'
|
pageIndex: 'pageNum'
|
||||||
},
|
},
|
||||||
lessonName: '',
|
lessonName: '',
|
||||||
queryForm: {
|
queryForm: {
|
||||||
labelWidth: '160px',
|
labelWidth: '160px',
|
||||||
queryObject: {
|
queryObject: {
|
||||||
'lessonId': {
|
'lessonId': {
|
||||||
type: this.$route.query.lessonId ? '' : 'select',
|
type: this.$route.query.lessonId ? '' : 'select',
|
||||||
label: this.$t('publish.lessonName'),
|
label: this.$t('publish.lessonName'),
|
||||||
config: {
|
config: {
|
||||||
data: []
|
data: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'name': {
|
'name': {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
label: this.$t('publish.paperName')
|
label: this.$t('publish.paperName')
|
||||||
},
|
},
|
||||||
'creatorName': {
|
'creatorName': {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
label: this.$t('publish.creator')
|
label: this.$t('publish.creator')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reset: !this.$route.query.lessonId
|
reset: !this.$route.query.lessonId
|
||||||
},
|
},
|
||||||
queryList: {
|
queryList: {
|
||||||
query: this.queryFunction,
|
query: this.queryFunction,
|
||||||
selectCheckShow: false,
|
selectCheckShow: false,
|
||||||
indexShow: true,
|
indexShow: true,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title: this.$t('publish.lessonName'),
|
title: this.$t('publish.lessonName'),
|
||||||
prop: 'lessonId',
|
prop: 'lessonId',
|
||||||
type: 'tag',
|
type: 'tag',
|
||||||
show: !this.$route.query.lessonId,
|
show: !this.$route.query.lessonId,
|
||||||
columnValue: (row) => { return this.$convertField(row.lessonId, this.OrganizationList, ['id', 'name']); },
|
columnValue: (row) => { return this.$convertField(row.lessonId, this.OrganizationList, ['id', 'name']); },
|
||||||
tagType: (row) => { return ''; }
|
tagType: (row) => { return ''; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('publish.paperName'),
|
title: this.$t('publish.paperName'),
|
||||||
prop: 'name'
|
prop: 'name'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('publish.creator'),
|
title: this.$t('publish.creator'),
|
||||||
prop: 'creatorName'
|
prop: 'creatorName'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('global.isTry'),
|
title: this.$t('global.isTry'),
|
||||||
prop: 'trial',
|
prop: 'trial',
|
||||||
type: 'tag',
|
type: 'tag',
|
||||||
columnValue: (row) => { return this.$ConstSelect.translate(row.trial, 'Whether'); },
|
columnValue: (row) => { return this.$ConstSelect.translate(row.trial, 'Whether'); },
|
||||||
tagType: (row) => {
|
tagType: (row) => {
|
||||||
switch (row.trial) {
|
switch (row.trial) {
|
||||||
case true: return 'success';
|
case true: return 'success';
|
||||||
case false: return 'danger';
|
case false: return 'danger';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('global.duration'),
|
title: this.$t('global.duration'),
|
||||||
prop: 'duration',
|
prop: 'duration',
|
||||||
type: 'tag',
|
type: 'tag',
|
||||||
columnValue: (row) => { return this.durationField(row.duration); },
|
columnValue: (row) => { return this.durationField(row.duration); },
|
||||||
tagType: (row) => { return ''; }
|
tagType: (row) => { return ''; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('publish.examTime'),
|
title: this.$t('publish.examTime'),
|
||||||
prop: 'startTime',
|
prop: 'startTime',
|
||||||
type: 'formatter',
|
type: 'formatter',
|
||||||
format: 'yyyy-MM-dd hh:ss'
|
format: 'yyyy-MM-dd hh:ss'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('publish.fullMark'),
|
title: this.$t('publish.fullMark'),
|
||||||
prop: 'fullPoint'
|
prop: 'fullPoint'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('publish.passScore'),
|
title: this.$t('publish.passScore'),
|
||||||
prop: 'passingPoint'
|
prop: 'passingPoint'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('global.status'),
|
title: this.$t('global.status'),
|
||||||
prop: 'status',
|
prop: 'status',
|
||||||
type: 'tag',
|
type: 'tag',
|
||||||
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
|
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
|
||||||
tagType: (row) => {
|
tagType: (row) => {
|
||||||
switch (row.status) {
|
switch (row.status) {
|
||||||
case '1': return 'success';
|
case '1': return 'success';
|
||||||
default: return 'danger';
|
default: return 'danger';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
title: this.$t('global.operate'),
|
title: this.$t('global.operate'),
|
||||||
width: '380',
|
width: '380',
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
name: this.$t('global.fastCreate'),
|
name: this.$t('global.fastCreate'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
handleClick: this.handleDistribute,
|
handleClick: this.handleDistribute,
|
||||||
showControl: (row) => { return row.bizType !== '02'; }
|
showControl: (row) => { return row.bizType !== '02'; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: this.$t('global.edit'),
|
name: this.$t('global.edit'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
showControl: (row) => { return row.creatorId == this.userId; },
|
showControl: (row) => { return row.creatorId == this.userId; },
|
||||||
handleClick: this.handleUpdate
|
handleClick: this.handleUpdate
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: this.$t('global.soldOut'),
|
name: this.$t('global.soldOut'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
handleClick: this.handleEfficacy,
|
handleClick: this.handleEfficacy,
|
||||||
showControl: (row) => {
|
showControl: (row) => {
|
||||||
return !this.$route.query.lessonId && row.status == 1;
|
return !this.$route.query.lessonId && row.status == 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: this.$t('publish.lessonDeleteBtn'),
|
name: this.$t('publish.lessonDeleteBtn'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
handleClick: this.handleDelete,
|
handleClick: this.handleDelete,
|
||||||
showControl: (row) => {
|
showControl: (row) => {
|
||||||
return this.$route.query.lessonId && row.status == 1 && row.creatorId == this.userId;
|
return this.$route.query.lessonId && row.status == 1 && row.creatorId == this.userId;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: this.$t('global.putaway'),
|
name: this.$t('global.putaway'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
handleClick: this.handleEffective,
|
handleClick: this.handleEffective,
|
||||||
showControl: (row) => {
|
showControl: (row) => {
|
||||||
return (this.$route.query.lessonId ? row.creatorId == this.userId : true) && row.status != 1;
|
return (this.$route.query.lessonId ? row.creatorId == this.userId : true) && row.status != 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: this.$t('global.delete'),
|
name: this.$t('global.delete'),
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
handleClick: this.deleteList,
|
handleClick: this.deleteList,
|
||||||
showControl: (row) => { return row.creatorId == this.userId; }
|
showControl: (row) => { return row.creatorId == this.userId; }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
{ text: this.$t('global.add'), btnCode: 'employee_insert', handler: this.handleNormalAdd },
|
{ text: this.$t('global.add'), btnCode: 'employee_insert', handler: this.handleNormalAdd },
|
||||||
{ text: this.$t('global.back'), btnCode: 'employee_back', handler: this.handlerBack }
|
{ text: this.$t('global.back'), btnCode: 'employee_back', handler: this.handlerBack }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
created() {
|
||||||
height() {
|
this.loadInitData();
|
||||||
return /\/exam\//.test(`${this.$route.path}`)? this.$store.state.app.height - 92: this.$store.state.app.height - 65;
|
},
|
||||||
}
|
mounted() {
|
||||||
},
|
this.$store.dispatch('exam/setCourseDetail', {});
|
||||||
created() {
|
this.$store.dispatch('exam/setRuleList', []);
|
||||||
this.loadInitData();
|
},
|
||||||
},
|
methods: {
|
||||||
mounted() {
|
loadInitData() {
|
||||||
this.$store.dispatch('exam/setCourseDetail', {});
|
this.queryForm.queryObject.lessonId.config.data.length = 0;
|
||||||
this.$store.dispatch('exam/setRuleList', []);
|
getPublishLessonList().then(response => {
|
||||||
},
|
this.OrganizationList = response.data;
|
||||||
methods: {
|
this.OrganizationList.forEach(elem => {
|
||||||
loadInitData() {
|
if (elem.id == this.$route.query.lessonId) {
|
||||||
this.queryForm.queryObject.lessonId.config.data.length = 0;
|
this.lessonName = elem.name;
|
||||||
getPublishLessonList().then(response => {
|
}
|
||||||
this.OrganizationList = response.data;
|
this.queryForm.queryObject.lessonId.config.data.push({ value: elem.id, label: elem.name });
|
||||||
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.$Dictionary.effectiveType().then(list => {
|
||||||
this.$convertList(list, this.EffectiveTypeList, elem => {
|
this.$convertList(list, this.EffectiveTypeList, elem => {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
durationField(fieldValue) {
|
durationField(fieldValue) {
|
||||||
if (fieldValue) {
|
if (fieldValue) {
|
||||||
const time = Number(fieldValue) / 60;
|
const time = Number(fieldValue) / 60;
|
||||||
return `${time} ${this.$t('publish.durationMinutes')}`;
|
return `${time} ${this.$t('publish.durationMinutes')}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
queryFunction(params) {
|
queryFunction(params) {
|
||||||
if (this.$route.query.lessonId) {
|
if (this.$route.query.lessonId) {
|
||||||
params.lessonId = this.$route.query.lessonId;
|
params.lessonId = this.$route.query.lessonId;
|
||||||
params.status = '1';
|
params.status = '1';
|
||||||
}
|
}
|
||||||
return getExamList(params);
|
return getExamList(params);
|
||||||
},
|
},
|
||||||
handleNormalAdd() {
|
handleNormalAdd() {
|
||||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
||||||
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
||||||
this.$router.push({ path: `${path}/add/0/${lessonId}` });
|
this.$router.push({ path: `${path}/add/0/${lessonId}` });
|
||||||
},
|
},
|
||||||
handleUpdate(index, data) {
|
handleUpdate(index, data) {
|
||||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
||||||
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
||||||
this.$router.push({ path: `${path}/edit/${data.id}/${lessonId}` });
|
this.$router.push({ path: `${path}/edit/${data.id}/${lessonId}` });
|
||||||
},
|
},
|
||||||
handleDistribute(index, data) {
|
handleDistribute(index, data) {
|
||||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
||||||
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
||||||
this.$router.push({ path: `${path}/add/${data.id}/${lessonId}` });
|
this.$router.push({ path: `${path}/add/${data.id}/${lessonId}` });
|
||||||
},
|
},
|
||||||
// 删除
|
// 删除
|
||||||
deleteList(index, data) {
|
deleteList(index, data) {
|
||||||
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
||||||
confirmButtonText: this.$t('global.confirm'),
|
confirmButtonText: this.$t('global.confirm'),
|
||||||
cancelButtonText: this.$t('global.cancel'),
|
cancelButtonText: this.$t('global.cancel'),
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
deleteExam(data).then(res => {
|
deleteExam(data).then(res => {
|
||||||
this.queryList.reload();
|
this.queryList.reload();
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: this.$t('publish.setSuccess')
|
message: this.$t('publish.setSuccess')
|
||||||
});
|
});
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
if (res.code == '500009') {
|
if (res.code == '500009') {
|
||||||
this.$message({ type: 'warning', message: this.$t('error.paperHasUseNotDel') });
|
this.$message({ type: 'warning', message: this.$t('error.paperHasUseNotDel') });
|
||||||
} else {
|
} else {
|
||||||
this.$message({ type: 'error', message: this.$t('error.deleteException') });
|
this.$message({ type: 'error', message: this.$t('error.deleteException') });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch(() => { });
|
}).catch(() => { });
|
||||||
},
|
},
|
||||||
// 下架
|
// 下架
|
||||||
handleDelete(index, data) {
|
handleDelete(index, data) {
|
||||||
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
||||||
confirmButtonText: this.$t('global.confirm'),
|
confirmButtonText: this.$t('global.confirm'),
|
||||||
cancelButtonText: this.$t('global.cancel'),
|
cancelButtonText: this.$t('global.cancel'),
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setExamEfficacy(data).then(res => {
|
setExamEfficacy(data).then(res => {
|
||||||
this.queryList.reload();
|
this.queryList.reload();
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: this.$t('publish.setSuccess')
|
message: this.$t('publish.setSuccess')
|
||||||
});
|
});
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
||||||
});
|
});
|
||||||
}).catch(() => { });
|
}).catch(() => { });
|
||||||
},
|
},
|
||||||
// 下架
|
// 下架
|
||||||
handleEfficacy(index, data) {
|
handleEfficacy(index, data) {
|
||||||
this.$confirm(this.$t('publish.wellSoldOutPaper'), this.$t('global.tips'), {
|
this.$confirm(this.$t('publish.wellSoldOutPaper'), this.$t('global.tips'), {
|
||||||
confirmButtonText: this.$t('global.confirm'),
|
confirmButtonText: this.$t('global.confirm'),
|
||||||
cancelButtonText: this.$t('global.cancel'),
|
cancelButtonText: this.$t('global.cancel'),
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setExamEfficacy(data).then(res => {
|
setExamEfficacy(data).then(res => {
|
||||||
this.queryList.reload();
|
this.queryList.reload();
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: this.$t('publish.setSuccess')
|
message: this.$t('publish.setSuccess')
|
||||||
});
|
});
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
||||||
});
|
});
|
||||||
}).catch(() => { });
|
}).catch(() => { });
|
||||||
},
|
},
|
||||||
// 上架
|
// 上架
|
||||||
handleEffective(index, data) {
|
handleEffective(index, data) {
|
||||||
this.$confirm(this.$t('publish.wellPutawayPaper'), this.$t('global.tips'), {
|
this.$confirm(this.$t('publish.wellPutawayPaper'), this.$t('global.tips'), {
|
||||||
confirmButtonText: this.$t('global.confirm'),
|
confirmButtonText: this.$t('global.confirm'),
|
||||||
cancelButtonText: this.$t('global.cancel'),
|
cancelButtonText: this.$t('global.cancel'),
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setExamEffectivey(data).then(res => {
|
setExamEffectivey(data).then(res => {
|
||||||
this.queryList.reload();
|
this.queryList.reload();
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: this.$t('publish.setSuccess')
|
message: this.$t('publish.setSuccess')
|
||||||
});
|
});
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
||||||
});
|
});
|
||||||
}).catch(() => { });
|
}).catch(() => { });
|
||||||
},
|
},
|
||||||
handlerBack() {
|
handlerBack() {
|
||||||
this.$router.back();
|
this.$router.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<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/ {
|
/deep/ {
|
||||||
.is-always-shadow {
|
.is-always-shadow {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
Loading…
Reference in New Issue
Block a user