Browse Source

分类问题

Zhang Li, BBF-411-2(Neusoft) 2 years ago
parent
commit
f7128a6156
1 changed files with 36 additions and 21 deletions
  1. 36 21
      src/views/modules/knowledge/warehouse/knowledgeClassList.vue

+ 36 - 21
src/views/modules/knowledge/warehouse/knowledgeClassList.vue

@@ -38,14 +38,8 @@
           idField="pkId"
         >
           <template slot="name" slot-scope="{text}">
-            <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>
+              <div style="white-space: nowrap">{{ text }}</div>
+              <!-- <div style="white-space: nowrap;overflow-x: scroll;">{{ text }}</div> -->
           </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>
@@ -91,8 +85,8 @@
 <script>
 import breadcrumb from '../components/breadcrumb.vue'
 import api from '@/api/knowledge/classify'
-import classApi from '@/api/knowledge/classify'
 import { getCategoryId, getChildrenLength, hideChooseLevel } from '../aJs/getClassifyTree'
+import SessionCache from '../aJs/cache'
 import mixin from "../aMixin/mixin"
 const classifyMixin = new mixin('classify')
 export default {
@@ -114,26 +108,25 @@ export default {
           title: 'ID',
           dataIndex: 'pkId',
           align: 'center',
-          width: 200
+          width: 200,
         },
         {
           title: '分类名称',
           dataIndex: 'name',
           // align: 'center',
-          scopedSlots: {customRender: 'name'},
-          minWidth: 1000
+          scopedSlots: {customRender: 'name'}
         },
         {
           title: '操作人',
           dataIndex: 'operatorName',
           align: 'center',
-          width: 200
+          width: 200,
         },
         {
           title: '操作时间',
           dataIndex: 'updateTime',
           align: 'center',
-          width: 200
+          width: 200,
         },
         { 
           title: '操作',
@@ -157,7 +150,8 @@ export default {
       isShowButton: true,
       // 选中的分类等级
       chooseLevel: 0,
-      changeOnSelect: true
+      changeOnSelect: true,
+      maxLevel: 0
     }
   },
   computed: {
@@ -198,15 +192,36 @@ export default {
   },
   created() {
     this.init()
+    SessionCache.setCache('maxLevel', 0)
+  },
+  mounted() {
+    console.log(1111111111)
+    setInterval(() => {
+      document.querySelectorAll('.ant-table-row-expand-icon').forEach(el => {
+        el.onclick = function() {
+          // 获取level
+          let className = el.previousElementSibling.getAttribute('class')
+          let level = className.charAt(className.length - 1)
+          
+          let maxLevel = SessionCache.getCache('maxLevel')
+          if(maxLevel > level) return    
+          // that.maxLevel = level
+          SessionCache.setCache('maxLevel', parseInt(level))
+          let computed = 20*level + 25 + 68 + 160
+          document.querySelectorAll('.ant-table-row td:nth-child(2)').forEach(item => {
+            item.style.width = computed + 'px'
+          })
+          document.querySelectorAll('.ant-table-thead tr th:nth-child(2)').forEach(item => {
+            item.style.width = computed + 'px'
+          })
+          
+        }
+      })
+    }, 1000)
   },
-  // 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()
+      let res = await api.getAllByCategoryId()
       this.classifyList = res.data.children
       this.classifyLevelList = JSON.parse(JSON.stringify(this.classifyList))
     },