From 2abb91c893f2eed3761bd09aabe12400460d2863 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期五, 21 六月 2024 00:16:35 +0800
Subject: [PATCH] 产品工艺路线更新

---
 src/api/tigerapi/system.ts |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/api/tigerapi/system.ts b/src/api/tigerapi/system.ts
index 7d55e42..ae1367b 100644
--- a/src/api/tigerapi/system.ts
+++ b/src/api/tigerapi/system.ts
@@ -31,8 +31,7 @@
   iSYS_ROLE_PROD,
 } from './model/systemModel';
 import { defHttp } from '/@/utils/http/axios';
-import { isArray, isDate, isNullOrEmpty, isTimeType } from '/@/utils/is';
-import { MES_ROUTE_EDGE, MES_ROUTE_NODE } from './model/router';
+import { isArray, isDate, isNullOrEmpty, isTimeType, isTimeViaRegExp8601, isTimeViaRegExpSimple } from '/@/utils/is';
 
 export enum Api {
   QueryUrl = '/Base/Query',
@@ -281,9 +280,17 @@
   return result;
 }
 
-export function convertToTree(data: [], parentId: string, id: string, pid?: string) {
-  const result: any[] = [];
-  let temp: any[] = [];
+/**
+ * @description: 鏍戝舰琛ㄧ粨鏋勮浆鏍戝舰Json
+ * @param {T} data
+ * @param {string} parentId
+ * @param {string} id
+ * @param {string} pid
+ * @return {*}
+ */
+export function convertToTree<T>(data: T[], parentId: string, id: string, pid?: string) {
+  const result: T[] = [];
+  let temp: T[] = [];
   const _pid = isNullOrEmpty(pid) ? '' : pid;
   for (let i = 0; i < data.length; i++) {
     const currPid = data[i][parentId] == null ? '' : data[i][parentId];
@@ -712,7 +719,7 @@
       Keys[k] != '0' &&
       !Keys[k].toString().endsWith('PSelect_0')
     ) {
-      if (!isNullOrEmpty(params[Keys[k]].length) && isDate(params[Keys[k]][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]}'`;
       } else {
@@ -738,7 +745,7 @@
 }
 async function getListByPageAsync(params: any) {
   const data = await defHttp.post(
-    { url: Api.QueryUrl, params },
+    { url: Api.QueryUrl, params,timeout:30000 },
     {
       isTransformResponse: false,
     },
@@ -750,7 +757,7 @@
   return model;
 }
 
-export async function SaveEntity<T>(params: T, isUpdate: boolean, entityName: string) {
+export async function SaveEntity<T>(params: T, isUpdate: boolean, entityName: string, ...args) {
   let data;
   if (isUpdate) {
     data = await defHttp.post(
@@ -761,6 +768,12 @@
       },
     );
   } else {
+    var check = await isExist(genAction(entityName, args[0]));
+    if(check.Data){
+      check.IsSuccessed = false;
+      check.Message = '璁板綍宸茬粡瀛樺湪锛屼笉鑳芥柊澧烇紒';
+      return check;
+    }
     params.ID = buildUUID(); //鐢熸垚GUID
     data = await defHttp.post(
       { url: Api.AddEntity, params: genAction(entityName, params) },
@@ -894,7 +907,7 @@
 export function formatValues(values: any) {
   const Keys = Object.getOwnPropertyNames(values);
   for (const k in Keys) {
-    if(isArray(values[Keys[k]])){
+    if (isArray(values[Keys[k]])) {
       values[Keys[k]] = values[Keys[k]][0];
     }
   }

--
Gitblit v1.9.3