From 5fdea06fbfc49a8ae8f20054db6b27fcf4ade75f Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 04 七月 2024 00:34:19 +0800
Subject: [PATCH] 一些更新

---
 src/views/tigerprojects/system/lowcode/data.ts |  287 ++++++++++++++------------------------------------------
 1 files changed, 73 insertions(+), 214 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/data.ts b/src/views/tigerprojects/system/lowcode/data.ts
index d3863c8..8438128 100644
--- a/src/views/tigerprojects/system/lowcode/data.ts
+++ b/src/views/tigerprojects/system/lowcode/data.ts
@@ -1,68 +1,28 @@
 /*
- *                                                     __----~~~~~~~~~~~------___
- *                                    .  .   ~~//====......          __--~ ~~
- *                    -.            \_|//     |||\\  ~~~~~~::::... /~
- *                 ___-==_       _-~o~  \/    |||  \\            _/~~-
- *         __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
- *     _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
- *   .~       .~       |   \\ -_    /  /-   /   ||      \   /
- *  /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
- *  |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
- *           '         ~-|      /|    |-~\~~       __--~~
- *                       |-~~-_/ |    |   ~\_   _-~            /\
- *                            /  \     \__   \/~                \__
- *                        _--~ _/ | .-~~____--~-/                  ~~==.
- *                       ((->/~   '.|||' -_|    ~~-/ ,              . _||
- *                                  -_     ~\      ~~---l__i__i__i--~~_/
- *                                  _-~-__   ~)  \--______________--~~
- *                                //.-~~~-~_--~- |-------~~~~~~~~
- *                                       //.-~~~--\
- *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- *                               绁炲吔淇濅綉            姘告棤BUG
- */
-
-/*
  * @Description: 閫氱敤浣庝唬鐮佸憟鐜伴〉闈富鏁版嵁
  * @Author: Ben Lin
  * @version:
  * @Date: 2024-06-02 17:52:35
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-06-14 09:08:11
+ * @LastEditTime: 2024-07-03 20:19:37
  */
 
-import {
-  baseSchema,
-  searchSchema,
-  defectBaseColumn,
-  crudSchema,
-} from './normal/basDefectGrp';
-import {
-  onChangeFns,
-  rsnBaseSchema,
-  rsnCrudSchema,
-  rsnSearchSchema,
-  rsnBaseColumn,
-} from './normal/basReasonGrp';
-import { DeleteEntity, convertToTree, getEntity } from '/@/api/tigerapi/system';
-import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table';
+import { ActionItem, FormSchema } from '/@/components/Table';
 import { useI18n } from '/@/hooks/web/useI18n';
 import { isNullOrEmpty } from '/@/utils/is';
 import { woCustFn, woformSchema } from '/@/views/components/bizMesWo';
 import { useModal } from '/@/components/Modal';
