From dc63cd71100864be7486b2a4e947017e0880880e Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期二, 17 十二月 2024 22:39:37 +0800
Subject: [PATCH] 一些更新

---
 src/views/components/GeneralCrudModal.vue |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/views/components/GeneralCrudModal.vue b/src/views/components/GeneralCrudModal.vue
index 8a49781..3611598 100644
--- a/src/views/components/GeneralCrudModal.vue
+++ b/src/views/components/GeneralCrudModal.vue
@@ -110,10 +110,21 @@
       console.log(`绗�${index + 1}寮犲浘鐗囧凡鍔犺浇锛孶RL涓猴細${url}`, dom);
     };
     // 鍙互浣跨敤createImgPreview杩斿洖鐨� PreviewActions 鏉ユ帶鍒堕瑙堥�昏緫锛屽疄鐜扮被浼煎够鐏墖銆佽嚜鍔ㄦ棆杞箣绫荤殑楠氭搷浣�
+    const Keys = Object.getOwnPropertyNames(others.value);
+    let path = '';
+    dataSource.map((item) => {
+      for (const k in Keys) {
+        if (item[Keys[k]] == others.value[Keys[k]] && !isNullOrEmpty(others.value[Keys[k]])) {
+          path = item['LABEL_VIEW_PATH'];
+          return;
+        }
+      }
+    });
+    if(isNullOrEmpty(path)){
+      path = dataSource.filter((q) => isNullOrEmpty(q.WORK_ORDER) || isNullOrEmpty(q.PROD_CODE))[0].LABEL_VIEW_PATH;
+    }
     createImgPreview({
-      imageList: [
-        dataSource.filter((q) => q.WORK_ORDER == others.value.WORK_ORDER)[0].LABEL_VIEW_PATH,
-      ],
+      imageList: [path],
       defaultWidth: 700,
       rememberState: true,
       onImgLoad,
@@ -166,7 +177,7 @@
    * @return {*}
    */
   function handleDel(record: EditRecordRow) {
-    if (!isNullOrEmpty(record.WORK_ORDER)) {
+    if (!isNullOrEmpty(record.WORK_ORDER) || !isNullOrEmpty(record.PROD_CODE)) {
       //鍒犻櫎
       DeleteEntity(record, ctype.value).then((action) => {
         if (action.IsSuccessed) {
@@ -190,7 +201,7 @@
           reload();
         }
       });
-    }else{
+    } else {
       msg.error({ content: t('娌℃湁闇�瑕佸垹闄ょ殑鍙橀噺'), key: 'saving' });
     }
   }

--
Gitblit v1.9.3