<template>
  <view class="page-product-receipt">
    <view class="header" :style="{ backgroundColor: `rgba(250, 53, 52, ${scrollTop / 100})` }">
      <view class="left">
        <u-icon class="icon" name="arrow-left" @click="uni.navigateBack({})" />
      </view>
      <view class="title">检验单位</view>
      <view class="right"></view>
    </view>
    <!-- <view class="single-left">
      <u-input @blur="onblur()" @focus="onfocus" @click="onclick"  style="width: 100%;  background-color: #ffffff; margin: auto;" v-model="orderNo" placeholder="请选择检验项目" />
    </view> -->
    <view style="margin: 20px">
      <wyb-table ref="table" :headers="headers" :contents="list" width="auto" first-col-bg-color="#ffffff" checker-color="#000000" @onCheck="changeContent" show-left-and-right-border />
    </view>
    <u-select v-model="show" mode="mutil-column-auto" :list="list" @confirm="confirm"></u-select>

    <!-- <view class="bottom-bar">
      <u-row class="button-bar">
        <u-col :span="6">
          <u-button @click="onSubmit" type="primary">确定</u-button>
        </u-col>
        <u-col :span="6">
          <u-button type="error" @click="uni.navigateBack({})">返回</u-button>
        </u-col>
      </u-row>
    </view> -->
    <u-toast ref="uToast" />
  </view>
</template>
<script lang="ts">
import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import jPicker from '@/components/J-Picker/jPicker.vue';
import model from './model';
//import { session } from '@/store/modules/session';
// import wybTable from '@/components/wyb-table/wyb-table.vue';
@Component({
  components: {
    jPicker,
  },
})
export default class ProductionQtyInsplist extends BasePage {
  model = model;
  rowdata: any = {};
  formdata: any = {};
  show: any = false;
  headers = [
    // {
    //   label: '序号',
    //   key: 'index',
    //   width: 100,
    // },
    {
      label: '单位编号',
      key: 'ruleName',
      width: 300,
    },
    {
      label: '名称',
      key: 'standardValue',
      // width: ,
    },
    {
      label: '单位',
      key: 'unit',
    },
  ];
  tableData: any = [];
  orderNo: any = '';
  shouciFocus = true;
  // 详细
  detailsinfo: any = {};
  detailsinfolist: any = {};
  detailsinfocontent: any = {};
  // 模态框
  isshow = false;
  inputmodal = false;
  isvalue = false;
  ischecked = false;
  radiomodal = false;
  list: any = [
    {
      value: 1,
      label: '中国',
      children: [
        {
          value: 2,
          label: '广东',
          children: [
            {
              value: 3,
              label: '深圳',
            },
            {
              value: 4,
              label: '广州',
            },
          ],
        },
        {
          value: 5,
          label: '广西',
          children: [
            {
              value: 6,
              label: '南宁',
            },
            {
              value: 7,
              label: '桂林',
            },
          ],
        },
      ],
    },
    {
      value: 8,
      label: '美国',
      children: [
        {
          value: 9,
          label: '纽约',
          children: [
            {
              value: 10,
              label: '皇后街区',
            },
          ],
        },
      ],
    },
  ];
  // remove: any = {};
  // async onReady() {
  //   await this.model.queryLocation();
  //   this.remove = this.model.WlList[0];
  // }
  // selectItem(e: any) {
  //   this.remove = e.pickerName;
  // }
  onShow() {
    // this.query();
  }
  onblur() {
    console.log('333');
    this.show = true;
  }
  onfocus() {
    console.log('222');
    this.show = false;
  }
  onclick() {
    console.log('111');
    this.show = true;
  }
  confirm(e) {
    console.log(e, this.page, this.rowdata);
  }
  cancel() {
    this.isshow = false;
  }
  goback() {
    uni.redirectTo({
      url: `/pages/equipment/Repair/repairing?listitem=` + encodeURIComponent(JSON.stringify(this.detailsinfo)),
    });
  }

