1.修复征求意见详情页刷新回到登录页的BUG

2.修复征求意见详情添加窗口通信刷新BUG
This commit is contained in:
chenxiaoxi
2022-01-26 17:09:36 +08:00
parent 5102f8514c
commit 7f66222a6c
8 changed files with 90 additions and 32 deletions
@@ -137,7 +137,7 @@ export default {
this.$router.push({
name: "consultationDetails",
query: {
item: item
item: JSON.stringify(item)
}
});
},
@@ -80,6 +80,8 @@
},
methods: {
saveUserInfo () {
this.$store.commit('SET_REFRESH_FLAG', true)
return false
this.$refs['formAdd'].validate((valid) => {
if (valid) {
this.isSubmit = true
@@ -14,7 +14,7 @@
<span class="transition-box-span table-jump"
@click="handlePreview(itemData)"
>
{{ this.$route.query.item.cid }}
{{ this.lawsStand.cid }}
</span>
</p>
<!-- <p class="transition-box-p">-->
@@ -22,7 +22,7 @@
<!-- <span class="transition-box-span table-jump"-->
<!-- @click="handlePreview(itemData)"-->
<!-- >-->
<!-- {{ this.$route.query.item.cname || '-' }}-->
<!-- {{ this.lawsStand.cname || '-' }}-->
<!-- </span>-->
<!-- </p>-->
<div class="transition-box-p">
@@ -69,11 +69,11 @@
</div>
<p class="transition-box-p">
<label class="transition-box-label">上传时间</label>
<span class="transition-box-span">{{ this.$route.query.item.startTime || '-' }}</span>
<span class="transition-box-span">{{ this.lawsStand.startTime || '-' }}</span>
</p>
<p class="transition-box-p">
<label class="transition-box-label">征求意见周期</label>
<span class="transition-box-span" v-if="this.$route.query.item.startTime && this.$route.query.item.endTime">{{ this.$route.query.item.startTime + ' ~ ' + this.$route.query.item.endTime }}</span>
<span class="transition-box-span" v-if="this.lawsStand.startTime && this.lawsStand.endTime">{{ this.lawsStand.startTime + ' ~ ' + this.lawsStand.endTime }}</span>
<span class="transition-box-span" v-else>-</span>
</p>
</div>
@@ -234,9 +234,9 @@
</el-drawer>
<loading :loading="spinShow">数据加载中</loading>
<el-dialog
title="查看修改前内容"
:visible.sync="itermsConditionsFlag"
size="800px">
title="查看修改前内容"
:visible.sync="itermsConditionsFlag"
width="800px">
<div style="height: 500px;overflow: auto;" v-html="itermsConditionsTitle"></div>
<div slot="footer">
<el-button class="common-button-default" size="mini" icon="el-icon-close" @click="itermsConditionsClose">关闭</el-button>
@@ -246,6 +246,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
export default {
name: 'consultationDetails',
data() {
@@ -256,7 +257,7 @@
options: [],
fileInfoList: [],
fileInfoLists: [],
itemData: this.$route.query.item,
itemData: this.lawsStand,
id: '', // 选中id
type: '', // 选中状态
spinShow: false,
@@ -289,14 +290,15 @@
},
standinfoList: [], // 详情列表
form: {
ideaId: this.$route.query.item.id,
cid: this.$route.query.item.cid,
ideaId: '',
cid: '',
page: 1,
size: this.$store.getters.userInfo.configContent,
userId: this.$store.getters.userInfo.userId,
endTime: this.$route.query.item.endTime
endTime: ''
}, // 详情数据
ideaKey: false
ideaKey: false,
refreshTimer: null
}
},
methods: {
@@ -330,10 +332,10 @@
window.open(routeUrl.href, '_blank')
},
exportAll() {
window.open('/api/slrs/sar-public-idea-all/tuallStand?cid=' + this.$route.query.item.id)
window.open('/api/slrs/sar-public-idea-all/tuallStand?cid=' + this.lawsStand.id)
},
exportAll1() {
window.open('/api/slrs/sar-public-idea-all/tuallStand?type=1&cid=' + this.$route.query.item.id)
window.open('/api/slrs/sar-public-idea-all/tuallStand?type=1&cid=' + this.lawsStand.id)
},
getIdeaKey() {
this.$http.get('slrs/sar-public-idea-all/checkIsShow', {
@@ -399,6 +401,26 @@
} else {
localStorage.setItem('freshClueNum', new Date().getTime())
this.freshClueNum = localStorage.getItem('freshClueNum') || '';
const that = this
const watcherRefreshData = function(ev) {
const { key: eventType, newValue } = ev
if (eventType === 'refreshFlag' && eval(newValue) === true) {
// 更新数据...
console.log('更新数据')
that.$store.commit('SET_REFRESH_FLAG', false)
}
}
// 对浏览器的localStorage进行监听,当需要更新数据时,refreshFlag为true,数据更新后将refreshFlag置为false
window.addEventListener('storage', (ev) => {
watcherRefreshData(ev)
this.$once('hook:beforeDestroy', () => {
window.removeEventListener('storage', (ev) => {
watcherRefreshData(ev)
})
})
})
let routeData = this.$router.resolve({
name: "AddFileDetails",
query: {
@@ -407,10 +429,10 @@
userName: this.$store.getters.userInfo.userName || '',
deptName: this.$store.getters.userInfo.institutionName || '',
deptId: this.$store.getters.userInfo.institutionId || '',
standId: JSON.parse(this.$route.query.item.files)[0].standId,
fileType: JSON.parse(this.$route.query.item.files)[0].standFileClassify,
ideaId: this.$route.query.item.id,
cid: this.$route.query.item.cid,
standId: JSON.parse(this.lawsStand.files)[0].standId,
fileType: JSON.parse(this.lawsStand.files)[0].standFileClassify,
ideaId: this.lawsStand.id,
cid: this.lawsStand.cid,
}
});
window.open(routeData.href, '_blank')
@@ -457,8 +479,8 @@
if (valid) {
var url = ''
var form = {
ideaId: this.$route.query.item.id,
cid: this.$route.query.item.cid,
ideaId: this.lawsStand.id,
cid: this.lawsStand.cid,
content: this.opinionContent.content,
oldText: this.opinionContent.oldText,
newText: this.opinionContent.newText,
@@ -504,7 +526,7 @@
this.isDialog = false
},
getFileInfo() {
JSON.parse(this.$route.query.item.files).forEach(item=>{
JSON.parse(this.lawsStand.files).forEach(item=>{
this.fileInfoList.push({
attId: item.attId,
id: item.id,
@@ -516,20 +538,42 @@
window.open('/static/pdf/web/viewer.html?file=' + encodeURIComponent('/api/att/attFile/getFileInfo?fileId=' + file.attId))
}
},
watch: {
refreshFlag(val) {
console.log('refresh刷新了')
}
},
computed: {
lawsStand() {
return this.$route.query.item && JSON.parse(this.$route.query.item)
},
...mapGetters(['refreshFlag'])
},
mounted() {
if (this.lawsStand) {
this.form = {
ideaId: this.lawsStand.id,
cid: this.lawsStand.cid,
page: 1,
size: this.$store.getters.userInfo.configContent,
userId: this.$store.getters.userInfo.userId,
endTime: this.lawsStand.endTime
}
}
// 详情数据
window.addEventListener("storage", ev => {
if(ev.key === 'freshClueNum'){
this.form.page = 1
this.getList()
}
})
if (JSON.parse(this.$route.query.item.wkfiles).length) {
this.fileInfoLists = JSON.parse(this.$route.query.item.wkfiles)
if (JSON.parse(this.lawsStand.wkfiles).length) {
this.fileInfoLists = JSON.parse(this.lawsStand.wkfiles)
} else {
this.fileInfoLists = []
}
if (JSON.parse(this.$route.query.item.files).length) {
let json = JSON.parse(this.$route.query.item.files)[0]
if (JSON.parse(this.lawsStand.files).length) {
let json = JSON.parse(this.lawsStand.files)[0]
this.$http.get('SarStandItems/sar-stand-items/querySarItemAndInterpretation', {
standId: json.standId,
fileType: json.standFileClassify,
@@ -547,7 +591,7 @@
this.getList()
this.getIdeaKey()
this.getFileInfo()
},
}
}
</script>