新功能: tableSelector组件
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div>{{props.modelValue}}</div>
|
||||||
<el-select popper-class="popperClass" class="tableSelector" :multiple="props.tableConfig.isMultiple"
|
<el-select popper-class="popperClass" class="tableSelector" :multiple="props.tableConfig.isMultiple"
|
||||||
@remove-tag="removeTag" v-model="data" placeholder="请选择" @visible-change="visibleChange">
|
@remove-tag="removeTag" v-model="data" placeholder="请选择" @visible-change="visibleChange">
|
||||||
<template #empty>
|
<template #empty>
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-table
|
<el-table
|
||||||
|
ref="tableRef"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
size="mini"
|
size="mini"
|
||||||
border
|
border
|
||||||
@@ -42,7 +44,7 @@
|
|||||||
import {defineProps, onMounted, reactive, ref, toRaw, watch} from 'vue'
|
import {defineProps, onMounted, reactive, ref, toRaw, watch} from 'vue'
|
||||||
import {dict} from '@fast-crud/fast-crud'
|
import {dict} from '@fast-crud/fast-crud'
|
||||||
import XEUtils from "xe-utils";
|
import XEUtils from "xe-utils";
|
||||||
|
import qs from 'qs'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {},
|
modelValue: {},
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
@@ -56,6 +58,8 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
} as any)
|
} as any)
|
||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
// tableRef
|
||||||
|
const tableRef = ref()
|
||||||
// template上使用data
|
// template上使用data
|
||||||
const data = ref()
|
const data = ref()
|
||||||
// 多选值
|
// 多选值
|
||||||
@@ -74,6 +78,9 @@ watch(multipleSelection, // 监听multipleSelection的变化,
|
|||||||
}, // 当multipleSelection值触发后,同步修改data.value的值
|
}, // 当multipleSelection值触发后,同步修改data.value的值
|
||||||
{immediate: true} // 立即触发一次,给data赋值初始值
|
{immediate: true} // 立即触发一次,给data赋值初始值
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 搜索值
|
// 搜索值
|
||||||
const search = ref(undefined)
|
const search = ref(undefined)
|
||||||
//表格数据
|
//表格数据
|
||||||
@@ -85,10 +92,6 @@ const pageConfig = reactive({
|
|||||||
total: 0
|
total: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
const removeTag = (val: any, aa: any) => {
|
|
||||||
console.log(val, aa)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格多选
|
* 表格多选
|
||||||
* @param val:Array
|
* @param val:Array
|
||||||
@@ -160,6 +163,22 @@ const handlePageChange = (page: any) => {
|
|||||||
getDict()
|
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>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ export function GetObj(id: InfoReq) {
|
|||||||
|
|
||||||
export function AddObj(obj: AddReq) {
|
export function AddObj(obj: AddReq) {
|
||||||
console.log(20,obj)
|
console.log(20,obj)
|
||||||
// return request({
|
return request({
|
||||||
// url: apiPrefix,
|
url: apiPrefix,
|
||||||
// method: 'post',
|
method: 'post',
|
||||||
// data: obj,
|
data: obj,
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj: EditReq) {
|
export function UpdateObj(obj: EditReq) {
|
||||||
|
|||||||
Reference in New Issue
Block a user