@ued_fpi/data-visual
Version:
<br /> <br /> <div style="text-align:center"> <b style="font-size:30px">@ued_fpi/data-visual</b> <p>基于Vite4+TypeScript的Vue3大屏组件库开发框架</p> <img style="display:inline" src="https://img.shields.io/npm/v/@ued_fpi/data-visual" />
90 lines (85 loc) • 3.3 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const vue = require('vue');
const lodashEs = require('lodash-es');
const elementPlusExpand = require('@ued_fpi/element-plus-expand');
const utils = require('../../../utils.js');
const index = require('./api/index.js');
const _hoisted_1 = { class: "monitor-content" };
const _hoisted_2 = { class: "name" };
const _hoisted_3 = { class: "value" };
const _hoisted_4 = { class: "onlineCount" };
const _hoisted_5 = /* @__PURE__ */ vue.createElementVNode("span", { class: "slash" }, "/", -1);
const _hoisted_6 = { class: "totalCount" };
const _hoisted_7 = {
key: 1,
class: "empty-data"
};
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{
name: "DvWgmsWaterOnlineEnvironmentalMonitor",
title: "环境在线监测(1.4)"
},
__name: "index",
props: {
code: { default: "011" },
data: { default: null },
isLazy: { type: Boolean, default: false }
},
setup(__props, { expose: __expose }) {
const props = __props;
const time = vue.ref(15);
const list = vue.ref([]);
const { isDark } = utils.useThemeHook();
const getData = async () => {
if (props.data) {
list.value = props.data;
return;
}
const res = await index.allConfigList(props.code);
list.value = lodashEs.get(res, "data[0].children[0].children") || [];
time.value = list.value.length * 2.5;
};
vue.onMounted(async () => {
!props.isLazy && getData();
});
vue.watch([() => props.code, () => props.data, () => props.isLazy], () => {
!props.isLazy && getData();
}, { deep: true });
__expose({
reload: getData
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
list.value.length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlusExpand.FpiElRolling), {
key: 0,
"scroll-able": "",
time: time.value
}, {
default: vue.withCtx(() => [
vue.createElementVNode("div", {
class: "roll-box",
style: vue.normalizeStyle({ width: list.value.length < 4 ? "374px" : "" })
}, [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (item) => {
return vue.openBlock(), vue.createElementBlock("div", {
key: item.uniqueKey,
class: vue.normalizeClass(["item_bg", vue.unref(isDark) ? "item-bg-dark" : "item-bg-light"])
}, [
vue.createElementVNode("div", _hoisted_2, vue.toDisplayString(item.name), 1),
vue.createElementVNode("div", _hoisted_3, [
vue.createElementVNode("span", _hoisted_4, vue.toDisplayString(item.onlineCount), 1),
_hoisted_5,
vue.createElementVNode("span", _hoisted_6, vue.toDisplayString(item.totalCount), 1)
])
], 2);
}), 128))
], 4)
]),
_: 1
}, 8, ["time"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, " 暂无数据 "))
]);
};
}
});
exports.default = _sfc_main;