@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" />
108 lines (103 loc) • 3.38 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const vue = require('vue');
const dayjs = require('dayjs');
const index = require('./api/index.js');
const _hoisted_1 = { class: "dv-wgms-auxiliary-judgment" };
const _hoisted_2 = { class: "conclusion-box" };
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{
name: "DvWgmsAuxiliaryJudgment",
title: "辅助研判"
},
__name: "index",
props: {
params: {
type: Object,
default: () => {
return {
beginTime: 16858944e5,
endTime: 16858944e5,
distance: 1e4,
factorId: 9,
// 因子ID
longitude: 120.445633,
latitude: 30.120086,
siteCode: "YYZDSTGG00S330127_0012A",
surroundingStationCodes: "1",
// 需要找的周边类型编码
timeStamp: 1688313541e3,
// 统计事件数量的时间点
timeType: "week",
siteCodeList: []
// 站点code
};
}
},
returnData: {
type: Array,
default: () => {
return [];
}
},
isLazy: {
type: Boolean,
default: false
}
},
setup(__props, { expose: __expose }) {
const props = __props;
const data = vue.reactive({
resultTable: []
// 研判结论返回
});
const getDateTime = () => {
const timeType = props?.params?.timeType;
const dateType = props?.params?.timeType === "day" ? "days" : props?.params?.timeType === "hour" ? "hours" : props?.params?.timeType;
const dataTime = props?.params?.timeType === "hour" || props?.params?.timeType === "day" ? props?.params.timeStamp : dayjs(props?.params.timeStamp).startOf(timeType).valueOf();
return {
startTime: dayjs(dataTime).add(-23, dateType).startOf(timeType).format("x"),
endTime: dayjs(dataTime).add(1, dateType).startOf(timeType).format("x")
};
};
const getConclusion = () => {
if (props.returnData && props.returnData.length) {
data.resultTable = props.returnData;
return;
}
const { startTime, endTime } = getDateTime();
const params = {
...props?.params,
distance: props?.params?.distance / 1e3,
waveBeginTime: startTime,
waveEndTime: endTime
};
index.analysisResult(params).then((res) => {
data.resultTable = res?.data ?? [];
});
};
vue.onMounted(async () => {
!props.isLazy && getConclusion();
});
vue.watch([() => props.params, () => props.returnData, () => props.isLazy], () => {
!props.isLazy && getConclusion();
}, { deep: true });
__expose({
reload: getConclusion
});
const { resultTable } = vue.toRefs(data);
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
vue.createElementVNode("div", _hoisted_2, [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(resultTable), (item, index) => {
return vue.openBlock(), vue.createElementBlock("div", {
key: index,
class: "conclusion-text"
}, vue.toDisplayString(item), 1);
}), 128))
])
]);
};
}
});
exports.default = _sfc_main;