feat:【ele】【ai】image 的代码评审

This commit is contained in:
YunaiV
2025-11-15 15:31:47 +08:00
parent 636df26e73
commit 104be22d0d
13 changed files with 20 additions and 28 deletions

View File

@@ -77,6 +77,7 @@ onMounted(async () => {
</Button> </Button>
</div> </div>
<div class="flex"> <div class="flex">
<!-- TODO @AI居右对齐 -->
<Button <Button
class="m-0 p-2" class="m-0 p-2"
type="text" type="text"

View File

@@ -101,7 +101,7 @@ watch(
}, },
{ immediate: true, deep: true }, { immediate: true, deep: true },
); );
/** 暴露组件方法 */
defineExpose({ settingValues }); defineExpose({ settingValues });
</script> </script>
<template> <template>

View File

@@ -138,7 +138,6 @@ async function settingValues(detail: AiImageApi.Image) {
await handleSizeClick(imageSize); await handleSizeClick(imageSize);
} }
/** 暴露组件方法 */
defineExpose({ settingValues }); defineExpose({ settingValues });
</script> </script>
<template> <template>

View File

@@ -10,7 +10,7 @@ import {
StableDiffusionSamplers, StableDiffusionSamplers,
StableDiffusionStylePresets, StableDiffusionStylePresets,
} from '@vben/constants'; } from '@vben/constants';
import { formatDate } from '@vben/utils'; import { formatDateTime } from '@vben/utils';
import { Image } from 'ant-design-vue'; import { Image } from 'ant-design-vue';
@@ -53,12 +53,8 @@ watch(
<div class="mb-5 w-full overflow-hidden break-words"> <div class="mb-5 w-full overflow-hidden break-words">
<div class="text-lg font-bold">时间</div> <div class="text-lg font-bold">时间</div>
<div class="mt-2"> <div class="mt-2">
<div> <div>提交时间{{ formatDateTime(detail.createTime) }}</div>
提交时间{{ formatDate(detail.createTime, 'yyyy-MM-dd HH:mm:ss') }} <div>生成时间{{ formatDateTime(detail.finishTime) }}</div>
</div>
<div>
生成时间{{ formatDate(detail.finishTime, 'yyyy-MM-dd HH:mm:ss') }}
</div>
</div> </div>
</div> </div>

View File

@@ -135,7 +135,6 @@ async function settingValues(detail: AiImageApi.Image) {
referImageUrl.value = detail.options.referImageUrl; referImageUrl.value = detail.options.referImageUrl;
} }
/** 暴露组件方法 */
defineExpose({ settingValues }); defineExpose({ settingValues });
</script> </script>
<template> <template>

View File

@@ -126,7 +126,6 @@ async function settingValues(detail: AiImageApi.Image) {
stylePreset.value = detail.options?.stylePreset; stylePreset.value = detail.options?.stylePreset;
} }
/** 暴露组件方法 */
defineExpose({ settingValues }); defineExpose({ settingValues });
</script> </script>
<template> <template>
@@ -225,6 +224,7 @@ defineExpose({ settingValues });
</div> </div>
<!-- 图片尺寸 --> <!-- 图片尺寸 -->
<!-- TODO @AI /Users/yunai/Java/yudao-ui-admin-vben-v5/apps/web-antd/src/views/ai/image/index/modules/common/index.vue 的问题 -->
<div class="mt-8"> <div class="mt-8">
<div><b>图片尺寸</b></div> <div><b>图片尺寸</b></div>
<Space wrap class="mt-4 w-full"> <Space wrap class="mt-4 w-full">

View File

