From c1050d16ab413f9e4bbe67d2a46adbe638bf78f6 Mon Sep 17 00:00:00 2001 From: lVAL Date: Wed, 21 Oct 2020 18:36:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9AUSTool=20=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/rpTools.js | 2 +- src/jmapNew/theme/aus_00/planConvert copy.js | 268 ++++++++ src/jmapNew/theme/aus_00/planConvert.js | 174 ++---- src/jmapNew/theme/aus_00/utils.js | 156 ++--- .../dialog/planJustRunning.vue | 12 +- .../dialog/planJustStop.vue | 12 +- .../dialog/planModifyArea.vue | 158 +++++ .../dialog/planSetParams.vue | 127 ++++ .../planMonitor/editToolAUS - 副本/index.vue | 429 +++++++++++++ .../menus.vue | 31 +- .../planMonitor/editToolAUS - 副本/monitor.js | 369 +++++++++++ .../editToolAUS - 副本/schedule.vue | 382 ++++++++++++ .../planMonitor/editToolAUS - 副本/utils.js | 46 ++ .../planMonitor/editToolAUS copy/-index.vue | 77 --- .../planMonitor/editToolAUS copy/index.vue | 351 ----------- .../planMonitor/editToolAUS copy/monitor.js | 339 ---------- .../planMonitor/editToolAUS copy/schedule.vue | 586 ------------------ .../planMonitor/editToolAUS copy/utils.js | 37 -- .../editToolAUS/dialog/planModifyArea.vue | 2 +- .../editToolAUS/dialog/planSetAreaNote.vue | 80 +++ src/views/planMonitor/editToolAUS/index.vue | 56 +- src/views/planMonitor/editToolAUS/menus.vue | 15 +- src/views/planMonitor/editToolAUS/monitor.js | 388 ++++++++---- .../planMonitor/editToolAUS/schedule.vue | 16 +- src/views/planMonitor/editToolAUS/utils.js | 36 +- 25 files changed, 2366 insertions(+), 1783 deletions(-) create mode 100644 src/jmapNew/theme/aus_00/planConvert copy.js rename src/views/planMonitor/{editToolAUS copy => editToolAUS - 副本}/dialog/planJustRunning.vue (90%) rename src/views/planMonitor/{editToolAUS copy => editToolAUS - 副本}/dialog/planJustStop.vue (87%) create mode 100644 src/views/planMonitor/editToolAUS - 副本/dialog/planModifyArea.vue create mode 100644 src/views/planMonitor/editToolAUS - 副本/dialog/planSetParams.vue create mode 100644 src/views/planMonitor/editToolAUS - 副本/index.vue rename src/views/planMonitor/{editToolAUS copy => editToolAUS - 副本}/menus.vue (87%) create mode 100644 src/views/planMonitor/editToolAUS - 副本/monitor.js create mode 100644 src/views/planMonitor/editToolAUS - 副本/schedule.vue create mode 100644 src/views/planMonitor/editToolAUS - 副本/utils.js delete mode 100644 src/views/planMonitor/editToolAUS copy/-index.vue delete mode 100644 src/views/planMonitor/editToolAUS copy/index.vue delete mode 100644 src/views/planMonitor/editToolAUS copy/monitor.js delete mode 100644 src/views/planMonitor/editToolAUS copy/schedule.vue delete mode 100644 src/views/planMonitor/editToolAUS copy/utils.js create mode 100644 src/views/planMonitor/editToolAUS/dialog/planSetAreaNote.vue diff --git a/src/api/rpTools.js b/src/api/rpTools.js index ffac62027..e6837c471 100644 --- a/src/api/rpTools.js +++ b/src/api/rpTools.js @@ -120,7 +120,7 @@ export function justTripNoStop(tripNo, data) { /** * 平移车次 */ -export function translateTripNo(tripNo, data) { +export function translateTrip(tripNo, data) { return request({ url: `/api/rpTools/${tripNo}/trip`, method: 'put', diff --git a/src/jmapNew/theme/aus_00/planConvert copy.js b/src/jmapNew/theme/aus_00/planConvert copy.js new file mode 100644 index 000000000..e70629e38 --- /dev/null +++ b/src/jmapNew/theme/aus_00/planConvert copy.js @@ -0,0 +1,268 @@ +import { createSeriesModel, createMarkLineModels, createMartPoint } from './utils'; +import { toTimeStamp } from '@/utils/date'; + +export default { + /** 边缘高度*/ + EdgeHeight: 600, + + /** 间隔高度*/ + CoordMultiple: 1, + + /** 偏移时间*/ + TranslationTime: 0, + + /** 将后台数据解析成图形*/ + parseDataToGraph(chart, planData, stations, kmRangeCoordinateMap) { + const graphs = []; + if (planData && + planData.areaList && + planData.areaList.length) { + planData.areaList.forEach(area => { + const startTime = toTimeStamp(area.startTime); + const endTime = toTimeStamp(area.endTime); + + const fartherKm = this.getCoordinateYByObj(stations, kmRangeCoordinateMap, {stationCode: area.fartherStationCode}); + const closerKm = this.getCoordinateYByObj(stations, kmRangeCoordinateMap, {stationCode: area.closerStationCode}); + const point1 = [ startTime, fartherKm]; + const point2 = [ endTime, closerKm] + const position = chart.convertToPixel('grid', point1); + const position2 = chart.convertToPixel('grid', point2) + const width = Math.abs(position[0] - position2[0]); + const height = Math.abs(position[1] - position2[1]); + + graphs.push({ + type: 'rect', + subType: 'Area', + areaNo: area.areaNo, + position, + point1, + point2, + model: area, + shape: { + x: 0, + y: 0, + width, + height + }, + style: { + fill: 'rgb(255,0,0, 0.3)', + stroke: 'rgb(255, 0, 0, 0.8)' + }, + z: 100 + }) + }) + } + + return graphs; + }, + + /** 将后台数据解析成折线*/ + parseDataToSeries(chart, planData, stations, kmRangeCoordinateMap) { + const models = []; + if (planData && + planData.serviceList && + planData.serviceList.length) { + planData.serviceList.forEach((service,i) => { + if (service.tripList && + service.tripList.length) { + + service.tripList.forEach((trip,j) => { + const opt = { + name: `plan-${service.serviceNo}-${trip.tripNo}-${trip.direction}`, + type: 'line', + symbolSize: 1, + showAllSymbol: true, + markPoint: { data: [] }, + data: [] + }; + + var lastPoint = null; + var nextPoint = null; + var pointData = { + name: `${service.serviceNo}-${trip.tripNo}`, + color: '#000', + direction: trip.direction, + coord: [trip.stationTimeList[0].departureTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, trip.stationTimeList[0], trip.direction, false)], + }; + + opt.markPoint.data.push(createMartPoint(pointData)); + + trip.stationTimeList.forEach(elem => { + const name = `${trip.direction}${trip.tripNo}`; + if (elem.arrivalTime) { + opt.data.push([elem.arrivalTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, elem, elem.direction, false), { + stationCode: elem.stationCode, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + name + }]); + } + + if (elem.departureTime) { + opt.data.push([elem.departureTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, elem, elem.direction, false), { + stationCode: elem.stationCode, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + name + }]); + } + }); + + const model = createSeriesModel(opt, + { color: '#000', width: 1 }, + { color: '#000', fill: '#000'} + ); + models.push(model); + + if (service.tripList[j + 1] && + service.tripList[j + 1].stationTimeList) { + const opt = { + name: `reentry-${service.serviceNo}-${trip.tripNo}-${trip.direction}`, + type: 'line', + symbolSize: 1, + showAllSymbol: false, + markPoint: { data: [] }, + data: [] + }; + + lastPoint = trip.stationTimeList[trip.stationTimeList.length-1]; + nextPoint = service.tripList[j + 1].stationTimeList[0]; + const name = `${trip.direction}${trip.tripNo}`; + opt.data.push([lastPoint.arrivalTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, lastPoint, trip.direction, false), { + stationCode: lastPoint.stationCode, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + name + }]); + + opt.data.push([lastPoint.arrivalTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, lastPoint, trip.direction, true), { + stationCode: lastPoint.stationCode, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + name + }]); + opt.data.push([nextPoint.departureTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, lastPoint, trip.direction, true), { + stationCode: lastPoint.stationCode, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + name + }]); + opt.data.push([nextPoint.departureTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, lastPoint, trip.direction, false), { + stationCode: lastPoint.stationCode, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + name + }]); + + + const model = createSeriesModel(opt, + { color: '#000', width: 1 }, + { color: '#000', fill: '#000'} + ); + models.push(model); + } + }); + } + }) + } + + return models; +}, + + /** 更新数据并解析成折线*/ + updateDataToModels(chart, planData, stations, kmRangeCoordinateMap, series) { + if (planData && planData.length) { + } + return series; + }, + + /** 初始化Y轴*/ + initializeYaxis(stations) { + return createMarkLineModels(stations, (elem) => { + return this.EdgeHeight + elem.kmRange * this.CoordMultiple; + }); + }, + + /** 将后台数据转换为试图序列模型*/ + convertStationsToMap(stations) { + var map = {}; + if (stations && stations.length) { + stations.forEach((elem) => { + map[`${elem.kmRange}`] = this.EdgeHeight + elem.kmRange * this.CoordMultiple; + }); + } + + return map; + }, + + /** 计算y轴最小值*/ + computedYaxisMinValue(stations) { + return stations[0].kmRange * this.CoordMultiple; + }, + + /** 计算y轴最大值*/ + computedYaxisMaxValue(stations) { + return stations[stations.length - 1].kmRange * this.CoordMultiple + this.EdgeHeight * 2; + }, + + /** 格式化y轴数据*/ + computedFormatYAxis(stations, params) { + var yText = '0m'; + + stations.forEach(elem => { + if (elem.kmRange < parseInt(params.value) / this.CoordMultiple - this.EdgeHeight) { + yText = Math.floor(elem.kmRange) + 'm'; + } + }); + + return yText; + }, + + /** 根据方向计算y折返偏移量*/ + getYvalueByDirectionCode(defaultVlue, direction) { + if (direction === '1') { + defaultVlue -= this.EdgeHeight / 2; + } else if (direction === '2') { + defaultVlue += this.EdgeHeight / 2; + } + + return defaultVlue; + }, + + + /** 根据elem计算y值*/ + getCoordinateYByObj(stations, kmRangeCoordinateMap, obj, direction, isSpecial) { + var defaultVlue = 0; + var station = stations.find(it => { return it.code == obj.stationCode; }); + if (station) { + defaultVlue = kmRangeCoordinateMap[`${station.kmRange}`]; + if (isSpecial) { + defaultVlue = this.getYvalueByDirectionCode(defaultVlue, direction); + } + } + + return defaultVlue; + }, + + /** 通过y坐标获取站信息 */ + getStationByCoordinate(stations, y) { + for(var i = stations.length-1; i >= 0; i--) { + const station = stations[i]; + const edge = this.EdgeHeight + const preKm = i == 0? edge*2: Math.abs(station.kmRange-stations[i-1].kmRange)/2; + const nxtKm = i == stations.length-1? edge: Math.abs(station.kmRange-stations[i+1].kmRange)/2; + const min = edge + station.kmRange - preKm; + const max = edge + station.kmRange + nxtKm; + if (y >= min && y <= max) { + return station; + } + } + return null; + } +}; diff --git a/src/jmapNew/theme/aus_00/planConvert.js b/src/jmapNew/theme/aus_00/planConvert.js index e70629e38..7e00cbdf0 100644 --- a/src/jmapNew/theme/aus_00/planConvert.js +++ b/src/jmapNew/theme/aus_00/planConvert.js @@ -1,4 +1,4 @@ -import { createSeriesModel, createMarkLineModels, createMartPoint } from './utils'; +import { createSeriesModel, createMarkLineModels, createRectArea, createMartPoint } from './utils'; import { toTimeStamp } from '@/utils/date'; export default { @@ -12,7 +12,7 @@ export default { TranslationTime: 0, /** 将后台数据解析成图形*/ - parseDataToGraph(chart, planData, stations, kmRangeCoordinateMap) { + parseDataToGraph(chart, planData, stations) { const graphs = []; if (planData && planData.areaList && @@ -21,8 +21,8 @@ export default { const startTime = toTimeStamp(area.startTime); const endTime = toTimeStamp(area.endTime); - const fartherKm = this.getCoordinateYByObj(stations, kmRangeCoordinateMap, {stationCode: area.fartherStationCode}); - const closerKm = this.getCoordinateYByObj(stations, kmRangeCoordinateMap, {stationCode: area.closerStationCode}); + const fartherKm = this.getCoordinateYByStationCode(stations, area.fartherStationCode); + const closerKm = this.getCoordinateYByStationCode(stations, area.closerStationCode); const point1 = [ startTime, fartherKm]; const point2 = [ endTime, closerKm] const position = chart.convertToPixel('grid', point1); @@ -30,26 +30,15 @@ export default { const width = Math.abs(position[0] - position2[0]); const height = Math.abs(position[1] - position2[1]); - graphs.push({ - type: 'rect', - subType: 'Area', + graphs.push(createRectArea({ areaNo: area.areaNo, + model: area, position, point1, point2, - model: area, - shape: { - x: 0, - y: 0, - width, - height - }, - style: { - fill: 'rgb(255,0,0, 0.3)', - stroke: 'rgb(255, 0, 0, 0.8)' - }, - z: 100 - }) + width, + height + })); }) } @@ -57,7 +46,7 @@ export default { }, /** 将后台数据解析成折线*/ - parseDataToSeries(chart, planData, stations, kmRangeCoordinateMap) { + parseDataToSeries(chart, planData, stations) { const models = []; if (planData && planData.serviceList && @@ -66,108 +55,85 @@ export default { if (service.tripList && service.tripList.length) { - service.tripList.forEach((trip,j) => { - const opt = { - name: `plan-${service.serviceNo}-${trip.tripNo}-${trip.direction}`, - type: 'line', - symbolSize: 1, - showAllSymbol: true, - markPoint: { data: [] }, - data: [] - }; + const opt = { + name: `service${service.serviceNo}`, + type: 'line', + symbolSize: 1, + showAllSymbol: true, + markPoint: { data: [] }, + data: [] + }; + service.tripList.forEach((trip,j) => { var lastPoint = null; var nextPoint = null; var pointData = { name: `${service.serviceNo}-${trip.tripNo}`, color: '#000', direction: trip.direction, - coord: [trip.stationTimeList[0].departureTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, trip.stationTimeList[0], trip.direction, false)], + coord: [trip.stationTimeList[0].departureTime, this.getCoordinateYByStationCode(stations, trip.stationTimeList[0].stationCode)], }; opt.markPoint.data.push(createMartPoint(pointData)); trip.stationTimeList.forEach(elem => { - const name = `${trip.direction}${trip.tripNo}`; if (elem.arrivalTime) { - opt.data.push([elem.arrivalTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, elem, elem.direction, false), { + opt.data.push([elem.arrivalTime, this.getCoordinateYByStationCode(stations, elem.stationCode), { stationCode: elem.stationCode, serviceNo: service.serviceNo, tripNo: trip.tripNo, direction: trip.direction, - name + silent: false }]); } if (elem.departureTime) { - opt.data.push([elem.departureTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, elem, elem.direction, false), { + opt.data.push([elem.departureTime, this.getCoordinateYByStationCode(stations, elem.stationCode), { stationCode: elem.stationCode, serviceNo: service.serviceNo, tripNo: trip.tripNo, direction: trip.direction, - name + silent: false }]); } }); - const model = createSeriesModel(opt, - { color: '#000', width: 1 }, - { color: '#000', fill: '#000'} - ); - models.push(model); - if (service.tripList[j + 1] && service.tripList[j + 1].stationTimeList) { - const opt = { - name: `reentry-${service.serviceNo}-${trip.tripNo}-${trip.direction}`, - type: 'line', - symbolSize: 1, - showAllSymbol: false, - markPoint: { data: [] }, - data: [] - }; lastPoint = trip.stationTimeList[trip.stationTimeList.length-1]; nextPoint = service.tripList[j + 1].stationTimeList[0]; - const name = `${trip.direction}${trip.tripNo}`; - opt.data.push([lastPoint.arrivalTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, lastPoint, trip.direction, false), { - stationCode: lastPoint.stationCode, - serviceNo: service.serviceNo, - tripNo: trip.tripNo, - direction: trip.direction, - name - }]); - opt.data.push([lastPoint.arrivalTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, lastPoint, trip.direction, true), { - stationCode: lastPoint.stationCode, - serviceNo: service.serviceNo, - tripNo: trip.tripNo, - direction: trip.direction, - name - }]); - opt.data.push([nextPoint.departureTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, lastPoint, trip.direction, true), { - stationCode: lastPoint.stationCode, - serviceNo: service.serviceNo, - tripNo: trip.tripNo, - direction: trip.direction, - name - }]); - opt.data.push([nextPoint.departureTime, this.getCoordinateYByObj(stations, kmRangeCoordinateMap, lastPoint, trip.direction, false), { - stationCode: lastPoint.stationCode, - serviceNo: service.serviceNo, - tripNo: trip.tripNo, - direction: trip.direction, - name - }]); - - - const model = createSeriesModel(opt, - { color: '#000', width: 1 }, - { color: '#000', fill: '#000'} - ); - models.push(model); + opt.data.push({ + value: [lastPoint.arrivalTime, this.getCoordinateYByStationCode(stations, lastPoint.stationCode, true, trip.direction), { + stationCode: lastPoint.stationCode, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + silent: true + }], + symbol: 'none', + symbolSize: 1, + }); + opt.data.push({ + value: [nextPoint.departureTime, this.getCoordinateYByStationCode(stations, lastPoint.stationCode, true, trip.direction), { + stationCode: lastPoint.stationCode, + serviceNo: service.serviceNo, + tripNo: trip.tripNo, + direction: trip.direction, + silent: true + }], + symbol: 'none', + symbolSize: 1, + }); } }); + + const model = createSeriesModel(opt, + { color: '#000', width: 1 }, + { color: '#000', fill: '#000'} + ); + models.push(model); } }) } @@ -176,7 +142,7 @@ export default { }, /** 更新数据并解析成折线*/ - updateDataToModels(chart, planData, stations, kmRangeCoordinateMap, series) { + updateDataToModels(chart, planData, stations, series) { if (planData && planData.length) { } return series; @@ -189,18 +155,6 @@ export default { }); }, - /** 将后台数据转换为试图序列模型*/ - convertStationsToMap(stations) { - var map = {}; - if (stations && stations.length) { - stations.forEach((elem) => { - map[`${elem.kmRange}`] = this.EdgeHeight + elem.kmRange * this.CoordMultiple; - }); - } - - return map; - }, - /** 计算y轴最小值*/ computedYaxisMinValue(stations) { return stations[0].kmRange * this.CoordMultiple; @@ -225,29 +179,29 @@ export default { }, /** 根据方向计算y折返偏移量*/ - getYvalueByDirectionCode(defaultVlue, direction) { + getOffsetYByDirection(value, direction) { if (direction === '1') { - defaultVlue -= this.EdgeHeight / 2; + value -= this.EdgeHeight / 2; } else if (direction === '2') { - defaultVlue += this.EdgeHeight / 2; + value += this.EdgeHeight / 2; } - return defaultVlue; + return value; }, - /** 根据elem计算y值*/ - getCoordinateYByObj(stations, kmRangeCoordinateMap, obj, direction, isSpecial) { - var defaultVlue = 0; - var station = stations.find(it => { return it.code == obj.stationCode; }); + /** 通过站信息获取y坐标*/ + getCoordinateYByStationCode(stations, stationCode, isSpecial=false, direction='01') { + var value = 0; + var station = stations.find(it => { return it.code == stationCode; }); if (station) { - defaultVlue = kmRangeCoordinateMap[`${station.kmRange}`]; + value = this.EdgeHeight + station.kmRange * this.CoordMultiple; if (isSpecial) { - defaultVlue = this.getYvalueByDirectionCode(defaultVlue, direction); + value = this.getOffsetYByDirection(value, direction); } } - return defaultVlue; + return value; }, /** 通过y坐标获取站信息 */ diff --git a/src/jmapNew/theme/aus_00/utils.js b/src/jmapNew/theme/aus_00/utils.js index 435b6fafa..95a1a4fa6 100644 --- a/src/jmapNew/theme/aus_00/utils.js +++ b/src/jmapNew/theme/aus_00/utils.js @@ -20,11 +20,10 @@ export function createMartPoint(opt) { }; } -/** 创建一个车次数据序列*/ +/** 创建一个服务数据序列*/ export function createSeriesModel(opt, lineStyle={}, itemStyle={}) { return { - z: opt.z || 5, - zlevel: opt.zlevel || 0, + z: opt.z || 2, type: 'line', name: opt.name, data: opt.data, @@ -42,12 +41,47 @@ export function createSeriesModel(opt, lineStyle={}, itemStyle={}) { }; } +/** + * 创建一个区域 + */ +export function createRectArea(opt, style={}) { + return { + type: 'rect', + subType: 'Area', + areaNo: opt.model.areaNo, + position: opt.position, + point1: opt.point1, + point2: opt.point2, + model: opt.model, + shape: { + x: 0, + y: 0, + width: opt.width, + height: opt.height + }, + style: { + fill: 'rgb(255,0,0, 0.3)', + stroke: 'rgb(255, 0, 0, 0.8)', + text: opt.model.text, + textFill: 'rgb(0, 0, 0)', + fontSize: 18, + fontWeight: 500, + textVerticalAlign: 'middle', + textAlign: 'center', + ...style + }, + z: 100 + } +} + /** 创建标记横线*/ export function createMarkLineModels(stations, computedYaxis) { const markLineModel = {}; if (stations && stations.length) { markLineModel.type = 'line'; - markLineModel.name = 'markline'; + markLineModel.name = 'markline'; + markLineModel.silent = true; + markLineModel.animation = false; markLineModel.markLine = {}; markLineModel.markLine.silent = true; markLineModel.markLine.data = []; @@ -76,120 +110,8 @@ export function createMarkLineModels(stations, computedYaxis) { return markLineModel; } -/** 创建不会重复颜色的内部对象*/ -export const hexColor = { - colorIndex: 0, - difValue: 0.25, // 一般为0.25 - oddColor: null, - eveColor: null, - oldColor: null, - newColor: null, - colorList: [ - '#000000', '#0000FF', '#8A2BE2', '#A52A2A', '#DEB887', '#5F9EA0', '#7FFF00', '#FF7F50', '#6495ED', '#DC143C', - '#00FFFF', '#008B8B', '#B8860B', '#BDB76B', '#8B008B', '#FF8C00', '#9932CC', '#8FBC8F', '#FF1493', '#00BFFF', - '#FF00FF', '#FFD700', '#FF69B4', '#FF4500', '#DB7093', '#4169E1', '#6A5ACD', '#00FF7F', '#EE82EE', '#40E0D0' - ], - colors: [ - '#B9C671', '#6C9040', '#79C671', '#71A5C6', '#C6A071', '#71C689', '#' - ], - randomHsl: function () { - const h = Math.random(); - const s = Math.random(); - const l = Math.random(); - return [h, s, l]; - }, - hslToRgb: function (h, s, l) { - let r, g, b; - - if (s === 0) { - r = g = b = l; // achromatic - } else { - const hue2rgb = function hue2rgb(p, q, t) { - if (t < 0) t += 1; - if (t > 1) t -= 1; - if (t < 1 / 6) return p + (q - p) * 6 * t; - if (t < 1 / 2) return q; - if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; - return p; - }; - - const q = l < 0.5 ? l * (1 + s) : l + s - l * s; - const p = 2 * l - q; - r = hue2rgb(p, q, h + 1 / 3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1 / 3); - } - - return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)]; - }, - rgbToHsl: function (r, g, b) { - // eslint-disable-next-line no-sequences - r /= 255, g /= 255, b /= 255; - const max = Math.max(r, g, b); const min = Math.min(r, g, b); - let h; let s; const l = (max + min) / 2; - - if (max === min) { - h = s = 0; // achromatic - } else { - const d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch (max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - - return [h, s, l]; - }, - // 固定颜色 - colorFixed() { - var color = this.colorList[this.colorIndex++ % this.colorList.length]; - return color; - }, - // 随机颜色 - colorRandom() { - return '#' + (Math.random() * 0xffffff << 0).toString(16); - }, - // 生成和前一个不同的随机颜色 - colorContrast() { - this.newColor = this.randomHsl(); // 获取随机的hsl,并且给一个默认的hsl - this.newColor[1] = 0.7 + this.newColor[1] * 0.2; // [0.7 - 0.9] 排除过灰颜色 - this.newColor[2] = 0.4 + this.newColor[2] * 0.2; // [0.4 - 0.8] 排除过亮过暗色 - - /** 如果oldColor不为空时,要根据车次号保证两次生成的颜色差值为difValue*/ - this.oldColor = Number(this.colorIndex) % 2 ? this.oddColor : this.eveColor; - if (this.oldColor) { - /** 保证本次的颜色和上次的不一致*/ - for (let i = 0; i < this.newColor.length && i < this.oldColor.length; i++) { - if (i === 0 && Math.abs(this.newColor[i].toFixed(2) - this.oldColor[i].toFixed(2)) < this.difValue) { - this.colorRandom(); - break; - } - } - } - - /** 保存之前的颜色状态*/ - if (Number(this.colorIndex) % 2) { - this.oddColor = this.newColor; - } else { - this.eveColor = this.newColor; - } - - this.colorIndex += 1; - return `#${this.hslToRgb(...this.newColor).map(e => { return Number(e).toString(16); }).join('')}`; - }, - // 渐进颜色 - colorProgressiveColor() { - }, - toCreate: function () { - return this.colorRandom(); - } -}; - /** 对list数据进行排序, 相同元素保持原有顺序*/ -export function sortListByCallBack(list, callback) { +export function sortListByCb(list, callback) { list.map((elem, index) => { elem[`oldIndex`] = index; }); list.sort((a, b) => { return callback(a, b) || a.oldIndex - b.oldIndex; diff --git a/src/views/planMonitor/editToolAUS copy/dialog/planJustRunning.vue b/src/views/planMonitor/editToolAUS - 副本/dialog/planJustRunning.vue similarity index 90% rename from src/views/planMonitor/editToolAUS copy/dialog/planJustRunning.vue rename to src/views/planMonitor/editToolAUS - 副本/dialog/planJustRunning.vue index 36f1dc765..7f906c7bc 100644 --- a/src/views/planMonitor/editToolAUS copy/dialog/planJustRunning.vue +++ b/src/views/planMonitor/editToolAUS - 副本/dialog/planJustRunning.vue @@ -14,7 +14,7 @@ diff --git a/src/views/planMonitor/editToolAUS - 副本/dialog/planSetParams.vue b/src/views/planMonitor/editToolAUS - 副本/dialog/planSetParams.vue new file mode 100644 index 000000000..55b4f9dd0 --- /dev/null +++ b/src/views/planMonitor/editToolAUS - 副本/dialog/planSetParams.vue @@ -0,0 +1,127 @@ + + + diff --git a/src/views/planMonitor/editToolAUS - 副本/index.vue b/src/views/planMonitor/editToolAUS - 副本/index.vue new file mode 100644 index 000000000..355721fef --- /dev/null +++ b/src/views/planMonitor/editToolAUS - 副本/index.vue @@ -0,0 +1,429 @@ + + + + diff --git a/src/views/planMonitor/editToolAUS copy/menus.vue b/src/views/planMonitor/editToolAUS - 副本/menus.vue similarity index 87% rename from src/views/planMonitor/editToolAUS copy/menus.vue rename to src/views/planMonitor/editToolAUS - 副本/menus.vue index b18bc1872..71cea6157 100644 --- a/src/views/planMonitor/editToolAUS copy/menus.vue +++ b/src/views/planMonitor/editToolAUS - 副本/menus.vue @@ -1,6 +1,6 @@