From bbae990ed1f4574fa954753faeae159052d03fba Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期二, 27 一月 2026 16:14:06 +0800
Subject: [PATCH] 待我审核增加销售订单,采购订单

---
 utils/common.js |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 106 insertions(+), 5 deletions(-)

diff --git a/utils/common.js b/utils/common.js
index b70b133..6905022 100644
--- a/utils/common.js
+++ b/utils/common.js
@@ -311,11 +311,10 @@
         data,
         method,
     }) {
-        if(this.requestLock){
-            console.warn("璇ヨ姹傝閿佸畾锛屽凡閫�鍑鸿姹�!")
+        if (this.requestLock) {
+            console.log("璇ヨ姹傝閿佸畾,涓嶈兘閲嶅璇锋眰!!!")
             return
         }
-        
         this.requestLock = true
         return new Promise((resolve, reject) => {
             // that = that || this;
@@ -341,6 +340,35 @@
             })
         })
     }
+	//娌℃湁娣诲姞閿佺殑寮傛鏌ヨ
+    async doRequest2Async({
+        url,
+        data,
+        method,
+    }) {
+        return new Promise((resolve, reject) => {
+            // that = that || this;
+            let errorTip = null;
+            uni.showLoading({
+                title: '鍔犺浇涓�...'
+            })
+            uni.request({
+                method: method || "GET",
+                url: this.serverUrl + url,
+                data: data || "",
+                success: (res) => {
+                    resolve(res)
+                },
+                fail: (err) => {
+                    reject(err)
+                },
+                complete: () => {
+                    uni.hideLoading()
+                }
+            })
+        })
+    }
+
     stringToBoolean(str) {
         // 蹇界暐澶у皬鍐欑殑杞崲
         return str?.toLowerCase() === "true";
@@ -364,9 +392,10 @@
             console.log(res.errCode);
         });
         innerAudioContext.onPause(function() {
-            console.log('鎾斁鍑虹幇閿欒锛岄攢姣�');
+            console.log('鎾斁鏆傚仠锛岄攢姣�');
             innerAudioContext.destroy();
-        })
+        });
+		
     }
     // playSound(e) {
     //     // 鍏ㄥ眬缁存姢涓�涓煶棰戝疄渚嬶紝闃叉缂撳瓨婧㈠嚭
@@ -400,6 +429,29 @@
     // }
 
 
+    showTips({
+        type,
+        message,
+        title,
+        duration
+    }) {
+        if (!message) {
+            return
+        }
+
+        if (message.length < 20) {
+            return uni.showToast({
+                icon: type || 'none',
+                title: message
+            })
+        }
+
+        return uni.showModal({
+            title: title,
+            content: message,
+            showCancel: false
+        })
+    }
 
     replaceWithFunction(str, handler) {
         return str.replace(/\{(.+?)\}/g, (match, key) => {
@@ -407,6 +459,55 @@
             return handler(key, match);
         });
     }
+    
+    fieldListFilterRole({FieldList, ExcludeKeys = [] ,RoleList = null}) {
+        if(!RoleList) {
+            RoleList = [
+                /^[a-zA-Z]+$/,
+                /id$/i
+            ]
+        }
+        if(!Array.isArray(RoleList)){
+            return {
+                status: false,
+                data: null,
+                Message: "杩囨护瀛楁鍒楄〃澶辫触锛岃鍒欏繀椤绘槸鏁扮粍銆�"
+            }
+        }
+        
+        let FieldListCache = Array(...FieldList)
+        
+        RoleList.forEach(role => {
+            FieldListCache = FieldListCache.filter(elem => !role.test(elem.ColmCols))
+        })
+        
+        FieldListCache = FieldListCache.filter(elem => !ExcludeKeys.includes(elem.ColmCols))
+        return {
+            status: true,
+            data: FieldListCache,
+            Message: ""
+        }
+    }
+    
+    emptyValueFilter(item, fieldList){
+        return fieldList.filter(e => {
+            return item[e.ColmCols]
+        })
+    }
+    
+    httpFormatWs(httpUrl=this.serverUrl) {
+        if(httpUrl.indexOf("http://") === 0){
+            httpUrl = httpUrl.replace("http://", "")
+            httpUrl = "ws://" + httpUrl.split(":")[0]+":8089/ws"
+        }else if(httpUrl.indexOf("https://") === 0) {
+            httpUrl = httpUrl.replace("https://", "")
+            httpUrl = "wss://" + httpUrl.split(":")[0]+":8089/ws"
+        }else{
+            // 鎻愮ず浼犲叆杩炴帴閿欒
+        }
+        
+        return httpUrl
+    }
 }
 
 export const CommonUtils = new commonUtils()
\ No newline at end of file

--
Gitblit v1.9.1