chenhaozhe
2026-01-15 72ea36da98e2e5803386257e72242dbc29f6daa6
pages/index/tab1.vue
@@ -1,206 +1,143 @@
<template>
   <view class="content">
      <view class="header">
         <view class="switch-button">
            <uni-icons type="loop" @click="switchIconsModeHandler"></uni-icons>
         </view>
      </view>
      <view class="mains">
         <view class="box" v-for="(item,index) in itemData" :key="index" @tap="toUrl(item)">
         <view v-if="!canEdit" :hidden="item.hidden||!item.id" class="box" v-for="(item,index) in itemData" :key="index"
            @tap="toUrl(item)">
            <image :src="item.img" mode=""></image>
            <view class="texts">
               <view class="font1">{{item.text}}</view>
               <view class="font2">{{item.tip}}</view>
               {{item.text}}
            </view>
            <uni-icons type="forward" color="#888" style="position: absolute;right: 70rpx;" size="18"></uni-icons>
         </view>
         <view :enable-hidden="item.hidden" :hidden="!item.id" v-if="canEdit" class="box edit" v-for="(item,index) in itemData"
            :key="index" @tap="switchHidden(index)">
            <uni-icons class="edit-mark" color="red" type="closeempty"></uni-icons>
            <image :src="item.img" mode=""></image>
            <view class="texts">
               {{item.text}}
            </view>
         </view>
      </view>
   </view>
