From 6abf4c703ebcdd4f856cb9cfe39bd7f0027dd6ac Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期六, 15 六月 2024 22:49:28 +0800
Subject: [PATCH] 工艺行为更新

---
 src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts |  279 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 277 insertions(+), 2 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts b/src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts
index ed04bd8..f397489 100644
--- a/src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts
+++ b/src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts
@@ -1,7 +1,14 @@
-import { ActionItem, BasicColumn } from '/@/components/Table';
+import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table';
 import { useMessage } from '/@/hooks/web/useMessage';
 import { useI18n } from '/@/hooks/web/useI18n';
 import { FunctionType } from '/@/api/tigerapi/model/systemModel';
+import { DeleteEntity, getEntity } from '/@/api/tigerapi/system';
+import { Tag } from 'ant-design-vue';
+import { Ref, h } from 'vue';
+import { isNullOrEmpty } from '/@/utils/is';
+import { buildUUID } from '/@/utils/uuid';
+import { useUserStore } from '/@/store/modules/user';
+import { formatToDateTime } from '/@/utils/dateUtil';
 
 const { t } = useI18n();
 const { notification } = useMessage();
@@ -14,6 +21,17 @@
     duration: 3,
   });
   reload();
+}
+
+/**
+ * @description: 鑷畾涔夌紪杈戞柟娉曪紝璺宠浆鍒伴珮绾ч〉闈�
+ * @param {Fn} args
+ * @param {*} params
+ * @return {*}
+ */
+export function rsnGrpEdit(args: Fn[], params: {}) {
+  const param = { CODE: params['record']['RSNG_CODE'], ID: params['record']['ID'], Name: 'BAS_REASON', Title: `缂栬緫涓嶈壇鍘熷洜缁勶細${params['record']['RSNG_CODE']}`, pCode: 'RSNG_CODE', IsID: false };
+  args[5](`/BAS_REASON/High/${encodeURI(JSON.stringify(param))}`);
 }
 
 export const rsGrpactionColumn: BasicColumn = {
@@ -32,9 +50,74 @@
   },
 ];
 
+/**
+ * @description: 鑷畾涔夊垹闄ゆ柟娉�
+ * @param {Fn} args
+ * @param {*} params
+ * @return {*}
+ */
+export function rsnGrpDel(args: Fn[], params: {}) {
+  if (!isNullOrEmpty(params['data'])) {
+    var _data = params['data'].value.filter((item) => item['ID'] != params['record']['ID']);
+    params['data'].value = _data;
+    args[6]({
+      dataSource: [],
+    });
+    args[6]({
+      dataSource: params['data'],
+    });
+    args[1]();
+  }else{
+    DeleteEntity(params['record'], params['entityName']).then((action) => {
+      if (action.IsSuccessed) {
+        args[1]();
+      }
+    });
+  }
+}
+
+/**
+ * @description: 鑷畾涔夋槑缁嗚〃涓紪杈戣繑鍥炴柟娉�
+ * @param {string} type
+ * @param {*} d
+ * @param {*} u
+ * @return {*}
+ */
+export function rsnEditeOperation( data: Ref<any[]>, d, u) {
+  if (u.isUpdate) {
+    //鏇存柊
+    var _data = data.value.map((item) => {
+      if (item['ID'] == d.ID)
+        return {
+          ...item,
+          RSN_CODE: d.RSN_CODE,
+          RSN_NAME: d.RSN_NAME,
+          NEED_REPLACE: d.NEED_REPLACE,
+          REMARK: d.REMARK,
+        };
+      return item;
+    });
+    data.value = _data;
+  } 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)) {
+      _data2 = data.value.map((item) => {
+        return item;
+      });
+    }
+    _data2.push(d);
+    data.value = _data2;
+  }
+}
+
 export function rsGrpGetSelectSuccess(d, u) {
   return {
-    RSNG_CODE: d.values.values,
+    RSNG_CODE: d.values['val'],
   };
 }
 
@@ -69,6 +152,7 @@
     ],
     tableName: 'BAS_REASON_GRP',
     rowKey: 'RSNG_CODE',
+    searchInfo: {TABLE_NAME: 'BAS_REASON_GRP'}
   });
 }
 
@@ -83,3 +167,194 @@
   },
   XXX: (e) => {},
 };
