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

143 lines (138 loc) 5.67 kB
'use strict'; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } }); const es = require('element-plus/es'); require('element-plus/es/components/base/style/css'); require('element-plus/es/components/empty/style/css'); const vue = require('vue'); const request = require('../../service/request.js'); const newNodata = require('./images/new-nodata.svg.js'); const _hoisted_1 = { class: "dv-ipes-air-pollution" }; const _hoisted_2 = { class: "discharge-total" }; const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "discharge-title" }, [ /* @__PURE__ */ vue.createElementVNode("span", null, "年度累计排放总量 "), /* @__PURE__ */ vue.createElementVNode("span", { class: "unit" }, "(吨)") ], -1); const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("div", { class: "discharge-label flex" }, [ /* @__PURE__ */ vue.createElementVNode("div", null, " 污染物 "), /* @__PURE__ */ vue.createElementVNode("div", null, " 排放量/允许排放量 ") ], -1); const _hoisted_5 = { key: 0, class: "box" }; const _hoisted_6 = { class: "chart-statistics-head" }; const _hoisted_7 = ["title"]; const _hoisted_8 = { class: "statistics-head-number" }; const _hoisted_9 = /* @__PURE__ */ vue.createElementVNode("span", { class: "separator" }, " / ", -1); const _hoisted_10 = ["title"]; const _hoisted_11 = { class: "chart-statistics-body" }; const _hoisted_12 = { class: "chart-statistics-body-box" }; const __default__ = { name: "DvIpesAirPollutionDischarge", title: "大气污染物排放" }; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...__default__, setup(__props) { const chartStatistics = vue.reactive([]); const discharge = vue.reactive({ companyNum: 0, monitorCompanyNum: 0 }); vue.ref(); const fetchData = async () => { try { const result = await request.default({ method: "get", url: "/ipes-iacp-server/api/v2/gis-panel-data/discharge" }); const data = result.data; const objs = vue.toRefs(data); Object.assign(discharge, objs); const arr = data.factorList.slice(0, 3).map((item) => { let flag = parseInt(item.factorValue) / parseInt(item.targetValue) * 100; if (flag <= 80) item.color = "var(--dv-color-success)"; else if (flag > 80 && flag <= 100) item.color = "var(--dv-color-warning)"; else if (flag > 100) item.color = "var(--dv-color-danger)"; isNaN(flag) && (flag = 0); item.percent = flag > 100 ? 100 : flag; return item; }); chartStatistics.splice(0, chartStatistics.length, ...arr); const seriesData = [ ["在线监测", data.monitorCompanyNum], [ "非在线监测", data.companyNum - data.monitorCompanyNum ] ]; } catch (error) { console.log(error); } }; vue.onMounted(async () => { await vue.nextTick(); fetchData(); }); return (_ctx, _cache) => { const _component_el_empty = es.ElEmpty; return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ vue.createElementVNode("div", _hoisted_2, [ _hoisted_3, _hoisted_4, chartStatistics.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(chartStatistics, (item, index) => { return vue.openBlock(), vue.createElementBlock("div", { key: index, class: "chart-statistics" }, [ vue.createElementVNode("div", _hoisted_6, [ vue.createElementVNode("div", { class: "statistics-head-name", title: item.factorName }, vue.toDisplayString(item.factorName), 9, _hoisted_7), vue.createElementVNode("div", _hoisted_8, [ vue.createElementVNode("span", { class: "statistics-head-number-left", style: vue.normalizeStyle({ color: item.color }) }, vue.toDisplayString(item.factorValue || "0"), 5), _hoisted_9, vue.createElementVNode("span", { title: item.targetValue }, vue.toDisplayString(item.targetValue), 9, _hoisted_10) ]) ]), vue.createElementVNode("div", _hoisted_11, [ vue.createElementVNode("div", _hoisted_12, [ vue.createElementVNode("div", { class: "statistics-body-left", style: vue.normalizeStyle({ backgroundColor: item.color, width: `${item.percent}%` }) }, null, 4), vue.createElementVNode("div", { class: "statistics-body-right", style: vue.normalizeStyle({ width: `${100 - item.percent}%` }) }, null, 4) ]) ]) ]); }), 128)) ])) : (vue.openBlock(), vue.createBlock(_component_el_empty, { key: 1, "image-size": 100, image: vue.unref(newNodata.default), description: "" }, null, 8, ["image"])) ]) ]); }; } }); exports.default = _sfc_main;