@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" />
83 lines (80 loc) • 2.95 kB
JavaScript
import { defineComponent, toRefs, ref, openBlock, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, unref, createCommentVNode } from 'vue';
const _hoisted_1 = { class: "dv-ipes-pollutant-source-manage" };
const _hoisted_2 = ["onClick"];
const _hoisted_3 = { class: "title" };
const _hoisted_4 = { class: "flex-c" };
const _hoisted_5 = { key: 0 };
const __default__ = {
name: "DvIpesPollutantSourceManage",
title: "污染源排放管理"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: {
statusData: { default: () => {
return {
wg: {
abnormal: 0,
normal: 0,
offline: 0,
total: 0
},
ww: {
abnormal: 0,
normal: 0,
offline: 0,
total: 0
}
};
} }
},
emits: ["openPopup"],
setup(__props, { emit }) {
const props = __props;
const { statusData } = toRefs(props);
const activeCard = ref("");
const cardList = ref([
{ title: "废气", key: "wg" },
{ title: "废水", key: "ww" }
]);
const statusOption = ref([
{ key: "normal", color: "#0EED9B" },
{ key: "abnormal", color: "#F84439" },
{ key: "offline", color: "#FFFFFF" }
]);
const clickCard = (key, type) => {
if (activeCard.value === key + type)
activeCard.value = "";
else
activeCard.value = key + type;
emit("openPopup", key + type);
};
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
(openBlock(true), createElementBlock(Fragment, null, renderList(cardList.value, (item) => {
return openBlock(), createElementBlock("div", {
key: item.key,
class: normalizeClass(["card-box", { active: activeCard.value === `${item.key}Site` }]),
onClick: ($event) => clickCard(item.key, "Site")
}, [
createElementVNode("div", _hoisted_3, toDisplayString(item.title) + "排口 ", 1),
createElementVNode("div", _hoisted_4, [
(openBlock(true), createElementBlock(Fragment, null, renderList(statusOption.value, (option, index) => {
return openBlock(), createElementBlock("div", {
key: option.key,
class: "status"
}, [
createElementVNode("div", {
class: normalizeClass(["value", [option.key]])
}, toDisplayString(unref(statusData) && unref(statusData)[item.key] ? unref(statusData)[item.key][option.key] : "--"), 3),
index < statusOption.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_5, "/")) : createCommentVNode("", true)
]);
}), 128))
])
], 10, _hoisted_2);
}), 128))
]);
};
}
});
export { _sfc_main as default };