| | |
| | | <view class="form" :style="{ |
| | | height: containerHeight + 'px', |
| | | overflow: 'auto' |
| | | }"> |
| | | <view class="list" v-for="(item,index) in HMaterList" :key="index"> |
| | | }"> |
| | | <!-- 物料列表 - 使用排序后的数据 --> |
| | | <view class="list" v-for="(item,index) in paginatedMaterList" :key="index"> |
| | | <uni-card :title="item.物料名称" :extra="item.物料代码" style="margin: 10px;" @tap="delMater(item)"> |
| | | <view class="card-detail"> |
| | | <view class="detail"> |
| | |
| | | <view class="detail" v-if="item.辅助属性"> |
| | | <text>辅助属性:</text>{{item.辅助属性}} |
| | | </view> |
| | | <!-- 兴达客户 功能 --> |
| | | <view class="detail" v-if="materMeta[0].HWHName && /兴达/.test(hform.HStockOrgName |
| | | )"> |
| | | <view class="detail" v-if="materMeta[0].HWHName && /兴达/.test(hform.HStockOrgName)"> |
| | | <text>仓库:</text>{{materMeta[0].HWHName}} |
| | | </view> |
| | | </view> |
| | | </uni-card> |
| | | </view> |
| | | <view class="over" v-if="HMaterList.length == 0">暂无数据</view> |
| | | <view style="padding: 10px; background: #f5f5f5; display: flex; justify-content: space-between; align-items: center;"> |
| | | <text>共 {{ sortedMaterList.length }} 条</text> |
| | | <view> |
| | | <button size="mini" @click="prevPage" :disabled="currentPage === 1" style="margin-right: 10px;">上一页</button> |
| | | <text>{{ currentPage }}/{{ totalPages }}</text> |
| | | <button size="mini" @click="nextPage" :disabled="currentPage === totalPages" style="margin-left: 10px;">下一页</button> |
| | | </view> |
| | | </view> |
| | | <view class="over" v-if="sortedMaterList.length == 0">暂无数据</view> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | | sortedMaterList: [], // 排序后的物料列表 |
| | | paginatedMaterList: [] ,// 当前页显示的物料 |
| | | tabs: 0, |
| | | hcpFocus: false, |
| | | barCodeFocus: false, |
| | |
| | | this.barCodeFocus = true; |
| | | }, 100); |
| | | }, |
| | | // 排序物料(有数量的排在前面) |
| | | sortMaterList(list) { |
| | | if (!list || list.length === 0) return [] |
| | | return [...list].sort((a, b) => { |
| | | // 数量大于0的排在前面 |
| | | if (a.数量 > 0 && b.数量 <= 0) return -1 |
| | | if (a.数量 <= 0 && b.数量 > 0) return 1 |
| | | return b.数量 - a.数量 // 都有数量或都没有,按数量降序 |
| | | }) |
| | | }, |
| | | |
| | | // 更新当前页数据 |
| | | updatePageData() { |
| | | const start = (this.currentPage - 1) * this.pageSize |
| | | const end = start + this.pageSize |
| | | this.paginatedMaterList = this.sortedMaterList.slice(start, end) |
| | | }, |
| | | |
| | | // 上一页 |
| | | prevPage() { |
| | | if (this.currentPage > 1) { |
| | | this.currentPage-- |
| | | this.updatePageData() |
| | | } |
| | | }, |
| | | |
| | | // 下一页 |
| | | nextPage() { |
| | | if (this.currentPage < Math.ceil(this.sortedMaterList.length / this.pageSize)) { |
| | | this.currentPage++ |
| | | this.updatePageData() |
| | | } |
| | | }, |
| | | async set_InitBillSubType(){ |
| | | try{ |
| | | let res = await CommonUtils.doRequest2Async({ |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | |
| | | // 器具删除 |
| | | async delMould(item) { |
| | | uni.showModal({ |
| | |
| | | this.FIFOlist = data.FIFOlist |
| | | } |
| | | } |
| | | this.sortedMaterList = this.sortMaterList(this.HMaterList) |
| | | this.currentPage = 1 |
| | | this.updatePageData() |
| | | |
| | | // 根据是否是箱条码配置仓位信息 |
| | | if (sBarCodePrefix == 'PAK') { |