人数统计

This commit is contained in:
quantulr
2022-10-20 23:46:47 +08:00
parent cb3fdc2ce7
commit 8422f5312e
4 changed files with 73 additions and 26 deletions

View File

@ -7,13 +7,22 @@ const routes = [
{ path: "/amap", component: () => import("../components/AMap.vue") }, { path: "/amap", component: () => import("../components/AMap.vue") },
// { path: "/", component: () => import("../views/Overview/index.vue") }, // { path: "/", component: () => import("../views/Overview/index.vue") },
{ {
path: "/", component: () => import("../views/Layout.vue"), children: [ path: "/",
component: () => import("../views/Layout.vue"),
children: [
{ {
path: '', component: () => import('../views/Overview/index.vue') path: "",
component: () => import("../views/Overview/index.vue"),
}, },
{ path: "monitor", component: () => import("../views/Monitor/index.vue") }, {
{ path: "/monitor/detail", component: () => import("../views/Monitor/monitor-detail.vue") }, path: "monitor",
] component: () => import("../views/Monitor/index.vue"),
},
{
path: "/monitor/detail",
component: () => import("../views/Monitor/monitor-detail.vue"),
},
],
}, },
]; ];
@ -23,7 +32,7 @@ const routes = [
const router = createRouter({ const router = createRouter({
// 4. 内部提供了 history 模式的实现。为了简单起见,我们在这里使用 hash 模式。 // 4. 内部提供了 history 模式的实现。为了简单起见,我们在这里使用 hash 模式。
history: createWebHashHistory(), history: createWebHashHistory(),
routes, // `routes: routes` 的缩写 routes,
}); });
export default router; export default router;

View File

@ -3,36 +3,46 @@
<div class="people-count grid grid-cols-2 gap-y-4"> <div class="people-count grid grid-cols-2 gap-y-4">
<div class="expected"> <div class="expected">
<div> <div>
<span class="num">4936</span> <span class="num">{{ data.NORMALCOUNT }}</span>
<span class="unit"></span> <span class="unit"></span>
</div> </div>
<div class="desc">员总</div> <div class="desc">昨日实际出勤人数</div>
</div> </div>
<div class="actual"> <div class="actual">
<div> <div>
<span class="num">3405</span> <span class="num">{{ data.ABSENTEEISMCOUNT }}</span>
<span class="unit"></span> <span class="unit"></span>
</div> </div>
<div class="desc">实时人数</div> <div class="desc">昨日矿工人数</div>
</div> </div>
<div class="expected"> <div class="expected">
<div> <div>
<span class="num">4800</span> <span class="num">{{ data.ALLCOUNT }}</span>
<span class="unit"></span> <span class="unit"></span>
</div> </div>
<div class="desc">今日出勤人数</div> <div class="desc">昨日应出席人数</div>
</div> </div>
<div class="actual"> <div class="actual">
<div> <div>
<span class="num">88%</span> <span class="num">{{ data.LATECOUNT }}</span>
<span class="unit"></span>
</div> </div>
<div class="desc">今日出勤率</div> <div class="desc">昨日迟到人数</div>
</div> </div>
</div> </div>
</ChartContainer> </ChartContainer>
</template> </template>
<script setup> <script setup>
import ChartContainer from "@/components/ChartContainer.vue"; import ChartContainer from "@/components/ChartContainer.vue";
import { toRefs } from "vue";
const props = defineProps({
data: {
type: Object,
required: true,
// default: {},
},
});
const { data } = toRefs(props);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.project-person-count { .project-person-count {

View File

@ -1,16 +1,27 @@
<template> <template>
<div class="container flex items-center justify-start"> <div class="container flex items-center justify-start">
<img class="icon" src="@/assets/polygon40@3x.png" alt="" /> <img class="icon" src="@/assets/polygon40@3x.png" alt="" />
<div class="title text-white">项目总数</div> <div class="title text-white">项目总</div>
<div class="counting-board flex justify-between"> <div class="counting-board flex justify-between">
<div class="num">1</div> <div class="num" v-for="item in countChars" :key="item">{{ item }}</div>
<div class="num">0</div>
<div class="num">0</div>
<div class="num">0</div>
</div> </div>
</div> </div>
</template> </template>
<script setup></script> <script setup>
import { ref, toRefs } from "vue";
const props = defineProps({
data: {
type: Object,
required: true,
},
});
const { data } = toRefs(props);
const countChars = ref([]);
countChars.value = `${parseInt(data.value.PROJECTCOUNT)}`.split("");
for (let i = countChars.value.length; i < 4; i++) {
countChars.value.unshift("0");
}
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container {
width: 465px; width: 465px;

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="wrap flex justify-between"> <div class="wrap flex justify-between">
<div class="col-1 flex flex-col"> <div class="col-1 flex flex-col">
<ProjectPersonCount /> <ProjectPersonCount :data="projectPersonCount" />
<SecuritySituation class="security-situation" /> <SecuritySituation class="security-situation" />
<QualitySituation class="quality-situation" /> <QualitySituation class="quality-situation" />
</div> </div>
@ -10,7 +10,7 @@
<Gantt /> <Gantt />
</div> </div>
<div class="col-3"> <div class="col-3">
<ProjectTotal class="project-total" /> <ProjectTotal class="project-total" :data="projectPersonCount" />
<ProjectDetail class="project-detail" /> <ProjectDetail class="project-detail" />
</div> </div>
<!-- <div class="row-1 flex justify-between"> <!-- <div class="row-1 flex justify-between">
@ -29,7 +29,7 @@
</div> </div>
</template> </template>
<script setup name="Overview"> <script setup name="Overview">
import { reactive } from "vue"; import { reactive, toRefs } from "vue";
import Map from "./Map.vue"; import Map from "./Map.vue";
import SecuritySituation from "./SecuritySituation.vue"; import SecuritySituation from "./SecuritySituation.vue";
import QualitySituation from "./QualitySituation.vue"; import QualitySituation from "./QualitySituation.vue";
@ -37,11 +37,28 @@ import ProjectTotal from "./ProjectTotal.vue";
import ProjectDetail from "./ProjectDetail.vue"; import ProjectDetail from "./ProjectDetail.vue";
import ProjectPersonCount from "./ProjectPersonCount.vue"; import ProjectPersonCount from "./ProjectPersonCount.vue";
import Gantt from "./Gantt.vue"; import Gantt from "./Gantt.vue";
import axios from "axios";
const config1 = reactive({ // const config1 = reactive({
number: [100], // number: [100],
content: "{nt}个", // content: "{nt}个",
// });
const data = reactive({
projectPersonCount: {},
}); });
const { projectPersonCount } = toRefs(data);
const loadData = async () => {
// const resp = await axios.get("_________url______");
const resp = {
NORMALCOUNT: 0.0,
PROJECTCOUNT: 3,
ABSENTEEISMCOUNT: 3.0,
ALLCOUNT: 3.0,
LATECOUNT: 0.0,
};
projectPersonCount.value = resp;
};
loadData();
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>