@@ -283,107 +283,52 @@ export default {
283283 elmnt .clientTop + elmnt .height ;
284284 document .getElementById (" Select" ).style .Left = elmnt .clientLeft ;
285285 },
286+ ABtime (YYYYMMDD ) {
287+ return (
288+ new Date (YYYYMMDD ).getUTCFullYear () +
289+ " -" +
290+ new Date (YYYYMMDD ).getUTCMonth () +
291+ " -" +
292+ new Date (YYYYMMDD ).getUTCDate ()
293+ );
294+ },
295+ ontime () {
296+ return (
297+ new Date ().getUTCFullYear () +
298+ " -" +
299+ new Date ().getUTCMonth () +
300+ " -" +
301+ new Date ().getUTCDate ()
302+ );
303+ },
286304 handleChange () {
287305 console .log (this .dateValue ); // -> 1
288306 this .$store .commit (" setSelectDate" , this .dateValue );
289307 let start = this .dateValue [0 ];
290- // new Date(this.dateValue[0]).getFullYear() +
291- // "-" +
292- // new Date(this.dateValue[0]).getMonth() +
293- // "-" +
294- // new Date(this.dateValue[0]).getDate();
295308 let end = this .dateValue [1 ];
296- // new Date(this.dateValue[1]).getFullYear() +
297- // "-" +
298- // new Date(this.dateValue[1]).getMonth() +
299- // "-" +
300- // new Date(this.dateValue[1]).getDate();
301309 this .$store .commit (" updateDateformat" , [start, end]);
302- // console.log("$store", this.$store.state.selectDate); // -> 1
303- // console.log("$store", this.$store.state.selectDate); // -> 1
304- // this.$store.dispatch("fetchSummaryApi", {
305- // start_date: new Date(start).toISOString().substring(0, 10),
306- // end_date: new Date(end).toISOString().substring(0, 10)
307- // });
308- if (start == end && start == new Date ().toISOString ().substring (0 , 10 )) {
310+ if (
311+ this .ABtime (start) == this .ABtime (end) &&
312+ this .ABtime (start) == this .ontime
313+ ) {
314+ console .log (
315+ " 起始日=截止日=今日" ,
316+ this .ABtime (start),
317+ this .ABtime (end),
318+ this .ontime
319+ );
309320 // FIXME
310- this .$store .dispatch (" fetchToDaysApi" );
311321 console .log (
312322 " 起始日=截止日=今日" ,
313323 new Date ().toISOString ().substring (0 , 10 )
314324 );
315- // if (
316- // // new Date(start).getUTCMonth() == new Date().getMonth() &&
317- // // new Date(start).getUTCDate() == new Date().getUTCDate()
318- // new Date(start).getMonth() == new Date().getMonth() &&
319- // new Date(start).getDate() == new Date().getDate()
320- // ) {
321- // console.log("$start == end tore", start, end); // -> 1
322- // //等於當日 FIX ISSUE 50
323- // this.$store.dispatch("fetchToDaysApi");
324- // }
325+ this .$store .dispatch (" fetchToDaysApi" );
325326 // FIXME
327+ // 等於當日 FIX ISSUE 50
326328 // 執行TO(被選中的單日)Day
327329 } else {
328- console .log (
329- " GetAPI start" ,
330- start,
331- new Date (start)
332- .toLocaleString ()
333- .replace (" /" , " -" )
334- .replace (" /" , " -" )
335- .substring (0 , 9 )
336- ); // -> 1
337- console .log (
338- " GetAPI end" ,
339- end,
340- new Date (end)
341- .toLocaleString ()
342- .replace (" /" , " -" )
343- .replace (" /" , " -" )
344- .substring (0 , 9 )
345- ); // -> 1
346- let startFromt = new Date (start).toLocaleString ().split (" /" );
347- let endFromt = new Date (end).toLocaleString ().split (" /" );
348- let startSTR =
349- startFromt[0 ] +
350- " -" +
351- startFromt[1 ] +
352- " -" +
353- startFromt[2 ].substring (0 , 2 );
354- let endSTR =
355- endFromt[0 ] + " -" + endFromt[1 ] + " -" + endFromt[2 ].substring (0 , 2 );
356- console .log (" ss" , startSTR, endSTR);
357- this .GetAPI (
358- " Summary" ,
359- start,
360- end
361- // new Date(start).toISOString().substring(0, 10),
362- // new Date(end).toISOString().substring(0, 10)
363- // new Date(start)
364- // .toLocaleString()
365- // .replace("/", "-")
366- // .replace("/", "-")
367- // .substring(0, 9),
368- // new Date(end)
369- // .toLocaleString()
370- // .replace("/", "-")
371- // .replace("/", "-")
372- // .substring(0, 9)
373-
374- // new Date(start).toISOString().substring(0, 10),
375- // new Date(end).toISOString().substring(0, 10)
376- // new Date(start).getFullYear()+'-'+new Date(start).getMonth()+'-'+new Date(start).getDate(),
377- // new Date(end).getFullYear()+'-'+new Date(end).getMonth()+'-'+new Date(end).getDate()
378- // startSTR + "",
379- // endSTR + ""
380- // startFromt[0] +
381- // "-" +
382- // startFromt[1] +
383- // "-" +
384- // startFromt[2].substring(0, 2),
385- // endFromt[0] + "-" + endFromt[1] + "-" + endFromt[2].substring(0, 2)
386- );
330+ console .log (" Summary" , start, end);
331+ this .GetAPI (" Summary" , start, end);
387332 }
388333
389334 console .log (
0 commit comments