| | |
| | | </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> |
| | | <div class="content_total">共{{form.total}}条数据</div> |
| | | <scroll-view class="content_list" scroll-y> |
| | | <div class="content_list_item" v-for="(item, index) in indexList" :key="index" @click="getVal(item)"> |
| | | <div class="content_list_item" v-for="(item, index) in list" :key="index" @click="jump(item)"> |
| | | <div class="content_list_item_name"> |
| | | <span>{{item.name}}</span> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { allUser } from '@/util/api/PlanningAPI' |
| | | export default { |
| | | props: { |
| | | show: Boolean |
| | | }, |
| | | data() { |
| | | return { |
| | | keyword: '', |
| | | total: 0, |
| | | indexList: [] |
| | | list: [], |
| | | loading: false, |
| | | finished: false, |
| | | refreshing: false, |
| | | form: { |
| | | capacity: 50, |
| | | page: 0, |
| | | total: 0, |
| | | name: '' |
| | | } |
| | | }; |
| | | }, |
| | | methods: { |
| | | getVal(item) { |
| | | // 搜索框 |
| | | searchInput(data) { |
| | | this.form.page = 0 |
| | | this.finished = false |
| | | this.list = [] |
| | | this.loadmore() |
| | | }, |
| | | jump(item) { |
| | | this.$emit('value', item) |
| | | }, |
| | | open() { |
| | | this.indexList = [] |
| | | this.loadmore() |
| | | }, |
| | | scrolltolower() { |
| | | this.list = [] |
| | | 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}` |
| | | allUser({ name: this.form.name }) |
| | | .then(res => { |
| | | if (res.code === 200 && res.data && res.data.length !== 0) { |
| | | this.form.total = res.data.length |
| | | this.list = res.data |
| | | } else { |
| | | this.finished = true; |
| | | } |
| | | }).catch(err => { |
| | | this.loading = false; |
| | | this.finished = true; |
| | | if (this.refreshing) { |
| | | this.list = [] |
| | | this.refreshing = false; |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | close() { |
| | | this.$emit('close') |