|
|
@@ -32,6 +32,21 @@
|
|
|
if (this.option.url) {
|
|
|
this.setEditor(this.option)
|
|
|
}
|
|
|
+ if(this.option.mode == 'edit'){
|
|
|
+ // 编辑模式下轮询获取文件id
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ if (this.configKey) {
|
|
|
+ showView({ key: this.configKey }).then((response) => {
|
|
|
+ if (response.variables.data !== '0' && this.newId !== response.variables.data) {
|
|
|
+ // 记录当前id,与返回的文件id比对,有变化证明有做修改,提示并替换
|
|
|
+ this.newId = response.variables.data
|
|
|
+ this.$message.success('文件编辑保存成功,稍后请提交表单!')
|
|
|
+ this.$emit('updateFile', this.newId)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }, 2000)
|
|
|
+ }
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
// 页面关闭清除定时任务
|
|
|
@@ -92,12 +107,13 @@
|
|
|
onRequestSaveAs: () => {
|
|
|
console.log('另存为')
|
|
|
},
|
|
|
- onDocumentStateChange: e => {
|
|
|
- if (!e.data) {
|
|
|
- console.log('文件修改', e)
|
|
|
- this.handlerFileSave()
|
|
|
- }
|
|
|
- },
|
|
|
+ // 监听文件修改开启轮询,有几率同时触发N个,导致页面卡死
|
|
|
+ // onDocumentStateChange: e => {
|
|
|
+ // if (!e.data) {
|
|
|
+ // console.log('文件修改', e)
|
|
|
+ // this.handlerFileSave()
|
|
|
+ // }
|
|
|
+ // },
|
|
|
onDocumentReady: () => {
|
|
|
console.log('文件加载完成~')
|
|
|
}
|