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

158 lines (153 loc) 5.13 kB
'use strict'; 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 vue = require('vue'); const request = require('../../service/request.js'); const utils = require('../../../utils.js'); const hooks = require('../../utils/hooks.js'); const _hoisted_1 = { class: "dv-ipes-waste-water-rate" }; const _hoisted_2 = { class: "left-waste-water-box" }; const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("div", { id: "wasteWaterChart", class: "pie" }, null, -1); const _hoisted_4 = { class: "info" }; const _hoisted_5 = { class: "row" }; const _hoisted_6 = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, " 废水达标率 ", -1); const _hoisted_7 = { class: "value" }; const _hoisted_8 = { class: "number" }; const _hoisted_9 = /* @__PURE__ */ vue.createElementVNode("span", { class: "unit" }, "%", -1); const _hoisted_10 = { class: "right-waste-water-box" }; const _hoisted_11 = ["src"]; const _hoisted_12 = { class: "info" }; const _hoisted_13 = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, " 污水厂总排口 ", -1); const __default__ = { name: "DvIpesWastewaterTargetRate", title: "废水达标率" }; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...__default__, setup(__props) { const { isDark } = utils.useThemeHook(); const info = vue.ref({ onlineRatio: 0, runStatusName: "" }); const getImg = () => { return new URL((/* #__PURE__ */ Object.assign({"./images/bg-light.png": bgLight.default,"./images/bg.png": bg.default}))[`./images/bg${isDark.value ? "" : "-light"}.png`], self.location).href; }; async function getInfoData() { try { const res = await request.default({ method: "get", url: "/ipes-data-aggregation-server/api/v2/gis/env/stat-ww" }); info.value = res?.data; drawChart(info.value); } catch (error) { console.log(error); } } function drawChart(data) { const legendData = [ { name: "达标率", y: +(data.onlineRatio || 0) }, { name: "未达标率", y: 100 - +(data.onlineRatio || 0) } ]; const seriesData = legendData; const highcharts = window.Highcharts; highcharts.chart("wasteWaterChart", { chart: { type: "pie", animation: false, // marginTop: 20, backgroundColor: "transparent", // 不显示背景色 options3d: { enabled: true, alpha: 50, beta: 0, depth: 8 } }, credits: { enabled: false }, title: { text: null }, colors: ["var(--dv-color-success)", "var(--dv-bg-gray)"], tooltip: { enabled: false }, plotOptions: { pie: { center: ["50%", "50%"], allowPointSelect: true, inactiveOtherPoints: false, cursor: "pointer", depth: 10, innerSize: "0%", size: "40", dataLabels: { enabled: false } } }, series: [ { type: "pie", name: "废水达标率", data: seriesData } ] }); } function getSiteStateColor(runStatus) { const statusColors = { stop_running: "#FF792E", // 停运 stop_using: "rgb(233, 169, 0)", // 停用 offline: "rgb(116, 116, 116)", // 离线 exceed: "rgb(228, 56, 52)", // 超标 abnormal: "rgb(143, 32, 253)", // 异常 normal: "rgb(58, 183, 93)" // 正常 }; return statusColors[runStatus] || "#0084ff"; } vue.onMounted(() => { getInfoData(); }); hooks.setIntervalData(getInfoData, 5 * 60 * 1e3); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ vue.createElementVNode("div", _hoisted_2, [ _hoisted_3, vue.createElementVNode("div", _hoisted_4, [ vue.createElementVNode("div", _hoisted_5, [ _hoisted_6, vue.createElementVNode("div", _hoisted_7, [ vue.createElementVNode("span", _hoisted_8, vue.toDisplayString(info.value.onlineRatio), 1), _hoisted_9 ]) ]) ]) ]), vue.createElementVNode("div", _hoisted_10, [ vue.createElementVNode("img", { src: getImg(vue.unref(isDark)) }, null, 8, _hoisted_11), vue.createElementVNode("div", _hoisted_12, [ _hoisted_13, vue.createElementVNode("div", { class: "value", style: vue.normalizeStyle({ color: getSiteStateColor(info.value.runStatus) }) }, vue.toDisplayString(info.value.runStatusName), 5) ]) ]) ]); }; } }); exports.default = _sfc_main;