From afa3bc1e2f39f66f59ee9b15d6af16593acdc9a4 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期六, 02 十二月 2023 10:38:27 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/common.js |  179 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 130 insertions(+), 49 deletions(-)

diff --git a/src/main/webapp/static/js/common.js b/src/main/webapp/static/js/common.js
index 34aca17..28bf7c3 100644
--- a/src/main/webapp/static/js/common.js
+++ b/src/main/webapp/static/js/common.js
@@ -54,6 +54,23 @@
     return y + "-" + M + "-" + d + " " + h + ":" + m + ":" + s;
 }
 
+// 鏃堕棿 ==>> 瀛楃涓�
+function dateToStr2(date) {
+    var time = new Date(date);
+    var y = time.getFullYear();
+    var M = time.getMonth() + 1;
+    M = M < 10 ? ("0" + M) : M;
+    var d = time.getDate();
+    d = d < 10 ? ("0" + d) : d;
+    var h = time.getHours();
+    h = h < 10 ? ("0" + h) : h;
+    var m = time.getMinutes();
+    m = m < 10 ? ("0" + m) : m;
+    var s = time.getSeconds();
+    s = s < 10 ? ("0" + s) : s;
+    return y + "" + "" + M + "" + d + "" + h + "" + "" + m + "" + s;
+}
+
 // 瀛楃涓� ===>> 鏃堕棿
 function strToDate(str) {
     var t = Date.parse(str);
@@ -202,6 +219,13 @@
     }) : "object" == typeof module && module.exports ? module.exports = http : n.http = http
 }(this);
 
+function requireTip(el) {
+    let oldBorderByCss = el.css("border");
+    el.css("border", "1px solid #FF5722");
+    setTimeout(function () {
+        el.css("border", oldBorderByCss);
+    }, 2000)
+}
 
 function arrRemove(arr, key, val) {
     for(var i=arr.length-1; i>=0; i--){
@@ -211,56 +235,113 @@
     }
 }
 
-var matCols = [
-    {field: 'matnr', align: 'center',title: '鍟嗗搧缂栧彿', width: 180}
-    ,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О', width: 200}
-    ,{field: 'name', align: 'center',title: '鍚嶇О', hide: true}
-    ,{field: 'specs', align: 'center',title: '瑙勬牸'}
-    ,{field: 'model', align: 'center',title: '鍨嬪彿', hide: true}
-    ,{field: 'unit', align: 'center',title: '鍗曚綅', hide: true}
-    ,{field: 'barcode', align: 'center',title: 'SKC',hide: true}
-    // ,{field: 'docId', align: 'center',title: '鍗曟嵁绫诲瀷', hide: true}
-    // ,{field: 'docNum', align: 'center',title: '鍗曟嵁缂栧彿', hide: true}
-    ,{field: 'custName', align: 'center',title: '瀹㈡埛鍚嶇О', hide: true}
-    ,{field: 'itemNum', align: 'center',title: '鍝侀」鏁�', hide: true}
-    ,{field: 'count', align: 'center',title: '鏁伴噺', hide: true}
-    ,{field: 'price', align: 'center',title: '鍗曚环'}
-    ,{field: 'weight', align: 'center',title: '閲嶉噺', hide: true}
-    // ,{field: 'status', align: 'center',title: '鐘舵��'}
-    // ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳'}
-    // ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
-    // ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳'}
-    // ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
-    ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
-]
-
-var detlCols = [
-    {field: 'matnr', align: 'center',title: '鍟嗗搧缂栧彿', width: 180}
-    ,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О', width: 200}
-    ,{field: 'anfme', align: 'center',title: '搴撳瓨鏁伴噺', style: 'font-weight: bold'}
-    ,{field: 'name', align: 'center',title: '鍚嶇О', hide: true}
-    ,{field: 'specs', align: 'center',title: '瑙勬牸'}
-    ,{field: 'model', align: 'center',title: '鍨嬪彿', hide: true}
-    ,{field: 'batch', align: 'center',title: '鎵瑰彿'}
-    ,{field: 'unit', align: 'center',title: '鍗曚綅', hide: true}
-    ,{field: 'barcode', align: 'center',title: 'SKC',hide: true}
-    ,{field: 'docId', align: 'center',title: '鍗曟嵁绫诲瀷', hide: true}
-    ,{field: 'docNum', align: 'center',title: '鍗曟嵁缂栧彿', hide: true}
-    ,{field: 'custName', align: 'center',title: '瀹㈡埛鍚嶇О', hide: true}
-    ,{field: 'itemNum', align: 'center',title: '鍝侀」鏁�', hide: true}
-    ,{field: 'count', align: 'center',title: '鏁伴噺', hide: true}
-    ,{field: 'price', align: 'center',title: '鍗曚环', hide: true}
-    ,{field: 'weight', align: 'center',title: '閲嶉噺', hide: true}
-    ,{field: 'zpallet', align: 'center',title: '鎵樼洏鐮�'}
-    // ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳'}
-    // ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
-    // ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳'}
-    // ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
-    ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
-]
-
-
 var popupRight;
 var cstmrByMore;
 var orderByMore;
 var planByMore;
