Ver código fonte

jipiaoxiugai

liuhj 1 mês atrás
pai
commit
2d71a0ca8e

+ 208 - 1
package-lock.json

@@ -22,6 +22,8 @@
         "element-china-area-data": "^6.1.0",
         "element-ui": "^2.15.13",
         "github-markdown-css": "^5.8.1",
+        "html2canvas": "^1.4.1",
+        "jspdf": "^2.5.1",
         "mapkit-token": "^1.1.1",
         "mapkit-vue": "^0.0.1",
         "marked": "^4.3.0",
@@ -123,6 +125,15 @@
         "node": ">=6.0.0"
       }
     },
+    "node_modules/@babel/runtime": {
+      "version": "7.28.4",
+      "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.28.4.tgz",
+      "integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=6.9.0"
+      }
+    },
     "node_modules/@ckeditor/ckeditor5-adapter-ckfinder": {
       "version": "38.1.0",
       "resolved": "https://registry.npmjs.org/@ckeditor/ckeditor5-adapter-ckfinder/-/ckeditor5-adapter-ckfinder-38.1.0.tgz",
@@ -2249,6 +2260,13 @@
       "integrity": "sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ==",
       "dev": true
     },
+    "node_modules/@types/raf": {
+      "version": "3.4.3",
+      "resolved": "https://registry.npmmirror.com/@types/raf/-/raf-3.4.3.tgz",
+      "integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==",
+      "license": "MIT",
+      "optional": true
+    },
     "node_modules/@vue/compiler-sfc": {
       "version": "2.7.14",
       "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.14.tgz",
@@ -2769,7 +2787,6 @@
       "version": "2.1.2",
       "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
       "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
-      "dev": true,
       "bin": {
         "atob": "bin/atob.js"
       },
@@ -3688,6 +3705,15 @@
         "node": ">=0.10.0"
       }
     },
+    "node_modules/base64-arraybuffer": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
+      "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==",
+      "license": "MIT",
+      "engines": {
+        "node": ">= 0.6.0"
+      }
+    },
     "node_modules/base64-js": {
       "version": "1.5.1",
       "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -3983,6 +4009,18 @@
         "browserslist": "cli.js"
       }
     },
+    "node_modules/btoa": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmmirror.com/btoa/-/btoa-1.2.1.tgz",
+      "integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==",
+      "license": "(MIT OR Apache-2.0)",
+      "bin": {
+        "btoa": "bin/btoa.js"
+      },
+      "engines": {
+        "node": ">= 0.4.0"
+      }
+    },
     "node_modules/buffer": {
       "version": "4.9.2",
       "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
@@ -4198,6 +4236,45 @@
         }
       ]
     },
+    "node_modules/canvg": {
+      "version": "3.0.11",
+      "resolved": "https://registry.npmmirror.com/canvg/-/canvg-3.0.11.tgz",
+      "integrity": "sha512-5ON+q7jCTgMp9cjpu4Jo6XbvfYwSB2Ow3kzHKfIyJfaCAOHLbdKPQqGKgfED/R5B+3TFFfe8pegYA+b423SRyA==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "@babel/runtime": "^7.12.5",
+        "@types/raf": "^3.4.0",
+        "core-js": "^3.8.3",
+        "raf": "^3.4.1",
+        "regenerator-runtime": "^0.13.7",
+        "rgbcolor": "^1.0.1",
+        "stackblur-canvas": "^2.0.0",
+        "svg-pathdata": "^6.0.3"
+      },
+      "engines": {
+        "node": ">=10.0.0"
+      }
+    },
+    "node_modules/canvg/node_modules/core-js": {
+      "version": "3.46.0",
+      "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.46.0.tgz",
+      "integrity": "sha512-vDMm9B0xnqqZ8uSBpZ8sNtRtOdmfShrvT6h2TuQGLs0Is+cR0DYbj/KWP6ALVNbWPpqA/qPLoOuppJN07humpA==",
+      "hasInstallScript": true,
+      "license": "MIT",
+      "optional": true,
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/core-js"
+      }
+    },
+    "node_modules/canvg/node_modules/regenerator-runtime": {
+      "version": "0.13.11",
+      "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
+      "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
+      "license": "MIT",
+      "optional": true
+    },
     "node_modules/cardinal": {
       "version": "2.1.1",
       "resolved": "https://registry.npmmirror.com/cardinal/-/cardinal-2.1.1.tgz",
@@ -5541,6 +5618,15 @@
         "node": ">=0.10.0"
       }
     },
