Kaynağa Gözat

feat: 优化签章功能流程与文档处理逻辑

yusheng 1 ay önce
ebeveyn
işleme
eb21d408df

+ 31 - 110
src/components/addDoc/seal.vue

@@ -69,16 +69,16 @@
   // 引入 html2canvas 和 jsPDF
   import html2canvas from 'html2canvas';
   import jsPDF from 'jspdf';
-  //   const imageUrl = [
-  //     require('@/assets/0.jpg'),
-  //     require('@/assets/1.jpg'),
-  //     require('@/assets/2.jpg'),
-  //     require('@/assets/3.jpg'),
-  //     require('@/assets/4.jpg'),
-  //     require('@/assets/5.jpg')
-  //   ]; // 使用相对路径或别名路径
-  //   // 默认精美的示例HTML + CSS (内联样式丰富,展示能力)
-  //   const DEFAULT_HTML = `
+  // const imageUrl = [
+  //   require('@/assets/0.jpg'),
+  //   require('@/assets/1.jpg'),
+  //   require('@/assets/2.jpg'),
+  //   require('@/assets/3.jpg'),
+  //   require('@/assets/4.jpg'),
+  //   require('@/assets/5.jpg')
+  // ]; // 使用相对路径或别名路径
+  // // 默认精美的示例HTML + CSS (内联样式丰富,展示能力)
+  // const DEFAULT_HTML = `
   //  <div class="container">
   //         <div class="img-area">
   //             <img class="my-photo" alt="loading" src="${imageUrl[0]}">
@@ -103,7 +103,6 @@
     data() {
       return {
         editableHtml: '',
-        previewHtml: '',
         canvasGenerated: false,
         publicImages: [],
         privateImages: [],
@@ -146,7 +145,7 @@
     mounted() {
       // 组件挂载后自动渲染一次
       this.$nextTick(() => {
-        this.renderToCanvas();
+        // this.renderToCanvas();
       });
 
       // 保存组件实例引用,用于事件处理器
@@ -331,9 +330,9 @@
         img.onload = () => {
           console.log('图片加载成功,原始尺寸:', img.width, img.height);
 
-          // 默认图片大小为 100x100
-          const width = 100;
-          const height = 100;
+          // 使用图片原始尺寸
+          const width = img.width;
+          const height = img.height;
           const posX = x - width / 2;
           const posY = y - height / 2;
 
@@ -841,8 +840,8 @@
           outputCanvas.width = canvas.width;
           outputCanvas.height = canvas.height;
           // 使用原始尺寸(去除scale倍数),保持显示比例
-          outputCanvas.style.width = (canvas.width / scale) + 'px';
-          outputCanvas.style.height = (canvas.height / scale) + 'px';
+          outputCanvas.style.width = canvas.width / scale + 'px';
+          outputCanvas.style.height = canvas.height / scale + 'px';
           const ctx = outputCanvas.getContext('2d');
           ctx.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
           ctx.drawImage(canvas, 0, 0);
@@ -931,93 +930,6 @@
         }
       },
 
-      // 重新渲染基础内容(当 HTML 内容变化时调用)
-      async refreshBaseContent() {
-        try {
-          const targetElement = document.getElementById('captureTarget');
-          if (!targetElement) return;
-
-          const newCanvas = await html2canvas(targetElement, {
-            scale: 2,
-            backgroundColor: '#ffffff',
-            useCORS: true,
-            logging: false,
-            allowTaint: false,
-            imageTimeout: 5000,
-            windowWidth: targetElement.scrollWidth,
-            windowHeight: targetElement.scrollHeight
-          });
-
-          this.baseCanvasData = newCanvas;
-
-          // 更新主 Canvas
-          const outputCanvas = document.getElementById('outputCanvas');
-          if (outputCanvas && this.canvasGenerated) {
-            const ctx = outputCanvas.getContext('2d');
-            ctx.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
-            ctx.drawImage(newCanvas, 0, 0);
-
-            // 重新绘制所有拖入的图片
-            this.droppedImages.forEach((image) => {
-              const img = new Image();
-              img.onload = () => {
-                ctx.drawImage(img, image.x, image.y, image.width, image.height);
-              };
-              img.src = image.imgUrl;
-            });
-          }
-
-          console.log('基础内容已更新');
-        } catch (error) {
-          console.error('更新基础内容失败:', error);
-        }
-      },
-
-      // 获取 PDF 文件流(用于直接上传)
-      getPDFFile() {
-        const outputCanvas = document.getElementById('outputCanvas');
-        if (
-          !this.canvasGenerated ||
-          !outputCanvas ||
-          outputCanvas.width === 0
-        ) {
-          // this.showMessage(
-          //   '请先点击"渲染至Canvas"生成图像后再获取PDF',
-          //   'error'
-          // );
-          return Promise.reject(new Error('Canvas 未生成'));
-        }
-
-        return new Promise((resolve, reject) => {
-          try {
-            const imgData = outputCanvas.toDataURL('image/png');
-            const canvasWidth = outputCanvas.width;
-            const canvasHeight = outputCanvas.height;
-
-            // 创建 PDF 实例
-            const orientation = canvasWidth > canvasHeight ? 'l' : 'p';
-            const pdf = new jsPDF(orientation, 'px', [
-              canvasWidth,
-              canvasHeight
-            ]);
-
-            // 将 Canvas 图片添加到 PDF
-            pdf.addImage(imgData, 'PNG', 0, 0, canvasWidth, canvasHeight);
-
-            // 获取 PDF 文件流
-            const pdfBlob = pdf.output('blob');
-            const pdfFile = new File([pdfBlob], `canvas-${Date.now()}.pdf`, {
-              type: 'application/pdf'
-            });
-
-            resolve(pdfFile);
-          } catch (err) {
-            console.error('获取 PDF 文件流失败', err);
-            reject(err);
-          }
-        });
-      },
-
       // 打印 Canvas / 另存为 PDF
       printCanvas() {
         const outputCanvas = document.getElementById('outputCanvas');
@@ -1077,12 +989,21 @@
         }
       },
 
-      init(html) {
-        this.editableHtml = html;
-        this.previewHtml = html;
-        this.$nextTick(() => {
-          this.renderToCanvas();
-        });
+      init(html, data) {
+        if (data.droppedImages) {
+          this.droppedImages = data.droppedImages;
+          this.editableHtml = html;
+          this.$nextTick(() => {
+            setTimeout(() => {
+              this.redrawCanvas();
+            }, 10000);
+          });
+        } else {
+          this.editableHtml = html;
+          this.$nextTick(() => {
+            this.renderToCanvas();
+          });
+        }
       }
     }
   };

