<template>
  <view class="page-raw-ingoods">
    <view class="header">
      <view class="left">
        <u-icon class="icon" name="arrow-left" @click="goback()" />
      </view>
      <view class="title">质量管理</view>
      <view class="right"></view>
    </view>
    <view class="container">
      <view class="container1">
        <view class="title">
          <div class="">任务管理</div>
        </view>
        <view class="content clearfix">
          <div class="menu1 fleft" :class="[index % 2 == 0 ? 'menu1active' : 'active1']" @click="link(item)" v-for="(item, index) in newmenuList3" :key="index">
            <div class="item1">{{ item.checkName || item.attr1 }}</div>
            <div class="item2">{{ item.taskNum }}</div>
          </div>
        </view>
      </view>
    </view>
    <view class="container">
      <view class="toptitle">
        <view class="shuxian"></view>
        <view class="title"> 基础操作 </view>
      </view>
      <view class="tubiao">
        <u-icon
          v-for="item in newmenuList"
          :key="item.path"
          @click="
            uni.navigateTo({
              url: item.path,
            })
          "
          :label="item.menuName"
          label-pos="bottom"
          size="80"
          name="../../static/icons/icon-01.png"
        ></u-icon>
      </view>
    </view>
    <view class="container">
      <view class="toptitle">
        <view class="shuxian"></view>
        <view class="title"> 基础资料 </view>
      </view>
      <view class="tubiao">
        <u-icon
          v-for="item in newmenuList2"
          :key="item.path"
          @click="
            uni.navigateTo({
              url: item.path,
            })
          "
          :label="item.menuName"
          label-pos="bottom"
          size="80"
          name="../../static/icons/icon-01.png"
        ></u-icon>
      </view>
    </view>
  </view>
</template>

<script lang="ts">
import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import { session } from '@/store/modules/session';
import model from './model';
@Component
export default class RawAppointment extends BasePage {
  model = model;
  childData: any;
  menuList = session.getMenus;
  newmenuList: any = [];
  newmenuList2: any = [];
  newmenuList3: any = [];
  onReady() {
    this.newmenuList = this.menuList.filter((item) => item.perms == 'qualityCZ');
    this.newmenuList2 = this.menuList.filter((item) => item.perms == 'qualityJC');
    console.log('1234', this.menuList);
  }
  async onShow() {
    await this.model.getTopTaskInfo();
    this.newmenuList3 = this.model.orderNoItemList;
  }
  // async onLoad() {
  //   await this.model.getTopTaskInfo();
  //   this.newmenuList3 = this.model.orderNoItemList;
  // }
  link(item) {
    if (item.attr1 == '检验任务') {
      uni.navigateTo({
        url: `/pages/quality/Materialinspection/index?listitem=` + encodeURIComponent(JSON.stringify(item)),
      });
    } else {
      uni.navigateTo({
        url: `/pages/quality/Belowstandard/index?listitem=` + encodeURIComponent(JSON.stringify(item)),
      });
    }
  }
  goback() {
    uni.navigateTo({
      url: `/pages/shouye/index`,
    });
  }
}
</script>

<style lang="scss" scoped>
.page-raw-ingoods {
  background-color: #f4f7fc;
  padding-top: 150rpx;
  min-height: 100%;

  .header {
    position: fixed;
    top: 0;
    // padding-top: 18px;
    left: 0;
    right: 0;
    z-index: 99;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    background-color: #d9001b;
    /* height: 46px; */
    line-height: 46px;
    color: #fff;
    font-size: 34rpx;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 1px 2px #e87675;
    padding: 60rpx 0rpx 0rpx;
    .title {
      flex: 3;
    }
    .left,
    .right {
      flex: 1;
    }
    .icon {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 88rpx;
      height: 88rpx;
    }
  }

  .container {
    background-color: #ffffff;
    padding: 20rpx;
    border: 2rpx solid #9093992e;
    margin-top: 12rpx;
    border-radius: 4rpx;
    // padding: 30rpx 15rpx 0;
    .toptitle {
      display: flex;
      flex-direction: row;
      padding: 6rpx;
      .shuxian {
        border: 2rpx solid red;
        margin-right: 24rpx;
      }
      .title {
        // margin-bottom: 10rpx;
      }
    }
    .tubiao {
      margin-left: 40rpx;
    }

    .container1 {
      width: 560rpx;
      margin: auto;
      box-shadow: 0rpx 0rpx 12rpx 0rpx #a6a3a3;
      border-radius: 6rpx;
      padding: 20rpx;
      .title {
        font-weight: 600;
      }
      .content {
        margin-top: 20rpx;
        .menu1 {
          width: 49%;
          text-align: center;
          .item1 {
            margin-top: 20rpx;
          }
          .item2 {
            margin-top: 20rpx;
            margin-bottom: 20rpx;
            color: #94d1f4;
          }
        }
        .menu1active {
          border-right: 2rpx solid #d8d6d6;
        }
      }
    }
  }
}
::v-deep .u-icon {
  padding: 17rpx;
}
::v-deep .u-icon__label {
  width: 124rpx;
  text-align: center;
}
.fleft {
  float: left;
}

.fright {
  float: right;
}

.clearfix::after {
  content: '';
  display: block;
  clear: both;
}
</style>