-import {
-  pkgBaseColumn,
-  pkgBaseSchema,
-  pkgCrudSchema,
-  pkgSearchSchema,
-} from './basPkgrule';
-import { GetRoutePTree } from '/@/api/tigerapi/mes/router';
+import { Ref, unref } from 'vue';
+import { getRouteData } from '/@/api/tigerapi/mes/router';
+import { buildUUID } from '/@/utils/uuid';
+import { useUserStore } from '/@/store/modules/user';
+import { formatToDateTime } from '/@/utils/dateUtil';
 
 const { t } = useI18n();
 /**
  * @description: 浣庝唬鐮侀〉闈㈣幏鍙栨搷浣滃瓧娈电粨鏋凧son锛屽澧炲姞鎸夐挳鍙婃柟娉�
  * 鏀荤暐:
- *  1. 鍙︽柊寤洪┘宄板疄浣撳悕.ts鐨勬枃浠讹紝濡傦細basDefectGrp.ts銆備互渚垮尯鍒笉鍚岄〉闈㈢殑鏂规硶
+ *  1. 鍙︽柊寤洪┘宄板疄浣撳悕.ts鐨勬枃浠讹紝濡傦細BAS_REASON.ts銆備互渚垮尯鍒笉鍚岄〉闈㈢殑鏂规硶
  *  2. 鏇挎崲涓婚〉闈㈢紪杈戞寜閽柟娉曞彉涓鸿烦杞埌楂樼骇椤甸潰锛屾柟娉曚腑浼犲叆 { CODE: 涓昏〃璁板綍鐨勫叧閿瓧娈靛�硷紝涓�鑸槸XXX_CODE鐨勫��, ID: 褰撳墠璁板綍鐨処D, Name: 'BAS_DEFECT'锛堣烦杞繃鍘婚渶瑕佹柊澧炵紪杈戠殑瀹炰綋鍚嶏級, Title: `缂栬緫涓嶈壇浠g爜缁勶細${params['record']['DFTG_CODE']}`锛堝畾涔塼ab椤电鐨勬爣棰橈級, pCode: 'DFTG_CODE'锛堜富琛ㄧ殑鍏抽敭瀛楁浠g爜锛� }
  *     鏇挎崲涓婚〉闈㈡柊澧炴寜閽柟娉曞悓涓�
  *  3. 鍦ㄨ彍鍗曠鐞嗘柊寤轰竴涓珮绾ч〉闈€��
@@ -70,7 +30,7 @@
  *  5. 鍒濆鍖栬〃鏍� GetBasicColumnAndInit
  *  6. 璁剧疆杩斿洖 getHomeUrl
  *  7. 璁剧疆鏍囬 getTitle
- *  8. 璁剧疆鏂板鏃跺氨榛樿鐨勫�� getOthersValues
+ *  8. 璁剧疆鏂板鏃跺氨榛樿鐨勫�� getKeyFieldValues
  *  9. 鏇挎崲鍒犻櫎鏂规硶 GetActionsData
  * @param {*} params
  * @param {array} args
@@ -107,7 +67,7 @@
   if (!isNullOrEmpty(fnName)) {
     switch (entityName) {
       case 'BAS_REASON':
-        onChangeFns[fnName](e);
+        // onChangeFns[fnName](e);
         break;
       default:
         break;
@@ -182,33 +142,6 @@
     case 'BIZ_MES_WO':
       _formSchema = woformSchema;
       break;
-    case 'BAS_DEFECT_BaseForm':
-      _formSchema = baseSchema;
-      break;
-    case 'BAS_DEFECT_Search':
-      _formSchema = searchSchema;
-      break;
-    case 'BAS_DEFECT_Crud':
-      _formSchema = crudSchema;
-      break;
-    case 'BAS_REASON_BaseForm':
-      _formSchema = rsnBaseSchema;
-      break;
-    case 'BAS_REASON_Search':
-      _formSchema = rsnSearchSchema;
-      break;
-    case 'BAS_REASON_Crud':
-      _formSchema = rsnCrudSchema;
-      break;
-    case 'BAS_PKG_DTL_BaseForm':
-      _formSchema = pkgBaseSchema;
-      break;
-    case 'BAS_PKG_DTL_Search':
-      _formSchema = pkgSearchSchema;
-      break;
-    case 'BAS_PKG_DTL_Crud':
-      _formSchema = pkgCrudSchema;
-      break;
     default:
       break;
   }
@@ -216,151 +149,77 @@
 }
 
 /**
- * @description: 鑾峰彇琛ㄦ牸鍒�
- * @param {string} entityName
+ * @description: 宸ヨ壓璺嚎鍒濆鍖�
+ * @param {*} lf
  * @return {*}
  */
