@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" />
89 lines (86 loc) • 3.1 kB
JavaScript
import { defineComponent, ref, watch, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, normalizeStyle, toDisplayString } from 'vue';
import _sfc_main$1 from '../common/popup-table.vue.mjs';
import '../common/popup-table.vue2.mjs';
import { waterQualityStatistic } from './api/index.mjs';
const _hoisted_1 = { class: "dv-wgms-station-water-quality-statistics" };
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "DvWgmsStationWaterQualityStatistics",
title: "站点水质统计(1.1)"
},
__name: "index",
props: {
treeId: { default: "3301" },
treeType: { default: 1 },
year: { default: "2023" },
data: {},
isLazy: { type: Boolean, default: false }
},
setup(__props, { expose: __expose }) {
const props = __props;
const option = ref([
{ label: "排名", key: "index", flex: 0.6, class: "table-number" },
{ label: "站点", key: "siteName", flex: 1.4 },
{ label: "数据时间", key: "dataTime", class: "table-number" },
{ label: "水质类别", key: "level", class: "table-number" },
{ label: "水质目标", key: "target", class: "table-number" },
{ label: "同期水质", key: "yoyLevel", class: "table-number" }
]);
const tableData = ref([]);
const getData = async () => {
const params = {
...props
};
const { data } = await waterQualityStatistic(params);
tableData.value = (data || []).map((item, index) => {
return {
index: index + 1,
...item
};
});
};
watch([() => props.data, () => props.treeId, () => props.treeType, () => props.year, () => props.isLazy], () => {
if (props.isLazy)
return;
if (props.data) {
tableData.value = props.data;
return;
}
getData();
}, { immediate: true });
__expose({
reload: getData
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
createVNode(_sfc_main$1, {
option: option.value,
data: tableData.value,
"header-line-style": { padding: 0 },
"line-style": { padding: 0, height: "32px" }
}, {
level: withCtx((scope) => [
createElementVNode("span", {
class: "tab-item",
style: normalizeStyle({ background: scope.row.levelColor })
}, toDisplayString(scope.row.levelName), 5)
]),
target: withCtx((scope) => [
createElementVNode("span", {
class: "tab-item",
style: normalizeStyle({ background: scope.row.targetColor })
}, toDisplayString(scope.row.targetName), 5)
]),
yoyLevel: withCtx((scope) => [
createElementVNode("span", {
class: "tab-item",
style: normalizeStyle({ background: scope.row.yoyLevelColor })
}, toDisplayString(scope.row.yoyLevelName), 5)
]),
_: 1
}, 8, ["option", "data"])
]);
};
}
});
export { _sfc_main as default };