</template>
<script>
   import { CommonUtils } from '../../utils/common'
   import { setMenuList, getMenuList } from '../../utils/menuListApp'
   export default {
      data() {
         return {
            updateCount: 0,
            menuListName: 'tab1',
            canEdit: false,
            serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
            itemData: [{
               img: '../../static/icon/icon_a9.png',
               text: '工序进站接收单新增',
               tip: '立即新增',
               url: '/pages/gongxuIn/form',
               id: 1,
            }, {
               img: '../../static/icon/icon_a9.png',
               text: '工序进站接收单列表',
               tip: '查看列表',
               url: '/pages/gongxuIn/table',
               id: 2,
            }, {
               img: '../../static/icon/icon_a10.png',
               text: '工序出站汇报单新增',
               tip: '立即新增',
               url: '/pages/gongxuOut/form',
               id: 3,
            }, {
               img: '../../static/icon/icon_a10.png',
               text: '工序出站汇报单列表',
               tip: '查看列表',
               url: '/pages/gongxuOut/table',
               id: 4,
            }, {
               img: '../../static/icon/icon_a11.png',
               text: '工序委外发出单新增',
               tip: '立即新增',
               url: '/pages/weiwaigxIn/form',
               id: 5,
            }, {
               img: '../../static/icon/icon_a11.png',
               text: '工序委外发出单列表',
               tip: '查看列表',
               url: '/pages/weiwaigxIn/table',
               id: 6,
            }, {
               img: '../../static/icon/icon_a12.png',
               text: '工序委外接收单新增',
               tip: '立即新增',
               url: '/pages/weiwaigxOut/form',
               id: 7,
            }, {
               img: '../../static/icon/icon_a12.png',
               text: '工序委外接收单列表',
               tip: '查看列表',
               url: '/pages/weiwaigxOut/table',
               id: 8,
            }, {
               img: '../../static/icon/icon_a1.png',
               text: '设备档案查询',
               tip: '查看详情',
               url: '/pages/shebeidangan/table',
               id: 9,
            }, {
               img: '../../static/icon/icon_a8.png',
               text: '设备履历查询',
               tip: '查看详情',
               url: '/pages/shebeilvli/table',
               id: 10,
            }, {
               img: '../../static/icon/icon_a14.png',
               text: '我的报工平台',
               tip: '点击进入',
               url: '/pages/baogong/table',
               id: 11,
            }, {
               img: '../../static/icon/icon_a13.png',
               text: '上模单',
               tip: '查看详情',
               url: '/pages/MJGL/shangmudan/table',
               id: 12,
            }, {
               img: '../../static/icon/icon_a13.png',
               text: '下模单',
               tip: '查看详情',
               url: '',
               id: 13,
            }, {
               img: '../../static/icon/icon_a32.png',
               text: '设备运行状态',
               tip: '查看详情',
               url: '/pages/shebeiyunxingzhuangtai/shebeiyunxingzhuangtai',
               id: 14,
            }, {
               img: '../../static/icon/icon_a6.png',
               text: '模具状态分析',
               tip: '查看详情',
               url: '/pages/mujvzhuangtai/mujvzhuangtai',
               id: 15,
            }]
            // itemData: [{
            //    //  img:'../../static/icon0.png',
            //    //  text:'报表中心',
            //    //  url:'/pages/shebeilvli/table',
            //    //  id:0
            //    // },{
            //    img: '../../static/icon/icon_a1.png',
            //    text: '设备档案',
            //    url: '/pages/shebeidangan/table',
            //    id: 1
            // }, {
            //    img: '../../static/icon/icon_a2.png',
            //    text: '设备保养计划单',
            //    url: '/pages/baoyangjihua/table',
            //    id: 2
            // }, {
            //    img: '../../static/icon/icon_a3.png',
            //    text: '设备保养记录单',
            //    url: '/pages/baoyangjilu/table',
            //    id: 3
            //    // },{
            //    //  img:'../../static/icon/icon_a4.png',
            //    //  text:'设备点检计划单',
            //    //  url:'',
            //    //  id:4
            //    // },{
            //    //  img:'../../static/icon/icon_a5.png',
            //    //  text:'设备点检记录单',
            //    //  url:'',
            //    //  id:5,
            // }, {
            //    img: '../../static/icon/icon_a6.png',
            //    text: '设备故障登记表',
            //    url: '/pages/guzhangdengji/table',
            //    id: 6
            // }, {
            //    img: '../../static/icon/icon_a7.png',
            //    text: '设备维修记录单',
            //    url: '/pages/shebeiweixiu/table',
            //    id: 7,
            // }, {
            //    img: '../../static/icon/icon_a8.png',
            //    text: '设备履历',
            //    url: '/pages/shebeilvli/table',
            //    id: 8,
            // }, {
            //    img: '../../static/icon/icon_a9.png',
            //    text: '工序进站接收单',
            //    url: '/pages/gongxuIn/table',
            //    id: 9,
            // }, {
            //    img: '../../static/icon/icon_a10.png',
            //    text: '工序出站汇报单',
            //    url: '/pages/gongxuOut/table',
            //    id: 10,
            // }, {
            //    img: '../../static/icon/icon_a11.png',
            //    text: '工序委外发出单',
            //    url: '/pages/weiwaigxIn/table',
            //    id: 11,
            // }, {
            //    img: '../../static/icon/icon_a12.png',
            //    text: '工序委外接收单',
            //    url: '/pages/weiwaigxOut/table',
            //    id: 12,
            // // }, {
            // //    img: '../../static/icon/icon_a13.png',
            // //    text: '设备管理',
            // //    url: '',
            // //    id: 13,
            // }, {
            //    img: '../../static/icon/icon_a14.png',
            //    text: '报工平台',
            //    url: '/pages/baogong/table',
            //    id: 14,
            // }, {
            //    img: '../../static/icon/icon_a15.png',
            //    text: '异常反馈单',
            //    url: '/pages/yichang/table',
            //    id: 15,
            // }, {
            //    img: '../../static/icon/icon_a16.png',
            //    text: '异常反馈处理单',
            //    url: '/pages/yichang/list',
            //    id: 16,
            // }]
                  img: '../../static/icon/icon9.png',
                  text: '工序进站接收单新增',
                  tip: '立即新增',
                  url: '/pages/gongxuIn/Cj_StationInBill',
                  id: 1,
                  hidden: false,
               },
               {
                  img: '../../static/icon/icon10.png',
                  text: '工序出站汇报单新增',
                  tip: '立即新增',
                  url: '/pages/gongxuOut/Cj_StationOutBill',
                  id: 2,
                  hidden: false,
               },
               {
                  img: '../../static/icon/icon11.png',
                  text: '工序委外发出单新增',
                  tip: '立即新增',
                  url: '/pages/weiwaigxIn/Cj_StationEntrustInBill',
                  id: 3,
                  hidden: false,
               },
               {
                  img: '../../static/icon/icon12.png',
                  text: '工序委外接收单新增',
                  tip: '立即新增',
                  url: '/pages/weiwaigxOut/Cj_StationEntrustOutBill',
                  id: 4,
                  hidden: false,
               },
               {
                  img: '../../static/icon/icon14.png',
                  text: '我的报工平台',
                  tip: '点击进入',
                  url: '/pages/baogong/IpadIndex',
                  id: 5,
                  hidden: false,
               },
               {
                  img: '../../static/icon/icon10.png',
                  text: '我的任务',
                  tip: '立即新增',
                  url: '/pages/gongxuOutSendWork/gongxuOutSendWorkBill',
                  id: 6,
                  hidden: false,
               },
               {
                  img: '../../static/icon/icon12.png',
                  text: '员工签到记录单',
                  tip: '立即新增',
                  url: '/pages/EmployeeRecords/EmployeeRecordsBill',
                  id: 7,
                  hidden: false,
               },
               {
                  img: '../../static/icon/icon12.png',
                  text: '员工签到记录单列表',
                  tip: '点击进入',
                  url: '/pages/EmployeeRecords/EmployeeRecordsBillList',
                  id: 8,
                  hidden: false,
               }
            ]
         }
      },
      onLoad() {
         this.getHiddenItem()
      },
      methods: {
         async getHiddenItem() {
            let data = await getMenuList({
               menuName: this.menuListName
            })
            Array.from(data).forEach(e => {
               this.itemData[e["HIndex"]].hidden = !CommonUtils.stringToBoolean(e["HShowMode"])
               this.itemData[e["HIndex"]].id = e["HEntryID"];//id为0强制隐藏
            })
         },
         switchHidden(index) {
            this.updateCount ++;
            this.itemData[index].hidden = !this.itemData[index].hidden
         },
         switchIconsModeHandler() {
            this.canEdit = !this.canEdit
            if(this.canEdit == false && this.updateCount > 0) {
               this.$nextTick(() => {
                  // uni.setStorageSync("HIndexItemData", this.itemData)
                  setMenuList({
                     menuName: this.menuListName,
                     payload: this.itemData
                  })
                  this.updateCount = 0
               })
            }
            this.$forceUpdate()
         },
         toUrl(item) {
            if (item.url) {
               uni.navigateTo({
@@ -208,8 +145,8 @@
               })
            } else {
               uni.showToast({
                  title:'功能开发中。。。',
                  icon:'none'
                  title: '功能开发中。。。',
                  icon: 'none'
               })
            }
         }
@@ -218,46 +155,104 @@
</script>
<style lang="scss" scoped>
   .header {
      width: 100%;
      height: 2em;
      position: relative;
      .switch-button {
         position: absolute;
         right: 10rpx;
         bottom: 0;
      }
   }
   page {
      width: 100vw;
      min-height: 100vh;
      background-color: #f5f5f5;
      background-color: #fff;
   }
   .mains {
      width: 720rpx;
      margin: 0 auto;
      padding-bottom: 120rpx;
      display: flex;
      flex-wrap: wrap;
      padding-bottom: 80rpx;
      .box {
         width: 680rpx;
         margin: 0 auto;
         margin-top: 20rpx;
         display: flex;
         align-items: center;
         background-color: #fff;
         border-radius: 20rpx;
         box-shadow: 2upx 2upx 20upx 0 #ddd;
         width: 25%;
         margin-top: 2.5vh;
         text-align: center;
         image {
            width: 78rpx;
            height: 78rpx;
            padding: 10rpx;
            margin: 14rpx 30rpx;
            width: 18vw;
            height: 18vw;
         }
         .texts {
            font-size: 30rpx;
            width: 120rpx;
            margin: 0 auto;
            font-size: 29rpx;
            font-weight: normal;
            color: #333333;
            .font1 {}
            .font2 {
               font-size: 25rpx;
               color: #999;
            }
            margin-top: .2vh;
         }
      }
      .edit {
         position: relative;
      }
      .edit-mark {
         position: absolute;
         top: 0;
         right: 0;
      }
      view[enable-hidden] {
         opacity: .4 !important;
      }
      view[hidden] {
         display: none;
      }
   }
   // .mains {
   //    width: 720rpx;
   //    margin: 0 auto;
   //    padding-bottom: 120rpx;
   //    .box {
   //       width: 680rpx;
   //       margin: 0 auto;
   //       margin-top: 20rpx;
   //       display: flex;
   //       align-items: center;
   //       background-color: #fff;
   //       border-radius: 20rpx;
   //       box-shadow: 2upx 2upx 20upx 0 #ddd;
   //       image {
   //          width: 78rpx;
   //          height: 78rpx;
   //          padding: 10rpx;
   //          margin: 14rpx 30rpx;
   //       }
   //       .texts {
   //          font-size: 30rpx;
   //          font-weight: normal;
   //          color: #333333;
   //          .font1 {}
   //          .font2 {
   //             font-size: 25rpx;
   //             color: #999;
   //          }
   //       }
   //    }
   // }
</style>