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

131 lines (128 loc) 5.15 kB
import { ElIcon } from 'element-plus/es'; import 'element-plus/es/components/base/style/css'; import 'element-plus/es/components/icon/style/css'; import { defineComponent, ref, onMounted, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, Fragment, renderList, normalizeStyle, toDisplayString, withCtx } from 'vue'; import dayjs from 'dayjs'; import _sfc_main$1 from './components/ProgressBar.vue.mjs'; import './components/ProgressBar.vue2.mjs'; import { getAlgaeMonitoringWarning } from './api/index.mjs'; const _hoisted_1 = { class: "dv-bmp-algae-monitoring-box" }; const _hoisted_2 = { class: "algae-monitoring-rate" }; const _hoisted_3 = /* @__PURE__ */ createElementVNode("div", { class: "decorate-outer" }, null, -1); const _hoisted_4 = { class: "decorate-inner" }; const _hoisted_5 = { class: "total-warn" }; const _hoisted_6 = /* @__PURE__ */ createElementVNode("div", { class: "total-warn-top" }, " 年累计 ", -1); const _hoisted_7 = { class: "total-warn-bottom" }; const _hoisted_8 = { class: "total-warn-done" }; const _hoisted_9 = /* @__PURE__ */ createElementVNode("div", { class: "total-warn-separator" }, " / ", -1); const _hoisted_10 = { class: "total-warn-total" }; const _hoisted_11 = { class: "algae-monitoring-items" }; const _hoisted_12 = { class: "algae-monitoring-item" }; const _hoisted_13 = /* @__PURE__ */ createElementVNode("span", { class: "algae-title" }, "今日预警数", -1); const _hoisted_14 = { class: "algae-num" }; const _hoisted_15 = { class: "algae-monitoring-item last-item" }; const _hoisted_16 = /* @__PURE__ */ createElementVNode("span", { class: "algae-title algae-title-diff" }, "已处理", -1); const _hoisted_17 = { class: "algae-num" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "index", props: { year: String, // 是否使用内置接口进行数据查询 isUseBuiltInApi: { type: Boolean, default: true }, // 不使用内部接口查询时,组件使用的数据 data: { type: Object, default: () => { } } }, setup(__props) { const props = __props; const todayWarnObj = ref({ doing: 0, done: 0, total: 0, undone: 0 }); const totalWarnObj = ref({ doing: 0, done: 0, total: 0, undone: 0 }); const getData = async (startTime, endTime) => { const params = { startTime, endTime, envTypeCodeList: ["water"], siteCodeList: [], alarmTypeCodeList: ["automonitor_wgmsCyanobacteria"] }; const res = await getAlgaeMonitoringWarning(params); return res?.data; }; onMounted(async () => { if (props.isUseBuiltInApi) { todayWarnObj.value = await getData(dayjs().startOf("day").valueOf(), dayjs().valueOf()); totalWarnObj.value = await getData(dayjs().startOf("year").valueOf(), dayjs().valueOf()); } else { todayWarnObj.value = props.data.todayWarnObj; totalWarnObj.value = props.data.totalWarnObj; } }); return (_ctx, _cache) => { const _component_Bell = resolveComponent("Bell"); const _component_el_icon = ElIcon; const _component_CircleCheck = resolveComponent("CircleCheck"); return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ _hoisted_3, createVNode(_sfc_main$1, { rate: 0.75 }), createElementVNode("div", _hoisted_4, [ (openBlock(), createElementBlock(Fragment, null, renderList(72, (item) => { return createElementVNode("div", { key: item, class: "decorate-inner-item", style: normalizeStyle({ transform: `rotate(${5 * item}deg)` }) }, null, 4); }), 64)) ]), createElementVNode("div", _hoisted_5, [ _hoisted_6, createElementVNode("div", _hoisted_7, [ createElementVNode("div", _hoisted_8, toDisplayString(totalWarnObj.value.done), 1), _hoisted_9, createElementVNode("div", _hoisted_10, toDisplayString(totalWarnObj.value.total), 1) ]) ]) ]), createElementVNode("div", _hoisted_11, [ createElementVNode("div", _hoisted_12, [ createVNode(_component_el_icon, { class: "algae-icon" }, { default: withCtx(() => [ createVNode(_component_Bell) ]), _: 1 }), _hoisted_13, createElementVNode("span", _hoisted_14, toDisplayString(todayWarnObj.value.total), 1) ]), createElementVNode("div", _hoisted_15, [ createVNode(_component_el_icon, { class: "algae-icon" }, { default: withCtx(() => [ createVNode(_component_CircleCheck) ]), _: 1 }), _hoisted_16, createElementVNode("span", _hoisted_17, toDisplayString(todayWarnObj.value.done), 1) ]) ]) ]); }; } }); export { _sfc_main as default };