diff --git a/src/api/DraftApi.ts b/src/api/DraftApi.ts index 29cb8d1..ce3f216 100644 --- a/src/api/DraftApi.ts +++ b/src/api/DraftApi.ts @@ -21,6 +21,14 @@ export const iscsStyleOption = [ }, ]; +export const searchTscsStyleOption = [ + { + label: '全部', + value: IscsStyle.UNKNOWN, + }, + ...iscsStyleOption, +]; + export interface DraftItem { id: number; name: string; @@ -33,8 +41,11 @@ export interface DraftItem { createdAt: string; updatedAt: string; defaultReleaseDataName: string; + userName: string; +} +export interface IscsDataOptions { + style: IscsStyle; } - export interface PagingQueryParams { paging: { page: number; @@ -42,9 +53,10 @@ export interface PagingQueryParams { }; query: { dataType: DraftDataType; - userId?: number; + options?: IscsDataOptions; name?: string; isShared?: boolean; + userId?: number; }; } export interface DraftIscsDataDto { @@ -52,9 +64,6 @@ export interface DraftIscsDataDto { options: IscsDataOptions; } -export interface IscsDataOptions { - style: IscsStyle; -} export async function draftPageQuery( params: PagingQueryParams ): Promise> { @@ -63,7 +72,7 @@ export async function draftPageQuery( userDraftIscsDataPaging(paging: $paging, query: $query) { total items { - draftData {id name dataType userId defaultReleaseDataId createdAt updatedAt isShared defaultReleaseDataName} + draftData {id name dataType userName defaultReleaseDataId createdAt updatedAt isShared defaultReleaseDataName} options {style} } } @@ -84,7 +93,7 @@ export async function sharedDraftPageQuery( sharedDraftIscsDataPaging(paging: $paging, query: $query) { total items { - draftData {id name dataType userId defaultReleaseDataId createdAt updatedAt isShared defaultReleaseDataName} + draftData {id name dataType userName defaultReleaseDataId createdAt updatedAt isShared defaultReleaseDataName} options {style} } } @@ -208,10 +217,7 @@ export function saveDraft(variables: { id: number; data: string }) { * @param variables * @returns */ -export async function saveAsDraft(variables: { - id: number; - name: string; -}) { +export async function saveAsDraft(variables: { id: number; name: string }) { const mutation = ` mutation saveAsNewDraftData($id: Int,$name: String) { saveAsNewDraftData(id: $id,name: $name){ diff --git a/src/api/PublishApi.ts b/src/api/PublishApi.ts index fe4d46a..3e0ff64 100644 --- a/src/api/PublishApi.ts +++ b/src/api/PublishApi.ts @@ -14,6 +14,7 @@ export interface PublishItem { createdAt: string; updatedAt: string; description: string; + userName: string; } interface PagingQueryParams { @@ -26,6 +27,7 @@ interface PagingQueryParams { userId?: number; name?: string; isPublished?: boolean; + options?: IscsDataOptions; }; } export interface PublishIscsDataDto { @@ -110,7 +112,7 @@ export async function publishPageQuery( releaseIscsDataPaging(page: $page, query: $query) { total items { - releaseData {id name dataType usedVersionId userId isPublished createdAt updatedAt description } + releaseData {id name dataType usedVersionId userName isPublished createdAt updatedAt description } options {style} } } @@ -162,7 +164,7 @@ export async function getPublishHistoryById(variables: { releaseDataVersionPaging(dataId: $dataId, page: $page) { total items { - id releaseDataId description userId createdAt + id releaseDataId description userName createdAt } } } diff --git a/src/api/UserApi.ts b/src/api/UserApi.ts new file mode 100644 index 0000000..8efedb2 --- /dev/null +++ b/src/api/UserApi.ts @@ -0,0 +1,83 @@ +import { api } from 'src/boot/axios'; +import { PageDto } from './ApiCommon'; + +export interface User { + id: string; + name: string; + mobile: string; + email: string; + roles: []; + createdAt: string; + updatedAt: string; +} + +export interface PagingQueryParams { + page: { + page: number; + itemsPerPage: number; + }; + query: { + id?: string; + name?: string; + mobile?: string; + email?: string; + roles?: []; + }; +} + +/** + * 分页查询用户信息 + * @param params + * @returns + */ +export async function userPageQuery( + params: PagingQueryParams +): Promise> { + const query = ` + query userPaging($page: PageQueryDto, $query: UserQueryDto) { + userPaging(page: $page, query: $query) { + total + items { + id name mobile email roles createdAt updatedAt + } + } + } +`; + const response = await api.post('', { + query, + variables: params, + }); + return response.data.data.userPaging; +} + +/** + * 获取获取用户信息 + */ +export async function getLoginUserInfo() { + const query = ` + query loginUserInfo { + loginUserInfo{ + id + } + } +`; + const response = await api.post('', { + query, + }); + return response.data.data; +} + +/** + * 同步用户 + */ +export async function syncUsersInfo() { + const mutation = ` + mutation syncUser { + syncUser + } +`; + const response = await api.post('', { + query: mutation, + }); + return response.data.data; +} diff --git a/src/components/common/DraggableDialog.vue b/src/components/common/DraggableDialog.vue index b4a458a..69d7545 100644 --- a/src/components/common/DraggableDialog.vue +++ b/src/components/common/DraggableDialog.vue @@ -84,7 +84,7 @@ diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 1f778e8..937e408 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -126,12 +126,17 @@ import SysMenu from 'src/components/SysMenu.vue'; import { useRoute } from 'vue-router'; import { clearJwtToken, saveJwtToken } from 'src/configs/TokenManage'; import { Dialog } from 'quasar'; +import { getLoginUserInfo } from 'src/api/UserApi'; +import { useAuthStore } from 'src/stores/auth-store'; const route = useRoute(); +const authStore = useAuthStore(); -onMounted(() => { +onMounted(async () => { if (route.params.token) { saveJwtToken(route.params.token as string); + const res = await getLoginUserInfo(); + authStore.setUserId(res.loginUserInfo.id); } }); diff --git a/src/pages/IscsDraftManage.vue b/src/pages/IscsDraftManage.vue index 8be2fc9..4db1a1c 100644 --- a/src/pages/IscsDraftManage.vue +++ b/src/pages/IscsDraftManage.vue @@ -15,19 +15,35 @@ @request="onRequest" >