Browse Source

CRM14.0 - 后台部分

hbchen 1 year ago
parent
commit
f5666cb2b6

+ 34 - 78
src/api/modules/assistanceDoc.js

@@ -4,6 +4,17 @@
 import http from "@/api/http.js"
 
 export const assistanceDocInterence = {
+    /**
+     * 获取文章列表
+     * @param Keyword String 文章标题
+     * @param PageSize number 每页数据条数
+     * @param CurrentIndex number 当前页面
+     * @param ClassifyId number 分类id
+     * @returns 
+     */
+    getAssistanceDocList:(params)=>{
+      return http.get('/help_doc/list',params)
+    },
     /**
      * 新增文章
      * @param ClassifyId number 分类Id
@@ -26,6 +37,21 @@ export const assistanceDocInterence = {
     getAssistanceDoc:(params)=>{
       return http.get('/help_doc/detail',params)
     },
+    /**
+     * 文章发布/取消发布
+     * @param DocId number 文章Id
+     * @param Status number 状态
+     */
+    assistanceDocPublish:(params)=>{
+      return http.post('/help_doc/publish',params)
+    },
+    /**
+     * 文章发布/取消发布
+     * @param DocId number 文章Id
+     */
+    assistanceDocDelete:(params)=>{
+      return http.post('/help_doc/delete',params)
+    },
     /**
      * 获取分类列表
      * @param Keyword String分类名称
@@ -51,6 +77,14 @@ export const assistanceDocInterence = {
     editAssistanceClassify:(params)=>{
       return http.post('/help_doc/classify/edit',params)
     },
+    /**
+     * 修改分类可见权限
+     * @param HelpDocClassifyId number 文章Id
+     * @param VisibleBusinessIds number 商家Id 多选 ,拼接
+     */
+    editAssistanceClassifyVisible:(params)=>{
+      return http.post('help_doc/classify/visible/edit',params)
+    },
     /**
      * 删除分类
      * @param ClassifyId number 节点Id
@@ -68,82 +102,4 @@ export const assistanceDocInterence = {
     moveAssistanceClassify:(params)=>{
       return http.post('/help_doc/classify/move',params)
     },
-    // /**
-    //  * 获取操作日志列表
-    //  * @param EtaBusinessId Integer 商家ID
-    //  */
-    // getTimeLineList:(params)=>{
-    //     return http.get('/eta_business/operate_record_list',params)
-    // },
-    // /**
-    //  * 获取商家详情
-    //  * @param EtaBusinessId Integer 商家ID
-    //  */
-    // getBusinessDetail:(params)=>{
-    //     return http.get('/eta_business/detail',params)
-    // },
-    // /**
-    //  * 添加续约
-    //  * @param EtaBusinessId Integer 商家ID
-    //  * @param SigningTime String 签约时间
-    //  * @param ExpiredTime String 到期时间
-    //  * @returns 
-    //  */
-    // addNewContract:(params)=>{
-    //     return http.post('/eta_business/signing',params)
-    // },
-    // /**
-    //  * 修改销售
-    //  * @param EtaBusinessId Integer 商家ID
-    //  * @param SellerId Integer 销售ID
-    //  * @param SellerName String 销售名称
-    //  */
-    // changeBusinessSeller:(params)=>{
-    //     return http.post('/eta_business/move_seller',params)
-    // },
-    // /**
-    //  * 启用禁用商家
-    //  * @param EtaBusinessId Integer 商家ID
-    //  */
-    // changeBusinessStatus:(params)=>{
-    //     return http.post('/eta_business/enable',params)
-    // },
-    // /**
-    //  * 编辑商家
-    //  * @param EtaBusinessId Integer 商家ID
-    //  * @param Province String 省份
-    //  * @param City String 城市
-    //  * @param Leader String 决策人姓名
-    //  * @param IndustryId Integer 行业ID
-    //  * @param IndustryName String 行业名称
-    //  * @param CapitalScale String 资金规模
-    //  * @param ResearchTeamSize String 研究团队规模
-    //  * @param UserMax Integer 用户上限
-    //  */
-    // editBusiness:(params)=>{
-    //     return http.post('/eta_business/edit',params)
-    // },
-    // /**
-    //  * 添加商家
-    //  * @param BusinessName String 商家名称
-    //  * @param CreditCode String 社会信用码
-    //  * @param RegionType String 所属区域:国内;海外
-    //  * @param Province String 省份
-    //  * @param City String 城市
-    //  * @param SellerId Integer 销售ID
-    //  * @param SellerName String 销售姓名
-    //  * @param Leader String 决策人姓名
-    //  * @param IndustryId Integer 行业ID
-    //  * @param IndustryName String 行业名称
-    //  * @param CapitalScale String 资金规模
-    //  * @param ResearchTeamSize String 研究团队规模
-    //  * @param UserMax Integer 用户上限
-    //  * @param SigningTime String 签约时间(IsCheck为false时必填)
-    //  * @param ExpiredTime String 到期时间(IsCheck为false时必填)
-    //  * @param IsCheck Boolean 是否仅校验,为true时校验参数但不实际新增
-    //  * @returns 
-    //  */
-    // addBusiness:(params)=>{
-    //     return http.post('/eta_business/add',params)
-    // }
 }

