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

91 lines (86 loc) 3.4 kB
'use strict'; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } }); const vue = require('vue'); const request = require('../../service/request.js'); const hooks = require('../../utils/hooks.js'); const _hoisted_1 = { class: "dv-ipes-security-management" }; const _hoisted_2 = { class: "box" }; const _hoisted_3 = { class: "title" }; const _hoisted_4 = { class: "bottom" }; const _hoisted_5 = { class: "value" }; const _hoisted_6 = { class: "unit" }; const _hoisted_7 = { class: "footer" }; const _hoisted_8 = /* @__PURE__ */ vue.createElementVNode("div", { class: "label" }, " 企业演练完成率 ", -1); const _hoisted_9 = { class: "percent" }; const _hoisted_10 = { class: "number" }; const _hoisted_11 = /* @__PURE__ */ vue.createElementVNode("div", { class: "unit" }, " % ", -1); const __default__ = { name: "DvIpesBasicSecurityManagement", title: "安全基础管理" }; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...__default__, setup(__props) { const commitmentData = vue.ref({ city: null, park: null, company: null, workShop: null, companyCompletionRate: 0 }); const commitmentInfos = vue.ref([ { title: "市级演练", key: "city", unit: "次" }, { title: "企业演练", key: "company", unit: "次" }, { title: "车间演练", key: "workShop", unit: "次" }, { title: "园区演练", key: "park", unit: "次" } ]); async function getCommitmentData() { try { const res = await request.default({ method: "get", url: "/ipes-emergency-manager-server/api/v2/statistical/emergency-drill-stat" }); 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("%", ""); } vue.onMounted(() => { getCommitmentData(); }); hooks.setIntervalData(getCommitmentData, 5 * 60 * 1e3); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ vue.createElementVNode("div", _hoisted_2, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(commitmentInfos.value, (item) => { return vue.openBlock(), vue.createElementBlock("div", { key: item.key, class: vue.normalizeClass(["security-box", item.key]) }, [ vue.createElementVNode("div", _hoisted_3, vue.toDisplayString(item.title), 1), vue.createElementVNode("div", _hoisted_4, [ vue.createElementVNode("span", _hoisted_5, vue.toDisplayString(getShowData(commitmentData.value[item.key])), 1), vue.createElementVNode("span", _hoisted_6, vue.toDisplayString(item.unit), 1) ]) ], 2); }), 128)) ]), vue.createElementVNode("div", _hoisted_7, [ _hoisted_8, vue.createElementVNode("div", _hoisted_9, [ vue.createElementVNode("div", _hoisted_10, vue.toDisplayString(replaceUnit(commitmentData.value.companyCompletionRate)), 1), _hoisted_11 ]) ]) ]); }; } }); exports.default = _sfc_main;