<!-- 扫描rfid,选择缓存区，根据选择的缓存区查询库位，勾选是否取走托盘，提交托盘变更信息 -->
<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="goback()" />
      </view>
      <view class="title">维修审核</view>
      <view class="right"></view>
    </view>
    <div class="singlebox">
      <view class="single-left" style="background-color: #ffffff; margin-top: 10px">
        <view style="width: 25%">审核状态</view>
        <jPicker sureColor="#ff0000" @bindpicker="selectAuditStatus" showKey="label" valKey="value" :val="AuditStatusType.value" :options="AuditStatusList" />
      </view>
    </div>

    <!-- <u-tabs name="cate_name" count="cate_count" :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs> -->
    <view class="list" v-show="current == 0" v-for="(item, index) in listdata" :key="index" @click="linkdetails(item)">
      <div class="list-top">
        <div class="tag">{{ item.resultInspect == 2 ? '待审核' : item.resultInspect == 1 ? '审核通过' : '驳回' }}</div>
      </div>
      <div class="list-top">
        <div class="name">维修单号: {{ item.orderCode }}</div>
        <!-- <div class="tag">{{ item.orderStatus == 0 ? '待处理' : item.orderStatus == 1 ? '已完成' : item.orderStatus == 2 ? '已逾期' : '进行中' }}</div> -->
        <u-icon @click="linkdetails(item)" name="arrow-right" color="#2979ff" size="28"></u-icon>
      </div>
      <div class="item1">报修来源: {{ item.workCode }}</div>
      <div class="item1" style="color: red">设备编码:{{ item.equipmentCode }}</div>
      <div class="item1" style="color: red">设备名称:{{ item.equipmentName }}</div>
      <div class="item1" style="color: red">处理措施:{{ item.repairMeasures }}</div>
      <div class="item1" style="color: red">维修班组:{{ item.teamName }}</div>
      <div class="item1">维修人: {{ item.workPersonName }}</div>
    </view>

    <u-toast ref="uToast" />
    <!-- <u-calendar v-model="iscalendar" :mode="mode" @change="changetime"></u-calendar> -->
  </view>
