<DatePicker v-model="searchCreateTime" type="daterange" placement="bottom-end" placeholder="選擇建立時間區間" clearable ></DatePicker>
searchCreateTime:['', ''],html
createTimeStart: this.createTime[0], 前端
createTimeEnd: this.createTime[1],vue
{"page":1,"limit":10,"status":"","wxcode":"","type":"","orderCode":"","userName":"","createTimeStart":"2020-06-07T16:00:00.000Z","createTimeEnd":"2020-06-10T16:00:00.000Z"} SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); df.setTimeZone(TimeZone.getTimeZone("UTC")); SimpleDateFormat dfMy = new SimpleDateFormat("yyyy-MM-dd");
String createTimeStart = StringISNULLUtil.mapToString(searchPreamMy.get("createTimeStart")); String createTimeEnd = StringISNULLUtil.mapToString(searchPreamMy.get("createTimeEnd"));
if (createTimeEnd != null && !"".equals(createTimeEnd)) { map.put("createTimeEnd", dfMy.format(df.parse(createTimeEnd))+" 23:59:59"); } else { map.put("createTimeEnd", ""); } if (createTimeStart != null && !"".equals(createTimeStart)) { map.put("createTimeStart", dfMy.format(df.parse(createTimeStart))+" 00:00:00"); } else { map.put("createTimeStart", ""); }
<DatePicker v-model="auditTime" @on-change="setOption" type="daterange" format="yyyy-MM-dd" placement="bottom-end" placeholder="選擇註冊開始時間以及結束時間" ></DatePicker>
2.js vue 定義: 後端
auditTime:['',''],xcode
3.on-change 設置:this
setOption(date) {spa
this.auditTime = date;code
},orm
4.取值:htm
createTimeStart:this.auditTime[0],
createTimeEnd:this.auditTime[1],
5.後端不須要任何處理,直接接受參數便可
userSearch.setCreateTimeEnd(StringISNULLUtil.mapToString(searchPreamMy.get("createTimeEnd")));
userSearch.setCreateTimeStart(StringISNULLUtil.mapToString(searchPreamMy.get("createTimeStart")));