222
schangxiang@126.com
2025-04-30 9bec4dcae002f36aa23231da11cb03a156b40110
PipeLineLems/web/src/components/Tag/Tag.tsx
@@ -12,6 +12,7 @@
import Empty from '../Empty/Empty'
import Icon from '../Icon/Icon'
import isNil from 'lodash/isNil'
import { _t } from '@/libs/Language/Language'
interface OptionType {
  label: string
  value: string
@@ -34,7 +35,7 @@
  [key: string]: any
}
export default defineComponent<TagProps>({
export default defineComponent<any>({
  // @ts-ignore
  name: 'Tag',
  emits: ['click', 'update:modelValue', 'change', 'mouseenter', 'update:data'],
@@ -73,13 +74,21 @@
    },
    // 默认值
    defaultValue: {
      type: String,
      type: [String, Number],
      default: '',
    },
    // 默认值
    max: {
      type: Number,
      default: 999,
    },
    className: {
      type: String,
      default: '',
    },
    width: {
      type: String,
      default: '180px',
    },
  },
  setup(props: TagProps, { attrs, slots, emit }: SetupContext) {
@@ -243,8 +252,6 @@
    }
    return () => {
      // showTip
      // 多tag情况,传data[]
      if (Array.isArray(props.data)) {
        const msg = (item: DataType) =>
          item[label] ||
@@ -256,7 +263,12 @@
        return (
          // @ts-ignore
          <Tip showTip={props.showTip} v={v}>
            <div class={styles.flex}>
            <div
              class={{
                [styles.flex]: true,
                [props.className]: props.className,
              }}
            >
              <DRender />
            </div>
          </Tip>
@@ -291,12 +303,13 @@
                    })}
                  </el-dropdown-menu>
                ) : (
                  <Empty />
                  <Empty text={_t('暂无数据')} />
                ),
            }}
          >
            <div
              onMouseenter={onMouseenter}
              style={{ width: props.width }}
              class={{
                [styles.tagSelect]: true,
                [styles.isSelectTag]: visible.value,
@@ -307,7 +320,7 @@
                  {currentName.value}
                </span>
              ) : (
                <div class={styles.pl}>请选择</div>
                <div class={styles.pl}>{_t('请选择')}</div>
              )}
              <Icon
                class={styles.iconDown}