ProcurementReportView.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <div class="app-page">
  3. <section class="glass-card page-hero">
  4. <div class="page-hero__meta">
  5. <span class="page-hero__eyebrow">Procurement Analytics</span>
  6. <h1>采购报表</h1>
  7. <p>追踪采购额、到货及时率、质量合格率和供应商排名,优化采购策略。</p>
  8. </div>
  9. </section>
  10. <section class="glass-card section-card" style="padding:20px">
  11. <div style="display:flex;gap:16px;flex-wrap:wrap">
  12. <div class="procure-card">
  13. <div class="procure-card__icon" style="background:linear-gradient(135deg,#409EFF,#67C23A)">
  14. <el-icon><ShoppingCart /></el-icon>
  15. </div>
  16. <div class="procure-card__info">
  17. <div class="procure-card__value">¥1,258,600</div>
  18. <div class="procure-card__label">本月采购额</div>
  19. <div class="procure-card__trend trend-up">+15.2% ↑</div>
  20. </div>
  21. </div>
  22. <div class="procure-card">
  23. <div class="procure-card__icon" style="background:linear-gradient(135deg,#67C23A,#E6A23C)">
  24. <el-icon><Timer /></el-icon>
  25. </div>
  26. <div class="procure-card__info">
  27. <div class="procure-card__value">94.2%</div>
  28. <div class="procure-card__label">到货及时率</div>
  29. <div class="procure-card__trend trend-up">+2.1% ↑</div>
  30. </div>
  31. </div>
  32. <div class="procure-card">
  33. <div class="procure-card__icon" style="background:linear-gradient(135deg,#E6A23C,#F56C6C)">
  34. <el-icon><CircleCheck /></el-icon>
  35. </div>
  36. <div class="procure-card__info">
  37. <div class="procure-card__value">97.8%</div>
  38. <div class="procure-card__label">质量合格率</div>
  39. <div class="procure-card__trend trend-up">+0.8% ↑</div>
  40. </div>
  41. </div>
  42. <div class="procure-card">
  43. <div class="procure-card__icon" style="background:linear-gradient(135deg,#F56C6C,#909399)">
  44. <el-icon><Clock /></el-icon>
  45. </div>
  46. <div class="procure-card__info">
  47. <div class="procure-card__value">12.5天</div>
  48. <div class="procure-card__label">平均交期</div>
  49. <div class="procure-card__trend trend-down">-1.2天 ↓</div>
  50. </div>
  51. </div>
  52. </div>
  53. </section>
  54. <section class="page-grid" style="grid-template-columns: 1fr 1fr;">
  55. <article class="glass-card section-card">
  56. <h3 style="margin:0 0 16px">采购额趋势</h3>
  57. <v-chart :option="purchaseTrendOption" autoresize style="height:280px" />
  58. </article>
  59. <article class="glass-card section-card">
  60. <h3 style="margin:0 0 16px">供应商采购分布</h3>
  61. <v-chart :option="supplierDistOption" autoresize style="height:280px" />
  62. </article>
  63. </section>
  64. <section class="glass-card section-card">
  65. <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:16px">
  66. <h3 style="margin:0">供应商排名</h3>
  67. <el-radio-group v-model="rankingType" size="small">
  68. <el-radio-button label="amount">采购额</el-radio-button>
  69. <el-radio-button label="quality">质量</el-radio-button>
  70. <el-radio-button label="delivery">交期</el-radio-button>
  71. </el-radio-group>
  72. </div>
  73. <div class="supplier-ranking">
  74. <div v-for="(s, idx) in supplierRanking" :key="idx" class="supplier-item">
  75. <div class="supplier-item__rank" :class="{ 'supplier-item__rank--top': idx < 3 }">
  76. {{ idx + 1 }}
  77. </div>
  78. <div class="supplier-item__info">
  79. <div class="supplier-item__name">{{ s.name }}</div>
  80. <el-progress :percentage="s.score" :stroke-width="6" :show-text="false" :color="idx < 3 ? '#409EFF' : '#909399'" />
  81. </div>
  82. <div class="supplier-item__meta">
  83. <div class="supplier-item__value">¥{{ s.amount.toLocaleString() }}</div>
  84. <div class="supplier-item__rate">{{ s.rate }}%</div>
  85. </div>
  86. <el-tag :type="getSupplierLevel(s.level).type" size="small">
  87. {{ getSupplierLevel(s.level).label }}
  88. </el-tag>
  89. </div>
  90. </div>
  91. </section>
  92. <section class="glass-card section-card">
  93. <h3 style="margin:0 0 16px">采购明细</h3>
  94. <el-table :data="purchaseDetail">
  95. <el-table-column prop="poNo" label="采购单号" width="150" />
  96. <el-table-column prop="supplier" label="供应商" width="130" />
  97. <el-table-column prop="sku" label="SKU" width="110" />
  98. <el-table-column label="数量/单价" width="120">
  99. <template #default="{ row }">
  100. <span>{{ row.qty }} / ¥{{ row.price }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column prop="amount" label="金额" width="120">
  104. <template #default="{ row }">
  105. <span style="font-weight:600;color:var(--cb-primary)">¥{{ row.amount.toLocaleString() }}</span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="交期" width="140">
  109. <template #default="{ row }">
  110. <span :class="row.onTime ? 'trend-up' : 'trend-down'">
  111. {{ row.onTime ? '✓ 准时' : '✗ 延迟' }}
  112. </span>
  113. {{ row.expectedDate }}
  114. </template>
  115. </el-table-column>
  116. <el-table-column prop="qualityStatus" label="质检" width="90">
  117. <template #default="{ row }">
  118. <el-tag :type="getQualityStatus(row.qualityStatus).type" size="small">
  119. {{ getQualityStatus(row.qualityStatus).label }}
  120. </el-tag>
  121. </template>
  122. </el-table-column>
  123. </el-table>
  124. </section>
  125. </div>
  126. </template>
  127. <script setup lang="ts">
  128. import { ref, computed, onMounted } from 'vue';
  129. import { ShoppingCart, Timer, CircleCheck, Clock } from '@element-plus/icons-vue';
  130. import VChart from 'vue-echarts';
  131. import { use } from 'echarts/core';
  132. import { CanvasRenderer } from 'echarts/renderers';
  133. import { LineChart, BarChart, PieChart } from 'echarts/charts';
  134. import { GridComponent, TooltipComponent, LegendComponent } from 'echarts/components';
  135. import { getQualityStatus, getSupplierLevel } from '@/utils/enumMappings';
  136. use([CanvasRenderer, LineChart, BarChart, PieChart, GridComponent, TooltipComponent, LegendComponent]);
  137. const loading = ref(false);
  138. const rankingType = ref('amount');
  139. const supplierRanking = ref([
  140. { name: '深圳华通供应链有限公司', amount: 428600, score: 100, rate: 98.5, level: 'A' },
  141. { name: '广州鼎盛纺织制衣厂', amount: 325800, score: 76, rate: 95.0, level: 'A' },
  142. { name: '东莞鑫达皮革制品厂', amount: 258200, score: 60, rate: 88.0, level: 'B' },
  143. { name: '宁波海天塑业有限公司', amount: 185600, score: 43, rate: 92.0, level: 'B' },
  144. { name: '苏州金诚纺织集团', amount: 125400, score: 29, rate: 82.0, level: 'C' }
  145. ]);
  146. const purchaseDetail = ref([
  147. { poNo: 'PO-20260420-001', supplier: '深圳华通', sku: 'SKU-NM-BK-M', qty: 500, price: 85, amount: 42500, expectedDate: '2026-04-25', onTime: true, qualityStatus: '合格' },
  148. { poNo: 'PO-20260419-002', supplier: '广州鼎盛', sku: 'SKU-AE-GR-L', qty: 800, price: 42, amount: 33600, expectedDate: '2026-04-28', onTime: false, qualityStatus: '待检' },
  149. { poNo: 'PO-20260418-003', supplier: '东莞鑫达', sku: 'SKU-UT-WH-XL', qty: 200, price: 156, amount: 31200, expectedDate: '2026-04-22', onTime: false, qualityStatus: '合格' },
  150. { poNo: 'PO-20260417-004', supplier: '宁波海天', sku: 'SKU-UT-BK-42', qty: 150, price: 185, amount: 27750, expectedDate: '2026-04-30', onTime: true, qualityStatus: '待检' }
  151. ]);
  152. const days = ['4/14', '4/15', '4/16', '4/17', '4/18', '4/19', '4/20'];
  153. const purchaseTrendOption = computed(() => ({
  154. tooltip: { trigger: 'axis' },
  155. grid: { left: 60, right: 20, top: 20, bottom: 30 },
  156. xAxis: { type: 'category', data: days, boundaryGap: false },
  157. yAxis: { type: 'value', axisLabel: { formatter: '¥{value}' } },
  158. series: [{
  159. type: 'line',
  160. smooth: true,
  161. data: [168000, 185000, 172000, 198000, 182000, 215000, 186000],
  162. areaStyle: { opacity: 0.3, color: { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: 'rgba(64,158,255,0.5)' }, { offset: 1, color: 'rgba(64,158,255,0.05)' }] } },
  163. lineStyle: { width: 3, color: '#409EFF' },
  164. itemStyle: { color: '#409EFF' },
  165. symbol: 'circle',
  166. symbolSize: 6
  167. }]
  168. }));
  169. const supplierDistOption = computed(() => ({
  170. tooltip: { trigger: 'item', formatter: '{b}: ¥{c} ({d}%)' },
  171. series: [{
  172. type: 'pie',
  173. radius: ['45%', '75%'],
  174. center: ['50%', '50%'],
  175. roseType: 'area',
  176. itemStyle: { borderRadius: 8 },
  177. data: [
  178. { value: 428600, name: '深圳华通', itemStyle: { color: '#409EFF' } },
  179. { value: 325800, name: '广州鼎盛', itemStyle: { color: '#67C23A' } },
  180. { value: 258200, name: '东莞鑫达', itemStyle: { color: '#E6A23C' } },
  181. { value: 185600, name: '宁波海天', itemStyle: { color: '#F56C6C' } },
  182. { value: 125400, name: '苏州金诚', itemStyle: { color: '#909399' } }
  183. ],
  184. label: { color: '#666' }
  185. }]
  186. }));
  187. const loadData = () => { loading.value = true; setTimeout(() => { loading.value = false; }, 300); };
  188. onMounted(loadData);
  189. </script>
  190. <style scoped>
  191. .procure-card { display: flex; align-items: center; gap: 16px; padding: 20px 24px; background: linear-gradient(135deg, rgba(255,255,255,1), rgba(248,249,250,1)); border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); min-width: 200px; }
  192. .procure-card__icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: white; font-size: 20px; }
  193. .procure-card__value { font-size: 22px; font-weight: 700; color: var(--cb-text-primary); }
  194. .procure-card__label { font-size: 13px; color: var(--cb-text-soft); margin: 2px 0; }
  195. .procure-card__trend { font-size: 12px; }
  196. .supplier-ranking { display: flex; flex-direction: column; gap: 12px; }
  197. .supplier-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(248,249,250,1); border-radius: 8px; }
  198. .supplier-item__rank { width: 28px; height: 28px; border-radius: 50%; background: #f0f0f0; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
  199. .supplier-item__rank--top { background: linear-gradient(135deg, #409EFF, #67C23A); color: white; }
  200. .supplier-item__info { flex: 1; min-width: 0; }
  201. .supplier-item__name { font-weight: 500; margin-bottom: 6px; font-size: 14px; }
  202. .supplier-item__value { font-weight: 600; color: var(--cb-primary); font-size: 14px; }
  203. .supplier-item__rate { font-size: 12px; color: var(--cb-text-soft); }
  204. .supplier-item__meta { text-align: right; margin-right: 12px; }
  205. .trend-up { color: var(--el-color-success); }
  206. .trend-down { color: var(--el-color-danger); }
  207. </style>