From 4179d065f06c6969d913c29b363b95efe8fbc813 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 27 三月 2026 13:46:49 +0800
Subject: [PATCH] 过程检验增加查询条件,增加详情功能

---
 src/views/qualityManagement/processInspection/components/detailDialog.vue |  281 ++++++++++++++++++++++++++++++++++++++++
 src/api/qualityManagement/rawMaterialInspection.js                        |    8 +
 src/views/qualityManagement/processInspection/index.vue                   |  131 ++++++++----------
 3 files changed, 349 insertions(+), 71 deletions(-)

diff --git a/src/api/qualityManagement/rawMaterialInspection.js b/src/api/qualityManagement/rawMaterialInspection.js
index 3b76a8f..550b60d 100644
--- a/src/api/qualityManagement/rawMaterialInspection.js
+++ b/src/api/qualityManagement/rawMaterialInspection.js
@@ -63,3 +63,11 @@
         params: query,
     })
 }
+// 鏌ヨ杩囩▼妫�璇︽儏
+export function qualityInspectProcessDetails(query) {
+    return request({
+        url: '/quality/qualityInspect/processDetails',
+        method: 'get',
+        params: query,
+    })
+}
diff --git a/src/views/qualityManagement/processInspection/components/detailDialog.vue b/src/views/qualityManagement/processInspection/components/detailDialog.vue
new file mode 100644
index 0000000..b987127
--- /dev/null
+++ b/src/views/qualityManagement/processInspection/components/detailDialog.vue
@@ -0,0 +1,281 @@
+<template>
+  <div>
+    <el-dialog v-model="dialogVisible"
+               title="妫�楠岃鎯�"
+               width="1000px"
+               @close="closeDialog">
+      <el-card class="detail-card">
+        <template #header>
+          <div class="card-header">
+            <span>鍩烘湰淇℃伅</span>
+          </div>
+        </template>
+        <div class="detail-info">
+          <div class="info-row">
+            <div class="info-item">
+              <span class="info-label">鏃ユ湡锛�</span>
+              <span class="info-value">{{ dayjs(detailData.createTime) .format('YYYY-MM-DD') }}</span>
+            </div>
+            <div class="info-item">
+              <span class="info-label">鐢熶骇璁㈠崟鍙凤細</span>
+              <span class="info-value">{{ detailData.npsNo }}</span>
+            </div>
+            <div class="info-item">
+              <span class="info-label">宸ュ簭锛�</span>
+              <!-- <span class="info-value">{{ detailData.process }}</span> -->
+              <el-tag type="primary">{{ detailData.process }}</el-tag>
+            </div>
+          </div>
+          <div class="info-row">
+            <div class="info-item">
+              <span class="info-label">浜у搧缂栫爜锛�</span>
+              <span class="info-value">{{ detailData.materialCode }}</span>
+            </div>
+            <div class="info-item">
+              <span class="info-label">浜у搧绫诲瀷锛�</span>
+              <!-- <span class="info-value">{{ detailData.strength }}</span> -->
+              <el-tag type="info">{{ detailData.strength }}</el-tag>
+            </div>
+            <div class="info-item">
+              <span class="info-label">浜у搧鍚嶇О锛�</span>
+              <span class="info-value">{{ detailData.productName }}</span>
+            </div>
+          </div>
+          <div class="info-row">
+            <div class="info-item">
+              <span class="info-label">瑙勬牸锛�</span>
+              <span class="info-value">{{ detailData.model }}</span>
+            </div>
+            <div class="info-item">
+              <span class="info-label">鐝锛�</span>
+              <el-tag :type="detailData.schedule === '鐧界彮' ? 'primary' : 'warning'">{{ detailData.schedule }}</el-tag>
+            </div>
+            <div class="info-item">
+              <span class="info-label">宀椾綅浜哄憳锛�</span>
+              <span class="info-value">{{ detailData.postName }}</span>
+            </div>
+          </div>
+          <div class="info-row">
+            <!-- <div class="info-item">
+              <span class="info-label">鎶ュ伐鍗曞彿锛�</span>
+              <span class="info-value">{{ detailData.productionProductRouteItemId }}</span>
+            </div> -->
+            <div class="info-item">
+              <span class="info-label">浜у嚭鏁伴噺锛�</span>
+              <span class="info-value"><span style="font-weight: bold;color: #409eff;">{{ detailData.quantity }}</span> 鏂�</span>
+            </div>
+            <div class="info-item">
+              <span class="info-label">鍚堟牸鏁伴噺锛�</span>
+              <span class="info-value"><span style="font-weight: bold;color: #28e431;">{{ detailData.qualifiedQuantity }}</span> 鏂�</span>
+            </div>
+            <div class="info-item">
+              <span class="info-label">涓嶅悎鏍兼暟閲忥細</span>
+              <span class="info-value"><span style="font-weight: bold;color: #b43434;">{{ detailData.unqualifiedQuantity }}</span> 鏂�</span>
+            </div>
+          </div>
+        </div>
+      </el-card>
+      <el-card v-for="group in groupedInspectionData"
+               :key="group.sourceSort"
+               class="detail-card"
+               style="margin-top: 20px;">
+        <template #header>
+          <div class="card-header">
+            <span v-if="groupedInspectionData.length > 1">妫�楠屾寚鏍囩粍 - {{ group.sourceSort }}</span>
+            <span v-else>妫�楠屾寚鏍�</span>
+          </div>
+        </template>
+        <el-table :data="group.items"
+                  style="width: 100%"
+                  :row-class-name="rowClassName">
+          <el-table-column prop="paramName"
+                           label="鎸囨爣" />
+          <el-table-column prop="unit"
+                           label="鍗曚綅"
+                           width="100">
+            <template #default="scope">
+              {{ scope.row.unit || "/" }}
+            </template>
+          </el-table-column>
+          <el-table-column prop="standardText"
+                           label="鏍囧噯鍊�" />
+          <el-table-column prop="paramValue"
+                           label="瀹為檯鍊�" />
+          <el-table-column prop="result"
+                           label="缁撴灉"
+                           width="100">
+            <template #default="scope">
+              <el-tag :type="scope.row.result === '鍚堟牸' ? 'success' : 'danger'">
+                {{ scope.row.result }}
+              </el-tag>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-card>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button @click="closeDialog">鍏抽棴</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+  import { ref, onMounted } from "vue";
+  import { qualityInspectProcessDetails } from "@/api/qualityManagement/rawMaterialInspection.js";
+  import dayjs from "dayjs";
+
+  const emit = defineEmits(["close"]);
+  const dialogVisible = ref(false);
+  const detailData = ref({});
+  const inspectionData = ref([]);
+  const groupedInspectionData = ref([]);
+  const loading = ref(false);
+
+  const openDialog = row => {
+    dialogVisible.value = true;
+    detailData.value = {
+      ...row,
+      createTime: row.createTime
+        ? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
+        : "",
+    };
+    getInspectionDetails(row.productionProductRouteItemId);
+  };
+
+  const getInspectionDetails = id => {
+    loading.value = true;
+    qualityInspectProcessDetails({ productionProductRouteItemId: id })
+      .then(res => {
+        const data = res.data || [];
+        // 璁$畻缁撴灉
+        const processedData = data.map(item => {
+          let result = "鍚堟牸";
+          let standardText = "";
+          if (item.valueMode === 1) {
+            // 鍗曞�兼瘮杈�
+            if (item.standardValue !== null) {
+              standardText = item.standardValue;
+              if (item.paramValue !== item.standardValue) {
+                result = "涓嶅悎鏍�";
+              }
+            } else {
+              standardText = "-";
+              result = "鍚堟牸";
+            }
+          } else if (item.valueMode === 2) {
+            // 鍖洪棿姣旇緝
+            if (item.minValue !== null || item.maxValue !== null) {
+              standardText =
+                (item.minValue ? item.minValue : "-鈭�") +
+                "~" +
+                (item.maxValue ? item.maxValue : "+鈭�");
+              if (
+                item.paramValue < item.minValue ||
+                item.paramValue > item.maxValue
+              ) {
+                result = "涓嶅悎鏍�";
+              }
+            } else {
+              standardText = "-";
+              result = "鍚堟牸";
+            }
+          }
+          return {
+            ...item,
+            standardText,
+            result,
+          };
+        });
+
+        // 鎸塻ourceSort鍒嗙粍
+        const grouped = {};
+        processedData.forEach(item => {
+          const key = item.sourceSort || "榛樿";
+          if (!grouped[key]) {
+            grouped[key] = [];
+          }
+          grouped[key].push(item);
+        });
+
+        // 杞崲涓烘暟缁勬牸寮�
+        groupedInspectionData.value = Object.entries(grouped).map(
+          ([key, items]) => ({
+            sourceSort: key,
+            items,
+          })
+        );
+
+        loading.value = false;
+      })
+      .catch(err => {
+        loading.value = false;
+        console.error("鑾峰彇妫�楠岃鎯呭け璐�:", err);
+      });
+  };
+
+  const closeDialog = () => {
+    dialogVisible.value = false;
+    emit("close");
+  };
+
+  // 涓轰笉鍚堟牸鐨勮娣诲姞鏍峰紡
+  const rowClassName = ({ row }) => {
+    return row.result == "涓嶅悎鏍�" ? "unqualified-row" : "";
+  };
+
+  defineExpose({
+    openDialog,
+  });
+</script>
+
+<style scoped>
+  .detail-card {
+    margin-bottom: 20px;
+  }
+
+  .card-header {
+    font-size: 16px;
+    font-weight: bold;
+    color: #333;
+  }
+
+  .detail-info {
+    padding: 10px 0;
+  }
+
+  .info-row {
+    display: flex;
+    flex-wrap: wrap;
+    margin-bottom: 10px;
+  }
+
+  .info-item {
+    width: 33%;
+    margin-bottom: 10px;
+  }
+
+  .info-label {
+    display: inline-block;
+    width: 100px;
+    font-weight: bold;
+    color: #666;
+  }
+
+  .info-value {
+    color: #333;
+  }
+
+  .dialog-footer {
+    text-align: center;
+  }
+
+  :deep(.unqualified-row) {
+    background-color: rgba(245, 108, 108, 0.05) !important;
+  }
+
+  :deep(.unqualified-row .cell) {
+    color: #f56c6c !important;
+  }
+</style>
\ No newline at end of file
diff --git a/src/views/qualityManagement/processInspection/index.vue b/src/views/qualityManagement/processInspection/index.vue
index 96b90ad..6414dcd 100644
--- a/src/views/qualityManagement/processInspection/index.vue
+++ b/src/views/qualityManagement/processInspection/index.vue
@@ -4,8 +4,32 @@
       <div>
         <span class="search_title">宸ュ簭锛�</span>
         <el-input v-model="searchForm.process"
