From 076bb96b437258f0e8cdbe184040e1e302b60d4b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 22 十二月 2025 14:10:12 +0800
Subject: [PATCH] 1.军泰伟业代码初始化

---
 src/views/index.vue |  104 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 94 insertions(+), 10 deletions(-)

diff --git a/src/views/index.vue b/src/views/index.vue
index 2888b16..e6b22c5 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -13,9 +13,13 @@
 							<div class="company-meta">{{userStore.roleName}}</div>
 						</div>
 						<div style="display: flex;align-items: center;gap: 8px">
-							<el-icon color="#5053B5" size="22"><Clock /></el-icon>
-							<span>鐧婚檰鏃ユ湡锛歿{userStore.currentLoginTime}}</span>
-						</div>
+						<el-icon color="#5053B5" size="22"><Clock /></el-icon>
+						<span>鐧婚檰鏃ユ湡锛歿{userStore.currentLoginTime}}</span>
+					</div>
+					<div style="display: flex;align-items: center;gap: 8px">
+						<el-icon color="#5053B5" size="22"><Calendar /></el-icon>
+						<span>鎺掔彮鏃堕棿锛歿{scheduleTime}}</span>
+					</div>
 					</div>
 				</div>
 				<div class="data-cards">
@@ -118,11 +122,11 @@
 			<div class="main-panel">
 				<div style="display: flex;justify-content: space-between;">
 					<div class="section-title">搴旀敹搴斾粯缁熻</div>
-					<el-radio-group v-model="radio1" size="large" @change="statisticsReceivable">
-						<el-radio-button label="鎸夊懆" :value="1" />
-						<el-radio-button label="鎸夋湀" :value="2" />
-						<el-radio-button label="鎸夊搴�" :value="3" />
-					</el-radio-group>
+<!--					<el-radio-group v-model="radio1" size="large" @change="statisticsReceivable">-->
+<!--						<el-radio-button label="鎸夊懆" :value="1" />-->
+<!--						<el-radio-button label="鎸夋湀" :value="2" />-->
+<!--						<el-radio-button label="鎸夊搴�" :value="3" />-->
+<!--					</el-radio-group>-->
 				</div>
 				<Echarts ref="chart"
 								 :color="barColors2"
@@ -165,17 +169,23 @@
 </template>
 
 <script setup>
-import { ref, onMounted } from 'vue'
+import { ref, reactive, onMounted } from 'vue'
+import { ElNotification } from 'element-plus'
 import Echarts from "@/components/Echarts/echarts.vue";
 import * as echarts from 'echarts';
 import useUserStore from "@/store/modules/user.js";
+import { Clock, Calendar } from '@element-plus/icons-vue'
 import {
 	analysisCustomerContractAmounts, getAmountHalfYear,
 	getBusiness,
 	homeTodos,
 	qualityStatistics,
-	statisticsReceivablePayable
+	statisticsReceivablePayable,
+	approveAndDeviceTodos,
+	noticesCount
 } from "@/api/viewIndex.js";
+import { getCurrentUserLatestScheduling } from "@/api/personnelManagement/scheduling.js";
+import dayjs from "dayjs";
 
 const userStore = useUserStore()
 
@@ -341,6 +351,10 @@
 const todoList = ref([])
 const radio1 = ref(1)
 
+// 鎺掔彮鏃堕棿
+const scheduleTime = ref('')
+const scheduleInfo = ref({})
+
 // 鍥捐〃寮曠敤
 const barChart = ref(null)
 const lineChart = ref(null)
@@ -358,6 +372,9 @@
 	statisticsReceivable()
 	qualityStatisticsInfo()
 	getAmountHalfYearNum()
+	getCurrentUserSchedule()
+	getApproveAndDeviceTodos()
+	getOngoingAnnouncementNoticeNumber()
 })
 // 鏁版嵁缁熻
 const getBusinessData = () => {
@@ -409,6 +426,35 @@
 		qualityStatisticsObject.value.factoryNum = res.data.factoryNum
 	})
 }
+// 鑾峰彇褰撳墠鐢ㄦ埛鎺掔彮淇℃伅
+const getCurrentUserSchedule = async () => {
+  try {
+    const res = await getCurrentUserLatestScheduling()
+    
+    if (res.data) {
+      const currentSchedule = res.data
+      scheduleInfo.value = currentSchedule
+      
+      // 鏍煎紡鍖栨帓鐝椂闂存樉绀�
+      if (currentSchedule.startTime && currentSchedule.endTime) {
+        scheduleTime.value = `${currentSchedule.startTime} - ${currentSchedule.endTime}`
+      } else if (currentSchedule.workStartTime && currentSchedule.workEndTime) {
+        const startTime = dayjs(currentSchedule.workStartTime).format('HH:mm')
+        const endTime = dayjs(currentSchedule.workEndTime).format('HH:mm')
+        scheduleTime.value = `${startTime} - ${endTime}`
+      } else {
+        scheduleTime.value = '浠婃棩鏃犳帓鐝�'
+      }
+    } else {
+      scheduleTime.value = '浠婃棩鏃犳帓鐝�'
+      scheduleInfo.value = {}
+    }
+  } catch (error) {
+    console.error('鑾峰彇鎺掔彮淇℃伅澶辫触:', error)
+    scheduleTime.value = '鑾峰彇鎺掔彮淇℃伅澶辫触'
+  }
+}
+
 const getAmountHalfYearNum = async () => {
 	const res = await getAmountHalfYear()
 	console.log(res)
@@ -484,6 +530,44 @@
 		}
 	]
 }
+
+// 鍗忓悓寰呭鎵瑰拰鎶ヤ慨寰呭姙浜嬮」
+const getApproveAndDeviceTodos = async () => {
+	try {
+		const res = await approveAndDeviceTodos()
+		const { approveTodo, deviceRepairTodo } = res.data
+		
+		// 鏄剧ず閫氱煡
+		ElNotification({
+				title: '寰呭姙浜嬮」鎻愰啋',
+				message: `褰撳墠鏈�${approveTodo}鏉″緟瀹℃壒浜嬮」锛�${deviceRepairTodo}鏉″緟缁翠慨浜嬮」`,
+				type: 'warning',
+				duration: 5000
+			})
+	} catch (error) {
+		console.error('鑾峰彇鍗忓悓寰呭姙浜嬮」澶辫触:', error)
+	}
+}
+// 杩涜涓叕鍛婇�氱煡
+const getOngoingAnnouncementNoticeNumber = async () => {
+	try {
+		const res = await noticesCount()
+		// const { approveTodo, deviceRepairTodo } = res.data
+		const _noticesCount = res.data
+		if(!_noticesCount){
+			return
+		}
+		// 鏄剧ず閫氱煡
+		ElNotification({
+				title: '閫氱煡鍏憡閫氱煡',
+				message: `褰撳墠鏈�${_noticesCount}鏉″叕鍛婇�氱煡锛屾敞鎰忔煡鐪媊,
+				type: 'warning',
+				duration: 5000
+			})
+	} catch (error) {
+		console.error('鑾峰彇鍗忓悓寰呭姙浜嬮」澶辫触:', error)
+	}
+}
 </script>
 
 <style scoped>

--
Gitblit v1.9.3