+ 11 - 19
src/components/addDoc/sealManagement.vue

@@ -63,23 +63,15 @@
         this.$refs.sealRef.exportToPDF();
       },
       pdfGenerated({ pdfFile, droppedImages }) {
-        uploadFileNew({
-          module: 'fm',
-          multiPartFile: pdfFile
-        })
-          .then((res) => {
-            this.$emit('save', {
-              stampStoragePath: res.data ? [res.data] : [],
-              id: this.restoreData.id,
-              droppedImages
-            });
-            this.showEditFlag = false;
-          })
-          .finally(() => {
-            this.loading = false;
-          });
+        this.$emit('save', {
+          pdfFile: pdfFile,
+          id: this.restoreData.id,
+          droppedImages
+        });
+
       },
       setFileUrl(row) {
+        console.log(row,'row')
         let file = row.stampStoragePath[0] || row.storagePath[0];
         let fileNames = file.storePath.split('/');
         let url =
@@ -100,10 +92,10 @@
             console.log(container);
 
             this.$refs.sealRef.init(
-              container[0].innerHTML.replace(
-                /src="https?:\/\/[^\/]+(\/[^"]*)"/g,
-                `src="${window.location.origin}$1"`
-              )
+             '',
+              {
+                droppedImages:row.droppedImages||''
+              }
             );
           };
         });

+ 146 - 144
src/views/bpm/handleTask/components/doc/index.vue

@@ -21,154 +21,156 @@
     <browse ref="browseRef"></browse>
   </ele-pro-table>
 </template>
-  
-  <script>
-import { getById } from '@/api/bpm/components/doc';
-import browse from '@/components/addDoc/browse.vue';
 
