Browse Source

首页接口调试

master
wwp 1 month ago
parent
commit
4cddb9a71b
4 changed files with 60 additions and 50 deletions
  1. +4
    -0
      SafeCampus.WEB/src/api/modules/usermanage/dormitory.ts
  2. +8
    -0
      SafeCampus.WEB/src/api/modules/warn/zjrq.ts
  3. +46
    -48
      SafeCampus.WEB/src/views/home/index.vue
  4. +2
    -2
      SafeCampus.WEB/src/views/userManage/dormitory/components/formDormitory/index.vue

+ 4
- 0
SafeCampus.WEB/src/api/modules/usermanage/dormitory.ts View File

@@ -78,6 +78,10 @@ const userManageDormitoryApi = {
/** 获取归寝时间 */ /** 获取归寝时间 */
getReturnTime() { getReturnTime() {
return httpChamber.get("getReturnTime"); return httpChamber.get("getReturnTime");
},
// 获取宿舍楼摄像头列表
getBuildCameraList() {
return http.get("getBuildCameraList");
} }
}; };




+ 8
- 0
SafeCampus.WEB/src/api/modules/warn/zjrq.ts View File

@@ -45,6 +45,14 @@ const warnZJRQApi = {
/** 处理预警 */ /** 处理预警 */
handWarn(params: ReqId) { handWarn(params: ReqId) {
return http.post("handWarn", params); return http.post("handWarn", params);
},
// 首页基础数据
basicInfo() {
return http.get("getBaseStatistics");
},
// 首页高危预警
highWarn() {
return http.get("getHighRisk");
} }
}; };




+ 46
- 48
SafeCampus.WEB/src/views/home/index.vue View File

@@ -16,7 +16,7 @@
</div> </div>
<div class="home-bg-content-item-content"> <div class="home-bg-content-item-content">
<div class="home-bg-content-item-title">摄像头数量</div> <div class="home-bg-content-item-title">摄像头数量</div>
<div class="home-bg-content-item-value">3</div>
<div class="home-bg-content-item-value">{{ basicInfo.cameraCount }}</div>
</div> </div>
</div></el-col </div></el-col
> >
@@ -27,7 +27,7 @@
</div> </div>
<div class="home-bg-content-item-content"> <div class="home-bg-content-item-content">
<div class="home-bg-content-item-title">预警信息总量</div> <div class="home-bg-content-item-title">预警信息总量</div>
<div class="home-bg-content-item-value">1972</div>
<div class="home-bg-content-item-value">{{ basicInfo.warnCount }}</div>
</div> </div>
</div></el-col </div></el-col
> >
@@ -38,7 +38,7 @@
</div> </div>
<div class="home-bg-content-item-content"> <div class="home-bg-content-item-content">
<div class="home-bg-content-item-title">处理意见提交</div> <div class="home-bg-content-item-title">处理意见提交</div>
<div class="home-bg-content-item-value">40</div>
<div class="home-bg-content-item-value">{{ basicInfo.handCount }}</div>
</div> </div>
</div></el-col </div></el-col
> >
@@ -49,7 +49,7 @@
</div> </div>
<div class="home-bg-content-item-content"> <div class="home-bg-content-item-content">
<div class="home-bg-content-item-title">参与安防教师</div> <div class="home-bg-content-item-title">参与安防教师</div>
<div class="home-bg-content-item-value">22</div>
<div class="home-bg-content-item-value">{{ basicInfo.teacherCount }}</div>
</div> </div>
</div></el-col </div></el-col
> >
@@ -86,7 +86,7 @@
<div>高危预警信息统计</div> <div>高危预警信息统计</div>
</div> </div>
<div class="home-bg-content handleBox"> <div class="home-bg-content handleBox">
<ProTable ref="proTable" title="视频列表" :toolButton="false" :pagination="false" :columns="columns" :data="tableData"> </ProTable>
<ProTable ref="proTable" :toolButton="false" :pagination="false" :columns="columns" :data="highTabledata"> </ProTable>
</div> </div>
</div> </div>
</el-col> </el-col>
@@ -108,7 +108,7 @@
<script setup lang="ts" name="home"> <script setup lang="ts" name="home">
import { ref, watch, provide, onMounted, unref, computed, reactive } from "vue"; import { ref, watch, provide, onMounted, unref, computed, reactive } from "vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { monitorLIVEApi } from "@/api";
import { warnZJRQApi } from "@/api";
import { ZJRQ } from "@/api/interface"; import { ZJRQ } from "@/api/interface";
import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface"; import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
import { useDictStore } from "@/stores/modules"; import { useDictStore } from "@/stores/modules";
@@ -121,9 +121,30 @@ const chart2 = ref(null);
const chart3 = ref(null); const chart3 = ref(null);


