Zhang Li, BBF-411-2(Neusoft) il y a 2 ans
Parent
commit
3262604438

+ 37 - 0
src/views/modules/knowledge/aJs/getClassifyTree.js

@@ -39,4 +39,41 @@ export function getParentNode(data) {
   }
   _getParentCategoryName(parentData)
   return result.reverse()
+}
+
+// 获取指定id数据的children长度
+export function getChildrenLength(data,record) {
+  let info = ''
+  const _computedChildrenLength = (data,id) => {
+    for(let i of data) {
+      if(i.pkId == id) {
+        info = i.children.length
+        return
+      } else {
+        if(i.children) {
+          _computedChildrenLength(i.children,id)
+        }
+      }
+    }
+  }
+  _computedChildrenLength(data,record.parent)
+  return info
+}
+
+// 隐藏当前选中等级
+export function hideChooseLevel(data,level) {
+  let nowLevel = level
+  const _computedChildrenLength = (data) => {
+    data.forEach((element) => {
+      if(nowLevel == element.level) {
+        delete element.children
+      } else {
+        if(element.children) {
+          _computedChildrenLength(element.children)
+        }
+      }
+    })
+  }
+  _computedChildrenLength(data)
+  return data
 }

+ 1 - 1
src/views/modules/knowledge/aMixin/mixin.js

@@ -66,7 +66,7 @@ export default (deleteTitle) => {
           this.queryParam.categoryId = ''
         }
         if(isNeedReload == true) {
-          setTimeout(() => this.reloadTable(), 500)
+          setTimeout(() => (this.reloadTable(),this.isShowButton = true), 500)
         }
       },
       // 删除

+ 25 - 1
src/views/modules/knowledge/map/addUpdateMap.vue

@@ -195,6 +195,12 @@
             </a-form-model-item>
             <a-form-model-item label="知识分类:" prop="classify" v-show="learnForm.type==2">
               <a-cascader v-model="learnForm.classify" 
+                class="scroll-ckunk"  
+                :popupStyle="{
+                  maxWidth: '40vw',
+                  'overflow-x': 'auto',
+                }"
+                :getPopupContainer="triggerNode => { return triggerNode.parentNode }"
                 :options="classifyList" 
                 :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
                 placeholder="请选择"
@@ -226,6 +232,7 @@ import initMixin from "../aMixin/initMixin"
 import getTimeNow from '@/views/modules/knowledge/aJs/getTimeNow'
 import SessionCache from '../aJs/cache'
 import { getParentNode } from '@/views/modules/knowledge/aJs/getClassifyTree'