@@ -31,7 +31,9 @@ async function getList() {
loading.value = false; loading.value = false;
} }
} }
const debounceGetList = useDebounceFn(getList, 80); const debounceGetList = useDebounceFn(getList, 80);
/** 搜索按钮操作 */ /** 搜索按钮操作 */
function handleQuery() { function handleQuery() {
queryParams.pageNo = 1; queryParams.pageNo = 1;

View File

@@ -91,10 +91,7 @@ onMounted(async () => {
<div class="absolute inset-0 m-4 flex h-full w-full flex-row"> <div class="absolute inset-0 m-4 flex h-full w-full flex-row">
<div class="bg-card left-0 mr-4 flex w-96 flex-col rounded-lg p-4"> <div class="bg-card left-0 mr-4 flex w-96 flex-col rounded-lg p-4">
<div class="flex justify-center"> <div class="flex justify-center">
<ElSegmented <ElSegmented v-model="selectPlatform" :options="platformOptions" />
v-model="selectPlatform"
:options="platformOptions"
/>
</div> </div>
<div class="mt-8 h-full overflow-y-auto"> <div class="mt-8 h-full overflow-y-auto">
<Common <Common
@@ -129,4 +126,3 @@ onMounted(async () => {
</div> </div>
</Page> </Page>
</template> </template>

View File

@@ -48,7 +48,6 @@ async function handleLoading(status: number) {
loading.value = ElMessage({ loading.value = ElMessage({
message: `生成中...`, message: `生成中...`,
type: 'info', type: 'info',
duration: 0,
}); });
} else { } else {
// 情况二:如果已经生成结束,则移除 loading // 情况二:如果已经生成结束,则移除 loading
@@ -74,7 +73,10 @@ onMounted(async () => {
<ElButton v-else-if="detail?.status === AiImageStatusEnum.SUCCESS"> <ElButton v-else-if="detail?.status === AiImageStatusEnum.SUCCESS">
已完成 已完成
</ElButton> </ElButton>
<ElButton type="danger" v-else-if="detail?.status === AiImageStatusEnum.FAIL"> <ElButton
type="danger"
v-else-if="detail?.status === AiImageStatusEnum.FAIL"
>
异常 异常
</ElButton> </ElButton>
</div> </div>
@@ -132,4 +134,3 @@ onMounted(async () => {
</div> </div>
</ElCard> </ElCard>
</template> </template>

View File

@@ -107,7 +107,7 @@ watch(
}, },
{ immediate: true, deep: true }, { immediate: true, deep: true },
); );
/** 暴露组件方法 */
defineExpose({ settingValues }); defineExpose({ settingValues });
</script> </script>
<template> <template>
@@ -195,6 +195,8 @@ defineExpose({ settingValues });
<b>图片尺寸</b> <b>图片尺寸</b>
</div> </div>
<ElSpace wrap class="mt-4 flex flex-wrap gap-x-5"> <ElSpace wrap class="mt-4 flex flex-wrap gap-x-5">
<!-- TODO @AI是不是可以 ElInputNumber 里面另外高在一行里 <template #prepend>Http://</template><template #append>.com</template>
-->
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span></span> <span></span>
<ElInputNumber <ElInputNumber

View File

@@ -183,6 +183,7 @@ defineExpose({ settingValues });
v-for="model in Dall3Models" v-for="model in Dall3Models"
:key="model.key" :key="model.key"
> >
<!-- TODO @AI图片无法展示 -->
<ElImage <ElImage
:preview-src-list="[]" :preview-src-list="[]"
:src="model.image" :src="model.image"

View File

@@ -10,7 +10,7 @@ import {
StableDiffusionSamplers, StableDiffusionSamplers,
StableDiffusionStylePresets, StableDiffusionStylePresets,
} from '@vben/constants'; } from '@vben/constants';
import { formatDate } from '@vben/utils'; import { formatDateTime } from '@vben/utils';
import { ElImage } from 'element-plus'; import { ElImage } from 'element-plus';
@@ -53,12 +53,8 @@ watch(
<div class="mb-5 w-full overflow-hidden break-words"> <div class="mb-5 w-full overflow-hidden break-words">
<div class="text-lg font-bold">时间</div> <div class="text-lg font-bold">时间</div>
<div class="mt-2"> <div class="mt-2">
<div> <div>提交时间{{ formatDateTime(detail.createTime) }}</div>
提交时间{{ formatDate(detail.createTime, 'yyyy-MM-dd HH:mm:ss') }} <div>生成时间{{ formatDateTime(detail.finishTime) }}</div>
</div>
<div>
生成时间{{ formatDate(detail.finishTime, 'yyyy-MM-dd HH:mm:ss') }}
</div>
</div> </div>
</div> </div>

View File

@@ -4,7 +4,6 @@ import type { AiImageApi } from '#/api/ai/image';
import { onMounted, reactive, ref } from 'vue'; import { onMounted, reactive, ref } from 'vue';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { IconifyIcon } from '@vben/icons'; import { IconifyIcon } from '@vben/icons';
import { useDebounceFn } from '@vueuse/core'; import { useDebounceFn } from '@vueuse/core';