@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" />
148 lines (145 loc) • 5.66 kB
JavaScript
import { defineComponent, reactive, onMounted, watch, toRefs, openBlock, createElementBlock, createElementVNode, createCommentVNode, Fragment, renderList, unref, toDisplayString, createVNode } from 'vue';
import dayjs from 'dayjs';
import { getDateEndTime } from '../../utils/tools.mjs';
import _sfc_main$1 from '../common/ProgressBar.vue.mjs';
import '../common/ProgressBar.vue2.mjs';
import { correlationAnalysis } from './api/index.mjs';
const _hoisted_1 = { class: "dv-wgms-cross-section-correlation" };
const _hoisted_2 = { class: "section-correlation-table" };
const _hoisted_3 = { class: "section-correlation-list header" };
const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "sort" }, null, -1);
const _hoisted_5 = /* @__PURE__ */ createElementVNode("span", { class: "name" }, null, -1);
const _hoisted_6 = {
key: 0,
class: "progress"
};
const _hoisted_7 = {
key: 1,
class: "correlation-coefficient"
};
const _hoisted_8 = /* @__PURE__ */ createElementVNode("span", { class: "alarm" }, "报警数", -1);
const _hoisted_9 = { class: "sort" };
const _hoisted_10 = ["title"];
const _hoisted_11 = {
key: 0,
class: "progress"
};
const _hoisted_12 = {
key: 1,
class: "correlation-coefficient green"
};
const _hoisted_13 = { class: "alarm red" };
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "DvWgmsCrossSectionCorrelation",
title: "断面相关性系数排名及最近报警统计"
},
__name: "index",
props: {
params: {
type: Object,
default: () => {
return {
alartTime: 1701964799999,
// 报警时间
analysisTime: 24,
accessCode: "31100614",
targetFactorId: 1,
queryTimeType: "day",
beginTime: 170136e7,
// 分析时间开始
endTime: 1701964799999,
// 分析时间结束
delayedFlag: true,
filterEmptyData: true,
limit: 3,
factorCode: "w01009"
};
}
},
isLazy: {
type: Boolean,
default: false
}
},
setup(__props, { expose: __expose }) {
const props = __props;
const data = reactive({
relativeData: []
});
const getData = async () => {
const params = {
time: dayjs(props?.params?.alartTime).valueOf(),
// 报警时间
analysisTime: props?.params?.analysisTime,
accessCode: props?.params?.accessCode,
targetFactorId: props?.params?.targetFactorId,
queryTimeType: props?.params?.queryTimeType,
beginTime: props?.params?.beginTime,
// 分析时间开始
endTime: getDateEndTime(props?.params?.queryTimeType, props.params?.endTime),
sourceFactors: props?.params?.factorCode,
delayedFlag: props?.params?.delayedFlag,
filterEmptyData: props?.params?.filterEmptyData,
limit: props?.params?.limit
};
const res = await correlationAnalysis(params);
const resData = res.data || [];
data.relativeData = resData.map((item) => {
return {
rank: item.rank,
label: item.name,
alarmNum: item.alarmCount,
coefficientDoubleValue: item.corr !== null ? item.corr : "--"
};
});
if (props?.params?.queryTimeType === "hour")
data.relativeData = data.relativeData.filter((item) => !(item.alarmNum === 0 && item.coefficientDoubleValue === "--"));
else
data.relativeData = data.relativeData.filter((item) => item.alarmNum !== 0);
};
onMounted(() => {
!props.isLazy && getData();
});
watch([() => props.params, () => props.isLazy], () => {
!props.isLazy && getData();
}, { deep: true });
__expose({
reload: getData
});
const { relativeData } = toRefs(data);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
createElementVNode("div", _hoisted_2, [
createElementVNode("div", _hoisted_3, [
_hoisted_4,
_hoisted_5,
props?.params?.queryTimeType === "hour" ? (openBlock(), createElementBlock("span", _hoisted_6)) : createCommentVNode("", true),
props?.params?.queryTimeType === "hour" ? (openBlock(), createElementBlock("span", _hoisted_7, "相关系数")) : createCommentVNode("", true),
_hoisted_8
]),
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(relativeData), (item, index) => {
return openBlock(), createElementBlock("div", {
key: index,
class: "section-correlation-list"
}, [
createElementVNode("span", _hoisted_9, toDisplayString(item.rank), 1),
createElementVNode("span", {
class: "name",
title: item.label
}, toDisplayString(item.label), 9, _hoisted_10),
props?.params?.queryTimeType === "hour" ? (openBlock(), createElementBlock("div", _hoisted_11, [
createVNode(_sfc_main$1, {
percentage: item.coefficientDoubleValue * 100
}, null, 8, ["percentage"])
])) : createCommentVNode("", true),
props?.params?.queryTimeType === "hour" ? (openBlock(), createElementBlock("span", _hoisted_12, toDisplayString(item.coefficientDoubleValue ?? "--"), 1)) : createCommentVNode("", true),
createElementVNode("span", _hoisted_13, toDisplayString(item.alarmNum || item.alarmNum === 0 ? item.alarmNum : "--"), 1)
]);
}), 128))
])
]);
};
}
});
export { _sfc_main as default };