Vue + Element 后台管理页面之实现报表数据查询与清空的按钮

如图:

 

 

代码如下:

<!-- 查询清空按钮 -->
          <span class="inline-span butt">
            <el-button type="primary" v-on:click="getFinaDetailsData" plain icon="el-icon-search">查询</el-button>
            <el-button icon="el-icon-delete" v-on:click="resetData">清空</el-button>
          </span>

 

//一些数据变量须在data里先声明,自行添加
watch: { dateRangeParam: { handler (newValue, oldValue) { this.getFinaDetailsData() }, deep: true } }, methods: { // 点击查询 getFinaDetailsData () { this.currentPage = 1 this.tempFormData = Object.assign({ start: this.dateRangeParam[0], end: this.dateRangeParam[1], storeId: this.storeId, orderId: this.orderId, payType: this.payType, incPayType: this.incPayType, minAmount: this.minAmount, maxAmount: this.maxAmount, current: this.currentPage, size: this.pageSize }) this.$http({ url: this.$http.adornUrl('项目地址'), method: 'get', params: this.$http.adornParams({ start: this.dateRangeParam[0], end: this.dateRangeParam[1], storeId: this.storeId, orderId: this.orderId, payType: this.payType, incPayType: this.incPayType, minAmount: this.minAmount, maxAmount: this.maxAmount, current: this.currentPage, size: this.pageSize }) }).then(({ data }) => { console.log(data) this.tableData = data.records // 将支付类型(int)转中文(str) this.tableData.forEach(element => { element.payType = this.payTypeList[element.payType] }) this.currentPage = data.current this.pageSize = data.size this.pageTotal = data.total }) }, // 点击清空 resetData () { this.orderId = null this.payType = -1 this.incPayType = 0 this.maxAmount = null this.minAmount = null } }

  

posted @ 2020-08-24 09:22  yoona-lin  阅读(976)  评论(0编辑  收藏  举报