-                  style="width: 240px"
+                  style="width: 200px"
                   placeholder="璇疯緭鍏ュ伐搴忔悳绱�"
+                  @change="handleQuery"
+                  clearable
+                  :prefix-icon="Search" />
+        <span style="margin-left: 10px"
+              class="search_title">鐢熶骇璁㈠崟鍙凤細</span>
+        <el-input v-model="searchForm.npsNo"
+                  style="width: 200px"
+                  placeholder="璇疯緭鍏ョ敓浜ц鍗曞彿鎼滅储"
+                  @change="handleQuery"
+                  clearable
+                  :prefix-icon="Search" />
+        <span style="margin-left: 10px"
+              class="search_title">浜у搧缂栫爜锛�</span>
+        <el-input v-model="searchForm.materialCode"
+                  style="width: 200px"
+                  placeholder="璇疯緭鍏ヤ骇鍝佺紪鐮佹悳绱�"
+                  @change="handleQuery"
+                  clearable
+                  :prefix-icon="Search" />
+        <span style="margin-left: 10px"
+              class="search_title">浜у搧鍚嶇О锛�</span>
+        <el-input v-model="searchForm.productName"
+                  style="width: 200px"
+                  placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�"
                   @change="handleQuery"
                   clearable
                   :prefix-icon="Search" />
