From 0ce559e6195a189ccc777b0fa439906bffb12b55 Mon Sep 17 00:00:00 2001
From: zhang_12370 <z2864490065@outlook.com>
Date: 星期三, 25 六月 2025 17:58:31 +0800
Subject: [PATCH] 多页面添加查看功能

---
 src/views/production/components/ProductionDialog.vue |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/views/production/components/ProductionDialog.vue b/src/views/production/components/ProductionDialog.vue
index 8c16696..955a1aa 100644
--- a/src/views/production/components/ProductionDialog.vue
+++ b/src/views/production/components/ProductionDialog.vue
@@ -1,12 +1,12 @@
 <template>
   <el-dialog
       v-model="dialogVisible"
-      :title="dialogType === 'add' ? '鏂板鐢熶骇鍔犲伐' : '缂栬緫鐢熶骇鍔犲伐'"
+      :title="dialogType === 'add' ? '鏂板鐢熶骇鍔犲伐' : dialogType === 'viewRow' ? '鏌ョ湅鐢熶骇鍔犲伐' : '缂栬緫鐢熶骇鍔犲伐'"
       width="1200px"
       :close-on-click-modal="false"
       @close="handleClose"
   >
-    <el-row :gutter="10" style="margin-bottom: 10px">
+    <el-row :gutter="10" style="margin-bottom: 10px" v-if="dialogType !== 'viewRow'">
       <el-col :span="3">
         <el-button type="primary" @click="handlData"
         >
@@ -40,20 +40,21 @@
     </el-row>
     <ETableModify
         :columns="columns"
-        :showOperations="false"
+        :showOperations="dialogType !== 'viewRow'"
         height="200"
         @cell-edit="handleCellEdit"
         :tableData="tableData"
         :showOverflowTooltip="false"
         @row-click="handleRowClick"
-        :editableColumns="['usedQuantity']"
+        :editableColumns="dialogType === 'viewRow' ? [] : ['usedQuantity']"
+        :editableCells="dialogType !== 'viewRow'"
         @delete="handleRemoveItem"
     />
     <div class="empty-table">
       <h1>鐢熶骇鏄庣粏</h1>
       <el-row :gutter="10">
         <el-col :span="2">
-          <el-button type="primary" @click="addNewRow">
+          <el-button type="primary" @click="addNewRow" v-if="dialogType !== 'viewRow'">
             <el-icon>
               <Plus/>
             </el-icon>
@@ -72,10 +73,11 @@
       <ProductionDetailsTable
           v-model="detailsTableData"
           :border="false"
-          :show-operations="true"
+          :show-operations="dialogType !== 'viewRow'"
           :auto-calculate="true"
           @input-change="handleDetailsChange"
           @delete-row="handleDeleteRow"
+          :dialogType="dialogType"
       />
     </div>
 
@@ -83,14 +85,17 @@
       <div class="dialog-footer">
         <el-button
             @click="handleClose"
-            v-if="dialogType === 'add' || dialogType === 'edit'"
-        >鍙� 娑�
+        >{{ dialogType === 'viewRow' ? '鍏� 闂�' : '鍙� 娑�' }}
         </el-button
         >
         <!-- <el-button @click="handleReset" v-if="dialogType === 'edit'"
           >閲� 缃�</el-button
         > -->
-        <el-button type="primary" :loading="loading" @click="handleSubmit"
+        <el-button 
+            v-if="dialogType !== 'viewRow'"
+            type="primary" 
+            :loading="loading" 
+            @click="handleSubmit"
         >纭� 瀹�
         </el-button
         >
@@ -298,11 +303,11 @@
   dialogType.value = "add";
 };
 
-const editInitialization = (data) => {
+const editInitialization = (type,data) => {
   copyForm.value = deepClone(data);
   tableData.value = data.productionInventoryList || [];
   detailsTableData.value = data.productionList || [];
-  dialogType.value = "edit";
+  dialogType.value = type;
   const existingOfficialIds = tableData.value
       .map((item) => item.officialId)
       .filter((id) => id);

--
Gitblit v1.9.3