onMounted(() => { onMounted(() => {
getBasic();
getHighWarin();
getDataChart(); getDataChart();
getWeekData(); getWeekData();
}); });
let basicInfo = reactive({
cameraCount: 0,
handCount: 0,
teacherCount: 0,
warnCount: 0
});

// 获取基础数据
function getBasic() {
warnZJRQApi.basicInfo().then((res: any) => {
if (res.code == 200) {
basicInfo.cameraCount = res.data.cameraCount;
basicInfo.handCount = res.data.handCount;
basicInfo.teacherCount = res.data.teacherCount;
basicInfo.warnCount = res.data.warnCount;
}
});
}

function getDataChart() { function getDataChart() {
setTimeout(async () => { setTimeout(async () => {
await statistionApi.warnstatistion({}).then(res => { await statistionApi.warnstatistion({}).then(res => {
@@ -158,6 +179,7 @@ function getDataChart() {
}); });
}); });
} }

function getCharts1(data: any) { function getCharts1(data: any) {
const chart = echarts.init(chart1.value); const chart = echarts.init(chart1.value);
const option = { const option = {
@@ -170,7 +192,7 @@ function getCharts1(data: any) {
// }, // },
legend: { legend: {
orient: "vertical", orient: "vertical",
left: "right",
right: "0%",
top: "middle" top: "middle"
}, },
series: [ series: [
@@ -220,7 +242,7 @@ function getCharts2(data: any) {
// }, // },
legend: { legend: {
orient: "vertical", orient: "vertical",
left: "right",
right: "0%",
top: "middle" top: "middle"
}, },
series: [ series: [
@@ -325,61 +347,37 @@ const dictStore = useDictStore();
// 表格配置项 // 表格配置项
const columns: ColumnProps<ZJRQ.WarnInfo>[] = [ const columns: ColumnProps<ZJRQ.WarnInfo>[] = [
{ {
prop: "type",
prop: "name",
label: "数据类型" label: "数据类型"
// render: () => { // render: () => {
// return "楼道"; // return "楼道";
// } // }
}, },
{ {
prop: "warntotal",
label: "预警总量"
prop: "day",
label: "今日预警"
// render: () => { // render: () => {
// return "楼道"; // return "楼道";
// } // }
}, },
{ {
prop: "lowrisk",
label: "低危信息 "
prop: "week",
label: "七日预警 "
}, },
{ {
prop: "highrisk",
label: "高危信息"
prop: "count",
label: "预警总量"
} }
]; ];
const tableData = ref([
{
type: "今日",
warntotal: "20",
lowrisk: "10",
highrisk: "10"
},
{
type: "本周",
warntotal: "50",
lowrisk: "20",
highrisk: "30"
},
{
type: "本月",
warntotal: "198",
lowrisk: "176",
highrisk: "22"
},
{
type: "上月",
warntotal: "10",
lowrisk: "5",
highrisk: "5"
},

{
type: "环比",
warntotal: "-9.07%",
lowrisk: "0%",
highrisk: "0%"
}
]);
let highTabledata = ref([]);
// 获取高危预警数据
function getHighWarin() {
warnZJRQApi.highWarn().then((res: any) => {
if (res.code == 200) {
highTabledata.value = res.data;
}
});
}
const tableLoading = ref(false); const tableLoading = ref(false);
</script> </script>




+ 2
- 2
SafeCampus.WEB/src/views/userManage/dormitory/components/formDormitory/index.vue View File

@@ -142,8 +142,8 @@ onMounted(() => {
getCreamaList(); getCreamaList();
}); });
const getCreamaList = () => { const getCreamaList = () => {
monitorLIVEApi.list({ pageNum: 1, pageSize: 1000 }).then(res => {
creamaData.value = res.data.list;
userManageDormitoryApi.getBuildCameraList().then((res: any) => {
creamaData.value = res.data;
}); });
}; };
// 暴露给父组件的方法 // 暴露给父组件的方法


Loading…
Cancel
Save