Procházet zdrojové kódy

版图设置,分类列表改动

Karsa před 11 měsíci
rodič
revize
33fd25a6e2

+ 18 - 0
src/api/modules/reportV2.js

@@ -78,6 +78,24 @@ export const reportV2Interface = {
 	 */
 	checkChaterPublishState: params => {
 		return http.get('/report/chapter/un_publish/list',params)
+	},
+
+	/**
+	 * 设置版图
+	 * @param {*ReportId HeadImg HeadResourceId EndImg EndResourceId CanvasColor} params 
+	 * @returns 
+	 */
+	setReportLayoutImg: params => {
+		return http.post('/report/layout_img/edit',params)
+	},
+
+	/**
+	 * 获取分类关联的品种列表
+	 * @param {*ClassifyId} params 
+	 * @returns 
+	 */
+	getClassifyPermissionList: params => {
+		return	http.get('/classify/permission/list',params)
 	}
 
 }

+ 12 - 2
src/lang/modules/ReportManagement/ReportList.js

@@ -159,7 +159,12 @@ export const ReportListEn = {
   report_empty_msg:'Please input the report content',
   img_set_btn: 'Layout Settings',
   no_chapter_msg:'No section information available',
-  chapter_nosubmit_msg:'{name},the content of the section has not been submitted'
+  chapter_nosubmit_msg:'{name},the content of the section has not been submitted',
+
+  choose_head_img:'Select Header',
+  choose_end_img:'Select Footer',
+  canvas_set:'Canvas Settings',
+  choose_layout_img:'Select Layout'
 };
 
 /* 中文 */
@@ -319,5 +324,10 @@ export const ReportListZh = {
   report_empty_msg:'请输入报告内容',
   img_set_btn: '版图设置',
   no_chapter_msg:'暂无章节信息',
-  chapter_nosubmit_msg:'{name}章节内容未提交'
+  chapter_nosubmit_msg:'{name}章节内容未提交',
+
+  choose_head_img:'选择版头',
+  choose_end_img:'选择版尾',
+  canvas_set:'画布设置',
+  choose_layout_img:'选择版图'
 };

+ 26 - 12
src/views/classify_manage/chapterSettingV2.vue

@@ -65,7 +65,7 @@
                 </el-form-item>
                 <!-- 上级分类 -->
                 <el-form-item :label="$t('ReportManage.CategoryList.parent_category')">
-                    <el-input  disabled :value="researchType=='day'?'晨报':'周报'" style="width: 317px;" 
+                    <el-input  disabled :value="parentClassifyName" style="width: 317px;" 
                     :placeholder="$t('ReportManage.CategoryList.related_variety_inputhint')"></el-input>
                 </el-form-item>
                 <!-- 关联品种 -->
@@ -79,6 +79,7 @@
                         </el-tooltip>
                     </template>
                     <el-cascader
+                        v-if="reportVarietyList.length"
                         :options="reportVarietyList" 
                         v-model="addForm.ChartPermissionIdList" 
                         :placeholder="$t('ReportManage.CategoryList.related_variety_inputhint')"
@@ -104,15 +105,12 @@ import { getchapterTypeList,addChapterType,editChapterType,} from 'api/api.js';
 import {setChapterEnable,setChapterSort} from '@/api/modules/oldApi.js'
 import {reportVarietyInterence} from '@/api/modules/reportVariety'
 import {classifyPermissionInterface} from '@/api/modules/classifyApi.js'
