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

65 lines (62 loc) 2.34 kB
import { defineComponent, ref, onMounted, openBlock, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString } from 'vue'; import requestControl from '../../service/request.mjs'; import { setIntervalData } from '../../utils/hooks.mjs'; const _hoisted_1 = { class: "dv-ipes-security-commitment" }; const _hoisted_2 = { class: "top" }; const _hoisted_3 = { class: "value" }; const _hoisted_4 = { class: "unit" }; const _hoisted_5 = { class: "title" }; const __default__ = { name: "DvIpesSecurityCommitment", title: "安全承诺" }; const _sfc_main = /* @__PURE__ */ defineComponent({ ...__default__, setup(__props) { const commitmentData = ref({ todayCount: null, todayNoCount: null, yearRatio: null }); const commitmentInfos = ref([ { title: "今日已承诺", key: "todayCount", unit: "家" }, { title: "今日未承诺", key: "todayNoCount", unit: "家" }, { title: "年度承诺率", key: "yearRatio", unit: "%" } ]); async function getCommitmentData() { try { const res = await requestControl({ method: "get", url: "/ipes-srip-server/api/v3/safety-promise-notice/statistic" }); commitmentData.value = res.data; } catch (error) { console.log(error); } } function getShowData(value) { return value == null ? "--" : value; } onMounted(() => { getCommitmentData(); }); setIntervalData(getCommitmentData, 5 * 60 * 1e3); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ (openBlock(true), createElementBlock(Fragment, null, renderList(commitmentInfos.value, (item) => { return openBlock(), createElementBlock("div", { key: item.key, class: normalizeClass(["commitment-box", item.key]) }, [ createElementVNode("div", _hoisted_2, [ createElementVNode("span", _hoisted_3, toDisplayString(getShowData(commitmentData.value[item.key])), 1), createElementVNode("span", _hoisted_4, toDisplayString(item.unit), 1) ]), createElementVNode("div", _hoisted_5, toDisplayString(item.title), 1) ], 2); }), 128)) ]); }; } }); export { _sfc_main as default };