Browse Source

更新依赖

caner 1 year ago
parent
commit
46bb917aef

+ 0 - 1
.eslintignore

@@ -1 +0,0 @@
-audio-pusher.ts

+ 16 - 13
package.json

@@ -9,26 +9,29 @@
     "preview": "vite preview"
     "preview": "vite preview"
   },
   },
   "dependencies": {
   "dependencies": {
-    "naive-ui": "^2.35.0",
+    "html2canvas": "^1.4.1",
+    "jspdf": "^2.5.1",
+    "naive-ui": "^2.38.2",
     "pinia": "^2.1.7",
     "pinia": "^2.1.7",
     "pinia-plugin-persist": "^1.0.0",
     "pinia-plugin-persist": "^1.0.0",
-    "vue": "^3.3.11",
-    "vue-router": "^4.2.5"
+    "vue": "^3.4.31",
+    "vue-router": "^4.4.0",
+    "xlsx": "^0.18.5"
   },
   },
   "devDependencies": {
   "devDependencies": {
     "@types/node": "^20.10.4",
     "@types/node": "^20.10.4",
-    "@typescript-eslint/parser": "^6.14.0",
-    "@vitejs/plugin-vue": "^4.5.2",
-    "eslint": "^8.55.0",
+    "@typescript-eslint/parser": "^7.16.0",
+    "@vitejs/plugin-vue": "^5.0.5",
+    "eslint": "^8.57.0",
     "eslint-config-airbnb-base": "^15.0.0",
     "eslint-config-airbnb-base": "^15.0.0",
-    "eslint-plugin-import": "^2.29.0",
-    "eslint-plugin-vue": "^9.19.2",
-    "sass": "^1.69.3",
-    "typescript": "^5.3.3",
-    "vite": "^5.0.8",
+    "eslint-plugin-import": "^2.29.1",
+    "eslint-plugin-vue": "^9.27.0",
+    "sass": "^1.77.8",
+    "typescript": "^5.5.3",
+    "vite": "^5.3.3",
     "vite-plugin-compression": "^0.5.1",
     "vite-plugin-compression": "^0.5.1",
-    "vite-plugin-eslint": "^1.8.0",
+    "vite-plugin-eslint": "^1.8.1",
     "vite-plugin-svg-icons": "^2.0.1",
     "vite-plugin-svg-icons": "^2.0.1",
-    "vue-tsc": "^1.8.25"
+    "vue-tsc": "^2.0.26"
   }
   }
 }
 }

+ 8 - 8
src/services/export2file.ts → src/services/exportFile.ts

@@ -1,6 +1,5 @@
 import html2canvas from "html2canvas";
 import html2canvas from "html2canvas";
 import JSPDF from "jspdf";
 import JSPDF from "jspdf";
-import { downloadFile } from "./downloadFile";
 import * as XLSX from 'xlsx'
 import * as XLSX from 'xlsx'
 
 
 /**
 /**
@@ -78,8 +77,8 @@ export const exp2png = async (domID: string, fileName: string, bkcolor: string)
         height: imgHeight,
         height: imgHeight,
         imageTimeout: 5000 // 设置图片的超时,设置0为禁用
         imageTimeout: 5000 // 设置图片的超时,设置0为禁用
     })
     })
-    const imgURL = canvas.toDataURL('image/png') as any
-    downloadFile(imgURL,fileName)
+    const imgURL = canvas.toDataURL('image/png')
+    return imgURL
     // loading
     // loading
 }
 }
 
 
@@ -126,7 +125,7 @@ export const dom2excel = (domID: string, fileName: string) => {
         return buf
         return buf
     }
     }
     const blob = new Blob([s2ab(baty)], { type: 'application/octet-stream' })
     const blob = new Blob([s2ab(baty)], { type: 'application/octet-stream' })
-    downloadFile(blob, fileName + '.xlsx')
+    return blob
 }
 }
 
 
 /**
 /**
@@ -134,17 +133,17 @@ export const dom2excel = (domID: string, fileName: string) => {
  * @param arr 数据是数组包含的对象
  * @param arr 数据是数组包含的对象
  * @param fileName 名字
  * @param fileName 名字
  */
  */
