大数据模型练习2

html 复制代码
<template>
  <el-dialog v-model="visible" title="搜索项配置" width="700px" @open="initTransferData">
    <div style="text-align: center">
      <el-transfer
        v-model="targetKeys"
        :data="transferData"
        :titles="['全部搜索项', '已选搜索项']"
        target-order="original"
        filterable
      />
    </div>

    <template #footer>
      <span class="dialog-footer">
        <el-button @click="visible = false">取消</el-button>
        <el-button type="primary" @click="handleConfirm">确定</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup>
import { computed, ref, watch } from 'vue'
import { useSearchStore } from '../../stores/searchStore'

const props = defineProps(['modelValue'])
const emit = defineEmits(['update:modelValue'])

const searchStore = useSearchStore()
const targetKeys = ref([]) // 右侧已选的 key 数组

// 计算属性实现 v-model
const visible = computed({
  get: () => props.modelValue,
  set: (val) => emit('update:modelValue', val),
})

// 将 Store 中的字段转换为 Transfer 需要的格式 { key, label }
const transferData = computed(() => {
  return searchStore.allFields.map((f) => ({
    key: f.key,
    label: f.label,
    disabled: false,
  }))
})

// 弹窗打开时,从 Store 同步当前状态
const initTransferData = () => {
  targetKeys.value = [...searchStore.activeFieldKeys]
}

const handleConfirm = () => {
  // 更新 Store
  searchStore.updateActiveFields(targetKeys.value)
  visible.value = false
}
</script>
相关推荐
Aloudata5 小时前
制造企业做库存周转分析:沿用 ERP 报表,还是用语义层统一跨工厂口径?
大数据·数据分析·制造·语义层
顧棟5 小时前
Elasticsearch LifecycleComponent 组件生命周期设计分析
大数据·elasticsearch
qyr67896 小时前
全球汽车和航空航天用磁铁材料市场竞争格局变化趋势
大数据·人工智能·物联网·自动化·汽车和航空航天用磁铁材料
大大大大晴天9 小时前
范式建模、维度建模与宽表建模:企业数仓该如何取舍
大数据
货拉拉技术12 小时前
货拉拉大数据智能运维AI Agent探索实践
大数据·人工智能
TDengine (老段)13 小时前
TDengine 读缓存与 LAST 查询完全指南
大数据·数据库·物联网·缓存·时序数据库·tdengine·涛思数据
字节跳动数据平台13 小时前
知识引擎 VeKnow 文档解析实践:文字提取之后,如何保留结构与依据
大数据
武子康16 小时前
100个AI玩家,不等于100位真实玩家
大数据·人工智能·claude
linweidong16 小时前
从零搭建 Iceberg 数据湖:存储、查询与运维实战
大数据·spark·iceberg·实时数仓·数据湖·湖仓一体·大数据面试
存储架构师-iVY18 小时前
从端侧192GB到云端PCIe 5.0:拆解AI时代的存储架构演进
大数据·人工智能·ai存储·lpcamm2·socamm2·pcie 5.0·统一内存架构