From 0761dbca1d6449a65aa908fa9596c8cf00fc01cc Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期二, 17 三月 2026 11:44:01 +0800
Subject: [PATCH] 印铜报工

---
 src/views/productionManagement/productionProcess/index.vue |  276 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 255 insertions(+), 21 deletions(-)

diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index 7ab8c9a..df847df 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -30,7 +30,9 @@
            class="mb10">
         <el-button type="primary"
                    @click="showNewModal">鏂板宸ュ簭</el-button>
-        <el-button type="info" plain @click="handleImport">瀵煎叆</el-button>
+        <el-button type="info"
+                   plain
+                   @click="handleImport">瀵煎叆</el-button>
         <el-button type="danger"
                    @click="handleDelete"
                    :disabled="selectedRows.length === 0"
@@ -46,6 +48,50 @@
                 @pagination="pagination"
                 :total="page.total"></PIMTable>
     </div>
+
+    <!-- 宸ュ簭鐢熶骇璁板綍鍒楄〃寮规 -->
+    <el-dialog v-model="isShowProcessParamModal"
+               title="鐢熶骇璁板綍"
+               width="800px">
+      <div style="text-align: right"
+           class="mb10">
+        <el-button type="primary"
+                   @click="showSelectProductParamModal">鏂板</el-button>
+        <el-button type="danger"
+                   plain
+                   @click="handleDeleteProcessParam"
+                   :disabled="processParamSelectedRows.length === 0">鎵归噺鍒犻櫎</el-button>
+      </div>
+      <PIMTable rowKey="id"
+                :column="processParamColumns"
+                :tableData="processParamTableData"
+                :page="processParamPage"
+                :isSelection="true"
+                @selection-change="handleProcessParamSelectionChange"
+                @pagination="processParamPagination"
+                :total="processParamPage.total"></PIMTable>
+    </el-dialog>
+
+    <!-- 閫夋嫨鐢熶骇璁板綍寮规 -->
+    <el-dialog v-model="isShowSelectParamModal"
+               title="閫夋嫨鐢熶骇璁板綍"
+               width="800px">
+      <PIMTable rowKey="id"
+                :column="productParamColumns"
+                :tableData="productParamTableData"
+                :page="productParamPage"
+                :isSelection="true"
+                @selection-change="handleProductParamSelectionChange"
+                @pagination="productParamPagination"
+                :total="productParamPage.total"></PIMTable>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary"
+                     @click="handleAddProcessParam">纭畾</el-button>
+          <el-button @click="isShowSelectParamModal = false">鍙栨秷</el-button>
+        </div>
+      </template>
+    </el-dialog>
     <new-process v-if="isShowNewModal"
                  v-model:visible="isShowNewModal"
                  @completed="getList" />
@@ -53,19 +99,17 @@
                   v-model:visible="isShowEditModal"
                   :record="record"
                   @completed="getList" />
-    <ImportDialog
-      ref="importDialogRef"
-      v-model="importDialogVisible"
-      title="瀵煎叆宸ュ簭"
-      :action="importAction"
-      :headers="importHeaders"
-      :auto-upload="false"
-      :on-success="handleImportSuccess"
-      :on-error="handleImportError"
-      @confirm="handleImportConfirm"
-      @download-template="handleDownloadTemplate"
-      @close="handleImportClose"
-    />
+    <ImportDialog ref="importDialogRef"
+                  v-model="importDialogVisible"
+                  title="瀵煎叆宸ュ簭"
+                  :action="importAction"
+                  :headers="importHeaders"
+                  :auto-upload="false"
+                  :on-success="handleImportSuccess"
+                  :on-error="handleImportError"
+                  @confirm="handleImportConfirm"
+                  @download-template="handleDownloadTemplate"
+                  @close="handleImportClose" />
   </div>
 </template>
 
@@ -74,7 +118,18 @@
   import NewProcess from "@/views/productionManagement/productionProcess/New.vue";
   import EditProcess from "@/views/productionManagement/productionProcess/Edit.vue";
   import ImportDialog from "@/components/Dialog/ImportDialog.vue";
