wtt
2026-01-13 0c3742edc195ef40efd5abb7b31e1f462391d120
pages/baogong/IpadIndex.vue
@@ -1,31 +1,25 @@
<template>
   <view class="content">
<!--       <view class="form">
         <view class="form-item">
            <view class="title">设备编号:</view>
            <view class="right">
               <input v-model="hform.HNumber" placeholder="请输入设备编号" />
            </view>
         </view>
         <view class="form-item">
            <view class="title">设备名称:</view>
            <view class="right">
               <input v-model="hform.HName" placeholder="请输入设备名称" />
            </view>
         </view>
      </view> -->
      <!-- <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view> -->
      <view class="tabs">
         <view :class="tabs == 0 ? 'on':''" @tap="changeTab(0)">全部</view>
         <view :class="tabs == 1 ? 'on':''" @tap="changeTab(1)">运行</view>
         <view :class="tabs == 2 ? 'on':''" @tap="changeTab(2)">待机</view>
         <view :class="tabs == 3 ? 'on':''" @tap="changeTab(3)">停机</view>
      </view>
      <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
      <!-- 只在全部页签显示添加生产资源卡片 -->
      <view class="list" v-if="tabs == 0">
         <uni-card style="margin: 10px;" @tap="addResource">
            <view class="card-main add-resource">
               <view class="add-icon">+</view>
               <view class="add-text">添加生产资源</view>
            </view>
         </uni-card>
      </view>
      <view class="list" v-for="(item,index) in showList" :key="index">
         <uni-card style="margin: 10px;" @tap="toList(item)">
            <view class="card-main">
@@ -49,65 +43,42 @@
               </view>
               <view class="op">
                  <view class="op5" v-if="item.HStatus == '空闲'">
                     <uni-icons type="smallcircle-filled" size="14" color=""></uni-icons><text>{{item.HStatus}}</text>
                     <uni-icons type="smallcircle-filled" size="14"
                        color=""></uni-icons><text>{{item.HStatus}}</text>
                  </view>
                  <view class="op3" v-if="item.HStatus == '开机'">
                     <uni-icons type="smallcircle-filled" size="14" color=""></uni-icons><text>{{item.HStatus}}</text>
                     <uni-icons type="smallcircle-filled" size="14"
                        color=""></uni-icons><text>{{item.HStatus}}</text>
                  </view>
                  <view class="op4" v-if="item.HStatus == '停机'">
                     <uni-icons type="smallcircle-filled" size="14" color=""></uni-icons><text>{{item.HStatus}}</text>
                     <uni-icons type="smallcircle-filled" size="14"
                        color=""></uni-icons><text>{{item.HStatus}}</text>
                  </view>
                  <view class="op1" v-if="item.HStatus == '生产'">
                     <uni-icons type="smallcircle-filled" size="14" color=""></uni-icons><text>{{item.HStatus}}</text>
                     <uni-icons type="smallcircle-filled" size="14"
                        color=""></uni-icons><text>{{item.HStatus}}</text>
                  </view>
                  <view class="op2" v-if="item.HStatus == '维修进行中'">
                     <uni-icons type="smallcircle-filled" size="14" color=""></uni-icons><text>{{item.HStatus}}</text>
                     <uni-icons type="smallcircle-filled" size="14"
                        color=""></uni-icons><text>{{item.HStatus}}</text>
                  </view>
                  <view class="op2" v-if="item.HStatus == '维修结束'">
                     <uni-icons type="smallcircle-filled" size="14" color=""></uni-icons><text>{{item.HStatus}}</text>
                     <uni-icons type="smallcircle-filled" size="14"
                        color=""></uni-icons><text>{{item.HStatus}}</text>
                  </view>
                  <view class="op2" v-if="item.HStatus == '维修终止'">
                     <uni-icons type="smallcircle-filled" size="14" color=""></uni-icons><text>{{item.HStatus}}</text>
                     <uni-icons type="smallcircle-filled" size="14"
                        color=""></uni-icons><text>{{item.HStatus}}</text>
                  </view>
               </view>
            </view>
