- 新增OperationDashboard.vue全屏大屏组件 - 添加6个核心KPI指标卡片: 进水总量/出水总量/产销差率/营收额/平均水质/报警次数 - 实现6个ECharts图表: 供水趋势/水质分布/报警统计/管网空间/设备状态/营收分析 - 创建静态HTML版本operation-dashboard.html,使用CDN加载Vue3/ECharts/Element Plus - 更新路由配置,添加/operation路径支持 - 修复nextTick导入问题,优化build脚本 🚧 开发者: bot_dev1 📝 任务: #38 [BI] 运营仪表盘 + 供水专题大屏
59 lines
2.3 KiB
JavaScript
59 lines
2.3 KiB
JavaScript
import { isClient } from "../../utils/browser.mjs";
|
|
import { isArray, isElement } from "../../utils/types.mjs";
|
|
//#region ../../packages/directives/click-outside/index.ts
|
|
const nodeList = /* @__PURE__ */ new Map();
|
|
if (isClient) {
|
|
let startClick;
|
|
document.addEventListener("mousedown", (e) => startClick = e);
|
|
document.addEventListener("mouseup", (e) => {
|
|
if (startClick) {
|
|
for (const handlers of nodeList.values()) for (const { documentHandler } of handlers) documentHandler(e, startClick);
|
|
startClick = void 0;
|
|
}
|
|
});
|
|
}
|
|
function createDocumentHandler(el, binding) {
|
|
let excludes = [];
|
|
if (isArray(binding.arg)) excludes = binding.arg;
|
|
else if (isElement(binding.arg)) excludes.push(binding.arg);
|
|
return function(mouseup, mousedown) {
|
|
const popperRef = binding.instance.popperRef;
|
|
const mouseUpTarget = mouseup.target;
|
|
const mouseDownTarget = mousedown?.target;
|
|
const isBound = !binding || !binding.instance;
|
|
const isTargetExists = !mouseUpTarget || !mouseDownTarget;
|
|
const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
|
|
const isSelf = el === mouseUpTarget;
|
|
const isTargetExcluded = excludes.length && excludes.some((item) => item?.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
|
|
const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
|
|
if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) return;
|
|
binding.value(mouseup, mousedown);
|
|
};
|
|
}
|
|
const ClickOutside = {
|
|
beforeMount(el, binding) {
|
|
if (!nodeList.has(el)) nodeList.set(el, []);
|
|
nodeList.get(el).push({
|
|
documentHandler: createDocumentHandler(el, binding),
|
|
bindingFn: binding.value
|
|
});
|
|
},
|
|
updated(el, binding) {
|
|
if (!nodeList.has(el)) nodeList.set(el, []);
|
|
const handlers = nodeList.get(el);
|
|
const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
|
|
const newHandler = {
|
|
documentHandler: createDocumentHandler(el, binding),
|
|
bindingFn: binding.value
|
|
};
|
|
if (oldHandlerIndex >= 0) handlers.splice(oldHandlerIndex, 1, newHandler);
|
|
else handlers.push(newHandler);
|
|
},
|
|
unmounted(el) {
|
|
nodeList.delete(el);
|
|
}
|
|
};
|
|
//#endregion
|
|
export { ClickOutside as default };
|
|
|
|
//# sourceMappingURL=index.mjs.map
|