| | |
| | | </section> |
| | | <section class="section-card flex-fill-card"> |
| | | <div class="section-title-row"> |
| | | <div class="section-title">今年销售金额分析</div> |
| | | <el-radio-group v-model="pendingFilter" |
| | | size="small"> |
| | | <el-radio-button label="mine">板材</el-radio-button> |
| | | <el-radio-button label="high">砌块</el-radio-button> |
| | | <div class="section-title">区域销售金额分析</div> |
| | | <el-radio-group v-model="chartProductType2" |
| | | size="small" |
| | | @change="fetchSalesAmountChartData"> |
| | | <el-radio-button label="板材">板材</el-radio-button> |
| | | <el-radio-button label="砌块">砌块</el-radio-button> |
| | | </el-radio-group> |
| | | </div> |
| | | <Echarts :chartStyle="chartStyle" |
| | | :grid="grid" |
| | | :tooltip="barTooltip" |
| | | :xAxis="salesAmountXAxis" |
| | | :yAxis="salesAmountYAxis" |
| | | :series="salesAmountSeries" |
| | | style="height: 300px" /> |
| | | </section> |
| | | </div> |
| | | <div class="right-col"> |
| | |
| | | </section> --> |
| | | <section class="section-card mini-table-wrap" |
| | | v-if="isSectionVisible('planTable')"> |
| | | <div class="section-title">生产计划执行明细</div> |
| | | <div class="section-title">最近报工</div> |
| | | <el-table :data="planTable" |
| | | size="small" |
| | | stripe> |
| | | <el-table-column prop="planNo" |
| | | label="计划单号" |
| | | label="班次" |
| | | min-width="150" /> |
| | | <el-table-column prop="product" |
| | | label="产品" |
| | | label="创建人" |
| | | min-width="120" /> |
| | | <el-table-column prop="product" |
| | | label="报工时间" |
| | | min-width="120" /> |
| | | <el-table-column prop="qty" |
| | | label="计划量" |
| | | label="产品" |
| | | min-width="90" /> |
| | | <el-table-column prop="issued" |
| | | label="已下发" |
| | | label="生产数量" |
| | | min-width="90" /> |
| | | <el-table-column prop="status" |
| | | label="状态" |
| | | min-width="100" /> |
| | | <el-table-column label="操作" |
| | | min-width="120"> |
| | | <template #default="{ row }"> |
| | | <el-button link |
| | | type="primary" |
| | | @click="goTo(routePathMap.plan)">查看</el-button> |
| | | <el-button v-if="row.status !== '已完成'" |
| | | link |
| | | type="success" |
| | | @click="goTo(routePathMap.dispatch)"> |
| | | 下发 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="issued" |
| | | label="合格数量" |
| | | min-width="90" /> |
| | | </el-table> |
| | | </section> |
| | | </div> |
| | |
| | | nonComplianceWarning, |
| | | } from "@/api/viewIndex.js"; |
| | | import { energyConsumptionDetailStatistics } from "@/api/energyManagement/energyType"; |
| | | import { getSalesAmountAnalysis } from "@/api/reportAnalysis/salesStatistics"; |
| | | |
| | | const router = useRouter(); |
| | | const userStore = useUserStore(); |
| | |
| | | itemStyle: { color: "#67C23A" }, |
| | | }, |
| | | ]); |
| | | |
| | | // 销售金额图表 |
| | | const chartProductType2 = ref("砌块"); |
| | | const salesAmountChartData = ref({ |
| | | dates: [], |
| | | customerTrends: [], |
| | | }); |
| | | |
| | | const salesAmountXAxis = reactive({ |
| | | type: "value", |
| | | axisLabel: { |
| | | interval: "auto", |
| | | formatter: value => { |
| | | // 格式化金额,显示为更易读的形式 |
| | | if (value >= 10000) { |
| | | return (value / 10000).toFixed(0) + "万"; |
| | | } |
| | | return value; |
| | | }, |
| | | }, |
| | | axisTick: { |
| | | interval: "auto", |
| | | }, |
| | | }); |
| | | |
| | | const salesAmountYAxis = reactive({ |
| | | type: "category", |
| | | data: [], |
| | | axisLabel: { |
| | | rotate: 0, |
| | | }, |
| | | }); |
| | | |
| | | const salesAmountSeries = reactive([]); |
| | | |
| | | // 获取销售金额分析图表数据 |
| | | const fetchSalesAmountChartData = async () => { |
| | | try { |
| | | const response = await getSalesAmountAnalysis({ |
| | | type: chartProductType2.value, |
| | | days: "年", // 默认年 |
| | | }); |
| | | if (response?.data) { |
| | | salesAmountChartData.value = response.data; |
| | | updateSalesAmountChart(); |
| | | } |
| | | } catch (error) { |
| | | console.error("获取销售金额分析图表数据失败:", error); |
| | | // 使用模拟数据 |
| | | salesAmountChartData.value = { |
| | | dates: [ |
| | | "2026-01-01", |
| | | "2025-01-01", |
| | | "2024-01-01", |
| | | "2023-01-01", |
| | | "2022-01-01", |
| | | ], |
| | | customerTrends: [ |
| | | { 内蒙古: 100, 银川: 200, 自提: 300, 其他: 150, 全部: 750 }, |
| | | { 内蒙古: 80, 银川: 180, 自提: 280, 其他: 130, 全部: 670 }, |
| | | { 内蒙古: 90, 银川: 190, 自提: 290, 其他: 140, 全部: 710 }, |
| | | { 内蒙古: 70, 银川: 170, 自提: 270, 其他: 120, 全部: 630 }, |
| | | { 内蒙古: 110, 银川: 210, 自提: 310, 其他: 160, 全部: 790 }, |
| | | ], |
| | | }; |
| | | updateSalesAmountChart(); |
| | | } |
| | | }; |
| | | |
| | | // 更新销售金额图表 |
| | | const updateSalesAmountChart = () => { |
| | | const { customerTrends = [] } = salesAmountChartData.value; |
| | | |
| | | // 计算每个销售区域的总销售额(过滤掉"全部") |
| | | const areaTotalMap = new Map(); |
| | | customerTrends.forEach(item => { |
| | | Object.keys(item).forEach(key => { |
| | | // 过滤掉"全部"销售区域 |
| | | if (key !== "全部") { |
| | | const value = item[key] || 0; |
| | | if (areaTotalMap.has(key)) { |
| | | areaTotalMap.set(key, areaTotalMap.get(key) + value); |
| | | } else { |
| | | areaTotalMap.set(key, value); |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 转换为数组 |
| | | const salesAreas = Array.from(areaTotalMap.keys()); |
| | | |
| | | const colors = [ |
| | | "#00A4ED", |
| | | "#34D8F7", |
| | | "#4A8BFF", |
| | | "#8A6BFF", |
| | | "#C8C447", |
| | | "#FF6B6B", |
| | | ]; |
| | | |
| | | // 更新Y轴数据(现在是销售区域) |
| | | salesAmountYAxis.data = salesAreas; |
| | | |
| | | // 更新系列数据(每个销售区域的总销售额) |
| | | salesAmountSeries.splice(0, salesAmountSeries.length); |
| | | salesAmountSeries.push({ |
| | | name: "销售金额", |
| | | data: salesAreas.map(area => areaTotalMap.get(area)), |
| | | type: "bar", |
| | | itemStyle: { color: "#00A4ED" }, |
| | | }); |
| | | }; |
| | | |
| | | // 模拟能耗数据 |
| | | const energyData = reactive({ |
| | |
| | | // loadCostComposition(); |
| | | // loadWarningCenter(); |
| | | updateEnergyTypeChart(); |
| | | fetchSalesAmountChartData(); |
| | | lastUpdatedAt.value = new Date().toLocaleString(); |
| | | }; |
| | | |