创建草稿时选择类型
This commit is contained in:
parent
3179a41e4f
commit
6d9f59e6be
@ -35,7 +35,7 @@ export async function pageQuery(
|
||||
* @param params
|
||||
* @returns
|
||||
*/
|
||||
export function createDraft(draftData: { name: string }) {
|
||||
export function createDraft(draftData: { name: string; type: string }) {
|
||||
return api.post(`${DraftUriBase}`, draftData);
|
||||
}
|
||||
|
||||
@ -82,3 +82,12 @@ export function saveDraft(
|
||||
) {
|
||||
return api.put(`${DraftUriBase}/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 另存草稿数据
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
export function saveAsDraft(id: number, data: { name: string }) {
|
||||
return api.post(`${DraftUriBase}/${id}/saveAs`, data);
|
||||
}
|
||||
|
@ -60,14 +60,25 @@
|
||||
<q-card style="width: 300px">
|
||||
<q-card-section>
|
||||
<div class="text-h6">新建草稿图</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-section>
|
||||
<q-input outlined label="名称" v-model="draftName" />
|
||||
<q-form @submit="onCreate" class="q-gutter-md">
|
||||
<q-input
|
||||
outlined
|
||||
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-actions align="right">
|
||||
<q-btn color="primary" label="创建" @click="onCreate" />
|
||||
<q-btn color="primary" label="创建" type="submit" />
|
||||
<q-btn label="取消" v-close-popup />
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
@ -204,6 +215,7 @@ async function onCreate() {
|
||||
try {
|
||||
await createDraft({
|
||||
name: draftName.value,
|
||||
type: createType.value,
|
||||
});
|
||||
createFormShow.value = false;
|
||||
tableRef.value.requestServerInteraction(); // 刷新列表
|
||||
@ -273,4 +285,9 @@ async function deleteData(row: any) {
|
||||
operateDisabled.value = false;
|
||||
});
|
||||
}
|
||||
const typeOptions = [
|
||||
{ label: '线路', value: 'Line' },
|
||||
{ label: '线网', value: 'LineNetwork' },
|
||||
];
|
||||
const createType = ref('Line');
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user