Przeglądaj źródła

Merge branch 'master' of http://8.136.199.33:3000/eta_front/eta_front

Karsa 6 miesięcy temu
rodzic
commit
602bbd0ce4

+ 1 - 1
src/views/report_manage/editreportNew.vue

@@ -731,7 +731,7 @@ export default {
 		},
 		publishreport(id,code) {
 			//发布报告
-			reportpublish({ ReportIds: String(id) ,ReportCode:this.generatePdfLinks(code)}).then((res) => {
+			reportpublish({ ReportIds: String(id) ,ReportUrl:this.generatePdfLinks(code)}).then((res) => {
 				if (res.Ret == 200) {
 					this.isPublishloading = false;
 					this.$router.push({ path: '/reportlist' });

+ 3 - 3
src/views/report_manage/reportEn/reportEditor.vue

@@ -703,7 +703,7 @@ export default {
 						content: data.Content,
             overview:data.Overview||''
 					};
-					this.publishReportCode=res.Data.ReportCode
+
 					// 回显定时发布时间
 					if(data.PrePublishTime){
 						this.taskTime=data.PrePublishTime
@@ -778,7 +778,7 @@ export default {
 
 				this.$message.success(res.Msg);
         this.report_id = res.Data.ReportId;
-
+				this.publishReportCode = res.Data.ReportCode;
 				if (tp === "yl") {
 					let { href } = this.$router.resolve({
 						name: "预览报告",
@@ -823,7 +823,7 @@ export default {
 			})
 		},
 
-		publishreport(id,code) {
+		publishreport(id) {
 			//发布报告
 			reportEnInterface.reportPublish({ ReportIds: String(id),ReportUrl:this.generatePdfLinks(this.publishReportCode)}).then((res) => {
 				if (res.Ret !== 200) return

+ 0 - 1
src/views/report_manage/reportEn/reportlist.vue

@@ -762,7 +762,6 @@ export default {
     /* 发布报告 */
     publishReport(item) {
       this.$confirm(item.PrePublishTime? this.$t('ReportManage.smart_msg.is_publish_immediately'):this.$t('ReportManage.smart_msg.report_publish_immediately'),this.$t('Confirm.prompt'),{type: 'warning'}).then(()=>{
-
 				reportEnInterface.reportPublish({ReportIds:String(item.Id),ReportUrl:this.generatePdfLinks(item.ReportCode)}).then(res=>{
           if(res.Ret!==200) return
           this.$message.success(this.$t('MsgPrompt.publish_msg'));

+ 11 - 5
src/views/smartReport/editReport.vue

@@ -74,11 +74,11 @@
                             <div class="del-btn" @click.stop="deleteLayoutPic(1)"></div>
                         </div>
                         <img :src="headImg" alt="" style="display:block;width:100%">
-                        <div class="head-layout-item" v-for="item in headImgStyle" :key="item.label"
+                        <div class="head-layout-item" v-for="item in headImgStyle" :key="item.value"
                         :style="{fontFamily:item.family,fontSize:(item.size*2)+'px',fontWeight:item.weight,textAlign:item.align,color:item.color,
                             width:item.width,height:item.height,left:item.left,top:item.top
                         }">
-                            {{ layoutBaseInfo[item.label] }}
+                            {{ layoutBaseInfo[item.value] }}
                         </div>
                     </div>
                     <draggable
@@ -160,11 +160,11 @@
                             <div class="del-btn" @click.stop="endImg=''"></div>
                         </div>
                         <img :src="endImg" alt="" style="display:block;width:100%">
-                        <div class="head-layout-item" v-for="item in endImgStyle" :key="item.label"
+                        <div class="head-layout-item" v-for="item in endImgStyle" :key="item.value"
                         :style="{fontFamily:item.family,fontSize:(item.size*2)+'px',fontWeight:item.weight,textAlign:item.align,color:item.color,
                             width:item.width,height:item.height,left:item.left,top:item.top
                         }">
-                            {{ layoutBaseInfo[item.label] }}
+                            {{ layoutBaseInfo[item.value] }}
                         </div>
                     </div>
                 </div>
@@ -830,10 +830,16 @@ export default {
                     this.endImg=res.Data.EndImg
                     this.headImgId=res.Data.HeadResourceId
                     this.endImgId=res.Data.EndResourceId
+
                     this.headImgStyle=res.Data.HeadStyle?JSON.parse(res.Data.HeadStyle):[]
+                    this.headImgStyle.map(st =>{
+                        st.value=st.value || st.label
+                    })
                     this.endImgStyle=res.Data.EndStyle?JSON.parse(res.Data.EndStyle):[]
+                    this.endImgStyle.map(st =>{
+                        st.value=st.value || st.label
+                    })
                     this.bgColor=res.Data.CanvasColor
-
                     this.layoutBaseInfo['研报标题']=res.Data.Title
                     this.layoutBaseInfo['研报作者']=res.Data.Author
                     this.layoutBaseInfo['创建时间']=res.Data.CreateTime

+ 10 - 4
src/views/smartReport/reportDetail.vue

@@ -10,11 +10,11 @@
             </div> -->
             <div class="html-head-img-box" v-if="reportInfo && !!reportInfo.NeedSplice && reportInfo.HeadImg">
                 <img :src="reportInfo.HeadImg" alt="" style="display:block;width:100%">
-                <div class="head-layout-item" v-for="item in headImgStyle" :key="item.label"
+                <div class="head-layout-item" v-for="item in headImgStyle" :key="item.value"
                 :style="{fontFamily:item.family,fontSize:(item.size*2)+'px',fontWeight:item.weight,textAlign:item.align,color:item.color,
                     width:item.width,height:item.height,left:item.left,top:item.top
                 }">
-                    {{ layoutBaseInfo[item.label] }}
+                    {{ layoutBaseInfo[item.value] }}
                 </div>
             </div>
             <!-- 无版头版尾 -->
@@ -31,11 +31,11 @@
             <div class="html-wrap" v-html="content"></div>
             <div class="html-end-img-box" v-if="reportInfo && !!reportInfo.NeedSplice && reportInfo.EndImg">
                 <img :src="reportInfo.EndImg" alt="" style="display:block;width:100%">
-                <div class="head-layout-item" v-for="item in endImgStyle" :key="item.label"
+                <div class="head-layout-item" v-for="item in endImgStyle" :key="item.value"
                 :style="{fontFamily:item.family,fontSize:(item.size*2)+'px',fontWeight:item.weight,textAlign:item.align,color:item.color,
                     width:item.width,height:item.height,left:item.left,top:item.top
                 }">
-                    {{ layoutBaseInfo[item.label] }}
+                    {{ layoutBaseInfo[item.value] }}
                 </div>
             </div> 
         </div>
@@ -143,7 +143,13 @@ export default {
                 if(res.Ret===200){
                     this.reportInfo=res.Data || {}
                     this.headImgStyle=this.reportInfo.HeadStyle?JSON.parse(this.reportInfo.HeadStyle):[]
+                    this.headImgStyle.map(st =>{
+                        st.value=st.value || st.label
+                    })
                     this.endImgStyle=this.reportInfo.EndStyle?JSON.parse(this.reportInfo.EndStyle):[]
+                    this.endImgStyle.map(st =>{
+                        st.value=st.value || st.label
+                    })
                     this.layoutBaseInfo['研报标题']=this.reportInfo.Title
                     this.layoutBaseInfo['研报作者']=this.reportInfo.Author
                     this.layoutBaseInfo['创建时间']=this.reportInfo.CreateTime

+ 42 - 33
src/views/system_manage/components/smartReportImgSet.vue

@@ -122,25 +122,23 @@
                     </el-form-item>
                 </template>
                 <template v-else>
-                    <draggable tag="div" class="layout-options" :sort="false" :list="layoutOptions" 
-                    :group="{ name: 'option', pull: 'clone', put: false }">
-                        <div class="option-item" v-for="item in layoutOptions" :key="item.label">
+                    <draggable tag="div" class="layout-options" :sort="false" :list="layoutOptions" @start="dropStart">
+                        <div class="option-item" v-for="item in layoutOptions" :key="item.value">
                             <div class="option-item-title">{{ item.label }}</div>
                             <img src="~@/assets/img/icons/layout-option-icon.png" class="option-item-icon" />
                         </div>
                     </draggable>
-                    <draggable class="layout-background" ghostClass="ghost-class" forceFallback handle=".cannomove"
-                    tag="div" animation="300" :group="{ name: 'component1', pull: false, put: true }" 
-                    @add="handleAddOption">
+                    <div class="layout-background" @dragover.prevent @drop="handleAddOption">
                         <img :src="formData.imgUrl" class="layout-image" ref="layoutImage" />
                         <vue-drag-resize :parentLimitation="true" :sticks="['bl','br']" :minw="10" :minh="10"
-                        :w="item.width" :h="item.height" @resizestop="(p)=>resizeStop(p,item.label)" @dragstop="(p)=>dragStop(p,item.label)"
-                        v-for="item in layoutItems" :key="item.label" :x="item.x" :y="item.y" :z="item.z" @clicked="()=>optionClick(item)">
+                        :w="item.width" :h="item.height" @resizestop="(p)=>resizeStop(p,item.value)" @dragstop="(p)=>dragStop(p,item.value)"
+                        v-for="item in layoutItems" :key="item.value" :x="item.x" :y="item.y" :z="item.z" @clicked="()=>optionClick(item)">
                             <div class="layout-item" @contextmenu.prevent="(e)=>rightClick(e,item)" @blur="blur" tabindex="-1"
                             :style="{fontFamily:item.family,fontSize:item.size+'px',fontWeight:item.weight,textAlign:item.align,color:item.color}">{{ item.label }}</div>
                         </vue-drag-resize>
                         <div
                         class="right-mouse-menu"
+                        ref="rightMenuRef"
                         v-if="rightMouseMenu.show"
                         :style="{
                             left: rightMouseMenu.left,
@@ -149,7 +147,7 @@
                         >
                             <div class="item" @click="optionDel" style="color: #AD352F;">{{$t('Table.delete_btn')}}</div>
                         </div>
-                    </draggable>
+                    </div>
                     <div class="layout-font">
                         <div class="layout-font-title">{{$t('SystemManage.BaseConfig.text_style')}}</div>
                         <div class="layout-font-options">
@@ -217,9 +215,9 @@ export default {
             },
             step:1,
             steps:[this.$t('SystemManage.BaseConfig.select_layout'),this.$t('SystemManage.BaseConfig.edit_layout')],
-            layoutOptions:[{label:this.$t('SystemManage.BaseConfig.report_title')},//研报标题
-                            {label:this.$t('SystemManage.BaseConfig.report_author')},//研报作者
-                            {label:this.$t('SystemManage.BaseConfig.report_creation_time')}],//创建时间
+            layoutOptions:[{value:'研报标题',label:this.$t('SystemManage.BaseConfig.report_title')},//研报标题
+                            {value:'研报作者',label:this.$t('SystemManage.BaseConfig.report_author')},//研报作者
+                            {value:'创建时间',label:this.$t('SystemManage.BaseConfig.report_creation_time')}],//创建时间
             layoutItems:[],
             // currentLayout:{},
             layoutFont:{
@@ -233,8 +231,9 @@ export default {
                 show: false,
                 left: '99999px',
                 top: '99999px',
-                label: '',
+                value: '',
             },
+            dragIndex:0,
             layoutFontF:['Arial','Georgia','Impact','Tahoma','Times New Roman','Verdana','思源宋体','思源黑体'],
             layoutFontS:['12','13','14','15','16','18','20','24','28','32','36','40'],
             layoutFontW:[{value:'normal',label:this.$t('SystemManage.BaseConfig.style_font_w_normal')},
@@ -330,6 +329,7 @@ export default {
                     let backgroundGHeight = this.$refs.layoutImage.height
                     let layoutStr = this.layoutItems.map(item =>{
                         return {
+                            value:item.value,
                             label:item.label,
                             left:item.x/backgroundWidth*100+'%',
                             top:item.y/backgroundGHeight*100+'%',
@@ -374,7 +374,10 @@ export default {
                 }
             })
         },
-
+        convertLabel(value){
+            let row = this.layoutOptions.find(it => it.value==value)
+            return row?row.label:value
+        },
         handleCloseImgUpload(){
             this.uploadImgPop=false
         },
@@ -397,7 +400,7 @@ export default {
                 show: false,
                 left: '99999px',
                 top: '99999px',
-                label: '',
+                value: '',
             },
             this.$nextTick(()=>{
                 this.$refs.ruleForm.clearValidate()
@@ -474,9 +477,10 @@ export default {
                 let backgroundWidth = this.$refs.layoutImage?this.$refs.layoutImage.width:400
                 let backgroundGHeight = this.$refs.layoutImage?this.$refs.layoutImage.height:100
                 try {
-                    this.layoutItems=JSON.parse(this.formData.layout).map(it =>{
+                    this.layoutItems=this.formData.layout?JSON.parse(this.formData.layout).map(it =>{
                         return {
-                            label:it.label,
+                            value:it.value || it.label,
+                            label:this.convertLabel(it.value || it.label),
                             x:this.percent2Number(it.left,backgroundWidth),
                             y:this.percent2Number(it.top,backgroundGHeight),
                             z:1,
@@ -488,9 +492,9 @@ export default {
                             align:it.align,
                             color:it.color,
                         }
-                    })
+                    }):[]
                 } catch (error) {
-                    // console.log(error,'error');
+                    console.log(error,'error');
                     this.layoutItems=[]
                 }
                 // console.log(this.layoutItems,'this.layoutItems');
@@ -501,18 +505,22 @@ export default {
             let decimals = (+per.substring(0,per.length-1))/100
             return entirety*decimals
         },
+        dropStart(e){
+            this.dragIndex = e.oldIndex
+        },
         handleAddOption(e){
-            let options = this.layoutOptions[e.oldIndex]
-            let layoutItem = this.layoutItems.find(it => it.label == options.label)
+            let options = this.layoutOptions[this.dragIndex]
+            let layoutItem = this.layoutItems.find(it => it.value == options.value)
             if(layoutItem){
                 layoutItem.z = Math.max(...this.layoutItems.map(t => t.z))+1
-                this.$message.warning(`已添加${options.label}!`)
+                this.$message.warning(this.$i18nt.locale==='zh'?`已添加${options.label}!`:`${options.label} already added!`)
                 return
             }
             this.layoutItems.push({
+                value:options.value,
                 label:options.label,
-                x:e.originalEvent.layerX,
-                y:e.originalEvent.layerY,
+                x:e.layerX,
+                y:e.layerY,
                 z:1,
                 width:120,
                 height:20,
@@ -523,14 +531,14 @@ export default {
                 color:'#333333'
             })
         },
-        resizeStop({width,height},label){
-            let item = this.layoutItems.find(it => it.label==label)
+        resizeStop({width,height},value){
+            let item = this.layoutItems.find(it => it.value==value)
             if(!item) return 
             item.width=width
             item.height=height
         },
-        dragStop({left,top},label){
-            let item = this.layoutItems.find(it => it.label==label)
+        dragStop({left,top},value){
+            let item = this.layoutItems.find(it => it.value==value)
             if(!item) return 
             item.x=left
             item.y=top
@@ -539,20 +547,21 @@ export default {
             this.layoutFont = op
         },
         rightClick(e,item){
-            e.target.focus()
             clearTimeout(this.rigtMenuHideTimer)
             this.rightMouseMenu.left = e.clientX + "px";
             this.rightMouseMenu.top = e.clientY + "px";
-            this.rightMouseMenu.label = item.label;
+            this.rightMouseMenu.value = item.value;
             this.rightMouseMenu.show = true;
         },
         optionDel(){
-            this.layoutItems=this.layoutItems.filter(it => it.label!=this.rightMouseMenu.label)
+            this.layoutItems=this.layoutItems.filter(it => it.value!=this.rightMouseMenu.value)
+            this.rightMouseMenu.show=false
         },
         blur(){
-            this.rigtMenuHideTimer=setTimeout(()=>{
+            this.$refs.rightMenuRef.style.opacity=0
+            setTimeout(()=>{
                 this.rightMouseMenu.show=false
-            },80)
+            },300)
         }
     },
 }