jwyu 1 year ago
parent
commit
74d235554b

+ 10 - 0
src/api/modules/classifyApi.js

@@ -14,4 +14,14 @@ export const classifyPermissionInterface={
      editClassifyPermission:params=>{
 	    return http.post('/classify/permission/edit',params)
 	},
+
+	// 拖动排序
+	moveSort:params=>{
+		return http.post('/classify/move',params)
+	},
+
+	//启用\禁用
+	enableSet:params=>{
+		return http.post('/classify/enabled/set',params)
+	},
 }

+ 13 - 0
src/api/modules/classifyEnApi.js

@@ -53,3 +53,16 @@ export const setClassifyVariety=params=>{
   return http.post('/english_classify/permission/edit',params)
 }
 
+/**
+ * 拖动排序
+ */
+export const moveSort=params=>{
+  return http.post('/english_report/classify/move',params)
+}
+
+//启用\禁用
+export const enableSet=params=>{
+  return http.post('/english_report/classify/enabled/set',params)
+}
+
+

+ 41 - 0
src/api/modules/reportVariety.js

@@ -39,6 +39,47 @@ export const reportVarietyENInterence={
     //删除品种
     delVariety:params=>{
         return http.post('/en_permission/remove',params)
+    },
+    sortVariety:params=>{
+        return http.post('/en_permission/move',params)
     }
 
+}
+
+//中文品种
+export const reportVarietyInterence={
+    // 品种列表
+    varietyList:params=>{
+        return http.get('/permission/list',params)
+    },
+    //获取过滤后的品种列表数据
+    filterVarietyOpts:params=>{
+        return new Promise((resolve,reject)=>{
+            http.get('/en_permission/list',params).then(res=>{
+                if(res.Ret===200){
+                    const arr=res.Data||[]
+                    arr.forEach(e => {
+                        e.Child&&e.Child.forEach(_e=>{
+                            delete _e.Child
+                        })
+                    });
+                    const resArr=arr.filter(e=>e.Child&&e.Child.length>0)
+                    resolve(resArr)
+                }else{
+                    resolve([])
+                }
+            })
+        })
+    },
+    //新增品种
+    addVariety:params=>{
+        return http.post('/permission/add',params)
+    },
+    //编辑品种
+    editVariety:params=>{
+        return http.post('/permission/edit',params)
+    },
+    sortVariety:params=>{
+        return http.post('/permission/move',params)
+    }
 }

+ 4 - 3
src/utils/buttonConfig.js

@@ -127,9 +127,10 @@ export const authorManage = {
     authorManage_add:'authorManage:add',//添加作者按钮
 }
 /*
-*--------英文品种配置----------- 
+*--------品种配置----------- 
 */
