ws hai 1 ano
pai
achega
be44c118b1
Modificáronse 1 ficheiros con 20 adicións e 4 borrados
  1. 20 4
      chuanyi_client/src/utils/luckysheettool.js

+ 20 - 4
chuanyi_client/src/utils/luckysheettool.js

@@ -1,6 +1,7 @@
-import {showAlertWin, withDateFormatLength} from "@/utils/cqcy";
+import {getNowFormatDate, showAlertWin, withDateFormatLength} from "@/utils/cqcy";
 import { parseString } from "cron-parser";
 import html2canvas from "html2canvas";
+import {getUsername} from "@/utils/auth";
 
 function setCellSize(l, e, t, o) {
     const {
@@ -331,13 +332,13 @@ function calculateMinutes(time1, time2) {
 function changeValStr(str) {
     if (str) {
 		if ((str + "").startsWith("${")) {
-			return "";
+			return changeBaseVal(str + "");
 		} else {
 			if (str.v && str.v.startsWith("${")) {
-			    return "";
+			    return changeBaseVal(str.v);
 			} else  {
 			    if (JSON.stringify(str).startsWith("${")) {
-			        return "";
+			        return changeBaseVal(JSON.stringify(str));
 			    }
 			}
 		}
@@ -347,6 +348,21 @@ function changeValStr(str) {
     }
 }
 
+function changeBaseVal(str) {
+    if (str.indexOf('${currDate}') > -1) {
+        return getNowFormatDate('yyyy-MM-dd')
+    } else if (str.indexOf('${currDateTime}') > -1) {
+        console.log(str)
+        return getNowFormatDate('yyyy-MM-dd HH:mm:ss')
+    } else if (str.indexOf('${userName}') > -1) {
+        return getUsername()
+    } else if (str.indexOf('${winUserName}') > -1) {
+        return process.env.VUE_APP_WINNAME
+    } else {
+        return ""
+    }
+}
+
 function getLegendHeight(clazzw, data){
         var height =0;