From ebe3507d1382bb124c1fb895a5e27f7063fdffdc Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 13 一月 2026 16:19:14 +0800
Subject: [PATCH] fix: 规章制度加一个附件功能

---
 src/views/collaborativeApproval/rulesRegulationsManagement/index.vue |  337 +++++++++----------------------------
 src/api/collaborativeApproval/rulesRegulationsManagementFile.js      |   28 +++
 src/components/Dialog/FileListDialog.vue                             |  152 ++++++++++++++++
 3 files changed, 261 insertions(+), 256 deletions(-)

diff --git a/src/api/collaborativeApproval/rulesRegulationsManagementFile.js b/src/api/collaborativeApproval/rulesRegulationsManagementFile.js
new file mode 100644
index 0000000..791b6a7
--- /dev/null
+++ b/src/api/collaborativeApproval/rulesRegulationsManagementFile.js
@@ -0,0 +1,28 @@
+import request from "@/utils/request";
+
+// 闄勪欢鍒楄〃
+export function listRuleFiles(query) {
+  return request({
+    url: "/rulesRegulationsManagementFile/listPage",
+    method: "get",
+    params: query,
+  });
+}
+
+// 鏂板闄勪欢
+export function addRuleFile(data) {
+  return request({
+    url: "/rulesRegulationsManagementFile/add",
+    method: "post",
+    data,
+  });
+}
+
+// 鍒犻櫎闄勪欢锛堟敮鎸佷紶閫� id 鏁扮粍锛�
+export function delRuleFile(ids) {
+  return request({
+    url: "/rulesRegulationsManagementFile/del",
+    method: "delete",
+    data: ids,
+  });
+}
diff --git a/src/components/Dialog/FileListDialog.vue b/src/components/Dialog/FileListDialog.vue
index ea269d7..ebe81dd 100644
--- a/src/components/Dialog/FileListDialog.vue
+++ b/src/components/Dialog/FileListDialog.vue
@@ -5,6 +5,37 @@
     :width="width" 
     :before-close="handleClose"
   >
+    <div class="file-list-toolbar" v-if="showToolbar">
+      <template v-if="useBuiltInUpload">
+        <el-upload
+          v-model:file-list="uploadFileList"
+          class="upload-demo"
+          :action="uploadAction"
+          :headers="uploadHeaders"
+          :show-file-list="false"
+          :on-success="handleDefaultUploadSuccess"
+          :on-error="handleDefaultUploadError"
+        >
+          <el-button 
+            v-if="showUploadButton" 
+            type="primary" 
+            size="small"
+          >
+            涓婁紶闄勪欢
+          </el-button>
+        </el-upload>
+      </template>
+      <template v-else>
+        <el-button 
+          v-if="showUploadButton" 
+          type="primary" 
+          size="small" 
+          @click="handleUpload"
+        >
+          鏂板闄勪欢
+        </el-button>
+      </template>
+    </div>
     <el-table :data="tableData" border :height="tableHeight">
       <el-table-column 
         :label="nameColumnLabel" 
@@ -38,6 +69,15 @@
           >
             棰勮
           </el-button>
+          <el-button
+            v-if="showDeleteButton"
+            link
+            type="danger"
+            size="small"
+            @click="handleDelete(scope.row, scope.$index)"
+          >
+            鍒犻櫎
+          </el-button>
           <slot name="actions" :row="scope.row"></slot>
         </template>
       </el-table-column>
@@ -49,7 +89,9 @@
 
 <script setup>
 import { ref, computed, getCurrentInstance } from 'vue'
+import { ElMessage } from 'element-plus'
 import filePreview from '@/components/filePreview/index.vue'
