草稿发布修改

This commit is contained in:
dong 2023-06-09 13:55:06 +08:00
parent 0dd5e9775a
commit 99ead17306
2 changed files with 75 additions and 44 deletions

View File

@ -52,11 +52,11 @@ export function deleteDraft(id: number) {
* @param id 稿id
*/
export function publishDraft(data: {
layoutId: string;
name: string;
overwrite?: boolean;
lineId: number;
draftingId: number;
}) {
return api.post(`${DraftUriBase}/publish`, data);
return api.post('/api/publishedGi/publish', data);
}
/**

View File

@ -58,9 +58,9 @@
transition-hide="scale"
>
<q-card style="width: 300px">
<q-form ref="myForm" @submit="onCreate" class="q-gutter-md">
<q-card-section>
<div class="text-h6">新建草稿图</div>
<q-form ref="myForm" class="q-gutter-md">
<q-input
outlined
label="名称"
@ -73,15 +73,15 @@
:options="typeOptions"
emit-value
map-options
label="类型"
label="类型 * "
/>
</q-form>
</q-card-section>
<q-card-actions align="right">
<q-btn color="primary" label="创建" type="submit" @click="onCreate" />
<q-btn color="primary" label="创建" type="submit" />
<q-btn label="取消" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
@ -96,6 +96,7 @@
<div class="text-h6">草稿发布</div>
</q-card-section>
<q-form ref="pubForm" @submit="publishGraphics" class="q-gutter-md">
<q-card-section>
<q-input
outlined
@ -103,13 +104,34 @@
label="草稿名称"
v-model="publishForm.draftName"
/>
<q-input outlined label="发布名称" v-model="publishForm.pubName" />
<q-input
outlined
label="发布名称 * "
v-model="publishForm.pubName"
lazy-rules
:rules="[(val) => val.length > 0 || '请输入名称!']"
/>
<q-select
v-model="publishForm.lineId"
:options="lineOptions"
emit-value
map-options
label="线路 * "
lazy-rules
:rules="[(val) => val || '请选择线路!']"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn color="primary" label="发布" @click="publishGraphics" />
<q-btn
color="primary"
label="发布"
type="submit"
@click="publishGraphics"
/>
<q-btn label="取消" v-close-popup />
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</div>
@ -143,6 +165,10 @@ const typeOptions = [
{ label: '线网', value: 'LineNetwork' },
];
const createType = ref('Line');
const lineOptions = [
{ label: '线路1', value: 1 },
{ label: '线路2', value: 2 },
];
const typeOptionsMap = computed(() => {
const obj: { [k: string]: string } = {};
@ -256,7 +282,7 @@ function onCreate() {
}
});
}
const pubForm = ref<QForm | null>(null);
const publishFormShow = ref(false);
const publishForm = reactive({
id: '',
@ -269,14 +295,17 @@ function prePublish(row: any) {
publishForm.id = row.id;
publishForm.draftName = row.name;
publishForm.pubName = row.name;
publishForm.lineId = '';
}
async function publishGraphics() {
pubForm.value?.validate().then(async (res) => {
if (res) {
try {
await publishDraft({
draftingId: publishForm.id,
draftingId: +publishForm.id,
name: publishForm.pubName,
lineId: publishForm.lineId,
lineId: +publishForm.lineId,
});
publishFormShow.value = false;
$q.notify({
@ -289,6 +318,8 @@ async function publishGraphics() {
message: error.message,
});
}
}
});
}
async function deleteData(row: any) {