+ 10 - 0
src/routes/modules/operateRoutes.js

@@ -91,6 +91,16 @@ export default [
 					pathName: '帮助中心配置'
 				}
 			},
+			{
+				path:"assistanceDocEdit",
+				component: () => import('@/views/system_manage/assistance_center/assistanceDocAdd.vue'),
+				name: '编辑文章',
+				hidden: true,
+				meta: {
+					pathFrom: 'assistanceCenter',
+					pathName: '帮助中心配置'
+				}
+			},
 			{
 				path:"docClassifyManage",
 				component: () => import('@/views/system_manage/assistance_center/docClassifyManage.vue'),

+ 56 - 92
src/views/system_manage/assistance_center/assistanceCenter.vue

@@ -7,50 +7,53 @@
       </div>
       <div class="assistance-center-top-search">
         <el-cascader
-          v-model="queryParams.classifyId"
           :options="classifyList"
           collapse-tags
           clearable
           :props="{
             multiple:true,
-            value:'id',
-            label:'text',
-            children:'child'
+            value:'ClassifyId',
+            label:'ClassifyName',
+            children:'Children',
+            emitPath:false
           }"
           placeholder="所属分类"
           @change="handlSearchClassify"
         />
-        <el-input placeholder="文章标题" v-model="queryParams.title" @input="handlSearchClassify" clearable 
+        <el-input placeholder="文章标题" v-model="queryParams.KeyWord" clearable @input="getDocumentList"
         style="width:500px;margin-left: 20px;">
 				  <i slot="prefix" class="el-input__icon el-icon-search"></i>
 			  </el-input>
       </div>
     </div>
     <el-table ref="documentTable" :data="documentList" border class="document-table">
-      <el-table-column prop="title" label="文章标题" align="center">
+      <el-table-column prop="Title" label="文章标题" align="center">
         <template slot-scope="scope">
-          <span @click="goDetail(scope.row)" class="document-title">{{scope.row.title}}</span>
+          <span @click="goDetail(scope.row)" class="document-title">{{scope.row.Title}}</span>
         </template>
       </el-table-column>
-      <el-table-column prop="classify" label="所属分类" align="center">
-        <template slot-scope="scope"> <span>{{scope.row.classify}}</span> </template>
+      <el-table-column prop="ClassifyName" label="所属分类" align="center">
+        <template slot-scope="scope"> <span>{{scope.row.ClassifyName}}</span> </template>
       </el-table-column>
-      <el-table-column prop="author" label="文章作者" align="center">
-        <template slot-scope="scope"> <span>{{scope.row.author}}</span> </template>
+      <el-table-column prop="Author" label="文章作者" align="center">
+        <template slot-scope="scope"> <span>{{scope.row.Author}}</span> </template>
       </el-table-column>
-      <el-table-column prop="status" label="发布状态" align="center">
+      <el-table-column prop="Status" label="发布状态" align="center">
         <template slot-scope="scope"> 
-          <span :style="{color:scope.row.status==1?'#4FB112':'#F56C6C'}">{{scope.row.status==1?"已发布":"未发布"}}</span>
+          <span :style="{color:scope.row.Status==2?'#4FB112':'#F56C6C'}">{{scope.row.Status==2?"已发布":"未发布"}}</span>
         </template>
       </el-table-column>
-      <el-table-column prop="updateTime" label="更新时间" align="center">
-        <template slot-scope="scope"> <span>{{scope.row.updateTime}}</span> </template>
+      <el-table-column prop="CreateTime" label="创建时间" align="center">
+        <template slot-scope="scope"> <span>{{scope.row.CreateTime}}</span> </template>
+      </el-table-column>
+      <el-table-column prop="ModifyTime" label="更新时间" align="center">
+        <template slot-scope="scope"> <span>{{scope.row.ModifyTime}}</span> </template>
       </el-table-column>
       <el-table-column label="操作" align="center" min-width="110" v-if="Role!='admin'">
         <template slot-scope="scope">
           <div style="color:#4099ef;">
