From 78f67775cd8d880dacd5e8d5be6e17cc9fcbf77c Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 26 五月 2026 14:53:07 +0800
Subject: [PATCH] feat(forms): 统一表单创建时间和编号生成逻辑

---
 src/views/safeProduction/safetyTrainingAssessment/index.vue |   67 ++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/src/views/safeProduction/safetyTrainingAssessment/index.vue b/src/views/safeProduction/safetyTrainingAssessment/index.vue
index b595bf6..ff09589 100644
--- a/src/views/safeProduction/safetyTrainingAssessment/index.vue
+++ b/src/views/safeProduction/safetyTrainingAssessment/index.vue
@@ -76,7 +76,21 @@
                           prop="courseCode">
               <el-input v-model="form.courseCode"
                         disabled
-                        placeholder="鑷姩鐢熸垚" />
+                        placeholder="淇濆瓨鍚庤嚜鍔ㄧ敓鎴�" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鍒涘缓鏃堕棿"
+                          prop="createTime">
+              <el-date-picker style="width: 100%"
+                              v-model="form.createTime"
+                              value-format="YYYY-MM-DD"
+                              format="YYYY-MM-DD"
+                              type="date"
+                              placeholder="璇烽�夋嫨"
+                              clearable />
             </el-form-item>
           </el-col>
         </el-row>
@@ -239,7 +253,7 @@
           <el-descriptions-item label="闄勪欢鍒楄〃:">
             <el-button type="primary"
                        size="small"
-                       @click="downLoadFile(endform)">闄勪欢鍒楄〃</el-button>
+                       @click="openFileDialog(endform)">闄勪欢鍒楄〃</el-button>
           </el-descriptions-item>
         </el-descriptions>
         <!-- <el-divider style="margin: 20px 0;" /> -->
@@ -359,22 +373,12 @@
       </template>
     </el-dialog>
     <!--  todo 闄勪欢棰勮鐩稿叧 -->
-    <FileListDialog ref="fileListRef"
-                    v-model="fileListDialogVisible"
-                    :show-upload-button="true"
-                    :show-delete-button="true"
-                    :is-show-pagination="true"
-                    :page="filePagination"
-                    :upload-method="handleUpload"
-                    :delete-method="handleFileDelete"
-                    @pagination="paginationSearch"
-                    title="闄勪欢鍒楄〃" />
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="safe_training" :record-id="recordId"  />
   </div>
 </template>
 
 <script setup>
   import { Search } from "@element-plus/icons-vue";
-  import FileListDialog from "@/components/Dialog/FileListDialog.vue";
   import {
     onMounted,
     ref,
@@ -403,6 +407,7 @@
   import useUserStore from "@/store/modules/user";
   import dayjs from "dayjs";
   const userStore = useUserStore();
+  const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
 
   // 琛ㄥ崟楠岃瘉瑙勫垯
   const rules = {
@@ -454,6 +459,7 @@
       trainingMode: "", // 鍩硅鏂瑰紡
       placeTraining: "", // 鍩硅鍦扮偣
       classHour: "", // 璇炬椂
+      createTime: "", // 鍒涘缓鏃堕棿
     },
     dialogVisible: false,
     dialogTitle: "",
@@ -621,7 +627,7 @@
           name: "闄勪欢",
           type: "text",
           clickFun: row => {
-            downLoadFile(row);
+            openFileDialog(row);
           },
           color: "#007AFF",
         },
@@ -783,27 +789,17 @@
       form.value.principalMobile = selectedUser.phonenumber;
     }
   };
-  /**
-   * 涓嬭浇鏂囦欢
-   *
-   * @param row 涓嬭浇鏂囦欢鐨勭浉鍏充俊鎭璞�
-   */
-  const fileListRef = ref(null);
-  const fileListDialogVisible = ref(false);
-  const currentFileRow = ref(null);
-  const downLoadFile = row => {
-    currentFileRow.value = row;
-    safeTrainingFileListPage({
-      safeTrainingId: row.id,
-      current: filePagination.value.current,
-      size: filePagination.value.size,
-    }).then(res => {
-      if (fileListRef.value) {
-        fileListRef.value.open(res.data.records);
-        filePagination.value.total = res.data?.total || 0;
-      }
-    });
-  };
+
+  // 鎵撳紑闄勪欢寮圭獥
+  const recordId =ref(0)
+  const fileDialogVisible = ref(false)
+
+  // 鎵撳紑闄勪欢寮规
+  const openFileDialog = async (row) => {
+    recordId.value = row.id
+    fileDialogVisible.value = true
+  }
+  
   // 涓婁紶闄勪欢
   const handleUpload = async () => {
     if (!currentFileRow.value) {
@@ -1044,6 +1040,7 @@
         trainingMode: "", // 鍩硅鏂瑰紡
         placeTraining: "", // 鍩硅鍦扮偣
         classHour: "", // 璇炬椂
+        createTime: new Date().toISOString().split("T")[0], // 鍒涘缓鏃堕棿
       });
     } else if (type === "edit" && row) {
       dialogTitle.value = "缂栬緫鍩硅";

--
Gitblit v1.9.3