Browse Source

Merge branch 'master' into test-dev

duy 1 month ago
parent
commit
f4b08c509a

+ 1 - 1
package.json

@@ -25,7 +25,7 @@
         "dayjs": "^1.11.13",
         "echarts": "^5.5.1",
         "element-plus": "^2.8.7",
-        "hc-vue3-ui": "^4.9.1",
+        "hc-vue3-ui": "^4.9.3",
         "js-base64": "^3.7.7",
         "js-fast-way": "^0.5.7",
         "js-md5": "^0.8.3",

+ 10 - 0
src/api/modules/data-fill/query.js

@@ -235,4 +235,14 @@ export default {
             params: form,
         })
     },
+    //下载资料查询pdf文件
+
+    async downBussPdf(form) {
+        return HcApi({
+            url: '/api/blade-manager/exceltab/downBussPdf',
+            method: 'get',
+            params: form,
+            responseType: 'blob',
+        })
+    },
 }

+ 35 - 2
src/global/components/hc-pdfs/pdfs.vue

@@ -1,5 +1,13 @@
 <template>
-    <hc-pdf v-if="isPdfDom" :src="pdfUrl" :download="isDownload" :print="isPrint" :is-https="isHttps" :file-name="fileName" />
+    <hc-pdf 
+        v-if="isPdfDom" 
+        :src="pdfUrl" 
+        :download="isDownload" 
+        :print="isPrint" 
+        :is-https="isHttps" 
+        :file-name="fileName" 
+        @download-click="handleDownloadClick" 
+    />
 </template>
 
 <script setup>
@@ -7,6 +15,8 @@ import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
 import { btnAuth, decode } from '~uti/btn-auth'
 import { isNullES } from 'js-fast-way'
 import website from '~src/config'
