UNPKG

@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" />

163 lines (158 loc) 6.26 kB
'use strict'; 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 sort1 = require('./images/sort1.png.js'); const sort2 = require('./images/sort2.png.js'); const sort3 = require('./images/sort3.png.js'); const base = require('./images/base.png.js'); const _hoisted_1 = { class: "dv-wgms-correlation-coefficient" }; const _hoisted_2 = { key: 0 }; const _hoisted_3 = { class: "coefficient-img" }; const _hoisted_4 = ["src"]; const _hoisted_5 = ["src"]; const _hoisted_6 = { key: 2, class: "img-rank" }; const _hoisted_7 = ["title"]; const _hoisted_8 = { class: "coefficient-relation" }; const _hoisted_9 = /* @__PURE__ */ vue.createElementVNode("span", { class: "label" }, "相关系数:", -1); const _hoisted_10 = { class: "num blue" }; const _hoisted_11 = { class: "coefficient-relation w90" }; const _hoisted_12 = /* @__PURE__ */ vue.createElementVNode("span", { class: "label" }, "报警数:", -1); const _hoisted_13 = { class: "num red" }; const _hoisted_14 = { key: 1, class: "empty-data" }; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: "DvWgmsCorrelationCoefficient", title: "相关性系数(1.4)" }, __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, factorCode: "w01009" }; } }, isLazy: { type: Boolean, default: false } }, setup(__props, { expose: __expose }) { const props = __props; const state = vue.reactive({ tableDatas: [] }); const getDateEndTime = (timeType, date) => { let resDate; if (timeType === "hour") { resDate = dayjs(date).add(1, "hours").startOf("hour").format("x"); } else if (timeType === "day") { resDate = dayjs(date).add(1, "days").startOf("day").format("x"); } else if (timeType === "week") { resDate = dayjs(date).add(1, "week").startOf("week").format("x"); } else if (timeType === "month") { resDate = dayjs(date).add(1, "month").startOf("day").format("x"); } else if (timeType === "year") { resDate = dayjs(date).add(1, "year").startOf("year").format("x"); } return resDate; }; const initData = 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 ? props?.params?.limit : null }; const res = await index.correlationCoefficient(params); const resData = res.data || []; const imgIcon = [sort1.default, sort2.default, sort3.default]; state.tableDatas = resData.map((item, index) => { return { label: item.name, alarmNum: item.alarmCount, coefficientDoubleValue: item.corr !== null ? item.corr : "--", icon: item.rank && Number(item.rank) < 4 ? imgIcon[Number(item.rank) - 1] : "" }; }); }; vue.onMounted(() => { !props.isLazy && initData(); }); vue.watch([() => props.params, () => props.isLazy], () => { !props.isLazy && initData(); }, { deep: true }); __expose({ reload: initData }); const { tableDatas } = vue.toRefs(state); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ vue.unref(tableDatas).length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(tableDatas), (item, index) => { return vue.openBlock(), vue.createElementBlock("div", { key: index, class: "coefficient-item" }, [ vue.createElementVNode("div", _hoisted_3, [ item.icon ? (vue.openBlock(), vue.createElementBlock("img", { key: 0, src: item.icon }, null, 8, _hoisted_4)) : vue.createCommentVNode("", true), !item.icon ? (vue.openBlock(), vue.createElementBlock("img", { key: 1, src: vue.unref(base.default) }, null, 8, _hoisted_5)) : vue.createCommentVNode("", true), !item.icon ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6, vue.toDisplayString(item.rank), 1)) : vue.createCommentVNode("", true) ]), vue.createElementVNode("span", { class: "coefficient-name", title: item.label }, vue.toDisplayString(item.label), 9, _hoisted_7), vue.createElementVNode("div", _hoisted_8, [ _hoisted_9, vue.createElementVNode("span", _hoisted_10, vue.toDisplayString(item.coefficientDoubleValue ?? "--"), 1) ]), vue.createElementVNode("div", _hoisted_11, [ _hoisted_12, vue.createElementVNode("span", _hoisted_13, vue.toDisplayString(item.alarmNum || item.alarmNum === 0 ? item.alarmNum : "--"), 1) ]) ]); }), 128)) ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_14, " 暂无数据 ")) ]); }; } }); exports.default = _sfc_main;