</template>
<script lang="ts">
import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import model from './model';
import chooseOne from '@/components/choose-one/choose-one.vue';
import jPicker from '@/components/J-Picker/jPicker.vue';
import moment from 'moment';
// import { session } from '@/store/modules/session';
//import store from '@/store';
@Component({
  components: {
    chooseOne,
    jPicker,
  },
})
export default class RepairAudit extends BasePage {
  model = model;
  AuditStatusList: any = [
    { label: '待审核', value: '2' },
    { label: '审核通过', value: '1' },
    { label: '驳回', value: '0' },
  ];
  AuditStatusType: any = {};
  list: any = [
    {
      cate_name: '今日任务',
    },
    {
      cate_name: '保养记录',
    },
  ];
  current: any = 0;
  moren = '选择缓存区';
  shouciFocus = true;
  zaiciFocus = false;
  ischecked = false;
  switchListText = [
    {
      title: '是',
      value: 0,
    },
    {
      title: '否',
      value: 1,
    },
  ];
  listdata: any = [];
  detailsdata: any = [];
  orderNoItemList: any = {};
  productCodeList: any = {};
  productCodelocList: any = {};
  detailsdataceshi: any = [
    {
      itemq: '保养任务1',
      item2: '已保养',
      item3: '2023-08-01 - 2023-08-31',
      item4: '每月保养',
      item5: 'XXXXX',
      item6: '未发现异常',
    },
    {
      itemq: '保养任务1',
      item2: '已保养',
      item3: '2023-08-01 - 2023-08-31',
      item4: '每月保养',
      item5: 'XXXXX',
      item6: '未发现异常',
    },
  ];
  createTime: any = null;
  iscalendar = false;
  userinfo: any = null;
  Sparepartlist: any = [];
  // remove: any = {};
  async onReady() {
    this.createTime = moment().format('YYYY-MM-DD');
    //await this.model.getpalletLocation();
    //this.remove = this.model.WlList[0];
  }
  async onShow() {
    this.AuditStatusType = this.AuditStatusList[0];
    await this.model.getTodayTask(this.AuditStatusType.value);
    this.listdata = model.orderNoItemList;

    //模拟数据
    // this.listdata = [
    //   {
    //     orderNo: '123456789',
    //     orderStatus: 0,
    //     orderSource: '0000dfcdcs',
    //     equipmentCode: '123456789',
    //     equipmentName: '2023-08-01',
    //     orderBreakdownTime: 'jnnihnninin',
    //     orderDesc: 'xscxdcdc',
    //     orderRepairmanName: 'dwdxdwx',
    //   },
    //   {
    //     orderNo: '123456789',
    //     orderStatus: 0,
    //     orderSource: '0000dfcdcs',
    //     equipmentCode: '123456789',
    //     equipmentName: '2023-08-01',
    //     orderBreakdownTime: 'jnnihnninin',
    //     orderDesc: 'xscxdcdc',
    //     orderRepairmanName: 'dwdxdwx',
    //   },
    //   {
    //     orderNo: '123456789',
    //     orderStatus: 0,
    //     orderSource: '0000dfcdcs',
    //     equipmentCode: '123456789',
    //     equipmentName: '2023-08-01',
    //     orderBreakdownTime: 'jnnihnninin',
    //     orderDesc: 'xscxdcdc',
    //     orderRepairmanName: 'dwdxdwx',
    //   },
    // ];
  }
  async selectAuditStatus(e: any) {
    this.AuditStatusType = e.pickerName;
    await this.model.getTodayTask(this.AuditStatusType.value);
    this.listdata = model.orderNoItemList;
  }
  clear() {
    this.createTime = null;
  }
  onfocus() {
    this.iscalendar = true;
  }
  async onLoad() {
    // console.log(uni.getStorageSync('userinfo'));
  }
  // selectItem(e: any) {
  //   this.remove = e.pickerName;
  // }
  orderNo: any = '';
  isorderNo: any = null;
  location: any = '';
  locationStatus: any = 1;
  goback() {
    uni.navigateBack({
      delta: 1,
    });
  }
  linkdetails(item) {
    uni.navigateTo({
      url: `/pages/equipment/MaintenanceAudit/Audit?orderId=` + item.workId,
    });
    // this.model.rowdatanull();
    // this.orderNo = null;
    // // this.model.rowdata = []
    // // item.workStatus == 0 ? '待保养' : item.workStatus == 1 ? '保养完成' : item.workStatus == 2 ? '保养中' : '保养未完成';
    // if (item.orderStatus == 0) {
    //   uni.navigateTo({
    //     url: `/pages/equipment/RepairAudit/Audit`
    //     //?listitem=` + encodeURIComponent(JSON.stringify(item)) + '&equipmentCode=' + value,
    //   });
    // } else if (item.orderStatus == 2 || item.orderStatus == 3) {
    //   uni.navigateTo({
    //     url: `/pages/equipment/Upkeep/repairing?listitem=` + encodeURIComponent(JSON.stringify(item)) + '&equipmentCode=' + value,
    //   });
    // } else {
    //   this.ischecked = true;
    //   item.ischecked = true;
    //   uni.navigateTo({
    //     url: `/pages/equipment/Upkeep/repairingview?listitem=` + encodeURIComponent(JSON.stringify(item)) + '&equipmentCode=' + value,
    //   });
    // }
  }
}
</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%;
  .singlebox {
    margin-top: 10px;
    background-color: #fff;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px 0 rgba(128, 128, 128, 0.2);
  }
  .single-left {
    display: flex;
    .Scan {
      border-radius: 6px;
    }
  }
  .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;
    }
  }
  .quest {
    width: 367px;
    border-radius: 5px;
    border: rgba(121, 121, 121, 1) solid 1px;
    background-color: #ffffff;
    padding: 7px 8px 7px 12px;
    box-sizing: border-box;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: black;
  }
  .list {
    margin-top: 15px;
    width: 367px;
    border-radius: 5px;
    border: rgba(121, 121, 121, 1) solid 1px;
    background-color: #ffffff;
    padding: 7px 8px 7px 8px;
    box-sizing: border-box;
    .list-top {
      display: flex;
      justify-content: space-between;
      position: relative;
      height: 24px;
      align-items: center;
      margin-bottom: 10px;
      .name {
        font-weight: 600;
        font-size: 15px;
      }
      .tag {
        width: 71px;
        height: 24px;
        border-radius: 5px;
        text-align: center;
        line-height: 24px;
        // box-shadow: 0 1rpx 20rpx 0 #54B0D7;
        border: 2px solid #54b0d7;
        position: absolute;
        right: 18px;
        color: #54b0d7;
      }
      .tag1 {
        border: 2px solid #83c874;
        color: #83c874;
      }
    }
    .item1 {
      margin-bottom: 10px;
      white-space: 1px;
    }
  }
  ::v-deep .yjy-switch-container .yjy-switch-item {
    width: 100%;
  }
  ::v-deep .yjy-switch-container {
    width: 50%;
  }
}
</style>