+    "node_modules/css-line-break": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmmirror.com/css-line-break/-/css-line-break-2.1.0.tgz",
+      "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==",
+      "license": "MIT",
+      "dependencies": {
+        "utrie": "^1.0.2"
+      }
+    },
     "node_modules/css-loader": {
       "version": "0.28.11",
       "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-0.28.11.tgz",
@@ -6955,6 +7041,13 @@
         "url": "https://github.com/fb55/domhandler?sponsor=1"
       }
     },
+    "node_modules/dompurify": {
+      "version": "2.5.8",
+      "resolved": "https://registry.npmmirror.com/dompurify/-/dompurify-2.5.8.tgz",
+      "integrity": "sha512-o1vSNgrmYMQObbSSvF/1brBYEQPHhV1+gsmrusO7/GXtp1T9rCS8cXFqVxK/9crT1jA6Ccv+5MTSjBNqr7Sovw==",
+      "license": "(MPL-2.0 OR Apache-2.0)",
+      "optional": true
+    },
     "node_modules/domutils": {
       "version": "2.8.0",
       "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
@@ -8057,6 +8150,12 @@
         "node": ">=0.4.0"
       }
     },
+    "node_modules/fflate": {
+      "version": "0.4.8",
+      "resolved": "https://registry.npmmirror.com/fflate/-/fflate-0.4.8.tgz",
+      "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==",
+      "license": "MIT"
+    },
     "node_modules/figures": {
       "version": "5.0.0",
       "resolved": "https://registry.npmmirror.com/figures/-/figures-5.0.0.tgz",
@@ -9106,6 +9205,19 @@
         "object-assign": "^4.0.1"
       }
     },
+    "node_modules/html2canvas": {
+      "version": "1.4.1",
+      "resolved": "https://registry.npmmirror.com/html2canvas/-/html2canvas-1.4.1.tgz",
+      "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==",
+      "license": "MIT",
+      "dependencies": {
+        "css-line-break": "^2.1.0",
+        "text-segmentation": "^1.0.3"
+      },
+      "engines": {
+        "node": ">=8.0.0"
+      }
+    },
     "node_modules/htmlparser2": {
       "version": "6.1.0",
       "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz",
@@ -10232,6 +10344,36 @@
         "node": ">=10"
       }
     },
+    "node_modules/jspdf": {
+      "version": "2.5.1",
+      "resolved": "https://registry.npmmirror.com/jspdf/-/jspdf-2.5.1.tgz",
+      "integrity": "sha512-hXObxz7ZqoyhxET78+XR34Xu2qFGrJJ2I2bE5w4SM8eFaFEkW2xcGRVUss360fYelwRSid/jT078kbNvmoW0QA==",
+      "license": "MIT",
+      "dependencies": {
+        "@babel/runtime": "^7.14.0",
+        "atob": "^2.1.2",
+        "btoa": "^1.2.1",
+        "fflate": "^0.4.8"
+      },
+      "optionalDependencies": {
+        "canvg": "^3.0.6",
+        "core-js": "^3.6.0",
+        "dompurify": "^2.2.0",
+        "html2canvas": "^1.0.0-rc.5"
+      }
+    },
+    "node_modules/jspdf/node_modules/core-js": {
+      "version": "3.46.0",
+      "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.46.0.tgz",
+      "integrity": "sha512-vDMm9B0xnqqZ8uSBpZ8sNtRtOdmfShrvT6h2TuQGLs0Is+cR0DYbj/KWP6ALVNbWPpqA/qPLoOuppJN07humpA==",
+      "hasInstallScript": true,
+      "license": "MIT",
+      "optional": true,
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/core-js"
+      }
+    },
     "node_modules/jwa": {
       "version": "1.4.1",
       "resolved": "https://registry.npmmirror.com/jwa/-/jwa-1.4.1.tgz",
@@ -15188,6 +15330,13 @@
         "node": ">=0.12"
       }
     },
