统一组件不同引用及传值显示不同

2019-12-10  本文已影响0人  兰夏天
 <a-form>    
   <a-row>
 
 <a-col
          class="widthtime"
          :sm="24"
          :md="12"
          :lg="8"
          :lx="8"
          v-if="'starttime' in queryCondition">
          <a-form-item label="开始时间">
            <a-date-picker
              v-model="efmobj.starttime"
              showTime
              format="YYYY-MM-DD HH:mm:ss"
              placeholder="开始时间"
            />
          </a-form-item>
        </a-col>
        <a-col
          class="widthtime"
          :sm="24"
          :md="12"
          :lg="8"
          :lx="8"
          v-if="'endtime' in queryCondition">
          <a-form-item label="结束时间" style="widht:100%;">
            <a-date-picker
              v-model=" efmobj.endtime"
              showTime
              format="YYYY-MM-DD HH:mm:ss"
              placeholder="结束时间"
            />
          </a-form-item>
        </a-col>
   </a-row>
    </a-form>
  props: {
    showtime: String
  },
data(){
return{  
 efmobj: {
        endtime: moment().endOf('day'),
        starttime: moment().startOf('day')
      }
}
},
 mounted () {
    let that = this
    switch (this.showtime) {
      case 'hour':
        that.efmobj.starttime = moment().startOf('hour')
        that.efmobj.endtime = moment().startOf('hour').add(1, 'hour')
        break
      case 'day':
        that.efmobj.starttime = moment().startOf('day')
        that.efmobj.endtime = moment().endOf('day')
        break
      default:
        that.efmobj.starttime = moment().startOf('day')
        that.efmobj.endtime = moment().endOf('day')
    }

    this.getfactorydata()
  },
上一篇下一篇

猜你喜欢

热点阅读