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

87 lines (84 loc) 3.02 kB
import { defineComponent, ref, onMounted, openBlock, createElementBlock, createElementVNode, toDisplayString, Fragment, renderList } from 'vue'; import requestControl from '../../service/request.mjs'; import { setIntervalData } from '../../utils/hooks.mjs'; const _hoisted_1 = { class: "dv-ipes-Enterprises-park" }; const _hoisted_2 = { class: "Enterprises-header" }; const _hoisted_3 = /* @__PURE__ */ createElementVNode("div", { class: "Enterprises-title" }, " 企业总数 ", -1); const _hoisted_4 = { class: "Enterprises-value" }; const _hoisted_5 = /* @__PURE__ */ createElementVNode("span", { class: "Enterprises-unit" }, "家", -1); const _hoisted_6 = { class: "Enterprises-content" }; const _hoisted_7 = { class: "label" }; const _hoisted_8 = { class: "value" }; const __default__ = { name: "DvIpesEnterprisesInPark", title: "园内企业" }; const _sfc_main = /* @__PURE__ */ defineComponent({ ...__default__, props: { companyAuth: { default: "1" } }, setup(__props) { const props = __props; const countData = ref({ total: 0, // 总数 zcsc: 0, // 正常生产 wtc: 0, // 未投产 ssc: 0, // 试生产 cqtc: 0 // 长期停产 }); const Infos = ref([ { title: "正常生产", key: "zcsc", color: "var(--dv-color-success)" }, { title: "未投产", key: "wtc", color: "var(--abnormal)" }, { title: "试生产", key: "ssc", color: "var(--offline)" }, { title: "长期停产", key: "cqtc", color: "var(--dv-color-warning)" } ]); async function getData() { try { const res = await requestControl({ method: "get", url: "/bmp-company-manager-server/api/v3/park/client/company/stat-by-state", params: props }); countData.value = res?.data || {}; } catch (error) { console.log(error); } } function getShowData(value) { return value == null ? "0" : value; } onMounted(() => { getData(); }); setIntervalData(getData, 5 * 60 * 1e3); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ _hoisted_3, createElementVNode("div", null, [ createElementVNode("span", _hoisted_4, toDisplayString(getShowData(countData.value.total)), 1), _hoisted_5 ]) ]), createElementVNode("div", _hoisted_6, [ (openBlock(true), createElementBlock(Fragment, null, renderList(Infos.value, (item) => { return openBlock(), createElementBlock("div", { key: item.key, class: "item" }, [ createElementVNode("div", _hoisted_7, toDisplayString(item.title), 1), createElementVNode("div", _hoisted_8, toDisplayString(getShowData(countData.value[item.key])), 1) ]); }), 128)) ]) ]); }; } }); export { _sfc_main as default };