+
 export default {
   name: 'knowledgeAddUpdate',
   mixins: [ initMixin ],
@@ -377,7 +384,7 @@ export default {
       OsGroupApi.getAllOsGroupList({dimId:1}).then(res => {
         let listOption = []
         for (let i = 0; i < res.length; i++) {
-          if(res[i].path.indexOf("C0000")>-1){
+          if(res[i].path && res[i].path.indexOf("C0000")>-1){
             let tempData = {}
             tempData.pId = res[i].parentId
             tempData.title = res[i].name
@@ -670,6 +677,14 @@ export default {
     addLearnInfo(){
       this.learnForm = Object.assign({},this.$options.data().learnForm)
       this.showLearnFlag = true
+
+      setInterval(() => {
+        document.querySelectorAll('.ant-cascader-menu-item').forEach(el => {
+          el.onclick = function() {
+            document.querySelector('.ant-cascader-menus').scrollLeft = 2048
+          }
+        })
+      }, 1000)
     },
     // 选中分类
     async handleClassifyChange(value, selectedOptions) {
@@ -966,4 +981,13 @@ export default {
   background-color: #fff;
   border-color: #ccc;
 }
+/deep/ .ant-cascader-menus {
+  left: 0!important;
+}
+/deep/ .ant-cascader-menu:last-child {
+  margin-right: 0;
+}
+/deep/ .ant-modal-wrap {
+  overflow: inherit;
+}
 </style>

+ 34 - 4
src/views/modules/knowledge/warehouse/auditManageList.vue

@@ -30,7 +30,7 @@
                     class="form-item-style"
                     label="审核状态"
                     name="online">
-                    <a-select class="set-input" v-model="queryParam.approvalStatus" placeholder="请选择"  allowClear>
+                    <a-select class="set-input" v-model="queryParam.approvalStatus" placeholder="请选择"  allowClear :getPopupContainer="triggerNode => { return triggerNode.parentNode }">
                       <a-select-option v-for="(item,index) in approvalStatusList" :key="index" :value="item.value">
                         {{item.label}}
                       </a-select-option>
@@ -40,7 +40,7 @@
                     class="form-item-style"
                     label="知识类别"
                     name="online">
-                    <a-select class="set-input" v-model="queryParam.type" placeholder="请选择"  allowClear>
+                    <a-select class="set-input" v-model="queryParam.type" placeholder="请选择"  allowClear :getPopupContainer="triggerNode => { return triggerNode.parentNode }">
                       <a-select-option v-for="(item,index) in knowledgeList" :key="index" :value="item.value">
                         {{item.label}}
                       </a-select-option>
@@ -51,7 +51,12 @@
                     label="所属分类"
                     name="categoryIds">
                     <a-cascader v-model="categoryIds" 
-                                class="set-input"
+                                class="set-input scroll-ckunk"
+                                :popupStyle="{
+                                  maxWidth: widthVar + 'px',
+                                  'overflow-x': 'auto'
+                                }"
+                                :getPopupContainer="triggerNode => { return triggerNode.parentNode }"
                                 :options="classifyList" 
                                 :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
                                 placeholder="请选择"
@@ -396,7 +401,8 @@ export default {
       // 职等
       gradesInfo: {},
       // 文档知识不能选择权限
-      isDocument: false
+      isDocument: false,
+      widthVar: 800
     }
   },
   created() {
@@ -419,6 +425,24 @@ export default {
     }
     this.init()
   },
+  mounted() {
+    let innerWidth = window.innerWidth
+
+    // 计算
+    setTimeout(() => {
+      let offsetWidth = document.querySelector('.scroll-ckunk').getBoundingClientRect().left
+      this.widthVar = innerWidth - offsetWidth - 40
+    }, 1000);
+    
+    setInterval(() => {
+      document.querySelectorAll('.ant-cascader-menu-item').forEach(el => {
+        el.onclick = function() {
+          document.querySelector('.ant-cascader-menus').scrollLeft = 2048
+        }
+      })
+    }, 1000)
+   
+  },
   computed: {
     getApprovalStatus(){
       return function(arg) {
@@ -702,4 +726,10 @@ export default {
 /deep/ .gridContent{
   border: none;
 }
+/deep/ .ant-cascader-menus {
+  left: 0!important;
+}
+/deep/ .ant-cascader-menu:last-child {
+  margin-right: 0;
+}
 </style>

+ 32 - 1
src/views/modules/knowledge/warehouse/knowledgeAddUpdate.vue

@@ -8,6 +8,12 @@
             <a-form-model ref="knowledgeRef" :model="knowledgeForm" :rules="knowledgeRules" layout="inline" hideRequiredMark>
               <a-form-model-item label="*所选分类:" prop="categoryId">
                 <a-cascader v-model="knowledgeForm.categoryId" 
+                  class="scroll-ckunk"
+                  :popupStyle="{
+                    maxWidth: widthVar + 'px',
+                    'overflow-x': 'auto'
+                  }"
+                  :getPopupContainer="triggerNode => { return triggerNode.parentNode }"
                   :disabled="!!pkId"
                   :options="classifyList" 
                   :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
@@ -247,7 +253,8 @@ export default {
       // 职系
       sequencesInfo: {},
       // 职等
-      gradesInfo: {}
+      gradesInfo: {},
+      innerWidth: 800
     }
   },
   created() {
@@ -316,6 +323,24 @@ export default {
       this.headers['Authorization'] = 'Bearer ' + token // 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
     }
   },
+  mounted() {
+    let innerWidth = window.innerWidth
+
+    // 计算
+    setTimeout(() => {
+      let offsetWidth = document.querySelector('.scroll-ckunk').getBoundingClientRect().left
+      this.widthVar = innerWidth - offsetWidth - 40
+    }, 1000);
+    
+    setInterval(() => {
+      document.querySelectorAll('.ant-cascader-menu-item').forEach(el => {
+        el.onclick = function() {
+          document.querySelector('.ant-cascader-menus').scrollLeft = 2048
+        }
+      })
+    }, 1000)
+   
+  },
   beforeDestroy() {
     this.$refs.knowledgeRef.clearValidate()
   },
@@ -524,4 +549,10 @@ export default {
 /deep/.ant-btn > .anticon + span {
   margin-left: 0;
 }
+/deep/ .ant-cascader-menus {
+  left: 0!important;
+}
+/deep/ .ant-cascader-menu:last-child {
+  margin-right: 0;
+}
 </style>

+ 80 - 60
src/views/modules/knowledge/warehouse/knowledgeClassList.vue

@@ -8,14 +8,6 @@
             <div class="body">
               <div class="content">
                 <a-form ref="searchForm" layout="inline" style="display:flex;flex-wrap:wrap;">
-                  <!-- <div style="width:80%;display:flex;flex-wrap:wrap;">
-                    <a-form-item
-                      style="width:300px;margin: 5px 40px 5px 0;"
-                      label="分类名称"
-                      name="name">
-                      <a-input v-model="queryParam.name" placeholder="请输入"/>
-                    </a-form-item>
-                  </div> -->
                   <a-form-item
                       class="form-item-style"
                       label="分类名称"
@@ -46,7 +38,14 @@
           idField="pkId"
         >
           <template slot="name" slot-scope="{text}">
-            <div style="white-space: pre-line">{{ text }}</div>
+            <a-tooltip placement="topLeft">
+              <template slot="title">
+                {{ text }}
+              </template>
+              <!-- <div style="white-space: pre-line">{{ text }}</div> -->
+              <!-- <div style="white-space: nowrap">{{ text }}</div> -->
+              <div style="white-space: nowrap;overflow-x: scroll;">{{ text }}</div>
+            </a-tooltip>
           </template>
           <template slot="action" slot-scope="{text,record,index}">
             <rx-button class="clearBtn" alias="classificationEdit" :butn-icon="'none'" v-if="record.isSys != 1" @click="handleUpdateClassifyClick(record)">编辑</rx-button>
@@ -93,7 +92,7 @@
 import breadcrumb from '../components/breadcrumb.vue'
 import api from '@/api/knowledge/classify'
 import classApi from '@/api/knowledge/classify'
-import { getCategoryId } from '../aJs/getClassifyTree'
+import { getCategoryId, getChildrenLength, hideChooseLevel } from '../aJs/getClassifyTree'
 import mixin from "../aMixin/mixin"
 const classifyMixin = new mixin('classify')
 export default {
@@ -114,23 +113,27 @@ export default {
         {
           title: 'ID',
           dataIndex: 'pkId',
-          align: 'center'
+          align: 'center',
+          width: 200
         },
         {
           title: '分类名称',
           dataIndex: 'name',
           // align: 'center',
-          scopedSlots: {customRender: 'name'}
+          scopedSlots: {customRender: 'name'},
+          minWidth: 1000
         },
         {
           title: '操作人',
           dataIndex: 'operatorName',
-          align: 'center'
+          align: 'center',
+          width: 200
         },
         {
           title: '操作时间',
           dataIndex: 'updateTime',
-          align: 'center'
+          align: 'center',
+          width: 200
         },
         { 
           title: '操作',
@@ -162,54 +165,65 @@ export default {
       return function(record) {
         if(record.level == 1) {
           return this.$refs.classifyRef.getData().length
-        } else if(record.level == 2) {
-          let levelTwo = this.$refs.classifyRef.getData().find(item => item.pkId == record.parent)
-          if(levelTwo.children) {
-            return levelTwo.children.length
-          } else {
-            return 0
-          }
         } else {
-          for(let i of this.$refs.classifyRef.getData()) {
-            if(i.children) {
-              for(let j of i.children) { 
-                if(j.pkId == record.parent) {
-                  if(j.children) {
-                    return j.children.length
-                  } else {
-                    return 0
-                  }
-                }
-              }
-            }
-          }
+          return getChildrenLength(this.$refs.classifyRef.getData(),record)
         }
+        // if(record.level == 1) {
+        //   return this.$refs.classifyRef.getData().length
+        // } else if(record.level == 2) {
+        //   let levelTwo = this.$refs.classifyRef.getData().find(item => item.pkId == record.parent)
+        //   if(levelTwo.children) {
+        //     console.log(levelTwo.children.length)
+        //     return levelTwo.children.length
+        //   } else {
+        //     return 0
+        //   }
+        // } else {
+        //   for(let i of this.$refs.classifyRef.getData()) {
+        //     if(i.children) {
+        //       for(let j of i.children) { 
+        //         if(j.pkId == record.parent) {
+        //           if(j.children) {
+        //             return j.children.length
+        //           } else {
+        //             return 0
+        //           }
+        //         }
+        //       }
+        //     }
+        //   }
+        // }
       }
     }
   },
   created() {
     this.init()
   },
+  // mounted() {
+  //   document.querySelector('.ant-table-thead tr th:nth-child(2)')
+  //   console.log(document.querySelector('.ant-table-thead tr th:nth-child(2)').getAttribute('width'))
+  //   document.querySelector('.ant-table-thead tr th:nth-child(2)').setAttribute('width', 1000)
+  // },
   methods: {
     async init() {
       let res = await classApi.getAllByCategoryId()
-      this.classifyList = this.getData(res.data.children)
+      this.classifyList = res.data.children
       this.classifyLevelList = JSON.parse(JSON.stringify(this.classifyList))
     },
     // 格式化数据 disabled 编辑三分类时,只有一级分类没有二级分类,则不可选一级分类
-    getData(data,disabled = false) {
-      data.forEach((element) => {
-        if(element.children && element.children.length > 0 && element.level == 2) {
-          this.getData(element.children)
-        } else {
-          if(disabled && element.level == 2) {
-            element.disabled = true
-          } 
-          delete element.children
-        }
-      })
-      return data
-    },
+    // getData(data,level) {
+    //   data.forEach((element) => {
+    //     if(element.children && element.children.length > 0 && element.level == 2) {
+    //       this.getData(element.children)
+    //     } else {
+    //       if(disabled && element.level == 2) {
+    //         element.disabled = true
+    //       } 
+    //       delete element.children
+    //     }
+    //   })
+    //   return data
+    // },
     // 搜索
     handleSearchClick() {
       this.isShowButton = this.queryParam.name ? false : true
@@ -227,17 +241,19 @@ export default {
       this.title = '编辑分类'
       this.chooseLevel = record.level
       this.changeOnSelect = false
-      if(record.level == 2) {
-        this.classifyLevelList = JSON.parse(JSON.stringify(this.classifyList))
-        this.classifyLevelList.forEach(element => {
-          if(element.level == 2) {
-            delete element.children
-          }
-        })
-      }
-      if(record.level == 3) {
-        this.classifyLevelList = this.getData(JSON.parse(JSON.stringify(this.classifyList)), true)
-      }
+      // if(record.level == 2) {
+      //   this.classifyLevelList = JSON.parse(JSON.stringify(this.classifyList))
+      //   this.classifyLevelList.forEach(element => {
+      //     // if(element.level == 2) {
+      //     //   delete element.children
+      //     // }
+      //     element.disabled = true
+      //   })
+      // }
+      // if(record.level == 3) {
+      //   this.classifyLevelList = this.getData(JSON.parse(JSON.stringify(this.classifyList)), true)
+      // }
+      this.classifyLevelList = hideChooseLevel(JSON.parse(JSON.stringify(this.classifyList)), record.level)
       let res = await this.api.findAllParentByCategoryId(record.pkId)
       let gategoryId 
       if(!res.data.parents) {
@@ -258,7 +274,7 @@ export default {
         this.$message.error("请输入分类名称");
         return
       }
-      if((this.chooseLevel == 2 || this.chooseLevel == 3) && !this.classForm.parent.length) {
+      if((this.chooseLevel != 0 && this.chooseLevel != 1) && !this.classForm.parent.length) {
         this.$message.error("请选择上级分类");
         return
       }
@@ -376,4 +392,8 @@ export default {
 /deep/ .gridContent .ant-table-content .ant-table-tbody>tr>td:nth-child(2) {
   padding-left: 60px!important;
 }
+/* /deep/ .gridContent .ant-table-content .ant-table-tbody>tr>td:nth-child(2)>div:last-child {
+  white-space: nowrap!important;
+  overflow-x: scroll;
+} */
 </style>

+ 33 - 3
src/views/modules/knowledge/warehouse/knowledgeManageList.vue

@@ -18,7 +18,7 @@
                     class="form-item-style"
                     label="知识类型"
                     name="type">
-                    <a-select class="set-input" v-model="queryParam.type" placeholder="请选择" allowClear>
+                    <a-select class="set-input" v-model="queryParam.type" placeholder="请选择" allowClear :getPopupContainer="triggerNode => { return triggerNode.parentNode }">
                       <a-select-option v-for="(item,index) in knowledgeList" :key="index" :value="item.value">
                         {{item.label}}
                       </a-select-option>
@@ -35,7 +35,12 @@
                     label="所属分类"
                     name="categoryIds">
                     <a-cascader v-model="categoryIds" 
-                              class="set-input" 
+                              class="set-input scroll-ckunk"  
+                              :popupStyle="{
+                                maxWidth: widthVar + 'px',
+                                'overflow-x': 'auto'
+                              }"
+                              :getPopupContainer="triggerNode => { return triggerNode.parentNode }"
                               :options="classifyList" 
                               :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
                               placeholder="请选择"
@@ -277,7 +282,8 @@ export default {
         {value: '2', label: '维基知识'}
       ],
       num: 0,
-      classifyList: []
+      classifyList: [],
+      widthVar: 800
     }
   },
   async created() {
@@ -296,6 +302,24 @@ export default {
       this.categoryIds = gategoryId
     }
   },
+  mounted() {
+    let innerWidth = window.innerWidth
+
+    // 计算
+    setTimeout(() => {
+      let offsetWidth = document.querySelector('.scroll-ckunk').getBoundingClientRect().left
+      this.widthVar = innerWidth - offsetWidth - 40
+    }, 1000);
+    
+    setInterval(() => {
+      document.querySelectorAll('.ant-cascader-menu-item').forEach(el => {
+        el.onclick = function() {
+          document.querySelector('.ant-cascader-menus').scrollLeft = 2048
+        }
+      })
+    }, 1000)
+   
+  },
   methods: {
     getCategory,
     async getAuditNum() {
@@ -451,4 +475,10 @@ export default {
 /deep/ .gridContent{
   border: none;
 }
+/deep/ .ant-cascader-menus {
+  left: 0!important;
+}
+/deep/ .ant-cascader-menu:last-child {
+  margin-right: 0;
+}
 </style>