<template>
  <view class="content">
    <!-- 第一个信息框 -->
    <view class="base-info-box">
      <info-item
        isFirst="true"
        label="检测类型"
        :value="baseInfo.jclx || '--'"
      />
      <info-item label="检测时间" :value="baseInfo.jcsj" />
      <info-item
        label="粮食品种"
        :value="
          getDictLabelSync(DICT_TYPE.SYSTEM_LSPZ, baseInfo.lspzmc) || '--'
          // getPzName(baseInfo.lspzmc)
        "
      />
      <info-item
        label="粮食等级"
        :value="
          getDictLabelSync(DICT_TYPE.SYSTEM_LSDJ, baseInfo.lsdjbm) || '--'
        "
      />
      <info-item label="检测人员姓名" :value="baseInfo.jcrrxm" />
      <info-item
        isImage="true"
        label="质检码单照片"
        :value="baseInfo.fileIds"
      />
    </view>
  </view>
</template>

<script setup>
import { ref } from "vue";
import { getDictOptions, DICT_TYPE, getDictLabelSync } from "@/utils/dict.js";
import { onLoad } from "@dcloudio/uni-app";
import InfoItem from "@/pages/components/InfoItem.vue";
const props = defineProps(["baseInfo"]);
const getPzName = (value) => {
  const dictOptions = [
    { code: "1737", label: "大豆", value: "1411001" },
    { code: "1736", label: "稻谷", value: "1130000" },
    { code: "1735", label: "玉米", value: "1120000" },
    { code: "1734", label: "小麦", value: "1110000" },
  ];

  const item = dictOptions.find((item) => item.value === value);
  return item ? item.label : "--";
};
const baseInfo = ref({});
onLoad(async (options) => {
  if (options) {
    baseInfo.value = JSON.parse(decodeURIComponent(options.getData));
  }
});
</script>

<style lang="scss" scoped>
.content {
  padding: 20rpx;
}

.base-info-box {
  background: #ffffff;
  border-radius: 20rpx;
  margin-bottom: 40rpx;
  padding: 20rpx;
}
</style>
