<template>
  <view class="emergency_add_page">
    <view class="card_form">
      <hs-cell title="选择项目" required borderTop :isLink="true" :value="useModel?.formData?.value?.project_name"
        isPlaceholder="请选择项目" url="/pages/public/select_project/index?source=emergency_add" />
      <hs-cell title="事件名称" required borderTop>
        <hs-input v-model:valueModel="useModel.formData.value.name" placeholder="请输入事件名称" textAlign="right" />
      </hs-cell>
      <hs-radio-picker-categories-tree title="事件分类" required borderTop
        v-model:valueModel="useModel.formData.value.two_emergency_categories_id" />
      <hs-radio-picker-levels title="事件等级" required borderTop
        v-model:valueModel="useModel.formData.value.emergency_event_levels_id" />
      <hs-date-picker title="发生时间" required borderTop v-model:valueModel="useModel.formData.value.emergency_time" />
    </view>
    <view class="card_form">
      <hs-cell-textarea required title="事发地点" placeholder="请详细描述问题情况，包括具体位置现象等"
        v-model:valueModel="useModel.formData.value.emergency_location" />
      <hs-cell-textarea required title="事件描述" placeholder="请详细描述问题情况，包括具体位置现象等"
        v-model:valueModel="useModel.formData.value.emergency_description" />
      <hs-cell-textarea required title="发生原因" placeholder="请详细描述问题情况，包括具体位置现象等"
        v-model:valueModel="useModel.formData.value.emergency_cause" />
      <hs-cell-textarea required title="造成结果" placeholder="请详细描述问题情况，包括具体位置现象等"
        v-model:valueModel="useModel.formData.value.cause_result" />
      <hs-upload title="事件相关图片" :count="10" borderTop v-model:valueModel="useModel.formData.value.emergency_images" />
    </view>
    <view class="card_form">
      <hs-cell-textarea title="相关人物" placeholder="请详细描述问题情况，包括具体位置现象等"
        v-model:valueModel="useModel.formData.value.related_person" />
      <hs-cell-textarea title="补充信息" placeholder="请详细描述问题情况，包括具体位置现象等"
        v-model:valueModel="useModel.formData.value.supplement" />
    </view>

    <!-- <view class="card_form">
      <hs-cell title="赔偿方">
        <hs-radio
          :Enums="EmergencyEventsCompensationTypeEnum"
          v-model:valueModel="useModel.formData.value.compensation_type"
        />
      </hs-cell>
      <hs-cell title="赔偿比例" borderTop>
        <hs-input
          v-model:valueModel="useModel.formData.value.compensation_rate"
          textAlign="right"
          type="number"
          suffix="%"
        />
      </hs-cell>
      <hs-cell title="赔偿金额" borderTop>
        <hs-input
          v-model:valueModel="useModel.formData.value.compensation_amount"
          textAlign="right"
          type="number"
          suffix="元"
        />
      </hs-cell>
      <hs-cell title="已支付赔偿金额" borderTop>
        <hs-input
          v-model:valueModel="useModel.formData.value.compensation_paid_amount"
          textAlign="right"
          type="number"
          suffix="元"
        />
      </hs-cell>
    </view> -->

    <hs-footer btnParimaryName="提交" @handleParmaryClick="method?.handleSubmit" />
  </view>
</template>
<script setup lang="ts">
import { onShow, onUnload } from '@dcloudio/uni-app'
import method from './method'
import useModel from './model'

onShow(() => {
  method?.init()
})
onUnload(() => {
  useModel.formData.value = {}
})
</script>
<style lang="scss">
@import './style.scss';
</style>
