@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" />
91 lines (86 loc) • 3.96 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const bgLight = require('./images/bg-light.png.js');
const bg = require('./images/bg.png.js');
const standardLight = require('./images/standard-light.png.js');
const standard = require('./images/standard.png.js');
const unstandardLight = require('./images/unstandard-light.png.js');
const unstandard = require('./images/unstandard.png.js');
const vue = require('vue');
const utils = require('../../../utils.js');
const request = require('../../service/request.js');
const hooks = require('../../utils/hooks.js');
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__ */ vue.createElementVNode("span", { class: "unit" }, "类", -1);
const _hoisted_5 = ["src"];
const __default__ = {
name: "DvIpesWaterQualityStandard",
title: "水环境质量达标"
};
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...__default__,
setup(__props) {
const { isDark } = utils.useThemeHook();
const getImg = (isStandard) => {
const imgName = `${isStandard ? "" : "un"}standard${isDark ? "" : "-light"}`;
return new URL((/* #__PURE__ */ Object.assign({"./images/bg-light.png": bgLight.default,"./images/bg.png": bg.default,"./images/standard-light.png": standardLight.default,"./images/standard.png": standard.default,"./images/unstandard-light.png": unstandardLight.default,"./images/unstandard.png": unstandard.default}))[`./images/${imgName}.png`], self.location).href;
};
const basicInfoData = vue.ref({
inSiteName: "",
realInLevel: "",
isRealInReach: true,
outSiteName: "",
realOutLevel: "",
isRealOutReach: true
});
const basicInfos = vue.ref([
{ title: "inSiteName", key: "realInLevel", standardKey: "isRealInReach", color: "realInColor" },
{ title: "outSiteName", key: "realOutLevel", standardKey: "isRealOutReach", color: "realOutColor" }
]);
async function getData() {
try {
const { data } = await request.default({
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);
}
}
vue.onMounted(() => {
getData();
});
hooks.setIntervalData(getData, 5 * 60 * 1e3);
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(basicInfos.value, (item) => {
return vue.openBlock(), vue.createElementBlock("div", {
key: item.key,
class: "info-box"
}, [
vue.createElementVNode("span", _hoisted_2, vue.toDisplayString(basicInfoData.value[item.title]), 1),
vue.createElementVNode("div", _hoisted_3, [
vue.createElementVNode("span", {
class: "value",
style: vue.normalizeStyle({ color: basicInfoData.value[item.color] })
}, vue.toDisplayString(basicInfoData.value[item.key]), 5),
_hoisted_4,
vue.createElementVNode("img", {
src: getImg(basicInfoData.value[item.standardKey])
}, null, 8, _hoisted_5)
])
]);
}), 128))
]);
};
}
});
exports.default = _sfc_main;