<!--             <view class="card-detail" v-if="showDetail == index">
               <view class="detail" v-if="moreData.HSourceBillNo">
                  <text>当前订单:</text>{{moreData.HSourceBillNo}}
               <!-- 删除按钮 -->
               <view class="delete-btn" @tap.stop="deleteResource(item.HSourceID, index)" v-if="item.HSourceID">
                  <uni-icons type="closeempty" size="20" color="#da0000"></uni-icons>
               </view>
               <view class="detail" v-if="moreData.HMaterName">
                  <text>物料名称:</text>{{moreData.HMaterName}}
               </view>
            </view> -->
<!--             <view class="more" v-if="showDetail == index && operations != index">
               <view class="part" style="border-right: 1px solid #eee;" @tap.stop="showMore(item,index)">
                  <uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>收起
               </view>
               <view class="part" @tap.stop="operations = operations==index?-1:index">
                  <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>操作
               </view>
            </view>
            <view class="more" v-if="showDetail != index && operations != index">
               <view class="part" style="border-right: 1px solid #eee;" @tap.stop="showMore(item,index)">
                  <uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>更多信息
               </view>
               <view class="part" @tap.stop="operations = operations==index?-1:index">
                  <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>操作
               </view>
            </view> -->
            <view class="op" v-if="operations == index">
               <button class="op1" size="mini" plain @tap.stop="check(item)">开工</button>
<!--                <button class="op1" size="mini" plain @tap.stop="check(item)">完工</button>
               <button class="op2" size="mini" plain @tap.stop="antiCheck(item)">停工</button> -->
               <button class="op3" size="mini" plain @tap.stop="edit(item)">汇报</button>
               <button class="op4" size="mini" plain @tap.stop="del(item)">异常申请</button>
               <button class="op5" size="mini" plain @tap.stop="operations = -1">取消操作</button>
            </view>
         </uni-card>
      </view>
      <view class="over" v-if="listData.length == 0">暂无数据</view>
      <view class="over" v-if="listData.length != 0 && listData.length != showList.length">加载中...</view>
      <view class="over" v-if="listData.length != 0 && listData.length == showList.length">已到底</view>