-export const enChartPermission = {
+export const reportVariety = {
+    
     enChartPermission_del:'enChartPermission:del',
     enChartPermission_save:'enChartPermission:save',
 }
@@ -686,7 +687,7 @@ export const chartThemePermission = {
 const btnMap  = {
     reportManageBtn,enReportManageBtn,smartReportManageBtn,
     classifyBtn,enClassifyBtn,authorManage,
-    enChartPermission,cloudDisk,
+    reportVariety,cloudDisk,
     pptPermission,enPPTPermission,
     dataSourcePermission,
     edbDataPermission,predictEdbPermission,chartLibPermission,

+ 162 - 130
src/views/classify_manage/classifyEnListV2.vue

@@ -17,66 +17,35 @@
             </div>
         </div>
         <div class="content-box">
-            <div class="list-item-wrap">
-                <draggable
-                    v-model="level1_list"
-                    class="drag_list-wrap"
-                    animation="300"
-                    tag="ul"
-                >
-                    <li class="item" v-for="item in level1_list" :key="item.Id" @click="handleSelectLevel1(item)">
-                        <span class="tag open-tag">启用</span>
-                        <div style="flex:1">{{item.ClassifyName}}</div>
-                        <div>
-                            <span class="edit-btn" style="color:#0052D9" @click.stop="handleEdit(item,1)">编辑</span>
-                            <span class="edit-btn" style="color:#D54941">禁用</span> 
-                        </div>
-                    </li>
-                </draggable>
-            </div>
-            <div class="list-item-wrap">
-                <div v-if="level2_list&&level2_list.length>0">
-                    <div style="padding: 20px 0 0 20px;">二级分类</div>
-                    <draggable
-                        v-model="level2_list"
-                        class="drag_list-wrap"
-                        animation="300"
-                        tag="ul"
-                    >
-                        <li class="item" v-for="item in level2_list" :key="item.Id" @click="handleSelectLevel2(item)">
-                            <span class="tag open-tag">启用</span>
-                            <div style="flex:1">{{item.ClassifyName}}</div>
-                            <div>
-                                <span class="edit-btn" style="color:#0052D9" @click.stop="handleEdit(item,2)">编辑</span>
-                                <span class="edit-btn" style="color:#D54941">禁用</span> 
-                            </div>
-                        </li>
-                    </draggable>
-                </div>
-                
-                <span class="placehoder-text" v-else>请选择一级分类</span>
-            </div>
-            <div class="list-item-wrap">
-                <div v-if="level3_list&&level3_list.length>0">
-                    <div style="padding: 20px 0 0 20px;">三级分类</div>
-                    <draggable
-                        v-model="level3_list"
-                        class="drag_list-wrap"
-                        animation="300"
-                        tag="ul"
-                    >
-                        <li class="item" v-for="item in level3_list" :key="item.Id" @click="handleSelectLevel2(item)">
-                            <span class="tag open-tag">启用</span>
-                            <div style="flex:1">{{item.ClassifyName}}</div>
-                            <div>
-                                <span class="edit-btn" style="color:#0052D9" @click.stop="handleEdit(item,3)">编辑</span>
-                                <span class="edit-btn" style="color:#D54941">禁用</span> 
-                            </div>
-                        </li>
-                    </draggable>
-                </div>
-                <span class="placehoder-text" v-else>请选择二级分类</span>
-            </div>
+            <el-tree
+			    :data="list"
+				node-key="Id"
+                :props="{
+                    label: 'ClassifyName',
+                    children: 'Child'
+                }"
+				check-strictly
+				empty-text="暂无数据"
+                draggable
+                indent='76'
+                :allow-drop="canDropHandle"
+                @node-drop="dropOverHandle"
+			>
+				<div
+					class="classify-item-wrap"
+					slot-scope="{ node, data }"
+				>
+                    <div>
+                        <span :class="['tag', data.Enabled==1?'open':'close']" @click.stop="handleEnableSet(data)">{{data.Enabled==1?'启用':'禁用'}}</span>
+                        <span>{{data.ClassifyName}}</span>
+                    </div>
+					
+                    <div class="opt-box">
+                        <img class="icon-drag" src="~@/assets/img/data_m/move_ico2.png" alt="">
+                        <img class="icon-set" src="~@/assets/img/icons/variety_set.png" alt="" @click.stop="handleEdit(data,node)">
+                    </div>
+				</div>
+			</el-tree>
         </div>
 
         <!-- 分类弹窗 -->
@@ -92,7 +61,7 @@
                     ref="formRef" 
                     label-position="left"
                     hide-required-asterisk
-                    label-width="80px">
+                    label-width="90px">
                     <el-form-item prop="classify_name" label="分类名称">
                         <el-input 
                             type="text" 
@@ -103,14 +72,23 @@
                     </el-form-item>
                     <el-form-item prop="parent_id" label="上级分类">
                         <el-cascader :options="classifyparentArr" v-model="classifyForm.parent_id" placeholder="请选择"
-                        :props="{value:'Id',label:'ClassifyName',children:'Child',checkStrictly:true,emitPath:true}" style="min-width:400px;"></el-cascader>
+                        :props="{value:'Id',label:'ClassifyName',children:'Child',checkStrictly:true,emitPath:false}" style="min-width:400px;"></el-cascader>
                     </el-form-item>
-                    <el-form-item prop="variety" label="关联品种" v-if="classifyForm.parent_id&&classifyForm.parent_id.length==2">
+                    <el-form-item prop="variety" label="关联品种" v-if="classifyForm.level==3">
+                        <template slot="label">
+                            <el-tooltip class="item" effect="dark" content="控制报告阅读权限">
+                                <div>
+                                    <span>关联品种</span>
+                                    <i class="el-icon-info"></i>
+                                </div>
+                            </el-tooltip>
+                        </template>
                         <el-cascader
-                            :options="classifyparentArr" 
-                            v-model="classifyForm.parent_id" 
+                            :options="reportVarietyList" 
+                            v-model="classifyForm.variety" 
                             placeholder="请选择"
-                            :props="{value:'Id',label:'ClassifyName',children:'Child',checkStrictly:true,emitPath:true}" 
+                            collapse-tags
+                            :props="{value:'PermissionId',label:'PermissionName',children:'Child',multiple: true,emitPath:false}" 
                             style="min-width:400px;"
                         ></el-cascader>
                     </el-form-item>
@@ -134,6 +112,7 @@
 <script>
 import draggable from 'vuedraggable';
 import mDialog from '@/components/mDialog.vue';
+import {reportVarietyENInterence} from '@/api/modules/reportVariety'
 import * as classifyEnInterface from "@/api/modules/classifyEnApi.js";
 export default {
     components:{draggable,mDialog},
@@ -148,25 +127,27 @@ export default {
         return {
             typeVal:1,
             searchVal:'',
-            level1_list:[],
-            level2_list:[],
-            level3_list:[],
+            list:[],
 
             classifyForm:{
                 show:false,
                 classify_id:0,
                 classify_name:"",
-                parent_id: ['0'],
+                parent_id: '',
                 variety:'',//关联的品种
+                level:1
             },
             formRules: {
                 classify_name: [{ required:true,message:'请输入分类名称',trigger:'blur'}]
             },
-            classifyparentArr:[]
+            classifyparentArr:[],
+
+            reportVarietyList:[],//英文品种列表
         }
     },
     mounted(){
         this.getList()
+        this.getReportVarietyList()
     },
     methods: {
         async getList(){
@@ -174,18 +155,10 @@ export default {
                 KeyWord:this.searchVal
             })
             if(res.Ret===200){
-                this.level1_list=res.Data.List||[]
-                this.level2_list=[]
-                this.level3_list=[]
+                this.list=res.Data.List||[]
             }
         },
-        handleSelectLevel1(item){
-            this.level2_list=item.Child||[]
-            this.level3_list=[]
-        },
-        handleSelectLevel2(item){
-            this.level3_list=item.Child||[]
-        },
+        
         /* 获取一级分类 */
         getClassifyOne() {
             classifyEnInterface.classifyOne({ CurrentIndex: 1, PageSize: 9999}).then(res => {
@@ -196,28 +169,37 @@ export default {
                 this.classifyparentArr.unshift({Id:"0",ClassifyName:'无',Child:null})
             })
         },
+
+        //启用\禁用设置
+        handleEnableSet(item){
+            classifyEnInterface.enableSet({
+                ClassifyId:item.Id,
+                Enabled:item.Enabled==1?0:1
+            }).then(res=>{
+                if(res.Ret===200){
+                    this.$message.success('设置成功')
+                    this.getList()
+                }
+            })
+        },
+
         addClassify(){
             this.classifyForm={
                 show:true,
                 classify_id:0,
                 classify_name:"",
-                parent_id: ['0'],
+                parent_id: '',
                 variety:'',//关联的品种
             }
         },
-        handleEdit(item,level){
-            let parent_id=['0']
-            if(level===2){
-                parent_id=[item.ParentId]
-            }else if(level===3){
-                parent_id=[item.RootId,item.ParentId]
-            }
+        handleEdit(item,node){
             this.classifyForm={
                 show:true,
                 classify_id:item.Id,
                 classify_name:item.ClassifyName,
-                parent_id: parent_id,
-                variety:level===3?item.EnPermissions:'',//关联的品种
+                parent_id: item.ParentId||'0',
+                variety:item.EnPermissions||'',//关联的品种
+                level:node.level
             }
         },
         async setClassifyHandle(){
@@ -227,6 +209,8 @@ export default {
                 ClassifyName: classify_name,
                 ParentId: parent_id&&parent_id[parent_id.length-1]?parseInt(parent_id):0,
             }
+            console.log(this.classifyForm);
+            return
 
             const { Ret,Msg } = classify_id 
                 ? await classifyEnInterface.classifyEdit({...params,ClassifyId: classify_id}) 
@@ -242,6 +226,56 @@ export default {
             this.$refs.formRef.resetFields();
             this.classifyForm.show = false;
         },
+
+        // 获取品种数据
+        getReportVarietyList(){
+            reportVarietyENInterence.filterVarietyOpts().then(res=>{
+                this.reportVarietyList=res||[]
+            })
+        },
+
+        //控制只能同级拖动
+        canDropHandle(draggingNode, dropNode, type){
+            if(type==='inner') return false //禁止向内部拖动
+            if(draggingNode.level!=dropNode.level) return false
+            if(draggingNode.data.ParentId!=dropNode.data.ParentId) return false
+            return true
+        },
+
+        //拖动结束
+        dropOverHandle(b,a,i,e) {
+            // 被拖拽节点对应的 Node、结束拖拽时最后进入的节点、被拖拽节点的放置位置
+            const classifyId=b.data.Id
+            let list=a.parent.childNodes;
+            let PrevClassifyId=0,NextClassifyId=0,targetIndex=0;
+            list.forEach((item,index) => {
+                if(item.data.Id===classifyId){
+                    targetIndex=index
+                }
+            });
+            if(targetIndex===0){
+                NextClassifyId=list[1].data.Id
+            }else if(targetIndex===list.length-1){
+                PrevClassifyId=list[list.length-1].data.Id
+            }else{
+                PrevClassifyId=list[targetIndex-1].data.Id
+                NextClassifyId=list[targetIndex+1].data.Id
+            }
+
+            const params={
+                ClassifyId:classifyId,
+                PrevClassifyId,
+                NextClassifyId
+            }
+            console.log(params);
+            classifyEnInterface.moveSort(params).then(res=>{
+                if(res.Ret===200){
+                    this.$message.success('操作成功')
+                }else{
+                    this.getList()
+                }
+            })
+        },
     },
 }
 </script>
@@ -250,6 +284,15 @@ export default {
 .el-cascader .el-input{
   width: 100%;
 }
+.classify-page{
+    .content-box{
+        .el-tree-node__content{
+            padding-top: 10px;
+            padding-bottom: 10px;
+            border-bottom: 1px solid #C8CDD9;
+        }
+    }
+}
 
 </style>
 <style lang="scss" scoped>
@@ -284,47 +327,36 @@ export default {
     }
 }
 .content-box{
-    margin-top: 30px;
-    display: flex;
-    gap: 0 30px;
-    .list-item-wrap{
+    padding: 20px;
+    margin-top: 20px;
+    height: calc(100vh - 230px);
+    overflow-y: auto;
+    background-color: #FFFFFF;
+    .classify-item-wrap{
         flex: 1;
-        background-color: #FFFFFF;
-        height: calc(100vh - 230px);
-        position: relative;
-        .placehoder-text{
-            position: absolute;
-            top: 50%;
-            left: 50%;
-            transform: translate(-50%,-50%);
-            color: #C0C4CC;
+        padding-right: 20px;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        .tag{
+            display: inline-block;
+            min-width: 76px;
+            line-height: 30px;
+            text-align: center;
+            &.open{
+                background-color: #ECF2FE;
+                color: #0052D9;
+            }
+            &.close{
+                background-color: #0052D9;
+                color: #fff;
+            }
         }
-        .drag_list-wrap{
-            padding: 20px;
-            box-sizing: border-box;
-            .item{
-                box-sizing: border-box;
-                display: flex;
-                align-items: center;
-                justify-content: space-between;
-                padding: 10px 0;
-                border-bottom: 1px solid #C8CDD9;
-                .tag{
-                    min-width: 76px;
-                    line-height: 30px;
-                    text-align: center;
-                    display: inline-block;
-                    margin-right: 10px;
-                }
-                .open-tag{
-                    color: #2BA471;
-                    background-color: #E3F9E9;
-                }
-                .edit-btn{
-                    margin-left: 30px;
-                    display: inline-block;
-                    cursor: pointer;
-                }
+        .opt-box{
+            .icon-drag,.icon-set{
+                width: 16px;
+                height: 16px;
+                margin-left: 10px;
             }
         }
     } 

+ 78 - 11
src/views/classify_manage/classifylistV2.vue

@@ -27,15 +27,16 @@
 				check-strictly
 				empty-text="暂无数据"
                 draggable
-                icon-class=""
                 indent='76'
+                :allow-drop="canDropHandle"
+                @node-drop="dropOverHandle"
 			>
 				<div
 					class="classify-item-wrap"
 					slot-scope="{ node, data }"
 				>
                     <div>
-                        <span class="tag open">启用</span>
+                        <span :class="['tag', data.Enabled==1?'open':'close']" @click.stop="handleEnableSet(data)">{{data.Enabled==1?'启用':'禁用'}}</span>
                         <span>{{data.ClassifyName}}</span>
                     </div>
 					
@@ -82,14 +83,14 @@
                                     <span>关联品种</span>
                                     <i class="el-icon-info"></i>
                                 </div>
-                                
                             </el-tooltip>
                         </template>
                         <el-cascader
-                            :options="classifyparentArr" 
-                            v-model="classifyForm.parent_id" 
+                            :options="reportVarietyList" 
+                            v-model="classifyForm.variety" 
                             placeholder="请选择"
-                            :props="{value:'Id',label:'ClassifyName',children:'Child',checkStrictly:true,emitPath:true}" 
+                            collapse-tags
+                            :props="{value:'PermissionId',label:'PermissionName',children:'Child',multiple: true}" 
                             style="min-width:400px;"
                         ></el-cascader>
                     </el-form-item>
@@ -112,7 +113,9 @@
 
 <script>
 import mDialog from '@/components/mDialog.vue';
-import { classifylist,classifyparent,classifyadd,classifydelete,classifyedit,checkDeleteClassify } from 'api/api.js';
+import { classifylist,classifyparent,classifyadd,classifyedit } from 'api/api.js';
+import {reportVarietyInterence} from '@/api/modules/reportVariety'
+import {classifyPermissionInterface} from '@/api/modules/classifyApi.js'
 export default {
     components:{mDialog},
     watch: {
@@ -138,11 +141,14 @@ export default {
             formRules: {
                 classify_name: [{ required:true,message:'请输入分类名称',trigger:'blur'}]
             },
-            classifyparentArr:[]
+            classifyparentArr:[],
+
+            reportVarietyList:[],//中文品种列表
         }
     },
     mounted(){
         this.getList()
+        this.getReportVarietyList()
     },
     methods: {
         async getList(){
@@ -202,6 +208,70 @@ export default {
             this.$refs.formRef.resetFields();
             this.classifyForm.show = false;
         },
+
+        // 获取品种数据
+        getReportVarietyList(){
+            reportVarietyInterence.filterVarietyOpts().then(res=>{
+                this.reportVarietyList=res||[]
+            })
+        },
+
+        //启用\禁用设置
+        handleEnableSet(item){
+            classifyPermissionInterface.enableSet({
+                ClassifyId:item.Id,
+                Enabled:item.Enabled==1?0:1
+            }).then(res=>{
+                if(res.Ret===200){
+                    this.$message.success('设置成功')
+                    this.getList()
+                }
+            })
+        },
+
+        //控制只能同级拖动
+        canDropHandle(draggingNode, dropNode, type){
+            if(type==='inner') return false //禁止向内部拖动
+            if(draggingNode.level!=dropNode.level) return false
+            if(draggingNode.data.ParentId!=dropNode.data.ParentId) return false
+            return true
+        },
+
+        //拖动结束
+        dropOverHandle(b,a,i,e) {
+            // 被拖拽节点对应的 Node、结束拖拽时最后进入的节点、被拖拽节点的放置位置
+            const classifyId=b.data.Id
+            let list=a.parent.childNodes;
+            let PrevClassifyId=0,NextClassifyId=0,targetIndex=0;
+            list.forEach((item,index) => {
+                if(item.data.Id===classifyId){
+                    targetIndex=index
+                }
+            });
+            if(targetIndex===0){
+                NextClassifyId=list[1].data.Id
+            }else if(targetIndex===list.length-1){
+                PrevClassifyId=list[list.length-1].data.Id
+            }else{
+                PrevClassifyId=list[targetIndex-1].data.Id
+                NextClassifyId=list[targetIndex+1].data.Id
+            }
+
+            const params={
+                ClassifyId:classifyId,
+                PrevClassifyId,
+                NextClassifyId
+            }
+            console.log(params);
+            classifyPermissionInterface.moveSort(params).then(res=>{
+                if(res.Ret===200){
+                    this.$message.success('操作成功')
+                }else{
+                    this.getList()
+                }
+            })
+        },
+        
     },
 }
 </script>
@@ -217,9 +287,6 @@ export default {
             padding-bottom: 10px;
             border-bottom: 1px solid #C8CDD9;
         }
-        // .el-tree-node.is-current > .el-tree-node__content {
-		// 	background-color: #f0f4ff !important;
-		// }
     }
 }
 

+ 199 - 128
src/views/report_manage/reportVariety.vue

@@ -9,7 +9,7 @@
         <div class="main-wrap">
             <div class="left-wrap">
                 <div class="add-btn-box">
-                    <el-button type="primary" v-permission="permissionBtn.enChartPermission.enChartPermission_save" @click="handleAddVariety">添加品种</el-button>
+                    <el-button type="primary" @click="handleAddVariety">添加品种</el-button>
                 </div>
                 <div class="first-variety-wrap">
                     <draggable
@@ -18,14 +18,15 @@
                         animation="300"
                         tag="ul"
                         handle=".icon-drag"
+                        @end="handleSortEnd($event,1)"
                     >
                         <li 
-                            :class="['item',selectFirstId==item.EnPermissionId?'active':'']" 
+                            :class="['item',selectFirstId==item.PermissionId?'active':'']" 
                             v-for="item in tableData" 
-                            :key="item.EnPermissionId"
+                            :key="item.PermissionId"
                             @click="handleSelectFirstVariety(item)"
                         >
-                            <div class="name">{{item.EnPermissionName}}</div>
+                            <div class="name">{{item.PermissionName}}</div>
                             <div class="menu-box">
                                 <img class="icon-drag" src="~@/assets/img/data_m/move_ico2.png" alt="">
                                 <img class="icon-set" src="~@/assets/img/icons/variety_set.png" alt="" @click="handleShowEdit(item)">
@@ -34,53 +35,51 @@
                     </draggable>
                 </div>
             </div>
+            <div>
             <draggable
+                v-model="secondVarietyList"
                 class="list-wrap"
                 animation="300"
                 tag="ul"
                 handle=".icon-drag"
                 :move="onMove"
-                @start="dragStart"
-                @update="dragenter"
-                @end="menuDragOver"
+                @end="handleSortEnd($event,2)"
             >
-                <li class="item add-btn" v-if="selectFirstId">
+                <!-- <li class="item add-btn" v-if="selectFirstId" @click="handleAddVariety(2)">
                     <img class="icon" src="~@/assets/img/icons/variety_add.png" alt="">
-                </li>
-                <li class="item" v-for="item in secondVarietyList" :key="item.EnPermissionId">
+                </li> -->
+                <li class="item" v-for="item in secondVarietyList" :key="item.PermissionId">
                     <div class="top-icons">
                         <img class="icon-drag" src="~@/assets/img/data_m/move_ico2.png" alt="">
-                        <el-switch
-                            :value="true"
-                            active-color="#0052D9">
-                        </el-switch>
+                        <span @click="handleQuickSet(item,'enable')">
+                            <el-switch
+                                :value="item.Enabled==1"
+                                active-color="#0052D9"
+                            />
+                        </span>
                     </div>
                     <div class="name-box">
-                        <el-input
-							ref="editVal"
-                            size='mini'
-							style="width: 90px"
-							placeholder="请输入值"
-							class="label-input"
-							v-model="new_label"
-							v-if="item.isEdit"
-							@blur="changeValue(item)"
-						/>
-                        <template v-else>
-                        <div class="name" >{{item.EnPermissionName}}</div>
-                        <img @click="editNodeLabel(item)" class="icon-edit" src="~@/assets/img/icons/variety_name_edit.png" alt="">
-                        </template>
+                        <div class="name" >{{item.PermissionName}}</div>
+                        <img @click="handleShowEdit(item)" class="icon-edit" src="~@/assets/img/icons/variety_name_edit.png" alt="">
                     </div>
-                    <div class="tag-box open" v-if="true">
+                    <template v-if="typeVal==1">
+                    <div class="tag-box open" v-if="item.IsPublic==1" @click="handleQuickSet(item,'ispublic')">
                         <span class="tag">公有</span>
                         <img class="icon" src="~@/assets/img/icons/changeLang01.png" alt="">
                     </div>
-                    <div class="tag-box close" v-else>
+                    <div class="tag-box close" v-else @click="handleQuickSet(item,'ispublic')">
                         <span class="tag">私有</span>
                         <img class="icon" src="~@/assets/img/icons/edit_icon01.png" alt="">
                     </div>
+                    </template>
                 </li> 
             </draggable>
+            <ul class="list-wrap" style="float:left;margin-top:20px">
+                <li class="item add-btn" v-if="selectFirstId" @click="handleAddVariety(2)">
+                    <img class="icon" src="~@/assets/img/icons/variety_add.png" alt="">
+                </li>
+            </ul>
+            </div>
         </div>
 
         <!-- 品种编辑弹窗 -->
@@ -95,6 +94,16 @@
         >
             <div class="edit-variety-wrap" style="padding-bottom:30px">
                 <el-form>
+                    <el-form-item label="上级品种" v-if="editBreedData.parentId">
+                        <el-select v-model="editBreedData.parentId" style="width:400px">
+                            <el-option 
+                                v-for="item in tableData" 
+                                :key="item.PermissionId"
+                                :label="item.PermissionName"
+                                :value="item.PermissionId"
+                            />
+                        </el-select>
+                    </el-form-item>
                     <el-form-item label="品种名称">
                         <el-input placeholder="请输入品种名称" v-model="editBreedData.name" style="width:400px"></el-input>
                     </el-form-item>
@@ -104,6 +113,21 @@
                             active-color="#0052D9">
                         </el-switch>
                     </el-form-item>
+                    <!-- 中文品种特有的设置公有权限 -->
+                    <div class="public-auth-box" v-if="typeVal==1&&secondVarietyList.length>0&&editBreedData.parentId==0">
+                        <el-tooltip effect="dark" content="默认为私有,勾选并保存设置为公有">
+                            <div style="display:inline-block">
+                                <span>公有权限设置</span>
+                                <i class="el-icon-info"></i>
+                            </div>
+                        </el-tooltip>
+                        <div class="auth-list-box">
+                            <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
+                            <el-checkbox-group style="padding:20px" v-model="checkedList" @change="handleCheckedAuthChange">
+                                <el-checkbox style="display:block;margin-bottom:10px" v-for="item in secondVarietyList" :label="item.PermissionId" :key="item.PermissionId">{{item.PermissionName}}</el-checkbox>
+                            </el-checkbox-group>   
+                        </div>
+                    </div>
                 </el-form>
                 <div style="text-align: center;margin-top:40px">
                     <el-button type="primary" plain @click="showEditBreed=false">取消</el-button>
@@ -116,7 +140,7 @@
 
 <script>
 import draggable from 'vuedraggable';
-import {reportVarietyENInterence} from '@/api/api'
+import {reportVarietyENInterence,reportVarietyInterence} from '@/api/modules/reportVariety'
 export default {
     components:{draggable},
     watch: {
@@ -125,9 +149,13 @@ export default {
                 this.editBreedData={
                     id:0,
                     name:'',
-                    sort:0,
                     parentId:0,
+                    status:true,//启用状态
+                    IsPublic:0,//1公有,0私有
                 }
+                this.isIndeterminate=false
+                this.checkAll=false
+                this.checkedList=[]
             }
         }
     },
@@ -141,15 +169,17 @@ export default {
             selectFirstId:0,//当前选中的一级品种Id
             secondVarietyList:[],//当前选中的一级品种下的二级品种数据
 
-            new_label:'',//当前编辑二级品种的名称值
-
             showEditBreed:false,
             editBreedData:{
                 id:0,
                 name:'',
+                parentId:0,
                 status:true,//启用状态
-
+                IsPublic:0,//1公有,0私有
             },
+            isIndeterminate:false,
+            checkAll:false,
+            checkedList:[]
         }
     },
     created(){
@@ -158,71 +188,149 @@ export default {
     methods: {
         async getList(){
             this.listLoading=true
-            const res=await reportVarietyENInterence.varietyList({Keyword:this.searchVal})
+            const res=this.typeVal==1?await reportVarietyInterence.varietyList({Keyword:this.searchVal}) : await reportVarietyENInterence.varietyList({Keyword:this.searchVal})
             this.listLoading=false
             if(res.Ret===200){
                 this.tableData=res.Data||[]
                 if(this.tableData.length>0){
-                    this.handleSelectFirstVariety(this.tableData[0])
+                    if(this.selectFirstId==0){
+                        this.handleSelectFirstVariety(this.tableData[0])
+                    }else{
+                        let index=this.tableData.findIndex(e=>e.PermissionId==this.selectFirstId)
+                        this.handleSelectFirstVariety(this.tableData[index])
+                    }
+                    
                 }
             }
         },
 
         // 点击一级分类
         handleSelectFirstVariety(item){
-            this.selectFirstId=item.EnPermissionId
-            this.secondVarietyList=item.Child||[]
+            this.selectFirstId=item.PermissionId
+            const arr=item.Child?JSON.parse(JSON.stringify(item.Child)):[]
+            this.secondVarietyList=arr
         },
 
-        //点击编辑二级品种名称
-        editNodeLabel(item){
-            this.$set(item,'isEdit',true)
-            this.new_label = item.EnPermissionName;
-			this.$nextTick(() => {
-				this.$refs.editVal[0].focus();
-			});
-        },
-        changeValue(item){
-            if(this.new_label) {
-				this.$set(item,'isEdit',false)
-				// this.new_label !== data.ClassifyName && dataBaseInterface.nodeEdit({
-				// 		ClassifyId: data.ClassifyId,
-				// 		ClassifyName: this.new_label
-				// 	}).then(res => {
-				// 		if(res.Ret === 200) {
-				// 			this.getTreeData();
-				// 		}
-				// 	})
-			}else {
-				this.$message.warning('名称不能为空')
-			}
+        // 快捷设置是否禁用\公有私有
+        async handleQuickSet(item,type){
+            let params={
+                PermissionId:item.PermissionId,
+                PermissionName:item.PermissionName
+            }
+            if(type==='enable'){
+                params.enabled=item.Enabled==1?0:1
+                params.IsPublic=item.IsPublic
+            }else if(type==='ispublic'){
+                params.IsPublic=item.IsPublic==1?0:1
+                params.enabled=item.Enabled
+            }
+            const res=this.typeVal==1?await reportVarietyInterence.editVariety(params):await reportVarietyENInterence.editVariety(params)
+            if(res.Ret===200){
+                this.$message.success(`编辑成功`)
+                this.getList()
+            }
         },
-
-        handleAddVariety(){
-            this.showEditBreed=true
-            this.editBreedData={
-                id:0,
-                name:'',
-                status:true,//启用状态
+    
+        //显示添加品种
+        handleAddVariety(level){
+            if(level==2){
+                this.editBreedData.parentId=this.selectFirstId
             }
+            this.showEditBreed=true
         },
 
+        //点击显示编辑品种
         handleShowEdit(item){
-            this.showEditBreed=true
+            if(item.ParentId){//编辑子分类
+                this.editBreedData={
+                    id:item.PermissionId,
+                    name:item.PermissionName,
+                    parentId:item.ParentId,
+                    status:item.Enabled===1?true:false
+                }
+                this.showEditBreed=true
+                return
+            }
+            this.selectFirstId=item.PermissionId
+            const arr=item.Child?JSON.parse(JSON.stringify(item.Child)):[]
+            this.secondVarietyList=arr
+
+            this.secondVarietyList.forEach(item=>{
+                if(item.IsPublic==1){
+                    this.checkedList.push(item.PermissionId)
+                }
+            })
+            this.checkAll = this.checkedList.length === this.secondVarietyList.length;
+            this.isIndeterminate = this.checkedList.length > 0 && this.checkedList.length < this.secondVarietyList.length;
+            
             this.editBreedData={
-                id:item.EnPermissionId,
-                name:item.EnPermissionName
+                id:item.PermissionId,
+                name:item.PermissionName,
+                parentId:item.ParentId,
+                status:item.Enabled===1?true:false
             }
+
+            console.log(this.isIndeterminate,this.checkedList);
+
+            this.showEditBreed=true
+        },
+
+        // 公有权限设置全选按钮
+        handleCheckAllChange(val){
+            let list=[]
+            this.secondVarietyList.forEach(item => {
+                list.push(item.PermissionId)
+            });
+            this.checkedList=val?list:[]
+            this.isIndeterminate=false
+        },
+        handleCheckedAuthChange(value){
+            let checkedCount = value.length;
+            this.checkAll = checkedCount === this.secondVarietyList.length;
+            this.isIndeterminate = checkedCount > 0 && checkedCount < this.secondVarietyList.length;
         },
 
         onMove(e){
-            if(e.relatedContext.index===0) return false
+            // if(e.relatedContext.index===0) return false //控制新增按钮不能拖动
             return true
         },
 
+        // 拖动排序结束
+        async handleSortEnd(e,level){
+            const arr=level==1?this.tableData:this.secondVarietyList
+            if(arr.length===1) return
+
+            const newIndex=level==1?e.newIndex:e.newIndex//因为子组件前面有个固定的添加项 所以实际index要-1
+            const PermissionId=arr[newIndex].PermissionId
+            let PrevPermissionId=0,NextPermissionId=0;
+
+            if(newIndex==0){//移动到最前面
+                NextPermissionId=arr[newIndex+1].PermissionId
+            }else if(newIndex===arr.length-1){//移动到最后面
+                PrevPermissionId=arr[newIndex-1].PermissionId
+            }else{
+                PrevPermissionId=arr[newIndex-1].PermissionId
+                NextPermissionId=arr[newIndex+1].PermissionId
+            }
+            const params={
+                PermissionId,
+                PrevPermissionId,
+                NextPermissionId
+            }
+            const res=this.typeVal==1?await reportVarietyInterence.sortVariety(params):await reportVarietyENInterence.sortVariety(params)
+            if(res.Ret===200){
+                this.$message.success('操作成功')
+            }
+            this.getList()
+        },
+
         // 中英文品种切换
         handleTypeChange(type){
             this.typeVal=type
+            this.tableData=[]
+            this.selectFirstId=0
+            this.secondVarietyList=[]
+            this.getList()
         },
 
         async handleConfirmEidtBreed(){
@@ -231,50 +339,28 @@ export default {
                 return
             }
             let params={
-                EnPermissionName:this.editBreedData.name,
+                PermissionName:this.editBreedData.name,
                 ParentId:this.editBreedData.parentId,
-                Sort:Number(this.editBreedData.sort)
+                enabled:this.editBreedData.status?1:0
             }
             if(this.editBreedData.id){
-                params.EnPermissionId=this.editBreedData.id
+                params.PermissionId=this.editBreedData.id
+            }
+            let res
+            // 中文
+            if(this.typeVal===1){
+                if(this.editBreedData.id>0&&params.ParentId==0){//编辑一级品种时批量设置公有权限
+                    params.PublicPermissionIds=this.checkedList||[]
+                }
+                res=this.editBreedData.id?await reportVarietyInterence.editVariety(params):await reportVarietyInterence.addVariety(params)
+            }else{//英文
+                res=this.editBreedData.id?await reportVarietyENInterence.editVariety(params):await reportVarietyENInterence.addVariety(params)
             }
-            const res=this.editBreedData.id?await reportVarietyENInterence.editVariety(params):await reportVarietyENInterence.addVariety(params)
             if(res.Ret===200){
                 this.$message.success(`${this.editBreedData.id?'编辑':"新增"}成功`)
                 this.getList()
                 this.showEditBreed=false
-                this.getParentVarietyList()
             }
-        },
-
-        handleEditBreedItem(item){
-            this.editBreedData={
-                id:item.EnPermissionId,
-                name:item.EnPermissionName,
-                sort:item.Sort,
-                parentId:item.ParentId||0
-            }
-            this.getParentVarietyList(item.ParentId?false:true)
-            this.showEditBreed=true
-        },
-
-        // 删除品种
-        handleDelBreedItem(item){
-            this.$confirm('确认删除吗?', '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(()=>{
-                reportVarietyENInterence.delVariety({
-                    EnPermissionId:item.EnPermissionId
-                }).then(res=>{
-                    if(res.Ret===200){
-                        this.$message.success('删除成功')
-                        this.getList()
-                        this.getParentVarietyList()
-                    }
-                })
-            })
         }
     },
 }
@@ -417,28 +503,13 @@ export default {
     }
 }
 .edit-variety-wrap{
-    height: 100%;
-    display: flex;
-    flex-direction: column;
-    .header-box{
-        display: flex;
-        justify-content: space-between;
-        align-items: center;
-        height: 48px;
-        border-bottom: 1px solid #E7E7E7;
-        .title{
-            width: 88px;
-            height: 48px;
-            line-height: 48px;
-            font-size: 16px;
-            text-align: center;
-            color: #0052D9;
-            border-bottom: 2px solid #0052D9;
+    .public-auth-box{
+        .auth-list-box{
+            margin-top: 20px;
+            padding: 20px;
+            background-color: #F8F8F8;
         }
-    }
-    .content-box{
-        flex: 1;
-        overflow-y: auto;
+        
     }
 }
 </style>