<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.PERSON_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">
              <u-row>
                <u-col span="3" v-for="(item,index) in userCerList" :key="index">
                  <u--image :showLoading="true" :src="userCerList" width="80px" height="80px"
                            @click="previewImage(userCerList, item)"></u--image>
                </u-col>
              </u-row>
            </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>
