Эх сурвалжийг харах

表格的标题更新后保存

Karsa 8 сар өмнө
parent
commit
9ec5153829

+ 12 - 0
src/utils/common.js

@@ -355,4 +355,16 @@ export const waitRequestReturn=(flag,callBack,timeout)=>{
   }else{
     callBack()
   }
+}
+
+/* 获取url的query */
+export function GetQueryString(url) {
+  let urlStr=url.split('?')[1]
+  let obj={}
+  let paramsArr=urlStr.split('&')
+  for (let index = 0; index < paramsArr.length; index++) {
+      let arr=paramsArr[index].split('=')
+      obj[arr[0]]=arr[1]
+  }
+  return obj
 }

+ 1 - 0
src/views/report_manage/reportV2/components/reportEditHeader.vue

@@ -137,6 +137,7 @@ export default {
     .action-list{
         display: flex;
         align-items: center;
+        flex-shrink: 0;
         .action-item{
             height: 36px;
             display: flex;

+ 10 - 5
src/views/report_manage/reportV2/smartReport/editReport.vue

@@ -304,6 +304,7 @@ import ImgSource from './components/ImgSource.vue'
 import editHeader from '../components/reportEditHeader.vue';
 import chapterWrapper from '../components/chapterEditWrapper.vue';
 import smartReportDetail from './reportDetail.vue'
+import { GetQueryString } from '@/utils/common'
 export default {
     mixins:[reportApproveConfig],
     name:"smartReportEditV2",
@@ -467,7 +468,7 @@ export default {
 				ReportChapterId: this.reportInfo.ReportChapterId,
 				// Title: this.reportInfo.Title,
 				Content: htmlStr,
-                ContentStruct:JSON.stringify(this.conList),
+                ContentStruct:this.formatContentListElData(),
 			})
 			if(res.Ret !== 200) return 
 
@@ -512,17 +513,22 @@ export default {
 
         /* 表格标题可修改,保存时获取每个sheet最新的title存进conList */
         formatContentListElData() {
-            console.log(this.conList)
             let newList = this.conList.map(_ => {
                 if(_.compId===4) {
+                    let params = GetQueryString(_.content);
+                    let titleText = $(`.title_iframe${params.code}`)?$(`.title_iframe${params.code}`)[0].innerText:'';
                     return {
                         ..._,
-                        // titleText: 
+                        titleText
                     }
                 }else {
                     return _
                 }
             })
+            
+            // console.log(newList)
+            this.contentChange = JSON.stringify(newList)===JSON.stringify(this.conList) ? this.contentChange : true;
+            return JSON.stringify(newList)
         },
 
         handleCheckClassifyNameArr(arr) {
@@ -1113,11 +1119,10 @@ export default {
                 const id=this.$route.query.id||0
                 if(!id) return
                 
-                this.formatContentListElData()
                 autosave({
                     ReportId: Number(this.$route.query.id),
                     Content:html,
-                    ContentStruct:JSON.stringify(this.conList),
+                    ContentStruct:this.formatContentListElData(),
                     NoChange:this.contentChange?2:1,
                     HeadImg:this.headImg,
                     EndImg:this.endImg,