新功能: tableSelector组件

This commit is contained in:
猿小天
2023-02-18 21:43:35 +08:00
parent c633b580be
commit d5d2931944
2 changed files with 29 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
<template>
<div>{{props.modelValue}}</div>
<el-select popper-class="popperClass" class="tableSelector" :multiple="props.tableConfig.isMultiple"
@remove-tag="removeTag" v-model="data" placeholder="请选择" @visible-change="visibleChange">
<template #empty>
@@ -10,6 +11,7 @@
</template>
</el-input>
<el-table
ref="tableRef"
:data="tableData"
size="mini"
border
@@ -42,7 +44,7 @@
import {defineProps, onMounted, reactive, ref, toRaw, watch} from 'vue'
import {dict} from '@fast-crud/fast-crud'
import XEUtils from "xe-utils";
import qs from 'qs'
const props = defineProps({
modelValue: {},
tableConfig: {
@@ -56,6 +58,8 @@ const props = defineProps({
}
} as any)
const emit = defineEmits(['update:modelValue'])
// tableRef
const tableRef = ref()
// template上使用data
const data = ref()
// 多选值
@@ -74,6 +78,9 @@ watch(multipleSelection, // 监听multipleSelection的变化
}, // 当multipleSelection值触发后同步修改data.value的值
{immediate: true} // 立即触发一次给data赋值初始值
)
// 搜索值
const search = ref(undefined)
//表格数据
@@ -85,10 +92,6 @@ const pageConfig = reactive({
total: 0
})
const removeTag = (val: any, aa: any) => {
console.log(val, aa)
}
/**
* 表格多选
* @param val:Array
@@ -160,6 +163,22 @@ const handlePageChange = (page: any) => {
getDict()
}
const getDictByValue = async ()=>{
const url = props.tableConfig.url
const dicts = dict({url: url, params: {}})
await dicts.reloadDict()
const dictData = dicts.data
console.log(dictData)
return dictData
}
// 监听modelValue的变化更新数据
watch(()=>{
return props.modelValue
},(value)=>{
},{immediate: true})
</script>