- 新增OperationDashboard.vue全屏大屏组件 - 添加6个核心KPI指标卡片: 进水总量/出水总量/产销差率/营收额/平均水质/报警次数 - 实现6个ECharts图表: 供水趋势/水质分布/报警统计/管网空间/设备状态/营收分析 - 创建静态HTML版本operation-dashboard.html,使用CDN加载Vue3/ECharts/Element Plus - 更新路由配置,添加/operation路径支持 - 修复nextTick导入问题,优化build脚本 🚧 开发者: bot_dev1 📝 任务: #38 [BI] 运营仪表盘 + 供水专题大屏
127 lines
3.3 KiB
JavaScript
127 lines
3.3 KiB
JavaScript
import Frozen from "../Core/Frozen.js";
|
|
import defined from "../Core/defined.js";
|
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
import MetadataSchema from "./MetadataSchema.js";
|
|
import ResourceLoader from "./ResourceLoader.js";
|
|
import ResourceLoaderState from "./ResourceLoaderState.js";
|
|
|
|
/**
|
|
* A {@link MetadataSchema} loader.
|
|
* <p>
|
|
* Implements the {@link ResourceLoader} interface.
|
|
* </p>
|
|
*
|
|
* @private
|
|
* @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
|
|
*/
|
|
class MetadataSchemaLoader extends ResourceLoader {
|
|
/**
|
|
* @param {object} options Object with the following properties:
|
|
* @param {object} [options.schema] An object that explicitly defines a schema JSON. Mutually exclusive with options.resource.
|
|
* @param {Resource} [options.resource] The {@link Resource} pointing to the schema JSON. Mutually exclusive with options.schema.
|
|
* @param {string} [options.cacheKey] The cache key of the resource.
|
|
*
|
|
* @exception {DeveloperError} One of options.schema and options.resource must be defined.
|
|
*/
|
|
constructor(options) {
|
|
super();
|
|
|
|
options = options ?? Frozen.EMPTY_OBJECT;
|
|
const schema = options.schema;
|
|
const resource = options.resource;
|
|
const cacheKey = options.cacheKey;
|
|
|
|
//>>includeStart('debug', pragmas.debug);
|
|
if (defined(schema) === defined(resource)) {
|
|
throw new DeveloperError(
|
|
"One of options.schema and options.resource must be defined.",
|
|
);
|
|
}
|
|
//>>includeEnd('debug');
|
|
|
|
this._schema = defined(schema)
|
|
? MetadataSchema.fromJson(schema)
|
|
: undefined;
|
|
this._resource = resource;
|
|
this._cacheKey = cacheKey;
|
|
this._state = ResourceLoaderState.UNLOADED;
|
|
this._promise = undefined;
|
|
}
|
|
|
|
/**
|
|
* The cache key of the resource.
|
|
*
|
|
*
|
|
* @type {string}
|
|
* @readonly
|
|
* @private
|
|
*/
|
|
get cacheKey() {
|
|
return this._cacheKey;
|
|
}
|
|
|
|
/**
|
|
* The metadata schema object.
|
|
*
|
|
*
|
|
* @type {MetadataSchema}
|
|
* @readonly
|
|
* @private
|
|
*/
|
|
get schema() {
|
|
return this._schema;
|
|
}
|
|
|
|
/**
|
|
* Loads the resource.
|
|
* @returns {Promise<MetadataSchemaLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
* @private
|
|
*/
|
|
async load() {
|
|
if (defined(this._promise)) {
|
|
return this._promise;
|
|
}
|
|
|
|
if (defined(this._schema)) {
|
|
this._promise = Promise.resolve(this);
|
|
return this._promise;
|
|
}
|
|
|
|
this._promise = loadExternalSchema(this);
|
|
return this._promise;
|
|
}
|
|
|
|
/**
|
|
* Unloads the resource.
|
|
* @private
|
|
*/
|
|
unload() {
|
|
this._schema = undefined;
|
|
}
|
|
}
|
|
|
|
async function loadExternalSchema(schemaLoader) {
|
|
const resource = schemaLoader._resource;
|
|
schemaLoader._state = ResourceLoaderState.LOADING;
|
|
try {
|
|
const json = await resource.fetchJson();
|
|
if (schemaLoader.isDestroyed()) {
|
|
return;
|
|
}
|
|
|
|
schemaLoader._schema = MetadataSchema.fromJson(json);
|
|
schemaLoader._state = ResourceLoaderState.READY;
|
|
return schemaLoader;
|
|
} catch (error) {
|
|
if (schemaLoader.isDestroyed()) {
|
|
return;
|
|
}
|
|
|
|
schemaLoader._state = ResourceLoaderState.FAILED;
|
|
const errorMessage = `Failed to load schema: ${resource.url}`;
|
|
throw schemaLoader.getError(errorMessage, error);
|
|
}
|
|
}
|
|
|
|
export default MetadataSchemaLoader;
|