Commit fa5bc39a authored by jingnan's avatar jingnan 👀

配套明细页表头全量筛选功能,用户自己配置

parent 2cb428bd
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
--> -->
<template> <template>
<div v-dee-loading="loading" class="MatchRequestItemsCon"> <div v-dee-loading="loading" class="MatchRequestItemsCon">
<dee-as-com
:lay-config="{
typeName: 'ExtSupportingItem',
layKey: 'MatchRequestItemsSearch'
}"
@searchEvent="searchEvent"
/>
<dee-tools slot="header" :tools="tools" mode="normal" :collapse="false" /> <dee-tools slot="header" :tools="tools" mode="normal" :collapse="false" />
<div class="dee-table dee-table-dis-border"> <div class="dee-table dee-table-dis-border">
<el-table <el-table
...@@ -171,11 +178,12 @@ export default { ...@@ -171,11 +178,12 @@ export default {
selectionRows: [], selectionRows: [],
currentRow: {}, currentRow: {},
reqStatusOptions: [], reqStatusOptions: [],
hideMaterial: true hideMaterial: true,
searchParams: {}
} }
}, },
computed: { computed: {
filterTableData() { rawTableData() {
let resData = [] let resData = []
if (this.hideMaterial) { if (this.hideMaterial) {
this.tableData.forEach(row => { this.tableData.forEach(row => {
...@@ -188,6 +196,9 @@ export default { ...@@ -188,6 +196,9 @@ export default {
} }
return resData return resData
}, },
filterTableData() {
return this.filterTableDataBySearch(this.rawTableData, this.searchParams)
},
tools() { tools() {
const data = [ const data = [
// { // {
...@@ -233,6 +244,35 @@ export default { ...@@ -233,6 +244,35 @@ export default {
this.reqStatusOptions = res this.reqStatusOptions = res
}) })
}, },
searchEvent(val) {
this.searchParams = val
},
// 过滤函数
filterTableDataBySearch(data, filters) {
if (!filters || !filters.items || filters.items.length === 0) {
return data
}
return data.filter(row => {
let matches = true
filters.items.forEach(filter => {
const fieldValue = this.getNestedValue(row, filter.fieldName)
if (filter.operator === 'EQ') {
debugger
matches = matches && (fieldValue === filter.value)
} else if (filter.operator === 'LIKE') {
matches = matches && (fieldValue && fieldValue.toString().includes(filter.value))
}
if (!matches) {
return false
}
})
return matches
})
},
// 辅助函数,用于获取嵌套字段的值
getNestedValue(obj, path) {
return path.split('.').reduce((o, i) => (o || {})[i], obj)
},
getOuterTableData() { getOuterTableData() {
// this.loading = true // this.loading = true
get(`/ExtSupportingItem/searchByAo?aoId=${this.basicData.extProcessPlanId}`).then(res => { get(`/ExtSupportingItem/searchByAo?aoId=${this.basicData.extProcessPlanId}`).then(res => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment