diff --git a/jero-web/src/views/projectManagement/components/ParameterItemCollectionList.vue b/jero-web/src/views/projectManagement/components/ParameterItemCollectionList.vue index dcdcd4fbf..d1bf08411 100644 --- a/jero-web/src/views/projectManagement/components/ParameterItemCollectionList.vue +++ b/jero-web/src/views/projectManagement/components/ParameterItemCollectionList.vue @@ -755,7 +755,9 @@ NotSelectedRowKeysValue: [], NoEngineer: 1, // 下发收集的权限,0为没有接口人 1为由接口人 默认有 NotSelectedNoEngineerValue: [], - paramsManifest: {} + paramsManifest: {}, + timeBatch:'', + timer:'', } }, props: { @@ -766,16 +768,44 @@ // } }, mounted() { + this.handleClick() + window.addEventListener('keyup',this.handleKeyup) + window.addEventListener('click',this.handleClick) this.GetgetLoginUserType() - console.log(this.currentPersonRole) if(this.$route.query.type == '1'){ this.handleOkRoleSwitching() } - setTimeout(() => { - if (this.currentPersonRole == 'dre') { - this.handlePreservation() - } - }, 10000) + // clearTimeout(this.timeBatch) + // this.timeBatch = setTimeout(() => { + // if (this.currentPersonRole == 'dre') { + // this.handlePreservation() + // } + // }, 10000) + // if (this.currentPersonRole == 'dre') { + // this.timeBatch = setInterval(() => { + // this.handlePreservation(); + // }, 10000); + // this.$nextTick(() => { + // var interval = setInterval(this.handlePreservation(),10000); + // /* if 5 minutes no operation then logout */ + // var maxTime = 120; // seconds + // var time = maxTime; + // $('body').on('keydown mousemove mousedown', function(e) { + // time = maxTime; // reset + // }); + // var intervalId = setInterval(function() { + // time--; + // if (time <= 0) { + // ShowInvalidLoginMessage(); + // clearInterval(intervalId); + // } + // }, 10000) + // function ShowInvalidLoginMessage() { + // // 停止定时器 + // clearInterval(interval); + // } + // }) + // } // this.paramsManifest = JSON.parse(localStorage.getItem('paramsManifest')) this.paramsManifest = this.$route.query // document.title = `${this.paramsManifest.title}-` + this.$t('ParameteItemCollectionList') @@ -783,6 +813,37 @@ }, methods: { ...mapGetters(['userInfo']), + handleKeyup(){ + clearTimeout(this.timer) + clearTimeout(this.timeBatch) + clearTimeout(this.timerOne) + this.timer = setTimeout(()=>{ + if (this.currentPersonRole == 'dre') { + this.handlePreservation() + } + },10000) + this.timerOne = setTimeout(()=>{ + clearTimeout(this.timer) + clearTimeout(this.timeBatch) + clearTimeout(this.timerOne) + },300000) + }, + handleClick(){ + clearTimeout(this.timer) + clearTimeout(this.timeBatch) + clearTimeout(this.timerOne) + this.timer = setTimeout(()=>{ + if (this.currentPersonRole == 'dre') { + this.handlePreservation() + } + },10000) + this.timerOne = setTimeout(()=>{ + clearTimeout(this.timer) + clearTimeout(this.timeBatch) + clearTimeout(this.timerOne) + },300000) + }, + handleToggleSearch() { this.toggleSearchStatus = !this.toggleSearchStatus }, @@ -868,11 +929,35 @@ this.$nextTick(()=>{ this.formInlineRoleSwitching.roleSwitchingCode = this.currentPersonRole this.$refs.ruleFormRoleSwitching.clearValidate() - setTimeout(() => { + clearTimeout(this.timeBatch) + this.timeBatch = setTimeout(() => { if (this.currentPersonRole == 'dre') { this.handlePreservation() } }, 10000) + // if (this.currentPersonRole == 'dre') { + // this.timeBatch = setInterval(() => { + // this.handlePreservation(); + // }, 10000); + // var interval = setInterval(this.handlePreservation(),10000); + // /* if 5 minutes no operation then logout */ + // var maxTime = 120; // seconds + // var time = maxTime; + // $('body').on('keydown mousemove mousedown', function(e) { + // time = maxTime; // reset + // }); + // var intervalId = setInterval(function() { + // time--; + // if (time <= 0) { + // ShowInvalidLoginMessage(); + // clearInterval(intervalId); + // } + // }, 10000) + // function ShowInvalidLoginMessage() { + // // 停止定时器 + // clearInterval(interval); + // } + // } }) }, GetgetLoginUserType() { @@ -1588,11 +1673,35 @@ _this.$message.success(_this.$t('OperationSuccessful')) this.textLoading = false } - setTimeout(() => { + clearTimeout(this.timeBatch) + this.timeBatch = setTimeout(() => { if (this.currentPersonRole == 'dre') { this.handlePreservation() } }, 10000) + // if (this.currentPersonRole == 'dre') { + // this.timeBatch = setTimeout(() => { + // this.handlePreservation(); + // }, 10000); + // var interval = setInterval(this.handlePreservation(),10000); + // /* if 5 minutes no operation then logout */ + // var maxTime = 120; // seconds + // var time = maxTime; + // $('body').on('keydown mousemove mousedown', function(e) { + // time = maxTime; // reset + // }); + // var intervalId = setInterval(function() { + // time--; + // if (time <= 0) { + // ShowInvalidLoginMessage(); + // clearInterval(intervalId); + // } + // }, 10000) + // function ShowInvalidLoginMessage() { + // // 停止定时器 + // clearInterval(interval); + // } + // } } else { if (num && num == 1) { _this.$message.warning(_this.$t('operationFailed')) @@ -1905,6 +2014,10 @@ SizeChange() { } + }, + destroyed() { + // 离开页面结束定时器 + clearTimeout(this.timeBatch) } }