-  import { listPage, del, importData, downloadTemplate } from "@/api/productionManagement/productionProcess.js";
+  import {
+    listPage,
+    del,
+    importData,
+    downloadTemplate,
+  } from "@/api/productionManagement/productionProcess.js";
+  import {
+    listPage as listProcessParamPage,
+    del as delProcessParam,
+    addProductProcessParameter,
+  } from "@/api/productionManagement/productProcessParameter.js";
+  import { listPage as listProductParamPage } from "@/api/productionManagement/productionRecords.js";
   import { getToken } from "@/utils/auth";
 
   const data = reactive({
@@ -93,16 +148,26 @@
       label: "宸ュ簭鍚嶇О",
       prop: "name",
     },
-   
     {
       label: "宸ヨ祫瀹氶",
       prop: "salaryQuota",
     },
     {
+      label: "鍚堟牸鐜�",
+      prop: "qualifiedRate",
+    },
+    {
+      label: "鏄惁璐ㄦ",
+      prop: "isQuality",
+      formatData: (params) => {
+        return params ? "鏄�" : "鍚�";
+      },
+    },
+    {
       label: "澶囨敞",
       prop: "remark",
     },
-     {
+    {
       label: "鏇存柊鏃堕棿",
       prop: "updateTime",
     },
@@ -114,6 +179,13 @@
       width: 280,
       operation: [
         {
+          name: "鏌ョ湅",
+          type: "text",
+          clickFun: row => {
+            showProcessParamModal(row);
+          },
+        },
+        {
           name: "缂栬緫",
           type: "text",
           clickFun: row => {
@@ -123,12 +195,59 @@
       ],
     },
   ]);
+  // 宸ュ簭宸茬粦瀹氱殑鐢熶骇璁板綍鍒楄〃鍒楅厤缃�
+  const processParamColumns = ref([
+    { label: "鍙傛暟缂栫爜", prop: "code" },
+    { label: "鍙傛暟椤�", prop: "parameterItem" },
+    {
+      label: "鍙傛暟绫诲瀷",
+      prop: "type",
+      formatData: val => {
+        const dictList = (proxy.useDict && proxy.useDict("parameter_tyep")?.parameter_tyep) || [];
+        const list = dictList.value || dictList;
+        const hit = (list || []).find(d => d.value === val);
+        return hit ? hit.label : val;
+      },
+    },
+    { label: "鍗曚綅", prop: "unit" },
+    { label: "鍙傛暟鏍煎紡", prop: "parameterFormat" },
+    {
+      label: "鏄惁蹇呭~",
+      prop: "isRequired",
+      formatData: v => (v === "1" || v === 1 ? "鏄�" : "鍚�"),
+    },
+  ]);
+  // 鍙�夋嫨鐨勭敓浜ц褰曞垪琛ㄥ垪閰嶇疆
+  const productParamColumns = ref([
+    { label: "鍙傛暟缂栫爜", prop: "code" },
+    { label: "鍙傛暟椤�", prop: "parameterItem" },
+    {
+      label: "鍙傛暟绫诲瀷",
+      prop: "type",
+      formatData: val => {
+        const dictList = (proxy.useDict && proxy.useDict("parameter_tyep")?.parameter_tyep) || [];
+        const list = dictList.value || dictList;
+        const hit = (list || []).find(d => d.value === val);
+        return hit ? hit.label : val;
+      },
+    },
+    { label: "鍗曚綅", prop: "unit" },
+    { label: "鍙傛暟鏍煎紡", prop: "parameterFormat" },
+    {
+      label: "鏄惁蹇呭~",
+      prop: "isRequired",
+      formatData: v => (v === "1" || v === 1 ? "鏄�" : "鍚�"),
+    },
+  ]);
   const tableData = ref([]);
   const selectedRows = ref([]);
   const tableLoading = ref(false);
   const isShowNewModal = ref(false);
   const isShowEditModal = ref(false);
+  const isShowProcessParamModal = ref(false);
+  const isShowSelectParamModal = ref(false);
   const record = ref({});
+  const currentProcess = ref(null);
   const importDialogVisible = ref(false);
   const importDialogRef = ref(null);
   const page = reactive({
@@ -136,10 +255,25 @@
     size: 100,
     total: 0,
   });
+  const processParamPage = reactive({
+    current: 1,
+    size: 100,
+    total: 0,
+  });
+  const productParamPage = reactive({
+    current: 1,
+    size: 100,
+    total: 0,
+  });
+  const processParamTableData = ref([]);
+  const productParamTableData = ref([]);
+  const processParamSelectedRows = ref([]);
+  const productParamSelectedRows = ref([]);
   const { proxy } = getCurrentInstance();
-  
+
   // 瀵煎叆鐩稿叧閰嶇疆
-  const importAction = import.meta.env.VITE_APP_BASE_API + "/productProcess/importData";
+  const importAction =
+    import.meta.env.VITE_APP_BASE_API + "/productProcess/importData";
   const importHeaders = { Authorization: "Bearer " + getToken() };
 
   // 鏌ヨ鍒楄〃
@@ -153,6 +287,16 @@
     page.current = obj.page;
     page.size = obj.limit;
     getList();
+  };
+  const processParamPagination = obj => {
+    processParamPage.current = obj.page;
+    processParamPage.size = obj.limit;
+    getProcessParamList();
+  };
+  const productParamPagination = obj => {
+    productParamPage.current = obj.page;
+    productParamPage.size = obj.limit;
+    getProductParamList();
   };
   const getList = () => {
     tableLoading.value = true;
@@ -175,6 +319,14 @@
     selectedRows.value = selection;
   };
 
