<template>
  <van-dialog @confirm="onConfirm" v-model="show" show-cancel-button>
    <div style="margin:10px;">
      <div>
        <div>是否更新{{ stateText }}时间?</div>
      </div>
      <time-cell required is-row title="更新时间" v-model="time" dateType="time" textFormatter="H时m分"/>
    </div>
  </van-dialog>
</template>

<script>
import dayjs from 'dayjs'
import TimeCell from '@/components/timeCell'

export default {
  components: { TimeCell },
  data() {
    return {
      show: false,
      subSystem: {},
      stateText: '',
      time:dayjs(new Date()) .format("H:m")
    }
  },
  props: {},
  methods: {
    dayjs,
    onConfirm() {  
      this.$emit('success',this.subSystem,this.state,`${dayjs().format("YYYY-MM-DD")} ${this.time}:00`)
    },
    open(subSystem,state, stateText) {
      this.subSystem = subSystem
      this.state=state,
      this.stateText = stateText
      this.show = true
    }
  }
}
</script>
