This commit is contained in:
zyy 2020-05-15 19:01:18 +08:00
commit 93f7210596
17 changed files with 385 additions and 55 deletions

View File

@ -80,3 +80,10 @@ export function getLessonByClassId(classId) {
method: 'get' method: 'get'
}); });
} }
/** 强制删除课程(即删除课程和课程关联的试卷) */
export function forceDeleteLesson(lessonId) {
return request({
url: `/api/lesson/usedLesson/${lessonId}`
});
}

View File

@ -0,0 +1,129 @@
<template>
<el-dialog v-dialogDrag class="ningbo-01__systerm switch-control" :title="title" :visible.sync="show" width="300px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-row class="header">
<el-col :span="11"><span>设备:</span></el-col>
<el-col :span="11" :offset="2"><span>故障类型:</span></el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-input v-model="deviceName" size="small" disabled />
</el-col>
<el-col :span="11" :offset="2">
<el-select v-model="faultType" style="height: 32px;" placeholder="请选择">
<el-option
v-for="item in faultList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel">取消</el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import { menuOperate, commitOperate } from '../utils/menuOperate';
import { deviceFaultType, deviceType} from '@/scripts/cmdPlugin/Config';
export default {
name: 'SwitchControl',
components: {
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
operation: '',
stationName: '',
switchName: '',
activeShow: false,
deviceName: '',
faultType: '',
faultList: []
};
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationHandler.getDomIdByOperation(this.operation) : '';
},
title() {
return '设置故障';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(operate, selected) {
if (!this.dialogShow) {
this.switchName = '';
this.stationName = '';
this.operation = operate.operation;
this.deviceName = deviceType[selected._type] + '-' + selected.name;
this.faultList = deviceFaultType[selected._type];
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
commit() {
},
sendCommand(operate) { //
this.loading = true;
commitOperate(operate, {}, 2).then(({valid})=>{
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow({}, error.message);
});
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -6,6 +6,7 @@
<speed-limit-control ref="speedLimitControl" /> <speed-limit-control ref="speedLimitControl" />
<alxe-effective ref="alxeEffective" /> <alxe-effective ref="alxeEffective" />
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
<set-fault ref="setFault" />
</div> </div>
</template> </template>
@ -21,6 +22,7 @@ import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler'; import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import {menuOperate, commitOperate} from './utils/menuOperate'; import {menuOperate, commitOperate} from './utils/menuOperate';
import SetFault from './dialog/setFault';
export default { export default {
name: 'SectionMenu', name: 'SectionMenu',
@ -30,7 +32,8 @@ export default {
SectionUnLock, SectionUnLock,
SpeedLimitControl, SpeedLimitControl,
AlxeEffective, AlxeEffective,
NoticeInfo NoticeInfo,
SetFault
}, },
props: { props: {
selected: { selected: {
@ -95,10 +98,20 @@ export default {
] ]
}, },
menuForce: [ menuForce: [
// {
// label: '', //
// handler: this.alxeFailure,
// cmdType: CMD.Section.CMD_SECTION_ADD_FAULT
// },
{ {
label: '设置计轴失效', // label: this.$t('menu.menuSection.setFault'),
handler: this.alxeFailure, handler: this.setStoppage,
cmdType: CMD.Section.CMD_SECTION_ADD_FAULT cmdType: CMD.Section.CMD_SECTION_ADD_FAULT
},
{
label: this.$t('menu.menuSection.cancelFault'),
handler: this.cancelStoppage,
cmdType: CMD.Section.CMD_SECTION_REMOVE_FAULT
} }
] ]
}; };
@ -148,14 +161,14 @@ export default {
this.$refs.popMenu.close(); this.$refs.popMenu.close();
} }
}, },
// // //
alxeFailure() { // alxeFailure() {
this.mouseCancelState(this.selected); // this.mouseCancelState(this.selected);
commitOperate(menuOperate.Section.alxeFailure, {sectionCode:this.selected.code}, 3).then(({valid, operate})=>{ // commitOperate(menuOperate.Section.alxeFailure, {sectionCode:this.selected.code}, 3).then(({valid, operate})=>{
}).catch(()=>{ // }).catch(()=>{
this.$refs.noticeInfo.doShow(); // this.$refs.noticeInfo.doShow();
}); // });
}, // },
// //
fault() { fault() {
commitOperate(menuOperate.Section.fault, {sectionCode:this.selected.code}, 0).then(({valid, operate})=>{ commitOperate(menuOperate.Section.fault, {sectionCode:this.selected.code}, 0).then(({valid, operate})=>{
@ -214,7 +227,15 @@ export default {
this.$refs.speedLimitControl.doShow(operate, this.selected); this.$refs.speedLimitControl.doShow(operate, this.selected);
} }
}); });
},
setStoppage() {
commitOperate(menuOperate.Section.setFault, { sectionCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(operate, this.selected);
} }
});
},
cancelStoppage() {}
} }
}; };
</script> </script>