+import { downloadBlob } from 'js-fast-way'
+import queryApi from '~api/data-fill/query'
 
 const props = defineProps({
     url: {
@@ -21,6 +31,10 @@ const props = defineProps({
         type: String,
         default: '',
     },
+    pdfId: {
+        type: [String, Number],
+        default: '',
+    },
 })
 
 defineOptions({
@@ -31,11 +45,13 @@ defineOptions({
 const queryUrl = ref(props.url)
 const queryCode = ref(props.code)
 const fileName = ref(props.fileName)
-watch(() => [props.url, props.code, props.fileName], ([url, code, name]) => {
+const pdfId = ref(props.pdfId)
+watch(() => [props.url, props.code, props.fileName, props.pdfId], ([url, code, name, idVal]) => {
  
     queryUrl.value = url
     queryCode.value = code
     fileName.value = name
+    pdfId.value = idVal
     setPdfSrcData()
 })
 
@@ -80,4 +96,21 @@ const setPdfSrcData = () => {
 onUnmounted(() => {
     isPdfDom.value = false
 })
+
+//下载按钮点击
+const downLoadTemplateLoading = ref(false)
+const handleDownloadClick = async ()=>{
+
+    
+    downLoadTemplateLoading.value = true
+    const { error, disposition, res, msg } = await queryApi.downBussPdf({ id: pdfId.value })
+    downLoadTemplateLoading.value = false
+    if (!error) {
+        if (disposition) {
+            downloadBlob(res, disposition)
+        } else {
+            window.$message?.error(msg || '数据异常')
+        }
+    }
+}
 </script>

+ 2 - 2
src/utils/btn-auth.js

@@ -19,7 +19,7 @@ export const btnAuth = (key) => {
 }
 
 // 跳转到PDF页面
-export const toPdfPage = (url, name) => {
+export const toPdfPage = (url, name, pdfId) => {
     if (isNullES(url)) {
         window.$message.warning('pdf地址为空')
         return
@@ -27,7 +27,7 @@ export const toPdfPage = (url, name) => {
     if (name) {
         fullDrawer({
             type: 'url',
-            content: '/#/pdf?code=' + encode(url) + '&fileName=' + name,
+            content: '/#/pdf?code=' + encode(url) + '&fileName=' + name + '&pdfId=' + pdfId,
         })
     } else {
         fullDrawer({

+ 3 - 1
src/views/data-fill/query.vue

@@ -797,7 +797,9 @@ const bussPreview = async (row) => {
 
     row.bussPreviewLoading = false
     if (!error && code === 200) {
-        toPdfPage(data, row.name)
+        // row.name会存在乱码,所以用id代替
+        toPdfPage(data, row.id, row.id)
+        // toPdfPage(data)
         //window.open(data, '_blank')
     } else {
         window.$message?.warning('获取PDF失败')

+ 7 - 2
src/views/home/pdf.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="hc-pdf-page-box">
-        <hc-pdfs :url="pdfUrl" :code="pdfCode" :file-name="pdfName" />
+        <hc-pdfs :pdf-id="pdfIdVal" :url="pdfUrl" :code="pdfCode" :file-name="pdfName" />
     </div>
 </template>
 
@@ -19,13 +19,18 @@ defineOptions({
 const pdfUrl = ref('')
 const pdfCode = ref('')
 const pdfName = ref('')
+const pdfIdVal = ref('')
 onMounted(() => {
 
     
-    const { url, code, fileName } = useRoutes.query
+    const { url, code, fileName, pdfId } = useRoutes.query
     pdfUrl.value = url
     pdfCode.value = code
     pdfName.value = fileName
+    pdfIdVal.value = pdfId
+
+    
+
 })
 </script>
 

+ 31 - 5
src/views/tasks/components/TableCard.vue

@@ -381,22 +381,48 @@ const batchApprovalTaskClick = () => {
     const pendingRows = rows.filter(row => row.estatus !== -1)
 
     if (pendingRows.length > 0) {
-       const pendingNames = pendingRows.map(row => row.taskName).join('')
+       const pendingNames = pendingRows.map(row => row.taskName).join('<br>')
         const warningMessage = `
-            存在以下已审批任务,不允许勾选------------\n
+            存在以下任务,不允许勾选:<br>
             ${pendingNames}
         `
-           window.$message?.warning(warningMessage)
+        
+        // 添加 customClass 并启用 HTML
+        window.$message.warning({
+            message: warningMessage,
+            customClass: 'custom-message-warning', // 自定义类名
+            dangerouslyUseHTMLString: true, // 允许 HTML 内容
+        })
         return
     }
     if (rows.length > 0) {
         emit('batchApproval', rows)
     } else {
-        window?.$message?.warning('请先勾选需要审批的数据')
+        window?.$notify?.warning('请先勾选需要审批的数据')
     }
 }
 </script>
 
-<style lang="scss" scoped>
+<style lang="scss">
+/* 复杂提示的样式 */
+.custom-message-warning {
+  --el-message-bg-color: #fff8e6; /* 背景色 */
+  --el-message-border-color: #ffe58f; /* 边框色 */
+  --el-message-text-color: #faad14; /* 文本色 */
+  max-width: 400px; /* 最大宽度 */
+}
 
+/* 复杂提示中的内容样式 */
+.custom-message-warning .el-message__content {
+  font-size: 14px;
+  line-height: 1.6;
+  padding: 10px 0;
+}
+
+/* 简单提示的样式 */
+.custom-message-simple {
+  --el-message-bg-color: #fef0f0;
+  --el-message-border-color: #fee2e2;
+  --el-message-text-color: #f53f3f;
+}
 </style>

+ 4 - 4
yarn.lock

@@ -2109,10 +2109,10 @@ has-flag@^4.0.0:
   resolved "http://219.151.181.73:9000/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
   integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
 
-hc-vue3-ui@^4.9.1:
-  version "4.9.1"
-  resolved "http://219.151.181.73:9000/hc-vue3-ui/-/hc-vue3-ui-4.9.1.tgz#5125ee1c3dc48cfcc3971adb051b2b8daf8d1a83"
-  integrity sha512-NGC0+tC3X14RAcyGD44VZh6JFThTGbzazWy1IaEkonl2orwmjv2hihYHG1IBUIrdz6SYQ4g5DDp3ZOl0gTzHGw==
+hc-vue3-ui@^4.9.3:
+  version "4.9.3"
+  resolved "http://219.151.181.73:9000/hc-vue3-ui/-/hc-vue3-ui-4.9.3.tgz#a34d605cbce5f0f65085a7d9f30dca1325407a16"
+  integrity sha512-U7ANZwAwVVMs96FMuRSLK/NX4Iig0e+Sx2x/H0Ehv7+7WhysFx51iDa8yF4J+gVJ0fiSSbQUAg4LTZ36CS7V0g==
   dependencies:
     axios "^1.7.7"
     dayjs "^1.11.13"