@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" />
115 lines (112 loc) • 4.95 kB
JavaScript
import { ElTooltip } from 'element-plus/es';
import 'element-plus/es/components/base/style/css';
import 'element-plus/es/components/tooltip/style/css';
import __vite_glob_0_0 from './images/bg-light.png.mjs';
import __vite_glob_0_1 from './images/bg.png.mjs';
import __vite_glob_0_2 from './images/selfUse-light.png.mjs';
import __vite_glob_0_3 from './images/selfUse.png.mjs';
import __vite_glob_0_4 from './images/stockWeight-light.png.mjs';
import __vite_glob_0_5 from './images/stockWeight.png.mjs';
import __vite_glob_0_6 from './images/transfer-light.png.mjs';
import __vite_glob_0_7 from './images/transfer.png.mjs';
import __vite_glob_0_8 from './images/wasteGenerated-light.png.mjs';
import __vite_glob_0_9 from './images/wasteGenerated.png.mjs';
import { defineComponent, ref, onMounted, openBlock, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, unref, toDisplayString, createVNode, withCtx } from 'vue';
import dayjs from 'dayjs';
import requestControl from '../../service/request.mjs';
import { useThemeHook } from '../../../utils.mjs';
import { setIntervalData } from '../../utils/hooks.mjs';
const _hoisted_1 = { class: "dv-ipes-hazardous-waste" };
const _hoisted_2 = { class: "box" };
const _hoisted_3 = ["src"];
const _hoisted_4 = { class: "info" };
const _hoisted_5 = { class: "name" };
const _hoisted_6 = { class: "right flex" };
const _hoisted_7 = { class: "value" };
const _hoisted_8 = /* @__PURE__ */ createElementVNode("div", { class: "unit" }, " 吨 ", -1);
const __default__ = {
name: "DvIpesHazardousWasteManagement",
title: "危废管理"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: {
companyCode: { default: "" },
companyAuth: { default: 1 },
year: { default: +dayjs().year() }
},
setup(__props) {
const props = __props;
const { isDark } = useThemeHook();
const basicInfos = ref([
{ name: "危废产生", key: "wasteGenerated" },
{ name: "自行处置", key: "selfUse" },
{ name: "委外处置", key: "transfer" },
{ name: "库存量", key: "stockWeight" }
]);
const infoData = ref({
wasteGenerated: 0,
selfUse: 0,
transfer: 0,
stockWeight: 0
});
const getImg = (key) => {
return new URL((/* #__PURE__ */ Object.assign({"./images/bg-light.png": __vite_glob_0_0,"./images/bg.png": __vite_glob_0_1,"./images/selfUse-light.png": __vite_glob_0_2,"./images/selfUse.png": __vite_glob_0_3,"./images/stockWeight-light.png": __vite_glob_0_4,"./images/stockWeight.png": __vite_glob_0_5,"./images/transfer-light.png": __vite_glob_0_6,"./images/transfer.png": __vite_glob_0_7,"./images/wasteGenerated-light.png": __vite_glob_0_8,"./images/wasteGenerated.png": __vite_glob_0_9}))[`./images/${key}.png`], self.location).href;
};
async function getData() {
try {
const { data } = await requestControl({
method: "get",
url: "/ipes-hwms-server/api/v2/statistics/gis/company-overview",
params: props
});
infoData.value = data;
} catch (error) {
console.log(error);
}
}
function getShowData(value) {
return value == null ? "0" : value;
}
onMounted(() => {
getData();
});
setIntervalData(getData, 5 * 60 * 1e3);
return (_ctx, _cache) => {
const _component_el_tooltip = ElTooltip;
return openBlock(), createElementBlock("div", _hoisted_1, [
(openBlock(true), createElementBlock(Fragment, null, renderList(basicInfos.value, (item) => {
return openBlock(), createElementBlock("div", {
key: item.key,
class: normalizeClass(["security-box", item.key])
}, [
createElementVNode("div", _hoisted_2, [
createElementVNode("img", {
src: getImg(item.key + (unref(isDark) ? "" : "-light"))
}, null, 8, _hoisted_3),
createElementVNode("div", _hoisted_4, [
createElementVNode("div", _hoisted_5, toDisplayString(item.name), 1),
createElementVNode("div", _hoisted_6, [
createVNode(_component_el_tooltip, {
disabled: getShowData(infoData.value[item.key]) && getShowData(infoData.value[item.key]).length < 8,
class: "item",
effect: "dark",
content: getShowData(infoData.value[item.key]),
placement: "top-start"
}, {
default: withCtx(() => [
createElementVNode("div", _hoisted_7, toDisplayString(getShowData(infoData.value[item.key])), 1)
]),
_: 2
}, 1032, ["disabled", "content"]),
_hoisted_8
])
])
])
], 2);
}), 128))
]);
};
}
});
export { _sfc_main as default };