bug
jiangping
2023-11-07 64b432916af9c9218ab3f3eca614e26c542142ae
minipro_standard/components/SelectTraMultipleMaterial.vue
@@ -1,10 +1,10 @@
<template>
   <u-popup :show="show" :round="10" closeable @close="show=false">
      <view class="material-content bbox p30 rp">
         <view class="tc b f24 c2 mb20">选择物料</view>
         <!-- <v-Search ref="V" @searchInput="searchInput" @submit="submit" :isShow="false" placeholder="搜索物料名称/编码">
         </v-Search> -->
         <div class="content_total">共{{pages.total}}条数据</div>
<template>
   <u-popup :show="show" :round="10" closeable @close="show=false">
      <view class="material-content bbox p30 rp">
         <view class="tc b f24 c2 mb20">选择物料</view>
         <!-- <v-Search ref="V" @searchInput="searchInput" @submit="submit" :isShow="false" placeholder="搜索物料名称/编码">
         </v-Search> -->
         <div class="content_total">共{{pages.total}}条数据</div>
         <view class="scroll-content">
            <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="refreshing" @scrolltolower="loadMore"
               @refresherrefresh="onRefresh">
@@ -47,106 +47,106 @@
                     </div>
                  </view>
               </view>
            </scroll-view>
            <!-- <u-list @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower">
               <u-list-item v-for="(item1, index) in list" :key="index">
               </u-list-item>
            </u-list> -->
         </view>
         <view style="height: 98rpx;"></view>
         <!-- <view class="">
            <u-safe-bottom></u-safe-bottom>
         </view> -->
         <view class="fixedBottom bottom cY">
            <view class="fx1 bbox plr30">
               <u-checkbox-group style="display: block;" name="" @change="selectAll()">
                  <u-checkbox :checked="isAll" label="全选"></u-checkbox>
               </u-checkbox-group>
            </view>
            <view class="submit sbtn_green bbox tc" @click="submitAction">{{ `提交(${selectIndex.length})`}}</view>
         </view>
      </view>
   </u-popup>
</template>
<script>
   // import vSearch from '@/components/Search.vue'
   import {
      choiceStockPageByTransfer
   } from '@/util/api/ExWarehouse'
   export default {
      name: "selectTraMultipleMaterial",
      // components: {
      //    vSearch
      // },
      data() {
         return {
            show: false,
            splite: '&nbsp;|&nbsp;',
            </scroll-view>
            <!-- <u-list @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower">
               <u-list-item v-for="(item1, index) in list" :key="index">
               </u-list-item>
            </u-list> -->
         </view>
         <view style="height: 98rpx;"></view>
         <!-- <view class="">
            <u-safe-bottom></u-safe-bottom>
         </view> -->
         <view class="fixedBottom bottom cY">
            <view class="fx1 bbox plr30">
               <u-checkbox-group style="display: block;" name="" @change="selectAll()">
                  <u-checkbox :checked="isAll" label="全选"></u-checkbox>
               </u-checkbox-group>
            </view>
            <view class="submit sbtn_green bbox tc" @click="submitAction">{{ `提交(${selectIndex.length})`}}</view>
         </view>
      </view>
   </u-popup>
</template>
<script>
   // import vSearch from '@/components/Search.vue'
   import {
      choiceStockPageByTransfer
   } from '@/util/api/ExWarehouse'
   export default {
      name: "selectTraMultipleMaterial",
      // components: {
      //    vSearch
      // },
      data() {
         return {
            show: false,
            splite: '&nbsp;|&nbsp;',
            isAll: false,
            refreshing: false,
            pages: {
               capacity: 10,
               page: 1,
               total: 0
            refreshing: false,
            pages: {
               capacity: 10,
               page: 1,
               total: 0
            },
            transferId: '',
            warehouseId: '',
            warehouseId: '',
            list: [],
            selectIndex: []
         };
      },
      methods: {
         open(target) {
            selectIndex: []
         };
      },
      methods: {
         open(target) {
            this.show = true
            this.refreshing = false
            this.isAll = false
            this.transferId = target.transferId
            this.warehouseId = target.warehouseId
            this.isAll = false
            this.transferId = target.transferId
            this.warehouseId = target.warehouseId
            this.list = []
            this.selectIndex = []
            
            // console.log(this.selectIndex);
            this.pages = {
               capacity: 10,
               page: 1,
               total: 0
            }
            this.loadData()
         },
         loadData() {
            choiceStockPageByTransfer({
               ...this.pages,
               model: {
                  transferId: this.transferId,
                  warehouseId: this.warehouseId
               }
            // console.log(this.selectIndex);
            this.pages = {
               capacity: 10,
               page: 1,
               total: 0
            }
            this.loadData()
         },
         loadData() {
            choiceStockPageByTransfer({
               ...this.pages,
               model: {
                  transferId: this.transferId,
                  warehouseId: this.warehouseId
               }
            }).then(res => {
               let {data} = res
               if (data.page == 1) {
                  this.list = [];
               if (data.page == 1) {
                  this.list = [];
               }
               this.pages.page = data.page
               this.pages.total = data.total
               this.list.push(...data.records)
            }).catch((err) => {
               this.list.push(...data.records)
            }).catch((err) => {
            })
            .finally(() => {
               this.refreshing = false;
            })
         },
            })
         },
         loadMore() {
            this.pages.page += 1
            this.loadData()
         },
            this.pages.page += 1
            this.loadData()
         },
         onRefresh() {
            if (this.refreshing) return
            this.refreshing = true;
            this.pages.page = 1
            this.loadData()
         },
            this.pages.page = 1
            this.loadData()
         },
         selectMaterialAction(index) {
            let i = this.selectIndex.findIndex(item => item==index)
            if (i == -1 ) {
@@ -158,8 +158,8 @@
               this.isAll = true
            } else {
               this.isAll = false
            }
         },
            }
         },
         selectAll() {
            this.selectIndex = []
            this.selectIndex = [...new Array(this.list.length).keys()]
@@ -171,89 +171,89 @@
               selectValue.push(this.list[item])
            })
            this.$emit('selectes', { materials: selectValue })
         }
      }
   }
   /*
    */
