Kaynağa Gözat

增删改添加2.0方法

zhaoke 1 yıl önce
ebeveyn
işleme
be074522d0
3 değiştirilmiş dosya ile 78 ekleme ve 23 silme
  1. 6 4
      public/config.js
  2. 55 3
      src/api/webApi.ts
  3. 17 16
      typings/global.d.ts

+ 6 - 4
public/config.js

@@ -5,7 +5,7 @@ var LOOP_INTERVAL = {
   waybill: 15 * 1000,
   goods: 15 * 1000,
   dashboard: 15 * 1000,
-}
+};
 
 var NEW_DATACONTENT_ID = [
   51000,
@@ -86,7 +86,7 @@ var NEW_DATACONTENT_ID = [
   12, //位置查询
   13, //预警报警场景维护
   15, //预警报警策略维护
-]
+];
 
 var DATACONTENT_ID = {
   /***-----登录------***/
@@ -404,7 +404,7 @@ var DATACONTENT_ID = {
   modeAgentbased: 51047, //基于代理人
   modeSpecialList: 51049, //特货明细
   modedeliverydetails: 51050, //拉货明细
-}
+};
 
 var SERVICE_ID = {
   /***-----账号管理------***/
@@ -440,4 +440,6 @@ var SERVICE_ID = {
 
   /***-----离港管理------***/
   departureScId: 8011, //发送报警预警日志信息
-}
+};
+
+var NEW_SERVICE_ID = [];

+ 55 - 3
src/api/webApi.ts

@@ -54,7 +54,32 @@ export async function htQuery(id, ...dataContent) {
   }
 }
 
+function NewGeneralDataReception(func: any) {
+  return func;
+}
+
 export function GeneralDataReception(params): Promise<CommonQueryResult> {
+  const { serviceId, dataContent } = params;
+  if (NEW_SERVICE_ID.includes(serviceId)) {
+    const newData = JSON.parse(dataContent);
+    const { event } = newData;
+    const eventType = event;
+    let key: any = null;
+    if (newData?.event) {
+      delete newData.event;
+    }
+    if (eventType == 2) {
+      for (const item in newData) {
+        if (item.includes("id") || item.includes("Id") || item.includes("ID")) {
+          key = item;
+        }
+      }
+      return NewGeneralDataReception(
+        dataToChange(serviceId, newData, eventType, key)
+      );
+    }
+    return NewGeneralDataReception(dataToChange(serviceId, newData, eventType));
+  }
   return request({
     url: "/openApi/generalDataReception",
     method: "post",
@@ -78,16 +103,43 @@ export async function dataToChange(
     };
     const { code, message } =
       event == 1
-        ? await newData(params)
+        ? await newData2(params)
         : event == 2
-        ? await modifyData(params)
-        : await moveData(params);
+        ? await modifyData2(params)
+        : await moveData2(params);
     return { code, message };
   } catch (error) {
     return { code: 1, message: error };
   }
 }
 
+//新增
+export function newData2(params) {
+  return request({
+    url: "/openApi/newdata",
+    method: "post",
+    data: params,
+  });
+}
+
+//修改
+export function modifyData2(params) {
+  return request({
+    url: "/openApi/modifydata",
+    method: "post",
+    data: params,
+  });
+}
+
+//删除movedata
+export function moveData2(params) {
+  return request({
+    url: "/openApi/movedata",
+    method: "post",
+    data: params,
+  });
+}
+
 //新增
 export function newData(params) {
   return request({

+ 17 - 16
typings/global.d.ts

@@ -1,21 +1,22 @@
 //global declare file
 //let  function  namespace  class ,module
 declare global {
-  declare let GLOBAL_let: Array<any>
-  declare let GLOBAL_STRING: string
-  declare let onlyOneChild: any
-  declare let GLOBAL_VAR: any
-  declare let defineOptions: any
-  declare let $ref: any
-  declare const PLATFROM_CONFIG: any
-  declare var LOOP_INTERVAL: any
-  declare var DATACONTENT_ID: any
-  declare var NEW_DATACONTENT_ID: any
-  declare var SERVICE_ID: any
-  declare var NODE_CODE: any
-  declare var MESSAGE_TYPE: any
-  declare var LOAD_WARNING_MAP: any
-  declare var HANDOVER_WARNING_MAP: any
+  declare let GLOBAL_let: Array<any>;
+  declare let GLOBAL_STRING: string;
+  declare let onlyOneChild: any;
+  declare let GLOBAL_VAR: any;
+  declare let defineOptions: any;
+  declare let $ref: any;
+  declare const PLATFROM_CONFIG: any;
+  declare var LOOP_INTERVAL: any;
+  declare var DATACONTENT_ID: any;
+  declare var NEW_DATACONTENT_ID: any;
+  declare var SERVICE_ID: any;
+  declare var NEW_SERVICE_ID: any;
+  declare var NODE_CODE: any;
+  declare var MESSAGE_TYPE: any;
+  declare var LOAD_WARNING_MAP: any;
+  declare var HANDOVER_WARNING_MAP: any;
 }
 
-export {}
+export {};