From 92cb62d60d38be56312be20cfae8638a5a9aa57a Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期日, 27 十月 2024 11:15:09 +0800
Subject: [PATCH] 计划任务优化

---
 src/api/tigerapi/system.ts |   40 +++++++++++++++++++++++-----------------
 1 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/api/tigerapi/system.ts b/src/api/tigerapi/system.ts
index e6a9a45..3dababe 100644
--- a/src/api/tigerapi/system.ts
+++ b/src/api/tigerapi/system.ts
@@ -67,6 +67,7 @@
   StopJob = '/Tsk/PauseJob',
   AddJob = '/Tsk/AddJob',
   UpdateJob = '/Tsk/UpdateJob',
+  SaveTskJob = '/Tsk/SaveTskJob',
   urlQueryEnum = '/Base/QueryEnum',
   DeleteWareHouse = '/WMS/DelWareHouseModel',
   AddLocation = '/WMS/AddLoctionModel',
@@ -134,7 +135,7 @@
 /*
  * 鐢熸垚Action
  */
-export function genAction<T>(datatype: string, data: T, option?: object) {
+export function genAction<T>(datatype: string, data: T, option?: object, NeedInclude?: boolean) {
   const time = new Date();
   const params: ApiAction<T> = {
     ID: buildUUID(),
@@ -148,6 +149,7 @@
     StatusCode: 0,
     Data: data,
     LocaleMsg: undefined,
+    NeedInclude: isNullOrEmpty(NeedInclude) ? false : NeedInclude,
   };
   return params;
 }
@@ -318,18 +320,18 @@
  */
 export function findParent(tree: any[], nodeId: string): any | undefined {
   for (const node of tree) {
-      if (node.children) {
-          for (const child of node.children) {
-              if (child.tid === nodeId) {
-                  return node;
-              }
-              // 閫掑綊鏌ユ壘瀛愭爲
-              const potentialParent = findParent(node.children, nodeId);
-              if (potentialParent) {
-                  return potentialParent;
-              }
-          }
+    if (node.children) {
+      for (const child of node.children) {
+        if (child.tid === nodeId) {
+          return node;
+        }
+        // 閫掑綊鏌ユ壘瀛愭爲
+        const potentialParent = findParent(node.children, nodeId);
+        if (potentialParent) {
+          return potentialParent;
+        }
       }
+    }
   }
   return undefined; // 娌℃湁鎵惧埌瀵瑰簲鐨勭埗浜茶妭鐐�
 }
@@ -753,6 +755,7 @@
           },
         },
     params['option'],
+    params['NeedInclude'],
   );
   return getListByPageAsync(rParams, params['apiUrl']); //濡傛灉涓嶆兂鐢ㄩ粯璁ょ殑鍩虹鏂规硶鑾峰彇鍒嗛〉鏁版嵁锛屽彲浠ユ崲鍏朵粬鐨刟pi
 }
@@ -790,15 +793,18 @@
       Keys[k] != 'option' &&
       Keys[k] != '0' &&
       Keys[k] != 'apiUrl' &&
+      Keys[k] != 'NeedInclude' &&
       !Keys[k].toString().endsWith('PSelect_0')
     ) {
-      if (!isNullOrEmpty(params[Keys[k]].length) && isTimeViaRegExp8601(params[Keys[k]][0])) {
-        sqlcmd += ` And ${Keys[k]} > '${params[Keys[k]][0]}'`;
-        sqlcmd += ` And ${Keys[k]} < '${params[Keys[k]][1]}'`;
+      if (!isNullOrEmpty(params[Keys[k]].length) && isArray(params[Keys[k]])) {
+        if (isTimeViaRegExp8601(params[Keys[k]][0])) {
+          sqlcmd += ` And ${Keys[k]} > '${params[Keys[k]][0]}'`;
+          sqlcmd += ` And ${Keys[k]} < '${params[Keys[k]][1]}'`;
+        } else {
+          sqlcmd += `And '${params[Keys[k]].join(',')}' like '%'+${Keys[k]}+'%'`;
+        }
       } else if (isNumber(params[Keys[k]])) {
         sqlcmd += `And ${Keys[k]} = ${params[Keys[k]]}`;
-      } else if (Keys[k] == 'sqlcmd') {
-        sqlcmd += ` And ${params[Keys[k]]}`;
       } else {
         sqlcmd += `And ${Keys[k]} like '%${params[Keys[k]]}%'`;
       }

--
Gitblit v1.9.3