avue 自定义搜索内容

在这里插入图片描述


<template>
  <basic-container>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
    >
    自定义顶部按钮
      <template slot="menuLeft">
        <el-button
          type="primary"
          size="small"
          icon="el-icon-download"
          @click="exportFn"
          >导出台账
        </el-button>
    
      </template>
      自定义列表按钮
      <template slot="menu" slot-scope="scope">
        <el-button
          type="text"
          size="small"
          icon="el-icon-view"
          @click="lookFn(scope.row)"
          >查看
        </el-button>
      </template>
      <!-- <template slot-scope="{ row }" slot="category">
        <el-tag>{{ row.categoryName }}</el-tag>
      </template> -->
      <!-- 申报日期/ -->
      //自定义搜索
       //  declareTime  是prop的值
      <template slot="declareTimeSearch">
        <el-date-picker
          v-model="createTimeRange"
          format="yyyy-MM-dd HH:mm:ss"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetimerange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          @change="createTimeChange"
        >
        </el-date-picker>
      </template>
        自定义搜索
      <template slot="jeqjSearch">
         <div>
           <el-input v-model="startAmount" style="width:100px;margin-right: 5px;"></el-input>
          -<el-input v-model="endAmount" style="width:100px;margin-left: 5px;"></el-input>
         </div>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
export default {
  data() {
    return {
      processInsId:'',
      // 开始金额。/
      startAmount:'',
    // 结束金额
    endAmount:'',
      dialogVisible: false,
      createTimeRange: [],
      form: {},
      query: {},
      loading: true,
      search: {},
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      selectionList: [],
      option: {
        column: [
          {
            label: "申报日期",
            prop: "declareTime",
            search: true,
          },
          {
            label: "金额区间",
            prop: "jeqj",
            search: true,
            hide: true,
          }
        ],
      },
      data: [],
    };
  },

  methods: {
    // 时间搜索
    createTimeChange(val) {
      if (val) {
        this.$set(this.search, "declarerStartDate", val[0]);
        this.$set(this.search, "declarerEndDate", val[1]);
      } else {
        this.$set(this.search, "declarerStartDate", "");
        this.$set(this.search, "declarerEndDate", "");
      }
    },
  //搜索方法
    searchChange(params, done) {
      var reg = /^[0-9]*$ /
      //金额
      if(reg.test(this.startAmount) || reg.test(this.endAmount)){
         params.startAmount = this.startAmount
         params.endAmount = this.endAmount
      }else{
        this.startAmount = ''
        this.endAmount = ''
       this.$message({
            type: "warning",
            message: "金额只能输入数字",
          });
      }
    

      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
 
  
   

    },
  },
};
</script>

<style>
</style>

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小四是个处女座

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值