From 03790f338ed62174def6b67776280e3dace05b7e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 30 六月 2026 13:37:45 +0800
Subject: [PATCH] 中兴实强 1.智能驾驶舱大屏数据展示修改
---
src/views/reportAnalysis/dataDashboard/components/basic/center-top.vue | 231 +++++++++++++++++++++------------------------------------
1 files changed, 87 insertions(+), 144 deletions(-)
diff --git a/src/views/reportAnalysis/dataDashboard/components/basic/center-top.vue b/src/views/reportAnalysis/dataDashboard/components/basic/center-top.vue
index 2c0ebe5..c27dcb7 100644
--- a/src/views/reportAnalysis/dataDashboard/components/basic/center-top.vue
+++ b/src/views/reportAnalysis/dataDashboard/components/basic/center-top.vue
@@ -7,6 +7,11 @@
<div class="card-content">
<span class="card-label">鍛樺伐鎬绘暟</span>
<span class="card-value">{{ totalStaff }}</span>
+ <div class="card-compare" :class="compareClass(staffYoY)">
+ <span>鍚屾瘮</span>
+ <span class="compare-value">{{ formatPercent(staffYoY) }}</span>
+ <span class="compare-icon">{{ staffYoY >= 0 ? '鈫�' : '鈫�' }}</span>
+ </div>
</div>
</div>
<div class="stat-card">
@@ -14,6 +19,11 @@
<div class="card-content">
<span class="card-label">瀹㈡埛鎬绘暟</span>
<span class="card-value">{{ totalCustomers }}</span>
+ <div class="card-compare" :class="compareClass(customersYoY)">
+ <span>鍚屾瘮</span>
+ <span class="compare-value">{{ formatPercent(customersYoY) }}</span>
+ <span class="compare-icon">{{ customersYoY >= 0 ? '鈫�' : '鈫�' }}</span>
+ </div>
</div>
</div>
<div class="stat-card">
@@ -21,36 +31,11 @@
<div class="card-content">
<span class="card-label">渚涘簲鍟嗘�绘暟</span>
<span class="card-value">{{ totalSuppliers }}</span>
- </div>
- </div>
- </div>
-
- <!-- 璁惧缁熻 -->
- <div class="equipment-stats">
- <div class="equipment-header">
- <img
- src="@/assets/BI/shujutongjiicon@2x.png"
- alt="鍥炬爣"
- class="equipment-icon"
- />
- <span class="equipment-title">璁惧缁熻</span>
- </div>
- <div class="equipment-items">
- <div class="equipment-item">
- <span class="equipment-value">{{ equipmentNum }}</span>
- <span class="equipment-label">璁惧鎬绘暟</span>
- </div>
- <div class="equipment-item">
- <span class="equipment-value">{{ equipmentRepair }}</span>
- <span class="equipment-label">寰呯淮淇澶�</span>
- </div>
- <div class="equipment-item">
- <span class="equipment-value">{{ equipmentMaintain }}</span>
- <span class="equipment-label">寰呬繚鍏昏澶�</span>
- </div>
- <div class="equipment-item">
- <span class="equipment-value">{{ totalMeasuring }}</span>
- <span class="equipment-label">璁¢噺鍣ㄥ叿鎬绘暟</span>
+ <div class="card-compare" :class="compareClass(suppliersYoY)">
+ <span>鍚屾瘮</span>
+ <span class="compare-value">{{ formatPercent(suppliersYoY) }}</span>
+ <span class="compare-icon">{{ suppliersYoY >= 0 ? '鈫�' : '鈫�' }}</span>
+ </div>
</div>
</div>
</div>
@@ -80,7 +65,7 @@
<div class="todo-division">寰呭姙浜嬬敱锛歿{ item.approveReason }}</div>
<div style="display: flex;justify-content: space-between;align-items: center;"
>
- <div class="todo-title">鐢宠绫诲瀷锛歿{ item.approveId }}</div>
+ <div class="todo-title">鐢宠绫诲瀷锛歿{ item.approveTypeName }}</div>
<div class="todo-division">鐢宠閮ㄩ棬锛歿{ item.approveDeptName }}</div>
<div class="todo-time">{{ item.approveTime }}</div>
</div>
@@ -95,68 +80,60 @@
</template>
<script setup>
-import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'
-import { homeTodos } from '@/api/viewIndex.js'
-import { staffOnJobListPage } from '@/api/personnelManagement/employeeRecord.js'
-import { listCustomer } from '@/api/basicData/customerFile.js'
-import { listSupplier } from '@/api/basicData/supplierManageFile.js'
-import { getLedgerPage } from '@/api/equipmentManagement/ledger.js'
-import { getRepairPage } from '@/api/equipmentManagement/repair.js'
-import { getUpkeepPage } from '@/api/equipmentManagement/upkeep.js'
-import { measuringInstrumentListPage } from '@/api/equipmentManagement/measurementEquipment.js'
+import { ref, onMounted, onBeforeUnmount, nextTick, inject, watch } from 'vue'
+import { homeTodos, summaryStatistics } from '@/api/viewIndex.js'
// 缁熻鏁版嵁
const totalStaff = ref(0)
const totalCustomers = ref(0)
const totalSuppliers = ref(0)
-const equipmentNum = ref(0)
-const equipmentRepair = ref(0)
-const equipmentMaintain = ref(0)
-const totalMeasuring = ref(0)
+// 鍚屾瘮
+const staffYoY = ref(0)
+const customersYoY = ref(0)
+const suppliersYoY = ref(0)
// 寰呭姙浜嬮」
const todoList = ref([])
const refTodoList = ref(null)
+const formatPercent = (val) => {
+ const num = Number(val) || 0
+ return `${Math.abs(num).toFixed(2)}%`
+}
+
+const compareClass = (val) => (val >= 0 ? 'compare-up' : 'compare-down')
+
// 鑾峰彇鍛樺伐銆佸鎴枫�佷緵搴斿晢鏁伴噺
const getNum = () => {
- const params = {
- pageNum: -1,
- pageSize: -1,
- }
- staffOnJobListPage({ ...params, staffState: 1 }).then((res) => {
- totalStaff.value = res.data.total
- })
- listCustomer(params).then((res) => {
- totalCustomers.value = res.total
- })
- listSupplier(params).then((res) => {
- totalSuppliers.value = res.data.total
+ summaryStatistics().then((res) => {
+ totalStaff.value = res.data.totalStaff
+ staffYoY.value = res.data.staffGrowthRate
+ totalCustomers.value = res.data.totalCustomer
+ customersYoY.value = res.data.customerGrowthRate
+ totalSuppliers.value = res.data.totalSupplier
+ suppliersYoY.value = res.data.supplierGrowthRate
+ }).catch(err => {
+ console.error('鑾峰彇鍩虹缁熻鏁版嵁澶辫触:', err)
})
}
-// 鑾峰彇璁惧鐩稿叧鏁伴噺
-const getLedgerNum = () => {
- const params = {
- pageNum: -1,
- pageSize: -1,
+const destroyTodoListScroll = () => {
+ const todoListEl = refTodoList.value
+ if (todoListEl) {
+ if (todoListEl._animationFrame) {
+ cancelAnimationFrame(todoListEl._animationFrame)
+ todoListEl._animationFrame = null
+ }
+ if (todoListEl._pauseTimer) {
+ clearInterval(todoListEl._pauseTimer)
+ todoListEl._pauseTimer = null
+ }
}
- getLedgerPage(params).then((res) => {
- equipmentNum.value = res.data.total
- })
- getRepairPage({ ...params, status: 0 }).then((res) => {
- equipmentRepair.value = res.data.total
- })
- getUpkeepPage({ ...params, status: 0 }).then((res) => {
- equipmentMaintain.value = res.data.total
- })
- measuringInstrumentListPage(params).then((res) => {
- totalMeasuring.value = res.data.total
- })
}
// 鍒濆鍖栧緟鍔炰簨椤瑰垪琛ㄦ粴鍔ㄥ姛鑳�
const initTodoListScroll = () => {
+ destroyTodoListScroll()
const todoListEl = refTodoList.value
// 寮哄埗鍚敤婊氬姩锛屼笉妫�鏌ヤ换浣曟潯浠�
if (todoListEl) {
@@ -239,6 +216,7 @@
// 寰呭姙浜嬮」
const todoInfoS = () => {
+ destroyTodoListScroll()
homeTodos().then((res) => {
todoList.value = res.data
// 鍦ㄨ幏鍙栧埌寰呭姙浜嬮」鏁版嵁鍚庯紝鍒濆鍖栨粴鍔ㄥ姛鑳�
@@ -248,25 +226,24 @@
})
}
-onMounted(() => {
+const refreshCenterTopData = () => {
getNum()
- getLedgerNum()
todoInfoS()
+}
+
+const dataDashboardRefreshTick = inject('dataDashboardRefreshTick', null)
+if (dataDashboardRefreshTick) {
+ watch(dataDashboardRefreshTick, () => {
+ refreshCenterTopData()
+ })
+}
+
+onMounted(() => {
+ refreshCenterTopData()
})
onBeforeUnmount(() => {
- // 娓呯悊寰呭姙浜嬮」鍒楄〃鐨勫姩鐢诲拰瀹氭椂鍣�
- const todoListEl = refTodoList.value
- if (todoListEl) {
- if (todoListEl._animationFrame) {
- cancelAnimationFrame(todoListEl._animationFrame)
- todoListEl._animationFrame = null
- }
- if (todoListEl._pauseTimer) {
- clearInterval(todoListEl._pauseTimer)
- todoListEl._pauseTimer = null
- }
- }
+ destroyTodoListScroll()
})
</script>
@@ -314,72 +291,37 @@
color: rgba(208, 231, 255, 0.7);
}
-.equipment-stats {
- border: 1px solid #1a58b0;
- padding: 18px;
- height: 240px;
-}
-
-.equipment-header {
- font-weight: 500;
- font-size: 21px;
+.card-compare {
display: flex;
- border-bottom: 1px solid;
- border-image: linear-gradient(
- 270deg,
- rgba(0, 126, 255, 0) 0%,
- rgba(0, 126, 255, 0.4549) 35%,
- #007eff 78%,
- #007eff 100%
- )
- 1;
- padding-bottom: 2px;
+ align-items: center;
+ gap: 6px;
+ font-size: 15px;
+ color: #d0e7ff;
}
-.equipment-title {
- font-weight: 500;
- font-size: 18px;
- background: linear-gradient(360deg, #056dff 0%, #43e8fc 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
- line-height: 50px;
+.card-compare > span:first-child {
+ font-size: 13px;
+ opacity: 0.8;
}
-.equipment-icon {
- width: 50px;
- height: 50px;
+.compare-value {
+ font-weight: 600;
}
-.equipment-items {
- display: flex;
- justify-content: space-around;
- gap: 30px;
+.compare-icon {
+ font-size: 14px;
+ position: relative;
+ top: -1px; /* 杞诲井涓婄Щ锛岃绠ご涓庢枃瀛楀瀭鐩村眳涓榻� */
}
-.equipment-item {
- text-align: center;
+.compare-up .compare-value,
+.compare-up .compare-icon {
+ color: #00c853;
}
-.equipment-value {
- display: block;
- font-weight: 500;
- font-size: 40px;
- color: #ffffff;
- width: 120px;
- height: 110px;
- line-height: 110px;
- background-image: url('@/assets/BI/shujutongji@2x.png');
- background-size: 100% 100%;
- background-position: center;
- background-repeat: no-repeat;
- margin-bottom: 8px;
-}
-
-.equipment-label {
- font-weight: 500;
- font-size: 16px;
- color: #fffffe;
+.compare-down .compare-value,
+.compare-down .compare-icon {
+ color: #ff5252;
}
.event-info {
@@ -388,7 +330,8 @@
background-position: center;
background-repeat: no-repeat;
padding: 20px;
- height: 186px;
+ padding-top: 10px;
+ height: 426px;
}
.event-header {
@@ -412,7 +355,7 @@
list-style: none;
padding: 0;
margin: 0;
- height: 120px; /* 鎸夌敤鎴疯姹傝皟鏁撮珮搴� */
+ height: 360px; /* 鎸夌敤鎴疯姹傝皟鏁撮珮搴� */
overflow: hidden;
font-size: 15px;
}
--
Gitblit v1.9.3