222
schangxiang@126.com
2025-04-30 9bec4dcae002f36aa23231da11cb03a156b40110
PipeLineLems/web/src/components/ConfirmBox/ConfirmBox.tsx
@@ -1,22 +1,37 @@
import { createApp, h, ref, nextTick } from 'vue'
import { createApp, h, ref, nextTick, Component } from 'vue'
import BaseDialog from '@/components/BaseDialog/index.vue'
import { ElConfigProvider } from 'element-plus'
import styles from './ConfirmBox.module.scss'
export const ConfirmBox = (text: string, title = '确认') => {
import { _t } from '@/libs/Language/Language'
export const ConfirmBox = (
  text: string | any,
  title = '确认',
  attrs: any = {}
) => {
  return new Promise((resolve, reject) => {
    const mountNode = document.createElement('div')
    document.body.appendChild(mountNode)
    const visible = ref(true)
    const RenderProvider = (Widget: any) => {
      return (
        <el-config-provider namespace="cs">
          <Widget />
        </el-config-provider>
      )
    }
    const app = createApp({
      render() {
        return h(
        return RenderProvider(
          h(
          BaseDialog,
          {
              class: styles.ConfirmBox,
            modelValue: visible.value,
            'onUpdate:modelValue': (value: boolean) => {
              visible.value = value
            },
            title: title,
              title: _t(title),
            width: '379px',
            onConfirm: () => {
              resolve(true)
@@ -30,8 +45,13 @@
                mountNode.remove()
              })
            },
              ...attrs,
          },
          h('div', { class: styles.deleteDialog }, text)
            {
              default: h('div', { class: styles.confirmDialog }, text),
              footer: attrs.footer ? attrs.footer : null,
            }
          )
        )
      },
    })