YOS-DRVOGPU6U78\Administrator
2023-07-19 3acc5e4a99c7c69d25d7782e3c71152c5d0e0845
pages/index/index.vue
@@ -1,93 +1,73 @@
<template>
   <u-grid :col="3" @click="gotoPage" border>
      <u-grid-item v-for="item in grid" :index="item[0]">
         <u-icon name="photo" :size="46"></u-icon>
         <view class="grid-text">{{item[0]}}</view>
      </u-grid-item>
   </u-grid>
   <view>
      <u-grid :col="3" @click="gotoPage" border>
         <u-grid-item v-for="item in grid" :index="item[0]">
            <u-icon name="play-right-fill" :size="46" color="#FF8000"></u-icon>
            <view class="grid-text">{{item.name}}</view>
         </u-grid-item>
      </u-grid>
      <u-toast ref="uToast" />
   </view>
</template>
<script>
   import {
      queryPurview
   } from '../../api'
   import grid from '../../uni_modules/uview-ui/libs/config/props/grid'
   export default {
      data() {
         return {
            grid: [
               [
                  "巡检首检", "touliao"
               ],
               [
                  "采购入库", "touliao"
               ],
               [
                  "生产退料", "touliao"
               ],
               [
                  "其它入库", "touliao"
               ],
               [
                  "生产入库", "touliao"
               ],
               [
                  "采购退货", "touliao"
               ],
               [
                  "其它出库", "touliao"
               ],
               [
                  "调拔出库", "touliao"
               ],
               [
                  "调拔入库", "touliao"
               ],
               [
                  "生产报工", "touliao"
               ],
               [
                  "打印设置", "touliao"
               ],
               [
                  "生产备料", "touliao"
               ]
            ],
            title: 'Hello'
            grid: [],
            filter: [{
               name: '巡检检验',
               src: '/pages/inspection/inspectionList',
               icon:''
            }]
         }
      },
      onLoad() {
         queryPurview().then(res => {
            if (!res.result) {
               this.$refs.uToast.show({
                  message: res.msg,
                  type: 'error'
               })
               return
            }
            // 显示需要被代理的
            for (let item of this.filter) {
               if (res.data.find(t => t[0] == item.name)) {
                  this.grid.push(item)
               }
            }
         })
      },
      methods: {
         gotoPage(e) {
            console.log(this.grid[e])
            // console.log(this.grid[e])
            // let name = this.grid[e][0]
            // // 判断该页面是否应该被代理
            // let item = this.filter.find(t => {
            //    if (t.name == name) {
            //       return t;
            //    }
            // })
            // if (typeof(item) == 'undefined') {
            //    uni.navigateTo({
            //       url: '/pages/main/main?name=' + name
            //    })
            //    return
            // }
            uni.navigateTo({
               url: this.grid[e].src
            })
         }
      }
   }
</script>
<style>
   .content {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
   }
   .logo {
      height: 200rpx;
      width: 200rpx;
      margin-top: 200rpx;
      margin-left: auto;
      margin-right: auto;
      margin-bottom: 50rpx;
   }
   .text-area {
      display: flex;
      justify-content: center;
   }
   .title {
      font-size: 36rpx;
      color: #8f8f94;
   }
</style>