@@ -15,6 +39,7 @@
                         value-format="YYYY-MM-DD"
                         format="YYYY-MM-DD"
                         type="daterange"
+                        style="width: 240px"
                         placeholder="璇烽�夋嫨"
                         clearable
                         @change="changeDaterange" />
@@ -60,6 +85,8 @@
              @close="handleQuery"></FormDia>
     <files-dia ref="filesDia"
                @close="handleQuery"></files-dia>
+    <DetailDialog ref="detailDialog"
+                  @close="handleQuery"></DetailDialog>
     <el-dialog v-model="dialogFormVisible"
                title="缂栬緫妫�楠屽憳"
                width="30%"
@@ -104,6 +131,7 @@
   } from "vue";
   import InspectionFormDia from "@/views/qualityManagement/processInspection/components/inspectionFormDia.vue";
   import FormDia from "@/views/qualityManagement/processInspection/components/formDia.vue";
+  import DetailDialog from "@/views/qualityManagement/processInspection/components/detailDialog.vue";
   import { ElMessageBox } from "element-plus";
   import {
     downloadQualityInspect,
@@ -112,6 +140,7 @@
     qualityInspectUpdate,
     submitQualityInspect,
     qualityInspectProcessPage,
+    qualityInspectProcessDetails,
   } from "@/api/qualityManagement/rawMaterialInspection.js";
   import FilesDia from "@/views/qualityManagement/processInspection/components/filesDia.vue";
   import dayjs from "dayjs";
