|
@@ -1,11 +1,11 @@
|
|
|
-import { BtnList as btnType } from '@/common/components/btnList/interface';
|
|
|
|
|
|
|
+import { BtnClassName, BtnListType } from '@/common/components/btnList/interface';
|
|
|
import { EnumRouterName } from '@/common/constants/enumRouterName';
|
|
import { EnumRouterName } from '@/common/constants/enumRouterName';
|
|
|
import { ModalName } from '@/common/constants/modalName';
|
|
import { ModalName } from '@/common/constants/modalName';
|
|
|
import { OperationTabMenu } from '@/services/go/commonService/interface';
|
|
import { OperationTabMenu } from '@/services/go/commonService/interface';
|
|
|
import { sessionStorageUtil } from "@/utils/storage";
|
|
import { sessionStorageUtil } from "@/utils/storage";
|
|
|
import { inject, ref, Ref, toRaw, unref } from 'vue';
|
|
import { inject, ref, Ref, toRaw, unref } from 'vue';
|
|
|
import { openModal } from "../modal";
|
|
import { openModal } from "../modal";
|
|
|
-import { BtnClassName, BtnList, ButtonListKey } from './interface';
|
|
|
|
|
|
|
+import { ButtonListKey } from './interface';
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取class 名
|
|
* 获取class 名
|
|
@@ -44,14 +44,14 @@ export function getThirdMenuData(): OperationTabMenu[] {
|
|
|
}
|
|
}
|
|
|
// 旧的获取配置按钮逻辑,
|
|
// 旧的获取配置按钮逻辑,
|
|
|
export function handleBtnList(list: OperationTabMenu | undefined, menuType: keyof ButtonListKey, hasDetail: boolean, commonName: string[] = ['新增']) {
|
|
export function handleBtnList(list: OperationTabMenu | undefined, menuType: keyof ButtonListKey, hasDetail: boolean, commonName: string[] = ['新增']) {
|
|
|
- const commonBtn = ref<BtnList[]>([]); // 通用按钮列表,不用选中数据才显示
|
|
|
|
|
- const forDataBtn = ref<BtnList[]>([]); // 针对数据按钮列表,选中某条数据才显示
|
|
|
|
|
|
|
+ const commonBtn = ref<BtnListType[]>([]); // 通用按钮列表,不用选中数据才显示
|
|
|
|
|
+ const forDataBtn = ref<BtnListType[]>([]); // 针对数据按钮列表,选中某条数据才显示
|
|
|
if (list && list.children) {
|
|
if (list && list.children) {
|
|
|
list.children.forEach(e => {
|
|
list.children.forEach(e => {
|
|
|
const { code, type, title, isshow } = e;
|
|
const { code, type, title, isshow } = e;
|
|
|
if (type === 2 && isshow) { // 按钮类型
|
|
if (type === 2 && isshow) { // 按钮类型
|
|
|
const { openAction } = openModal(code as keyof ModalName);
|
|
const { openAction } = openModal(code as keyof ModalName);
|
|
|
- const item = { lable: title, callback: openAction, className: getClassName(code) }
|
|
|
|
|
|
|
+ const item = { lable: title, callback: openAction, className: getClassName(code), code: code }
|
|
|
if (commonName.includes(title)) { //
|
|
if (commonName.includes(title)) { //
|
|
|
commonBtn.value.push(item)
|
|
commonBtn.value.push(item)
|
|
|
} else {
|
|
} else {
|
|
@@ -65,14 +65,14 @@ export function handleBtnList(list: OperationTabMenu | undefined, menuType: keyo
|
|
|
// 详情
|
|
// 详情
|
|
|
if (hasDetail) {
|
|
if (hasDetail) {
|
|
|
const { openAction } = openModal('detail')
|
|
const { openAction } = openModal('detail')
|
|
|
- forDataBtn.value.push({ lable: '详情', callback: openAction, className: getClassName('') })
|
|
|
|
|
|
|
+ forDataBtn.value.push({ lable: '详情', callback: openAction, className: getClassName(''), code: 'detail' })
|
|
|
}
|
|
}
|
|
|
return { commonBtn, forDataBtn }
|
|
return { commonBtn, forDataBtn }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 新的获取按钮逻辑,有时间把旧的都替换掉
|
|
// 新的获取按钮逻辑,有时间把旧的都替换掉
|
|
|
export function _handleBtnList_(list: OperationTabMenu | undefined, hasDetail: boolean,) {
|
|
export function _handleBtnList_(list: OperationTabMenu | undefined, hasDetail: boolean,) {
|
|
|
- const result = ref<btnType[][]>([])
|
|
|
|
|
|
|
+ const result = ref<BtnListType[][]>([])
|
|
|
const temp: [number, OperationTabMenu[] | undefined] = [0, list?.children]
|
|
const temp: [number, OperationTabMenu[] | undefined] = [0, list?.children]
|
|
|
while (temp[1] && temp[1].length) {
|
|
while (temp[1] && temp[1].length) {
|
|
|
temp[1].forEach((e) => {
|
|
temp[1].forEach((e) => {
|
|
@@ -117,7 +117,7 @@ export function _handleBtnList_(list: OperationTabMenu | undefined, hasDetail: b
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function _handleBtnList(list: OperationTabMenu | undefined, hasDetail: boolean,) {
|
|
export function _handleBtnList(list: OperationTabMenu | undefined, hasDetail: boolean,) {
|
|
|
- const result = ref<BtnList[][]>([])
|
|
|
|
|
|
|
+ const result = ref<BtnListType[][]>([])
|
|
|
const temp: [number, OperationTabMenu[] | undefined] = [0, list?.children]
|
|
const temp: [number, OperationTabMenu[] | undefined] = [0, list?.children]
|
|
|
while (temp[1] && temp[1].length) {
|
|
while (temp[1] && temp[1].length) {
|
|
|
temp[1].forEach((e) => {
|
|
temp[1].forEach((e) => {
|
|
@@ -128,7 +128,7 @@ export function _handleBtnList(list: OperationTabMenu | undefined, hasDetail: bo
|
|
|
}
|
|
}
|
|
|
if (type === 2 && isshow) { // 按钮类型 并且显示
|
|
if (type === 2 && isshow) { // 按钮类型 并且显示
|
|
|
const { openAction } = openModal(code as keyof ModalName);
|
|
const { openAction } = openModal(code as keyof ModalName);
|
|
|
- const item = { lable: title, callback: openAction, className: getClassName(code) }
|
|
|
|
|
|
|
+ const item = { lable: title, callback: openAction, className: getClassName(code), code: code }
|
|
|
result.value[index].push(item)
|
|
result.value[index].push(item)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -143,7 +143,7 @@ export function _handleBtnList(list: OperationTabMenu | undefined, hasDetail: bo
|
|
|
// 详情
|
|
// 详情
|
|
|
if (hasDetail) {
|
|
if (hasDetail) {
|
|
|
const { openAction } = openModal('detail')
|
|
const { openAction } = openModal('detail')
|
|
|
- const item = { lable: '详情', callback: openAction, className: getClassName('') }
|
|
|
|
|
|
|
+ const item = { lable: '详情', callback: openAction, className: getClassName(''), code: 'detail' }
|
|
|
const len = result.value.length;
|
|
const len = result.value.length;
|
|
|
if (len) {
|
|
if (len) {
|
|
|
result.value[len - 1].push(item)
|
|
result.value[len - 1].push(item)
|
|
@@ -158,7 +158,7 @@ export function _handleBtnList(list: OperationTabMenu | undefined, hasDetail: bo
|
|
|
|
|
|
|
|
// 获取单据按钮列表
|
|
// 获取单据按钮列表
|
|
|
export function getOrderBtnList(list: OperationTabMenu[], hasDetail = false) {
|
|
export function getOrderBtnList(list: OperationTabMenu[], hasDetail = false) {
|
|
|
- const result = ref<btnType[]>([])
|
|
|
|
|
|
|
+ const result = ref<BtnListType[]>([])
|
|
|
list.forEach(el => {
|
|
list.forEach(el => {
|
|
|
const { code, type, title, isshow } = el;
|
|
const { code, type, title, isshow } = el;
|
|
|
if (type === 2 && isshow) {
|
|
if (type === 2 && isshow) {
|
|
@@ -187,7 +187,7 @@ export function getBtnList(menuType: keyof ButtonListKey, hasDetail: boolean, co
|
|
|
return handleBtnList(list, menuType, hasDetail, commonName)
|
|
return handleBtnList(list, menuType, hasDetail, commonName)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export function _getBtnList(menuType: keyof ButtonListKey, hasDetail: boolean): Ref<BtnList[][]> {
|
|
|
|
|
|
|
+export function _getBtnList(menuType: keyof ButtonListKey, hasDetail: boolean): Ref<BtnListType[][]> {
|
|
|
const data = getThirdMenuData()
|
|
const data = getThirdMenuData()
|
|
|
const list = data.find((e) => e.code === menuType);
|
|
const list = data.find((e) => e.code === menuType);
|
|
|
return _handleBtnList(list, hasDetail)
|
|
return _handleBtnList(list, hasDetail)
|