From 3505aa60ad15de91bc9b437ca8d69124c8074974 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期二, 25 六月 2024 11:42:28 +0800 Subject: [PATCH] 通用页面更新 --- src/api/sys/menu.ts | 4 src/views/tigerprojects/bas/MaterialInfo/index.vue | 86 ++++-- src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue | 4 src/views/tigerprojects/system/lowcode/composition/index.vue | 23 + src/views/tigerprojects/system/menu/index.vue | 345 +++++++++++++++----------- src/views/tigerprojects/bas/shift/index.vue | 2 src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts | 15 src/views/tigerprojects/system/lowcode/normal/mainTable.vue | 6 src/views/tigerprojects/system/lowcode/composition/AddRoute.vue | 4 src/views/tigerprojects/system/lowcode/normal/index.vue | 32 -- src/views/tigerprojects/system/lowcode/composition/ActionConfig.vue | 241 ++++++++++++++++++ 11 files changed, 533 insertions(+), 229 deletions(-) diff --git a/src/api/sys/menu.ts b/src/api/sys/menu.ts index cb6cdb0..3d6d3bf 100644 --- a/src/api/sys/menu.ts +++ b/src/api/sys/menu.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-18 15:09:47 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-24 14:53:25 + * @LastEditTime: 2024-06-24 22:50:45 */ import { defHttp } from '/@/utils/http/axios'; import { getMenuListResultModel } from './model/menuModel'; @@ -67,7 +67,7 @@ const usParams = genAction('SYS_MENU', { QueryAble_T: '', where: "PFUNC_CODE = '" + params + "' And BUTTON_TYPE < 3", - order: '', + order: 'SEQ_NO', }); return await defHttp.post( { url: Api.QueryUrl, params: usParams }, diff --git a/src/views/tigerprojects/bas/MaterialInfo/index.vue b/src/views/tigerprojects/bas/MaterialInfo/index.vue index 81c6018..3cbc98d 100644 --- a/src/views/tigerprojects/bas/MaterialInfo/index.vue +++ b/src/views/tigerprojects/bas/MaterialInfo/index.vue @@ -3,32 +3,19 @@ <BasicTable @register="registerTable"> <template #toolbar> <!-- <a-button type="primary" @click="handleRenew"> 鎵归噺鏇存柊 </a-button> --> - <a-button type="primary" @click="handleCreate" v-if="HasRole"> 鏂板鐗╂枡 </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 }"> <!-- b87079a98deb456a9cfa506bfd1a7bc6 --> - <TableAction - :actions="[ - { - icon: 'clarity:note-edit-line', - onClick: handleEdit.bind(null, record), - }, - { - icon: 'ant-design:delete-outlined', - color: 'error', - popConfirm: { - title: '鏄惁纭鍒犻櫎?', - placement: 'left', - confirm: handleDelete.bind(null, record), - }, - }, - // { - // icon: 'binding|svg', - // tooltip: '缁戝畾宸ヨ壓', - // onClick: handleBinding.bind(null, record), - // }, - ]" - /> + <TableAction :actions="GenerateActionButton(record)" /> </template> </BasicTable> <MaterialDrawer @register="registerDrawer" @success="handleSuccess" /> @@ -36,7 +23,7 @@ </div> </template> <script lang="ts" setup> - import { BasicTable, useTable, TableAction } from '/@/components/Table'; + import { BasicTable, useTable, TableAction, PopConfirm, ActionItem } from '/@/components/Table'; import { useDrawer } from '/@/components/Drawer'; import MaterialDrawer from './MaterialDrawer.vue'; import MaterialModal from './MaterialModal.vue'; @@ -47,15 +34,14 @@ import { useGo } from '/@/hooks/web/usePage'; import { useRouter } from 'vue-router'; import { onMounted, ref } from 'vue'; - import { getMenuButtons } from '/@/api/sys/menu'; -import { useUserStore } from '/@/store/modules/user'; + import { getRoleButtons } from '/@/api/sys/menu'; + import { isNullOrEmpty } from '/@/utils/is'; const go = useGo(); const { currentRoute } = useRouter(); const [registerDrawer, { openDrawer }] = useDrawer(); const [registerModal, { openModal: openMaterialModal }] = useModal(); const buttons = ref([]); - const HasRole = ref(false); const [registerTable, { reload }] = useTable({ title: '鐗╂枡鍒楄〃', api: getListByPage, @@ -76,7 +62,47 @@ slots: { customRender: 'action' }, }, }); - function handleCreate() { + + /** + * @description: 鑾峰彇鏉冮檺鎸夐挳鍒楄〃 + * @param {*} params + * @return {*} + */ + function GenerateActionButton(record: Recordable) { + 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 = handleEdit.bind(null, record); + } else { + _click = x['ICON_URL']; + if (x['DO_METHOD'] == 'Delete') { + url = 'ant-design:delete-outlined'; + color = 'error'; + _popConfirm = { + title: '鏄惁纭鍒犻櫎?', + placement: 'left', + confirm: handleDelete.bind(null, record), + }; + } + } + actionItem.push({ + icon: isNullOrEmpty(x['ICON_URL']) ? url : x['ICON_URL'], + onClick: _click, + color: color, + popConfirm: _popConfirm, + }); + } + }); + return actionItem; + } + + function handleCreate(fnName: string) { openDrawer(true, { isUpdate: false, }); @@ -109,8 +135,6 @@ } onMounted(async () => { - buttons.value = (await getMenuButtons(currentRoute.value.meta.menuCode as string)).Data.Items; - const roles = useUserStore().getUserInfo.roles; - const btnsByrole = buttons.value.filter((btn) => roles.some((item) => item.MENU_CODE === btn['FUNC_CODE'])); + buttons.value = await getRoleButtons(currentRoute.value.meta.menuCode as string); }); </script> diff --git a/src/views/tigerprojects/bas/shift/index.vue b/src/views/tigerprojects/bas/shift/index.vue index ba02191..dee37e1 100644 --- a/src/views/tigerprojects/bas/shift/index.vue +++ b/src/views/tigerprojects/bas/shift/index.vue @@ -2,7 +2,7 @@ <div> <BasicTable @register="registerTable"> <template #toolbar> - <a-button color="primary" @click="handleAdd" preIcon="add_02|svg"> 鏂板 </a-button> + <a-button type="primary" @click="handleAdd" preIcon="add_02|svg"> 鏂板 </a-button> <a-button ghost color="success" @click="aoaToExcel" preIcon="excel-export|svg"> 瀵煎嚭 </a-button> diff --git a/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue b/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue index fcab497..6b150b6 100644 --- a/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue +++ b/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue @@ -4,13 +4,13 @@ * @version: * @Date: 2024-05-25 00:27:00 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-10 23:54:01 + * @LastEditTime: 2024-06-24 22:58:16 --> <template> <div> <BasicTable @register="registerTable"> <template #toolbar> - <a-button color="primary" @click="addWo" preIcon="add_02|svg"> 鏂板 </a-button> + <a-button type="primary" @click="addWo" preIcon="add_02|svg"> 鏂板 </a-button> <a-button ghost color="success" @click="ExcelToDb" preIcon="excel-import|svg"> 瀵煎叆 </a-button> diff --git a/src/views/tigerprojects/system/lowcode/composition/ActionConfig.vue b/src/views/tigerprojects/system/lowcode/composition/ActionConfig.vue new file mode 100644 index 0000000..93a634e --- /dev/null +++ b/src/views/tigerprojects/system/lowcode/composition/ActionConfig.vue @@ -0,0 +1,241 @@ +<!-- + * @Description: file content + * @Author: Ben Lin + * @version: + * @Date: 2024-06-24 23:44:31 + * @LastEditors: Ben Lin + * @LastEditTime: 2024-06-25 00:33:57 +--> +<template> + <Card title="琛屼负閰嶇疆"> + <BasicForm @register="registerForm"> + <template #addItem="{ field }"> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="handleSelectItem" + preIcon="search|svg" + /> + <GeneralModal @register="registerItemAdd" @success="handleItemSuccess" /> + </template> + </BasicForm> + </Card> +</template> +<script lang="ts" setup> + import { unref } from 'vue'; + import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; + import { Card } from 'ant-design-vue'; + import { useModal } from '/@/components/Modal'; + import { useUserStore } from '/@/store/modules/user'; + import { useI18n } from '/@/hooks/web/useI18n'; + import { GetEnum } from '/@/api/tigerapi/system'; + import { useLocale } from '/@/locales/useLocale'; + + const { t } = useI18n(); + const { getLocale } = useLocale(); + const emit = defineEmits(['success', 'register']); + const [registerItemAdd, { openModal: openItemModal }] = useModal(); + + const formSchema: FormSchema[] = [ + { + field: 'ACT_NAME', + label: '琛屼负鍚嶇О', + required: true, + component: 'Input', + colProps: { span: 12 }, + }, + { + field: 'ID', + label: 'ID', + component: 'Input', + show: false, + }, + { + field: 'ORDER_DESC', + label: '宸ュ崟鎻忚堪', + component: 'Input', + show: false, + colProps: { span: 12 }, + }, + { + field: 'ACT_TYPE', + label: '琛屼负绫诲瀷', + component: 'ApiSelect', + colProps: { span: 12 }, + defaultValue: '', + componentProps: { + api: GetEnum, + params: { name: 'MES_CUSTOM_ACT+ACT_TYPEs' }, + resultField: 'Data', + labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name', + valueField: 'Value', + // onChange: (e, v) => { + // alert(e) + // console.log('ApiSelect====>:', e, v); + // }, + }, + }, + { + field: 'IS_ACTIVE', + label: '鏄惁鍚敤', + required: true, + component: 'Select', + colProps: { span: 12 }, + componentProps: { + options: [ + { + label: '鏄�', + value: 'Y', + key: 'Y', + }, + { + label: '鍚�', + value: 'N', + key: 'N', + }, + ], + }, + }, + { + field: 'STATUS', + label: '鐘舵��', + component: 'Input', + show: false, + }, + { + field: 'DO_TYPE', + label: '鑷畾涔夋柟娉曠被鍨�', + required: true, + component: 'ApiSelect', + colProps: { span: 12 }, + componentProps: { + api: GetEnum, + params: { name: 'MES_CUSTOM_ACT+DO_TYPEs' }, + resultField: 'Data', + labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name', + valueField: 'Value', + // onChange: (e, v) => { + // alert(e) + // console.log('ApiSelect====>:', e, v); + // }, + }, + }, + { + field: 'DO_METHOD', + label: '鑷畾涔夋柟娉�', + required: true, + component: 'Input', + colProps: { span: 12 }, + }, + // { + // field: '0', + // component: 'Input', + // label: '1', + // colSlot: 'addItem', + // colProps: { + // span: 4, + // }, + // }, + { + field: 'DO_IF_PASS', + label: '閫氳繃鏃舵墽琛�', + //required: true, + component: 'Input', + colProps: { span: 12 }, + }, + { + field: 'DO_IF_FAIL', + label: '澶辫触鏃舵墽琛�', + //required: true, + component: 'Input', + colProps: { span: 12 }, + }, + { + field: 'REMARK', + label: '澶囨敞', + component: 'Input', + colProps: { span: 12 }, + }, + ]; + const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ + labelWidth: 120, + schemas: formSchema, + actionColOptions: { + offset: 8, + span: 24, + }, + wrapperCol: { + span: 15, + }, + showActionButtonGroup: true, + submitButtonOptions: { + text: '鎻愪氦', + }, + }); + + async function handleSubmit() { + // try { + // const values = await validate(); + // setDrawerProps({ confirmLoading: true }); + // // TODO custom api + // //淇濆瓨宸ュ崟 + // if (!unref(isUpdate)) { + // values.STATUS = 0; + // } + // values.AUTH_PROD = useUserStore().getUserInfo.prodCode; + // values.FACTORY = useUserStore().getUserInfo.prodCode; + // const apiAction = SaveEntity(values, unref(isUpdate), 'BIZ_MES_WO'); + // apiAction.then((action) => { + // if (action.IsSuccessed) { + // closeDrawer(); + // emit('success'); + // } + // }); + // } finally { + // setDrawerProps({ confirmLoading: false }); + // } + } + + //鐐瑰嚮鎵撳紑鐗╂枡鍒楄〃妗� + function handleSelectItem() { + 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' }, + }); + } + + function handleItemSuccess(d, u) { + setFieldsValue({ + ITEM_CODE: d.values['val'], + }); + } +</script> diff --git a/src/views/tigerprojects/system/lowcode/composition/RouteAction.vue b/src/views/tigerprojects/system/lowcode/composition/AddRoute.vue similarity index 98% rename from src/views/tigerprojects/system/lowcode/composition/RouteAction.vue rename to src/views/tigerprojects/system/lowcode/composition/AddRoute.vue index f72ddea..4e21485 100644 --- a/src/views/tigerprojects/system/lowcode/composition/RouteAction.vue +++ b/src/views/tigerprojects/system/lowcode/composition/AddRoute.vue @@ -4,10 +4,10 @@ * @version: * @Date: 2024-06-20 12:13:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-24 10:56:19 + * @LastEditTime: 2024-06-25 00:07:08 --> <template> - <Card title="鎿嶄綔"> + <Card title="娣诲姞宸ヨ壓"> <CardGrid v-for="item in navItems" :key="item.title" @click="changeItem(item.action)"> <span class="flex flex-col items-center"> <Icon :icon="item.icon" :color="item.color" size="20" /> diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue index eb739c3..176cb34 100644 --- a/src/views/tigerprojects/system/lowcode/composition/index.vue +++ b/src/views/tigerprojects/system/lowcode/composition/index.vue @@ -21,7 +21,8 @@ add @handle-add="handleAdd" --> <div class="w-3/4 xl:w-4/5 p-5"> - <RouteAction v-if="entityName == 'ProdRouteBinding' && rotType == 'Product'" /> + <AddRoute v-if="entityName == 'ProdRouteBinding' && rotType == 'Product'" /> + <ActionConfig v-if="entityName == 'ProdRouteBinding' && rotType == 'Action'" /> </div> <!-- <BasicTable class="w-3/4 xl:w-4/5" @register="registerTable"> <template #toolbar> @@ -67,7 +68,8 @@ import GeneralTree from '/@/views/components/GeneralTree.vue'; import { useModal } from '@/components/Modal'; import GeneralModal from '/@/views/components/GeneralModal.vue'; - import RouteAction from './RouteAction.vue'; + import AddRoute from './AddRoute.vue'; + import ActionConfig from './ActionConfig.vue'; import CustModal from '/@/views/components/CustModal.vue'; import { OpenCustModal } from '../data'; import { Ref, onMounted, provide, reactive, ref } from 'vue'; @@ -104,6 +106,7 @@ const pageTitle = ref(objParams.value.pageTitle); const pageContent = ref(objParams.value.pageContent); const prodCode = ref(''); + const actionCode = ref(''); const rotType = ref(''); const isMounted = ref(false); const custImport = ref<any>(null); @@ -111,6 +114,7 @@ const [registerItemAdd, { openModal: openItemModal }] = useModal(); const [registerDrawer, { openDrawer }] = useDrawer(); provide<Ref<string>>('prodCode', prodCode); + provide<Ref<string>>('actionCode', actionCode); setTitle(objParams.value.Title); //璁剧疆鏍囩椤垫爣棰� /** @@ -121,11 +125,11 @@ async function fetch(type: string) { if (!isNullOrUnDef(custImport.value)) { const [{ fetchTreeData }] = custImport.value['default'](); - //鏍规嵁type鑾峰彇鏍戝舰鏁版嵁 - const data = await fetchTreeData(type, objParams.value.CODE); - title.value = data.title; - treeData.value = data.treeData; - fieldNames.value = data.fieldNames; + //鏍规嵁type鑾峰彇鏍戝舰鏁版嵁 + const data = await fetchTreeData(type, objParams.value.CODE); + title.value = data.title; + treeData.value = data.treeData; + fieldNames.value = data.fieldNames; } } @@ -155,7 +159,7 @@ if (isNullOrUnDef(custImport.value)) { return ''; } else { - const [{CreateIcon}] = custImport.value['default'](); + const [{ CreateIcon }] = custImport.value['default'](); return CreateIcon(params); } } @@ -172,8 +176,9 @@ function handleSelect(deptId = '', info) { searchInfo.deptId = deptId; - prodCode.value = info.selectedNodes[0].code; rotType.value = info.selectedNodes[0].type; + prodCode.value =rotType.value=='Product'? info.selectedNodes[0].code: prodCode.value; + actionCode.value =rotType.value=='Action'? info.selectedNodes[0].code: actionCode.value; // reload(); } 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 7ebd613..6cffcb7 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BAS_DEFECT_GRP.ts @@ -4,12 +4,13 @@ * @version: * @Date: 2024-06-19 20:34:27 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-24 15:52:18 + * @LastEditTime: 2024-06-25 11:28:25 */ import { ActionItem, BasicColumn } from '/@/components/Table'; import { buildUUID } from '/@/utils/uuid'; import { useI18n } from '/@/hooks/web/useI18n'; +import { isNullOrUnDef } from '/@/utils/is'; const { t } = useI18n(); function _default() { @@ -63,15 +64,17 @@ * @return {*} */ ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { - data[0].onClick = DftGrpEdit.bind(null, args, params); + if (!isNullOrUnDef(data[0])) { + data[0].onClick = DftGrpEdit.bind(null, args, params); + } return data; }, - GetSelectSuccess:(d, u) => { + GetSelectSuccess: (d, u) => { return { ITEM_CODE: d.values['val'], }; }, - OpenSelectItem:(openItemModal: Fn) => { + OpenSelectItem: (openItemModal: Fn) => { openItemModal(true, { title: '鐗╂枡鍒楄〃', schemas: [ @@ -102,9 +105,9 @@ ], tableName: 'BAS_ITEM', rowKey: 'ITEM_CODE', - searchInfo: {TABLE_NAME: 'BAS_ITEM'} + searchInfo: { TABLE_NAME: 'BAS_ITEM' }, }); - } + }, }; return [methods, ActionColumn]; diff --git a/src/views/tigerprojects/system/lowcode/normal/index.vue b/src/views/tigerprojects/system/lowcode/normal/index.vue index d3a3514..82d1228 100644 --- a/src/views/tigerprojects/system/lowcode/normal/index.vue +++ b/src/views/tigerprojects/system/lowcode/normal/index.vue @@ -4,40 +4,10 @@ * @version: * @Date: 2024-05-30 13:28:20 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-24 18:10:10 + * @LastEditTime: 2024-06-24 18:49:29 --> <template> <div> - <!-- <BasicTable @register="registerTable" v-if="isMounted"> - <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"> - <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" /> --> <Suspense> <mainTable /> </Suspense> diff --git a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue index e55e784..b89a03b 100644 --- a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue +++ b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue @@ -107,7 +107,9 @@ ] = isNullOrUnDef(custImport.value['default']) ? EntityCustFunction.value : custImport.value['default'](); - others.value = OthersValues(objParams['CODE'], objParams['ID']); + others.value = isNullOrUnDef(OthersValues) + ? {} + : OthersValues(objParams['CODE'], objParams['ID']); const [registerTable, { getForm, reload, setProps }] = useTable({ title: '鍒楄〃淇℃伅', api: getListByPage, @@ -257,7 +259,7 @@ case 'drawer': openDrawer(true, { isUpdate: false, - entityName: objParams.value.ID, + entityName: entityName.value, formJson: _crudFormSchema.value, crudColSlots: objParams['crudColSlots'], isExistSql: isExistSql.value, diff --git a/src/views/tigerprojects/system/menu/index.vue b/src/views/tigerprojects/system/menu/index.vue index 82b309b..fabbd90 100644 --- a/src/views/tigerprojects/system/menu/index.vue +++ b/src/views/tigerprojects/system/menu/index.vue @@ -1,154 +1,213 @@ <template> - <div class="p-2"> - <BasicTable - @register="registerTable" - @fetch-success="onFetchSuccess" - @expanded-rows-change="onExpandedRChg" - > - <template #toolbar> - <a-button type="primary" @click="handleCreate"> 鏂板鑿滃崟 </a-button> - </template> - <template #action="{ record }"> - <TableAction - :actions="[ - { - icon: 'clarity:note-edit-line', - onClick: handleEdit.bind(null, record), - }, - { - icon: 'ant-design:delete-outlined', - color: 'error', - popConfirm: { - title: '鏄惁纭鍒犻櫎?', - placement: 'left', - confirm: handleDelete.bind(null, record), - }, - }, - ]" - /> - </template> - </BasicTable> - <MenuDrawer @register="registerDrawer" @success="handleSuccess" /> - </div> + <PageWrapper title="鑿滃崟绠$悊" content="杩欓噷鏄彍鍗曠殑澧炲姞鍒犻櫎鍜屼慨鏀�" contentBackground> + <template #footer> + <a-tabs default-active-key="detail" v-model:activeKey="currentKey"> + <a-tab-pane key="detailfirst" tab="BS鑿滃崟" /> + <a-tab-pane key="detailsecond" tab="PDA鑿滃崟" /> + </a-tabs> + </template> + <div> + <div v-if="currentKey == 'detailfirst'"> + <div class="p-2"> + <BasicTable + @register="registerTable" + @fetch-success="onFetchSuccess" + @expanded-rows-change="onExpandedRChg" + > + <template #toolbar> + <a-button type="primary" @click="handleCreate"> 鏂板鑿滃崟 </a-button> + </template> + <template #action="{ record }"> + <TableAction + :actions="[ + { + icon: 'clarity:note-edit-line', + onClick: handleEdit.bind(null, record), + }, + { + icon: 'ant-design:delete-outlined', + color: 'error', + popConfirm: { + title: '鏄惁纭鍒犻櫎?', + placement: 'left', + confirm: handleDelete.bind(null, record), + }, + }, + ]" + /> + </template> + </BasicTable> + </div> + </div> + <div v-if="currentKey == 'detailsecond'"> + <div class="p-2"> + <BasicTable + @register="registerTableSecond" + @fetch-success="onFetchSuccess" + @expanded-rows-change="onExpandedRChg" + > + <template #toolbar> + <a-button type="primary" @click="handleCreate"> 鏂板鑿滃崟 </a-button> + </template> + <template #action="{ record }"> + <TableAction + :actions="[ + { + icon: 'clarity:note-edit-line', + onClick: handleEdit.bind(null, record), + }, + { + icon: 'ant-design:delete-outlined', + color: 'error', + popConfirm: { + title: '鏄惁纭鍒犻櫎?', + placement: 'left', + confirm: handleDelete.bind(null, record), + }, + }, + ]" + /> + </template> + </BasicTable> + </div> + </div> + <MenuDrawer @register="registerDrawer" @success="handleSuccess" /> + </div> + </PageWrapper> </template> -<script lang="ts"> - import { defineComponent, nextTick, ref, unref } from 'vue'; - +<script lang="ts" setup> + import { nextTick, ref, unref } from 'vue'; + import { PageWrapper } from '/@/components/Page'; import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { getMenuList, DeleteMenu } from '/@/api/tigerapi/system'; import { useDrawer } from '/@/components/Drawer'; import MenuDrawer from './MenuDrawer.vue'; - + import { Tabs } from 'ant-design-vue'; import { columns, searchFormSchema } from './menu.data'; - export default defineComponent({ - name: 'MenuManagement', - components: { BasicTable, MenuDrawer, TableAction }, - setup() { - const expandedRowKeys = ref<string[]>([]); - const [registerDrawer, { openDrawer }] = useDrawer(); - const [registerTable, { reload, expandAll, expandRows }] = useTable({ - // const [registerTable, { reload, expandRows }] = useTable({ - title: '鑿滃崟鍒楄〃', - api: getMenuList, - columns, - // formConfig: { - // labelWidth: 120, - // schemas: searchFormSchema, - // }, - isTreeTable: true, - // 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, - }, - rowKey: 'id', - }); - - function handleCreate() { - openDrawer(true, { - isUpdate: false, - }); - } - - function handleEdit(record: Recordable) { - openDrawer(true, { - record, - isUpdate: true, - }); - } - - function handleDelete(record: Recordable) { - console.log(record); - //鍒犻櫎鑿滃崟 - const apiAction = DeleteMenu(record); - apiAction.then((onfulfilled) => { - if (onfulfilled.IsSuccessed) { - reload(); - } - }); - } - - function handleSuccess({ values }) { - reload(); - nextTick(() => { - setTimeout(() => { - var tdList = document.querySelectorAll( - '.ant-table-cell.ant-table-cell-ellipsis.ant-table-cell-with-append', - ); - for (var i = 0; i < tdList.length; i++) { - if (tdList[i].attributes['title'].nodeValue == values.menuName) { - tdList[i].scrollIntoView(); - } - } - }, 1000); - // console.log( - // document.querySelectorAll( - // '.ant-table-cell.ant-table-cell-ellipsis.ant-table-cell-with-append', - // )[8].attributes['title'].nodeValue, //[8].attributes['data-row-key'].nodeValue - // values.menuName, - // ); - }); - } - - function onFetchSuccess(record: Recordable) { - // 婕旂ず榛樿灞曞紑鎵�鏈夎〃椤� - nextTick(() => { - if (expandedRowKeys.value.length == 0) { - expandAll(); - } else { - expandRows(expandedRowKeys.value); - } - }); - console.log(record); - //nextTick(collapseAll); - // expandRows([record.items[1].id]); - } - - function onExpandedRChg(record: Recordable) { - expandedRowKeys.value = record; - console.log(11, record); - } - - return { - registerTable, - registerDrawer, - handleCreate, - handleEdit, - handleDelete, - handleSuccess, - onFetchSuccess, - onExpandedRChg, - }; + const ATabs = ref(Tabs); + const ATabPane = ref(Tabs.TabPane); + var currentKey = ref('detailfirst'); + const expandedRowKeys = ref<string[]>([]); + const [registerDrawer, { openDrawer }] = useDrawer(); + const [registerTable, { reload, expandAll, expandRows }] = useTable({ + // const [registerTable, { reload, expandRows }] = useTable({ + title: '鑿滃崟鍒楄〃', + api: getMenuList, + searchInfo: { menuName: 'BS 鑿滃崟' }, + columns, + // formConfig: { + // labelWidth: 120, + // schemas: searchFormSchema, + // }, + isTreeTable: true, + // 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, }, + rowKey: 'id', }); + + const [registerTableSecond, { reloadSecond, expandAllSecond, expandRowsSecond }] = useTable({ + // const [registerTable, { reload, expandRows }] = useTable({ + title: '鑿滃崟鍒楄〃', + api: getMenuList, + searchInfo: { menuName: 'PDA' }, + columns, + // formConfig: { + // labelWidth: 120, + // schemas: searchFormSchema, + // }, + isTreeTable: true, + // 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, + }, + rowKey: 'id', + }); + + function handleCreate() { + openDrawer(true, { + isUpdate: false, + }); + } + + function handleEdit(record: Recordable) { + openDrawer(true, { + record, + isUpdate: true, + }); + } + + function handleDelete(record: Recordable) { + console.log(record); + //鍒犻櫎鑿滃崟 + const apiAction = DeleteMenu(record); + apiAction.then((onfulfilled) => { + if (onfulfilled.IsSuccessed) { + reload(); + } + }); + } + + function handleSuccess({ values }) { + reload(); + nextTick(() => { + setTimeout(() => { + var tdList = document.querySelectorAll( + '.ant-table-cell.ant-table-cell-ellipsis.ant-table-cell-with-append', + ); + for (var i = 0; i < tdList.length; i++) { + if (tdList[i].attributes['title'].nodeValue == values.menuName) { + tdList[i].scrollIntoView(); + } + } + }, 1000); + // console.log( + // document.querySelectorAll( + // '.ant-table-cell.ant-table-cell-ellipsis.ant-table-cell-with-append', + // )[8].attributes['title'].nodeValue, //[8].attributes['data-row-key'].nodeValue + // values.menuName, + // ); + }); + } + + function onFetchSuccess(record: Recordable) { + // 婕旂ず榛樿灞曞紑鎵�鏈夎〃椤� + nextTick(() => { + if (expandedRowKeys.value.length == 0) { + // expandAll(); + } else { + expandRows(expandedRowKeys.value); + } + }); + console.log(record); + //nextTick(collapseAll); + // expandRows([record.items[1].id]); + } + + function onExpandedRChg(record: Recordable) { + expandedRowKeys.value = record; + console.log(11, record); + } </script> -- Gitblit v1.9.3