<template>
  <view class="content p-10">
    <view class="card">
      <u-cell-group :border="false">
        <u-cell>
          <view slot="title" class="title">角色：</view>
          <view slot="value">{{ form.role_name }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">部门：</view>
          <view slot="value">{{ form.DEPTNAME }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">岗位：</view>
          <view slot="value">{{ form.postName }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">用户名：</view>
          <view slot="value">{{ form.username }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">姓名：</view>
          <view slot="value">{{ form.name }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">人员类型：</view>
          <view slot="value">{{ form.user_type }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">是否为隐患确认人：</view>
          <view slot="value">{{ form.IS_HAZARDCONFIRMER == '1' ? '是' : '否' }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">部门排序：</view>
          <view slot="value">{{ form.sort }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">邮箱：</view>
          <view slot="value">{{ form.email }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">排班1：</view>
          <view slot="value">{{ form.SHIFTDUTYONE_NAME }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">排班2：</view>
          <view slot="value">{{ form.SHIFTDUTYTWO_NAME }}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">备注：</view>
          <view slot="label" class="mt-10">{{ form.bz }}</view>
        </u-cell>
        <div v-if="form.IS_ONLINELEARNING == '1'">
          <u-cell>
            <view slot="title" class="title">身份证号：</view>
            <view slot="value" class="mt-10">{{ form.USER_ID_CARD }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">民族：</view>
            <view slot="value" class="mt-10">{{ form.NATION }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">性别：</view>
            <view slot="value" class="mt-10">{{ form.SEX }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">政治面貌：</view>
            <view slot="value" class="mt-10">{{ form.POLITICAL_OUTLOOK }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">出生年月：</view>
            <view slot="value" class="mt-10">{{ form.DATE_OF_BIRTH }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">文化程度：</view>
            <view slot="value" class="mt-10">{{ form.DEGREE_OF_EDUCATION }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">在职情况：</view>
            <view slot="value" class="mt-10">{{ form.INCUMBENCY }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">职务：</view>
            <view slot="value" class="mt-10">{{ form.DUTIES }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">职称：</view>
            <view slot="value" class="mt-10">{{ form.TITLE }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">工种：</view>
            <view slot="value" class="mt-10">{{ form.TYPE_OF_WORK }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">入职日期：</view>
            <view slot="value" class="mt-10">{{ form.ENTRY_DATE }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">参加工作日期：</view>
            <view slot="value" class="mt-10">{{ form.WORKING_DATE }}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">证书图片</view>
            <view slot="label" class="mt-10">
              <view style="display: flex;flex-wrap: wrap">
                <view v-for="(item,index) in userCerList" :key="index" class="ml-10 mt-10">
                  <u--image :showLoading="true" :src="userCerList" width="80px" height="80px"
                            @click="previewImage(userCerList, item)"></u--image>
                </view>
              </view>
            </view>
          </u-cell>
        </div>
      </u-cell-group>
    </view>
  </view>
</template>

<script>

import {getCorpInfoListById} from "../../../api";

export default {
  data() {
    return {
      form: {},
      userCerList: [],
      USER_ID: ''
    }
  },
  onLoad(event) {
    this.USER_ID = event.USER_ID
    this.getData()
  },
  methods: {
    async getData() {
      let resData = await getCorpInfoListById({USER_ID: this.USER_ID})
      this.form = resData.pd
      console.log(resData)
      for (let i = 0; i < resData.userCerList.length; i++) {
        this.userCerList.push(this.$store.state.filePath + resData.userCerList[i].FILEPATH)
      }
    },
    previewImage(current) {
      uni.previewImage({
        urls: [],
        current
      });
    },
  },
}
</script>

<style scoped>

</style>
