<template>
 <div >
  <a-modal style="padding-left: 15px;padding-right: 15px" :title="title" :width="width" :visible="visible" @ok="handleOk" okText="结束应急" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
   

   <div class="p-4">
    <a-card>
      <!-- Redis 信息实时监控 -->
      <a-row :gutter="8">
        <a-col :sm="24" :xl="18">
          <div  style="width: 100%; height: 150px">
          <a-descriptions title="基本信息" style="padding-left: 15px;padding-right: 15px">
          <a-descriptions-item label="应急事件名称">{{ name }}</a-descriptions-item>
          <a-descriptions-item label="事件类型">{{ tp_dictText }}</a-descriptions-item>
          <a-descriptions-item label="事件等级">{{ level_dictText }}</a-descriptions-item>
          <a-descriptions-item label="牵头处置部门">{{ handleDepart }}</a-descriptions-item>
          <a-descriptions-item label="参与部门" :span="2">{{ supportDepart }}</a-descriptions-item>
          <a-descriptions-item label="说明" :span="2">{{ des }}</a-descriptions-item>
        </a-descriptions>
          </div>
        </a-col>
        <a-col :sm="24" :xl="6">
          <div  style="width: 100%; height: 150px">

          <a-descriptions title="应急处置事件计时" style="padding-left: 15px;padding-right: 15px">
         <a-descriptions-item label="开始时间">{{ name }}</a-descriptions-item>
          </a-descriptions>
          </div>
        </a-col>
      </a-row>
    </a-card>

    
  </div>

  <BcsHandleMethodExeList :eventId="eventId" ref="refBcsHandleMethodList" />


   


  </a-modal>

  
</div>
</template>

<script lang="ts" setup>
  import { ref, nextTick, defineExpose } from 'vue';
  import { useMessage } from '/@/hooks/web/useMessage';
  import BcsHandleMethodExeList from '/@/views/bcs/handle/BcsHandleMethodExeList.vue';
  import {updateEventStaEnd } from '/@/views/bcs/handle/BcsRiskEvent.api';

  const onFinish = () => {
  console.log('finished!');
};
const deadline = Date.now();

  
  
  
  const title = ref<string>('');
  const width = ref<number>(1024);
  const visible = ref<boolean>(false);
  const disableSubmit = ref<boolean>(false);
  const registerForm = ref();
  const emit = defineEmits(['register', 'success']);

  const eventId = ref<number>(0);

  const activeKey = ref('1');
  const name = ref<string>('');
  const level_dictText = ref<string>('');
  const tp_dictText = ref<string>('');
  const handleDepart = ref<string>('');
  const supportDepart = ref<string>('');
  const des = ref<string>('');
  const refBcsHandleMethodList = ref();
  const sttime = ref();

  const { createMessage } = useMessage();
  

  
  /**
   * 编辑
   * @param record
   */
  function edit(record) {
    title.value = '处置';
    visible.value = true;
    eventId.value =record.id;
    name.value =record.name;
    tp_dictText.value =record.tp_dictText;
    level_dictText.value =record.level_dictText;
    handleDepart.value =record.handleDepart;
    supportDepart.value =record.supportDepart;
    des.value =record.des;
    sttime.value =record.sttime;

    refBcsHandleMethodList.value.searchReset(eventId.value);
      
    nextTick(() => {
    //  registerForm.value.edit(record);
    });
  }


  //使用component动态切换tab
   function tabChange(key) {
        activeKey.value = key;
      
      }


  
  /**
   * 确定按钮点击事件
   */
   function handleOk() {
   // registerForm.value.submitForm();
    createMessage.success("事件处理完毕");
     updateEventStaEnd({ id: eventId.value }, handleCancel);
     handleCancel();
     emit('success');

  }

  /**
   * form保存回调事件
   */
  function submitCallback() {
    handleCancel();
    emit('success');
  }

  /**
   * 取消按钮回调事件
   */
  function handleCancel() {
    visible.value = false;
  }


  

  defineExpose({
   
    edit,
    disableSubmit,
  });
</script>

<style scoped lang="less">
  /**隐藏样式-modal确定按钮 */
  .jee-hidden {
    display: none !important;
  }

</style>
