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

85 lines (82 loc) 3.19 kB
import { defineComponent, ref, onMounted, openBlock, createElementBlock, createElementVNode, Fragment, renderList, normalizeClass, toDisplayString } from 'vue'; import requestControl from '../../service/request.mjs'; import { setIntervalData } from '../../utils/hooks.mjs'; const _hoisted_1 = { class: "dv-ipes-emengercy-plan" }; const _hoisted_2 = { class: "box" }; const _hoisted_3 = { class: "top" }; const _hoisted_4 = { class: "value" }; const _hoisted_5 = { class: "unit" }; const _hoisted_6 = { class: "title" }; const _hoisted_7 = { class: "footer" }; const _hoisted_8 = /* @__PURE__ */ createElementVNode("div", { class: "label" }, " 结构化预案比率 ", -1); const _hoisted_9 = { class: "percent" }; const _hoisted_10 = { class: "number" }; const _hoisted_11 = /* @__PURE__ */ createElementVNode("div", { class: "unit" }, " % ", -1); const __default__ = { name: "DvIpesEmengercyPlan", title: "应急预案" }; const _sfc_main = /* @__PURE__ */ defineComponent({ ...__default__, setup(__props) { const commitmentData = ref({ upLevel: null, park: null, company: null, structuredPlanRate: 0 }); const commitmentInfos = ref([ { title: "上级预案", key: "upLevel", unit: "个" }, { title: "园区预案", key: "park", unit: "个" }, { title: "企业预案", key: "company", unit: "个" } ]); async function getCommitmentData() { try { const res = await requestControl({ method: "get", url: "/ipes-emergency-manager-server/api/v2/plan/statistics/overview" }); commitmentData.value = res.data; } catch (error) { console.log(error); } } function getShowData(value) { return value == null ? "0" : value; } function replaceUnit(value) { const rate = value || 0; return rate.toString().replace("%", ""); } onMounted(() => { getCommitmentData(); }); setIntervalData(getCommitmentData, 5 * 60 * 1e3); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ (openBlock(true), createElementBlock(Fragment, null, renderList(commitmentInfos.value, (item) => { return openBlock(), createElementBlock("div", { key: item.key, class: normalizeClass(["plan-box", item.key]) }, [ createElementVNode("div", _hoisted_3, [ createElementVNode("span", _hoisted_4, toDisplayString(getShowData(commitmentData.value[item.key])), 1), createElementVNode("span", _hoisted_5, toDisplayString(item.unit), 1) ]), createElementVNode("div", _hoisted_6, toDisplayString(item.title), 1) ], 2); }), 128)) ]), createElementVNode("div", _hoisted_7, [ _hoisted_8, createElementVNode("div", _hoisted_9, [ createElementVNode("div", _hoisted_10, toDisplayString(replaceUnit(commitmentData.value.structuredPlanRate)), 1), _hoisted_11 ]) ]) ]); }; } }); export { _sfc_main as default };