大数据模型练习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>
相关推荐
会员源码网4 小时前
Elasticsearch从零启动指南:安装、配置、启停与排坑全解析
大数据·elasticsearch·搜索引擎
才盛智能科技4 小时前
元K:自助KTV行业AI生态领航者
大数据·人工智能·物联网·自助ktv系统·才盛云自助ktv系统
xuefuhe4 小时前
postgresql xmin xmax cmin cmax ctid
大数据·数据库
昨夜见军贴06164 小时前
合规性管理的现代化实践:IACheck的AI审核如何系统提升生产型检测报告的合规水平
大数据·运维·人工智能
wuxi_joe5 小时前
一家研发制造企业的“软件进化史”
大数据·数据库·制造
Lansonli5 小时前
大数据Spark(七十九):Action行动算子countByKey和countByValue使用案例
大数据·分布式·spark
发哥来了5 小时前
主流AI视频生成模型商用化能力评测:三大核心维度对比分析
大数据·人工智能·音视频
Hello.Reader5 小时前
Flink CLI 从提交作业到 Savepoint/Checkpoint、再到 YARN/K8S 与 PyFlink
大数据·flink·kubernetes
电商API&Tina5 小时前
唯品会获得vip商品详情 API 返回值说明
java·大数据·开发语言·数据库·人工智能·spring