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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@
<script>
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { getStationListBySkinCode, queryRunPlan } from '@/api/runplan';
import { getStationList, queryRunPlan } from '@/api/runplan';
import {getRpDetailByUserMapId, getUserMapDetailByMapId} from '@/api/designPlatform';
import { loadMapDataById } from '@/utils/loaddata';
import { getPublishMapInfo } from '@/api/jmap/map';
@ -372,7 +372,7 @@ export default {
this.loadInitChart().then(() => {
if (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.loadInitData();
if (this.planId) {

View File

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