-export const exp2excel = (arr: object[], fileName:string,cellMerges?:Array<any>) => {
+export const exp2excel = (arr: object[], fileName: string, cellMerges?: Array<any>) => {
     const sheet = XLSX.utils.json_to_sheet(arr);
     const sheet = XLSX.utils.json_to_sheet(arr);
     // excel宽高设置
     // excel宽高设置
     sheet["!cols"] = arr.map(() => {
     sheet["!cols"] = arr.map(() => {
         return { wch: 30 }
         return { wch: 30 }
     })
     })
-    if(cellMerges){
+    if (cellMerges) {
         sheet['!merges'] = cellMerges; // <====合并单元格
         sheet['!merges'] = cellMerges; // <====合并单元格
     }
     }
     // 转blob
     // 转blob
-    const sheet2blob = (sheet: any, sheetName='sheet1') => {
+    const sheet2blob = (sheet: any, sheetName = 'sheet1') => {
         const workbook = {
         const workbook = {
             SheetNames: [sheetName],
             SheetNames: [sheetName],
             Sheets: {} as any
             Sheets: {} as any
@@ -168,5 +167,6 @@ export const exp2excel = (arr: object[], fileName:string,cellMerges?:Array<any>)
 
 
         return blob;
         return blob;
     }
     }
-    downloadFile(sheet2blob(sheet), fileName + '.xlsx')
+
+    return sheet2blob(sheet)
 }
 }

+ 8 - 8
src/services/laglat2gauss.ts

@@ -1,17 +1,17 @@
 // 大地坐标与经纬度坐标互转
 // 大地坐标与经纬度坐标互转
 
 
 
 
-function GaussToBL(X,Y){
+function GaussToBL(X: number,Y: number){
     let ProjNo;
     let ProjNo;
-    let ZoneWide; 带宽
+    let ZoneWide; //带宽
     let output = new Array(2);
     let output = new Array(2);
     let longitude1,latitude1, longitude0, X0,Y0, xval,yval;//latitude0,
     let longitude1,latitude1, longitude0, X0,Y0, xval,yval;//latitude0,
     let e1,e2,f,a, ee, NN, T,C, M, D,R,u,fai, iPI;
     let e1,e2,f,a, ee, NN, T,C, M, D,R,u,fai, iPI;
     iPI = 3.14159265358979324/180.0; 3.1415926535898/180.0;
     iPI = 3.14159265358979324/180.0; 3.1415926535898/180.0;
     // a = 6378245.0; f = 1.0/298.3; //54年北京坐标系参数
     // a = 6378245.0; f = 1.0/298.3; //54年北京坐标系参数
     a=6378140.0; f=1.0/298.257; //80年西安坐标系参数
     a=6378140.0; f=1.0/298.257; //80年西安坐标系参数
-    ZoneWide = 6; 6度带宽
-    ProjNo = parseInt(X/1000000) ; //查找带号
+    ZoneWide = 6; //6度带宽
+    ProjNo = Math.floor(X/1000000) ; //查找带号
     longitude0 = (ProjNo-1) * ZoneWide + ZoneWide / 2;
     longitude0 = (ProjNo-1) * ZoneWide + ZoneWide / 2;
     longitude0 = longitude0 * iPI ; //中央经线
     longitude0 = longitude0 * iPI ; //中央经线
 
 
@@ -44,17 +44,17 @@ function GaussToBL(X,Y){
 }
 }
 
 
 //经纬度=>高斯投影
 //经纬度=>高斯投影
-function BLToGauss(longitude, latitude){
+function BLToGauss(longitude: number, latitude: number){
     let ProjNo=0;
     let ProjNo=0;
-    let ZoneWide; 带宽
+    let ZoneWide; //带宽
     let ret=Array(2);
     let ret=Array(2);
     let longitude1,latitude1, longitude0,latitude0, X0,Y0, xval,yval;
     let longitude1,latitude1, longitude0,latitude0, X0,Y0, xval,yval;
     let a,f, e2,ee, NN, T,C,A, M, iPI;
     let a,f, e2,ee, NN, T,C,A, M, iPI;
     iPI = 0.0174532925199433; 3.1415926535898/180.0;
     iPI = 0.0174532925199433; 3.1415926535898/180.0;
-    ZoneWide = 6; 6度带宽
+    ZoneWide = 6; //6度带宽
     // a=6378245.0; f=1.0/298.3; //54年北京坐标系参数
     // a=6378245.0; f=1.0/298.3; //54年北京坐标系参数
     a=6378140.0; f=1/298.257; //80年西安坐标系参数
     a=6378140.0; f=1/298.257; //80年西安坐标系参数
-    ProjNo = parseInt(longitude / ZoneWide) ;
+    ProjNo = Math.floor(longitude / ZoneWide) ;
     longitude0 = ProjNo * ZoneWide + ZoneWide / 2;
     longitude0 = ProjNo * ZoneWide + ZoneWide / 2;
     longitude0 = longitude0 * iPI ;
     longitude0 = longitude0 * iPI ;
     latitude0 = 0;
     latitude0 = 0;

+ 2 - 2
src/services/net.service.ts

@@ -75,8 +75,8 @@ export default class NetService extends Service {
         fetch(url).then((res) => res.blob()).then((blob) => download(blob, fileName)).finally(() => resolve())
         fetch(url).then((res) => res.blob()).then((blob) => download(blob, fileName)).finally(() => resolve())
       }
       }
     })
     })
