<template>

    <el-dialog
      :title="dialogTitle"
      v-model="dialogVisible"
      width="600px"
  
      @close="closeDialog(0)"
       @open="open"
    >
    <div style="width:100%;
    height:400px;background:#aaa   "></div>
     
    </el-dialog>

</template>

<script>
import { useStore } from 'vuex'
import { defineComponent, ref, watchEffect } from 'vue'
// import * as api from '@/api/siteManage/watchDog.js'
// import { ElMessage } from 'element-plus'

export default defineComponent({
  name: 'CheckVideo',
  emits: ['closeDialog'],
  props: {
    flag: Boolean,
    dialogTitle: String,
    itemInfo: Object,
  },
  setup(props, context) {
    context
    const store = useStore()
    const dialogVisible = ref(false)
    const formInfo = ref(null)

    const form = ref([])

     const siteList = ref([])

    // open(): Dialog弹窗打开之前做的事
    const open = () => {
      form.value = props.itemInfo.value;
      siteList.value = store.state.siteList
      console.log('siteList.value')
      console.log(siteList.value)
      console.log('siteList.value')
    }

    const options = [
      {
        value: '选项1',
        label: '站点一',
      },
      {
        value: '选项2',
        label: '站点二',
      },
      {
        value: '选项3',
        label: '站点三',
      },
      {
        value: '选项4',
        label: '站点四',
      },
      {
        value: '选项5',
        label: '站点五',
      },
    ]

    // 关闭弹框
    const closeDialog = () => {
      context.emit('closeDialog', false)
      dialogVisible.value = false
    }

    watchEffect((fn, options) => {
      fn, options
      dialogVisible.value = props.flag
    })

    const roleValid = (rule, value, callback) => {
      rule
      if (value.length === 0) {
        callback(new Error('角色不能为空'))
      } else {
        callback()
      }
    }


    return {
      closeDialog,
      dialogVisible,
      options,
      roleValid,
      formInfo,
      siteList,
      form,
      open,
    
    }
  },
})
</script>
 
<style scoped lang="scss">
.el-input,
.el-select {
  width: 240px;
}

// label样式
.el-form-item__label {
    width: 150px
}
.el-form-item__content {
    margin-left: 150px
}
</style>