This commit is contained in:
joylink_cuiweidong 2019-10-30 18:07:45 +08:00
commit 2df4c5f8cb
59 changed files with 7762 additions and 8138 deletions

View File

@ -2,111 +2,103 @@ import request from '@/utils/request';
/** 获取课程树*/ /** 获取课程树*/
export function getLessonTree(skinCode) { export function getLessonTree(skinCode) {
return request({ return request({
url: `/api/lessonDraft/${skinCode}/tree`, url: `/api/lessonDraft/${skinCode}/tree`,
method: 'get' method: 'get'
}); });
} }
/** 获取课程详细内容*/ /** 获取课程详细内容*/
export function getLessonDetail(data) { export function getLessonDetail(data) {
return request({ return request({
url: `/api/lessonDraft/${data.id}`, url: `/api/lessonDraft/${data.id}`,
method: 'get' method: 'get'
}); });
} }
/** 创建课程*/ /** 创建课程*/
export function createLesson(data) { export function createLesson(data) {
return request({ return request({
url: '/api/lessonDraft', url: '/api/lessonDraft',
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 从发布课程创建*/ /** 从发布课程创建*/
export function createLessonFromPublish(data) { export function createLessonFromPublish(data) {
return request({ return request({
url: '/api/lessonDraft/createForm', url: '/api/lessonDraft/createForm',
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 更新课程*/ /** 更新课程*/
export function updateLesson(data) { export function updateLesson(data) {
return request({ return request({
url: `/api/lessonDraft/${data.id}`, url: `/api/lessonDraft/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** 删除课程*/ /** 删除课程*/
export function delLesson(data) { export function delLesson(data) {
return request({ return request({
url: `/api/lessonDraft/${data.id}`, url: `/api/lessonDraft/${data.id}`,
method: 'delete', method: 'delete',
data: data data: data
}); });
} }
/** 创建课程章节*/ /** 创建课程章节*/
export function createLessonChapter(data) { export function createLessonChapter(data) {
return request({ return request({
url: `/api/lessonDraft/${data.lessonId}/chapter`, url: `/api/lessonDraft/${data.lessonId}/chapter`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 更新课程章节*/ /** 更新课程章节*/
export function updateLessonChapter(data) { export function updateLessonChapter(data) {
return request({ return request({
url: `/api/lessonDraft/chapter/${data.id}`, url: `/api/lessonDraft/chapter/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** 创建课程章节详细内容*/ /** 创建课程章节详细内容*/
export function getLessonChapterDetail(data) { export function getLessonChapterDetail(data) {
return request({ return request({
url: `/api/lessonDraft/chapter/${data.id}`, url: `/api/lessonDraft/chapter/${data.id}`,
method: 'get' method: 'get'
}); });
} }
/** 发布课程*/ /** 发布课程*/
export function publishLesson(data) { export function publishLesson(data) {
return request({ return request({
url: `/api/lessonDraft/${data.id}/publish`, url: `/api/lessonDraft/${data.id}/publish`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 课程章节拖拽排序*/ /** 课程章节拖拽排序*/
export function dragSortLessonChapter(data) { export function dragSortLessonChapter(data) {
return request({ return request({
url: '/api/lessonDraft/dragSort', url: '/api/lessonDraft/dragSort',
method: 'put', method: 'put',
data: data data: data
}); });
}
/** 根据lessonId获取课程名称*/
export function getLessonNameByMapIdAndLessonId(model) {
return request({
url: `/api/lessonDraft/${model.mapId}/${model.lessonId}`,
method: 'get'
});
} }
export function getLessonDrftList(params) { export function getLessonDrftList(params) {
return request({ return request({
url: `/api/lessonDraft`, url: `/api/lessonDraft`,
method: 'get', method: 'get',
params: params params: params
}); });
} }

View File

@ -17,22 +17,6 @@ export function getPublishMapListBySkinCode(skinCode) {
}); });
} }
/** 根据皮肤获取地图版本信息*/
export function getPublishMapVersion(skinCode) {
return request({
url: `/api/map/skin/${skinCode}/version`,
method: 'get'
});
}
/** 根据皮肤获取发布地图详细内容*/
export function getPublishMapDetail(skinCode) {
return request({
url: `/api/map/skin/${skinCode}/details`,
method: 'get'
});
}
/** 根据地图id获取地图版本信息*/ /** 根据地图id获取地图版本信息*/
export function getPublishMapVersionById(id) { export function getPublishMapVersionById(id) {
return request({ return request({
@ -49,14 +33,6 @@ export function getPublishMapDetailById(id) {
}); });
} }
/** 获取发布地图列车列表*/
export function getPublishTrainList(skinCode) {
return request({
url: `/api/map/${skinCode}/train`,
method: 'get'
});
}
/** 获取发布地图列表*/ /** 获取发布地图列表*/
export function listPublishMap(params) { export function listPublishMap(params) {
return request({ return request({

View File

@ -62,9 +62,9 @@ export function deleteTrainingCategory(data) {
/** /**
* 获取地图下的产品列表 * 获取地图下的产品列表
*/ */
export function getCommodityMapProduct(skinCode) { export function getCommodityMapProduct(mapId) {
return request({ return request({
url: `/api/mapPrd/${skinCode}/list`, url: `/api/mapPrd/${mapId}/list`,
method: 'get' method: 'get'
}); });
} }

View File

@ -2,68 +2,68 @@ import request from '@/utils/request';
/** 分页查询皮肤*/ /** 分页查询皮肤*/
export function getSkinCodePageList(params) { export function getSkinCodePageList(params) {
return request({ return request({
url: `/api/mapSkin`, url: `/api/realLine`,
method: 'get', method: 'get',
params: params params: params
}); });
} }
/** 添加皮肤*/ /** 添加皮肤*/
export function addSkinCode(data) { export function addSkinCode(data) {
return request({ return request({
url: `/api/mapSkin`, url: `/api/realLine`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 删除皮肤*/ /** 删除皮肤*/
export function delSkinCode(id) { export function delSkinCode(id) {
return request({ return request({
url: `/api/mapSkin/${id}`, url: `/api/realLine/${id}`,
method: 'delete' method: 'delete'
}); });
} }
/** 查询地图皮肤 */ /** 查询地图皮肤 */
export function querySkinCode(id) { export function querySkinCode(id) {
return request({ return request({
url: `/api/mapSkin/${id}`, url: `/api/realLine/${id}`,
method: 'get' method: 'get'
}); });
} }
/** 修改地图皮肤*/ /** 修改地图皮肤*/
export function updateSkinCode(data) { export function updateSkinCode(data) {
return request({ return request({
url: `/api/mapSkin/${data.id}`, url: `/api/realLine/${data.id}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** 通过皮肤Code更新地图皮肤*/ /** 通过皮肤Code更新地图皮肤*/
export function updateSkinCodeByCode(data) { export function updateSkinCodeByCode(data) {
return request({ return request({
url: `/api/mapSkin/${data.code}/update`, url: `/api/realLine/${data.code}/update`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** 查询皮肤是否存在*/ /** 查询皮肤是否存在*/
export function querySkinCodeExistByCode(code) { export function querySkinCodeExistByCode(code) {
return request({ return request({
url: `/api/mapSkin/${code}/exist`, url: `/api/realLine/${code}/exist`,
method: 'get' method: 'get'
}); });
} }
/** 获取皮肤列表*/ /** 获取皮肤列表*/
export function getSkinCodeList() { export function getSkinCodeList() {
return request({ return request({
url: `/api/mapSkin/list`, url: `/api/realLine/list`,
method: 'get' method: 'get'
}); });
} }

View File

@ -1,15 +1,5 @@
import request from '@/utils/request'; import request from '@/utils/request';
/**
* 获取运行图列表
*/
export function getRunPlanList() {
return request({
url: '/api/runPlan/draft/tree',
method: 'get'
});
}
/** /**
* 获取地图速度等级列表 * 获取地图速度等级列表
*/ */
@ -41,16 +31,6 @@ export function getStationList(mapId) {
}); });
} }
/**
* 通过皮肤获取运行图车站列表
*/
export function getStationListBySkinCode(skinCode) {
return request({
url: `/api/runPlan/draft/station/${skinCode}/bySkin`,
method: 'get'
});
}
/** /**
* 创建运行图 * 创建运行图
*/ */
@ -73,9 +53,9 @@ export function queryRunPlan(planId) {
} }
// 根据skinCode查询发布运行图列表 // 根据skinCode查询发布运行图列表
export function queryRunPlanList(skinCode) { export function queryRunPlanList(mapId) {
return request({ return request({
url: `/api/runPlan/template/skin/${skinCode}`, url: `/api/runPlan/template/${mapId}/list`,
method: 'get' method: 'get'
}); });
} }

View File

@ -82,383 +82,375 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map';
import ConfirmTrain from './childDialog/confirmTrain'; import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from './childDialog/childDialog/noticeInfo'; import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default { export default {
name: 'TrainControl', name: 'TrainControl',
components: { components: {
ConfirmTrain, ConfirmTrain,
NoticeInfo NoticeInfo
}, },
data() { data() {
return { return {
trainList: [], trainList: [],
formModel: { formModel: {
trainNo: '', trainNo: '',
trainNumber: '', trainNumber: '',
trainType: '01', trainType: '01',
serverNo: '', serverNo: '',
targetCode: '' targetCode: ''
}, },
rules: { rules: {
trainNumber: [ trainNumber: [
{ required: true, message: '请选择车组号', trigger: 'change' } { required: true, message: '请选择车组号', trigger: 'change' }
], ],
trainType: [ trainType: [
{ required: true, message: '请选择一个列车类型', trigger: 'change' } { required: true, message: '请选择一个列车类型', trigger: 'change' }
], ],
serverNo: [ serverNo: [
{ required: true, message: '请输入表号', trigger: 'blur' } { required: true, message: '请输入表号', trigger: 'blur' }
], ],
trainNo: [ trainNo: [
{ required: true, message: '请输入车次号', trigger: 'blur' } { required: true, message: '请输入车次号', trigger: 'blur' }
], ],
targetCode: [ targetCode: [
{ required: true, message: '请输入目的地号', trigger: 'blur' } { required: true, message: '请输入目的地号', trigger: 'blur' }
] ]
}, },
operation: null, operation: null,
dialogShow: false, dialogShow: false,
loading: false, loading: false,
direction: 0 direction: 0
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'map' 'map'
]), ]),
trainNoIsDisabled() { trainNoIsDisabled() {
return false; return false;
}, },
serverNoIsDisabled() { serverNoIsDisabled() {
return false; return false;
}, },
targetCodeIsDisabled() { targetCodeIsDisabled() {
return false; return false;
}, },
trainNumberIsDisabled() { trainNumberIsDisabled() {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) { if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true; return true;
} }
return false; return false;
}, },
trainTypeIsDisabled() { trainTypeIsDisabled() {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) { if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true; return true;
} }
return false; return false;
}, },
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
domIdTrainNumber() { domIdTrainNumber() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainNumberChange.domId; return OperationEvent.Train.addTrainId.trainNumberChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainNumberChange.domId; return OperationEvent.Train.editTrainId.trainNumberChange.domId;
} }
} }
return null; return null;
}, },
domIdTrainNo() { domIdTrainNo() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainNoChange.domId; return OperationEvent.Train.addTrainId.trainNoChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainNoChange.domId; return OperationEvent.Train.editTrainId.trainNoChange.domId;
} }
} }
return null; return null;
}, },
domIdTrainType() { domIdTrainType() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainTypeChange.domId; return OperationEvent.Train.addTrainId.trainTypeChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainTypeChange.domId; return OperationEvent.Train.editTrainId.trainTypeChange.domId;
} }
} }
return null; return null;
}, },
domIdServerNo() { domIdServerNo() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.serverNoChange.domId; return OperationEvent.Train.addTrainId.serverNoChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.serverNoChange.domId; return OperationEvent.Train.editTrainId.serverNoChange.domId;
} }
} }
return null; return null;
}, },
domIdTargetCode() { domIdTargetCode() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.targetCodeChange.domId; return OperationEvent.Train.addTrainId.targetCodeChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.targetCodeChange.domId; return OperationEvent.Train.editTrainId.targetCodeChange.domId;
} }
} }
return null; return null;
}, },
domIdConfirm() { domIdConfirm() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.menu.domId; return OperationEvent.Train.addTrainId.menu.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.menu.domId; return OperationEvent.Train.editTrainId.menu.domId;
} }
} }
return null; return null;
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
title() { title() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
return '添加列车识别号'; return '添加列车识别号';
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
return '修改列车识别号'; return '修改列车识别号';
} }
return ''; return '';
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}); });
}, },
methods: { methods: {
loadInitData(map) { loadInitData(map) {
if (map) { },
getPublishTrainList(map.skinCode).then(resp => { doShow(operate, selected) {
this.trainList = resp.data; //
}).catch(() => { if (!this.dialogShow) {
this.$messageBox(`获取列车车组号失败`); this.operation = operate.operation;
}); }
}
},
doShow(operate, selected) {
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
this.formModel = { this.formModel = {
trainNumber: selected.trainNumber, trainNumber: selected.trainNumber,
trainNo: selected.trainNo, trainNo: selected.trainNo,
trainType: '01', trainType: '01',
serverNo: selected.serverNo, serverNo: selected.serverNo,
targetCode: selected.targetCode targetCode: selected.targetCode
}; };
/** 加载列车数据*/ /** 加载列车数据*/
this.loadInitData(this.map); this.loadInitData(this.map);
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false); this.$store.dispatch('map/setTrainWindowShow', false);
}, },
trainNumberChange(trainNumber) { trainNumberChange(trainNumber) {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
val: `${trainNumber}`, val: `${trainNumber}`,
operation: '' operation: ''
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation; operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNumberChange.operation; operate.operation = OperationEvent.Train.editTrainId.trainNumberChange.operation;
} }
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }
}); });
}, },
trainTypeChange(trainType) { trainTypeChange(trainType) {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
val: `${trainType}`, val: `${trainType}`,
operation: '' operation: ''
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation; operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainTypeChange.operation; operate.operation = OperationEvent.Train.editTrainId.trainTypeChange.operation;
} }
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }
}); });
}, },
serverNoChange(serverNo) { serverNoChange(serverNo) {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
val: `${serverNo}`, val: `${serverNo}`,
operation: '' operation: ''
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.serverNoChange.operation; operate.operation = OperationEvent.Train.addTrainId.serverNoChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.serverNoChange.operation; operate.operation = OperationEvent.Train.editTrainId.serverNoChange.operation;
} }
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }
}); });
}, },
trainNoChange(trainNo) { trainNoChange(trainNo) {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
val: `${trainNo}`, val: `${trainNo}`,
operation: '' operation: ''
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation; operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation; operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation;
} }
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }
}); });
}, },
targetCodeChange(targetCode) { targetCodeChange(targetCode) {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
val: `${targetCode}`, val: `${targetCode}`,
operation: '' operation: ''
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.targetCodeChange.operation; operate.operation = OperationEvent.Train.addTrainId.targetCodeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.targetCodeChange.operation; operate.operation = OperationEvent.Train.editTrainId.targetCodeChange.operation;
} }
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }
}); });
}, },
commit() { commit() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 增加列车识别号*/ /** 增加列车识别号*/
this.addTrainId(); this.addTrainId();
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
this.editTrainId(); this.editTrainId();
} }
}, },
// //
addTrainId() { addTrainId() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
const model = this.formModel; const model = this.formModel;
const operate = { const operate = {
send: true, send: true,
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
operation: OperationEvent.Train.addTrainId.menu.operation, operation: OperationEvent.Train.addTrainId.menu.operation,
messages: [`添加列车识别号:成功`], messages: [`添加列车识别号:成功`],
val: `${model.trainNumber}::${model.trainType}::${model.serverNo}::${model.trainNo}::${model.targetCode}` val: `${model.trainNumber}::${model.trainType}::${model.serverNo}::${model.trainNo}::${model.targetCode}`
}; };
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.confirmTrain.doShow(operate); this.$refs.confirmTrain.doShow(operate);
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate);
}); });
} else { } else {
return false; return false;
} }
}); });
}, },
// //
editTrainId() { editTrainId() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
const operate = { const operate = {
send: true, send: true,
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
operation: OperationEvent.Train.editTrainId.menu.operation, operation: OperationEvent.Train.editTrainId.menu.operation,
messages: [`修改列车识别号:成功`], messages: [`修改列车识别号:成功`],
val: this.formModel.trainNo val: this.formModel.trainNo
}; };
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.confirmTrain.doShow(operate); this.$refs.confirmTrain.doShow(operate);
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate);
}); });
} else { } else {
return false; return false;
} }
}); });
}, },
cancel() { cancel() {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation operation: OperationEvent.Command.cancel.menu.operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.doClose(); this.doClose();
}); });
} }
} }
}; };
</script> </script>

View File

@ -1,155 +1,160 @@
<template> <template>
<el-dialog class="fuzhou_01 route-create" :title="title" :visible.sync="show" width="580px" label-position="top" <el-dialog
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag> class="fuzhou_01 route-create"
<div style="padding: 10px 20px; border: 1px solid lightgray;"> v-dialogDrag
<el-form size="small" label-width="100px"> :title="title"
<el-form-item label="列车:" prop="trainCode"> :visible.sync="show"
<el-select v-model="trainCode" filterable placeholder="列车"> width="580px"
<el-option v-for="item in trainList" :key="item.code" :label="item.trainNumber" label-position="top"
:value="item.code"></el-option> :before-close="doClose"
</el-select> :z-index="2000"
</el-form-item> :modal="false"
<!-- <el-form-item label="列车车次:" prop="trainNo"> :close-on-click-modal="false"
>
<div style="padding: 10px 20px; border: 1px solid lightgray;">
<el-form size="small" label-width="100px">
<el-form-item label="列车:" prop="trainCode">
<el-select v-model="trainCode" filterable placeholder="列车">
<el-option
v-for="item in trainList"
:key="item.code"
:label="item.trainNumber"
:value="item.code"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="列车车次:" prop="trainNo">
<el-select v-model="trainNo" filterable placeholder="列车车次"> <el-select v-model="trainNo" filterable placeholder="列车车次">
<el-option v-for="no in trainNoList" :key="no" :label="no" :value="no"></el-option> <el-option v-for="no in trainNoList" :key="no" :label="no" :value="no"></el-option>
</el-select> </el-select>
<div style="font-size: 12px;">(上行路线车次号选择偶数下行路线车次号选择基数)</div> <div style="font-size: 12px;">(上行路线车次号选择偶数下行路线车次号选择基数)</div>
</el-form-item> --> </el-form-item> -->
<el-form-item label="列车方向:" prop="direction"> <el-form-item label="列车方向:" prop="direction">
<el-select v-model="direction" filterable placeholder="列车方向"> <el-select v-model="direction" filterable placeholder="列车方向">
<el-option v-for="no in directionList" :key="no.value" :label="no.label" :value="no.value"> <el-option v-for="no in directionList" :key="no.value" :label="no.label" :value="no.value" />
</el-option> </el-select>
</el-select> <!-- <div style="font-size: 12px;">(上行路线车次号选择偶数下行路线车次号选择基数)</div> -->
<!-- <div style="font-size: 12px;">(上行路线车次号选择偶数下行路线车次号选择基数)</div> --> </el-form-item>
</el-form-item> </el-form>
</el-form> <el-row>
<el-row> <el-col style="text-align: right;">
<el-col style="text-align: right;"> <el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button> <el-button :id="domIdCancel" @click="cancel"> </el-button>
<el-button :id="domIdCancel" @click="cancel"> </el-button> </el-col>
</el-col> </el-row>
</el-row> </div>
</div> <notice-info ref="noticeInfo" />
<notice-info ref="noticeInfo"></notice-info> </el-dialog>
</el-dialog>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map'; import NoticeInfo from './childDialog/childDialog/noticeInfo';
import NoticeInfo from './childDialog/childDialog/noticeInfo'
export default { export default {
name: 'RouteCreate', name: 'RouteCreate',
components: { components: {
NoticeInfo NoticeInfo
}, },
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
trainList: [], trainList: [],
trainNoList: [], trainNoList: [],
directionList: [ directionList: [
{ {
value: '2', value: '2',
label: '上行' label: '上行'
}, },
{ {
value: '1', value: '1',
label: '下行' label: '下行'
}
],
trainCode: '',
trainNo: '',
direction: '',
selected: null
}
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return OperationEvent.Section.newtrain.menu.domId;
},
title() {
return '设置列车';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (Object.keys(map || {}).length) {
getPublishTrainList(map.skinCode).then(response => {
this.trainList = response.data;
}).catch(error => {
this.$messageBox(`获取列车列表失败`);
})
} }
}, ],
doShow(operate, selected) { trainCode: '',
this.dialogShow = true; trainNo: '',
this.selected = selected; direction: '',
selected: null
};
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return OperationEvent.Section.newtrain.menu.domId;
},
title() {
return '设置列车';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
},
doShow(operate, selected) {
this.dialogShow = true;
this.selected = selected;
/** 加载列车数据*/ /** 加载列车数据*/
this.loadInitData(this.map); this.loadInitData(this.map);
this.$nextTick(function () { this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.trainCode = '';
this.direction = '';
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}, });
commit() { },
let operate = { doClose() {
send: true, this.trainCode = '';
type: MapDeviceType.Section.type, this.direction = '';
operation: OperationEvent.Section.newtrain.menu.operation, this.loading = false;
val: '' + this.direction + '::' + this.trainCode this.dialogShow = false;
} this.$store.dispatch('training/emitTipFresh');
this.loading = true; },
this.$store.dispatch('training/next', operate).then(({ valid }) => { commit() {
this.loading = false; const operate = {
if (valid) { send: true,
this.doClose(); type: MapDeviceType.Section.type,
} operation: OperationEvent.Section.newtrain.menu.operation,
}).catch(error => { val: '' + this.direction + '::' + this.trainCode
this.loading = false; };
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
cancel() {
let operate = {
type: MapDeviceType.Section.type,
operation: OperationEvent.Command.cancel.menu.operation,
} }
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
cancel() {
const operate = {
type: MapDeviceType.Section.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose();
}
}).catch(error => {
this.doClose(); this.doClose();
}); }
} }).catch(error => {
this.doClose();
});
} }
} }
</script> };
</script>

View File

@ -1,151 +1,155 @@
<template> <template>
<el-dialog class="beijing-01__systerm route-create" :title="title" :visible.sync="show" width="580px" <el-dialog
label-position="top" :before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag
v-dialogDrag> class="beijing-01__systerm route-create"
<div style="padding: 10px 20px; border: 1px solid lightgray;"> :title="title"
<el-form size="small" label-width="100px"> :visible.sync="show"
<el-form-item label="列车:" prop="trainCode"> width="580px"
<el-select v-model="trainCode" filterable placeholder="列车"> label-position="top"
<el-option v-for="item in trainList" :key="item.code" :label="item.groupNumber" :before-close="doClose"
:value="item.code"></el-option> :z-index="2000"
</el-select> :modal="false"
</el-form-item> :close-on-click-modal="false"
<el-form-item label="列车方向:" prop="direction"> >
<el-select v-model="direction" filterable placeholder="列车方向"> <div style="padding: 10px 20px; border: 1px solid lightgray;">
<el-option v-for="no in directionList" :key="no.value" :label="no.label" :value="no.value"> <el-form size="small" label-width="100px">
</el-option> <el-form-item label="列车:" prop="trainCode">
</el-select> <el-select v-model="trainCode" filterable placeholder="列车">
</el-form-item> <el-option
</el-form> v-for="item in trainList"
<el-row> :key="item.code"
<el-col style="text-align: right;"> :label="item.groupNumber"
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button> :value="item.code"
<el-button :id="domIdCancel" @click="cancel"> </el-button> />
</el-col> </el-select>
</el-row> </el-form-item>
</div> <el-form-item label="列车方向:" prop="direction">
<notice-info ref="noticeInfo"></notice-info> <el-select v-model="direction" filterable placeholder="列车方向">
</el-dialog> <el-option v-for="no in directionList" :key="no.value" :label="no.label" :value="no.value" />
</el-select>
</el-form-item>
</el-form>
<el-row>
<el-col style="text-align: right;">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
</div>
<notice-info ref="noticeInfo" />
</el-dialog>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map'; import { mouseCancelState } from '../utils/menuItemStatus';
import { mouseCancelState } from '../utils/menuItemStatus'; import NoticeInfo from './childDialog/childDialog/noticeInfo';
import NoticeInfo from './childDialog/childDialog/noticeInfo'
export default { export default {
name: 'RouteCreate', name: 'RouteCreate',
components: { components: {
NoticeInfo NoticeInfo
}, },
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
trainList: [], trainList: [],
trainNoList: [], trainNoList: [],
directionList: [ directionList: [
{ {
value: '2', value: '2',
label: '上行' label: '上行'
}, },
{ {
value: '1', value: '1',
label: '下行' label: '下行'
}
],
trainCode: '',
tripNumber: '',
direction: '',
selected: null
}
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return OperationEvent.Section.newtrain.menu.domId;
},
title() {
return '设置列车';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (Object.keys(map || {}).length) {
getPublishTrainList(map.skinCode).then(response => {
this.trainList = response.data;
}).catch(error => {
this.$messageBox(`获取列车列表失败`);
})
} }
}, ],
doShow(operate, selected) { trainCode: '',
this.dialogShow = true; tripNumber: '',
this.selected = selected; direction: '',
selected: null
};
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return OperationEvent.Section.newtrain.menu.domId;
},
title() {
return '设置列车';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
},
doShow(operate, selected) {
this.dialogShow = true;
this.selected = selected;
/** 加载列车数据*/ /** 加载列车数据*/
this.loadInitData(this.map); this.loadInitData(this.map);
this.$nextTick(function () { this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.trainCode = '';
this.direction = '';
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected); });
}, },
commit() { doClose() {
let operate = { this.trainCode = '';
send: true, this.direction = '';
type: MapDeviceType.Section.type, this.loading = false;
operation: OperationEvent.Section.newtrain.menu.operation, this.dialogShow = false;
val: '' + this.direction + '::' + this.trainCode this.$store.dispatch('training/emitTipFresh');
} mouseCancelState(this.selected);
this.loading = true; },
this.$store.dispatch('training/next', operate).then(({ valid }) => { commit() {
this.loading = false; const operate = {
if (valid) { send: true,
this.doClose(); type: MapDeviceType.Section.type,
} operation: OperationEvent.Section.newtrain.menu.operation,
}).catch(error => { val: '' + this.direction + '::' + this.trainCode
this.loading = false; };
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
cancel() {
let operate = {
type: MapDeviceType.Section.type,
operation: OperationEvent.Command.cancel.menu.operation,
} }
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
cancel() {
const operate = {
type: MapDeviceType.Section.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose();
}
}).catch(error => {
this.doClose(); this.doClose();
}); }
} }).catch(error => {
this.doClose();
});
} }
} }
</script> };
</script>

View File

@ -19,127 +19,128 @@
<script> <script>
import { runPlanTemplateList } from '@/api/runplan'; import { runPlanTemplateList } from '@/api/runplan';
import { getStationListBySkinCode } from '@/api/runplan'; import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation'; import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin'; import { getSkinCodeList } from '@/api/management/mapskin';
export default { export default {
name: 'ReloadTodayPlan', name: 'ReloadTodayPlan',
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
skinCodeList: [], skinCodeList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
reset: true, reset: true,
labelWidth: '100px', labelWidth: '100px',
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: '运行图名称' label: '运行图名称'
} }
} }
}, },
queryList: { queryList: {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
radioShow: true, radioShow: true,
columns: [ columns: [
{ {
title: '运行图名称', title: '运行图名称',
prop: 'name' prop: 'name'
}, },
{ {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinCode', prop: 'skinCode',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
}, },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
} }
] ]
}, },
currentModel: {} currentModel: {}
}; };
}, },
computed: { computed: {
title() { title() {
return '加载当天计划'; return '加载当天计划';
} }
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.skinCodeList = []; this.skinCodeList = [];
getSkinCodeList().then(response => { getSkinCodeList().then(response => {
this.skinCodeList = response.data; this.skinCodeList = response.data;
}); });
}, },
doShow() { doShow() {
this.loading = false; this.loading = false;
this.dialogShow = true; this.dialogShow = true;
this.loadInitData(); this.loadInitData();
}, },
doClose() { doClose() {
this.dialogShow = false; this.dialogShow = false;
}, },
queryFunction(params) { queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) { if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode']; params['skinCode'] = this.$store.getters['map/skinCode'];
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
// //
handleConfirm() { handleConfirm() {
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose(); const choose = this.$refs.pageRules.currentChoose();
if (choose && choose.id) { if (choose && choose.id) {
this.loading = true; this.loading = true;
generateDayRunPlan(choose.id, this.$route.query.group).then(response => { generateDayRunPlan(choose.id, this.$route.query.group).then(response => {
this.loading = false; this.loading = false;
this.reloadTable(); this.reloadTable();
this.loadRunData(); this.loadRunData();
this.doClose(); this.doClose();
this.$message.success(`生成用户每日运行图成功`); this.$message.success(`生成用户每日运行图成功`);
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.reloadTable(); this.reloadTable();
this.$messageBox(`生成用户每日运行图失败`); this.$messageBox(`生成用户每日运行图失败`);
}); });
} else { } else {
this.$messageBox(`请选择需要加载的运行图`); this.$messageBox(`请选择需要加载的运行图`);
} }
} }
}, },
loadRunData() { loadRunData() {
const skinCode = this.$route.query.skinCode; const skinCode = this.$route.query.skinCode;
this.$store.dispatch('runPlan/clear'); const mapId = this.$route.query.mapId;
if (skinCode) { this.$store.dispatch('runPlan/clear');
getStationListBySkinCode(skinCode).then(response => { if (mapId) {
const stations = response.data; getStationList(mapId).then(response => {
this.PlanConvert = this.$theme.loadPlanConvert(skinCode); const stations = response.data;
this.$store.dispatch('runPlan/setStations', stations).then(() => { this.PlanConvert = this.$theme.loadPlanConvert(skinCode);
getEveryDayRunPlanData(this.$route.query.group).then(resp => { this.$store.dispatch('runPlan/setStations', stations).then(() => {
this.$store.dispatch('runPlan/setPlanData', resp.data); getEveryDayRunPlanData(this.$route.query.group).then(resp => {
}).catch(() => { this.$store.dispatch('runPlan/setPlanData', resp.data);
this.$store.dispatch('runPlan/setPlanData', []); }).catch(() => {
this.$messageBox(`获取运行图数据失败`); this.$store.dispatch('runPlan/setPlanData', []);
}); this.$messageBox(`获取运行图数据失败`);
}); });
}).catch(() => { });
this.$messageBox(`获取车站列表失败`); }).catch(() => {
}); this.$messageBox(`获取车站列表失败`);
} });
}, }
reloadTable() { },
this.queryList.reload(); reloadTable() {
} this.queryList.reload();
} }
}
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -97,241 +97,233 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map';
import { mouseCancelState } from '../utils/menuItemStatus'; import { mouseCancelState } from '../utils/menuItemStatus';
import ConfirmTrain from './childDialog/confirmTrain'; import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from './childDialog/childDialog/noticeInfo'; import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default { export default {
name: 'TrainControl', name: 'TrainControl',
components: { components: {
ConfirmTrain, ConfirmTrain,
NoticeInfo NoticeInfo
}, },
data() { data() {
return { return {
trainList: [], trainList: [],
selected: null, selected: null,
addModel: { addModel: {
stationName: '', stationName: '',
sectionCode: '', sectionCode: '',
trainWindowCode: '', trainWindowCode: '',
groupNumber: '', groupNumber: '',
serviceNumber: '', serviceNumber: '',
targetCode: '', targetCode: '',
trainCode: '', trainCode: '',
runningMode: '' runningMode: ''
}, },
rules: { rules: {
stationName: [ stationName: [
{ required: true, message: '请输入车站', trigger: 'blur'} { required: true, message: '请输入车站', trigger: 'blur'}
], ],
sectionCode: [ sectionCode: [
{ required: true, message: '请输入轨道', trigger: 'blur'} { required: true, message: '请输入轨道', trigger: 'blur'}
], ],
trainWindowCode: [ trainWindowCode: [
{ required: true, message: '请输入车次窗', trigger: 'blur'} { required: true, message: '请输入车次窗', trigger: 'blur'}
], ],
groupNumber: [ groupNumber: [
{ required: true, message: '请选择车组号', trigger: 'change' } { required: true, message: '请选择车组号', trigger: 'change' }
], ],
serviceNumber: [ serviceNumber: [
{ required: true, message: '请输入服务号', trigger: 'blur'} { required: true, message: '请输入服务号', trigger: 'blur'}
], ],
targetCode: [ targetCode: [
{ required: true, message: '请输入目的地号', trigger: 'blur'} { required: true, message: '请输入目的地号', trigger: 'blur'}
], ],
trainCode: [ trainCode: [
{ required: true, message: '请输入序列号', trigger: 'blur'} { required: true, message: '请输入序列号', trigger: 'blur'}
], ],
runningMode: [ runningMode: [
{ required: true, message: '请选择运行模式', trigger: 'blur'} { required: true, message: '请选择运行模式', trigger: 'blur'}
] ]
}, },
operation: null, operation: null,
dialogShow: false, dialogShow: false,
loading: false, loading: false,
direction: 0 direction: 0
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'map' 'map'
]), ]),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
domIdConfirm() { domIdConfirm() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.destinationTrainId.menu.operation) { if (this.operation == OperationEvent.Train.destinationTrainId.menu.operation) {
/* 设目的地*/ /* 设目的地*/
return OperationEvent.Train.destinationTrainId.menu.domId; return OperationEvent.Train.destinationTrainId.menu.domId;
} else if (this.operation == OperationEvent.Train.setPlanTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.setPlanTrainId.menu.operation) {
/* 设计划车*/ /* 设计划车*/
return OperationEvent.Train.setPlanTrainId.menu.domId; return OperationEvent.Train.setPlanTrainId.menu.domId;
} else if (this.operation == OperationEvent.Train.artificialTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.artificialTrainId.menu.operation) {
/* 设人工车*/ /* 设人工车*/
return OperationEvent.Train.artificialTrainId.menu.domId; return OperationEvent.Train.artificialTrainId.menu.domId;
} }
return ''; return '';
} }
return ''; return '';
}, },
title() { title() {
if ( this.operation == OperationEvent.Train.destinationTrainId.menu.operation) { if ( this.operation == OperationEvent.Train.destinationTrainId.menu.operation) {
return '设目的地车'; return '设目的地车';
} else if ( this.operation == OperationEvent.Train.setPlanTrainId.menu.operation ) { } else if ( this.operation == OperationEvent.Train.setPlanTrainId.menu.operation ) {
return '设计划车'; return '设计划车';
} else if ( this.operation == OperationEvent.Train.artificialTrainId.menu.operation ) { } else if ( this.operation == OperationEvent.Train.artificialTrainId.menu.operation ) {
return '设人工车'; return '设人工车';
} }
return ''; return '';
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}); });
}, },
methods: { methods: {
loadInitData(map) { loadInitData(map) {
if (map) { },
getPublishTrainList(map.skinCode).then(resp => { doShow(operate, selected) {
this.trainList = resp.data; this.selected = selected;
}).catch(() => { //
this.$messageBox(`获取列车车组号失败`); if (!this.dialogShow) {
}); this.operation = operate.operation;
} }
}, this.addModel = {
doShow(operate, selected) { tripNumber: '',
this.selected = selected; groupNumber: '',
// trainType: '01',
if (!this.dialogShow) { serviceNumber: '',
this.operation = operate.operation; targetCode: ''
} };
this.addModel = { /** 加载列车数据*/
tripNumber: '', this.loadInitData(this.map);
groupNumber: '', this.dialogShow = true;
trainType: '01', this.$nextTick(function () {
serviceNumber: '', this.$store.dispatch('training/emitTipFresh');
targetCode: '' });
}; },
/** 加载列车数据*/ doClose() {
this.loadInitData(this.map); this.loading = false;
this.dialogShow = true; this.dialogShow = false;
this.$nextTick(function () { this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('map/setTrainWindowShow', false);
}); mouseCancelState(this.selected);
}, },
doClose() { commit() {
this.loading = false; if ( this.operation == OperationEvent.Train.destinationTrainId.menu.operation ) {
this.dialogShow = false; this.destinationTrainId();
this.$store.dispatch('training/emitTipFresh'); } else if (this.operation == OperationEvent.Train.setPlanTrainId.menu.operation ) {
this.$store.dispatch('map/setTrainWindowShow', false); this.setPlanTrainId();
mouseCancelState(this.selected); } else if (this.operation == OperationEvent.Train.artificialTrainId.menu.operation ) {
}, this.artificialTrainId();
commit() { }
if ( this.operation == OperationEvent.Train.destinationTrainId.menu.operation ) { },
this.destinationTrainId(); //
} else if (this.operation == OperationEvent.Train.setPlanTrainId.menu.operation ) { destinationTrainId() {
this.setPlanTrainId(); this.$refs['form'].validate((valid) => {
} else if (this.operation == OperationEvent.Train.artificialTrainId.menu.operation ) { if (valid) {
this.artificialTrainId(); const operate = {
} type: MapDeviceType.Train.type,
}, operation: OperationEvent.Train.destinationTrainId.menu.operation,
// message: [`设目的地车:成功`],
destinationTrainId() { val: ''
this.$refs['form'].validate((valid) => { };
if (valid) { this.loading = true;
const operate = { this.$store.dispatch('training/next', operate).then(({ valid }) => {
type: MapDeviceType.Train.type, this.doClose();
operation: OperationEvent.Train.destinationTrainId.menu.operation, this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
message: [`设目的地车:成功`], }).catch(() => {
val: '' this.loading = false;
}; this.doClose();
this.loading = true; this.$refs.noticeInfo.doShow(operate);
this.$store.dispatch('training/next', operate).then(({ valid }) => { });
this.doClose(); } else {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); return false;
}).catch(() => { }
this.loading = false; });
this.doClose(); },
this.$refs.noticeInfo.doShow(operate); //
}); setPlanTrainId() {
} else { this.$refs['form'].validate((valid) => {
return false; if (valid) {
} const operate = {
}); type: MapDeviceType.Train.type,
}, operation: OperationEvent.Train.setPlanTrainId.menu.operation,
// message: [`设计划车:成功`],
setPlanTrainId() { val: ''
this.$refs['form'].validate((valid) => { };
if (valid) { this.loading = true;
const operate = { this.$store.dispatch('training/next', operate).then(({ valid }) => {
type: MapDeviceType.Train.type, this.doClose();
operation: OperationEvent.Train.setPlanTrainId.menu.operation, this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
message: [`设计划车:成功`], }).catch(() => {
val: '' this.loading = false;
}; this.doClose();
this.loading = true; this.$refs.noticeInfo.doShow(operate);
this.$store.dispatch('training/next', operate).then(({ valid }) => { });
this.doClose(); } else {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); return false;
}).catch(() => { }
this.loading = false; });
this.doClose(); },
this.$refs.noticeInfo.doShow(operate); //
}); artificialTrainId() {
} else { this.$refs['form'].validate((valid) => {
return false; if (valid) {
} const operate = {
}); type: MapDeviceType.Train.type,
}, operation: OperationEvent.Train.artificialTrainId.menu.operation,
// message: [`设人工车:成功`],
artificialTrainId() { val: ''
this.$refs['form'].validate((valid) => { };
if (valid) { this.loading = true;
const operate = { this.$store.dispatch('training/next', operate).then(({ valid }) => {
type: MapDeviceType.Train.type, this.doClose();
operation: OperationEvent.Train.artificialTrainId.menu.operation, this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
message: [`设人工车:成功`], }).catch(() => {
val: '' this.loading = false;
}; this.doClose();
this.loading = true; this.$refs.noticeInfo.doShow(operate);
this.$store.dispatch('training/next', operate).then(({ valid }) => { });
this.doClose(); } else {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); return false;
}).catch(() => { }
this.loading = false; });
this.doClose(); },
this.$refs.noticeInfo.doShow(operate); cancel() {
}); const operate = {
} else { type: MapDeviceType.Train.type,
return false; operation: OperationEvent.Command.cancel.menu.operation
} };
});
},
cancel() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.doClose(); this.doClose();
}); });
} }
} }
}; };
</script> </script>
<style scoped> <style scoped>

View File

@ -33,121 +33,113 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map';
import { mouseCancelState } from '../utils/menuItemStatus'; import { mouseCancelState } from '../utils/menuItemStatus';
import NoticeInfo from './childDialog/childDialog/noticeInfo'; import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default { export default {
name: 'RouteCreate', name: 'RouteCreate',
components: { components: {
NoticeInfo NoticeInfo
}, },
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
trainList: [], trainList: [],
trainNoList: [], trainNoList: [],
directionList: [ directionList: [
{ {
value: '2', value: '2',
label: '上行' label: '上行'
}, },
{ {
value: '1', value: '1',
label: '下行' label: '下行'
} }
], ],
trainCode: '', trainCode: '',
tripNumber: '', tripNumber: '',
direction: '', direction: '',
selected: null selected: null
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'map' 'map'
]), ]),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
domIdConfirm() { domIdConfirm() {
return OperationEvent.Section.newtrain.menu.domId; return OperationEvent.Section.newtrain.menu.domId;
}, },
title() { title() {
return '设置列车'; return '设置列车';
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}); });
}, },
methods: { methods: {
loadInitData(map) { loadInitData(map) {
if (Object.keys(map || {}).length) { },
getPublishTrainList(map.skinCode).then(response => { doShow(operate, selected) {
this.trainList = response.data; this.dialogShow = true;
}).catch(() => { this.selected = selected;
this.$messageBox(`获取列车列表失败`); console.log(this.map);
}); /** 加载列车数据*/
} this.loadInitData(this.map);
},
doShow(operate, selected) {
this.dialogShow = true;
this.selected = selected;
console.log(this.map);
/** 加载列车数据*/
this.loadInitData(this.map);
this.$nextTick(function () { this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
doClose() { doClose() {
this.trainCode = ''; this.trainCode = '';
this.direction = ''; this.direction = '';
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected); mouseCancelState(this.selected);
}, },
commit() { commit() {
const operate = { const operate = {
send: true, send: true,
type: MapDeviceType.Section.type, type: MapDeviceType.Section.type,
operation: OperationEvent.Section.newtrain.menu.operation, operation: OperationEvent.Section.newtrain.menu.operation,
val: '' + this.direction + '::' + this.trainCode val: '' + this.direction + '::' + this.trainCode
}; };
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate);
}); });
}, },
cancel() { cancel() {
const operate = { const operate = {
type: MapDeviceType.Section.type, type: MapDeviceType.Section.type,
operation: OperationEvent.Command.cancel.menu.operation operation: OperationEvent.Command.cancel.menu.operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.doClose(); this.doClose();
}); });
} }
} }
}; };
</script> </script>

View File

@ -1,169 +1,173 @@
<template> <template>
<el-dialog class="chengdou-03__systerm stand-stop-time" :title="title" :visible.sync="show" width="480px" <el-dialog
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag> v-dialogDrag
<div class="el-dialog-div"> class="chengdou-03__systerm stand-stop-time"
<el-form size="small" label-width="80px" :model="addModel" :rules="rules" ref="form" label-position="left"> :title="title"
<el-row> :visible.sync="show"
<el-col :span="11"> width="480px"
<el-form-item prop="stationName"> :before-close="doClose"
<span slot="label">车站</span> :z-index="2000"
<el-input v-model="addModel.stationName" :disabled="true"></el-input> :modal="false"
</el-form-item> :close-on-click-modal="false"
</el-col> >
<el-col :span="11" :offset="1"> <div class="el-dialog-div">
<el-form-item prop="trainWindowCode"> <el-form ref="form" size="small" label-width="80px" :model="addModel" :rules="rules" label-position="left">
<span slot="label">车次窗</span> <el-row>
<el-input v-model="addModel.trainWindowCode" :disabled="true"></el-input> <el-col :span="11">
</el-form-item> <el-form-item prop="stationName">
</el-col> <span slot="label">车站</span>
</el-row> <el-input v-model="addModel.stationName" :disabled="true" />
<el-row> </el-form-item>
<el-col :span="11"> </el-col>
<el-form-item label="车 组 号:" prop="groupNumber"> <el-col :span="11" :offset="1">
<el-select v-model="addModel.groupNumber" filterable> <el-form-item prop="trainWindowCode">
<el-option v-for="train in trainList" :key="train.groupNumber" :label="train.groupNumber" <span slot="label">车次窗</span>
:value="train.groupNumber"> <el-input v-model="addModel.trainWindowCode" :disabled="true" />
</el-option> </el-form-item>
</el-select> </el-col>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<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> </el-row>
</el-dialog> <el-row>
<el-col :span="11">
<el-form-item label="车 组 号:" prop="groupNumber">
<el-select v-model="addModel.groupNumber" filterable>
<el-option
v-for="train in trainList"
:key="train.groupNumber"
:label="train.groupNumber"
:value="train.groupNumber"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<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>
</el-dialog>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus'; import { mouseCancelState } from '../utils/menuItemStatus';
import { getPublishTrainList } from '@/api/jmap/map';
export default { export default {
name: 'TrainCreateNumber', name: 'TrainCreateNumber',
components: { components: {
},
data() {
return {
trainNoList: [],
trainList: [],
selected: null,
addModel: {
stationName:'',
trainWindowCode: '',
groupNumber:''
},
rules: {
groupNumber: [
{ required: true, message: '请输入车组号', trigger: 'blur'}
]
},
dialogShow: false,
loading: false
};
},
computed: {
...mapGetters('map', [
'stationStandList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
data() { domIdCancel() {
return { return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
trainNoList: [], },
trainList: [], domIdConfirm() {
selected: null, return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : '';
addModel: { },
title() {
return '新建车组号';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.addModel = {
stationName:'', stationName:'',
trainWindowCode: '', trainWindowCode: '',
groupNumber:'', groupNumber:''
}, };
rules: {
groupNumber: [
{ required: true, message: '请输入车组号', trigger: 'blur'}
],
},
dialogShow: false,
loading: false,
} }
}, this.dialogShow = true;
computed: { this.$nextTick(function () {
...mapGetters('map', [
'stationStandList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : '';
},
title() {
return '新建车组号'
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (map) {
getPublishTrainList(map.skinCode).then(resp => {
this.trainList = resp.data;
}).catch(error => {
this.$messageBox(`获取列车车组号失败`);
});
}
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.addModel ={
stationName:'',
trainWindowCode: '',
groupNumber:'',
}
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false); });
mouseCancelState(this.selected); },
}, doClose() {
commit() { this.loading = false;
this.$refs['form'].validate((valid) => { this.dialogShow = false;
if (valid) { this.$store.dispatch('training/emitTipFresh');
let operate = { this.$store.dispatch('map/setTrainWindowShow', false);
send: true, mouseCancelState(this.selected);
type: MapDeviceType.Train.type, },
operation: OperationEvent.Train.createTrainNo.menu.operation, commit() {
} this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.createTrainNo.menu.operation
};
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose(); this.doClose();
// this.$refs.noticeInfo.doShow(operate); }
}) }).catch(error => {
} else { this.loading = false;
return false;
}
});
},
cancel() {
let operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose(); this.doClose();
} // this.$refs.noticeInfo.doShow(operate);
}).catch(error => { this.doClose(); }); });
} } else {
return false;
}
});
},
cancel() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => { this.doClose(); });
} }
} }
};
</script> </script>
<style scoped> <style scoped>
.chengdou-03__systerm .el-dialog .base-label { .chengdou-03__systerm .el-dialog .base-label {

View File

@ -1,164 +1,168 @@
<template> <template>
<el-dialog class="chengdou-03__systerm stand-stop-time" :title="title" :visible.sync="show" width="480px" <el-dialog
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag> v-dialogDrag
<div class="el-dialog-div"> class="chengdou-03__systerm stand-stop-time"
<el-form size="small" label-width="80px" :model="addModel" ref="form" label-position="left"> :title="title"
<el-row> :visible.sync="show"
<el-col :span="11"> width="480px"
<el-form-item prop="stationName"> :before-close="doClose"
<span slot="label">车站</span> :z-index="2000"
<el-input v-model="addModel.stationName" :disabled="true"></el-input> :modal="false"
</el-form-item> :close-on-click-modal="false"
</el-col> >
<el-col :span="11" :offset="1"> <div class="el-dialog-div">
<el-form-item prop="trainWindowCode"> <el-form ref="form" size="small" label-width="80px" :model="addModel" label-position="left">
<span slot="label">车次窗</span> <el-row>
<el-input v-model="addModel.trainWindowCode" :disabled="true"></el-input> <el-col :span="11">
</el-form-item> <el-form-item prop="stationName">
</el-col> <span slot="label">车站</span>
</el-row> <el-input v-model="addModel.stationName" :disabled="true" />
<el-row> </el-form-item>
<el-col :span="11"> </el-col>
<el-form-item label="车 组 号:" prop="groupNumber"> <el-col :span="11" :offset="1">
<el-select v-model="addModel.groupNumber" filterable disabled> <el-form-item prop="trainWindowCode">
<el-option v-for="train in trainList" :key="train.groupNumber" :label="train.groupNumber" <span slot="label">车次窗</span>
:value="train.groupNumber"> <el-input v-model="addModel.trainWindowCode" :disabled="true" />
</el-option> </el-form-item>
</el-select> </el-col>
</el-form-item> </el-row>
</el-col> <el-row>
</el-row> <el-col :span="11">
</el-form> <el-form-item label="车 组 号:" prop="groupNumber">
</div> <el-select v-model="addModel.groupNumber" filterable disabled>
<el-row justify="center" class="button-group"> <el-option
<el-col :span="10" :offset="2"> v-for="train in trainList"
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button> :key="train.groupNumber"
</el-col> :label="train.groupNumber"
<el-col :span="8" :offset="4"> :value="train.groupNumber"
<el-button :id="domIdCancel" @click="cancel"> </el-button> />
</el-col> </el-select>
</el-row> </el-form-item>
</el-dialog> </el-col>
</el-row>
</el-form>
</div>
<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>
</el-dialog>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus'; import { mouseCancelState } from '../utils/menuItemStatus';
import { getPublishTrainList } from '@/api/jmap/map';
export default { export default {
name: 'TrainDeleteNumber', name: 'TrainDeleteNumber',
components: { components: {
},
data() {
return {
trainNoList: [],
trainList: [],
selected: null,
addModel: {
stationName:'',
trainWindowCode: '',
groupNumber:''
},
dialogShow: false,
loading: false
};
},
computed: {
...mapGetters('map', [
'stationStandList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
data() { domIdCancel() {
return { return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
trainNoList: [], },
trainList: [], domIdConfirm() {
selected: null, return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : '';
addModel: { },
title() {
return '删除车组号';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.addModel = {
stationName:'', stationName:'',
trainWindowCode: '', trainWindowCode: '',
groupNumber:'', groupNumber:''
}, };
dialogShow: false,
loading: false,
} }
}, this.dialogShow = true;
computed: { this.$nextTick(function () {
...mapGetters('map', [
'stationStandList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : '';
},
title() {
return '删除车组号'
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (map) {
getPublishTrainList(map.skinCode).then(resp => {
this.trainList = resp.data;
}).catch(error => {
this.$messageBox(`获取列车车组号失败`);
});
}
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.addModel ={
stationName:'',
trainWindowCode: '',
groupNumber:'',
}
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false); });
mouseCancelState(this.selected); },
}, doClose() {
commit() { this.loading = false;
this.$refs['form'].validate((valid) => { this.dialogShow = false;
if (valid) { this.$store.dispatch('training/emitTipFresh');
let operate = { this.$store.dispatch('map/setTrainWindowShow', false);
send: true, mouseCancelState(this.selected);
type: MapDeviceType.Train.type, },
operation: OperationEvent.Train.deleteTrainNo.menu.operation, commit() {
}; this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.deleteTrainNo.menu.operation
};
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose(); this.doClose();
// this.$refs.noticeInfo.doShow(operate); }
}) }).catch(error => {
} else { this.loading = false;
return false;
}
});
},
cancel() {
let operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose(); this.doClose();
} // this.$refs.noticeInfo.doShow(operate);
}).catch(error => { this.doClose(); }); });
} } else {
return false;
}
});
},
cancel() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => { this.doClose(); });
} }
} }
};
</script> </script>
<style scoped> <style scoped>
.chengdou-03__systerm .el-dialog .base-label { .chengdou-03__systerm .el-dialog .base-label {

View File

@ -234,7 +234,6 @@
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus'; import { mouseCancelState } from '../utils/menuItemStatus';
import { getPublishTrainList } from '@/api/jmap/map';
export default { export default {
name: 'TrainDetailInfo', name: 'TrainDetailInfo',

View File

@ -49,125 +49,117 @@
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus'; import { mouseCancelState } from '../utils/menuItemStatus';
import { getPublishTrainList } from '@/api/jmap/map';
export default { export default {
name: 'TrainEditNumber', name: 'TrainEditNumber',
components: { components: {
}, },
data() { data() {
return { return {
trainNoList: [], trainNoList: [],
trainList: [], trainList: [],
selected: null, selected: null,
addModel: { addModel: {
stationName: '', stationName: '',
trainWindowCode: '', trainWindowCode: '',
oldGroupNumber: '', oldGroupNumber: '',
newGroupNumber: '' newGroupNumber: ''
}, },
rules: { rules: {
newGroupNumber: [ newGroupNumber: [
{ required: true, message: '请输入新车组号', trigger: 'blur'} { required: true, message: '请输入新车组号', trigger: 'blur'}
] ]
}, },
dialogShow: false, dialogShow: false,
loading: false loading: false
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'stationStandList' 'stationStandList'
]), ]),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
domIdConfirm() { domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : ''; return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : '';
}, },
title() { title() {
return '修改车组号'; return '修改车组号';
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}); });
}, },
methods: { methods: {
loadInitData(map) { loadInitData(map) {
if (map) { },
getPublishTrainList(map.skinCode).then(resp => { doShow(operate, selected) {
this.trainList = resp.data; this.selected = selected;
}).catch(() => { //
this.$messageBox(`获取列车车组号失败`); if (!this.dialogShow) {
}); this.addModel = {
} stationName: '',
}, trainWindowCode: '',
doShow(operate, selected) { oldGroupNumber: '',
this.selected = selected; newGroupNumber: ''
// };
if (!this.dialogShow) { }
this.addModel ={ this.dialogShow = true;
stationName: '', this.$nextTick(function () {
trainWindowCode: '', this.$store.dispatch('training/emitTipFresh');
oldGroupNumber: '', });
newGroupNumber: '' },
}; doClose() {
} this.loading = false;
this.dialogShow = true; this.dialogShow = false;
this.$nextTick(function () { this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('map/setTrainWindowShow', false);
}); mouseCancelState(this.selected);
}, },
doClose() { commit() {
this.loading = false; this.$refs['form'].validate((valid) => {
this.dialogShow = false; if (valid) {
this.$store.dispatch('training/emitTipFresh'); const operate = {
this.$store.dispatch('map/setTrainWindowShow', false); send: true,
mouseCancelState(this.selected); type: MapDeviceType.Train.type,
}, operation: OperationEvent.Train.editTrainNo.menu.operation
commit() { };
this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.editTrainNo.menu.operation
};
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
}); });
} else { } else {
return false; return false;
} }
}); });
}, },
cancel() { cancel() {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation operation: OperationEvent.Command.cancel.menu.operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { this.doClose(); }); }).catch(() => { this.doClose(); });
} }
} }
}; };
</script> </script>
<style scoped> <style scoped>

View File

@ -1,182 +1,186 @@
<template> <template>
<el-dialog class="chengdou-03__systerm stand-stop-time" :title="title" :visible.sync="show" width="480px" <el-dialog
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag> v-dialogDrag
<div class="el-dialog-div"> class="chengdou-03__systerm stand-stop-time"
<el-form size="small" label-width="90px" :model="addModel" ref="form" label-position="left"> :title="title"
<el-row> :visible.sync="show"
<el-col :span="11"> width="480px"
<el-form-item prop="stationName"> :before-close="doClose"
<span slot="label">车站</span> :z-index="2000"
<el-input v-model="addModel.stationName" :disabled="true"></el-input> :modal="false"
</el-form-item> :close-on-click-modal="false"
</el-col> >
<el-col :span="11" :offset="1"> <div class="el-dialog-div">
<el-form-item prop="trainWindowCode"> <el-form ref="form" size="small" label-width="90px" :model="addModel" label-position="left">
<span slot="label">车次窗</span> <el-row>
<el-input v-model="addModel.trainWindowCode" :disabled="true"></el-input> <el-col :span="11">
</el-form-item> <el-form-item prop="stationName">
</el-col> <span slot="label">车站</span>
</el-row> <el-input v-model="addModel.stationName" :disabled="true" />
<el-row> </el-form-item>
<el-col :span="11"> </el-col>
<el-form-item label="车 组 号:" prop="groupNumber"> <el-col :span="11" :offset="1">
<el-select v-model="addModel.groupNumber" filterable disabled> <el-form-item prop="trainWindowCode">
<el-option v-for="train in trainList" :key="train.groupNumber" :label="train.groupNumber" <span slot="label">车次窗</span>
:value="train.groupNumber"> <el-input v-model="addModel.trainWindowCode" :disabled="true" />
</el-option> </el-form-item>
</el-select> </el-col>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item prop="purposeStationName">
<span slot="label">车站</span>
<el-input v-model="addModel.purposeStationName" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="11" :offset="1">
<el-form-item prop="purposeTrainWindowCode" >
<span slot="label">目的车次窗</span>
<el-input v-model="addModel.purposeTrainWindowCode" :disabled="true"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<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> </el-row>
</el-dialog> <el-row>
<el-col :span="11">
<el-form-item label="车 组 号:" prop="groupNumber">
<el-select v-model="addModel.groupNumber" filterable disabled>
<el-option
v-for="train in trainList"
:key="train.groupNumber"
:label="train.groupNumber"
:value="train.groupNumber"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item prop="purposeStationName">
<span slot="label">车站</span>
<el-input v-model="addModel.purposeStationName" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="11" :offset="1">
<el-form-item prop="purposeTrainWindowCode">
<span slot="label">目的车次窗</span>
<el-input v-model="addModel.purposeTrainWindowCode" :disabled="true" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<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>
</el-dialog>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus'; import { mouseCancelState } from '../utils/menuItemStatus';
import { getPublishTrainList } from '@/api/jmap/map';
export default { export default {
name: 'TrainMoveNumber', name: 'TrainMoveNumber',
components: { components: {
},
data() {
return {
trainNoList: [],
trainList: [],
selected: null,
addModel: {
stationName: '',
trainWindowCode: '',
groupNumber: '',
purposeStationName: '',
purposeTrainWindowCode: ''
},
dialogShow: false,
loading: false
};
},
computed: {
...mapGetters('map', [
'stationStandList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
data() { domIdCancel() {
return { return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
trainNoList: [], },
trainList: [], domIdConfirm() {
selected: null, return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : '';
addModel: { },
title() {
return '移动车组号';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
},
doShow(operate, selected) {
console.log('operate', operate, selected);
this.selected = selected;
//
if (!this.dialogShow) {
this.addModel = {
stationName: '', stationName: '',
trainWindowCode: '', trainWindowCode: '',
groupNumber: '', groupNumber: '',
purposeStationName: '', purposeStationName: '',
purposeTrainWindowCode: '', purposeTrainWindowCode: ''
},
dialogShow: false,
loading: false,
}
},
computed: {
...mapGetters('map', [
'stationStandList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : '';
},
title() {
return '移动车组号'
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (map) {
getPublishTrainList(map.skinCode).then(resp => {
this.trainList = resp.data;
}).catch(error => {
this.$messageBox(`获取列车车组号失败`);
});
}
},
doShow(operate, selected) {
console.log('operate',operate,selected);
this.selected = selected;
//
if (!this.dialogShow) {
this.addModel ={
stationName: '',
trainWindowCode: '',
groupNumber: '',
purposeStationName: '',
purposeTrainWindowCode: '',
}
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
mouseCancelState(this.selected);
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
let operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.moveTrainNo.menu.operation,
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
// this.$refs.noticeInfo.doShow(operate);
})
} else {
return false;
}
});
},
cancel() {
let operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation,
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => { this.doClose(); });
} }
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
mouseCancelState(this.selected);
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.moveTrainNo.menu.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
// this.$refs.noticeInfo.doShow(operate);
});
} else {
return false;
}
});
},
cancel() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => { this.doClose(); });
} }
} }
};
</script> </script>
<style scoped> <style scoped>
.chengdou-03__systerm .el-dialog .base-label { .chengdou-03__systerm .el-dialog .base-label {

View File

@ -19,128 +19,129 @@
<script> <script>
import { runPlanTemplateList } from '@/api/runplan'; import { runPlanTemplateList } from '@/api/runplan';
import { getStationListBySkinCode } from '@/api/runplan'; import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation'; import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin'; import { getSkinCodeList } from '@/api/management/mapskin';
export default { export default {
name: 'ReloadTodayPlan', name: 'ReloadTodayPlan',
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
skinCodeList: [], skinCodeList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
reset: true, reset: true,
labelWidth: '100px', labelWidth: '100px',
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: '运行图名称' label: '运行图名称'
} }
} }
}, },
queryList: { queryList: {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
radioShow: true, radioShow: true,
columns: [ columns: [
{ {
title: '运行图名称', title: '运行图名称',
prop: 'name' prop: 'name'
}, },
{ {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinCode', prop: 'skinCode',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
}, },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
} }
] ]
}, },
currentModel: {} currentModel: {}
}; };
}, },
computed: { computed: {
title() { title() {
return '加载当天计划'; return '加载当天计划';
} }
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.skinCodeList = []; this.skinCodeList = [];
getSkinCodeList().then(response => { getSkinCodeList().then(response => {
this.skinCodeList = response.data; this.skinCodeList = response.data;
}); });
}, },
doShow() { doShow() {
this.loading = false; this.loading = false;
this.dialogShow = true; this.dialogShow = true;
this.loadInitData(); this.loadInitData();
}, },
doClose() { doClose() {
this.dialogShow = false; this.dialogShow = false;
}, },
queryFunction(params) { queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) { if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode']; params['skinCode'] = this.$store.getters['map/skinCode'];
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
// //
handleConfirm() { handleConfirm() {
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose(); const choose = this.$refs.pageRules.currentChoose();
if (choose && choose.id) { if (choose && choose.id) {
this.loading = true; this.loading = true;
generateDayRunPlan(choose.id, this.$route.query.group).then(response => { generateDayRunPlan(choose.id, this.$route.query.group).then(response => {
this.loading = false; this.loading = false;
this.reloadTable(); this.reloadTable();
this.loadRunData(); this.loadRunData();
this.doClose(); this.doClose();
this.$message.success(`生成用户每日运行图成功`); this.$message.success(`生成用户每日运行图成功`);
}).catch((error) => { }).catch((error) => {
console.error(error); console.error(error);
this.loading = false; this.loading = false;
this.reloadTable(); this.reloadTable();
this.$messageBox(`生成用户每日运行图失败`); this.$messageBox(`生成用户每日运行图失败`);
}); });
} else { } else {
this.$messageBox(`请选择需要加载的运行图`); this.$messageBox(`请选择需要加载的运行图`);
} }
} }
}, },
loadRunData() { loadRunData() {
const skinCode = this.$route.query.skinCode; const skinCode = this.$route.query.skinCode;
this.$store.dispatch('runPlan/clear'); const mapId = this.$route.query.mapId;
if (skinCode) { this.$store.dispatch('runPlan/clear');
getStationListBySkinCode(skinCode).then(response => { if (mapId) {
const stations = response.data; getStationList(mapId).then(response => {
this.PlanConvert = this.$theme.loadPlanConvert(skinCode); const stations = response.data;
this.$store.dispatch('runPlan/setStations', stations).then(() => { this.PlanConvert = this.$theme.loadPlanConvert(skinCode);
getEveryDayRunPlanData(this.$route.query.group).then(resp => { this.$store.dispatch('runPlan/setStations', stations).then(() => {
this.$store.dispatch('runPlan/setPlanData', resp.data); getEveryDayRunPlanData(this.$route.query.group).then(resp => {
}).catch(() => { this.$store.dispatch('runPlan/setPlanData', resp.data);
this.$store.dispatch('runPlan/setPlanData', []); }).catch(() => {
this.$messageBox(`获取运行图数据失败`); this.$store.dispatch('runPlan/setPlanData', []);
}); this.$messageBox(`获取运行图数据失败`);
}); });
}).catch(() => { });
this.$messageBox(`获取车站列表失败`); }).catch(() => {
}); this.$messageBox(`获取车站列表失败`);
} });
}, }
reloadTable() { },
this.queryList.reload(); reloadTable() {
} this.queryList.reload();
} }
}
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -19,127 +19,128 @@
<script> <script>
import { runPlanTemplateList } from '@/api/runplan'; import { runPlanTemplateList } from '@/api/runplan';
import { getStationListBySkinCode } from '@/api/runplan'; import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation'; import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin'; import { getSkinCodeList } from '@/api/management/mapskin';
export default { export default {
name: 'ReloadTodayPlan', name: 'ReloadTodayPlan',
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
skinCodeList: [], skinCodeList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
reset: true, reset: true,
labelWidth: '100px', labelWidth: '100px',
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: '运行图名称' label: '运行图名称'
} }
} }
}, },
queryList: { queryList: {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
radioShow: true, radioShow: true,
columns: [ columns: [
{ {
title: '运行图名称', title: '运行图名称',
prop: 'name' prop: 'name'
}, },
{ {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinCode', prop: 'skinCode',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
}, },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
} }
] ]
}, },
currentModel: {} currentModel: {}
}; };
}, },
computed: { computed: {
title() { title() {
return '加载当天计划'; return '加载当天计划';
} }
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.skinCodeList = []; this.skinCodeList = [];
getSkinCodeList().then(response => { getSkinCodeList().then(response => {
this.skinCodeList = response.data; this.skinCodeList = response.data;
}); });
}, },
doShow() { doShow() {
this.loading = false; this.loading = false;
this.dialogShow = true; this.dialogShow = true;
this.loadInitData(); this.loadInitData();
}, },
doClose() { doClose() {
this.dialogShow = false; this.dialogShow = false;
}, },
queryFunction(params) { queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) { if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode']; params['skinCode'] = this.$store.getters['map/skinCode'];
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
// //
handleConfirm() { handleConfirm() {
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose(); const choose = this.$refs.pageRules.currentChoose();
if (choose && choose.id) { if (choose && choose.id) {
this.loading = true; this.loading = true;
generateDayRunPlan(choose.id, this.$route.query.group).then(response => { generateDayRunPlan(choose.id, this.$route.query.group).then(response => {
this.loading = false; this.loading = false;
this.reloadTable(); this.reloadTable();
this.loadRunData(); this.loadRunData();
this.doClose(); this.doClose();
this.$message.success(`生成用户每日运行图成功`); this.$message.success(`生成用户每日运行图成功`);
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.reloadTable(); this.reloadTable();
this.$messageBox(`生成用户每日运行图失败`); this.$messageBox(`生成用户每日运行图失败`);
}); });
} else { } else {
this.$messageBox(`请选择需要加载的运行图`); this.$messageBox(`请选择需要加载的运行图`);
} }
} }
}, },
loadRunData() { loadRunData() {
const skinCode = this.$route.query.skinCode; const skinCode = this.$route.query.skinCode;
this.$store.dispatch('runPlan/clear'); const mapId = this.$route.query.mapId;
if (skinCode) { this.$store.dispatch('runPlan/clear');
getStationListBySkinCode(skinCode).then(response => { if (mapId) {
const stations = response.data; getStationList(mapId).then(response => {
this.PlanConvert = this.$theme.loadPlanConvert(skinCode); const stations = response.data;
this.$store.dispatch('runPlan/setStations', stations).then(() => { this.PlanConvert = this.$theme.loadPlanConvert(skinCode);
getEveryDayRunPlanData(this.$route.query.group).then(resp => { this.$store.dispatch('runPlan/setStations', stations).then(() => {
this.$store.dispatch('runPlan/setPlanData', resp.data); getEveryDayRunPlanData(this.$route.query.group).then(resp => {
}).catch(() => { this.$store.dispatch('runPlan/setPlanData', resp.data);
this.$store.dispatch('runPlan/setPlanData', []); }).catch(() => {
this.$messageBox(`获取运行图数据失败`); this.$store.dispatch('runPlan/setPlanData', []);
}); this.$messageBox(`获取运行图数据失败`);
}); });
}).catch(() => { });
this.$messageBox(`获取车站列表失败`); }).catch(() => {
}); this.$messageBox(`获取车站列表失败`);
} });
}, }
reloadTable() { },
this.queryList.reload(); reloadTable() {
} this.queryList.reload();
} }
}
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -84,393 +84,384 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map';
import ConfirmTrain from './childDialog/confirmTrain'; import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from './childDialog/childDialog/noticeInfo'; import NoticeInfo from './childDialog/childDialog/noticeInfo';
import OperateHandler from '@/scripts/plugin/trainingOperateHandler'; import OperateHandler from '@/scripts/plugin/trainingOperateHandler';
export default { export default {
name: 'TrainControl', name: 'TrainControl',
components: { components: {
ConfirmTrain, ConfirmTrain,
NoticeInfo NoticeInfo
}, },
data() { data() {
return { return {
trainList: [], trainList: [],
categoryList: [ categoryList: [
{ name: 'MM', value: '01' } { name: 'MM', value: '01' }
], ],
formModel: { formModel: {
tripNumber: '', tripNumber: '',
groupNumber: '', groupNumber: '',
trainType: '01', trainType: '01',
serviceNumber: '', serviceNumber: '',
targetCode: '', targetCode: '',
category: 'MM' category: 'MM'
}, },
rules: { rules: {
groupNumber: [ groupNumber: [
{ required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'change' } { required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'change' }
], ],
trainType: [ trainType: [
{ required: true, message: this.$t('rules.selectATrainType'), trigger: 'change' } { required: true, message: this.$t('rules.selectATrainType'), trigger: 'change' }
], ],
serviceNumber: [ serviceNumber: [
{ required: true, message: this.$t('rules.enterTheServiceNumber'), trigger: 'blur' } { required: true, message: this.$t('rules.enterTheServiceNumber'), trigger: 'blur' }
], ],
tripNumber: [ tripNumber: [
{ required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' } { required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' }
], ],
targetCode: [ targetCode: [
{ required: true, message: this.$t('rules.enterTheTargetCode'), trigger: 'blur' } { required: true, message: this.$t('rules.enterTheTargetCode'), trigger: 'blur' }
] ]
}, },
operation: null, operation: null,
dialogShow: false, dialogShow: false,
loading: false, loading: false,
direction: 0 direction: 0
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'map' 'map'
]), ]),
trainNoIsDisabled() { trainNoIsDisabled() {
return false; return false;
}, },
serverNoIsDisabled() { serverNoIsDisabled() {
return true; return true;
}, },
targetCodeIsDisabled() { targetCodeIsDisabled() {
return true; return true;
}, },
trainNumberIsDisabled() { trainNumberIsDisabled() {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) { if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true; return true;
} }
return ''; return '';
}, },
// trainTypeIsDisabled() { // trainTypeIsDisabled() {
// if (this.operation != OperationEvent.Train.addTrainId.menu.operation) { // if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
// return true; // return true;
// } // }
// return ''; // return '';
// }, // },
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
domIdTrainNumber() { domIdTrainNumber() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainNumberChange.domId; return OperationEvent.Train.addTrainId.trainNumberChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainNumberChange.domId; return OperationEvent.Train.editTrainId.trainNumberChange.domId;
} }
} }
return ''; return '';
}, },
domIdTrainNo() { domIdTrainNo() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainNoChange.domId; return OperationEvent.Train.addTrainId.trainNoChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainNoChange.domId; return OperationEvent.Train.editTrainId.trainNoChange.domId;
} }
} }
return ''; return '';
}, },
domIdTrainType() { domIdTrainType() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainTypeChange.domId; return OperationEvent.Train.addTrainId.trainTypeChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainTypeChange.domId; return OperationEvent.Train.editTrainId.trainTypeChange.domId;
} }
} }
return ''; return '';
}, },
domIdServerNo() { domIdServerNo() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.serverNoChange.domId; return OperationEvent.Train.addTrainId.serverNoChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.serverNoChange.domId; return OperationEvent.Train.editTrainId.serverNoChange.domId;
} }
} }
return ''; return '';
}, },
domIdTargetCode() { domIdTargetCode() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.targetCodeChange.domId; return OperationEvent.Train.addTrainId.targetCodeChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.targetCodeChange.domId; return OperationEvent.Train.editTrainId.targetCodeChange.domId;
} }
} }
return ''; return '';
}, },
domIdConfirm() { domIdConfirm() {
if (this.dialogShow) { if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/ /** 添加列车识别号*/
return OperationEvent.Train.addTrainId.menu.domId; return OperationEvent.Train.addTrainId.menu.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
return OperationEvent.Train.editTrainId.menu.domId; return OperationEvent.Train.editTrainId.menu.domId;
} }
} }
return ''; return '';
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
title() { title() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
return this.$t('menu.menuTrain.addTrainId'); return this.$t('menu.menuTrain.addTrainId');
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
return this.$t('menu.menuTrain.editTrainId'); return this.$t('menu.menuTrain.editTrainId');
} }
return ''; return '';
}, },
istargetCode() { istargetCode() {
if (this.formModel.serviceNumber && this.formModel.targetCode) { if (this.formModel.serviceNumber && this.formModel.targetCode) {
return false; return false;
} }
return true; return true;
} }
}, },
watch: { watch: {
'formModel.tripNumber': function(val) { 'formModel.tripNumber': function(val) {
if (val.length == 4) { if (val.length == 4) {
this.trainNoChange(val); this.trainNoChange(val);
} else { } else {
this.formModel = { this.formModel = {
groupNumber: this.formModel.groupNumber, groupNumber: this.formModel.groupNumber,
tripNumber: val, tripNumber: val,
trainType: this.formModel.trainType, trainType: this.formModel.trainType,
serviceNumber: '', serviceNumber: '',
targetCode: '', targetCode: '',
category: 'MM' category: 'MM'
}; };
} }
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}); });
}, },
methods: { methods: {
loadInitData(map) { loadInitData(map) {},
if (map.skinCode) { doShow(operate, selected) {
getPublishTrainList(map.skinCode).then(resp => { //
this.trainList = resp.data; if (!this.dialogShow) {
}).catch(() => { this.operation = operate.operation;
this.$messageBox(this.$t('error.obtainTrainGroupNumberFailed')); }
}); const model = this.$store.getters['map/getDeviceByCode'](selected.code);
} this.formModel = {
}, groupNumber: model.groupNumber,
doShow(operate, selected) { tripNumber: `${model.directionCode}${model.tripNumber}`,
// trainType: model.type,
if (!this.dialogShow) { serviceNumber: model.serviceNumber,
this.operation = operate.operation; targetCode: model.targetCode,
} category: 'MM'
const model = this.$store.getters['map/getDeviceByCode'](selected.code); };
this.formModel = {
groupNumber: model.groupNumber,
tripNumber: `${model.directionCode}${model.tripNumber}`,
trainType: model.type,
serviceNumber: model.serviceNumber,
targetCode: model.targetCode,
category: 'MM'
};
/** 加载列车数据*/ /** 加载列车数据*/
this.loadInitData(this.map); this.loadInitData(this.map);
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false); this.$store.dispatch('map/setTrainWindowShow', false);
}, },
trainNumberChange(groupNumber) { trainNumberChange(groupNumber) {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
val: `${groupNumber}`, val: `${groupNumber}`,
operation: '' operation: ''
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation; operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNumberChange.operation; operate.operation = OperationEvent.Train.editTrainId.trainNumberChange.operation;
} }
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }
}); });
}, },
trainTypeChange(trainType) { trainTypeChange(trainType) {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
val: `${trainType}`, val: `${trainType}`,
operation: '' operation: ''
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation; operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainTypeChange.operation; operate.operation = OperationEvent.Train.editTrainId.trainTypeChange.operation;
} }
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} }
}); });
}, },
trainNoChange(tripNumber) { trainNoChange(tripNumber) {
const operate = { const operate = {
send: true, send: true,
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
val: tripNumber, val: tripNumber,
operation: '' operation: ''
}; };
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation; operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation; operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation;
} }
OperateHandler.backStep(1); OperateHandler.backStep(1);
this.$store.dispatch('training/next', operate).then(({ valid, response }) => { this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) { if (valid) {
if (response.data) { if (response.data) {
this.formModel = { this.formModel = {
groupNumber: this.formModel.groupNumber, groupNumber: this.formModel.groupNumber,
tripNumber: tripNumber, tripNumber: tripNumber,
trainType: this.formModel.trainType, trainType: this.formModel.trainType,
serviceNumber: response.data.serviceNumber, serviceNumber: response.data.serviceNumber,
targetCode: response.data.targetCode, targetCode: response.data.targetCode,
category: 'MM' category: 'MM'
}; };
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else { } else {
this.formModel = { this.formModel = {
groupNumber: this.formModel.groupNumber, groupNumber: this.formModel.groupNumber,
tripNumber: tripNumber, tripNumber: tripNumber,
trainType: this.formModel.trainType, trainType: this.formModel.trainType,
serviceNumber: '', serviceNumber: '',
targetCode: '', targetCode: '',
category: 'MM' category: 'MM'
}; };
} }
} }
}); });
}, },
commit() { commit() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) { if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 增加列车识别号*/ /** 增加列车识别号*/
this.addTrainId(); this.addTrainId();
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) { } else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/ /** 修改列车识别号*/
this.editTrainId(); this.editTrainId();
} }
}, },
// //
addTrainId() { addTrainId() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
const model = this.formModel; const model = this.formModel;
const operate = { const operate = {
send: true, send: true,
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
operation: OperationEvent.Train.addTrainId.menu.operation, operation: OperationEvent.Train.addTrainId.menu.operation,
messages: [this.$t('tip.addTrainIdTip')], messages: [this.$t('tip.addTrainIdTip')],
val: `${model.groupNumber}::${model.trainType}::${model.serviceNumber}::${model.tripNumber}::${model.targetCode}` val: `${model.groupNumber}::${model.trainType}::${model.serviceNumber}::${model.tripNumber}::${model.targetCode}`
}; };
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.confirmTrain.doShow(operate); this.$refs.confirmTrain.doShow(operate);
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate);
}); });
} else { } else {
return false; return false;
} }
}); });
}, },
// //
editTrainId() { editTrainId() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
const operate = { const operate = {
send: true, send: true,
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
operation: OperationEvent.Train.editTrainId.menu.operation, operation: OperationEvent.Train.editTrainId.menu.operation,
messages: [this.$t('tip.editTrainIdTip')], messages: [this.$t('tip.editTrainIdTip')],
val: `${this.formModel.trainType}::${this.formModel.tripNumber}` val: `${this.formModel.trainType}::${this.formModel.tripNumber}`
}; };
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.confirmTrain.doShow(operate); this.$refs.confirmTrain.doShow(operate);
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate);
}); });
} else { } else {
return false; return false;
} }
}); });
}, },
cancel() { cancel() {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation operation: OperationEvent.Command.cancel.menu.operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.doClose(); this.doClose();
}); });
} }
} }
}; };
</script> </script>

View File

@ -39,117 +39,116 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
// import { getPublishTrainList } from '@/api/jmap/map';
import NoticeInfo from './childDialog/childDialog/noticeInfo'; import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default { export default {
name: 'RouteCreate', name: 'RouteCreate',
components: { components: {
NoticeInfo NoticeInfo
}, },
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
trainList: [], trainList: [],
trainNoList: [], trainNoList: [],
directionList: [ directionList: [
{ {
value: '2', value: '2',
label: this.$t('menu.up') label: this.$t('menu.up')
}, },
{ {
value: '1', value: '1',
label: this.$t('menu.down') label: this.$t('menu.down')
} }
], ],
trainCode: '', trainCode: '',
tripNumber: '', tripNumber: '',
direction: '', direction: '',
selected: null selected: null
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'map' 'map'
]), ]),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
domIdConfirm() { domIdConfirm() {
return OperationEvent.Section.newtrain.menu.domId; return OperationEvent.Section.newtrain.menu.domId;
}, },
title() { title() {
return this.$t('menu.settingTrain'); return this.$t('menu.settingTrain');
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}); });
}, },
methods: { methods: {
loadInitData(map) { loadInitData(map) {
if (map.trainList.length) { if (map.trainList.length) {
this.trainList = map.trainList; this.trainList = map.trainList;
} else { } else {
this.$messageBox(this.$t('error.getTrainListFailed')); this.$messageBox(this.$t('error.getTrainListFailed'));
} }
}, },
doShow(operate, selected) { doShow(operate, selected) {
this.dialogShow = true; this.dialogShow = true;
this.selected = selected; this.selected = selected;
console.log(this.map, 111); console.log(this.map, 111);
/** 加载列车数据*/ /** 加载列车数据*/
this.loadInitData(this.map); this.loadInitData(this.map);
this.$nextTick(function () { this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
doClose() { doClose() {
this.trainCode = ''; this.trainCode = '';
this.direction = ''; this.direction = '';
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}, },
commit() { commit() {
const operate = { const operate = {
send: true, send: true,
type: MapDeviceType.Section.type, type: MapDeviceType.Section.type,
operation: OperationEvent.Section.newtrain.menu.operation, operation: OperationEvent.Section.newtrain.menu.operation,
val: '' + this.direction + '::' + this.trainCode val: '' + this.direction + '::' + this.trainCode
}; };
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(operate); this.$refs.noticeInfo.doShow(operate);
}); });
}, },
cancel() { cancel() {
const operate = { const operate = {
type: MapDeviceType.Section.type, type: MapDeviceType.Section.type,
operation: OperationEvent.Command.cancel.menu.operation operation: OperationEvent.Command.cancel.menu.operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.doClose(); this.doClose();
}); });
} }
} }
}; };
</script> </script>

View File

@ -78,118 +78,118 @@ import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic'; import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
export default { export default {
name: 'TrainSwitch', name: 'TrainSwitch',
components: { components: {
}, },
data() { data() {
return { return {
trainNoList: [], trainNoList: [],
addModel: { addModel: {
trainNumberSource: '', trainNumberSource: '',
trainSource: '', trainSource: '',
stationStandSource: '', stationStandSource: '',
trainGoal: '', trainGoal: '',
stationStandGoal: '', stationStandGoal: '',
trainNumberGoal: '' trainNumberGoal: ''
}, },
rules: { rules: {
trainNumberSource: [ trainNumberSource: [
{ required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'blur' } { required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'blur' }
], ],
trainSource: [ trainSource: [
{ required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' } { required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' }
], ],
stationStandSource: [ stationStandSource: [
{ required: true, message: this.$t('rules.selectStation'), trigger: 'change' } { required: true, message: this.$t('rules.selectStation'), trigger: 'change' }
], ],
trainNumberGoal: [ trainNumberGoal: [
{ required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'blur' } { required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'blur' }
], ],
trainGoal: [ trainGoal: [
{ required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' } { required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' }
], ],
stationStandGoal: [ stationStandGoal: [
{ required: true, message: this.$t('rules.selectStation'), trigger: 'change' } { required: true, message: this.$t('rules.selectStation'), trigger: 'change' }
] ]
}, },
dialogShow: false, dialogShow: false,
loading: false loading: false
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'stationStandList' 'stationStandList'
]), ]),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
domIdCancel() { domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : ''; return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
}, },
domIdConfirm() { domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.moveTrainId.menu.domId : ''; return this.dialogShow ? OperationEvent.Train.moveTrainId.menu.domId : '';
}, },
title() { title() {
return this.$t('menu.menuTrain.moveTrainId'); return this.$t('menu.menuTrain.switchTrainId');
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('training/tipReload'); this.$store.dispatch('training/tipReload');
}); });
}, },
methods: { methods: {
doShow(operate, selected) { doShow(operate, selected) {
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false); this.$store.dispatch('map/setTrainWindowShow', false);
}, },
commit() { commit() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
const operate = { const operate = {
send: true, send: true,
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
operation: OperationEvent.Train.moveTrainId.menu.operation operation: OperationEvent.Train.moveTrainId.menu.operation
}; };
this.loading = true; this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow(operate);
}); });
} else { } else {
return false; return false;
} }
}); });
}, },
cancel() { cancel() {
const operate = { const operate = {
type: MapDeviceType.Train.type, type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation operation: OperationEvent.Command.cancel.menu.operation
}; };
this.$store.dispatch('training/next', operate).then(({ valid }) => { this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(() => { this.doClose(); }); }).catch(() => { this.doClose(); });
} }
} }
}; };
</script> </script>
<style scoped> <style scoped>

View File

@ -19,127 +19,128 @@
<script> <script>
import { runPlanTemplateList } from '@/api/runplan'; import { runPlanTemplateList } from '@/api/runplan';
import { getStationListBySkinCode } from '@/api/runplan'; import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation'; import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin'; import { getSkinCodeList } from '@/api/management/mapskin';
export default { export default {
name: 'ReloadTodayPlan', name: 'ReloadTodayPlan',
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
skinCodeList: [], skinCodeList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
reset: true, reset: true,
labelWidth: '120px', labelWidth: '120px',
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: this.$t('menu.runGraphName') label: this.$t('menu.runGraphName')
} }
} }
}, },
queryList: { queryList: {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
radioShow: true, radioShow: true,
columns: [ columns: [
{ {
title: this.$t('menu.runGraphName'), title: this.$t('menu.runGraphName'),
prop: 'name' prop: 'name'
}, },
{ {
title: this.$t('menu.skinType'), title: this.$t('menu.skinType'),
prop: 'skinCode', prop: 'skinCode',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
}, },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
} }
] ]
}, },
currentModel: {} currentModel: {}
}; };
}, },
computed: { computed: {
title() { title() {
return this.$t('menu.loadTheDayPlan'); return this.$t('menu.loadTheDayPlan');
} }
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.skinCodeList = []; this.skinCodeList = [];
getSkinCodeList().then(response => { getSkinCodeList().then(response => {
this.skinCodeList = response.data; this.skinCodeList = response.data;
}); });
}, },
doShow() { doShow() {
this.loading = false; this.loading = false;
this.dialogShow = true; this.dialogShow = true;
this.loadInitData(); this.loadInitData();
}, },
doClose() { doClose() {
this.dialogShow = false; this.dialogShow = false;
}, },
queryFunction(params) { queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) { if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode']; params['skinCode'] = this.$store.getters['map/skinCode'];
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
// //
handleConfirm() { handleConfirm() {
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose(); const choose = this.$refs.pageRules.currentChoose();
if (choose && choose.id) { if (choose && choose.id) {
this.loading = true; this.loading = true;
generateDayRunPlan(choose.id, this.$route.query.group).then(response => { generateDayRunPlan(choose.id, this.$route.query.group).then(response => {
this.loading = false; this.loading = false;
this.reloadTable(); this.reloadTable();
this.loadRunData(); this.loadRunData();
this.doClose(); this.doClose();
this.$message.success(this.$t('tip.generateUserDailyRunGraphSuccessfully')); this.$message.success(this.$t('tip.generateUserDailyRunGraphSuccessfully'));
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.reloadTable(); this.reloadTable();
this.$messageBox(this.$t('tip.generateUserDailyRunGraphFailed')); this.$messageBox(this.$t('tip.generateUserDailyRunGraphFailed'));
}); });
} else { } else {
this.$messageBox(this.$t('rules.selectTheRunningDiagramToBeLoaded')); this.$messageBox(this.$t('rules.selectTheRunningDiagramToBeLoaded'));
} }
} }
}, },
loadRunData() { loadRunData() {
const skinCode = this.$route.query.skinCode; const skinCode = this.$route.query.skinCode;
this.$store.dispatch('runPlan/clear'); const mapId = this.$route.query.mapId;
if (skinCode) { this.$store.dispatch('runPlan/clear');
getStationListBySkinCode(skinCode).then(response => { if (mapId) {
const stations = response.data; getStationList(mapId).then(response => {
this.PlanConvert = this.$theme.loadPlanConvert(skinCode); const stations = response.data;
this.$store.dispatch('runPlan/setStations', stations).then(() => { this.PlanConvert = this.$theme.loadPlanConvert(skinCode);
getEveryDayRunPlanData(this.$route.query.group).then(resp => { this.$store.dispatch('runPlan/setStations', stations).then(() => {
this.$store.dispatch('runPlan/setPlanData', resp.data); getEveryDayRunPlanData(this.$route.query.group).then(resp => {
}).catch(() => { this.$store.dispatch('runPlan/setPlanData', resp.data);
this.$store.dispatch('runPlan/setPlanData', []); }).catch(() => {
this.$messageBox(this.$t('error.getRunGraphDataFailed')); this.$store.dispatch('runPlan/setPlanData', []);
}); this.$messageBox(this.$t('error.getRunGraphDataFailed'));
}); });
}).catch(() => { });
this.$messageBox(this.$t('error.getStationListFail')); }).catch(() => {
}); this.$messageBox(this.$t('error.getStationListFail'));
} });
}, }
reloadTable() { },
this.queryList.reload(); reloadTable() {
} this.queryList.reload();
} }
}
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -41,7 +41,6 @@ import ScriptmanageHome from '@/views/scriptManage/home';
import ScriptDisplay from '@/views/scriptManage/display/index'; import ScriptDisplay from '@/views/scriptManage/display/index';
import TeachDetail from '@/views/teach/detail/index'; import TeachDetail from '@/views/teach/detail/index';
import TeachPractical from '@/views/teach/practical/index';
import TeachHome from '@/views/teach/index'; import TeachHome from '@/views/teach/index';
import Pay from '@/views/components/pay/index'; import Pay from '@/views/components/pay/index';
import ExamDetail from '@/views/exam/detail/examDetail'; import ExamDetail from '@/views/exam/detail/examDetail';
@ -603,11 +602,6 @@ export const asyncRouter = [
component: ExamDetail, component: ExamDetail,
hidden: true hidden: true
}, },
{
path: 'practical/:trainingId/:lessonId',
component: TeachPractical,
hidden: true
},
{ {
path: 'pay/:lessonId', path: 'pay/:lessonId',
component: Pay, component: Pay,

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,9 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰 // BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
} else { } else {
BASE_API = process.env.VUE_APP_BASE_API; BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -1,66 +1,36 @@
import store from '@/store'; import store from '@/store';
import { getPublishMapVersion, getPublishMapDetail, getPublishMapVersionById, getPublishMapDetailById} from '@/api/jmap/map'; import { getPublishMapVersionById, getPublishMapDetailById} from '@/api/jmap/map';
// 获取地图版本数据和store里面的map版本做比较如果不同 // 获取地图版本数据和store里面的map版本做比较如果不同
// 获取发布的地图数据 // 获取发布的地图数据
// 先设置地图数据 // 先设置地图数据
// 清除列车数据 // 清除列车数据
export function loadMapData(skinCode) {
return new Promise((resolve, reject) => {
getPublishMapVersion(skinCode).then(resp => {
var version = resp.data;
var mapData = store.state.map.mapList[`mapDate_${skinCode}`];
if (mapData && mapData.version == version) {
store.dispatch('map/setMapData', mapData).then(() => {
store.dispatch('map/clearJlmapTrainView').then(() => {
resolve();
});
});
} else {
getPublishMapDetail(skinCode).then(res => {
mapData = res.data;
store.dispatch('map/setMapDataList', mapData);
store.dispatch('map/setMapData', mapData).then(() => {
store.dispatch('map/clearJlmapTrainView').then(() => {
resolve();
});
});
}).catch(error => {
reject(error);
});
}
}).catch(error => {
reject(error);
});
});
}
export function loadMapDataById(mapId) { export function loadMapDataById(mapId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getPublishMapVersionById(mapId).then(resp => { getPublishMapVersionById(mapId).then(resp => {
var version = resp.data; var version = resp.data;
var mapData = store.state.map.mapIdList[`mapDate_${mapId}`]; var mapData = store.state.map.mapIdList[`mapDate_${mapId}`];
if (mapData && mapData.version == version) { if (mapData && mapData.version == version) {
store.dispatch('map/setMapData', mapData).then(() => { store.dispatch('map/setMapData', mapData).then(() => {
store.dispatch('map/clearJlmapTrainView').then(() => { store.dispatch('map/clearJlmapTrainView').then(() => {
resolve(); resolve();
}); });
}); });
} else { } else {
getPublishMapDetailById(mapId).then(res => { getPublishMapDetailById(mapId).then(res => {
mapData = res.data; mapData = res.data;
store.dispatch('map/setMapDataIdList', {mapData, mapId}); store.dispatch('map/setMapDataIdList', {mapData, mapId});
store.dispatch('map/setMapData', mapData).then(() => { store.dispatch('map/setMapData', mapData).then(() => {
store.dispatch('map/clearJlmapTrainView').then(() => { store.dispatch('map/clearJlmapTrainView').then(() => {
resolve(); resolve();
}); });
}); });
}).catch(error => { }).catch(error => {
reject(error); reject(error);
}); });
} }
}).catch(error => { }).catch(error => {
reject(error); reject(error);
}); });
}); });
} }

View File

@ -14,61 +14,61 @@ import { publisMapCityList} from '@/api/designPlatform';
import localStore from 'storejs'; import localStore from 'storejs';
export default { export default {
name: 'FilterCity', name: 'FilterCity',
props: { props: {
size: { size: {
type: String, type: String,
default() { default() {
return 'medium'; return 'medium';
} }
}, },
filterEmpty: { filterEmpty: {
type: Boolean, type: Boolean,
default() { default() {
return false; return false;
} }
}, },
queryFunction: { queryFunction: {
type: Function, type: Function,
required: true required: true
}, },
localParamName: { localParamName: {
type: String, type: String,
required: true required: true
} }
}, },
data() { data() {
return { return {
filterSelect: ['', ''], filterSelect: ['', ''],
filterOptions: [] filterOptions: []
}; };
}, },
created() { created() {
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
async loadInitData() { async loadInitData() {
// //
this.filterOptions=[]; this.filterOptions = [];
let resp = this.$route.fullPath.includes('design/userlist')?await this.$Dictionary.cityType():await publisMapCityList('city_type'); let resp = this.$route.fullPath.includes('design/userlist') ? await this.$Dictionary.cityType() : await publisMapCityList('city_type');
resp=this.$route.fullPath.includes('design/userlist')?resp:resp.data; resp = this.$route.fullPath.includes('design/userlist') ? resp : resp.data;
const cityList = resp.sort((a, b) => { const cityList = resp.sort((a, b) => {
return a.code.localeCompare(b.code); return a.code.localeCompare(b.code);
}); });
this.filterOptions=cityList; this.filterOptions = cityList;
this.filterSelect = localStore.get(this.localParamName) || cityList[0].code; this.filterSelect = localStore.get(this.localParamName) || cityList[0].code;
this.$emit('filterSelectChange', this.filterSelect); this.$emit('filterSelectChange', this.filterSelect);
}, },
filterSelectChange(filterSelect) { filterSelectChange(filterSelect) {
// //
// localStore.set('_cityCode', filterSelect); // localStore.set('_cityCode', filterSelect);
localStore.set(this.localParamName, filterSelect); localStore.set(this.localParamName, filterSelect);
this.$emit('filterSelectChange', filterSelect); this.$emit('filterSelectChange', filterSelect);
} }
} }
}; };
</script> </script>

View File

@ -19,43 +19,43 @@ import Digit from './digit';
import Separator from './separator'; import Separator from './separator';
export default { export default {
name: 'SystenTime', name: 'SystenTime',
components: { components: {
Digit, Digit,
Separator Separator
}, },
props: { props: {
background: { background: {
type: String, type: String,
default() { default() {
return '#000'; return '#000';
} }
}, },
color: { color: {
type: String, type: String,
default() { default() {
return '#00FF00'; return '#00FF00';
} }
}, },
time: { time: {
type: String, type: String,
default() { default() {
return '12:3456'; return '12:3456';
} }
}, },
zoom: { zoom: {
type: Number, type: Number,
default() { default() {
return 4; return 4;
} }
}, },
fine: { fine: {
type: Number, type: Number,
default() { default() {
return 2; return 2;
} }
} }
} }
}; };
</script> </script>
@ -63,5 +63,6 @@ export default {
.system-time-box { .system-time-box {
display: inline-block; display: inline-block;
text-align: center; text-align: center;
background: #000;
} }
</style> </style>

View File

@ -21,7 +21,7 @@
<span <span
class="el-icon-tickets" class="el-icon-tickets"
:style="{color: data.valid ? 'green':''}" :style="{color: data.valid ? 'green':''}"
></span> />
<span :style="{color: data.valid ? 'green':''}">&nbsp;{{ tnode.label }}</span> <span :style="{color: data.valid ? 'green':''}">&nbsp;{{ tnode.label }}</span>
</span> </span>
</el-tree> </el-tree>
@ -35,94 +35,94 @@ import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/ut
import FilterCity from '@/views/components/filterCity'; import FilterCity from '@/views/components/filterCity';
export default { export default {
name: 'ExamDetailList', name: 'ExamDetailList',
components: { components: {
FilterCity FilterCity
}, },
props: { props: {
height: { height: {
type: Number, type: Number,
required: true required: true
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
defaultShowKeys: [], defaultShowKeys: [],
queryFunction: getPublishMapTree, queryFunction: getPublishMapTree,
filterText: '', filterText: '',
treeData: [], treeData: [],
treeList: [], treeList: [],
selected: {}, selected: {},
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'name' label: 'name'
}, },
node: { node: {
} }
}; };
}, },
computed: { computed: {
role() { role() {
return this.$store.state.user.roles.includes('04') || return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05') || this.$store.state.user.roles.includes('05') ||
this.$store.state.user.roles.includes('01'); this.$store.state.user.roles.includes('01');
} }
}, },
watch: { watch: {
filterText(val) { filterText(val) {
this.treeList = this.treeData.filter((res) => { this.treeList = this.treeData.filter((res) => {
return res.name.includes(val); return res.name.includes(val);
}); });
} }
}, },
beforeDestroy () { beforeDestroy () {
removeSessionStorage('demonList'); removeSessionStorage('demonList');
}, },
methods: { methods: {
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.name.indexOf(value) !== -1; return data.name.indexOf(value) !== -1;
}, },
showContextMenu(e, obj, node, vueElem) { showContextMenu(e, obj, node, vueElem) {
if (obj) { if (obj) {
this.node = node; this.node = node;
this.selected = obj; this.selected = obj;
} }
}, },
clickEvent(obj, data, ele) { clickEvent(obj, data, ele) {
if (obj.type == 'Map') { if (obj.type == 'Map') {
setSessionStorage('demonList', obj.id); setSessionStorage('demonList', obj.id);
this.$router.push({ path: `${UrlConfig.demonstration.detail}/${obj.id}` }); this.$router.push({ path: `${UrlConfig.demonstration.detail}/${obj.id}` });
} }
}, },
async refresh(filterSelect) { async refresh(filterSelect) {
this.loading = true; this.loading = true;
this.treeData = this.treeList = []; this.treeData = this.treeList = [];
try { try {
const res = await getPublishMapTree(filterSelect); const res = await getPublishMapTree(filterSelect);
this.treeData = res.data; this.treeData = res.data;
this.treeList = this.filterText this.treeList = this.filterText
? res.data.filter(elem => { return elem.name.includes(this.filterText); }) ? res.data.filter(elem => { return elem.name.includes(this.filterText); })
: res.data; : res.data;
if (this.treeData.length > 0) { if (this.treeData.length > 0) {
this.treeData.forEach(v => { this.treeData.forEach(v => {
v.children = []; v.children = [];
}); });
} }
this.$nextTick(() => { this.$nextTick(() => {
const mapId = getSessionStorage('demonList') || null; const mapId = getSessionStorage('demonList') || null;
this.$refs.tree.setCurrentKey(mapId); this.$refs.tree.setCurrentKey(mapId);
this.loading = false; this.loading = false;
}); });
} catch (error) { } catch (error) {
this.loading = false; this.loading = false;
this.$messageBox(this.$t('error.refreshFailed')); this.$messageBox(this.$t('error.refreshFailed'));
} }
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -79,10 +79,9 @@ import { getProductDetail } from '@/api/management/mapprd';
import { runDiagramQuit, getSimulationInfo } from '@/api/simulation'; import { runDiagramQuit, getSimulationInfo } from '@/api/simulation';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login'; import { checkLoginLine } from '@/api/login';
import { loadMapData, loadMapDataById } from '@/utils/loaddata'; import { loadMapDataById } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import Vue from 'vue'; import Vue from 'vue';
// import { UrlConfig } from '@/router/index';
import {loadDraftScript} from '@/api/designPlatform'; import {loadDraftScript} from '@/api/designPlatform';
// //
@ -401,7 +400,7 @@ export default {
if (rest && rest.code == 200) { if (rest && rest.code == 200) {
const data = rest.data; const data = rest.data;
await this.$store.dispatch('training/setPrdType', data.prdType); await this.$store.dispatch('training/setPrdType', data.prdType);
await this.loadMapData(detail.skinCode); await this.loadMapDataById(this.mapId);
} }
} else { } else {
this.$messageBox(`获取实训步骤数据失败`); this.$messageBox(`获取实训步骤数据失败`);
@ -417,9 +416,8 @@ export default {
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setPrdType', '');
if (parseInt(this.skinCode)) { if (parseInt(this.mapId)) {
await this.loadMapData(this.skinCode); await this.loadMapDataById(this.mapId);
} else { } else {
this.endViewLoading(); this.endViewLoading();
} }
@ -430,9 +428,8 @@ export default {
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.$store.dispatch('training/setPrdType', this.prdTypeMap[this.prdType]); this.$store.dispatch('training/setPrdType', this.prdTypeMap[this.prdType]);
if (parseInt(this.skinCode)) { if (parseInt(this.mapId)) {
await this.loadMapData(this.skinCode); await this.loadMapDataById(this.mapId);
} else { } else {
this.endViewLoading(); this.endViewLoading();
} }
@ -443,9 +440,8 @@ export default {
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setPrdType', '01');
if (parseInt(this.skinCode)) { if (parseInt(this.mapId)) {
await this.loadMapData(this.skinCode); await this.loadMapDataById(this.mapId);
} else { } else {
this.endViewLoading(); this.endViewLoading();
} }
@ -468,9 +464,8 @@ export default {
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setPrdType', '01');
if (parseInt(this.skinCode)) { if (parseInt(this.mapId)) {
await this.loadMapData(this.skinCode); await this.loadMapDataById(this.mapId);
} else { } else {
this.endViewLoading(); this.endViewLoading();
} }
@ -535,16 +530,6 @@ export default {
async quitQuest() { async quitQuest() {
this.questId = 0; this.questId = 0;
}, },
//
async loadMapData(skinCode) {
try {
await loadMapData(skinCode);
await this.$store.dispatch('training/setMapDefaultState');
} catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading();
}
},
// id // id
async loadMapDataById(mapId) { async loadMapDataById(mapId) {

File diff suppressed because it is too large Load Diff

View File

@ -27,132 +27,132 @@ import { launchFullscreen } from '@/utils/screen';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
export default { export default {
name: 'MenuExam', name: 'MenuExam',
components: { components: {
TipExamList TipExamList
}, },
props: { props: {
group: { group: {
type: String, type: String,
required: true required: true
}, },
offset: { offset: {
type: Number, type: Number,
required: true required: true
} }
}, },
data() { data() {
return { return {
isDisable: false, isDisable: false,
startLoading: false, startLoading: false,
training: { training: {
id: '', id: '',
name: '', name: '',
remarks: '' remarks: ''
} }
}; };
}, },
computed: { computed: {
formatUsedTime() { formatUsedTime() {
return timeFormat(this.$store.state.training.usedTime); return timeFormat(this.$store.state.training.usedTime);
} }
}, },
watch: { watch: {
'$store.state.map.mapViewLoadedCount': function() { '$store.state.map.mapViewLoadedCount': function() {
this.$store.dispatch('exam/countUsedTime'); this.$store.dispatch('exam/countUsedTime');
} }
}, },
methods: { methods: {
tipInfo(opt) { tipInfo(opt) {
if (opt && opt.hasOwnProperty('color') && opt.hasOwnProperty('message')) { if (opt && opt.hasOwnProperty('color') && opt.hasOwnProperty('message')) {
const h = this.$createElement; const h = this.$createElement;
this.$notify({ this.$notify({
title: this.$t('global.tips'), title: this.$t('global.tips'),
message: h('i', { style: 'color:' + opt.color }, this.$t('display.exam.startTestOperateTip')) message: h('i', { style: 'color:' + opt.color }, this.$t('display.exam.startTestOperateTip'))
}); });
} }
}, },
start() { start() {
this.$store.dispatch('menuOperation/setButtonOperation', null); this.$store.dispatch('menuOperation/setButtonOperation', null);
this.startLoading = true; this.startLoading = true;
if (this.$route.query.trainingId) { if (this.$route.query.trainingId) {
this.isDisable = true; this.isDisable = true;
startTraining({ id: this.$route.query.trainingId }, this.group).then(response => { startTraining({ id: this.$route.query.trainingId }, this.group).then(response => {
this.$store.dispatch('training/examModeStart'); this.$store.dispatch('training/examModeStart');
this.$store.dispatch('map/clearJlmapTrainView').then(() => { this.$store.dispatch('map/clearJlmapTrainView').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => { this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}); });
this.startLoading = false; this.startLoading = false;
}).catch(() => { }).catch(() => {
this.isDisable = false; this.isDisable = false;
this.startLoading = false; this.startLoading = false;
}); });
} else { } else {
this.startLoading = true; this.startLoading = true;
this.$messageBox(this.$t('display.exam.selectTest')); this.$messageBox(this.$t('display.exam.selectTest'));
} }
}, },
end() { end() {
if (this.$route.query.trainingId) { if (this.$route.query.trainingId) {
this.isDisable = false; this.isDisable = false;
if (this.$store.state.training.started) { if (this.$store.state.training.started) {
const model = { const model = {
id: this.$route.query.examQuestionId, id: this.$route.query.examQuestionId,
usedTime: this.$store.state.training.usedTime, usedTime: this.$store.state.training.usedTime,
group: this.group group: this.group
}; };
this.$store.dispatch('training/end', null); this.$store.dispatch('training/end', null);
finishOneExamQuestion(model).then(response => { finishOneExamQuestion(model).then(response => {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
this.init(); this.init();
}).catch(() => { }).catch(() => {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
this.$messageBox(this.$t('display.exam.endTrainingError')); this.$messageBox(this.$t('display.exam.endTrainingError'));
}); });
} else { } else {
this.isDisable = true; this.isDisable = true;
this.$messageBox(this.$t('display.exam.startTestTip')); this.$messageBox(this.$t('display.exam.startTestTip'));
} }
} }
}, },
back() { back() {
this.$confirm(this.$t('display.exam.endTestTip'), this.$t('global.tips'), { this.$confirm(this.$t('display.exam.endTestTip'), 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(() => {
this.$emit('quit'); this.$emit('quit');
this.$router.push({ path: `${UrlConfig.trainingPlatform.examDetail}/${this.$route.query.examId}`, query: { subSystem: this.$route.query.subSystem }}); this.$router.push({ path: `${UrlConfig.trainingPlatform.examDetail}/${this.$route.query.examId}`, query: { subSystem: this.$route.query.subSystem, mapId: this.$route.query.mapId }});
Notification.closeAll(); Notification.closeAll();
exitFullscreen(); exitFullscreen();
}).catch(() => { }).catch(() => {
}); });
}, },
init() { init() {
launchFullscreen(); launchFullscreen();
// //
refreshExamList(this.$route.query.userExamId).then(response => { refreshExamList(this.$route.query.userExamId).then(response => {
this.$store.dispatch('exam/setUsedTime', response.data.usedTime); this.$store.dispatch('exam/setUsedTime', response.data.usedTime);
this.$store.dispatch('exam/setTotalTime', response.data.duration); this.$store.dispatch('exam/setTotalTime', response.data.duration);
this.$store.dispatch('trainingList/setTrainingList', response.data.userExamQuestionsVOs).then(response => { }); this.$store.dispatch('trainingList/setTrainingList', response.data.userExamQuestionsVOs).then(response => { });
}).catch(error => { }).catch(error => {
// 50009y // 50009y
if (error.code === 500009) { if (error.code === 500009) {
this.$router.replace({ path: `/trainingPlatform/result/${this.$route.params.userExamId}`, query: {subSystem: this.$route.query.subSystem} }); this.$router.replace({ path: `/trainingPlatform/result/${this.$route.params.userExamId}`, query: {subSystem: this.$route.query.subSystem} });
} else { } else {
this.$messageBox(this.$t('display.exam.refreshListError')); this.$messageBox(this.$t('display.exam.refreshListError'));
} }
}); });
}, },
refresh() { refresh() {
this.isDisable = false; this.isDisable = false;
this.$store.dispatch('training/end', null); this.$store.dispatch('training/end', null);
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -5,164 +5,164 @@
</el-select> </el-select>
<el-button-group> <el-button-group>
<!-- viewRunQuest --> <!-- viewRunQuest -->
<el-button v-if="isDemon && isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewScriptRoles">{{$t('display.schema.selectRoles')}}</el-button> <el-button v-if="isDemon && isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button>
<el-button v-if="isDemon && !isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{$t('display.schema.loadScript')}}</el-button> <el-button v-if="isDemon && !isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
<el-button v-if="notScript && runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{$t('display.schema.previewRunDiagram')}}</el-button> <el-button v-if="notScript && runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
<el-button v-if="!runing && !isPlan && notScript" size="small" :disabled="viewDisabled" type="warning" @click="loadRunPlan">{{$t('display.schema.loadRunDiagram')}}</el-button> <el-button v-if="!runing && !isPlan && notScript" size="small" :disabled="viewDisabled" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
<el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">{{$t('display.schema.faultSetting')}}</el-button> <el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">{{ $t('display.schema.faultSetting') }}</el-button>
</el-button-group> </el-button-group>
<el-radio-group v-if="!isPlan" v-model="mode" size="small" @change="changeOperateMode(mode)"> <el-radio-group v-if="!isPlan" v-model="mode" size="small" @change="changeOperateMode(mode)">
<el-radio-button class="mode" :label="OperateMode.NORMAL">{{$t('display.schema.normalOperation')}}</el-radio-button> <el-radio-button class="mode" :label="OperateMode.NORMAL">{{ $t('display.schema.normalOperation') }}</el-radio-button>
<el-radio-button class="mode" :label="OperateMode.FAULT">{{$t('display.schema.faultOperation')}}</el-radio-button> <el-radio-button class="mode" :label="OperateMode.FAULT">{{ $t('display.schema.faultOperation') }}</el-radio-button>
</el-radio-group> </el-radio-group>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic'; import { OperateMode } from '@/scripts/ConstDic';
import { getStationListBySkinCode, queryRunPlan } from '@/api/runplan'; import { getStationList, queryRunPlan } from '@/api/runplan';
import { getEveryDayRunPlanData } from '@/api/simulation'; import { getEveryDayRunPlanData } from '@/api/simulation';
import {getRpDetailByUserMapId} from '@/api/designPlatform'; import {getRpDetailByUserMapId} from '@/api/designPlatform';
export default { export default {
name: 'MenuSchema', name: 'MenuSchema',
props: { props: {
group: { group: {
type: String, type: String,
required: true required: true
}, },
offset: { offset: {
type: Number, type: Number,
required: true required: true
} }
}, },
data() { data() {
return { return {
mode: OperateMode.NORMAL, mode: OperateMode.NORMAL,
OperateMode: OperateMode, OperateMode: OperateMode,
viewDisabled: true, viewDisabled: true,
runing: false, runing: false,
swch: '02', swch: '02',
swchList: [ swchList: [
{ value: '01', name: '现地' }, { value: '01', name: '现地' },
{ value: '02', name: '行调' } { value: '02', name: '行调' }
] ]
}; };
}, },
computed: { computed: {
...mapGetters('runPlan', [ ...mapGetters('runPlan', [
'stations' 'stations'
]), ]),
notScript() { notScript() {
return this.$route.params.mode !== 'script'; return this.$route.params.mode !== 'script';
}, },
isPlan() { isPlan() {
return this.$route.params.mode === 'plan'; return this.$route.params.mode === 'plan';
}, },
isScript() { isScript() {
// return this.$route.params.mode === 'script'; // return this.$route.params.mode === 'script';
return false; return false;
}, },
isDemon() { isDemon() {
return this.$route.params.mode === 'demon'; return this.$route.params.mode === 'demon';
}, },
isDesignPlatform(){ isDesignPlatform() {
return this.$route.fullPath.includes('design/display/demon'); return this.$route.fullPath.includes('design/display/demon');
} }
}, },
watch: { watch: {
'$store.state.training.started': function (val) { '$store.state.training.started': function (val) {
this.setRuning(val); this.setRuning(val);
}, },
'$store.state.training.switchcount': async function () { '$store.state.training.switchcount': async function () {
if (this.group) { if (this.group) {
const started = this.$store.state.training.started; const started = this.$store.state.training.started;
if (started) { if (started) {
await this.loadRunData(this.$route.query); await this.loadRunData(this.$route.query);
} }
} }
} }
}, },
async mounted() { async mounted() {
await this.loadRunData(this.$route.query); console.log(this.$route.query, '=====');
}, await this.loadRunData(this.$route.query);
methods: { },
loadRunData(opt) { methods: {
this.$store.dispatch('runPlan/clear').then(() => { loadRunData(opt) {
if (opt && opt.skinCode) { this.$store.dispatch('runPlan/clear').then(() => {
this.viewDisabled = true; if (opt && opt.mapId) {
getStationListBySkinCode(opt.skinCode).then(response => { this.viewDisabled = true;
this.$store.dispatch('runPlan/setStations', response.data).then(() => { getStationList(opt.mapId).then(response => {
if (this.$route.params.mode == 'plan') { this.$store.dispatch('runPlan/setStations', response.data).then(() => {
// debugger; if (this.$route.params.mode == 'plan') {
if(this.$route.query.from=="user"){ // debugger;
// if (this.$route.query.from == 'user') {
getRpDetailByUserMapId(this.$route.query.planId).then(resp => { //
this.$store.dispatch('runPlan/setPlanData', resp.data); getRpDetailByUserMapId(this.$route.query.planId).then(resp => {
this.viewDisabled = false; this.$store.dispatch('runPlan/setPlanData', resp.data);
}).catch(() => { this.viewDisabled = false;
this.$store.dispatch('runPlan/setPlanData', []); }).catch(() => {
this.$messageBox(this.$t('display.schema.getRunDiagramFail')); this.$store.dispatch('runPlan/setPlanData', []);
}); this.$messageBox(this.$t('display.schema.getRunDiagramFail'));
}else{ });
// } else {
queryRunPlan(this.$route.query.planId).then(resp => { //
this.$store.dispatch('runPlan/setPlanData', resp.data); queryRunPlan(this.$route.query.planId).then(resp => {
this.viewDisabled = false; this.$store.dispatch('runPlan/setPlanData', resp.data);
}).catch(() => { this.viewDisabled = false;
this.$store.dispatch('runPlan/setPlanData', []); }).catch(() => {
this.$messageBox(this.$t('display.schema.getRunDiagramFail')); this.$store.dispatch('runPlan/setPlanData', []);
}); this.$messageBox(this.$t('display.schema.getRunDiagramFail'));
} });
}
} else { } else {
getEveryDayRunPlanData(this.group).then(resp => { getEveryDayRunPlanData(this.group).then(resp => {
this.$store.dispatch('runPlan/setPlanData', resp.data); this.$store.dispatch('runPlan/setPlanData', resp.data);
this.viewDisabled = false; this.viewDisabled = false;
}).catch(error => { }).catch(error => {
this.$store.dispatch('runPlan/setPlanData', []); this.$store.dispatch('runPlan/setPlanData', []);
if (error.code == 30001) { if (error.code == 30001) {
this.$messageBox(this.$t('display.schema.todayRunDiagramNoLoad')); this.$messageBox(this.$t('display.schema.todayRunDiagramNoLoad'));
} else { } else {
this.$messageBox(this.$t('display.schema.getRunDiagramFail')); this.$messageBox(this.$t('display.schema.getRunDiagramFail'));
} }
}); });
} }
}); });
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('display.schema.getStationListFail')); this.$messageBox(this.$t('display.schema.getStationListFail'));
}); });
} }
}); });
}, },
changeOperateMode(handle) { changeOperateMode(handle) {
this.$store.dispatch('training/changeOperateMode', { mode: handle }); this.$store.dispatch('training/changeOperateMode', { mode: handle });
}, },
setRuning(run) { setRuning(run) {
this.runing = run; this.runing = run;
}, },
setFault() { setFault() {
this.$emit('faultChooseShow'); this.$emit('faultChooseShow');
}, },
loadRunPlan() { loadRunPlan() {
this.$emit('runPlanLoadShow'); this.$emit('runPlanLoadShow');
}, },
viewRunPlan() { viewRunPlan() {
this.$emit('runPlanViewShow'); this.$emit('runPlanViewShow');
}, },
viewRunQuest() { viewRunQuest() {
this.$emit('runQuestLoadShow'); this.$emit('runQuestLoadShow');
}, },
viewScriptRoles(){ viewScriptRoles() {
this.$emit('runAddRolesLoadShow'); this.$emit('runAddRolesLoadShow');
}, },
switchMode(swch) { switchMode(swch) {
this.$emit('switchMode', swch); this.$emit('switchMode', swch);
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -83,202 +83,203 @@ import { getTrainingDetail } from '@/api/jmap/training';
import { launchFullscreen, exitFullscreen } from '@/utils/screen'; import { launchFullscreen, exitFullscreen } from '@/utils/screen';
export default { export default {
name: 'TipExamList', name: 'TipExamList',
components: { components: {
}, },
data() { data() {
return { return {
training: { training: {
id: '', id: '',
name: '', name: '',
remarks: '' remarks: ''
}, },
isShrink: false, isShrink: false,
examName: '', examName: '',
courseModel: { courseModel: {
id: '', id: '',
name: '', name: '',
maxDuration: '', maxDuration: '',
minDuration: '', minDuration: '',
remarks: '', remarks: '',
updateTime: '' updateTime: ''
}, },
detailShow: false, detailShow: false,
examIndex: 0 examIndex: 0
}; };
}, },
computed: { computed: {
...mapGetters('trainingList', [ ...mapGetters('trainingList', [
'trainingList' 'trainingList'
]), ]),
remainTime() { remainTime() {
return this.$store.state.exam.totalTime - this.$store.state.exam.usedTime; return this.$store.state.exam.totalTime - this.$store.state.exam.usedTime;
}, },
formatRemainTime() { formatRemainTime() {
if (this.remainTime < 0) { if (this.remainTime < 0) {
this.$message.success(this.$t('display.exam.autoSubmit')); this.$message.success(this.$t('display.exam.autoSubmit'));
this.submit(); this.submit();
} }
return timeFormat(this.remainTime); return timeFormat(this.remainTime);
}, },
isFirst() { isFirst() {
return this.examIndex == 0; return this.examIndex == 0;
}, },
isLast() { isLast() {
return this.examIndex == this.trainingList.length - 1; return this.examIndex == this.trainingList.length - 1;
} }
}, },
mounted() { mounted() {
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
backList() { backList() {
this.detailShow = true; this.detailShow = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.treeQuestion.setCurrentKey(this.$route.query.examQuestionId); // value node-key this.$refs.treeQuestion.setCurrentKey(this.$route.query.examQuestionId); // value node-key
}); });
}, },
// //
selectedTraining(obj) { selectedTraining(obj) {
this.trainingList.forEach((item, index) => { this.trainingList.forEach((item, index) => {
if (item.id == obj.id) { if (item.id == obj.id) {
this.examIndex = index; this.examIndex = index;
return; return;
} }
}); });
if (obj) { if (obj) {
getTrainingDetail(obj.trainingId ).then(res => { getTrainingDetail(obj.trainingId ).then(res => {
this.courseModel = { this.courseModel = {
id: res.data.id, id: res.data.id,
name: res.data.name, name: res.data.name,
maxDuration: res.data.maxDuration, maxDuration: res.data.maxDuration,
remarks: res.data.remarks, remarks: res.data.remarks,
minDuration: res.data.minDuration, minDuration: res.data.minDuration,
updateTime: res.data.updateTime updateTime: res.data.updateTime
}; };
}).catch(error => { }).catch(error => {
this.$message.error(this.$t('display.exam.getTestInformation')+':' + error.message); this.$message.error(this.$t('display.exam.getTestInformation') + ':' + error.message);
}); });
} }
this.jump(obj); this.jump(obj);
}, },
getTrainDetail(obj) { getTrainDetail(obj) {
this.selectedTraining(obj); this.selectedTraining(obj);
this.detailShow = false; this.detailShow = false;
}, },
// //
loadInitData() { loadInitData() {
// //
refreshExamList(this.$route.query.userExamId).then(response => { refreshExamList(this.$route.query.userExamId).then(response => {
this.examName = response.data.examName; this.examName = response.data.examName;
this.$store.dispatch('exam/setUsedTime', response.data.usedTime); this.$store.dispatch('exam/setUsedTime', response.data.usedTime);
this.$store.dispatch('exam/setTotalTime', response.data.duration); this.$store.dispatch('exam/setTotalTime', response.data.duration);
this.$store.dispatch('trainingList/setTrainingList', response.data.userExamQuestionsVOs).then(response => { }); this.$store.dispatch('trainingList/setTrainingList', response.data.userExamQuestionsVOs).then(response => { });
const obj = { const obj = {
trainingId: '', trainingId: '',
id: '' id: ''
}; };
if (this.$route.query.examQuestionId && this.$route.query.trainingId) { if (this.$route.query.examQuestionId && this.$route.query.trainingId) {
obj.trainingId = this.$route.query.trainingId; obj.trainingId = this.$route.query.trainingId;
obj.id = this.$route.query.examQuestionId; obj.id = this.$route.query.examQuestionId;
} else { } else {
obj.trainingId = response.data.userExamQuestionsVOs[0].trainingId; obj.trainingId = response.data.userExamQuestionsVOs[0].trainingId;
obj.id = response.data.userExamQuestionsVOs[0].id; obj.id = response.data.userExamQuestionsVOs[0].id;
} }
this.selectedTraining(obj); this.selectedTraining(obj);
}).catch(error => { }).catch(error => {
// 50009y // 50009y
if (error.code === 500009) { if (error.code === 500009) {
this.$router.replace({ path: `/trainingPlatform/result/${this.$route.params.userExamId}`, query: { subSystem: this.$route.query.subSystem } }); this.$router.replace({ path: `/trainingPlatform/result/${this.$route.params.userExamId}`, query: { subSystem: this.$route.query.subSystem } });
} else { } else {
this.$messageBox(this.$t('display.exam.refreshListError')); this.$messageBox(this.$t('display.exam.refreshListError'));
} }
}); });
this.shrink(); this.shrink();
}, },
nextExam() { nextExam() {
const obj = { const obj = {
trainingId: '', trainingId: '',
id: '' id: ''
}; };
if (this.trainingList[this.examIndex + 1] && this.trainingList[this.examIndex + 1].trainingId) { if (this.trainingList[this.examIndex + 1] && this.trainingList[this.examIndex + 1].trainingId) {
obj.trainingId = this.trainingList[this.examIndex + 1].trainingId; obj.trainingId = this.trainingList[this.examIndex + 1].trainingId;
obj.id = this.trainingList[this.examIndex + 1].id; obj.id = this.trainingList[this.examIndex + 1].id;
this.examIndex = this.examIndex + 1; this.examIndex = this.examIndex + 1;
} }
if (obj.trainingId && obj.id) { if (obj.trainingId && obj.id) {
this.selectedTraining(obj); this.selectedTraining(obj);
} }
}, },
lastExam() { lastExam() {
const obj = { const obj = {
trainingId: '', trainingId: '',
id: '' id: ''
}; };
if (this.trainingList[this.examIndex - 1] && this.trainingList[this.examIndex - 1].trainingId) { if (this.trainingList[this.examIndex - 1] && this.trainingList[this.examIndex - 1].trainingId) {
obj.trainingId = this.trainingList[this.examIndex - 1].trainingId; obj.trainingId = this.trainingList[this.examIndex - 1].trainingId;
obj.id = this.trainingList[this.examIndex - 1].id; obj.id = this.trainingList[this.examIndex - 1].id;
this.examIndex = this.examIndex - 1; this.examIndex = this.examIndex - 1;
} }
if (obj.trainingId && obj.id) { if (obj.trainingId && obj.id) {
this.selectedTraining(obj); this.selectedTraining(obj);
} }
}, },
jump(obj) { jump(obj) {
const query = { const query = {
group: this.$route.query.group, group: this.$route.query.group,
userExamId: this.$route.query.userExamId, userExamId: this.$route.query.userExamId,
trainingId: obj.trainingId, trainingId: obj.trainingId,
examQuestionId: obj.id, examQuestionId: obj.id,
subSystem: this.$route.query.subSystem, subSystem: this.$route.query.subSystem,
examId: this.$route.query.examId examId: this.$route.query.examId,
}; mapId: this.$route.query.mapId
this.$router.push({ path: '/display/exam', query: query }); };
this.$emit('refresh'); this.$router.push({ path: '/display/exam', query: query });
launchFullscreen(); this.$emit('refresh');
}, launchFullscreen();
overExam() { },
this.$store.dispatch('exam/isOver').then(isOver => { overExam() {
if (isOver) { this.$store.dispatch('exam/isOver').then(isOver => {
this.submit(); if (isOver) {
} else { this.submit();
this.$confirm(this.$t('display.exam.cancleExam'), this.$t('global.tips'), { } else {
cancelButtonText: this.$t('global.cancel'), this.$confirm(this.$t('display.exam.cancleExam'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'), cancelButtonText: this.$t('global.cancel'),
type: 'warning', confirmButtonText: this.$t('global.confirm'),
center: true type: 'warning',
}).then(() => { center: true
this.submit(); }).then(() => {
}).catch(() => { this.submit();
}); }).catch(() => {
} });
}); }
}, });
submit() { },
exitFullscreen(); submit() {
this.$store.dispatch('exam/over').then(() => { exitFullscreen();
this.$store.dispatch('trainingList/clearTrainingList'); this.$store.dispatch('exam/over').then(() => {
this.$router.replace({ path: `/trainingPlatform/result/${this.$route.query.userExamId}`, query: {subSystem: this.$route.query.subSystem} }); this.$store.dispatch('trainingList/clearTrainingList');
}); this.$router.replace({ path: `/trainingPlatform/result/${this.$route.query.userExamId}`, query: {subSystem: this.$route.query.subSystem} });
}, });
shrink() { },
const height = this.$refs.dragBody.offsetHeight + 40; shrink() {
const top = this.$refs.drapBox.style.top; const height = this.$refs.dragBody.offsetHeight + 40;
if (this.isShrink) { const top = this.$refs.drapBox.style.top;
this.$refs.drapBox.style.height = '40px'; if (this.isShrink) {
this.$refs.drapBox.style.top = ''; this.$refs.drapBox.style.height = '40px';
this.isShrink = false; this.$refs.drapBox.style.top = '';
} else { this.isShrink = false;
this.$refs.drapBox.style.height = height + 'px'; } else {
this.$refs.drapBox.style.top = top; this.$refs.drapBox.style.height = height + 'px';
this.isShrink = true; this.$refs.drapBox.style.top = top;
} this.isShrink = true;
} }
} }
}
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -60,149 +60,149 @@ import { getSessionStorage, setSessionStorage } from '@/utils/auth';
import localStore from 'storejs'; import localStore from 'storejs';
export default { export default {
name: 'ExamDetailView', name: 'ExamDetailView',
components: { components: {
LimitList LimitList
}, },
data() { data() {
return { return {
loading: false, loading: false,
courseModel: { courseModel: {
id: '', id: '',
name: this.$t('rules.lessonInput'), name: this.$t('rules.lessonInput'),
price: 0, price: 0,
remarks: '', remarks: '',
detail: [], detail: [],
pmsList: [], pmsList: [],
treeList: [] treeList: []
}, },
EffectiveTypeList: [], EffectiveTypeList: [],
activeName: 'first', activeName: 'first',
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'name' label: 'name'
}, },
expandList: [], expandList: [],
valid: false valid: false
}; };
}, },
computed: { computed: {
hasPermssion() { hasPermssion() {
return this.courseModel.pmsList.length > 0; return this.courseModel.pmsList.length > 0;
}, },
isAddRule() { isAddRule() {
let sumRemains = 0; let sumRemains = 0;
if (this.courseModel.pmsList) { if (this.courseModel.pmsList) {
this.courseModel.pmsList.forEach(elem => { this.courseModel.pmsList.forEach(elem => {
sumRemains += elem.remains; sumRemains += elem.remains;
}); });
} }
return sumRemains >= 10; return sumRemains >= 10;
}, },
height() { height() {
return this.$store.state.app.height - 91; return this.$store.state.app.height - 91;
} }
}, },
watch: { watch: {
'$route.params.subSystem': function (val) { '$route.params.subSystem': function (val) {
this.loadInitPage(); this.loadInitPage();
} }
}, },
mounted() { mounted() {
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
this.EffectiveTypeList = list; this.EffectiveTypeList = list;
}); });
this.loadInitPage(); this.loadInitPage();
}, },
methods: { methods: {
loadInitPage() { loadInitPage() {
getCourseLessonDetail({lessonId: this.$route.query.lessonId}).then(resp =>{ getCourseLessonDetail({lessonId: this.$route.query.lessonId}).then(resp =>{
if (resp.data) { if (resp.data) {
this.courseModel = { this.courseModel = {
id: resp.data.id, id: resp.data.id,
name: resp.data.name, name: resp.data.name,
pmsList: resp.data.permissionList || [], pmsList: resp.data.permissionList || [],
prdCode: resp.data.prdCode, prdCode: resp.data.prdCode,
mapId: resp.data.mapId, mapId: resp.data.mapId,
PermissionType: PermissionType.EXAM, PermissionType: PermissionType.EXAM,
treeList: resp.data.examDefinitionList treeList: resp.data.examDefinitionList
}; };
} }
if (this.courseModel.pmsList && this.courseModel.pmsList.length >0) { if (this.courseModel.pmsList && this.courseModel.pmsList.length > 0) {
this.valid = true; this.valid = true;
} }
this.getExpandList(this.courseModel.id); this.getExpandList(this.courseModel.id);
}).catch(()=>{ }).catch(()=>{
this.$messageBox('获取考试信息失败!'); this.$messageBox('获取考试信息失败!');
}); });
}, },
buy() { buy() {
this.loading = true; this.loading = true;
this.$router.push({ this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`, path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`,
query: { permissionType: PermissionType.EXAM, lessonId: this.courseModel.id, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem } query: { permissionType: PermissionType.EXAM, lessonId: this.courseModel.id, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
}); });
}, },
checkCourse() { checkCourse() {
this.loading = true; this.loading = true;
this.$router.push({ this.$router.push({
path: `${UrlConfig.trainingPlatform.examRuleManage}`, path: `${UrlConfig.trainingPlatform.examRuleManage}`,
query: { lessonId: this.courseModel.id } query: { lessonId: this.courseModel.id }
}); });
}, },
transfer() { // transfer() { //
this.loading = false; this.loading = false;
if (this.$refs) { if (this.$refs) {
this.activeName = 'second'; this.activeName = 'second';
this.$refs.limitList.transfer(this.courseModel); this.$refs.limitList.transfer(this.courseModel);
} }
}, },
distribute() { // distribute() { //
this.loading = false; this.loading = false;
if (this.$refs) { if (this.$refs) {
this.activeName = 'second'; this.activeName = 'second';
this.$refs.limitList.distribute(this.courseModel); this.$refs.limitList.distribute(this.courseModel);
} }
}, },
clickEvent(obj, node, data) { clickEvent(obj, node, data) {
if (this.valid || obj.trial) { if (this.valid || obj.trial) {
this.$router.push({ path: `${UrlConfig.trainingPlatform.examDetail}/${obj.id}`, query: { subSystem: this.$route.params.subSystem }}); this.$router.push({ path: `${UrlConfig.trainingPlatform.examDetail}/${obj.id}`, query: { subSystem: this.$route.params.subSystem, mapId: this.courseModel.mapId }});
} else { } else {
this.$confirm(this.$t('tip.accessCourseNo'), this.$t('tip.hint'), { this.$confirm(this.$t('tip.accessCourseNo'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel') cancelButtonText: this.$t('tip.cancel')
}).then(() => { }).then(() => {
this.buy(); this.buy();
}).catch(() => { }); }).catch(() => { });
} }
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.name.indexOf(value) !== -1; return data.name.indexOf(value) !== -1;
}, },
nodeExpand(obj, node, ele) { nodeExpand(obj, node, ele) {
const key = obj.id; const key = obj.id;
this.expandList = this.expandList.filter(item => item!==key); this.expandList = this.expandList.filter(item => item !== key);
this.expandList.push(key); this.expandList.push(key);
setSessionStorage('trainingExamExpandList'+this.courseModel.id, this.expandList); setSessionStorage('trainingExamExpandList' + this.courseModel.id, this.expandList);
}, },
nodeCollapse(obj, node, ele) { nodeCollapse(obj, node, ele) {
const key = obj.id; const key = obj.id;
this.expandList = this.expandList.filter(item => item!==key); this.expandList = this.expandList.filter(item => item !== key);
setSessionStorage('trainingExamExpandList'+this.courseModel.id, this.expandList); setSessionStorage('trainingExamExpandList' + this.courseModel.id, this.expandList);
}, },
getExpandList(id) { getExpandList(id) {
let expand = getSessionStorage('trainingExamExpandList'+id); let expand = getSessionStorage('trainingExamExpandList' + id);
expand = expand?(expand+'').split(','):''; expand = expand ? (expand + '').split(',') : '';
if (expand instanceof Array) { if (expand instanceof Array) {
this.expandList = expand; this.expandList = expand;
} }
}, },
backLessonList() { backLessonList() {
localStore.remove('examDetail'+this.$route.params.subSystem); localStore.remove('examDetail' + this.$route.params.subSystem);
this.$router.push({ path: `${UrlConfig.trainingPlatform.examHome}/${this.$route.params.subSystem}`}); this.$router.push({ path: `${UrlConfig.trainingPlatform.examHome}/${this.$route.params.subSystem}`});
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -60,164 +60,165 @@ import { launchFullscreen } from '@/utils/screen';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
export default { export default {
name: 'ExamDetailView', name: 'ExamDetailView',
data() { data() {
return { return {
loading: false, loading: false,
examDetails: { examDetails: {
lessonId: '', lessonId: '',
name: '', name: '',
remarks: '', remarks: '',
examDefinitionRulesVOList: [], examDefinitionRulesVOList: [],
startTime: '', startTime: '',
endTime: '', endTime: '',
fullPoint: '', fullPoint: '',
passingPoint: '', passingPoint: '',
duration: '', duration: '',
type: '' type: ''
}, },
typeList: [], typeList: [],
examList: [], examList: [],
trainingOperateTypeMap: {} trainingOperateTypeMap: {}
}; };
}, },
computed: { computed: {
...mapGetters('trainingList', [ ...mapGetters('trainingList', [
'trainingList' 'trainingList'
]), ]),
height() { height() {
return this.$store.state.app.height - 50; return this.$store.state.app.height - 50;
} }
}, },
watch: { watch: {
'$route.params.examId': function (val) { '$route.params.examId': function (val) {
this.loadInitPage(val); this.loadInitPage(val);
} }
}, },
async mounted() { async mounted() {
this.trainingOperateTypeMap = {}; this.trainingOperateTypeMap = {};
this.$Dictionary.stationControl().then(list => { this.$Dictionary.stationControl().then(list => {
this.trainingOperateTypeMap['01'] = list; // this.trainingOperateTypeMap['01'] = list; //
}); });
this.$Dictionary.signalOperation().then(list => { this.$Dictionary.signalOperation().then(list => {
this.trainingOperateTypeMap['02'] = list; // this.trainingOperateTypeMap['02'] = list; //
}); });
this.$Dictionary.switchOperation().then(list => { this.$Dictionary.switchOperation().then(list => {
this.trainingOperateTypeMap['03'] = list; // this.trainingOperateTypeMap['03'] = list; //
}); });
this.$Dictionary.sectionOperation().then(list => { this.$Dictionary.sectionOperation().then(list => {
this.trainingOperateTypeMap['04'] = list; // this.trainingOperateTypeMap['04'] = list; //
}); });
this.$Dictionary.stationStandOperation().then(list => { this.$Dictionary.stationStandOperation().then(list => {
this.trainingOperateTypeMap['05'] = list; // this.trainingOperateTypeMap['05'] = list; //
}); });
this.$Dictionary.trainPlanOperation().then(list => { this.$Dictionary.trainPlanOperation().then(list => {
this.trainingOperateTypeMap['06'] = list; // this.trainingOperateTypeMap['06'] = list; //
}); });
this.$Dictionary.trainOperation().then(list => { this.$Dictionary.trainOperation().then(list => {
this.trainingOperateTypeMap['07'] = list; // this.trainingOperateTypeMap['07'] = list; //
}); });
await this.getList(); await this.getList();
this.loadInitPage(this.$route.params.examId); this.loadInitPage(this.$route.params.examId);
}, },
methods: { methods: {
async getList() { async getList() {
this.typeList = []; this.typeList = [];
await getDetailList('training_type').then(res => { await getDetailList('training_type').then(res => {
this.typeList = res.data; this.typeList = res.data;
}); });
}, },
async loadInitPage(examId) { async loadInitPage(examId) {
if (examId) { if (examId) {
const res = await getExamLessonDetail(examId); const res = await getExamLessonDetail(examId);
this.examDetails = res.data; this.examDetails = res.data;
this.examDetails.examDefinitionRulesVOList.forEach((res, index) => { this.examDetails.examDefinitionRulesVOList.forEach((res, index) => {
res.chapterIdLong = Number(res.num) * Number(res.point); res.chapterIdLong = Number(res.num) * Number(res.point);
this.typeList.forEach(v => { this.typeList.forEach(v => {
if (res.trainingType == v.code) { if (res.trainingType == v.code) {
this.examDetails.examDefinitionRulesVOList[index].name = v.name; this.examDetails.examDefinitionRulesVOList[index].name = v.name;
if (res.operateType) { if (res.operateType) {
this.trainingOperateTypeMap[res.trainingType].forEach(item => { this.trainingOperateTypeMap[res.trainingType].forEach(item => {
if (item.code == res.operateType) { if (item.code == res.operateType) {
this.examDetails.examDefinitionRulesVOList[index].name = `${this.examDetails.examDefinitionRulesVOList[index].name}-${item.name}`; this.examDetails.examDefinitionRulesVOList[index].name = `${this.examDetails.examDefinitionRulesVOList[index].name}-${item.name}`;
return; return;
} }
}); });
} }
} }
}); });
}); });
} }
}, },
buy() { buy() {
this.loading = true; this.loading = true;
getPublishLessonDetail({ id: this.examDetails.lessonId }).then((res) => { getPublishLessonDetail({ id: this.examDetails.lessonId }).then((res) => {
this.$router.push({ this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.examDetails.lessonId}`, path: `${UrlConfig.trainingPlatform.pay}/${this.examDetails.lessonId}`,
query: { permissionType: PermissionType.EXAM, lessonId: this.examDetails.lessonId, prdCode: res.data.prdCode, mapId: res.data.mapId } query: { permissionType: PermissionType.EXAM, lessonId: this.examDetails.lessonId, prdCode: res.data.prdCode, mapId: res.data.mapId }
}); });
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('error.obtainCourseDetailsFailed')); this.$messageBox(this.$t('error.obtainCourseDetailsFailed'));
this.loading = false; this.loading = false;
}); });
}, },
async examDetail() { async examDetail() {
const data = this.examDetails; const data = this.examDetails;
try { try {
const response = await generateExamList(data.id); const response = await generateExamList(data.id);
this.examList = response.data.userExamQuestionsVOs; this.examList = response.data.userExamQuestionsVOs;
this.userExam = response.data; this.userExam = response.data;
const list = response.data.userExamQuestionsVOs; const list = response.data.userExamQuestionsVOs;
await this.$store.dispatch('exam/setUsedTime', this.userExam.usedTime); await this.$store.dispatch('exam/setUsedTime', this.userExam.usedTime);
await this.$store.dispatch('exam/setTotalTime', this.userExam.duration); await this.$store.dispatch('exam/setTotalTime', this.userExam.duration);
await this.$store.dispatch('trainingList/setTrainingList', list); await this.$store.dispatch('trainingList/setTrainingList', list);
} catch (error) { } catch (error) {
// //
if (error.code === 500004) { if (error.code === 500004) {
this.$confirm( this.$t('tip.noCourseAuthority'), this.$t('tip.hint'), { this.$confirm( this.$t('tip.noCourseAuthority'), this.$t('tip.hint'), {
cancelButtonText: this.$t('global.cancel'), cancelButtonText: this.$t('global.cancel'),
confirmButtonText: this.$t('global.confirm'), confirmButtonText: this.$t('global.confirm'),
type: 'warning', type: 'warning',
center: true center: true
}).then(() => { }).then(() => {
this.buy(); this.buy();
}).catch(() => { }); }).catch(() => { });
} else if (error.code === 500005) { } else if (error.code === 500005) {
this.$messageBox(this.$t('tip.notWithinTheScopeOfTheExamination')); this.$messageBox(this.$t('tip.notWithinTheScopeOfTheExamination'));
} else { } else {
this.$messageBox(`${error.message}`); this.$messageBox(`${error.message}`);
} }
} }
}, },
async exmaStart() { async exmaStart() {
this.loading = true; this.loading = true;
await this.examDetail(); await this.examDetail();
if (this.examList.length) { if (this.examList.length) {
examNotify({ examId: this.$route.params.examId }).then(resp => { examNotify({ examId: this.$route.params.examId }).then(resp => {
const query = { const query = {
group: resp.data, group: resp.data,
trainingId: this.examList[0].trainingId, trainingId: this.examList[0].trainingId,
userExamId: this.userExam.id, userExamId: this.userExam.id,
examQuestionId: this.examList[0].id, examQuestionId: this.examList[0].id,
subSystem: this.$route.query.subSystem, subSystem: this.$route.query.subSystem,
examId: this.$route.params.examId examId: this.$route.params.examId,
}; mapId: this.$route.query.mapId
this.$router.push({ path: `${UrlConfig.display}/exam`, query: query }); };
launchFullscreen(); this.$router.push({ path: `${UrlConfig.display}/exam`, query: query });
}).catch(error => { launchFullscreen();
this.loading = false; }).catch(error => {
this.$messageBox( this.$t('error.createSimulationFailed') +`: ${error.message}`); this.loading = false;
}); this.$messageBox( this.$t('error.createSimulationFailed') + `: ${error.message}`);
} else { });
this.loading = false; } else {
} this.loading = false;
}, }
back() { },
this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.query.subSystem}`, query: {lessonId: this.examDetails.lessonId}}); back() {
} this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.query.subSystem}`, query: {lessonId: this.examDetails.lessonId}});
} }
}
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -35,83 +35,83 @@ import { launchFullscreen } from '@/utils/screen';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
export default { export default {
name: 'ExamDetailList', name: 'ExamDetailList',
filters: { filters: {
setTime(val) { setTime(val) {
return val; return val;
} }
}, },
data() { data() {
return { return {
loading: false, loading: false,
courseModel: { courseModel: {
id: '', id: '',
name: '', name: '',
skinCode: '', skinCode: '',
maxDuration: '', maxDuration: '',
minDuration: '', minDuration: '',
remarks: '', remarks: '',
updateTime: '' updateTime: ''
} }
}; };
}, },
computed: { computed: {
formatExamUsedTime() { formatExamUsedTime() {
return timeFormat(this.$store.state.exam.usedTime); return timeFormat(this.$store.state.exam.usedTime);
}, },
height() { height() {
return this.$store.state.app.height; return this.$store.state.app.height;
} }
}, },
watch: { watch: {
$route(newVal) { $route(newVal) {
this.initLoadPage(); this.initLoadPage();
} }
}, },
mounted() { mounted() {
this.initLoadPage(); this.initLoadPage();
}, },
methods: { methods: {
initLoadPage() { initLoadPage() {
const trainingId = this.$route.query.trainingId; const trainingId = this.$route.query.trainingId;
if (parseInt(trainingId)) { if (parseInt(trainingId)) {
getTrainingDetail(trainingId).then(res => { getTrainingDetail(trainingId).then(res => {
this.courseModel = { this.courseModel = {
id: res.data.id, id: res.data.id,
name: res.data.name, name: res.data.name,
skinCode: res.data.skinCode, skinCode: res.data.skinCode,
maxDuration: res.data.maxDuration, maxDuration: res.data.maxDuration,
remarks: res.data.remarks, remarks: res.data.remarks,
minDuration: res.data.minDuration, minDuration: res.data.minDuration,
updateTime: res.data.updateTime updateTime: res.data.updateTime
}; };
}).catch(error => { }).catch(error => {
this.$message.error( this.$t('error.getTestInformationFailed') + ':' + error.message); this.$message.error( this.$t('error.getTestInformationFailed') + ':' + error.message);
}); });
} }
}, },
start() { start() {
this.loading = true; this.loading = true;
const query = { skinCode: this.$route.query.skinCode, trainingId: this.$route.query.trainingId, userExamId: this.$route.query.userExamId, examQuestionId: this.$route.params.examQuestionId }; const query = { skinCode: this.$route.query.skinCode, trainingId: this.$route.query.trainingId, userExamId: this.$route.query.userExamId, examQuestionId: this.$route.params.examQuestionId };
this.$router.push({ path: '/display/exam', query: query }); this.$router.push({ path: '/display/exam', query: query });
launchFullscreen(); launchFullscreen();
}, },
back() { back() {
this.loading = true; this.loading = true;
this.$confirm( this.$t('tip.giveUpTheExamTip'), this.$t('tip.hint'), { this.$confirm( this.$t('tip.giveUpTheExamTip'), this.$t('tip.hint'), {
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(() => {
// //
setExamGive(this.$route.query.userExamId).then(() => { setExamGive(this.$route.query.userExamId).then(() => {
this.$router.back(); this.$router.back();
}); });
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
}); });
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,103 +0,0 @@
<template>
<div :id="id" style="background: #000;" />
</template>
<script>
import Jlmap from '@/jmap/map';
import deviceType from '@/jmap/constant/deviceType';
import { getPublishMapDetail } from '@/api/test.js';
export default {
name: 'Jlmap',
data() {
return {
id: '__jmap__',
jmap: null
};
},
watch: {
'$store.state.app.windowSizeCount': function() {
this.$nextTick(() => {
this.jmap.resize({width: this.$store.state.app.width, height: this.$store.state.app.height});
});
}
},
mounted() {
document.getElementById(this.id).oncontextmenu = function (e) {
return false;
};
this.jmap = new Jlmap({
dom: document.getElementById(this.id),
config: {
renderer: 'canvas',
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight
},
options: {
scaleRate: 1,
offsetX: 0,
offsetY: 0
},
methods: {
dataLoaded() { console.log('dataLoaded'); },
viewLoaded() { console.log('viewLoaded'); },
stateLoaded() { console.log('stateLoaded'); },
viewUpdate() { console.log('viewUpdate'); },
stateUpdate() { console.log('stateUpdate'); }
// optionsUpdate() { console.log('optionsUpdate'); }
}
});
this.jmap.on('selected', this.selected);
this.jmap.on('contextmenu', this.contextmenu);
// const list = [];
// for (let i = 1; i < 20; i++) {
// for (let j = 1; j < 500; j++) {
// list.push({ code: `${(Array(3).join(0) + i).slice(-3)}${(Array(3).join(0) + j).slice(-3)}`, lp: { x: 50 + i * 120, y: 50 + j * 20 }, rp: { x: 150 + i * 120, y: 50 + j * 20 } });
// }
// }
// this.jmap.load({ skinVO: { code: '02' }, linkList: list });
getPublishMapDetail('02').then(resp => {
this.jmap.setLevelVisible([deviceType.Link], false);
this.jmap.setMap(resp.data);
// this.jmap.setDefaultState();
});
// this.jmap.render([
// {code: '11', type: 'Link', lp: { x: 20 , y: 100}, rp: { x: 120, y: 100 }}
// ]);
// this.jmap.update([
// { code: '11', type: 'Link', status: '02' }
// ]);
// this.jmap.render([
// { code: '11', type: 'Link', lp: { x: 0, y: 0 }, rp: { x: 200, y: 200 } }
// ]);
// this.jmap.update([]);
},
beforeDestroy() {
this.jmap.off('selected', this.selected);
this.jmap.off('contextmenu', this.contextmenu);
this.jmap.dispose();
this.jmap = null;
},
methods: {
selected(e) {
// console.log('selected', e, this.jmap);
},
contextmenu(e) {
// console.log('contextmenu', e);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss">
</style>

View File

@ -37,7 +37,7 @@ import IbpPlate from '@/views/ibp/index';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login'; import { checkLoginLine } from '@/api/login';
import { loadMapData } from '@/utils/loaddata'; import { loadMapDataById } from '@/utils/loaddata';
import { getUserRoles, deljointTrainRoom } from '@/api/chat'; import { getUserRoles, deljointTrainRoom } from '@/api/chat';
import { runDiagramOver, getSimulationInfo } from '@/api/simulation'; import { runDiagramOver, getSimulationInfo } from '@/api/simulation';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive'; import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
@ -46,345 +46,345 @@ import ibpData from '@/ibp/constant/ibpData';
import { Message } from 'element-ui'; import { Message } from 'element-ui';
export default { export default {
name: 'JointTrainingDraft', name: 'JointTrainingDraft',
components: { components: {
MapSystemDraft, MapSystemDraft,
MenuDemonJoint, MenuDemonJoint,
MenuDemonSchema, MenuDemonSchema,
JoinFaultChoose, JoinFaultChoose,
JoinRunPlanLoad, JoinRunPlanLoad,
JoinRunPlanView, JoinRunPlanView,
menuSystemTime, menuSystemTime,
Jl3dDrive, Jl3dDrive,
IbpPlate IbpPlate
}, },
data() { data() {
return { return {
trainingObj: {}, trainingObj: {},
checkLine: null, checkLine: null,
timeDemonNum: 0, timeDemonNum: 0,
offset: 10, offset: 10,
mouseNum: 1, mouseNum: 1,
ierval: null, ierval: null,
mouseNumTime: 0, mouseNumTime: 0,
mapBox: null, mapBox: null,
mapBoxP: null, mapBoxP: null,
userRole: '', userRole: '',
deviceCode: '', deviceCode: '',
group: '', group: '',
mapId: '', mapId: '',
skinCode: '', skinCode: '',
simulationShow: false, simulationShow: false,
drivingShow: false, drivingShow: false,
ibpShow: false, ibpShow: false,
panelShow: true, panelShow: true,
ibpPart: '' ibpPart: ''
}; };
}, },
computed: { computed: {
...mapGetters([ ...mapGetters([
'canvasWidth', 'canvasWidth',
'canvasHeight' 'canvasHeight'
]), ]),
...mapGetters('map', [ ...mapGetters('map', [
'map' 'map'
]), ]),
...mapGetters('training', [ ...mapGetters('training', [
'offsetStationCode' 'offsetStationCode'
]), ]),
...mapGetters('config', [ ...mapGetters('config', [
'canvasId' 'canvasId'
]), ]),
width() { width() {
return this.$store.state.app.width; return this.$store.state.app.width;
}, },
height() { height() {
return this.$store.state.app.height; return this.$store.state.app.height;
}, },
right() { right() {
return this.$store.state.config.width / 2 - 55; return this.$store.state.config.width / 2 - 55;
} }
}, },
watch: { watch: {
'$store.state.config.menuBarLoadedCount': function (val) { '$store.state.config.menuBarLoadedCount': function (val) {
this.setPosition(); this.setPosition();
}, },
'$store.state.map.mapViewLoadedCount': function (val) { '$store.state.map.mapViewLoadedCount': function (val) {
this.mapBoxP = document.getElementById(this.canvasId).children[0]; this.mapBoxP = document.getElementById(this.canvasId).children[0];
this.mapBox = document.getElementsByTagName('canvas'); this.mapBox = document.getElementsByTagName('canvas');
}, },
'$store.state.socket.permissionOver': function () { '$store.state.socket.permissionOver': function () {
this.$alert(this.$t('tip.userRightsHaveBeenReclaimed'), this.$t('tip.hint'), { this.$alert(this.$t('tip.userRightsHaveBeenReclaimed'), this.$t('tip.hint'), {
confirmButtonText: this.$t('global.confirm'), confirmButtonText: this.$t('global.confirm'),
showClose: false, showClose: false,
callback: async (action) => { callback: async (action) => {
await this.$store.dispatch('training/over'); await this.$store.dispatch('training/over');
await runDiagramOver(this.group); await runDiagramOver(this.group);
await deljointTrainRoom(this.group); await deljointTrainRoom(this.group);
await this.$router.push({ path: `/trainingPlatform/detail/${this.subSystem}`, query: {mapId: this.mapId} }); await this.$router.push({ path: `/trainingPlatform/detail/${this.subSystem}`, query: {mapId: this.mapId} });
} }
}); });
}, },
'$store.state.socket.jointRoomInfo': function (val) { // '$store.state.socket.jointRoomInfo': function (val) { //
if (val.creatorId) { if (val.creatorId) {
this.handleRoomInfo(val); this.handleRoomInfo(val);
} }
}, },
'$store.state.socket.chatContentList': function (val) { // '$store.state.socket.chatContentList': function (val) { //
if (val.type === 'userRoomKickOut'&&val.oneself) { if (val.type === 'userRoomKickOut' && val.oneself) {
this.$router.push({ path: `/` }); this.$router.push({ path: `/` });
this.messageInfo(this.$t('tip.beKickedOut'), 'warning'); this.messageInfo(this.$t('tip.beKickedOut'), 'warning');
} }
}, },
'$store.state.app.windowSizeCount': function() { '$store.state.app.windowSizeCount': function() {
this.setWindowSize(); this.setWindowSize();
}, },
$route() { $route() {
this.$nextTick(() => { this.$nextTick(() => {
this.initLoadData(); this.initLoadData();
}); });
} }
}, },
async created() { async created() {
this.group = this.$route.query.group; this.group = this.$route.query.group;
this.mapId = this.$route.query.mapId; this.mapId = this.$route.query.mapId;
this.skinCode = this.$route.query.skinCode; this.skinCode = this.$route.query.skinCode;
this.subSystem = this.$route.query.subSystem; this.subSystem = this.$route.query.subSystem;
Message.closeAll(); Message.closeAll();
}, },
async mounted() { async mounted() {
await this.setWindowSize(); await this.setWindowSize();
await this.initLoadData(); await this.initLoadData();
}, },
async beforeDestroy() { async beforeDestroy() {
await this.clearAllTimer(); await this.clearAllTimer();
await this.$store.dispatch('training/end', null); await this.$store.dispatch('training/end', null);
await this.$store.dispatch('training/reset'); await this.$store.dispatch('training/reset');
await this.$store.dispatch('map/mapClear'); await this.$store.dispatch('map/mapClear');
await this.$store.dispatch('training/setGroup', ''); await this.$store.dispatch('training/setGroup', '');
Message.closeAll(); Message.closeAll();
}, },
methods: { methods: {
mousemove(e) { mousemove(e) {
this.mouseNum = 1; this.mouseNum = 1;
}, },
handleRoomInfo(data) { handleRoomInfo(data) {
if (data.state == '03') { // 退 if (data.state == '03') { // 退
this.$router.push({ path: `/` }); this.$router.push({ path: `/` });
// this.clearSubscribe(); // this.clearSubscribe();
} else if (data.state == '01') { // } else if (data.state == '01') { //
const query = { group: this.group }; const query = { group: this.group };
this.$router.push({ path: `/trainroom`, query: query }); this.$router.push({ path: `/trainroom`, query: query });
// this.clearSubscribe(); // this.clearSubscribe();
} }
this.$store.dispatch('socket/setJointRoomInfo'); // this.$store.dispatch('socket/setJointRoomInfo'); //
}, },
// 线 // 线
clearAllTimer() { clearAllTimer() {
if (this.ierval) { if (this.ierval) {
clearTimeout(this.ierval); clearTimeout(this.ierval);
this.ierval = null; this.ierval = null;
} }
if (this.checkLine) { if (this.checkLine) {
clearTimeout(this.checkLine); clearTimeout(this.checkLine);
this.checkLine = null; this.checkLine = null;
} }
}, },
// 线 // 线
checkLoginLineTimer() { checkLoginLineTimer() {
if (this.checkLine) { if (this.checkLine) {
clearTimeout(this.checkLine); clearTimeout(this.checkLine);
} }
this.checkLine = setInterval(() => { this.checkLine = setInterval(() => {
checkLoginLine(); checkLoginLine();
}, 5000 * 60); }, 5000 * 60);
}, },
// //
checkMouseStatusTimer() { checkMouseStatusTimer() {
if (this.ierval) { if (this.ierval) {
clearTimeout(this.ierval); clearTimeout(this.ierval);
} }
this.ierval = setInterval(() => { this.ierval = setInterval(() => {
if (this.mouseNum) { if (this.mouseNum) {
this.mouseNum = 0; this.mouseNum = 0;
this.mouseNumTime = 0; this.mouseNumTime = 0;
} else { } else {
this.mouseNumTime += 1; this.mouseNumTime += 1;
} }
if (this.mapBox) { if (this.mapBox) {
if (this.mouseNumTime >= 15) { if (this.mouseNumTime >= 15) {
for (let i = 0; i < this.mapBox.length; i++) { for (let i = 0; i < this.mapBox.length; i++) {
this.mapBox[i].style.cursor = 'none'; this.mapBox[i].style.cursor = 'none';
} }
} else { } else {
for (let i = 0; i < this.mapBox.length; i++) { for (let i = 0; i < this.mapBox.length; i++) {
this.mapBox[i].style.cursor = ''; this.mapBox[i].style.cursor = '';
} }
} }
} }
}, 1000); }, 1000);
}, },
// //
setPosition() { setPosition() {
this.$nextTick(() => { this.$nextTick(() => {
let offset = 10; let offset = 10;
const menuBar = document.getElementById('menuBar'); const menuBar = document.getElementById('menuBar');
const menuTool = document.getElementById('menuTool'); const menuTool = document.getElementById('menuTool');
if (menuBar) { if (menuBar) {
offset += (menuBar.offsetHeight || 0); offset += (menuBar.offsetHeight || 0);
} }
if (menuTool) { if (menuTool) {
offset += (menuTool.offsetHeight || 0); offset += (menuTool.offsetHeight || 0);
} }
if (this.offset != offset) { if (this.offset != offset) {
this.offset = offset; this.offset = offset;
} }
}); });
}, },
// //
endViewLoading(isSuccess) { endViewLoading(isSuccess) {
if (!isSuccess) { if (!isSuccess) {
this.$store.dispatch('map/mapClear'); this.$store.dispatch('map/mapClear');
} }
this.$nextTick(() => { this.$nextTick(() => {
EventBus.$emit('viewLoading', false); EventBus.$emit('viewLoading', false);
}); });
}, },
// //
initLoadData() { initLoadData() {
const width = document.documentElement.clientWidth; const width = document.documentElement.clientWidth;
const height = document.documentElement.clientHeight + 200; const height = document.documentElement.clientHeight + 200;
this.$store.dispatch('config/resize', { width, height }); this.$store.dispatch('config/resize', { width, height });
try { try {
this.loadSimulationInfo(); this.loadSimulationInfo();
this.initLoadDemonData(); this.initLoadDemonData();
this.checkLoginLineTimer(); this.checkLoginLineTimer();
this.checkMouseStatusTimer(); this.checkMouseStatusTimer();
} catch (error) { } catch (error) {
this.$messageBox( this.$t('error.initializationFailed') + error.message); this.$messageBox( this.$t('error.initializationFailed') + error.message);
this.endViewLoading(); this.endViewLoading();
} }
}, },
async loadSimulationInfo() { async loadSimulationInfo() {
const resp = await getSimulationInfo(this.group); const resp = await getSimulationInfo(this.group);
if (resp && resp.code == 200) { if (resp && resp.code == 200) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
this.questId = Number(resp.data.questId) || 0; this.questId = Number(resp.data.questId) || 0;
} }
}, },
async getUserRole() { async getUserRole() {
const res = await getUserRoles(this.group); const res = await getUserRoles(this.group);
this.userRole = res.data.userRole; this.userRole = res.data.userRole;
this.deviceCode = res.data.deviceCode; this.deviceCode = res.data.deviceCode;
this.ibpPart = res.data.ibpPart; this.ibpPart = res.data.ibpPart;
if (this.userRole === 'IBP') { if (this.userRole === 'IBP') {
this.showIbp(this.deviceCode); this.showIbp(this.deviceCode);
} else { } else {
this.hideIbp(); this.hideIbp();
} }
return res; return res;
}, },
// 仿 // 仿
async initLoadDemonData() { async initLoadDemonData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL); this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
if (this.skinCode) { if (this.skinCode) {
// 01 02 '' // 01 02 ''
const resp = await this.getUserRole(); const resp = await this.getUserRole();
if (resp && resp.code == 200) { if (resp && resp.code == 200) {
// Admin Instructor Dispatcher Attendant Audience Driver Repair IBP:IBP // Admin Instructor Dispatcher Attendant Audience Driver Repair IBP:IBP
this.userRole = resp.data.userRole; this.userRole = resp.data.userRole;
switch (this.userRole) { switch (this.userRole) {
case 'Admin': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Admin'); this.hideIbp(); break; case 'Admin': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Admin'); this.hideIbp(); break;
case 'Instructor': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Instructor'); this.hideIbp(); break; case 'Instructor': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Instructor'); this.hideIbp(); break;
case 'Dispatcher': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Dispatcher'); this.hideIbp(); break; case 'Dispatcher': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Dispatcher'); this.hideIbp(); break;
case 'Attendant': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'Attendant'); this.hideIbp(); break; case 'Attendant': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'Attendant'); this.hideIbp(); break;
case 'Audience': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Audience'); this.hideIbp(); break; case 'Audience': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Audience'); this.hideIbp(); break;
case 'Driver': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Driver'); this.hideIbp(); break; case 'Driver': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Driver'); this.hideIbp(); break;
case 'Repair': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Repair'); this.hideIbp(); break; case 'Repair': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Repair'); this.hideIbp(); break;
case 'IBP': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP'); this.showIbp(resp.data.deviceCode); break; case 'IBP': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP'); this.showIbp(resp.data.deviceCode); break;
case 'BigScreen': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BigScreen'); this.hideIbp(); break; case 'BigScreen': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BigScreen'); this.hideIbp(); break;
} }
} }
await this.getTrainDetail(this.skinCode); await this.getTrainDetail();
} else { } else {
this.endViewLoading(); this.endViewLoading();
} }
}, },
async getTrainDetail(skinCode) { async getTrainDetail() {
try { try {
await loadMapData(skinCode); await loadMapDataById(this.mapId);
await this.$store.dispatch('training/setMapDefaultState'); await this.$store.dispatch('training/setMapDefaultState');
} catch (error) { } catch (error) {
this.$messageBox(this.$t('error.getMapDataFailed')); this.$messageBox(this.$t('error.getMapDataFailed'));
this.endViewLoading(); this.endViewLoading();
} }
}, },
back() { back() {
this.$refs.demonMenu.back(); this.$refs.demonMenu.back();
}, },
runPlanViewShow() { runPlanViewShow() {
this.$refs.runPlanView.doShow(); this.$refs.runPlanView.doShow();
}, },
runPlanLoadShow() { runPlanLoadShow() {
this.$refs.runPlanLoad.doShow(); this.$refs.runPlanLoad.doShow();
}, },
faultChooseShow() { faultChooseShow() {
this.$refs.faultChoose.doShow(); this.$refs.faultChoose.doShow();
}, },
showdriving() { showdriving() {
this.panelShow = true; this.panelShow = true;
this.drivingShow = false; this.drivingShow = false;
this.ibpShow =false; this.ibpShow = false;
}, },
showIbp(deviceCode) { showIbp(deviceCode) {
this.drivingShow = false; this.drivingShow = false;
this.panelShow = false; this.panelShow = false;
this.ibpShow = true; this.ibpShow = true;
if (!deviceCode || !ibpData[deviceCode]) { if (!deviceCode || !ibpData[deviceCode]) {
Message.warning({message: this.$t('error.ibpNoDraw'), duration: 0, showClose: true, type: 'error'}); Message.warning({message: this.$t('error.ibpNoDraw'), duration: 0, showClose: true, type: 'error'});
return; return;
} else { } else {
Message.closeAll(); Message.closeAll();
} }
this.$refs.ibpPlate.show(deviceCode, this.ibpPart); this.$refs.ibpPlate.show(deviceCode, this.ibpPart);
}, },
hidepanel() { hidepanel() {
this.panelShow = false; this.panelShow = false;
this.drivingShow = true; this.drivingShow = true;
this.ibpShow = false; this.ibpShow = false;
this.$refs.Jl3dDrive.show(this.skinCode); this.$refs.Jl3dDrive.show(this.skinCode);
}, },
hideIbp() { hideIbp() {
Message.closeAll(); Message.closeAll();
this.drivingShow = false; this.drivingShow = false;
this.panelShow = true; this.panelShow = true;
this.ibpShow = false; this.ibpShow = false;
this.$refs.ibpPlate.ibpDestroy(); this.$refs.ibpPlate.ibpDestroy();
}, },
messageInfo(message, type) { messageInfo(message, type) {
this.$message({ this.$message({
showClose: true, showClose: true,
message: message, message: message,
type: type type: type
}); });
}, },
setWindowSize() { setWindowSize() {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.dispatch('config/resize', { width: this.width, height: this.height }); this.$store.dispatch('config/resize', { width: this.width, height: this.height });
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode }); this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
}); });
} }
} }
}; };
</script> </script>
<style> <style>

View File

@ -12,14 +12,14 @@
<el-button-group> <el-button-group>
<template> <template>
<el-button v-if="runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{$t('joinTraining.runGraphPreview')}}</el-button> <el-button v-if="runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
</template> </template>
<template v-if="userRole == 'Admin'"> <template v-if="userRole == 'Admin'">
<el-button v-if="!runing" size="small" type="warning" :disabled="viewDisabled" @click="loadRunPlan"> <el-button v-if="!runing" size="small" type="warning" :disabled="viewDisabled" @click="loadRunPlan">
{{$t('joinTraining.runGraphLoading')}}</el-button> {{ $t('joinTraining.runGraphLoading') }}</el-button>
</template> </template>
<template v-if="userRole == 'Instructor' || userRole == 'Admin'"> <template v-if="userRole == 'Instructor' || userRole == 'Admin'">
<el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">{{$t('joinTraining.faultSetting')}}</el-button> <el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">{{ $t('joinTraining.faultSetting') }}</el-button>
</template> </template>
</el-button-group> </el-button-group>
@ -29,121 +29,122 @@
size="small" size="small"
@change="changeOperateMode(mode)" @change="changeOperateMode(mode)"
> >
<el-radio-button class="mode" :label="OperateMode.NORMAL">{{$t('joinTraining.normalOperation')}}</el-radio-button> <el-radio-button class="mode" :label="OperateMode.NORMAL">{{ $t('joinTraining.normalOperation') }}</el-radio-button>
<el-radio-button class="mode" :label="OperateMode.FAULT">{{$t('joinTraining.faultOperation')}}</el-radio-button> <el-radio-button class="mode" :label="OperateMode.FAULT">{{ $t('joinTraining.faultOperation') }}</el-radio-button>
</el-radio-group> </el-radio-group>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic'; import { OperateMode } from '@/scripts/ConstDic';
import { getStationListBySkinCode } from '@/api/runplan'; import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData } from '@/api/simulation'; import { getEveryDayRunPlanData } from '@/api/simulation';
export default { export default {
name: 'MenuDemonSchema', name: 'MenuDemonSchema',
props: { props: {
group: { group: {
type: String, type: String,
required: true required: true
}, },
offset: { offset: {
type: Number, type: Number,
required: true required: true
}, },
userRole: { userRole: {
type: String, type: String,
required: true required: true
} }
}, },
data() { data() {
return { return {
mode: OperateMode.NORMAL, mode: OperateMode.NORMAL,
OperateMode: OperateMode, OperateMode: OperateMode,
viewDisabled: true, viewDisabled: true,
realData: {}, realData: {},
series: [], series: [],
kmRangeCoordMap: {}, kmRangeCoordMap: {},
runPlanData: {}, runPlanData: {},
swch: '02', swch: '02',
swchList: [ swchList: [
{ value: '01', name: this.$t('joinTraining.local') }, { value: '01', name: this.$t('joinTraining.local') },
{ value: '02', name: this.$t('joinTraining.lineAdjustment') } { value: '02', name: this.$t('joinTraining.lineAdjustment') }
], ],
runing: false, runing: false,
userId: '' userId: ''
}; };
}, },
computed: { computed: {
...mapGetters('runPlan', [ ...mapGetters('runPlan', [
'stations' 'stations'
]), ]),
isShowMenuBar() { isShowMenuBar() {
return this.$store.state.map.roles == 'Admin'; return this.$store.state.map.roles == 'Admin';
} }
}, },
watch: { watch: {
'$store.state.training.started': function (val) { '$store.state.training.started': function (val) {
this.setRuning(val); this.setRuning(val);
}, },
'$store.state.training.switchcount': async function () { '$store.state.training.switchcount': async function () {
if (this.group) { if (this.group) {
const started = this.$store.state.training.started; const started = this.$store.state.training.started;
if (started) { if (started) {
await this.loadRunData(this.$route.query); await this.loadRunData(this.$route.query);
} }
} }
} }
}, },
async mounted() { async mounted() {
this.userId = this.$store.state.user.id; this.userId = this.$store.state.user.id;
await this.loadRunData(this.$route.query); console.log(this.$route.query);
}, await this.loadRunData(this.$route.query);
methods: { },
loadRunData(opt) { methods: {
this.$store.dispatch('runPlan/clear').then(resp => { loadRunData(opt) {
if (opt && opt.skinCode) { this.$store.dispatch('runPlan/clear').then(resp => {
this.viewDisabled = true; if (opt && opt.mapId) {
getStationListBySkinCode(opt.skinCode).then(response => { this.viewDisabled = true;
const stations = response.data; getStationList(opt.mapId).then(response => {
this.$store.dispatch('runPlan/setStations', stations).then(() => { const stations = response.data;
getEveryDayRunPlanData(this.group).then(resp => { this.$store.dispatch('runPlan/setStations', stations).then(() => {
this.$store.dispatch('runPlan/setPlanData', resp.data); getEveryDayRunPlanData(this.group).then(resp => {
this.viewDisabled = false; this.$store.dispatch('runPlan/setPlanData', resp.data);
}).catch(error => { this.viewDisabled = false;
this.$store.dispatch('runPlan/setPlanData', []); }).catch(error => {
if (error.code == 30001) { this.$store.dispatch('runPlan/setPlanData', []);
this.$messageBox(this.$t('error.runGraphIsNotLoaded')); if (error.code == 30001) {
} else { this.$messageBox(this.$t('error.runGraphIsNotLoaded'));
this.$messageBox(this.$t('error.obtainOperationGraphFailed')); } else {
} this.$messageBox(this.$t('error.obtainOperationGraphFailed'));
}); }
}); });
}).catch(() => { });
this.$messageBox(this.$t('error.obtainStationListFailed')); }).catch(() => {
}); this.$messageBox(this.$t('error.obtainStationListFailed'));
} });
}); }
}, });
switchMode(swch) { },
this.$store.dispatch('training/setPrdType', swch); switchMode(swch) {
}, this.$store.dispatch('training/setPrdType', swch);
changeOperateMode(handle) { },
this.$store.dispatch('training/changeOperateMode', { mode: handle }); changeOperateMode(handle) {
}, this.$store.dispatch('training/changeOperateMode', { mode: handle });
setFault() { },
this.$emit('faultChooseShow'); setFault() {
}, this.$emit('faultChooseShow');
loadRunPlan() { },
this.$emit('runPlanLoadShow'); loadRunPlan() {
}, this.$emit('runPlanLoadShow');
viewRunPlan() { },
this.$emit('runPlanViewShow'); viewRunPlan() {
}, this.$emit('runPlanViewShow');
setRuning(run) { },
this.runing = run; setRuning(run) {
} this.runing = run;
} }
}
}; };
</script> </script>
<style> <style>

View File

@ -119,7 +119,7 @@ export default {
} else { } else {
this.courseModel.skinCode = this.$route.query.skinCode; this.courseModel.skinCode = this.$route.query.skinCode;
} }
getCommodityMapProduct(this.$route.query.skinCode).then(response => { getCommodityMapProduct(this.$route.query.mapId).then(response => {
this.productList = response.data || []; this.productList = response.data || [];
this.productList = this.productList.filter(elem => { return elem.prdType != '03'; }); this.productList = this.productList.filter(elem => { return elem.prdType != '03'; });
}); });

View File

@ -197,7 +197,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.skinCodeChoose(this.$route.params.skinCode); this.mapIdChoose(this.$route.query.mapId);
}, },
methods: { methods: {
show(data) { show(data) {
@ -211,11 +211,11 @@ export default {
this.dialogShow = false; this.dialogShow = false;
this.loading = false; this.loading = false;
}, },
skinCodeChoose(skinCode) { mapIdChoose(mapId) {
this.operateModel.prdCode = ''; this.operateModel.prdCode = '';
this.productList = []; this.productList = [];
if (skinCode) { if (mapId) {
getCommodityMapProduct(skinCode).then((response) => { getCommodityMapProduct(mapId).then((response) => {
this.productList = response.data; this.productList = response.data;
this.productList = this.productList.filter(elem => { return elem.prdType != '03'; }); this.productList = this.productList.filter(elem => { return elem.prdType != '03'; });
}); });

View File

@ -172,7 +172,7 @@ export default {
listPublishMap().then(response => { listPublishMap().then(response => {
this.mapIdList = response.data; this.mapIdList = response.data;
}); });
getCommodityMapProduct(this.$route.params.skinCode).then((response) => { getCommodityMapProduct(this.$route.query.mapId).then((response) => {
const productList = response.data; const productList = response.data;
if (productList && productList.length > 0) { if (productList && productList.length > 0) {
productList.forEach(elem => { productList.forEach(elem => {

View File

@ -23,70 +23,70 @@ import localStore from 'storejs';
import drapLeft from '@/views/components/drapLeft/index'; import drapLeft from '@/views/components/drapLeft/index';
export default { export default {
name: 'TrainingDraft', name: 'TrainingDraft',
components: { components: {
TrainingCategory, TrainingCategory,
drapLeft drapLeft
}, },
data() { data() {
return { return {
widthLeft: localStore.get('LeftWidth') ? Number(localStore.get('LeftWidth')) : 320, widthLeft: localStore.get('LeftWidth') ? Number(localStore.get('LeftWidth')) : 320,
trainingObj: null, trainingObj: null,
group: '' group: ''
}; };
}, },
computed: { computed: {
width() { width() {
return this.$store.state.app.width - 481 - this.widthLeft; return this.$store.state.app.width - 481 - this.widthLeft;
}, },
height() { height() {
return this.$store.state.app.height - 90; return this.$store.state.app.height - 90;
} }
}, },
watch: { watch: {
'$store.state.app.windowSizeCount': function() { '$store.state.app.windowSizeCount': function() {
this.resize(); this.resize();
}, },
widthLeft(val) { widthLeft(val) {
this.resize(val); this.resize(val);
}, },
$route() { $route() {
this.resize(); this.resize();
} }
}, },
mounted() { mounted() {
this.group = this.$route.query.group; this.group = this.$route.query.group;
this.resize(); this.resize();
}, },
async beforeDestroy() { async beforeDestroy() {
if (this.group) { if (this.group) {
runDiagramQuit(this.group); runDiagramQuit(this.group);
} }
}, },
methods: { methods: {
selectMapSure(data) { selectMapSure(data) {
trainingNotify({ trainingId: data.id }).then(resp => { trainingNotify({ trainingId: data.id }).then(resp => {
this.group = resp.data; this.group = resp.data;
this.$router.push({ path: `${UrlConfig.lesson.record}/${data.id}/${data.name}`, query: { group: resp.data } }); this.$router.push({ path: `${UrlConfig.lesson.record}/${data.id}/${data.name}`, query: { group: resp.data } });
}).catch(error => { }).catch(error => {
this.$messageBox(`${this.$t('error.createSimulationFailed')}: ${error.message}`); this.$messageBox(`${this.$t('error.createSimulationFailed')}: ${error.message}`);
}); });
}, },
trainingStart(data) { trainingStart(data) {
/** 区分演示和正式需要在演示时设置lessonId为0*/ /** 区分演示和正式需要在演示时设置lessonId为0*/
trainingNotify({ trainingId: data.id }).then(resp => { trainingNotify({ trainingId: data.id }).then(resp => {
this.$router.push({ path: `${UrlConfig.display}/record`, query: { trainingId: this.$route.params.trainingId, trainingName: this.$route.params.trainingName, group: resp.data, lessonId: 0 } }); this.$router.push({ path: `${UrlConfig.display}/record`, query: { trainingId: this.$route.params.trainingId, trainingName: this.$route.params.trainingName, group: resp.data, lessonId: 0 } });
}).catch(error => { }).catch(error => {
this.$messageBox(`${this.$t('error.createSimulationFailed')}: ${error.message}`); this.$messageBox(`${this.$t('error.createSimulationFailed')}: ${error.message}`);
}); });
}, },
drapWidth(width) { drapWidth(width) {
this.widthLeft = Number(width); this.widthLeft = Number(width);
}, },
resize() { resize() {
this.$store.dispatch('config/resize', { width: this.width, height: this.height }); this.$store.dispatch('config/resize', { width: this.width, height: this.height });
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -22,96 +22,96 @@ import { loadMapData } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
export default { export default {
name: 'LessonDraft', name: 'LessonDraft',
components: { components: {
MapSystemDraft, MapSystemDraft,
StepManage StepManage
}, },
data() { data() {
return { return {
stationObj: null, stationObj: null,
trainingObj: null, trainingObj: null,
widthLeft: 0 widthLeft: 0
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'mapData' 'mapData'
]), ]),
group() { group() {
return this.$route.query.group; return this.$route.query.group;
}, },
trainingId() { trainingId() {
return this.$route.params.trainingId; return this.$route.params.trainingId;
}, },
width() { width() {
return this.$store.state.app.width - 481 - this.widthLeft; return this.$store.state.app.width - 481 - this.widthLeft;
}, },
height() { height() {
return this.$store.state.app.height - 90; return this.$store.state.app.height - 90;
} }
}, },
watch: { watch: {
$route(newVal) { $route(newVal) {
this.initLoadData(); this.initLoadData();
}, },
'$store.state.map.mapViewLoadedCount': function() { '$store.state.map.mapViewLoadedCount': function() {
if (this.trainingId) { if (this.trainingId) {
getTrainingStepsDetail(this.trainingId, { group: this.group }).then(response => { getTrainingStepsDetail(this.trainingId, { group: this.group }).then(response => {
this.$store.dispatch('training/setTrainingData', response.data); this.$store.dispatch('training/setTrainingData', response.data);
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('error.getMapStepsFailed')); this.$messageBox(this.$t('error.getMapStepsFailed'));
this.endViewLoading(); this.endViewLoading();
}); });
} }
} }
}, },
mounted() { mounted() {
this.initLoadData(); this.initLoadData();
}, },
beforeDestroy() { beforeDestroy() {
this.$store.dispatch('map/mapClear'); this.$store.dispatch('map/mapClear');
}, },
methods: { methods: {
endViewLoading(isSuccess) { endViewLoading(isSuccess) {
if (!isSuccess) { if (!isSuccess) {
this.$store.dispatch('map/mapClear'); this.$store.dispatch('map/mapClear');
} }
this.$nextTick(() => { this.$nextTick(() => {
EventBus.$emit('viewLoading', false); EventBus.$emit('viewLoading', false);
}); });
}, },
initLoadData() { initLoadData() {
this.$store.dispatch('training/end', TrainingMode.EDIT); this.$store.dispatch('training/end', TrainingMode.EDIT);
this.$store.dispatch('training/reset'); this.$store.dispatch('training/reset');
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
if (parseInt(this.trainingId)) { if (parseInt(this.trainingId)) {
this.trainingObj = { id: this.trainingId, name: this.$route.params.trainingName }; this.trainingObj = { id: this.trainingId, name: this.$route.params.trainingName };
// //
// //
// //
getTrainingDetail(this.trainingId).then(resp => { getTrainingDetail(this.trainingId).then(resp => {
const detail = resp.data; const detail = resp.data;
getProductDetail(detail.prdCode).then(rest => { getProductDetail(detail.prdCode).then(rest => {
const data = rest.data; const data = rest.data;
loadMapData(detail.skinCode).then(() => { loadMapData(detail.skinCode).then(() => {
this.$store.dispatch('training/setPrdType', data.prdType); this.$store.dispatch('training/setPrdType', data.prdType);
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('error.loadMapDataFailed')); this.$messageBox(this.$t('error.loadMapDataFailed'));
this.endViewLoading(); this.endViewLoading();
}); });
}); });
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('error.getMapDetailFailed')); this.$messageBox(this.$t('error.getMapDetailFailed'));
this.endViewLoading(); this.endViewLoading();
}); });
} else { } else {
this.endViewLoading(); this.endViewLoading();
} }
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -15,176 +15,168 @@ import { getPublishMapList } from '@/api/jmap/map';
import { getCommodityMapProduct } from '@/api/management/mapprd'; import { getCommodityMapProduct } from '@/api/management/mapprd';
export default { export default {
name: 'UsersTrainingAdd', name: 'UsersTrainingAdd',
props: { props: {
type: { type: {
type: String, type: String,
required: true required: true
} }
}, },
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
formModel: { formModel: {
mapId: '', mapId: '',
mapPrdCode: '', mapPrdCode: '',
userId: '', userId: '',
userName: '', userName: '',
duration: '' duration: ''
}, },
LessonList: [], LessonList: [],
mapPrdList: [], mapPrdList: [],
UserList: [], UserList: [],
UserLoading: false UserLoading: false
}; };
}, },
computed: { computed: {
form() { form() {
const form = { const form = {
labelWidth: '120px', labelWidth: '120px',
items: [ items: [
{ prop: 'mapId', label: this.$t('system.mapName'), type: 'select', required: true, options: this.LessonList, change: true, onChange: this.mapChange, placeholder: this.$t('rules.mapInput') }, { prop: 'mapId', label: this.$t('system.mapName'), type: 'select', required: true, options: this.LessonList, change: true, onChange: this.mapChange, placeholder: this.$t('rules.mapInput') },
{ prop: 'mapPrdCode', label: this.$t('system.productName'), type: 'select', required: true, options: this.mapPrdList, placeholder: this.$t('rules.productInput') }, { prop: 'mapPrdCode', label: this.$t('system.productName'), type: 'select', required: true, options: this.mapPrdList, placeholder: this.$t('rules.productInput') },
{ prop: 'userName', label: this.$t('system.userName'), type: 'complete', required: false, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: this.$t('system.pleaseInputNames') }, { prop: 'userName', label: this.$t('system.userName'), type: 'complete', required: false, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: this.$t('system.pleaseInputNames') },
{ prop: 'duration', label: this.$t('system.trainingUseTime'), type: 'text', rightWidth: true, required: true, message: 's' } { prop: 'duration', label: this.$t('system.trainingUseTime'), type: 'text', rightWidth: true, required: true, message: 's' }
] ]
}; };
return form; return form;
}, },
rules() { rules() {
const crules = { const crules = {
mapId: [ mapId: [
{ required: true, message: this.$t('rules.mapInput'), trigger: 'change' } { required: true, message: this.$t('rules.mapInput'), trigger: 'change' }
], ],
userName: [ userName: [
{ required: true, message: this.$t('rules.chooseUser'), trigger: 'change' } { required: true, message: this.$t('rules.chooseUser'), trigger: 'change' }
], ],
mapPrdCode: [ mapPrdCode: [
{ required: true, message: this.$t('rules.productInput'), trigger: 'change' } { required: true, message: this.$t('rules.productInput'), trigger: 'change' }
], ],
duration: [ duration: [
{ required: true, message: this.$t('rules.timeInput'), trigger: 'blur' } { required: true, message: this.$t('rules.timeInput'), trigger: 'blur' }
] ]
}; };
return crules; return crules;
}, },
title() { title() {
return this.$t('system.createSimulationTitle'); return this.$t('system.createSimulationTitle');
} }
}, },
mounted() { mounted() {
this.initLoadPage(); this.initLoadPage();
}, },
methods: { methods: {
initLoadPage() { initLoadPage() {
// //
this.LessonList.length = 0; this.LessonList.length = 0;
this.UserList.length = 0; this.UserList.length = 0;
const param = { const param = {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
}; };
getPublishMapList(param).then(response => { getPublishMapList(param).then(response => {
const data = response.data.list; const data = response.data.list;
if (data && data.length) { if (data && data.length) {
data.forEach(elem => { data.forEach(elem => {
this.LessonList.push({ value: elem.id, label: elem.name, skinCode: elem.skinCode }); this.LessonList.push({ value: elem.id, label: elem.name, skinCode: elem.skinCode });
}); });
} }
}); });
}, },
// input // input
async querySearchAsync(queryString, cb) { async querySearchAsync(queryString, cb) {
// queryString // queryString
const results = []; const results = [];
if (queryString) { if (queryString) {
try { try {
const params = { const params = {
fuzzyParam: queryString fuzzyParam: queryString
}; };
const res = await getDimUserList(params); const res = await getDimUserList(params);
const list = res.data; const list = res.data;
list.forEach(item => { list.forEach(item => {
const value = { const value = {
id: item.id, id: item.id,
value: `${item.nickname}(${item.name})${item.mobile}` value: `${item.nickname}(${item.name})${item.mobile}`
}; };
results.push(value); results.push(value);
}); });
cb(results); cb(results);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
cb(results); cb(results);
} }
} else { } else {
cb(results); cb(results);
} }
}, },
prdSelect(item) { prdSelect(item) {
this.formModel.userId = item.id; this.formModel.userId = item.id;
}, },
async mapChange(val) { async mapChange(val) {
let skinCode = ''; this.mapPrdList = [];
this.mapPrdList = []; this.formModel.mapPrdCode = '';
this.formModel.mapPrdCode = ''; try {
if (this.LessonList.length) { const res = await getCommodityMapProduct(val);
this.LessonList.forEach(item => { const data = res.data;
if (item.value == val) { if (data && data.length) {
skinCode = item.skinCode; data.forEach(elem => {
} this.mapPrdList.push({ value: elem.code, label: elem.name });
}); });
try { }
const res = await getCommodityMapProduct(skinCode); } catch (error) {
const data = res.data; console.error(error);
if (data && data.length) { }
data.forEach(elem => { },
this.mapPrdList.push({ value: elem.code, label: elem.name }); show(data) {
}); this.dialogVisible = true;
} },
} catch (error) { doSave() {
console.error(error); const self = this;
} this.$refs.dataform.validateForm(() => {
} self.save();
}, });
show(data) { },
this.dialogVisible = true; save() {
}, const self = this;
doSave() { const params = {
const self = this; mapId: this.formModel.mapId,
this.$refs.dataform.validateForm(() => { mapPrdCode: this.formModel.mapPrdCode,
self.save(); userId: this.formModel.userId,
}); duration: parseInt(this.formModel.duration)
}, };
save() { if (params.userId) {
const self = this; postSimulationStats(params).then(response => {
const params = { self.$message.success(this.$t('system.addSuccess'));
mapId: this.formModel.mapId, self.handleClose();
mapPrdCode: this.formModel.mapPrdCode, self.$emit('reloadTable');
userId: this.formModel.userId, }).catch(error => {
duration: parseInt(this.formModel.duration) self.$message.error(this.$t('error.addFailed') + error.message);
}; });
if (params.userId) { } else {
postSimulationStats(params).then(response => { this.$message.error(this.$t('rules.chooseUser'));
self.$message.success(this.$t('system.addSuccess')); }
self.handleClose(); },
self.$emit('reloadTable'); handleClose(done) {
}).catch(error => { this.formModel = {
self.$message.error(this.$t('error.addFailed') + error.message); mapId: '',
}); mapPrdCode: '',
} else { userId: '',
this.$message.error(this.$t('rules.chooseUser')); userName: '',
} duration: ''
}, };
handleClose(done) { this.dialogVisible = false;
this.formModel = { }
mapId: '', }
mapPrdCode: '',
userId: '',
userName: '',
duration: ''
};
this.dialogVisible = false;
}
}
}; };
</script> </script>

View File

@ -10,7 +10,6 @@
</template> </template>
<script> <script>
import { getPublishMapInfo } from '@/api/jmap/map';
import { getCommodityMapProduct } from '@/api/management/mapprd'; import { getCommodityMapProduct } from '@/api/management/mapprd';
import { OperatorModel, PermissionType } from '@/scripts/ConstDic'; import { OperatorModel, PermissionType } from '@/scripts/ConstDic';
import { getTotalRemains } from '@/api/management/author'; import { getTotalRemains } from '@/api/management/author';
@ -18,295 +17,293 @@ import { superAdmin, admin } from '@/router';
import { getDimUserList } from '@/api/management/user'; import { getDimUserList } from '@/api/management/user';
export default { export default {
name: 'EditRule', name: 'EditRule',
props: { props: {
permissionTypeList: { permissionTypeList: {
type: Array, type: Array,
required: true required: true
}, },
publishMapList: { publishMapList: {
type: Array, type: Array,
required: true required: true
}, },
publisLessonList: { publisLessonList: {
type: Array, type: Array,
required: true required: true
} }
}, },
data() { data() {
return { return {
show: false, show: false,
type: '', type: '',
mapProductList: [], mapProductList: [],
filterPublisLessonList: [], filterPublisLessonList: [],
formModel: { formModel: {
permissionType: '', permissionType: '',
mapId: '', mapId: '',
lessonId: '', lessonId: '',
prdCode: '', prdCode: '',
date: '', date: '',
amount: 0, amount: 0,
ownerId: '', ownerId: '',
roleName: '' roleName: ''
}, },
DatePicker: { DatePicker: {
shortcuts: [{ shortcuts: [{
text: this.$t('global.today'), text: this.$t('global.today'),
onClick(picker) { onClick(picker) {
picker.$emit('pick', new Date()); picker.$emit('pick', new Date());
} }
}] }]
}, },
numberMessage: '' numberMessage: ''
}; };
}, },
computed: { computed: {
form() { form() {
const form = { const form = {
labelWidth: '120px', labelWidth: '120px',
items: [ items: [
{ prop: 'permissionType', label: this.$t('permission.permissionType'), type: 'select', required: false, disabled: !this.isAdd, options: this.permissionTypeList, change: true, onChange: this.permissionTypeChange }, { prop: 'permissionType', label: this.$t('permission.permissionType'), type: 'select', required: false, disabled: !this.isAdd, options: this.permissionTypeList, change: true, onChange: this.permissionTypeChange },
{ prop: 'mapId', label: this.$t('permission.mapName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMap, options: this.publishMapList, change: true, onChange: this.mapChange }, { prop: 'mapId', label: this.$t('permission.mapName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMap, options: this.publishMapList, change: true, onChange: this.mapChange },
{ prop: 'prdCode', label: this.$t('permission.mapProductName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMapProduct, options: this.mapProductList, change: true, onChange: this.mapProductChange }, { prop: 'prdCode', label: this.$t('permission.mapProductName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMapProduct, options: this.mapProductList, change: true, onChange: this.mapProductChange },
{ prop: 'lessonId', label: this.$t('permission.lessonName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowLesson, options: this.filterPublisLessonList }, { prop: 'lessonId', label: this.$t('permission.lessonName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowLesson, options: this.filterPublisLessonList },
{ prop: 'roleName', label: this.$t('permission.belonger'), type: 'complete', required: false, disabled: !this.isAdd && this.isAdministrator, show: this.isShowRole, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: '请输入昵称/名字/手机号' }, { prop: 'roleName', label: this.$t('permission.belonger'), type: 'complete', required: false, disabled: !this.isAdd && this.isAdministrator, show: this.isShowRole, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: '请输入昵称/名字/手机号' },
{ prop: 'date', label: this.$t('permission.selectDate'), type: 'daterange', required: false, viewFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss' }, { prop: 'date', label: this.$t('permission.selectDate'), type: 'daterange', required: false, viewFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss' },
{ prop: 'amount', label: '权限个数', type: 'number', required: false, min: 0, max: this.maxTotal, message: this.numberMessage } { prop: 'amount', label: '权限个数', type: 'number', required: false, min: 0, max: this.maxTotal, message: this.numberMessage }
] ]
}; };
return form; return form;
}, },
rules() { rules() {
const that = this; const that = this;
const crules = { const crules = {
permissionType: [ permissionType: [
{ required: true, message: this.$t('rules.permissionTypeInput'), trigger: 'change' } { required: true, message: this.$t('rules.permissionTypeInput'), trigger: 'change' }
], ],
mapId: [ mapId: [
{ required: true, message: this.$t('rules.selectMapName'), trigger: 'change' } { required: true, message: this.$t('rules.selectMapName'), trigger: 'change' }
], ],
prdCode: [ prdCode: [
{ required: true, message: this.$t('rules.selectMapProductName'), trigger: 'change' } { required: true, message: this.$t('rules.selectMapProductName'), trigger: 'change' }
], ],
lessonId: [ lessonId: [
{ required: true, message: this.$t('rules.lessonInput'), trigger: 'change' } { required: true, message: this.$t('rules.lessonInput'), trigger: 'change' }
], ],
date: [ date: [
{ required: true, message: this.$t('rules.inputTime'), trigger: 'blur' } { required: true, message: this.$t('rules.inputTime'), trigger: 'blur' }
], ],
amount: [ amount: [
{ required: true, message: this.$t('rules.inputPermissionNumber'), trigger: 'change' }, { required: true, message: this.$t('rules.inputPermissionNumber'), trigger: 'change' },
{ {
validator(rule, value, callback) { validator(rule, value, callback) {
if (Number.isInteger(Number(value)) && Number(value) > 0) { if (Number.isInteger(Number(value)) && Number(value) > 0) {
callback(); callback();
} else { } else {
callback(new Error(that.$t('rules.permissionNumberGreater0'))); callback(new Error(that.$t('rules.permissionNumberGreater0')));
} }
}, },
trigger: 'blur' trigger: 'blur'
} }
] ]
}; };
return crules; return crules;
}, },
title() { title() {
if (this.isAdd) { if (this.isAdd) {
return this.$t('permission.addPermissionPackageRule'); return this.$t('permission.addPermissionPackageRule');
} else { } else {
return this.$t('permission.editPermissionPackageRule'); return this.$t('permission.editPermissionPackageRule');
} }
}, },
disabled() { disabled() {
return this.formModel.amount > this.maxTotal || this.formModel.amount <= 0; return this.formModel.amount > this.maxTotal || this.formModel.amount <= 0;
}, },
isAdd() { isAdd() {
return this.type == 'add'; return this.type == 'add';
}, },
isAdministrator() { isAdministrator() {
return this.$store.state.user.roles.indexOf(superAdmin) || this.$store.state.user.roles.indexOf(admin); return this.$store.state.user.roles.indexOf(superAdmin) || this.$store.state.user.roles.indexOf(admin);
}, },
isShowMap() { isShowMap() {
return this.formModel.permissionType !== '04'; return this.formModel.permissionType !== '04';
}, },
isShowRole() { isShowRole() {
return this.$store.state.user.roles.indexOf(superAdmin) != -1; return this.$store.state.user.roles.indexOf(superAdmin) != -1;
}, },
isShowMapProduct() { isShowMapProduct() {
return this.formModel.permissionType !== '04'; return this.formModel.permissionType !== '04';
}, },
isShowLesson() { isShowLesson() {
return this.formModel.permissionType != '04' && this.formModel.permissionType != '03'; return this.formModel.permissionType != '04' && this.formModel.permissionType != '03';
} }
}, },
watch: { watch: {
formModel: { formModel: {
handler: function (val, old) { handler: function (val, old) {
this.setTotalMax(); this.setTotalMax();
}, },
deep: true deep: true
} }
}, },
methods: { methods: {
setTotalMax() { setTotalMax() {
let endTime; let endTime;
let startTime; let startTime;
if (this.formModel.date) { if (this.formModel.date) {
endTime = this.formModel.date[1]; endTime = this.formModel.date[1];
startTime = this.formModel.date[0]; startTime = this.formModel.date[0];
} }
var validator = {}; var validator = {};
validator[PermissionType.LESSON] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.prdCode; }; validator[PermissionType.LESSON] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.prdCode; };
validator[PermissionType.EXAM] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.prdCode; }; validator[PermissionType.EXAM] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.prdCode; };
validator[PermissionType.SIMULATION] = () => { return this.formModel.mapId && this.formModel.prdCode; }; validator[PermissionType.SIMULATION] = () => { return this.formModel.mapId && this.formModel.prdCode; };
validator[PermissionType.SCREEN] = () => { return true; }; validator[PermissionType.SCREEN] = () => { return true; };
if (endTime && startTime && this.formModel.permissionType && validator[this.formModel.permissionType]()) { if (endTime && startTime && this.formModel.permissionType && validator[this.formModel.permissionType]()) {
if (endTime > startTime) { if (endTime > startTime) {
const model = { const model = {
startTime: startTime, startTime: startTime,
endTime: endTime, endTime: endTime,
permissionType: this.formModel.permissionType, permissionType: this.formModel.permissionType,
ownerId: this.formModel.ownerId ownerId: this.formModel.ownerId
}; };
if (this.formModel.permissionType == PermissionType.LESSON || this.formModel.permissionType == PermissionType.EXAM) { if (this.formModel.permissionType == PermissionType.LESSON || this.formModel.permissionType == PermissionType.EXAM) {
model['lessonId'] = this.formModel.lessonId; model['lessonId'] = this.formModel.lessonId;
model['mapId'] = this.formModel.mapId; model['mapId'] = this.formModel.mapId;
model['prdCode'] = this.formModel.prdCode; model['prdCode'] = this.formModel.prdCode;
} else if (this.formModel.permissionType == PermissionType.SIMULATION) { } else if (this.formModel.permissionType == PermissionType.SIMULATION) {
model['mapId'] = this.formModel.mapId; model['mapId'] = this.formModel.mapId;
model['prdCode'] = this.formModel.prdCode; model['prdCode'] = this.formModel.prdCode;
} }
getTotalRemains(model).then(response => { getTotalRemains(model).then(response => {
this.maxTotal = response.data; this.maxTotal = response.data;
if (this.maxTotal == 0) { if (this.maxTotal == 0) {
this.numberMessage = '可用权限数量为0'; this.numberMessage = '可用权限数量为0';
} else { } else {
this.numberMessage = `${this.$t('global.remainPermissionNumber')}${this.maxTotal}`; this.numberMessage = `${this.$t('global.remainPermissionNumber')}${this.maxTotal}`;
} }
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('error.obtainMaxNumberFailed')); this.$messageBox(this.$t('error.obtainMaxNumberFailed'));
}); });
} else { } else {
this.numberMessage = '结束时间必须大于开始时间'; this.numberMessage = '结束时间必须大于开始时间';
} }
} else { } else {
this.numberMessage = ''; this.numberMessage = '';
} }
}, },
permissionTypeChange() { permissionTypeChange() {
this.formModel.mapId = ''; this.formModel.mapId = '';
this.formModel.prdCode = ''; this.formModel.prdCode = '';
this.formModel.lessonId = ''; this.formModel.lessonId = '';
}, },
mapChange(mapId) { mapChange(mapId) {
this.formModel.prdCode = ''; this.formModel.prdCode = '';
this.formModel.lessonId = ''; this.formModel.lessonId = '';
this.mapProductList = []; this.mapProductList = [];
getPublishMapInfo(mapId).then(resp => { getCommodityMapProduct(mapId).then(rest => {
getCommodityMapProduct(resp.data.skinCode).then(rest => { const list = rest.data || [];
const list = rest.data || []; this.mapProductList = list.map(elem => {
this.mapProductList = list.map(elem => { return { value: elem.code, label: elem.name };
return { value: elem.code, label: elem.name }; });
}); });
}); },
}); mapProductChange(prdCode) {
}, this.formModel.lessonId = '';
mapProductChange(prdCode) { this.filterPublisLessonList = this.publisLessonList.filter(elem => { return elem.mapId == this.formModel.mapId && elem.prdCode == this.formModel.prdCode; });
this.formModel.lessonId = ''; },
this.filterPublisLessonList = this.publisLessonList.filter(elem => { return elem.mapId == this.formModel.mapId && elem.prdCode == this.formModel.prdCode; }); // input
}, async querySearchAsync(queryString, cb) {
// input // queryString
async querySearchAsync(queryString, cb) { const results = [];
// queryString if (queryString) {
const results = []; try {
if (queryString) { const params = {
try { fuzzyParam: queryString
const params = { };
fuzzyParam: queryString const res = await getDimUserList(params);
}; const list = res.data;
const res = await getDimUserList(params); list.forEach(item => {
const list = res.data; const value = {
list.forEach(item => { id: item.id,
const value = { value: `${item.nickname}(${item.name})${item.mobile}`
id: item.id, };
value: `${item.nickname}(${item.name})${item.mobile}` results.push(value);
}; });
results.push(value); cb(results);
}); } catch (error) {
cb(results); cb(results);
} catch (error) { }
cb(results); } else {
} cb(results);
} else { }
cb(results); },
} prdSelect(item) {
}, this.formModel.ownerId = item.id;
prdSelect(item) { },
this.formModel.ownerId = item.id; doShow(data) {
}, this.show = true;
doShow(data) { this.type = data.type;
this.show = true; if (!this.isAdd) {
this.type = data.type; const model = data.item;
if (!this.isAdd) { this.formModel = {
const model = data.item; permissionType: model.permissionType,
this.formModel = { mapId: model.mapId,
permissionType: model.permissionType, lessonId: model.lessonId,
mapId: model.mapId, prdCode: model.prdCode,
lessonId: model.lessonId, date: [model.startTime, model.endTime],
prdCode: model.prdCode, amount: model.amount,
date: [model.startTime, model.endTime], ownerId: this.formModel.ownerId,
amount: model.amount, roleName: this.formModel.roleName
ownerId: this.formModel.ownerId, };
roleName: this.formModel.roleName }
};
}
this.formModel.amount = 0; this.formModel.amount = 0;
}, },
doClose() { doClose() {
this.show = false; this.show = false;
}, },
draftRule() { draftRule() {
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
if (this.formModel.amount <= this.maxTotal && this.formModel.amount) { if (this.formModel.amount <= this.maxTotal && this.formModel.amount) {
if (this.isAdd) { if (this.isAdd) {
this.$emit('addRuleForm', { this.$emit('addRuleForm', {
operator: OperatorModel.TRANSFER, operator: OperatorModel.TRANSFER,
permissionType: this.formModel.permissionType, permissionType: this.formModel.permissionType,
mapId: this.isShowMap ? this.formModel.mapId : '', mapId: this.isShowMap ? this.formModel.mapId : '',
lessonId: this.isShowLesson ? this.formModel.lessonId : '', lessonId: this.isShowLesson ? this.formModel.lessonId : '',
prdCode: this.isShowMapProduct ? this.formModel.prdCode : '', prdCode: this.isShowMapProduct ? this.formModel.prdCode : '',
startTime: this.formModel.date[0], startTime: this.formModel.date[0],
endTime: this.formModel.date[1], endTime: this.formModel.date[1],
amount: this.formModel.amount, amount: this.formModel.amount,
ownerId: this.formModel.ownerId, ownerId: this.formModel.ownerId,
roleName: this.formModel.roleName roleName: this.formModel.roleName
}); });
} else { } else {
this.$emit('editRuleForm', { this.$emit('editRuleForm', {
operator: OperatorModel.TRANSFER, operator: OperatorModel.TRANSFER,
permissionType: this.formModel.permissionType, permissionType: this.formModel.permissionType,
mapId: this.isShowMap ? this.formModel.mapId : '', mapId: this.isShowMap ? this.formModel.mapId : '',
lessonId: this.isShowLesson ? this.formModel.lessonId : '', lessonId: this.isShowLesson ? this.formModel.lessonId : '',
prdCode: this.isShowMapProduct ? this.formModel.prdCode : '', prdCode: this.isShowMapProduct ? this.formModel.prdCode : '',
startTime: this.formModel.date[0], startTime: this.formModel.date[0],
endTime: this.formModel.date[1], endTime: this.formModel.date[1],
amount: this.formModel.amount, amount: this.formModel.amount,
ownerId: this.formModel.ownerId, ownerId: this.formModel.ownerId,
roleName: this.formModel.roleName roleName: this.formModel.roleName
}); });
} }
this.doClose(); this.doClose();
} }
}); });
} }
} }
}; };
</script> </script>

View File

@ -70,7 +70,7 @@
</template> </template>
<script> <script>
import { listPublishMap, getPublishMapInfo } from '@/api/jmap/map'; import { listPublishMap } from '@/api/jmap/map';
import { getPublishLessonList } from '@/api/jmap/lesson'; import { getPublishLessonList } from '@/api/jmap/lesson';
import { getCommodityMapProduct } from '@/api/management/mapprd'; import { getCommodityMapProduct } from '@/api/management/mapprd';
import { packagePermissionDistribute } from '@/api/management/distribute'; import { packagePermissionDistribute } from '@/api/management/distribute';
@ -79,187 +79,184 @@ import EditRule from './editRule';
import CanTransfer from './canDistribute'; import CanTransfer from './canDistribute';
export default { export default {
name: 'PackRule', name: 'PackRule',
components: { components: {
EditRule, EditRule,
QrCode, QrCode,
CanTransfer CanTransfer
}, },
data() { data() {
return { return {
display: 1, display: 1,
urlInfo: {}, urlInfo: {},
PermissionTypeList: [], PermissionTypeList: [],
PublisLessonList: [], PublisLessonList: [],
PublishMapList: [], PublishMapList: [],
mapProductList: [], mapProductList: [],
ruleList: [] ruleList: []
}; };
}, },
computed: { computed: {
height() { height() {
return this.$store.state.app.height - 63; return this.$store.state.app.height - 63;
} }
}, },
mounted() { mounted() {
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
getSummaries(param) { getSummaries(param) {
const { columns, data } = param; const { columns, data } = param;
const sums = []; const sums = [];
columns.forEach((column, index) => { columns.forEach((column, index) => {
if (index === 0) { if (index === 0) {
sums[index] = this.$t('global.totoal'); sums[index] = this.$t('global.totoal');
return; return;
} }
if (index === 6) { if (index === 6) {
const values = data.map(item => Number(item[column.property])); const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) { if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => { sums[index] = values.reduce((prev, curr) => {
const value = Number(curr); const value = Number(curr);
if (!isNaN(value)) { if (!isNaN(value)) {
return prev + curr; return prev + curr;
} else { } else {
return prev; return prev;
} }
}, 0); }, 0);
} }
} }
}); });
return sums; return sums;
}, },
computedName(list, code) { computedName(list, code) {
let name = ''; let name = '';
list.forEach(elem => { list.forEach(elem => {
if (elem.value == code) { if (elem.value == code) {
name = elem.label; name = elem.label;
} }
}); });
return name; return name;
}, },
async computedMapProduct(item) { async computedMapProduct(item) {
let name = ''; let name = '';
const resp = await getPublishMapInfo(item.mapId); const rest = await getCommodityMapProduct(item.mapId);
const rest = await getCommodityMapProduct(resp.data.skinCode); const list = rest.data || [];
const list = rest.data || []; list.forEach(elem => {
list.forEach(elem => { if (elem.id == item.mapProductCode) {
if (elem.id == item.mapProductCode) { name = elem.name;
name = elem.name; return;
return; }
} });
}); return name;
return name; },
}, loadInitData() {
loadInitData() { this.PermissionTypeList = [];
this.PermissionTypeList = []; this.$Dictionary.permissionType().then(list => {
this.$Dictionary.permissionType().then(list => { this.PermissionTypeList = list.map(elem => {
this.PermissionTypeList = list.map(elem => { return { value: elem.code, label: elem.name };
return { value: elem.code, label: elem.name }; });
}); });
});
this.EffectiveTypeList = []; this.EffectiveTypeList = [];
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
this.EffectiveTypeList = list.map(elem => { this.EffectiveTypeList = list.map(elem => {
return { value: elem.code, label: elem.name }; return { value: elem.code, label: elem.name };
}); });
}); });
this.PublishMapList = []; this.PublishMapList = [];
listPublishMap().then(response => { listPublishMap().then(response => {
const list = response.data || []; const list = response.data || [];
this.PublishMapList = list.map(elem => { this.PublishMapList = list.map(elem => {
return { value: elem.id, label: elem.name }; return { value: elem.id, label: elem.name };
}); });
}); });
this.PublisLessonList = []; this.PublisLessonList = [];
getPublishLessonList().then(response => { getPublishLessonList().then(response => {
const list = response.data || []; const list = response.data || [];
this.PublisLessonList = list.map(elem => { this.PublisLessonList = list.map(elem => {
return { value: elem.id, label: elem.name, mapId: elem.mapId, prdCode: elem.prdCode }; return { value: elem.id, label: elem.name, mapId: elem.mapId, prdCode: elem.prdCode };
}); });
}); });
}, },
turnback() { turnback() {
this.$router.go(-1); this.$router.go(-1);
}, },
dialogAdd() { dialogAdd() {
this.$refs.addRule.doShow({ type: 'add' }); this.$refs.addRule.doShow({ type: 'add' });
}, },
dialogEdit(item) { dialogEdit(item) {
this.$refs.addRule.doShow({ type: 'edit', item: item }); this.$refs.addRule.doShow({ type: 'edit', item: item });
}, },
deleteForm(item) { deleteForm(item) {
var index = this.ruleList.indexOf(item); var index = this.ruleList.indexOf(item);
if (index >= 0) { if (index >= 0) {
this.ruleList.splice(index, 1); this.ruleList.splice(index, 1);
} }
}, },
addRuleForm(item) { addRuleForm(item) {
const index = this.ruleList.findIndex(elem => { const index = this.ruleList.findIndex(elem => {
return item.mapId == elem.mapId && return item.mapId == elem.mapId &&
item.lessonId == elem.lessonId && item.lessonId == elem.lessonId &&
item.prdCode == elem.prdCode && item.prdCode == elem.prdCode &&
item.permissionType == elem.permissionType; item.permissionType == elem.permissionType;
}); });
getPublishMapInfo(item.mapId).then(resp => { getCommodityMapProduct(item.mapId).then(rest => {
getCommodityMapProduct(resp.data.skinCode).then(rest => { const list = rest.data || [];
const list = rest.data || []; this.mapProductList = list.map(elem => {
this.mapProductList = list.map(elem => { return { value: elem.code, label: elem.name };
return { value: elem.code, label: elem.name }; });
}); });
}); if (index < 0) {
}); this.ruleList.push(item);
if (index < 0) { } else {
this.ruleList.push(item); this.$message.warning(this.$t('permission.hasExitRule'));
} else { }
this.$message.warning(this.$t('permission.hasExitRule')); },
} editRuleForm(item) {
}, const index = this.ruleList.findIndex(elem => {
editRuleForm(item) { return item.mapId == elem.mapId &&
const index = this.ruleList.findIndex(elem => {
return item.mapId == elem.mapId &&
item.lessonId == elem.lessonId && item.lessonId == elem.lessonId &&
item.mapProductCode == elem.mapProductCode && item.mapProductCode == elem.mapProductCode &&
item.permissionType == elem.permissionType; item.permissionType == elem.permissionType;
}); });
if (index >= 0) { if (index >= 0) {
Object.assign(this.ruleList[index], item); Object.assign(this.ruleList[index], item);
} }
}, },
packForm() { packForm() {
if (this.ruleList.length) { if (this.ruleList.length) {
this.$refs.canDistribute.doShow(); this.$refs.canDistribute.doShow();
} else { } else {
this.$messageBox(this.$t('permission.pleaseAddRule')); this.$messageBox(this.$t('permission.pleaseAddRule'));
} }
}, },
distribute(data) { distribute(data) {
this.url = ''; this.url = '';
this.ruleList.forEach(item => { this.ruleList.forEach(item => {
item.canDistribute = data.canDistribute; item.canDistribute = data.canDistribute;
}); });
packagePermissionDistribute(this.ruleList).then(resp => { packagePermissionDistribute(this.ruleList).then(resp => {
this.urlInfo = { this.urlInfo = {
url: resp.data, url: resp.data,
title: this.$t('global.distributeQrcode') title: this.$t('global.distributeQrcode')
}; };
this.qrcodeShow(); this.qrcodeShow();
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('error.packagePermissionFailed')); this.$messageBox(this.$t('error.packagePermissionFailed'));
}); });
}, },
qrcodeShow() { qrcodeShow() {
if (this.$refs) { if (this.$refs) {
this.$refs.qrCode.doShow(this.urlInfo); this.$refs.qrCode.doShow(this.urlInfo);
} }
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,43 +1,47 @@
<template> <template>
<el-card :style="{height: height+'px'}" style="overflow-y:scroll;padding-bottom:20px;"> <el-card :style="{height: height+'px'}" style="overflow-y:scroll;padding-bottom:20px;">
<div class="runPlanHeader" style="width: 90%;margin-left:5%;margin-top:20px;display: inline-block;"> <div class="runPlanHeader" style="width: 90%;margin-left:5%;margin-top:20px;display: inline-block;">
<div class="runPlanList">{{$t('planMonitor.openRunPlan.runPlanList')}}</div> <div class="runPlanList">{{ $t('planMonitor.openRunPlan.runPlanList') }}</div>
<el-button size="small" type="primary" @click="handleCreate" class="createRunPlan" v-if="isCreate">{{$t('planMonitor.createRunningDiagram')}}</el-button> <el-button v-if="isCreate" size="small" type="primary" class="createRunPlan" @click="handleCreate">{{ $t('planMonitor.createRunningDiagram') }}</el-button>
</div> </div>
<el-table :data="runPlanList" height="500" stripe <el-table
border :data="runPlanList"
style="width: 90%;margin-left:5%;margin-top:20px;display: inline-block;"> height="500"
<el-table-column prop="name" :label="this.$t('planMonitor.runGraphName')" /> stripe
<el-table-column :label="this.$t('global.status')" v-if="!(/^\/design\/userlist/.test(this.$route.fullPath))"> border
<template slot-scope="scope"> style="width: 90%;margin-left:5%;margin-top:20px;display: inline-block;"
<el-tag>{{handlerStatus(scope.row)}}</el-tag> >
</template> <el-table-column prop="name" :label="this.$t('planMonitor.runGraphName')" />
</el-table-column> <el-table-column v-if="!(/^\/design\/userlist/.test(this.$route.fullPath))" :label="this.$t('global.status')">
<el-table-column <template slot-scope="scope">
prop="explanation" <el-tag>{{ handlerStatus(scope.row) }}</el-tag>
show-overflow-tooltip </template>
v-if="!(/^\/design\/userlist/.test(this.$route.fullPath))" </el-table-column>
:label="this.$t('planMonitor.explanation')"> <el-table-column
</el-table-column> v-if="!(/^\/design\/userlist/.test(this.$route.fullPath))"
<el-table-column :label="this.$t('planMonitor.creationDate')"> prop="explanation"
<template slot-scope="scope"> show-overflow-tooltip
<el-tag type="success">{{handleTime(scope.row.createTime)}}</el-tag> :label="this.$t('planMonitor.explanation')"
</template> />
</el-table-column> <el-table-column :label="this.$t('planMonitor.creationDate')">
<el-table-column :label="this.$t('global.operate')" width="400"> <template slot-scope="scope">
<template slot-scope="scope"> <el-tag type="success">{{ handleTime(scope.row.createTime) }}</el-tag>
<el-button size="mini" class="button_box" type="success" @click="handleConfirm(scope.row)" v-if="scope.row.status !=='1'">{{$t('planMonitor.load')}}</el-button> </template>
<el-button size="mini" class="button_box" type="primary" @click="handleEdit(scope.row)" v-if="isCreate && scope.row.status !=='1'">{{$t('planMonitor.modifyName')}}</el-button> </el-table-column>
<el-button size="mini" class="button_box" type="danger" @click="handleDelete(scope.row)" v-if="isCreate && scope.row.status !=='1'">{{$t('global.delete')}}</el-button> <el-table-column :label="this.$t('global.operate')" width="400">
<el-button size="mini" class="button_box" type="primary" @click="handlePublish(scope.row)" v-if="isCreate && scope.row.status ==='0'">{{hasRelease?$t('global.release'):$t('planMonitor.applyRelease')}}</el-button> <template slot-scope="scope">
<el-button size="mini" class="button_box" type="primary" @click="handlePreview(scope.row)" v-if="scope.row.status === '1'">{{$t('planMonitor.preview')}}</el-button> <el-button v-if="scope.row.status !=='1'" size="mini" class="button_box" type="success" @click="handleConfirm(scope.row)">{{ $t('planMonitor.load') }}</el-button>
<el-button size="mini" class="button_box" type="danger" @click="handelRevert(scope.row)" v-if="scope.row.status === '1'" >{{$t('planMonitor.revoke')}}</el-button> <el-button v-if="isCreate && scope.row.status !=='1'" size="mini" class="button_box" type="primary" @click="handleEdit(scope.row)">{{ $t('planMonitor.modifyName') }}</el-button>
</template> <el-button v-if="isCreate && scope.row.status !=='1'" size="mini" class="button_box" type="danger" @click="handleDelete(scope.row)">{{ $t('global.delete') }}</el-button>
</el-table-column> <el-button v-if="isCreate && scope.row.status ==='0'" size="mini" class="button_box" type="primary" @click="handlePublish(scope.row)">{{ hasRelease?$t('global.release'):$t('planMonitor.applyRelease') }}</el-button>
</el-table> <el-button v-if="scope.row.status === '1'" size="mini" class="button_box" type="primary" @click="handlePreview(scope.row)">{{ $t('planMonitor.preview') }}</el-button>
<create-empty-plan ref="createEmptyPlan" :plan-convert="PlanConvert" @dispatchDialog="dispatchDialog" @refresh="refresh"/> <el-button v-if="scope.row.status === '1'" size="mini" class="button_box" type="danger" @click="handelRevert(scope.row)">{{ $t('planMonitor.revoke') }}</el-button>
<!-- @dispatchOperate="dispatchOperate" --> </template>
<edit-plan-name ref="editPlan" @renewal="getRunPlanList" /> </el-table-column>
</el-table>
<create-empty-plan ref="createEmptyPlan" :plan-convert="PlanConvert" @dispatchDialog="dispatchDialog" @refresh="refresh" />
<!-- @dispatchOperate="dispatchOperate" -->
<edit-plan-name ref="editPlan" @renewal="getRunPlanList" />
</el-card> </el-card>
</template> </template>
<script> <script>
@ -48,156 +52,154 @@ import { getRpListByMapId, deleteRunPlan } from '@/api/runplan';
import { launchFullscreen } from '@/utils/screen'; import { launchFullscreen } from '@/utils/screen';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
export default { export default {
name: 'userRunPlanList', name: 'UserRunPlanList',
components: { components: {
CreateEmptyPlan, CreateEmptyPlan,
EditPlanName EditPlanName
// LimitList // LimitList
}, },
filters: { filters: {
}, },
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
// height: 260, // height: 260,
// planId: '', // planId: '',
// planName: '', // planName: '',
type: 'add', type: 'add',
// defaultShowKeys: [], // defaultShowKeys: [],
runPlanList: [], runPlanList: [],
runPlanDict: {}, runPlanDict: {},
isCreate:false, isCreate:false,
PlanConvert: {} PlanConvert: {}
// defaultProps: { // defaultProps: {
// label: 'name' // label: 'name'
// } // }
}; };
}, },
computed: { computed: {
height() { height() {
return this.$store.state.app.height - 60 -30; return this.$store.state.app.height - 60 - 30;
}, },
skinCode() { skinCode() {
return this.$route.query.skinCode || '02'; return this.$route.query.skinCode || '02';
}, },
hasRelease() { hasRelease() {
return this.$store.state.user.roles.includes('04') || return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05'); this.$store.state.user.roles.includes('05');
} }
}, },
created(){ watch: {
this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.skinCode); '$route' () {
}, this.getRunPlanList();
mounted(){ }
this.getRunPlanList(); },
}, created() {
watch: { this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.skinCode);
'$route' () { },
this.getRunPlanList(); mounted() {
} this.getRunPlanList();
}, },
methods:{ methods:{
refresh(){ refresh() {
this.getRunPlanList(); this.getRunPlanList();
}, },
getRunPlanList() { getRunPlanList() {
if(/^\/design\/userlist/.test(this.$route.fullPath)){ if (/^\/design\/userlist/.test(this.$route.fullPath)) {
this.isCreate=false; this.isCreate = false;
getRpListByUserMapId(this.$route.params.mapId).then((resp) => { getRpListByUserMapId(this.$route.params.mapId).then((resp) => {
this.runPlanList = resp.data; this.runPlanList = resp.data;
this.runPlanList.forEach(elem => { this.runPlanList.forEach(elem => {
this.runPlanDict[elem.id] = elem.name; this.runPlanDict[elem.id] = elem.name;
}); });
// this.dialogShow = true; // this.dialogShow = true;
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('planMonitor.openRunPlan.getRunPlanListFail')); this.$messageBox(this.$t('planMonitor.openRunPlan.getRunPlanListFail'));
}); });
} } else {
else{ this.isCreate = true;
this.isCreate=true; getRpListByMapId(this.$route.params.mapId).then((resp) => {
getRpListByMapId(this.$route.params.mapId).then((resp) => { this.runPlanList = resp.data;
this.runPlanList = resp.data; this.runPlanList.forEach(elem => {
this.runPlanList.forEach(elem => { this.runPlanDict[elem.id] = elem.name;
this.runPlanDict[elem.id] = elem.name; });
}); // this.dialogShow = true;
// this.dialogShow = true; }).catch(() => {
}).catch(() => { this.$messageBox(this.$t('planMonitor.openRunPlan.getRunPlanListFail'));
this.$messageBox(this.$t('planMonitor.openRunPlan.getRunPlanListFail')); });
}); }
} },
}, // dispatchOperate(){
// dispatchOperate(){ // this.$refs[operateObj.dialogName][operateObj.operate](operateObj.params);
// this.$refs[operateObj.dialogName][operateObj.operate](operateObj.params); // },
// }, dispatchDialog() {
dispatchDialog(){ this.$refs['createEmptyPlan'].doShow();
this.$refs['createEmptyPlan'].doShow(); },
}, handleCreate() {
handleCreate(){ this.$refs['createEmptyPlan'].doShow();
this.$refs['createEmptyPlan'].doShow(); },
}, handleConfirm(row) {
handleConfirm(row){ this.loadRunPlanData({
this.loadRunPlanData({ planId: row.id,
planId: row.id, skinCode: this.$route.query.skinCode,
skinCode: this.$route.query.skinCode, planName: row.name
planName: row.name });
}); },
}, //
// handleEdit(row) {
handleEdit(row) { if (row.id && row.name) {
if (row.id && row.name) { this.$refs.editPlan.doShow({id: row.id, name: row.name});
this.$refs.editPlan.doShow({id: row.id, name: row.name}); } else {
} else { this.$message.info(this.$t('planMonitor.openRunPlan.pleaseSelectRunplan'));
this.$message.info(this.$t('planMonitor.openRunPlan.pleaseSelectRunplan')); }
} },
}, loadRunPlanData({ refresh, planId, skinCode, planName }) {
loadRunPlanData({ refresh, planId, skinCode, planName }) { if (refresh) {
if (refresh) { this.$store.dispatch('runPlan/refresh');
this.$store.dispatch('runPlan/refresh'); } else {
} else { const query = { skinCode: skinCode, mapId: this.$route.params.mapId, planId: planId, planName: planName };
const query = { skinCode: skinCode, mapId: this.$route.params.mapId, planId: planId, planName: planName }; if (/^\/design\/userlist/.test(this.$route.fullPath)) {
if(/^\/design\/userlist/.test(this.$route.fullPath)){ this.$router.push({ path: `${UrlConfig.plan.usertool}`, query: query });
this.$router.push({ path: `${UrlConfig.plan.usertool}`, query: query }); } else {
} this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
else{ }
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query }); }
} },
} //
}, handleDelete(row) {
// this.$confirm(this.$t('planMonitor.openRunPlan.confirmDeleteRunPlan'), this.$t('tip.hint'), {
handleDelete(row) {
this.$confirm(this.$t('planMonitor.openRunPlan.confirmDeleteRunPlan'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
deleteRunPlan(row.id).then(Response => {
this.$message.success(this.$t('planMonitor.openRunPlan.deleteSuccess'));
// if (row.id === this.$route.query.planId) {
// const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId };
// this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
// }
this.refresh();
// this.doClose();
}).catch(() => {
this.$messageBox(this.$t('tip.deleteOperationGraphFailed'));
});
}).catch(() => { });
},
handlePublish(row) {
this.$confirm(this.hasRelease? this.$t('tip.publishRunPlanTips'):this.$t('tip.applyRunPlanTips'),this.$t('tip.hint'),{
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
if (this.hasRelease){ deleteRunPlan(row.id).then(Response => {
publishRunPlan(row.id,{runPlanName: name}).then(resp => { this.$message.success(this.$t('planMonitor.openRunPlan.deleteSuccess'));
// if (row.id === this.$route.query.planId) {
// const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId };
// this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
// }
this.refresh();
// this.doClose();
}).catch(() => {
this.$messageBox(this.$t('tip.deleteOperationGraphFailed'));
});
}).catch(() => { });
},
handlePublish(row) {
this.$confirm(this.hasRelease ? this.$t('tip.publishRunPlanTips') : this.$t('tip.applyRunPlanTips'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
if (this.hasRelease) {
publishRunPlan(row.id, {runPlanName: name}).then(resp => {
this.$message.success(this.$t('tip.publishRunPlanSuccess')); this.$message.success(this.$t('tip.publishRunPlanSuccess'));
this.refresh(); this.refresh();
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('tip.publishRunPlanFail')); this.$messageBox(this.$t('tip.publishRunPlanFail'));
this.refresh(); this.refresh();
}) });
} else { } else {
releaseOrCancelRunPlan(row.id, '1').then(resp => { releaseOrCancelRunPlan(row.id, '1').then(resp => {
this.$message.success(this.$t('tip.applyRunPlanSuccess')); this.$message.success(this.$t('tip.applyRunPlanSuccess'));
@ -205,58 +207,58 @@ export default {
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('tip.applyRunPlanFail')); this.$messageBox(this.$t('tip.applyRunPlanFail'));
this.refresh(); this.refresh();
}) });
} }
}); });
}, },
handelRevert(row) { handelRevert(row) {
this.$confirm(this.$t('tip.cancelRunPlanTips'),this.$t('tip.hint'),{ this.$confirm(this.$t('tip.cancelRunPlanTips'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type:'warning' type:'warning'
}).then(() => { }).then(() => {
releaseOrCancelRunPlan(row.id,'0').then(resp=> { releaseOrCancelRunPlan(row.id, '0').then(resp=> {
this.$message.success(this.$t('tip.cancelRunPlanSuccess')); this.$message.success(this.$t('tip.cancelRunPlanSuccess'));
this.refresh(); this.refresh();
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('tip.cancelRunPlanFail')) this.$messageBox(this.$t('tip.cancelRunPlanFail'));
this.refresh(); this.refresh();
}) });
}) });
}, },
handlerStatus(row) { handlerStatus(row) {
let lessonStatus = ''; let lessonStatus = '';
switch (row.status){ switch (row.status) {
case '0': case '0':
lessonStatus = this.$t('lesson.notRelease'); lessonStatus = this.$t('lesson.notRelease');
break; break;
case '1': case '1':
lessonStatus = this.$t('lesson.pendingReview'); lessonStatus = this.$t('lesson.pendingReview');
break; break;
case '2': case '2':
lessonStatus = this.$t('lesson.published'); lessonStatus = this.$t('lesson.published');
break; break;
case '3': case '3':
lessonStatus = this.$t('lesson.rejected'); lessonStatus = this.$t('lesson.rejected');
break; break;
} }
return lessonStatus; return lessonStatus;
}, },
handleTime(time) { handleTime(time) {
return time.replace("T"," "); return time.replace('T', ' ');
}, },
handlePreview(row){ handlePreview(row) {
previewRunPlan(row.id).then(resp => { previewRunPlan(row.id).then(resp => {
const query = { const query = {
skinCode: row.skinCode, prdType: '01', group: resp.data, mapId: row.mapId, planId: row.id,from:'' skinCode: row.skinCode, prdType: '01', group: resp.data, mapId: row.mapId, planId: row.id, from:''
}; };
this.$router.push({ path: `${UrlConfig.display}/plan`, query: query }); this.$router.push({ path: `${UrlConfig.display}/plan`, query: query });
launchFullscreen(); launchFullscreen();
}).catch(error => { }).catch(error => {
this.$messageBox(this.$t('tip.createSimulationFaild')+this.$t('global.colon')+error.message); this.$messageBox(this.$t('tip.createSimulationFaild') + this.$t('global.colon') + error.message);
}); });
} }
} }
}; };
</script> </script>
<style scoped> <style scoped>

View File

@ -12,7 +12,7 @@
> >
<div> <div>
<el-tabs v-model="activeTab" type="card"> <el-tabs v-model="activeTab" type="card">
<el-tab-pane :label="this.$t('planMonitor.normalNew')" name="first"> <el-tab-pane :label="this.$t('planMonitor.normalNew')" name="first">
<el-row> <el-row>
<el-form ref="form" :model="newModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent> <el-form ref="form" :model="newModel" label-width="140px" size="mini" :rules="rules" @submit.native.prevent>
<el-form-item :label="this.$t('planMonitor.runGraphName')+this.$t('global.colon')" prop="name"> <el-form-item :label="this.$t('planMonitor.runGraphName')+this.$t('global.colon')" prop="name">
@ -69,196 +69,196 @@ import { UrlConfig } from '@/router/index';
import XLSX from 'xlsx'; import XLSX from 'xlsx';
export default { export default {
name: 'CreateEmptyPlan', name: 'CreateEmptyPlan',
components: { components: {
}, },
props: { props: {
planConvert: { planConvert: {
type: Object, type: Object,
default: function() { default: function() {
return { }; return { };
} }
} }
}, },
data() { data() {
return { return {
activeTab: 'second', activeTab: 'second',
dialogShow: false, dialogShow: false,
loading: false, loading: false,
loadingDig: null, loadingDig: null,
publishMapList: [], publishMapList: [],
newModel: { newModel: {
name: '', name: '',
skinCode: this.$route.query.skinCode skinCode: this.$route.query.skinCode
}, },
pullModel: { pullModel: {
templateId: '', templateId: '',
name: '', name: '',
skinCode: this.$route.query.skinCode skinCode: this.$route.query.skinCode
} }
}; };
}, },
computed: { computed: {
title() { title() {
return this.$t('planMonitor.newRunGraph'); return this.$t('planMonitor.newRunGraph');
}, },
rules() { rules() {
return { return {
name: [ name: [
{ required: true, message: this.$t('rules.enterTheNameOfTheRunGraph'), trigger: 'blur' } { required: true, message: this.$t('rules.enterTheNameOfTheRunGraph'), trigger: 'blur' }
] ]
}; };
}, },
pullRules() { pullRules() {
return { return {
templateId: [ templateId: [
{ required: true, message: this.$t('rules.chooseToPublishTheRunGraph'), trigger: 'change' } { required: true, message: this.$t('rules.chooseToPublishTheRunGraph'), trigger: 'change' }
], ],
name: [ name: [
{ required: true, message: this.$t('rules.enterTheNameOfTheRunGraph'), trigger: 'blur' } { required: true, message: this.$t('rules.enterTheNameOfTheRunGraph'), trigger: 'blur' }
] ]
}; };
} }
}, },
mounted() { mounted() {
}, },
methods: { methods: {
async initLoad() { async initLoad() {
const res = await queryRunPlanList(this.$route.query.skinCode); const res = await queryRunPlanList(this.$route.params.mapId);
if (res.code == 200 && res.data.length) { if (res.code == 200 && res.data.length) {
this.publishMapList = res.data; this.publishMapList = res.data;
} }
}, },
doShow() { doShow() {
this.dialogShow = true; this.dialogShow = true;
this.initLoad(); this.initLoad();
}, },
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.newModel.name = ''; this.newModel.name = '';
this.pullModel.templateId = ''; this.pullModel.templateId = '';
this.pullModel.name = ''; this.pullModel.name = '';
if (this.$refs.form) { if (this.$refs.form) {
this.$refs.form.resetFields(); this.$refs.form.resetFields();
} }
if (this.$refs.pullForm) { if (this.$refs.pullForm) {
this.$refs.pullForm.resetFields(); this.$refs.pullForm.resetFields();
} }
}, },
handleCommit() { handleCommit() {
if (this.activeTab === 'first') { if (this.activeTab === 'first') {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
this.loading = true; this.loading = true;
createEmptyPlan(this.newModel).then(resp => { createEmptyPlan(this.newModel).then(resp => {
const params = { const params = {
dialogName: 'openRunPlan', dialogName: 'openRunPlan',
operate: 'loadRunPlanData', operate: 'loadRunPlanData',
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.newModel.name, refresh: true } params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.newModel.name, refresh: true }
}; };
this.$emit('refresh'); this.$emit('refresh');
// this.$emit('dispatchOperate', params); // this.$emit('dispatchOperate', params);
this.$message.success(this.$t('tip.createAnEmptyRunGraphSuccessfully')); this.$message.success(this.$t('tip.createAnEmptyRunGraphSuccessfully'));
// this.jump(resp.data, this.newModel.name); // this.jump(resp.data, this.newModel.name);
this.doClose(); this.doClose();
}).catch((error) => { }).catch((error) => {
this.$messageBox(this.$t('error.createOperationGraphFailed')+ this.$t('global.colon') + error.message); this.$messageBox(this.$t('error.createOperationGraphFailed') + this.$t('global.colon') + error.message);
this.doClose(); this.doClose();
}); });
} }
}); });
} else { } else {
this.$refs['pullForm'].validate((valid) => { this.$refs['pullForm'].validate((valid) => {
if (valid) { if (valid) {
this.loading = true; this.loading = true;
postCreatePlan(this.pullModel).then(resp => { postCreatePlan(this.pullModel).then(resp => {
this.$message.success(this.$t('tip.createARunGraphSuccessfully')); this.$message.success(this.$t('tip.createARunGraphSuccessfully'));
// this.jump(resp.data, this.pullModel.name); // this.jump(resp.data, this.pullModel.name);
this.$emit('refresh'); this.$emit('refresh');
this.doClose(); this.doClose();
}).catch((error) => { }).catch((error) => {
this.$messageBox(this.$t('error.createOperationGraphFailed')+ this.$t('global.colon') + error.message); this.$messageBox(this.$t('error.createOperationGraphFailed') + this.$t('global.colon') + error.message);
this.doClose(); this.doClose();
}); });
} }
}); });
} }
}, },
importf(item) { importf(item) {
const obj = this.$refs.files; const obj = this.$refs.files;
if (obj.files) { if (obj.files) {
const file = obj.files[0]; const file = obj.files[0];
this.handleImportRunPlan(file); this.handleImportRunPlan(file);
obj.value = ''; obj.value = '';
} }
}, },
loadingScreen() { loadingScreen() {
this.loadingDig = this.$loading({ this.loadingDig = this.$loading({
lock: true, lock: true,
text: this.$t('tip.underImport'), text: this.$t('tip.underImport'),
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}); });
}, },
// //
handleImportRunPlan(file) { handleImportRunPlan(file) {
if (file) { if (file) {
this.loadingScreen(); this.loadingScreen();
setTimeout(() => { setTimeout(() => {
const that = this; const that = this;
const reader = new FileReader(); const reader = new FileReader();
if (reader) { if (reader) {
reader.onload = function (e) { reader.onload = function (e) {
let wb; let wb;
const data = e.target.result; const data = e.target.result;
if (that.rABS) { if (that.rABS) {
wb = XLSX.read(btoa(that.fixdata(data)), { // wb = XLSX.read(btoa(that.fixdata(data)), { //
type: 'base64' type: 'base64'
}); });
} else { } else {
wb = XLSX.read(data, { wb = XLSX.read(data, {
type: 'binary' type: 'binary'
}); });
} }
if (wb) { if (wb) {
try { try {
let jsonData = []; let jsonData = [];
for (const index in wb.Sheets) { for (const index in wb.Sheets) {
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData); jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
} }
importRunPlan({ mapId: that.$route.params.mapId || '02', runPlanList: jsonData }).then(response => { importRunPlan({ mapId: that.$route.params.mapId || '02', runPlanList: jsonData }).then(response => {
that.loadingDig.close(); that.loadingDig.close();
that.$message.success(that.$t('tip.importOperationGraphSuccessfully')); that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} }); // this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
}).catch(error => { }).catch(error => {
that.loadingDig.close(); that.loadingDig.close();
that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`); that.$message.warning(`${that.$t('tip.importRunGraphFailed')} ${error.message}`);
}); });
} catch (error) { } catch (error) {
that.loadingDig.close(); that.loadingDig.close();
that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`); that.$message.warning(`${that.$t('tip.parseRunGraphFailed')} ${error.message}`);
} }
} }
}; };
if (that.rABS) { if (that.rABS) {
reader.readAsArrayBuffer(file); reader.readAsArrayBuffer(file);
} else { } else {
reader.readAsBinaryString(file); reader.readAsBinaryString(file);
} }
} }
}, 200); }, 200);
} }
this.doClose(); this.doClose();
}, },
jump(planId, planName) { jump(planId, planName) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName }; const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query }); this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