+var priQuoteByMore;
+var reimburseOnlineByMore;
+
+function getQueryVariable(variable)
+{
+    var query = window.location.search.substring(1);
+    var vars = query.split("&");
+    for (var i=0;i<vars.length;i++) {
+        var pair = vars[i].split("=");
+        if(pair[0] == variable){return pair[1];}
+    }
+    return(false);
+}
+var businessTripByMore;
+var priOnlineByMore;
+var priSalesByMore;
+var priQuoteBudgetByMore;
+var contractByMore;
+
+
+function getOssClient() {
+    // const client = new OSS({
+    //     // yourRegion濉啓Bucket鎵�鍦ㄥ湴鍩熴�備互鍗庝笢1锛堟澀宸烇級涓轰緥锛寉ourRegion濉啓涓簅ss-cn-hangzhou銆�
+    //     region: "",
+    //     // 浠嶴TS鏈嶅姟鑾峰彇鐨勪复鏃惰闂瘑閽ワ紙AccessKey ID鍜孉ccessKey Secret锛夈��
+    //     accessKeyId: "",
+    //     accessKeySecret: "",
+    //     // 浠嶴TS鏈嶅姟鑾峰彇鐨勫畨鍏ㄤ护鐗岋紙SecurityToken锛夈��
+    //     // stsToken: "yourSecurityToken",
+    //     // 濉啓Bucket鍚嶇О銆�
+    //     bucket: "",
+    // });
+
+    let data
+    $.ajax({
+        url: baseUrl + "/open/getOssClient",
+        headers: {'token': localStorage.getItem('token')},
+        data: {},
+        method: 'POST',
+        async: false,
+        success: function (res) {
+            if (res.code === 200){
+                data = res.data;
+            }
+        }
+    });
+    return new OSS(data);
+}
+
+//涓婁紶鏂囦欢鑷砄SS
+async function putObject(file, uploadProgress) {
+    var client = getOssClient()
+    if (client == null) {
+        return false;
+    }
+
+    var filename = dateToStr2(new Date()) + "_" + file.name
+
+    // // 濉啓Object瀹屾暣璺緞銆侽bject瀹屾暣璺緞涓笉鑳藉寘鍚獴ucket鍚嶇О銆�
+    // // 鎮ㄥ彲浠ラ�氳繃鑷畾涔夋枃浠跺悕锛堜緥濡俥xampleobject.txt锛夋垨鏂囦欢瀹屾暣璺緞锛堜緥濡俥xampledir/exampleobject.txt锛夌殑褰㈠紡瀹炵幇灏嗘暟鎹笂浼犲埌褰撳墠Bucket鎴朆ucket涓殑鎸囧畾鐩綍銆�
+    // // data瀵硅薄鍙互鑷畾涔変负file瀵硅薄銆丅lob鏁版嵁鎴栬�匫SS Buffer銆�
+    // const options = {
+    //     meta: {temp: "demo"},
+    //     mime: "json",
+    //     headers: {"Content-Type": "text/plain"},
+    // };
+    //
+    // return await client.put(filename, file, options);
+
+    const options = {
+        // 鑾峰彇鍒嗙墖涓婁紶杩涘害銆佹柇鐐瑰拰杩斿洖鍊笺��
+        progress: (p, cpt, res) => {
+            // console.log(p);
+            uploadProgress(p)//鍥炶皟涓婁紶杩涘害
+        },
+        // 璁剧疆骞跺彂涓婁紶鐨勫垎鐗囨暟閲忋��
+        parallel: 4,
+        // 璁剧疆鍒嗙墖澶у皬銆傞粯璁ゅ�间负1 MB锛屾渶灏忓�间负100 KB銆�
+        partSize: 1024 * 1024,
+        // headers,
+        // 鑷畾涔夊厓鏁版嵁锛岄�氳繃HeadObject鎺ュ彛鍙互鑾峰彇Object鐨勫厓鏁版嵁銆�
+        meta: {year: 2020, people: "test"},
+        mime: "text/plain",
+    };
+
+    return await client.multipartUpload(filename, file, {...options});
+}
+
+//鑾峰彇OSS鏂囦欢URL
+function getObjectUrl(filepath) {
+    var client = getOssClient()
+    if (client == null) {
+        return null;
+    }
+    const domain = filepath.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n]+)/im)[0] + "/";//鍩熷悕閮ㄥ垎
+    // 閰嶇疆鍝嶅簲澶村疄鐜伴�氳繃URL璁块棶鏃惰嚜鍔ㄤ笅杞芥枃浠讹紝骞惰缃笅杞藉悗鐨勬枃浠跺悕銆�
+    const filename = filepath.split(domain)[1];
+    const response = {
+        "content-disposition": `attachment; filename=${encodeURIComponent(
+            filename
+        )}`,
+    };
+    // 濉啓Object瀹屾暣璺緞銆侽bject瀹屾暣璺緞涓笉鑳藉寘鍚獴ucket鍚嶇О銆�
+    const url = client.signatureUrl(filename,{response});
+    return url;
+}
\ No newline at end of file

--
Gitblit v1.9.1