分页
This commit is contained in:
@@ -112,8 +112,8 @@ export default {
|
|||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
activated () {
|
activated () {
|
||||||
if (this.$store.getters.materObj !== '') {
|
if (this.$store.getters.materArr.length > 0) {
|
||||||
this.dataList.push(JSON.parse(this.$store.getters.materObj))
|
this.dataList = [...this.dataList, ...this.$store.getters.materArr]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
|||||||
@@ -29,15 +29,16 @@
|
|||||||
<div class="search-item flexend spesite">
|
<div class="search-item flexend spesite">
|
||||||
<button class="button button--primary" @click="_getMaterial">快速查询</button>
|
<button class="button button--primary" @click="_getMaterial">快速查询</button>
|
||||||
<button class="button button--primary" @click="toSure">确定</button>
|
<button class="button button--primary" @click="toSure">确定</button>
|
||||||
<button class="button button--primary" @click="clear">清空</button>
|
<button class="button button--primary" @click="clearUp">清空</button>
|
||||||
<button class="button button--primary" @click="close">关闭</button>
|
<button class="button button--primary" @click="colseUp">关闭</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_wraper">
|
<div class="grid_wraper" v-infinite-scroll="loadMore" infinite-scroll-disabled="busy" infinite-scroll-distance="0" infinite-scroll-immediate-check="false">
|
||||||
<table class="filter-table">
|
<table class="filter-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>选择</th>
|
||||||
<th>序号</th>
|
<th>序号</th>
|
||||||
<th>日期</th>
|
<th>日期</th>
|
||||||
<th>单据号</th>
|
<th>单据号</th>
|
||||||
@@ -50,7 +51,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(e, i) in dataList" :key="i" :class="{'selected_icon': pkId === e.sale_code}" @click="toRadio(e)">
|
<tr v-for="(e, i) in dataList" :key="e.sale_code" @click="toRadio(e)">
|
||||||
|
<td>
|
||||||
|
<button class="iconfont select_icon select_square_icon" :class="e.checked ? 'selected_icon' : 'unselect_icon'"></button>
|
||||||
|
</td>
|
||||||
<td>{{i + 1}}</td>
|
<td>{{i + 1}}</td>
|
||||||
<td>{{e.create_time}}</td>
|
<td>{{e.create_time}}</td>
|
||||||
<td>{{e.sale_code}}</td>
|
<td>{{e.sale_code}}</td>
|
||||||
@@ -73,39 +77,68 @@ import {dateTimeFtt} from '@config/utils.js'
|
|||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
page: 1,
|
||||||
|
size: '30',
|
||||||
|
busy: false,
|
||||||
|
desc: '',
|
||||||
val1: '',
|
val1: '',
|
||||||
val2: '',
|
val2: '',
|
||||||
date: [new Date((new Date().getTime() - 6 * 24 * 60 * 60 * 1000)), new Date((new Date().getTime()))],
|
date: [new Date((new Date().getTime() - 6 * 24 * 60 * 60 * 1000)), new Date((new Date().getTime()))],
|
||||||
dataList: [{sale_code: '030301010037'}],
|
dataList: [{sale_code: '030301010037', checked: false}, {sale_code: '030301010038', checked: false}],
|
||||||
pkId: '',
|
checkArr: []
|
||||||
pkObj: {}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this._getMaterial()
|
this._getMaterial()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 查询
|
// grid
|
||||||
async _getMaterial () {
|
async _getMaterial () {
|
||||||
|
this.page = 1
|
||||||
|
this.busy = false
|
||||||
|
this.desc = ''
|
||||||
let res = await getMaterial(this.date !== null ? dateTimeFtt(this.date[0]) : '', this.date !== null ? dateTimeFtt(this.date[1]) : '', this.val1, this.val2)
|
let res = await getMaterial(this.date !== null ? dateTimeFtt(this.date[0]) : '', this.date !== null ? dateTimeFtt(this.date[1]) : '', this.val1, this.val2)
|
||||||
|
this.dataList = []
|
||||||
|
res.data.map(el => {
|
||||||
|
this.$set(el, 'checked', false)
|
||||||
|
})
|
||||||
this.dataList = [...res.data]
|
this.dataList = [...res.data]
|
||||||
|
if (res.data.length < 30) {
|
||||||
|
this.busy = true
|
||||||
|
this.desc = '已加载全部数据'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
toRadio (e) {
|
async loadMore () {
|
||||||
this.pkId = this.pkId === e.sale_code ? '' : e.sale_code
|
this.busy = true
|
||||||
this.pkObj = this.pkId === e.sale_code ? e : {}
|
this.page++
|
||||||
|
let res = await getMaterial(this.date !== null ? dateTimeFtt(this.date[0]) : '', this.date !== null ? dateTimeFtt(this.date[1]) : '', this.val1, this.val2)
|
||||||
|
res.data.map(el => {
|
||||||
|
this.$set(el, 'checked', false)
|
||||||
|
})
|
||||||
|
this.dataList = [...this.dataList, ...res.data]
|
||||||
|
if (res.data.length < 30) {
|
||||||
|
this.busy = true
|
||||||
|
this.desc = '已加载全部数据'
|
||||||
|
} else {
|
||||||
|
this.busy = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
colseUp () {
|
||||||
|
this.$router.push('/finishedinstore')
|
||||||
},
|
},
|
||||||
toSure () {
|
toSure () {
|
||||||
this.$store.dispatch('setMaterObj', JSON.stringify(this.pkObj))
|
if (this.checkArr.length === 0) {
|
||||||
this.$router.push('/finishedinstore')
|
return
|
||||||
|
}
|
||||||
|
this.$store.dispatch('setMaterArr', this.checkArr)
|
||||||
|
this.colseUp()
|
||||||
},
|
},
|
||||||
clear () {
|
clearUp () {
|
||||||
this.val1 = ''
|
this.checkArr = []
|
||||||
this.val2 = ''
|
|
||||||
this.pkId = ''
|
|
||||||
this.pkObj = {}
|
|
||||||
},
|
},
|
||||||
close () {
|
toRadio (e) {
|
||||||
this.$router.push('/finishedinstore')
|
e.checked = !e.checked
|
||||||
|
this.checkArr = this.dataList.filter(i => { return i.checked === true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user