<template>
  <view class="content">
    <view class="card">
      <view class="mt-10">
        <u-cell-group :border="false">
          <u-cell>
            <view slot="title" class="title">风险点名称：</view>
            <view slot="value">{{ form.riskUnitName }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">辨识部位名称：</view>
            <view slot="value">{{ form.identificationpartsName }}</view>
          </u-cell>
          <view class="mt-10 flex">
            <view class="title1">存在风险</view>
            <view class="main">{{ form.riskDesc }}</view>
          </view>
          <view class="mt-10 flex">
            <view class="title1">主要管控措施</view>
            <view class="main">{{ form.measures }}</view>
          </view>

          <u-cell>
            <view slot="title" class="title">管控部门</view>
            <view slot="value">{{ form.departmentName }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">事故类型</view>
            <view slot="value">{{ form.accidentsName }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">风险等级</view>
            <view slot="value">
              <u-tag v-if="form.level ==='levelD'" text="低风险/D级"></u-tag>
              <u-tag v-if="form.level ==='levelB'" text="较大风险/B级" type="warning"></u-tag>
              <u-tag v-if="form.level ==='levelC'" text="一般风险/C级" bgColor="#eeca51" borderColor="#eeca51"></u-tag>
              <u-tag v-if="form.level ==='levelA'" text="重大风险/A级" type="error"></u-tag>
            </view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">经度</view>
            <view slot="value">{{ form.longitude }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">纬度</view>
            <view slot="value">{{ form.latitude }}</view>
          </u-cell>
        </u-cell-group>
      </view>
    </view>
  </view>
</template>

<script>
import { getRiskPostInfo } from "@/api";

export default {
  data() {
    return {
      id: '',
      companyId: '',
      form: {}
    }
  },
  onLoad(event) {
    this.id = event.id;
    this.companyId = event.companyId;
    this.getData();
  },
  methods: {
    async getData() {
      let { data } = await getRiskPostInfo({ id: this.id });
      this.form = data;
    }
  }
}
</script>

<style scoped lang="scss">
.flex {
  color: #222222;
  font-size: 30rpx;
  border-bottom: 1px solid #eeeeee;

  .title1 {
    font-weight: bold;
    padding-left: 30rpx;
    font-size: 28rpx;
  }

  .main {
    padding: 40rpx;
  }
}

</style>