+import { getToken } from '@/utils/auth'
 
 const props = defineProps({
   modelValue: {
@@ -82,7 +124,7 @@
   },
   actionColumnWidth: {
     type: [String, Number],
-    default: 100
+    default: 160
   },
   showActions: {
     type: Boolean,
@@ -96,6 +138,14 @@
     type: Boolean,
     default: true
   },
+  showUploadButton: {
+    type: Boolean,
+    default: false
+  },
+  showDeleteButton: {
+    type: Boolean,
+    default: false
+  },
   urlField: {
     type: String,
     default: 'url'
@@ -107,13 +157,30 @@
   previewMethod: {
     type: Function,
     default: null
+  },
+  uploadMethod: {
+    type: Function,
+    default: null
+  },
+  deleteMethod: {
+    type: Function,
+    default: null
+  },
+  rulesRegulationsManagementId: {
+    type: [String, Number],
+    default: ''
+  },
+  uploadUrl: {
+    type: String,
+    default: `${import.meta.env.VITE_APP_BASE_API}/file/upload`
   }
 })
 
-const emit = defineEmits(['update:modelValue', 'close', 'download', 'preview'])
+const emit = defineEmits(['update:modelValue', 'close', 'download', 'preview', 'upload', 'delete'])
 
 const { proxy } = getCurrentInstance()
 const filePreviewRef = ref(null)
+const uploadFileList = ref([])
 
 const dialogVisible = computed({
   get: () => props.modelValue,
@@ -121,6 +188,12 @@
 })
 
 const tableData = ref([])
+const showToolbar = computed(() => props.showUploadButton)
+const useBuiltInUpload = computed(() => !props.uploadMethod)
+const uploadAction = computed(() => props.uploadUrl)
+const uploadHeaders = computed(() => ({
+  Authorization: `Bearer ${getToken()}`
+}))
 
 const handleClose = () => {
   emit('close')
@@ -154,11 +227,84 @@
   tableData.value = list || []
 }
 
+const handleUpload = async () => {
+  if (props.uploadMethod) {
+    const newItem = await props.uploadMethod()
+    if (newItem) {
+      addAttachment(newItem)
+    }
+  }
+  emit('upload')
+}
+
+const handleDelete = async (row, index) => {
+  if (props.deleteMethod) {
+    const result = await props.deleteMethod(row, index)
+    if (result === false) {
+      return
+    }
+    // 濡傛灉鎻愪緵浜� deleteMethod锛岀敱鐖剁粍浠惰礋璐e埛鏂板垪琛紝涓嶅湪杩欓噷鍒犻櫎
+  } else {
+    // 濡傛灉娌℃湁鎻愪緵 deleteMethod锛屾墠鍦ㄧ粍浠跺唴閮ㄥ垹闄�
+    removeAttachment(index)
+  }
+  emit('delete', row)
+}
+
+const addAttachment = (item) => {
+  tableData.value = [...tableData.value, item]
+}
+
+const handleDefaultUploadSuccess = async (res, file) => {
+  if (res?.code !== 200) {
+    ElMessage.error(res?.msg || '鏂囦欢涓婁紶澶辫触')
+    return
+  }
+  if (!props.rulesRegulationsManagementId) {
+    ElMessage.error('缂哄皯瑙勭珷鍒跺害ID锛屾棤娉曚繚瀛橀檮浠�')
+    return
+  }
+  const fileName = res?.data?.originalName || file?.name
+  const fileUrl = res?.data?.tempPath || res?.data?.url
+  const payload = {
+    fileName,
+    fileUrl,
+    rulesRegulationsManagementId: props.rulesRegulationsManagementId,
+    raw: res?.data || {}
+  }
+  emit('upload', payload)
+}
+
+const handleDefaultUploadError = () => {
+  ElMessage.error('鏂囦欢涓婁紶澶辫触')
+}
+
+const removeAttachment = (index) => {
+  if (index > -1 && index < tableData.value.length) {
+    const newList = [...tableData.value]
+    newList.splice(index, 1)
+    tableData.value = newList
+  }
+}
+
+const setList = (list) => {
+  tableData.value = list || []
+}
+
 defineExpose({
-  open
+  open,
+  addAttachment,
+  removeAttachment,
+  setList,
+  handleUpload,
+  handleDelete
 })
 </script>
 
 <style scoped>
+.file-list-toolbar {
+  margin-bottom: 8px;
+  text-align: right;
+}
 </style>
 
diff --git a/src/views/collaborativeApproval/rulesRegulationsManagement/index.vue b/src/views/collaborativeApproval/rulesRegulationsManagement/index.vue
index 4063295..91a6468 100644
--- a/src/views/collaborativeApproval/rulesRegulationsManagement/index.vue
+++ b/src/views/collaborativeApproval/rulesRegulationsManagement/index.vue
@@ -52,54 +52,21 @@
                   </template>
                 </el-table-column>
                 <el-table-column prop="readCount" label="宸茶浜烘暟" width="100" />
-                <el-table-column label="鎿嶄綔" width="250" fixed="right">
+                <el-table-column label="鎿嶄綔" width="320" fixed="right">
                   <template #default="scope">
                     <el-button link @click="viewRegulation(scope.row)">鏌ョ湅</el-button>
                     <el-button link type="primary" @click="handleEdit(scope.row)">缂栬緫</el-button>
                     <el-button link type="danger" @click="repealEdit(scope.row)">搴熷純</el-button>
                     <el-button link type="success" @click="viewVersionHistory(scope.row)">鐗堟湰鍘嗗彶</el-button>
                     <el-button link type="warning" @click="viewReadStatus(scope.row)">闃呰鐘舵��</el-button>
+                    <el-button link type="primary" @click="openFileDialog(scope.row)">闄勪欢</el-button>
                   </template>
                 </el-table-column>
               </el-table>
             </div>
           </el-card>
 
-    <!-- 鐢ㄥ嵃鐢宠瀵硅瘽妗� -->
-    <!-- <el-dialog v-model="showSealApplyDialog" title="鐢宠鐢ㄥ嵃" width="600px">
-      <el-form :model="sealForm" :rules="sealRules" ref="sealFormRef" label-width="100px">
-        <el-form-item label="鐢宠缂栧彿" prop="applicationNum">
-          <el-input v-model="sealForm.applicationNum" placeholder="璇疯緭鍏ョ敵璇风紪鍙�" />
-        </el-form-item>
-        <el-form-item label="鐢宠鏍囬" prop="title">
-          <el-input v-model="sealForm.title" placeholder="璇疯緭鍏ョ敵璇锋爣棰�" />
-        </el-form-item>
-        <el-form-item label="鐢ㄥ嵃绫诲瀷" prop="sealType">
-          <el-select v-model="sealForm.sealType" placeholder="璇烽�夋嫨鐢ㄥ嵃绫诲瀷" style="width: 100%">
-            <el-option label="鍏珷" value="official" />
-            <el-option label="鍚堝悓涓撶敤绔�" value="contract" />
-            <el-option label="璐㈠姟涓撶敤绔�" value="finance" />
-            <el-option label="娉曚汉绔�" value="legal" />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="鐢宠鍘熷洜" prop="reason">
-          <el-input v-model="sealForm.reason" type="textarea" :rows="4" placeholder="璇疯缁嗚鏄庣敤鍗板師鍥�" />
-        </el-form-item>
-        <el-form-item label="绱ф�ョ▼搴�" prop="urgency">
-          <el-radio-group v-model="sealForm.urgency">
-            <el-radio label="normal">鏅��</el-radio>
-            <el-radio label="urgent">绱ф��</el-radio>
-            <el-radio label="very-urgent">鐗规��</el-radio>
-          </el-radio-group>
-        </el-form-item>
-      </el-form>
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button @click="showSealApplyDialog = false">鍙栨秷</el-button>
-          <el-button type="primary" @click="submitSealApplication">鎻愪氦鐢宠</el-button>
-        </span>
-      </template>
-    </el-dialog> -->
+    <!-- 鐢ㄥ嵃鐢宠瀵硅瘽妗嗭紙宸茬Щ闄わ級 -->
 
     <!-- 瑙勭珷鍒跺害鍙戝竷瀵硅瘽妗� -->
     <el-dialog v-model="showRegulationDialog" :title="operationType === 'add' ? '鍙戝竷鍒跺害' : '缂栬緫鍒跺害'" width="800px">
@@ -150,25 +117,7 @@
       </template>
     </el-dialog>
 
-    <!-- 鐢ㄥ嵃璇︽儏瀵硅瘽妗� -->
-    <!-- <el-dialog v-model="showSealDetailDialog" title="鐢ㄥ嵃鐢宠璇︽儏" width="700px">
-      <div v-if="currentSealDetail" class="mb10">
-        <el-descriptions :column="2" border>
-          <el-descriptions-item label="鐢宠缂栧彿">{{ currentSealDetail.id }}</el-descriptions-item>
-          <el-descriptions-item label="鐢宠鏍囬">{{ currentSealDetail.title }}</el-descriptions-item>
-          <el-descriptions-item label="鐢宠浜�">{{ currentSealDetail.createUserName }}</el-descriptions-item>
-          <el-descriptions-item label="鎵�灞為儴闂�">{{ currentSealDetail.department }}</el-descriptions-item>
-          <el-descriptions-item label="鐢ㄥ嵃绫诲瀷">{{ getSealTypeText(currentSealDetail.sealType) }}</el-descriptions-item>
-          <el-descriptions-item label="鐢宠鏃堕棿">{{ currentSealDetail.createTime }}</el-descriptions-item>
-          <el-descriptions-item label="鐘舵��">
-            <el-tag :type="getStatusType(currentSealDetail.status)">
-              {{ getStatusText(currentSealDetail.status) }}
-            </el-tag>
-          </el-descriptions-item>
-          <el-descriptions-item label="鐢宠鍘熷洜" :span="2">{{ currentSealDetail.reason }}</el-descriptions-item>
-        </el-descriptions>
-      </div>
-    </el-dialog> -->
+    <!-- 鐢ㄥ嵃璇︽儏瀵硅瘽妗嗭紙宸茬Щ闄わ級 -->
 
     <!-- 瑙勭珷鍒跺害璇︽儏瀵硅瘽妗� -->
     <el-dialog v-model="showRegulationDetailDialog" title="瑙勭珷鍒跺害璇︽儏" width="800px">
@@ -224,54 +173,42 @@
         </el-table-column>
       </el-table>
     </el-dialog>
+
+    <FileListDialog
+      ref="fileListDialogRef"
+      v-model="fileDialogVisible"
+      :show-upload-button="true"
+      :show-delete-button="true"
+      :delete-method="handleAttachmentDelete"
+      :rules-regulations-management-id="currentFileRuleId"
+      :name-column-label="'闄勪欢鍚嶇О'"
+      @upload="handleAttachmentUpload"
+    />
   </div>
 </template>
 
 <script setup>
 import { ref, reactive, onMounted, getCurrentInstance } from 'vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
-import { Plus } from '@element-plus/icons-vue'
-import { listSealApplication, addSealApplication, updateSealApplication,listRuleManagement,addRuleManagement,updateRuleManagement,delRuleManagement,getReadingStatusByRuleId,getReadingStatusList,addReadingStatus,updateReadingStatus  } from '@/api/collaborativeApproval/sealManagement.js'
-import { el } from 'element-plus/es/locales.mjs'
-import { getUserProfile } from '@/api/system/user.js'
-import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js";
-import useUserStore from '@/store/modules/user'
-import { userLoginFacotryList } from "@/api/system/user.js"
+import { listRuleManagement,addRuleManagement,updateRuleManagement,delRuleManagement,getReadingStatusByRuleId,addReadingStatus,updateReadingStatus  } from '@/api/collaborativeApproval/sealManagement.js'
+import FileListDialog from '@/components/Dialog/FileListDialog.vue'
+import { listRuleFiles, delRuleFile, addRuleFile } from '@/api/collaborativeApproval/rulesRegulationsManagementFile.js'
 
 // 鍝嶅簲寮忔暟鎹�
-const currentUser = ref(null)
-const activeTab = ref('seal')
 const operationType = ref('add')
 const tableData = ref([])
-// 鐢ㄥ嵃鐢宠鐩稿叧
-const userStore = useUserStore()
-const showSealApplyDialog = ref(false)
 const tableLoading = ref(false)
-const showSealDetailDialog = ref(false)
-const currentSealDetail = ref(null)
-const sealFormRef = ref()
-const sealForm = reactive({
-  applicationNum: '',
-  title: '',
-  sealType: '',
-  reason: '',
-  urgency: 'normal',
-  status: 'pending'
-})
-
-const sealRules = {
-  applicationNum: [{ required: true, message: '璇疯緭鍏ョ敵璇风紪鍙�', trigger: 'blur' }],
-  title: [{ required: true, message: '璇疯緭鍏ョ敵璇锋爣棰�', trigger: 'blur' }],
-  sealType: [{ required: true, message: '璇烽�夋嫨鐢ㄥ嵃绫诲瀷', trigger: 'change' }],
-  reason: [{ required: true, message: '璇疯緭鍏ョ敵璇峰師鍥�', trigger: 'blur' }]
-}
-
-const sealSearchForm = reactive({
-  title: '',
-  status: ''
-})
 // 鍒嗛〉鍙傛暟
 const page = reactive({
+  current: 1,
+  size: 10,
+  total: 0
+})
+// 闄勪欢寮圭獥
+const fileDialogVisible = ref(false)
+const fileListDialogRef = ref(null)
+const currentFileRuleId = ref(null)
+const filePage = reactive({
   current: 1,
   size: 10,
   total: 0
@@ -320,9 +257,6 @@
   category: ''
 })
 
-// 鍋囨暟鎹�
-const sealApplications = ref([])
-
 const regulations = ref([])
 
 const versionHistory = ref([])
@@ -332,34 +266,6 @@
   // { employee: '鍒橀泤濠�', department: '鎶�鏈儴', readTime: '2025-01-11 14:20:00', confirmTime: '', status: 'unconfirmed' },
   // { employee: '鐜嬪缓鍥�', department: '璐㈠姟閮�', readTime: '2025-01-12 09:15:00', confirmTime: '2025-01-12 09:20:00', status: 'confirmed' }
 
-// 鐢ㄥ嵃鐢宠鐘舵��
-const getStatusType = (status) => {
-  const statusMap = {
-    pending: 'warning',
-    approved: 'success',
-    rejected: 'danger'
-  }
-  return statusMap[status] || 'info'
-}
-// 鍒跺害鐘舵��
-const getStatusText = (status) => {
-  const statusMap = {
-    pending: '寰呭鎵�',
-    approved: '宸查�氳繃',
-    rejected: '宸叉嫆缁�'
-  }
-  return statusMap[status] || '鏈煡'
-}
-// 鐢ㄥ嵃绫诲瀷
-const getSealTypeText = (sealType) => {
-  const sealTypeMap = {
-    official: '鍏珷',
-    contract: '鍚堝悓涓撶敤绔�',
-    finance: '璐㈠姟涓撶敤绔�',
-    tegal: '鎶�鏈笓鐢ㄧ珷'
-  }
-  return sealTypeMap[sealType] || '鏈煡'
-}
 // 鍒跺害鍒嗙被
 const getCategoryText = (category) => {
   const categoryMap = {
@@ -369,19 +275,6 @@
     tech: '鎶�鏈埗搴�'
   }
   return categoryMap[category] || '鏈煡'
-}
-// 鎼滅储鍗扮珷鐢宠
-const searchSealApplications = () => {
-  page.current=1
-  getSealApplicationList()
-
-  // ElMessage.success('鎼滅储瀹屾垚')
-}
-// 閲嶇疆鍗扮珷鐢宠鎼滅储
-const resetSealSearch = () => {
-  sealSearchForm.title = ''
-  sealSearchForm.status = ''
-  searchSealApplications()
 }
 // 鎼滅储鍒跺害
 const searchRegulations = () => {
@@ -393,32 +286,6 @@
   regulationSearchForm.title = ''
   regulationSearchForm.category = ''
   searchRegulations()
-}
-// 鎻愪氦鐢ㄥ嵃鐢宠
-const submitSealApplication = async () => {
-  try {
-    await sealFormRef.value.validate()
-    addSealApplication(sealForm).then(res => {
-      if(res.code == 200){
-        ElMessage.success('鐢宠鎻愪氦鎴愬姛')
-        showSealApplyDialog.value = false
-        getSealApplicationList()
-        Object.assign(sealForm, {
-        applicationNum: '',
-        title: '',
-        sealType: '',
-        reason: '',
-        urgency: 'normal',
-        status: 'pending'
-      })
-      }
-    }).catch(err => {
-      ElMessage.error(err.msg)
-    })
-  
-  } catch (error) {
-    ElMessage.error('璇峰畬鍠勭敵璇蜂俊鎭�')
-  }
 }
 // 鏂板
 const handleAdd = () => {
@@ -501,72 +368,6 @@
 }
 
 
-// 鏌ョ湅鐢ㄥ嵃鐢宠璇︽儏
-const viewSealDetail = (row) => {
-  currentSealDetail.value = row
-  showSealDetailDialog.value = true
-}
-// 瀹℃壒鐢ㄥ嵃鐢宠
-const approveSeal = (row) => {
-  console.log(row)
-  ElMessageBox.confirm('纭閫氳繃璇ョ敤鍗扮敵璇凤紵', '鎻愮ず', {
-    confirmButtonText: '纭畾',
-    cancelButtonText: '鍙栨秷',
-    type: 'warning'
-  }).then(() => {
-    row.status = 'approved'
-    updateSealApplication(row).then(res => {
-      if(res.code == 200){
-        ElMessage.success('瀹℃壒閫氳繃')
-      }
-    })
-  })
-}
-// 鎷掔粷鐢ㄥ嵃鐢宠
-const rejectSeal = (row) => {
-  ElMessageBox.prompt('璇疯緭鍏ユ嫆缁濆師鍥�', '鎻愮ず', {
-    confirmButtonText: '纭畾',
-    cancelButtonText: '鍙栨秷',
-    inputPattern: /\S+/,
-    inputErrorMessage: '鎷掔粷鍘熷洜涓嶈兘涓虹┖'
-  }).then(({ value }) => {
-    row.status = 'rejected'
-    updateSealApplication(row).then(res => {
-      if(res.code == 200){
-        ElMessage.success('瀹℃壒鎷掔粷')
-      }
-    })
-    ElMessage.success('宸叉嫆缁濈敵璇�')
-  })
-}
-// 鑾峰彇鍦ㄨ亴鍛樺伐鍒楄〃
-const getList = () => {
-  tableLoading.value = true;
-      //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅
-  getUserProfile().then(res => {
-    if(res.code == 200){
-      console.log(res.data.userName)
-      currentUser.value = res.data.userName
-    }
-  })
-  staffJoinListPage({staffState: 1}).then(res => {
-    tableLoading.value = false;
-    // tableData.value = res.data.records
-    // //绛涢�夊嚭鍜宑urrentUser鍚屽悕鐨勪汉鍛�
-    tableData.value = res.data.records.filter(item => item.staffName === currentUser.value)
-    console.log("tableData",tableData.value) 
-    page.total = res.data.total;
-      
-    if(tableData.value.length == 0){
-    ElMessage.error('褰撳墠鐢ㄦ埛鏈姞鍏ヤ换浣曢儴闂�')
-    }
-  }).catch(err => {
-    tableLoading.value = false;
-  })
-
-
-};
-
 // 鏌ョ湅鍒跺害鐗堟湰鍘嗗彶
 const viewVersionHistory = (row) => {
   showVersionHistoryDialog.value = true
@@ -582,7 +383,6 @@
 }
 // 鏌ョ湅鍒跺害璇︽儏
 const viewRegulation = (row) => {
-  getList()
   currentRegulationDetail.value = row
   showRegulationDetailDialog.value = true
   getReadingStatusByRuleId(row.id).then(res => {
@@ -659,32 +459,64 @@
   proxy.download('/rulesRegulationsManagement/export', { ...regulationSearchForm }, '瑙勭珷鍒跺害.xlsx')
 }
 
-// 鑾峰彇鍗扮珷鐢宠鍒楄〃鏁版嵁
-const getSealApplicationList = async () => {
-  tableLoading.value = true
-  listSealApplication(page,sealSearchForm)
-  .then(res => {
-    //鑾峰彇褰撳墠鐧诲綍鐨勯儴闂ㄤ俊鎭�
-// 鑾峰彇褰撳墠鐧诲綍鐨勯儴闂ㄤ俊鎭苟杩囨护鏁版嵁
-    const currentFactoryName = userStore.currentFactoryName
-    if (currentFactoryName) {
-      // 鏍规嵁currentFactoryName杩囨护鍑篸epartment鐩稿悓鐨勬暟鎹�
-      sealApplications.value = res.data.records.filter(item => item.department === currentFactoryName)
-      // 鏇存柊杩囨护鍚庣殑鎬绘暟
-      page.value.total = sealApplications.value.length
-    } else {
-      // 濡傛灉娌℃湁currentFactoryName锛屽垯鏄剧ず鎵�鏈夋暟鎹�
-      sealApplications.value = res.data.records
-      page.value.total = res.data.total
-    }
-    // sealApplications.value = res.data.records
-    // page.value.total = res.data.total;
-    tableLoading.value = false;
-
-  }).catch(err => {
-    tableLoading.value = false;
-  })
+// 闄勪欢锛氭煡璇�
+const fetchRuleFiles = async (rulesRegulationsManagementId) => {
+  const params = {
+    current: filePage.current,
+    size: filePage.size,
+    rulesRegulationsManagementId
+  }
+  const res = await listRuleFiles(params)
+  const records = res?.data?.records || []
+  filePage.total = res?.data?.total || records.length
+  const mapped = records.map(item => ({
+    id: item.id,
+    name: item.fileName || item.name,
+    url: item.fileUrl || item.url,
+    raw: item
+  }))
+  fileListDialogRef.value?.setList(mapped)
 }
+
+// 鎵撳紑闄勪欢寮圭獥
+const openFileDialog = async (row) => {
+  currentFileRuleId.value = row.id
+  fileDialogVisible.value = true
+  await fetchRuleFiles(row.id)
+}
+
+// 鍒锋柊闄勪欢鍒楄〃
+const refreshFileList = async () => {
+  if (!currentFileRuleId.value) return
+  await fetchRuleFiles(currentFileRuleId.value)
+}
+
+// 涓婁紶闄勪欢锛堢敱瀛愮粍浠惰Е鍙戯級
+const handleAttachmentUpload = async (filePayload) => {
+  if (!currentFileRuleId.value) return
+  const payload = {
+    name: filePayload?.fileName || filePayload?.name,
+    url: filePayload?.fileUrl || filePayload?.url,
+    rulesRegulationsManagementId: currentFileRuleId.value
+  }
+  await addRuleFile(payload)
+  ElMessage.success('鏂囦欢涓婁紶鎴愬姛')
+  await refreshFileList()
+}
+
+// 鍒犻櫎闄勪欢
+const handleAttachmentDelete = async (row) => {
+  if (!row?.id) return false
+  try {
+    await ElMessageBox.confirm('纭鍒犻櫎璇ラ檮浠讹紵', '鎻愮ず', { type: 'warning' })
+  } catch {
+    return false
+  }
+  await delRuleFile([row.id])
+  ElMessage.success('鍒犻櫎鎴愬姛')
+  await refreshFileList()
+}
+
 // 鑾峰彇瑙勭珷鍒跺害鍒楄〃鏁版嵁
 const getRegulationList = async () => {
   tableLoading.value = true
@@ -704,7 +536,6 @@
 
 onMounted(() => {
   // 鍒濆鍖�
-  getSealApplicationList()
   getRegulationList()
 })
 </script>

--
Gitblit v1.9.3