diff --git a/frontend/.eslintrc-auto-import.json b/frontend/.eslintrc-auto-import.json new file mode 100644 index 0000000000..b2abc8dbd4 --- /dev/null +++ b/frontend/.eslintrc-auto-import.json @@ -0,0 +1,67 @@ +{ + "globals": { + "Component": true, + "ComponentPublicInstance": true, + "ComputedRef": true, + "EffectScope": true, + "ExtractDefaultPropTypes": true, + "ExtractPropTypes": true, + "ExtractPublicPropTypes": true, + "InjectionKey": true, + "PropType": true, + "Ref": true, + "VNode": true, + "WritableComputedRef": true, + "computed": true, + "createApp": true, + "customRef": true, + "defineAsyncComponent": true, + "defineComponent": true, + "effectScope": true, + "getCurrentInstance": true, + "getCurrentScope": true, + "h": true, + "inject": true, + "isProxy": true, + "isReactive": true, + "isReadonly": true, + "isRef": true, + "markRaw": true, + "nextTick": true, + "onActivated": true, + "onBeforeMount": true, + "onBeforeUnmount": true, + "onBeforeUpdate": true, + "onDeactivated": true, + "onErrorCaptured": true, + "onMounted": true, + "onRenderTracked": true, + "onRenderTriggered": true, + "onScopeDispose": true, + "onServerPrefetch": true, + "onUnmounted": true, + "onUpdated": true, + "provide": true, + "reactive": true, + "readonly": true, + "ref": true, + "resolveComponent": true, + "shallowReactive": true, + "shallowReadonly": true, + "shallowRef": true, + "toRaw": true, + "toRef": true, + "toRefs": true, + "toValue": true, + "triggerRef": true, + "unref": true, + "useAttrs": true, + "useCssModule": true, + "useCssVars": true, + "useSlots": true, + "watch": true, + "watchEffect": true, + "watchPostEffect": true, + "watchSyncEffect": true + } +} diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index faa7602821..5e8f277018 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -27,6 +27,7 @@ module.exports = { 'plugin:import/typescript', 'plugin:vue/vue3-recommended', 'plugin:prettier/recommended', + './.eslintrc-auto-import.json', ], settings: { 'import/resolver': { diff --git a/frontend/config/vite.config.base.ts b/frontend/config/vite.config.base.ts index ab28e2d531..57b65b795c 100644 --- a/frontend/config/vite.config.base.ts +++ b/frontend/config/vite.config.base.ts @@ -7,6 +7,7 @@ import svgLoader from 'vite-svg-loader'; // import configArcoResolverPlugin from './plugin/arcoResolver'; import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'; import vueSetupExtend from 'vite-plugin-vue-setup-extend'; +import AutoImport from 'unplugin-auto-import/vite'; export default defineConfig({ plugins: [ @@ -22,6 +23,19 @@ export default defineConfig({ // 指定symbolId格式 symbolId: 'icon-[name]', }), + AutoImport({ + include: [ + /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx + /\.vue$/, + /\.vue\?vue/, // .vue + /\.md$/, // .md + ], + imports: ['vue'], + dts: 'src/auto-import.d.ts', + eslintrc: { + enabled: true, // <-- this + }, + }), ], resolve: { alias: [ diff --git a/frontend/package.json b/frontend/package.json index 231f8fb793..1826ee0e1c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -124,6 +124,7 @@ "stylelint-order": "^5.0.0", "tailwindcss": "^3.3.3", "typescript": "^4.9.5", + "unplugin-auto-import": "^0.16.6", "unplugin-vue-components": "^0.24.1", "vite": "^3.2.7", "vite-plugin-compression": "^0.5.1", diff --git a/frontend/src/api/modules/project-management/menuManagement.ts b/frontend/src/api/modules/project-management/menuManagement.ts index 4320a45b1f..23eb4e822c 100644 --- a/frontend/src/api/modules/project-management/menuManagement.ts +++ b/frontend/src/api/modules/project-management/menuManagement.ts @@ -1,28 +1,19 @@ import MSR from '@/api/http/index'; import * as Url from '@/api/requrls/project-management/menuManagement'; -import type { MenuTableListItem, MenuTableListParams } from '@/models/projectManagement/menuManagement'; +import type { + MenuTableListItem, + MenuTableListParams, + MenuTableConfigItem, +} from '@/models/projectManagement/menuManagement'; import { MenuEnum } from '@/enums/commonEnum'; import { TableQueryParams, CommonList } from '@/models/common'; -const tableList: MenuTableListItem[] = [ - 'workstation', - 'loadTest', - 'testPlan', - 'bugManagement', - 'caseManagement', - 'apiTest', - 'uiTest', -].map((item, index) => { - return { module: item, moduleEnable: index % 2 === 0 }; -}); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export function postTabletList(data: TableQueryParams) { - // return MSR.post>({ url: Url.getMenuListUrl, data }); +export async function postTabletList(params: TableQueryParams): Promise> { + const list = await MSR.get({ url: `${Url.getMenuListUrl}${params.projectId}` }); const result: CommonList = { - list: tableList, - total: tableList.length, + total: list.length, + list, pageSize: 10, current: 1, }; @@ -54,7 +45,33 @@ export function postUpdateMenu(data: MenuTableListParams) { suffix = 'performance-test'; break; } - return MSR.post({ url: `${Url.updateConfigByMenuTypeUrl}${suffix}`, data }); + return MSR.post({ url: `${Url.updateConfigByMenuTypeUrl}${suffix}`, data }); } -export default {}; +export function getConfigByMenuItem(data: MenuTableListParams) { + let suffix = ''; + switch (data.type) { + case MenuEnum.workstation: + suffix = 'workstation'; + break; + case MenuEnum.testPlan: + suffix = 'test-plan'; + break; + case MenuEnum.bugManagement: + suffix = 'issue'; + break; + case MenuEnum.caseManagement: + suffix = 'case'; + break; + case MenuEnum.apiTest: + suffix = 'api'; + break; + case MenuEnum.uiTest: + suffix = 'ui'; + break; + default: + suffix = 'performance-test'; + break; + } + return MSR.post({ url: `${Url.getConfigByMenuTypeUrl}${suffix}`, data }); +} diff --git a/frontend/src/auto-import.d.ts b/frontend/src/auto-import.d.ts new file mode 100644 index 0000000000..ea2aea13eb --- /dev/null +++ b/frontend/src/auto-import.d.ts @@ -0,0 +1,77 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols +// Generated by unplugin-auto-import +export {} +declare global { + const EffectScope: typeof import('vue')['EffectScope']; + const computed: typeof import('vue')['computed']; + const createApp: typeof import('vue')['createApp']; + const customRef: typeof import('vue')['customRef']; + const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']; + const defineComponent: typeof import('vue')['defineComponent']; + const effectScope: typeof import('vue')['effectScope']; + const getCurrentInstance: typeof import('vue')['getCurrentInstance']; + const getCurrentScope: typeof import('vue')['getCurrentScope']; + const h: typeof import('vue')['h']; + const inject: typeof import('vue')['inject']; + const isProxy: typeof import('vue')['isProxy']; + const isReactive: typeof import('vue')['isReactive']; + const isReadonly: typeof import('vue')['isReadonly']; + const isRef: typeof import('vue')['isRef']; + const markRaw: typeof import('vue')['markRaw']; + const nextTick: typeof import('vue')['nextTick']; + const onActivated: typeof import('vue')['onActivated']; + const onBeforeMount: typeof import('vue')['onBeforeMount']; + const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']; + const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']; + const onDeactivated: typeof import('vue')['onDeactivated']; + const onErrorCaptured: typeof import('vue')['onErrorCaptured']; + const onMounted: typeof import('vue')['onMounted']; + const onRenderTracked: typeof import('vue')['onRenderTracked']; + const onRenderTriggered: typeof import('vue')['onRenderTriggered']; + const onScopeDispose: typeof import('vue')['onScopeDispose']; + const onServerPrefetch: typeof import('vue')['onServerPrefetch']; + const onUnmounted: typeof import('vue')['onUnmounted']; + const onUpdated: typeof import('vue')['onUpdated']; + const provide: typeof import('vue')['provide']; + const reactive: typeof import('vue')['reactive']; + const readonly: typeof import('vue')['readonly']; + const ref: typeof import('vue')['ref']; + const resolveComponent: typeof import('vue')['resolveComponent']; + const shallowReactive: typeof import('vue')['shallowReactive']; + const shallowReadonly: typeof import('vue')['shallowReadonly']; + const shallowRef: typeof import('vue')['shallowRef']; + const toRaw: typeof import('vue')['toRaw']; + const toRef: typeof import('vue')['toRef']; + const toRefs: typeof import('vue')['toRefs']; + const toValue: typeof import('vue')['toValue']; + const triggerRef: typeof import('vue')['triggerRef']; + const unref: typeof import('vue')['unref']; + const useAttrs: typeof import('vue')['useAttrs']; + const useCssModule: typeof import('vue')['useCssModule']; + const useCssVars: typeof import('vue')['useCssVars']; + const useSlots: typeof import('vue')['useSlots']; + const watch: typeof import('vue')['watch']; + const watchEffect: typeof import('vue')['watchEffect']; + const watchPostEffect: typeof import('vue')['watchPostEffect']; + const watchSyncEffect: typeof import('vue')['watchSyncEffect']; +} +// for type re-export +declare global { + // @ts-ignore + export type { + Component, + ComponentPublicInstance, + ComputedRef, + ExtractDefaultPropTypes, + ExtractPropTypes, + ExtractPublicPropTypes, + InjectionKey, + PropType, + Ref, + VNode, + WritableComputedRef, + } from 'vue'; +} diff --git a/frontend/src/components/business/ms-user-group-comp/addUserModal.vue b/frontend/src/components/business/ms-user-group-comp/addUserModal.vue index d3d83ebc50..b2eff2e19d 100644 --- a/frontend/src/components/business/ms-user-group-comp/addUserModal.vue +++ b/frontend/src/components/business/ms-user-group-comp/addUserModal.vue @@ -37,7 +37,7 @@ import { addOrgUserToUserGroup, addUserToUserGroup } from '@/api/modules/setting/usergroup'; import { Message, type FormInstance, type ValidatedError } from '@arco-design/web-vue'; import MsUserSelector from '@/components/business/ms-user-selector/index.vue'; - import { UserRequesetTypeEnum } from '@/components/business/ms-user-selector/utils'; + import { UserRequestTypeEnum } from '@/components/business/ms-user-selector/utils'; import { AuthScopeEnum } from '@/enums/commonEnum'; const { t } = useI18n(); @@ -52,7 +52,7 @@ const userSelectorProps = computed(() => { if (systemType === AuthScopeEnum.SYSTEM) { return { - type: UserRequesetTypeEnum.SYSTEM_USER_GROUP, + type: UserRequestTypeEnum.SYSTEM_USER_GROUP, loadOptionParams: { roleId: props.currentId, }, @@ -60,7 +60,7 @@ }; } return { - type: UserRequesetTypeEnum.ORGANIZATION_USER_GROUP, + type: UserRequestTypeEnum.ORGANIZATION_USER_GROUP, loadOptionParams: { roleId: props.currentId, organizationId: currentOrgId.value, diff --git a/frontend/src/components/business/ms-user-selector/index.vue b/frontend/src/components/business/ms-user-selector/index.vue index 87aca4aad7..6f3f9e8805 100644 --- a/frontend/src/components/business/ms-user-selector/index.vue +++ b/frontend/src/components/business/ms-user-selector/index.vue @@ -25,7 +25,7 @@ diff --git a/frontend/src/components/pure/ms-table/type.ts b/frontend/src/components/pure/ms-table/type.ts index 6e513bdf55..d40b97ad62 100644 --- a/frontend/src/components/pure/ms-table/type.ts +++ b/frontend/src/components/pure/ms-table/type.ts @@ -1,6 +1,6 @@ import { ColumnEditTypeEnum, SelectAllEnum } from '@/enums/tableEnum'; import { TableQueryParams } from '@/models/common'; -import { TableColumnData, TableData, TableDraggable, TableChangeExtra, TableExpandable } from '@arco-design/web-vue'; +import { TableColumnData, TableData, TableDraggable, TableChangeExtra } from '@arco-design/web-vue'; export interface MsPaginationI { current: number; @@ -77,7 +77,7 @@ export interface MsTableProps { /** 展开行相关 */ showExpand?: boolean; // 是否显示展开行 expandedKeys?: string[]; // 显示的展开行、子树(受控模式) - + emptyDataShowLine?: boolean; // 空数据是否显示 "-" [key: string]: any; } @@ -107,7 +107,7 @@ export interface BatchActionConfig { moreAction?: BatchActionParams[]; } -export interface renamePopconfirmVisibleType { +export interface renamePopConfirmVisibleType { [key: string]: boolean; } diff --git a/frontend/src/components/pure/ms-table/useTable.ts b/frontend/src/components/pure/ms-table/useTable.ts index d80e3ee5b9..b5ea2cc81b 100644 --- a/frontend/src/components/pure/ms-table/useTable.ts +++ b/frontend/src/components/pure/ms-table/useTable.ts @@ -36,7 +36,7 @@ export default function useTableProps( data: [], // 表格数据 /** * 表格列配置 - * 当showSetting为true时,此配置无效,通过TableStore.initColumnsk(tableKey: string, column: MsTableColumn)初始化。 + * 当showSetting为true时,此配置无效,通过TableStore.initColumn(tableKey: string, column: MsTableColumn)初始化。 * 当showSetting为false时,此配置生效 */ columns: [] as MsTableColumn, @@ -59,7 +59,7 @@ export default function useTableProps( showFirstOperation: false, // 展示第一行的操作 /** 展开行相关 */ showExpand: false, // 是否显示展开行 - expandedKeys: [], // 显示的展开行、子树(受控模式) + emptyDataShowLine: true, // 空数据是否显示 "-" ...props, }; @@ -351,18 +351,6 @@ export default function useTableProps( propsRes.value.selectedKeys = selectedKeys; propsRes.value.excludeKeys = excludeKeys; }, - // 展开收起 - expandChange: (key: string) => { - const { expandedKeys: oldExpandedKeys } = propsRes.value; - if (!oldExpandedKeys) { - return; - } - if (oldExpandedKeys.includes(key)) { - propsRes.value.expandedKeys = oldExpandedKeys.filter((item) => item !== key); - } else { - propsRes.value.expandedKeys = [...oldExpandedKeys, key]; - } - }, }); watchEffect(() => { diff --git a/frontend/src/components/pure/ms-time-selector/MsTimeSelector.vue b/frontend/src/components/pure/ms-time-selector/MsTimeSelector.vue new file mode 100644 index 0000000000..f60ff067c3 --- /dev/null +++ b/frontend/src/components/pure/ms-time-selector/MsTimeSelector.vue @@ -0,0 +1,5 @@ + diff --git a/frontend/src/components/pure/ms-time-selector/locale/en-US.ts b/frontend/src/components/pure/ms-time-selector/locale/en-US.ts new file mode 100644 index 0000000000..ff8b4c5632 --- /dev/null +++ b/frontend/src/components/pure/ms-time-selector/locale/en-US.ts @@ -0,0 +1 @@ +export default {}; diff --git a/frontend/src/components/pure/ms-time-selector/locale/zh-CN.ts b/frontend/src/components/pure/ms-time-selector/locale/zh-CN.ts new file mode 100644 index 0000000000..ff8b4c5632 --- /dev/null +++ b/frontend/src/components/pure/ms-time-selector/locale/zh-CN.ts @@ -0,0 +1 @@ +export default {}; diff --git a/frontend/src/models/projectManagement/menuManagement.ts b/frontend/src/models/projectManagement/menuManagement.ts index 4d8bbe4b35..453d59fa52 100644 --- a/frontend/src/models/projectManagement/menuManagement.ts +++ b/frontend/src/models/projectManagement/menuManagement.ts @@ -1,14 +1,19 @@ import { MenuEnum } from '@/enums/commonEnum'; +export interface MenuTableConfigItem { + projectId: string; + type: string; + typeValue: string; +} export interface MenuTableListItem { module: string; moduleEnable: boolean; moduleDesc?: string; - children?: MenuTableListItem[]; + children?: MenuTableConfigItem[]; } export interface MenuTableListParams { projectId: string; - type: MenuEnum; - typeValue: boolean; + type?: MenuEnum; + typeValue?: boolean; } diff --git a/frontend/src/views/project-management/projectAndPermission/member/components/addMemberModal.vue b/frontend/src/views/project-management/projectAndPermission/member/components/addMemberModal.vue index 8f9e41c5f1..fdd6fbb321 100644 --- a/frontend/src/views/project-management/projectAndPermission/member/components/addMemberModal.vue +++ b/frontend/src/views/project-management/projectAndPermission/member/components/addMemberModal.vue @@ -18,7 +18,7 @@ @@ -51,7 +51,7 @@ ActionProjectMember, AddProjectMember, } from '@/models/projectManagement/projectAndPermission'; - import { UserRequesetTypeEnum } from '@/components/business/ms-user-selector/utils'; + import { UserRequestTypeEnum } from '@/components/business/ms-user-selector/utils'; const { t } = useI18n(); const userStore = useUserStore(); diff --git a/frontend/src/views/project-management/projectAndPermission/menuManagement/TableExpand.vue b/frontend/src/views/project-management/projectAndPermission/menuManagement/TableExpand.vue deleted file mode 100644 index 3b9ee61693..0000000000 --- a/frontend/src/views/project-management/projectAndPermission/menuManagement/TableExpand.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/frontend/src/views/project-management/projectAndPermission/menuManagement/components/defectSync.vue b/frontend/src/views/project-management/projectAndPermission/menuManagement/components/defectSync.vue new file mode 100644 index 0000000000..f78c041676 --- /dev/null +++ b/frontend/src/views/project-management/projectAndPermission/menuManagement/components/defectSync.vue @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/views/project-management/projectAndPermission/menuManagement/index.vue b/frontend/src/views/project-management/projectAndPermission/menuManagement/index.vue index 41feb0b2ac..64583ab46d 100644 --- a/frontend/src/views/project-management/projectAndPermission/menuManagement/index.vue +++ b/frontend/src/views/project-management/projectAndPermission/menuManagement/index.vue @@ -1,40 +1,182 @@