@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" />
200 lines (197 loc) • 6.84 kB
JavaScript
import { defineComponent, ref, reactive, watch, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, unref, withCtx, Fragment, renderList, normalizeStyle, createCommentVNode, createBlock } from 'vue';
import _imports_0 from './images/noData.svg.mjs';
import { FpiElRolling } from '@ued_fpi/element-plus-expand';
import { useCssVar } from '@vueuse/core';
import _sfc_main$1 from '../common/Echarts.vue.mjs';
import '../common/Echarts.vue2.mjs';
import { getCssValue } from '../../utils/tools.mjs';
const _hoisted_1 = { class: "dv-ipes-OrdorControl" };
const _hoisted_2 = { class: "specific-site" };
const _hoisted_3 = { class: "site-name" };
const _hoisted_4 = { class: "site-title" };
const _hoisted_5 = { class: "time" };
const _hoisted_6 = ["title"];
const _hoisted_7 = { class: "right" };
const _hoisted_8 = { style: { color: "#00DEFF" } };
const _hoisted_9 = {
key: 1,
class: "nodata",
style: { "height": "128px" }
};
const _hoisted_10 = /* @__PURE__ */ createElementVNode("img", { src: _imports_0 }, null, -1);
const _hoisted_11 = [
_hoisted_10
];
const _hoisted_12 = { class: "smell-number" };
const _hoisted_13 = { class: "head" };
const _hoisted_14 = /* @__PURE__ */ createElementVNode("div", { class: "title" }, " 异味指数 ", -1);
const _hoisted_15 = {
key: 0,
class: "unit"
};
const _hoisted_16 = {
key: 1,
class: "nodata",
style: { "height": "128px" }
};
const _hoisted_17 = /* @__PURE__ */ createElementVNode("img", { src: _imports_0 }, null, -1);
const _hoisted_18 = [
_hoisted_17
];
const __default__ = {
name: "OdorControl",
title: "异味管控"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: {
siteData: {
type: Object,
default: () => ({
siteCode: "JSYQ0432062300941000",
siteName: "上风向空气超站(六参)",
dataTime: "2023-06-30 10",
siteFactorDatas: [
{
factorCode: "a21001",
factorName: "NH₃",
factorValue: "0.0",
factorStandardValue: "1.0",
exceed: false
}
]
})
},
chartData: {
type: Object,
default: () => ({
xData: ["1月", "2月", "3月", "4月", "5月", "6月"],
yData: ["0.72", "4.00", "4.30", "10.00", "5.00", "7.00"]
})
}
},
setup(__props) {
const props = __props;
const themeEl = ref(null);
const themeColor = useCssVar("--color", themeEl);
const axisLabelEl = ref(null);
const axisLabelColor = useCssVar("--dv-color-text-primary", axisLabelEl);
const splitLineEl = ref(null);
const splitLineElColor = useCssVar("--dv-color-border-light", splitLineEl);
const echartsOptions = reactive({
options: {
color: getCssValue("--dv-color-index"),
grid: {
left: 0,
bottom: 0,
right: 0,
top: 10,
containLabel: true
},
tooltip: {
trigger: "axis",
padding: 8,
background: getCssValue("-dv-color-fill-base")
},
xAxis: {
type: "category",
axisTick: {
show: false
},
axisLine: {
show: false
},
axisLabel: {
color: axisLabelColor.value
},
data: []
},
yAxis: {
type: "value",
splitNumber: 3,
axisTick: {
show: false
},
axisLine: {
show: false
},
axisLabel: {
show: true
},
splitLine: {
lineStyle: {
color: splitLineElColor.value
},
show: true
}
},
series: {
type: "bar",
barWidth: 10,
itemStyle: {
color: themeColor.value
},
data: []
}
},
init: false
});
watch(() => props.chartData, (newValue) => {
echartsOptions.options.xAxis.data = newValue?.xData || [];
echartsOptions.options.series.data = newValue?.yData || [];
}, { deep: true, immediate: true });
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
createElementVNode("div", _hoisted_2, [
createElementVNode("div", _hoisted_3, [
createElementVNode("div", _hoisted_4, toDisplayString(__props.siteData.siteName || "--"), 1),
createElementVNode("div", _hoisted_5, toDisplayString(__props.siteData.dataTime), 1)
]),
createVNode(unref(FpiElRolling), {
class: "site-factor",
direction: "y",
time: __props.siteData.siteFactorDatas.length * 1
}, {
default: withCtx(() => [
__props.siteData.siteFactorDatas && __props.siteData.siteFactorDatas.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.siteData.siteFactorDatas, (item) => {
return openBlock(), createElementBlock("div", {
key: item.factorCode,
class: "item-factor"
}, [
createElementVNode("div", {
class: "left",
title: item.factorName
}, toDisplayString(item.factorName), 9, _hoisted_6),
createElementVNode("div", _hoisted_7, [
createElementVNode("span", {
style: normalizeStyle({ color: item.exceed ? "rgb(248, 68, 57)" : "#15F3A3" })
}, toDisplayString(item.factorValue), 5),
createElementVNode("span", {
style: normalizeStyle({ color: "rgba(255,255,255,.3)" })
}, toDisplayString(` / `), 4),
createElementVNode("span", _hoisted_8, toDisplayString(item.factorStandardValue), 1)
])
]);
}), 128)) : (openBlock(), createElementBlock("div", _hoisted_9, _hoisted_11))
]),
_: 1
}, 8, ["time"]),
createElementVNode("div", _hoisted_12, [
createElementVNode("div", _hoisted_13, [
_hoisted_14,
__props.chartData.yData.length ? (openBlock(), createElementBlock("div", _hoisted_15, " % ")) : createCommentVNode("", true)
]),
__props.chartData.xData.length ? (openBlock(), createBlock(_sfc_main$1, {
key: 0,
id: "echarts",
height: "120px",
"full-options": echartsOptions,
loading: false
}, null, 8, ["full-options"])) : (openBlock(), createElementBlock("div", _hoisted_16, _hoisted_18))
])
])
]);
};
}
});
export { _sfc_main as default };