<template>
  <view class="content">
    <view class="card">
      <view class="card">
        <view class="view-title">
          <u--text text="检测内容" bold></u--text>
        </view>
        <view class="mt-10">
          <uni-table border stripe emptyText="暂无更多数据">
            <uni-tr>
              <uni-th align="center">检测内容</uni-th>
              <uni-th align="center">状态</uni-th>
            </uni-tr>
            <uni-tr v-for="item in varList" :key="item.RISKPOINT_ID">
              <uni-td>{{ item.CHECK_CONTENT }}</uni-td>
              <uni-td v-if='item.ISNORMAL=="1"' align="center">
                <view style="color: blue;" @click="HiddenDetail(item.HIDDEN_ID)">不合格</view>
              </uni-td>
              <uni-td v-else-if='item.ISNORMAL=="2"' align="center">
                <view style="color: blue;">已忽略</view>
              </uni-td>
              <uni-td v-else align="center">
                <template v-if="item.IMGCOUNT>0 && isTongyong">
                  <view style="color: blue;">合格</view>
                </template>
                <template v-else>合格</template>
              </uni-td>
            </uni-tr>
          </uni-table>
        </view>
      </view>
      <view class="card">
        <view class="view-title">
          <u--text text="其他隐患信息" bold></u--text>
        </view>
        <view class="mt-10">
          <uni-table border stripe emptyText="暂无更多数据">
            <uni-tr>
              <uni-th align="center">隐患描述</uni-th>
              <uni-th align="center">操作</uni-th>
            </uni-tr>
            <uni-tr v-for="item in otherHiddenList" :key="item.HIDDEN_ID">
              <uni-td>{{ item.HIDDENDESCR }}</uni-td>
              <uni-td align="center">
                <view style="color: blue" @click="HiddenDetail(item.HIDDEN_ID)">查看</view>
              </uni-td>
            </uni-tr>
          </uni-table>
        </view>
      </view>
      <view class="card">
        <view class="view-title">
          <u--text text="清单信息" bold></u--text>
        </view>
        <view class="mt-10">
          <u-cell-group>
            <u-cell>
              <view slot="title" class="title">清单名称</view>
              <view slot="value">{{ form.LIST_NAME }}</view>
            </u-cell>
            <u-cell>
              <view slot="title" class="title">排查清单类型</view>
              <view slot="value">{{ form.SCREENTYPENAME }}</view>
            </u-cell>
            <u-cell>
              <view slot="title" class="title">检查人</view>
              <view slot="value">{{ form.USERS }}</view>
            </u-cell>
            <u-cell>
              <view slot="title" class="title">检查时间</view>
              <view slot="value">{{ form.CHECK_TIME }}</view>
            </u-cell>
            <u-cell>
              <view slot="title" class="title">所属部门</view>
              <view slot="value">{{ form.DEPARTMENT_NAME }}</view>
            </u-cell>
            <u-cell>
              <view slot="title" class="title">所属岗位</view>
              <view slot="value">{{ form.POST_NAME }}</view>
            </u-cell>
            <u-cell>
              <view slot="title" class="title">排查周期</view>
              <view slot="value">{{ form.PERIODNAME }}</view>
            </u-cell>
            <u-cell>
              <view slot="title" class="title">清单类型</view>
              <view slot="value">{{ form.TYPENAME }}</view>
            </u-cell>
          </u-cell-group>
        </view>
      </view>
      <view class="mt-10">
        <u-button
            type="primary"
            shape="circle"
            text="清单位置"
            @click="
            $u.route({
              url: '/pages/branch-self-report/index/map',
              params: { CHECKRECORD_ID },
            })
          "
        />
      </view>
    </view>
  </view>
</template>

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

export default {
  data() {
    return {
      CHECKRECORD_ID: '',
      form: {},
      mapUrl: '',
      scale: 13,
      latitude: 39.935866846326036,
      longitude: 119.64918897343684,
      covers: [],
      varList: [],
      hdList: [],
      otherHiddenList: [],
    }
  },
  onLoad(event) {
    this.CHECKRECORD_ID = event.CHECKRECORD_ID;
    this.getData()
  },
  methods: {
    async getData() {
      let resData = await getInspectionReportListManageRecordsDetails({
        CHECKRECORD_ID: this.CHECKRECORD_ID,
      });
      this.form = resData.pd;
      this.varList = resData.varList;
      this.hdList = resData.hdList;
      this.otherHiddenList = resData.otherHiddenList;
      for (let i = 0; i < resData.hdList.length; i++) {
        console.log(resData.hdList)
        this.covers.push({
          latitude: resData.hdList[i].LATITUDE,
          longitude: resData.hdList[i].LONGITUDE,
          iconPath: '../../../static/map/h.png',
        });
      }
      this.mapUrl = ("/hybrid/html/mapShow.html?covers=" + JSON.stringify(this.covers) + "&title=检查记录详情");
    },
    HiddenDetail(HIDDEN_ID) {
      uni.$u.route({
        url: '/pages/general-hidden-management/general-hidden/detail',
        params: {
          HIDDEN_ID,
        }
      })
    },
  }
}
</script>

<style scoped>
</style>