+
+/**
+ * @description: 涓嶈壇鍘熷洜涓诲熀鏈俊鎭〃鍗曞瓧娈�
+ * @return {*}
+ */
+export const rsnBaseSchema: FormSchema[] = [
+  {
+    field: 'RSNG_CODE',
+    label: '涓嶈壇鍘熷洜缁勭紪鐮�',
+    component: 'Input',
+    required: true,
+    colProps: {
+      span: 8,
+    },
+  },
+  {
+    label: '涓嶈壇鍘熷洜缁勫悕绉�',
+    field: 'RSNG_NAME',
+    required: true,
+    component: 'Input',
+    colProps: {
+      span: 8,
+    },
+  },
+  {
+    label: '澶囨敞',
+    field: 'REMARK',
+    component: 'Input',
+    colProps: {
+      span: 8,
+    },
+  },
+];
+
+/**
+ * @description: 涓嶈壇鍘熷洜澧炲垹鏀瑰瓧娈�
+ * @return {*}
+ */
+export const rsnCrudSchema: FormSchema[] = [
+  {
+    field: 'RSN_CODE',
+    label: '涓嶈壇鍘熷洜缂栫爜',
+    component: 'Input',
+    required: true,
+    colProps: {
+      span: 24,
+    },
+  },
+  {
+    label: '涓嶈壇鍘熷洜鍚嶇О',
+    field: 'RSN_NAME',
+    component: 'Input',
+    required: true,
+    colProps: {
+      span: 24,
+    },
+  },
+  {
+    label: '涓嶈壇鍘熷洜缁勭紪鐮�',
+    field: 'RSNG_CODE',
+    component: 'ApiSelect',
+    colProps: {
+      span: 24,
+    },
+    componentProps: {
+      api: getEntity,
+      params: { entityName: 'BAS_REASON_GRP', sqlcmd: ' 1=1 ' },
+      resultField: 'Data.Items',
+      labelField: 'RSNG_NAME',
+      valueField: 'RSNG_CODE',
+    },
+    dynamicDisabled: ({ values }) => {
+      return true;
+    },
+  },
+  {
+    label: '鏄惁蹇呴』鏇存崲闆朵欢',
+    field: 'NEED_REPLACE',
+    component: 'Select',
+    required: true,
+    colProps: {
+      span: 24,
+    },
+    componentProps: {
+      options: [
+        {
+          label: '鏇存崲',
+          value: 'Y',
+          key: 'Y',
+        },
+        {
+          label: '涓嶆洿鎹�',
+          value: 'N',
+          key: 'N',
+        },
+      ],
+    },
+  },
+  {
+    label: '澶囨敞',
+    field: 'REMARK',
+    component: 'Input',
+    colProps: {
+      span: 24,
+    },
+  },
+  {
+    label: 'ID',
+    field: 'ID',
+    component: 'Input',
+    colProps: {
+      span: 24,
+    },
+    show: false,
+  },
+];
+
+/**
+ * @description: 涓嶈壇鍘熷洜鏌ヨ瀛楁
+ * @return {*}
+ */
+export const rsnSearchSchema: FormSchema[] = [
+  {
+    field: 'RSN_CODE',
+    label: '涓嶈壇鍘熷洜缂栫爜',
+    component: 'Input',
+    colProps: {
+      span: 8,
+    },
+  },
+  {
+    label: '涓嶈壇鍘熷洜鍚嶇О',
+    field: 'RSN_NAME',
+    component: 'Input',
+    colProps: {
+      span: 8,
+    },
+  },
+];
+
+/**
+ * @description: 涓嶈壇鍘熷洜琛ㄦ牸鍒�
+ * @return {*}
+ */
+export const rsnBaseColumn: BasicColumn[] = [
+  {
+    title: '涓嶈壇鍘熷洜缂栫爜',
+    dataIndex: 'RSN_CODE',
+    // ifShow: false,
+    width: 180,
+  },
+  {
+    title: '涓嶈壇鍘熷洜鍚嶇О',
+    dataIndex: 'RSN_NAME',
+  },
+  {
+    title: '鏄惁蹇呴』鏇存崲闆朵欢',
+    dataIndex: 'NEED_REPLACE',
+    customRender: ({ record }) => {
+      const type = record.NEED_REPLACE;
+      var text = '';
+      var color = 'green';
+      switch (type) {
+        case 'Y':
+          text = '鏇存崲';
+          break;
+        case 'N':
+          color = 'blue';
+          text = '涓嶆洿鎹�';
+          break;
+      }
+      return h(Tag, { color: color }, () => text);
+    },
+  },
+  {
+    title: '涓嶈壇鍘熷洜缁勭紪鐮�',
+    dataIndex: 'RSNG_CODE',
+  },
+  {
+    title: '澶囨敞',
+    dataIndex: 'REMARK',
+  },
+  {
+    title: '鏇存柊鏃堕棿',
+    dataIndex: 'UPDATE_TIME',
+  },
+  {
+    title: '鏇存柊浜�',
+    dataIndex: 'UPDATE_USER',
+  },
+];

--
Gitblit v1.9.3