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.79 kB
'use strict'; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } }); const vue = require('vue'); const dayjs = require('dayjs'); const echartsOptions = require('../../utils/echarts/echartsOptions.js'); const BaseECharts_vue_vue_type_script_setup_true_lang = require('../../utils/echarts/BaseECharts.vue.js'); const index = require('./api/index.js'); const _hoisted_1 = { class: "dv-wgms-pollution-source", style: { "width": "auto" } }; const _hoisted_2 = { class: "dv-wgms-statistic-content" }; const _hoisted_3 = { class: "dv-wgms-statistic-box" }; const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("div", { class: "dv-wgms-text" }, " 重点源超标统计 ", -1); const _hoisted_5 = { class: "dv-wgms-total-content" }; const _hoisted_6 = /* @__PURE__ */ vue.createElementVNode("div", { class: "dv-wgms-left" }, " 总数 ", -1); const _hoisted_7 = { class: "dv-wgms-right" }; const _hoisted_8 = { class: "dv-wgms-num" }; const _hoisted_9 = { class: "dv-wgms-legend" }; const _hoisted_10 = { class: "dv-wgms-left" }; const _hoisted_11 = { class: "dv-wgms-name" }; const _hoisted_12 = { class: "dv-wgms-right" }; const _hoisted_13 = /* @__PURE__ */ vue.createElementVNode("span", null, "/", -1); const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: "DvWgmsPollutionSourceControlStatistics", title: "污染源管控-重点源超标统计" }, __name: "index", props: { params: { type: Object, default: () => { return { distance: 5e3, startTime: dayjs().startOf("year").valueOf(), endTime: dayjs().endOf("year").valueOf(), factor: "", factorFlag: true, latitude: 30, longitude: 120, timeType: "day" }; } }, isLazy: { type: Boolean, default: false }, data: { type: Object, default: void 0 } }, setup(__props, { expose: __expose }) { const props = __props; const staticData = vue.reactive({ chartDetail: [], colorList: ["var(--dv-color-danger)", "var(--dv-color-primary)", "var(--dv-color-success)"], totalCount: 0 }); const statChart = vue.ref(null); vue.watch([ () => props.params, () => props.data, () => props.isLazy ], () => { if (props.isLazy) return; keyPollutionStatistic(); }); const option = vue.ref(); vue.onMounted(() => { if (props.isLazy) return; keyPollutionStatistic(); }); const keyPollutionStatistic = async () => { let resData; if (props.data) { resData = props.data; } else { const res = await index.pomsFactorAlarm(props.params); resData = res.data; } const total = resData?.totalCount ?? 0; staticData.totalCount = total; const dataList = [ { name: "氮超标", value: resData?.ncount ?? "--", percent: resData?.npercent ?? "--" }, { name: "磷超标", value: resData?.pcount ?? "--", percent: resData?.ppercent ?? "--" }, { name: "其他", value: resData?.otherCount ?? "--", percent: resData?.otherPercent ?? "--" } ]; staticData.chartDetail = dataList.map((item, index) => { return { ...item, itemStyle: { color: staticData.colorList[index] } }; }); const seriesData = [ ...staticData.chartDetail ]; option.value = echartsOptions.pollutionSourcePieOptions(seriesData); }; const { colorList, totalCount, chartDetail } = vue.toRefs(staticData); __expose({ reload: keyPollutionStatistic }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ vue.createElementVNode("div", _hoisted_2, [ vue.createElementVNode("div", _hoisted_3, [ _hoisted_4, vue.createElementVNode("div", _hoisted_5, [ _hoisted_6, vue.createElementVNode("div", _hoisted_7, [ vue.createElementVNode("div", _hoisted_8, vue.toDisplayString(vue.unref(totalCount)), 1), vue.createElementVNode("div", { ref_key: "statChart", ref: statChart, class: "dv-wgms-chart" }, [ vue.createVNode(BaseECharts_vue_vue_type_script_setup_true_lang.default, { options: option.value }, null, 8, ["options"]) ], 512) ]) ]), vue.createElementVNode("div", _hoisted_9, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(chartDetail), (item, index) => { return vue.openBlock(), vue.createElementBlock("div", { key: index, class: "dv-wgms-legend-one" }, [ vue.createElementVNode("div", _hoisted_10, [ vue.createElementVNode("div", { class: "dv-wgms-circle", style: vue.normalizeStyle({ background: vue.unref(colorList)[index] }) }, null, 4), vue.createElementVNode("div", _hoisted_11, vue.toDisplayString(item.name || "--"), 1) ]), vue.createElementVNode("div", _hoisted_12, [ vue.createElementVNode("span", null, vue.toDisplayString(item.value ?? "--"), 1), _hoisted_13, vue.createElementVNode("span", null, vue.toDisplayString(item.percent ?? "--") + "%", 1) ]) ]); }), 128)) ]) ]) ]) ]); }; } }); exports.default = _sfc_main;