export default { data() { return { CRFLoading: false, timer: null, flag: 1, multipleSelectFullSetTime: null } }, methods: { // 智能填充 getFirstFeedbackData(title, id) { console.log(this.dataForm) console.log(this.flag) if (this.flag === 1) { console.log('------------------') this.flag++ // 解决多次调用定时器清除不掉的问题 this.CRFLoading = true // 获取已保存的手术列表--调取hmcrf.multipleSelectFull()方法回显 console.log(99999999999999) this.$http.get(`/from/data/getFirstFeedbackData/${this.dataForm.formName}/${this.dataForm.patientIdNumber}/${id}`).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } if (res.data) { const fillData = res.data this.crfDataVisible = true this.timer = setInterval(() => { if (title === '智能填充') { console.log(123, title) this.isClick = true this.oldCRFListItem = {} if (this.$refs.crfComponent && this.$refs.crfComponent.$el.contentWindow.dataFill) { this.$refs.crfComponent.$el.contentWindow.dataFill(fillData) clearInterval(this.timer) this.flag = 1 this.CRFLoading = false } else { clearInterval(this.timer) this.flag = 1 } } else if (title === '病历模板') { console.log(456, title) this.oldCRFListItem = {} const ifr = document.getElementsByClassName('tox-edit-area__iframe')[0] console.log(ifr.contentWindow) console.log(ifr.contentWindow.dataFill) if (ifr.contentWindow.dataFill) { ifr.contentWindow.dataFill(fillData) clearInterval(this.timer) this.flag = 1 this.CRFLoading = false } } }, 500) } }).catch(() => { }) } else { clearInterval(this.timer) this.oldCRFListItem = {} this.flag = 1 this.CRFLoading = false console.log('flag', this.flag) } }, // 获取已保存的手术列表--调取hmcrf.multipleSelectFull()方法回显 async getsaveOperaList(formId) { this.multipleSelectFullSetTime ? clearInterval(this.multipleSelectFullSetTime) : '' const { data: res } = await this.$http.get('/opera/patient/getExecuteOperaList', { params: { crfFormId: formId } }) if (res.code !== 0) { return this.$message.error(res.msg) } else { this.multipleSelectFullSetTime = setInterval(() => { console.log('multipleSelectFull') if (this.$refs.crfComponent && this.$refs.crfComponent.$el.contentWindow.multipleSelectFull) { console.log(this.$refs.crfComponent) clearInterval(this.multipleSelectFullSetTime) this.$refs.crfComponent.$el.contentWindow.multipleSelectFull(res.data) } }, 500) } } } }