-                  
-                    
-                      
-                        {{ scope.row.frontUploading ? '识别中...' : '头像面' }}
-                      
-                    
-                    ✓
-                  
-                  
-                    
-                      
-                        {{ scope.row.backUploading ? '识别中...' : '国徽面' }}
-                      
-                    
-                    ✓
-                  
+                
+                  
+                  
+                    
+                    
+                      
+                    
+                  
+
+                  
+                  
+                    
+                    
+                      
+                    
+                  
                 
               
             
+
+
+
+
+            
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
             
               
                 删除
@@ -520,7 +572,8 @@ export default {
       treeProps: {
         label: 'name',
         children: 'children'
-      }
+      },
+      uploadParseUrl: process.env.VUE_APP_BASE_API + '/material/authorize/parseWord',
     }
   },
   created() {
@@ -865,16 +918,6 @@ export default {
         this.$message.error(response.msg || '文件上传失败')
       }
     },
-    // 文件上传删除处理
-    handleFileRemove(file, fileList) {
-      this.url = null
-      this.fileList = fileList
-    },
-    //文件上传失败
-    handleError(err, file, fileList) {
-      console.error('Error while uploading file:', err)
-      this.url = null
-    },
 
     // 新增领料人
     addReceiver() {
@@ -979,22 +1022,22 @@ export default {
     },
     // 预览文件
     previewFile(file) {
-      if (!file || !file.url) return
-
-      const ext = file.name.split('.').pop().toLowerCase()
-      console.log(ext)
-
-      if (ext === 'pdf') {
-        this.previewPDF(file.url)
-      } else if (['jpg', 'jpeg', 'png', 'gif'].includes(ext)) {
-        // 图片直接使用el-image预览
-        this.$alert(`
`, file.name, {
-          dangerouslyUseHTMLString: true,
-          customClass: 'image-preview-modal'
-        })
-      } else {
-        this.$message.warning('不支持预览此文件类型')
-      }
+      // if (!file || !file.url) return
+      //
+      // const ext = file.name.split('.').pop().toLowerCase()
+      // console.log(ext)
+      //
+      // if (ext === 'pdf') {
+      //   this.previewPDF(file.url)
+      // } else if (['jpg', 'jpeg', 'png', 'gif'].includes(ext)) {
+      //   // 图片直接使用el-image预览
+      //   this.$alert(`
`, file.name, {
+      //     dangerouslyUseHTMLString: true,
+      //     customClass: 'image-preview-modal'
+      //   })
+      // } else {
+      //   this.$message.warning('不支持预览此文件类型')
+      // }
     },
     // 预览PDF文件
     previewPDF(url) {
@@ -1182,7 +1225,101 @@ export default {
       } finally {
         this.$loading().close()
       }
-    }
+    },
+    /** 下载模板方法 */
+    async downloadTemplate() {
+      try {
+        // 使用统一的下载方法,确保路径正确
+        await this.download("/material/authorize/downLoad", {}, "授权委托书模板.doc");
+        this.$message.success("模板下载成功");
+      } catch (error) {
+        console.error("模板下载失败:", error);
+        this.$message.error("模板下载失败,请稍后重试");
+      } finally {
+      }
+    },
+    // 上传并解析成功
+    // handleParseSuccess(response, file, fileList) {
+    //   // 兼容你的 AjaxResult 结构:{ code:200, data: [...] }
+    //   const list = (response && response.code === 200) ? response.data : (Array.isArray(response) ? response : null);
+    //
+    //   if (!list || list.length === 0) {
+    //     this.$message.warning('未识别到委托人信息,请手动填写');
+    //     // 设置 fileList 显示上传的文件名
+    //     this.fileList = [{ name: file.name, url: '' }];
+    //     return;
+    //   }
+    //
+    //   // 直接把识别到的结果赋值给 materialReceivers(并保证字段名一致)
+    //   this.materialReceivers = list.map(item => ({
+    //     name: item.name || '',
+    //     idNumber: item.idNumber || '',
+    //     phone: item.phone || '',
+    //     idFrontPhoto: item.frontUrl || item.idFrontPhoto || item.fronturl || null,
+    //     idBackPhoto: item.backUrl || item.idBackPhoto || item.backurl || null,
+    //     frontUploading: false,
+    //     backUploading: false
+    //   }));
+    //
+    //   // 同步到 authForm
+    //   this.authForm.materialReceivers = [...this.materialReceivers];
+    //
+    //   // 更新 fileList 显示
+    //   this.fileList = [{ name: file.name, url: '' }];
+    //
+    //   this.$message.success(`识别成功,共提取 ${this.materialReceivers.length} 个委托人`);
+    // },
+    handleParseSuccess(response, file, fileList) {
+      // 后端返回结构:{ code:200, data: { receivers: [...], filePath: "xxx" } }
+      const data = (response && response.code === 200) ? response.data : null;
+      const list = data ? data.receivers : null;
+
+      if (!list || list.length === 0) {
+        this.$message.warning('未识别到委托人信息,请手动填写');
+        // 设置 fileList 显示上传的文件名
+        this.fileList = [{ name: file.name, url: data ? data.filePath : '' }];
+        // 同时保存文件路径(即使没有识别成功)
+        this.authForm.filePath = data ? data.filePath : '';
+        this.url=data ? data.filePath : '';
+        this.fileName=data ? data.fileName : '';
+        return;
+      }
+
+      // 把识别到的结果赋值给 materialReceivers
+      this.materialReceivers = list.map(item => ({
+        name: item.name || '',
+        idNumber: item.idNumber || '',
+        phone: item.phone || '',
+        idFrontPhoto: item.frontUrl || item.idFrontPhoto || item.fronturl || null,
+        idBackPhoto: item.backUrl || item.idBackPhoto || item.backurl || null,
+        frontUploading: false,
+        backUploading: false
+      }));
+
+      // 同步到表单
+      this.authForm.materialReceivers = [...this.materialReceivers];
+      // 保存文件路径
+      this.authForm.filePath = data.filePath;
+
+      // 更新 fileList 显示
+      this.fileList = [{ name: file.name, url: data.filePath }];
+      this.url=data.filePath;
+      this.fileName=data.fileName;
+
+      this.$message.success(`识别成功,共提取 ${this.materialReceivers.length} 个委托人`);
+    },
+
+
+    handleError(err) {
+      console.error('上传/解析失败', err);
+      this.$message.error('文件上传或解析失败');
+    },
+
+    handleFileRemove(file, fileList) {
+      this.fileList = fileList;
+      // 清空识别结果(可选)
+      // this.materialReceivers = [];
+    },
   }
 }