大数据模型练习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>
相关推荐
慕诗客5 小时前
repo管理多仓库
大数据·elasticsearch·搜索引擎
yaoyouzhong7 小时前
MySQL 批量插入详解:快速提升大数据导入效率的实战方法
大数据·数据库·mysql
云栖梦泽9 小时前
AI安全合规与治理:行业发展趋势与职业展望
大数据·人工智能·安全
得物技术9 小时前
财务数仓 Claude AI Coding 应用实战|得物技术
大数据·llm·aiops
rainy雨10 小时前
免费且好用的精益工具在哪里?2026年精益工具清单整理
大数据·人工智能·信息可视化·数据挖掘·数据分析·精益工程
蚂蚁数据AntData10 小时前
破解AI“机器味“困境:HeartBench评测实践详解
大数据·人工智能·算法·机器学习·语言模型·开源
Jane - UTS 数据传输系统11 小时前
立足国家“十五五”数智化战略大局,紧扣上海“2+3+6+6”产业布局,UTS数据传输系统筑牢数智化转型数据底座
大数据·人工智能·跨平台·信创·跨数据库·十五五·国产数据库适配
xcbrand11 小时前
口碑好的品牌策划厂家
大数据·人工智能·python
wzl2026121314 小时前
企微私域工具免费版vs付费版:数据统计API差异与自动化报表脚本实现
大数据·自动化·企业微信
key_3_feng14 小时前
MCP协议:解锁AI模型与外部世界的高效协作
大数据·人工智能·mcp