+    "node_modules/performance-now": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz",
+      "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
+      "license": "MIT",
+      "optional": true
+    },
     "node_modules/picocolors": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
@@ -18281,6 +18430,16 @@
       "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-2.0.3.tgz",
       "integrity": "sha512-jLN68Dx5kyFHaePoXWPsCGW5qdyZQtLYHkxkg02/Mz6g0kYpDx4FyP6XfArhQdlOC4b8Mv+EMxPo/8La7Tzghg=="
     },
+    "node_modules/raf": {
+      "version": "3.4.1",
+      "resolved": "https://registry.npmmirror.com/raf/-/raf-3.4.1.tgz",
+      "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "performance-now": "^2.1.0"
+      }
+    },
     "node_modules/randombytes": {
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@@ -18796,6 +18955,16 @@
       "integrity": "sha512-zgn5OjNQXLUTdq8m17KdaicF6w89TZs8ZU8y0AYENIU6wG8GG6LLm0yLSiPY8DmaYmHdgRW8rnApjoT0fQRfMg==",
       "dev": true
     },
+    "node_modules/rgbcolor": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmmirror.com/rgbcolor/-/rgbcolor-1.0.1.tgz",
+      "integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==",
+      "license": "MIT OR SEE LICENSE IN FEEL-FREE.md",
+      "optional": true,
+      "engines": {
+        "node": ">= 0.8.15"
+      }
+    },
     "node_modules/right-align": {
       "version": "0.1.3",
       "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
@@ -20492,6 +20661,16 @@
       "deprecated": "Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility",
       "dev": true
     },
+    "node_modules/stackblur-canvas": {
+      "version": "2.7.0",
+      "resolved": "https://registry.npmmirror.com/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz",
+      "integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=0.1.14"
+      }
+    },
     "node_modules/stackframe": {
       "version": "1.3.4",
       "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz",
@@ -20978,6 +21157,16 @@
         "url": "https://github.com/sponsors/ljharb"
       }
     },
+    "node_modules/svg-pathdata": {
+      "version": "6.0.3",
+      "resolved": "https://registry.npmmirror.com/svg-pathdata/-/svg-pathdata-6.0.3.tgz",
+      "integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=12.0.0"
+      }
+    },
     "node_modules/svgo": {
       "version": "0.7.2",
       "resolved": "https://registry.npmjs.org/svgo/-/svgo-0.7.2.tgz",
@@ -21109,6 +21298,15 @@
         "url": "https://github.com/sponsors/sindresorhus"
       }
     },
+    "node_modules/text-segmentation": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmmirror.com/text-segmentation/-/text-segmentation-1.0.3.tgz",
+      "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==",
+      "license": "MIT",
+      "dependencies": {
+        "utrie": "^1.0.2"
+      }
+    },
     "node_modules/throttle-debounce": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz",
@@ -21847,6 +22045,15 @@
         "node": ">= 0.4.0"
       }
     },
+    "node_modules/utrie": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmmirror.com/utrie/-/utrie-1.0.2.tgz",
+      "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==",
+      "license": "MIT",
+      "dependencies": {
+        "base64-arraybuffer": "^1.0.2"
+      }
+    },
     "node_modules/uuid": {
       "version": "3.4.0",
       "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",

+ 2 - 0
package.json

@@ -24,6 +24,8 @@
     "element-china-area-data": "^6.1.0",
     "element-ui": "^2.15.13",
     "github-markdown-css": "^5.8.1",
+    "html2canvas": "^1.4.1",
+    "jspdf": "^2.5.1",
     "mapkit-token": "^1.1.1",
     "mapkit-vue": "^0.0.1",
     "marked": "^4.3.0",

+ 5 - 1
src/components/OP/OpAirTicketRes.vue

@@ -712,7 +712,9 @@ export default {
                     that.ticketClass = res.data.data.ticketClass;//舱位下拉框
                     that.payment = res.data.data.payment;//支付方式下拉框
                     that.cardType = res.data.data.cardType;//卡类型下拉框
-                    that.cardPaymentOpData.ctdId=that.cardType[0].id;
+                    if(that.cardPaymentOpData.ctdId==''){
+                        that.cardPaymentOpData.ctdId=that.cardType[0].id;
+                    }
                     that.cardPaymentOpData.bankNo=that.cardType[0].remark;
                     that.airTicketAgents = res.data.data.airTicketAgents//合作方资料下拉框
                     that.DiIdSelect = parseInt(that.DiId); //选中团组
@@ -1009,6 +1011,8 @@ export default {
                     } else {
                         that.cardPaymentOpData.ctdId = parseInt(creData.ctdId)
                     }
+                    console.log(that.cardPaymentOpData.ctdId);
+                    
                     that.cardPaymentOpData.orbitalPrivateTransfer = parseInt(creData.orbitalPrivateTransfer)
                 }
             })