@@ -124,6 +153,9 @@
       entryDate: undefined, // 褰曞叆鏃ユ湡
       startTime: undefined,
       endTime: undefined,
+      materialCode: "",
+      productName: "",
+      npsNo: "",
     },
     rules: {
       checkName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -218,75 +250,21 @@
       slot: "unqualifiedQuantity",
     },
 
-    // {
-    //   dataType: "action",
-    //   label: "鎿嶄綔",
-    //   align: "center",
-    //   fixed: "right",
-    //   width: 280,
-    //   operation: [
-    //     {
-    //       name: "缂栬緫",
-    //       type: "text",
-    //       clickFun: row => {
-    //         openForm("edit", row);
-    //       },
-    //       disabled: row => {
-    //         // 宸叉彁浜ゅ垯绂佺敤
-    //         if (row.inspectState == 1) return true;
-    //         // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
-    //         if (row.checkName) {
-    //           return row.checkName !== userStore.nickName;
-    //         }
-    //         return false;
-    //       },
-    //     },
-    //     {
-    //       name: "闄勪欢",
-    //       type: "text",
-    //       clickFun: row => {
-    //         openFilesFormDia(row);
-    //       },
-    //     },
-    //     {
-    //       name: "鎻愪氦",
-    //       type: "text",
-    //       clickFun: row => {
-    //         submit(row.id);
-    //       },
-    //       disabled: row => {
-    //         // 宸叉彁浜ゅ垯绂佺敤
-    //         if (row.inspectState == 1) return true;
-    //         // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
-    //         if (row.checkName) {
-    //           return row.checkName !== userStore.nickName;
-    //         }
-    //         return false;
-    //       },
-    //     },
-    //     {
-    //       name: "鍒嗛厤妫�楠屽憳",
-    //       type: "text",
-    //       clickFun: row => {
-    //         if (!row.checkName) {
-    //           open(row);
-    //         } else {
-    //           proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
-    //         }
-    //       },
-    //       disabled: row => {
-    //         return row.inspectState == 1 || row.checkName;
-    //       },
-    //     },
-    //     {
-    //       name: "涓嬭浇",
-    //       type: "text",
-    //       clickFun: row => {
-    //         downLoadFile(row);
-    //       },
-    //     },
-    //   ],
-    // },
+    {
+      dataType: "action",
+      label: "鎿嶄綔",
+      align: "center",
+      fixed: "right",
+      width: 100,
+      operation: [
+        {
+          name: "璇︽儏",
+          clickFun: row => {
+            openInspectionFormDia(row);
+          },
+        },
+      ],
+    },
   ]);
   const userList = ref([]);
   const currentRow = ref(null);
@@ -305,6 +283,7 @@
   const formDia = ref();
   const filesDia = ref();
   const inspectionFormDia = ref();
+  const detailDialog = ref();
   const { proxy } = getCurrentInstance();
   const userStore = useUserStore();
   const changeDaterange = value => {
@@ -325,10 +304,13 @@
   /** 閲嶇疆鎸夐挳鎿嶄綔 */
   const resetForm = () => {
     searchForm.value = {
-      checkName: "",
+      process: "",
       entryDate: undefined,
       startTime: undefined,
       endTime: undefined,
+      materialCode: "",
+      productName: "",
+      npsNo: "",
     };
     getList();
   };
@@ -368,6 +350,13 @@
       inspectionFormDia.value?.openDialog(type, row);
     });
   };
+
+  // 鎵撳紑璇︽儏寮规
+  const openInspectionFormDia = row => {
+    nextTick(() => {
+      detailDialog.value?.openDialog(row);
+    });
+  };
   // 鎵撳紑闄勪欢寮规
   const openFilesFormDia = (type, row) => {
     nextTick(() => {

--
Gitblit v1.9.3