@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" />
108 lines (105 loc) • 4.34 kB
JavaScript
import * as icon1 from './images/icon-1.svg.mjs';
import * as icon2 from './images/icon-2.svg.mjs';
import * as icon3 from './images/icon-3.svg.mjs';
import * as iconLight1 from './images/icon-light-1.svg.mjs';
import * as iconLight2 from './images/icon-light-2.svg.mjs';
import * as iconLight3 from './images/icon-light-3.svg.mjs';
import { defineComponent, onMounted, watch, ref, openBlock, createElementBlock, Fragment, renderList, createElementVNode, normalizeStyle, toDisplayString, unref } from 'vue';
import { useThemeHook } from '../../../utils.mjs';
import { getDrinkWaterData } from './api/index.mjs';
const _hoisted_1 = { class: "dv-wgms-compliance" };
const _hoisted_2 = { class: "dv-wgms-compliance-rate dv-wgms-flex-between-center" };
const _hoisted_3 = { class: "dv-wgms-compliance-rate-one-icon" };
const _hoisted_4 = ["src"];
const _hoisted_5 = { class: "dv-wgms-compliance-rate-one-label" };
const _hoisted_6 = { class: "dv-wgms-compliance-rate-one-value" };
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "DvWgmsDrinkingWaterComplianceRate",
title: "饮用水源地达标率"
},
__name: "index",
props: {
params: { default: () => {
return {
// startTime: dayjs().startOf('year').valueOf(),
// endTime: dayjs().endOf('year').valueOf(),
timeStr: "2023",
timeType: "hour",
factor: "8",
factorFlag: false,
keyWord: "",
treeId: "3301",
waterSourceScaleCode: ""
};
} },
titleStyle: { default: () => {
return {
color: "var(--dv-color-text-primary)"
};
} },
isLazy: { type: Boolean, default: false }
},
setup(__props, { expose: __expose }) {
const props = __props;
const { isDark } = useThemeHook();
onMounted(() => {
!props.isLazy && getResData();
});
watch(() => props.params, () => {
!props.isLazy && getResData();
}, { deep: true });
const imgList = /* #__PURE__ */ Object.assign({"./images/icon-1.svg": icon1,"./images/icon-2.svg": icon2,"./images/icon-3.svg": icon3,"./images/icon-light-1.svg": iconLight1,"./images/icon-light-2.svg": iconLight2,"./images/icon-light-3.svg": iconLight3});
const listData = ref();
const list = [
{ label: "水源地总数", props: "waterSourceNum", unit: "个" },
{ label: "监测点总数", props: "siteNum", unit: "个" },
{ label: "达标率", props: "reachRate", unit: "%" }
];
const getResData = async () => {
const { data } = await getDrinkWaterData(props.params);
data && (listData.value = data);
};
const getImg = (url) => {
return imgList[url]?.default;
};
__expose({
reload: getResData
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
(openBlock(true), createElementBlock(Fragment, null, renderList(listData.value, (item, index) => {
return openBlock(), createElementBlock("div", {
key: index,
class: "dv-wgms-compliance-one"
}, [
createElementVNode("div", {
class: "title-text",
style: normalizeStyle(_ctx.titleStyle)
}, toDisplayString(item.waterSourceScaleName), 5),
createElementVNode("div", _hoisted_2, [
(openBlock(), createElementBlock(Fragment, null, renderList(list, (i, idx) => {
return createElementVNode("div", {
key: idx,
class: "dv-wgms-compliance-rate-one dv-wgms-flex-center-center"
}, [
createElementVNode("div", _hoisted_3, [
createElementVNode("img", {
src: getImg(`./images/icon-${unref(isDark) ? "" : "light-"}${idx + 1}.svg`),
alt: ""
}, null, 8, _hoisted_4)
]),
createElementVNode("div", _hoisted_5, toDisplayString(i.label), 1),
createElementVNode("div", _hoisted_6, [
createElementVNode("span", null, toDisplayString(item[i.props] === null ? "--" : item[i.props] + i.unit), 1)
])
]);
}), 64))
])
]);
}), 128))
]);
};
}
});
export { _sfc_main as default };