huangbin 4 년 전
부모
커밋
e432d3ee32

+ 2 - 0
src/common/methods/request/index.ts

@@ -0,0 +1,2 @@
+import { getRequestResultInfo } from './resultInfo'
+export { getRequestResultInfo }

+ 1 - 0
src/common/methods/request/interface.ts

@@ -0,0 +1 @@
+export type ResultInfo = [string, string]

+ 15 - 0
src/common/methods/request/resultInfo.ts

@@ -0,0 +1,15 @@
+import { ResultInfo } from './interface'
+/**
+ * 获取
+ * @param map 
+ * @param type 
+ * @returns 
+ */
+export function getRequestResultInfo(map: Map<number, ResultInfo>, type: number): ResultInfo {
+    if (map.has(type)) {
+        const result = map.get(type) as ResultInfo
+        return result
+    } else {
+        return ['成功', '失败']
+    }
+}

+ 5 - 9
src/views/information/spot-contract/components/setup.ts

@@ -1,12 +1,10 @@
+import { orderContract, spotContractStatus } from "@/services/proto/spotcontract";
 import {
     GldErmcpSpotContractOperateReq,
     GldSpotContractInfo,
     SpotContractOperateReq
 } from "@/services/proto/spotcontract/interface";
-import {orderContract, spotContractStatus} from "@/services/proto/spotcontract";
-import {ref} from "vue";
-import {getSelectedAccountId} from "@/services/bus/account";
-import * as Long from "long";
+import { ref } from "vue";
 
 /**
  * 合同操作相关
@@ -30,7 +28,7 @@ export function changeOrderContract() {
         let successText = "成功"
         let errorText = "失败"
 
-        switch (type){
+        switch (type) {
             case 1:
                 successText = "保存草稿成功"
                 errorText = "保存草稿失败:"
@@ -60,7 +58,7 @@ export function changeOrderContract() {
             })
     }
 
-    return {loading, orderContractState}
+    return { loading, orderContractState }
 }
 
 
@@ -106,7 +104,5 @@ export function OrderContractControl() {
             })
     }
 
-    return {loading, orderContractState}
+    return { loading, orderContractState }
 }
-
-