草稿发布修改
This commit is contained in:
parent
0dd5e9775a
commit
99ead17306
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,9 +58,9 @@
|
||||
transition-hide="scale"
|
||||
>
|
||||
<q-card style="width: 300px">
|
||||
<q-card-section>
|
||||
<div class="text-h6">新建草稿图</div>
|
||||
<q-form ref="myForm" class="q-gutter-md">
|
||||
<q-form ref="myForm" @submit="onCreate" class="q-gutter-md">
|
||||
<q-card-section>
|
||||
<div class="text-h6">新建草稿图</div>
|
||||
<q-input
|
||||
outlined
|
||||
label="名称"
|
||||
@ -73,15 +73,15 @@
|
||||
:options="typeOptions"
|
||||
emit-value
|
||||
map-options
|
||||
label="类型"
|
||||
label="类型 * "
|
||||
/>
|
||||
</q-form>
|
||||
</q-card-section>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-actions align="right">
|
||||
<q-btn color="primary" label="创建" type="submit" @click="onCreate" />
|
||||
<q-btn label="取消" v-close-popup />
|
||||
</q-card-actions>
|
||||
<q-card-actions align="right">
|
||||
<q-btn color="primary" label="创建" type="submit" />
|
||||
<q-btn label="取消" v-close-popup />
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
@ -96,20 +96,42 @@
|
||||
<div class="text-h6">草稿发布</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-section>
|
||||
<q-input
|
||||
outlined
|
||||
disable
|
||||
label="草稿名称"
|
||||
v-model="publishForm.draftName"
|
||||
/>
|
||||
<q-input outlined label="发布名称" v-model="publishForm.pubName" />
|
||||
</q-card-section>
|
||||
<q-form ref="pubForm" @submit="publishGraphics" class="q-gutter-md">
|
||||
<q-card-section>
|
||||
<q-input
|
||||
outlined
|
||||
disable
|
||||
label="草稿名称"
|
||||
v-model="publishForm.draftName"
|
||||
/>
|
||||
<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 label="取消" v-close-popup />
|
||||
</q-card-actions>
|
||||
<q-card-actions align="right">
|
||||
<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,26 +295,31 @@ function prePublish(row: any) {
|
||||
publishForm.id = row.id;
|
||||
publishForm.draftName = row.name;
|
||||
publishForm.pubName = row.name;
|
||||
publishForm.lineId = '';
|
||||
}
|
||||
|
||||
async function publishGraphics() {
|
||||
try {
|
||||
await publishDraft({
|
||||
draftingId: publishForm.id,
|
||||
name: publishForm.pubName,
|
||||
lineId: publishForm.lineId,
|
||||
});
|
||||
publishFormShow.value = false;
|
||||
$q.notify({
|
||||
type: 'positive',
|
||||
message: '发布成功',
|
||||
});
|
||||
} catch (error: any) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: error.message,
|
||||
});
|
||||
}
|
||||
pubForm.value?.validate().then(async (res) => {
|
||||
if (res) {
|
||||
try {
|
||||
await publishDraft({
|
||||
draftingId: +publishForm.id,
|
||||
name: publishForm.pubName,
|
||||
lineId: +publishForm.lineId,
|
||||
});
|
||||
publishFormShow.value = false;
|
||||
$q.notify({
|
||||
type: 'positive',
|
||||
message: '发布成功',
|
||||
});
|
||||
} catch (error: any) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: error.message,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function deleteData(row: any) {
|
||||
|
Loading…
Reference in New Issue
Block a user