@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" />
193 lines (188 loc) • 7.03 kB
JavaScript
'use strict';
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const vue = require('vue');
const task = require('./images/task.png.js');
const icon2Light = require('./images/icon-2-light.svg.js');
const icon2 = require('./images/icon-2.svg.js');
const icon1Light = require('./images/icon-1-light.svg.js');
const icon1 = require('./images/icon-1.svg.js');
const dayjs = require('dayjs');
const utils = require('../../../utils.js');
const index = require('./api/index.js');
const _hoisted_1 = { class: "algae-monitoring-box" };
const _hoisted_2 = { class: "body-box" };
const _hoisted_3 = { class: "left-today" };
const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("img", {
src: task.default,
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: icon2Light.default,
alt: ""
};
const _hoisted_12 = {
key: 1,
src: icon2.default,
alt: ""
};
const _hoisted_13 = /* @__PURE__ */ vue.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: icon1Light.default,
alt: ""
};
const _hoisted_18 = {
key: 1,
src: icon1.default,
alt: ""
};
const _hoisted_19 = /* @__PURE__ */ vue.createElementVNode("div", null, "累计处置", -1);
const _hoisted_20 = { class: "Oswald" };
const _sfc_main = /* @__PURE__ */ vue.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 } = utils.useThemeHook();
const countWarning = vue.ref(0);
const countDisWarning = vue.ref(0);
const todayAlarmNum = vue.ref(0);
const timeData = vue.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 index.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 index.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 index.monitorWarn(params);
if (!data) {
todayAlarmNum.value = 0;
return;
}
let total_ = 0;
data.forEach((item) => {
total_ += item.totalCount;
});
todayAlarmNum.value = total_;
};
vue.onMounted(async () => {
!props.isLazy && getHandleSite();
});
vue.watch([() => props.params, () => props.timeObj, () => props.isLazy], () => {
!props.isLazy && getHandleSite();
}, { deep: true });
__expose({
reload: getHandleSite
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
vue.createElementVNode("div", _hoisted_2, [
vue.createElementVNode("div", _hoisted_3, [
_hoisted_4,
vue.createElementVNode("div", _hoisted_5, [
vue.createElementVNode("div", _hoisted_6, vue.toDisplayString(!vue.unref(timeData).hasPeriod ? "今日提醒" : "当日提醒"), 1),
vue.createElementVNode("div", _hoisted_7, vue.toDisplayString(vue.unref(todayAlarmNum)), 1)
])
]),
vue.createElementVNode("div", _hoisted_8, [
vue.createElementVNode("div", _hoisted_9, [
vue.createElementVNode("div", _hoisted_10, [
!vue.unref(isDark) ? (vue.openBlock(), vue.createElementBlock("img", _hoisted_11)) : (vue.openBlock(), vue.createElementBlock("img", _hoisted_12)),
_hoisted_13
]),
vue.createElementVNode("div", _hoisted_14, vue.toDisplayString(vue.unref(countWarning)), 1)
]),
vue.createElementVNode("div", _hoisted_15, [
vue.createElementVNode("div", _hoisted_16, [
!vue.unref(isDark) ? (vue.openBlock(), vue.createElementBlock("img", _hoisted_17)) : (vue.openBlock(), vue.createElementBlock("img", _hoisted_18)),
_hoisted_19
]),
vue.createElementVNode("div", _hoisted_20, vue.toDisplayString(vue.unref(countDisWarning)), 1)
])
])
])
]);
};
}
});
exports.default = _sfc_main;