diff --git a/src/api/DraftApi.ts b/src/api/DraftApi.ts index 015826a..849d4c8 100644 --- a/src/api/DraftApi.ts +++ b/src/api/DraftApi.ts @@ -38,8 +38,8 @@ export async function draftPageQuery( params: PagingQueryParams ): Promise> { const query = ` - query userDraftDataPaging($paging: PageQueryDto, $query: UserDraftDataFilterDto) { - userDraftDataPaging(paging: $paging, query: $query) { + query userDraftIscsDataPaging($paging: PageQueryDto, $query: UserDraftIscsDataFilterDto) { + userDraftIscsDataPaging(paging: $paging, query: $query) { total data { id name dataType createdAt updatedAt isShared @@ -51,7 +51,7 @@ export async function draftPageQuery( query, variables: params, }); - return response.data.data.userDraftDataPaging; + return response.data.data.userDraftIscsDataPaging; } /** @@ -59,25 +59,28 @@ export async function draftPageQuery( * @param params * @returns */ -export function createDraft(name: string) { +export enum IscsStyle { + UNKNOWN, + DA_SHI_ZHI_NENG = 'DA_SHI_ZHI_NENG', +} +interface CreateDraftIscsDto { + input: { + name: string; + options: { style: IscsStyle }; + userId: number; + }; +} +export function createDraft(params: CreateDraftIscsDto) { const mutation = ` - mutation createDraftData($input: CreateDraftDataDto) { - createDraftData(input: $input) { + mutation createDraftIscsData($input: CreateDraftIscsDto) { + createDraftIscsData(input: $input) { name } } `; - const variables = { - input: { - name, - dataType: DraftDataType.ISCS, - data: [], - userId: 1, - }, - }; return api.post(``, { query: mutation, - variables, + variables: params, }); } diff --git a/src/pages/IscsDraftManage.vue b/src/pages/IscsDraftManage.vue index ed50ebc..f0009a7 100644 --- a/src/pages/IscsDraftManage.vue +++ b/src/pages/IscsDraftManage.vue @@ -64,10 +64,18 @@ + @@ -128,6 +136,7 @@ import { DraftDataType, DraftItem, draftPageQuery, + IscsStyle, } from '../api/DraftApi'; import { ApiError } from 'src/boot/axios'; @@ -168,6 +177,14 @@ const columnDefs: QTableColumn[] = [ field: (row) => new Date(row.updatedAt).toLocaleString(), align: 'center', }, + { + name: 'isShared', + label: '是否共享', + field: (row) => { + return row.isShared ? '是' : '否'; + }, + align: 'center', + }, { name: 'operations', label: '操作', field: 'operations', align: 'center' }, ]; @@ -216,14 +233,30 @@ async function onRequest(props: any) { } const createFormShow = ref(false); -const draftName = ref(''); +const createForm = reactive({ + draftName: '', + style: IscsStyle.DA_SHI_ZHI_NENG, +}); +const iscsStyleOption = [ + { + label: '达实智能', + value: IscsStyle.DA_SHI_ZHI_NENG, + }, +]; const myForm = ref(null); function onCreate() { myForm.value?.validate().then(async (res) => { if (res) { operateDisabled.value = true; try { - await createDraft(draftName.value); + const variables = { + input: { + name: createForm.draftName, + options: { style: createForm.style }, + userId: 1, + }, + }; + await createDraft(variables); createFormShow.value = false; tableRef.value.requestServerInteraction(); // 刷新列表 } catch (err) {