From 64a7f738aadbf552bfb1ce24c46b1924767bf526 Mon Sep 17 00:00:00 2001 From: Mr.Zhang <710666463@qq.com> Date: 星期二, 05 九月 2023 16:00:16 +0800 Subject: [PATCH] 小程序 --- minipro_standard/components/selectMaterial.vue | 132 +++++++++++++++++++++++++++---------------- 1 files changed, 82 insertions(+), 50 deletions(-) diff --git a/minipro_standard/components/selectMaterial.vue b/minipro_standard/components/selectMaterial.vue index c2250fe..89224e5 100644 --- a/minipro_standard/components/selectMaterial.vue +++ b/minipro_standard/components/selectMaterial.vue @@ -2,44 +2,51 @@ <u-popup :show="show" :round="10" closeable @close="show=false"> <view class="material-content bbox p30"> <view class="tc b f24 c2">閫夋嫨鐗╂枡</view> - <u-list @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower"> + <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="refreshing" + @scrolltolower="loadMore" @refresherrefresh="onRefresh"> + <view v-for="(item1, index) in list" :key="index" class="" style="height: 20px;" @click="jump(item1)"> + <div class="page_content_title_top"> + <span>{{ item1.materialName + ' | ' + item1.materialCode }}</span> + </div> + <div class="page_content_title_bottom"> + <span>{{ item1.locationName }} / </span> + <span>{{ item1.num }}{{ item1.unitName }}</span> + </div> + <div class="page_content_title_bottom"> + <span class="green" v-if="item1.qualityType == 0">鍚堟牸 <span class="c1">/</span> </span> + <span class="orange" v-else-if="item1.qualityType == 1">涓嶈壇 <span + class="c1">/</span> </span> + <span class="red" v-else-if="item1.qualityType == 2">鎶ュ簾 <span + class="c1">/</span> </span> + <span v-else>- / </span> + <span>{{item1.procedureName ? item1.procedureName : '-'}} / </span> + <span>{{item1.batch ? item1.batch : '-'}}</span> + </div> + </view> + </scroll-view> + <!-- <u-list @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower"> <u-list-item v-for="(item1, index) in list" :key="index"> - <view class="" style="height: 20px;" @click="jump(item1)"> - <div class="page_content_title_top"> - <span>{{ item1.materialName + ' | ' + item1.materialCode }}</span> - </div> - <div class="page_content_title_bottom"> - <span>{{ item1.locationName }} / </span> - <span>{{ item1.num }}{{ item1.unitName }}</span> - </div> - <div class="page_content_title_bottom"> - <span class="green" v-if="item1.qualityType == 0">鍚堟牸 <span - class="c1">/</span> </span> - <span class="orange" v-else-if="item1.qualityType == 1">涓嶈壇 <span - class="c1">/</span> </span> - <span class="red" v-else-if="item1.qualityType == 2">鎶ュ簾 <span - class="c1">/</span> </span> - <span v-else>- / </span> - <span>{{item1.procedureName ? item1.procedureName : '-'}} / </span> - <span>{{item1.batch ? item1.batch : '-'}}</span> - </div> - </view> </u-list-item> - </u-list> + </u-list> --> </view> </u-popup> </template> <script> + import { + choiceStockListPage, + choiceStockPageForStandard + } from '@/util/api/agencyAPI' export default { name: "selectMaterial", data() { return { - show: false, - pages: { - size: 10, - index: 1, - total: 0 + show: false, + refreshing: false, + pages: { + capacity: 10, + page: 1, + total: 0 }, list: [ 1, 2, 3, 4, 5, 6, 7, 8 @@ -49,39 +56,64 @@ methods: { open(target) { this.show = true - this.workorderId = target.workorderId + this.refreshing = false + this.workorderId = target.workorderId this.deviceId = target.deviceId this.list = [] - this.pages = { - size: 10, - index: 1, - total: 0 + this.pages = { + capacity: 10, + page: 1, + total: 0 } this.loadData() }, loadData() { - this.list = [{ - batch: '1', - materialName: 'dsadas', - materialCode: '1m0001', - locationName: 'a浠�2鍙蜂綅', - num: '1', - unitName: '鍧�', - qualityType: 0, - procedureName: '鍘嬪埗', - }] + // this.list = [{ + // batch: '1', + // materialName: 'dsadas', + // materialCode: '1m0001', + // locationName: 'a浠�2鍙蜂綅', + // num: '1', + // unitName: '鍧�', + // qualityType: 0, + // procedureName: '鍘嬪埗', + // }] + choiceStockPageForStandard({ + ...this.pages, + model: { + workorderId: this.workorderId, + deviceId: this.deviceId + } + }).then(res => { + let { + data + } = res + if (data.page == 1) { + this.list = []; + } + this.pages.page = data.page + this.pages.total = data.total + this.list.push(...data.records) + }).catch((err) => { + + }) + .finally(() => { + this.refreshing = false; + }) }, - scrolltoupper() { - console.log('scrolltoupper'); + loadMore() { + this.pages.page += 1 this.loadData() }, - scrolltolower() { - console.log('scrolltolower'); + onRefresh() { + if (this.refreshing) return + this.refreshing = true; + this.pages.page = 1 this.loadData() - }, - jump(item) { - this.$emit('selectAction', item) - this.show = false + }, + jump(item) { + this.$emit('selectAction', item) + this.show = false } } } -- Gitblit v1.9.3