2 Commit-ok f3e6f68023 ... b7252d4728

Szerző SHA1 Üzenet Dátum
  shiyanyu b7252d4728 Merge branch 'master' of http://1.71.9.215:3000/feiyi/cbjsxt-front-master 1 hete
  shiyanyu f38109088c fix: 修改bug 1 hete

+ 34 - 4
src/views/costAudit/auditInfo/auditManage/auditDocumentsMain.vue

@@ -413,6 +413,7 @@
       @confirm="handleConfirm"
     >
       <cost-audit-table
+        ref="selectWhTable"
         :table-data="selectDocumentWhData"
         :columns="selectDocumentWhColumns"
         :show-selection="true"
@@ -1382,12 +1383,41 @@
         this.selectDocumentWhPagination.pageSize = pageSize
       },
       selectDocumentWhSelectionChange(selection) {
-        if (selection.length > 1) {
-          this.$message.error('只能选择一个文号!')
+        // 该弹窗要求“单选”:只保留最后一次勾选
+        const list = Array.isArray(selection) ? selection : []
+        if (list.length <= 1) {
+          this.selectDocumentWhSelection = list
           return
-        } else {
-          this.selectDocumentWhSelection = selection
         }
+
+        const last = list[list.length - 1]
+        this.$message.error('只能选择一个文号!')
+        this.selectDocumentWhSelection = last ? [last] : []
+
+        // 同步清理 UI 上的多选勾选(兼容不同 table 组件暴露的方法)
+        this.$nextTick(() => {
+          const table = this.$refs.selectWhTable
+          if (!table) return
+
+          // 1) 若内部直接是 el-table
+          if (typeof table.clearSelection === 'function') {
+            table.clearSelection()
+            if (last && typeof table.toggleRowSelection === 'function') {
+              table.toggleRowSelection(last, true)
+            }
+            return
+          }
+
+          // 2) 若外层封装,需要从 $refs.table 取 el-table
+          const inner =
+            table.$refs && (table.$refs.table || table.$refs.elTable)
+          if (inner && typeof inner.clearSelection === 'function') {
+            inner.clearSelection()
+            if (last && typeof inner.toggleRowSelection === 'function') {
+              inner.toggleRowSelection(last, true)
+            }
+          }
+        })
       },
       handleTemplateChange() {
         let data = this.documentData.documentTypes.find(