@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" />
195 lines (190 loc) • 5.35 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const vue = require('vue');
const BaseECharts_vue_vue_type_script_setup_true_lang = require('../../utils/echarts/BaseECharts.vue.js');
const index = require('./api/index.js');
const _hoisted_1 = { class: "dv-wgms-changes-along-the-process" };
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{
name: "DvWgmsChangesAlongTheProcess",
title: "叶绿素a沿程变化"
},
__name: "index",
props: {
height: { default: "200px" },
params: { default: () => {
return {
factorCode: "w01016",
siteCode: "",
stationCode: "1",
time: 1694016e6,
timeType: "day"
};
} },
data: { default: null }
},
setup(__props, { expose: __expose }) {
const props = __props;
const chartUpstreamImpact = vue.ref();
const option = vue.ref(void 0);
vue.watch([
() => props.params,
() => props.data,
() => props.isLazy
], async () => {
!props.isLazy && getData();
}, { deep: true, immediate: true });
vue.onMounted(async () => {
await vue.nextTick();
!props.isLazy && getData();
});
const getData = async () => {
let resData;
if (props.data) {
resData = props.data;
} else {
const res = await index.pathAnalysis(props.params);
resData = res?.data;
}
const dataList = resData?.siteFactorDataList ?? [];
const xData = dataList.map((item) => {
return item.siteName;
});
const valueDate = dataList.map((item) => {
return item.factorValue;
});
const limit = resData?.limit;
option.value = await upstreamSectionOptions(xData, valueDate, limit);
};
const upstreamSectionOptions = (xData, data, limit) => {
return {
title: {
show: true,
text: "μg/L",
textAlign: "left",
left: 10,
top: 10,
textStyle: {
color: "var(--dv-color-text-secondary)",
fontSize: "var(--dv-text-number2)",
fontFamily: "var(--dv-font-family-number)"
}
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "line"
// 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
top: 50,
left: 10,
right: "1%",
bottom: 20,
containLabel: true
},
xAxis: [
{
type: "category",
data: xData,
axisLine: {
show: false
},
axisLabel: {
textStyle: {
color: "var(--dv-color-text-primary)",
fontSize: "var( --dv-text-body1)"
}
},
axisTick: {
show: false
}
}
],
yAxis: [
{
type: "value",
name: "",
axisLabel: {
textStyle: {
fontFamily: "var(--dv-font-family-number)",
fontSize: "var(--dv-text-number2)",
color: "var(--dv-color-text-secondary)"
}
},
axisLine: {
show: false
},
splitArea: {
show: false
},
splitLine: {
show: true,
lineStyle: {
color: "var(--dv-color-fill-lighter)"
}
},
axisTick: { show: false }
}
],
series: [
{
name: "沿程变化",
type: "line",
data,
symbol: "circle",
symbolSize: 8,
lineStyle: {
color: "#0AAEFF",
width: 1
},
itemStyle: {
color: (params) => {
return params.value > limit ? "#f54455" : "#1492E6";
}
},
markLine: {
symbol: "none",
type: "average",
data: [
{
name: "超标线",
lineStyle: {
type: "solid",
color: "var(--dv-color-danger)"
},
label: {
position: "end",
formatter: "{b}",
distance: -50,
backgroundColor: "var(--dv-color-danger)",
color: "var(--dv-color-text-primary)",
borderRadius: 20,
padding: [3, 7]
},
yAxis: limit
}
]
}
}
]
};
};
__expose({
reload: getData
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
vue.createElementVNode("div", {
ref_key: "chartUpstreamImpact",
ref: chartUpstreamImpact,
class: "chart"
}, [
vue.createVNode(BaseECharts_vue_vue_type_script_setup_true_lang.default, { options: option.value }, null, 8, ["options"])
], 512)
]);
};
}
});
exports.default = _sfc_main;