| | |
| | | </view> |
| | | <view class="content"> |
| | | <view class="content_search"> |
| | | <u-search :showAction="false" placeholder="搜索物料名称" v-model="keyword"></u-search> |
| | | <u-search :showAction="false" placeholder="搜索物料名称" v-model="form.name" @search="searchInput"></u-search> |
| | | </view> |
| | | <div class="content_total">共{{total}}条数据</div> |
| | | <view class="content_list"> |
| | | <u-list @scrolltolower="scrolltolower"> |
| | | <u-list-item v-for="(item, index) in indexList" :key="index"> |
| | | <div class="content_list_item" @click="getVal(item)"> |
| | | <div class="content_list_item_name"> |
| | | <span>{{item.name}}</span> |
| | | </div> |
| | | </div> |
| | | </u-list-item> |
| | | </u-list> |
| | | </view> |
| | | <scroll-view scroll-y class="content_list" @scrolltolower="loadmore"> |
| | | <div class="content_list_item" v-for="(item, index) in list" :key="index" @click="getVal(item)"> |
| | | <div class="content_list_item_name"> |
| | | <span>{{item.mmodelUnionName}}</span> |
| | | </div> |
| | | </div> |
| | | </scroll-view> |
| | | </view> |
| | | </u-popup> |
| | | </template> |
| | | |
| | | <script> |
| | | import { materialDistributeExt } from '@/util/api/ExWarehouse' |
| | | |
| | | export default { |
| | | props: { |
| | | show: Boolean |
| | |
| | | return { |
| | | keyword: '', |
| | | total: 0, |
| | | indexList: [] |
| | | list: [], |
| | | loading: false, |
| | | finished: false, |
| | | refreshing: false, |
| | | form: { |
| | | capacity: 50, |
| | | page: 0, |
| | | total: 0, |
| | | name: '' |
| | | } |
| | | }; |
| | | }, |
| | | methods: { |
| | | searchInput() { |
| | | this.form.page = 0 |
| | | this.finished = false |
| | | this.list = [] |
| | | this.loadmore() |
| | | }, |
| | | getVal(item) { |
| | | this.$emit('value', item) |
| | | }, |
| | | open() { |
| | | this.indexList = [] |
| | | this.loadmore() |
| | | }, |
| | | scrolltolower() { |
| | | this.form.page = 0 |
| | | this.finished = false |
| | | this.list = [] |
| | | this.loadmore() |
| | | }, |
| | | loadmore() { |
| | | for (let i = 0; i < 20; i++) { |
| | | this.indexList.push({ |
| | | id: i, |
| | | name: `仓库${i}` |
| | | if (!this.finished) { |
| | | this.loading = true; |
| | | this.form.page = this.form.page += 1 |
| | | materialDistributeExt({ |
| | | capacity: this.form.capacity, |
| | | page: this.form.page, |
| | | model: { |
| | | mmodelUnionName: this.form.name, |
| | | status: 1 |
| | | } |
| | | }).then(res => { |
| | | if (this.refreshing) { |
| | | this.list = [] |
| | | this.refreshing = false; |
| | | } |
| | | this.loading = false; |
| | | if (res.code === 200 && res.data.records && res.data.records.length !== 0) { |
| | | this.form.total = res.data.total |
| | | this.list.push(...res.data.records) |
| | | } else { |
| | | this.finished = true; |
| | | } |
| | | }).catch(err => { |
| | | this.loading = false; |
| | | this.finished = true; |
| | | if (this.refreshing) { |
| | | this.list = [] |
| | | this.refreshing = false; |
| | | } |
| | | }) |
| | | } |
| | | }, |