diff --git a/src/api/jmap/mapdraft.js b/src/api/jmap/mapdraft.js index c0d477f54..63c48f6de 100644 --- a/src/api/jmap/mapdraft.js +++ b/src/api/jmap/mapdraft.js @@ -152,6 +152,23 @@ export function deleteRoutingData(routingId) { }); } +/** 保存用户配置 (新版)*/ +export function addRunplanConfig(mapId, data) { + return request({ + url: `/api/runPlan/userData/${mapId}/config`, + method: 'post', + data: data + }); +} + +/** 获取用户配置(新版)*/ +export function getRunplanConfig(mapId) { + return request({ + url: `/api/runPlan/userData/${mapId}/config`, + method: 'get' + }); +} + /** 获取交路详情(新版)*/ export function getRoutingData(routingId) { return request({ diff --git a/src/api/runplan.js b/src/api/runplan.js index dc09e67d0..c2d502c88 100644 --- a/src/api/runplan.js +++ b/src/api/runplan.js @@ -147,10 +147,19 @@ export function checkServiceNumberExist({ planId, serviceNumber }) { }); } -/** 查询交路列表*/ -export function getRoutingList(planId) { +// /** 查询交路列表*/ +// export function getRoutingList(planId) { +// return request({ +// url: `/api/runPlan/draft/${planId}/routingList`, +// method: 'get' +// }); +// } + +/** 查询用户交路数据 (新版)*/ +export function listUserRoutingData(mapId) { return request({ - url: `/api/runPlan/draft/${planId}/routingList`, + // url: `/api/mapBuild/${mapId}/routingData`, + url: `/api/runPlan/userData/${mapId}/routing`, method: 'get' }); } @@ -233,10 +242,19 @@ export function updatePlanTrip(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`, + url: `/api/runPlan/draft/${params.planId}/userRouting`, method: 'get', params: { SDTNumber: params.SDTNumber @@ -252,6 +270,15 @@ export function updateServiceNumber(planId, serviceNumber, newServiceNumber) { }); } +/** 生成计划(新版)*/ +export function generatePlanTrain(planId, data) { + return request({ + url: `/api/runPlan/draft/${planId}/service/generate`, + method: 'post', + data + }); +} + /** 修改任务车次号*/ export function updateTripNumber(planId, SDTNumber, tripNumber) { return request({ diff --git a/src/assets/icon/favicon_jdy.png b/src/assets/icon/favicon_jdy.png new file mode 100644 index 000000000..f86b5c448 Binary files /dev/null and b/src/assets/icon/favicon_jdy.png differ diff --git a/src/components/QueryListPage/DataForm.vue b/src/components/QueryListPage/DataForm.vue index f843a0365..702c166bb 100644 --- a/src/components/QueryListPage/DataForm.vue +++ b/src/components/QueryListPage/DataForm.vue @@ -1,5 +1,5 @@ - - - - + diff --git a/src/views/planMonitor/editTool/routingoperate/routeMap.vue b/src/views/planMonitor/editTool/routingoperate/routeMap.vue index b3f798ac9..7d32846ae 100644 --- a/src/views/planMonitor/editTool/routingoperate/routeMap.vue +++ b/src/views/planMonitor/editTool/routingoperate/routeMap.vue @@ -1,180 +1,13 @@ @@ -182,150 +15,54 @@ import JlmapVisual from '@/views/newMap/jlmapNew/index'; import { loadMapDataById } from '@/utils/loaddata'; import { EventBus } from '@/scripts/event-bus'; - -import RouteOperate from './routeOperate'; - -import { mapGetters } from 'vuex'; -import { setUID } from '@/jmapNew/utils/Uid'; -import { addRoutingData, updateRoutingData } from '@/api/jmap/mapdraft'; -import { formatName } from '@/utils/runPlan'; -import Sortable from 'sortablejs'; +import RouteConfig from './routeConfig'; +import RunplanConfig from './runplanConfig'; export default { name: 'RouteMap', components: { JlmapVisual, - RouteOperate + RouteConfig, + RunplanConfig }, props:{ }, data() { return { + type:'', + title:'', dialogShow: false, oldDevice: null, - field: '', - allowSelect:false, - isStartSelected:false, - stationCode: '', - sectionCode: '', - isSave: true, - loading: false, oldsection:[], - DirectionCodeList: [{label: '右行', value: true}, {label: '左行', value: false}], - addModel: { - name: '', - mapId: '', - code: '', - // withLoop:false, - right: true, - destinationCode: '', - startStationCode: '', - startSectionCode: '', - endStationCode: '', - endSectionCode: '', - remarks: '', - userId: '', - parkSectionCodeList: [] - }, - editShow: false, - rules: { - name: [ - { required: true, message: '请输入交路名称', trigger: 'change' } - ], - startStationCode: [ - { required: true, message: '请选择起始站', trigger: 'change' } - ], - startSectionCode: [ - { required: true, message: '请选择起始区段', trigger: 'change' } - ], - endStationCode: [ - { required: true, message: '请选择终到站', trigger: 'change' } - ], - endSectionCode: [ - { required: true, message: '请选择终到区段', trigger: 'change' } - ] - } + isFirst:true }; }, - computed: { - ...mapGetters('map', [ - 'sectionList', - 'stationList' - ]), - filterSectionList() { - if (this.sectionList) { - return this.sectionList.filter(elem => { return elem.standTrack || elem.reentryTrack || elem.transferTrack; }); - } else { - return []; - } - }, - filterStationList() { - if (this.stationList) { - return this.stationList.filter(elem => { return true; }); - } else { - return []; - } - }, - routeName: { - get() { - var name = ''; - if (this.isSave) { - let begStation = ''; let endStation = ''; - let begSection = ''; let endSection = ''; - if (this.stationList) { - this.stationList.forEach(elem => { - if (elem.code === this.addModel.startStationCode) begStation = elem.name; - if (elem.code === this.addModel.endStationCode) endStation = elem.name; - }); - } - if (this.sectionList) { - this.sectionList.forEach(elem => { - if (elem.code === this.addModel.startSectionCode) begSection = '(' + elem.name + ')'; - if (elem.code === this.addModel.endSectionCode) endSection = '(' + elem.name + ')'; - }); - } - name = begStation + begSection + '-' + endStation + endSection; - } - return name; - } - - } - }, watch: { - mapInfo(val) { - if (val) { - this.addModel.mapId = val.id; - } - }, - 'addModel.parkSectionCodeList':function(val, old) { - this.changeSectionSelected(val, true); - }, '$store.state.app.width': function(val) { this.setWindowSize(); }, - routeName(val, old) { - if (val) { - this.addModel.name = val; - } - }, - sectionCode(val) { - val && this.changeBelongSection(val); + '$store.state.app.windowSizeCount': function() { + this.setWindowSize(); } }, mounted() { - this.rowDrop(); }, methods: { - async doShow() { + async doShow(type) { + this.type = type; + if (this.type == 'routeMap') { + this.title = '交路配置'; + } else if (this.type == 'runplanParams') { + this.title = '参数配置'; + + } this.dialogShow = true; await this.setWindowSize(); - await this.loadInitPage(); - }, - previewRouteEvent() { - this.$refs.routeOperate.doShow(); - }, - createRouteEvent() { - this.clear(); + if (this.isFirst) { + await this.loadInitPage(); + } + this.isFirst = false; + if (this.type == 'runplanParams') { this.$refs.runPlanConfig.doShow(); } }, // 获取设备数据 getDeviceByEm(em) { @@ -384,331 +121,22 @@ export default { EventBus.$emit('viewLoading', false); }); }, - routingSelected(data) { - this.editData(data); - }, - // 行拖拽 - rowDrop() { - const that = this; - const tbody = document.querySelector('.el-parkSectionCode-table tbody', {filter:'.ignoreDrag'}); - if (tbody) { - Sortable.create(tbody, { - onEnd({ newIndex, oldIndex }) { - const length = that.addModel.parkSectionCodeList.length - 1; - if (newIndex != 0 && oldIndex != 0 && newIndex != length && oldIndex != length) { - that.addModel.parkSectionCodeList.splice(newIndex, 0, that.addModel.parkSectionCodeList.splice(oldIndex, 1)[0]); - const newArray = that.addModel.parkSectionCodeList.slice(0); - that.addModel.parkSectionCodeList = []; - that.$nextTick(function () { - that.addModel.parkSectionCodeList = newArray; - }); - } else { - const newArray = that.addModel.parkSectionCodeList.slice(0); - that.addModel.parkSectionCodeList = []; - that.$nextTick(function () { - that.addModel.parkSectionCodeList = newArray; - }); - } - } - }); - } - }, - editData(data) { - this.isSave = false; - this.allowSelect = true; - this.isStartSelected = true; - this.editShow = true; - this.addModel = data; - }, - changeStartStation() { - this.judgeAllowSelected(); - this.addStartSectionData(true); - }, - changeStartSection(data) { - const section = this.$store.getters['map/getDeviceByCode'](data); - if (section.belongStation) { - this.addModel.startStationCode = section.belongStation; - } - this.judgeAllowSelected(); - this.addStartSectionData(false); - }, - changeEndStation() { - this.judgeAllowSelected(); - this.addEndSectionData(true); - }, - changeEndSection(data) { - const section = this.$store.getters['map/getDeviceByCode'](data); - if (section.belongStation) { - this.addModel.endStationCode = section.belongStation; - } - this.judgeAllowSelected(); - this.addEndSectionData(false); - }, - changeBelongSection(code) { - const section = this.$store.getters['map/getDeviceByCode'](code); - if (section && section.belongStation) { - this.stationCode = section.belongStation; - } - }, - judgeAllowSelected() { - if (this.addModel.startStationCode != '' && this.addModel.startSectionCode != '' && this.addModel.endStationCode != '' && this.addModel.endSectionCode != '') { - this.allowSelect = true; - } else { - this.allowSelect = false; - } - }, - addStartSectionData(isStation) { - if (this.addModel.startStationCode != '' && this.addModel.startSectionCode != '') { - this.isStartSelected = true; - const result = this.pushSection({stationCode: this.addModel.startStationCode, sectionCode: this.addModel.startSectionCode}, 'top', isStation); - return result; - } - return false; - }, - addEndSectionData(isStation) { - if (this.addModel.endStationCode != '' && this.addModel.endSectionCode != '') { - const result = this.pushSection({stationCode: this.addModel.endStationCode, sectionCode: this.addModel.endSectionCode}, 'bottom', isStation); - return result; - } - return false; - }, - hover(field) { - this.field = field === this.field ? '' : field; - }, - formatName(code) { - return formatName(code); - }, setSelected(selected) { if (selected) { - if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'startStationCode'.toUpperCase()) { - this.addModel.startStationCode = selected.code; - this.judgeAllowSelected(); - this.addStartSectionData(true); - } else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'endStationCode'.toUpperCase()) { - this.addModel.endStationCode = selected.code; - this.judgeAllowSelected(); - this.addEndSectionData(true); - } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'startSectionCode'.toUpperCase()) { - if (selected.standTrack || selected.reentryTrack || selected.transferTrack) { - if (selected.belongStation) { - this.addModel.startStationCode = selected.belongStation; - } - this.addModel.startSectionCode = selected.code; - this.judgeAllowSelected(); - this.addStartSectionData(false); - } else { - // (折返轨/转换轨/站台轨对应的区段) - this.$message.error('请选择正确的起始区段'); - } - } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) { - if (selected.standTrack || selected.reentryTrack || selected.transferTrack) { - if (selected.belongStation) { - this.addModel.endStationCode = selected.belongStation; - } - this.addModel.endSectionCode = selected.code; - this.judgeAllowSelected(); - this.addEndSectionData(false); - this.addModel.destinationCode = selected.destinationCode || ''; - } else { - this.$message.error('请选择正确的终到区段'); - } - } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() == 'routingSection'.toUpperCase()) { - if (selected.standTrack || selected.reentryTrack || selected.transferTrack) { - this.sectionCode = selected.code; - } else { - this.$message.error('请选择正确的区段'); - } - } else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() == 'routingStation'.toUpperCase()) { - this.stationCode = selected.code; - } - } - }, - pushSection(data, type, isStation) { - const list = this.addModel.parkSectionCodeList; - if (data && data.stationCode && data.sectionCode) { - const index = list.findIndex(elem => { return elem.sectionCode == data.sectionCode; }); - switch (type) { - case 'center': { - if (index < 0) { - list.splice(list.length - 1, 0, data); - } else { - this.$messageBox('该区段已经在交路区段中存在'); - } - break; - } - case 'top': { - if (isStation) { - list.splice(0, 1, data); - } else { - if (index < 0) { - list.splice(0, 1, data); - } else { - if (index == list.length - 1 && list.length >= 2) { - this.addModel.startSectionCode = list[0].sectionCode; - this.addModel.startStationCode = list[0].stationCode; - this.$messageBox('起始区段和终到区段不能相同'); - } else if (index != list.length - 1 && index != 0) { - this.$messageBox('该区段已经在交路区段中存在'); - } - } - } - break; - } - case 'bottom': { - if (isStation) { - if (list.length >= 2) { - list.splice(list.length - 1, 1, data); - } else { - if (index < 0) { - list.push(data); - } - } - } else { - if (index < 0) { - if (list.length >= 2) { - list.splice(list.length - 1, 1, data); - } else { - list.push(data); - } - } else { - if (index == 0 && list.length >= 2) { - this.addModel.endSectionCode = list[list.length - 1].sectionCode; - this.addModel.endStationCode = list[list.length - 1].stationCode; - this.$messageBox('起始区段和终到区段不能相同'); - } else if (index != list.length - 1 && index != 0) { - this.$messageBox('该区段已经在交路区段中存在'); - } - } - } - break; - } - default: { - if (index < 0) { - list.splice(list.length - 1, 0, data); - } else { - this.$messageBox(this.$t('tip.routeSameID')); - } - break; - } - } - this.sectionCode = ''; - this.stationCode = ''; - } - }, - deleteSection(list, index) { - const data = list.splice(index, 1); - if (data.length > 0) { - const section = this.$store.getters['map/getDeviceByCode'](data[0].sectionCode); - section.instance.drawBatchSelected(section, ''); - } - }, - buildModel(code) { - const model = Object.assign({}, this.addModel); - // if (model.withLoop) { model.withLoop = true; } else { model.withLoop = false; } - model['mapId'] = this.$route.query.mapId; - model['userId'] = this.$store.state.user.id; - if (code) { model['code'] = code; } - return model; - }, - save() { - this.addModel; - this.$refs.form.validate((valid) => { - if (valid) { - this.loading = true; - addRoutingData(this.buildModel(setUID('Routing'))).then(resp => { - this.$message.success(this.$t('tip.pathCreationSuccessful')); - this.loading = false; - this.clear(); - }).catch((error) => { - this.$messageBox(this.$t('tip.createRoutingFailed') + ':' + error.message); - this.loading = false; - }); - } - }); - }, - update() { - this.$refs.form.validate((valid) => { - if (valid) { - this.loading = true; - const data = this.buildModel(); - // delete data.withLoop; - updateRoutingData(data).then(resp => { - this.$message.success(this.$t('tip.pathUpdataSuccessful')); - this.loading = false; - this.clear(); - }).catch((error) => { - this.$messageBox(this.$t('tip.pathUpdataFailed') + ':' + error.message); - this.loading = false; - }); - - } - }); - }, - batchSectionListFocus(flag) { - this.changeSectionSelected(this.addModel.parkSectionCodeList, flag); - }, - changeSectionSelected(selectedList, flag) { - if (this.addModel.parkSectionCodeList && this.addModel.parkSectionCodeList.length > 0) { - if (flag) { - if (this.oldsection.length > 0) { - this.oldsection.forEach((section)=>{ - section.instance.drawBatchSelected(section, ''); - }); - this.oldsection = []; - } - selectedList.forEach(each=>{ - const section = this.$store.getters['map/getDeviceByCode'](each.sectionCode); - const list = section.logicSectionCodeList; - if (list && list.length > 0) { - list.forEach(logicSectionCode=>{ - const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode); - this.oldsection.push(logicSection); - logicSection.instance.drawBatchSelected(section, 'routingSection'); - }); - } else { - this.oldsection.push(section); - section.instance.drawBatchSelected(section, 'routingSection'); - } - }); - } else { - selectedList.forEach(each=>{ - const section = this.$store.getters['map/getDeviceByCode'](each.sectionCode); - const list = section.logicSectionCodeList; - if (list && list.length > 0) { - list.forEach(logicSectionCode=>{ - const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode); - logicSection.instance.drawBatchSelected(section, ''); - }); - } else { - section.instance.drawBatchSelected(section, ''); - } - }); - } - } - }, - clear() { - if (this.$refs && this.$refs.form) { - this.changeSectionSelected(this.addModel.parkSectionCodeList, false); - delete this.addModel.id; - this.$refs.form.resetFields(); - this.addModel.mapId = this.$route.query.mapId; - this.addModel.parkSectionCodeList = []; - this.addModel.code = ''; - this.stationCode = ''; - this.sectionCode = ''; - this.isSave = true; - this.allowSelect = false; - this.isStartSelected = false; - // this.addModel.withLoop = false; - this.editShow = false; - this.field = ''; + if (this.type == 'routeMap') { this.$refs.routeConfig.setSelected(selected); } + if (this.type == 'runplanParams') { this.$refs.runPlanConfig.setSelected(selected); } } }, + // batchSectionListFocus(flag) { + // this.changeSectionSelected(this.addModel.parkSectionCodeList, flag); + // }, onContextmenu() { }, close() { this.dialogShow = false; + if (this.type == 'routeMap') { this.$refs.routeConfig.createRouteEvent(); } + if (this.type == 'runplanParams') { this.$refs.runPlanConfig.clear(); } } } }; @@ -716,18 +144,41 @@ export default { diff --git a/src/views/planMonitor/editTool/routingoperate/runplanConfig.vue b/src/views/planMonitor/editTool/routingoperate/runplanConfig.vue new file mode 100644 index 000000000..f17c887b8 --- /dev/null +++ b/src/views/planMonitor/editTool/routingoperate/runplanConfig.vue @@ -0,0 +1,212 @@ + + + diff --git a/src/views/planMonitor/editTool/schedule.vue b/src/views/planMonitor/editTool/schedule.vue index f3bda9b1d..b632ef8ac 100644 --- a/src/views/planMonitor/editTool/schedule.vue +++ b/src/views/planMonitor/editTool/schedule.vue @@ -361,8 +361,11 @@ export default { .map(serviceNumber => { return { serviceNumber }; }); }, async analyticalTripNumber(data) { + // this.tripNumberConfig.data = Object.keys(data || {}) + // .sort((a, b) => { return data[a].tripNumber - data[b].tripNumber; }) + // .map(tripNumber => { return { tripNumber }; }); this.tripNumberConfig.data = Object.keys(data || {}) - .sort((a, b) => { return data[a].tripNumber - data[b].tripNumber; }) + .sort((a, b) => { return data[a].oldIndex - data[b].oldIndex; }) .map(tripNumber => { return { tripNumber }; }); }, async setPosition() { @@ -569,7 +572,6 @@ export default { this.option.title.text = this.mapName; } this.myChart = echarts.init(document.getElementById(this.runPlanId)); - // debugger; // this.option; this.myChart.setOption(this.option); this.reSize({ width: this.$store.state.runPlan.width, height: this.$store.state.runPlan.height }); diff --git a/src/views/planMonitor/editTool/statusBar.vue b/src/views/planMonitor/editTool/statusBar.vue index 79e390e1a..502ef85c2 100644 --- a/src/views/planMonitor/editTool/statusBar.vue +++ b/src/views/planMonitor/editTool/statusBar.vue @@ -1,15 +1,15 @@