  async onLoad() {
    console.log('111');
  }
  changeContent(e) {
    //console.log('eee', e.data);
    this.rowdata = e.data[0]?.lineData;
    // uni.$emit('changeContent',e);
  }
  onSubmit() {
    //debugger
    //console.log('xssss',this.rowdata);

    if (JSON.stringify(this.rowdata) === '{}' || this.rowdata === undefined) {
      this.customToast('请选择至少一个备件');
      return;
    }
    this.isshow = true;

    // this.uni.navigateTo({
    //   url: this.page.mes.ProductionQtyInspDetail,
    // });
  }
  histroyItem: any = {};
  barcode: any = '';
}
</script>
<style lang="scss" scoped>
.page-product-receipt {
  background: #f2f2f2 linear-gradient(0deg, #f2f2f2 0%, #f8262c 51%, #d9001b 100%) no-repeat;
  background-size: 100% 600rpx;
  padding: 118rpx 30rpx 162rpx;
  min-height: 100%;

  .header {
    position: fixed;
    top: 0rpx;
    left: 0;
    right: 0;
    z-index: 99;
    display: flex;
    height: 120rpx;
    line-height: 88rpx;
    color: #fff;
    font-size: 34rpx;
    font-weight: 500;
    text-align: center;
    padding: 45rpx 0rpx 0rpx;
    .title {
      flex: 3;
    }

    .left,
    .right {
      flex: 1;
    }

    .icon {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 88rpx;
      height: 88rpx;
    }
  }

  .form {
    background-color: #fff;
    padding: 40rpx;
    border-radius: 10rpx;
    box-shadow: 0 0 20rpx 0 rgba(128, 128, 128, 0.2);

    .u-form-item {
      padding: 30rpx 0;
      line-height: 35rpx;

      .Transfer {
        width: 280rpx;
        height: 64rpx;
        background: rgb(242, 242, 242);
        border-radius: 110rpx;
      }
    }

    .single {
      width: 100%;
      height: 100rpx;
      display: flex;

      .single-right {
        button {
          margin-top: 15rpx;
          width: 140rpx;
          height: 70rpx;
          background-color: #fa3534;
        }
      }
    }
  }

  .bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99;
    background: #ffffff;
    box-shadow: 0 1rpx 20rpx 0 rgba(128, 128, 128, 0.2);
    padding: 20rpx;
  }
  .single-left {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding-left: 20px;
    padding-right: 20px;
    // view {
    //   width:50px;
    //   height: 100%;
    //   line-height: 100rpx;
    //   font-size: 15px;
    //   // font-weight: bold;
    //   margin: auto;
    // }
  }

  .photoList {
    display: flex;
    padding-top: 12rpx;

    .chooseBtn {
      width: 202rpx;
      height: 202rpx;
      background: #fafafa;
      border-radius: 12rpx;
      border: 2rpx dashed #e2e2e2;
      display: flex;
      justify-content: center;
      align-items: center;

      .inner {
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
      }

      .desc {
        font-size: 28rpx;
        font-weight: 400;
        color: #24252a;
        line-height: 40rpx;
      }

      .img {
        width: 50rpx;
        height: 50rpx;
        margin-bottom: 6rpx;
      }
    }

    .photoBox {
      width: 202rpx;
      height: 202rpx;
      background: #fafafa;
      border-radius: 12rpx;
      position: relative;

      .closeBtn {
        position: absolute;
        top: -12rpx;
        right: -12rpx;
        z-index: 2;
        width: 36rpx;
        height: 36rpx;

        .img {
          width: 36rpx;
          height: 36rpx;
        }
      }

      .img {
        width: 202rpx;
        height: 202rpx;
        border-radius: 12rpx;
      }
    }

    .itemBox {
      flex: 0 0 202rpx;
      margin-right: 20rpx;
      padding: 9px 0px;
      &:last-child {
        margin-right: 0;
      }
    }

    // /deep/ .remarksBox textarea {
    //   font-size: 24rpx;
    // }
  }
}
// .wyb-table-scroll-view {
//   width: auto !important;
// }
.form {
  margin-top: 10px;
  margin-bottom: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
::v-deep .uni-input-input {
  padding: 10px 5px;
  box-sizing: border-box;
  outline: none;
  border: none;
}
::v-deep.uni-input-placeholder {
  left: 6px;
}
</style>
