兰宝车间质量管理系统-前端
疯狂的狮子Li
2025-02-07 b95a49c7d74e5c7f45cd7c65f45502edf7f203dd
src/components/DictTag/index.vue
@@ -2,16 +2,28 @@
  <div>
    <template v-for="(item, index) in options">
      <template v-if="values.includes(item.value)">
        <span v-if="(item.elTagType === 'default' || item.elTagType === '') && (item.elTagClass === '' || item.elTagClass == null)"
              :key="item.value" :index="index" :class="item.elTagClass">
          {{ item.label + " " }}
        <span
          v-if="(item.elTagType === 'default' || item.elTagType === '') && (item.elTagClass === '' || item.elTagClass == null)"
          :key="item.value"
          :index="index"
          :class="item.elTagClass"
        >
          {{ item.label + ' ' }}
        </span>
        <el-tag
          v-else
          :key="item.value + ''"
          :disable-transitions="true"
          :index="index"
          :type="(item.elTagType === 'primary' || item.elTagType === 'default')? '' : item.elTagType"
          :type="
            item.elTagType === 'primary' ||
            item.elTagType === 'success' ||
            item.elTagType === 'info' ||
            item.elTagType === 'warning' ||
            item.elTagType === 'danger'
              ? item.elTagType
              : 'primary'
          "
          :class="item.elTagClass"
        >
          {{ item.label + ' ' }}
@@ -28,8 +40,8 @@
interface Props {
  options: Array<DictDataOption>;
  value: number | string | Array<number | string>;
  showValue: boolean;
  separator: string;
  showValue?: boolean;
  separator?: string;
}
const props = withDefaults(defineProps<Props>(), {
  showValue: true,
@@ -44,12 +56,13 @@
const unmatch = computed(() => {
  if (props.options?.length == 0 || props.value === '' || props.value === null || typeof props.value === 'undefined') return false;
  // 传入值为非数组
  let unmatch = false; // 添加一个标志来判断是否有未匹配项
  values.value.forEach((item) => {
    if (!props.options.some((v) => v.value === item)) {
      return true; // 如果有未匹配项,将标志设置为true
      unmatch = true; // 如果有未匹配项,将标志设置为true
    }
  });
  return false; // 返回标志的值
  return unmatch; // 返回标志的值
});
const unmatchArray = computed(() => {