From c1b5f6edeacfa0326931d06de6773b936dbabe27 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期二, 26 八月 2025 15:18:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_JLMY' into dev_JLMY

---
 src/views/production/productionReporting/index.vue |  277 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 277 insertions(+), 0 deletions(-)

diff --git a/src/views/production/productionReporting/index.vue b/src/views/production/productionReporting/index.vue
new file mode 100644
index 0000000..7a1d60e
--- /dev/null
+++ b/src/views/production/productionReporting/index.vue
@@ -0,0 +1,277 @@
+<template>
+  <div class="app-container">
+    <!-- 鎼滅储琛ㄥ崟 -->
+    <el-form :inline="true" :model="queryParams" class="search-form">
+      <el-form-item label="鎼滅储">
+        <el-input
+            v-model="queryParams.searchAll"
+            placeholder="璇疯緭鍏ュ叧閿瘝"
+            clearable
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="handleSearch">鏌ヨ</el-button>
+        <el-button @click="handleReset">閲嶇疆</el-button>
+      </el-form-item>
+    </el-form>
+
+    <!-- 涓昏鍐呭鍖哄煙 -->
+    <el-card>
+      <!-- 鎿嶄綔鎸夐挳 -->
+      <div class="toolbar">
+        <el-button
+            type="danger"
+            :icon="Delete"
+            :disabled="!selectedRows.length"
+            @click="() => deleteSelected(delProductionScheduling)"
+        >
+          鍒犻櫎
+        </el-button>
+      </div>
+      <!-- 鏁版嵁琛ㄦ牸 -->
+      <ETable
+          :showOverflowTooltip="false"
+          :loading="loading"
+          :table-data="tableData"
+          :columns="columns"
+          :current-page="queryParams.current"
+          :page-size="queryParams.size"
+          @selection-change="handleSelectionChange"
+          @edit="(row) => openDialog('work', row)"
+          :show-selection="true"
+          :border="true"
+          :operations="['work']"
+          :operationsWidth="200"
+          :show-overflow-tooltip="false"
+          style="width: 100%; height: calc(100vh - 26em)"
+      >
+        <template #coalId="{ row }">
+          <div class="coal-tags">
+            <template v-if="row.coalId">
+              <el-tag
+                  v-for="coal in parseCoalArray(row.coalId)"
+                  :key="coal"
+                  size="small"
+                  type="primary"
+                  class="coal-tag"
+              >
+                {{ getDisplayCoalName(coal) }}
+              </el-tag>
+            </template>
+            <span v-else class="no-data">--</span>
+          </div>
+        </template>
+      </ETable>
+      <!-- 鍒嗛〉缁勪欢 -->
+      <Pagination
+          :layout="'total, prev, pager, next, jumper'"
+          :total="total"
+          v-model:page="queryParams.current"
+          :limit="queryParams.size"
+          @pagination="handlePageChange"
+      />
+    </el-card>
+
+    <!-- 鐢熶骇瀵硅瘽妗� -->
+    <!-- handleProductionAndProcessing -->
+    <ProductionDialog
+        v-model:visible="dialogVisible"
+        ref="dialogRef"
+        :type="dialogType"
+        @update:productionAndProcessing="handleProductionAndProcessing"
+        @success="handleDialogSuccess"
+    />
+  </div>
+</template>
+
+<script setup>
+import { onMounted, ref } from "vue";
+import { ElMessage } from "element-plus";
+import { Plus, Delete } from "@element-plus/icons-vue";
+import ProductionDialog from "./components/ProductionDialog.vue";
+import ETable from "@/components/Table/ETable.vue";
+import Pagination from "@/components/Pagination/index.vue";
+import { listPage,delProductionScheduling } from "@/api/productionScheduling";
+import { parseCoalArray } from "@/utils/production";
+import { useTableData } from "./components/useTableData.js";
+import { useDialog } from "./components/useDialog.js";
+import { useCoalData } from "./components/useCoalData.js";
+import { getCoalInfoList } from "@/api/production";
+
+// 鐓ょ淇℃伅鍒楄〃
+const coalInfoList = ref([]);
+
+// 琛ㄦ牸鍒楅厤缃�
+const columns = [
+  { prop: "coalId", label: "鐓ょ", minWidth: 150, slot: true },
+  {
+    prop: "type",
+    label: "鐓ゆ枡绫诲瀷",
+    minWidth: 150,
+    formatter: (row) => {
+      const statusMap = {
+        1: '鎴愬搧',
+        2: '鍘熸枡'
+      };
+      return statusMap[row.type] || '鏈煡绫诲瀷';
+    }
+  },
+  {
+    prop: "status",
+    label: "鐘舵��",
+    minWidth: 150,
+    formatter: (row) => {
+      const statusMap = {
+        1: '寰呯敓浜�',
+        2: '鐢熶骇涓�',
+        3: '宸插叆搴�'
+      };
+      return statusMap[row.status] || '鏈煡鐘舵��';
+    }
+  },
+  { prop: "schedulingUserName", label: "鐢熶骇浜�", minWidth: 150 },
+  { prop: "schedulingNum", label: "鐢熶骇鏁伴噺", minWidth: 120 },
+  { prop: "successNum", label: "鍏ュ簱鏁伴噺", minWidth: 120,
+    formatter: (row) => {
+      return row.successNum || '0';
+    } },
+  { prop: "workHours", label: "宸ユ椂瀹氶", minWidth: 150 },
+  { prop: "unit", label: "鍗曚綅", minWidth: 120 },
+  { prop: "process", label: "宸ュ簭", minWidth: 143 },
+  { prop: "schedulingDate", label: "鎺掍骇鏃ユ湡", minWidth: 150 },
+];
+
+// 浣跨敤琛ㄦ牸鏁版嵁缁勫悎寮忓嚱鏁�
+const {
+  tableData,
+  loading,
+  total,
+  selectedRows,
+  queryParams,
+  getList,
+  handleSearch,
+  handleReset,
+  handlePageChange,
+  handleSelectionChange,
+  deleteSelected,
+} = useTableData(listPage, { pageSize: 10 });
+
+// 浣跨敤瀵硅瘽妗嗙粍鍚堝紡鍑芥暟
+const {
+  dialogVisible,
+  dialogType,
+  dialogRef,
+  openDialog,
+  handleDialogSuccess: onDialogSuccess,
+} = useDialog();
+
+// 浣跨敤鐓ょ鏁版嵁缁勫悎寮忓嚱鏁�
+const { getCoalNameById, getCoalData } = useCoalData();
+
+// 鑾峰彇鐓ょ鏄剧ず鍚嶇О锛堝甫澶囩敤閫昏緫锛�
+const getDisplayCoalName = (coalId) => {
+  // 浼樺厛浣跨敤 useCoalData 鐨勬柟娉�
+  let name = getCoalNameById(coalId);
+
+  // 濡傛灉娌℃湁鎵惧埌锛屽皾璇曚粠 coalInfoList 涓煡鎵�
+  if (name === coalId && coalInfoList.value.length > 0) {
+    const found = coalInfoList.value.find((item) => item.id == coalId);
+    name = found ? found.coal : coalId;
+  }
+
+  return name || coalId;
+};
+
+// 澶勭悊鐢熶骇鏁版嵁鏇存柊
+const handleProductionAndProcessing = (row, rows) => {
+  const index = tableData.value.findIndex((item) => item.id === rows.id);
+  if (index !== -1) {
+    tableData.value[index] = { ...tableData.value[index], ...row };
+  }
+};
+
+// 瀵硅瘽妗嗘垚鍔熷洖璋�
+const handleDialogSuccess = () => {
+  onDialogSuccess(() => {
+    getList();
+    ElMessage.success("鎿嶄綔鎴愬姛");
+  });
+};
+
+// 缁勪欢鎸傝浇鏃跺姞杞芥暟鎹�
+onMounted(async () => {
+  try {
+    // 骞惰鍔犺浇鐓ょ鏁版嵁鍜岃〃鏍兼暟鎹�
+    await Promise.all([
+      getCoalData(), // 棰勫姞杞界叅绉嶆暟鎹�
+      (async () => {
+        const res = await getCoalInfoList();
+        if (res.code === 200) {
+          coalInfoList.value = res.data;
+        }
+      })(),
+    ]);
+
+    // 鍔犺浇琛ㄦ牸鏁版嵁
+    getList();
+  } catch (error) {
+    ElMessage.error("鏁版嵁鍔犺浇澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯");
+  }
+});
+</script>
+
+<style scoped lang="scss">
+.production-container {
+  padding: 20px;
+
+  .el-card:nth-child(1) {
+    margin-bottom: 20px;
+  }
+}
+
+.search-bar {
+  margin-bottom: 20px;
+  display: flex;
+  gap: 10px;
+
+  .el-input {
+    width: 20%;
+  }
+}
+
+.search-form {
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+  margin-bottom: 20px;
+
+  .el-form-item {
+    margin-right: 10px;
+  }
+
+  .el-button {
+    margin-left: 10px;
+  }
+}
+
+.coal-tags {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 4px;
+  align-items: center;
+
+  .coal-tag {
+    margin-right: 4px;
+    margin-bottom: 4px;
+
+    &:last-child {
+      margin-right: 0;
+    }
+  }
+
+  .no-data {
+    color: #999;
+    font-style: italic;
+  }
+}
+</style>

--
Gitblit v1.9.3