| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import { initData } from '@/common/methods';
- import APP from '@/services';
- import { OperationTabMenu, OperationTabMenuAuth } from '@/services/go/commonService/interface';
- import { ref } from 'vue';
- // 单据菜单数据
- const orderList = ref<OperationTabMenu[]>([])
- // 选中的具体tab下的数据
- const recordItemTab = ref<OperationTabMenuAuth[]>([])
- const isBottom = ref<boolean>(false)
- // 处理页面下半部分数据
- export function handleOrderData() {
- const componentId = ref<string>()
- initData(() => {
- const menuList = APP.getRef('menus');
- const findResult = menuList.value.find((e: OperationTabMenu) => e.code === 'bottom');
- if (findResult) {
- isBottom.value = true
- const list = findResult.children;
- orderList.value = list
- if (list.length) {
- componentId.value = list[0].code
- }
- }
- });
- return { isBottom, orderList, componentId }
- }
- export function getHasBottom() {
- return isBottom
- }
- // 根据 code 获取单据对应子菜单配置数据
- export function handleOrderDetailList(code: string) {
- // 选中的组件,默认第一个
- const componentId = ref<string>()
- const tabList = ref<OperationTabMenu[]>([])
- // 过滤,获取当前tab页配置数据
- function filerAction() {
- const temp = orderList.value.find(e => e.code === code)
- if (temp) {
- tabList.value = temp.children
- // 判断是否有底部切换菜单
- if (temp.children.length) {
- const { code, auth } = temp.children[0]
- recordItemTab.value = auth ?? []
- componentId.value = code
- }
- }
- }
- // 切换tab组件
- function changeTab(index: number, item: OperationTabMenu) {
- recordItemTab.value = item.auth ?? []
- console.log('当前底部组件名:', item.code)
- componentId.value = item.code
- }
- filerAction()
- return { tabList, componentId, changeTab }
- }
- export function getRecordItemTab(): OperationTabMenuAuth[] {
- return recordItemTab.value
- }
|