File diff suppressed because it is too large Load Diff

View File

@ -28,22 +28,22 @@ import home2 from '@/assets/home/plan2.png';
import home3 from '@/assets/home/plan3.png'; import home3 from '@/assets/home/plan3.png';
export default { export default {
name: 'Home', name: 'Home',
data() { data() {
return { return {
listImg: [ listImg: [
{ src: home1 }, { src: home1 },
{ src: home2 }, { src: home2 },
{ src: home3 } { src: home3 }
], ],
logo: logo logo: logo
}; };
}, },
computed: { computed: {
height() { height() {
return this.$store.state.app.height; return this.$store.state.app.height;
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -19,38 +19,38 @@ import drapLeft from '@/views/components/drapLeft/index';
import localStore from 'storejs'; import localStore from 'storejs';
export default { export default {
name: 'Exam', name: 'Exam',
components: { components: {
planList, planList,
drapLeft drapLeft
}, },
data() { data() {
return { return {
listShow: true, listShow: true,
widthLeft: Number(localStore.get('LeftWidth')) || 450 widthLeft: Number(localStore.get('LeftWidth')) || 450
}; };
}, },
computed: { computed: {
...mapGetters([ ...mapGetters([
'lessonbar' 'lessonbar'
]), ]),
height() { height() {
return this.$store.state.app.height; return this.$store.state.app.height;
} }
}, },
watch: { watch: {
'lessonbar.opened': function (val) { 'lessonbar.opened': function (val) {
this.listShow = val; this.listShow = val;
} }
}, },
methods: { methods: {
refresh() { refresh() {
this.$refs && this.$refs.planList && this.$refs.planList.refresh(); this.$refs && this.$refs.planList && this.$refs.planList.refresh();
}, },
drapWidth(width) { drapWidth(width) {
this.widthLeft = Number(width); this.widthLeft = Number(width);
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -15,174 +15,174 @@ import MapSelect from './mapSelect';
import CopyPlan from './copyPlan.vue'; import CopyPlan from './copyPlan.vue';
export default { export default {
name: 'RunPlanTemplate', name: 'RunPlanTemplate',
components: { components: {
MapSelect, MapSelect,
CopyPlan CopyPlan
}, },
data() { data() {
return { return {
skinCodeList: [], skinCodeList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
labelWidth: '140px', labelWidth: '140px',
reset: true, reset: true,
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: this.$t('publish.runPlanName') label: this.$t('publish.runPlanName')
}, },
skinCode: { skinCode: {
type: 'select', type: 'select',
label: this.$t('publish.skinType'), label: this.$t('publish.skinType'),
config: { config: {
data: [] data: []
} }
} }
} }
}, },
queryList: { queryList: {
query: runPlanTemplateList, query: runPlanTemplateList,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: this.$t('publish.runPlanName'), title: this.$t('publish.runPlanName'),
prop: 'name' prop: 'name'
}, },
{ {
title: this.$t('publish.skinType'), title: this.$t('publish.skinType'),
prop: 'skinCode', prop: 'skinCode',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
}, },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{ {
title: this.$t('publish.createTime'), title: this.$t('publish.createTime'),
prop: 'createTime' prop: 'createTime'
}, },
{ {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),
width: '450', width: '450',
hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; }, hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; },
buttons: [ buttons: [
{ {
name: this.$t('global.delete'), name: this.$t('global.delete'),
handleClick: this.handleDelete, handleClick: this.handleDelete,
type: 'danger' type: 'danger'
}, },
{ {
name: this.$t('publish.generateRunPlan'), name: this.$t('publish.generateRunPlan'),
handleClick: this.handleMapSelect, handleClick: this.handleMapSelect,
type: '' type: ''
}, },
{ {
name: this.$t('publish.copyRunPlan'), name: this.$t('publish.copyRunPlan'),
handleClick: this.handleCopyPlan, handleClick: this.handleCopyPlan,
type: '' type: ''
}, },
{ {
name: this.$t('global.preview'), name: this.$t('global.preview'),
handleClick: this.handleView, handleClick: this.handleView,
type: '' type: ''
} }
] ]
} }
] ]
}, },
currentModel: {} currentModel: {}
}; };
}, },
created() { created() {
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.skinCodeList = []; this.skinCodeList = [];
getSkinCodeList().then(response => { getSkinCodeList().then(response => {
this.skinCodeList = response.data; this.skinCodeList = response.data;
response.data.forEach(elem => { response.data.forEach(elem => {
this.queryForm.queryObject.skinCode.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.skinCode.config.data.push({ value: elem.code, label: elem.name });
}); });
}); });
}, },
// //
handleDelete(index, row) { handleDelete(index, row) {
this.$confirm(this.$t('publish.wellDelTemplate'), this.$t('global.tips'), { this.$confirm(this.$t('publish.wellDelTemplate'), 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(() => {
deleteRunPlanTemplate(row.id).then(response => { deleteRunPlanTemplate(row.id).then(response => {
this.$message.success(this.$t('publish.deleteSuccess')); this.$message.success(this.$t('publish.deleteSuccess'));
this.reloadTable(); this.reloadTable();
}).catch(error => { }).catch(error => {
this.reloadTable(); this.reloadTable();
if (error.code == 500) { if (error.code == 500) {
this.$messageBox(this.$t('error.deleteFailed')); this.$messageBox(this.$t('error.deleteFailed'));
} else if (error.code == 500009) { } else if (error.code == 500009) {
this.$messageBox(this.$t('error.templateHasBeUse')); this.$messageBox(this.$t('error.templateHasBeUse'));
} }
}); });
}).catch(() => { }); }).catch(() => { });
}, },
// //
handleMapSelect(index, row) { handleMapSelect(index, row) {
this.$refs.map.doShow(row); this.$refs.map.doShow(row);
}, },
// //
handleCopyPlan(index, row) { handleCopyPlan(index, row) {
this.$refs.copyPlan.doShow(row); this.$refs.copyPlan.doShow(row);
}, },
// //
handleGenerateEveryDay({planId, mapId}) { handleGenerateEveryDay({planId, mapId}) {
this.$confirm(this.$t('publish.wellGenerateEveryRunPlan'), this.$t('global.tips'), { this.$confirm(this.$t('publish.wellGenerateEveryRunPlan'), 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(() => {
generateCommonRunPlanEveryDay(planId, {mapId}).then(response => { generateCommonRunPlanEveryDay(planId, {mapId}).then(response => {
this.reloadTable(); this.reloadTable();
this.$refs.map.doClose(); this.$refs.map.doClose();
this.$message.success(this.$t('publish.createCommonSuccess')); this.$message.success(this.$t('publish.createCommonSuccess'));
}).catch(() => { }).catch(() => {
this.reloadTable(); this.reloadTable();
this.$messageBox(this.$t('error.operationFailure')); this.$messageBox(this.$t('error.operationFailure'));
}); });
}).catch(() => { }); }).catch(() => { });
}, },
// //
handleCopyRunPlan(data) { handleCopyRunPlan(data) {
this.$confirm(this.$t('publish.copyRunPlanContinue'), this.$t('global.tips'), { this.$confirm(this.$t('publish.copyRunPlanContinue'), 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(() => {
postRunPlanTemplate({ id: data.id, skinCode: data.skinCode, name: data.name }).then(response => { postRunPlanTemplate({ id: data.id, skinCode: data.skinCode, name: data.name }).then(response => {
this.reloadTable(); this.reloadTable();
this.$refs.copyPlan.doClose(); this.$refs.copyPlan.doClose();
this.$message.success(this.$t('publish.createCommonSuccess')); this.$message.success(this.$t('publish.createCommonSuccess'));
}).catch(() => { }).catch(() => {
this.reloadTable(); this.reloadTable();
this.$messageBox(this.$t('error.operationFailure')); this.$messageBox(this.$t('error.operationFailure'));
}); });
}).catch(() => { }); }).catch(() => { });
}, },
// //
handleView(index, row) { handleView(index, row) {
this.$router.push({ path: `${UrlConfig.publish.runPlanView}/template`, query: { skinCode: row.skinCode, planId: row.id } }); this.$router.push({ path: `${UrlConfig.publish.runPlanView}/template`, query: { skinCode: row.skinCode, planId: row.id, mapId: row.mapId } });
}, },
reloadTable() { reloadTable() {
this.queryList.reload(); this.queryList.reload();
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -11,366 +11,366 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getStationListBySkinCode, queryRunPlan, queryRunPlanTemplate, queryRunPlanDaily } from '@/api/runplan'; import { getStationList, queryRunPlan, queryRunPlanTemplate, queryRunPlanDaily } from '@/api/runplan';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
export default { export default {
name: 'RunPlan', name: 'RunPlan',
data() { data() {
return { return {
runPlanId: 'main', runPlanId: 'main',
myChart: null, myChart: null,
PlanConvert: {}, PlanConvert: {},
option: { option: {
title: { title: {
text: '', text: '',
left: 'center' left: 'center'
}, },
grid: { grid: {
top: '30px', top: '30px',
left: '120px', left: '120px',
right: '2%', right: '2%',
bottom: '80px', bottom: '80px',
containLabel: true, containLabel: true,
backgroundColor: 'floralwhite' backgroundColor: 'floralwhite'
}, },
toolbox: { toolbox: {
right: '2%', right: '2%',
feature: { feature: {
dataZoom: { dataZoom: {
yAxisIndex: 'none' yAxisIndex: 'none'
}, },
restore: {}, restore: {},
saveAsImage: {} saveAsImage: {}
} }
}, },
tooltip: { tooltip: {
axisPointer: { axisPointer: {
trigger: 'item', trigger: 'item',
type: 'cross' type: 'cross'
}, },
formatter: this.axisTooltip, formatter: this.axisTooltip,
borderWidth: 1 borderWidth: 1
}, },
xAxis: [ xAxis: [
{ {
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: [], data: [],
axisLine: { axisLine: {
onZero: false, onZero: false,
lineStyle: { lineStyle: {
width: 2, width: 2,
color: '#d14a61' color: '#d14a61'
} }
}, },
axisLabel: { axisLabel: {
formatter: this.xAxisLableFormat, formatter: this.xAxisLableFormat,
textStyle: { textStyle: {
color: '#333' color: '#333'
} }
}, },
axisPointer: { axisPointer: {
snap: true, snap: true,
label: { label: {
formatter: this.xAxisPointFormat, formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)', backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white' color: 'white'
} }
} }
} }
], ],
yAxis: { yAxis: {
type: 'value', type: 'value',
splitLine: { splitLine: {
show: false show: false
}, },
axisTick: { axisTick: {
show: false show: false
}, },
axisLine: { axisLine: {
onZero: false, onZero: false,
lineStyle: { lineStyle: {
width: 2, width: 2,
color: '#d14a61' color: '#d14a61'
} }
}, },
axisLabel: { axisLabel: {
interval: 'auto', interval: 'auto',
formatter: this.yAxisLableFormat formatter: this.yAxisLableFormat
}, },
axisPointer: { axisPointer: {
xAxisIndex: 'all', xAxisIndex: 'all',
label: { label: {
formatter: this.yAxisPointFormat, formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)', backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white' color: 'white'
} }
}, },
min: 0, min: 0,
max: 0 max: 0
}, },
series: [], series: [],
dataZoom: [ dataZoom: [
{ {
type: 'inside' type: 'inside'
}, },
{ {
fiterMode: 'filter', fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z', handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%', handleSize: '80%',
handleStyle: { handleStyle: {
color: '#fff', color: '#fff',
shadowBlur: 3, shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)', shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2, shadowOffsetX: 2,
shadowOffsetY: 2 shadowOffsetY: 2
}, },
bottom: '25px' bottom: '25px'
} }
] ]
}, },
kmRangeCoordMap: {} kmRangeCoordMap: {}
}; };
}, },
computed: { computed: {
...mapGetters('runPlan', [ ...mapGetters('runPlan', [
'stations' 'stations'
]), ]),
isShowBack() { isShowBack() {
if (this.$route.params.mode !== 'draft') { if (this.$route.params.mode !== 'draft') {
return true; return true;
} }
return false; return false;
}, },
mode() { mode() {
return this.$route.params.mode; return this.$route.params.mode;
}, },
width() { width() {
return this.$store.state.app.width; return this.$store.state.app.width;
}, },
height() { height() {
return this.$store.state.app.height; return this.$store.state.app.height;
} }
}, },
watch: { watch: {
'$store.state.runPlan.planSizeCount': function () { '$store.state.runPlan.planSizeCount': function () {
this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height }); this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height });
}, },
'$store.state.app.windowSizeCount': function() { '$store.state.app.windowSizeCount': function() {
this.setPlanSize(); this.setPlanSize();
}, },
$route() { $route() {
this.$nextTick(() => { this.$nextTick(() => {
this.loadChartPage(this.$route.query); this.loadChartPage(this.$route.query);
}); });
} }
}, },
mounted() { mounted() {
this.setPlanSize(); this.setPlanSize();
this.loadChartPage(this.$route.query); this.loadChartPage(this.$route.query);
}, },
beforeDestroy() { beforeDestroy() {
this.destroy(); this.destroy();
}, },
methods: { methods: {
loadChartPage(opt) { loadChartPage(opt) {
this.PlanConvert = this.$theme.loadPlanConvert(opt.skinCode); this.PlanConvert = this.$theme.loadPlanConvert(opt.skinCode);
this.$store.dispatch('runPlan/clear').then(resp => { this.$store.dispatch('runPlan/clear').then(resp => {
this.loadInitChart().then(() => { this.loadInitChart().then(() => {
if (opt.skinCode && opt.planId) { if (opt.mapId && opt.planId) {
this.myChart && this.myChart.showLoading(); this.myChart && this.myChart.showLoading();
getStationListBySkinCode(opt.skinCode).then(response => { getStationList(opt.mapId).then(response => {
this.$store.dispatch('runPlan/setStations', response.data).then(() => { this.$store.dispatch('runPlan/setStations', response.data).then(() => {
let queryFunc = null; let queryFunc = null;
const params = opt.planId; const params = opt.planId;
switch (this.mode) { switch (this.mode) {
case 'common': queryFunc = queryRunPlanTemplate; break; case 'common': queryFunc = queryRunPlanTemplate; break;
case 'template': queryFunc = queryRunPlanTemplate; break; case 'template': queryFunc = queryRunPlanTemplate; break;
case 'everyDay': queryFunc = queryRunPlanDaily; break; case 'everyDay': queryFunc = queryRunPlanDaily; break;
default: queryFunc = queryRunPlan; break; default: queryFunc = queryRunPlan; break;
} }
queryFunc(params).then(resp => { queryFunc(params).then(resp => {
this.loadChartData(resp.data); this.loadChartData(resp.data);
this.myChart && this.myChart.hideLoading(); this.myChart && this.myChart.hideLoading();
}).catch(() => { }).catch(() => {
this.myChart && this.myChart.hideLoading(); this.myChart && this.myChart.hideLoading();
this.$messageBox(this.$t('error.obtainOperationGraphFailed')); this.$messageBox(this.$t('error.obtainOperationGraphFailed'));
}); });
}); });
}).catch(() => { }).catch(() => {
this.myChart && this.myChart.hideLoading(); this.myChart && this.myChart.hideLoading();
this.$messageBox(this.$t('error.obtainStationListFailed')); this.$messageBox(this.$t('error.obtainStationListFailed'));
}); });
} }
}); });
}); });
}, },
async loadChartData(data) { async loadChartData(data) {
try { try {
this.option.title.text = data.planName; this.option.title.text = data.planName;
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(this.stations); this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(this.stations);
this.option.series = []; this.option.series = [];
this.pushModels(this.option.series, [this.PlanConvert.initializeYaxis(this.stations)]); this.pushModels(this.option.series, [this.PlanConvert.initializeYaxis(this.stations)]);
this.pushModels(this.option.series, this.PlanConvert.convertDataToModels(data, this.stations, this.kmRangeCoordMap, { width: 1 })); this.pushModels(this.option.series, this.PlanConvert.convertDataToModels(data, this.stations, this.kmRangeCoordMap, { width: 1 }));
this.loadInitData(); this.loadInitData();
} catch (error) { } catch (error) {
this.$messageBox(this.$t('error.loadingOperationGraphFailed')); this.$messageBox(this.$t('error.loadingOperationGraphFailed'));
} }
}, },
async loadInitData() { async loadInitData() {
await this.xAxisInit(); await this.xAxisInit();
await this.yAxisInit(); await this.yAxisInit();
await this.loadInitChart(); await this.loadInitChart();
}, },
xAxisPointFormat(params) { xAxisPointFormat(params) {
return timeFormat(params.value); return timeFormat(params.value);
}, },
yAxisPointFormat(params) { yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params); return this.PlanConvert.computedFormatYAxis(this.stations, params);
}, },
xAxisLableFormat(value, index) { xAxisLableFormat(value, index) {
if (value % 60 === 0) { if (value % 60 === 0) {
return timeFormat(parseInt(value)); return timeFormat(parseInt(value));
} }
}, },
yAxisLableFormat(value, index) { yAxisLableFormat(value, index) {
return ''; return '';
}, },
xAxisInit() { xAxisInit() {
const list = []; const list = [];
for (var time = this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) { for (var time = this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time); list.push(time);
} }
this.option.xAxis[0].data = list; this.option.xAxis[0].data = list;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = 3600 * 6 - 600 + this.PlanConvert.TranslationTime; this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = 3600 * 6 - 600 + this.PlanConvert.TranslationTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = 3600 * 8 + 600 + this.PlanConvert.TranslationTime; this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = 3600 * 8 + 600 + this.PlanConvert.TranslationTime;
}, },
yAxisInit() { yAxisInit() {
if (Object.keys(this.PlanConvert).length) { if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations); this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations); this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
} }
}, },
pushModels(series, models) { pushModels(series, models) {
if (models && models.length) { if (models && models.length) {
models.forEach(elem => { models.forEach(elem => {
if (elem) { if (elem) {
series.push(elem); series.push(elem);
} }
}); });
} }
return series; return series;
}, },
popModels(series, models) { popModels(series, models) {
if (models && models.length) { if (models && models.length) {
models.forEach(elem => { models.forEach(elem => {
const index = series.indexOf(elem); const index = series.indexOf(elem);
if (index >= 0) { if (index >= 0) {
series.split(index, 1); series.split(index, 1);
} }
}); });
} }
return series; return series;
}, },
loadInitChart() { loadInitChart() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
const that = this; const that = this;
// echart // echart
require.config( require.config(
{ {
paths: { paths: {
echarts: './js/dist' echarts: './js/dist'
} }
} }
); );
// //
require( require(
[ [
'echarts', 'echarts',
'echarts/lib/chart/line' 'echarts/lib/chart/line'
], ],
function (ec) { function (ec) {
if (that.myChart && that.myChart.isDisposed) { if (that.myChart && that.myChart.isDisposed) {
that.myChart.clear(); that.myChart.clear();
} }
that.myChart = ec.init(document.getElementById(that.runPlanId)); that.myChart = ec.init(document.getElementById(that.runPlanId));
that.myChart.setOption(that.option); that.myChart.setOption(that.option);
that.reSize({ width: that.$store.state.runPlan.width, height: that.$store.state.runPlan.height }); that.reSize({ width: that.$store.state.runPlan.width, height: that.$store.state.runPlan.height });
// that.myChart.on('click', that.mouseClick); // that.myChart.on('click', that.mouseClick);
resolve(true); resolve(true);
} }
); );
} catch (error) { } catch (error) {
reject(error); reject(error);
} }
}); });
}, },
axisTooltip(param) { axisTooltip(param) {
if (param.data[1] >= this.option.yAxis.min + this.PlanConvert.EdgeHeight && param.data[1] <= this.option.yAxis.max - this.PlanConvert.EdgeHeight) { if (param.data[1] >= this.option.yAxis.min + this.PlanConvert.EdgeHeight && param.data[1] <= this.option.yAxis.max - this.PlanConvert.EdgeHeight) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' }; const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [ return [
`Point Data <hr size=1 style="margin: 3px 0">`, `Point Data <hr size=1 style="margin: 3px 0">`,
`${this.$t('map.stationName')}: ${station.name}<br>`, `${this.$t('map.stationName')}: ${station.name}<br>`,
`${this.$t('map.stationKilometerMark')}: ${station.kmRange} km <br>`, `${this.$t('map.stationKilometerMark')}: ${station.kmRange} km <br>`,
`${this.$t('map.arrivalTime')}: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>` `${this.$t('map.arrivalTime')}: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join(''); ].join('');
} }
}, },
mouseClick(params) { mouseClick(params) {
}, },
settingExac(data) { settingExac(data) {
this.myChart && this.myChart.setOption({ this.myChart && this.myChart.setOption({
xAxis: this.option.xAxis, xAxis: this.option.xAxis,
yAxis: this.option.yAxis yAxis: this.option.yAxis
}); });
this.myChart && this.myChart.dispatchAction({ this.myChart && this.myChart.dispatchAction({
type: 'dataZoom', type: 'dataZoom',
dataZoomIndex: [0, 1], dataZoomIndex: [0, 1],
startValue: parseInt(data.startValue / 1000), startValue: parseInt(data.startValue / 1000),
endValue: parseInt(data.endValue / 1000) endValue: parseInt(data.endValue / 1000)
}); });
}, },
reSize(opt) { reSize(opt) {
if (this.myChart) { if (this.myChart) {
this.myChart.resize({ this.myChart.resize({
width: opt.width, width: opt.width,
height: opt.height, height: opt.height,
silent: false silent: false
}); });
} }
}, },
setPlanSize() { setPlanSize() {
this.$nextTick(() => { this.$nextTick(() => {
if (this.mode !== 'draft') { if (this.mode !== 'draft') {
this.$store.dispatch('runPlan/resize', { width: this.width, height: this.height - 130 }); this.$store.dispatch('runPlan/resize', { width: this.width, height: this.height - 130 });
} else { } else {
this.$store.dispatch('runPlan/resize', { width: this.$store.state.runPlan.width, height: this.height - 60 }); this.$store.dispatch('runPlan/resize', { width: this.$store.state.runPlan.width, height: this.height - 60 });
} }
}); });
}, },
destroy() { destroy() {
if (this.myChart && this.myChart.isDisposed) { if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose(); this.myChart.dispose();
this.myChart = null; this.myChart = null;
} }
}, },
back() { back() {
if (this.$route.params.mode === 'everyDay') { if (this.$route.params.mode === 'everyDay') {
this.$router.replace({ path: `${UrlConfig.publish.runPlanEveryDay}` }); this.$router.replace({ path: `${UrlConfig.publish.runPlanEveryDay}` });
} else if (this.$route.params.mode === 'template') { } else if (this.$route.params.mode === 'template') {
this.$router.replace({ path: `${UrlConfig.publish.runPlanTemplate}` }); this.$router.replace({ path: `${UrlConfig.publish.runPlanTemplate}` });
} else if (this.$route.params.mode === 'common') { } else if (this.$route.params.mode === 'common') {
this.$router.replace({ path: `${UrlConfig.publish.runPlanCommon}` }); this.$router.replace({ path: `${UrlConfig.publish.runPlanCommon}` });
} else { } else {
this.$router.go(-1); this.$router.go(-1);
} }
} }
} }
}; };
</script> </script>

View File

@ -3,6 +3,7 @@
<div class="clearfix"> <div class="clearfix">
<span>{{ $t('map.productCategories') }}</span> <span>{{ $t('map.productCategories') }}</span>
</div> </div>
<filter-city ref="filerCity" filter-empty :query-function="queryFunction" :local-param-name="localParamName" @filterSelectChange="refresh" />
<el-input v-model="filterText" :placeholder="$t('tip.enterKeywordsFiltering')" clearable /> <el-input v-model="filterText" :placeholder="$t('tip.enterKeywordsFiltering')" clearable />
<div style="height: calc(100% - 87px);"> <div style="height: calc(100% - 87px);">
<el-tree <el-tree
@ -29,13 +30,18 @@
</div> </div>
</template> </template>
<script> <script>
import { getProductTree } from '@/api/management/mapprd'; import { getPublishMapTree } from '@/api/management/mapprd';
import FilterCity from '@/views/components/filterCity';
export default { export default {
name: 'TreeOperate', name: 'TreeOperate',
components: {
FilterCity
},
data() { data() {
return { return {
loading: true, loading: true,
queryFunction: getPublishMapTree,
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'name' label: 'name'
@ -46,7 +52,8 @@ export default {
point: { point: {
x: 0, x: 0,
y: 0 y: 0
} },
localParamName: 'product_cityCode'
}; };
}, },
watch: { watch: {
@ -54,9 +61,6 @@ export default {
this.$refs.trainingTree.filter(val); this.$refs.trainingTree.filter(val);
} }
}, },
mounted() {
this.refresh();
},
methods: { methods: {
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
@ -90,14 +94,19 @@ export default {
} }
return tree; return tree;
}, },
refresh() { async refresh(filterSelect) {
getProductTree().then(response => { console.log(filterSelect, '==========');
this.treeData = this.convertTreeData(response.data); this.loading = true;
this.$nextTick(() => { this.loading = false; }); try {
}).catch(() => { const res = await getPublishMapTree(filterSelect);
this.$messageBox(this.$t('tip.refreshFailure')); this.treeData = this.convertTreeData(res.data);
this.$nextTick(() => {
this.loading = false;
});
} catch (error) {
this.loading = false; this.loading = false;
}); this.$messageBox(this.$t('error.refreshFailed'));
}
} }
} }
}; };

View File

@ -1,144 +1,140 @@
<template> <template>
<div> <div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center> <el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{$t('global.confirm')}}</el-button> <el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{$t('global.cancel')}}</el-button> <el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { listPublishMap } from '@/api/jmap/map'; import { listPublishMap } from '@/api/jmap/map';
import { getCommodityMapProduct } from '@/api/management/mapprd'; import { getCommodityMapProduct } from '@/api/management/mapprd';
export default { export default {
name: 'OnceGenerate', name: 'OnceGenerate',
data() { props: {
return { title: String,
dialogVisible: false, operateType:String
mapList: [], },
disabled:null, data() {
productList:[], return {
mapInfoList:[], dialogVisible: false,
projectList:[], mapList: [],
typeList:[], disabled:null,
formModel:{ productList:[],
mapId:'', mapInfoList:[],
name: "", projectList:[],
prdCode: "", typeList:[],
type: "", formModel:{
id:null, mapId:'',
} name: '',
prdCode: '',
type: '',
id:null
} }
}, };
mounted() { },
this.loadInitData(); computed: {
}, form() {
props: { let form = {};
title: String, if (this.operateType == 'add') {
operateType:String form = {
}, labelWidth: '150px',
computed: { items: [
form() { { prop: 'customized', label: this.$t('systemGenerate.customized'), type: 'select', required: true, options: this.projectList},
let form={}; { prop: 'mapId', label: this.$t('systemGenerate.mapName'), type: 'select', required: true, options: this.mapList, change:true, onChange:this.changeMap},
if(this.operateType=="add"){ { prop: 'prdCode', label: this.$t('systemGenerate.prdName'), type: 'select', required: true, options:this.productList},
form={ { prop: 'name', label: this.$t('systemGenerate.name'), type: 'text', required: true},
labelWidth: '150px', { prop: 'type', label: this.$t('systemGenerate.type'), type: 'select', required: true, options: this.typeList}
items: [ ]
{ prop: 'customized', label: this.$t('systemGenerate.customized'), type: 'select', required: true,options: this.projectList}, };
{ prop: 'mapId', label: this.$t('systemGenerate.mapName'), type: 'select', required: true,options: this.mapList,change:true,onChange:this.changeMap}, } else {
{ prop: 'prdCode', label: this.$t('systemGenerate.prdName'), type: 'select', required: true,options:this.productList}, form = {
{ prop: 'name', label: this.$t('systemGenerate.name'), type: 'text', required: true,}, labelWidth: '150px',
{ prop: 'type', label: this.$t('systemGenerate.type'), type: 'select', required: true,options: this.typeList}, items: [
] { prop: 'name', label: this.$t('systemGenerate.name'), type: 'text', required: true}
} ]
} };
else{
form={
labelWidth: '150px',
items: [
{ prop: 'name', label: this.$t('systemGenerate.name'), type: 'text', required: true,},
]
}
}
return form
},
rules() {
let crules ={};
if(this.operateType=="add"){
crules ={customized:[
{ required: true, message: this.$t('systemGenerate.selectProject'), trigger: 'change'},
],
mapId:[
{ required: true, message: this.$t('systemGenerate.selectMap'), trigger: 'change'},
],
name: [
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'blur' },
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'change' },
],
type:[
{ required: true, message: this.$t('systemGenerate.selectType'), trigger: 'change'},
],
prdCode:[
{ required: true, message: this.$t('systemGenerate.selectPrdName'), trigger: 'change'},
]
}
}else{
crules ={
name: [
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'blur' },
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'change' },
],
};
}
return crules
},
},
methods:{
loadInitData(){
this.projectList=[{value:'xty',label:'西铁院'}];
let customeredProductType=ConstConfig.ConstSelect.customeredProductType;
this.typeList=Cookies.get("user_lang")=="en"?
customeredProductType.map(elem => { return { value: elem.value, label: elem.enlabel } }):
customeredProductType.map(elem => { return { value: elem.value, label: elem.label } });
listPublishMap().then(response => {
this.mapInfoList=response.data;
this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name } });
})
},
changeMap(index){
this.productList=[];
let mapInfo=this.mapInfoList.find(elem=>{
return elem.id==index;
});
getCommodityMapProduct(mapInfo.skinCode).then((response) => {
this.productList = response.data.map(elem => { return { value: elem.code, label: elem.name } });
this.formModel.prdCode="";
});
},
doShow(data) {
if(data){
this.formModel.name=data.name;
this.formModel.id=data.id;
}
this.dialogVisible = true
},
doCreate() {
let self = this
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose()
})
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false
} }
return form;
},
rules() {
let crules = {};
if (this.operateType == 'add') {
crules = {customized:[
{ required: true, message: this.$t('systemGenerate.selectProject'), trigger: 'change'}
],
mapId:[
{ required: true, message: this.$t('systemGenerate.selectMap'), trigger: 'change'}
],
name: [
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'blur' },
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'change' }
],
type:[
{ required: true, message: this.$t('systemGenerate.selectType'), trigger: 'change'}
],
prdCode:[
{ required: true, message: this.$t('systemGenerate.selectPrdName'), trigger: 'change'}
]
};
} else {
crules = {
name: [
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'blur' },
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'change' }
]
};
}
return crules;
} }
}; },
mounted() {
this.loadInitData();
},
methods:{
loadInitData() {
this.projectList = [{value:'xty', label:'西铁院'}];
const customeredProductType = ConstConfig.ConstSelect.customeredProductType;
this.typeList = Cookies.get('user_lang') == 'en'
? customeredProductType.map(elem => { return { value: elem.value, label: elem.enlabel }; })
: customeredProductType.map(elem => { return { value: elem.value, label: elem.label }; });
listPublishMap().then(response => {
this.mapInfoList = response.data;
this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name }; });
});
},
changeMap(index) {
this.productList = [];
getCommodityMapProduct(index).then((response) => {
this.productList = response.data.map(elem => { return { value: elem.code, label: elem.name }; });
this.formModel.prdCode = '';
});
},
doShow(data) {
if (data) {
this.formModel.name = data.name;
this.formModel.id = data.id;
}
this.dialogVisible = true;
},
doCreate() {
const self = this;
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose();
});
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false;
}
}
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .el-dialog--center .el-dialog__body{ /deep/ .el-dialog--center .el-dialog__body{

View File

@ -60,156 +60,156 @@ import { launchFullscreen } from '@/utils/screen';
import localStore from 'storejs'; import localStore from 'storejs';
export default { export default {
name: 'LessonDetail', name: 'LessonDetail',
components: { components: {
LimitList LimitList
}, },
data() { data() {
return { return {
num: 5, num: 5,
loading: false, loading: false,
WhetherTypeList: [], WhetherTypeList: [],
EffectiveTypeList: [], EffectiveTypeList: [],
courseModel: { courseModel: {
id: '', id: '',
name: '', name: '',
pmsList: [] pmsList: []
}, },
activeName: 'first', activeName: 'first',
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'name' label: 'name'
}, },
expandList: [] expandList: []
}; };
}, },
computed: { computed: {
hasPermssion() { hasPermssion() {
return this.courseModel.pmsList.length > 0; return this.courseModel.pmsList.length > 0;
}, },
height() { height() {
return this.$store.state.app.height - 50; return this.$store.state.app.height - 50;
} }
}, },
watch: { watch: {
$route(newVal) { $route(newVal) {
this.initLoadPage(); this.initLoadPage();
} }
}, },
mounted() { mounted() {
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
this.EffectiveTypeList = list; this.EffectiveTypeList = list;
}); });
this.initLoadPage(); this.initLoadPage();
}, },
methods: { methods: {
initLoadPage() { initLoadPage() {
getPublishLessonTree(this.$route.query.lessonId).then(response => { getPublishLessonTree(this.$route.query.lessonId).then(response => {
if (response.data.tree && response.data.tree.length>0) { if (response.data.tree && response.data.tree.length > 0) {
this.courseModel = { this.courseModel = {
id: response.data.tree[0].id, id: response.data.tree[0].id,
name: response.data.tree[0].name, name: response.data.tree[0].name,
pmsList: response.data.permissionList || [], pmsList: response.data.permissionList || [],
treeList: response.data.tree, treeList: response.data.tree,
prdCode: this.$route.query.prdCode, prdCode: this.$route.query.prdCode,
mapId: this.$route.query.mapId, mapId: this.$route.query.mapId,
PermissionType: PermissionType.LESSON PermissionType: PermissionType.LESSON
}; };
} }
this.getExpandList(this.courseModel.id); this.getExpandList(this.courseModel.id);
}).catch(error => { }).catch(error => {
this.$message.error(this.$t('tip.failedCourse') + ':' + error.message); this.$message.error(this.$t('tip.failedCourse') + ':' + error.message);
}); });
}, },
transfer() { transfer() {
this.loading = false; this.loading = false;
if (this.$refs) { if (this.$refs) {
this.activeName = 'second'; this.activeName = 'second';
this.$refs.limitList.transfer(this.courseModel); this.$refs.limitList.transfer(this.courseModel);
} }
}, },
distribute() { distribute() {
this.loading = false; this.loading = false;
if (this.$refs) { if (this.$refs) {
this.activeName = 'second'; this.activeName = 'second';
this.$refs.limitList.distribute(this.courseModel); this.$refs.limitList.distribute(this.courseModel);
} }
}, },
clickEvent(obj, node, ele) { clickEvent(obj, node, ele) {
if (obj && obj.type==='Training') { if (obj && obj.type === 'Training') {
if (obj.valid) { if (obj.valid) {
this.loading = true; this.loading = true;
trainingNotify({ trainingId: obj.id }).then(resp => { trainingNotify({ trainingId: obj.id }).then(resp => {
const query = { const query = {
group: resp.data, trainingId: obj.id, lessonId: this.$route.query.lessonId group: resp.data, trainingId: obj.id, lessonId: this.$route.query.lessonId, mapId: this.courseModel.mapId
}; };
this.$router.push({ path: `${UrlConfig.display}/teach`, query: query }); this.$router.push({ path: `${UrlConfig.display}/teach`, query: query });
launchFullscreen(); launchFullscreen();
}).catch(error => { }).catch(error => {
this.loading = false; this.loading = false;
this.$messageBox(`${this.$t('tip.createSimulationFaild')} : ${error.message}`); this.$messageBox(`${this.$t('tip.createSimulationFaild')} : ${error.message}`);
}); });
} else { } else {
this.$confirm(this.$t('tip.accessCourseNo'), this.$t('tip.hint'), { this.$confirm(this.$t('tip.accessCourseNo'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel') cancelButtonText: this.$t('tip.cancel')
}).then(() => { }).then(() => {
this.buy(); this.buy();
}).catch(() => { }); }).catch(() => { });
} }
} }
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.name.indexOf(value) !== -1; return data.name.indexOf(value) !== -1;
}, },
buy() { buy() {
this.$router.push({ this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`, query: path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`, query:
{ permissionType: PermissionType.LESSON, lessonId: this.courseModel.id, prdCode: this.$route.query.prdCode, mapId: this.$route.query.mapId, subSystem: this.$route.params.subSystem } { permissionType: PermissionType.LESSON, lessonId: this.courseModel.id, prdCode: this.$route.query.prdCode, mapId: this.$route.query.mapId, subSystem: this.$route.params.subSystem }
}); });
}, },
nodeExpand(obj, node, ele) { nodeExpand(obj, node, ele) {
const key = obj.id; const key = obj.id;
this.expandList = this.expandList.filter(item => item!==key); this.expandList = this.expandList.filter(item => item !== key);
this.expandList.push(key); this.expandList.push(key);
setSessionStorage('trainingTeachExpandList'+this.courseModel.id, this.expandList); setSessionStorage('trainingTeachExpandList' + this.courseModel.id, this.expandList);
}, },
nodeCollapse(obj, node, ele) { nodeCollapse(obj, node, ele) {
const key = obj.id; const key = obj.id;
if (obj.type === 'Lesson') { if (obj.type === 'Lesson') {
this.expandList = []; this.expandList = [];
} else { } else {
this.expandList = this.expandList.filter(item => item!==key); this.expandList = this.expandList.filter(item => item !== key);
} }
setSessionStorage('trainingTeachExpandList'+this.courseModel.id, this.expandList); setSessionStorage('trainingTeachExpandList' + this.courseModel.id, this.expandList);
}, },
getExpandList(id) { getExpandList(id) {
let expand = getSessionStorage('trainingTeachExpandList'+id); let expand = getSessionStorage('trainingTeachExpandList' + id);
expand = expand?(expand+'').split(','):''; expand = expand ? (expand + '').split(',') : '';
if (expand instanceof Array) { if (expand instanceof Array) {
this.expandList = expand; this.expandList = expand;
} }
}, },
startTraining(data) { startTraining(data) {
if (data && data.type==='Training') { if (data && data.type === 'Training') {
if (data.valid) { if (data.valid) {
this.$router.push({ path: `${UrlConfig.trainingPlatform.practical}/${data.id}/${this.courseModel.id}`}); this.$router.push({ path: `${UrlConfig.trainingPlatform.practical}/${data.id}/${this.courseModel.id}`});
} else { } else {
this.$confirm(this.$t('tip.accessCourseNo'), this.$t('tip.hint'), { this.$confirm(this.$t('tip.accessCourseNo'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel') cancelButtonText: this.$t('tip.cancel')
}).then(() => { }).then(() => {
this.buy(); this.buy();
}).catch(() => { }); }).catch(() => { });
} }
} }
}, },
backLessonList() { backLessonList() {
localStore.remove('teachDetail'+this.$route.params.subSystem); localStore.remove('teachDetail' + this.$route.params.subSystem);
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachHome}/${this.$route.params.subSystem}`}); this.$router.push({ path: `${UrlConfig.trainingPlatform.teachHome}/${this.$route.params.subSystem}`});
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,131 +0,0 @@
<template>
<el-card>
<div slot="header" style="text-align: center;">
<b>{{ $t('teach.trainingName') }} {{ courseModel.name }}</b>
</div>
<div style="margin:50px">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: height - 190 +'px' }">
<p class="list-item">
<span class="list-label">{{ $t('teach.trainingTime') }}</span>
<span class="list-elem"> {{ courseModel.minDuration | setTime }} {{ $t('teach.seconds') }}</span>
</p>
<p class="list-item">
<span class="list-label">{{ $t('teach.trainingMaximum') }}</span>
<span class="list-elem">{{ courseModel.maxDuration | setTime }} {{ $t('teach.seconds') }}</span>
</p>
<p class="list-item">
<span class="list-label">{{ $t('teach.trainingInstructions') }}</span>
<span class="list-elem">{{ courseModel.remarks }}</span>
</p>
</el-scrollbar>
</div>
<div class="btn-start">
<el-button :loading="loading" type="primary" @click="start">{{ $t('teach.startTraining') }}</el-button>
<el-button @click="back">{{ $t('global.back') }}</el-button>
</div>
</el-card>
</template>
<script>
import { getTrainingDetail } from '@/api/jmap/training';
import { trainingNotify } from '@/api/simulation';
import { UrlConfig } from '@/router/index';
import { launchFullscreen } from '@/utils/screen';
export default {
name: 'LessonPracticalDetail',
filters: {
setTime(val) {
return val;
}
},
data() {
return {
loading: false,
courseModel: {
id: '',
name: '',
maxDuration: '',
minDuration: '',
remarks: '',
updateTime: ''
}
};
},
computed: {
height() {
return this.$store.state.app.height - 50;
}
},
watch: {
$route(newVal) {
this.initLoadPage();
}
},
mounted() {
this.initLoadPage();
},
methods: {
initLoadPage() {
const trainingId = this.$route.params.trainingId;
if (parseInt(trainingId)) {
getTrainingDetail(trainingId)
.then(res => {
this.courseModel = {
id: res.data.id,
name: res.data.name,
maxDuration: res.data.maxDuration,
remarks: res.data.remarks,
minDuration: res.data.minDuration,
updateTime: res.data.updateTime
};
})
.catch(error => {
this.$message.error(this.$t('tip.failedCourse') + ':' + error.message);
});
}
},
start() {
this.loading = true;
trainingNotify({ trainingId: this.$route.params.trainingId }).then(resp => {
const query = {
group: resp.data, trainingId: this.$route.params.trainingId, lessonId: this.$route.params.lessonId
};
this.$router.push({ path: `${UrlConfig.display}/teach`, query: query });
launchFullscreen();
}).catch(error => {
this.loading = false;
this.$messageBox(`${this.$t('tip.createSimulationFaild')} : ${error.message}`);
});
},
back() {
this.$router.back();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.list-item {
font-size: 16px;
margin-bottom: 20px;
}
.list-label {
display: inline-block;
text-align: right;
width: 160px;
}
.list-elem {
color: #808080 !important;
}
.btn-start {
position: relative;
text-align: center;
justify-content: center;
transform: translateY(-20px);
}
</style>