- 新增OperationDashboard.vue全屏大屏组件 - 添加6个核心KPI指标卡片: 进水总量/出水总量/产销差率/营收额/平均水质/报警次数 - 实现6个ECharts图表: 供水趋势/水质分布/报警统计/管网空间/设备状态/营收分析 - 创建静态HTML版本operation-dashboard.html,使用CDN加载Vue3/ECharts/Element Plus - 更新路由配置,添加/operation路径支持 - 修复nextTick导入问题,优化build脚本 🚧 开发者: bot_dev1 📝 任务: #38 [BI] 运营仪表盘 + 供水专题大屏
120 lines
3.1 KiB
JavaScript
120 lines
3.1 KiB
JavaScript
import defined from "../Core/defined.js";
|
|
|
|
/**
|
|
* A priority queue of tiles to be replaced, if necessary, to make room for new tiles. The queue
|
|
* is implemented as a linked list.
|
|
*
|
|
* @alias TileReplacementQueue
|
|
* @private
|
|
*/
|
|
function TileReplacementQueue() {
|
|
this.head = undefined;
|
|
this.tail = undefined;
|
|
this.count = 0;
|
|
this._lastBeforeStartOfFrame = undefined;
|
|
}
|
|
|
|
/**
|
|
* Marks the start of the render frame. Tiles before (closer to the head) this tile in the
|
|
* list were used last frame and must not be unloaded.
|
|
*/
|
|
TileReplacementQueue.prototype.markStartOfRenderFrame = function () {
|
|
this._lastBeforeStartOfFrame = this.head;
|
|
};
|
|
|
|
/**
|
|
* Reduces the size of the queue to a specified size by unloading the least-recently used
|
|
* tiles. Tiles that were used last frame will not be unloaded, even if that puts the number
|
|
* of tiles above the specified maximum.
|
|
*
|
|
* @param {number} maximumTiles The maximum number of tiles in the queue.
|
|
*/
|
|
TileReplacementQueue.prototype.trimTiles = function (maximumTiles) {
|
|
let tileToTrim = this.tail;
|
|
let keepTrimming = true;
|
|
while (
|
|
keepTrimming &&
|
|
defined(this._lastBeforeStartOfFrame) &&
|
|
this.count > maximumTiles &&
|
|
defined(tileToTrim)
|
|
) {
|
|
// Stop trimming after we process the last tile not used in the
|
|
// current frame.
|
|
keepTrimming = tileToTrim !== this._lastBeforeStartOfFrame;
|
|
|
|
const previous = tileToTrim.replacementPrevious;
|
|
|
|
if (tileToTrim.eligibleForUnloading) {
|
|
tileToTrim.freeResources();
|
|
remove(this, tileToTrim);
|
|
}
|
|
|
|
tileToTrim = previous;
|
|
}
|
|
};
|
|
|
|
function remove(tileReplacementQueue, item) {
|
|
const previous = item.replacementPrevious;
|
|
const next = item.replacementNext;
|
|
|
|
if (item === tileReplacementQueue._lastBeforeStartOfFrame) {
|
|
tileReplacementQueue._lastBeforeStartOfFrame = next;
|
|
}
|
|
|
|
if (item === tileReplacementQueue.head) {
|
|
tileReplacementQueue.head = next;
|
|
} else {
|
|
previous.replacementNext = next;
|
|
}
|
|
|
|
if (item === tileReplacementQueue.tail) {
|
|
tileReplacementQueue.tail = previous;
|
|
} else {
|
|
next.replacementPrevious = previous;
|
|
}
|
|
|
|
item.replacementPrevious = undefined;
|
|
item.replacementNext = undefined;
|
|
|
|
--tileReplacementQueue.count;
|
|
}
|
|
|
|
/**
|
|
* Marks a tile as rendered this frame and moves it before the first tile that was not rendered
|
|
* this frame.
|
|
*
|
|
* @param {TileReplacementQueue} item The tile that was rendered.
|
|
*/
|
|
TileReplacementQueue.prototype.markTileRendered = function (item) {
|
|
const head = this.head;
|
|
if (head === item) {
|
|
if (item === this._lastBeforeStartOfFrame) {
|
|
this._lastBeforeStartOfFrame = item.replacementNext;
|
|
}
|
|
return;
|
|
}
|
|
|
|
++this.count;
|
|
|
|
if (!defined(head)) {
|
|
// no other tiles in the list
|
|
item.replacementPrevious = undefined;
|
|
item.replacementNext = undefined;
|
|
this.head = item;
|
|
this.tail = item;
|
|
return;
|
|
}
|
|
|
|
if (defined(item.replacementPrevious) || defined(item.replacementNext)) {
|
|
// tile already in the list, remove from its current location
|
|
remove(this, item);
|
|
}
|
|
|
|
item.replacementPrevious = undefined;
|
|
item.replacementNext = head;
|
|
head.replacementPrevious = item;
|
|
|
|
this.head = item;
|
|
};
|
|
export default TileReplacementQueue;
|