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

165 lines (160 loc) 5.92 kB
'use strict'; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } }); const es = require('element-plus/es'); require('element-plus/es/components/base/style/css'); require('element-plus/es/components/scrollbar/style/css'); const vue = require('vue'); const dayjs = require('dayjs'); const tools = require('../../utils/tools.js'); const index = require('./api/index.js'); const _hoisted_1 = { class: "dv-wgms-pollution-sources-elements" }; const _hoisted_2 = { class: "custom-table" }; const _hoisted_3 = { class: "custom-table-header" }; const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("div", { style: { "width": "46px" }, class: "fixed-width" }, " 序号 ", -1); const _hoisted_5 = { class: "custom-table-cell fixed-width", style: { "width": "46px" } }; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: "DvWgmsPollutionSourcesElements", title: "各要素详情-污染源" }, __name: "index", props: { params: { type: Object, default: () => { return { queryTimeType: "day", beginTime: 170136e7, endTime: 1701964799999, alarmTime: 1701964799999, factor: 1, // 因子ID longitude: 119.168, latitude: 30.183, distance: 12e4, limit: -1, minWave: 2 }; } }, isLazy: { type: Boolean, default: false } }, setup(__props, { expose: __expose }) { const props = __props; const state = vue.reactive({ tableData: [] }); const tableProps = vue.ref([ { label: "名称", prop: "name" }, { label: "预警次数", prop: "alarmCount", width: "60px" }, { label: "距离(km)", prop: "distance", width: "70px" }, { label: "波动率", prop: "bdl", width: "70px" } ]); const getDateTime = () => { const timeType = props?.params?.queryTimeType || "hour"; const dateType = props?.params?.queryTimeType === "day" ? "days" : props?.params?.queryTimeType === "hour" ? "hours" : props?.params?.queryTimeType; const dataTime = props?.params?.queryTimeType === "hour" || props?.params?.queryTimeType === "day" ? props?.params?.alarmTime : dayjs(props?.params?.alarmTime).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 getData = async () => { const resp = await index.queryFactorGroup({ code: "companyPollutionSource" }); const factorsObj = resp && resp.length ? resp[0] : null; const params = { queryTimeType: props?.params?.queryTimeType, beginTime: props?.params?.beginTime, // 分析时间开始 endTime: tools.getDateEndTime(props?.params?.queryTimeType, props.params?.endTime), factorFlag: true, factor: factorsObj?.id, longitude: props?.params?.longitude, latitude: props?.params?.latitude, distance: props?.params?.distance / 1e3, limit: props?.params?.limit, minWave: props?.params?.minWave, waveBeginTime: getDateTime().startTime, waveEndTime: getDateTime().endTime, waveFactorFlag: false, waveFactor: props?.params?.factor }; const res = await index.pollutionSourceElements(params); state.tableData = res?.data || []; }; vue.onMounted(async () => { !props.isLazy && getData(); }); vue.watch([() => props.params, () => props.isLazy], () => { !props.isLazy && getData(); }, { deep: true }); __expose({ reload: getData }); const { tableData } = vue.toRefs(state); return (_ctx, _cache) => { const _component_el_scrollbar = es.ElScrollbar; return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ vue.createElementVNode("div", _hoisted_2, [ vue.createElementVNode("div", _hoisted_3, [ _hoisted_4, (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(tableProps.value, (item) => { return vue.openBlock(), vue.createElementBlock("div", { key: item.prop, class: vue.normalizeClass(item.width ? "fixed-width" : "auto-width"), style: vue.normalizeStyle({ width: item.width }) }, vue.toDisplayString(item.label), 7); }), 128)) ]), vue.createVNode(_component_el_scrollbar, { class: "custom-table-body" }, { default: vue.withCtx(() => [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(tableData), (item, index) => { return vue.openBlock(), vue.createElementBlock("div", { key: item.id, class: "custom-table-row" }, [ vue.createElementVNode("div", _hoisted_5, vue.toDisplayString(index + 1), 1), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(tableProps.value, (prop) => { return vue.openBlock(), vue.createElementBlock("div", { key: prop.prop, class: vue.normalizeClass(["custom-table-cell", [prop.width ? "fixed-width" : "auto-width"]]), style: vue.normalizeStyle({ width: prop.width }) }, vue.toDisplayString(item[prop.prop] || item[prop.prop] === 0 ? item[prop.prop] : "--"), 7); }), 128)) ]); }), 128)) ]), _: 1 }) ]) ]); }; } }); exports.default = _sfc_main;