Преглед изворни кода

材料计量单预览pdf修改

duy пре 1 година
родитељ
комит
ed2b26b93e

+ 17 - 2
src/views/debit-pay/material/components/order/dataModal.vue

@@ -104,7 +104,7 @@
                 </hc-card-item>
             </div>
         </div>
-        <HcUploadFile ref="HcUploadFileRef" @finish="HcUploadFileFinish" />
+        <HcUploadFile ref="HcUploadFileRef" @finish="HcUploadFileFinish" @success="uploadFileSuccess" />
     </hc-new-dialog>
 </template>
 
@@ -352,7 +352,11 @@ const HcUploadFileRef = ref(null)
 const HcUploadFileFinish = async (res) => {
  let arr = []
  res.forEach((ele)=>{
-    arr.push(ele.resData)
+    const { pdfUrl } = ele.resData
+    if (pdfUrl) {
+        arr.push(ele.resData)
+    }
+  
  })
  arr.forEach((ele)=>{
     ele.fileName = ele.originalName
@@ -365,6 +369,17 @@ fileName.value = baseForm.value.fileList
 
   HcUploadFileRef?.value.setModalShow(false)
 }
+
+// 文件上传成功的回调
+const uploadFileSuccess = ({ resData }) => {
+    const { pdfUrl } = resData
+    if (isNullES(pdfUrl)) {
+        window.$message.warning('该文件不能生成pdf,请更换文件上传')
+        HcUploadFileRef?.value.setModalShow(false)
+        return
+    }
+
+}
 //上传
 const formItemUpload = () => {
     HcUploadFileRef.value?.selectFile()

+ 18 - 2
src/views/debit-pay/start-work/components/order/dataModal.vue

@@ -31,7 +31,7 @@
                 </el-form>
             </hc-card-item>
         </el-scrollbar>
-        <HcUploadFile ref="HcUploadFileRef" @finish="HcUploadFileFinish" />
+        <HcUploadFile ref="HcUploadFileRef" @finish="HcUploadFileFinish" @success="uploadFileSuccess" />
     </hc-new-dialog>
 </template>
 
@@ -217,11 +217,16 @@ const formItemChange = (src, index, list)=>{
 }
 const HcUploadFileRef = ref(null)
 
+// 文件全部上传完成
 // 文件全部上传完成
 const HcUploadFileFinish = async (res) => {
  let arr = []
  res.forEach((ele)=>{
-    arr.push(ele.resData)
+    const { pdfUrl } = ele.resData
+    if (pdfUrl) {
+        arr.push(ele.resData)
+    }
+  
  })
  arr.forEach((ele)=>{
     ele.fileName = ele.originalName
@@ -234,6 +239,17 @@ fileName.value = baseForm.value.fileList
 
   HcUploadFileRef?.value.setModalShow(false)
 }
+
+// 文件上传成功的回调
+const uploadFileSuccess = ({ resData }) => {
+    const { pdfUrl } = resData
+    if (isNullES(pdfUrl)) {
+        window.$message.warning('该文件不能生成pdf,请更换文件上传')
+        HcUploadFileRef?.value.setModalShow(false)
+        return
+    }
+
+}
 </script>
 
 <style scoped lang="scss">