业务如图:
代码如下:
html:
<label>时间:</label>
<sit-datepicker sit-value="vm.value1" style="display:inline-block;vertical-align:middle"> </sit-datepicker>
<label>至</label>
<sit-datepicker sit-value="vm.value2" style="display:inline-block;vertical-align:middle"> </sit-datepicker>
js:
var d = new Date();
d.setDate(1);
//self.value1 = d.format('yyyy-MM-dd');
//self.value2 = getCurrentMonthLast().format('yyyy-MM-dd');
// self.value1 = d;
//self.value2 = getCurrentMonthLast();
//获取年月日 20180318 wt
var GetDate_yyyyMMdd = function () {
var nowDate = new Date();
var year = nowDate.getFullYear().toString();
var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1;
var day = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
return year + "-" + month + "-" + day;
}
//获取时分秒 20180318 wt
var GetDate_HHmmss = function () {
var nowDate = new Date();
var hour = nowDate.getHours() < 10 ? "0" + nowDate.getHours() : nowDate.getHours();
var minute = nowDate.getMinutes() < 10 ? "0" + nowDate.getMinutes() : nowDate.getMinutes();
var second = nowDate.getSeconds() < 10 ? "0" + nowDate.getSeconds() : nowDate.getSeconds();
return hour.toString() + ":" + minute + ":" + second;
}
if (typeof (self.value1) != "undefined" && self.value1 != "" && typeof (self.value2) != "undefined" && self.value2 != "") {
strWhere = strWhere + " and estimated_start_time >= '" + self.value1.format('yyyy-MM-dd') + ' 00:00:00' + "' and estimated_start_time <= '" + self.value2.format('yyyy-MM-dd') + ' 23:59:59' + "' ";
}