Merge branch 'dev' of https://git.qcloud.com/joylink/jl-nclient into dev
# Conflicts: # src/router/index.js # src/views/lesson/lessoncategory/edit/lesson/index.vue
This commit is contained in:
commit
24a56a9695
File diff suppressed because one or more lines are too long
@ -12,297 +12,296 @@ const renderer = 'canvas';
|
||||
const devicePixelRatio = 1;
|
||||
|
||||
class IbpPan {
|
||||
constructor(opts) {
|
||||
this.methods = opts.methods;
|
||||
constructor(opts) {
|
||||
this.methods = opts.methods;
|
||||
|
||||
// 鼠标事件
|
||||
this.events = { __Pan: 'pan', Selected: 'selected', Contextmenu: 'contextmenu'};
|
||||
// 鼠标事件
|
||||
this.events = { __Pan: 'pan', Selected: 'selected', Contextmenu: 'contextmenu'};
|
||||
|
||||
// 设备数据
|
||||
this.ibpDevice = {};
|
||||
// 设备数据
|
||||
this.ibpDevice = {};
|
||||
|
||||
// 展示的画布大小
|
||||
this.canvasSize = {};
|
||||
// 展示的画布大小
|
||||
this.canvasSize = {};
|
||||
|
||||
this.initIbpPage(opts);
|
||||
}
|
||||
initIbpPage(opts) {
|
||||
const width = opts.config.width;
|
||||
const height = opts.config.height;
|
||||
this.isAllowDragging=false;
|
||||
this.$ibpZr = zrender.init(opts.dom, Object.assign({ renderer, devicePixelRatio, width, height }, opts.config));
|
||||
this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {})); // 缩放
|
||||
this.$mouseController = new MouseController(this);
|
||||
this.initIbpPage(opts);
|
||||
}
|
||||
initIbpPage(opts) {
|
||||
const width = opts.config.width;
|
||||
const height = opts.config.height;
|
||||
this.isAllowDragging = false;
|
||||
this.$ibpZr = zrender.init(opts.dom, Object.assign({ renderer, devicePixelRatio, width, height }, opts.config));
|
||||
this.$options = new Options(Object.assign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {})); // 缩放
|
||||
this.$mouseController = new MouseController(this);
|
||||
|
||||
this.$mouseController.enable();
|
||||
this.$mouseController.enable();
|
||||
|
||||
this.$painter = new Painter(this);
|
||||
this.$painter.updateZrSize({width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight()});
|
||||
this.$painter.updateTransform(this.$options, this.canvasSize);
|
||||
this.$painter = new Painter(this);
|
||||
this.$painter.updateZrSize({width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight()});
|
||||
this.$painter.updateTransform(this.$options, this.canvasSize);
|
||||
|
||||
this.optionsHandler = this.setOptions.bind(this);
|
||||
this.optionsHandler = this.setOptions.bind(this);
|
||||
|
||||
this.$mouseController.on(this.events.__Pan, this.optionsHandler);
|
||||
}
|
||||
this.$mouseController.on(this.events.__Pan, this.optionsHandler);
|
||||
}
|
||||
|
||||
setMap(config, ibpDevice) {
|
||||
// 保存平移缩放数据
|
||||
if (config.config) {
|
||||
this.$options.scaleRate = config.scaling;
|
||||
this.$options.offsetX = config.origin.x;
|
||||
this.$options.offsetY = config.origin.y;
|
||||
}
|
||||
setMap(config, ibpDevice) {
|
||||
// 保存平移缩放数据
|
||||
if (config.config) {
|
||||
this.$options.scaleRate = config.scaling;
|
||||
this.$options.offsetX = config.origin.x;
|
||||
this.$options.offsetY = config.origin.y;
|
||||
}
|
||||
|
||||
// 保存原始数据
|
||||
this.data = config;
|
||||
// 保存原始数据
|
||||
this.data = config;
|
||||
|
||||
// 保存需展现的画布大小
|
||||
this.canvasSize = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: config.background.width,
|
||||
height: config.background.height
|
||||
};
|
||||
// 保存需展现的画布大小
|
||||
this.canvasSize = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: config.background.width,
|
||||
height: config.background.height
|
||||
};
|
||||
|
||||
// 地图数据
|
||||
this.ibpDevice = ibpDevice;
|
||||
// 地图数据
|
||||
this.ibpDevice = ibpDevice;
|
||||
|
||||
// 数据加载完成 回调
|
||||
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.ibpDevice); }
|
||||
// 数据加载完成 回调
|
||||
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.ibpDevice); }
|
||||
|
||||
// 初次渲染视图
|
||||
this.$painter.repaint(this.ibpDevice);
|
||||
// 初次渲染视图
|
||||
this.$painter.repaint(this.ibpDevice);
|
||||
|
||||
// 视图加载完成 回调
|
||||
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.ibpDevice); }
|
||||
// 视图加载完成 回调
|
||||
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(this.ibpDevice); }
|
||||
|
||||
this.$painter.updateTransform(this.$options, this.canvasSize);
|
||||
}
|
||||
this.$painter.updateTransform(this.$options, this.canvasSize);
|
||||
}
|
||||
|
||||
setDefaultState() {
|
||||
const list = [];
|
||||
Object.values(this.mapDevice).forEach(elem => {
|
||||
const type = elem.model._type;
|
||||
list.push(deviceFactory(type, Object.assign(elem.model, this.defaultStateDict[type]) ));
|
||||
});
|
||||
setDefaultState() {
|
||||
const list = [];
|
||||
Object.values(this.mapDevice).forEach(elem => {
|
||||
const type = elem.model._type;
|
||||
list.push(deviceFactory(type, Object.assign(elem.model, this.defaultStateDict[type]) ));
|
||||
});
|
||||
|
||||
this.update(list);
|
||||
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
|
||||
}
|
||||
this.update(list);
|
||||
if (this.methods.stateLoaded instanceof Function) { this.methods.stateLoaded(list); }
|
||||
}
|
||||
|
||||
setOptions(opts) {
|
||||
const options = this.pullBack(opts);
|
||||
this.$options.update(options);
|
||||
this.$painter.updateTransform(this.$options, this.canvasSize);
|
||||
setOptions(opts) {
|
||||
const options = this.pullBack(opts);
|
||||
this.$options.update(options);
|
||||
this.$painter.updateTransform(this.$options, this.canvasSize);
|
||||
|
||||
if (this.$options.disabled == true) {
|
||||
this.$mouseController.disable();
|
||||
} else {
|
||||
this.$mouseController.enable(opts);
|
||||
}
|
||||
if (this.$options.disabled == true) {
|
||||
this.$mouseController.disable();
|
||||
} else {
|
||||
this.$mouseController.enable(opts);
|
||||
}
|
||||
|
||||
if (this.methods.optionsUpdate instanceof Function) { this.methods.optionsUpdate(this.$options); }
|
||||
}
|
||||
if (this.methods.optionsUpdate instanceof Function) { this.methods.optionsUpdate(this.$options); }
|
||||
}
|
||||
|
||||
setCenter(deviceCode) {
|
||||
const device = this.ibpDevice[deviceCode];
|
||||
if (device && device.instance) {
|
||||
var rect = createBoundingRect(device.instance);
|
||||
var dcenter = calculateDCenter(rect, { width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight() });
|
||||
this.setOptions(dcenter);
|
||||
}
|
||||
}
|
||||
setCenter(deviceCode) {
|
||||
const device = this.ibpDevice[deviceCode];
|
||||
if (device && device.instance) {
|
||||
var rect = createBoundingRect(device.instance);
|
||||
var dcenter = calculateDCenter(rect, { width: this.$ibpZr.getWidth(), height: this.$ibpZr.getHeight() });
|
||||
this.setOptions(dcenter);
|
||||
}
|
||||
}
|
||||
|
||||
setLevelVisible(list) {
|
||||
this.$painter.setLevelVisible(list);
|
||||
}
|
||||
setLevelVisible(list) {
|
||||
this.$painter.setLevelVisible(list);
|
||||
}
|
||||
|
||||
render(list) {
|
||||
(list || []).forEach(elem => {
|
||||
const code = elem.code;
|
||||
const type = elem._type;
|
||||
if (type === deviceType.Background) {
|
||||
this.canvasSize = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: elem.width,
|
||||
height: elem.height
|
||||
};
|
||||
}
|
||||
updateIbpData(elem);
|
||||
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem);
|
||||
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
|
||||
delete this.ibpDevice[code];
|
||||
this.$painter.delete(oDevice);
|
||||
if (!elem._dispose) {
|
||||
this.ibpDevice[code] = nDevice;
|
||||
this.$painter.add(nDevice);
|
||||
}
|
||||
});
|
||||
if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); }
|
||||
}
|
||||
render(list) {
|
||||
(list || []).forEach(elem => {
|
||||
const code = elem.code;
|
||||
const type = elem._type;
|
||||
if (type === deviceType.Background) {
|
||||
this.canvasSize = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: elem.width,
|
||||
height: elem.height
|
||||
};
|
||||
}
|
||||
updateIbpData(elem);
|
||||
const oDevice = this.ibpDevice[code] || deviceFactory(type, elem);
|
||||
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
|
||||
delete this.ibpDevice[code];
|
||||
this.$painter.delete(oDevice);
|
||||
if (!elem._dispose) {
|
||||
this.ibpDevice[code] = nDevice;
|
||||
this.$painter.add(nDevice);
|
||||
}
|
||||
});
|
||||
if (this.methods.viewUpdate instanceof Function) { this.methods.viewUpdate(list); }
|
||||
}
|
||||
|
||||
// 中间处理
|
||||
hookHandle(model, elem) {
|
||||
const code = elem.code;
|
||||
const type = elem._type;
|
||||
// 如果是延时计时,需要保存计数值到全局
|
||||
if (type === deviceType.StationCounter) {
|
||||
let val = '' + elem.val;
|
||||
if (val === '0' || !elem.val) {
|
||||
val = elem.val = localStore.get(code) || '0';
|
||||
}
|
||||
// 中间处理
|
||||
hookHandle(model, elem) {
|
||||
const code = elem.code;
|
||||
const type = elem._type;
|
||||
// 如果是延时计时,需要保存计数值到全局
|
||||
if (type === deviceType.StationCounter) {
|
||||
let val = '' + elem.val;
|
||||
if (val === '0' || !elem.val) {
|
||||
val = elem.val = localStore.get(code) || '0';
|
||||
}
|
||||
|
||||
localStore(code, val);
|
||||
}
|
||||
for (var prop in elem) {
|
||||
if (elem[prop] != model[prop]) {
|
||||
Object.assign(model, elem);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
localStore(code, val);
|
||||
}
|
||||
for (var prop in elem) {
|
||||
if (elem[prop] != model[prop]) {
|
||||
Object.assign(model, elem);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
update(list) {
|
||||
(list || []).forEach(elem => {
|
||||
const code = elem.code;
|
||||
const oDevice = this.ibpDevice[code];
|
||||
if (elem.dispose) {
|
||||
this.$painter.delete(oDevice);
|
||||
} else {
|
||||
if (this.hookHandle(oDevice.model, elem)) {
|
||||
this.$painter.update(oDevice);
|
||||
}
|
||||
}
|
||||
});
|
||||
update(list) {
|
||||
(list || []).forEach(elem => {
|
||||
const code = elem.code;
|
||||
const oDevice = this.ibpDevice[code];
|
||||
if (elem.dispose) {
|
||||
this.$painter.delete(oDevice);
|
||||
} else {
|
||||
if (this.hookHandle(oDevice.model, elem)) {
|
||||
this.$painter.update(oDevice);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
|
||||
}
|
||||
setStatus(code, model) {
|
||||
const oDevcie = this.ibpDevice[code].instance;
|
||||
oDevcie.setStatus(model);
|
||||
}
|
||||
setDeviceStatus(list) {
|
||||
const deviceList = Object.values(this.ibpDevice);
|
||||
console.log(list, deviceList);
|
||||
deviceList.forEach(elem =>{
|
||||
(list || []).forEach(it =>{
|
||||
if (elem.model.linkDevice === it.code) {
|
||||
elem.instance.setStatus(it);
|
||||
}
|
||||
});
|
||||
});
|
||||
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
|
||||
}
|
||||
setStatus(code, model) {
|
||||
const oDevcie = this.ibpDevice[code].instance;
|
||||
oDevcie.setStatus(model);
|
||||
}
|
||||
setDeviceStatus(list) {
|
||||
const deviceList = Object.values(this.ibpDevice);
|
||||
deviceList.forEach(elem =>{
|
||||
(list || []).forEach(it =>{
|
||||
if (elem.model.linkDevice === it.code) {
|
||||
elem.instance.setStatus(it);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
drawIbpInit() {
|
||||
this.$mouseController.setAllowDragging(true);
|
||||
}
|
||||
}
|
||||
drawIbpInit() {
|
||||
this.$mouseController.setAllowDragging(true);
|
||||
}
|
||||
|
||||
pullBack(payload) {
|
||||
if (payload.type === 'zoom') {
|
||||
const zrWidth = this.$ibpZr.getWidth();
|
||||
const zrHeight = this.$ibpZr.getHeight();
|
||||
const originX = payload.originX || zrWidth / 2;
|
||||
const originY = payload.originY || zrHeight / 2;
|
||||
const x = (this.$options.offsetX + originX) / this.$options.scaleRate;
|
||||
const y = (this.$options.offsetY + originY) / this.$options.scaleRate;
|
||||
const newScaleRate = this.$options.getScaleRate(payload.scale);
|
||||
const dx = originX - (x * newScaleRate - this.$options.offsetX);
|
||||
const dy = originY - (y * newScaleRate - this.$options.offsetY);
|
||||
payload.dx = dx;
|
||||
payload.dy = dy;
|
||||
}
|
||||
pullBack(payload) {
|
||||
if (payload.type === 'zoom') {
|
||||
const zrWidth = this.$ibpZr.getWidth();
|
||||
const zrHeight = this.$ibpZr.getHeight();
|
||||
const originX = payload.originX || zrWidth / 2;
|
||||
const originY = payload.originY || zrHeight / 2;
|
||||
const x = (this.$options.offsetX + originX) / this.$options.scaleRate;
|
||||
const y = (this.$options.offsetY + originY) / this.$options.scaleRate;
|
||||
const newScaleRate = this.$options.getScaleRate(payload.scale);
|
||||
const dx = originX - (x * newScaleRate - this.$options.offsetX);
|
||||
const dy = originY - (y * newScaleRate - this.$options.offsetY);
|
||||
payload.dx = dx;
|
||||
payload.dy = dy;
|
||||
}
|
||||
|
||||
return payload || {};
|
||||
}
|
||||
return payload || {};
|
||||
}
|
||||
|
||||
getZr() {
|
||||
return this.$ibpZr;
|
||||
}
|
||||
getZr() {
|
||||
return this.$ibpZr;
|
||||
}
|
||||
|
||||
getEvents() {
|
||||
return this.events;
|
||||
}
|
||||
getEvents() {
|
||||
return this.events;
|
||||
}
|
||||
|
||||
getDeviceByCode(code) {
|
||||
return this.ibpDevice[code];
|
||||
}
|
||||
getDeviceByCode(code) {
|
||||
return this.ibpDevice[code];
|
||||
}
|
||||
|
||||
resize(opt) {
|
||||
this.$ibpZr.resize(opt);
|
||||
this.$painter.updateZrSize(opt);
|
||||
}
|
||||
resize(opt) {
|
||||
this.$ibpZr.resize(opt);
|
||||
this.$painter.updateZrSize(opt);
|
||||
}
|
||||
|
||||
refresh() {
|
||||
this.$painter.refresh();
|
||||
}
|
||||
clear() {
|
||||
this.skinCode = '';
|
||||
this.style = {};
|
||||
this.ibpDevice = {};
|
||||
this.$painter.clear();
|
||||
}
|
||||
initClockTime(initTime) {
|
||||
Object.values(this.ibpDevice)
|
||||
.forEach(elem => {
|
||||
if (elem.model._type === deviceType.Clock) {
|
||||
this.$painter.initClockTime(elem, initTime);
|
||||
}
|
||||
});
|
||||
}
|
||||
setClockStart(started) {
|
||||
Object.values(this.ibpDevice)
|
||||
.forEach(elem => {
|
||||
if (elem.model._type === deviceType.Clock) {
|
||||
this.$painter.setClockStart(elem, started);
|
||||
}
|
||||
});
|
||||
}
|
||||
dispose() {
|
||||
this.off(this.events.Pan, this.optionsHandler);
|
||||
this.off(this.events.Zoom, this.optionsHandler);
|
||||
refresh() {
|
||||
this.$painter.refresh();
|
||||
}
|
||||
clear() {
|
||||
this.skinCode = '';
|
||||
this.style = {};
|
||||
this.ibpDevice = {};
|
||||
this.$painter.clear();
|
||||
}
|
||||
initClockTime(initTime) {
|
||||
Object.values(this.ibpDevice)
|
||||
.forEach(elem => {
|
||||
if (elem.model._type === deviceType.Clock) {
|
||||
this.$painter.initClockTime(elem, initTime);
|
||||
}
|
||||
});
|
||||
}
|
||||
setClockStart(started) {
|
||||
Object.values(this.ibpDevice)
|
||||
.forEach(elem => {
|
||||
if (elem.model._type === deviceType.Clock) {
|
||||
this.$painter.setClockStart(elem, started);
|
||||
}
|
||||
});
|
||||
}
|
||||
dispose() {
|
||||
this.off(this.events.Pan, this.optionsHandler);
|
||||
this.off(this.events.Zoom, this.optionsHandler);
|
||||
|
||||
this.clear();
|
||||
this.clear();
|
||||
|
||||
this.$mouseController.dispose();
|
||||
this.$ibpZr && zrender.dispose(this.$ibpZr);
|
||||
this.$painter.dispose();
|
||||
}
|
||||
this.$mouseController.dispose();
|
||||
this.$ibpZr && zrender.dispose(this.$ibpZr);
|
||||
this.$painter.dispose();
|
||||
}
|
||||
|
||||
on(eventname, cb, context) {
|
||||
const idx = Object.values(this.events).indexOf(eventname);
|
||||
if (idx >= 0) {
|
||||
switch (eventname) {
|
||||
case this.events.Selected:
|
||||
this.$mouseController.on(this.events.Selected, cb, context);
|
||||
break;
|
||||
case this.events.Contextmenu:
|
||||
this.$mouseController.on(this.events.Contextmenu, cb, context);
|
||||
break;
|
||||
case this.events.DataZoom:
|
||||
this.$mouseController.on(this.events.DataZoom, cb, context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
on(eventname, cb, context) {
|
||||
const idx = Object.values(this.events).indexOf(eventname);
|
||||
if (idx >= 0) {
|
||||
switch (eventname) {
|
||||
case this.events.Selected:
|
||||
this.$mouseController.on(this.events.Selected, cb, context);
|
||||
break;
|
||||
case this.events.Contextmenu:
|
||||
this.$mouseController.on(this.events.Contextmenu, cb, context);
|
||||
break;
|
||||
case this.events.DataZoom:
|
||||
this.$mouseController.on(this.events.DataZoom, cb, context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
off(eventname, cb) {
|
||||
const idx = Object.values(this.events).indexOf(eventname);
|
||||
if (idx >= 0) {
|
||||
switch (eventname) {
|
||||
case this.events.Selected:
|
||||
this.$mouseController.off(this.events.Selected, cb);
|
||||
break;
|
||||
case this.events.Contextmenu:
|
||||
this.$mouseController.off(this.events.Contextmenu, cb);
|
||||
break;
|
||||
case this.events.DataZoom:
|
||||
this.$mouseController.off(this.events.DataZoom, cb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
off(eventname, cb) {
|
||||
const idx = Object.values(this.events).indexOf(eventname);
|
||||
if (idx >= 0) {
|
||||
switch (eventname) {
|
||||
case this.events.Selected:
|
||||
this.$mouseController.off(this.events.Selected, cb);
|
||||
break;
|
||||
case this.events.Contextmenu:
|
||||
this.$mouseController.off(this.events.Contextmenu, cb);
|
||||
break;
|
||||
case this.events.DataZoom:
|
||||
this.$mouseController.off(this.events.DataZoom, cb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
export default IbpPan;
|
||||
|
@ -10,7 +10,7 @@
|
||||
<!-- </el-scrollbar> -->
|
||||
</section>
|
||||
<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>
|
||||
</el-footer>
|
||||
</div>
|
||||
@ -21,47 +21,47 @@
|
||||
import { Navbar } from './components'; // Sidebar
|
||||
|
||||
export default {
|
||||
name: 'Layout',
|
||||
components: {
|
||||
Navbar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
sidebar() {
|
||||
return this.$store.state.app.sidebar;
|
||||
},
|
||||
device() {
|
||||
return this.$store.state.app.device;
|
||||
},
|
||||
classObj() {
|
||||
return {
|
||||
withoutAnimation: this.sidebar.withoutAnimation,
|
||||
mobile: this.device === 'mobile'
|
||||
};
|
||||
},
|
||||
width() {
|
||||
return this.$store.state.app.width;
|
||||
},
|
||||
height() {
|
||||
return this.$store.state.app.height - 90;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.watchRouterUpdate();
|
||||
},
|
||||
methods: {
|
||||
handleClickOutside() {
|
||||
this.$store.dispatch('CloseSideBar', { withoutAnimation: false });
|
||||
},
|
||||
watchRouterUpdate() {
|
||||
this.$router.beforeEach((to, from, next) => {
|
||||
next();
|
||||
});
|
||||
}
|
||||
}
|
||||
name: 'Layout',
|
||||
components: {
|
||||
Navbar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
sidebar() {
|
||||
return this.$store.state.app.sidebar;
|
||||
},
|
||||
device() {
|
||||
return this.$store.state.app.device;
|
||||
},
|
||||
classObj() {
|
||||
return {
|
||||
withoutAnimation: this.sidebar.withoutAnimation,
|
||||
mobile: this.device === 'mobile'
|
||||
};
|
||||
},
|
||||
width() {
|
||||
return this.$store.state.app.width;
|
||||
},
|
||||
height() {
|
||||
return this.$store.state.app.height - 90;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.watchRouterUpdate();
|
||||
},
|
||||
methods: {
|
||||
handleClickOutside() {
|
||||
this.$store.dispatch('CloseSideBar', { withoutAnimation: false });
|
||||
},
|
||||
watchRouterUpdate() {
|
||||
this.$router.beforeEach((to, from, next) => {
|
||||
next();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -18,14 +18,22 @@ import JointTraining from '@/views/jointTraining/index';
|
||||
import Error401 from '@/views/error-page/401';
|
||||
import Errpr404 from '@/views/error-page/404';
|
||||
|
||||
import SkinCode from '@/views/system/skinCode/index';
|
||||
import SkinCodeDraft from '@/views/system/skinCode/draft';
|
||||
import MapProduct from '@/views/system/product/index';
|
||||
import Dictionary from '@/views/system/dictionary/index';
|
||||
import DictionaryDetail from '@/views/system/dictionaryDetail/index';
|
||||
import UserControl from '@/views/system/userControl/index';
|
||||
import UserTraining from '@/views/system/userTraining/index';
|
||||
import UserExam from '@/views/system/userExam/index';
|
||||
import UserSimulation from '@/views/system/userSimulation/index';
|
||||
import ExistingSimulation from '@/views/system/existingSimulation/index';
|
||||
import CacheControl from '@/views/system/cacheControl/index';
|
||||
import Trainingrecord from '@/views/system/trainingrecord/index';
|
||||
import SystemGenerate from '@/views/system/systemGenerate/index';
|
||||
import IbpDraw from '@/views/system/ibpDraw/index';
|
||||
|
||||
import Mapedit from '@/views/mapdraft/index';
|
||||
|
||||
import Trainingrecord from '@/views/lesson/trainingrecord/index';
|
||||
import TrainingrecordManage from '@/views/lesson/trainingrecord/manage/index';
|
||||
import TrainingrecordManage from '@/views/lesson/trainingrecordmanage/index';
|
||||
import Taskmanage from '@/views/lesson/taskmanage/list';
|
||||
import TrainingRuleList from '@/views/lesson/trainingRule/list';
|
||||
import TrainingRuleEdit from '@/views/lesson/trainingRule/detail/index';
|
||||
@ -76,7 +84,6 @@ import RunplanView from '@/views/publish/runPlanEveryDay/runPlanView';
|
||||
import PublishExamRule from '@/views/publish/examRule/index';
|
||||
import PublishExamRuleDraft from '@/views/publish/examRule/draft/index';
|
||||
|
||||
import IbpEdit from '@/views/ibp/ibpDraft/ibpEdit/index';
|
||||
import TrainingPlatform from '@/views/trainingPlatform/index';
|
||||
|
||||
import Commodity from '@/views/orderauthor/commodity/index';
|
||||
@ -92,21 +99,10 @@ import PermissionCreate from '@/views/orderauthor/permission/create/index';
|
||||
import UserRules from '@/views/orderauthor/rules/index';
|
||||
import UserRulesDetail from '@/views/orderauthor/rules/detail';
|
||||
|
||||
import Dictionary from '@/views/management/dictionary/index';
|
||||
import DictionaryDetail from '@/views/management/dictionaryDetail/index';
|
||||
import UserControl from '@/views/management/userControl/index';
|
||||
import UserTraining from '@/views/management/userTraining/index';
|
||||
import UserExam from '@/views/management/userExam/index';
|
||||
import UserSimulation from '@/views/management/userSimulation/index';
|
||||
import ExistingSimulation from '@/views/management/existingSimulation/index';
|
||||
import CacheControl from '@/views/management/cacheControl/index';
|
||||
|
||||
import LessonApproval from '@/views/approval/lesson/index';
|
||||
import ScriptApproval from '@/views/approval/script/index';
|
||||
import RunPlanApproval from '@/views/approval/runPlan/index';
|
||||
|
||||
import SystemGenerate from '@/views/systemGenerate/index';
|
||||
|
||||
import { loginTitle } from '@/scripts/ConstDic';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
|
||||
@ -312,22 +308,12 @@ export const asyncRouter = [
|
||||
meta: {
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'map/draw/:mapId/:view',
|
||||
component: Mapedit,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'lesson/edit/:type',
|
||||
component: LessonEdit,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
{ // 运行图设计
|
||||
path: 'runPlan/detail/:mapId',
|
||||
component: PlanMonitorDetail,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
{ // 剧本
|
||||
path: 'script/home/:mapId',
|
||||
component: ScriptmanageHome,
|
||||
meta: {
|
||||
@ -335,13 +321,37 @@ export const asyncRouter = [
|
||||
},
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
{ // 课程列表
|
||||
path: 'lesson/home/:mapId',
|
||||
// /:skinCode
|
||||
component: LessonHome,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
{ // 操作定义
|
||||
path: 'lesson/trainingRule',
|
||||
component: TrainingRuleList,
|
||||
hidden: true
|
||||
},
|
||||
{ // 操作定义步骤
|
||||
path: 'lesson/trainingRule/detail',
|
||||
hidden: true,
|
||||
component: TrainingRuleEdit
|
||||
},
|
||||
{ // 任务管理
|
||||
path: 'lesson/taskManage',
|
||||
component: Taskmanage,
|
||||
hidden: true
|
||||
},
|
||||
{ // 实训管理
|
||||
path: 'lesson/trainingManage',
|
||||
component: Trainingmanage,
|
||||
hidden: true
|
||||
},
|
||||
{ // 创建课程
|
||||
path: 'lesson/edit/:type',
|
||||
component: LessonEdit,
|
||||
hidden: true
|
||||
},
|
||||
{ // 课程详情
|
||||
path: 'lesson/details',
|
||||
component: LessonDetail,
|
||||
hidden: true,
|
||||
@ -358,32 +368,7 @@ export const asyncRouter = [
|
||||
component: TrainingrecordManage,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'lesson/taskManage',
|
||||
component: Taskmanage,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'lesson/trainingRule',
|
||||
component: TrainingRuleList,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'lesson/trainingRule/detail',
|
||||
hidden: true,
|
||||
component: TrainingRuleEdit
|
||||
},
|
||||
{
|
||||
path: 'lesson/trainingManage',
|
||||
component: Trainingmanage,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'lesson/training/:trainingId/:trainingName',
|
||||
component: TrainingrecordManage,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
{ // 地图预览
|
||||
path: 'mapPreview/:mapId',
|
||||
component: MapPreview,
|
||||
hidden: true
|
||||
@ -416,38 +401,15 @@ export const asyncRouter = [
|
||||
meta: {
|
||||
}
|
||||
},
|
||||
{
|
||||
{ // 地图绘制
|
||||
path: 'map/draw/:mapId/:view',
|
||||
component: Mapedit,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'lesson/edit/:type',
|
||||
component: LessonEdit,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
{ // 运行图设计
|
||||
path: 'runPlan/detail/:mapId',
|
||||
component: PlanMonitorDetail,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'script/home/:mapId',
|
||||
component: ScriptmanageHome,
|
||||
meta: {
|
||||
i18n: 'router.scriptManage'
|
||||
},
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'lesson/home/:mapId',
|
||||
component: LessonHome,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'lesson/training/:trainingId/:trainingName',
|
||||
component: TrainingrecordManage,
|
||||
hidden: true
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -507,17 +469,17 @@ export const asyncRouter = [
|
||||
meta: {
|
||||
},
|
||||
children: [
|
||||
{
|
||||
{ // 仿真详情
|
||||
path: 'detail/:subSystem',
|
||||
component: DemonstrationDetail,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
{ // 教学系统 课程列表
|
||||
path: 'teachHome/:subSystem',
|
||||
component: TeachHome,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
{ // 课程详情
|
||||
path: 'teach/:subSystem',
|
||||
component: TeachDetail,
|
||||
hidden: true
|
||||
@ -774,21 +736,9 @@ export const asyncRouter = [
|
||||
roles: [admin, userDesign]
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'skinCode',
|
||||
component: SkinCode,
|
||||
meta: {
|
||||
i18n: 'router.skinManage'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'skinCode/draft/:mode/:skinCodeId',
|
||||
hidden: true,
|
||||
component: SkinCodeDraft
|
||||
},
|
||||
{
|
||||
path: 'ibp/edit',
|
||||
component: IbpEdit,
|
||||
component: IbpDraw,
|
||||
meta: {
|
||||
i18n: 'router.ibpDraw'
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ export function getBaseUrl() {
|
||||
let BASE_API;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||
BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
|
||||
} else {
|
||||
BASE_API = process.env.VUE_APP_BASE_API;
|
||||
|
@ -1,82 +0,0 @@
|
||||
<template>
|
||||
<transition name="el-zoom-in-center">
|
||||
<div class="mapPaint">
|
||||
<div class="map-view">
|
||||
<ibp-plate ref="ibpPlate" :size="size" />
|
||||
</div>
|
||||
<div class="map-draft">
|
||||
<ibp-operate ref="ibpOperate" @ibpChange="ibpChange" />
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
<script>
|
||||
import IbpPlate from '@/views/ibp/index';
|
||||
import IbpOperate from './ibpOperate/index';
|
||||
|
||||
export default {
|
||||
name: 'IbpView',
|
||||
components: {
|
||||
IbpPlate,
|
||||
IbpOperate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
size: {
|
||||
width: this.$store.state.app.width-521,
|
||||
height: this.$store.state.app.height - 60
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.$store.dispatch('config/resize', { width: this.$store.state.app.width - 521, height: this.$store.state.app.height - 60 });
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$store.dispatch('config/resize', { width: this.$store.state.app.width - 521, height: this.$store.state.app.height - 60 });
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.ibpPlate.show();
|
||||
this.$refs.ibpPlate.drawIbpInit();
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
ibpChange(stationCode) {
|
||||
this.$refs.ibpPlate.show(stationCode);
|
||||
this.$refs.ibpPlate.drawIbpInit();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.map-draft{
|
||||
/deep/{
|
||||
.v-modal{
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.map-view {
|
||||
float: left;
|
||||
width: 60%;
|
||||
}
|
||||
.mapPaint{
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.map-draft {
|
||||
float: right;
|
||||
width: 520px;
|
||||
|
||||
// /deep/ .el-scrollbar__view {
|
||||
// width: 510px !important;
|
||||
// height: calc(100% - 40px);
|
||||
// }
|
||||
}
|
||||
</style>
|
@ -1,213 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div :id="ibpId" :style="{ width: this.canvasWidth +'px', height: this.canvasHeight +'px',background:'#000' }" class="ibp-canvas" v-loading="loading" />
|
||||
<el-button v-if="showBackButton" class="ibp-button" type="primary" @click="back">{{$t('global.back')}}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import IbpPan from '@/ibp/ibpPan';
|
||||
import { parser } from '@/ibp/utils/parser';
|
||||
import ibpData from '@/ibp/constant/ibpData';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { exitFullscreen } from '@/utils/screen';
|
||||
import { putJointTrainingSimulationUser } from '@/api/chat';
|
||||
import { handlerIbpEvent } from '@/api/simulation';
|
||||
import { IbpOperation } from '@/scripts/ConstDic'
|
||||
|
||||
export default {
|
||||
name: 'Ibp',
|
||||
props: {
|
||||
size: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
width: this.$store.state.config.width,
|
||||
height: this.$store.state.config.height,
|
||||
dataZoom: {
|
||||
offsetX: '0',
|
||||
offsetY: '0',
|
||||
scaleRate: '1'
|
||||
},
|
||||
config: {
|
||||
scaleRate: '1',
|
||||
origin: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
},
|
||||
showBackButton: true,
|
||||
initTime: '',
|
||||
started: false,
|
||||
loading: false,
|
||||
stationCode: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'canvasWidth',
|
||||
'canvasHeight'
|
||||
]),
|
||||
ibpId() {
|
||||
return ['ibp', (Math.random().toFixed(5)) * 100000].join('_');
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'$store.state.config.canvasSizeCount': function (val) {
|
||||
this.reSize();
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.setWindowSize();
|
||||
},
|
||||
'$store.state.training.initTime': function (initTime) {
|
||||
this.initTime = initTime;
|
||||
if (this.$ibp) {
|
||||
this.initClockTime(initTime);
|
||||
}
|
||||
},
|
||||
'$store.state.training.started': function (started) {
|
||||
this.started = started;
|
||||
if (this.$ibp) {
|
||||
this.setClockStart(started);
|
||||
}
|
||||
},
|
||||
'$store.state.socket.equipmentStatus': function (val) {
|
||||
if (val.length) {
|
||||
this.statusMessage(val);
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.setWindowSize();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.ibpDestroy();
|
||||
},
|
||||
methods: {
|
||||
show (deviceCode,ibpPart) {
|
||||
if (!deviceCode) {
|
||||
return;
|
||||
}
|
||||
this.stationCode = deviceCode;
|
||||
document.getElementById(this.ibpId).oncontextmenu = function (e) {
|
||||
return false;
|
||||
};
|
||||
let offsetX = 0;
|
||||
if (ibpPart === 'left'){
|
||||
offsetX = 0;
|
||||
}else if (ibpPart === 'right'){
|
||||
offsetX = 1920;
|
||||
}
|
||||
this.ibpDestroy();
|
||||
this.loading = true;
|
||||
const data = parser(ibpData[deviceCode], {width: this.canvasWidth, height: this.canvasHeight});
|
||||
this.$ibp = new IbpPan({
|
||||
dom: document.getElementById(this.ibpId),
|
||||
config: {
|
||||
renderer: 'canvas',
|
||||
width: this.canvasWidth,
|
||||
height: this.canvasHeight
|
||||
},
|
||||
options: {
|
||||
scaleRate: 1,
|
||||
offsetX: offsetX,
|
||||
offsetY: 0
|
||||
},
|
||||
methods: {
|
||||
viewLoaded: this.handleViewLoaded,
|
||||
}
|
||||
});
|
||||
Vue.prototype.$ibp = this.$ibp;
|
||||
this.$ibp.on('contextmenu', this.onContextMenu, this);
|
||||
if (this.$route.query.group) {
|
||||
this.$ibp.on('selected', this.onSelected, this);
|
||||
}
|
||||
this.setMap(data,ibpData[deviceCode]);
|
||||
this.$store.dispatch('ibp/setIbpData', ibpData[deviceCode]);
|
||||
this.initClockTime(this.initTime);
|
||||
window.document.oncontextmenu = function () {
|
||||
return false;
|
||||
};
|
||||
},
|
||||
setMap(data,oldData) {
|
||||
this.$ibp.setMap(oldData, data);
|
||||
},
|
||||
// 点击选择事件
|
||||
onSelected(em) {
|
||||
if (em.deviceModel.mean) {
|
||||
const params = { operate:IbpOperation[em.deviceModel.mean].operate,stationCode:this.stationCode };
|
||||
handlerIbpEvent(this.$route.query.group,params);
|
||||
}
|
||||
},
|
||||
// 右键点击事件
|
||||
onContextMenu(em) {
|
||||
this.$store.dispatch('ibp/setUpdateDeviceData', em.eventTarget.model);
|
||||
},
|
||||
// 绘图时调用,元素可拖拽
|
||||
drawIbpInit() {
|
||||
this.$ibp&&this.$ibp.drawIbpInit();
|
||||
this.showBackButton = false;
|
||||
},
|
||||
// 初始化电子表时间
|
||||
initClockTime(initTime) {
|
||||
this.$ibp.initClockTime(initTime);
|
||||
},
|
||||
// 设置电子时钟开始或停止
|
||||
setClockStart(started) {
|
||||
this.$ibp.setClockStart(started);
|
||||
},
|
||||
reSize() {
|
||||
this.$nextTick(() => {
|
||||
this.width = this.$store.state.config.width;
|
||||
this.height = this.$store.state.config.height;
|
||||
this.$ibp && this.$ibp.resize({ width: this.width, height: this.height });
|
||||
});
|
||||
},
|
||||
setWindowSize() {
|
||||
this.$nextTick(() => {
|
||||
const width = this.size ? this.size.width : this.$store.state.app.width;
|
||||
const height = this.size ? this.size.height : this.$store.state.app.height;
|
||||
this.$store.dispatch('config/resize', { width: width, height: height });
|
||||
});
|
||||
},
|
||||
back() {
|
||||
this.group = this.$route.query.group;
|
||||
this.$store.dispatch('training/over').then(() => {
|
||||
putJointTrainingSimulationUser(this.group).then(() => {
|
||||
this.$router.push({ path: `/trainroom`, query: { group: this.group } });
|
||||
exitFullscreen();
|
||||
});
|
||||
});
|
||||
},
|
||||
ibpDestroy() {
|
||||
if (this.$ibp) {
|
||||
this.$ibp.dispose();
|
||||
this.$ibp = '';
|
||||
Vue.prototype.$ibp = '';
|
||||
}
|
||||
},
|
||||
handleViewLoaded() {
|
||||
this.loading = false;
|
||||
},
|
||||
statusMessage(val) {
|
||||
this.$ibp && this.$ibp.setDeviceStatus(val);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.ibp-button{
|
||||
position: absolute;
|
||||
float: right;
|
||||
right: 20px;
|
||||
bottom: 15px;
|
||||
}
|
||||
.ibp-canvas{
|
||||
}
|
||||
</style>
|
213
src/views/ibpsystem/index.vue
Normal file
213
src/views/ibpsystem/index.vue
Normal file
@ -0,0 +1,213 @@
|
||||
<template>
|
||||
<div>
|
||||
<div :id="ibpId" v-loading="loading" :style="{ width: this.canvasWidth +'px', height: this.canvasHeight +'px',background:'#000' }" class="ibp-canvas" />
|
||||
<el-button v-if="showBackButton" class="ibp-button" type="primary" @click="back">{{ $t('global.back') }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import IbpPan from '@/ibp/ibpPan';
|
||||
import { parser } from '@/ibp/utils/parser';
|
||||
import ibpData from '@/ibp/constant/ibpData';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { exitFullscreen } from '@/utils/screen';
|
||||
import { putJointTrainingSimulationUser } from '@/api/chat';
|
||||
import { handlerIbpEvent } from '@/api/simulation';
|
||||
import { IbpOperation } from '@/scripts/ConstDic';
|
||||
|
||||
export default {
|
||||
name: 'Ibp',
|
||||
props: {
|
||||
size: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
width: this.$store.state.config.width,
|
||||
height: this.$store.state.config.height,
|
||||
dataZoom: {
|
||||
offsetX: '0',
|
||||
offsetY: '0',
|
||||
scaleRate: '1'
|
||||
},
|
||||
config: {
|
||||
scaleRate: '1',
|
||||
origin: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
},
|
||||
showBackButton: true,
|
||||
initTime: '',
|
||||
started: false,
|
||||
loading: false,
|
||||
stationCode: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'canvasWidth',
|
||||
'canvasHeight'
|
||||
]),
|
||||
ibpId() {
|
||||
return ['ibp', (Math.random().toFixed(5)) * 100000].join('_');
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$store.state.config.canvasSizeCount': function (val) {
|
||||
this.reSize();
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.setWindowSize();
|
||||
},
|
||||
'$store.state.training.initTime': function (initTime) {
|
||||
this.initTime = initTime;
|
||||
if (this.$ibp) {
|
||||
this.initClockTime(initTime);
|
||||
}
|
||||
},
|
||||
'$store.state.training.started': function (started) {
|
||||
this.started = started;
|
||||
if (this.$ibp) {
|
||||
this.setClockStart(started);
|
||||
}
|
||||
},
|
||||
'$store.state.socket.equipmentStatus': function (val) {
|
||||
if (val.length) {
|
||||
this.statusMessage(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.setWindowSize();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.ibpDestroy();
|
||||
},
|
||||
methods: {
|
||||
show (deviceCode, ibpPart) {
|
||||
if (!deviceCode) {
|
||||
return;
|
||||
}
|
||||
this.stationCode = deviceCode;
|
||||
document.getElementById(this.ibpId).oncontextmenu = function (e) {
|
||||
return false;
|
||||
};
|
||||
let offsetX = 0;
|
||||
if (ibpPart === 'left') {
|
||||
offsetX = 0;
|
||||
} else if (ibpPart === 'right') {
|
||||
offsetX = 1920;
|
||||
}
|
||||
this.ibpDestroy();
|
||||
this.loading = true;
|
||||
const data = parser(ibpData[deviceCode], {width: this.canvasWidth, height: this.canvasHeight});
|
||||
this.$ibp = new IbpPan({
|
||||
dom: document.getElementById(this.ibpId),
|
||||
config: {
|
||||
renderer: 'canvas',
|
||||
width: this.canvasWidth,
|
||||
height: this.canvasHeight
|
||||
},
|
||||
options: {
|
||||
scaleRate: 1,
|
||||
offsetX: offsetX,
|
||||
offsetY: 0
|
||||
},
|
||||
methods: {
|
||||
viewLoaded: this.handleViewLoaded
|
||||
}
|
||||
});
|
||||
Vue.prototype.$ibp = this.$ibp;
|
||||
this.$ibp.on('contextmenu', this.onContextMenu, this);
|
||||
if (this.$route.query.group) {
|
||||
this.$ibp.on('selected', this.onSelected, this);
|
||||
}
|
||||
this.setMap(data, ibpData[deviceCode]);
|
||||
this.$store.dispatch('ibp/setIbpData', ibpData[deviceCode]);
|
||||
this.initClockTime(this.initTime);
|
||||
window.document.oncontextmenu = function () {
|
||||
return false;
|
||||
};
|
||||
},
|
||||
setMap(data, oldData) {
|
||||
this.$ibp.setMap(oldData, data);
|
||||
},
|
||||
// 点击选择事件
|
||||
onSelected(em) {
|
||||
if (em.deviceModel.mean) {
|
||||
const params = { operate:IbpOperation[em.deviceModel.mean].operate, stationCode:this.stationCode };
|
||||
handlerIbpEvent(this.$route.query.group, params);
|
||||
}
|
||||
},
|
||||
// 右键点击事件
|
||||
onContextMenu(em) {
|
||||
this.$store.dispatch('ibp/setUpdateDeviceData', em.eventTarget.model);
|
||||
},
|
||||
// 绘图时调用,元素可拖拽
|
||||
drawIbpInit() {
|
||||
this.$ibp && this.$ibp.drawIbpInit();
|
||||
this.showBackButton = false;
|
||||
},
|
||||
// 初始化电子表时间
|
||||
initClockTime(initTime) {
|
||||
this.$ibp.initClockTime(initTime);
|
||||
},
|
||||
// 设置电子时钟开始或停止
|
||||
setClockStart(started) {
|
||||
this.$ibp.setClockStart(started);
|
||||
},
|
||||
reSize() {
|
||||
this.$nextTick(() => {
|
||||
this.width = this.$store.state.config.width;
|
||||
this.height = this.$store.state.config.height;
|
||||
this.$ibp && this.$ibp.resize({ width: this.width, height: this.height });
|
||||
});
|
||||
},
|
||||
setWindowSize() {
|
||||
this.$nextTick(() => {
|
||||
const width = this.size ? this.size.width : this.$store.state.app.width;
|
||||
const height = this.size ? this.size.height : this.$store.state.app.height;
|
||||
this.$store.dispatch('config/resize', { width: width, height: height });
|
||||
});
|
||||
},
|
||||
back() {
|
||||
this.group = this.$route.query.group;
|
||||
this.$store.dispatch('training/over').then(() => {
|
||||
putJointTrainingSimulationUser(this.group).then(() => {
|
||||
this.$router.push({ path: `/trainroom`, query: { group: this.group } });
|
||||
exitFullscreen();
|
||||
});
|
||||
});
|
||||
},
|
||||
ibpDestroy() {
|
||||
if (this.$ibp) {
|
||||
this.$ibp.dispose();
|
||||
this.$ibp = '';
|
||||
Vue.prototype.$ibp = '';
|
||||
}
|
||||
},
|
||||
handleViewLoaded() {
|
||||
this.loading = false;
|
||||
},
|
||||
statusMessage(val) {
|
||||
this.$ibp && this.$ibp.setDeviceStatus(val);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.ibp-button{
|
||||
position: absolute;
|
||||
float: right;
|
||||
right: 20px;
|
||||
bottom: 15px;
|
||||
}
|
||||
.ibp-canvas{
|
||||
}
|
||||
</style>
|
@ -33,7 +33,7 @@ import JoinFaultChoose from '@/views/display/demon/faultChoose';
|
||||
import JoinRunPlanLoad from '@/views/display/demon/runPlanLoad';
|
||||
import JoinRunPlanView from '@/views/display/demon/runPlanView';
|
||||
import menuSystemTime from '@/views/display/menuSystemTime';
|
||||
import IbpPlate from '@/views/ibp/index';
|
||||
import IbpPlate from '@/views/ibpsystem/index';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
|
||||
import { checkLoginLine } from '@/api/login';
|
||||
|
@ -145,7 +145,7 @@ export default {
|
||||
.box{
|
||||
height: 100%;
|
||||
display: -webkit-box;
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -1,160 +0,0 @@
|
||||
<template>
|
||||
<el-card v-loading="loading" class="map-list-main">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{ $t(`lesson.trainingList`) }}</span>
|
||||
</div>
|
||||
<div style="{width: 150px}">
|
||||
<el-input v-model="filterText" :placeholder="$t(`lesson.filterPlaceholder`)" clearable />
|
||||
</div>
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-270) +'px' }">
|
||||
<el-tree
|
||||
ref="tree"
|
||||
:data="treeData"
|
||||
:props="defaultProps"
|
||||
node-key="id"
|
||||
:default-expanded-keys="defaultShowKeys"
|
||||
:filter-node-method="filterNode"
|
||||
expand-on-click-node
|
||||
highlight-current
|
||||
:span="22"
|
||||
@node-contextmenu="showContextMenu"
|
||||
@node-click="clickEvent"
|
||||
>
|
||||
<div slot-scope="{ node: nodeScop }">
|
||||
<span v-if="nodeScop.data.type == 'skin'" class="el-icon-news"> {{ nodeScop.label }}</span>
|
||||
<span v-else-if="nodeScop.data.type == 'prd'" class="el-icon-tickets"> {{ nodeScop.label }}</span>
|
||||
<span
|
||||
v-else-if="nodeScop.data.type == 'trainingType'"
|
||||
class="el-icon-document"
|
||||
> {{ nodeScop.label }}</span>
|
||||
<span
|
||||
v-else-if="nodeScop.data.type == 'training'"
|
||||
class="el-icon-edit-outline"
|
||||
> {{ nodeScop.label }}</span>
|
||||
</div>
|
||||
</el-tree>
|
||||
</el-scrollbar>
|
||||
<operate-menu ref="menu" :point="point" :node="node" @refresh="refresh" @trainingShow="trainingShow" />
|
||||
</el-card>
|
||||
</template>
|
||||
<script>
|
||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||
import { getTrainingTree } from '@/api/jmap/training';
|
||||
import { trainingNotify } from '@/api/simulation';
|
||||
import OperateMenu from './category/operateMenu';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import localStore from 'storejs';
|
||||
|
||||
export default {
|
||||
name: 'TrainingOperate',
|
||||
components: {
|
||||
OperateMenu
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
defaultShowKeys: [],
|
||||
filterText: '',
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
point: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
node: {
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height - 50;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.refresh();
|
||||
},
|
||||
methods: {
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
clickEvent(obj, node, data) {
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
|
||||
if (obj && obj.type === 'Training') {
|
||||
this.resize();
|
||||
trainingNotify({ trainingId: obj.id }).then(resp => {
|
||||
this.group = resp.data;
|
||||
this.$router.push({ path: `${UrlConfig.design.lessonTraining}/${obj.id}/${obj.name}`, query: { group: resp.data } });
|
||||
}).catch(error => {
|
||||
this.$messageBox(`${this.$t('error.createSimulationFailed')}: ${error.message}`);
|
||||
});
|
||||
}
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
if (obj && obj.type === 'TrainingType' || obj.type === 'Training') {
|
||||
e.preventDefault();
|
||||
this.point = {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
};
|
||||
this.node = node;
|
||||
const menu = DeviceMenu.Training;
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
||||
}
|
||||
},
|
||||
getParent(node) {
|
||||
while (node && node.data.type != 'Skin') {
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return node || {};
|
||||
},
|
||||
trainingShow() {
|
||||
this.$emit('trainingStart', { id: this.node.data.id, lessonId: this.getParent(this.node).data.id });
|
||||
},
|
||||
refresh() {
|
||||
this.loading = true;
|
||||
getTrainingTree().then(response => {
|
||||
this.treeData = response.data;
|
||||
this.defaultShowKeys = [this.$route.params.trainingId];
|
||||
this.$nextTick(() => {
|
||||
this.loading = false;
|
||||
this.$refs.tree.setCurrentKey(this.$route.params.trainingId); // value 绑定的node-key
|
||||
if (this.filterText) {
|
||||
this.$refs.tree.filter(this.filterText);
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$messageBox(this.$t('error.refreshFailed'));
|
||||
});
|
||||
},
|
||||
resize() {
|
||||
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
|
||||
const width = this.$store.state.app.width - 521 - this.widthLeft;
|
||||
const height = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: width, height: height });
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-tree {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.map-list-main {
|
||||
text-align: center;
|
||||
}
|
||||
.el-tree-node.is-current>.el-tree-node__content {
|
||||
background-color: #e4e3e3 !important;
|
||||
}
|
||||
</style>
|
@ -1,137 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<dictionary-edit ref="create" type="ADD" @reloadTable="reloadTable" />
|
||||
<dictionary-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { list, del } from '@/api/management/dictionary';
|
||||
import DictionaryEdit from '@/views/management/dictionary/edit';
|
||||
export default {
|
||||
name: 'Dictionary',
|
||||
components: {
|
||||
DictionaryEdit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '80px',
|
||||
reset: true,
|
||||
queryObject: {
|
||||
code: {
|
||||
type: 'text',
|
||||
label: this.$t('system.code')
|
||||
},
|
||||
name: {
|
||||
type: 'text',
|
||||
label: this.$t('system.name')
|
||||
},
|
||||
status: {
|
||||
type: 'select',
|
||||
label: this.$t('system.status'),
|
||||
config: {
|
||||
data: this.$ConstSelect.Status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
queryList: {
|
||||
query: list,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('system.code'),
|
||||
prop: 'code'
|
||||
},
|
||||
{
|
||||
title: this.$t('system.name'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('system.status'),
|
||||
prop: 'status',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'Status'); },
|
||||
tagType: (row) => { if (row.status === '0') { return 'danger'; } else { return 'success'; } }
|
||||
},
|
||||
{
|
||||
title: this.$t('system.remarks'),
|
||||
prop: 'remarks'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '250',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('global.detail'),
|
||||
handleClick: this.handleViewDetail
|
||||
},
|
||||
{
|
||||
name: this.$t('global.edit'),
|
||||
handleClick: this.handleEdit
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
handleClick: this.handleDelete,
|
||||
type: 'danger'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('global.add'), handler: this.handleAdd }
|
||||
// { text: '批量删除', btnCode: 'employee_delete', handler: this.handleBatchDelete, type: 'danger' }
|
||||
]
|
||||
},
|
||||
|
||||
currentModel: {}
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleViewDetail(index, row) {
|
||||
this.$router.push({ path: `/system/dictionary/detail`, query: { id: row.id } });
|
||||
},
|
||||
|
||||
handleEdit(index, row) {
|
||||
this.$refs.edit.show(row.id);
|
||||
},
|
||||
|
||||
handleAdd() {
|
||||
this.$refs.create.show();
|
||||
},
|
||||
|
||||
handleBatchDelete() {
|
||||
},
|
||||
|
||||
handleDelete(index, row) {
|
||||
this.$confirm(this.$t('system.wellDelType'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
del(row.id).then(response => {
|
||||
this.$message.success(this.$t('system.deleteSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.reloadTable();
|
||||
this.$messageBox(this.$t('error.deleteFailed'));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
reloadTable() {
|
||||
this.queryList.reload();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,167 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- <turnback-bar :title="turnbackBarTitle"></turnback-bar> -->
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<dictionary-detail-edit ref="create" type="ADD" :dic-id="dicId" @reloadTable="reloadTable" />
|
||||
<dictionary-detail-edit ref="edit" type="EDIT" :dic-id="dicId" @reloadTable="reloadTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { list, del } from '@/api/management/dictionaryDetail';
|
||||
import { getData } from '@/api/management/dictionary';
|
||||
import DictionaryDetailEdit from '@/views/management/dictionaryDetail/edit';
|
||||
export default {
|
||||
name: 'DictionaryDetail',
|
||||
components: {
|
||||
DictionaryDetailEdit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dicId: '',
|
||||
dic: {},
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '80px',
|
||||
reset: true,
|
||||
queryObject: {
|
||||
code: {
|
||||
type: 'text',
|
||||
label: this.$t('global.code')
|
||||
},
|
||||
name: {
|
||||
type: 'text',
|
||||
label: this.$t('global.name')
|
||||
},
|
||||
status: {
|
||||
type: 'select',
|
||||
label: this.$t('global.status'),
|
||||
config: {
|
||||
data: this.$ConstSelect.Status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('global.code'),
|
||||
prop: 'code'
|
||||
},
|
||||
{
|
||||
title: this.$t('global.name'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('global.status'),
|
||||
prop: 'status',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'Status'); },
|
||||
tagType: (row) => { if (row.status === '0') { return 'danger'; } else { return 'success'; } }
|
||||
},
|
||||
{
|
||||
title: this.$t('global.remarks'),
|
||||
prop: 'remarks'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '250',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('global.edit'),
|
||||
handleClick: this.handleEdit
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
handleClick: this.handleDelete,
|
||||
type: 'danger'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('global.add'), btnCode: 'employee_insert', handler: this.handleAdd }
|
||||
// { text: '批量删除', btnCode: 'employee_delete', handler: this.handleBatchDelete, type: 'danger' }
|
||||
]
|
||||
},
|
||||
|
||||
currentModel: {}
|
||||
};
|
||||
},
|
||||
|
||||
// computed: {
|
||||
// turnbackBarTitle() {
|
||||
// return this.dic.name + '(' + this.dic.code + ')'
|
||||
// }
|
||||
// },
|
||||
|
||||
created() {
|
||||
this.dicId = this.$route.query.id;
|
||||
getData(this.dicId).then(response => {
|
||||
this.dic = response.data;
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
queryFunction(params) {
|
||||
return list(this.dicId, params);
|
||||
},
|
||||
|
||||
handleEdit(index, row) {
|
||||
this.$refs.edit.show(row.id);
|
||||
},
|
||||
|
||||
handleAdd() {
|
||||
this.$refs.create.show();
|
||||
},
|
||||
|
||||
handleBatchDelete() {
|
||||
|
||||
},
|
||||
|
||||
handleDelete(index, row) {
|
||||
this.$confirm(this.$t('system.wellDelType'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
del(this.dicId, row.id).then(response => {
|
||||
this.$message.success(this.$t('system.deleteSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.reloadTable();
|
||||
this.$messageBox(this.$t('error.deleteFailed'));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
reloadTable() {
|
||||
this.queryList.reload();
|
||||
},
|
||||
|
||||
turnback() {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.draft {
|
||||
width: 400px;
|
||||
text-align: center;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
@ -2,37 +2,13 @@
|
||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogShow" :before-close="handleCancel" :close-on-click-modal="false">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
|
||||
<el-form-item :label="$t('publish.trainingType')" prop="course">
|
||||
<el-select
|
||||
v-model="form.course"
|
||||
:placeholder="$t('publish.selectTypeScope')"
|
||||
:disabled="editOk"
|
||||
style="width:240px;"
|
||||
@change="changeCourse(form.course)"
|
||||
>
|
||||
<el-option
|
||||
v-for="nor in options"
|
||||
:key="nor.id"
|
||||
:label="nor.name"
|
||||
:value="nor.code"
|
||||
:disabled="nor.disabled"
|
||||
/>
|
||||
<el-select v-model="form.course" :placeholder="$t('publish.selectTypeScope')" :disabled="editOk" style="width:240px;" @change="changeCourse(form.course)">
|
||||
<el-option v-for="nor in options" :key="nor.id" :label="nor.name" :value="nor.code" :disabled="nor.disabled" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.operationType')">
|
||||
<el-select
|
||||
v-model="form.operateType"
|
||||
clearable
|
||||
:placeholder="$t('publish.selectScope')"
|
||||
:disabled="editOk"
|
||||
@change="changeOperation(form.operateType)"
|
||||
>
|
||||
<el-option
|
||||
v-for="nor in operationTypeList"
|
||||
:key="nor.id"
|
||||
:label="nor.name"
|
||||
:value="nor.code"
|
||||
:disabled="nor.disabled"
|
||||
/>
|
||||
<el-select v-model="form.operateType" clearable :placeholder="$t('publish.selectScope')" :disabled="editOk" @change="changeOperation(form.operateType)">
|
||||
<el-option v-for="nor in operationTypeList" :key="nor.id" :label="nor.name" :value="nor.code" :disabled="nor.disabled" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.questionNumbers')" prop="number">
|
||||
@ -59,254 +35,254 @@ import { getLessonTypeNum, getCourseTypeList } from '@/api/management/exam';
|
||||
import { getDetailList } from '@/api/management/dictionary';
|
||||
|
||||
export default {
|
||||
name: 'EditRule',
|
||||
props: {
|
||||
courseId: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
editCourse: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
var number = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('publish.inputQuestionNumber')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (Number(value) == 0) {
|
||||
callback(new Error(this.$t('publish.inputQuestionNumberError')));
|
||||
} else if (!Number(value)) {
|
||||
callback(new Error(this.$t('publish.inputValidNumber')));
|
||||
} else if (Number(value) > this.topicNum) {
|
||||
callback(new Error(this.$t('publish.inputNumberError')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
var mark = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('publish.inputScorePerQuestion')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number(value)) {
|
||||
callback(new Error(this.$t('publish.inputNumericType')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
return {
|
||||
title: this.$t('publish.addRules'),
|
||||
form: {
|
||||
course: '',
|
||||
operateType: '',
|
||||
number: '',
|
||||
mark: ''
|
||||
},
|
||||
topicNum: 0,
|
||||
dialogShow: false,
|
||||
editOk: false,
|
||||
rules: {
|
||||
course: [
|
||||
{ required: true, message: this.$t('publish.selectTestType'), trigger: 'change' }
|
||||
],
|
||||
number: [
|
||||
{ required: true, validator: number, trigger: 'blur' }
|
||||
],
|
||||
mark: [
|
||||
{ required: true, validator: mark, trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
options: this.$store.state.exam.courseList,
|
||||
typeList: [],
|
||||
operationTypeList: [],
|
||||
trainingOperateTypeMap: {}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
editCourse: function (val) {
|
||||
this.title = this.$t('publish.modifyRules');
|
||||
this.editOk = true;
|
||||
this.form = {
|
||||
course: val.trainingType,
|
||||
operateType: val.operateType,
|
||||
number: val.num,
|
||||
mark: val.point
|
||||
};
|
||||
this.changeCourse(val.trainingType);
|
||||
this.changeOperation(val.operateType);
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
await this.getList();
|
||||
await this.refresh();
|
||||
this.trainingOperateTypeMap = {};
|
||||
this.$Dictionary.stationControl().then(list => {
|
||||
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
||||
});
|
||||
this.$Dictionary.signalOperation().then(list => {
|
||||
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
||||
});
|
||||
this.$Dictionary.switchOperation().then(list => {
|
||||
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
||||
});
|
||||
this.$Dictionary.sectionOperation().then(list => {
|
||||
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
||||
});
|
||||
this.$Dictionary.stationStandOperation().then(list => {
|
||||
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
||||
});
|
||||
this.$Dictionary.trainPlanOperation().then(list => {
|
||||
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
||||
});
|
||||
this.$Dictionary.trainOperation().then(list => {
|
||||
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
show() {
|
||||
this.dialogShow = true;
|
||||
},
|
||||
handleOk() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.operationTypeList.forEach(item => {
|
||||
if (item.code == this.form.operateType) {
|
||||
this.form.name = item.name;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (this.editOk) {
|
||||
// 修改
|
||||
this.$emit('editRuleList', this.form);
|
||||
this.editOk = false;
|
||||
setTimeout(() => {
|
||||
this.handleCancel();
|
||||
}, 300);
|
||||
} else {
|
||||
// 新增
|
||||
this.$emit('addRuleList', this.form);
|
||||
setTimeout(() => {
|
||||
this.handleCancel();
|
||||
}, 300);
|
||||
}
|
||||
this.topicNum = 0;
|
||||
} else {
|
||||
this.dialogShow = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
this.$refs['form'].resetFields();
|
||||
this.clearBoth();
|
||||
this.dialogShow = false;
|
||||
this.editOk = false;
|
||||
this.topicNum = 0;
|
||||
this.operationTypeList = [];
|
||||
},
|
||||
clearBoth() {
|
||||
this.form = {
|
||||
course: '',
|
||||
number: '',
|
||||
mark: ''
|
||||
};
|
||||
},
|
||||
// 获取课题下类型
|
||||
async refresh() {
|
||||
await getCourseTypeList({ lessonId: this.courseId }).then(res => {
|
||||
const list = [];
|
||||
res.data.sort();
|
||||
res.data.forEach(ele => {
|
||||
this.typeList.forEach(v => {
|
||||
if (ele == v.code) {
|
||||
list.push(v);
|
||||
}
|
||||
});
|
||||
});
|
||||
this.options = list;
|
||||
this.changeCourseDisable();
|
||||
this.$store.dispatch('exam/setCourse', this.options);
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('publish.refreshFailed'));
|
||||
});
|
||||
},
|
||||
async getList() {
|
||||
this.typeList = [];
|
||||
await getDetailList('training_type').then(res => {
|
||||
this.typeList = res.data;
|
||||
}).catch((error) => { console.log(error.message); });
|
||||
},
|
||||
async changeCourse(val) {
|
||||
const param = {
|
||||
lessonId: this.courseId,
|
||||
trainingType: val,
|
||||
operateType: ''
|
||||
};
|
||||
this.operationTypeList = this.trainingOperateTypeMap[val];
|
||||
if (this.operationTypeList) {
|
||||
this.operationTypeList.forEach(item => {
|
||||
item.disabled = false;
|
||||
this.changeOperationDisabled(); // 禁用设置
|
||||
});
|
||||
}
|
||||
this.form.operateType='';
|
||||
const resp = await getLessonTypeNum(param);
|
||||
if (resp.code == 200) {
|
||||
this.topicNum = resp.data;
|
||||
return this.topicNum;
|
||||
}
|
||||
this.$store.dispatch('exam/setCourse', this.options);
|
||||
},
|
||||
async changeOperation(val) {
|
||||
const param = {
|
||||
lessonId: this.courseId,
|
||||
trainingType: this.form.course,
|
||||
operateType: val
|
||||
};
|
||||
const resp = await getLessonTypeNum(param);
|
||||
if (resp.code == 200) {
|
||||
this.topicNum = resp.data;
|
||||
return this.topicNum;
|
||||
}
|
||||
this.$store.dispatch('exam/setCourse', this.options);
|
||||
},
|
||||
// 判断类型是否选择过
|
||||
changeCourseDisable() {
|
||||
const arr = this.$store.state.exam.ruleList;
|
||||
arr.forEach(ele => {
|
||||
this.options.forEach(res => {
|
||||
// operateType 操作类型为空或没有值存在 禁用
|
||||
if (ele.trainingType == res.code && !ele.operateType) {
|
||||
res.disabled = true;
|
||||
}
|
||||
});
|
||||
name: 'EditRule',
|
||||
props: {
|
||||
courseId: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
editCourse: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
var number = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('publish.inputQuestionNumber')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (Number(value) == 0) {
|
||||
callback(new Error(this.$t('publish.inputQuestionNumberError')));
|
||||
} else if (!Number(value)) {
|
||||
callback(new Error(this.$t('publish.inputValidNumber')));
|
||||
} else if (Number(value) > this.topicNum) {
|
||||
callback(new Error(this.$t('publish.inputNumberError')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
var mark = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('publish.inputScorePerQuestion')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number(value)) {
|
||||
callback(new Error(this.$t('publish.inputNumericType')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
return {
|
||||
title: this.$t('publish.addRules'),
|
||||
form: {
|
||||
course: '',
|
||||
operateType: '',
|
||||
number: '',
|
||||
mark: ''
|
||||
},
|
||||
topicNum: 0,
|
||||
dialogShow: false,
|
||||
editOk: false,
|
||||
rules: {
|
||||
course: [
|
||||
{ required: true, message: this.$t('publish.selectTestType'), trigger: 'change' }
|
||||
],
|
||||
number: [
|
||||
{ required: true, validator: number, trigger: 'blur' }
|
||||
],
|
||||
mark: [
|
||||
{ required: true, validator: mark, trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
options: this.$store.state.exam.courseList,
|
||||
typeList: [],
|
||||
operationTypeList: [],
|
||||
trainingOperateTypeMap: {}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
editCourse: function (val) {
|
||||
this.title = this.$t('publish.modifyRules');
|
||||
this.editOk = true;
|
||||
this.form = {
|
||||
course: val.trainingType,
|
||||
operateType: val.operateType,
|
||||
number: val.num,
|
||||
mark: val.point
|
||||
};
|
||||
this.changeCourse(val.trainingType);
|
||||
this.changeOperation(val.operateType);
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
await this.getList();
|
||||
await this.refresh();
|
||||
this.trainingOperateTypeMap = {};
|
||||
this.$Dictionary.stationControl().then(list => {
|
||||
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
||||
});
|
||||
this.$Dictionary.signalOperation().then(list => {
|
||||
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
||||
});
|
||||
this.$Dictionary.switchOperation().then(list => {
|
||||
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
||||
});
|
||||
this.$Dictionary.sectionOperation().then(list => {
|
||||
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
||||
});
|
||||
this.$Dictionary.stationStandOperation().then(list => {
|
||||
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
||||
});
|
||||
this.$Dictionary.trainPlanOperation().then(list => {
|
||||
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
||||
});
|
||||
this.$Dictionary.trainOperation().then(list => {
|
||||
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
show() {
|
||||
this.dialogShow = true;
|
||||
},
|
||||
handleOk() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.operationTypeList.forEach(item => {
|
||||
if (item.code == this.form.operateType) {
|
||||
this.form.name = item.name;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (this.editOk) {
|
||||
// 修改
|
||||
this.$emit('editRuleList', this.form);
|
||||
this.editOk = false;
|
||||
setTimeout(() => {
|
||||
this.handleCancel();
|
||||
}, 300);
|
||||
} else {
|
||||
// 新增
|
||||
this.$emit('addRuleList', this.form);
|
||||
setTimeout(() => {
|
||||
this.handleCancel();
|
||||
}, 300);
|
||||
}
|
||||
this.topicNum = 0;
|
||||
} else {
|
||||
this.dialogShow = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
this.$refs['form'].resetFields();
|
||||
this.clearBoth();
|
||||
this.dialogShow = false;
|
||||
this.editOk = false;
|
||||
this.topicNum = 0;
|
||||
this.operationTypeList = [];
|
||||
},
|
||||
clearBoth() {
|
||||
this.form = {
|
||||
course: '',
|
||||
number: '',
|
||||
mark: ''
|
||||
};
|
||||
},
|
||||
// 获取课题下类型
|
||||
async refresh() {
|
||||
await getCourseTypeList({ lessonId: this.courseId }).then(res => {
|
||||
const list = [];
|
||||
res.data.sort();
|
||||
res.data.forEach(ele => {
|
||||
this.typeList.forEach(v => {
|
||||
if (ele == v.code) {
|
||||
list.push(v);
|
||||
}
|
||||
});
|
||||
});
|
||||
this.options = list;
|
||||
this.changeCourseDisable();
|
||||
this.$store.dispatch('exam/setCourse', this.options);
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('publish.refreshFailed'));
|
||||
});
|
||||
},
|
||||
async getList() {
|
||||
this.typeList = [];
|
||||
await getDetailList('training_type').then(res => {
|
||||
this.typeList = res.data;
|
||||
}).catch((error) => { console.log(error.message); });
|
||||
},
|
||||
async changeCourse(val) {
|
||||
const param = {
|
||||
lessonId: this.courseId,
|
||||
trainingType: val,
|
||||
operateType: ''
|
||||
};
|
||||
this.operationTypeList = this.trainingOperateTypeMap[val];
|
||||
if (this.operationTypeList) {
|
||||
this.operationTypeList.forEach(item => {
|
||||
item.disabled = false;
|
||||
this.changeOperationDisabled(); // 禁用设置
|
||||
});
|
||||
}
|
||||
this.form.operateType = '';
|
||||
const resp = await getLessonTypeNum(param);
|
||||
if (resp.code == 200) {
|
||||
this.topicNum = resp.data;
|
||||
return this.topicNum;
|
||||
}
|
||||
this.$store.dispatch('exam/setCourse', this.options);
|
||||
},
|
||||
async changeOperation(val) {
|
||||
const param = {
|
||||
lessonId: this.courseId,
|
||||
trainingType: this.form.course,
|
||||
operateType: val
|
||||
};
|
||||
const resp = await getLessonTypeNum(param);
|
||||
if (resp.code == 200) {
|
||||
this.topicNum = resp.data;
|
||||
return this.topicNum;
|
||||
}
|
||||
this.$store.dispatch('exam/setCourse', this.options);
|
||||
},
|
||||
// 判断类型是否选择过
|
||||
changeCourseDisable() {
|
||||
const arr = this.$store.state.exam.ruleList;
|
||||
arr.forEach(ele => {
|
||||
this.options.forEach(res => {
|
||||
// operateType 操作类型为空或没有值存在 禁用
|
||||
if (ele.trainingType == res.code && !ele.operateType) {
|
||||
res.disabled = true;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
changeOperationDisabled() {
|
||||
const arr = this.$store.state.exam.ruleList;
|
||||
arr.forEach(ele => {
|
||||
this.operationTypeList.forEach(res => {
|
||||
if (ele.operateType == res.code) {
|
||||
res.disabled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
changeListDisabled(val) {
|
||||
this.options.forEach(res => {
|
||||
if (res.code == val) {
|
||||
res.disabled = false;
|
||||
}
|
||||
});
|
||||
this.$store.dispatch('exam/setCourse', this.options);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
changeOperationDisabled() {
|
||||
const arr = this.$store.state.exam.ruleList;
|
||||
arr.forEach(ele => {
|
||||
this.operationTypeList.forEach(res => {
|
||||
if (ele.operateType == res.code) {
|
||||
res.disabled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
changeListDisabled(val) {
|
||||
this.options.forEach(res => {
|
||||
if (res.code == val) {
|
||||
res.disabled = false;
|
||||
}
|
||||
});
|
||||
this.$store.dispatch('exam/setCourse', this.options);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
@ -1,77 +1,65 @@
|
||||
<template>
|
||||
<div class="exam-rule">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height + 'px'}">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" class="demo-form">
|
||||
<el-form-item :label="$t('publish.testName')" prop="name">
|
||||
<el-input v-model="form.name" :placeholder="$t('publish.inputTestName')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testScope')" prop="region">
|
||||
<el-select
|
||||
v-model="form.region"
|
||||
:placeholder="$t('publish.selectTestScope')"
|
||||
style="width: 100%;"
|
||||
:disabled="isEdit || selectDisable"
|
||||
>
|
||||
<el-option v-for="nor in options" :key="nor.id" :label="nor.name" :value="nor.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testDuration')" prop="duration">
|
||||
<el-input
|
||||
v-model="form.duration"
|
||||
placeholder="90"
|
||||
style="float: left; width: calc(100% - 80px);"
|
||||
:disabled="isEdit"
|
||||
/>
|
||||
<span style="width:80px; display: block;float: left; text-align: center;"> {{ $t('publish.durationMinutes') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testDate')">
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="startDate">
|
||||
<el-date-picker
|
||||
v-model="form.startDate"
|
||||
type="datetime"
|
||||
:placeholder="$t('publish.startTestTime')"
|
||||
style="width: 100%;"
|
||||
value-format="timestamp"
|
||||
:disabled="isEdit"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col class="line" :span="2">-</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="endDate">
|
||||
<el-date-picker
|
||||
v-model="form.endDate"
|
||||
type="datetime"
|
||||
:placeholder="$t('publish.endTestTime')"
|
||||
style="width: 100%;"
|
||||
value-format="timestamp"
|
||||
:disabled="isEdit"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.fullScore')" prop="fullMark">
|
||||
<el-input v-model="form.fullMark" placeholder="" :disabled="isEdit" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.passingScore')" prop="passMark">
|
||||
<el-input v-model="form.passMark" placeholder="" :disabled="isEdit" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="trialShow" :label="$t('publish.whetherToTry')" required>
|
||||
<el-radio-group v-model="trial">
|
||||
<el-radio label="1">{{ $t('publish.trialNo') }}</el-radio>
|
||||
<el-radio label="2">{{ $t('publish.trialYes') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testDescription')" prop="desc">
|
||||
<el-input v-model="form.desc" type="textarea" :placeholder="$t('publish.inputTestDescription')" :disabled="isEdit" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px" class="demo-form">
|
||||
<el-form-item :label="$t('publish.testName')" prop="name">
|
||||
<el-input v-model="form.name" :placeholder="$t('publish.inputTestName')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testScope')" prop="region">
|
||||
<el-select v-model="form.region" :placeholder="$t('publish.selectTestScope')" style="width: 100%;" :disabled="isEdit || selectDisable">
|
||||
<el-option v-for="nor in options" :key="nor.id" :label="nor.name" :value="nor.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testDuration')" prop="duration">
|
||||
<el-input v-model="form.duration" placeholder="90" style="float: left; width: calc(100% - 80px);" :disabled="isEdit" />
|
||||
<span style="width:80px; display: block;float: left; text-align: center;"> {{ $t('publish.durationMinutes') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testDate')">
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="startDate">
|
||||
<el-date-picker
|
||||
v-model="form.startDate"
|
||||
type="datetime"
|
||||
:placeholder="$t('publish.startTestTime')"
|
||||
style="width: 100%;"
|
||||
value-format="timestamp"
|
||||
:disabled="isEdit"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col class="line" :span="2">-</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="endDate">
|
||||
<el-date-picker
|
||||
v-model="form.endDate"
|
||||
type="datetime"
|
||||
:placeholder="$t('publish.endTestTime')"
|
||||
style="width: 100%;"
|
||||
value-format="timestamp"
|
||||
:disabled="isEdit"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.fullScore')" prop="fullMark">
|
||||
<el-input v-model="form.fullMark" placeholder="" :disabled="isEdit" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.passingScore')" prop="passMark">
|
||||
<el-input v-model="form.passMark" placeholder="" :disabled="isEdit" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="trialShow" :label="$t('publish.whetherToTry')" required>
|
||||
<el-radio-group v-model="trial">
|
||||
<el-radio label="1">{{ $t('publish.trialNo') }}</el-radio>
|
||||
<el-radio label="2">{{ $t('publish.trialYes') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testDescription')" prop="desc">
|
||||
<el-input v-model="form.desc" type="textarea" :placeholder="$t('publish.inputTestDescription')" :disabled="isEdit" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-button type="primary" @click="updateForm" v-if="isEdit">{{ $t('error.edit') }}</el-button>
|
||||
<el-button type="primary" @click="submitForm" v-else>{{ $t('error.nextStep') }}</el-button>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -80,211 +68,205 @@ import { getPublishLessonList } from '@/api/jmap/lesson';
|
||||
import { getExamLessonDetail, updateExamRules } from '@/api/management/exam';
|
||||
|
||||
export default {
|
||||
name: 'ExamFrom',
|
||||
props: {
|
||||
height: {
|
||||
type: Number,
|
||||
default: 800
|
||||
}
|
||||
},
|
||||
data() {
|
||||
var fullMark = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('publish.inputFullScore')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number(value)) {
|
||||
callback(new Error(this.$t('publish.inputNumericType')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
var passMark = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('publish.inputPassingScore')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number(value)) {
|
||||
callback(new Error(this.$t('publish.inputNumericType')));
|
||||
} else {
|
||||
if (Number(value) > this.form.fullMark) {
|
||||
callback(new Error(this.$t('publish.inputScoreError')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
var duration = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('publish.inputTestDuration')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number(value)) {
|
||||
callback(new Error(this.$t('publish.inputNumericType')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
return {
|
||||
formDetail: {
|
||||
name: '',
|
||||
region: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
desc: '',
|
||||
type: '',
|
||||
duration: '',
|
||||
fullMark: '',
|
||||
passMark: ''
|
||||
},
|
||||
trial: '1',
|
||||
trialShow: false,
|
||||
form: this.$store.state.exam.courseDetail,
|
||||
options: [],
|
||||
selectDisable: false,
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }
|
||||
],
|
||||
region: [
|
||||
{ required: true, message: this.$t('publish.selectTestScope'), trigger: 'change' }
|
||||
],
|
||||
duration: [
|
||||
{ required: true, validator: duration, trigger: 'blur' }
|
||||
],
|
||||
fullMark: [
|
||||
{ required: true, validator: fullMark, trigger: 'blur' }
|
||||
],
|
||||
trial: [
|
||||
{ required: true, message: this.$t('publish.selectWetherTrial'), trigger: 'blur' }
|
||||
],
|
||||
passMark: [
|
||||
{ required: true, validator: passMark, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isEdit() {
|
||||
return this.$route.params.mode == 'edit';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'form.startDate': function (val) {
|
||||
if (val) {
|
||||
this.form.endDate = val + Number(this.form.duration * 60000);
|
||||
} else {
|
||||
this.form.endDate = '';
|
||||
}
|
||||
},
|
||||
'form.duration': function (val) {
|
||||
if (this.form.startDate) {
|
||||
this.form.endDate = this.form.startDate + Number(val * 60000);
|
||||
} else {
|
||||
this.form.endDate = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.refresh();
|
||||
},
|
||||
mounted() {
|
||||
const user = this.$store.state.user;
|
||||
const roles = user.roles;
|
||||
this.trialShow = roles.indexOf('04') != -1;
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
setData(data) {
|
||||
this.form = {
|
||||
name: data.name,
|
||||
region: data.region,
|
||||
startDate: Date.parse(new Date(data.startDate)),
|
||||
endDate: Date.parse(new Date(data.endDate)),
|
||||
desc: data.desc,
|
||||
type: data.type,
|
||||
duration: Number(data.duration),
|
||||
fullMark: data.fullMark,
|
||||
passMark: data.passMark
|
||||
};
|
||||
},
|
||||
init() {
|
||||
this.$nextTick(() => {
|
||||
if (this.$route.params.ruleId != 0) {
|
||||
getExamLessonDetail(this.$route.params.ruleId).then(res => {
|
||||
this.formDetail = {
|
||||
name: res.data.name,
|
||||
region: `${res.data.lessonId}`,
|
||||
startDate: Date.parse(new Date(res.data.startTime)),
|
||||
endDate: Date.parse(new Date(res.data.endTime)),
|
||||
desc: res.data.remarks,
|
||||
type: res.data.type,
|
||||
duration: Number(res.data.duration) / 60,
|
||||
fullMark: res.data.fullPoint,
|
||||
passMark: res.data.passingPoint
|
||||
};
|
||||
name: 'ExamFrom',
|
||||
data() {
|
||||
var fullMark = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('publish.inputFullScore')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number(value)) {
|
||||
callback(new Error(this.$t('publish.inputNumericType')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
var passMark = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('publish.inputPassingScore')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number(value)) {
|
||||
callback(new Error(this.$t('publish.inputNumericType')));
|
||||
} else {
|
||||
if (Number(value) > this.form.fullMark) {
|
||||
callback(new Error(this.$t('publish.inputScoreError')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
var duration = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('publish.inputTestDuration')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number(value)) {
|
||||
callback(new Error(this.$t('publish.inputNumericType')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
return {
|
||||
formDetail: {
|
||||
name: '',
|
||||
region: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
desc: '',
|
||||
type: '',
|
||||
duration: '',
|
||||
fullMark: '',
|
||||
passMark: ''
|
||||
},
|
||||
trial: '1',
|
||||
trialShow: false,
|
||||
form: this.$store.state.exam.courseDetail,
|
||||
options: [],
|
||||
selectDisable: false,
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }
|
||||
],
|
||||
region: [
|
||||
{ required: true, message: this.$t('publish.selectTestScope'), trigger: 'change' }
|
||||
],
|
||||
duration: [
|
||||
{ required: true, validator: duration, trigger: 'blur' }
|
||||
],
|
||||
fullMark: [
|
||||
{ required: true, validator: fullMark, trigger: 'blur' }
|
||||
],
|
||||
trial: [
|
||||
{ required: true, message: this.$t('publish.selectWetherTrial'), trigger: 'blur' }
|
||||
],
|
||||
passMark: [
|
||||
{ required: true, validator: passMark, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isEdit() {
|
||||
return this.$route.params.mode == 'edit';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'form.startDate': function (val) {
|
||||
if (val) {
|
||||
this.form.endDate = val + Number(this.form.duration * 60000);
|
||||
} else {
|
||||
this.form.endDate = '';
|
||||
}
|
||||
},
|
||||
'form.duration': function (val) {
|
||||
if (this.form.startDate) {
|
||||
this.form.endDate = this.form.startDate + Number(val * 60000);
|
||||
} else {
|
||||
this.form.endDate = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.refresh();
|
||||
},
|
||||
mounted() {
|
||||
const user = this.$store.state.user;
|
||||
const roles = user.roles;
|
||||
this.trialShow = roles.indexOf('04') != -1;
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
setData(data) {
|
||||
this.form = {
|
||||
name: data.name,
|
||||
region: data.region,
|
||||
startDate: Date.parse(new Date(data.startDate)),
|
||||
endDate: Date.parse(new Date(data.endDate)),
|
||||
desc: data.desc,
|
||||
type: data.type,
|
||||
duration: Number(data.duration),
|
||||
fullMark: data.fullMark,
|
||||
passMark: data.passMark
|
||||
};
|
||||
},
|
||||
init() {
|
||||
this.$nextTick(() => {
|
||||
if (this.$route.params.ruleId != 0) {
|
||||
getExamLessonDetail(this.$route.params.ruleId).then(res => {
|
||||
this.formDetail = {
|
||||
name: res.data.name,
|
||||
region: `${res.data.lessonId}`,
|
||||
startDate: Date.parse(new Date(res.data.startTime)),
|
||||
endDate: Date.parse(new Date(res.data.endTime)),
|
||||
desc: res.data.remarks,
|
||||
type: res.data.type,
|
||||
duration: Number(res.data.duration) / 60,
|
||||
fullMark: res.data.fullPoint,
|
||||
passMark: res.data.passingPoint
|
||||
};
|
||||
|
||||
if (!this.form.name) {
|
||||
this.$store.dispatch('exam/setCourseDetail', this.formDetail);
|
||||
this.form = this.formDetail;
|
||||
} else {
|
||||
this.$store.dispatch('exam/setCourseDetail', this.form);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!this.form.name) {
|
||||
this.$store.dispatch('exam/setCourseDetail', this.formDetail);
|
||||
this.form = this.formDetail;
|
||||
} else {
|
||||
this.$store.dispatch('exam/setCourseDetail', this.form);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.$refs.form.clearValidate();
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.form['trial'] = this.trial;
|
||||
this.$store.dispatch('exam/setCourseDetail', this.form);
|
||||
this.$emit('definition', this.form);
|
||||
}
|
||||
});
|
||||
},
|
||||
updateForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const model = {
|
||||
id: this.$route.params.ruleId,
|
||||
name: this.form.name,
|
||||
trial: this.trial == 2
|
||||
};
|
||||
this.$refs.form.clearValidate();
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.form['trial'] = this.trial;
|
||||
this.$store.dispatch('exam/setCourseDetail', this.form);
|
||||
this.$emit('definition', this.form);
|
||||
}
|
||||
});
|
||||
},
|
||||
updateForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const model = {
|
||||
id: this.$route.params.ruleId,
|
||||
name: this.form.name,
|
||||
trial: this.trial == 2
|
||||
};
|
||||
|
||||
updateExamRules(model).then(response => {
|
||||
this.$store.dispatch('exam/setCourseDetail', this.form);
|
||||
this.$message.success(this.$t('publish.updateExamRuleSuccess'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('publish.updateExamRuleFailed'));
|
||||
});
|
||||
}
|
||||
});
|
||||
updateExamRules(model).then(response => {
|
||||
this.$store.dispatch('exam/setCourseDetail', this.form);
|
||||
this.$message.success(this.$t('publish.updateExamRuleSuccess'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('publish.updateExamRuleFailed'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
refresh() {
|
||||
getPublishLessonList().then(response => {
|
||||
this.options = response.data;
|
||||
if (parseInt(this.$route.params.lessonId)) {
|
||||
this.form.region = this.$route.params.lessonId;
|
||||
this.selectDisable = true;
|
||||
}
|
||||
this.$nextTick(() => { this.$refs.form.clearValidate(); });
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('publish.refreshFailed'));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
refresh() {
|
||||
getPublishLessonList().then(response => {
|
||||
this.options = response.data;
|
||||
if (parseInt(this.$route.params.lessonId)) {
|
||||
this.form.region = this.$route.params.lessonId;
|
||||
this.selectDisable = true;
|
||||
}
|
||||
this.$nextTick(() => { this.$refs.form.clearValidate(); });
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('publish.refreshFailed'));
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.exam-rule {
|
||||
overflow-y: auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.line {
|
||||
|
@ -1,32 +1,32 @@
|
||||
<template>
|
||||
<!-- <el-card> -->
|
||||
<!-- <div v-if="lessonName" slot="header" style="text-align: center;">
|
||||
<div class="joylink-card" :class="lessonName ? 'card-box' : ''">
|
||||
<div v-if="lessonName" class="card-title">
|
||||
<b>{{ $t('publish.lessonName') }}: {{ lessonName }}</b>
|
||||
</div> -->
|
||||
<div class="exam-box">
|
||||
<el-steps class="steps" :active="display">
|
||||
<el-step :title="$t('publish.testDefinitionMaking')" icon="el-icon-edit" />
|
||||
<el-step :title="$t('publish.examRuleMaking')" icon="el-icon-setting" />
|
||||
</el-steps>
|
||||
<div class="joylink-card forms">
|
||||
<template v-if="display == 1" class="definition">
|
||||
<exam-from ref="exam" @definition="definition" />
|
||||
</template>
|
||||
<template v-else class="rule">
|
||||
<rule-from ref="rule" :course="course" @regulation="regulation" />
|
||||
</template>
|
||||
</div>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button v-if="isPrevStep" type="primary" @click="prevStep">{{ this.$t('global.lastStep') }}</el-button>
|
||||
<el-button v-if="isNextStep" type="primary" @click="nextStep">{{ this.$t('global.nextStep') }}</el-button>
|
||||
<el-button v-if="isUpdate" type="warning" @click="update">{{ $t('global.update') }}</el-button>
|
||||
<el-button v-if="isCreate" type="primary" @click="create">{{ $t('global.create') }}</el-button>
|
||||
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
||||
</el-button-group>
|
||||
<div class="exam-box" :style="{ 'height': lessonName ? 'calc(100% - 47px)' : '' }">
|
||||
<el-steps class="steps" :active="display">
|
||||
<el-step :title="$t('publish.testDefinitionMaking')" icon="el-icon-edit" />
|
||||
<el-step :title="$t('publish.examRuleMaking')" icon="el-icon-setting" />
|
||||
</el-steps>
|
||||
<div class="joylink-card forms">
|
||||
<template v-if="display == 1" class="definition">
|
||||
<exam-from ref="exam" @definition="definition" />
|
||||
</template>
|
||||
<template v-else class="rule">
|
||||
<rule-from ref="rule" :course="course" @regulation="regulation" />
|
||||
</template>
|
||||
</div>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button v-if="isPrevStep" type="primary" @click="prevStep">{{ this.$t('global.lastStep') }}</el-button>
|
||||
<el-button v-if="isNextStep" type="primary" @click="nextStep">{{ this.$t('global.nextStep') }}</el-button>
|
||||
<el-button v-if="isUpdate" type="warning" @click="update">{{ $t('global.update') }}</el-button>
|
||||
<el-button v-if="isCreate" type="primary" @click="create">{{ $t('global.create') }}</el-button>
|
||||
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </el-card> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -44,7 +44,7 @@ export default {
|
||||
return {
|
||||
display: 1,
|
||||
course: {},
|
||||
// lessonName: '',
|
||||
lessonName: '',
|
||||
formData: {}
|
||||
};
|
||||
},
|
||||
@ -69,11 +69,11 @@ export default {
|
||||
loadInitData() {
|
||||
getPublishLessonList().then(response => {
|
||||
this.OrganizationList = response.data;
|
||||
// this.OrganizationList.forEach(elem => {
|
||||
// if (elem.id == this.$route.params.lessonId) {
|
||||
// this.lessonName = elem.name;
|
||||
// }
|
||||
// });
|
||||
this.OrganizationList.forEach(elem => {
|
||||
if (elem.id == this.$route.params.lessonId) {
|
||||
this.lessonName = elem.name;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
definition(data) {
|
||||
@ -109,9 +109,21 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.joylink-card{
|
||||
.card-title{
|
||||
text-align: center;
|
||||
height: 47px;
|
||||
line-height: 47px;
|
||||
border-bottom: 1px solid #e6e6e6;
|
||||
}
|
||||
}
|
||||
.card-box{
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
.exam-box {
|
||||
padding-top: 10px;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
|
||||
/deep/ {
|
||||
.el-step__icon.is-icon {
|
||||
|
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="exam-rule">
|
||||
<span>{{$t('publish.fullScoreTips')}} {{ course.fullMark }} {{$t('publish.scorePoints')}}</span>
|
||||
<el-button class="addList" size="small" @click="handleAdd">{{$t('publish.addRules')}}</el-button>
|
||||
<el-table :data="ruleList" border show-summary style="width: 100%" :height="height">
|
||||
<span>{{ $t('publish.fullScoreTips') }} {{ course.fullMark }} {{ $t('publish.scorePoints') }}</span>
|
||||
<el-button class="addList" size="small" @click="handleAdd">{{ $t('publish.addRules') }}</el-button>
|
||||
<el-table :data="ruleList" border show-summary style="width: 100%; min-height: 300px;">
|
||||
<el-table-column prop="name" :label="$t('publish.trainingType')" />
|
||||
<el-table-column prop="num" :label="$t('publish.questionsNumber')" width="100" />
|
||||
<el-table-column prop="point" :label="$t('publish.eachScore')" width="100" />
|
||||
@ -14,10 +14,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <div class="btn-footer">
|
||||
<el-button @click="regulation">上一步</el-button>
|
||||
<el-button type="primary" @click="creatOk">新增</el-button>
|
||||
</div> -->
|
||||
<edit-rule
|
||||
ref="addRule"
|
||||
:course-id="courseId"
|
||||
@ -35,244 +31,240 @@ import { UrlConfig } from '@/router/index';
|
||||
import editRule from './editRule';
|
||||
|
||||
export default {
|
||||
name: 'Rule',
|
||||
components: {
|
||||
editRule
|
||||
},
|
||||
props: {
|
||||
course: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 800
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ruleList: this.$store.state.exam.ruleList,
|
||||
courseId: this.course.region,
|
||||
editCourse: {},
|
||||
formDetail: {
|
||||
name: '',
|
||||
region: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
desc: '',
|
||||
type: '',
|
||||
duration: '',
|
||||
fullMark: '',
|
||||
passMark: ''
|
||||
},
|
||||
form: {
|
||||
course: '',
|
||||
number: '',
|
||||
mark: ''
|
||||
},
|
||||
typeList: [],
|
||||
trainingOperateTypeMap: {}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
async mounted() {
|
||||
this.trainingOperateTypeMap = {};
|
||||
this.$Dictionary.stationControl().then(list => {
|
||||
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
||||
});
|
||||
this.$Dictionary.signalOperation().then(list => {
|
||||
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
||||
});
|
||||
this.$Dictionary.switchOperation().then(list => {
|
||||
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
||||
});
|
||||
this.$Dictionary.sectionOperation().then(list => {
|
||||
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
||||
});
|
||||
this.$Dictionary.stationStandOperation().then(list => {
|
||||
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
||||
});
|
||||
this.$Dictionary.trainPlanOperation().then(list => {
|
||||
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
||||
});
|
||||
this.$Dictionary.trainOperation().then(list => {
|
||||
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
||||
});
|
||||
await this.getList();
|
||||
await this.init();
|
||||
},
|
||||
methods: {
|
||||
async getList() {
|
||||
this.typeList = [];
|
||||
await getDetailList('training_type').then(res => {
|
||||
this.typeList = res.data;
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
async init() {
|
||||
if (this.$route.params.ruleId != 0 && this.ruleList.length == 0) {
|
||||
await getExamLessonDetail(this.$route.params.ruleId).then(res => {
|
||||
if (res.code == 200) {
|
||||
const arr = res.data.examDefinitionRulesVOList;
|
||||
arr.forEach((ele, index) => {
|
||||
this.typeList.forEach(v => {
|
||||
if (ele.trainingType == v.code) {
|
||||
arr[index].name = v.name;
|
||||
if (ele.operateType) {
|
||||
this.trainingOperateTypeMap[ele.trainingType].forEach(item => {
|
||||
if (item.code == ele.operateType) {
|
||||
arr[index].name = `${v.name}-${item.name}`;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
this.ruleList = arr;
|
||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||
this.ruleList.forEach(res => {
|
||||
res.chapterIdLong = Number(res.num) * Number(res.point);
|
||||
});
|
||||
this.changeCourseDisable();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
handleAdd() {
|
||||
this.$refs.addRule.show();
|
||||
},
|
||||
async creatOk() {
|
||||
if (this.ruleList.length) {
|
||||
let flag = 0;
|
||||
this.ruleList.forEach(res => {
|
||||
flag += Number(res.chapterIdLong);
|
||||
});
|
||||
if (flag == this.course.fullMark) {
|
||||
const result = {
|
||||
duration: Number(this.course.duration) * 60, // 时长
|
||||
examDefinitionRulesVOList: this.ruleList, // 规则
|
||||
fullPoint: Number(this.course.fullMark), // 满分
|
||||
lessonId: this.course.region, // 课程id
|
||||
name: this.course.name, // 名称
|
||||
passingPoint: Number(this.course.passMark), // 及格分
|
||||
remarks: this.course.desc, // 考试说明
|
||||
endTime: this.course.endDate,
|
||||
startTime: this.course.startDate,
|
||||
type: this.course.type, // 类型
|
||||
trial: this.course.trial == 2 // 权限判断
|
||||
};
|
||||
await this.save(result);
|
||||
} else {
|
||||
this.$messageBox(this.$t('publish.addExamRluesError'));
|
||||
}
|
||||
} else {
|
||||
this.$messageBox(this.$t('publish.addExamRules'));
|
||||
}
|
||||
},
|
||||
save(data) {
|
||||
setCourseList(data).then(res => {
|
||||
this.$message.success({ message: res.message });
|
||||
this.$store.dispatch('exam/setCourseDetail', this.formDetail); // 清空 form 表单数据
|
||||
this.$store.dispatch('exam/setRuleList', []); // 清空规则列表数据
|
||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`;
|
||||
const lessonId = this.$route.params.lessonId;
|
||||
if (parseInt(lessonId)) {
|
||||
this.$router.push({ path: `${path}`, query: { lessonId: lessonId } });
|
||||
} else {
|
||||
this.$router.push({ path: `${path}` });
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$messageBox(`${this.$t('publish.saveRuleFailed')} ${error.message}`);
|
||||
});
|
||||
},
|
||||
addRuleList(data) {
|
||||
var arr = this.$store.state.exam.courseList;
|
||||
let value;
|
||||
arr.forEach(res => {
|
||||
if (res.code == data.course) {
|
||||
value = res;
|
||||
return value;
|
||||
}
|
||||
});
|
||||
let titleName = value.name;
|
||||
if (data.name) {
|
||||
titleName = `${value.name}-${data.name}`;
|
||||
}
|
||||
const element = {
|
||||
trainingType: data.course,
|
||||
operateType: data.operateType,
|
||||
num: Number(data.number),
|
||||
point: Number(data.mark),
|
||||
name: titleName,
|
||||
chapterIdLong: Number(data.number) * Number(data.mark)
|
||||
};
|
||||
this.ruleList.push(element);
|
||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||
this.changeCourseDisable();
|
||||
},
|
||||
// 判断类型是否选择过
|
||||
changeCourseDisable() {
|
||||
const arr = this.$store.state.exam.courseList;
|
||||
this.ruleList.forEach(ele => {
|
||||
arr.forEach(res => {
|
||||
if (ele.trainingType == res.code && !ele.operateType) {
|
||||
res.disabled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
editRuleList(data) {
|
||||
var arr = this.$store.state.exam.courseList;
|
||||
let value;
|
||||
arr.forEach(res => {
|
||||
if (res.code == data.course) {
|
||||
value = res;
|
||||
return value;
|
||||
}
|
||||
});
|
||||
let titleName = value.name;
|
||||
if (data.name) {
|
||||
titleName = `${value.name}-${data.name}`;
|
||||
}
|
||||
const element = {
|
||||
trainingType: data.course,
|
||||
operateType: data.operateType,
|
||||
num: Number(data.number),
|
||||
point: Number(data.mark),
|
||||
name: titleName,
|
||||
chapterIdLong: data.number * data.mark
|
||||
};
|
||||
this.ruleList.splice(this.indexCourse, 1, element);
|
||||
},
|
||||
handleForm(data) {
|
||||
// 子元素监听 editCourse 每次改变值
|
||||
this.indexCourse = data.$index;
|
||||
const list = JSON.stringify(data.row);
|
||||
const detail = JSON.parse(list);
|
||||
var arr = this.$store.state.exam.courseList;
|
||||
arr.forEach(res => {
|
||||
if (res.name == detail.name) {
|
||||
detail.name = res.id;
|
||||
return detail.name;
|
||||
}
|
||||
});
|
||||
this.editCourse = detail;
|
||||
this.handleAdd();
|
||||
},
|
||||
deleteForm(data) {
|
||||
const index = data.$index;
|
||||
this.ruleList.splice(index, 1);
|
||||
this.$refs.addRule.changeListDisabled(data.row.trainingType);
|
||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||
},
|
||||
regulation() {
|
||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||
this.$emit('regulation', this.course);
|
||||
}
|
||||
}
|
||||
name: 'Rule',
|
||||
components: {
|
||||
editRule
|
||||
},
|
||||
props: {
|
||||
course: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ruleList: this.$store.state.exam.ruleList,
|
||||
courseId: this.course.region,
|
||||
editCourse: {},
|
||||
formDetail: {
|
||||
name: '',
|
||||
region: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
desc: '',
|
||||
type: '',
|
||||
duration: '',
|
||||
fullMark: '',
|
||||
passMark: ''
|
||||
},
|
||||
form: {
|
||||
course: '',
|
||||
number: '',
|
||||
mark: ''
|
||||
},
|
||||
typeList: [],
|
||||
trainingOperateTypeMap: {}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
async mounted() {
|
||||
this.trainingOperateTypeMap = {};
|
||||
this.$Dictionary.stationControl().then(list => {
|
||||
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
||||
});
|
||||
this.$Dictionary.signalOperation().then(list => {
|
||||
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
||||
});
|
||||
this.$Dictionary.switchOperation().then(list => {
|
||||
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
||||
});
|
||||
this.$Dictionary.sectionOperation().then(list => {
|
||||
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
||||
});
|
||||
this.$Dictionary.stationStandOperation().then(list => {
|
||||
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
||||
});
|
||||
this.$Dictionary.trainPlanOperation().then(list => {
|
||||
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
||||
});
|
||||
this.$Dictionary.trainOperation().then(list => {
|
||||
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
||||
});
|
||||
await this.getList();
|
||||
await this.init();
|
||||
},
|
||||
methods: {
|
||||
async getList() {
|
||||
this.typeList = [];
|
||||
await getDetailList('training_type').then(res => {
|
||||
this.typeList = res.data;
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
async init() {
|
||||
if (this.$route.params.ruleId != 0 && this.ruleList.length == 0) {
|
||||
await getExamLessonDetail(this.$route.params.ruleId).then(res => {
|
||||
if (res.code == 200) {
|
||||
const arr = res.data.examDefinitionRulesVOList;
|
||||
arr.forEach((ele, index) => {
|
||||
this.typeList.forEach(v => {
|
||||
if (ele.trainingType == v.code) {
|
||||
arr[index].name = v.name;
|
||||
if (ele.operateType) {
|
||||
this.trainingOperateTypeMap[ele.trainingType].forEach(item => {
|
||||
if (item.code == ele.operateType) {
|
||||
arr[index].name = `${v.name}-${item.name}`;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
this.ruleList = arr;
|
||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||
this.ruleList.forEach(res => {
|
||||
res.chapterIdLong = Number(res.num) * Number(res.point);
|
||||
});
|
||||
this.changeCourseDisable();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
handleAdd() {
|
||||
this.$refs.addRule.show();
|
||||
},
|
||||
async creatOk() {
|
||||
if (this.ruleList.length) {
|
||||
let flag = 0;
|
||||
this.ruleList.forEach(res => {
|
||||
flag += Number(res.chapterIdLong);
|
||||
});
|
||||
if (flag == this.course.fullMark) {
|
||||
const result = {
|
||||
duration: Number(this.course.duration) * 60, // 时长
|
||||
examDefinitionRulesVOList: this.ruleList, // 规则
|
||||
fullPoint: Number(this.course.fullMark), // 满分
|
||||
lessonId: this.course.region, // 课程id
|
||||
name: this.course.name, // 名称
|
||||
passingPoint: Number(this.course.passMark), // 及格分
|
||||
remarks: this.course.desc, // 考试说明
|
||||
endTime: this.course.endDate,
|
||||
startTime: this.course.startDate,
|
||||
type: this.course.type, // 类型
|
||||
trial: this.course.trial == 2 // 权限判断
|
||||
};
|
||||
await this.save(result);
|
||||
} else {
|
||||
this.$messageBox(this.$t('publish.addExamRluesError'));
|
||||
}
|
||||
} else {
|
||||
this.$messageBox(this.$t('publish.addExamRules'));
|
||||
}
|
||||
},
|
||||
save(data) {
|
||||
setCourseList(data).then(res => {
|
||||
this.$message.success({ message: res.message });
|
||||
this.$store.dispatch('exam/setCourseDetail', this.formDetail); // 清空 form 表单数据
|
||||
this.$store.dispatch('exam/setRuleList', []); // 清空规则列表数据
|
||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`;
|
||||
const lessonId = this.$route.params.lessonId;
|
||||
if (parseInt(lessonId)) {
|
||||
this.$router.push({ path: `${path}`, query: { lessonId: lessonId } });
|
||||
} else {
|
||||
this.$router.push({ path: `${path}` });
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$messageBox(`${this.$t('publish.saveRuleFailed')} ${error.message}`);
|
||||
});
|
||||
},
|
||||
addRuleList(data) {
|
||||
var arr = this.$store.state.exam.courseList;
|
||||
let value;
|
||||
arr.forEach(res => {
|
||||
if (res.code == data.course) {
|
||||
value = res;
|
||||
return value;
|
||||
}
|
||||
});
|
||||
let titleName = value.name;
|
||||
if (data.name) {
|
||||
titleName = `${value.name}-${data.name}`;
|
||||
}
|
||||
const element = {
|
||||
trainingType: data.course,
|
||||
operateType: data.operateType,
|
||||
num: Number(data.number),
|
||||
point: Number(data.mark),
|
||||
name: titleName,
|
||||
chapterIdLong: Number(data.number) * Number(data.mark)
|
||||
};
|
||||
this.ruleList.push(element);
|
||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||
this.changeCourseDisable();
|
||||
},
|
||||
// 判断类型是否选择过
|
||||
changeCourseDisable() {
|
||||
const arr = this.$store.state.exam.courseList;
|
||||
this.ruleList.forEach(ele => {
|
||||
arr.forEach(res => {
|
||||
if (ele.trainingType == res.code && !ele.operateType) {
|
||||
res.disabled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
editRuleList(data) {
|
||||
var arr = this.$store.state.exam.courseList;
|
||||
let value;
|
||||
arr.forEach(res => {
|
||||
if (res.code == data.course) {
|
||||
value = res;
|
||||
return value;
|
||||
}
|
||||
});
|
||||
let titleName = value.name;
|
||||
if (data.name) {
|
||||
titleName = `${value.name}-${data.name}`;
|
||||
}
|
||||
const element = {
|
||||
trainingType: data.course,
|
||||
operateType: data.operateType,
|
||||
num: Number(data.number),
|
||||
point: Number(data.mark),
|
||||
name: titleName,
|
||||
chapterIdLong: data.number * data.mark
|
||||
};
|
||||
this.ruleList.splice(this.indexCourse, 1, element);
|
||||
},
|
||||
handleForm(data) {
|
||||
// 子元素监听 editCourse 每次改变值
|
||||
this.indexCourse = data.$index;
|
||||
const list = JSON.stringify(data.row);
|
||||
const detail = JSON.parse(list);
|
||||
var arr = this.$store.state.exam.courseList;
|
||||
arr.forEach(res => {
|
||||
if (res.name == detail.name) {
|
||||
detail.name = res.id;
|
||||
return detail.name;
|
||||
}
|
||||
});
|
||||
this.editCourse = detail;
|
||||
this.handleAdd();
|
||||
},
|
||||
deleteForm(data) {
|
||||
const index = data.$index;
|
||||
this.ruleList.splice(index, 1);
|
||||
this.$refs.addRule.changeListDisabled(data.row.trainingType);
|
||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||
},
|
||||
regulation() {
|
||||
this.$store.dispatch('exam/setRuleList', this.ruleList);
|
||||
this.$emit('regulation', this.course);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
@ -1,20 +1,14 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<div v-if="lessonName" slot="header" style="text-align: center;">
|
||||
<div class="joylink-card">
|
||||
<div v-if="lessonName" class="card-title">
|
||||
<b>{{ $t('publish.lessonName') }}: {{ lessonName }}</b>
|
||||
</div>
|
||||
<div :style="{ height: height +'px' }">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" style="">
|
||||
<QueryListPage
|
||||
ref="queryListPage"
|
||||
:pager-config="pagerConfig"
|
||||
:query-form="queryForm"
|
||||
:query-list="queryList"
|
||||
style="height: 100%;"
|
||||
/>
|
||||
<div :style="{ 'height': lessonName ? 'calc(100% - 47px)' : '100%' }">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -23,307 +17,311 @@ import { getPublishLessonList } from '@/api/jmap/lesson';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
|
||||
export default {
|
||||
name: 'List',
|
||||
data() {
|
||||
return {
|
||||
BizTypeList: [],
|
||||
OrderTypeList: [],
|
||||
PayTypeList: [],
|
||||
PayStatusList: [],
|
||||
OrganizationList: [],
|
||||
EffectiveTypeList: [],
|
||||
userId: this.$store.state.user.id,
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
lessonName: '',
|
||||
queryForm: {
|
||||
labelWidth: '160px',
|
||||
queryObject: {
|
||||
'lessonId': {
|
||||
type: this.$route.query.lessonId ? '' : 'select',
|
||||
label: this.$t('publish.lessonName'),
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
},
|
||||
'name': {
|
||||
type: 'text',
|
||||
label: this.$t('publish.paperName')
|
||||
},
|
||||
'creatorName': {
|
||||
type: 'text',
|
||||
label: this.$t('publish.creator')
|
||||
}
|
||||
},
|
||||
reset: !this.$route.query.lessonId
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('publish.lessonName'),
|
||||
prop: 'lessonId',
|
||||
type: 'tag',
|
||||
show: !this.$route.query.lessonId,
|
||||
columnValue: (row) => { return this.$convertField(row.lessonId, this.OrganizationList, ['id', 'name']); },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: this.$t('publish.paperName'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('publish.creator'),
|
||||
prop: 'creatorName'
|
||||
},
|
||||
{
|
||||
title: this.$t('global.isTry'),
|
||||
prop: 'trial',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$ConstSelect.translate(row.trial, 'Whether'); },
|
||||
tagType: (row) => {
|
||||
switch (row.trial) {
|
||||
case true: return 'success';
|
||||
case false: return 'danger';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('global.duration'),
|
||||
prop: 'duration',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.durationField(row.duration); },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: this.$t('publish.examTime'),
|
||||
prop: 'startTime',
|
||||
type: 'formatter',
|
||||
format: 'yyyy-MM-dd hh:ss'
|
||||
},
|
||||
{
|
||||
title: this.$t('publish.fullMark'),
|
||||
prop: 'fullPoint'
|
||||
},
|
||||
{
|
||||
title: this.$t('publish.passScore'),
|
||||
prop: 'passingPoint'
|
||||
},
|
||||
{
|
||||
title: this.$t('global.status'),
|
||||
prop: 'status',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
|
||||
tagType: (row) => {
|
||||
switch (row.status) {
|
||||
case '1': return 'success';
|
||||
default: return 'danger';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '380',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('global.fastCreate'),
|
||||
type: 'primary',
|
||||
handleClick: this.handleDistribute,
|
||||
showControl: (row) => { return row.bizType !== '02'; }
|
||||
},
|
||||
{
|
||||
name: this.$t('global.edit'),
|
||||
type: 'primary',
|
||||
showControl: (row) => { return row.creatorId == this.userId; },
|
||||
handleClick: this.handleUpdate
|
||||
},
|
||||
{
|
||||
name: this.$t('global.soldOut'),
|
||||
type: 'warning',
|
||||
handleClick: this.handleEfficacy,
|
||||
showControl: (row) => {
|
||||
return !this.$route.query.lessonId && row.status == 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('publish.lessonDeleteBtn'),
|
||||
type: 'warning',
|
||||
handleClick: this.handleDelete,
|
||||
showControl: (row) => {
|
||||
return this.$route.query.lessonId && row.status == 1 && row.creatorId == this.userId;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('global.putaway'),
|
||||
type: 'primary',
|
||||
handleClick: this.handleEffective,
|
||||
showControl: (row) => {
|
||||
return (this.$route.query.lessonId ? row.creatorId == this.userId : true) && row.status != 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
type: 'danger',
|
||||
handleClick: this.deleteList,
|
||||
showControl: (row) => { return row.creatorId == this.userId; }
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('global.add'), btnCode: 'employee_insert', handler: this.handleNormalAdd },
|
||||
{ text: this.$t('global.back'), btnCode: 'employee_back', handler: this.handlerBack }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return /\/exam\//.test(`${this.$route.path}`)? this.$store.state.app.height - 92: this.$store.state.app.height - 65;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadInitData();
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('exam/setCourseDetail', {});
|
||||
this.$store.dispatch('exam/setRuleList', []);
|
||||
},
|
||||
methods: {
|
||||
loadInitData() {
|
||||
this.queryForm.queryObject.lessonId.config.data.length = 0;
|
||||
getPublishLessonList().then(response => {
|
||||
this.OrganizationList = response.data;
|
||||
this.OrganizationList.forEach(elem => {
|
||||
if (elem.id == this.$route.query.lessonId) {
|
||||
this.lessonName = elem.name;
|
||||
}
|
||||
this.queryForm.queryObject.lessonId.config.data.push({ value: elem.id, label: elem.name });
|
||||
});
|
||||
});
|
||||
name: 'List',
|
||||
data() {
|
||||
return {
|
||||
BizTypeList: [],
|
||||
OrderTypeList: [],
|
||||
PayTypeList: [],
|
||||
PayStatusList: [],
|
||||
OrganizationList: [],
|
||||
EffectiveTypeList: [],
|
||||
userId: this.$store.state.user.id,
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
lessonName: '',
|
||||
queryForm: {
|
||||
labelWidth: '160px',
|
||||
queryObject: {
|
||||
'lessonId': {
|
||||
type: this.$route.query.lessonId ? '' : 'select',
|
||||
label: this.$t('publish.lessonName'),
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
},
|
||||
'name': {
|
||||
type: 'text',
|
||||
label: this.$t('publish.paperName')
|
||||
},
|
||||
'creatorName': {
|
||||
type: 'text',
|
||||
label: this.$t('publish.creator')
|
||||
}
|
||||
},
|
||||
reset: !this.$route.query.lessonId
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('publish.lessonName'),
|
||||
prop: 'lessonId',
|
||||
type: 'tag',
|
||||
show: !this.$route.query.lessonId,
|
||||
columnValue: (row) => { return this.$convertField(row.lessonId, this.OrganizationList, ['id', 'name']); },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: this.$t('publish.paperName'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('publish.creator'),
|
||||
prop: 'creatorName'
|
||||
},
|
||||
{
|
||||
title: this.$t('global.isTry'),
|
||||
prop: 'trial',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$ConstSelect.translate(row.trial, 'Whether'); },
|
||||
tagType: (row) => {
|
||||
switch (row.trial) {
|
||||
case true: return 'success';
|
||||
case false: return 'danger';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('global.duration'),
|
||||
prop: 'duration',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.durationField(row.duration); },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: this.$t('publish.examTime'),
|
||||
prop: 'startTime',
|
||||
type: 'formatter',
|
||||
format: 'yyyy-MM-dd hh:ss'
|
||||
},
|
||||
{
|
||||
title: this.$t('publish.fullMark'),
|
||||
prop: 'fullPoint'
|
||||
},
|
||||
{
|
||||
title: this.$t('publish.passScore'),
|
||||
prop: 'passingPoint'
|
||||
},
|
||||
{
|
||||
title: this.$t('global.status'),
|
||||
prop: 'status',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
|
||||
tagType: (row) => {
|
||||
switch (row.status) {
|
||||
case '1': return 'success';
|
||||
default: return 'danger';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '380',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('global.fastCreate'),
|
||||
type: 'primary',
|
||||
handleClick: this.handleDistribute,
|
||||
showControl: (row) => { return row.bizType !== '02'; }
|
||||
},
|
||||
{
|
||||
name: this.$t('global.edit'),
|
||||
type: 'primary',
|
||||
showControl: (row) => { return row.creatorId == this.userId; },
|
||||
handleClick: this.handleUpdate
|
||||
},
|
||||
{
|
||||
name: this.$t('global.soldOut'),
|
||||
type: 'warning',
|
||||
handleClick: this.handleEfficacy,
|
||||
showControl: (row) => {
|
||||
return !this.$route.query.lessonId && row.status == 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('publish.lessonDeleteBtn'),
|
||||
type: 'warning',
|
||||
handleClick: this.handleDelete,
|
||||
showControl: (row) => {
|
||||
return this.$route.query.lessonId && row.status == 1 && row.creatorId == this.userId;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('global.putaway'),
|
||||
type: 'primary',
|
||||
handleClick: this.handleEffective,
|
||||
showControl: (row) => {
|
||||
return (this.$route.query.lessonId ? row.creatorId == this.userId : true) && row.status != 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
type: 'danger',
|
||||
handleClick: this.deleteList,
|
||||
showControl: (row) => { return row.creatorId == this.userId; }
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('global.add'), btnCode: 'employee_insert', handler: this.handleNormalAdd },
|
||||
{ text: this.$t('global.back'), btnCode: 'employee_back', handler: this.handlerBack }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loadInitData();
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('exam/setCourseDetail', {});
|
||||
this.$store.dispatch('exam/setRuleList', []);
|
||||
},
|
||||
methods: {
|
||||
loadInitData() {
|
||||
this.queryForm.queryObject.lessonId.config.data.length = 0;
|
||||
getPublishLessonList().then(response => {
|
||||
this.OrganizationList = response.data;
|
||||
this.OrganizationList.forEach(elem => {
|
||||
if (elem.id == this.$route.query.lessonId) {
|
||||
this.lessonName = elem.name;
|
||||
}
|
||||
this.queryForm.queryObject.lessonId.config.data.push({ value: elem.id, label: elem.name });
|
||||
});
|
||||
});
|
||||
|
||||
this.$Dictionary.effectiveType().then(list => {
|
||||
this.$convertList(list, this.EffectiveTypeList, elem => {
|
||||
return true;
|
||||
});
|
||||
});
|
||||
},
|
||||
durationField(fieldValue) {
|
||||
if (fieldValue) {
|
||||
const time = Number(fieldValue) / 60;
|
||||
return `${time} ${this.$t('publish.durationMinutes')}`;
|
||||
}
|
||||
},
|
||||
queryFunction(params) {
|
||||
if (this.$route.query.lessonId) {
|
||||
params.lessonId = this.$route.query.lessonId;
|
||||
params.status = '1';
|
||||
}
|
||||
return getExamList(params);
|
||||
},
|
||||
handleNormalAdd() {
|
||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
||||
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
||||
this.$router.push({ path: `${path}/add/0/${lessonId}` });
|
||||
},
|
||||
handleUpdate(index, data) {
|
||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
||||
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
||||
this.$router.push({ path: `${path}/edit/${data.id}/${lessonId}` });
|
||||
},
|
||||
handleDistribute(index, data) {
|
||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
||||
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
||||
this.$router.push({ path: `${path}/add/${data.id}/${lessonId}` });
|
||||
},
|
||||
// 删除
|
||||
deleteList(index, data) {
|
||||
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteExam(data).then(res => {
|
||||
this.queryList.reload();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('publish.setSuccess')
|
||||
});
|
||||
}).catch(res => {
|
||||
if (res.code == '500009') {
|
||||
this.$message({ type: 'warning', message: this.$t('error.paperHasUseNotDel') });
|
||||
} else {
|
||||
this.$message({ type: 'error', message: this.$t('error.deleteException') });
|
||||
}
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
// 下架
|
||||
handleDelete(index, data) {
|
||||
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
setExamEfficacy(data).then(res => {
|
||||
this.queryList.reload();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('publish.setSuccess')
|
||||
});
|
||||
}).catch(res => {
|
||||
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
// 下架
|
||||
handleEfficacy(index, data) {
|
||||
this.$confirm(this.$t('publish.wellSoldOutPaper'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
setExamEfficacy(data).then(res => {
|
||||
this.queryList.reload();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('publish.setSuccess')
|
||||
});
|
||||
}).catch(res => {
|
||||
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
// 上架
|
||||
handleEffective(index, data) {
|
||||
this.$confirm(this.$t('publish.wellPutawayPaper'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
setExamEffectivey(data).then(res => {
|
||||
this.queryList.reload();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('publish.setSuccess')
|
||||
});
|
||||
}).catch(res => {
|
||||
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
handlerBack() {
|
||||
this.$router.back();
|
||||
}
|
||||
}
|
||||
this.$Dictionary.effectiveType().then(list => {
|
||||
this.$convertList(list, this.EffectiveTypeList, elem => {
|
||||
return true;
|
||||
});
|
||||
});
|
||||
},
|
||||
durationField(fieldValue) {
|
||||
if (fieldValue) {
|
||||
const time = Number(fieldValue) / 60;
|
||||
return `${time} ${this.$t('publish.durationMinutes')}`;
|
||||
}
|
||||
},
|
||||
queryFunction(params) {
|
||||
if (this.$route.query.lessonId) {
|
||||
params.lessonId = this.$route.query.lessonId;
|
||||
params.status = '1';
|
||||
}
|
||||
return getExamList(params);
|
||||
},
|
||||
handleNormalAdd() {
|
||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
||||
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
||||
this.$router.push({ path: `${path}/add/0/${lessonId}` });
|
||||
},
|
||||
handleUpdate(index, data) {
|
||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
||||
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
||||
this.$router.push({ path: `${path}/edit/${data.id}/${lessonId}` });
|
||||
},
|
||||
handleDistribute(index, data) {
|
||||
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleDraft}`;
|
||||
const lessonId = this.$route.query.lessonId ? this.$route.query.lessonId : 0;
|
||||
this.$router.push({ path: `${path}/add/${data.id}/${lessonId}` });
|
||||
},
|
||||
// 删除
|
||||
deleteList(index, data) {
|
||||
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteExam(data).then(res => {
|
||||
this.queryList.reload();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('publish.setSuccess')
|
||||
});
|
||||
}).catch(res => {
|
||||
if (res.code == '500009') {
|
||||
this.$message({ type: 'warning', message: this.$t('error.paperHasUseNotDel') });
|
||||
} else {
|
||||
this.$message({ type: 'error', message: this.$t('error.deleteException') });
|
||||
}
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
// 下架
|
||||
handleDelete(index, data) {
|
||||
this.$confirm(this.$t('publish.wellDelPaper'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
setExamEfficacy(data).then(res => {
|
||||
this.queryList.reload();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('publish.setSuccess')
|
||||
});
|
||||
}).catch(res => {
|
||||
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
// 下架
|
||||
handleEfficacy(index, data) {
|
||||
this.$confirm(this.$t('publish.wellSoldOutPaper'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
setExamEfficacy(data).then(res => {
|
||||
this.queryList.reload();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('publish.setSuccess')
|
||||
});
|
||||
}).catch(res => {
|
||||
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
// 上架
|
||||
handleEffective(index, data) {
|
||||
this.$confirm(this.$t('publish.wellPutawayPaper'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
setExamEffectivey(data).then(res => {
|
||||
this.queryList.reload();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('publish.setSuccess')
|
||||
});
|
||||
}).catch(res => {
|
||||
this.$message({ type: 'warning', message: `${this.$t('error.setFailed')}${res.message}` });
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
handlerBack() {
|
||||
this.$router.back();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.joylink-card {
|
||||
height: 100%;
|
||||
}
|
||||
.card-title{
|
||||
text-align: center;
|
||||
height: 47px;
|
||||
line-height: 47px;
|
||||
border-bottom: 1px solid #e6e6e6;
|
||||
}
|
||||
/deep/ {
|
||||
.is-always-shadow {
|
||||
box-shadow: none;
|
||||
|
@ -2,7 +2,7 @@
|
||||
<el-dialog v-dialogDrag title="复制地图为" :visible.sync="dialogVisible" width="30%" center>
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
@ -19,6 +19,7 @@ export default {
|
||||
name: '',
|
||||
copyOtherData: false
|
||||
},
|
||||
loading: false,
|
||||
mapId: '',
|
||||
form:{
|
||||
labelWidth: '100px',
|
||||
@ -46,10 +47,18 @@ export default {
|
||||
this.mapId = row.id;
|
||||
},
|
||||
doSave() {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
copyMapAs(this.mapId, this.formModel).then(resp =>{
|
||||
this.$message.success('复制地图成功!');
|
||||
this.loading = false;
|
||||
this.dialogVisible = false;
|
||||
this.$emit('refresh');
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$messageBox(`复制地图失败!`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
@ -45,6 +45,7 @@ export default {
|
||||
project: false,
|
||||
projectCode: ''
|
||||
},
|
||||
loading: false,
|
||||
projectCodeShow: false,
|
||||
booleanValue: {
|
||||
t: true,
|
||||
@ -63,10 +64,17 @@ export default {
|
||||
doSave() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
setMapProject(this.formModel).then(resp =>{
|
||||
this.$message.success('设置归属项目成功!');
|
||||
this.loading = false;
|
||||
this.dialogVisible = false;
|
||||
this.$emit('refresh');
|
||||
}).catch( ()=>{
|
||||
this.$messageBox(`设置归属项目失败!`);
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
|
138
src/views/system/dictionary/index.vue
Normal file
138
src/views/system/dictionary/index.vue
Normal file
@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<div>
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<dictionary-edit ref="create" type="ADD" @reloadTable="reloadTable" />
|
||||
<dictionary-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { list, del } from '@/api/management/dictionary';
|
||||
import DictionaryEdit from '@/views/system/dictionary/edit';
|
||||
|
||||
export default {
|
||||
name: 'Dictionary',
|
||||
components: {
|
||||
DictionaryEdit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '80px',
|
||||
reset: true,
|
||||
queryObject: {
|
||||
code: {
|
||||
type: 'text',
|
||||
label: this.$t('system.code')
|
||||
},
|
||||
name: {
|
||||
type: 'text',
|
||||
label: this.$t('system.name')
|
||||
},
|
||||
status: {
|
||||
type: 'select',
|
||||
label: this.$t('system.status'),
|
||||
config: {
|
||||
data: this.$ConstSelect.Status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
queryList: {
|
||||
query: list,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('system.code'),
|
||||
prop: 'code'
|
||||
},
|
||||
{
|
||||
title: this.$t('system.name'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('system.status'),
|
||||
prop: 'status',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'Status'); },
|
||||
tagType: (row) => { if (row.status === '0') { return 'danger'; } else { return 'success'; } }
|
||||
},
|
||||
{
|
||||
title: this.$t('system.remarks'),
|
||||
prop: 'remarks'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '250',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('global.detail'),
|
||||
handleClick: this.handleViewDetail
|
||||
},
|
||||
{
|
||||
name: this.$t('global.edit'),
|
||||
handleClick: this.handleEdit
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
handleClick: this.handleDelete,
|
||||
type: 'danger'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('global.add'), handler: this.handleAdd }
|
||||
// { text: '批量删除', btnCode: 'employee_delete', handler: this.handleBatchDelete, type: 'danger' }
|
||||
]
|
||||
},
|
||||
|
||||
currentModel: {}
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleViewDetail(index, row) {
|
||||
this.$router.push({ path: `/system/dictionary/detail`, query: { id: row.id } });
|
||||
},
|
||||
|
||||
handleEdit(index, row) {
|
||||
this.$refs.edit.show(row.id);
|
||||
},
|
||||
|
||||
handleAdd() {
|
||||
this.$refs.create.show();
|
||||
},
|
||||
|
||||
handleBatchDelete() {
|
||||
},
|
||||
|
||||
handleDelete(index, row) {
|
||||
this.$confirm(this.$t('system.wellDelType'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
del(row.id).then(response => {
|
||||
this.$message.success(this.$t('system.deleteSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.reloadTable();
|
||||
this.$messageBox(this.$t('error.deleteFailed'));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
reloadTable() {
|
||||
this.queryList.reload();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
167
src/views/system/dictionaryDetail/index.vue
Normal file
167
src/views/system/dictionaryDetail/index.vue
Normal file
@ -0,0 +1,167 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- <turnback-bar :title="turnbackBarTitle"></turnback-bar> -->
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<dictionary-detail-edit ref="create" type="ADD" :dic-id="dicId" @reloadTable="reloadTable" />
|
||||
<dictionary-detail-edit ref="edit" type="EDIT" :dic-id="dicId" @reloadTable="reloadTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { list, del } from '@/api/management/dictionaryDetail';
|
||||
import { getData } from '@/api/management/dictionary';
|
||||
import DictionaryDetailEdit from '@/views/system/dictionaryDetail/edit';
|
||||
export default {
|
||||
name: 'DictionaryDetail',
|
||||
components: {
|
||||
DictionaryDetailEdit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dicId: '',
|
||||
dic: {},
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '80px',
|
||||
reset: true,
|
||||
queryObject: {
|
||||
code: {
|
||||
type: 'text',
|
||||
label: this.$t('global.code')
|
||||
},
|
||||
name: {
|
||||
type: 'text',
|
||||
label: this.$t('global.name')
|
||||
},
|
||||
status: {
|
||||
type: 'select',
|
||||
label: this.$t('global.status'),
|
||||
config: {
|
||||
data: this.$ConstSelect.Status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('global.code'),
|
||||
prop: 'code'
|
||||
},
|
||||
{
|
||||
title: this.$t('global.name'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('global.status'),
|
||||
prop: 'status',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'Status'); },
|
||||
tagType: (row) => { if (row.status === '0') { return 'danger'; } else { return 'success'; } }
|
||||
},
|
||||
{
|
||||
title: this.$t('global.remarks'),
|
||||
prop: 'remarks'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '250',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('global.edit'),
|
||||
handleClick: this.handleEdit
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
handleClick: this.handleDelete,
|
||||
type: 'danger'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('global.add'), btnCode: 'employee_insert', handler: this.handleAdd }
|
||||
// { text: '批量删除', btnCode: 'employee_delete', handler: this.handleBatchDelete, type: 'danger' }
|
||||
]
|
||||
},
|
||||
|
||||
currentModel: {}
|
||||
};
|
||||
},
|
||||
|
||||
// computed: {
|
||||
// turnbackBarTitle() {
|
||||
// return this.dic.name + '(' + this.dic.code + ')'
|
||||
// }
|
||||
// },
|
||||
|
||||
created() {
|
||||
this.dicId = this.$route.query.id;
|
||||
getData(this.dicId).then(response => {
|
||||
this.dic = response.data;
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
queryFunction(params) {
|
||||
return list(this.dicId, params);
|
||||
},
|
||||
|
||||
handleEdit(index, row) {
|
||||
this.$refs.edit.show(row.id);
|
||||
},
|
||||
|
||||
handleAdd() {
|
||||
this.$refs.create.show();
|
||||
},
|
||||
|
||||
handleBatchDelete() {
|
||||
|
||||
},
|
||||
|
||||
handleDelete(index, row) {
|
||||
this.$confirm(this.$t('system.wellDelType'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
del(this.dicId, row.id).then(response => {
|
||||
this.$message.success(this.$t('system.deleteSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.reloadTable();
|
||||
this.$messageBox(this.$t('error.deleteFailed'));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
reloadTable() {
|
||||
this.queryList.reload();
|
||||
},
|
||||
|
||||
turnback() {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.draft {
|
||||
width: 400px;
|
||||
text-align: center;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
82
src/views/system/ibpDraw/index.vue
Normal file
82
src/views/system/ibpDraw/index.vue
Normal file
@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<transition name="el-zoom-in-center">
|
||||
<div class="mapPaint">
|
||||
<div class="map-view">
|
||||
<ibp-plate ref="ibpPlate" :size="size" />
|
||||
</div>
|
||||
<div class="map-draft">
|
||||
<ibp-operate ref="ibpOperate" @ibpChange="ibpChange" />
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
<script>
|
||||
import IbpPlate from '@/views/ibpsystem/index';
|
||||
import IbpOperate from './ibpOperate/index';
|
||||
|
||||
export default {
|
||||
name: 'IbpView',
|
||||
components: {
|
||||
IbpPlate,
|
||||
IbpOperate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
size: {
|
||||
width: this.$store.state.app.width - 521,
|
||||
height: this.$store.state.app.height - 60
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.$store.dispatch('config/resize', { width: this.$store.state.app.width - 521, height: this.$store.state.app.height - 60 });
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$store.dispatch('config/resize', { width: this.$store.state.app.width - 521, height: this.$store.state.app.height - 60 });
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.ibpPlate.show();
|
||||
this.$refs.ibpPlate.drawIbpInit();
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
ibpChange(stationCode) {
|
||||
this.$refs.ibpPlate.show(stationCode);
|
||||
this.$refs.ibpPlate.drawIbpInit();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.map-draft{
|
||||
/deep/{
|
||||
.v-modal{
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.map-view {
|
||||
float: left;
|
||||
width: 60%;
|
||||
}
|
||||
.mapPaint{
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.map-draft {
|
||||
float: right;
|
||||
width: 520px;
|
||||
|
||||
// /deep/ .el-scrollbar__view {
|
||||
// width: 510px !important;
|
||||
// height: calc(100% - 40px);
|
||||
// }
|
||||
}
|
||||
</style>
|
@ -1,202 +0,0 @@
|
||||
<template>
|
||||
<div class="card-box">
|
||||
<el-steps class="steps" :active="display">
|
||||
<el-step :title="title" icon="el-icon-edit-outline" />
|
||||
<el-step icon="el-icon-upload" />
|
||||
</el-steps>
|
||||
<el-card class="forms">
|
||||
<div style="padding-top: 40px; padding-bottom: 20px;">
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
</div>
|
||||
</el-card>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button v-if="isAdd" type="primary" style="margin-left: 120px" @click="create">{{ $t('global.create') }}</el-button>
|
||||
<el-button v-if="isEdit" type="warning" style="margin-left: 120px" @click="update">{{ $t('global.update') }}</el-button>
|
||||
<el-button type="primary" @click="turnback">{{ $t('global.return') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addSkinCode, querySkinCode, updateSkinCode, querySkinCodeExistByCode } from '@/api/management/mapskin';
|
||||
|
||||
export default {
|
||||
name: 'DictionaryDetailEdit',
|
||||
data() {
|
||||
return {
|
||||
display: 1,
|
||||
formModel: {
|
||||
id: '',
|
||||
code: '',
|
||||
name: '',
|
||||
origin: { x: 0, y: 0 },
|
||||
scaling: '1',
|
||||
linkWidth: 0,
|
||||
zoneWidth: 0,
|
||||
watermarkShow: false
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
if (this.isAdd) {
|
||||
return this.$t('map.addMapSkin');
|
||||
}
|
||||
if (this.isEdit) {
|
||||
return this.$t('map.updateMapSkin');
|
||||
}
|
||||
return '';
|
||||
},
|
||||
isAdd() {
|
||||
return this.$route.params.mode.toUpperCase() == 'add'.toUpperCase();
|
||||
},
|
||||
isEdit() {
|
||||
return this.$route.params.mode.toUpperCase() == 'edit'.toUpperCase();
|
||||
},
|
||||
isDisabled() {
|
||||
return this.isEdit;
|
||||
},
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '140px',
|
||||
items: [
|
||||
{ prop: 'code', label: this.$t('map.skinCoding'), type: 'text', required: false, disabled: this.isDisabled },
|
||||
{ prop: 'name', label: this.$t('map.skinDesignation'), type: 'text', required: false },
|
||||
{ prop: 'origin', label: this.$t('map.coordinatesOrigin'), type: 'point', required: false },
|
||||
{ prop: 'scaling', label: this.$t('map.scaling'), type: 'number', required: false, message: this.$t('rules.maxScaling') }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
|
||||
rules() {
|
||||
const baseRules = {
|
||||
code: [
|
||||
{ required: true, message: this.$t('rules.skinCodingInput'), trigger: 'blur' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.skinDesignationInput'), trigger: 'blur' }
|
||||
],
|
||||
origin: [
|
||||
{ required: true, message: this.$t('rules.coordinatesOriginInput'), trigger: 'blur' }
|
||||
],
|
||||
scaling: [
|
||||
{ required: true, message: this.$t('rules.scalingInput'), trigger: 'blur' },
|
||||
{
|
||||
validator(rule, value, callback) {
|
||||
if (Number(value) >= 1 && Number(value) <= 8) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error(this.$t('rules.scalingInputPrompt')));
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
};
|
||||
return baseRules;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initLoadPage();
|
||||
},
|
||||
methods: {
|
||||
initLoadPage() {
|
||||
// 加载发布课程列表
|
||||
this.display = 1;
|
||||
this.formModel = {
|
||||
id: '',
|
||||
code: '',
|
||||
name: '',
|
||||
origin: { x: 0, y: 0 },
|
||||
scaling: '1'
|
||||
};
|
||||
|
||||
if (this.isEdit) {
|
||||
querySkinCode(this.$route.params.skinCodeId).then(response => {
|
||||
this.formModel = response.data;
|
||||
});
|
||||
}
|
||||
|
||||
// 清空表单验证提示信息
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dataform.resetForm();
|
||||
});
|
||||
},
|
||||
create() {
|
||||
this.formModel.id = '';
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
querySkinCodeExistByCode(this.formModel.code).then(resp => {
|
||||
addSkinCode(this.formModel).then(response => {
|
||||
this.turnback();
|
||||
this.$message.success(this.$t('tip.creatingSuccessful'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.creatingFailed'));
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.skinCodingExist'));
|
||||
});
|
||||
});
|
||||
},
|
||||
update() {
|
||||
this.formModel.id = this.$route.params.skinCodeId;
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
updateSkinCode(this.formModel).then(response => {
|
||||
this.turnback();
|
||||
this.$message.success(this.$t('tip.updateSuccessfully'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.updateFailed'));
|
||||
});
|
||||
});
|
||||
},
|
||||
turnback() {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.steps {
|
||||
width: 940px;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
height: 100%;
|
||||
|
||||
/deep/ {
|
||||
.el-step__icon.is-icon {
|
||||
width: 95px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.forms {
|
||||
width: 800px;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
|
||||
/deep/ {
|
||||
.el-select {
|
||||
float: left;
|
||||
width: calc(600px);
|
||||
}
|
||||
|
||||
.el-form-item__content>.el-input>.el-input__inner {
|
||||
float: left;
|
||||
width: calc(600px);
|
||||
}
|
||||
|
||||
.el-input-number {
|
||||
float: left;
|
||||
width: calc(250px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.draft {
|
||||
width: 300px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
@ -1,124 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import { getSkinCodePageList, delSkinCode } from '@/api/management/mapskin';
|
||||
import { getSkinCodeList } from '@/api/management/mapskin';
|
||||
|
||||
export default {
|
||||
name: 'SkinCode',
|
||||
data() {
|
||||
return {
|
||||
prdTypeList: [],
|
||||
skinCodeList: [],
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '80px',
|
||||
reset: true,
|
||||
queryObject: {
|
||||
name: {
|
||||
type: 'text',
|
||||
label: this.$t('map.skinDesignation')
|
||||
},
|
||||
code: {
|
||||
type: 'text',
|
||||
label: this.$t('map.skinCoding')
|
||||
}
|
||||
}
|
||||
},
|
||||
queryList: {
|
||||
query: getSkinCodePageList,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('map.skinCoding'),
|
||||
prop: 'code'
|
||||
},
|
||||
{
|
||||
title: this.$t('map.skinDesignation'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('map.coordinatesOrigin'),
|
||||
prop: 'origin',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return `(${row.origin.x}, ${row.origin.y})`; },
|
||||
tagType: () => { return ''; }
|
||||
},
|
||||
{
|
||||
title: this.$t('map.scalingColon'),
|
||||
prop: 'scaling'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '250',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('global.edit'),
|
||||
handleClick: this.handleEdit,
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
handleClick: this.handleDelete,
|
||||
type: 'danger'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('global.add'), handler: this.handleAdd }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
loadInitData() {
|
||||
this.prdTypeList = [];
|
||||
this.$Dictionary.productPostType().then(list => {
|
||||
this.prdTypeList = list;
|
||||
});
|
||||
|
||||
this.skinCodeList = [];
|
||||
getSkinCodeList().then(response => {
|
||||
this.skinCodeList = response.data;
|
||||
});
|
||||
},
|
||||
handleAdd() {
|
||||
this.$router.push(`${UrlConfig.map.skinCodeDraft}/add/null`);
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
this.$router.push(`${UrlConfig.map.skinCodeDraft}/edit/${row.id}`);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
this.$confirm(this.$t('tip.skinDeleteConfirmation'), this.$t('tip.hint'), {
|
||||
confirmButtonText: this.$t('tip.confirm'),
|
||||
cancelButtonText: this.$t('tip.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
delSkinCode(row.id).then(() => {
|
||||
this.$message.success(this.$t('tip.skinDeleteSuccessfully'),);
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.skinDeleteFailed'));
|
||||
});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
reloadTable() {
|
||||
this.queryList.reload();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user