|
|
@@ -104,7 +104,6 @@ export default {
|
|
|
refreshPage:true,
|
|
|
reportCenterLsit:[],
|
|
|
systemappid:JSON.parse(sessionStorage.getItem('activeApp')).systemappid,
|
|
|
- idx:0
|
|
|
}
|
|
|
},
|
|
|
computed:{
|
|
|
@@ -149,17 +148,20 @@ export default {
|
|
|
reportCenter
|
|
|
},
|
|
|
methods:{
|
|
|
- async queryData (pageNumber) {
|
|
|
- /* 暴露请求配置 进行修改 */
|
|
|
- this.$emit('updateParam',this.param)
|
|
|
-
|
|
|
- this.param.id = this.turnPageId
|
|
|
- this.param.content.pageNumber = pageNumber
|
|
|
- const res = await this.$api.requested(this.param)
|
|
|
- this.total = res.total
|
|
|
- // this.$emit('pageChange',res.data[0][this.idname],res.data[0].rowindex)
|
|
|
- this.$refs['tag']?this.$refs['tag'].queryTag():''
|
|
|
- this.refresh()
|
|
|
+ // async queryData (pageNumber) {
|
|
|
+ // this.$emit('updateParam',this.param)
|
|
|
+ // this.param.id = this.turnPageId
|
|
|
+ // this.param.content.pageNumber = pageNumber
|
|
|
+ // const res = await this.$api.requested(this.param)
|
|
|
+ // this.total = res.total
|
|
|
+ // this.$refs['tag']?this.$refs['tag'].queryTag():''
|
|
|
+ // this.refresh()
|
|
|
+ // },
|
|
|
+ async nextData(param,fn) {
|
|
|
+ this.rowStatus = null
|
|
|
+ const res = await this.$api.requested(param)
|
|
|
+ this.$store.dispatch('saveListData',{listData:res.data,param:param})
|
|
|
+ fn?fn():''
|
|
|
},
|
|
|
/* 获取是否有报表数据 */
|
|
|
async getSystemAppid () {
|
|
|
@@ -185,40 +187,61 @@ export default {
|
|
|
window.open(this.tool.getBaseUrl() + res.data + `&${this.idname}=${data}`)
|
|
|
})
|
|
|
},
|
|
|
- next () {
|
|
|
- let nowId = this.$route.query.id
|
|
|
- let changeId = ''
|
|
|
- console.log( this.svlistData.listData)
|
|
|
- if ((this.idx + 1) == this.svlistData.listData.length) return this.$message({
|
|
|
- message:"已经是当前页最后一条了!",
|
|
|
- type:'warning'
|
|
|
- })
|
|
|
- this.svlistData.listData.forEach((e,index)=>{
|
|
|
- if (e[this.idname] == nowId) {
|
|
|
- changeId = this.svlistData.listData[index + 1][this.idname]
|
|
|
- this.idx = index + 1
|
|
|
+ async next () {
|
|
|
+ const rs = await this.checkPaginationData()
|
|
|
+ if (rs == 0 && this.svlistData.listData.length == 1) return false
|
|
|
+ if (rs == 1 && this.svlistData.param.content.pageNumber == this.svlistData.pageTotal) return false
|
|
|
+ let fun = (rs) =>{
|
|
|
+ let nowId = this.$route.query.id
|
|
|
+ let changeId = ''
|
|
|
+ if (rs == 1) {
|
|
|
+ changeId = this.svlistData.listData[0][this.idname]
|
|
|
+ } else {
|
|
|
+ this.svlistData.listData.forEach((e,index)=>{
|
|
|
+ if (e[this.idname] == nowId) {
|
|
|
+ changeId = this.svlistData.listData[index + 1][this.idname]
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
- this.$emit('pageChange',changeId,this.idx)
|
|
|
- this.refresh()
|
|
|
+ this.$emit('pageChange',changeId,this.idx)
|
|
|
+ this.refresh()
|
|
|
+ }
|
|
|
+ if (rs == 1) {
|
|
|
+ this.svlistData.param.content.pageNumber ++
|
|
|
+ this.nextData(this.svlistData.param,(rs)=>{
|
|
|
+ fun(1)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ fun()
|
|
|
+ }
|
|
|
},
|
|
|
- previous () {
|
|
|
- let nowId = this.$route.query.id
|
|
|
- let changeId = ''
|
|
|
- if ((this.idx - 1) < 0) return this.$message({
|
|
|
- message:"当前是第一条",
|
|
|
- type:'warning'
|
|
|
- })
|
|
|
- this.svlistData.listData.forEach((e,index)=>{
|
|
|
- if (e[this.idname] == nowId) {
|
|
|
- changeId = this.svlistData.listData[index - 1][this.idname]
|
|
|
- this.idx = index - 1
|
|
|
+ async previous () {
|
|
|
+ const res = await this.checkPaginationData()
|
|
|
+ if (res == 0 && this.svlistData.param.content.pageNumber == 1) return false
|
|
|
+ const fun = (rs)=>{
|
|
|
+ let nowId = this.$route.query.id
|
|
|
+ let changeId = ''
|
|
|
+
|
|
|
+ if (rs == 0) {
|
|
|
+ changeId = this.svlistData.listData[this.svlistData.listData.length - 1][this.idname]
|
|
|
+ } else {
|
|
|
+ this.svlistData.listData.forEach((e,index)=>{
|
|
|
+ if (e[this.idname] == nowId) {
|
|
|
+ changeId = this.svlistData.listData[index - 1][this.idname]
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
- this.$emit('pageChange',changeId,this.idx)
|
|
|
- this.refresh()
|
|
|
+ this.$emit('pageChange',changeId,this.idx)
|
|
|
+ this.refresh()
|
|
|
+ }
|
|
|
+ if (res == 0) {
|
|
|
+ this.svlistData.param.content.pageNumber --
|
|
|
+ this.nextData(this.svlistData.param,()=>{
|
|
|
+ fun(0)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ fun()
|
|
|
+ }
|
|
|
},
|
|
|
onSuccess () {
|
|
|
this.$emit('onEditSuccess')
|
|
|
@@ -283,10 +306,31 @@ export default {
|
|
|
},
|
|
|
closeTags() {
|
|
|
this.$refs.tag?this.$refs.tag.closeTag():''
|
|
|
+ },
|
|
|
+
|
|
|
+ checkPaginationData () {
|
|
|
+ return new Promise((reslove,reject)=>{
|
|
|
+ let id = this.$route.query.id
|
|
|
+ let n = 0
|
|
|
+ this.svlistData.listData.filter((e,index)=>{
|
|
|
+ if (e[this.idname] == id){
|
|
|
+ n = index
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (n == 0) {
|
|
|
+ reslove(0)
|
|
|
+ } else if (n == this.svlistData.listData.length - 1) {
|
|
|
+ reslove(1)
|
|
|
+ } else {
|
|
|
+ reslove(-1)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
+ // this.checkPaginationData()
|
|
|
this.idx = this.$route.query.rowindex
|
|
|
+
|
|
|
},
|
|
|
created () {
|
|
|
this.$emit('detailCreate',this.param)
|
|
|
@@ -297,6 +341,7 @@ export default {
|
|
|
watch:{
|
|
|
mainAreaData () {
|
|
|
// console.log(this.mainAData,'mainAData')
|
|
|
+ // this.checkPaginationData()
|
|
|
}
|
|
|
}
|
|
|
}
|