+ 134 - 34
src/components/OP/performanceanalysis.vue

@@ -1,34 +1,42 @@
 <template>
-    <div class="performanceanalysis-all" element-loading-text="AI生成耗时较长请耐心等待" v-loading.fullscreen.lock="performanLoading">
+    <div class="performanceanalysis-all" element-loading-text="AI生成耗时较长请耐心等待"
+        v-loading.fullscreen.lock="performanLoading">
         <el-dialog width="900px" title="AI绩效分析" :visible.sync="AIVisible">
-            <div style="margin-bottom: 40px;" v-html="marktext" class="markdownyangshi markdown-body"></div>
-            <el-table  :data="SCgridData" border>
-                <el-table-column prop="rowNumber" label="序号" width="50">
-                </el-table-column>
-                <el-table-column prop="teamName" label="团组名">
-                </el-table-column>
-                <el-table-column prop="groupSales" label="营业额">
-                    <template slot-scope="scope">¥&nbsp;{{ scope.row.groupSales | townum }}</template>
-                </el-table-column>
-                <el-table-column prop="visitDate" label="出访日期" width="110">
-                    <template slot-scope="scope">{{ scope.row.visitDate | getvisitDate }}</template>
-                </el-table-column>
-                <el-table-column prop="visitPNumber" label="人数" width="50">
-                </el-table-column>
-                <el-table-column prop="collectionDays" label="收款日期" width="110">
-                    <template slot-scope="scope">{{ scope.row.collectionDays | getvisitDate }}</template>
-                </el-table-column>
-            </el-table>
-            <div  style="margin-top: 40px;" v-html="marktexts" class="markdownyangshi markdown-body"></div>
+            <div id="pdfDom">
+                <div style="margin-bottom: 40px;" v-html="marktext" class="markdownyangshi markdown-body"></div>
+                <el-table :data="SCgridData" border>
+                    <el-table-column prop="rowNumber" label="序号" width="50">
+                    </el-table-column>
+                    <el-table-column prop="teamName" label="团组名">
+                    </el-table-column>
+                    <el-table-column prop="groupSales" label="营业额">
+                        <template slot-scope="scope">¥&nbsp;{{ scope.row.groupSales | townum }}</template>
+                    </el-table-column>
+                    <el-table-column prop="visitDate" label="出访日期" width="110">
+                        <template slot-scope="scope">{{ scope.row.visitDate | getvisitDate }}</template>
+                    </el-table-column>
+                    <el-table-column prop="visitPNumber" label="人数" width="50">
+                    </el-table-column>
+                    <el-table-column prop="collectionDays" label="收款日期" width="110">
+                        <template slot-scope="scope">{{ scope.row.collectionDays | getvisitDate }}</template>
+                    </el-table-column>
+                </el-table>
+                <div style="margin-top: 40px;" v-html="marktexts" class="markdownyangshi markdown-body"></div>
+            </div>
+            <div style="text-align: right;margin-top: 15px;">
+                <el-button size="small" type="primary" @click="exportToPDF">导出为PDF</el-button>
+            </div>
         </el-dialog>
-        <div style="display: flex;justify-content: space-between;align-items: center;">
+        <div style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;">
             <div class="performanceanalysis-haed">
                 <div class="performanceanalysis-haed-li">