+import { reportV2Interface } from '@/api/modules/reportV2.js'
 export default {
     name:"chapterSetting",
     components:{mDialog},
     beforeRouteEnter(to, from, next) {
-        if(to.query.reportType=='day'){
-            to.matched[1].name='晨报章节设置'
-        }else{
-            to.matched[1].name='周报章节设置'
-        }
+        to.matched[1].name='章节设置'
         next()
     },
     data() {
@@ -123,23 +121,23 @@ export default {
             addDialogShow:false,
             addForm:{
                 ReportChapterTypeName:"",
-                ResearchType:"",
+                // ResearchType:"",.
                 ChartPermissionIdList:''
             },
             researchType:'',// day-晨报;week-周报
+            parentClassifyName: '',
 
             reportVarietyList:[],//中文品种列表
         }
     },
     mounted(){
-        // 类型 周报-晨报
-        this.addForm.ResearchType=this.researchType=this.$route.query.reportType=='week'?'week':'day'
+        this.parentClassifyName = this.$route.query.classifyName || ''
         this.getList()
         this.getReportVarietyList()
     },
     methods: {
         getList(type){
-            getchapterTypeList({ReportType:this.researchType}).then(res=>{
+            getchapterTypeList({ClassifyId:Number(this.$route.query.id)}).then(res=>{
                 if(res.Ret == 200){
                     this.list=res.Data.List || []
                 }
@@ -171,7 +169,11 @@ export default {
         this.$refs.addForm.validate((valid)=>{
           if(valid){
             // 添加小程序是否显示参数 0显示,1隐藏
-            let params={...this.addForm,ChartPermissionIdList:this.addForm.ChartPermissionIdList||[]}
+            let params={
+                ...this.addForm,
+                ClassifyId: Number(this.$route.query.id),
+                ChartPermissionIdList:this.addForm.ChartPermissionIdList||[]
+            }
             // 请求方法
             let requestMethod;
             // console.log(params);
@@ -197,12 +199,24 @@ export default {
         })
       },
 
+
+        filterNodes(arr) {
+            arr.length && arr.forEach(item => {
+                item.Child && item.Child.length && this.filterNodes(item.Child)
+                if((item.Child && !item.Child.length)) {
+                    delete item.Child
+                }
+            })
+        },
         
 
         // 获取品种数据
         getReportVarietyList(){
-            reportVarietyInterence.filterVarietyOpts().then(res=>{
+            reportV2Interface.getClassifyPermissionList({
+                ClassifyId: Number(this.$route.query.id),
+            }).then(res=>{
                 this.reportVarietyList=res.Data||[]
+                this.filterNodes(this.reportVarietyList)
             })
         },
 

+ 61 - 29
src/views/classify_manage/classifylistV2.vue

@@ -14,7 +14,7 @@
                 </div>
             </div>
             <div style="display:flex;padding:10px;gap:10px">
-                <el-button type="primary" @click="transferReport">分类报告转移</el-button>
+                <!-- <el-button type="primary" @click="transferReport">分类报告转移</el-button> -->
                 <!-- 添加分类 -->
                 <el-button 
                     type="primary"
@@ -59,7 +59,7 @@
                     <div class="opt-box">
                         <!-- 章节设置 -->
                         <span class="editsty" 
-                            v-if="!data.Child" 
+                            v-if="!data.Child || (data.Child&&!data.Child.length)" 
                             @click="chapterSetting(data)" 
                             v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_chapterSetting">
                             {{ $t('ReportManage.CategoryList.section_settings') }}
@@ -96,14 +96,27 @@
                     </el-form-item>
                     <!-- 上级分类 -->
                     <el-form-item prop="parent_id" :label="$t('ReportManage.CategoryList.parent_category')">
-                        <el-select v-model="classifyForm.parent_id" 
-                            :placeholder="$t('ReportManage.CategoryList.related_variety_inputhint')" style="width:400px;">
-                            <el-option :label="$t('ReportManage.CategoryList.parent_none')" :value="0"></el-option>
-                            <el-option v-for="(item,index) in classifyparentArr" :key="index" :label="item.ClassifyName" :value="item.Id"></el-option>
-                        </el-select>
+
+                        <el-cascader
+                            v-model="classifyForm.parent_id" 
+                            :options="classifyparentArr"
+                            :disabled="classifyForm.classify_id"
+                            style="width:400px;"
+                            ref="classifyRef"
+                            :props="{ 
+                                checkStrictly: true,
+                                value: 'Id',
+                                label: 'ClassifyName',
+                                children:'Child',
+                                emitPath:false
+                            }"
+                            clearable
+                            @change="changeClassify"
+                        >
+                        </el-cascader>
                     </el-form-item>
                     <!-- 关联品种 -->
-                    <el-form-item prop="variety" :label="$t('ReportManage.CategoryList.related_variety')" v-if="classifyForm.parent_id&&permissionBtn.classifyBtn.classifyList_cnClassify_connect_variety">
+                    <el-form-item prop="variety" :label="$t('ReportManage.CategoryList.related_variety')" v-if="canSetPermission">
                         <template slot="label">
                             <el-tooltip class="item" effect="dark" :content="$t('ReportManage.CategoryList.related_variety_hint')">
                                 <div>
@@ -196,8 +209,21 @@ import mDialog from '@/components/mDialog.vue';
 import { classifylist,classifyparent,classifyadd,classifyedit } from 'api/api.js';
 import {reportVarietyInterence} from '@/api/modules/reportVariety'
 import {classifyPermissionInterface} from '@/api/modules/classifyApi.js'
+import { reportV2Interface } from '@/api/modules/reportV2.js'
 export default {
     components:{mDialog},
+    computed: {
+        canSetPermission() {
+            /* 编辑最小级分类可设置品种 新增分类可设置跑品种 */
+            if(!this.permissionBtn.classifyBtn.classifyList_cnClassify_connect_variety) return false
+            
+            if(this.classifyForm.classify_id) {
+                return this.classifyForm.isLastLevel?true:false
+            }else {
+                return true
+            }
+        }
+    },
     data() {
         return {
             typeVal:1,
@@ -249,26 +275,39 @@ export default {
             })
             if(res.Ret===200){
                 this.list=res.Data.List||[]
+                
+                this.classifyparentArr=_.cloneDeep(this.list)
+                this.filterNodes(this.classifyparentArr)
+            }
+        },
+
+        /* 添加分类默认关联父级品种 */
+        async changeClassify(id) {
+            if(!this.classifyForm.classify_id) {
+                let item = this.$refs.classifyRef.getCheckedNodes(true)
+                console.log(item)
+                if(item&&item.length) {
+                    this.classifyForm.variety = item[0].data.ChartPermissionIdList
+                }
             }
         },
 
-        // 晨报周报 去设置章节
+        // 去设置章节
 		chapterSetting(row){
-			let reportType;
-			if(row.ClassifyName=='周报'){
-				reportType='week'
-			}else{
-				reportType='day'
-			}
-			this.$router.push({path:'chapterSetting',query:{reportType}})
+			this.$router.push({path:'chapterSetting',query:{ id:row.Id,classifyName: row.ClassifyName }})
 		},
 
+        filterNodes(arr) {
+            arr.length && arr.forEach(item => {
+                item.Child && item.Child.length && this.filterNodes(item.Child)
+                if(!item.Child || (item.Child&&!item.Child.length)  || item.Level===2) {
+                    delete item.Child
+                }
+            })
+        },
+
         async addClassify(){
-            this.classifyparentArr=[];
-            const res=await classifyparent()
-            if(res.Ret===200){
-                this.classifyparentArr=res.Data||[]
-            }
+
             this.classifyForm={
                 show:true,
                 classify_id:0,
@@ -278,14 +317,6 @@ export default {
             }
         },
         async handleEdit(item){
-            this.classifyparentArr=[];
-            const res=await classifyparent()
-            if(res.Ret===200){
-                // 编辑的是子分类或者没有子分类的才能选择上级分类
-                if(!item.Child){
-                    this.classifyparentArr=res.Data||[]
-                }
-            }
             
             this.classifyForm={
                 show:true,
@@ -293,6 +324,7 @@ export default {
                 classify_name:item.ClassifyName,
                 parent_id: item.ParentId,
                 variety:item.ChartPermissionIdList||'',//关联的品种
+                isLastLevel: !item.Child
             }
         },
         async setClassifyHandle(){

+ 41 - 7
src/views/report_manage/reportV2/components/chapterEditWrapper.vue

@@ -4,7 +4,7 @@
       <h3>{{reportBase.Title}}</h3>
 
       <ul class="handle-list">
-        <li v-if="reportBase.ReportLayout===2" @click="openTerritorySet">
+        <li v-if="reportBase.ReportLayout===2&&isCreator" @click="openTerritorySet">
           <img src="~@/assets/img/icons/submit_ico.svg" alt="">
           <el-button type="text"><!-- 版图设置 -->{{$t('ReportManage.ReportList.img_set_btn')}}</el-button>
         </li>
@@ -290,12 +290,20 @@
             </div>
         </div>
     </m-dialog>
-  </div>
 
+    <!-- 版图设置弹窗 -->
+    <smartTerritorSet 
+      :isShow.sync="isOpenTerritorDia"
+      :info="reportBase"
+      @change="handleChangeImgSet"
+    />
+
+  </div>
 </template>
 <script>
 import draggable from 'vuedraggable';
 import mDialog from '@/components/mDialog.vue';
+import smartTerritorSet from './smartTerritorSetDia.vue'
 import { chapterTrendTagList } from '@/api/api.js';
 import { 
   dayWeekChapterList,
@@ -305,7 +313,7 @@ import {
   markReport
 } from '@/api/modules/reportV2'
 export default {
-  components: { draggable,mDialog },
+  components: { draggable,mDialog,smartTerritorSet },
   props: {
     isApprove: {
       type: Boolean
@@ -359,7 +367,10 @@ export default {
       tagOptions: [],
 
       /* 上传录音弹窗 */
-      isOpenUploadAudio: false
+      isOpenUploadAudio: false,
+
+      /* 版图设置弹窗 */
+      isOpenTerritorDia: false
     }
   },
   mounted(){
@@ -384,7 +395,30 @@ export default {
 
     /* 版图设置 */
     openTerritorySet() {
+      this.isOpenTerritorDia = true;
+    },
+    /* 版图设置保存 */
+    async handleChangeImgSet(info) {
+      console.log(info)
+      
+      const res = await reportV2Interface.setReportLayoutImg({
+        ReportId: Number(this.$route.query.id),
+        HeadImg: info.headImg,
+        EndImg: info.endImg,
+        HeadResourceId: info.headImgId,
+        EndResourceId: info.endImgId,
+        CanvasColor: info.bgColor,
+      })
 
+      if(res.Ret !== 200) return 
+       
+      this.$message.success(this.$t('MsgPrompt.set_success_msg'))
+      
+      this.reportBase.HeadImg = info.headImg;
+      this.reportBase.EndImg = info.endImg;
+      this.reportBase.HeadResourceId = info.headImgId;
+      this.reportBase.EndResourceId = info.endImgId;
+      this.reportBase.CanvasColor = info.bgColor;
     },
 
 
@@ -718,9 +752,9 @@ export default {
       }
 
       .type-name {
-        background: #000;
-        padding: 2px 10px;
-        color: #FCDDC3;
+        background: #0052D9;
+        padding: 2px 12px;
+        color: #fff;
         border-radius: 10px;
         width: fit-content;
         margin-bottom: 10px;

+ 53 - 9
src/views/report_manage/reportV2/components/reportBaseInfoDia.vue

@@ -42,13 +42,13 @@
             :placeholder="$t('ReportManage.ReportList.please_select_category')"
             size="medium"
             style="width: 400px"
-            @change="handleUpdateBaseInfo"
+            @change="handleChangeClassify"
           />
         </el-form-item>
 
         <el-form-item prop="relationVariety" :label="$t('ReportManage.ReportList.label_relation_variety')" v-if="formData.relationVariety.length">
-          <div>
-            <el-tag v-for="item in formData.relationVariety" :key="item"></el-tag>
+          <div class="permission-wrap">
+            <el-tag v-for="item in formData.relationVariety" :key="item.ChartPermissionId">{{item.ChartPermissionName}}</el-tag>
           </div>
         </el-form-item>
 
@@ -190,6 +190,7 @@
 <script>
 import { apiSmartReport } from "@/api/modules/smartReport";
 import { reportV2Interface,classifylist,reportadd } from '@/api/modules/reportV2.js';
+import { classifyPermissionInterface } from '@/api/api.js';
 import chooseCooperaUserDia from './chooseCooperaUserDia.vue';
 import chooseInherReportDia from './chooseInherReportDia.vue';
 export default {
@@ -235,13 +236,17 @@ export default {
             frequency: this.reportInfo.Frequency,
             time: this.reportInfo.CreateTime,
             cooperationType: this.reportInfo.CollaborateType,//协作方式
-            cooperationUsers: this.reportInfo.GrandAdminList?this.reportInfo.GrandAdminList.map(_ => ({
-              NodeId: _.AdminId,
-              NodeName: _.AdminName
-            })):[],
+            cooperationUsers: this.reportInfo.GrandAdminList
+              ? this.reportInfo.GrandAdminList.map(_ => ({
+                  NodeId: _.AdminId,
+                  NodeName: _.AdminName
+                }))
+              : [],
             reportLayout: this.reportInfo.ReportLayout,//报告布局
             isPublcPublish: this.reportInfo.IsPublicPublish
           }
+
+          this.getRelationPermission()
       }
     },
   },
@@ -394,6 +399,13 @@ export default {
       });
     },
 
+
+    //分类变化 获取关联品种 
+    handleChangeClassify(val) {
+      this.getRelationPermission()
+      this.handleUpdateBaseInfo()
+    },
+
     handleUpdateBaseInfo() {
       this.formData.inheritId = 0;
 
@@ -429,7 +441,7 @@ export default {
     },
 
     /* 选择继承报告 */
-    chooseInheritReport(item) {
+    async chooseInheritReport(item) {
       const { Id,Title,Abstract,Author,CollaborateType,ReportLayout,IsPublicPublish } = item;
 
       this.formData.title = Title;
@@ -439,9 +451,25 @@ export default {
         : "";
       this.formData.cooperationType = CollaborateType;
       this.formData.inheritId = Id;
-      // this.formData.cooperationUsers: [],
       this.formData.reportLayout = ReportLayout;
       this.formData.isPublcPublish = IsPublicPublish;
+      
+      //继承的章节报告默认带出协作人
+      if(CollaborateType===1) {
+        this.formData.cooperationUsers = [];
+      }else {
+        const res = await reportV2Interface.getRportBase({
+          ReportId: Id
+        })
+        if(res.Ret!==200) return
+        
+        this.formData.cooperationUsers = res.Data.GrandAdminList
+          ? res.Data.GrandAdminList.map(_ => ({
+              NodeId: _.AdminId,
+              NodeName: _.AdminName
+            }))
+          : [];
+      }
     },
 
     //选择协作人
@@ -457,6 +485,16 @@ export default {
       this.formData.cooperationUsers.splice(index,1)
     },
 
+    //获取关联品种
+    async getRelationPermission() {
+      if(!this.formData.classify.length) return
+
+      const res = await classifyPermissionInterface.classifyPermissionList({ClassifyId:this.formData.classify[this.formData.classify.length-1]})
+
+        if(res.Ret!==200) return
+        this.formData.relationVariety = res.Data || []
+    },
+
     // 获取选择的分类名称
     getSelectClassifyName() {
       let arr = [];
@@ -543,5 +581,11 @@ export default {
     flex-wrap: wrap;
     gap: 10px;
   }
+  .permission-wrap {
+    width: 80%;
+    display: flex;
+    flex-wrap: wrap;
+    gap: 5px;
+  }
 }
 </style>

+ 132 - 13
src/views/report_manage/reportV2/components/smartTerritorSetDia.vue

@@ -1,23 +1,38 @@
 <template>
   <el-dialog
     v-dialogDrag
-    :title="$t('ReportManage.ReportList.choose_cooper')"
-    width="650px"
+    :title="$t('ReportManage.ReportList.img_set_btn')"
+    width="900px"
     :visible.sync="isShow"
     :modal-append-to-body="false"
+    :close-on-click-modal="false"
     :append-to-body="false"
     @close="closeDia"
   >
     <div class="main">
-      <ul>
+      <ul class="set-ul">
         <li>
-          <label>版图设置</label>
-          
+          <label class="el-form-item__label"><!-- 版图设置 -->{{$t('ReportManage.ReportList.img_set_btn')}}</label>
+          <div class="img-cont">
+
+            <div class="cont-item">
+              <img class="add-cont" :src="layoutInfo.headImg" alt="" v-if="layoutInfo.headImg">
+              <div class="add-cont" v-else @click="defaultType=1;isOpenChooseImg=true">+{{$t('ReportManage.ReportList.choose_head_img')}}<!-- 选择版头 --></div>
+              <i class="el-icon-delete" v-if="layoutInfo.headImg"  @click="layoutInfo.headImg='';layoutInfo.headImgId=0;"></i>
+            </div>
+
+            <div class="cont-item">
+              <img class="add-cont" :src="layoutInfo.endImg" alt="" v-if="layoutInfo.endImg">
+              <div class="add-cont" v-else @click="defaultType=2;isOpenChooseImg=true">+{{$t('ReportManage.ReportList.choose_end_img')}}<!-- 选择版尾 --></div>
+              <i class="el-icon-delete" v-if="layoutInfo.endImg" @click="layoutInfo.endImg='';layoutInfo.endImgId=0;"></i>
+            </div>
+
+          </div>
         </li>
 
         <li>
-          <label for="">画布设置</label>
-          <el-color-picker v-model="bgColor" @change="handleBgColorChange"></el-color-picker>
+          <label class="el-form-item__label"><!-- 画布设置 -->{{$t('ReportManage.ReportList.canvas_set')}}</label>
+          <el-color-picker v-model="layoutInfo.bgColor"></el-color-picker>
         </li>
 
       </ul>
@@ -25,35 +40,139 @@
 
     <div class="dialog-btn">
         <el-button type="primary" plain @click="closeDia">{{$t('Dialog.cancel_btn')}}</el-button>
-        <el-button type="primary" @click="handleSaveChecked">{{$t('Dialog.confirm_btn')}}</el-button>
+        <el-button type="primary" @click="handleSaveSet">{{$t('Dialog.confirm_btn')}}</el-button>
     </div>
 
 
     <!-- 选择版图弹窗 -->
-    <m-dialog>
-      <div>
-        
+    <m-dialog
+      :show.sync="isOpenChooseImg"
+      :title="'选择版图'"
+      width="900px"
+    >
+      <div class="main">
+        <imgSource
+          :inDialog="true"
+          :defaultType="defaultType"
+          @close="isOpenChooseImg=false"
+          @change="handleGetImg"
+        />
       </div>
     </m-dialog>
   </el-dialog>
 </template>
 <script>
 import mDialog from '@/components/mDialog.vue';
+import imgSource from '../smartReport/components/ImgSource.vue'
 export default {
-  components: { mDialog },
+  components: { mDialog,imgSource },
+  props: {
+    isShow: {
+      type: Boolean
+    },
+    info: {
+      type:Object
+    }
+  },
+  watch: {
+    isShow(nval) {
+      if(!nval) return
+
+      this.layoutInfo = {
+        bgColor: this.info.CanvasColor||'',
+        headImg:this.info.HeadImg||'',
+        endImg: this.info.EndImg||'',
+        headImgId: this.info.HeadResourceId||0,
+        endImgId: this.info.EndResourceId||0,
+      }
+    }
+  },
   data() {
     return {
+      layoutInfo: {
+        bgColor: '',
+        headImg:'',//版头图片
+        endImg: '',//版尾图片
+        headImgId: 0,//版头Id
+        endImgId: 0,//版尾Id
+      },
       
+      defaultType: 1,
+      isOpenChooseImg: false,
     }
   },
   mounted(){
 
   },
   methods:{
+    closeDia() {
+      this.$emit('update:isShow',false)
+    },
 
+    /* 保存设置 */
+    handleSaveSet() {
+      this.$emit('change',this.layoutInfo)
+      this.closeDia()
+    },
+    
+    handleGetImg({type,data}) {
+      this.isOpenChooseImg = false;
+      if(type === 1) {
+        this.layoutInfo.headImgId = data.ResourceId;
+        this.layoutInfo.headImg = data.ImgUrl;
+      } else {
+        this.layoutInfo.endImgId = data.ResourceId;
+        this.layoutInfo.endImg = data.ImgUrl;
+      }
+    }
   },
 }
 </script>
 <style scoped lang='scss'>
-
+.main {
+  .set-ul {
+    li {
+      display: flex;
+      margin: 20px 0;
+      .img-cont {
+        width: 80%;
+        height: 300px;
+        background: rgba($color: #000000, $alpha: 0.05);
+        display: flex;
+        justify-content: center;
+        flex-wrap: wrap;
+        align-items: center;
+        .cont-item  {
+          width: 90%;
+          height: 35%;
+          position: relative;
+          .add-cont {
+            width: 100%;
+            height: 100%;
+            object-fit: fill !important;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            background: rgba($color: #000000, $alpha: 0.1);
+          }
+          .el-icon-delete {
+            font-size: 20px;
+            position: absolute;
+            top: 10px;
+            right: 10px;
+            z-index: 2;
+            cursor: pointer;
+            color: #ededed;
+          }
+        }
+      }
+    }
+  }
+}.dialog-btn  {
+  margin:30px 0;
+  text-align: center;
+  .el-button {
+    width: 120px;
+  }
+}
 </style>

+ 8 - 3
src/views/report_manage/reportV2/normalReport/editReport.vue

@@ -279,6 +279,7 @@ export default {
         this.$message.success(this.$t('MsgPrompt.publish_msg'))
 
         setTimeout(() => {
+					this.timer && clearInterval(this.timer);
           this.$router.go(-1);
         }, 1000);
       }
@@ -398,7 +399,7 @@ export default {
 
 			this.isPublishloading = true;
 
-			let sendMsg = this.$route.query.reportCoopType===2 ? this.$refs.chapterContRef.reportBase.MsgIsSend : this.ThsMsgIsSend;
+			let sendMsg = this.reportCoopType===2 ? this.$refs.chapterContRef.reportBase.MsgIsSend : this.ThsMsgIsSend;
 			if(sendMsg===1){
 				this.publishreport({sendMsg: false})
 			}else {
@@ -443,7 +444,11 @@ export default {
 				if (res.Ret !== 200) return
 
 				sendMsg && reportMessageSend({ReportId: Number(this.$route.query.id)})
-				this.$router.push({ path: '/reportNew' });
+
+				this.$message.success(this.$t('MsgPrompt.publish_msg'))
+				setTimeout(() => {
+					this.$router.replace({ path: '/reportNew' });
+				},1000)
 			});
 		},
 
@@ -469,7 +474,7 @@ export default {
 			}
 			// return console.log(this.reportCode,'reportCode');
 			// 如果改报告已经推送过模板消息
-			let sendMsg = this.$route.query.reportCoopType===2 ? this.$refs.chapterContRef.reportBase.MsgIsSend : this.ThsMsgIsSend;
+			let sendMsg = this.reportCoopType===2 ? this.$refs.chapterContRef.reportBase.MsgIsSend : this.ThsMsgIsSend;
 			if(sendMsg===1){
 				reportSetPrepublish({
 					ReportId:Number(this.report_id),

+ 12 - 6
src/views/report_manage/reportV2/normalReport/mixins/messagePush.js

@@ -36,13 +36,16 @@ export default {
       if(this.$route.query.id&&code_arr.length) {
         let res = await dataBaseInterface.getReportrefreshStatus({
           Source: fromPage,
-          ReportId: Number(this.$route.query.id),
-          ReportChapterId: 0
+          PrimaryId: Number(this.$route.query.id),
+          SubId: this.reportInfo.ReportChapterId
         });
         
         if(!res.Data.RefreshResult) return this.$message.warning(this.$t('ReportManage.ReportList.chart_refreshed_msg'))
         const { Ret,Msg } = await dataBaseInterface.reportRefresh({
-            ChartInfoCode: code_arr
+            ChartInfoCode: code_arr,
+            Source: fromPage,
+            PrimaryId: Number(this.$route.query.id),
+            SubId: this.reportInfo.ReportChapterId
           })
           
           if(Ret === 200) {
@@ -60,12 +63,15 @@ export default {
         //获取刷新结果
         let res = await sheetInterface.getRefreshResult({
             Source: fromPage,
-            ReportId: Number(this.$route.query.id),
-            ReportChapterId: 0
+            PrimaryId: Number(this.$route.query.id),
+            SubId: this.reportInfo.ReportChapterId
           });
         if(!res.Data.RefreshResult) return this.$message.warning(this.$t('ReportManage.ReportList.chart_refreshed_msg'))
         const { Ret,Msg } = await sheetInterface.refreshSheet({
-            ExcelCodes: sheet_code_arr
+            ExcelCodes: sheet_code_arr,
+            Source: fromPage,
+            PrimaryId: Number(this.$route.query.id),
+            SubId: this.reportInfo.ReportChapterId
           })
           
           if(Ret === 200) {

+ 3 - 5
src/views/report_manage/reportV2/normalReport/reportdtl.vue

@@ -10,6 +10,7 @@
 		  <div>摘要:{{reportInfo.Abstract}}</div>
 		</div>
 		<div id="resetsty" style="padding:30px; box-sizing:border-box; overflow:hidden;">
+			<!-- 章节报告 -->
 			<block v-if="reportInfo.CollaborateType===2">
 				<div class="chapter-item" v-for="item in reportInfo.ChapterList" :key="item.ReportChapterId">
 					<div style="margin-bottom:10px">
@@ -20,6 +21,7 @@
 				</div>
 			</block>
 
+			<!-- 单报告 -->
 			<block v-else>
 				<div id="resetcss" style="overflow:hidden;" v-html="reportInfo.Content"></div>
 			</block>
@@ -162,7 +164,7 @@
 </script>
 
 <style lang="scss">
-	#reportdtl{ background:#fff;  max-width:1200px; margin:10px auto;position:relative;
+	#reportdtl{ background:#fff;  max-width:800px; margin:10px auto;position:relative;
 		img{ display:'block'; width:'100%'; margin:'0 auto'; }
 		header{ padding:10px 30px; box-sizing:border-box; font-size:28px; font-weight:500; color:#333; background:#fff; }
 		#abstract{ padding:10px 30px 0; box-sizing:border-box; font-size:22px; line-height:36px;
@@ -223,9 +225,5 @@
 				list-style-position: inside !important;
 			}
 		}
-        @media (max-width:1400px) {
-            margin-right: 100px;
-            
-        }
 	}
 </style>

+ 22 - 4
src/views/report_manage/reportV2/smartReport/components/ImgSource.vue

@@ -13,13 +13,13 @@
                     style="width:240px"
                     size="medium"
 				/>
-                <el-select :placeholder="$t('ReportManage.ReportList.select_img_type')" v-model="type" style="width:240px" @change="handleSearch" size="medium">
+                <el-select :placeholder="$t('ReportManage.ReportList.select_img_type')" v-model="type" style="width:240px" @change="handleSearch" size="medium" :disabled="defaultType">
                     <el-option :label="$t('ReportManage.ReportList.page_header_op')" :value="1"></el-option>
                     <el-option :label="$t('ReportManage.ReportList.page_trailer_op')" :value="2"></el-option>
                 </el-select>
             </div>
         </div>
-        <div class="main-box">
+        <div class="main-box" :style="inDialog?'height:550px;':'height: calc(100vh - 180px)'">
             <!-- <div class="type-select-box">
                 <span style="margin-right:20px">版面设置</span>
                 <el-radio-group v-model="setType">
@@ -52,10 +52,28 @@
 <script>
 import {apiSmartReport}  from '@/api/modules/smartReport'
 export default {
+    props: {
+        inDialog: { //内嵌进dialog
+            type: Boolean,
+            default: false
+        },
+        defaultType: { //默认类型
+            type: Number,
+            default: 0
+        }
+    },
+    watch: {
+        defaultType(nval) {
+            this.type = nval;
+            this.selectItem = null
+            this.page = 1;
+            this.getImgList()
+        }
+    },
     data() {
         return {
             keyword:'',
-            type:1,
+            type:this.defaultType||1,
             list:[],
             page:1,
             pageSize:20,
@@ -201,7 +219,7 @@ div{
             padding-top: 20px;
             text-align: center;
             .el-button{
-                width: 200px;
+                width: 120px;
             }
         }
     }

+ 31 - 15
src/views/report_manage/reportV2/smartReport/editReport.vue

@@ -494,6 +494,7 @@ export default {
                 this.$message.success(this.$t('MsgPrompt.publish_msg'))
 
                 setTimeout(() => {
+                    this.timer && clearInterval(this.timer);
                     this.$router.go(-1);
                 }, 1000);
             }
@@ -612,9 +613,14 @@ export default {
 
         // 跳转预览
         handlePreviewReport(){
-            const htmlStr=document.getElementById('report-html-content').outerHTML.replace(/contenteditable="true"/g,'contenteditable="false"');
-            sessionStorage.setItem('smartReportContent', htmlStr);
-            sessionStorage.setItem('smartReportContentBg', this.bgColor);
+            sessionStorage.removeItem('smartReportContent');
+            sessionStorage.removeItem('smartReportContentBg');
+            
+            if(document.getElementById('report-html-content')) {
+                const htmlStr=document.getElementById('report-html-content').outerHTML.replace(/contenteditable="true"/g,'contenteditable="false"');
+                sessionStorage.setItem('smartReportContent', htmlStr);
+                sessionStorage.setItem('smartReportContentBg', this.bgColor);
+            }
 			let { href } = this.$router.resolve({ 
                 path: '/smartReportDetail',
                 query:{
@@ -1013,15 +1019,18 @@ export default {
 
             if(this.$route.query.id&&code_arr.length) {
                 let res = await dataBaseInterface.getReportrefreshStatus({
-                    Source: 'smart_report',
-                    ReportId: Number(this.$route.query.id),
-                    ReportChapterId: Number(this.reportInfo.ReportChapterId)
+                    Source: 'report',
+                    PrimaryId: Number(this.$route.query.id),
+                    SubId: this.reportInfo.ReportChapterId
                 });
                 
                 if(!res.Data.RefreshResult) return this.$message.warning(this.$t('ReportManage.ReportList.chart_refreshed_msg'))
 
                 const { Ret,Msg } = await dataBaseInterface.reportRefresh({
-                    ChartInfoCode: code_arr
+                    ChartInfoCode: code_arr,
+                    Source: 'report',
+                    PrimaryId: Number(this.$route.query.id),
+                    SubId: this.reportInfo.ReportChapterId
                 })
                 
                 if(Ret === 200) {
@@ -1037,13 +1046,16 @@ export default {
             if(this.$route.query.id&&sheet_code_arr.length){
                 //获取刷新结果
                 let res = await sheetInterface.getRefreshResult({
-                    Source: 'smart_report',
-                    ReportId: Number(this.$route.query.id),
-                    ReportChapterId: 0
+                    Source: 'report',
+                    PrimaryId: Number(this.$route.query.id),
+                    SubId: this.reportInfo.ReportChapterId
                 });
-                if(!res.Data.RefreshResult) return this.$message.warning('表格正在刷新中,请勿重复操作')
+                if(!res.Data.RefreshResult) return this.$message.warning(/* '表格正在刷新中,请勿重复操作' */this.$t('ReportManage.ReportList.chart_refreshed_msg'))
                 const { Ret,Msg } = await sheetInterface.refreshSheet({
-                    ExcelCodes: sheet_code_arr
+                    ExcelCodes: sheet_code_arr,
+                    Source: fromPage,
+                    PrimaryId: Number(this.$route.query.id),
+                    SubId: this.reportInfo.ReportChapterId
                 })
                 
                 if(Ret === 200) {
@@ -1104,7 +1116,7 @@ export default {
                 return
             }
             //截止至ETA1.3.8 智能研报无推送模板消息,所有的reportInfo.MsgIsSend都为1
-            let sendMsg = this.$route.query.reportCoopType===2 ? this.$refs.chapterContRef.reportBase.MsgIsSend : this.reportInfo.MsgIsSend;
+            let sendMsg = this.reportCoopType===2 ? this.$refs.chapterContRef.reportBase.MsgIsSend : this.reportInfo.MsgIsSend;
             if(sendMsg===1){//该报告已经推送过模板消息
                 this.reportPublish({sendMsg:false})
             }else{
@@ -1169,7 +1181,7 @@ export default {
 				return
 			}
             // 如果该报告已经推送过模板消息
-            let sendMsg = this.$route.query.reportCoopType===2 ? this.$refs.chapterContRef.reportBase.MsgIsSend : this.reportInfo.MsgIsSend;
+            let sendMsg = this.reportCoopType===2 ? this.$refs.chapterContRef.reportBase.MsgIsSend : this.reportInfo.MsgIsSend;
             if(sendMsg===1){
                 reportSetPrepublish({
                     ReportId:Number(this.$route.query.id),
@@ -1238,7 +1250,11 @@ export default {
                     if(sendMsg){
                         this.reportSendMsg()
                     }
-                    this.$router.replace({ path: '/reportNew' });
+                    this.$message.success(this.$t('MsgPrompt.publish_msg'))
+
+                    setTimeout(() => {
+                        this.$router.replace({ path: '/reportNew' });
+                    },1000)
                 }
             })
         },

+ 46 - 15
src/views/report_manage/reportV2/smartReport/reportDetail.vue

@@ -1,13 +1,8 @@
 <template>
     <div class="smart-report-detail">
         <div class="main-box" :style="{backgroundColor:bgColor}">
-            <!-- <div class="top-box">
-                <div class="title">{{reportInfo&&reportInfo.Title}}</div>
-                <div class="flex">
-                    <span>{{reportInfo&&reportInfo.Author}}</span>
-                    <span>{{reportInfo&&reportInfo.PublishTime}}</span>
-                </div>
-            </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.value"
@@ -17,6 +12,7 @@
                     {{ layoutBaseInfo[item.value] }}
                 </div>
             </div>
+
             <!-- 无版头版尾 -->
             <div class="no-layout-img-box" v-if="reportInfo && !!reportInfo.NeedSplice && (!reportInfo.HeadImg) && (!reportInfo.EndImg)">
                 <header>{{reportInfo.Title}}</header>
@@ -25,10 +21,30 @@
                     <span style="float:right;">{{reportInfo.CreateTime}}</span>
                 </div>
             </div>
+
             <div class="abstract" v-if="reportInfo && !!reportInfo.NeedSplice">
                 <div>摘要: <span v-html="reportInfo.Abstract"></span></div> 
             </div>
-            <div class="html-wrap" v-html="content"></div>
+
+
+            <!-- 内容 -->
+            <template>
+                <!-- 章节报告 -->
+                <template v-if="reportInfo&&reportInfo.CollaborateType===2">
+                    <div class="chapter-item" v-for="item in reportInfo.ChapterList" :key="item.ReportChapterId">
+                        <div style="margin-bottom:10px">
+                            <span class="type" v-if="item.TypeName">{{item.TypeName}}</span>
+                            <span class="title">{{item.Title}}</span>
+                        </div>
+                        <div class="html-wrap" v-html="item.Content"></div>
+                    </div>
+                </template>
+
+                <!-- 单报告 -->
+                <div class="html-wrap" v-html="content" v-else></div>
+            </template>
+
+            <!-- 板尾 -->
             <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.value"
@@ -39,6 +55,7 @@
                 </div>
             </div> 
         </div>
+
         <div class="right-opt-box" v-if="$route.query.type!=='preview'&&!reportId">
             <div 
                 class="item copy" 
@@ -84,11 +101,7 @@
 <script>
 import {apiSmartReport}  from '@/api/modules/smartReport'
 import {
-	autosave,
-	reportedit,
 	reportdetail,
-	reportpublish,
-	reportSetPrepublish
 } from '@/api/modules/reportV2';
 import vueQr from 'vue-qr'
 export default {
@@ -182,8 +195,8 @@ export default {
                     this.layoutBaseInfo['研报作者']=this.reportInfo.Author
                     this.layoutBaseInfo['创建时间']=this.reportInfo.CreateTime
                     if(this.$route.query.type==='preview'){
-                       this.content=sessionStorage.getItem('smartReportContent')
-                       this.bgColor=sessionStorage.getItem('smartReportContentBg')
+                       this.content=sessionStorage.getItem('smartReportContent')||res.Data.Content
+                       this.bgColor=sessionStorage.getItem('smartReportContentBg')||res.Data.CanvasColor
                     }else{
                         this.content=res.Data.Content
                         this.bgColor=res.Data.CanvasColor
@@ -294,7 +307,7 @@ div{
     }
     .main-box{
         width: 800px;
-        padding: 20px 20px 20px 44px;
+        padding: 20px;
         margin: 20px auto;
         border: 1px solid var(--gary-gy-5-line, #C8CDD9);
         border-radius: 4px;
@@ -362,5 +375,23 @@ div{
             max-width: 800px;
         }
     }
+
+    .chapter-item{
+        margin-bottom: 20px;
+        padding-bottom: 20px;
+        border-bottom: 1px dashed #ccc;
+        .type{
+            font-size: 15px;
+            color: #fff;
+            padding: 5px 10px;
+            background-color: #E6A23C;
+            border-radius: 4px;
+        }
+        .title{
+            font-size: 15px;
+            margin-left: 10px;
+            font-weight: bold;
+        }
+    }
 }
 </style>