View File

@ -45,6 +45,10 @@ export const menuOperate = {
// 区段故障解锁 // 区段故障解锁
operation: OperationEvent.Section.fault.menu.operation, operation: OperationEvent.Section.fault.menu.operation,
cmdType: CMD.Section.CMD_SECTION_FAULT_UNLOCK cmdType: CMD.Section.CMD_SECTION_FAULT_UNLOCK
},
setFault: {
operation: OperationEvent.Section.stoppage.menu.operation,
cmdType: CMD.Section.CMD_SECTION_ADD_FAULT
} }
}, },
Signal:{ Signal:{

View File

@ -0,0 +1,131 @@
<template>
<el-dialog v-dialogDrag class="xian-01__systerm switch-control" :title="title" :visible.sync="show" width="300px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-row class="header">
<el-col :span="11"><span>设备:</span></el-col>
<el-col :span="11" :offset="2"><span>故障类型:</span></el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-input v-model="deviceName" size="small" disabled />
</el-col>
<el-col :span="11" :offset="2">
<el-select v-model="faultType" style="height: 32px;" placeholder="请选择">
<el-option
v-for="item in faultList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-col>
</el-row>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel">取消</el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import { menuOperate, commitOperate } from '../utils/menuOperate';
import { deviceFaultType, deviceType} from '@/scripts/cmdPlugin/Config';
export default {
name: 'SwitchControl',
components: {
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
operation: '',
stationName: '',
switchName: '',
activeShow: false,
deviceName: '',
faultType: '',
faultList: []
};
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationHandler.getDomIdByOperation(this.operation) : '';
},
title() {
return '设置故障';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(operate, selected) {
if (!this.dialogShow) {
this.switchName = '';
this.stationName = '';
this.operation = operate.operation;
this.deviceName = deviceType[selected._type] + '-' + selected.name;
this.faultList = deviceFaultType[selected._type];
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
commit() {
if (this.faultType) {
this.sendCommand(menuOperate.Section.setFault, this.faultType);
}
},
sendCommand(operate) { //
this.loading = true;
commitOperate(operate, {}, 2).then(({valid})=>{
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow({}, error.message);
});
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -5,6 +5,7 @@
<section-cmd-control ref="sectionCmdControl" /> <section-cmd-control ref="sectionCmdControl" />
<speed-cmd-control ref="speedCmdControl" /> <speed-cmd-control ref="speedCmdControl" />
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
<set-fault ref="setFault" />
</div> </div>
</template> </template>
@ -20,6 +21,7 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler'; import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import { menuOperate, commitOperate } from './utils/menuOperate'; import { menuOperate, commitOperate } from './utils/menuOperate';
import SetFault from './dialog/setFault';
export default { export default {
name: 'SectionMenu', name: 'SectionMenu',
@ -28,7 +30,8 @@ export default {
SectionControl, SectionControl,
SectionCmdControl, SectionCmdControl,
SpeedCmdControl, SpeedCmdControl,
NoticeInfo NoticeInfo,
SetFault
}, },
props: { props: {
selected: { selected: {
@ -170,24 +173,10 @@ export default {
}, },
// //
setStoppage() { setStoppage() {
const step = { commitOperate(menuOperate.Section.setFault, { sectionCode: this.selected.code }, 0).then(({valid, operate})=>{
start: true,
code: `${this.selected.code}`,
operation: OperationEvent.Section.stoppage.menu.operation,
cmdType: CMD.Section.CMD_SECTION_ADD_FAULT,
param: {
sectionCode: `${this.selected.code}`
}
};
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$refs.setFault.doShow(operate, this.selected);
} else {
this.$refs.noticeInfo.doShow(step);
} }
}).catch(() => {
this.$refs.noticeInfo.doShow(step);
}); });
}, },
// //

View File

@ -263,7 +263,16 @@ export const menuOperate = {
operation: OperationEvent.StationControl.emergencyStationControl.menu.operation, operation: OperationEvent.StationControl.emergencyStationControl.menu.operation,
cmdType:CMD.ControlConvertMenu.CMD_CM_EMERGENCY_STATION_CONTROL cmdType:CMD.ControlConvertMenu.CMD_CM_EMERGENCY_STATION_CONTROL
} }
},
Common: {
setFault: {
operation: OperationEvent.Section.stoppage.menu.operation,
cmdType: CMD.Section.CMD_SECTION_ADD_FAULT
},
cancelFault: {
operation: OperationEvent.Section.stoppage.menu.operation,
cmdType: CMD.Section.CMD_SECTION_ADD_FAULT
}
} }
}; };
@ -290,7 +299,9 @@ export function commitOperate(operate, paramList, over, val) {
step.cmdType = operate.cmdType; step.cmdType = operate.cmdType;
} }
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
console.log(step, '8888888888888');
store.dispatch('training/nextNew', step).then(({ valid }) => { store.dispatch('training/nextNew', step).then(({ valid }) => {
console.log(valid, '3333333333333');
if (valid) { if (valid) {
store.dispatch('menuOperation/handleBreakFlag', { break: true }); store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }

View File

@ -8,7 +8,7 @@ export default class Command {
} }
toFound(definition, wholeParam) { toFound(definition, wholeParam) {
this.id = definition.id; this.id = definition.operate;
(definition.paramList || []).forEach(param => { (definition.paramList || []).forEach(param => {
if (wholeParam.hasOwnProperty(param.name)) { if (wholeParam.hasOwnProperty(param.name)) {
this.command[param.name] = wholeParam[param.name]; this.command[param.name] = wholeParam[param.name];

View File

@ -218,7 +218,9 @@ export default {
/** 新建计划列车 */ /** 新建计划列车 */
CMD_Train_Init_Plan: {value: 'Train_Init_Plan', label: '新建计划列车'} CMD_Train_Init_Plan: {value: 'Train_Init_Plan', label: '新建计划列车'}
}, },
Fault: {
CMD_Set_Fault: {}
},
LimitControl: { LimitControl: {
} }

View File

@ -14,7 +14,11 @@ class CommandHandle {
load(list) { load(list) {
this.definitionMap = { this.definitionMap = {
Center: {}, Center: {},
Local: {} Local: {},
Common: {
Set_Fault:{operate: 'Set_Fault'},
Cancel_Fault: {operate:'Cancel_Fault'}
}
}; };
(list || []).forEach(definition => { (list || []).forEach(definition => {
this.definitionMap[definition.simulationRole][definition.operate] = definition; this.definitionMap[definition.simulationRole][definition.operate] = definition;
@ -25,7 +29,7 @@ class CommandHandle {
getDefinition(cmdType) { getDefinition(cmdType) {
if (cmdType) { if (cmdType) {
const simulationRole = Handler.getSimulationRole(); const simulationRole = Handler.getSimulationRole();
return this.definitionMap[simulationRole][cmdType.value] || null; return this.definitionMap[simulationRole][cmdType.value] || this.definitionMap.Common[cmdType.value] || null;
} else { } else {
return null; return null;
} }

View File

@ -26,4 +26,25 @@ export const MapDeviceType = {
MixinCommand: { type: '11', label: '混合命令' } MixinCommand: { type: '11', label: '混合命令' }
}; };
/** 设备故障类型 */
export const deviceFaultType = {
Section: [
{label: '计轴故障', value: 'FAULT'},
{label: '计轴干扰', value: 'DISTURBANCE'}
],
Signal: [
{label: '主灯丝熔断故障', value: 'MAIN_FILAMENT_BROKEN'}
],
Switch: [
{label: '挤岔', value: 'SPLIT'}
]
};
/** 设备类型 */
export const deviceType = {
Section: '区段',
Signal: '信号机',
Switch: '道岔',
Station: '车站',
StationStand: '站台',
Train: '列车'
};

View File

@ -57,7 +57,6 @@ class Handler {
if (operation.cmdType) { if (operation.cmdType) {
const cmdType = operation.cmdType; const cmdType = operation.cmdType;
const wholeParam = this.getWholeParam(); const wholeParam = this.getWholeParam();
command = CommandHandler.getCommand(cmdType, wholeParam); command = CommandHandler.getCommand(cmdType, wholeParam);
if (command && command.isError) { if (command && command.isError) {
this.operations.pop(); this.operations.pop();

View File

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

View File

@ -8,13 +8,18 @@
<el-card v-loading="loading"> <el-card v-loading="loading">
<el-table :data="tableData" border style="width: 100%"> <el-table :data="tableData" border style="width: 100%">
<el-table-column prop="name" :label="this.$t('exam.courseName')" /> <el-table-column prop="name" :label="this.$t('exam.courseName')" />
<el-table-column prop="classNames" label="所属班级">
<template slot-scope="scope">
<el-tag v-for="(item, index) in scope.row.classNames" :key="index" type="success">{{ item }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="remarks" show-overflow-tooltip :label="this.$t('exam.courseDescription')" /> <el-table-column prop="remarks" show-overflow-tooltip :label="this.$t('exam.courseDescription')" />
<el-table-column :label="this.$t('global.operate')"> <el-table-column :label="this.$t('global.operate')">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="primary" @click="goLesson(scope.row)"> <el-button size="mini" type="primary" @click="goLesson(scope.row)">
{{ $t('exam.enterTheExam') }} {{ $t('exam.enterTheExam') }}
</el-button> </el-button>
<el-button v-if="project.endsWith('gzb') && isTeacher" size="mini" type="danger" @click="handleDelete(scope.row)"> <el-button v-if="project.endsWith('gzb') && isTeacher && userId === scope.row.creatorId" size="mini" type="danger" @click="handleDelete(scope.row)">
删除课程 删除课程
</el-button> </el-button>
</template> </template>
@ -27,7 +32,7 @@
<script> <script>
import { getSubSystemDetail } from '@/api/trainingPlatform'; import { getSubSystemDetail } from '@/api/trainingPlatform';
import { UrlConfig } from '@/scripts/ConstDic'; import { UrlConfig } from '@/scripts/ConstDic';
import { delPublishLesson } from '@/api/jmap/lesson'; import { forceDeleteLesson } from '@/api/jmap/lesson';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import { lessonCreater } from '@/router/index_APP_TARGET'; import { lessonCreater } from '@/router/index_APP_TARGET';
import localStore from 'storejs'; import localStore from 'storejs';
@ -39,7 +44,8 @@ export default {
tableData: [], tableData: [],
loading: false, loading: false,
project: '', project: '',
isTeacher: false isTeacher: false,
userId: ''
}; };
}, },
watch: { watch: {
@ -51,7 +57,7 @@ export default {
this.loadInitPage(); this.loadInitPage();
this.project = getSessionStorage('project'); this.project = getSessionStorage('project');
this.isTeacher = this.$store.state.user.roles.includes(lessonCreater); this.isTeacher = this.$store.state.user.roles.includes(lessonCreater);
console.log(this.$store.state.user.roles, lessonCreater, this.isTeacher); this.userId = this.$store.state.user.id;
}, },
methods: { methods: {
loadInitPage() { loadInitPage() {
@ -77,12 +83,12 @@ export default {
this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.params.subSystem}`, query: {lessonId: row.id}}); this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.params.subSystem}`, query: {lessonId: row.id}});
}, },
handleDelete(row) { handleDelete(row) {
this.$confirm('此操作将删除该类型, 是否继续?', this.$t('global.tips'), { this.$confirm('此操作将删除课程及所有对应的试卷,且无法恢复,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'), confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'), cancelButtonText: this.$t('global.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delPublishLesson(row.id).then(response => { forceDeleteLesson(row.id).then(response => {
this.$message.success(this.$t('publish.deleteSuccess')); this.$message.success(this.$t('publish.deleteSuccess'));
this.loadInitPage(); this.loadInitPage();
}).catch((error) => { }).catch((error) => {

View File

@ -1,5 +1,5 @@
<template> <template>
<div style="width: 100%;height: 100%; position: relative;"> <div class="iscs_lcd_box" style="width: 100%;height: 100%; position: relative;">
<div class="lcdControl_title">LCD控制屏</div> <div class="lcdControl_title">LCD控制屏</div>
<div class="area_select" style="position: absolute; top: 15%; left: 25%; width: 80px; height: 50px;"> <div class="area_select" style="position: absolute; top: 15%; left: 25%; width: 80px; height: 50px;">
<div>特定区域</div> <div>特定区域</div>
@ -28,6 +28,9 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.iscs_lcd_box {
}
.lcdControl_title{ .lcdControl_title{
width: 100%; width: 100%;
text-align: center; text-align: center;

View File

@ -66,10 +66,6 @@ export default {
}, },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{
title: this.$t('lesson.explanation'),
prop: 'explanation'
},
{ {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),

View File

@ -8,13 +8,18 @@
<el-card v-loading="loading"> <el-card v-loading="loading">
<el-table :data="tableData" border style="width: 100%"> <el-table :data="tableData" border style="width: 100%">
<el-table-column prop="name" :label="this.$t('teach.courseName')" /> <el-table-column prop="name" :label="this.$t('teach.courseName')" />
<el-table-column prop="classNames" label="所属班级">
<template slot-scope="scope">
<el-tag v-for="(item, index) in scope.row.classNames" :key="index" type="success">{{ item }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="remarks" show-overflow-tooltip :label="this.$t('teach.courseDescription')" /> <el-table-column prop="remarks" show-overflow-tooltip :label="this.$t('teach.courseDescription')" />
<el-table-column :label="this.$t('global.operate')"> <el-table-column :label="this.$t('global.operate')">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="primary" @click="goLesson(scope.row)"> <el-button size="mini" type="primary" @click="goLesson(scope.row)">
{{ $t('teach.enterTheCourse') }} {{ $t('teach.enterTheCourse') }}
</el-button> </el-button>
<el-button v-if="project.endsWith('gzb') && isTeacher" size="mini" type="danger" @click="handleDelete(scope.row)"> <el-button v-if="project.endsWith('gzb') && isTeacher && userId === scope.row.creatorId" size="mini" type="danger" @click="handleDelete(scope.row)">
删除课程 删除课程
</el-button> </el-button>
</template> </template>
@ -27,7 +32,7 @@
<script> <script>
import { getSubSystemDetail } from '@/api/trainingPlatform'; import { getSubSystemDetail } from '@/api/trainingPlatform';
import { UrlConfig } from '@/scripts/ConstDic'; import { UrlConfig } from '@/scripts/ConstDic';
import { delPublishLesson } from '@/api/jmap/lesson'; import { forceDeleteLesson } from '@/api/jmap/lesson';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import { lessonCreater } from '@/router/index_APP_TARGET'; import { lessonCreater } from '@/router/index_APP_TARGET';
import localStore from 'storejs'; import localStore from 'storejs';
@ -39,7 +44,8 @@ export default {
tableData: [], tableData: [],
loading: false, loading: false,
project: '', project: '',
isTeacher: false isTeacher: false,
userId: ''
}; };
}, },
watch: { watch: {
@ -51,6 +57,7 @@ export default {
this.loadInitPage(); this.loadInitPage();
this.project = getSessionStorage('project'); this.project = getSessionStorage('project');
this.isTeacher = this.$store.state.user.roles.includes(lessonCreater); this.isTeacher = this.$store.state.user.roles.includes(lessonCreater);
this.userId = this.$store.state.user.id;
}, },
methods: { methods: {
loadInitPage() { loadInitPage() {
@ -78,12 +85,12 @@ export default {
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}`, query: {lessonId: row.id, mapId: row.mapId, prdType: row.prdType}}); this.$router.push({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}`, query: {lessonId: row.id, mapId: row.mapId, prdType: row.prdType}});
}, },
handleDelete(row) { handleDelete(row) {
this.$confirm('此操作将删除该类型, 是否继续?', this.$t('global.tips'), { this.$confirm('此操作将删除课程及所有对应的试卷,且无法恢复,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'), confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'), cancelButtonText: this.$t('global.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delPublishLesson(row.id).then(response => { forceDeleteLesson(row.id).then(response => {
this.$message.success(this.$t('publish.deleteSuccess')); this.$message.success(this.$t('publish.deleteSuccess'));
this.loadInitPage(); this.loadInitPage();
}).catch((error) => { }).catch((error) => {