删除接口:/api/runPlan/draft/station/{skinCode}/bySkin

This commit is contained in:
fan 2019-10-30 16:50:35 +08:00
parent 375773cceb
commit 4918c78204
11 changed files with 1506 additions and 1519 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

@ -4,317 +4,307 @@ import request from '@/utils/request';
* 获取运行图列表 * 获取运行图列表
*/ */
export function getRunPlanList() { export function getRunPlanList() {
return request({ return request({
url: '/api/runPlan/draft/tree', url: '/api/runPlan/draft/tree',
method: 'get' method: 'get'
}); });
} }
/** /**
* 获取地图速度等级列表 * 获取地图速度等级列表
*/ */
export function getSpeedLevels(skinCode) { export function getSpeedLevels(skinCode) {
return request({ return request({
url: `/api/runPlan/draft/${skinCode}/speed`, url: `/api/runPlan/draft/${skinCode}/speed`,
method: 'get' method: 'get'
}); });
} }
/** /**
* 新建地图速度等级列表 * 新建地图速度等级列表
*/ */
export function newSpeedLevels(data) { export function newSpeedLevels(data) {
return request({ return request({
url: '/api/runPlan/draft/speed', url: '/api/runPlan/draft/speed',
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** /**
* 获取运行图的车站列表 * 获取运行图的车站列表
*/ */
export function getStationList(mapId) { export function getStationList(mapId) {
return request({ return request({
url: `/api/runPlan/draft/station/${mapId}`, url: `/api/runPlan/draft/station/${mapId}`,
method: 'get' method: 'get'
}); });
}
/**
* 通过皮肤获取运行图车站列表
*/
export function getStationListBySkinCode(skinCode) {
return request({
url: `/api/runPlan/draft/station/${skinCode}/bySkin`,
method: 'get'
});
} }
/** /**
* 创建运行图 * 创建运行图
*/ */
export function newRunPlan(data) { export function newRunPlan(data) {
return request({ return request({
url: '/api/runPlan/draft', url: '/api/runPlan/draft',
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** /**
* 查询运行图获取数据 * 查询运行图获取数据
*/ */
export function queryRunPlan(planId) { export function queryRunPlan(planId) {
return request({ return request({
url: `/api/runPlan/draft/${planId}`, url: `/api/runPlan/draft/${planId}`,
method: 'get' method: 'get'
}); });
} }
// 根据skinCode查询发布运行图列表 // 根据skinCode查询发布运行图列表
export function queryRunPlanList(skinCode) { export function queryRunPlanList(skinCode) {
return request({ return request({
url: `/api/runPlan/template/skin/${skinCode}`, url: `/api/runPlan/template/skin/${skinCode}`,
method: 'get' method: 'get'
}); });
} }
// 从发布运行图创建新运行图 // 从发布运行图创建新运行图
export function postCreatePlan(data) { export function postCreatePlan(data) {
return request({ return request({
url: `/api/runPlan/draft/createFrom/${data.templateId}`, url: `/api/runPlan/draft/createFrom/${data.templateId}`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
// 删除运行图 // 删除运行图
export function deleteRunPlan(planId) { export function deleteRunPlan(planId) {
return request({ return request({
url: `/api/runPlan/draft/${planId}`, url: `/api/runPlan/draft/${planId}`,
method: 'delete' method: 'delete'
}); });
} }
// 修改运行图内容 // 修改运行图内容
export function putRunPlanDetail(data) { export function putRunPlanDetail(data) {
return request({ return request({
url: `/api/runPlan/draft/${data.planId}`, url: `/api/runPlan/draft/${data.planId}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** /**
* 发布运行图 * 发布运行图
*/ */
export function publishRunPlan(data) { export function publishRunPlan(data) {
return request({ return request({
url: `/api/runPlan/draft/${data.planId}/publish`, url: `/api/runPlan/draft/${data.planId}/publish`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** /**
* 导入真实运行图 * 导入真实运行图
*/ */
export function importRunPlan(data) { export function importRunPlan(data) {
return request({ return request({
url: `/api/runPlan/draft/${data.skinCode}/prdPlan`, url: `/api/runPlan/draft/${data.skinCode}/prdPlan`,
method: 'post', method: 'post',
data: data.runPlanList data: data.runPlanList
}); });
} }
/** 获取运行图停车点列表*/ /** 获取运行图停车点列表*/
export function getRunPlanStopPointList(skinCode) { export function getRunPlanStopPointList(skinCode) {
return request({ return request({
url: `/api/runPlan/draft/stopPoint/${skinCode}`, url: `/api/runPlan/draft/stopPoint/${skinCode}`,
method: 'get' method: 'get'
}); });
} }
/** 运行图*/ /** 运行图*/
export function getRpListByMapId(mapId) { export function getRpListByMapId(mapId) {
return request({ return request({
url: `/api/runPlan/draft/${mapId}/list`, url: `/api/runPlan/draft/${mapId}/list`,
method: 'get' method: 'get'
}); });
} }
/** 获取站间运行时间*/ /** 获取站间运行时间*/
export function getStationRunning(skinCode) { export function getStationRunning(skinCode) {
return request({ return request({
url: `/api/runPlan/draft/${skinCode}/stationRunning`, url: `/api/runPlan/draft/${skinCode}/stationRunning`,
method: 'get' method: 'get'
}); });
} }
/** 设置站间运行时间*/ /** 设置站间运行时间*/
export function setStationRunning(skinCode, data) { export function setStationRunning(skinCode, data) {
return request({ return request({
url: `/api/runPlan/draft/${skinCode}/stationRunning`, url: `/api/runPlan/draft/${skinCode}/stationRunning`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** 创建运行图*/ /** 创建运行图*/
export function createEmptyPlan(data) { export function createEmptyPlan(data) {
return request({ return request({
url: `/api/runPlan/draft`, url: `/api/runPlan/draft`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 查询运行图服务号是否存在*/ /** 查询运行图服务号是否存在*/
export function checkServiceNumberExist({ planId, serviceNumber }) { export function checkServiceNumberExist({ planId, serviceNumber }) {
return request({ return request({
url: `/api/runPlan/draft/${planId}/${serviceNumber}/service`, url: `/api/runPlan/draft/${planId}/${serviceNumber}/service`,
method: 'get' method: 'get'
}); });
} }
/** 查询交路列表*/ /** 查询交路列表*/
export function getRoutingList(planId) { export function getRoutingList(planId) {
return request({ return request({
url: `/api/runPlan/draft/${planId}/routingList`, url: `/api/runPlan/draft/${planId}/routingList`,
method: 'get' method: 'get'
}); });
} }
/** 根据交路查询交路区段列表*/ /** 根据交路查询交路区段列表*/
export function querySectionListByRouting({ planId, routingCode }) { export function querySectionListByRouting({ planId, routingCode }) {
return request({ return request({
url: `/api/runPlan/draft/${planId}/${routingCode}/routingSectionList`, url: `/api/runPlan/draft/${planId}/${routingCode}/routingSectionList`,
method: 'get' method: 'get'
}); });
} }
/** 有效性检查*/ /** 有效性检查*/
export function planEffectiveCheck(planId) { export function planEffectiveCheck(planId) {
return request({ return request({
url: `/api/runPlan/draft/${planId}/check`, url: `/api/runPlan/draft/${planId}/check`,
method: 'get' method: 'get'
}); });
} }
/** 增加计划*/ /** 增加计划*/
export function addPlanService(data) { export function addPlanService(data) {
return request({ return request({
url: `/api/runPlan/draft/${data.planId}/service`, url: `/api/runPlan/draft/${data.planId}/service`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 删除计划*/ /** 删除计划*/
export function deletePlanService(data) { export function deletePlanService(data) {
return request({ return request({
url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`, url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`,
method: 'delete' method: 'delete'
}); });
} }
/** 复制计划*/ /** 复制计划*/
export function duplicateService(data) { export function duplicateService(data) {
return request({ return request({
url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`, url: `/api/runPlan/draft/${data.planId}/service/${data.serviceNumber}`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 增加任务*/ /** 增加任务*/
export function addPlanTrip(data) { export function addPlanTrip(data) {
return request({ return request({
url: `/api/runPlan/draft/${data.planId}/${data.serviceNumber}/trip`, url: `/api/runPlan/draft/${data.planId}/${data.serviceNumber}/trip`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 删除任务*/ /** 删除任务*/
export function deletePlanTrip(params) { export function deletePlanTrip(params) {
return request({ return request({
url: `/api/runPlan/draft/${params.planId}/trip/${params.SDTNumber}`, url: `/api/runPlan/draft/${params.planId}/trip/${params.SDTNumber}`,
method: 'delete', method: 'delete',
params: { deleteBefore: params.deleteBefore } params: { deleteBefore: params.deleteBefore }
}); });
} }
/** 修改任务*/ /** 修改任务*/
export function updatePlanTrip(data) { export function updatePlanTrip(data) {
return request({ return request({
url: `/api/runPlan/draft/${data.planId}/trip/${data.SDTNumber}`, url: `/api/runPlan/draft/${data.planId}/trip/${data.SDTNumber}`,
method: 'put', method: 'put',
data: data data: data
}); });
} }
/** 根据车次号查询交路*/ /** 根据车次号查询交路*/
export function getRoutingBySDTNumber(params) { export function getRoutingBySDTNumber(params) {
return request({ return request({
url: `/api/runPlan/draft/${params.planId}/routing`, url: `/api/runPlan/draft/${params.planId}/routing`,
method: 'get', method: 'get',
params: { params: {
SDTNumber: params.SDTNumber SDTNumber: params.SDTNumber
} }
}); });
} }
/** 运行图仿真测试*/ /** 运行图仿真测试*/
export function runPlanNotify({ planId }) { export function runPlanNotify({ planId }) {
return request({ return request({
url: `/api/runPlan/draft/${planId}/simulation`, url: `/api/runPlan/draft/${planId}/simulation`,
method: 'get' method: 'get'
}); });
} }
/** 获取运行计划模板列表*/ /** 获取运行计划模板列表*/
export function runPlanTemplateList(params) { export function runPlanTemplateList(params) {
return request({ return request({
url: '/api/runPlan/template', url: '/api/runPlan/template',
method: 'get', method: 'get',
params: params params: params
}); });
} }
/** 删除运行图模板*/ /** 删除运行图模板*/
export function deleteRunPlanTemplate(planId) { export function deleteRunPlanTemplate(planId) {
return request({ return request({
url: `/api/runPlan/template/${planId}`, url: `/api/runPlan/template/${planId}`,
method: 'delete' method: 'delete'
}); });
} }
/** 生成通用每日运行图*/ /** 生成通用每日运行图*/
export function generateCommonRunPlanEveryDay(planId, params) { export function generateCommonRunPlanEveryDay(planId, params) {
return request({ return request({
url: `/api/runPlan/template/generate/${planId}`, url: `/api/runPlan/template/generate/${planId}`,
method: 'post', method: 'post',
params params
}); });
} }
/** 获取运行计划每日列表*/ /** 获取运行计划每日列表*/
export function runPlanEveryDayList(params) { export function runPlanEveryDayList(params) {
return request({ return request({
url: '/api/runPlan/daily', url: '/api/runPlan/daily',
method: 'get', method: 'get',
params: params params: params
}); });
} }
/** 删除运行图每日计划*/ /** 删除运行图每日计划*/
export function deleteRunPlanEveryDay(planId) { export function deleteRunPlanEveryDay(planId) {
return request({ return request({
url: `/api/runPlan/daily/${planId}`, url: `/api/runPlan/daily/${planId}`,
method: 'delete' method: 'delete'
}); });
} }
/** 获取地图运行图的车次号*/ /** 获取地图运行图的车次号*/
@ -327,91 +317,91 @@ export function deleteRunPlanEveryDay(planId) {
/** 分页查询加载计划*/ /** 分页查询加载计划*/
export function getRunPlanLoadList(params) { export function getRunPlanLoadList(params) {
return request({ return request({
url: `/api/runPlan/daily/runPlanLoad`, url: `/api/runPlan/daily/runPlanLoad`,
method: 'get', method: 'get',
params: params params: params
}); });
} }
/** 创建加载计划*/ /** 创建加载计划*/
export function createRunPlanLoad(data) { export function createRunPlanLoad(data) {
return request({ return request({
url: `/api/runPlan/daily/runPlanLoad`, url: `/api/runPlan/daily/runPlanLoad`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 管理创建通用加载计划*/ /** 管理创建通用加载计划*/
export function createRunPlanCommon(data) { export function createRunPlanCommon(data) {
return request({ return request({
url: `/api/runPlan/daily/runPlanLoad/common`, url: `/api/runPlan/daily/runPlanLoad/common`,
method: 'post', method: 'post',
data: data data: data
}); });
} }
/** 删除加载计划*/ /** 删除加载计划*/
export function deleteRunPlanLoad(planId) { export function deleteRunPlanLoad(planId) {
return request({ return request({
url: `/api/runPlan/daily/runPlanLoad/${planId}`, url: `/api/runPlan/daily/runPlanLoad/${planId}`,
method: 'delete' method: 'delete'
}); });
} }
/** 查询模板运行图数据*/ /** 查询模板运行图数据*/
export function queryRunPlanTemplate(planId) { export function queryRunPlanTemplate(planId) {
return request({ return request({
url: `/api/runPlan/template/${planId}`, url: `/api/runPlan/template/${planId}`,
method: 'get' method: 'get'
}); });
} }
/** 查询当日运行图数据*/ /** 查询当日运行图数据*/
export function queryRunPlanDaily(planId) { export function queryRunPlanDaily(planId) {
return request({ return request({
url: `/api/runPlan/daily/${planId}`, url: `/api/runPlan/daily/${planId}`,
method: 'get' method: 'get'
}); });
} }
/** 获取模板运行图列表*/ /** 获取模板运行图列表*/
export function listAllTempLateRunPlan() { export function listAllTempLateRunPlan() {
return request({ return request({
url: `/api/runPlan/template/all`, url: `/api/runPlan/template/all`,
method: 'get' method: 'get'
}); });
} }
// 删除加载计划 // 删除加载计划
export function deleteDailyRunPlanLoad(id) { export function deleteDailyRunPlanLoad(id) {
return request({ return request({
url: `/api/runPlan/daily/runPlanLoad/${id}`, url: `/api/runPlan/daily/runPlanLoad/${id}`,
method: 'DELETE' method: 'DELETE'
}); });
} }
// 从加载计划创建每日计划 // 从加载计划创建每日计划
export function postDailyRunPlanLoadGenerate(id) { export function postDailyRunPlanLoadGenerate(id) {
return request({ return request({
url: `/api/runPlan/daily/runPlanLoad/${id}/generate`, url: `/api/runPlan/daily/runPlanLoad/${id}/generate`,
method: 'post' method: 'post'
}); });
} }
// 加载通用排班计划 // 加载通用排班计划
export function postSchedulingCommonGenerate(mapId) { export function postSchedulingCommonGenerate(mapId) {
return request({ return request({
url: `/api/scheduling/common/generate?mapId=${mapId}`, url: `/api/scheduling/common/generate?mapId=${mapId}`,
method: 'post' method: 'post'
}); });
} }
// 从加载计划创建每日计划 // 从加载计划创建每日计划
export function postRunPlanTemplate(data) { export function postRunPlanTemplate(data) {
return request({ return request({
url: `/api/runPlan/template/${data.id}/copyAs/${data.skinCode}?name=${data.name}`, url: `/api/runPlan/template/${data.id}/copyAs/${data.skinCode}?name=${data.name}`,
method: 'post' method: 'post'
}); });
} }

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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -25,7 +25,7 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { getStationListBySkinCode, queryRunPlan } from '@/api/runplan'; import { getStationList, queryRunPlan } from '@/api/runplan';
import {getRpDetailByUserMapId, getUserMapDetailByMapId} from '@/api/designPlatform'; import {getRpDetailByUserMapId, getUserMapDetailByMapId} from '@/api/designPlatform';
import { loadMapDataById } from '@/utils/loaddata'; import { loadMapDataById } from '@/utils/loaddata';
import { getPublishMapInfo } from '@/api/jmap/map'; import { getPublishMapInfo } from '@/api/jmap/map';
@ -372,7 +372,7 @@ export default {
this.loadInitChart().then(() => { this.loadInitChart().then(() => {
if (this.$route.query.mapId) { if (this.$route.query.mapId) {
loadMapDataById(this.$route.query.mapId); loadMapDataById(this.$route.query.mapId);
getStationListBySkinCode(this.$route.query.skinCode).then(resp => { getStationList(this.$route.query.mapId).then(resp => {
this.$store.dispatch('runPlan/setStations', resp.data).then(() => { this.$store.dispatch('runPlan/setStations', resp.data).then(() => {
this.loadInitData(); this.loadInitData();
if (this.planId) { if (this.planId) {

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>