-                    <label>时间段选择:</label>
-                    <el-date-picker style="width:250px" size="small" v-model="datevalue" type="daterange" align="right"
+                    <label>月份选择:</label>
+                    <el-date-picker style="width:250px" size="small" v-model="months" type="month" placeholder="选择月">
+                    </el-date-picker>
+                    <!-- <el-date-picker style="width:250px" size="small" v-model="datevalue" type="daterange" align="right"
                         unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
                         :picker-options="pickerOptions">
-                    </el-date-picker>
+                    </el-date-picker> -->
                 </div>
                 <div class="performanceanalysis-haed-li">
                     <label>公司/岗位/用户:</label>
@@ -36,7 +44,7 @@
                 </div>
                 <div class="performanceanalysis-haed-li">
                     <el-button @click="sousuoccc" size="small" type="primary">搜索</el-button>
-                </div> 
+                </div>
             </div>
             <div>
                 <el-button size="small" type="primary">导出全年分析</el-button>
@@ -56,10 +64,11 @@
                 </el-table-column>
                 <el-table-column prop="workYears" label="工龄" width="100">
                 </el-table-column>
-                <el-table-column label="操作" width="250">
+                <el-table-column label="操作" width="350">
                     <template slot-scope="scope">
                         <el-button type="primary" @click="AiPerformanceAnalysis_GroupStatistics(scope.row)"
                             size="mini">生成AI分析</el-button>
+                        <el-button type="primary" size="mini">查看分析</el-button>
                         <el-button type="primary" @click="scope.row" size="mini">下载</el-button>
                     </template>
                 </el-table-column>
@@ -75,7 +84,8 @@
     </div>
 </template>
 <script>