-  }  
-  
+  }
+
   /** token 续期 */
   /** token 续期 */
   async refresh(token: string) {
   async refresh(token: string) {
     this.post('', { token }).then((res) => {
     this.post('', { token }).then((res) => {

+ 37 - 0
src/services/registerMenu.ts

@@ -0,0 +1,37 @@
+import { Boot } from '@wangeditor/editor'
+import { exp2pdf } from './exportFile'
+console.warn('此插件注册富文本自定义按钮')
+// 注册一个保存按钮
+class SaveBtn {
+    title = ''
+    iconSvg = ''
+    tag = ''
+    constructor() {
+        this.title = '导出PDF'
+        this.iconSvg = '<svg viewBox="0 0 1024 1024" style="width:22px;height:22px;" version="1.1" xmlns="http://www.w3.org/2000/svg" ><path d="M773.696 134.812444l-509.155556 0c-69.76 0-126.520889 56.760889-126.520889 126.542222l0 501.326222c0 69.781333 56.760889 126.499556 126.520889 126.499556l509.141333 0c69.781333 0 126.520889-56.718222 126.520889-126.499556L900.202667 261.361778C900.202667 191.573333 843.441778 134.833778 773.696 134.812444zM324.437333 184.213333l389.347556 0 0 279.608889L324.437333 463.822222 324.437333 184.213333zM850.872889 762.680889c0 42.552889-34.616889 77.191111-77.169778 77.191111l-509.155556 0c-42.552889 0-77.169778-34.638222-77.169778-77.191111L187.377778 261.383111c0-42.574222 34.616889-77.169778 77.169778-77.169778l0-0.021333 10.567111 0 0 329.009778 488.007111 0 0.021333 0L763.143111 184.184889l10.567111 0c42.56 0 77.169778 34.595556 77.169778 77.169778L850.88 762.680889zM591.772444 256.832l49.329778 0 0 164.522667-49.329778 0 0-164.522667ZM591.772444 256.832"></path></svg>'
+        this.tag = 'button'
+    }
+
+    getValue() {
+        return ''
+    }
+
+    isActive() {
+        return false
+    }
+
+    isDisabled() {
+        return false
+    }
+
+    exec() {
+        exp2pdf('exportPDF', '测试' + new Date().toLocaleDateString())
+        console.log('导出');
+    }
+}
+Boot.registerMenu({
+    key: 'SaveBtn',
+    factory() {
+        return new SaveBtn()
+    }
+})

+ 0 - 1
vite.config.ts

@@ -34,7 +34,6 @@ export default ({ mode }) => {
       port: 6888,
       port: 6888,
       open: true,
       open: true,
       strictPort: false,
       strictPort: false,
-      https: false,
       // proxy: {
       // proxy: {
       //   '/api': {
       //   '/api': {
       //     target: env.VITE_PROXY_URL,
       //     target: env.VITE_PROXY_URL,