gongchunyi
3 天以前 01b5728bb6842fbed09426cbf5e70e0e17def518
Merge branch 'dev_银川_中盛建材' of http://114.132.189.42:9002/r/product-inventory-management into dev_银川_中盛建材
已修改2个文件
116 ■■■■ 文件已修改
src/api/viewIndex.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/index.vue 109 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/viewIndex.js
@@ -326,3 +326,10 @@
    method: "get",
  });
};
// 管理统计
export const getManageStatistics = () => {
  return request({
    url: "/home/manage",
    method: "get",
  });
};
src/views/index.vue
@@ -75,7 +75,7 @@
                   :xAxis="salesAmountXAxis"
                   :yAxis="salesAmountYAxis"
                   :series="salesAmountSeries"
                   style="height: 300px" />
                   style="height: 90%" />
        </section>
      </div>
      <div class="right-col">
@@ -169,27 +169,51 @@
        <section class="section-card mini-table-wrap"
                 v-if="isSectionVisible('planTable')">
          <div class="section-title">最近报工</div>
          <el-table :data="planTable"
          <el-table :data="reportingTable"
                    size="small"
                    stripe>
            <el-table-column prop="planNo"
                             label="班次"
                    stripe
                    :loading="reportingTableLoading">
            <el-table-column prop="productNo"
                             label="报工编号"
                             min-width="150" />
            <el-table-column prop="product"
            <el-table-column prop="schedule"
                             label="班组"
                             min-width="80">
              <template #default="{ row }">
                <el-tag :type="row.schedule === '白班' ? 'primary' : 'warning'">{{ row.schedule || '-' }}</el-tag>
              </template>
            </el-table-column>
            <el-table-column prop="postName"
                             label="创建人"
                             min-width="120" />
            <el-table-column prop="product"
                             min-width="100" />
            <el-table-column prop="createTime"
                             label="报工时间"
                             min-width="120" />
            <el-table-column prop="qty"
                             min-width="150">
              <template #default="{ row }">
                {{ row.createTime ? dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') : '' }}
              </template>
            </el-table-column>
            <el-table-column prop="productName"
                             label="产品"
                             min-width="90" />
            <el-table-column prop="issued"
                             min-width="120">
              <template #default="{ row }">
                <el-tag :type="row.productName === '砌块' ? 'primary' : 'warning'">{{ row.productName || '-' }}</el-tag>
              </template>
            </el-table-column>
            <el-table-column prop="totalQuantity"
                             label="生产数量"
                             min-width="90" />
            <el-table-column prop="issued"
                             min-width="100">
              <template #default="{ row }">
                <span style="color:rgba(18, 148, 212, 0.8);">{{ row.totalQuantity || '-' }}</span> 方
              </template>
            </el-table-column>
            <el-table-column prop="quantity"
                             label="合格数量"
                             min-width="90" />
                             min-width="100">
              <template #default="{ row }">
                <span style="color:rgba(0, 228, 99, 0.8);">{{ row.quantity || '-' }}</span> 方
              </template>
            </el-table-column>
          </el-table>
        </section>
      </div>
@@ -269,9 +293,12 @@
    processDataProductionStatistics,
    qualityInspectionStatistics,
    nonComplianceWarning,
    getManageStatistics,
  } from "@/api/viewIndex.js";
  import { energyConsumptionDetailStatistics } from "@/api/energyManagement/energyType";
  import { getSalesAmountAnalysis } from "@/api/reportAnalysis/salesStatistics";
  import { productionReportListPage } from "@/api/productionManagement/productionReporting.js";
  import dayjs from "dayjs";
  const router = useRouter();
  const userStore = useUserStore();
@@ -454,8 +481,8 @@
    { name: "已完成订单数", value: "-" },
    { name: "未完成订单数", value: "-" },
    { name: "部分完成订单数", value: "-" },
    { name: "质检总数", value: "-" },
    { name: "过程检总数", value: "-" },
    { name: "来料检总数", value: "-" },
    // { name: "过程检总数", value: "-" },
  ]);
  const pendingTasks = reactive([]);
@@ -773,7 +800,33 @@
      });
  };
  const planTable = reactive([]);
  // 报工表格数据
  const reportingTable = ref([]);
  const reportingTableLoading = ref(false);
  // 获取最近报工数据
  const fetchReportingData = () => {
    reportingTableLoading.value = true;
    productionReportListPage({
      current: 1,
      size: 5, // 只显示最近5条
    })
      .then(res => {
        if (res.code === 200) {
          console.log(res.data.records || []);
          reportingTable.value = res.data.records || [];
        } else {
          reportingTable.value = [];
        }
      })
      .catch(error => {
        console.error("获取报工数据失败:", error);
        reportingTable.value = [];
      })
      .finally(() => {
        reportingTableLoading.value = false;
      });
  };
  const recentTrendCards = reactive([
    {
      key: "planIssued",
@@ -1204,6 +1257,24 @@
    //   console.error("expenseCompositionAnalysis接口获取失败:", error);
    // }
  };
  const loadManageStatistics = async () => {
    try {
      const res = await getManageStatistics();
      const data = res?.data || {};
      businessFocus[0].value = `${pickFirstNumber(data, ["total"])} 条`;
      businessFocus[1].value = `${pickFirstNumber(data, ["completed"])} 条`;
      businessFocus[2].value = `${pickFirstNumber(data, ["uncompleted"])} 条`;
      businessFocus[3].value = `${pickFirstNumber(data, [
        "partialCompleted",
      ])} 条`;
      businessFocus[4].value = `${pickFirstNumber(data, [
        "materialInspection",
      ])} 条`;
      // businessFocus[5].value = `${pickFirstNumber(data, [""])} 条`;
    } catch (error) {
      console.error("manageStatistics接口获取失败:", error);
    }
  };
  const refreshDashboardData = () => {
    // loadHomeTodos();
@@ -1212,8 +1283,10 @@
    // loadQualityData();
    // loadCostComposition();
    // loadWarningCenter();
    loadManageStatistics();
    updateEnergyTypeChart();
    fetchSalesAmountChartData();
    fetchReportingData();
    lastUpdatedAt.value = new Date().toLocaleString();
  };