@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" />
189 lines (186 loc) • 6.85 kB
JavaScript
import { defineComponent, ref, computed, onMounted, watch, openBlock, createElementBlock, createElementVNode, toDisplayString, unref } from 'vue';
import _imports_0 from './images/task.png.mjs';
import _imports_1 from './images/icon-2-light.svg.mjs';
import _imports_2 from './images/icon-2.svg.mjs';
import _imports_3 from './images/icon-1-light.svg.mjs';
import _imports_4 from './images/icon-1.svg.mjs';
import dayjs from 'dayjs';
import { useThemeHook } from '../../../utils.mjs';
import { querySiteList, countByAllStatus, monitorWarn } from './api/index.mjs';
const _hoisted_1 = { class: "algae-monitoring-box" };
const _hoisted_2 = { class: "body-box" };
const _hoisted_3 = { class: "left-today" };
const _hoisted_4 = /* @__PURE__ */ createElementVNode("img", {
src: _imports_0,
alt: ""
}, null, -1);
const _hoisted_5 = { class: "right" };
const _hoisted_6 = { class: "title-box" };
const _hoisted_7 = { class: "value-box-red" };
const _hoisted_8 = { class: "right-box" };
const _hoisted_9 = { class: "right-item" };
const _hoisted_10 = { class: "left-img" };
const _hoisted_11 = {
key: 0,
src: _imports_1,
alt: ""
};
const _hoisted_12 = {
key: 1,
src: _imports_2,
alt: ""
};
const _hoisted_13 = /* @__PURE__ */ createElementVNode("div", null, "累计预警", -1);
const _hoisted_14 = { class: "Oswald" };
const _hoisted_15 = { class: "right-item" };
const _hoisted_16 = { class: "left-img" };
const _hoisted_17 = {
key: 0,
src: _imports_3,
alt: ""
};
const _hoisted_18 = {
key: 1,
src: _imports_4,
alt: ""
};
const _hoisted_19 = /* @__PURE__ */ createElementVNode("div", null, "累计处置", -1);
const _hoisted_20 = { class: "Oswald" };
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "DvWgmsAlgaeTopicsWarningStatistics",
title: "藻类监测预警(1.4)"
},
__name: "index",
props: {
params: { default: () => {
return {
treeCode: "330100000000",
stationType: "002"
};
} },
timeObj: { default: () => {
return {
periodBeginTime: dayjs().startOf("year").valueOf(),
periodEndTime: dayjs().endOf("year").valueOf(),
currentTime: dayjs().valueOf(),
currentType: "dailyControl",
upToDate: true
};
} },
isLazy: { type: Boolean, default: false }
},
setup(__props, { expose: __expose }) {
const props = __props;
const { isDark } = useThemeHook();
const countWarning = ref(0);
const countDisWarning = ref(0);
const todayAlarmNum = ref(0);
const timeData = computed(() => {
return {
periodBeginTime: props.timeObj.periodBeginTime,
periodEndTime: props.timeObj.periodEndTime,
beginTime: props.timeObj.currentType !== "dailyControl" ? dayjs(props.timeObj.currentTime).startOf("day").valueOf() : dayjs().startOf("day").valueOf(),
endTime: props.timeObj.currentType !== "dailyControl" ? dayjs(props.timeObj.currentTime).endOf("day").valueOf() : dayjs().endOf("day").valueOf(),
hasPeriod: props.timeObj.currentType !== "dailyControl"
};
});
const getHandleSite = async () => {
const res = await querySiteList({
stationCodes: "1,40",
treeType: 1,
treeCode: props.params.treeCode,
stationType: props.params.stationType
});
const codeList = (res || []).map((item) => item.accessCode);
getTodayData("today", codeList);
getCountWarningAndDis(codeList);
};
const getCountWarningAndDis = async (codeList) => {
const params = {
startTime: timeData.value.periodBeginTime,
endTime: timeData.value.periodEndTime,
dataReviewStatusList: [1],
envTypeCodeList: ["water"],
siteCodeList: codeList,
alarmTypeCodeList: ["automonitor_alga_emergency"]
};
if (!timeData.value.hasPeriod) {
params.startTime = dayjs().startOf("year").valueOf();
params.endTime = dayjs().endOf("day").valueOf();
}
const { data } = await countByAllStatus(params);
if (!data)
return;
countDisWarning.value = data.doneCount;
countWarning.value = data.alarmCount;
};
const getTodayData = async (timeType, codeList) => {
const params = {
startTime: timeData.value.periodBeginTime,
endTime: timeData.value.periodEndTime,
envTypeCodeList: ["water"],
dataReviewStatusList: [1],
siteCodeList: codeList,
alarmTypeCodeList: ["automonitor_alga_emergency"]
};
if (!timeData.value.hasPeriod) {
params.startTime = dayjs().startOf("year").valueOf();
params.endTime = dayjs().endOf("day").valueOf();
}
if (timeType && timeType === "today") {
params.startTime = timeData.value.beginTime;
params.endTime = timeData.value.endTime;
}
const { data } = await monitorWarn(params);
if (!data) {
todayAlarmNum.value = 0;
return;
}
let total_ = 0;
data.forEach((item) => {
total_ += item.totalCount;
});
todayAlarmNum.value = total_;
};
onMounted(async () => {
!props.isLazy && getHandleSite();
});
watch([() => props.params, () => props.timeObj, () => props.isLazy], () => {
!props.isLazy && getHandleSite();
}, { deep: true });
__expose({
reload: getHandleSite
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
createElementVNode("div", _hoisted_2, [
createElementVNode("div", _hoisted_3, [
_hoisted_4,
createElementVNode("div", _hoisted_5, [
createElementVNode("div", _hoisted_6, toDisplayString(!unref(timeData).hasPeriod ? "今日提醒" : "当日提醒"), 1),
createElementVNode("div", _hoisted_7, toDisplayString(unref(todayAlarmNum)), 1)
])
]),
createElementVNode("div", _hoisted_8, [
createElementVNode("div", _hoisted_9, [
createElementVNode("div", _hoisted_10, [
!unref(isDark) ? (openBlock(), createElementBlock("img", _hoisted_11)) : (openBlock(), createElementBlock("img", _hoisted_12)),
_hoisted_13
]),
createElementVNode("div", _hoisted_14, toDisplayString(unref(countWarning)), 1)
]),
createElementVNode("div", _hoisted_15, [
createElementVNode("div", _hoisted_16, [
!unref(isDark) ? (openBlock(), createElementBlock("img", _hoisted_17)) : (openBlock(), createElementBlock("img", _hoisted_18)),
_hoisted_19
]),
createElementVNode("div", _hoisted_20, toDisplayString(unref(countDisWarning)), 1)
])
])
])
]);
};
}
});
export { _sfc_main as default };