@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" />
136 lines (133 loc) • 5.47 kB
JavaScript
import * as agricultural from './images/agricultural.png.mjs';
import * as aquaculture from './images/aquaculture.png.mjs';
import * as carWash from './images/carWash.png.mjs';
import * as garbageTreatmentPlant from './images/garbageTreatmentPlant.png.mjs';
import * as gasStation from './images/gasStation.png.mjs';
import * as hazardousWaste from './images/hazardousWaste.png.mjs';
import * as industry from './images/industry.png.mjs';
import * as livestock from './images/livestock.png.mjs';
import * as market from './images/market.png.mjs';
import * as medicalWaste from './images/medicalWaste.png.mjs';
import * as medicalWasteSource from './images/medicalWasteSource.png.mjs';
import * as residence from './images/residence.png.mjs';
import * as ruralLifeSource from './images/ruralLifeSource.png.mjs';
import * as sewageTreatmentPlant from './images/sewageTreatmentPlant.png.mjs';
import * as unit from './images/unit.png.mjs';
import * as urbanNonPointSource from './images/urbanNonPointSource.png.mjs';
import { defineComponent, reactive, onMounted, watch, toRefs, openBlock, createElementBlock, unref, createBlock, withCtx, createElementVNode, Fragment, renderList, toDisplayString, normalizeStyle } from 'vue';
import { FpiElRolling } from '@ued_fpi/element-plus-expand';
const _hoisted_1 = { class: "dv-wgms-surrounding-pollution-sources" };
const _hoisted_2 = { class: "roll-box" };
const _hoisted_3 = { class: "pollution-num" };
const _hoisted_4 = { class: "pollution-name" };
const _hoisted_5 = {
key: 1,
class: "empty-data"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "DvWgmsSurroundingPollutionSources",
title: "周边污染源(1.4)"
},
__name: "index",
props: {
data: {
type: Array,
default: () => {
return [
{
name: "工业区",
num: 0
},
{
name: "公建单位",
num: 0
},
{
name: "农贸市场",
num: 0
},
{
name: "洗车店",
img: "carWash"
}
];
}
}
},
setup(__props, { expose: __expose }) {
const props = __props;
const imgList = /* #__PURE__ */ Object.assign({"./images/agricultural.png": agricultural,"./images/aquaculture.png": aquaculture,"./images/carWash.png": carWash,"./images/garbageTreatmentPlant.png": garbageTreatmentPlant,"./images/gasStation.png": gasStation,"./images/hazardousWaste.png": hazardousWaste,"./images/industry.png": industry,"./images/livestock.png": livestock,"./images/market.png": market,"./images/medicalWaste.png": medicalWaste,"./images/medicalWasteSource.png": medicalWasteSource,"./images/residence.png": residence,"./images/ruralLifeSource.png": ruralLifeSource,"./images/sewageTreatmentPlant.png": sewageTreatmentPlant,"./images/unit.png": unit,"./images/urbanNonPointSource.png": urbanNonPointSource});
const polluteCode = {
工业区: "industry",
公建单位: "unit",
农贸市场: "market",
洗车店: "carWash",
住宅小区: "residence",
畜禽养殖: "livestock",
水产养殖: "aquaculture",
农业种植: "agricultural",
城市面源: "urbanNonPointSource",
农村生活源: "ruralLifeSource",
污水处理厂: "sewageTreatmentPlant",
垃圾处理厂: "garbageTreatmentPlant",
危险废物: "hazardousWaste",
医疗废物: "medicalWaste",
加油站: "gasStation",
医废重点源: "medicalWasteSource"
};
const state = reactive({
tableDatas: [],
time: 10
});
const getImg = (url) => {
return imgList[`./images/${url}`]?.default;
};
const initData = async () => {
state.tableDatas = props?.data || [];
state.tableDatas.forEach((item) => {
item.img = polluteCode[item.name] || "工业区";
});
state.time = state.tableDatas.length * 2.5;
};
onMounted(() => {
initData();
});
watch([() => () => props.data], () => {
initData();
}, { deep: true });
__expose({
reload: initData
});
const { tableDatas, time } = toRefs(state);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
unref(tableDatas).length ? (openBlock(), createBlock(unref(FpiElRolling), {
key: 0,
"scroll-able": "",
time: unref(time)
}, {
default: withCtx(() => [
createElementVNode("div", _hoisted_2, [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(tableDatas), (item, index) => {
return openBlock(), createElementBlock("div", {
key: index,
class: "pollution-item"
}, [
createElementVNode("span", _hoisted_3, toDisplayString(item.num ?? 0), 1),
createElementVNode("span", _hoisted_4, toDisplayString(item.name), 1),
createElementVNode("div", {
class: "pollution-img",
style: normalizeStyle({ "background-image": `url(${getImg(`${item.img}.png`)})` })
}, null, 4)
]);
}), 128))
])
]),
_: 1
}, 8, ["time"])) : (openBlock(), createElementBlock("div", _hoisted_5, " 暂无数据 "))
]);
};
}
});
export { _sfc_main as default };