1、template

<el-form-item label="注册时间">
                  <el-date-picker
                    v-model="dateRange"
                    size="small"
                    style="width: 240px"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    range-separator="-"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  ></el-date-picker>
                </el-form-item>

2、data

data() {
    return {
      // 日期范围
      dateRange: [],

3、methods

methods: {
    /** 查询供应商信息列表 */
    getList() {
      this.loading = true;
      listSupplierInfo(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
        this.supplierInfoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },

4、addDataRange封装

// 添加日期范围
export function addDateRange(params, dateRange) {
	var search = params;
	search.beginTime = "";
	search.endTime = "";
	if (null != dateRange && '' != dateRange) {
		search.beginTime = this.dateRange[0];
		search.endTime = this.dateRange[1];
	}
	return search;
}

5、mapper.xml

<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
                AND date_format(register_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>

 

Logo

前往低代码交流专区

更多推荐