From eed29804d3973801f8eac3ad9bead1e608f05b6a Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期六, 20 七月 2024 22:31:56 +0800 Subject: [PATCH] 工单及自定义弹出窗口更新 --- src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts | 115 ++++++++++++++++++++++++--------------------------------- 1 files changed, 49 insertions(+), 66 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts index b1ff66d..b560106 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts @@ -4,17 +4,18 @@ * @version: * @Date: 2024-06-22 00:58:43 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-01 17:13:16 + * @LastEditTime: 2024-07-04 11:21:56 */ import { Ref, h } from 'vue'; import { DeleteEntity, getEntity } from '/@/api/tigerapi/system'; -import { ActionItem, BasicColumn, useTable } from '/@/components/Table'; +import { ActionItem, BasicColumn, FormSchema, useTable } from '/@/components/Table'; import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; import { buildUUID } from '/@/utils/uuid'; import { useUserStore } from '/@/store/modules/user'; import { formatToDateTime } from '/@/utils/dateUtil'; import { Tag } from 'ant-design-vue'; import { useDrawer } from '/@/components/Drawer'; +import { EditOperation, Search, custDel } from '../data'; function _default() { const ActionColumn: BasicColumn = { @@ -45,7 +46,7 @@ */ ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { if (!isNullOrUnDef(data[1])) { - data[1].popConfirm.confirm = rsnGrpDel.bind(null, args, params); + data[1].popConfirm.confirm = custDel.bind(null, args, params); } return data; }, @@ -56,36 +57,20 @@ * @param {*} u * @return {*} */ - EditOperation: (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; - } + EditOperation: (data: Ref<any[]>, d, u, item) => { + //鏇存柊 + var _data = data.value[item].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; + }); + EditOperation(data,d, u, item, _data); }, /** * @description: 楂樼骇琛ㄥ崟鍜岃鎯呴〉闈㈣繑鍥炰富椤甸潰鐨剈rl @@ -170,18 +155,19 @@ * @param {array} args * @return {*} */ - GetUseTables: (data: any[], ...args) => { + GetUseTables: (data: Ref<{}>, ...args) => { return { BAS_REASON: useTable({ title: '鍒楄〃淇℃伅', - dataSource: data, + dataSource: data.value['BAS_REASON'], columns: baseColumns['BAS_REASON'], formConfig: { labelWidth: 140, schemas: searchForms['BAS_REASON'], + submitFunc: () => Search('BAS_REASON', data, args[0]), //鑷畾涔夋煡璇㈡彁浜ゆ寜閽殑鏂规硶锛岃Е鍙戞煡璇㈡彁浜や簨浠� }, useSearchForm: true, - showTableSetting: true, + showTableSetting: false, bordered: true, canResize: true, showIndexColumn: false, @@ -195,7 +181,27 @@ }), }; }, - OthersValues: (val: string, id: string) => { + /** + * @description: 琛ㄦ牸鏌ヨ鍥炶皟锛岀埗缁勪欢涓�氳繃瀛愮粍浠惰Е鍙戠殑浜嬩欢鑾峰彇浼犲叆鐨勫�硷紝鍋氬叿浣撶殑鏌ヨ閫昏緫瀹炵幇 + * @param {*} d + * @return {*} + */ + FormSearch: (d) => { + let data = {} as any; + switch (d.type) { + case 'BAS_REASON': + data = d.data.value[d.type].filter( + (item) => + item.RSN_CODE.includes(d.values.RSN_CODE) || item.RSN_NAME == d.values.RSN_NAME, + ); + if (isNullOrEmpty(d.values.RSN_CODE) && isNullOrEmpty(d.values.RSN_NAME)) { + data = d.data.value[d.type]; + } + break; + } + return data; + }, + KeyFieldValues: (val: string, id: string) => { return { RSNG_CODE: val }; }, /** @@ -212,35 +218,12 @@ } }; }, + GetUseForm: () => { + return {}; + }, }; /* 浠ヤ笅鏄唴閮ㄦ柟娉曪紝涓峞xport锛屼緵涓婇潰鐨勬柟娉曡皟鐢� */ - - /** - * @description: 鑷畾涔夊垹闄ゆ柟娉� - * @param {Fn} args - * @param {*} params - * @return {*} - */ - 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](); - } - }); - } - } const baseColumns = { BAS_REASON: [ @@ -289,7 +272,7 @@ title: '鏇存柊浜�', dataIndex: 'UPDATE_USER', }, - ], + ] as BasicColumn[], }; const searchForms = { @@ -310,7 +293,7 @@ span: 8, }, }, - ], + ] as FormSchema[], }; const crudForms = { @@ -391,7 +374,7 @@ }, show: false, }, - ], + ] as FormSchema[], }; return [methods, ActionColumn]; -- Gitblit v1.9.3