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

74 lines (71 loc) 2.48 kB
import { defineComponent, ref, computed, onMounted, openBlock, createElementBlock, Fragment, renderList, unref, createElementVNode, toDisplayString } from 'vue'; import requestControl from '../../service/request.mjs'; import { setIntervalData } from '../../utils/hooks.mjs'; const _hoisted_1 = { class: "dv-ipes-basic-security-info" }; const _hoisted_2 = { class: "title" }; const _hoisted_3 = { class: "value" }; const _hoisted_4 = { class: "unit" }; const __default__ = { name: "DvIpesBasicSecurityInfo", title: "安全基础信息" }; const _sfc_main = /* @__PURE__ */ defineComponent({ ...__default__, props: { url: { type: String, default: "/ipes-srip-server/api/v3/gis/panel/company-base/safety-statistics" }, basicInfoList: { type: Array, default: () => { return [ { title: "两重点一重大", key: "chemicalCompanyCount", unit: "家" }, { title: "危险化学品", key: "chemicalCount", unit: "种" }, { title: "危险化工工艺", key: "chemicalCraftCount", unit: "个" }, { title: "重大危险源", key: "hazardCount", unit: "个" } ]; } } }, setup(__props) { const props = __props; const basicInfoData = ref({ chemicalCompanyCount: 0, chemicalCount: 0, chemicalCraftCount: 0, hazardCount: 0 }); const basicInfos = computed(() => props.basicInfoList); async function getBasicInfoData() { try { const res = await requestControl({ method: "get", url: props.url }); basicInfoData.value = res.data; } catch (error) { console.log(error); } } onMounted(() => { getBasicInfoData(); }); setIntervalData(getBasicInfoData, 5 * 60 * 1e3); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(basicInfos), (item) => { return openBlock(), createElementBlock("div", { key: item.key, class: "info-box" }, [ createElementVNode("span", _hoisted_2, toDisplayString(item.title), 1), createElementVNode("span", _hoisted_3, toDisplayString(basicInfoData.value[item.key]), 1), createElementVNode("span", _hoisted_4, toDisplayString(item.unit), 1) ]); }), 128)) ]); }; } }); export { _sfc_main as default };