From e4f79a7e36214e5836cb0e667b3ffbd3db45456d Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期二, 22 十月 2024 23:54:26 +0800
Subject: [PATCH] 工单变量删除优化,预览优化

---
 src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts |   10 +++++++++-
 src/views/components/GeneralCrudModal.vue                         |   41 ++++++++++++++++++++++++++++++++---------
 2 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/src/views/components/GeneralCrudModal.vue b/src/views/components/GeneralCrudModal.vue
index 97aa475..8a49781 100644
--- a/src/views/components/GeneralCrudModal.vue
+++ b/src/views/components/GeneralCrudModal.vue
@@ -38,7 +38,7 @@
   import { DeleteEntity, getListByPage, SaveEntity } from '/@/api/tigerapi/system';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { cloneDeep, isFunction } from 'lodash-es';
-  import { isNullOrUnDef } from '/@/utils/is';
+  import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
   import { CustModalParams } from '/@/api/tigerapi/model/systemModel';
   import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel';
 
@@ -111,7 +111,9 @@
     };
     // 鍙互浣跨敤createImgPreview杩斿洖鐨� PreviewActions 鏉ユ帶鍒堕瑙堥�昏緫锛屽疄鐜扮被浼煎够鐏墖銆佽嚜鍔ㄦ棆杞箣绫荤殑楠氭搷浣�
     createImgPreview({
-      imageList: [dataSource.filter((q) => q.WORK_ORDER == others.value.WORK_ORDER)[0].LABEL_VIEW_PATH],
+      imageList: [
+        dataSource.filter((q) => q.WORK_ORDER == others.value.WORK_ORDER)[0].LABEL_VIEW_PATH,
+      ],
       defaultWidth: 700,
       rememberState: true,
       onImgLoad,
@@ -162,14 +164,35 @@
    * @description: 鍒犻櫎琛�
    * @param {*} record
    * @return {*}
-   */  
+   */
   function handleDel(record: EditRecordRow) {
-    //鍒犻櫎
-    DeleteEntity(record, ctype.value).then((action) => {
-      if (action.IsSuccessed) {
-        reload();
-      }
-    });
+    if (!isNullOrEmpty(record.WORK_ORDER)) {
+      //鍒犻櫎
+      DeleteEntity(record, ctype.value).then((action) => {
+        if (action.IsSuccessed) {
+          try {
+            const data = cloneDeep(record.editValueRefs);
+            console.log(data);
+            //TODO 姝ゅ灏嗘暟鎹彁浜ょ粰鏈嶅姟鍣ㄤ繚瀛�
+            const [{ CustFunc }] = isNullOrUnDef(custImport.value['default'])
+              ? EntityCustFunction.value
+              : custImport.value['default']();
+            if (CustFunc && isFunction(CustFunc)) {
+              CustFunc({
+                others: others.value,
+                ctype: 'delete',
+                values: record,
+              });
+            }
+          } catch (error) {
+            msg.error({ content: t('鍒犻櫎澶辫触'), key: 'saving' });
+          }
+          reload();
+        }
+      });
+    }else{
+      msg.error({ content: t('娌℃湁闇�瑕佸垹闄ょ殑鍙橀噺'), key: 'saving' });
+    }
   }
 
   /**
diff --git a/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts
index 732d685..3bc1df4 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/WoRouteBinding.ts
@@ -4,7 +4,7 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-10-22 22:46:28
+ * @LastEditTime: 2024-10-22 23:36:24
  */
 
 import { Ref, h, ref, render, unref } from 'vue';
@@ -888,6 +888,14 @@
                   );
                 }
               }
+            case 'delete':
+              const webSocketStore = useWebSocketStore();
+              if (webSocketStore.GetSocketState == 1) {
+                webSocketStore.sendMessage(
+                  `wsGetNew ${param.values['LABEL_ID']}_#_${ param.values['WORK_ORDER']}`,
+                );
+              }
+            break;
           }
           resolve('OK');
         } catch (e) {

--
Gitblit v1.9.3