perf: 合并参数
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
* @Author: zhaojinfeng 121016171@qq.com
|
* @Author: zhaojinfeng 121016171@qq.com
|
||||||
* @Date: 2023-08-14 11:07:15
|
* @Date: 2023-08-14 11:07:15
|
||||||
* @LastEditors: zhaojinfeng 121016171@qq.com
|
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||||
* @LastEditTime: 2023-09-05 18:26:31
|
* @LastEditTime: 2023-09-06 20:03:04
|
||||||
* @FilePath: \vue3\packages\select-transfer-modal\index.vue
|
* @FilePath: \vue3\packages\select-transfer-modal\index.vue
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@ -19,9 +19,8 @@
|
|||||||
:z-index="zIndex" @open="getList" @closed="closed"
|
:z-index="zIndex" @open="getList" @closed="closed"
|
||||||
>
|
>
|
||||||
<div flex>
|
<div flex>
|
||||||
<slot name="left" :left-params="leftParams" />
|
<slot name="left" />
|
||||||
<div>
|
<div grow>
|
||||||
{{ queryParams }}
|
|
||||||
<el-form ref="queryRef" :model="queryParams" inline>
|
<el-form ref="queryRef" :model="queryParams" inline>
|
||||||
<el-form-item v-for="formItem in formItems" :key="formItem.prop" :label="formItem.label" :prop="formItem.prop">
|
<el-form-item v-for="formItem in formItems" :key="formItem.prop" :label="formItem.label" :prop="formItem.prop">
|
||||||
<el-select v-if="formItem.selectOptions" :placeholder="formItem.placeholder">
|
<el-select v-if="formItem.selectOptions" :placeholder="formItem.placeholder">
|
||||||
@ -148,8 +147,6 @@ const queryParams = reactive({
|
|||||||
pageSize: properties.pageSizes[0] || 10,
|
pageSize: properties.pageSizes[0] || 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
const leftParams = reactive({})
|
|
||||||
|
|
||||||
const data = computed(() => {
|
const data = computed(() => {
|
||||||
const all: any[] = []
|
const all: any[] = []
|
||||||
const { props: { disabled = 'disabled', key = 'id' }, lockList } = properties
|
const { props: { disabled = 'disabled', key = 'id' }, lockList } = properties
|
||||||
@ -180,7 +177,6 @@ async function getList() {
|
|||||||
try {
|
try {
|
||||||
const response = await properties.request({
|
const response = await properties.request({
|
||||||
...properties.defaultParams,
|
...properties.defaultParams,
|
||||||
...leftParams, // 合并参数
|
|
||||||
...queryParams,
|
...queryParams,
|
||||||
})
|
})
|
||||||
const { key = 'id' } = properties.props
|
const { key = 'id' } = properties.props
|
||||||
@ -241,7 +237,7 @@ function transferValueInit() {
|
|||||||
|
|
||||||
transferValueInit()
|
transferValueInit()
|
||||||
|
|
||||||
watch(() => leftParams, handleQuery)
|
watch(() => properties.defaultParams, handleQuery, { deep: true })
|
||||||
watch(() => properties.value, transferValueInit)
|
watch(() => properties.value, transferValueInit)
|
||||||
watch(() => properties.show, (show) => {
|
watch(() => properties.show, (show) => {
|
||||||
showDialog.value = show
|
showDialog.value = show
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: zhaojinfeng 121016171@qq.com
|
* @Author: zhaojinfeng 121016171@qq.com
|
||||||
* @Date: 2023-08-14 11:07:15
|
* @Date: 2023-08-14 11:07:15
|
||||||
* @LastEditors: zhaojinfeng 121016171@qq.com
|
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||||
* @LastEditTime: 2023-09-05 18:19:09
|
* @LastEditTime: 2023-09-06 20:02:01
|
||||||
* @FilePath: \vue3\stories\SelectTransferModal.stories.ts
|
* @FilePath: \vue3\stories\SelectTransferModal.stories.ts
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@ -168,6 +168,10 @@ export const LeftSlot: Story = {
|
|||||||
name: '左插槽',
|
name: '左插槽',
|
||||||
args: {
|
args: {
|
||||||
...meta.args,
|
...meta.args,
|
||||||
|
width: '90%',
|
||||||
|
defaultParams: {
|
||||||
|
name: '',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
render: args => ({
|
render: args => ({
|
||||||
components: { ThSelectTransferModal },
|
components: { ThSelectTransferModal },
|
||||||
@ -189,10 +193,9 @@ export const LeftSlot: Story = {
|
|||||||
:width="args.width"
|
:width="args.width"
|
||||||
:z-index="args.zIndex"
|
:z-index="args.zIndex"
|
||||||
>
|
>
|
||||||
<template #left="{ queryParams }">
|
<template #left>
|
||||||
<div style="width:200px">
|
<div style="width:200px">
|
||||||
|
<input v-model="args.defaultParams.name" />
|
||||||
<input v-model="queryParams.name" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</th-select-transfer-modal>
|
</th-select-transfer-modal>
|
||||||
|
Reference in New Issue
Block a user