From c8f8a9c645f7857859a9d56fac96192d994be70b Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期一, 24 六月 2024 18:48:29 +0800 Subject: [PATCH] 按钮权限更新 --- src/api/sys/menu.ts | 16 src/views/tigerprojects/bas/MaterialInfo/index.vue | 27 - src/api/tigerapi/mes/router.ts | 16 + src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts | 4 src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts | 4 src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts | 2 src/api/tigerapi/mes/mesApi.ts | 1 src/views/tigerprojects/system/lowcode/composition/RouteAction.vue | 90 +++-- src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts | 4 src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts | 7 src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts | 2 src/api/tigerapi/model/basModel.ts | 15 src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts | 4 src/views/tigerprojects/system/lowcode/high/dtl.vue | 5 src/views/components/GeneralModal.vue | 4 src/views/tigerprojects/system/lowcode/detail/detail.vue | 5 src/views/tigerprojects/system/lowcode/composition/index.vue | 90 ----- src/views/tigerprojects/system/menu/menu.data.ts | 13 src/views/tigerprojects/system/lowcode/normal/mainTable.vue | 356 ++++++++++++++++++++++ src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts | 2 src/api/tigerapi/system.ts | 2 src/views/tigerprojects/system/lowcode/normal/index.vue | 262 +-------------- src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts | 2 src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts | 15 24 files changed, 541 insertions(+), 407 deletions(-) diff --git a/src/api/sys/menu.ts b/src/api/sys/menu.ts index 2e2c35f..cb6cdb0 100644 --- a/src/api/sys/menu.ts +++ b/src/api/sys/menu.ts @@ -4,11 +4,12 @@ * @version: * @Date: 2024-06-18 15:09:47 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-21 16:50:45 + * @LastEditTime: 2024-06-24 14:53:25 */ import { defHttp } from '/@/utils/http/axios'; import { getMenuListResultModel } from './model/menuModel'; import { genAction, Api } from '../tigerapi/system'; +import { useUserStore } from '/@/store/modules/user'; enum _Api { GetMenuList = '/SYS/getMenuList', @@ -65,7 +66,7 @@ export const getMenuButtons = async (params: string) =>{ const usParams = genAction('SYS_MENU', { QueryAble_T: '', - where: "PFUNC_CODE = '" + params + "'", + where: "PFUNC_CODE = '" + params + "' And BUTTON_TYPE < 3", order: '', }); return await defHttp.post( @@ -76,3 +77,14 @@ }, ); }; + +/** + * @description: 鏍规嵁褰撳墠鑿滃崟浠g爜鑾峰彇鐢ㄦ埛鏈夋潈闄愮殑鎸夐挳鍒楄〃 + * @param {string} menuCode + * @return {*} + */ +export async function getRoleButtons(menuCode: string) { + const buttons = (await getMenuButtons(menuCode)).Data.Items; + const roles = useUserStore().getUserInfo.roles; + return buttons.filter((btn) => roles.some((item) => item.MENU_CODE === btn.FUNC_CODE)); +} diff --git a/src/api/tigerapi/mes/mesApi.ts b/src/api/tigerapi/mes/mesApi.ts index 7d5b646..5424562 100644 --- a/src/api/tigerapi/mes/mesApi.ts +++ b/src/api/tigerapi/mes/mesApi.ts @@ -19,5 +19,6 @@ SaveRouteNodePost = '/MES/SaveRouteNodePost', GetRoutePTree = '/MES/GetRoutePTree', RouteToProd = '/MES/RouteToProd', + RouteToCust = '/MES/RouteToCust', } diff --git a/src/api/tigerapi/mes/router.ts b/src/api/tigerapi/mes/router.ts index b231a5b..9cc0478 100644 --- a/src/api/tigerapi/mes/router.ts +++ b/src/api/tigerapi/mes/router.ts @@ -156,3 +156,19 @@ ); return data; }; + +/** + * @description: 娣诲姞宸ヨ壓绾垮埌瀹㈡埛 + * @param {*} params + * @return {*} + */ +export const RouteToCust = async (params: {}) => { + const data = await defHttp.get( + { url: mesApi.RouteToCust, params: params }, + { + errorMessageMode: 'none', + isTransformResponse: false, + }, + ); + return data; +}; diff --git a/src/api/tigerapi/model/basModel.ts b/src/api/tigerapi/model/basModel.ts index fcaf930..33d382b 100644 --- a/src/api/tigerapi/model/basModel.ts +++ b/src/api/tigerapi/model/basModel.ts @@ -1,4 +1,6 @@ +import { Ref } from 'vue'; import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; +import { ActionItem } from '/@/components/Table'; //鐗╂枡淇℃伅瀹炰綋 export type MaterialInfoParams = { ITEM_CODE?: string; @@ -103,3 +105,16 @@ export type MaterialInfoPageListGetResultModel = BasicFetchResult<MaterialInfoListItem>; export type SupplierInfoPageListGetResultModel = BasicFetchResult<SupplierInfoListItem>; export type PackageRulePageListGetResultModel = BasicFetchResult<PackageRuleListItem>; + +export interface EntityCustFunctionType { + CreateAction: (fnName: string) => {}; + ActionItem: (params: Recordable<any>, data, ...args) => ActionItem[]; + EditeOperation: (data: Ref<any[]>, d, u) => void; + GetHomeUrl: () => string; + GetBaseColumns: () => []; + GetSearchForm: () => []; + GetCrudForm: () => []; + GetBaseForm: () => []; + GetBaseCards: () => []; + OthersValues: (val: string, id: string) => {} +} diff --git a/src/api/tigerapi/system.ts b/src/api/tigerapi/system.ts index ae1367b..e98fe8e 100644 --- a/src/api/tigerapi/system.ts +++ b/src/api/tigerapi/system.ts @@ -745,7 +745,7 @@ } async function getListByPageAsync(params: any) { const data = await defHttp.post( - { url: Api.QueryUrl, params,timeout:30000 }, + { url: Api.QueryUrl, params,timeout:50000 }, { isTransformResponse: false, }, diff --git a/src/views/components/GeneralModal.vue b/src/views/components/GeneralModal.vue index 1c76295..be69e53 100644 --- a/src/views/components/GeneralModal.vue +++ b/src/views/components/GeneralModal.vue @@ -33,6 +33,7 @@ const rowKey = ref(''); const returnFieldName = ref(''); const schemas = ref([] as FormSchema[]); + const which = ref(''); //鍒楄〃 const ItemColumns = ref([] as BasicColumn[]); @@ -98,6 +99,7 @@ rowKey.value = data?.rowKey; returnFieldName.value = data?.returnFieldName; checkedKeys.value = []; + which.value = data?.which; getForm().resetFields(); reload(); } @@ -113,6 +115,7 @@ isUpdate: unref(false), values: { val: record[rowKey.value], id: record['ID'] }, returnFieldName: returnFieldName.value, + which: which.value, }); } finally { setModalProps({ confirmLoading: false }); @@ -133,6 +136,7 @@ isUpdate: unref(false), values: { val: values, id: ids }, returnFieldName: returnFieldName.value, + which: which.value, }); } finally { setModalProps({ confirmLoading: false }); diff --git a/src/views/tigerprojects/bas/MaterialInfo/index.vue b/src/views/tigerprojects/bas/MaterialInfo/index.vue index 531396f..81c6018 100644 --- a/src/views/tigerprojects/bas/MaterialInfo/index.vue +++ b/src/views/tigerprojects/bas/MaterialInfo/index.vue @@ -111,31 +111,6 @@ onMounted(async () => { buttons.value = (await getMenuButtons(currentRoute.value.meta.menuCode as string)).Data.Items; const roles = useUserStore().getUserInfo.roles; - HasRole.value = roles.some((item) => item.MENU_CODE === buttons.value[0]['FUNC_CODE']); + const btnsByrole = buttons.value.filter((btn) => roles.some((item) => item.MENU_CODE === btn['FUNC_CODE'])); }); - - /** - * @description: 璺宠浆浜у搧宸ヨ壓缁戝畾椤甸潰 - * @param {*} record - * @return {*} - */ - function handleBinding(record: Recordable) { - const id = { - ID: record.ID, - Name: 'ProdRouteBinding', - CODE: record.ITEM_CODE, - Title: `浜у搧[${record.ITEM_CODE}]宸ヨ壓缁戝畾`, - colSlots: [], - crudColSlots: [], - dense: true, - pageTitle: `浜у搧宸ヨ壓缁戝畾`, - pageContent: `杩欓噷鏄鐞嗕骇鍝佺殑宸ヨ壓缁戝畾锛屼竴涓骇鍝佸彲浠ョ粦瀹氬涓伐鑹鸿矾绾縛, - }; - go(`/ProdRouteBinding/CP/${encodeURI(JSON.stringify(id))}`); - // let obj = JSON.stringify(id); - // push({ - // path: '/ProdRouteBinding', - // state: {obj}, //HTML5 History API 鐨勪紶鍙傦紝鍙傛暟闅愯棌涓嶅湪鍦板潃鏍忔樉绀猴紙history锛� - // }) - } </script> diff --git a/src/views/tigerprojects/system/lowcode/composition/RouteAction.vue b/src/views/tigerprojects/system/lowcode/composition/RouteAction.vue index cc0363e..f72ddea 100644 --- a/src/views/tigerprojects/system/lowcode/composition/RouteAction.vue +++ b/src/views/tigerprojects/system/lowcode/composition/RouteAction.vue @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-20 12:13:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-21 15:37:05 + * @LastEditTime: 2024-06-24 10:56:19 --> <template> <Card title="鎿嶄綔"> @@ -20,7 +20,7 @@ <script lang="ts" setup> import { Card, CardGrid } from 'ant-design-vue'; import Icon from '@/components/Icon/Icon.vue'; - import { RouteToProd } from '/@/api/tigerapi/mes/router'; + import { RouteToCust, RouteToProd } from '/@/api/tigerapi/mes/router'; import GeneralModal from '/@/views/components/GeneralModal.vue'; import { useModal } from '/@/components/Modal'; import { useI18n } from '/@/hooks/web/useI18n'; @@ -30,7 +30,7 @@ import { useMessage } from '/@/hooks/web/useMessage'; const { refreshPage } = useTabs(); - const {createErrorModal} = useMessage(); + const { createErrorModal } = useMessage(); // const props = defineProps({ // prodCode: { type: String }, // }); @@ -109,41 +109,40 @@ // }, ]; function changeItem(action) { - if (action == 'addRoute') { - openModal(true, { - title: '宸ヨ壓璺嚎鍒楄〃', - schemas: [ - { - field: 'ROT_CODE', - component: 'Input', - label: '宸ヨ壓璺嚎缂栫爜', - colProps: { - span: 12, - }, + openModal(true, { + title: '宸ヨ壓璺嚎鍒楄〃', + schemas: [ + { + field: 'ROT_CODE', + component: 'Input', + label: '宸ヨ壓璺嚎缂栫爜', + colProps: { + span: 12, }, - ], - ItemColumns: [ - { - title: t('宸ヨ壓璺嚎缂栫爜'), - dataIndex: 'ROT_CODE', - resizable: true, - sorter: true, - width: 200, - }, - { - title: t('宸ヨ壓璺嚎鍚嶇О'), - dataIndex: 'ROT_NAME', - resizable: true, - sorter: true, - width: 180, - }, - ], - tableName: 'MES_ROUTE', - rowKey: 'ROT_CODE', - returnFieldName: 'ROUTE_CODE', //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О - searchInfo: { TABLE_NAME: 'MES_ROUTE' }, - }); - } + }, + ], + ItemColumns: [ + { + title: t('宸ヨ壓璺嚎缂栫爜'), + dataIndex: 'ROT_CODE', + resizable: true, + sorter: true, + width: 200, + }, + { + title: t('宸ヨ壓璺嚎鍚嶇О'), + dataIndex: 'ROT_NAME', + resizable: true, + sorter: true, + width: 180, + }, + ], + tableName: 'MES_ROUTE', + rowKey: 'ROT_CODE', + returnFieldName: 'ROUTE_CODE', //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О + searchInfo: { TABLE_NAME: 'MES_ROUTE' }, + which: action, + }); } /** @@ -152,17 +151,24 @@ * @param {*} u * @return {*} */ - async function handleSuccess(d, u) { - if(isNullOrEmpty(Prod_Code.value)){ - createErrorModal({ title: t('sys.api.errorTip'), content: '浜у搧涓虹┖锛屼笉鑳芥坊鍔犲伐鑹鸿矾绾匡紝璇风偣鍑诲乏渚ч�夋嫨浜у搧' }); + async function handleSuccess(d, u) { + if (isNullOrEmpty(Prod_Code.value)) { + createErrorModal({ + title: t('sys.api.errorTip'), + content: '浜у搧涓虹┖锛屼笉鑳芥坊鍔犲伐鑹鸿矾绾匡紝璇风偣鍑诲乏渚ч�夋嫨浜у搧', + }); return; } let codes = d.values.id.split(','); var i; for (i = 0; i < codes.length; i++) { - await RouteToProd({ rotId: codes[i], prodCode: Prod_Code.value }); + if (d.which == 'addRoute') { + await RouteToProd({ rotId: codes[i], prodCode: Prod_Code.value }); + } else { + await RouteToCust({ rotId: codes[i], prodCode: Prod_Code.value, custCode: '' }); + } } - + await refreshPage(); } </script> diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue index ca58307..eb739c3 100644 --- a/src/views/tigerprojects/system/lowcode/composition/index.vue +++ b/src/views/tigerprojects/system/lowcode/composition/index.vue @@ -69,7 +69,7 @@ import GeneralModal from '/@/views/components/GeneralModal.vue'; import RouteAction from './RouteAction.vue'; import CustModal from '/@/views/components/CustModal.vue'; - import { OpenCustModal, getOthersValues } from '../data'; + import { OpenCustModal } from '../data'; import { Ref, onMounted, provide, reactive, ref } from 'vue'; import { useRoute } from 'vue-router'; import { useDrawer } from '/@/components/Drawer'; @@ -103,39 +103,15 @@ const dense = isNullOrUnDef(objParams.value.dense) ? ref(false) : ref(objParams.value.dense); const pageTitle = ref(objParams.value.pageTitle); const pageContent = ref(objParams.value.pageContent); - const others = ref(getOthersValues(entityName.value, objParams.value.CODE, objParams.value.ID)); const prodCode = ref(''); const rotType = ref(''); const isMounted = ref(false); - const custImport = ref(null); + const custImport = ref<any>(null); const [registerCust, { openModal: openCustomModal, closeModal }] = useModal(); const [registerItemAdd, { openModal: openItemModal }] = useModal(); const [registerDrawer, { openDrawer }] = useDrawer(); provide<Ref<string>>('prodCode', prodCode); setTitle(objParams.value.Title); //璁剧疆鏍囩椤垫爣棰� - // const [registerTable, { reload }] = useTable({ - // title: '鍒楄〃淇℃伅', - // api: getRoleListByPage, - // columns, - // formConfig: { - // labelWidth: 120, - // schemas: searchFormSchema, - // }, - // pagination: false, - // striped: false, - // useSearchForm: true, - // showTableSetting: true, - // bordered: true, - // showIndexColumn: false, - // canResize: false, - // actionColumn: { - // width: 80, - // title: '鎿嶄綔', - // dataIndex: 'action', - // // slots: { customRender: 'action' }, - // fixed: undefined, - // }, - // }); /** * @description: 鑾峰彇鏍戝舰鏁版嵁 @@ -144,7 +120,7 @@ */ async function fetch(type: string) { if (!isNullOrUnDef(custImport.value)) { - const [{ fetchTreeData }] = custImport.value.default(); + const [{ fetchTreeData }] = custImport.value['default'](); //鏍规嵁type鑾峰彇鏍戝舰鏁版嵁 const data = await fetchTreeData(type, objParams.value.CODE); title.value = data.title; @@ -159,7 +135,7 @@ */ function goBack() { if (!isNullOrUnDef(custImport.value)) { - const [{ GetHomeUrl }] = custImport.value.default(); + const [{ GetHomeUrl }] = custImport.value['default'](); // 鏈緥鐨勬晥鏋滄椂鐐瑰嚮杩斿洖濮嬬粓璺宠浆鍒拌处鍙峰垪琛ㄩ〉锛屽疄闄呭簲鐢ㄦ椂鍙繑鍥炰笂涓�椤� go(GetHomeUrl(entityName.value)); } @@ -179,7 +155,7 @@ if (isNullOrUnDef(custImport.value)) { return ''; } else { - const [{CreateIcon}] = custImport.value.default(); + const [{CreateIcon}] = custImport.value['default'](); return CreateIcon(params); } } @@ -193,58 +169,6 @@ isMounted.value = true; } catch (e) {} }); - - /** - * @description: 鐢熸垚鍒楄〃涓搷浣滈」鐨勬寜閽� - * @param {*} record - * @return {*} - */ - function createActions(record) { - // return GetActionsData( - // { - // record, - // isUpdate: true, - // ifSave: true, - // entityName: entityName.value, - // formJson: getFormSchema(`${entityName.value}_Crud`), - // cType, - // dtlSlots, - // useModalData, - // useFormData, - // crudColSlots, - // }, - // openDrawer, - // reload, - // openCustomModal, - // useForm, - // useModal, - // ); - } - - /** - * @description: 楠岃瘉琛ㄥ崟 - * @return {*} - */ - async function validate() { - let validates = {}; - const Keys = Object.getOwnPropertyNames(useFormData.value); - let i; - for (i = 0; i < Keys.length; i++) { - validates[Keys[i]] = await useFormData.value[Keys[i]][1].validate(); - } - return validates; - } - - // function handleEdit(record: Recordable) { - // openModal(true, { - // record, - // isUpdate: true, - // }); - // } - - // function handleDelete(record: Recordable) { - // console.log(record); - // } function handleSelect(deptId = '', info) { searchInfo.deptId = deptId; @@ -263,10 +187,6 @@ rotType.value = ''; // reload(); } - - // function handleSuccess() { - // reload(); - // } /** * @description: 寮瑰嚭妗嗙‘瀹氳繑鍥� diff --git a/src/views/tigerprojects/system/lowcode/detail/detail.vue b/src/views/tigerprojects/system/lowcode/detail/detail.vue index 0be5062..5898fb3 100644 --- a/src/views/tigerprojects/system/lowcode/detail/detail.vue +++ b/src/views/tigerprojects/system/lowcode/detail/detail.vue @@ -84,6 +84,11 @@ onMounted(() => {}); + /** + * @description: 鐢熸垚鍒楄〃涓搷浣滈」鐨勬寜閽� + * @param {*} record + * @return {*} + */ function createActions(record) { const params = { record, diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts index 0af4dc8..704cb9c 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT.ts @@ -63,7 +63,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) }; diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts index 9ab7013..7ebd613 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-22 23:30:54 + * @LastEditTime: 2024-06-24 15:52:18 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -44,7 +44,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'go', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) url: 'BAS_DEFECT/High', diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts index ea64a9b..3e3e924 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_PV.ts @@ -26,7 +26,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) }; diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts index 02f4089..2429938 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-23 23:53:41 + * @LastEditTime: 2024-06-24 15:52:02 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -46,7 +46,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) }; diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts index ddebf23..cf5a5b2 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts @@ -31,7 +31,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓猴紝蹇呴渶瑕佹湁鐨勬柟娉� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) }; diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts index b039ce2..161fd3c 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_DTL.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-23 18:28:00 + * @LastEditTime: 2024-06-24 15:51:12 */ import { Ref } from 'vue'; @@ -55,7 +55,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) }; @@ -65,6 +65,7 @@ * @return {*} */ ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { + /* 閲嶅啓鍒犻櫎鏂规硶 */ data[1].popConfirm.confirm = custDel.bind(null, args, params); return data; }, @@ -303,14 +304,18 @@ }, ]; }, + /** + * @description: 楂樼骇琛ㄥ崟涓讳俊鎭崱鐗囩敓鎴愶紝鍙互澶氫釜 + * @return {*} + */ GetBaseCards: () => { return [ { name: 'BaseForm', - slots: [], - preIcons: {}, + slots: [], //瀹氫箟鎻掓Ы + preIcons: {}, //瀹氫箟鎻掓Ы涓寜閽浘鏍� title: '鍖呰淇℃伅', - entityName: 'BAS_PKG_RULE', + entityName: 'BAS_PKG_RULE', //瀹炰綋鍚嶇О }, ]; }, diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts index 0df1809..b109fbe 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_PKG_RULE.ts @@ -42,7 +42,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'go', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) url: 'BAS_PKG_DTL/High', diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts index 39a3456..9916686 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-22 00:58:43 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-23 18:28:55 + * @LastEditTime: 2024-06-24 15:50:42 */ /* * @Description: 涓嶈壇鍘熷洜鐩稿叧 @@ -64,7 +64,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) }; diff --git a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts index 09da874..8786065 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_REASON_GRP.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-22 23:33:08 + * @LastEditTime: 2024-06-24 15:50:49 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -45,7 +45,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'go', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) url: 'BAS_REASON/High', diff --git a/src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts b/src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts index a9b8619..eccc002 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/V_BAS_PROD.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-22 22:20:05 + * @LastEditTime: 2024-06-24 15:50:03 */ import { ActionItem, BasicColumn } from '/@/components/Table'; @@ -48,7 +48,7 @@ * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� * @return {*} */ - CreateAction: () => { + CreateAction: (fnName: string) => { return { action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) }; @@ -66,6 +66,9 @@ }, ]; }, + OthersValues: (val: string, id: string) => { + return { RSNG_CODE: val }; + }, }; return [methods, ActionColumn]; diff --git a/src/views/tigerprojects/system/lowcode/high/dtl.vue b/src/views/tigerprojects/system/lowcode/high/dtl.vue index f5ee227..104fc85 100644 --- a/src/views/tigerprojects/system/lowcode/high/dtl.vue +++ b/src/views/tigerprojects/system/lowcode/high/dtl.vue @@ -118,6 +118,11 @@ }); }); + /** + * @description: 鐢熸垚鍒楄〃涓搷浣滈」鐨勬寜閽� + * @param {*} record + * @return {*} + */ function createActions(record) { const params = { record, diff --git a/src/views/tigerprojects/system/lowcode/normal/index.vue b/src/views/tigerprojects/system/lowcode/normal/index.vue index 5ea5e10..d3a3514 100644 --- a/src/views/tigerprojects/system/lowcode/normal/index.vue +++ b/src/views/tigerprojects/system/lowcode/normal/index.vue @@ -4,19 +4,26 @@ * @version: * @Date: 2024-05-30 13:28:20 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-23 00:03:51 + * @LastEditTime: 2024-06-24 18:10:10 --> <template> <div> - <BasicTable @register="registerTable" v-if="isMounted"> + <!-- <BasicTable @register="registerTable" v-if="isMounted"> <template #toolbar> - <a-button type="primary" @click="handleCreate" preIcon="add_02|svg"> 鏂板 </a-button> + <a-button + type="primary" + @click="handleCreate(item['DO_METHOD'])" + :preIcon="item['ICON_URL']" + v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)" + :key="item" + > + {{ item['FUNC_NAME'] }} + </a-button> </template> <template #action="{ record }"> <TableAction :actions="createActions(record)" /> </template> <template #[item]="{ field }" v-for="item in colSlots" :key="item"> - <!-- <template #form-BAS_REASON3aadd="{ field }"> --> <a-button v-if="field" class="mt-1 ml-1" @@ -30,7 +37,10 @@ /> </template> </BasicTable> - <normalDrawer @register="registerDrawer" @success="handleSuccess" /> + <normalDrawer @register="registerDrawer" @success="handleSuccess" /> --> + <Suspense> + <mainTable /> + </Suspense> <CustModal @register="registerCust" @success="custSuccess" @@ -60,14 +70,11 @@ </div> </template> <script lang="ts" setup> - import { h, onMounted, ref, unref } from 'vue'; - import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table'; - import { useDrawer } from '/@/components/Drawer'; - import normalDrawer from '../normalDrawer.vue'; + import { Ref, h, onMounted, provide, ref, unref } from 'vue'; + import mainTable from './mainTable.vue'; import GeneralModal from '/@/views/components/GeneralModal.vue'; import { DeleteEntity, GetEnum, getEntity, getListByPage } from '/@/api/tigerapi/system'; - import { useGlobSetting } from '/@/hooks/setting'; - import { useRoute } from 'vue-router'; + import { useRoute, useRouter } from 'vue-router'; import { Tag, Tooltip } from 'ant-design-vue'; import CustModal from '/@/views/components/CustModal.vue'; import { BasicForm, useForm } from '/@/components/Form/index'; @@ -78,166 +85,35 @@ import { uploadApi } from '/@/api/sys/upload'; import { useGo } from '/@/hooks/web/usePage'; import { useI18n } from '/@/hooks/web/useI18n'; + import { getRoleButtons } from '/@/api/sys/menu'; const { getLocale } = useLocale(); const { t } = useI18n(); const route = useRoute(); + const { currentRoute } = useRouter(); const go = useGo(); const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); - const entityName = ref(objParams.value.ID); - const globSetting = useGlobSetting(); const _columns = ref([]); const _searchFormSchema = ref([]); const _crudFormSchema = ref([]); - const formSchemas = ref({}); //寮瑰嚭妗嗗琛ㄥ崟缁撴瀯 const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 const useFormData = ref({}); - const colSlots = ref<any>(objParams.value.colSlots); //鎸夐挳鎻掓Ы - const crudColSlots = ref<any>(objParams.value.crudColSlots); const cType = ref(''); const dtlSlots = ref([] as any[]); const selectVals = ref({}); const isExistSql = ref(''); - const custImport = ref(null); + const custImport = ref<any>(null); const isMounted = ref(false); + const buttons = ref([]); + const others = ref<any>(null); + provide<Ref<any>>('objParams', objParams.value); + provide<Ref<any[]>>('_columns', _columns); + provide<Ref<any[]>>('_searchFormSchema', _searchFormSchema); + provide<Ref<any[]>>('_crudFormSchema', _crudFormSchema); + provide<Ref<string>>('isExistSql', isExistSql); + provide<Ref<any>>('others', others); const [registerCust, { openModal: openCustomModal, closeModal }] = useModal(); - const [registerItemAdd, { openModal: openItemModal }] = useModal(); - const [registerDrawer, { openDrawer }] = useDrawer(); - const [registerTable, { getForm, reload, setProps }] = useTable({ - title: '鍒楄〃淇℃伅', - api: getListByPage, - searchInfo: { TABLE_NAME: objParams.value.ID }, - columns: _columns as unknown as BasicColumn[], - formConfig: { - labelWidth: 140, - schemas: _searchFormSchema as unknown as FormSchema[], - }, - useSearchForm: true, - showTableSetting: true, - bordered: true, - canResize: true, - showIndexColumn: false, - actionColumn: { - width: 130, - title: '鎿嶄綔', - dataIndex: 'action', - slots: { customRender: 'action' }, - fixed: undefined, - }, //鑷畾涔夋搷浣滃垪 - }); - - /** - * @description: 鐢熸垚鍒楄〃涓搷浣滈」鐨勬寜閽� - * @param {*} record - * @return {*} - */ - function createActions(record) { - const params = { - record, - isUpdate: true, - entityName: objParams.value.ID, - formJson: _crudFormSchema.value, - cType, - dtlSlots, - formSchemas, - useModalData, - useFormData, - crudColSlots, - }; - const actionItem = [ - { - icon: 'clarity:note-edit-line', - onClick: editRecord.bind(null, openDrawer, params), - }, - { - icon: 'ant-design:delete-outlined', - color: 'error', - popConfirm: { - title: '鏄惁纭鍒犻櫎?', - placement: 'left', - confirm: deleteRecord.bind(null, reload, params), - }, - }, - ]; - if (isNullOrUnDef(custImport.value)) { - return actionItem; - } - const [{ ActionItem }] = custImport.value.default(); - return ActionItem( - params, - actionItem, - openDrawer, - reload, - openCustomModal, - useForm, - useModal, - go, - ); - } - - /** - * @description: 鍏敤缂栬緫鏂规硶 - * @param {Fn} fn - * @param {*} params - * @return {*} - */ - function editRecord(fn: Fn, params: {}) { - fn(true, params); - } - - /** - * @description: 鍏敤鍒犻櫎鏂规硶 - * @param {Fn} fn - * @param {*} params - * @return {*} - */ - function deleteRecord(fn: Fn, params: {}) { - console.log(params['record']); - //鍒犻櫎 - DeleteEntity(params['record'], params['entityName']).then((action) => { - if (action.IsSuccessed) { - fn(); - } - }); - } - - /** - * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� - * @return {*} - */ - function handleCreate() { - if (isNullOrUnDef(custImport.value)) { - openDrawer(true, { - isUpdate: false, - entityName: objParams.value.ID, - formJson: _crudFormSchema.value, - crudColSlots, - isExistSql: isExistSql.value, - }); - } else { - const [{ CreateAction }] = custImport.value.default(); - const result = CreateAction(objParams.value.ID); - switch (result.action) { - case 'go': - go(`/${result.url}/${encodeURI(JSON.stringify(result.params))}`); - break; - case 'drawer': - openDrawer(true, { - isUpdate: false, - entityName: objParams.value.ID, - formJson: _crudFormSchema.value, - crudColSlots, - isExistSql: isExistSql.value, - }); - break; - } - } - } - - function handleSuccess() { - reload(); - } onMounted(async () => { /* 鐢╦son鑾峰彇鍒� */ @@ -342,84 +218,8 @@ } } _columns.value = objs; + buttons.value = await getRoleButtons(currentRoute.value.meta.menuCode as string); }); - - /** - * @description: 寮瑰嚭閫夋嫨妗嗛�夋嫨鎴愬姛鍚庝簨浠� - * @param {*} d - * @param {*} u - * @param {*} item - * @return {*} - */ - function handleItemSuccess(d, u, item) { - /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ - try { - import( - /* @vite-ignore */ `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}` - ) - .then((m) => { - const [{ GetSelectSuccess }] = m.default(); - getForm().setFieldsValue(GetSelectSuccess(d, u)); - }) - .catch(() => { - getForm().setFieldsValue({ - ITEM_CODE: d.values['val'], - }); - }); - } catch (e) {} - } - - /** - * @description: 寮瑰嚭閫夋嫨妗� - * @param {*} item - * @return {*} - */ - function handleSelectItem(item) { - /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ - try { - import( - /* @vite-ignore */ `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}` - ) - .then((m) => { - const [{ OpenSelectItem }] = m.default(); - OpenSelectItem(openItemModal); - }) - .catch(() => { - openItemModal(true, { - title: '鐗╂枡鍒楄〃', - schemas: [ - { - field: 'ITEM_CODE', - component: 'Input', - label: '鐗╂枡缂栫爜', - colProps: { - span: 12, - }, - }, - ], - ItemColumns: [ - { - title: t('鐗╂枡缂栫爜'), - dataIndex: 'ITEM_CODE', - resizable: true, - sorter: true, - width: 200, - }, - { - title: t('鐗╂枡鍚嶇О'), - dataIndex: 'ITEM_NAME', - resizable: true, - sorter: true, - width: 180, - }, - ], - tableName: 'BAS_ITEM', - rowKey: 'ITEM_CODE', - searchInfo: { TABLE_NAME: 'BAS_ITEM' }, - }); - }); - } catch (e) {} - } /** * @description: Select 鑷畾涔塷nChange鏂规硶 @@ -441,7 +241,7 @@ //寮瑰嚭妗嗙‘瀹氳繑鍥� function custSuccess(d) { - reload(); + // reload(); } /** diff --git a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue new file mode 100644 index 0000000..e55e784 --- /dev/null +++ b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue @@ -0,0 +1,356 @@ +<template> + <div> + <BasicTable @register="registerTable"> + <template #toolbar> + <a-button + type="primary" + @click="handleCreate(item['DO_METHOD'])" + :preIcon="item['ICON_URL']" + v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)" + :key="item" + > + {{ item['FUNC_NAME'] }} + </a-button> + </template> + <template #action="{ record }"> + <TableAction :actions="createActions(record)" /> + </template> + <template #[item]="{ field }" v-for="item in colSlots" :key="item"> + <!-- <template #form-BAS_REASON3aadd="{ field }"> --> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="handleSelectItem(item)" + preIcon="search|svg" + /> + <GeneralModal + @register="registerItemAdd" + @success="(d, u) => handleItemSuccess(d, u, item)" + /> + </template> + </BasicTable> + <normalDrawer @register="registerDrawer" @success="handleSuccess" /> + </div> +</template> +<script lang="ts" setup> + import { Ref, inject, nextTick, onMounted, ref, watch } from 'vue'; + import { + BasicTable, + useTable, + TableAction, + BasicColumn, + FormSchema, + ActionItem, + PopConfirm, + } from '/@/components/Table'; + import { BasicForm, useForm } from '/@/components/Form/index'; + import { useDrawer } from '/@/components/Drawer'; + import GeneralModal from '/@/views/components/GeneralModal.vue'; + import normalDrawer from '../normalDrawer.vue'; + import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; + import { useModal } from '/@/components/Modal'; + import { useGo } from '/@/hooks/web/usePage'; + import { DeleteEntity, getEntity, getListByPage } from '/@/api/tigerapi/system'; + import { useI18n } from '/@/hooks/web/useI18n'; + import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; + import { getRoleButtons } from '/@/api/sys/menu'; + import { useRouter } from 'vue-router'; + + const { t } = useI18n(); + const { currentRoute } = useRouter(); + const props = defineProps({ + colSlots: { type: Array as PropType<any[]> }, + useTableData: { type: Object as PropType<{}>, default: { table: [] } }, + crudColSlots: { type: Object as PropType<any> }, + }); + const objParams = inject('objParams') as Ref<any>; + const _columns = inject('_columns') as Ref<any[]>; + const _searchFormSchema = inject('_searchFormSchema') as Ref<any[]>; + const _crudFormSchema = inject('_crudFormSchema') as Ref<any[]>; + const buttons = ref<[]>(await getRoleButtons(currentRoute.value.meta.menuCode as string)); + const isExistSql = inject('isExistSql') as Ref<string>; + const others = inject('others') as Ref<Recordable[]>; + const entityName = ref(objParams['ID']); + const go = useGo(); + const [registerDrawer, { openDrawer }] = useDrawer(); + const [registerItemAdd, { openModal: openItemModal }] = useModal(); + const cType = ref(''); + const dtlSlots = ref([] as any[]); + const formSchemas = ref({}); //寮瑰嚭妗嗗琛ㄥ崟缁撴瀯 + const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 + const useFormData = ref({}); + const custImport = ref<any[]>([]); + const EntityCustFunction = ref([ + { + ActionItem(params, data, ...args) {}, + EditeOperation(data, d, u) {}, + GetBaseColumns() {}, + GetSearchForm() {}, + GetCrudForm() {}, + OthersValues(val, id) {}, + } as EntityCustFunctionType, + ]); + /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ + try { + custImport.value = await import(/* @vite-ignore */ `../entityts/${objParams['ID']}`); + } catch (e) {} + const [ + { + ActionItem: nActionItem, + EditeOperation, + GetBaseColumns, + GetSearchForm, + GetCrudForm, + OthersValues, + }, + ] = isNullOrUnDef(custImport.value['default']) + ? EntityCustFunction.value + : custImport.value['default'](); + others.value = OthersValues(objParams['CODE'], objParams['ID']); + const [registerTable, { getForm, reload, setProps }] = useTable({ + title: '鍒楄〃淇℃伅', + api: getListByPage, + searchInfo: { TABLE_NAME: objParams['ID'] }, + columns: _columns as unknown as BasicColumn[], + formConfig: { + labelWidth: 140, + schemas: _searchFormSchema as unknown as FormSchema[], + }, + useSearchForm: true, + showTableSetting: true, + bordered: true, + canResize: true, + showIndexColumn: false, + actionColumn: { + width: 130, + title: '鎿嶄綔', + dataIndex: 'action', + slots: { customRender: 'action' }, + fixed: undefined, + }, //鑷畾涔夋搷浣滃垪 + }); + + onMounted(() => {}); + + /** + * @description: 鐢熸垚鍒楄〃涓搷浣滈」鐨勬寜閽� + * @param {*} record + * @return {*} + */ + function createActions(record) { + const params = { + record, + isUpdate: true, + entityName: objParams['ID'], + formJson: _crudFormSchema.value, + cType, + dtlSlots, + formSchemas, + useModalData, + useFormData, + crudColSlots: objParams['crudColSlots'], + }; + + const actionItem = GenerateActionButton(params); + if (isNullOrUnDef(custImport.value['default'])) { + return actionItem; + } + return nActionItem( + params, + actionItem, + openDrawer, + reload, + null, + useForm, + useModal, + go, + setProps, + ); + } + + /** + * @description: 鑾峰彇鏉冮檺鎸夐挳鍒楄〃 + * @param {*} params + * @return {*} + */ + function GenerateActionButton(params: any) { + let actionItem = [] as ActionItem[]; + buttons.value.map((x) => { + if (x['BUTTON_TYPE'] == 1) { + let url = ''; + let color = undefined as 'success' | 'error' | 'warning' | undefined; + let _click = null as any; + let _popConfirm = undefined as PopConfirm | undefined; + if (x['DO_METHOD'] == 'Edit') { + url = 'clarity:note-edit-line'; + _click = editRecord.bind(null, openDrawer, params); + } else { + _click = x['ICON_URL']; + if (x['DO_METHOD'] == 'Delete') { + url = 'ant-design:delete-outlined'; + color = 'error'; + _popConfirm = { + title: '鏄惁纭鍒犻櫎?', + placement: 'left', + confirm: deleteRecord.bind(null, reload, params), + }; + } + } + actionItem.push({ + icon: isNullOrEmpty(x['ICON_URL']) ? url : x['ICON_URL'], + onClick: _click, + color: color, + popConfirm: _popConfirm, + }); + } + }); + return actionItem; + } + + /** + * @description: 鍏敤缂栬緫鏂规硶 + * @param {Fn} fn + * @param {*} params + * @return {*} + */ + function editRecord(fn: Fn, params: {}) { + fn(true, params); + } + + /** + * @description: 鍏敤鍒犻櫎鏂规硶 + * @param {Fn} fn + * @param {*} params + * @return {*} + */ + function deleteRecord(fn: Fn, params: {}) { + console.log(params['record']); + //鍒犻櫎 + DeleteEntity(params['record'], params['entityName']).then((action) => { + if (action.IsSuccessed) { + fn(); + } + }); + } + + /** + * @description: 鑾峰彇鏂板鎸夐挳鐨勮涓� + * @return {*} + */ + function handleCreate(fnName: string) { + if (isNullOrUnDef(custImport.value['default'])) { + openDrawer(true, { + isUpdate: false, + entityName: entityName.value, + formJson: _crudFormSchema.value, + crudColSlots: objParams['crudColSlots'], + isExistSql: isExistSql.value, + }); + } else { + const [{ CreateAction }] = custImport.value['default'](); + const result = CreateAction(fnName); + switch (result.action) { + case 'go': + go(`/${result.url}/${encodeURI(JSON.stringify(result.params))}`); + break; + case 'drawer': + openDrawer(true, { + isUpdate: false, + entityName: objParams.value.ID, + formJson: _crudFormSchema.value, + crudColSlots: objParams['crudColSlots'], + isExistSql: isExistSql.value, + }); + break; + } + } + } + + /** + * @description: 鏂板缂栬緫杩斿洖鎴愬姛鏂规硶 + * @param {*} d + * @param {*} u + * @return {*} + */ + function handleSuccess(d, u) { + reload(); + } + + /** + * @description: 寮瑰嚭閫夋嫨妗嗛�夋嫨鎴愬姛鍚庝簨浠� + * @param {*} d + * @param {*} u + * @param {*} item + * @return {*} + */ + function handleItemSuccess(d, u, item) { + /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ + try { + import( + /* @vite-ignore */ `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}` + ) + .then((m) => { + const [{ GetSelectSuccess }] = m.default(); + getForm().setFieldsValue(GetSelectSuccess(d, u)); + }) + .catch(() => { + getForm().setFieldsValue({ + ITEM_CODE: d.values['val'], + }); + }); + } catch (e) {} + } + + /** + * @description: 寮瑰嚭閫夋嫨妗� + * @param {*} item + * @return {*} + */ + function handleSelectItem(item) { + /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ + try { + import( + /* @vite-ignore */ `../entityts/${getForm().getFieldsValue()[`${item.replace(/form-/, '').replace(/add/, '')}PSelect_0`]}` + ) + .then((m) => { + const [{ OpenSelectItem }] = m.default(); + OpenSelectItem(openItemModal); + }) + .catch(() => { + openItemModal(true, { + title: '鐗╂枡鍒楄〃', + schemas: [ + { + field: 'ITEM_CODE', + component: 'Input', + label: '鐗╂枡缂栫爜', + colProps: { + span: 12, + }, + }, + ], + ItemColumns: [ + { + title: t('鐗╂枡缂栫爜'), + dataIndex: 'ITEM_CODE', + resizable: true, + sorter: true, + width: 200, + }, + { + title: t('鐗╂枡鍚嶇О'), + dataIndex: 'ITEM_NAME', + resizable: true, + sorter: true, + width: 180, + }, + ], + tableName: 'BAS_ITEM', + rowKey: 'ITEM_CODE', + searchInfo: { TABLE_NAME: 'BAS_ITEM' }, + }); + }); + } catch (e) {} + } +</script> diff --git a/src/views/tigerprojects/system/menu/menu.data.ts b/src/views/tigerprojects/system/menu/menu.data.ts index bddeaf6..8458342 100644 --- a/src/views/tigerprojects/system/menu/menu.data.ts +++ b/src/views/tigerprojects/system/menu/menu.data.ts @@ -60,6 +60,11 @@ dataIndex: 'btnType', ifShow: false, }, + { + title: '鎵ц鏂规硶', + dataIndex: 'doMethod', + ifShow: false, + }, ]; const isDir = (type: string) => type === '0'; @@ -134,7 +139,7 @@ label: '鍥炬爣', component: 'IconPicker', required: ({ values }) => isDir(values.func_type), - ifShow: ({ values }) => !isButton(values.func_type), + ifShow: ({ values }) => true, //!isButton(values.func_type), }, { @@ -166,6 +171,12 @@ ifShow: ({ values }) => isButton(values.func_type), }, { + field: 'doMethod', + label: '鎵ц鏂规硶鍚�', + component: 'Input', + ifShow: ({ values }) => isButton(values.func_type), + }, + { field: 'func_code', label: '鏉冮檺鏍囪瘑', component: 'Input', -- Gitblit v1.9.3