-            <span style="margin-right:10px;cursor: pointer;" @click="publish(scope.row)" v-if="scope.row.status==1">取消发布</span>
-            <template v-if="scope.row.status==0">
+            <span style="margin-right:10px;cursor: pointer;" @click="publish(scope.row)" v-if="scope.row.Status==2">取消发布</span>
+            <template v-if="scope.row.Status==1">
               <span style="margin-right:10px;cursor: pointer;" @click="editDocument(scope.row)">编辑</span>
               <span style="margin-right:10px;cursor: pointer;" @click="publish(scope.row)">发布</span>
             </template>
@@ -72,6 +75,7 @@
 
 <script>
 import mPage from '@/components/mPage.vue';
+import { assistanceDocInterence } from '../../../api/modules/assistanceDoc';
 
   export default {
     name:"assistanceCenter",
@@ -80,11 +84,12 @@ import mPage from '@/components/mPage.vue';
       return {
         classifyList:[],
         documentList:[],
+        ClassifyIdList:[],
         queryParams:{
           CurrentIndex:1,
           PageSize:10,
-          classifyId:[],
-          title:""
+          ClassifyIds:"",
+          KeyWord:""
         },
         total:100
       }
@@ -95,69 +100,23 @@ import mPage from '@/components/mPage.vue';
     },
     methods: {
       getClassifyList(){
-        //TODO: 获取分类列表接口
-        this.classifyList = [
-          {id:1,text:"分类介绍",child:[{id:11,text:"分类介绍1",child:[{id:111,text:"分类介绍11",child:null}]}]},
-          {id:2,text:"ETA使用",child:[{id:22,text:"ETA使用1",child:[{id:222,text:"ETA使用11",child:null}]}]},
-          {id:3,text:"ETA移动",child:[{id:33,text:"ETA移动1",child:[{id:333,text:"ETA移动11",child:null}]}]},
-          {id:4,text:"指标成图",child:[{id:44,text:"指标成图1",child:[{id:444,text:"指标成图11",child:null}]}]},
-          {id:5,text:"图表分析",child:[{id:55,text:"图表分析1",child:[{id:555,text:"图表分析11",child:null}]}]}
-        ]
+        assistanceDocInterence.getAssistanceClassifyList().then(res=>{
+          if(res.Ret == 200){
+            this.classifyList = res.Data?res.Data.AllNodes||[]:[]
+          }
+        })
       },
       getDocumentList(){
-        //TODO: 获取文章列表接口
-        this.documentList=[
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-        Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-        Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-        Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-        Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:0,updateTime:"2023-07-21 12:12:12",
-        Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-        Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:0,updateTime:"2023-07-21 12:12:12",
-        Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`},
-        {id:1,title:"关于ETA投研系统",classify:"ETA介绍/关于ETA投研系统",author:"张三",status:1,updateTime:"2023-07-21 12:12:12",
-      Content:`<p style='color:red;font-size:26px;background-color:#000000'>帮助中心啦</p>`}]
+        assistanceDocInterence.getAssistanceDocList(this.queryParams).then(res=>{
+          if(res.Ret == 200){
+            this.documentList=res.Data.List || []
+            this.total = res.Data.Paging.Totals || 0
+          }
+        })
       },
-      handlSearchClassify(){
-        console.log(this.queryParams);
+      handlSearchClassify(value){
+        // console.log(value);
+        this.queryParams.ClassifyIds = value.join(',')
         this.getDocumentList()
       },
       pageChange(page_no){
@@ -165,15 +124,11 @@ import mPage from '@/components/mPage.vue';
         this.handlSearchClassify()
       },
       goDetail(item){
-        //TODO: 去往详情
-        sessionStorage.setItem("documentDoc",item.Content)
-        let { href } = this.$router.resolve({ path: "/assistanceDocDetail" });
-        window.open(href, "_blank");
+        this.$router.push({path:"/assistanceDocDetail",query:{DocId:item.Id}})
       },
       //发布/取消发布
       publish(item){
-        console.log(item.status);
-        let text = item.status==1?'取消发布':'发布'
+        let text = item.Status==2?'取消发布':'发布'
 
         this.$confirm(`是否确认${text}?`,"提示",
         {
@@ -181,16 +136,22 @@ import mPage from '@/components/mPage.vue';
           confirmButtonText: "确定",
           cancelButtonText: "取消",
         }).then(res=>{
-        //TODO: 接口对接
-          this.$message.success(text+"成功")
-          this.getDocumentList()
+          assistanceDocInterence.assistanceDocPublish({
+            DocId:item.Id,
+            Status:3-item.Status
+          }).then(res=>{
+            if(res.Ret == 200){
+              this.$message.success(text+"成功")
+              this.getDocumentList()
+            }
+          })
         }).catch(() => {});
       },
       addDocument(){
         this.$router.push("/assistanceDocAdd")
       },
       editDocument(item){
-        this.$router.push({path:"/assistanceDocAdd",query:{DocId:5}})
+        this.$router.push({path:"/assistanceDocEdit",query:{DocId:item.Id}})
       },
       //删除文章
       deleteDocument(item){
@@ -200,9 +161,12 @@ import mPage from '@/components/mPage.vue';
           confirmButtonText: "确定",
           cancelButtonText: "取消",
         }).then(res=>{
-        //TODO: 接口对接
-          this.$message.success("删除成功")
-          this.getDocumentList()
+          assistanceDocInterence.assistanceDocDelete({DocId:item.Id}).then(res=>{
+            if(res.Ret == 200){
+              this.$message.success("删除成功")
+              this.getDocumentList()
+            }
+          })
         }).catch(() => {});
       },
       classifyManage(){

+ 36 - 54
src/views/system_manage/assistance_center/assistanceDocAdd.vue

@@ -29,10 +29,10 @@
             <el-input v-model="addDocForm.Author" placeholder="请输入文章作者"></el-input>
           </el-form-item>
           <el-form-item label="相关推荐">
-            <div v-for="(item,index) in recommendedLink" :key="index" class="form-item-recommendedLink">
-              <el-input v-model="item.linkName" placeholder="请输入链接名称" style="width: 190px;"></el-input>
+            <div v-for="(item,index) in addDocForm.RecommendData" :key="index" class="form-item-recommendedLink">
+              <el-input v-model="item.Name" placeholder="请输入链接名称" style="width: 190px;"></el-input>
               <div class="recommendedLink-line"></div>
-              <el-input v-model="item.linkUrl" placeholder="请输入链接" style="width: 190px;"></el-input>
+              <el-input v-model="item.Url" placeholder="请输入链接" style="width: 190px;"></el-input>
             </div>
           </el-form-item>
         </el-form>
@@ -43,7 +43,7 @@
 
 <script>
 import {assistanceDocInterence} from "@/api/api.js"
-
+import {createBottomHref} from "./utils/common"
   export default {
     name:"assistanceDocAdd",
     data() {
@@ -134,9 +134,9 @@ import {assistanceDocInterence} from "@/api/api.js"
           Author:"",
           Status:1,
           Content:'',
-          AnchorData:[]
+          AnchorData:[],
+          RecommendData:[{Name:"",Url:""},{Name:"",Url:""}],
         },
-        recommendedLink:[{linkName:"",linkUrl:""},{linkName:"",linkUrl:""}],
         addDocRules:{
           Title:{required:true,message:'文章标题不能为空',trigger:'blur'},
           ClassifyId:{required:true,message:'文章所属分类不能为空',trigger:'change'},
@@ -146,29 +146,26 @@ import {assistanceDocInterence} from "@/api/api.js"
       }
     },
     created() {
-      this.getclassifyData()
+      this.getClassifyData()
       if(this.$route.query.DocId){
-        //TODO: 详情接口
-        console.log("详情接口");
         assistanceDocInterence.getAssistanceDoc({DocId:this.$route.query.DocId}).then(res=>{
           if(res.Ret == 200){
             this.addDocForm={
+              Id:res.Data.Id,
               Title:res.Data.Title,
               ClassifyId:res.Data.ClassifyId,
               Author:res.Data.Author,
               Status:res.Data.Status,
               Content:res.Data.Content,
+              RecommendData:res.Data.Recommend || [{Name:"",Url:""},{Name:"",Url:""}]
             }
-            // this.addDocForm.AnchorData:res.Data.Anchor,
-            // this.recommendedLink=[{linkName:"",linkUrl:""},{linkName:"",linkUrl:""}],
             
-            console.log(res);
           }
         })
       }      
     },
     methods: {
-      getclassifyData(){
+      getClassifyData(){
         assistanceDocInterence.getAssistanceClassifyList().then(res=>{
           if(res.Ret == 200){
             this.classifyList = res.Data?res.Data.AllNodes||[]:[]
@@ -222,21 +219,21 @@ import {assistanceDocInterence} from "@/api/api.js"
           this.searchTitleTag(frontH1Posiiton,firstLevel)
         }
       },
-      // 生成底部的两个链接
-      createBottomHref(){
-        let hrefStringBuiler='<ul style="margin-top:40px">'
-        this.recommendedLink.map(item =>{
-          if(item.linkName){
-            hrefStringBuiler+=`<li><a href="${item.linkUrl}" target="_blank" style="text-decoration: underline;">${item.linkName}</a></li>`
-          }
-        })
-        return hrefStringBuiler+"</ul>"
-      },
+      // // 生成底部的两个链接
+      // createBottomHref(){
+      //   let hrefStringBuiler='<ul style="margin-top:40px">'
+      //   this.addDocForm.RecommendData.map(item =>{
+      //     if(item.Name){
+      //       hrefStringBuiler+=`<li><a href="${item.Url}" target="_blank" style="text-decoration: underline;">${item.Name}</a></li>`
+      //     }
+      //   })
+      //   return hrefStringBuiler+"</ul>"
+      // },
       previewDocument(){
         // this.addDocForm.Content=`<p>范德萨发的刚发的</p><p>刚发的g梵蒂冈</p><p>割发代首刚发的</p><hr><h1>1. 个刚发的施工方</h1><p>刚发的刚发的g规范的施工方都是割发代首规范</p><h2>1.1. 规范的三个富士达割发代首</h2><p>个梵蒂冈是梵蒂冈讽德诵功范德萨割发代首个割发代首</p><p>刚分手的割发代首割发代首高富帅d</p><p>刚分手的刚分手的</p><p>割发代首刚分手的</p><p>刚分手的公司发的</p><p>刚发的事故发生的</p><p><br></p><p>割发代首刚分手的刚分手的</p><h2>1.2. 噶规范十多个范德萨刚发的施工方多少公分</h2><p>个讽德诵功范德萨</p><p>割发代首割发代首刚发的s规范的三个</p><h1>2.讽德诵功是反的</h1><p>割发代首割发代首个人的施工方都是</p><p>范德萨个人东方闪电方式</p><p>割发代首割发代首</p><h2>2.1.个梵蒂冈</h2><p>讽德诵功范德萨规范的三个范德萨讽德诵功放大s</p><h2>2.2.刚发的广泛地个</h2><p>刚分手的割发代首</p><p>割发代首割发代首割发代首</p><p><br></p><p>范德萨割发代首</p><h2>2.3.辅导费是的</h2><p>范甘迪个放大割发代首个</p><p>刚发的刚发的</p><h1>3. 个梵蒂冈放大</h1>`
         // 生成锚点
         // this.generateAnchor()
-        let bottomLink = this.createBottomHref()
+        let bottomLink = createBottomHref(this.addDocForm.RecommendData)
         
         sessionStorage.setItem("documentDoc",this.addDocForm.Content+bottomLink)
         let { href } = this.$router.resolve({ path: "/assistanceDocDetail" });
@@ -244,42 +241,27 @@ import {assistanceDocInterence} from "@/api/api.js"
       },
       saveDocument(type){
         // 生成锚点
-        console.log(this.addDocForm);
+        // console.log(this.addDocForm);
         this.$refs.addDocForm.validate(valid=>{
           if(valid){
-            //TODO: 保存文章和发布文章
             if(type=="发布") this.addDocForm.Status=2
 
             this.generateAnchor()
-            let bottomLink = this.createBottomHref()
-            this.addDocForm.Content=this.addDocForm.Content+bottomLink
+            this.addDocForm.Content=this.addDocForm.Content
             this.addDocForm.AnchorData = this.anchorData
-            console.log(this.addDocForm);
-            if(this.addDocForm.Id){
-              //编辑
-            }else{
-              //新增
-              assistanceDocInterence.addAssistanceDoc(this.addDocForm).then(res=>{
-                if(res.Ret == 200){
-                  this.$message({
-                    type:'success',
-                    message:'新增成功',
-                    duration:2000
-                  })
-                  setTimeout(()=>{
-                    this.$router.back()
-                  },2000)
-                }
-              })
-            }
-            // this.$message({
-            //   type:'success',
-            //   message:'操作成功',
-            //   duration:2000
-            // })
-            // setTimeout(()=>{
-            //   this.$router.back()
-            // },2000)
+            //保存
+            assistanceDocInterence.addAssistanceDoc(this.addDocForm).then(res=>{
+              if(res.Ret == 200){
+                this.$message({
+                  type:'success',
+                  message:'操作成功',
+                  duration:2000
+                })
+                setTimeout(()=>{
+                  this.$router.back()
+                },2000)
+              }
+            })
           }
         })
       }

+ 15 - 2
src/views/system_manage/assistance_center/assistanceDocDetail.vue

@@ -1,17 +1,30 @@
 <template>
   <div class="assistance-detail-container">
-    <div class="assistance-detail-box" v-html="docData"></div>
+    <div class="assistance-detail-box" v-html="content"></div>
   </div>
 </template>
 
 <script>
+import {assistanceDocInterence} from '@/api/api.js'
+import {createBottomHref} from './utils/common'
   export default {
     name:"assistanceDocDetail",
     data() {
       return {
-        docData:sessionStorage.getItem("documentDoc") || ""
+        content:''
       }
     },
+    created(){
+      if(this.$route.query.DocId){
+        assistanceDocInterence.getAssistanceDoc({DocId:this.$route.query.DocId}).then(res=>{
+          if(res.Ret == 200){
+            this.content = res.Data.Content + createBottomHref(res.Data.Recommend || [{Name:"",Url:""},{Name:"",Url:""}])
+          }
+        })
+      }else{
+        this.content = sessionStorage.getItem("documentDoc") || ''
+      }
+    }
   }
 </script>
 

+ 96 - 89
src/views/system_manage/assistance_center/docClassifyManage.vue

@@ -1,3 +1,8 @@
+<!-- 
+    表格树形数据拖拽 本来使用el-table和sortablejs 但是奇怪的判断导致前端无法做跨级拖拽的限制。
+  得由后端来限制,固使用drag-tree-table 但是这个插件构造比较简单,不是用table标签实现的
+  如果产品要实现el-table上面的功能,需要自定义,有更好的方法,还麻烦修改一下。
+ -->
 <template>
   <div class="doc-classifyMana-container">
     <div class="doc-classifyMana-top-zone">
@@ -45,7 +50,8 @@
       <div style="display: flex;flex-direction: column; align-items: center;margin-bottom: 35px;">
         <el-form :model="classifyForm" ref="classifyFormRef" label-width="80px">
           <el-form-item label="上级目录" prop="ParentId">
-            <el-cascader v-model="classifyForm.ParentId" :options="treeData.lists" placeholder="请选择上级目录"
+            <el-cascader v-model="classifyForm.ParentId" :options="noLevelThreeList" @change="selectParentId"
+              placeholder="请选择上级目录(不选默认添加的是一级分类)" ref="parentIdCascaderRef"
               :props="{ value:'ClassifyId',label:'ClassifyName',children:'Children',checkStrictly:true,emitPath:false}" 
               class="lastCatalogCascader" :disabled="this.dialogTitle.indexOf('编辑分类')!=-1" />
           </el-form-item>
@@ -68,7 +74,7 @@
           <el-form-item label="可见权限" prop="merchantIds">
             <el-select v-model="permissionForm.merchantIds" placeholder="请选择商家" 
             multiple style="width: 337px;" collapse-tags clearable >
-              <el-option :label="item.merchantName" :value="item.merchantId" 
+              <el-option :label="item.BusinessName" :value="item.EtaBusinessId" 
               v-for="item in merchantList" :key="item.merchantId"></el-option>
             </el-select>
           </el-form-item>
@@ -83,8 +89,8 @@
 </template>
 
 <script>
-import Sortable from "sortablejs";
-import {assistanceDocInterence} from "@/api/api.js"
+// import Sortable from "sortablejs";
+import {assistanceDocInterence,businessCustomInterence} from "@/api/api.js"
 import dragTreeTable from "drag-tree-table";
   export default {
     name:"docClassifyManage",
@@ -177,15 +183,16 @@ import dragTreeTable from "drag-tree-table";
           lists:[],
           custom_field:this.custom_field
         },
-        // 用于拖拽失败后的重置
-        classifyListResetUse:[],
-        // 扁平化之后的数据
-        classifyListFlat:[],
+        // 没有三级分类的分类数组,用于添加
+        noLevelThreeList:[],
+        // // 扁平化之后的数据
+        // classifyListFlat:[],
         dialogTitle:"",
         showAddClassifyDia:false,
         classifyForm:{
           ParentId:0,
-          HelpDocClassifyName:''
+          HelpDocClassifyName:'',
+          Level:0,
         },
         merchantList:[],
         showPermissionDia:false,
@@ -206,36 +213,29 @@ import dragTreeTable from "drag-tree-table";
     },
     methods: {
       getmerchantList(){
-        //TODO: 获取商家列表接口
-        this.merchantList=[{merchantId:1,merchantName:"依诺"},
-        {merchantId:2,merchantName:"依诺2"},{merchantId:3,merchantName:"依诺3"},{merchantId:4,merchantName:"依诺4"}]
+        businessCustomInterence.getBusinessList({PageSize:9999999,CurrentIndex:1}).then(res=>{
+          if(res.Ret == 200){
+            this.merchantList = res.Data.List||[]
+          }
+        })
       },
       getclassifyData(){
         assistanceDocInterence.getAssistanceClassifyList(this.queryParams).then(res=>{
           if(res.Ret == 200){
             console.log(res);
             this.treeData.lists = res.Data?res.Data.AllNodes||[]:[]
-            this.$refs.dragTreeTableRef.OpenAll()
-            console.log(this.treeData.lists);
+            this.noLevelThreeList = res.Data?res.Data.TwoLevelNodes||[]:[]
+            // console.log(this.treeData.lists);
           }
         })
-        // this.classifyListResetUse = [
-        //   {id:1,text:"分类介绍",level:1,child:[{id:11,text:"分类介绍1",level:2,child:[{id:111,text:"分类介绍11",level:3,child:null},{id:1111,text:"分类介绍111",level:3,child:null}]}]},
-        //   {id:2,text:"ETA使用",level:1,child:[{id:22,text:"ETA使用1",level:2,child:[{id:222,text:"ETA使用11",level:3,child:null}]}]},
-        //   {id:3,text:"ETA移动",level:1,child:[{id:33,text:"ETA移动1",level:2,child:[{id:333,text:"ETA移动11",level:3,child:null}]}]},
-        //   {id:4,text:"指标成图",level:1,child:[{id:44,text:"指标成图1",level:2,child:[{id:444,text:"指标成图11",level:3,child:null}]}]},
-        //   {id:5,text:"图表分析",level:1,child:[{id:55,text:"图表分析1",level:2,child:[{id:555,text:"图表分析11",level:3,child:null}]}]}
-        // ]
-        
-        // this.classifyListFlat=[]
-      },
-      tableRowClassName({row,rowIndex}) {
-        if( row.child && row.child.length>0 ){
-          return 'has-child-row';
-        }else{
-          return '';
-        }
       },
+      // tableRowClassName({row,rowIndex}) {
+      //   if( row.child && row.child.length>0 ){
+      //     return 'has-child-row';
+      //   }else{
+      //     return '';
+      //   }
+      // },
       beforeDrag(dragItem,effectItem,type){
         // console.log(arguments,'arguments');
         if(type=='center'){
@@ -286,52 +286,52 @@ import dragTreeTable from "drag-tree-table";
         }
         findDraggedItem(list)
       },
-      tableDropSet(){
-        const tbody = this.$refs.classifyTableRef.$el.querySelector(
-          ".el-table__body-wrapper > table > tbody"
-        );
-        const _this = this;
-        Sortable.create(tbody, {
-          animation: 150, 
-          onStart(evt){
-            if(_this.classifyListFlat && _this.classifyListFlat.length>0){
-              return 
-            }else{
-              _this.flatClassifyList(_this.classifyList,0)
-            }
-            console.log(_this.classifyListFlat);
-          },
-          onEnd({ newIndex, oldIndex }) {
-            console.log({ newIndex, oldIndex });
-            if(newIndex == oldIndex) return 
-            const oldRow = _this.classifyListFlat[oldIndex]
-            const newRow = _this.classifyListFlat[newIndex]
-            console.log(oldRow,newRow);
-            _this.$message.success("拖拽成功")
-            _this.getclassifyData()
-          },
-          onMove({ dragged, related }){
-            console.log(dragged.rowIndex, related.rowIndex);
-            const oldRow = _this.classifyListFlat[dragged.rowIndex]
-            const newRow = _this.classifyListFlat[related.rowIndex]
-            console.log(oldRow.level,newRow.level);
-            if (oldRow.level !== newRow.level) {
-              return false // 不允许不同级的拖动
-            }
-          }
-        });
-      },
-      flatClassifyList(list,parentId){
-        for (let i = 0; i < list.length; i++) {
-          const element = list[i];
-          const lastElementId = i==0?0:list[i-1].id
-          const nextElementId = i==(list.length-1)?0:list[i+1].id
-          this.classifyListFlat.push({id:element.id,lastElementId,nextElementId,parentId,level:element.level})
-          if(element.child && element.child.length>0){
-            this.flatClassifyList(element.child,element.id)
-          }
-        }
-      },
+      // tableDropSet(){
+      //   const tbody = this.$refs.classifyTableRef.$el.querySelector(
+      //     ".el-table__body-wrapper > table > tbody"
+      //   );
+      //   const _this = this;
+      //   Sortable.create(tbody, {
+      //     animation: 150, 
+      //     onStart(evt){
+      //       if(_this.classifyListFlat && _this.classifyListFlat.length>0){
+      //         return 
+      //       }else{
+      //         _this.flatClassifyList(_this.classifyList,0)
+      //       }
+      //       console.log(_this.classifyListFlat);
+      //     },
+      //     onEnd({ newIndex, oldIndex }) {
+      //       console.log({ newIndex, oldIndex });
+      //       if(newIndex == oldIndex) return 
+      //       const oldRow = _this.classifyListFlat[oldIndex]
+      //       const newRow = _this.classifyListFlat[newIndex]
+      //       console.log(oldRow,newRow);
+      //       _this.$message.success("拖拽成功")
+      //       _this.getclassifyData()
+      //     },
+      //     onMove({ dragged, related }){
+      //       console.log(dragged.rowIndex, related.rowIndex);
+      //       const oldRow = _this.classifyListFlat[dragged.rowIndex]
+      //       const newRow = _this.classifyListFlat[related.rowIndex]
+      //       console.log(oldRow.level,newRow.level);
+      //       if (oldRow.level !== newRow.level) {
+      //         return false // 不允许不同级的拖动
+      //       }
+      //     }
+      //   });
+      // },
+      // flatClassifyList(list,parentId){
+      //   for (let i = 0; i < list.length; i++) {
+      //     const element = list[i];
+      //     const lastElementId = i==0?0:list[i-1].id
+      //     const nextElementId = i==(list.length-1)?0:list[i+1].id
+      //     this.classifyListFlat.push({id:element.id,lastElementId,nextElementId,parentId,level:element.level})
+      //     if(element.child && element.child.length>0){
+      //       this.flatClassifyList(element.child,element.id)
+      //     }
+      //   }
+      // },
       // 添加分类
       addClassify(){
         this.dialogTitle="添加分类"
@@ -347,6 +347,9 @@ import dragTreeTable from "drag-tree-table";
         this.dialogTitle="编辑分类"
         this.showAddClassifyDia=true
       },
+      selectParentId(value){
+        this.classifyForm.Level = this.$refs.parentIdCascaderRef.getCheckedNodes()[0].data.Level
+      },
       deleteClassify(item){
         this.$confirm('是否确认删除?', '提示', {
           confirmButtonText: '确定',
@@ -393,7 +396,8 @@ import dragTreeTable from "drag-tree-table";
       resetForm(){
         this.classifyForm={
           ParentId:0,
-          HelpDocClassifyName:''
+          HelpDocClassifyName:'',
+          Level:0
         }
         this.$refs.classifyFormRef.clearValidate()
       },
@@ -401,8 +405,11 @@ import dragTreeTable from "drag-tree-table";
       configClassify(row){
         this.permissionForm={
           HelpDocClassifyId:row.ClassifyId,
-          merchantIds:[]
+          merchantIds:row.VisibleBusinessIds?row.VisibleBusinessIds.split(',').map(element => {
+            return parseInt(element)
+          }):[]
         }
+        // console.log(this.permissionForm.merchantIds);
         this.dialogTitle="设置权限"
         this.showPermissionDia=true
       },
@@ -414,17 +421,17 @@ import dragTreeTable from "drag-tree-table";
         this.$refs.permissionFormRef.clearValidate()
       },
       configSave(){
-        //TODO: 保存权限设置
-        // assistanceDocInterence.editAssistanceClassify(this.classifyForm).then(res=>{
-        //   if(res.Ret == 200){
-        //     this.$message.success(this.dialogTitle+"成功")
-        //     this.showAddClassifyDia=false
-        //     this.resetForm()
-        //     this.getclassifyData()
-        //   }
-        // })
-        this.$message.success("设置成功")
-        this.showPermissionDia=false
+        assistanceDocInterence.editAssistanceClassifyVisible({
+          HelpDocClassifyId:this.permissionForm.HelpDocClassifyId,
+          VisibleBusinessIds:this.permissionForm.merchantIds.join(',')
+        }).then(res=>{
+          if(res.Ret == 200){
+            this.$message.success("设置成功")
+            this.showPermissionDia=false
+            this.resetPermissonForm()
+            this.getclassifyData()
+          }
+        })
       }
     },
   }

+ 10 - 0
src/views/system_manage/assistance_center/utils/common.js

@@ -0,0 +1,10 @@
+// 生成底部的两个链接
+export function createBottomHref(RecommendData){
+  let hrefStringBuiler='<ul style="margin-top:40px">'
+  RecommendData.map(item =>{
+    if(item.Name){
+      hrefStringBuiler+=`<li><a href="${item.Url}" target="_blank" style="text-decoration: underline;">${item.Name}</a></li>`
+    }
+  })
+  return hrefStringBuiler+"</ul>"
+}