-export default {
-  components: {browse},
-  props: {
-    businessId: {
-      default: ''
-    }
-  },
-  //add:新建 fileEdit:修改  filePigeonhole:归档 fileUnPigeonhole:取消归档  fileIssue:发布 fileChange:变更 fileDel:删除
+<script>
+  import { getById } from '@/api/bpm/components/doc';
+  import browse from '@/components/addDoc/browse.vue';
 
-  data() {
-    return {
-      // 表格列配置
-      columns: [
-        {
-          label: '编码',
-          prop: 'code',
-          width: 180,
-          align: 'center',
-          fixed: 'left',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'name',
-          label: '文档名称',
-          align: 'center',
-          slot: 'name',
-          showOverflowTooltip: true,
-          minWidth: 200
-        },
-        {
-          prop: 'storagePath',
-          label: '文件名称',
-          align: 'center',
+  export default {
+    components: { browse },
+    props: {
+      businessId: {
+        default: ''
+      }
+    },
+    //add:新建 fileEdit:修改  filePigeonhole:归档 fileUnPigeonhole:取消归档  fileIssue:发布 fileChange:变更 fileDel:删除
 
-          showOverflowTooltip: true,
-          minWidth: 200,
-          formatter: (_row, _column, cellValue) => {
-            return cellValue[0]?.name;
-          }
-        },
-        {
-          prop: 'version',
-          label: '版本',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'checkOutUserName',
-          label: '检出人',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'checkOutStatus',
-          label: '检出状态',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100,
-          formatter: (_row, _column, cellValue) => {
-            return cellValue == 1 ? '已检出' : '';
-          }
-        },
-        {
-          prop: 'checkOutTime',
-          label: '检出时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 160
-        },
-        {
-          prop: 'createUserName',
-          label: '创建人',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 160,
-          formatter: (_row, _column, cellValue) => {
-            return this.$util.toDateString(cellValue);
-          }
-        },
-        {
-          prop: 'updateUserName',
-          label: '修改人',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'updateTime',
-          label: '修改时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 160
-        },
-        {
-          prop: 'sizeUnit',
-          label: '文档大小',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: '',
-          label: '状态',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 150,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          showOverflowTooltip: true,
-          fixed: 'right'
-        }
-      ],
-      tableList: []
-    };
-  },
-  created() {
-    this.init();
-  },
+    data() {
+      return {
+        // 表格列配置
+        columns: [
+          {
+            label: '编码',
+            prop: 'code',
+            width: 180,
+            align: 'center',
+            fixed: 'left',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '文档名称',
+            align: 'center',
+            slot: 'name',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'storagePath',
+            label: '文件名称',
+            align: 'center',
 
-  methods: {
-    async init() {
-      const data = await getById(this.businessId);
-      this.tableList = [data];
+            showOverflowTooltip: true,
+            minWidth: 200,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue[0]?.name;
+            }
+          },
+          {
+            prop: 'version',
+            label: '版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'checkOutUserName',
+            label: '检出人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'checkOutStatus',
+            label: '检出状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue == 1 ? '已检出' : '';
+            }
+          },
+          {
+            prop: 'checkOutTime',
+            label: '检出时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          },
+          {
+            prop: 'updateUserName',
+            label: '修改人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'updateTime',
+            label: '修改时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+          {
+            prop: 'sizeUnit',
+            label: '文档大小',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: '',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          }
+        ],
+        tableList: []
+      };
     },
-    browseOpen(row) {
-      this.$refs.browseRef.open(row);
+    created() {
+      this.init();
+    },
+
+    methods: {
+      async getTableValue() {
+        return 2;
+      },
+      async init() {
+        const data = await getById(this.businessId);
+        this.tableList = [data];
+      },
+      browseOpen(row) {
+        this.$refs.browseRef.open(row);
+      }
     }
-  }
-};
+  };
 </script>
-  

+ 178 - 183
src/views/bpm/handleTask/components/doc/send/receiveDialog.vue

@@ -1,195 +1,190 @@
 <!-- 用户编辑弹窗 -->
 <template>
-   <el-form
-      ref="form"
-      :model="form"
-      :rules="rules"
-      label-width="82px"
-      :disabled="true"
-    >
-      <el-row :gutter="15">
-        <el-col :span="8">
-          <el-form-item label="主题" prop="name">
-            <el-input v-model="form.name" placeholder="请输入主题"></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item label="回收人" prop="recycleUserName">
-            <el-input v-model="form.recycleUserName" disabled></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item label="回收时间" prop="recycleTime">
-            <el-date-picker
-              v-model="form.recycleTime"
-              type="datetime"
-              placeholder="选择日期时间"
-              format="yyyy-MM-dd HH:mm:ss"
-              value-format="yyyy-MM-dd HH:mm:ss"
-              style="width: 100%"
-            >
-            </el-date-picker>
-          
-          </el-form-item>
-        </el-col>
-       
-       
-        <el-col :span="8">
-          <el-form-item label="创建时间" prop="createTime">
-            <el-input v-model="form.createTime" disabled style="width: 100%">
-            </el-input>
-         
-          </el-form-item>
-        </el-col>
-        <el-col :span="24">
-          <el-form-item label="回收说明" prop="remark">
-            <el-input v-model="form.remark" type="textarea"></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="24">
-          <el-form-item label="回收信息" prop="releaseList">
-            <ele-pro-table
-              ref="table"
-              :columns="columns"
-              :datasource="form.releaseList"
-              tool-class="ele-toolbar-form"
-              cache-key="systemOrgUserTable"
-              :needPage="false"
-            >
-      
-  
-            </ele-pro-table>
-          </el-form-item>
-        </el-col>
-      
-      </el-row>
-    </el-form>
+  <el-form
+    ref="form"
+    :model="form"
+    :rules="rules"
+    label-width="82px"
+    :disabled="true"
+  >
+    <el-row :gutter="15">
+      <el-col :span="8">
+        <el-form-item label="主题" prop="name">
+          <el-input v-model="form.name" placeholder="请输入主题"></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="8">
+        <el-form-item label="回收人" prop="recycleUserName">
+          <el-input v-model="form.recycleUserName" disabled></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="8">
+        <el-form-item label="回收时间" prop="recycleTime">
+          <el-date-picker
+            v-model="form.recycleTime"
+            type="datetime"
+            placeholder="选择日期时间"
+            format="yyyy-MM-dd HH:mm:ss"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            style="width: 100%"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="8">
+        <el-form-item label="创建时间" prop="createTime">
+          <el-input v-model="form.createTime" disabled style="width: 100%">
+          </el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24">
+        <el-form-item label="回收说明" prop="remark">
+          <el-input v-model="form.remark" type="textarea"></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24">
+        <el-form-item label="回收信息" prop="releaseList">
+          <ele-pro-table
+            ref="table"
+            :columns="columns"
+            :datasource="form.releaseList"
+            tool-class="ele-toolbar-form"
+            cache-key="systemOrgUserTable"
+            :needPage="false"
+          >
+          </ele-pro-table>
+        </el-form-item>
+      </el-col>
+    </el-row>
+  </el-form>
 </template>
-  
-  <script>
-import power from './power.vue';
-import { recycleGetById } from '@/api/bpm/components/doc';
 
-const defaultForm = {
-  name: '',
-  releaseList: [], //回收信息集合
-  recycleTime: '', //回收时间
-  recycleUserId: '', //回收人id
-  recycleUserName: '', //回收人名称
-  remark: '', //描述
-  status: '',
-  type: ''
-};
-export default {
-  components: { power },
-  props: {
-    businessId: {
-      default: ''
-    }
-  },
-  props: {
-    businessId: {
-      default: ''
-    }
-  },
-  data() {
-    return {
-      form: {
-        ...defaultForm
-      },
+<script>
+  import power from './power.vue';
+  import { recycleGetById } from '@/api/bpm/components/doc';
 
-      columns: [
-        {
-          width: 45,
-          type: 'index',
-          columnKey: 'index',
-          align: 'center'
+  const defaultForm = {
+    name: '',
+    releaseList: [], //回收信息集合
+    recycleTime: '', //回收时间
+    recycleUserId: '', //回收人id
+    recycleUserName: '', //回收人名称
+    remark: '', //描述
+    status: '',
+    type: ''
+  };
+  export default {
+    components: { power },
+    props: {
+      businessId: {
+        default: ''
+      }
+    },
+    props: {
+      businessId: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        form: {
+          ...defaultForm
         },
 
-        {
-          label: '主题',
-          align: 'center',
-          prop: 'name',
-          width: 220,
-          showOverflowTooltip: true
-        },
+        columns: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center'
+          },
 
-        // {
-        //   align: 'center',
-        //   label: '是否回收权限',
-        //   prop: 'isAuthority',
-        //   width: 120,
-        //   formatter: (_row, _column, cellValue) => {
-        //     return cellValue == 1 ? '是' : '否';
-        //   }
-        // },
-        {
-          align: 'center',
-          label: '回收权限时间',
-          prop: 'isAuthorityTime',
-          width: 180,
-          showOverflowTooltip: true
-        },
-        {
-          align: 'center',
-          label: '失效时间',
-          prop: 'failureTime',
-          width: 180,
-          showOverflowTooltip: true
-        },
+          {
+            label: '主题',
+            align: 'center',
+            prop: 'name',
+            width: 220,
+            showOverflowTooltip: true
+          },
 
-        {
-          prop: 'userAuthority',
-          label: '通知用户',
-          align: 'center',
-          formatter: (_row, _column, cellValue) => {
-            return cellValue.map((item) => item.name).toString();
-          }
-        },
-        {
-          align: 'center',
-          label: '发布人',
-          prop: 'releaseUserName',
-          width: 180
-        },
+          // {
+          //   align: 'center',
+          //   label: '是否回收权限',
+          //   prop: 'isAuthority',
+          //   width: 120,
+          //   formatter: (_row, _column, cellValue) => {
+          //     return cellValue == 1 ? '是' : '否';
+          //   }
+          // },
+          {
+            align: 'center',
+            label: '回收权限时间',
+            prop: 'isAuthorityTime',
+            width: 180,
+            showOverflowTooltip: true
+          },
+          {
+            align: 'center',
+            label: '失效时间',
+            prop: 'failureTime',
+            width: 180,
+            showOverflowTooltip: true
+          },
 
-        {
-          prop: 'releaseTime',
-          align: 'center',
-          label: '发布时间',
-          width: 180
-        }
-      ],
-      powerArr: [
-        // { name: 'visible', label: '可见' },
-        // { name: 'check', label: '查看' },
-        // { name: 'browse', label: '浏览' },
-        // { name: 'download', label: '下载' },
-        // { name: 'print', label: '打印' }
-      ]
-    };
-  },
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    }
-  },
-  created() {
-    this.init();
-  },
-  methods: {
-    async init() {
-      const data = await recycleGetById(this.businessId);
-      this.form = data;
-      this.$nextTick(() => {
-        this.$refs.powerRef &&
-          this.$refs.powerRef.setTableList(data.userAuthority);
-      });
+          {
+            prop: 'userAuthority',
+            label: '通知用户',
+            align: 'center',
+            formatter: (_row, _column, cellValue) => {
+              return cellValue.map((item) => item.name).toString();
+            }
+          },
+          {
+            align: 'center',
+            label: '发布人',
+            prop: 'releaseUserName',
+            width: 180
+          },
+
+          {
+            prop: 'releaseTime',
+            align: 'center',
+            label: '发布时间',
+            width: 180
+          }
+        ],
+        powerArr: [
+          // { name: 'visible', label: '可见' },
+          // { name: 'check', label: '查看' },
+          // { name: 'browse', label: '浏览' },
+          // { name: 'download', label: '下载' },
+          // { name: 'print', label: '打印' }
+        ]
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    created() {
+      this.init();
+    },
+    methods: {
+      async getTableValue() {
+        return 2;
+      },
+      async init() {
+        const data = await recycleGetById(this.businessId);
+        this.form = data;
+        this.$nextTick(() => {
+          this.$refs.powerRef &&
+            this.$refs.powerRef.setTableList(data.userAuthority);
+        });
+      }
     }
-  }
-};
+  };
 </script>
