lizhuang пре 5 година
родитељ
комит
004e1f5cb1
1 измењених фајлова са 11 додато и 3 уклоњено
  1. 11 3
      src/views/doBusiness/index.vue

+ 11 - 3
src/views/doBusiness/index.vue

@@ -7,9 +7,13 @@
     </div>
     <el-calendar class="doBusinessContainer" :first-day-of-week="7">
       <template slot="dateCell" slot-scope="{date, data}">
-        <div class="time-duration" v-for="(item,index) in content" :key="index">
+        <template v-for="(item,index) in content" >
+          <div 
+          class="time-duration" 
+          :key="index"
+          v-if="showTimeDuration(date, item)"
+          >
           <el-time-picker
-            v-if="date.getFullYear()+''+(parseInt(date.getMonth()+1)>10?parseInt(date.getMonth()+1):'0'+(parseInt(date.getMonth()+1)))+''+(date.getDate()>10?date.getDate():'0'+date.getDate())==item.date"
             is-range
             v-model="item.timeRange"
             size="mini"
@@ -22,6 +26,7 @@
             placeholder="选择时间范围">
           </el-time-picker>
         </div>
+        </template>
         <div class="dataJoin">{{ data.day.split('-').slice(2).join('')}}</div>
       </template>
     </el-calendar>
@@ -53,7 +58,7 @@ export default {
     lt(){
        let month = parseInt(this.date.slice(4,6))+1
        return this.date.slice(0,4) + (month > 10 ? month : ('0'+month) )+ this.date.slice(6,8)
-    }
+    },
   },
 
   methods: {
@@ -100,6 +105,9 @@ export default {
       updateHours(params).then(res=>{
         console.log(res)
       })
+    },
+    showTimeDuration(date, item) {
+      return timestamp2String(+date).substr(0, 8) == item.date
     }
   },
   mounted(){