@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" />
98 lines (93 loc) • 3.31 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const vue = require('vue');
const elementPlusExpand = require('@ued_fpi/element-plus-expand');
const index = require('./api/index.js');
const _hoisted_1 = { class: "list flex-between-center" };
const _hoisted_2 = {
key: 0,
class: "name"
};
const _hoisted_3 = ["title"];
const _hoisted_4 = { class: "num" };
const _hoisted_5 = { class: "pre" };
const clsfix = "dv-aims-pollution-source-monitor";
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
__name: "index",
props: {
isUseBuiltInApi: { type: Boolean, default: true },
apiParams: { default: () => ({
showCount: true,
withPms: true
}) },
data: {}
},
setup(__props) {
const props = __props;
const siteTypeList = vue.ref([]);
const fetchData = async () => {
index.getSiteMonitorTypeTree(props.apiParams).then((res) => {
if (!res)
return;
const allList = [];
getAllChildrenData(res.filter((item) => item.code === "PS_MONITOR"), allList);
siteTypeList.value = allList;
});
};
const getAllChildrenData = (data, allList) => {
data.forEach((item) => {
if (item.children?.length) {
getAllChildrenData(item.children, allList);
return;
}
allList.push(item);
});
};
vue.onMounted(() => {
if (props.isUseBuiltInApi)
fetchData();
});
vue.watch([() => props.apiParams], () => {
if (props.isUseBuiltInApi)
fetchData();
});
vue.watch(() => props.data, () => {
if (!props.isUseBuiltInApi && props.data)
siteTypeList.value = props.data;
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("div", {
class: vue.normalizeClass(`${clsfix}-container`)
}, [
vue.createVNode(vue.unref(elementPlusExpand.FpiElRolling), {
direction: "x",
"scroll-able": "",
time: siteTypeList.value.length * 2
}, {
default: vue.withCtx(() => [
vue.createElementVNode("div", _hoisted_1, [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(siteTypeList.value, (item) => {
return vue.openBlock(), vue.createElementBlock("div", {
key: item.code,
class: "item"
}, [
item.name.length < 6 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, vue.toDisplayString(item.name), 1)) : (vue.openBlock(), vue.createElementBlock("div", {
key: 1,
class: "name",
title: item.name
}, vue.toDisplayString(`${item.name.slice(0, 4)}...`), 9, _hoisted_3)),
vue.createElementVNode("div", _hoisted_4, [
vue.createElementVNode("span", _hoisted_5, vue.toDisplayString(item.onlineCount), 1),
vue.createElementVNode("span", null, "/" + vue.toDisplayString(item.totalCount), 1)
])
]);
}), 128))
])
]),
_: 1
}, 8, ["time"])
], 2);
};
}
});
exports.default = _sfc_main;