-  <style scoped lang="scss">
-</style>
-  
+<style scoped lang="scss"></style>

+ 54 - 21
src/views/bpm/handleTask/components/doc/send/sendDialog.vue

@@ -66,7 +66,7 @@
           <ele-pro-table
             ref="table"
             :columns="columns"
-            :datasource="form.fileList"
+            :datasource="fileList"
             tool-class="ele-toolbar-form"
             cache-key="systemOrgUserTable"
             :needPage="false"
@@ -119,6 +119,7 @@
     fileUpdateAPI,
     getById
   } from '@/api/bpm/components/doc';
+  import { uploadFileNew } from '@/components/addDoc/api/index.js';
   import sealManagement from '@/components/addDoc/sealManagement.vue';
   import browse from '@/components/addDoc/browse.vue';
   import { usageRecordAdd } from '@/api/bpm/components/sealManagement';
@@ -141,6 +142,7 @@
     },
     data() {
       return {
+        fileList: [],
         form: {
           ...defaultForm
         },
@@ -258,32 +260,62 @@
       this.init();
     },
     methods: {
-      save({ stampStoragePath, id, droppedImages }) {
-        fileUpdateAPI({ stampStoragePath, id }).then((res) => {
-          let fileData = this.form.fileList.find((item) => item.id == id);
-          droppedImages.forEach((item) => {
-            if (item.imgId) {
-              usageRecordAdd({
-                sealId: item.imgId,
-                sealName: item.name,
-                version: item.version,
-                documentCode: fileData.code,
-                documentName: fileData.name,
-                usageObjectId: fileData.id,
-                usageObjectName: fileData.name,
-                usageDeptName: this.$store.state.user.info.groupName,
-                usageDeptId: this.$store.state.user.info.groupId,
-                userName: this.$store.state.user.info.name,
-                userId: this.$store.state.user.info.userId,
-                useTime: new Date()
+      save({ pdfFile, id, droppedImages }) {
+        let fileDataIndex = this.fileList.findIndex((item) => item.id == id);
+        this.$set(this.fileList[fileDataIndex], 'pdfFile', pdfFile);
+        this.$set(this.fileList[fileDataIndex], 'droppedImages', droppedImages);
+      },
+      async getTableValue() {
+        // 处理包含 pdfFile 的文件,上传并更新文档地址
+        const uploadPromises = this.fileList
+          .filter((item) => item.pdfFile)
+          .map(async (item) => {
+            // 上传 PDF 文件
+            const uploadRes = await uploadFileNew({
+              module: 'fm',
+              multiPartFile: item.pdfFile
+            });
+            // 获取文件地址
+            const fileUrl = uploadRes.data;
+            // 更新文档地址
+            await fileUpdateAPI({
+              stampStoragePath: fileUrl,
+              id: item.id
+            });
+            // 处理签章使用记录
+            if (item.droppedImages && item.droppedImages.length) {
+              item.droppedImages.forEach((dropItem) => {
+                if (dropItem.imgId) {
+                  usageRecordAdd({
+                    sealId: dropItem.imgId,
+                    sealName: dropItem.name,
+                    version: dropItem.version,
+                    documentCode: item.code,
+                    documentName: item.name,
+                    usageObjectId: item.id,
+                    usageObjectName: item.name,
+                    usageDeptName: this.$store.state.user.info.groupName,
+                    usageDeptId: this.$store.state.user.info.groupId,
+                    userName: this.$store.state.user.info.name,
+                    userId: this.$store.state.user.info.userId,
+                    useTime: new Date()
+                  });
+                }
               });
             }
           });
-        });
+
+        await Promise.all(uploadPromises);
+        return 2;
       },
       async init() {
         const data = await sendGetById(this.businessId);
         this.form = data;
+        this.fileList = data.fileList.map((item) => {
+          item['droppedImages'] = '';
+          item['pdfFile'] = '';
+          return item;
+        });
 
         this.$nextTick(() => {
           this.$refs.powerRef &&
@@ -292,7 +324,8 @@
       },
       async browseOpen(row, type) {
         if (type == 1) {
-          this.$refs.sealManagementRef.open(await getById(row.id));
+          let data=await getById(row.id)
+          this.$refs.sealManagementRef.open({...data,droppedImages:row.droppedImages});
         } else {
           this.$refs.browseRef.open(await getById(row.id));
         }

+ 94 - 81
src/views/bpm/handleTask/components/doc/submit.vue

@@ -3,7 +3,6 @@
     <el-form label-width="100px" ref="formRef" :model="form">
       <el-form-item
         label="审批建议"
-    
         style="margin-bottom: 20px"
         :rules="{
           required: true,
@@ -54,96 +53,110 @@
 </template>
 
 <script>
-import {approveTaskWithVariables, rejectTask,cancelTask} from '@/api/bpm/task';
-// 流程实例的详情页,可用于审批
-export default {
-  name: '',
-  components: {
-  },
-  props: {
-    businessId: {
-      default: ''
-    },
-    taskId: {
-      default: ''
+  import {
+    approveTaskWithVariables,
+    rejectTask,
+    cancelTask
+  } from '@/api/bpm/task';
+  // 流程实例的详情页,可用于审批
+  export default {
+    name: '',
+    components: {},
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      }
     },
-    id: {
-      default: ''
+    data() {
+      return {
+        form: {
+          reason: '同意'
+        }
+      };
     },
-    taskDefinitionKey: {
-      default: ''
-    }
-  },
-  data() {
-    return {
-      form: {
-        reason: '同意'
+    created() {},
+    methods: {
+      /** 处理转办审批人 */
+      handleUpdateAssignee() {
+        this.$emit('handleUpdateAssignee');
+      },
+      /** 退回 */
+      handleBackList() {
+        this.$emit('handleBackList');
       },
-    };
-  },
-  created() {
 
-  },
-  methods: {
-    /** 处理转办审批人 */
-    handleUpdateAssignee() {
-      this.$emit('handleUpdateAssignee');
-    },
-    /** 退回 */
-    handleBackList() {
-      this.$emit('handleBackList');
-    },
+      async handleAudit(status, type) {
+        let value=await this.getTableValue()
+        if (!value) {
+          return;
+        }
+        alert(value)
+        return
+        this._approveTaskWithVariables(status);
+      },
+      async _approveTaskWithVariables(status) {
+        let variables = {
+          pass: !!status
+        };
 
-    async handleAudit(status, type) {
-      this._approveTaskWithVariables(status);
-    },
-    async _approveTaskWithVariables(status) {
-      let variables = {
-        pass: !!status
-      };
+        let API = !!status ? approveTaskWithVariables : rejectTask;
+        API({
+          id: this.taskId,
+          reason: this.form.reason,
+          variables
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: status === 0 ? '驳回' : ''
+            });
+          }
+        });
+      },
 
-      let API = !!status ? approveTaskWithVariables : rejectTask;
-      API({
-        id: this.taskId,
-        reason: this.form.reason,
-        variables
-      }).then((res) => {
-        if (res.data.code != '-1') {
-          this.$emit('handleAudit', {
-            status,
-            title: status === 0 ? '驳回' : ''
+      getTableValue() {
+        return new Promise((resolve, reject) => {
+          this.$emit('getTableValue', async (data) => {
+            resolve(await data);
           });
-        }
-      });
-    },
-
-    //更多
-    handleCommand(command) {
-      if (command === 'cancel') {
-        this.$confirm('是否确认作废?', {
-          type: 'warning',
-          cancelButtonText: '取消',
-          confirmButtonText: '确定'
-        })
-          .then(() => {
-            cancelTask({
-              id: this.id,
-              taskId: this.taskId,
-              reason: this.form.reason,
-              businessId: this.businessId
-            })
-              .then(() => {
-                this.$emit('handleClose');
-              })
-              .catch(() => {
-                this.$message.error('流程作废失败');
-              });
+        });
+      },
+      //更多
+      handleCommand(command) {
+        if (command === 'cancel') {
+          this.$confirm('是否确认作废?', {
+            type: 'warning',
+            cancelButtonText: '取消',
+            confirmButtonText: '确定'
           })
-          .catch(() => {});
+            .then(() => {
+              cancelTask({
+                id: this.id,
+                taskId: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
+        }
       }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss"></style>