@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.31 kB
JavaScript
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-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__ */ 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: "DvIpesBasicSecurityManagement",
title: "安全基础管理"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
setup(__props) {
const commitmentData = ref({
city: null,
park: null,
company: null,
workShop: null,
companyCompletionRate: 0
});
const commitmentInfos = ref([
{ title: "市级演练", key: "city", unit: "次" },
{ title: "企业演练", key: "company", unit: "次" },
{ title: "车间演练", key: "workShop", unit: "次" },
{ title: "园区演练", key: "park", unit: "次" }
]);
async function getCommitmentData() {
try {
const res = await requestControl({
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("%", "");
}
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(["security-box", item.key])
}, [
createElementVNode("div", _hoisted_3, toDisplayString(item.title), 1),
createElementVNode("div", _hoisted_4, [
createElementVNode("span", _hoisted_5, toDisplayString(getShowData(commitmentData.value[item.key])), 1),
createElementVNode("span", _hoisted_6, toDisplayString(item.unit), 1)
])
], 2);
}), 128))
]),
createElementVNode("div", _hoisted_7, [
_hoisted_8,
createElementVNode("div", _hoisted_9, [
createElementVNode("div", _hoisted_10, toDisplayString(replaceUnit(commitmentData.value.companyCompletionRate)), 1),
_hoisted_11
])
])
]);
};
}
});
export { _sfc_main as default };