| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <el-dialog
- v-model="visible"
- :show-close="!requesting"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- width="1000px"
- custom-class="loading-dialog-EL"
- align-center
- append-to-body
- >
- <div class="loading-content mar-top-10">
- <!-- 新的步骤进度条 -->
- <ProgressSteps
- v-if="useNewProgress && progressSteps.length > 0"
- :steps="progressSteps"
- @complete="handleButtonClick"
- />
- <!-- 原有的简单进度条 -->
- <div v-else class="progress-container">
- <div class="progress-bar">
- <div
- class="progress-inner"
- :style="{ width: `${progress}%` }"
- ></div>
- </div>
- <span class="progress-text">{{ progress.toFixed(2) }}%</span>
- </div>
- <div class="message">{{ message }}</div>
- <!-- 错误信息插槽 -->
- <slot name="errList"></slot>
- <!-- 进度消息插槽 -->
- <slot name="progressMessages"></slot>
- <el-button
- v-if="!disabledButton && !useNewProgress"
- :disabled="disabledButton"
- type="primary"
- class="action-button button--primary1 mar-top-20"
- @click="handleButtonClick"
- >
- {{ buttonText }}
- </el-button>
- </div>
- </el-dialog>
- </template>
- <script setup lang="ts">
- import { ref, defineProps, defineEmits , watch } from 'vue'
- import ProgressSteps from './ProgressSteps.vue'
- interface StepData {
- msg_type: string
- name: string
- status: '等待处理' | '正在处理' | '处理完成' | '处理失败'
- current: number
- total: number
- error: number
- }
- interface Props {
- modelValue: boolean
- progress?: number
- message?: string
- disabledButton?: boolean
- buttonText?: string,
- requesting?: boolean
- useNewProgress?: boolean
- progressSteps?: StepData[]
- }
- const props = withDefaults(defineProps<Props>(), {
- progress: 0,
- message: '正在为您处理,请稍后...',
- disabledButton: true,
- buttonText: '处理完毕,点击打开最终图片目录',
- requesting: false,
- useNewProgress: false,
- progressSteps: () => []
- })
- const emit = defineEmits<{
- (e: 'update:modelValue', value: boolean): void
- (e: 'button-click'): void
- }>()
- const visible = ref(props.modelValue)
- // 监听visible变化
- watch(() => visible.value, (newVal) => {
- emit('update:modelValue', newVal)
- })
- // 监听props.modelValue变化
- watch(() => props.modelValue, (newVal) => {
- visible.value = newVal
- })
- const handleButtonClick = () => {
- emit('button-click')
- }
- </script>
- <style>
- .loading-dialog-EL{
- .el-dialog__header {
- display: none;
- padding: 0;
- }
- .el-dialog__body {
- background-image: url(@/assets/images/Photography/loading-bg.png); /* 添加背景图片 */
- background-size: cover; /* 确保图片覆盖整个区域 */
- background-position: center; /* 图片居中显示 */
- background-repeat: no-repeat; /* 防止图片重复 */
- padding: 40px 20px; /* 添加内边距 */
- }
- }
- </style>
- <style lang="scss" scoped>
- .loading-dialog {
- :deep(.el-dialog__header) {
- display: none;
- padding: 0;
- }
- :deep(.el-dialog__body) {
- padding:0;
- }
- }
- .loading-content {
- display: flex;
- flex-direction: column;
- align-items: center;
- text-align: center;
- }
- .progress-container {
- width: 100%;
- margin-bottom: 10px;
- display: flex;
- align-items: center;
- gap: 10px;
- .progress-bar {
- flex: 1;
- height: 6px;
- background: #E4E7ED;
- border-radius: 3px;
- overflow: hidden;
- .progress-inner {
- height: 100%;
- background: linear-gradient(90deg, #2FB0FF,#B863FB);
- border-radius: 3px;
- transition: width 0.3s ease;
- }
- }
- .progress-text {
- min-width: 45px;
- color: #606266;
- font-size: 14px;
- }
- }
- .message {
- color: #606266;
- font-size: 14px;
- margin-bottom: 0px;
- }
- .action-button {
- padding: 10px 20px;
- }
- </style>
|