zhuliu 1 year ago
parent
commit
c06cd66ab3

+ 1 - 1
src/views/analyse/custom/components/Charts/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div v-if="refresh">
-    <component :is="chartType.component" :formData="formData" :formCount="formCount" :selectedData="selectedData" :width="width" :height="height"></component>
+    <component :is="chartType.component" :myId="myId" :formData="formData" :formCount="formCount" :selectedData="selectedData" :width="width" :height="height"></component>
   </div>
 </template>
 

+ 7 - 1
src/views/analyse/custom/mixins.js

@@ -8,7 +8,10 @@ export const customPage = {
   props:{
     formCount:{},
     formData:{},
-    selectedData:{}
+    selectedData:{},
+    myId:{
+      type:String
+    }
   },
   computed: {
     form() {
@@ -497,6 +500,9 @@ export const chartOption = {
 export const chartOptionMixins = {
   mixins: [chartOption],
   mounted() {
+    if(this.myId){
+      this.id = this.myId + '_' + this.id
+    }
     this.$nextTick(() => {
       this.initChart(this.id, this.getOption())
     })

+ 1 - 0
src/views/components/editor/components/analysis/index.vue

@@ -49,6 +49,7 @@
     methods: {
       async edit(){
           var data =await this.$refs.Analysis.getCurrentData()
+          this.data.url = data.url
           data.isEdit = this.data.isEdit
           this.$emit('data',data)
           this.close()

+ 43 - 44
src/views/components/editor/editor.vue

@@ -552,7 +552,7 @@ export default {
     getHtml(){
       const value = this.editorRef.command.getValue(this.options)
           const htmlVal = this.editorRef.command.getHTML()
-          console.log(value,htmlVal)
+          // console.log(value,htmlVal)
       const parser = new DOMParser();
           // 解析包含 HTML 实体的字符串
           const doc = parser.parseFromString(htmlVal.main, "text/html");
@@ -613,7 +613,7 @@ export default {
             ${html}
             </body>
             </html>`
-            console.log(html)
+            // console.log(html)
             return html
     },
     //导出word
@@ -627,7 +627,7 @@ export default {
             ${html}
             </body>
             </html>`
-            console.log(html)
+            // console.log(html)
           var converted = htmlDocx.asBlob(html,{orientation:"landscape"})
           FileSaver.saveAs(converted,  new Date().toString() + ".docx");
     },
@@ -639,7 +639,6 @@ export default {
       proxyInputFile.accept = ".doc, .docx";
       proxyInputFile.onchange = () => {
         const file = proxyInputFile.files[0];
-        console.log(file)
         const fileReader = new FileReader();
         fileReader.readAsArrayBuffer(file);
         fileReader.onload = () => {
@@ -679,13 +678,13 @@ export default {
         
         // 通过菜单key找到菜单项后进行属性修改
         if (menu.key === 'imageChange') {
-          menu.callback = (command, context) => {
-            console.log(command, context)    
+          menu.callback = (command, context) => {  
             var value = context.endElement.value
             var index = this.imageData.findIndex(item=>{
               return item.url == value
             })
             if(index!=-1){
+              this.imageData[index].isEdit = true
               this.analysis(this.imageData[index])
               return
             }       
@@ -767,12 +766,12 @@ export default {
       saveDom.onclick = () => {
           const value = instance.command.getValue(this.options)
           const htmlVal = instance.command.getHTML()
-          console.log(value,htmlVal)
+          // console.log(value,htmlVal,this.imageData)
           this.$emit('save', value)// 保存数据传给父组件
       };
       // 快捷键保存
       instance.listener.saved = (payload) => {
-        console.log('elementList: ', payload)
+        // console.log('elementList: ', payload)
         const value = instance.command.getValue(this.options)
         this.$emit('save', value)// 保存数据传给父组件
       }
@@ -781,14 +780,14 @@ export default {
       const undoDom = document.querySelector('.menu-item__undo')
       undoDom.title = `撤销(${isApple ? '⌘' : 'Ctrl'}+Z)`
       undoDom.onclick = function () {
-        console.log('undo')
+        // console.log('undo')
         instance.command.executeUndo()
       }
 
       const redoDom = document.querySelector('.menu-item__redo')
       redoDom.title = `重做(${isApple ? '⌘' : 'Ctrl'}+Y)`
       redoDom.onclick = function () {
-        console.log('redo')
+        // console.log('redo')
         instance.command.executeRedo()
       }
 
@@ -796,13 +795,13 @@ export default {
         '.menu-item__painter'
       )
       painterDom.onclick = function () {
-        console.log('painter')
+        // console.log('painter')
         instance.command.executePainter({
           isDblclick: false
         })
       }
       painterDom.ondblclick = function () {
-        console.log('painter')
+        // console.log('painter')
         instance.command.executePainter({
           isDblclick: true
         })
@@ -810,7 +809,7 @@ export default {
 
       document.querySelector('.menu-item__format').onclick =
         function () {
-          console.log('format')
+          // console.log('format')
           instance.command.executeFormat()
         }
 
@@ -819,7 +818,7 @@ export default {
         const fontSelectDom = fontDom.querySelector('.select')
         const fontOptionDom = fontDom.querySelector('.options')
         fontDom.onclick = function () {
-          console.log('font')
+          // console.log('font')
           fontOptionDom.classList.toggle('visible')
         }
         fontOptionDom.onclick = function (evt) {
@@ -832,7 +831,7 @@ export default {
         const sizeOptionDom = sizeSetDom.querySelector('.options')
         sizeSetDom.title = `设置字号`
         sizeSetDom.onclick = function () {
-          console.log('size')
+          // console.log('size')
           sizeOptionDom.classList.toggle('visible')
         }
         sizeOptionDom.onclick = function (evt) {
@@ -845,7 +844,7 @@ export default {
         )
         sizeAddDom.title = `增大字号(${this.isApple ? '⌘' : 'Ctrl'}+[)`
         sizeAddDom.onclick = function () {
-          console.log('size-add')
+          // console.log('size-add')
           instance.command.executeSizeAdd()
         }
 
@@ -854,14 +853,14 @@ export default {
         )
         sizeMinusDom.title = `减小字号(${this.isApple ? '⌘' : 'Ctrl'}+])`
         sizeMinusDom.onclick = function () {
-          console.log('size-minus')
+          // console.log('size-minus')
           instance.command.executeSizeMinus()
         }
 
         const boldDom = document.querySelector('.menu-item__bold')
         boldDom.title = `加粗(${this.isApple ? '⌘' : 'Ctrl'}+B)`
         boldDom.onclick = function () {
-          console.log('bold')
+          // console.log('bold')
           instance.command.executeBold()
         }
 
@@ -869,7 +868,7 @@ export default {
           document.querySelector('.menu-item__italic')
         italicDom.title = `斜体(${this.isApple ? '⌘' : 'Ctrl'}+I)`
         italicDom.onclick = function () {
-          console.log('italic')
+          // console.log('italic')
           instance.command.executeItalic()
         }
 
@@ -878,7 +877,7 @@ export default {
         )
         underlineDom.title = `下划线(${this.isApple ? '⌘' : 'Ctrl'}+U)`
         underlineDom.onclick = function () {
-          console.log('underline')
+          // console.log('underline')
           instance.command.executeUnderline()
         }
 
@@ -886,7 +885,7 @@ export default {
           '.menu-item__strikeout'
         )
         strikeoutDom.onclick = function () {
-          console.log('strikeout')
+          // console.log('strikeout')
           instance.command.executeStrikeout()
         }
 
@@ -895,7 +894,7 @@ export default {
         )
         superscriptDom.title = `上标(${this.isApple ? '⌘' : 'Ctrl'}+Shift+,)`
         superscriptDom.onclick = function () {
-          console.log('superscript')
+          // console.log('superscript')
           instance.command.executeSuperscript()
         }
 
@@ -904,7 +903,7 @@ export default {
         )
         subscriptDom.title = `下标(${this.isApple ? '⌘' : 'Ctrl'}+Shift+.)`
         subscriptDom.onclick = function () {
-          console.log('subscript')
+          // console.log('subscript')
           instance.command.executeSubscript()
         }
 
@@ -915,7 +914,7 @@ export default {
         const colorDom = document.querySelector('.menu-item__color')
         const colorSpanDom = colorDom.querySelector('span')
         colorDom.onclick = function () {
-          console.log('color')
+          // console.log('color')
           colorControlDom.click()
         }
 
@@ -929,7 +928,7 @@ export default {
         )
         const highlightSpanDom = highlightDom.querySelector('span')
         highlightDom.onclick = function () {
-          console.log('highlight')
+          // console.log('highlight')
           highlightControlDom?.click()
         }
 
@@ -941,7 +940,7 @@ export default {
         })
 
         titleDom.onclick = function () {
-          console.log('title')
+          // console.log('title')
           titleOptionDom.classList.toggle('visible')
         }
         titleOptionDom.onclick = function (evt) {
@@ -953,7 +952,7 @@ export default {
         const leftDom = document.querySelector('.menu-item__left')
         leftDom.title = `左对齐(${this.isApple ? '⌘' : 'Ctrl'}+L)`
         leftDom.onclick = function () {
-          console.log('left')
+          // console.log('left')
           instance.command.executeRowFlex(RowFlex.LEFT)
         }
 
@@ -961,14 +960,14 @@ export default {
           document.querySelector('.menu-item__center')
         centerDom.title = `居中对齐(${this.isApple ? '⌘' : 'Ctrl'}+E)`
         centerDom.onclick = function () {
-          console.log('center')
+          // console.log('center')
           instance.command.executeRowFlex(RowFlex.CENTER)
         }
 
         const rightDom = document.querySelector('.menu-item__right')
         rightDom.title = `右对齐(${this.isApple ? '⌘' : 'Ctrl'}+R)`
         rightDom.onclick = function () {
-          console.log('right')
+          // console.log('right')
           instance.command.executeRowFlex(RowFlex.RIGHT)
         }
 
@@ -977,7 +976,7 @@ export default {
         )
         alignmentDom.title = `两端对齐(${this.isApple ? '⌘' : 'Ctrl'}+J)`
         alignmentDom.onclick = function () {
-          console.log('alignment')
+          // console.log('alignment')
           instance.command.executeRowFlex(RowFlex.ALIGNMENT)
         }
 
@@ -986,7 +985,7 @@ export default {
         )
         const rowOptionDom = rowMarginDom.querySelector('.options')
         rowMarginDom.onclick = function () {
-          console.log('row-margin')
+          // console.log('row-margin')
           rowOptionDom.classList.toggle('visible')
         }
         rowOptionDom.onclick = function (evt) {
@@ -998,7 +997,7 @@ export default {
         listDom.title = `列表(${this.isApple ? '⌘' : 'Ctrl'}+Shift+U)`
         const listOptionDom = listDom.querySelector('.options')
         listDom.onclick = function () {
-          console.log('list')
+          // console.log('list')
           listOptionDom.classList.toggle('visible')
         }
         listOptionDom.onclick = function (evt) {
@@ -1054,7 +1053,7 @@ export default {
     tablePanelContainer.style.display = 'none'
   }
   tableDom.onclick = function () {
-    console.log('table')
+    // console.log('table')
     tablePanelContainer.style.display = 'block'
   }
   tablePanel.onmousemove = function (evt) {
@@ -1159,7 +1158,7 @@ export default {
   const separatorOptionDom =
     separatorDom.querySelector('.options')
   separatorDom.onclick = function () {
-    console.log('separator')
+    // console.log('separator')
     separatorOptionDom.classList.toggle('visible')
   }
   separatorOptionDom.onmousedown = function (evt) {
@@ -1179,7 +1178,7 @@ export default {
     '.menu-item__page-break'
   )
   pageBreakDom.onclick = function () {
-    console.log('pageBreak')
+    // console.log('pageBreak')
     instance.command.executePageBreak()
   }
 
@@ -1445,7 +1444,7 @@ export default {
     '.menu-item__checkbox'
   )
   checkboxDom.onclick = function () {
-    console.log('checkbox')
+    // console.log('checkbox')
     instance.command.executeInsertElementList([
       {
         type: ElementType.CHECKBOX,
@@ -1486,7 +1485,7 @@ export default {
   const dateDom = document.querySelector('.menu-item__date')
   const dateDomOptionDom = dateDom.querySelector('.options')
   dateDom.onclick = function () {
-    console.log('date')
+    // console.log('date')
     dateDomOptionDom.classList.toggle('visible')
     // 定位调整
     const bodyRect = document.body.getBoundingClientRect()
@@ -1633,7 +1632,7 @@ export default {
     }
   }
   searchDom.onclick = function () {
-    console.log('search')
+    // console.log('search')
     searchCollapseDom.style.display = 'block'
     const bodyRect = document.body.getBoundingClientRect()
     const searchRect = searchDom.getBoundingClientRect()
@@ -1686,7 +1685,7 @@ export default {
   const printDom = document.querySelector('.menu-item__print')
   printDom.title = `打印(${isApple ? '⌘' : 'Ctrl'}+P)`
   printDom.onclick = function () {
-    console.log('print')
+    // console.log('print')
     instance.command.executePrint()
   }
 
@@ -1760,19 +1759,19 @@ export default {
 
   document.querySelector('.page-scale-percentage').onclick =
     function () {
-      console.log('page-scale-recovery')
+      // console.log('page-scale-recovery')
       instance.command.executePageScaleRecovery()
     }
 
   document.querySelector('.page-scale-minus').onclick =
     function () {
-      console.log('page-scale-minus')
+      // console.log('page-scale-minus')
       instance.command.executePageScaleMinus()
     }
 
   document.querySelector('.page-scale-add').onclick =
     function () {
-      console.log('page-scale-add')
+      // console.log('page-scale-add')
       instance.command.executePageScaleAdd()
     }
 
@@ -1888,7 +1887,7 @@ export default {
     fullscreenDom.classList.toggle('exist')
   })
   function toggleFullscreen() {
-    console.log('fullscreen')
+    // console.log('fullscreen')
     if (!document.fullscreenElement) {
       document.documentElement.requestFullscreen()
     } else {
@@ -1945,7 +1944,7 @@ export default {
     // 设置模式
     const { name, mode } = modeList[modeIndex]
     modeElement.innerText = name
-    console.log(1212, name)
+    // console.log(1212, name)
     instance.command.executeMode(mode)
     // 设置菜单栏权限视觉反馈
     const isReadonly = mode === EditorMode.READONLY

File diff suppressed because it is too large
+ 458 - 13
src/views/components/editor/index.vue