search项默认显示4条

This commit is contained in:
mll
2026-03-18 18:41:47 +08:00
parent cb77ad837b
commit 85f7484c57
2 changed files with 22 additions and 1 deletions

View File

@@ -231,6 +231,22 @@ const summaryMethod1=({columns,data})=>{
}) })
return styleObj return styleObj
} }
// 远程搜索处理函数
async function handleRemoteSearch(code,prop,page,dictData) {
// 空关键词时可选择加载前10条或清空
try {
let res = await ReportApi.getTableList(code,{pageSize: 50, pageNo:page})
// 更新下拉选项
dictData= dictData.concat(res.records.map(item=>({
label:item[prop],
value:item[prop]
})))
page++
} finally {
}
}
function getCurrentDate() { function getCurrentDate() {
const now = new Date(); const now = new Date();
// 补零函数小于10则前面加0 // 补零函数小于10则前面加0
@@ -383,6 +399,11 @@ const initTable = async () => {
pageSize: 1000000, pageSize: 1000000,
pageNo:1 pageNo:1
} }
// config.dicData=[]
// config.remote=true
// config.popperAppendToBody= true
// let pageN=1
// config.remoteMethod= handleRemoteSearch(jkTableDicFields[item.fieldName],config.prop,pageN,config.dicData)
config.dicFormatter= (res) => { //请求数据格式化 config.dicFormatter= (res) => { //请求数据格式化
const arr=[...new Set(res.records.map(item=>item[config.prop=="zonename"?"salezonename":config.prop]))] const arr=[...new Set(res.records.map(item=>item[config.prop=="zonename"?"salezonename":config.prop]))]
return arr.map(item=>({label:item,value:item})) return arr.map(item=>({label:item,value:item}))

View File

@@ -26,7 +26,7 @@ export const setupAvue = async (app: App<Element>) => {
searchSpan: 6, searchSpan: 6,
searchMenuSpan: 6, searchMenuSpan: 6,
searchMenuPosition: 'left', searchMenuPosition: 'left',
searchIndex: 3, searchIndex: 4,
searchIcon: true, searchIcon: true,
searchShowBtn: true, searchShowBtn: true,
labelSuffix: ' ', labelSuffix: ' ',