@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" />
162 lines (159 loc) • 6.65 kB
JavaScript
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/empty.png.mjs';
import __vite_glob_0_3 from './images/footer-light.png.mjs';
import __vite_glob_0_4 from './images/footer.png.mjs';
import __vite_glob_0_5 from './images/leader-light.png.mjs';
import __vite_glob_0_6 from './images/leader.png.mjs';
import __vite_glob_0_7 from './images/staff-light.png.mjs';
import __vite_glob_0_8 from './images/staff.png.mjs';
import { defineComponent, computed, ref, onMounted, openBlock, createElementBlock, createBlock, unref, withCtx, Fragment, renderList, createElementVNode, toDisplayString, normalizeStyle, createCommentVNode } from 'vue';
import { FpiElRolling } from '@ued_fpi/element-plus-expand';
import dayjs from 'dayjs';
import requestControl from '../../service/request.mjs';
import { useThemeHook } from '../../../utils.mjs';
import _sfc_main$1 from '../common/NoData.vue.mjs';
import '../common/NoData.vue2.mjs';
import { setIntervalData } from '../../utils/hooks.mjs';
const _hoisted_1 = { class: "dv-ipes-emergency-watch" };
const _hoisted_2 = /* @__PURE__ */ createElementVNode("div", { class: "emergency-watch-title" }, " 今日值班 ", -1);
const _hoisted_3 = { class: "box" };
const _hoisted_4 = ["src"];
const _hoisted_5 = { class: "info" };
const _hoisted_6 = { class: "type" };
const _hoisted_7 = ["onClick"];
const _hoisted_8 = { class: "name" };
const _hoisted_9 = { class: "phone" };
const _hoisted_10 = { class: "done-header" };
const _hoisted_11 = /* @__PURE__ */ createElementVNode("span", null, "日志填写率", -1);
const _hoisted_12 = { class: "doneRateNumber" };
const _hoisted_13 = {
key: 0,
class: "progress"
};
const _hoisted_14 = { class: "progress-inner" };
const _hoisted_15 = /* @__PURE__ */ createElementVNode("div", { class: "progress-end" }, null, -1);
const __default__ = {
name: "DvIpesEmergencyWatch",
title: "应急值守"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: {
doneRate: {
type: Number,
default: 100
},
url: {
type: String,
default: "/duty-system-server/duty/web/api/v1/work/getDutyKeeper"
}
},
emits: {
callPhone: (value) => value
},
setup(__props, { emit: emits }) {
const props = __props;
const { isDark } = useThemeHook();
const doneRate = computed(() => props.doneRate);
const componentBox = ref(null);
const copies = computed(() => {
const offsetWidth = componentBox.value?.offsetWidth || 0;
return offsetWidth > 0 ? (offsetWidth - 24 - 2) / 3 : 0;
});
const commitmentData = ref([]);
const getImg = (type, isDark2) => {
const key = type === "值班领导" ? "leader" : "staff";
return new URL((/* #__PURE__ */ Object.assign({"./images/bg-light.png": __vite_glob_0_0,"./images/bg.png": __vite_glob_0_1,"./images/empty.png": __vite_glob_0_2,"./images/footer-light.png": __vite_glob_0_3,"./images/footer.png": __vite_glob_0_4,"./images/leader-light.png": __vite_glob_0_5,"./images/leader.png": __vite_glob_0_6,"./images/staff-light.png": __vite_glob_0_7,"./images/staff.png": __vite_glob_0_8}))[`./images/${key}${isDark2 ? "" : "-light"}.png`], self.location).href;
};
async function getCommitmentData() {
try {
const { data } = await requestControl({
method: "get",
url: props.url,
params: {
date: dayjs().format("YYYY-MM-DD")
}
});
commitmentData.value = data.entries || [];
commitmentData.value = commitmentData.value.sort((a, b) => {
if (a.job === "值班领导")
return -1;
return 0;
});
} catch (error) {
console.log(error);
}
}
onMounted(() => {
getCommitmentData();
});
setIntervalData(getCommitmentData, 5 * 60 * 1e3);
function handleCallPhone(phone) {
emits("callPhone", phone);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1, [
_hoisted_2,
commitmentData.value.length ? (openBlock(), createBlock(unref(FpiElRolling), {
key: 0,
class: "list",
direction: "y",
time: 15
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(commitmentData.value, (item, index) => {
return openBlock(), createElementBlock("div", {
key: index,
class: "security-box"
}, [
createElementVNode("div", _hoisted_3, [
createElementVNode("img", {
src: getImg(item.type, unref(isDark))
}, null, 8, _hoisted_4),
createElementVNode("div", _hoisted_5, [
createElementVNode("div", _hoisted_6, toDisplayString(item.job), 1),
createElementVNode("div", {
class: "bottom",
onClick: ($event) => handleCallPhone(item.contactWay)
}, [
createElementVNode("span", _hoisted_8, toDisplayString(item.name), 1),
createElementVNode("span", _hoisted_9, toDisplayString(item.contactWay), 1)
], 8, _hoisted_7)
])
])
]);
}), 128))
]),
_: 1
})) : (openBlock(), createBlock(_sfc_main$1, {
key: 1,
class: "dv-ipes-ground-water-monitor"
})),
createElementVNode("div", {
ref_key: "componentBox",
ref: componentBox,
class: "done"
}, [
createElementVNode("div", _hoisted_10, [
_hoisted_11,
createElementVNode("span", _hoisted_12, toDisplayString(`${doneRate.value}%`), 1)
]),
!isNaN(doneRate.value) ? (openBlock(), createElementBlock("div", _hoisted_13, [
createElementVNode("div", _hoisted_14, [
(openBlock(true), createElementBlock(Fragment, null, renderList(Math.round(doneRate.value * (copies.value / 100)), (item) => {
return openBlock(), createElementBlock("div", {
key: item,
class: "bar",
style: normalizeStyle({ flex: `0 0 calc((100% - ${copies.value}px) / ${copies.value})` })
}, null, 4);
}), 128))
]),
_hoisted_15
])) : createCommentVNode("", true)
], 512)
]);
};
}
});
export { _sfc_main as default };