• 多个输入框实现串联筛选


    需求描述:调接口获取数据,前端通过条件进行模糊筛选,效果图如下:

    在这里插入图片描述
    在这里插入图片描述

    在这里插入图片描述

    <template>
    <div>
        <el-table border class="search-table" :data="tableData2">
            <el-table-column align="center" fixed type="selection" width="50" />
            <el-table-column fixed label="序号" type="index">
                <template #header>
                    <div class="th-head">序号div>
                template>
                <template slot-scope="scope">
                    {{ scope.$index + 1 }}
                template>
            el-table-column>
            <el-table-column fixed label="物料名称" prop="name" width="150">
                <template #header>
                    <div class="th-head">物料名称div>
                    <el-input v-model="query.name" placeholder="输入物料名称查询" />
                template>
            el-table-column>
            <el-table-column label="规格说明" prop="desc" width="150">
                <template #header>
                    <div class="th-head">规格说明div>
                    <el-input v-model="query.desc" placeholder="输入规格说明查询" />
                template>
            el-table-column>
            <el-table-column label="单位" prop="unit" width="120">
                <template #header>
                    <div class="th-head">单位div>
                    <el-input v-model="query.unit" placeholder="输入单位查询" />
                template>
            el-table-column>
            <el-table-column align="right" header-align="left" label="不含税单价" prop="price" width="120">
                <template #header>
                    <div class="th-head">不含税单价div>
                    <el-input v-model="query.price" placeholder="输入不含税单价查询" />
                template>
            el-table-column>
            <el-table-column align="right" header-align="left" label="含税单价" prop="pricevat" width="120">
                <template #header>
                    <div class="th-head">含税单价div>
                    <el-input v-model="query.pricevat" placeholder="输入含税单价查询" />
                template>
            el-table-column>
            <el-table-column label="订单量" prop="quantity" width="300">
                <template #header>
                    <div class="th-head">订单量div>
                    <el-input v-model="query.quantity" placeholder="输入订单量查询" />
                template>
            el-table-column>
            <el-table-column label="到货量" prop="zip" width="300">
                <template #header>
                    <div class="th-head">到货量div>
                    <el-input v-model="query.zip" placeholder="输入到货量查询" />
                template>
            el-table-column>
            <el-table-column label="收获单位" prop="city" width="300">
                <template #header>
                    <div class="th-head">收获单位div>
                    <el-input v-model="query.city" placeholder="输入收获单位查询" />
                template>
            el-table-column>
            <el-table-column fixed="right" label="操作" width="100">
                <template #header>
                    <div class="th-head">操作div>
                template>
                <template #default="{ row }">
                    <el-button size="small" type="text" @click="handleClick(row)">
                        查看
                    el-button>
                template>
            el-table-column>
        el-table>
    div>
    template>
    
    <script>
    export default {
        data() {
            return {
                tableData: [{
                        date: '2016-05-02',
                        name: '张小虎',
                        province: '上海',
                        city: '地方接电话',
                        address: '上海市普陀区金沙江路 1518 弄',
                        zip: '地方共和国股份回购',
                        desc: '哈哈哈哈',
                        price: '125',
                        pricevat: '230'
                    },
                    {
                        date: '2016-05-04',
                        name: '王大虎',
                        province: '上海',
                        city: '是经典款待付款',
                        address: '上海市普陀区金沙江路 1517 弄',
                        zip: '大结局几篇',
                        price: '125',
                        pricevat: '120,344,000.27',
                        desc: '信息已想哈',
                    },
                    {
                        date: '2016-05-01',
                        name: '李小虎',
                        province: '上海',
                        city: '近段时间',
                        address: '上海市普陀区金沙江路 1519 弄',
                        zip: '的会计考试',
                        price: '1,001,230,000.25',
                        pricevat: '120',
                        desc: '黑乎乎啥啥啥',
                    },
                    {
                        date: '2016-05-03',
                        name: '陈大虎',
                        province: '上海',
                        city: '普陀区',
                        address: '上海市普陀区金沙江路 1516 弄',
                        zip: '豆腐鱼页面快乐',
                        price: '10,023,000.25',
                        pricevat: '12',
                        desc: '就是调平看一眼2',
                    },
                    {
                        date: '2016-05-03',
                        name: '陈大王',
                        province: '上海',
                        city: '普陀区',
                        address: '上海市普陀区金沙江路 1516 弄',
                        zip: '豆腐鱼页面快乐3',
                        price: '20.25',
                        pricevat: '12,008,900.27',
                        desc: '就是调平看三眼',
                    },
                    {
                        date: '2016-05-03',
                        name: '陈大事',
                        province: '上海',
                        city: '普陀区',
                        address: '上海市普陀区金沙江路 1516 弄',
                        zip: '豆腐鱼页面快乐3',
                        price: '10',
                        pricevat: '12,008,900.27',
                        desc: '就是调平看二眼',
                    },
                ],
                query: {
                    name: '',
                    desc: '',
                    unit: '',
                    price: '',
                    pricevat: '',
                    quantity: '',
                    arrived: '',
                    arrivedcompany: '',
                },
            }
        },
        computed: {
            //俩input输入值筛选
            tableData2() {
                return this.tableData.filter(
                    //name,desc是要筛选的两个属性,this.query.name,this.query.dec是两个input框里v-model绑定的输入的两个值
                    item =>
                    item.name.includes(this.query.name) && item.desc.includes(this.query.desc) &&
                    item.price.includes(this.query.price) && item.pricevat.includes(this.query.pricevat)
    
                )
            },
        },
    }
    script>
    
    <style lang="less" scoped>
    .el-table th.el-table__cell.el-table__cell,
    .el-table th.el-table__cell .cell {
        background: #cccd;
        color: #666;
    }
    
    .search-table {
        th.el-table__cell {
            vertical-align: top;
            padding-top: 0;
            padding-bottom: 0;
        }
    
        .th-head {
            background: #cccd;
            border-bottom: 1px solid #e6ecf6;
            padding: 8px 10px;
            // height: 40px;
            box-sizing: border-box;
        }
    
        th.el-table__cell>.cell.cell {
            font-weight: 500;
            color: #282828;
            padding-left: 0;
            padding-right: 0;
        }
    
        th.el-table-column--selection .cell {
            background: #cccd;
            border-bottom: 1px solid #e6ecf6;
            padding-left: 10px;
            padding-right: 10px;
            padding-top: 8px;
            padding-bottom: 8px;
            height: 40px;
            box-sizing: border-box;
        }
    
        tr td.el-table__cell:first-child .cell .el-checkbox {
            padding-left: 4px;
        }
    
        // 输入框
        th .el-input__inner {
            border-color: transparent;
            padding-left: 10px;
        }
    
        th .el-input__inner:focus {
            border-color: #1890ff;
        }
    }
    style>
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229

    在这里插入图片描述

  • 相关阅读:
    JVM类加载机制
    标准应用 | 数据库防火墙安全技术解析与实践
    C#面:XML与 HTML 的主要区别是什么
    Java进阶07 嵌套类
    谁说Python只能用来敲代码,用Python来制作游戏你了解吗?
    java 企业工程管理系统软件源码 自主研发 工程行业适用
    Vue3中使用Element-Plus分页组件
    [4G/5G/6G专题基础-155]: 5G 3GPP高精确室内定位原理、AI方案概述
    给Mac加上点保险 AppleCare+问题解答
    使用CreateProcess崩溃:处未处理的异常: 0xC0000005: 写入位置 0x00415652 时发生访问冲突
  • 原文地址:https://blog.csdn.net/qq_45695853/article/details/126097994