<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.PARTSNAME }}</view>
          </u-cell>

          <view class="mt-10 flex">
            <view class="title1">存在风险</view>
            <view class="main">{{ form.RISK_DESCR }}</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.DEPT_NAME }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">事故类型</view>
            <view slot="value">{{ form.ACCIDENTS_NAME }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">风险等级</view>
            <view slot="value">
              <u-tag v-if="form.LEVELID=='levelD'" text="低风险/D级"></u-tag>
              <u-tag v-if="form.LEVELID=='levelB'" text="较大风险/B级" type="warning"></u-tag>
              <u-tag v-if="form.LEVELID=='levelC'" text="一般风险/C级" bgColor="#eeca51" borderColor="#eeca51"></u-tag>
              <u-tag v-if="form.LEVELID=='levelA'" text="重大风险/A级" type="error"></u-tag>
            </view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">经度</view>
            <view slot="value">{{ form.PARTSNAME_LONGITUDE }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">纬度</view>
            <view slot="value">{{ form.PARTSNAME_LATITUDE }}</view>
          </u-cell>
        </u-cell-group>
      </view>
    </view>
  </view>
</template>

<script>
import {getRiskUnitCustomizedList} from "../../../api";

export default {
  data() {
    return {
      RISKPOINT_ID: '',
      CORPINFO_ID: '',
      DEPARTMENT_ID: '',
      form: {}
    }
  },
  onLoad(event) {
    this.RISKPOINT_ID = event.RISKPOINT_ID;
    this.CORPINFO_ID = event.CORPINFO_ID;
    this.DEPARTMENT_ID = event.DEPARTMENT_ID;
    this.getData();
  },
  methods: {
    async getData() {
      let resData = await getRiskUnitCustomizedList({
        RISKPOINT_ID: this.RISKPOINT_ID,
        CORPINFO_ID: this.CORPINFO_ID,
        DEPARTMENT_ID: this.DEPARTMENT_ID
      });
      this.form = resData.varList[0];
    }
  }
}
</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>