|
|
@@ -9,6 +9,10 @@
|
|
|
<div>
|
|
|
<slot name="customOperation"></slot>
|
|
|
</div>
|
|
|
+ <div v-if="pageChange === true">
|
|
|
+ <el-button size="mini" icon="el-icon-arrow-left" @click="previous()" :disabled="$route.query.rowindex == 1"></el-button>
|
|
|
+ <el-button size="mini" @click="next()" :disabled="$route.query.rowindex == turnTotal"><i class="el-icon-arrow-right" ></i></el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
@@ -47,12 +51,15 @@ import {mapGetters} from "vuex";
|
|
|
import tabTemp from '@/components/normal-basic-layout/details/modules/tabs/tab'
|
|
|
export default {
|
|
|
name: "index",
|
|
|
- props:["titleText","mainAreaData",'tabs','editData','idname','ownertable'],
|
|
|
+ props:["titleText","mainAreaData",'tabs','editData','idname','ownertable','pageChange'],
|
|
|
components:{tabTemp},
|
|
|
data(){
|
|
|
return {
|
|
|
screenWidth: 0, // 存储当前屏幕的宽度
|
|
|
multipleSize: 0, // 根据屏幕宽度计算得出的值
|
|
|
+ turnTotal:sessionStorage.getItem('total'),
|
|
|
+ refreshPage:true,
|
|
|
+ time:null
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
@@ -62,7 +69,158 @@ export default {
|
|
|
handleResize() {
|
|
|
// 更新屏幕宽度
|
|
|
this.screenWidth = window.innerWidth;
|
|
|
- }
|
|
|
+ },
|
|
|
+ async next () {
|
|
|
+ console.log('1111111111111')
|
|
|
+ if (this.$route.query.listqueryid === 'undefined' || !this.$route.query.listqueryid){
|
|
|
+ this.nextOld()
|
|
|
+ }else {
|
|
|
+ let listqueryid = sessionStorage.getItem('listqueryid')
|
|
|
+ if (this.time !== null) {
|
|
|
+ clearTimeout(this.time)
|
|
|
+ }
|
|
|
+ this.time = setTimeout(() => {
|
|
|
+ this.upPageData(1,listqueryid)
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ async previous () {
|
|
|
+ if (this.$route.query.listqueryid === 'undefined' || !this.$route.query.listqueryid){
|
|
|
+ this.previousOld()
|
|
|
+ }else {
|
|
|
+ let rowindex = this.$route.query.rowindex
|
|
|
+ let listqueryid = sessionStorage.getItem('listqueryid')
|
|
|
+ if (rowindex >= 1) {
|
|
|
+ if (rowindex = 1){
|
|
|
+ if (this.time !== null) {
|
|
|
+ clearTimeout(this.time)
|
|
|
+ }
|
|
|
+ this.time = setTimeout(() => {
|
|
|
+ this.upPageData(0,listqueryid)
|
|
|
+ }, 0);
|
|
|
+ this.isPrevious = true
|
|
|
+ }else {
|
|
|
+ if (this.time !== null) {
|
|
|
+ clearTimeout(this.time)
|
|
|
+ }
|
|
|
+ this.time = setTimeout(() => {
|
|
|
+ this.upPageData(0,listqueryid)
|
|
|
+ }, 0);
|
|
|
+ this.isPrevious = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ /*message.warn('已经是第一条了!')*/
|
|
|
+ this.isPrevious = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ async nextOld () {
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ if (rs == 1) {
|
|
|
+ this.svlistData.param.content.pageNumber ++
|
|
|
+ this.nextData(this.svlistData.param,(rs)=>{
|
|
|
+ fun(1)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ fun()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async previousOld () {
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ if (res == 0) {
|
|
|
+ this.svlistData.param.content.pageNumber --
|
|
|
+ this.nextData(this.svlistData.param,()=>{
|
|
|
+ fun(0)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ fun()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async upPageData (forward,listqueryid){
|
|
|
+ /*const hide = message.loading({content:'正在查询数据,请稍等..',duration:0,key:1});*/
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "classname": "system.tools",
|
|
|
+ "method":"querylistdatabyrowindex",
|
|
|
+ "content": {
|
|
|
+ "uniqueid":this.$route.query.id,
|
|
|
+ "rowindex": this.$route.query.rowindex,
|
|
|
+ "forward":forward,
|
|
|
+ "listqueryid": listqueryid,
|
|
|
+ "fieldname":this.$route.query.fieldname
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('执行了嘛')
|
|
|
+ if (res.data.data) {
|
|
|
+ console.log('data执行')
|
|
|
+ this.$router.replace({path:this.$route.path,query:{id:res.data.data,rowindex:res.data.rowindex,listqueryid:listqueryid,fieldname:this.$route.query.fieldname}})
|
|
|
+ this.$emit('pageChange',res.data.data,this.$route.query.rowindex)
|
|
|
+ } else {
|
|
|
+ console.log("没有执行")
|
|
|
+ /* message.warn('已经是最后一条了!')*/
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ refresh () {
|
|
|
+ this.refreshPage = false
|
|
|
+ setTimeout(() => {
|
|
|
+ this.refreshPage = true
|
|
|
+ }, 10);
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
// 监听窗口大小变化
|
|
|
@@ -104,6 +262,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
},
|
|
|
+
|
|
|
...mapGetters({
|
|
|
activeApp:"activeApp",
|
|
|
svlistData:'svlistData'
|