+  const handleProcessParamSelectionChange = selection => {
+    processParamSelectedRows.value = selection;
+  };
+
+  const handleProductParamSelectionChange = selection => {
+    productParamSelectedRows.value = selection;
+  };
+
   // 鎵撳紑鏂板寮规
   const showNewModal = () => {
     isShowNewModal.value = true;
@@ -183,6 +335,88 @@
   const showEditModal = row => {
     isShowEditModal.value = true;
     record.value = row;
+  };
+
+  // 鏌ョ湅褰撳墠宸ュ簭鐨勭敓浜ц褰�
+  const showProcessParamModal = row => {
+    currentProcess.value = row;
+    isShowProcessParamModal.value = true;
+    processParamPage.current = 1;
+    getProcessParamList();
+  };
+
+  const getProcessParamList = () => {
+    if (!currentProcess.value) return;
+    const params = {
+      processId: currentProcess.value.id,
+      ...processParamPage,
+    };
+    listProcessParamPage(params).then(res => {
+      processParamTableData.value = res.data.records || [];
+      processParamPage.total = res.data.total || 0;
+    });
+  };
+
+  // 鍒犻櫎褰撳墠宸ュ簭缁戝畾鐨勭敓浜ц褰�
+  const handleDeleteProcessParam = () => {
+    const ids = processParamSelectedRows.value.map(item => item.id);
+    if (!ids.length) {
+      proxy.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑璁板綍");
+      return;
+    }
+    proxy.$modal
+      .confirm("鏄惁纭鍒犻櫎閫変腑鐨勭敓浜ц褰曪紵")
+      .then(() => delProcessParam(ids))
+      .then(() => {
+        proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+        getProcessParamList();
+      })
+      .catch(() => {});
+  };
+
+  // 鎵撳紑閫夋嫨鐢熶骇璁板綍寮规
+  const showSelectProductParamModal = () => {
+    isShowSelectParamModal.value = true;
+    productParamPage.current = 1;
+    getProductParamList();
+  };
+
+  const getProductParamList = () => {
+    const params = {
+      ...productParamPage,
+    };
+    listProductParamPage(params).then(res => {
+      const records = res.data.records || [];
+      // 宸茬粦瀹氬埌褰撳墠宸ュ簭鐨勭敓浜ц褰曪紝涓嶅厑璁稿啀娆¢�夋嫨 -> 鏍规嵁鍙傛暟缂栫爜鎵撲笂 disabled 鏍囪
+      const boundCodeSet = new Set(
+        (processParamTableData.value || [])
+          .map(item => item.code ?? item.parameterCode)
+          .filter(code => !!code)
+      );
+      productParamTableData.value = records.map(item => ({
+        ...item,
+        disabled: item.code ? boundCodeSet.has(item.code) : false,
+      }));
+      productParamPage.total = res.data.total || 0;
+    });
+  };
+
+  // 纭缁欏綋鍓嶅伐搴忔柊澧炵敓浜ц褰�
+  const handleAddProcessParam = () => {
+    if (!currentProcess.value) return;
+    const selectedList = productParamSelectedRows.value || [];
+    if (!selectedList.length) {
+      proxy.$modal.msgWarning("璇烽�夋嫨瑕佺粦瀹氱殑鐢熶骇璁板綍");
+      return;
+    }
+    // processId 鏀惧湪璺緞閲岋紝body 鐩存帴浼犻�変腑鐨勭敓浜ц褰曟暟缁�
+    addProductProcessParameter(currentProcess.value.id, selectedList)
+      .then(() => {
+        proxy.$modal.msgSuccess("鏂板鎴愬姛");
+        isShowSelectParamModal.value = false;
+        getProcessParamList();
+      })
+      .catch(() => {});
   };
 
   // 鍒犻櫎
@@ -235,7 +469,7 @@
   };
 
   // 瀵煎叆鎴愬姛
-  const handleImportSuccess = (response) => {
+  const handleImportSuccess = response => {
     if (response.code === 200) {
       proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
       importDialogVisible.value = false;
@@ -249,7 +483,7 @@
   };
 
   // 瀵煎叆澶辫触
-  const handleImportError = (error) => {
+  const handleImportError = error => {
     proxy.$modal.msgError("瀵煎叆澶辫触锛�" + (error.message || "鏈煡閿欒"));
   };
 

--
Gitblit v1.9.3