<template>
  <view>
    <u-popup v-model="isShow" mode="left" :border-radius="10" :closeable="true" @close="fnCancel" width="100%" height="100%">
      <u-row gutter="12">
		  <u-col span="12">
		    <CustomNavbar />
		  </u-col>
        <u-col span="12">
          <view :style="{ textAlign: 'center', height: '60px', lineHeight: '60px' }">
            <text :style="{ fontSize: '40rpx', fontWeight: 500, color: '#1D2129' }">报工详情</text>
          </view>
        </u-col>
		<u-col span="12">
        <u-form :model="dataItem" ref="dataItem" :errorType="['toast']" label-position="left" label-width="250" label-align="center">
          <u-form-item label="合格数量" prop="text" >
            <text>{{ dataItem.qualifiedNum }}</text>
          </u-form-item>
          <u-form-item label="次品数量" prop="text">
            <text>{{ dataItem.defectiveNum }}</text>
          </u-form-item>
		  <u-form-item label="二等品数量" prop="text">
		    <text>{{ dataItem.secondNum }}</text>
		  </u-form-item>
          <u-form-item label="剩余半成品数量" prop="text">
            <text>{{ dataItem.semiFinishedNum }}</text>
          </u-form-item>
          <u-form-item label="班组" prop="text">
            <text>{{ dataItem.reportGroup }}</text>
          </u-form-item>
          <u-form-item label="报工人员" prop="text">
            <text>{{dataItem.reportMember }}</text>
          </u-form-item>
        </u-form>
		</u-col>
      </u-row>
    </u-popup>
    <u-top-tips ref="uTips"></u-top-tips>
  </view>
</template>

<script>
  import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'
  import { mapGetters } from 'vuex'
  import { userList } from '@/api/yys/dayWork.js'
  import dayjs from 'dayjs'
  import CustomNavbar from "../../../work/components/CustomNavbar.vue";
  export default {
    components: {CustomNavbar},
    mixins: [],
    data() {
      return {
        isShow: false,
        dataItem: {},
        reportMemberList: [],
      }
    },
    watch: {},
    computed: {},
    onLoad(params) {},
    onUnload() {},
    methods: {
      init(dataItem) {
        this.fnReportMemberList()
        this.dataItem=dataItem
        switch (this.dataItem.groupType) {
          case '1':
            this.dataItem.qualifiedNum = this.dataItem.prodReportList[0]['qualifiedNum']
            this.dataItem.qualifiedNum = this.dataItem.prodReportList[0]['qualifiedNum']
            break
          case '2':
            this.dataItem.defectiveNum = this.dataItem.packageReportList[0]['defectiveNum']
            this.dataItem.qualifiedNum = this.dataItem.packageReportList[0]['qualifiedNum']
            break
          default:
            break
        }
        this.isShow = true
      },
      fnCancel() {
        this.dataItem = {}
        this.isShow = false
      },
      fnOk() {
        this.fnCancel()
      },
      fnReportMemberList() {
        userList()
          .then(res => {
            if (res.code == 200) {
              this.reportMemberList = res.data
            }
          })
          .catch(err => {
            console.log(err)
          })
      },
      fnReportMemberName(reportMember) {
        let _list = [...this.reportMemberList]
        let _one = _list.find(o1 => {
          return o1.id == reportMember
        })
        console.log(_one)
        if (_one) {
          return _one.realName
        } else {
          return ''
        }
      },
    },
  }
</script>

<style lang="scss" scoped>
  /deep/.u-th {
    width: 100%;
    height: 32px;
  }
  /deep/.u-td {
    width: 100%;
    height: 32px;
  }
</style>
