api调整
This commit is contained in:
parent
f9ee903d60
commit
2d73321e06
|
@ -38,8 +38,8 @@ export async function draftPageQuery(
|
|||
params: PagingQueryParams
|
||||
): Promise<PageDto<DraftItem>> {
|
||||
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,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -64,10 +64,18 @@
|
|||
<q-input
|
||||
outlined
|
||||
label="名称 * "
|
||||
v-model="draftName"
|
||||
v-model="createForm.draftName"
|
||||
lazy-rules
|
||||
:rules="[(val) => val.length > 0 || '请输入名称!']"
|
||||
/>
|
||||
<q-select
|
||||
v-model="createForm.style"
|
||||
:options="iscsStyleOption"
|
||||
emit-value
|
||||
map-options
|
||||
label="ISCS类型"
|
||||
lazy-rules
|
||||
/>
|
||||
<q-card-actions align="right">
|
||||
<q-btn color="primary" label="创建" type="submit" />
|
||||
<q-btn label="取消" v-close-popup />
|
||||
|
@ -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<QForm | null>(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) {
|
||||
|
|
Loading…
Reference in New Issue