-export function GetBasicColumnAndInit(entityName: string, ...args) {
-  let data: BasicColumn[] = [];
-  switch (entityName) {
-    case 'BAS_DEFECT':
-      data = defectBaseColumn;
-      args[0].value[entityName] = getFormSchema(entityName);
-      args[0].value['BaseForm'] = getFormSchema('BAS_DEFECT_BaseForm');
-      args[1].value = {
-        BaseForm: args[4]({
-          labelWidth: 120,
-          schemas: args[0].value['BaseForm'],
-          actionColOptions: {
-            span: 24,
-          },
-          showActionButtonGroup: false,
-        }),
-      };
-      args[2].value = [
-        {
-          name: 'BaseForm',
-          slots: [],
-          preIcons: {},
-          title: '涓嶈壇浠g爜缁勪俊鎭�',
-          entityName: 'BAS_DEFECT_GRP',
-        },
-        // {
-        //   name: 'prodinfo',
-        //   slots: ['addRot', 'setRot'],
-        //   preIcons: { addRot: 'search|svg', setRot: 'config|svg' },
-        //   title: '浜у搧淇℃伅',
-        // },
-        // { name: 'rotinfo', slots: ['add'], preIcons: { add: 'search|svg' }, title: '宸ヨ壓淇℃伅' },
-      ];
-      break;
-    case 'BAS_REASON':
-      data = rsnBaseColumn;
-      args[0].value['BaseForm'] = getFormSchema('BAS_REASON_BaseForm');
-      args[1].value = {
-        BaseForm: args[4]({
-          labelWidth: 120,
-          schemas: args[0].value['BaseForm'],
-          actionColOptions: {
-            span: 24,
-          },
-          showActionButtonGroup: false,
-        }),
-      };
-      args[2].value = [
-        {
-          name: 'BaseForm',
-          slots: [],
-          preIcons: {},
-          title: '涓嶈壇鍘熷洜缁勪俊鎭�',
-          entityName: 'BAS_REASON_GRP',
-        },
-      ];
-      break;
-    case 'BAS_PKG_DTL':
-      data = pkgBaseColumn;
-      args[0].value['BaseForm'] = getFormSchema('BAS_PKG_DTL_BaseForm');
-      args[1].value = {
-        BaseForm: args[4]({
-          labelWidth: 120,
-          schemas: args[0].value['BaseForm'],
-          actionColOptions: {
-            span: 24,
-          },
-          showActionButtonGroup: false,
-        }),
-      };
-      args[2].value = [
-        {
-          name: 'BaseForm',
-          slots: [],
-          preIcons: {},
-          title: '鍖呰淇℃伅',
-          entityName: 'BAS_PKG_RULE',
-        },
-      ];
-      break;
-    default:
-      break;
+export async function initRoute(lf, rotId, routeData, currlf) {
+  currlf.value = unref(lf);
+  //閫氳繃宸ヨ壓璺嚎ID鑾峰彇鍥惧舰鏁版嵁锛屽苟娓叉煋
+  var _data = await getRouteData(rotId);
+  console.log('缁勪欢宸叉寕杞�', _data);
+  if (_data.Data != null) {
+    _data.Data.nodes.forEach((n) => {
+      n.node.properties = JSON.parse(n.node.properties);
+      n['node']['text']['value'] = n.NODE_NAME;
+      routeData.value.nodes.push(n['node']);
+    });
+    console.log('111', routeData.value);
+    _data.Data.edges.forEach((e) => {
+      e.edge.properties = JSON.parse(e.edge.properties);
+      routeData.value.edges.push(e.edge);
+    });
+    _data.Data.acts.forEach((act) => {
+      act.node.properties = JSON.parse(act.node.properties);
+      routeData.value.nodes.push(act.node);
+    });
+    unref(lf).render(routeData.value);
+    // lf.graphModel.translateCenter();
+    // lf.graphModel.fitView();
   }
-  return data;
+}
+
+/* 楂樼骇琛ㄥ崟鍏敤鏂规硶 *********************************Start */
+
+/**
+ * @description: 鏌ヨ鑷畾涔夋柟娉曪紝褰撳湪楂樼骇琛ㄥ崟涓殑琛ㄦ牸涓煡璇㈡椂瑙﹀彂浜嬩欢锛屽苟鎶妠 type: type, data: data }浼犲埌鐖剁粍浠�
+ * @param {string} type 琛ㄦ牸鐨勫悕瀛楋紝濂界‘瀹氭槸鍝釜琛ㄦ牸瑕佹煡璇�
+ * @param {Ref} data 姝よ〃鏍肩殑鍘熸暟鎹�
+ * @param {*} emit dtl缁勪欢鐨勪簨浠讹紝瑙﹀彂涓�涓�'search'浜嬩欢
+ * @return {*}
+ */
+export async function Search(type: string, data: Ref<any>, emit) {
+  emit('search', { type: type, data: data });
 }
 
 /**
- * @description: 鑾峰彇鏍囬淇℃伅
- * @param {string} type
+ * @description: 楂樼骇琛ㄥ崟鏂板缂栬緫鏂规硶
+ * @param {Ref} data
+ * @param {*} d
+ * @param {*} u
+ * @param {*} item
+ * @param {*} updates
  * @return {*}
  */
-export function getTitle(type: string) {
-  let title = {};
-  switch (type) {
-    case 'BAS_DEFECT':
-      title = {
-        pageTitle: '涓嶈壇浠g爜缁勭鐞�',
-        pageContent: '杩欓噷鍙互娣诲姞鍜屼慨鏀逛笉鑹唬鐮佺粍鍜屼笉鑹唬鐮併��',
-        baseTableTitle: '涓嶈壇浠g爜绠$悊',
-      };
-      break;
-    case 'BAS_REASON':
-      title = {
-        pageTitle: '涓嶈壇鍘熷洜缁勭鐞�',
-        pageContent: '杩欓噷鍙互娣诲姞鍜屼慨鏀逛笉鑹師鍥犵粍鍜屼笉鑹唬鐮併��',
-        baseTableTitle: '涓嶈壇鍘熷洜绠$悊',
-      };
-      break;
-    case 'BAS_PKG_DTL':
-      title = {
-        pageTitle: '鍖呰瑙勫垯绠$悊',
-        pageContent: '杩欓噷鍙互娣诲姞鍜屼慨鏀瑰寘瑁呰鍒欏拰鍖呰淇℃伅銆�',
-        baseTableTitle: '鍖呰淇℃伅绠$悊',
-      };
-      break;
-    default:
-      break;
+export function EditOperation(data: Ref<any[]>, d, u, item, updates) {
+  if (u.isUpdate) {
+    //鏇存柊
+    data.value[item] = updates;
+  } else {
+    //鏂板
+    d.ID = buildUUID();
+    d.CREATE_USER = useUserStore().getUserInfo.userId as string;
+    d.UPDATE_TIME = formatToDateTime(new Date());
+    d.UPDATE_USER = useUserStore().getUserInfo.userId as string;
+    var _data2: any[] = [];
+    if (!isNullOrEmpty(data.value[item])) {
+      _data2 = data.value[item].map((item) => {
+        return item;
+      });
+    }
+    _data2.push(d);
+    data.value[item] = _data2;
   }
-  return title;
 }
 
-/**
- * @description: 鑾峰彇闇�瑕佹柊澧炴椂灏遍粯璁ょ殑鍊硷紝涓�鑸槸涓昏〃淇℃伅
- * @param {string} type
- * @param {string} val
- * @return {*}
- */
-export function getOthersValues(type: string, val: string, id: string) {
-  let Values = {};
-  switch (type) {
-    case 'BAS_DEFECT':
-      Values = { DFTG_CODE: val };
-      break;
-    case 'BAS_REASON':
-      Values = { RSNG_CODE: val };
-      break;
-    case 'BAS_PKG_DTL':
-      Values = { PKG_RULE_ID: id };
-      break;
-    default:
-      break;
-  }
-  return Values;
-}
+/* 楂樼骇琛ㄥ崟鍏敤鏂规硶 *********************************End */

--
Gitblit v1.9.3