huangbin 4 yıl önce
ebeveyn
işleme
4a03dba28b

+ 48 - 45
src/common/methods/request/resultInfo.ts

@@ -88,28 +88,6 @@ export async function requestResultLoadingAndInfo(fn: any, param: any, loading:
             })
         }
     })
-
-
-    // try {
-    //     let result = await param ? fn(param) : fn()
-    //     if (!!result && (typeof result === 'object' || result === 'function') && typeof result.then === 'function') {
-    //         result = await result.then()
-    //     }
-    //     // result.then(res => {
-    //     //     console.log('rreeeeeee', res)
-    //     // })
-    //     console.log('请求结果:', result)
-    //     console.log('请求结果:', typeof result)
-    //     message.success(sucInfo)
-    //     loading.value = false;
-    //     return Promise.resolve(result);
-    // } catch (err) {
-    //     loading.value = false;
-    //     console.warn(`${fn}调用失败: ${err}`);
-    //     const temp = errInfo + err
-    //     message.error(temp)
-    //     return Promise.resolve(temp)
-    // }
 }
 
 /**
@@ -119,28 +97,53 @@ export async function requestResultLoadingAndInfo(fn: any, param: any, loading:
  * @param param
  * @returns
  */
-export async function queryResultLoadingAndInfo(fn: Function, loading: Ref<boolean>, param?: any) {
-    try {
-        const res = await param ? fn(param) : fn()
-        let result = res
-        if (Array.isArray(res)) {
-            // 列表数据需要一个key,要不然会报错,统一处理
-            result = res.map((e: any, i: number) => {
-                if (e.hasOwnProperty('key')) {
-                    return e
-                } else {
-                    return { ...e, key: String(i) };
-                }
-            })
-        }
-        console.log('查询数据成功:', result)
-        loading.value = false;
-        return Promise.resolve(result);
-    } catch (err) {
-        loading.value = false;
-        console.error('查询数据失败:', err)
-        message.error(err.message)
-        return Promise.resolve(err)
-    }
+export async function queryResultLoadingAndInfo(fn: Function, loading: Ref<boolean>, param?: any): Promise<any[]> {
+    loading.value = true;
+    return new Promise((resolve, reject) => {
+        const tempFN = param ? fn(param) : fn()
+        tempFN.then((res: any) => {
+            let result = res
+            if (Array.isArray(res)) {
+                // 列表数据需要一个key,要不然会报错,统一处理
+                result = res.map((e: any, i: number) => {
+                    if (e.hasOwnProperty('key')) {
+                        return e
+                    } else {
+                        return { ...e, key: String(i) };
+                    }
+                })
+            }
+            console.log('查询数据成功:', result)
+            loading.value = false;
+            resolve(result as any[]);
+        }).catch((err: { message: string }) => {
+            loading.value = false;
+            console.error('查询数据失败:', err)
+            message.error(err.message)
+            reject(err)
+        })
+    })
+    // try {
+    //     const res = await param ? fn(param) : fn()
+    //     let result = res
+    //     if (Array.isArray(res)) {
+    //         // 列表数据需要一个key,要不然会报错,统一处理
+    //         result = res.map((e: any, i: number) => {
+    //             if (e.hasOwnProperty('key')) {
+    //                 return e
+    //             } else {
+    //                 return { ...e, key: String(i) };
+    //             }
+    //         })
+    //     }
+    //     console.log('查询数据成功:', result)
+    //     loading.value = false;
+    //     return Promise.resolve(result);
+    // } catch (err) {
+    //     loading.value = false;
+    //     console.error('查询数据失败:', err)
+    //     message.error(err.message)
+    //     return Promise.resolve(err)
+    // }
 }
 

+ 7 - 3
src/views/market/spot_trade/components/buy-sell-market/components/delisting/setup.ts

@@ -51,9 +51,13 @@ export function handleSpotWarrant(enumName: EnumRouterName, buyOrSell: BuyOrSell
         if (isWR()) {
             queryResultLoadingAndInfo(queryHoldLB, loading).then(res => {
                 allWR.value = res;
-                wrHoldList.value = res.filter((e: WrHoldLB) => e.wrfactortypeid === String(selectedRow.wrfactortypeid)).map((e: WrHoldLB) => {
-                    const { wrholdeno, enableqty, ladingbillid, enumdicname, subnum } = e
-                    return { id: ladingbillid, name: `${wrholdeno}(${enableqty}${enumdicname})`, subnum }
+                wrHoldList.value.length = 0
+                res.forEach(e => {
+                    if (e.wrfactortypeid === String(selectedRow.wrfactortypeid)) {
+                        const { wrholdeno, enableqty, ladingbillid, enumdicname, subnum } = e
+                        const result = { id: ladingbillid, name: `${wrholdeno}(${enableqty}${enumdicname})`, subnum }
+                        wrHoldList.value.push(result)
+                    }
                 })
             })
         }

+ 7 - 3
src/views/market/spot_trade/components/buy-sell-market/components/financing_delisting/setup.ts

@@ -56,9 +56,13 @@ export function handleSpotWarrant(enumName: EnumRouterName, buyOrSell: BuyOrSell
         if (isWR()) {
             queryResultLoadingAndInfo(queryHoldLB, loading).then(res => {
                 allWR.value = res;
-                wrHoldList.value = res.filter((e: WrHoldLB) => e.wrfactortypeid === String(selectedRow.wrfactortypeid)).map((e: WrHoldLB) => {
-                    const { wrholdeno, enableqty, ladingbillid, enumdicname, subnum } = e
-                    return { id: ladingbillid, name: `${wrholdeno}(${enableqty}${enumdicname})`, subnum }
+                wrHoldList.value.length = 0
+                res.forEach(e => {
+                    if (e.wrfactortypeid === String(selectedRow.wrfactortypeid)) {
+                        const { wrholdeno, enableqty, ladingbillid, enumdicname, subnum } = e
+                        const result = { id: ladingbillid, name: `${wrholdeno}(${enableqty}${enumdicname})`, subnum }
+                        wrHoldList.value.push(result)
+                    }
                 })
             })
         }

+ 7 - 3
src/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_blocs/components/delisting/setup.ts

@@ -39,9 +39,13 @@ export function handleSpotWarrant(buyOrSell: BuyOrSell, selectedRow: QueryOrderQ
     if (buyOrSell === BuyOrSell.buy) {
         queryResultLoadingAndInfo(queryHoldLB, loading).then(res => {
             allWrHoldList.value = res
-            wrHoldList.value = res.filter((e: WrHoldLB) => e.wrfactortypeid === String(selectedRow.wrfactortypeid)).map((e: WrHoldLB) => {
-                const { wrholdeno, enableqty, ladingbillid, enumdicname, subnum } = e
-                return { id: ladingbillid, name: `${wrholdeno}(${enableqty}${enumdicname})`, subnum }
+            wrHoldList.value.length = 0
+            res.forEach(e => {
+                if (e.wrfactortypeid === String(selectedRow.wrfactortypeid)) {
+                    const { wrholdeno, enableqty, ladingbillid, enumdicname, subnum } = e
+                    const result = { id: ladingbillid, name: `${wrholdeno}(${enableqty}${enumdicname})`, subnum }
+                    wrHoldList.value.push(result)
+                }
             })
         })
     }

+ 7 - 3
src/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_blocs/components/delisting/setup.ts

@@ -41,9 +41,13 @@ export function handleSpotWarrant(buyOrSell: BuyOrSell, selectedRow: QueryOrderQ
     if (buyOrSell === BuyOrSell.buy) {
         queryResultLoadingAndInfo(queryHoldLB, loading).then(res => {
             allWrHoldList.value = res
-            wrHoldList.value = res.filter((e: WrHoldLB) => e.wrfactortypeid === String(selectedRow.wrfactortypeid)).map((e: WrHoldLB) => {
-                const { wrholdeno, enableqty, ladingbillid, enumdicname, subnum } = e
-                return { id: ladingbillid, name: `${wrholdeno}(${enableqty}${enumdicname})`, subnum }
+            wrHoldList.value.length = 0
+            res.forEach(el => {
+                if (el.wrfactortypeid === String(selectedRow.wrfactortypeid)) {
+                    const { wrholdeno, enableqty, ladingbillid, enumdicname, subnum } = el
+                    const result = { id: ladingbillid, name: `${wrholdeno}(${enableqty}${enumdicname})`, subnum }
+                    wrHoldList.value.push(result)
+                }
             })
         })
     }

+ 1 - 0
src/views/order/funding_information/components/funding_information_funding_summary/index.vue

@@ -123,6 +123,7 @@ export default defineComponent({
         // 签约银行
         const { hasSignBank } = useSignBank();
         function openComponentAction(item: BtnListType, record: Taaccount) {
+            debugger;
             if (hasSignBank()) {
                 openComponent(item, record);
             } else {