chenhaozhe
2025-08-06 5e234e7e92f694cb40ad395f10544e5e2faa3318
pages/index/tab1.vue
@@ -1,293 +1,364 @@
<template>
    <view class="content">
        <view class="mains">
            <view 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> -->
                </view>
                <!-- <uni-icons type="forward" color="#888" style="position: absolute;right: 70rpx;" size="18"></uni-icons> -->
            </view>
        </view>
    </view>
   <view class="content">
      <view class="header">
         <view class="switch-button">
            <uni-icons type="loop" @click="switchIconsModeHandler"></uni-icons>
         </view>
      </view>
      <view class="mains">
         <view v-if="!canEdit" :hidden="item.hidden" class="box" v-for="(item,index) in itemData" :key="index"
            @tap="toUrl(item)">
            <image :src="item.img" mode=""></image>
            <view class="texts">
               {{item.text}}
            </view>
         </view>
         <view :enable-hidden="item.hidden" 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>
    export default {
        data() {
            return {
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                itemData: [{
                        img: '../../static/icon/icon9.png',
                        text: '工序进站接收单新增',
                        tip: '立即新增',
                        url: '/pages/gongxuIn/form',
                        id: 1,
                    }, {
                        img: '../../static/icon/icon9.png',
                        text: '工序进站接收单列表',
                        tip: '查看列表',
                        url: '/pages/gongxuIn/table',
                        id: 2,
                    }, {
                        img: '../../static/icon/icon10.png',
                        text: '工序出站汇报单新增',
                        tip: '立即新增',
                        url: '/pages/gongxuOut/form',
                        id: 3,
                    }, {
                        img: '../../static/icon/icon10.png',
                        text: '工序出站汇报单列表',
                        tip: '查看列表',
                        url: '/pages/gongxuOut/table',
                        id: 4,
                    }, {
                        img: '../../static/icon/icon11.png',
                        text: '工序委外发出单新增',
                        tip: '立即新增',
                        url: '/pages/weiwaigxIn/form',
                        id: 5,
                    }, {
                        img: '../../static/icon/icon11.png',
                        text: '工序委外发出单列表',
                        tip: '查看列表',
                        url: '/pages/weiwaigxIn/table',
                        id: 6,
                    }, {
                        img: '../../static/icon/icon12.png',
                        text: '工序委外接收单新增',
                        tip: '立即新增',
                        url: '/pages/weiwaigxOut/form',
                        id: 7,
                    }, {
                        img: '../../static/icon/icon12.png',
                        text: '工序委外接收单列表',
                        tip: '查看列表',
                        url: '/pages/weiwaigxOut/table',
                        id: 8,
                    }
                    // , {
                    //    img: '../../static/icon/icon1.png',
                    //    text: '设备档案查询',
                    //    tip: '查看详情',
                    //    url: '/pages/shebeidangan/table',
                    //    id: 9,
                    // }, {
                    //    img: '../../static/icon/icon8.png',
                    //    text: '设备履历查询',
                    //    tip: '查看详情',
                    //    url: '/pages/shebeilvli/table',
                    //    id: 10,
                    // }, {
                    //    img: '../../static/icon/icon14.png',
                    //    text: '我的报工平台',
                    //    tip: '点击进入',
                    //    url: '/pages/baogong/table',
                    //    id: 11,
                    // }, {
                    //    img: '../../static/icon/icon13.png',
                    //    text: '上模单',
                    //    tip: '查看详情',
                    //    url: '/pages/MJGL/shangmudan/table',
                    //    id: 12,
                    // }, {
                    //    img: '../../static/icon/icon13.png',
                    //    text: '下模单',
                    //    tip: '查看详情',
                    //    url: '',
                    //    id: 13,
                    // }, {
                    //    img: '../../static/icon/icon32.png',
                    //    text: '设备运行状态',
                    //    tip: '查看详情',
                    //    url: '/pages/shebeiyunxingzhuangtai/shebeiyunxingzhuangtai',
                    //    id: 14,
                    // }, {
                    //    img: '../../static/icon/icon6.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,
                // }]
            }
        },
        onLoad() {
        },
        methods: {
            toUrl(item) {
                if (item.url) {
                    uni.navigateTo({
                        url: item.url
                    })
                } else {
                    uni.showToast({
                        title: '功能开发中。。。',
                        icon: 'none'
                    })
                }
            }
        }
    }
   export default {
      data() {
         return {
            canEdit: false,
            serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
            itemData: [{
                  img: '../../static/icon/icon9.png',
                  text: '工序进站接收单新增',
                  tip: '立即新增',
                  url: '/pages/gongxuIn/form',
                  id: 1,
                  hidden: false,
               }, {
                  img: '../../static/icon/icon9.png',
                  text: '工序进站接收单列表',
                  tip: '查看列表',
                  url: '/pages/gongxuIn/table',
                  id: 2,
                  hidden: false,
               }, {
                  img: '../../static/icon/icon10.png',
                  text: '工序出站汇报单新增',
                  tip: '立即新增',
                  url: '/pages/gongxuOut/form',
                  id: 3,
                  hidden: false,
               }, {
                  img: '../../static/icon/icon10.png',
                  text: '工序出站汇报单列表',
                  tip: '查看列表',
                  url: '/pages/gongxuOut/table',
                  id: 4,
                  hidden: false,
               }, {
                  img: '../../static/icon/icon11.png',
                  text: '工序委外发出单新增',
                  tip: '立即新增',
                  url: '/pages/weiwaigxIn/form',
                  id: 5,
                  hidden: false,
               }, {
                  img: '../../static/icon/icon11.png',
                  text: '工序委外发出单列表',
                  tip: '查看列表',
                  url: '/pages/weiwaigxIn/table',
                  id: 6,
                  hidden: false,
               }, {
                  img: '../../static/icon/icon12.png',
                  text: '工序委外接收单新增',
                  tip: '立即新增',
                  url: '/pages/weiwaigxOut/form',
                  id: 7,
                  hidden: false,
               }, {
                  img: '../../static/icon/icon12.png',
                  text: '工序委外接收单列表',
                  tip: '查看列表',
                  url: '/pages/weiwaigxOut/table',
                  id: 8,
                  hidden: false,
               }
               // , {
               //    img: '../../static/icon/icon1.png',
               //    text: '设备档案查询',
               //    tip: '查看详情',
               //    url: '/pages/shebeidangan/table',
               //    id: 9,
               // }, {
               //    img: '../../static/icon/icon8.png',
               //    text: '设备履历查询',
               //    tip: '查看详情',
               //    url: '/pages/shebeilvli/table',
               //    id: 10,
               // }, {
               //    img: '../../static/icon/icon14.png',
               //    text: '我的报工平台',
               //    tip: '点击进入',
               //    url: '/pages/baogong/table',
               //    id: 11,
               // }, {
               //    img: '../../static/icon/icon13.png',
               //    text: '上模单',
               //    tip: '查看详情',
               //    url: '/pages/MJGL/shangmudan/table',
               //    id: 12,
               // }, {
               //    img: '../../static/icon/icon13.png',
               //    text: '下模单',
               //    tip: '查看详情',
               //    url: '',
               //    id: 13,
               // }, {
               //    img: '../../static/icon/icon32.png',
               //    text: '设备运行状态',
               //    tip: '查看详情',
               //    url: '/pages/shebeiyunxingzhuangtai/shebeiyunxingzhuangtai',
               //    id: 14,
               // }, {
               //    img: '../../static/icon/icon6.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,
            // }]
         }
      },
      onLoad() {
         this.getHiddenItem()
      },
      methods: {
         getHiddenItem() {
            let itemCache = uni.getStorageSync('HTab1ItemData') || ''
            console.log('itemCache: ', itemCache);
            if (itemCache !== '') {
               this.itemData = itemCache
            }
         },
         switchHidden(index) {
            console.log(this.itemData[index].hidden)
            this.itemData[index].hidden = !this.itemData[index].hidden
         },
         switchIconsModeHandler() {
            this.canEdit = !this.canEdit
            if (this.canEdit == false) {
               this.$nextTick(() => {
                  uni.setStorageSync("HTab1ItemData", this.itemData)
               })
            }
            this.$forceUpdate()
         },
         toUrl(item) {
            if (item.url) {
               uni.navigateTo({
                  url: item.url
               })
            } else {
               uni.showToast({
                  title: '功能开发中。。。',
                  icon: 'none'
               })
            }
         }
      }
   }
</script>
<style lang="scss" scoped>
    page {
        width: 100vw;
        min-height: 100vh;
        background-color: #fff;
    }
   .header {
      width: 100%;
      height: 2em;
      position: relative;
    .mains {
        width: 720rpx;
        margin: 0 auto;
        display: flex;
        flex-wrap: wrap;
        padding-bottom: 80rpx;
      .switch-button {
         position: absolute;
         right: 10rpx;
         bottom: 0;
      }
   }
        .box {
            width: 25%;
            margin-top: 2.5vh;
            text-align: center;
   page {
      width: 100vw;
      min-height: 100vh;
      background-color: #fff;
   }
            image {
                width: 18vw;
                height: 18vw;
            }
   .mains {
      width: 720rpx;
      margin: 0 auto;
      display: flex;
      flex-wrap: wrap;
      padding-bottom: 80rpx;
            .texts {
                width: 120rpx;
                margin: 0 auto;
                font-size: 29rpx;
                font-weight: normal;
                color: #333333;
                margin-top: .2vh;
            }
        }
    }
      .box {
         width: 25%;
         margin-top: 2.5vh;
         text-align: center;
    // .mains {
    //    width: 720rpx;
    //    margin: 0 auto;
    //    padding-bottom: 120rpx;
         image {
            width: 18vw;
            height: 18vw;
         }
    //    .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;
         .texts {
            width: 120rpx;
            margin: 0 auto;
            font-size: 29rpx;
            font-weight: normal;
            color: #333333;
            margin-top: .2vh;
         }
      }
    //       image {
    //          width: 78rpx;
    //          height: 78rpx;
    //          padding: 10rpx;
    //          margin: 14rpx 30rpx;
    //       }
      .edit {
         position: relative;
      }
    //       .texts {
    //          font-size: 30rpx;
    //          font-weight: normal;
    //          color: #333333;
      .edit-mark {
         position: absolute;
         top: 0;
         right: 0;
      }
    //          .font1 {}
      view[enable-hidden] {
         opacity: .4 !important;
      }
    //          .font2 {
    //             font-size: 25rpx;
    //             color: #999;
    //          }
    //       }
    //    }
    // }
      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>