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'
});
}
/** 强制删除课程(即删除课程和课程关联的试卷) */
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" />
<alxe-effective ref="alxeEffective" />
<notice-info ref="noticeInfo" />
<set-fault ref="setFault" />
</div>
</template>
@ -21,6 +22,7 @@ import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import {menuOperate, commitOperate} from './utils/menuOperate';
import SetFault from './dialog/setFault';
export default {
name: 'SectionMenu',
@ -30,7 +32,8 @@ export default {
SectionUnLock,
SpeedLimitControl,
AlxeEffective,
NoticeInfo
NoticeInfo,
SetFault
},
props: {
selected: {
@ -95,10 +98,20 @@ export default {
]
},
menuForce: [
// {
// label: '', //
// handler: this.alxeFailure,
// cmdType: CMD.Section.CMD_SECTION_ADD_FAULT
// },
{
label: '设置计轴失效', //
handler: this.alxeFailure,
label: this.$t('menu.menuSection.setFault'),
handler: this.setStoppage,
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();
}
},
//
alxeFailure() {
this.mouseCancelState(this.selected);
commitOperate(menuOperate.Section.alxeFailure, {sectionCode:this.selected.code}, 3).then(({valid, operate})=>{
}).catch(()=>{
this.$refs.noticeInfo.doShow();
});
},
// //
// alxeFailure() {
// this.mouseCancelState(this.selected);
// commitOperate(menuOperate.Section.alxeFailure, {sectionCode:this.selected.code}, 3).then(({valid, operate})=>{
// }).catch(()=>{
// this.$refs.noticeInfo.doShow();
// });
// },
//
fault() {
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);
}
});
}
},
setStoppage() {
commitOperate(menuOperate.Section.setFault, { sectionCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(operate, this.selected);
}
});
},
cancelStoppage() {}
}
};
</script>

View File

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

View File

@ -263,7 +263,16 @@ export const menuOperate = {
operation: OperationEvent.StationControl.emergencyStationControl.menu.operation,
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;
}
return new Promise(function(resolve, reject) {
console.log(step, '8888888888888');
store.dispatch('training/nextNew', step).then(({ valid }) => {
console.log(valid, '3333333333333');
if (valid) {
store.dispatch('menuOperation/handleBreakFlag', { break: true });
}

View File

@ -8,7 +8,7 @@ export default class Command {
}
toFound(definition, wholeParam) {
this.id = definition.id;
this.id = definition.operate;
(definition.paramList || []).forEach(param => {
if (wholeParam.hasOwnProperty(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: '新建计划列车'}
},
Fault: {
CMD_Set_Fault: {}
},
LimitControl: {
}

View File

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

View File

@ -26,4 +26,25 @@ export const MapDeviceType = {
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) {
const cmdType = operation.cmdType;
const wholeParam = this.getWholeParam();
command = CommandHandler.getCommand(cmdType, wholeParam);
if (command && command.isError) {
this.operations.pop();

View File

@ -2,12 +2,12 @@ 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'; // 张赛
// 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://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -8,13 +8,18 @@
<el-card v-loading="loading">
<el-table :data="tableData" border style="width: 100%">
<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 :label="this.$t('global.operate')">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="goLesson(scope.row)">
{{ $t('exam.enterTheExam') }}
</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>
</template>
@ -27,7 +32,7 @@
<script>
import { getSubSystemDetail } from '@/api/trainingPlatform';
import { UrlConfig } from '@/scripts/ConstDic';
import { delPublishLesson } from '@/api/jmap/lesson';
import { forceDeleteLesson } from '@/api/jmap/lesson';
import { getSessionStorage } from '@/utils/auth';
import { lessonCreater } from '@/router/index_APP_TARGET';
import localStore from 'storejs';
@ -39,7 +44,8 @@ export default {
tableData: [],
loading: false,
project: '',
isTeacher: false
isTeacher: false,
userId: ''
};
},
watch: {
@ -51,7 +57,7 @@ export default {
this.loadInitPage();
this.project = getSessionStorage('project');
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: {
loadInitPage() {
@ -77,12 +83,12 @@ export default {
this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.params.subSystem}`, query: {lessonId: row.id}});
},
handleDelete(row) {
this.$confirm('此操作将删除该类型, 是否继续?', this.$t('global.tips'), {
this.$confirm('此操作将删除课程及所有对应的试卷,且无法恢复,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
delPublishLesson(row.id).then(response => {
forceDeleteLesson(row.id).then(response => {
this.$message.success(this.$t('publish.deleteSuccess'));
this.loadInitPage();
}).catch((error) => {

View File

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

View File

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

View File

@ -8,13 +8,18 @@
<el-card v-loading="loading">
<el-table :data="tableData" border style="width: 100%">
<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 :label="this.$t('global.operate')">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="goLesson(scope.row)">
{{ $t('teach.enterTheCourse') }}
</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>
</template>
@ -27,7 +32,7 @@
<script>
import { getSubSystemDetail } from '@/api/trainingPlatform';
import { UrlConfig } from '@/scripts/ConstDic';
import { delPublishLesson } from '@/api/jmap/lesson';
import { forceDeleteLesson } from '@/api/jmap/lesson';
import { getSessionStorage } from '@/utils/auth';
import { lessonCreater } from '@/router/index_APP_TARGET';
import localStore from 'storejs';
@ -39,7 +44,8 @@ export default {
tableData: [],
loading: false,
project: '',
isTeacher: false
isTeacher: false,
userId: ''
};
},
watch: {
@ -51,6 +57,7 @@ export default {
this.loadInitPage();
this.project = getSessionStorage('project');
this.isTeacher = this.$store.state.user.roles.includes(lessonCreater);
this.userId = this.$store.state.user.id;
},
methods: {
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}});
},
handleDelete(row) {
this.$confirm('此操作将删除该类型, 是否继续?', this.$t('global.tips'), {
this.$confirm('此操作将删除课程及所有对应的试卷,且无法恢复,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
delPublishLesson(row.id).then(response => {
forceDeleteLesson(row.id).then(response => {
this.$message.success(this.$t('publish.deleteSuccess'));
this.loadInitPage();
}).catch((error) => {