Fix refresh application for mj (#24)

This commit is contained in:
AceDataCloud committed 2024-04-09 17:15:59 +00:00
1 parent ab0605c616
commit c923b1493b
5 files changed
+32 -7

No files matched your search

@@ -38,7 +38,7 @@ export default defineComponent({
ElSkeleton,
ElSkeletonItem
},
emits: ['update:modelValue', 'custom'],
emits: ['update:modelValue', 'custom', 'refresh'],
data() {
return {
job: 0
@@ -55,6 +55,16 @@ export default defineComponent({
return this.$store.state.midjourney.application;
}
},
watch: {
tasks: {
handler(val, oldVal) {
if (val && oldVal && JSON.stringify(val) !== JSON.stringify(oldVal)) {
this.$emit('refresh', val);
}
},
deep: true
}
},
async mounted() {
await this.$store.dispatch('midjourney/setImagineTasks', undefined);
this.getImagineTasks();
@@ -39,7 +39,7 @@ export default defineComponent({
ElSkeletonItem,
ElCard
},
emits: ['update:modelValue', 'custom'],
emits: ['update:modelValue', 'custom', 'refresh'],
data(): IData {
return {
job: undefined
@@ -74,6 +74,14 @@ export default defineComponent({
await this.$store.dispatch('midjourney/setImagineTasks', undefined);
this.getImagineTasks();
}
},
tasks: {
handler(val, oldVal) {
if (val && oldVal && JSON.stringify(val) !== JSON.stringify(oldVal)) {
this.$emit('refresh', val);
}
},
deep: true
}
},
async mounted() {
+4 -4
View File
@@ -7,9 +7,9 @@
:need-apply="needApply"
class="mb-4"
:service="service"
@refresh="onGetApplications"
@refresh="onGetApplication"
/>
<task-full-list @custom="onCustom" />
<task-full-list @custom="onCustom" @refresh="onGetApplication" />
<el-button type="primary" round class="btn btn-generate" @click="onGenerateNew">
<font-awesome-icon icon="fa-solid fa-chevron-left" class="icon icon-rotate mr-1" />
{{ $t('midjourney.button.generateNew') }}
@@ -71,7 +71,7 @@ export default defineComponent({
}
},
async mounted() {
await this.onGetApplications();
await this.onGetApplication();
},
methods: {
async onGenerateNew() {
@@ -79,7 +79,7 @@ export default defineComponent({
name: ROUTE_MIDJOURNEY_INDEX
});
},
async onGetApplications() {
async onGetApplication() {
await this.$store.dispatch('midjourney/getApplication');
},
async onStartTask(request: IMidjourneyImagineRequest) {
+1 -1
View File
@@ -25,7 +25,7 @@
</div>
</template>
<template #results>
<task-brief-list @custom="onCustom" />
<task-brief-list @custom="onCustom" @refresh="onGetApplication" />
</template>
</layout>
</template>