</script>
<style lang="scss" scoped>
   .material-content {
      display: flex;
      flex-direction: column;
      height: 1200rpx;
      box-sizing: border-box;
      .scroll-content {
         height: calc(1100rpx - env(safe-area-inset-bottom));
         overflow: scroll;
      }
   }
   .content_total {
      margin-top: 20rpx;
      margin-bottom: 20rpx;
      // padding: 24rpx 30rpx;
      // background: #F7F7F7;
      font-size: 24rpx;
      font-weight: 400;
      color: #666666;
   }
   .page_content_title_top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      span {
         &:nth-child(1) {
            font-size: 30rpx;
            font-weight: 500;
            color: #222222;
         }
         &:nth-child(2) {
            flex-shrink: 0;
            font-size: 24rpx;
            font-weight: 400;
            color: #333333;
            // span {
            //    font-size: 24rpx;
            //    color: $nav-color;
            // }
         }
      }
   }
   .page_content_title_bottom {
      margin-top: 24rpx;
      span {
         font-size: 24rpx;
         font-weight: 400;
         color: #666666;
      }
   }
   .page_content_title {
      display: flex;
      flex-direction: column;
      margin-bottom: 10rpx;
   }
   .bottom {
      height: 98rpx;
      // bottom: calc(env(safe-area-inset-bottom) + 20rpx);
      .submit {
         width: 272rpx;
         height: 98rpx;
         line-height: 98rpx;
      }
   }
         }
      }
   }
   /*
    */
</script>
<style lang="scss" scoped>
   .material-content {
      display: flex;
      flex-direction: column;
      height: 1200rpx;
      box-sizing: border-box;
      .scroll-content {
         height: calc(1100rpx - env(safe-area-inset-bottom));
         overflow: scroll;
      }
   }
   .content_total {
      margin-top: 20rpx;
      margin-bottom: 20rpx;
      // padding: 24rpx 30rpx;
      // background: #F7F7F7;
      font-size: 24rpx;
      font-weight: 400;
      color: #666666;
   }
   .page_content_title_top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      span {
         &:nth-child(1) {
            font-size: 30rpx;
            font-weight: 500;
            color: #222222;
         }
         &:nth-child(2) {
            flex-shrink: 0;
            font-size: 24rpx;
            font-weight: 400;
            color: #333333;
            // span {
            //    font-size: 24rpx;
            //    color: $nav-color;
            // }
         }
      }
   }
   .page_content_title_bottom {
      margin-top: 24rpx;
      span {
         font-size: 24rpx;
         font-weight: 400;
         color: #666666;
      }
   }
   .page_content_title {
      display: flex;
      flex-direction: column;
      margin-bottom: 10rpx;
   }
   .bottom {
      height: 98rpx;
      .submit {
         width: 272rpx;
         height: 98rpx;
         line-height: 98rpx;
      }
   }
</style>