@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" />
82 lines (77 loc) • 2.7 kB
JavaScript
;
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-dual-prevention-mechanism" };
const _hoisted_2 = { class: "name" };
const __default__ = {
name: "DvIpesDualPreventionMechanism",
title: "双重预防机制运行"
};
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...__default__,
props: {
dataList: {
type: Array,
default: () => ["excellentCount", "fineCount", "middlingCount", "badCount"]
}
},
setup(__props) {
const props = __props;
const data = vue.ref({
excellentCount: null,
fineCount: null,
middlingCount: null,
badCount: null,
nodBuildCount: null
});
const levels = vue.ref([
{ name: "优", key: "excellentCount", color: "--dv-color-success" },
{ name: "良", key: "fineCount", color: "--dv-color-warning" },
{ name: "中", key: "middlingCount", color: "--dv-color-index" },
{ name: "差", key: "badCount", color: "--dv-color-danger" },
{ name: "未建设", key: "nodBuildCount", color: "--dv-color-text-primary" }
]);
const levelsView = vue.computed(() => {
return levels.value.filter((item) => {
return props.dataList.includes(item.key);
});
});
function getShowData(value) {
return value == null || isNaN(+value) ? "--" : value;
}
async function getData() {
try {
const res = await request.default({
method: "get",
url: "/ipes-srip-server/api/v4/statistics/mechanism-operation"
});
data.value = res.data;
} catch (error) {
console.log(error);
}
}
vue.onMounted(() => {
getData();
});
hooks.setIntervalData(getData, 5 * 60 * 1e3);
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(levelsView.value, (item) => {
return vue.openBlock(), vue.createElementBlock("div", {
key: item.key,
class: "level-item"
}, [
vue.createElementVNode("div", _hoisted_2, vue.toDisplayString(item.name), 1),
vue.createElementVNode("div", {
class: "value",
style: vue.normalizeStyle({ color: `var(${item.color})` })
}, vue.toDisplayString(getShowData(data.value[item.key])), 5)
]);
}), 128))
]);
};
}
});
exports.default = _sfc_main;