|
|
@@ -14,7 +14,8 @@
|
|
|
<a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
|
|
|
<a-button type="primary" :disabled="tableRecord.length == 0" @click="onOK">添加</a-button>
|
|
|
</template>
|
|
|
- <a-input class="search-panel" v-model:value="search" placeholder="搜索内容" @keyup.enter="searchData" allowClear></a-input>
|
|
|
+ <a-input v-if="needQuestSearch" class="search-panel" v-model:value="search" placeholder="搜索内容" @keyup.enter="searchData" allowClear></a-input>
|
|
|
+ <a-input v-else class="search-panel" v-model:value="search" placeholder="静态搜索内容" @keyup.enter="filterItems" allowClear></a-input>
|
|
|
<slot name="more"></slot>
|
|
|
<a-table
|
|
|
:loading="loading"
|
|
|
@@ -67,7 +68,8 @@
|
|
|
loading:Boolean,
|
|
|
tableid:Number,
|
|
|
rowKey:String,
|
|
|
- selectAll:Boolean
|
|
|
+ selectAll:Boolean,
|
|
|
+ needQuestSearch:Boolean
|
|
|
})
|
|
|
const propsColumns = ref(props.columns)
|
|
|
const visible = ref(false)
|
|
|
@@ -149,7 +151,7 @@
|
|
|
props.param.content.pageSize = pagination.pageSize
|
|
|
listData()
|
|
|
}
|
|
|
- const listData = async (dataIndex,value)=> {
|
|
|
+ const listData = async (fn)=> {
|
|
|
props.param.content.where.tablefilter = {}
|
|
|
propsColumns.value.forEach((e)=>{
|
|
|
e.value?props.param.content.where.tablefilter[e.dataIndex] = e.value:''
|
|
|
@@ -165,6 +167,9 @@
|
|
|
tableRecord.value = res.data
|
|
|
selectedRowKeys.value = res.data.map(e=>e.itemid)
|
|
|
}
|
|
|
+
|
|
|
+ // 开启列表数据静态过滤
|
|
|
+ props.needQuestSearch ? fn() :''
|
|
|
}
|
|
|
const onSelect = async (record, selected, selectedRows, nativeEvent)=>{
|
|
|
if (!selected) {
|
|
|
@@ -178,11 +183,23 @@
|
|
|
props.param.content.pageNumber = 1
|
|
|
listData()
|
|
|
}
|
|
|
-
|
|
|
const reloadSelect = () =>{
|
|
|
selectedRowKeys.value = []
|
|
|
tableRecord.value = []
|
|
|
}
|
|
|
+ const filterItems = async (searchText)=> {
|
|
|
+ listData(()=>{
|
|
|
+ const items = ['itemname', 'itemno', 'standards', 'model', 'spec']
|
|
|
+ data.value = data.value.filter(item => {
|
|
|
+ // 假设我们搜索name和description字段
|
|
|
+ return (
|
|
|
+ items.some(field => item[field].toLowerCase().includes(search.value.toLowerCase()))
|
|
|
+ );
|
|
|
+ });
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
defineExpose({
|
|
|
visible,
|
|
|
listData,
|