@@ -115,102 +86,99 @@
</template>
<script>
   import { getUserInfo } from "@/utils/auth.js";
   import {
      getUserInfo
   } from "@/utils/auth.js";
   export default {
       data() {
           return {
            userInfo:getUserInfo(),
            serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
            tabs:0,
            status:'全部',
            hform:{
               HNumber:'',
               HName:'',
            },
            sWhere:'',
            listData:[],
            moreData:[],
            showList:[],
            showDetail:-1,
            operations:-1,
            page:1,
           }
       },
      data() {
         return {
            userInfo: getUserInfo(),
            serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
            tabs: 0,
            status: '全部',
            sWhere: '',
            listData: [],
            showList: [],
            showDetail: -1,
            operations: -1,
            page: 1,
         }
      },
      onLoad() {
         this.getList()
         // console.log(this.userInfo,uni.getStorageSync('HUserName'))
         // 监听刷新事件
         uni.$on('refreshDeviceList', () => {
            this.getList();
         });
         this.getList();
      },
      onUnload() {
         // 移除事件监听
         uni.$off('refreshDeviceList');
      },
      onReachBottom: function() {
         this.page++
         setTimeout(() => {
            this.showList = this.showList.concat(this.getPage(this.page,this.listData))
            this.showList = this.showList.concat(this.getPage(this.page, this.listData))
         }, 100)
      },
      onPullDownRefresh: function() {
         this.clear()
         setTimeout(()=>{
         setTimeout(() => {
            uni.stopPullDownRefresh();
         }, 1000);
      },
       methods: {
         getPage(page,list){
      methods: {
         getPage(page, list) {
            let sindex = (parseInt(page) - 1) * 20
            let eindex = parseInt(page) * 20
            let newList = list.slice(sindex,eindex)
            let newList = list.slice(sindex, eindex)
            return newList
         },
         changeTab(e){
         changeTab(e) {
            this.tabs = e
            this.page = 1
            this.showList = []
            if(this.tabs == 0){
            if (this.tabs == 0) {
               this.status = '全部'
               this.getList()
               // this.showList = this.getPage(this.page,this.listData)
            }
            if(this.tabs == 1){
            if (this.tabs == 1) {
               this.status = '运行'
               this.getList()
               // this.showList = this.getPage(this.page,this.listData)
            }
            if(this.tabs == 2){
            if (this.tabs == 2) {
               this.status = '待机'
               this.getList()
               // this.showList = this.getPage(this.page,this.listData)
            }
            if(this.tabs == 3){
            if (this.tabs == 3) {
               this.status = '停机'
               this.getList()
               // this.showList = this.getPage(this.page,this.listData)
            }
         },
         getList(){
            // console.log(this.sWhere)
            uni.showLoading({
               title:'加载中...'
            })
         getList() {
            uni.request({
                url: this.serverUrl + '/ReportPlatForm/SearchGetLineBindBillListStatus',
               data:{
                  HStatus:this.status,
               url: this.serverUrl + '/ReportPlatForm/SearchGetLineBindBillListStatus',
               data: {
                  HStatus: this.status,
                  HUserName: uni.getStorageSync('HUserName')
               },
                success: (res) => {
                  console.log(1,res.data);
                  if(res.data.count == 1){
               success: (res) => {
                  console.log(1, res.data);
                  if (res.data.count == 1) {
                     this.listData = res.data.data.h_p_JIT_GetSourceInfoByUser
                     console.log(this.listData.length)
                     this.showList = this.getPage(this.page,this.listData)
                     setTimeout(()=>{
                          uni.hideLoading()
                     this.showList = this.getPage(this.page, this.listData)
                     setTimeout(() => {
                        uni.hideLoading()
                     }, 1000)
                  }else{
                  } else {
                     this.listData = []
                     uni.hideLoading()
                     uni.showToast({
                        title:res.data.Message,
                        icon:'none'
                        title: res.data.Message,
                        icon: 'none'
                     })
                  }
               },
@@ -218,285 +186,230 @@
                  console.log(res);
                  uni.hideLoading()
                  uni.showToast({
                     title:'接口请求失败',
                     icon:'none'
                  })
               },
            });
         },
         //选择单据日期
         BenginHCreateDateChange(e){
            console.log(e.detail.value)
            this.hform.BenginHCreateDate = e.detail.value
         },
         //选择单据日期
         EndHCreateDateChange(e){
            console.log(e.detail.value)
            this.hform.EndHCreateDate = e.detail.value
         },
         //搜索
         search(){
            this.sWhere = ''
            this.listData = []
            this.page = 1
            this.showList = []
            console.log(this.hform)
            if (this.hform.HNumber) {
                this.sWhere += " and 设备代码 like '%" + this.hform.HNumber + "%'";
            }
            if (this.hform.HName) {
                this.sWhere += " and 设备名称 like '%" + this.hform.HName + "%'";
            }
            this.getList()
         },
         //新增
         creat(){
            uni.navigateTo({
               url:'/pages/shebeidangan/Gy_EquipFileMainBill'
            })
         },
         //重置
         clear(){
            this.listData = []
            this.page = 1
            this.showList = []
            this.sWhere = ''
            this.showDetail = -1,
            this.operations = -1,
            this.hform = {
               HNumber:'',
               HName:'',
            }
            this.getList()
         },
         //更多
         showMore(item,index){
            this.showDetail = this.showDetail==index?-1:index
            console.log(item)
            uni.request({
                url: this.serverUrl + '/ReportPlatForm/SearchGetWorkBillList',
               data:{
                  HSourceID: item.HSourceID
               },
                success: (res) => {
                  console.log(2,res.data.data);
                  if(res.data.count == 1){
                     this.moreData = res.data.data.h_p_JIT_GetWorkBillListInfoBySource1 //时间点产量
                     console.log(2,this.moreData);
                     this.$forceUpdate()
                  }else{
                     uni.showToast({
                        title:res.data.Message,
                        icon:'none'
                     })
                  }
               },
               fail: (res) => {
                  console.log(res);
                  uni.hideLoading()
                  uni.showToast({
                     title:'接口请求失败',
                     icon:'none'
                     title: '接口请求失败',
                     icon: 'none'
                  })
               },
            });
         },
         //工单列表
         toList(item){
         toList(item) {
            uni.navigateTo({
               url:'./list?HSourceID=' + item.HSourceID + '&HSourceName=' + item.HSourceName,
               url: './DayPlanBillList?HSourceID=' + item.HSourceID + '&HSourceName=' + item.HSourceName,
               success: () => {
                  // 设置页面返回时需要刷新的标志
                  this.needRefresh = true;
               }
            })
         },
         //编辑
         edit(item){
            console.log(item)
         // 添加生产资源
         addResource() {
            uni.navigateTo({
               url:'/pages/shebeidangan/Gy_EquipFileMainBill?hmainid=' + item.hmainid
               url: './AddLineBind', // 你需要创建这个页面
               success: () => {
                  // 设置页面返回时需要刷新的标志
                  this.needRefresh = true;
               }
            })
         },
         //删除
         del(item){
            console.log(item)
         // 删除生产资源
         deleteResource(HSourceID, index) {
            uni.showModal({
                title: '提示',
                content: '确认要删除吗,删除后不能恢复',
                success: (res) => {
                    if (res.confirm) {
                        console.log('用户点击确定');
               title: '删除确认',
               content: '确认要删除吗,删除后不能恢复',
               success: (res) => {
                  if (res.confirm) {
                     uni.showLoading({
                        title: '删除中...'
                     })
                     uni.request({
                         url: this.serverUrl + '/Gy_EquipFileMain/Delete_EquipFile',
                        data:{
                           HItemID: item.hmainid,
                        url: this.serverUrl + '/ReportPlatForm/DeleteGetLineBindBillList',
                        method: 'GET',
                        data: {
                           HSourceID: HSourceID,
                           user: uni.getStorageSync('HUserName')
                        },
                         success: (res) => {
                             console.log(1,res);
                           if(res.data.count == 1){
                              this.clear()
                        success: (res) => {
                           uni.hideLoading()
                           if (res.data.count > 0) {
                              // 重置分页参数
                              this.page = 1
                              this.listData = []
                              this.showList = []
                              // 重新获取数据
                              this.getList()
                           } else {
                              uni.showToast({
                                 title: res.data.Message || '删除失败',
                                 icon: 'none'
                              })
                           }
                           uni.showToast({
                              title:res.data.Message,
                              icon:'none'
                           })
                        },
                        fail: (res) => {
                           console.log(res);
                        fail: () => {
                           uni.hideLoading()
                           uni.showToast({
                              title:'接口请求失败',
                              icon:'none'
                              title: '删除失败',
                              icon: 'none'
                           })
                        },
                     });
                    } else if (res.cancel) {
                        console.log('用户点击取消');
                    }
                }
            });
                        }
                     })
                  }
               }
            })
         },
         // //审核
         // check(item){
         //    console.log(item)
         //    if (item.HBillStatus > 0) {
         //        uni.showToast({
         //           title:'单据不为未审核状态!'
         //        })
         //    }
         // },
         // //反审核
         // antiCheck(item){
         // },
       }
      }
   }
</script>
<style lang="scss" scoped>
   .form{
   .form {
      width: 640rpx;
      margin: 20rpx auto;
   }
   .tabs{
   .tabs {
      width: 100%;
      display: flex;
      view{
      view {
         width: 25%;
         font-size: 30rpx;
         color: #555;
         text-align: center;
         padding: 16rpx 0;
      }
      .on{
      .on {
         color: #3a78ff;
         font-weight: bold;
         border-bottom: 3px solid #3a78ff;
      }
   }
    .form-item{
   .form-item {
      display: flex;
      align-items: center;
      font-size: 28rpx;
      padding: 6rpx 0;
      .title{
      .title {
         width: 180rpx;
         text{
         text {
            color: red;
            font-weight: bold;
         }
      }
      .right{
      .right {
         width: 450rpx;
         border-radius: 22rpx;
         border: 1px solid #acacac;
      }
      .righton{
      .righton {
         width: 450rpx;
         border-radius: 22rpx;
         border: 1px solid #e4e4e4;
         background-color: #e4e4e4;
      }
      input{
      input {
         width: 100%;
         padding: 8rpx 20rpx;
         font-size: 30rpx;
      }
   }
   .buttons{
   .buttons {
      width: 100%;
      display: flex;
      justify-content: center;
      margin-top: 20rpx;
      button{
      button {
         border-radius: 50rpx;
         width: 180rpx;
         height: 66rpx;
         line-height: 66rpx;
         font-size: 28rpx;
      }
      .btn-a{
      .btn-a {
         background-color: #acacac;
         color: #fff;
      }
      .btn-b{
      .btn-b {
         background-color: #41a863;
         color: #fff;
      }
      .btn-c{
      .btn-c {
         background-color: #3a78ff;
         color: #fff;
      }
   }
   .list{
   .list {
      width: 100%;
      .card-main{
      .card-main {
         display: flex;
         image{
         image {
            width: 160rpx;
            height: 160rpx;
            margin-right: 30rpx;
         }
         .right{
         .right {
            font-size: 26rpx;
            margin-bottom: 12rpx;
            color: #555;
            text{
            text {
               color: #999;
            }
         }
      }
      .card-detail{
      .card-detail {
         width: 100%;
         display: flex;
         flex-wrap: wrap;
         justify-content: space-between;
         line-height: 120%;
         .detail{
         .detail {
            // width: 50%;
            font-size: 26rpx;
            margin-bottom: 12rpx;
            color: #555;
            margin-right: 20rpx;
            text{
            text {
               color: #999;
               font-size: 26rpx;
            }
         }
      }
      .more{
      .more {
         color: #888;
         font-size: 24rpx;
         display: flex;
         border-top: 1px solid #eee;
         padding-top: 20rpx;
         .part{
         .part {
            width: 50%;
            text-align: center;
         }
      }
      .op{
      .op {
         display: flex;
         // justify-content: space-around;
         // margin-top: 20rpx;
@@ -508,57 +421,108 @@
         position: absolute;
         right: 30rpx;
         bottom: 30rpx;
         text{
         text {
            margin-right: 10rpx;
            font-weight: bold;
            font-size: 28rpx;
         }
         button{
         button {
            padding: 0;
            width: 150rpx;
            font-size: 25rpx;
         }
         .op1{
         .op1 {
            // border: 1px solid #41a863;
            color: #41a863;
            background-color: rgba( #41a863, .15);
            background-color: rgba(#41a863, .15);
            padding: 2rpx 10rpx;
            border-radius: 4rpx;
            box-shadow: 2rpx 2rpx 6rpx 0 #acacac;
         }
         .op2{
         .op2 {
            // border: 1px solid #d98d00;
            color: #d98d00;
            background-color: rgba( #d98d00, .15);
            background-color: rgba(#d98d00, .15);
            padding: 2rpx 10rpx;
            border-radius: 4rpx;
            box-shadow: 2rpx 2rpx 6rpx 0 #acacac;
         }
         .op3{
         .op3 {
            // border: 1px solid #3a78ff;
            color: #3a78ff;
            background-color: rgba( #3a78ff, .15);
            background-color: rgba(#3a78ff, .15);
            padding: 2rpx 10rpx;
            border-radius: 4rpx;
            box-shadow: 2rpx 2rpx 6rpx 0 #acacac;
         }
         .op4{
         .op4 {
            // border: 1px solid #da0000;
            color: #da0000;
            background-color: rgba( #da0000, .15);
            background-color: rgba(#da0000, .15);
            padding: 2rpx 10rpx;
            border-radius: 4rpx;
            box-shadow: 2rpx 2rpx 6rpx 0 #acacac;
         }
         .op5{
         .op5 {
            // border: 1px solid #888;
            color: #888;
            background-color: rgba( #888, .15);
            background-color: rgba(#888, .15);
            padding: 2rpx 10rpx;
            border-radius: 4rpx;
            box-shadow: 2rpx 2rpx 6rpx 0 #acacac;
         }
      }
   }
</style>
      // 删除按钮样式
      .delete-btn {
         position: absolute;
         top: 10rpx;
         right: 10rpx;
         width: 50rpx;
         height: 50rpx;
         background-color: rgba(255, 255, 255, 0.9);
         border-radius: 50%;
         display: flex;
         align-items: center;
         justify-content: center;
         box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
         z-index: 10;
      }
      // 添加资源卡片样式 - 大小缩小一半
      .add-resource {
         display: flex;
         flex-direction: column;
         align-items: center;
         justify-content: center;
         height: 120rpx;
         /* 从300rpx缩小到150rpx */
         border: 2rpx dashed #3a78ff;
         border-radius: 16rpx;
         background-color: #f8fafc;
         .add-icon {
            font-size: 50rpx;
            /* 从100rpx缩小到50rpx */
            color: #3a78ff;
            line-height: 1;
            margin-bottom: 10rpx;
            /* 从20rpx缩小到10rpx */
         }
         .add-text {
            font-size: 24rpx;
            /* 从32rpx缩小到24rpx */
            color: #3a78ff;
            text-align: center;
         }
      }
   }
</style>