-// import marked from 'marked'
+import html2canvas from 'html2canvas';
+import { jsPDF } from 'jspdf';
 import "github-markdown-css"
 export default {
     data () {
@@ -123,6 +133,7 @@ export default {
             AIVisible:false,
             SCgridData:[],
             performanLoading:false,
+            months:'',
             // position:'',
             // positionArr:[],
             // employeeName:'',
@@ -186,7 +197,16 @@ export default {
         },
         //市场不al分析接口
          AiPerformanceAnalysis_JobMarketing(val){
-            var url = "/api/PersonnelModule/AiPerformanceAnalysis_JobMarketing?userId="+val.id+"&start="+this.datetime(this.datevalue[0])+"&end="+this.datetime(this.datevalue[1])
+            var new_year = this.months.getFullYear()
+            var month = this.months.getMonth();
+            var new_month = month + 1;
+            var firstDay = new Date(new_year, new_month - 1, 1); 
+            var lastDay = new Date(new_year, new_month, 0).getDate();
+            var mon = (new_month < 10 ? '0' : '') + new_month;
+            var startDateDay = ('0' + firstDay.getDate()).slice(-2);
+            var startDate = new_year + '-' + mon + '-' + startDateDay;
+            var endDate = new_year + '-' + mon + '-' + lastDay; 
+            var url = "/api/PersonnelModule/AiPerformanceAnalysis_JobMarketing?userId="+val.id+"&start="+startDate+"&end="+endDate
             var that = this
             this.$axios({
                 method: 'get',
@@ -199,8 +219,8 @@ export default {
                     that.performanLoading=false;
                     that.AIVisible=true;
                     if (that.$marked && typeof that.$marked === 'function') {
-                        that.marktext = that.$marked(res.data.data.answer)
-                        that.marktexts = that.$marked(that.texehr + res.data.data.kaoqinAnswer)
+                        that.marktext = that.$marked(res.data.data.answer+that.texehr);
+                        that.marktexts = that.$marked(that.texehr + res.data.data.kaoqinAnswer);
                     }
                 }else{
                     that.performanLoading=false;
@@ -210,12 +230,21 @@ export default {
         },
         //获取chutuan
         AiPerformanceAnalysis_GroupStatistics(val){
-            if(this.datevalue==null){
-                this.$message.error('请选择时间段');
+            if(this.months==''){
+                this.$message.error('请选择月份!');
                 return
             }
             this.performanLoading=true;
-            var url = "/api/PersonnelModule/AiPerformanceAnalysis_GroupStatistics?userId="+val.id+"&start="+this.datetime(this.datevalue[0])+"&end="+this.datetime(this.datevalue[1])
+            var new_year = this.months.getFullYear()
+            var month = this.months.getMonth();
+            var new_month = month + 1;
+            var firstDay = new Date(new_year, new_month - 1, 1); 
+            var lastDay = new Date(new_year, new_month, 0).getDate();
+            var mon = (new_month < 10 ? '0' : '') + new_month;
+            var startDateDay = ('0' + firstDay.getDate()).slice(-2);
+            var startDate = new_year + '-' + mon + '-' + startDateDay;
+            var endDate = new_year + '-' + mon + '-' + lastDay; 
+            var url = "/api/PersonnelModule/AiPerformanceAnalysis_GroupStatistics?userId="+val.id+"&start="+startDate+"&end="+endDate
             var that = this
             this.$axios({
                 method: 'get',
@@ -240,6 +269,44 @@ export default {
                 }
             })
         },
+        async exportToPDF() {
+            try {
+                const element = document.getElementById('pdfDom');
+                const canvas = await html2canvas(element, {
+                    useCORS: true,
+                    scale: 4,
+                    // 可以尝试设置宽度和高度,确保捕获全部内容
+                    width: element.scrollWidth,
+                    height: element.scrollHeight
+                });
+
+                const imgData = canvas.toDataURL('image/jpeg', 1.0);
+                const pdf = new jsPDF('p', 'mm', 'a4');
+                const pageWidth = pdf.internal.pageSize.getWidth();
+                const pageHeight = pdf.internal.pageSize.getHeight();
+
+                const imgWidth = pageWidth;
+                const imgHeight = (canvas.height * imgWidth) / canvas.width;
+
+                // 计算需要多少页
+                const totalPages = Math.ceil(imgHeight / pageHeight);
+
+                // 第一页
+                pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight);
+
+                // 如果需要多页
+                for (let i = 1; i < totalPages; i++) {
+                    pdf.addPage();
+                    // 计算每一页的y坐标(负值表示向上移动)
+                    const yPosition = -(i * pageHeight);
+                    pdf.addImage(imgData, 'JPEG', 0, yPosition, imgWidth, imgHeight);
+                }
+
+                pdf.save('导出的页面.pdf');
+            } catch (error) {
+                console.error('生成PDF失败:', error);
+            }
+        }
     },
     mounted(){
         this.AiPerformanceAnalysis_UserList();
@@ -247,6 +314,40 @@ export default {
 }
 </script>
 <style>
+    /* 确保PDF内容区域样式正确 */
+    #pdfDom {
+        box-sizing: border-box;
+        width: 100%;
+        background: white;
+        padding: 20px;
+    }
+
+    /* 避免使用可能导致截断的样式 */
+    #pdfDom * {
+        box-sizing: border-box;
+        page-break-inside: avoid;
+    }
+
+    /* 确保文本不会超出容器 */
+    #pdfDom p,
+    #pdfDom div,
+    #pdfDom span {
+        word-wrap: break-word;
+        overflow-wrap: break-word;
+    }
+
+    /* 表格样式优化 */
+    #pdfDom table {
+        width: 100%;
+        border-collapse: collapse;
+    }
+
+    #pdfDom td,
+    #pdfDom th {
+        padding: 8px;
+        border: 1px solid #ddd;
+    }
+
     .performanceanalysis-all{
         background-color: #fff;
         padding: 10px;
@@ -260,7 +361,6 @@ export default {
     .performanceanalysis-haed{
         display: flex;
         align-items: center;
-        margin-bottom: 10px;
     }
     .performanceanalysis-haed-li{
         margin-right: 10px;

+ 10 - 0
src/main.js

@@ -102,3 +102,13 @@ new Vue({
   template: '<App/>'
 })
 
+
+// import htmlToPdf from './store/htmlToPdf.js';
+// import htmlToPdf from './store/htmlToPdf.js';
+// Vue.config.productionTip = false;
+
+// Vue.use(htmlToPdf);
+
+// new Vue({
+//   render: (h) => h(App),
+// }).$mount('#app');

+ 135 - 0
src/store/htmlToPdf.js

@@ -0,0 +1,135 @@
+// 页面导出为pdf格式 //title表示为下载的标题,html表示document.querySelector('#myPrintHtml')
+
+import html2Canvas from 'html2canvas'
+
+import JsPDF from 'jspdf'
+const htmlPdf = {
+  getPdf(title, html) {
+    html2Canvas(html, {
+      allowTaint: true,
+      useCORS: true,
+      dpi: window.devicePixelRatio * 4, // 将分辨率提高到特定的DPI 提高四倍
+      background: '#FFFFFF',
+    }).then(canvas => {
+      //未生成pdf的html页面高度
+      var leftHeight = canvas.height
+
+      var a4Width = 595.28
+      var a4Height = 841.89 //A4大小,210mm x 297mm,四边各保留10mm的边距,显示区域190x277
+      //一页pdf显示html页面生成的canvas高度;
+      var a4HeightRef = Math.floor((canvas.width / a4Width) * a4Height)
+
+      //pdf页面偏移
+      var position = 0
+
+      var pageData = canvas.toDataURL('image/jpeg', 1.0)
+
+      var pdf = new JsPDF('p', 'pt', 'a4') //A4纸,纵向
+      var index = 1,
+        canvas1 = document.createElement('canvas'),
+        height
+      pdf.setDisplayMode('fullwidth', 'continuous', 'FullScreen')
+
+      var pdfName = title
+
+      function createImpl(canvas) {
+        console.log(leftHeight, a4HeightRef)
+        if (leftHeight > 0) {
+          index++
+
+          var checkCount = 0
+          if (leftHeight > a4HeightRef) {
+            var i = position + a4HeightRef
+            for (i = position + a4HeightRef; i >= position; i--) {
+              var isWrite = true
+              for (var j = 0; j < canvas.width; j++) {
+                var c = canvas.getContext('2d').getImageData(j, i, 1, 1).data
+
+                if (c[0] != 0xff || c[1] != 0xff || c[2] != 0xff) {
+                  isWrite = false
+                  break
+                }
+              }
+              if (isWrite) {
+                checkCount++
+                if (checkCount >= 10) {
+                  break
+                }
+              } else {
+                checkCount = 0
+              }
+            }
+            height = Math.round(i - position) || Math.min(leftHeight, a4HeightRef)
+            if (height <= 0) {
+              height = a4HeightRef
+            }
+          } else {
+            height = leftHeight
+          }
+
+          canvas1.width = canvas.width
+          canvas1.height = height
+
+          console.log(index, 'height:', height, 'pos', position)
+
+          var ctx = canvas1.getContext('2d')
+          ctx.drawImage(
+            canvas,
+            0,
+            position,
+            canvas.width,
+            height,
+            0,
+            0,
+            canvas.width,
+            height,
+          )
+
+          var pageHeight = Math.round((a4Width / canvas.width) * height)
+          // pdf.setPageSize(null, pageHeight)
+          if (position != 0) {
+            pdf.addPage()
+          }
+          pdf.addImage(
+            canvas1.toDataURL('image/jpeg', 1.0),
+            'JPEG',
+            10,
+            10,
+            a4Width,
+            (a4Width / canvas1.width) * height,
+          )
+          leftHeight -= height
+          position += height
+          if (leftHeight > 0) {
+            setTimeout(createImpl, 500, canvas)
+          } else {
+            pdf.save(title + '.pdf')
+          }
+        }
+      }
+
+      //当内容未超过pdf一页显示的范围,无需分页
+      if (leftHeight < a4HeightRef) {
+        pdf.addImage(
+          pageData,
+          'JPEG',
+          0,
+          0,
+          a4Width,
+          (a4Width / canvas.width) * leftHeight,
+        )
+        pdf.save(title + '.pdf')
+      } else {
+        try {
+          pdf.deletePage(0)
+          setTimeout(createImpl, 500, canvas)
+        } catch (err) {
+          // console.log(err);
+        }
+      }
+    })
+
+  }
+}
+
+export default htmlPdf