@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" />
115 lines (112 loc) • 3.77 kB
JavaScript
import { defineComponent, ref, watch, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, normalizeClass, toDisplayString, Fragment, createCommentVNode } from 'vue';
import _imports_0 from './images/-1.svg.mjs';
import _imports_1 from './images/1.svg.mjs';
import _imports_2 from './images/0.svg.mjs';
import _sfc_main$1 from '../common/popup-table.vue.mjs';
import '../common/popup-table.vue2.mjs';
import { synthesisIndex } from './api/index.mjs';
const _hoisted_1 = { class: "dv-wgms-regional-quality-analysis" };
const _hoisted_2 = {
key: 0,
src: _imports_0,
alt: ""
};
const _hoisted_3 = {
key: 1,
src: _imports_1,
alt: ""
};
const _hoisted_4 = {
key: 2,
src: _imports_2,
alt: ""
};
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "DvWgmsRegionalQualityAnalysis",
title: "区域水质分析(1.1)"
},
__name: "index",
props: {
treeId: {},
timeType: {},
startTime: {},
endTime: {},
data: { default: null },
isLazy: { type: Boolean, default: false },
params: { default: () => {
return {
treeId: "3301",
timeType: "year",
startTime: 16725024e5,
endTime: 17040384e5
};
} }
},
setup(__props, { expose: __expose }) {
const props = __props;
const option = [
{ label: "排名", key: "index", flex: 0.6, class: "table-number" },
{ label: "区域", key: "regionName", flex: 1.4 },
{ label: "本期", key: "currentPeriod", class: "table-number" },
{ label: "同期", key: "yoyPeriod", class: "table-number" },
{ label: "变化率", key: "changePercent", class: "table-number" }
];
const classObj = {
"1": "up-num",
"-1": "down-num",
"0": "same-num"
};
const tableData = ref([]);
const getData = async () => {
const params = {
...props.params
};
const { data } = await synthesisIndex(params);
tableData.value = (data || []).map((item, index) => {
const { changePercent } = item;
return {
index: index + 1,
type: changePercent > 0 ? "1" : changePercent < 0 ? "-1" : "0",
...item
};
});
};
watch([() => props.data, () => props.params, () => 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,
data: tableData.value,
"header-line-style": { padding: 0 },
"line-style": { padding: 0, height: "32px" }
}, {
changePercent: withCtx((scope) => [
createElementVNode("span", {
style: { "margin-right": "4px" },
class: normalizeClass(scope.row.changePercent !== null ? classObj[scope.row.type] : "")
}, toDisplayString(scope.row.changePercent === null ? "--" : scope.row.changePercent), 3),
scope.row.changePercent !== null ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
scope.row.type === "-1" ? (openBlock(), createElementBlock("img", _hoisted_2)) : createCommentVNode("", true),
scope.row.type === "1" ? (openBlock(), createElementBlock("img", _hoisted_3)) : createCommentVNode("", true),
scope.row.type === "0" ? (openBlock(), createElementBlock("img", _hoisted_4)) : createCommentVNode("", true)
], 64)) : createCommentVNode("", true)
]),
_: 1
}, 8, ["data"])
]);
};
}
});
export { _sfc_main as default };