222
schangxiang@126.com
2025-04-30 9bec4dcae002f36aa23231da11cb03a156b40110
PipeLineLems/web/src/components/BaseDrawer/BaseDrawer.tsx
@@ -1,6 +1,8 @@
import { computed, defineComponent, onMounted, ref } from 'vue'
import { Component, computed, defineComponent, onMounted, ref } from 'vue'
import styles from './BaseDrawer.module.scss'
import Icon from '../Icon/Icon'
import { _t } from '@/libs/Language/Language'
//@ts-ignore
export default defineComponent<{
  [key: string]: any
@@ -21,6 +23,15 @@
      type: String,
      default: '',
    },
    submitDisabled: {
      type: Boolean,
      default: false,
    },
    appendToBody: {
      type: Boolean,
      default: true,
    },
    // modelValue: {
    //   type: Boolean,
    //   default: false,
@@ -41,6 +52,43 @@
    // })
    return () => {
      const vSlots: {
        footer: () => Component
        title?: () => Component
      } = {
        footer() {
          return (
            <div class={styles.csDialogFooter}>
              <el-button
                onClick={() => emit('close')}
                type="info"
                plain
                class={{
                  [styles.dialogBtn]: true,
                  [styles.csBaseBtn]: true,
                }}
              >
                {_t('取消')}
              </el-button>
              <el-button
                onClick={() => emit('confirm')}
                type="primary"
                disabled={props.submitDisabled}
                class={{
                  [styles.csBaseBtn]: true,
                }}
              >
                {_t('确认')}
              </el-button>
            </div>
          )
        },
      }
      if (slots.title) {
        vSlots.title = () => {
          return slots.title?.()
        }
      }
      return (
        <div
          class={styles.drawContent}
@@ -55,34 +103,8 @@
            }}
            onOpen={() => emit('open')}
            onClose={() => emit('close')}
            v-slots={{
              footer() {
                return (
                  <div class={styles.csDialogFooter}>
                    <el-button
                      onClick={() => emit('close')}
                      type="info"
                      plain
                      class={{
                        [styles.dialogBtn]: true,
                        [styles.csBaseBtn]: true,
                      }}
                    >
                      取消
                    </el-button>
                    <el-button
                      onClick={() => emit('confirm')}
                      type="primary"
                      class={{
                        [styles.csBaseBtn]: true,
                      }}
                    >
                      确认
                    </el-button>
                  </div>
                )
              },
            }}
            v-slots={vSlots}
            append-to-body={props.appendToBody}
            {...attrs}
            title={props.title}
            size={props.width || attrs.size}