创建草稿时选择类型

This commit is contained in:
dong 2023-06-08 11:27:25 +08:00
parent 3179a41e4f
commit 6d9f59e6be
2 changed files with 32 additions and 6 deletions

View File

@ -35,7 +35,7 @@ export async function pageQuery(
* @param params * @param params
* @returns * @returns
*/ */
export function createDraft(draftData: { name: string }) { export function createDraft(draftData: { name: string; type: string }) {
return api.post(`${DraftUriBase}`, draftData); return api.post(`${DraftUriBase}`, draftData);
} }
@ -82,3 +82,12 @@ export function saveDraft(
) { ) {
return api.put(`${DraftUriBase}/${id}`, data); return api.put(`${DraftUriBase}/${id}`, data);
} }
/**
* 稿
* @param data
* @returns
*/
export function saveAsDraft(id: number, data: { name: string }) {
return api.post(`${DraftUriBase}/${id}/saveAs`, data);
}

View File

@ -60,14 +60,25 @@
<q-card style="width: 300px"> <q-card style="width: 300px">
<q-card-section> <q-card-section>
<div class="text-h6">新建草稿图</div> <div class="text-h6">新建草稿图</div>
</q-card-section> <q-form @submit="onCreate" class="q-gutter-md">
<q-input
<q-card-section> outlined
<q-input outlined label="名称" v-model="draftName" /> label="名称"
v-model="draftName"
lazy-rules
:rules="[(val) => val.length > 0 || '请输入名称!']"
/>
<q-select
v-model="createType"
:options="typeOptions"
emit-value
label="类型"
/>
</q-form>
</q-card-section> </q-card-section>
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn color="primary" label="创建" @click="onCreate" /> <q-btn color="primary" label="创建" type="submit" />
<q-btn label="取消" v-close-popup /> <q-btn label="取消" v-close-popup />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
@ -204,6 +215,7 @@ async function onCreate() {
try { try {
await createDraft({ await createDraft({
name: draftName.value, name: draftName.value,
type: createType.value,
}); });
createFormShow.value = false; createFormShow.value = false;
tableRef.value.requestServerInteraction(); // tableRef.value.requestServerInteraction(); //
@ -273,4 +285,9 @@ async function deleteData(row: any) {
operateDisabled.value = false; operateDisabled.value = false;
}); });
} }
const typeOptions = [
{ label: '线路', value: 'Line' },
{ label: '线网', value: 'LineNetwork' },
];
const createType = ref('Line');
</script> </script>