|
@@ -13,20 +13,21 @@
|
|
|
|
|
|
<el-row style="flex-wrap: wrap; ">
|
|
|
<el-col
|
|
|
-v-for="(item, index) in projects" :key="`card-${index}`" :xs="24" :sm="8"
|
|
|
- :md="8" :lg="8" :xl="8">
|
|
|
+ v-for="(item, index) in projects" :key="`card-${index}`" :xs="24" :sm="8"
|
|
|
+ :md="8" :lg="8" :xl="8">
|
|
|
<el-card
|
|
|
-class="mr-10px mt-5px ml-10px "
|
|
|
- :style="{ backgroundColor: item.cardBgColor }">
|
|
|
+ class="mr-10px mt-5px ml-10px "
|
|
|
+ :style="{ backgroundColor: item.cardBgColor }">
|
|
|
<div class="flex items-center h-120px ">
|
|
|
<!-- <Icon :icon="item.icon" :size="25" class="mr-8px" /> -->
|
|
|
<Icon
|
|
|
-:icon="item.icon" :size="80"
|
|
|
- :style="{ backgroundColor: item.iconBgColor, color: item. iconColor, borderRadius: '50%' }"
|
|
|
- class="circle-icon"/>
|
|
|
+ :icon="item.icon" :size="80"
|
|
|
+ :style="{ backgroundColor: item.iconBgColor, color: item. iconColor, borderRadius: '50%' }"
|
|
|
+ class="circle-icon"/>
|
|
|
<span class="text-30px c-black ">{{ item.name }}</span>
|
|
|
</div>
|
|
|
- <div class="mb-18px text-40px c-#233B59FF ml-20px text-center">{{
|
|
|
+ <div class="mb-18px text-40px c-#233B59FF ml-20px text-center">
|
|
|
+ {{
|
|
|
t(item.message)
|
|
|
}}
|
|
|
</div>
|
|
@@ -309,6 +310,7 @@ v-if="list1.length == 0"
|
|
|
|
|
|
</el-row>
|
|
|
</el-skeleton>
|
|
|
+ <teacher ref="teacherFormRef" @success="getUserInfo"/>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
@@ -325,6 +327,9 @@ import * as UserApi from '@/api/system/user'
|
|
|
import * as DeptApi from '@/api/system/dept'
|
|
|
import {StudentAttendanceApi} from '@/api/system/studentAttendance'
|
|
|
import * as echarts from 'echarts';
|
|
|
+import {PopDo,getIsPop} from '@/api/system/user/pop';
|
|
|
+import { getUserProfile, ProfileVO } from '@/api/system/user/profile';
|
|
|
+import teacher from '../userDetail/teacher.vue';
|
|
|
|
|
|
defineOptions({name: 'SystemHome'})
|
|
|
|
|
@@ -336,6 +341,39 @@ const avatar = userStore.getUser.avatar
|
|
|
const username = userStore.getUser.nickname
|
|
|
const chartRef = ref(null)
|
|
|
const chartInstance = ref(null)
|
|
|
+// 教师是否弹窗
|
|
|
+const teacherFormRef = ref();
|
|
|
+const isPop = ref();
|
|
|
+const userInfo = ref({} as ProfileVO);
|
|
|
+const getPopDataFunction = async () => {
|
|
|
+ console.log('getPopDataFunction 被调用');
|
|
|
+ try {
|
|
|
+ isPop.value = await getIsPop();
|
|
|
+ console.log(isPop.value, '弹窗值');
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取弹窗状态失败:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const teacherForm = () => {
|
|
|
+ if (teacherFormRef.value) {
|
|
|
+ teacherFormRef.value.open('update', userInfo.value.id);
|
|
|
+ } else {
|
|
|
+ console.error('Teacher form component is not mounted yet!');
|
|
|
+ }
|
|
|
+};
|
|
|
+const getUserInfo = async () => {
|
|
|
+ try {
|
|
|
+ loading.value = true;
|
|
|
+ const users = await getUserProfile();
|
|
|
+ userInfo.value = users;
|
|
|
+ // console.log('获取用户信息成功:', userInfo.value);
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取用户信息失败:', error);
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
/*基本信息*/
|
|
|
const detail = reactive({
|
|
@@ -345,7 +383,7 @@ const detail = reactive({
|
|
|
})
|
|
|
const getDetail = async () => {
|
|
|
const data = await UserApi.getDetail()
|
|
|
- console.log("基本信息", data);
|
|
|
+ // console.log("基本信息", data);
|
|
|
detail.deptNum = data.deptNum
|
|
|
detail.teacherNum = data.teacherNum
|
|
|
detail.studentNum = data.studentNum
|
|
@@ -396,7 +434,7 @@ let totalSate = reactive<WorkplaceTotal>({
|
|
|
})
|
|
|
const getCount = async () => {
|
|
|
const data = await StudentAttendanceApi.getDayAttendance()
|
|
|
- console.log("实时出勤统计", data);
|
|
|
+ // console.log("实时出勤统计", data);
|
|
|
totalSate = Object.assign(totalSate, data)
|
|
|
}
|
|
|
|
|
@@ -407,7 +445,7 @@ const getCount = async () => {
|
|
|
let pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption
|
|
|
const getGraduateCount = async () => {
|
|
|
const data = await UserApi.getGraduateCount()
|
|
|
- console.log("毕业达成统计", data);
|
|
|
+ // console.log("毕业达成统计", data);
|
|
|
const studentNum = data.studentNum;
|
|
|
const graduateNum = data.graduateNum;
|
|
|
const options = {
|
|
@@ -514,30 +552,11 @@ const getGraduateCount = async () => {
|
|
|
chartInstance.value.setOption(pieOptionsData, true);
|
|
|
}
|
|
|
};
|
|
|
- //图表自动适应容器尺寸变化
|
|
|
-onMounted(() => {
|
|
|
- nextTick(()=>{
|
|
|
- if (chartRef.value) {
|
|
|
- chartInstance.value = echarts.init(chartRef.value);
|
|
|
- chartInstance.value.setOption(pieOptionsData);
|
|
|
-
|
|
|
- window.addEventListener('resize', resizeChart);
|
|
|
- resizeChart();
|
|
|
- }
|
|
|
- })
|
|
|
-});
|
|
|
-
|
|
|
-onUnmounted(() => {
|
|
|
- if (chartInstance.value) {
|
|
|
- window.removeEventListener('resize', resizeChart);
|
|
|
- chartInstance.value.dispose();
|
|
|
- }
|
|
|
-});
|
|
|
|
|
|
const resizeChart = () => {
|
|
|
- console.log(chartRef.value,"eee")
|
|
|
+ // console.log(chartRef.value,"eee")
|
|
|
if (chartInstance.value && chartRef.value) {
|
|
|
- console.log(chartRef.value,"eee")
|
|
|
+ // console.log(chartRef.value,"eee")
|
|
|
const width = chartRef.value.offsetWidth;
|
|
|
// 根据容器宽度计算内外径比例
|
|
|
const innerRadius = width > 600 ? '50%' : '20%';
|
|
@@ -562,7 +581,7 @@ barOptionsData.textStyle = {
|
|
|
};
|
|
|
const getWeekend = async () => {
|
|
|
const data = await StudentAttendanceApi.getWeekendAttendance();
|
|
|
- console.log("周出勤情况", data);
|
|
|
+ // console.log("周出勤情况", data);
|
|
|
const normalData = data.dailyNormalList
|
|
|
const errorData = data.dailyErrorList;
|
|
|
const excuseData = data.dailyExcuseList;
|
|
@@ -575,7 +594,7 @@ const getWeekend = async () => {
|
|
|
let list2 = reactive([]);
|
|
|
const getStudentAttendanceError = async () => {
|
|
|
const data = await StudentAttendanceApi.getDayStudentErrorAttendance()
|
|
|
- console.log("缺勤列表", data);
|
|
|
+ // console.log("缺勤列表", data);
|
|
|
list2.splice(0, list2.length, ...data);
|
|
|
}
|
|
|
const class2Options = reactive({
|
|
@@ -589,7 +608,7 @@ const class2Options = reactive({
|
|
|
const list = reactive([]);
|
|
|
const getStudentAttendance = async () => {
|
|
|
const data = await StudentAttendanceApi.getDayStudentAttendance()
|
|
|
- console.log("打卡列表", data);
|
|
|
+ // console.log("打卡列表", data);
|
|
|
list.splice(0, list.length, ...data);
|
|
|
}
|
|
|
const classOptions = reactive({
|
|
@@ -603,7 +622,7 @@ const classOptions = reactive({
|
|
|
const list1 = reactive([]);
|
|
|
const getGraduationSource = async () => {
|
|
|
const data = await DeptApi.getGraduationSource()
|
|
|
- console.log("毕业条件达成率", data);
|
|
|
+ // console.log("毕业条件达成率", data);
|
|
|
list1.splice(0, list1.length, ...data);
|
|
|
}
|
|
|
const list1Options = reactive({
|
|
@@ -612,16 +631,42 @@ const list1Options = reactive({
|
|
|
direction: 1,//方向: 0 往下 1 往上 2 向左 3 向右。
|
|
|
});
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- getDetail()
|
|
|
- getWeekend()
|
|
|
- getProject()
|
|
|
- getCount()
|
|
|
- getStudentAttendanceError()
|
|
|
- getStudentAttendance()
|
|
|
- getGraduationSource()
|
|
|
- getGraduateCount()
|
|
|
-})
|
|
|
+ //图表自动适应容器尺寸变化
|
|
|
+ onMounted(async () => {
|
|
|
+ getDetail()
|
|
|
+ getWeekend()
|
|
|
+ getProject()
|
|
|
+ getCount()
|
|
|
+ getStudentAttendanceError()
|
|
|
+ getStudentAttendance()
|
|
|
+ getGraduationSource()
|
|
|
+ getGraduateCount()
|
|
|
+ // 别删我,球球了
|
|
|
+ await getUserInfo()
|
|
|
+ if (userInfo.value.userType === '3' || userInfo.value.userType === '5') {
|
|
|
+ await getPopDataFunction();
|
|
|
+ if (isPop.value) {
|
|
|
+ await nextTick();
|
|
|
+ teacherForm();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ nextTick(()=>{
|
|
|
+ if (chartRef.value) {
|
|
|
+ chartInstance.value = echarts.init(chartRef.value);
|
|
|
+ chartInstance.value.setOption(pieOptionsData);
|
|
|
+
|
|
|
+ window.addEventListener('resize', resizeChart);
|
|
|
+ resizeChart();
|
|
|
+ }
|
|
|
+ })
|
|
|
+});
|
|
|
+
|
|
|
+onUnmounted(() => {
|
|
|
+ if (chartInstance.value) {
|
|
|
+ window.removeEventListener('resize', resizeChart);
|
|
|
+ chartInstance.value.dispose();
|
|
|
+ }
|
|
|
+});
|
|
|
|
|
|
const getAllApi = async () => {
|
|
|
await Promise.all([
|