大数据模型练习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>
相关推荐
Data-Miner3 小时前
集团数字化转型大数据平台整体建设方案
大数据
guslegend4 小时前
大模型驱动大数据SRE智能运维
大数据·运维
跨境小彭5 小时前
2026 Temu 合规新玩法,凌风 ERP 优化 POD 运营效率
大数据·跨境电商·temu·shein
weixin_397574095 小时前
从“点状试点“到“全面智能化“:制造企业AI落地的现实路径
大数据·人工智能·制造
志栋智能6 小时前
超自动化巡检:知识沉淀与团队协作的新载体
大数据·运维·网络·数据库·人工智能·自动化
Old Uncle Tom7 小时前
循环工程(loop engineering)
大数据
跨境数据猎手7 小时前
淘宝大数据技术在电商行业的应用
大数据
阿部多瑞 ABU7 小时前
铁三角:泛二次元奶头乐经济的结构分析及其人口后果
大数据·人工智能
吴卫斌7 小时前
波动率控制仓位系列(一):满仓轮动的“过山车”困境
大数据·python·股票·量化交易
AI焦点7 小时前
2026年AI应用架构:如何避坑并选对API聚合中转服务?
大数据·人工智能·架构