Skip to content

Commit 2a848a9

Browse files
committed
更新2.0.8
1 parent 41ecdf1 commit 2a848a9

File tree

11 files changed

+110
-12
lines changed

11 files changed

+110
-12
lines changed

public/config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const config = {
1414
// 多个可切换的host
1515
HOSTS: [],
1616
},
17+
MENU: {
18+
SHOWURL: false,
19+
WIDTH: 300,
20+
},
1721
// 多语言
1822
LANG: [
1923
{

src/api/interface/config.ts

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { FormItemType } from "@/components/DataForm/interface";
2+
13
export interface GetConfigState {
24
lang?: string;
35
}
@@ -41,6 +43,9 @@ export interface ConfigAppItem {
4143
export interface ConfigAppGroupItem {
4244
title: string;
4345
name: string;
46+
label?: string;
47+
value?: string;
48+
key?: string;
4449
children?: ConfigAppGroupItem[];
4550
}
4651

@@ -75,5 +80,43 @@ export interface ConfigGlobalParamItem {
7580
export interface ConfigGeneratorItem {
7681
title: string;
7782
name: string;
78-
files: ObjectType;
83+
files: ConfigGeneratorItemFilesItem[];
84+
form?: ConfigGeneratorItemForm;
85+
table?: ConfigGeneratorItemTable;
86+
}
87+
88+
export interface ConfigGeneratorItemForm {
89+
[key: string]: any;
90+
items: FormItemType[];
91+
}
92+
93+
export interface ConfigGeneratorItemTable {
94+
field_types: any;
95+
items: ConfigGeneratorItemTableItem[];
96+
}
97+
98+
export interface ConfigGeneratorItemTableItem {
99+
title: string;
100+
model_path: string;
101+
default_fields: any;
102+
namespace?: string;
103+
model_tpl?: string;
104+
columns?: ConfigGeneratorItemTableColumn[];
105+
}
106+
107+
export interface ConfigGeneratorItemTableColumn {
108+
title: string;
109+
field: string;
110+
type: string;
111+
slots?: any;
112+
width?: number;
113+
align?: string;
114+
}
115+
116+
export interface ConfigGeneratorItemFilesItem {
117+
name: string;
118+
path: string;
119+
namespace: string;
120+
template?: string;
121+
rules?: any;
79122
}

src/components/Menu/src/MenuItemContent.vue

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,17 @@
1313
<FileMarkdownOutlined v-else-if="item.path && item.type === 'md'" />
1414
<FolderOutlined v-else />
1515

16-
{{ title }}
16+
<span>{{ title }} </span>
17+
<span
18+
v-if="item.controller && feConfig && feConfig.MENU && feConfig.MENU.SHOWURL"
19+
class="menu-item-text"
20+
>{{ item.controller }}
21+
</span>
22+
<span
23+
v-if="item.url && feConfig && feConfig.MENU && feConfig.MENU.SHOWURL"
24+
class="menu-item-text"
25+
>{{ item.url }}
26+
</span>
1727
</span>
1828
</template>
1929
<script lang="ts">
@@ -24,6 +34,8 @@ import {
2434
FolderOutlined,
2535
FileMarkdownOutlined,
2636
} from "@ant-design/icons-vue";
37+
import { useStore } from "vuex";
38+
import { GlobalState } from "@/store";
2739
2840
export default defineComponent({
2941
components: {
@@ -41,13 +53,15 @@ export default defineComponent({
4153
},
4254
setup(props) {
4355
const { t } = useI18n();
56+
let store = useStore<GlobalState>();
4457
const title = computed(() => {
4558
if (props.item.title === "未分组") {
4659
return t("common.notGroup");
4760
}
4861
return props.item.title;
4962
});
50-
return { title };
63+
const feConfig = computed(() => store.state.app.feConfig);
64+
return { title, feConfig };
5165
},
5266
});
5367
</script>
@@ -74,4 +88,9 @@ export default defineComponent({
7488
padding: 0px 10px;
7589
border-radius: 2px;
7690
}
91+
.menu-item-text {
92+
color: #999;
93+
margin-left: 10px;
94+
display: inline-block;
95+
}
7796
</style>

src/components/Menu/src/interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface MenuItemType {
88
url?: string;
99
key?: string;
1010
path?: string;
11+
controller?: string;
1112
}
1213

1314
export interface MenuGroupType {

src/components/TableInput/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { defineComponent, ref, watchEffect } from "vue";
1+
import { defineComponent, ref, watchEffect, PropType } from "vue";
22
import { Input } from "ant-design-vue";
33
import style from "./index.module.less";
44

55
export default defineComponent({
66
props: {
77
data: {
8-
type: String,
8+
type: [String, Number] as PropType<string | number>,
99
default: "",
1010
},
1111
placeholder: {

src/components/VerifyAuth/Index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<a-modal
33
:visible="visible"
44
:width="500"
5-
:closable="false"
65
:destroyOnClose="true"
76
:maskClosable="false"
87
:title="t('auth.title')"

src/layouts/multitabs/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default defineComponent({
7575
});
7676
state.activeKey = route.fullPath;
7777
} else {
78-
message.error(t("common.page.404"));
78+
// message.error(t("common.page.404"));
7979
router.push({
8080
name: "Home",
8181
});
@@ -104,7 +104,7 @@ export default defineComponent({
104104
});
105105
state.activeKey = route.fullPath;
106106
} else {
107-
message.error(t("common.page.404"));
107+
// message.error(t("common.page.404"));
108108
router.push({
109109
name: "Home",
110110
});

src/store/modules/Apidoc/helper.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { MenuItemType } from "@/components/Menu/src/interface";
33
import { createApiPageKey } from "@/utils";
44
import { ApiAnalysisData } from "@/store/modules/Apidoc/interface";
55
import { MdMenuItem } from "@/api/interface/markdown";
6-
import { ConfigAppItem, ConfigGlobalParamItem, ConfigInfo } from "@/api/interface/config";
6+
import {
7+
ConfigAppGroupItem,
8+
ConfigAppItem,
9+
ConfigGlobalParamItem,
10+
ConfigInfo,
11+
} from "@/api/interface/config";
712
import Cache from "@/utils/cache";
813
import * as Types from "./types";
914
import { cloneDeep } from "lodash";
@@ -127,6 +132,7 @@ export function handleApiData(data: ApiDataInfo, appKey: string): ReturnHandleAp
127132
method: item.method as string,
128133
url: item.url,
129134
tag: item.tag,
135+
controller: item.controller,
130136
key,
131137
};
132138
if (item.children && item.children.length) {
@@ -174,7 +180,7 @@ export function handleConfigAppsData(data: ConfigAppItem[]): HandleConfigAppData
174180
params: [],
175181
};
176182
function renderAppsData(list: ConfigAppItem[], appKey = ""): any {
177-
const mdMenus = list.map((item) => {
183+
const apps = list.map((item) => {
178184
const currentAppKey = `${appKey}${appKey ? "," : ""}${item.folder}`;
179185
if (item.folder && !(item.items && item.items.length)) {
180186
result.count++;
@@ -197,17 +203,34 @@ export function handleConfigAppsData(data: ConfigAppItem[]): HandleConfigAppData
197203
}
198204
}
199205
}
206+
if (item.groups && item.groups.length) {
207+
item.groups = handleConfigAppsGroupData(item.groups);
208+
}
200209
if (item.items && item.items.length) {
201210
item.items = renderAppsData(item.items, currentAppKey);
202211
}
203212
return item;
204213
});
205-
return mdMenus;
214+
return apps;
206215
}
207216
renderAppsData(data, "");
208217
return result;
209218
}
210219

220+
function handleConfigAppsGroupData(list: ConfigAppGroupItem[]) {
221+
const groups = list.map((item) => {
222+
item.label = item.title;
223+
item.value = item.name;
224+
item.key = item.name;
225+
if (item.children && item.children.length) {
226+
item.children = handleConfigAppsGroupData(item.children);
227+
}
228+
229+
return item;
230+
});
231+
return groups;
232+
}
233+
211234
interface handleInitGlobalParamsResult {
212235
headers: ConfigGlobalParamItem[];
213236
params: ConfigGlobalParamItem[];

src/store/modules/App/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ const app: Module<AppState, GlobalState> = {
5757
if (localStorage.APIDOC_CONFIG) {
5858
const apidocConfig = JSON.parse(localStorage.APIDOC_CONFIG);
5959
commit(Types.SET_FE_CONFIG, apidocConfig);
60+
if (apidocConfig && apidocConfig.MENU && apidocConfig.MENU.WIDTH) {
61+
commit(Types.SET_SIDE_WIDTH, apidocConfig.MENU.WIDTH);
62+
}
6063
}
6164
},
6265
// 设置前端配置

src/store/modules/App/interface.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ export interface FeConfigState {
3232
LANG?: FeConfigLangState[];
3333
HTTP: FeConfigHTTPState;
3434
PUBLICPATH?: string;
35+
MENU?: FeConfigMenuState;
3536
}
3637

38+
export interface FeConfigMenuState {
39+
SHOWURL: boolean;
40+
WIDTH: number;
41+
}
3742
export interface FeConfigLangState {
3843
title: string;
3944
lang: string;

src/views/apiDetail/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<a-tab-pane key="json" :tab="t('apiPage.json')">
5858
<json-tab :detail="detail" />
5959
</a-tab-pane>
60-
<a-tab-pane key="debug" :tab="t('apiPage.debug')">
60+
<a-tab-pane v-if="detail.notDebug !== true" key="debug" :tab="t('apiPage.debug')">
6161
<debug-tab :detail="detail" :currentMethod="currentMethod" />
6262
</a-tab-pane>
6363
</a-tabs>
@@ -113,6 +113,7 @@ export default defineComponent({
113113
const methodList: string[] = [];
114114
115115
const state = reactive({
116+
config: computed(() => store.state.app.config),
116117
pageData: computed(() => store.state.app.pageData),
117118
apiObject: computed(() => store.state.apidoc.apiObject),
118119
detail: detail,

0 commit comments

Comments
 (0)