tremble 4 年之前
父节点
当前提交
eb70559bf7
共有 3 个文件被更改,包括 17 次插入7 次删除
  1. 2 2
      index.html
  2. 1 1
      js/lib/sys-calendar.js
  3. 14 4
      js/showHardware.js

+ 2 - 2
index.html

@@ -136,7 +136,7 @@
                 <i class="iconfont iconquxiao"></i>
                 <i class="iconfont iconquxiao"></i>
             </div>
             </div>
         </div>
         </div>
-        <div class="m-con">
+        <!-- <div class="m-con">
             <i class="iconfont iconquxiao"></i>
             <i class="iconfont iconquxiao"></i>
             <div class="monitorbody">
             <div class="monitorbody">
                 <div class="mvideo">
                 <div class="mvideo">
@@ -144,7 +144,7 @@
                 </div>
                 </div>
                 <div id="calendar"></div>
                 <div id="calendar"></div>
             </div>
             </div>
-        </div>
+        </div> -->
     </div>
     </div>
     <div id="popup">
     <div id="popup">
         <div class="popup-content">
         <div class="popup-content">

+ 1 - 1
js/lib/sys-calendar.js

@@ -84,7 +84,6 @@ Calendar.prototype = {
             var modeText = $(this).text();
             var modeText = $(this).text();
             var mode = modeText == "月" ? "month" : "year";
             var mode = modeText == "月" ? "month" : "year";
             me.changeMode(mode);
             me.changeMode(mode);
-            console.log(mode,11111111);
         })
         })
         //calendar-cell日期点击事件
         //calendar-cell日期点击事件
         el.on("click", ".calendar-cell", function (e) {
         el.on("click", ".calendar-cell", function (e) {
@@ -154,6 +153,7 @@ Calendar.prototype = {
             opts.newDate.setFullYear(yearNum);
             opts.newDate.setFullYear(yearNum);
             opts.mode == "month" ? me._refreshCalendar(opts.newDate,cycleData) : me._refreshYearCalendar(opts.newDate);
             opts.mode == "month" ? me._refreshCalendar(opts.newDate,cycleData) : me._refreshYearCalendar(opts.newDate);
             $(parent).find(".calendar-year-text").text(yearText);
             $(parent).find(".calendar-year-text").text(yearText);
+            if (opts.yearSelect) opts.yearSelect.call(yearText,yearNum,me)
 
 
 
 
         })
         })

+ 14 - 4
js/showHardware.js

@@ -389,9 +389,9 @@ $(function () {
 
 
 
 
   window.loadCalendar = function(params = {}){
   window.loadCalendar = function(params = {}){
-    let { data,cellCb=()=>{},monthCb=()=>{} } = params
+
+    let { data,cellCb=()=>{},yearSelect=()=>{},monthCb=()=>{} } = params
       //日历方法
       //日历方法
-          
       $("#calendar").calendar({
       $("#calendar").calendar({
       data: data, //记录数据
       data: data, //记录数据
       work: [],//上班时间
       work: [],//上班时间
@@ -402,10 +402,13 @@ $(function () {
         let item = data[0]
         let item = data[0]
         cellCb(item)
         cellCb(item)
       },
       },
+      yearSelect: function (yearText) {
+        yearSelect(yearText)
+      },
       monthClick: function (e, nextMonth, opts, me) {
       monthClick: function (e, nextMonth, opts, me) {
-        monthCb(e)
+        monthCb(nextMonth)
       }
       }
-      });
+    });
   }
   }
 
 
   window.loadCalendar({
   window.loadCalendar({
@@ -416,7 +419,14 @@ $(function () {
     //点击日期时间
     //点击日期时间
     cellCb: (item)=> {
     cellCb: (item)=> {
       console.log(item);
       console.log(item);
+    },
+    yearSelect: (yearText)=> {
+      console.log(yearText);
+    },
+    monthCb: (nextMonth)=> {
+      console.log(nextMonth);
     }
     }
+    
   })
   })
 
 
   /*loadMonitor({
   /*loadMonitor({