From 0990f596791ebc4518e293a2d60407ff1165b53c Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期五, 21 六月 2024 18:09:31 +0800 Subject: [PATCH] 菜单更新 --- src/views/tigerprojects/system/lowcode/composition/index.vue | 197 ++++++++++++++++++++++++++---------------------- 1 files changed, 107 insertions(+), 90 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue index 079bbf6..b1beefd 100644 --- a/src/views/tigerprojects/system/lowcode/composition/index.vue +++ b/src/views/tigerprojects/system/lowcode/composition/index.vue @@ -1,8 +1,17 @@ <template> - <PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> - <CustTree + <PageWrapper + :dense="dense" + contentFullHeight + fixedHeight + contentClass="flex" + :title="pageTitle" + :content="pageContent" + @back="goBack" + > + <GeneralTree class="w-1/4 xl:w-1/5" @select="handleSelect" + @UnSelect="UnSelect" :title="title" :treeData="treeData" :create-icon="createIcon" @@ -10,7 +19,10 @@ /><!-- add @handle-add="handleAdd" --> - <BasicTable class="w-3/4 xl:w-4/5" @register="registerTable"> + <div class="w-3/4 xl:w-4/5 p-5"> + <RouteAction v-if="entityName == 'ProdRouteBinding' && rotType=='Product'" /> + </div> + <!-- <BasicTable class="w-3/4 xl:w-4/5" @register="registerTable"> <template #toolbar> <a-button type="primary" @click="handleCreate" preIcon="add_02|svg"> 鏂板 </a-button> </template> @@ -19,8 +31,8 @@ <TableAction :actions="createActions(record)" /> </template> </template> - </BasicTable> - <normalDrawer @register="registerDrawer" @success="handleSuccess" /> + </BasicTable> --> + <!-- <normalDrawer @register="registerDrawer" @success="handleSuccess" /> --> <CustModal @register="registerCust" @success="custSuccess" @@ -38,7 +50,7 @@ @click="handleCustClick(field)" :preIcon="item.preIcons[name]" /> - <NormalModal + <GeneralModal @register="useModalData[name][0]" @success="(d, u) => handleEntSuccess(d, u, item.name)" /> @@ -50,35 +62,35 @@ </PageWrapper> </template> <script lang="ts" setup> - import { BasicTable, useTable, TableAction } from '@/components/Table'; - import { getEntity, getRoleListByPage, convertToTree } from '@/api/tigerapi/system'; import { PageWrapper } from '@/components/Page'; - import CustTree from './CustTree.vue'; + import GeneralTree from '/@/views/components/GeneralTree.vue'; import { useModal } from '@/components/Modal'; - import normalDrawer from '../normalDrawer.vue'; - import NormalModal from '/@/views/components/NormalModal.vue'; + import GeneralModal from '/@/views/components/GeneralModal.vue'; + import RouteAction from './RouteAction.vue'; import CustModal from '/@/views/components/CustModal.vue'; - import { columns, searchFormSchema } from './dept.data'; import { - GetActionsData, GetSelectSuccess, OpenCustModal, fetchTreeData, - getFormSchema, + getHomeUrl, getOthersValues, } from '../data'; - import { onMounted, reactive, ref } from 'vue'; + import { Ref, onMounted, provide, reactive, ref } from 'vue'; import { useRoute } from 'vue-router'; import { useDrawer } from '/@/components/Drawer'; import { BasicForm, useForm } from '/@/components/Form/index'; import { TreeItem } from '/@/components/TigerTree'; import { createIconByType } from '../data'; -import { RouteToProd } from '/@/api/tigerapi/mes/router'; + import { useTabs } from '/@/hooks/web/useTabs'; + import { isNullOrUnDef } from '/@/utils/is'; + import { useGo } from '/@/hooks/web/usePage'; defineOptions({ name: 'DeptManagement' }); + const go = useGo(); const route = useRoute(); - const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); + const { setTitle } = useTabs(); + const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); //ref(JSON.parse(history.state.obj)) const entityName = ref(objParams.value.Name); const formSchemas = ref({}); //寮瑰嚭妗嗘垨楂樼骇椤甸潰澶氳〃鍗曠粨鏋� const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 @@ -94,45 +106,60 @@ const treeData = ref<TreeItem[]>([]); const title = ref(''); const fieldNames = ref({}); + 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 [registerCust, { openModal: openCustomModal, closeModal }] = useModal(); const [registerItemAdd, { openModal: openItemModal }] = useModal(); const [registerDrawer, { openDrawer }] = useDrawer(); - 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, - }, - }); + 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: 鑾峰彇鏍戝舰鏁版嵁 * @param {*} type * @return {*} - */ + */ async function fetch(type: string) { //鏍规嵁type鑾峰彇鏍戝舰鏁版嵁 - const data = await fetchTreeData(type); + const data = await fetchTreeData(type, objParams.value.CODE); title.value = data.title; treeData.value = data.treeData; fieldNames.value = data.fieldNames; + } + + /** + * @description: 椤甸潰宸︿晶鐐瑰嚮杩斿洖閾炬帴鏃剁殑鎿嶄綔 + * @return {*} + */ + function goBack() { + go(getHomeUrl(entityName.value)); } // function handleAdd(){ @@ -144,7 +171,7 @@ * @param {*} params * @param {*} type * @return {*} - */ + */ function createIcon(params: Recordable<any>) { return createIconByType(params, entityName.value); } @@ -159,25 +186,25 @@ * @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, - ); + // 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, + // ); } /** @@ -194,29 +221,6 @@ return validates; } - function handleCreate() { - // validate().then((res) => { - // const Keys = Object.getOwnPropertyNames(useFormData.value); - // let i; - // for (i = 0; i < Keys.length; i++) { - // others.value[objParams.value.pCode] = objParams.value.IsID - // ? res[Keys[i]]['ID'] - // : res[Keys[i]][objParams.value.pCode]; - // } - // openDrawer(true, { - // isUpdate: false, - // ifSave: true, - // entityName: entityName.value, - // formJson: getFormSchema(`${entityName.value}_Crud`), - // crudColSlots, - // others: others.value, - // }); - // }); - RouteToProd({rotId: 'e4712192f75b465585107fdcd13d8003', prodCode: 'K5019AA013517'}).then(() => { - - }); - } - // function handleEdit(record: Recordable) { // openModal(true, { // record, @@ -228,14 +232,27 @@ // console.log(record); // } - function handleSelect(deptId = '') { + function handleSelect(deptId = '', info) { searchInfo.deptId = deptId; - reload(); + prodCode.value = info.selectedNodes[0].code; + rotType.value = info.selectedNodes[0].type; + // reload(); } - function handleSuccess() { - reload(); + /** + * @description: 鍙栨秷閫夋嫨鏃朵簨浠惰繑鍥炴柟娉� + * @param {*} node + * @return {*} + */ + function UnSelect(node) { + prodCode.value = ''; + rotType.value = ''; + // reload(); } + + // function handleSuccess() { + // reload(); + // } /** * @description: 寮瑰嚭妗嗙‘瀹氳繑鍥� @@ -243,7 +260,7 @@ * @return {*} */ function custSuccess(d) { - reload(); + // reload(); } /** -- Gitblit v1.9.3