UNPKG

@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" />

87 lines (84 loc) 3.9 kB
import __vite_glob_0_0 from './images/bg-light.png.mjs'; import __vite_glob_0_1 from './images/bg.png.mjs'; import __vite_glob_0_2 from './images/standard-light.png.mjs'; import __vite_glob_0_3 from './images/standard.png.mjs'; import __vite_glob_0_4 from './images/unstandard-light.png.mjs'; import __vite_glob_0_5 from './images/unstandard.png.mjs'; import { defineComponent, ref, onMounted, openBlock, createElementBlock, Fragment, renderList, createElementVNode, toDisplayString, normalizeStyle } from 'vue'; import { useThemeHook } from '../../../utils.mjs'; import requestControl from '../../service/request.mjs'; import { setIntervalData } from '../../utils/hooks.mjs'; const _hoisted_1 = { class: "dv-ipes-water-quality-standard" }; const _hoisted_2 = { class: "title" }; const _hoisted_3 = { class: "info-box-count" }; const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "unit" }, "类", -1); const _hoisted_5 = ["src"]; const __default__ = { name: "DvIpesWaterQualityStandard", title: "水环境质量达标" }; const _sfc_main = /* @__PURE__ */ defineComponent({ ...__default__, setup(__props) { const { isDark } = useThemeHook(); const getImg = (isStandard) => { const imgName = `${isStandard ? "" : "un"}standard${isDark ? "" : "-light"}`; return new URL((/* #__PURE__ */ Object.assign({"./images/bg-light.png": __vite_glob_0_0,"./images/bg.png": __vite_glob_0_1,"./images/standard-light.png": __vite_glob_0_2,"./images/standard.png": __vite_glob_0_3,"./images/unstandard-light.png": __vite_glob_0_4,"./images/unstandard.png": __vite_glob_0_5}))[`./images/${imgName}.png`], self.location).href; }; const basicInfoData = ref({ inSiteName: "", realInLevel: "", isRealInReach: true, outSiteName: "", realOutLevel: "", isRealOutReach: true }); const basicInfos = ref([ { title: "inSiteName", key: "realInLevel", standardKey: "isRealInReach", color: "realInColor" }, { title: "outSiteName", key: "realOutLevel", standardKey: "isRealOutReach", color: "realOutColor" } ]); async function getData() { try { const { data } = await requestControl({ method: "get", url: "/ipes-data-aggregation-server/api/v1/env-protection/water-manage", params: { yearData: false // 如果为false则不提去年度水质情况,默认为true(为兼容历史)(boolean) } }); const { inSiteName, realInLevel, isRealInReach, outSiteName, realOutLevel, isRealOutReach, realOutColor, realInColor } = data; basicInfoData.value = { inSiteName, realInLevel, isRealInReach, outSiteName, realOutLevel, isRealOutReach, realOutColor, realInColor }; } catch (error) { console.log(error); } } onMounted(() => { getData(); }); setIntervalData(getData, 5 * 60 * 1e3); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ (openBlock(true), createElementBlock(Fragment, null, renderList(basicInfos.value, (item) => { return openBlock(), createElementBlock("div", { key: item.key, class: "info-box" }, [ createElementVNode("span", _hoisted_2, toDisplayString(basicInfoData.value[item.title]), 1), createElementVNode("div", _hoisted_3, [ createElementVNode("span", { class: "value", style: normalizeStyle({ color: basicInfoData.value[item.color] }) }, toDisplayString(basicInfoData.value[item.key]), 5), _hoisted_4, createElementVNode("img", { src: getImg(basicInfoData.value[item.standardKey]) }, null, 8, _hoisted_5) ]) ]); }), 128)) ]); }; } }); export { _sfc_main as default };