This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<ArtSearchBar
|
||||
v-model:filter="searchForm"
|
||||
:items="searchFormItems"
|
||||
:show-expand="false"
|
||||
show-expand
|
||||
@reset="handleReset"
|
||||
@search="handleSearch"
|
||||
></ArtSearchBar>
|
||||
@@ -347,6 +347,28 @@
|
||||
const availableRoles = ref<ShopRoleResponse[]>([])
|
||||
const selectedRoleId = ref<number | undefined>(undefined)
|
||||
|
||||
// 上级店铺搜索选项
|
||||
const parentShopOptions = ref<any[]>([])
|
||||
|
||||
// 搜索上级店铺
|
||||
const searchParentShops = async (query: string) => {
|
||||
try {
|
||||
const params: any = {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
}
|
||||
if (query) {
|
||||
params.shop_name = query
|
||||
}
|
||||
const res = await ShopService.getShops(params)
|
||||
if (res.code === 0) {
|
||||
parentShopOptions.value = res.data.items || []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('搜索店铺失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 定义表单搜索初始值
|
||||
const initialSearchState = {
|
||||
shop_name: '',
|
||||
@@ -408,6 +430,23 @@
|
||||
placeholder: '请输入店铺编号'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '上级店铺',
|
||||
prop: 'parent_id',
|
||||
type: 'select',
|
||||
config: {
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
remote: true,
|
||||
remoteMethod: (query: string) => searchParentShops(query),
|
||||
placeholder: '请选择或搜索上级店铺'
|
||||
},
|
||||
options: () =>
|
||||
parentShopOptions.value.map((shop) => ({
|
||||
label: shop.shop_name,
|
||||
value: shop.id
|
||||
}))
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
prop: 'status',
|
||||
@@ -722,6 +761,7 @@
|
||||
getShopList()
|
||||
loadTopLevelShops() // 加载顶级店铺用于级联选择
|
||||
searchDefaultRoles('') // 加载初始默认角色列表
|
||||
searchParentShops('') // 加载上级店铺选项
|
||||
})
|
||||
|
||||
// 获取店铺列表
|
||||
|
||||
Reference in New Issue
Block a user