Zhang Li, BBF-411-2(Neusoft) 1 year ago
parent
commit
244b049077

+ 7 - 0
src/api/knowledge/manage.js

@@ -25,6 +25,13 @@ returnData.transferAuthor=function (parameter) {
   })
 }
 
+// 批量修改分类
+returnData.transferCategory=function (parameter) {
+  var url= returnData.baseUrl + '/transferCategory'
+  return rxAjax.postJson(url,parameter).then (res => {
+    return res
+  })
+}
 // 新增
 returnData.create=function (parameter) {
   var url= returnData.baseUrl + '/create'

+ 11 - 7
src/views/modules/knowledge/aJs/getClassifyTree.js

@@ -62,15 +62,19 @@ export function getChildrenLength(data,record) {
 
 // 隐藏当前选中等级
 export function hideChooseLevel(data,level) {
-  let nowLevel = level
+  // let nowLevel = level
   const _computedChildrenLength = (data) => {
     data.forEach((element) => {
-      if(nowLevel == element.level) {
-        delete element.children
-      } else {
-        if(element.children) {
-          _computedChildrenLength(element.children)
-        }
+      // if(nowLevel == element.level) {
+      //   delete element.children
+      // } else {
+      //   if(element.children) {
+      //     element.disabled = false
+      //     _computedChildrenLength(element.children)
+      //   }
+      // }
+      if(element.children) {
+        _computedChildrenLength(element.children)
       }
     })
   }

+ 1 - 1
src/views/modules/knowledge/components/editor.vue

@@ -184,7 +184,7 @@ export default {
         'image',
         // 'video',
         // 'table',
-        'code',
+        // 'code',
         'splitLine',
         'undo',
         'redo'

+ 0 - 15
src/views/modules/knowledge/statistics/components/orgPeople.vue

@@ -63,8 +63,6 @@
                             v-model="checkedKeys"
                             :loadByParent="onLoadGroupTree"
                             multiSelect
-                            :showTreeIcon="true"
-                            :expandOnLoad="0"
                             id-field="key"
                             text-field="title"
                             @check="check"
@@ -249,19 +247,6 @@
                     }
                 })
             }
-            // console.log(selKeys, e)
-            // this.chooseTags.push(e.checkedNodes.map(item => {
-            //     return {
-            //         id: item.key,
-            //         name: item.componentOptions.propsData.title
-            //     }
-            // }))
-            // this.checkedTargets = Object.assign({},this.$options.data().checkedTargets)
-            // this.checkedTargets.organizationId = selKeys
-            // for(let i of e.checkedNodes) {
-            //      this.checkedTargets.organizationName.push(i.data.props.title)
-            // }
-            // this.$emit('transCheckedTargets',this.checkedTargets)
         },
         // 组织名称搜索
         handleSearchOrgClick() {

+ 2 - 2
src/views/modules/knowledge/warehouse/auditManageList.vue

@@ -658,9 +658,9 @@ export default {
       }
       this.showAuditFlag = false
     },
-      // 重新加载表格
+    // 重新加载表格
     reloadTable() {
-      this.$refs.auditRef.loadData()
+      this.$refs.auditRef.onRefresh()
     }
   }
 }

+ 8 - 6
src/views/modules/knowledge/warehouse/auditProcessMaintain.vue

@@ -71,8 +71,10 @@
                           </a-form-item>
                         </div>
                         <div style="width:6%;height:40px;display:flex;align-items:center;">
-                          <a-button :style="{display: (item.isFinal == 1 || item.isFinal == -1) ? 'none' : ''}" style="margin-right:10px;"  @click="delRow(index,indez)" shape="circle" icon="delete"></a-button>
-                          <a-button v-if="itez.knowledgeApprovalNode.length != (index + 1) || itez.knowledgeApprovalNode.length==1" type="primary" @click="addRow(index,indez)" shape="circle" icon="plus"></a-button>
+                          <!-- <a-button :style="{display: (item.isFinal == 1 || item.isFinal == -1) ? 'none' : ''}" style="margin-right:10px;"  @click="delRow(index,indez)" shape="circle" icon="delete"></a-button> -->
+                          <a-button :style="{display: item.isFinal == -1 ? 'none' : ''}" style="margin-right:10px;"  @click="delRow(index,indez)" shape="circle" icon="delete"></a-button>
+                          <!-- <a-button v-if="itez.knowledgeApprovalNode.length != (index + 1) || itez.knowledgeApprovalNode.length==1" type="primary" @click="addRow(index,indez)" shape="circle" icon="plus"></a-button> -->
+                          <a-button v-if="item.isFinal != 1" type="primary" @click="addRow(index,indez)" shape="circle" icon="plus"></a-button>
                           </div>
                       </a-row>
                       <a-row :gutter="24" style="margin: 40px 0;" class="rowList">
@@ -364,11 +366,11 @@ export default {
         isFinal: 0
       }
       let info = this.tabPaneList[indez].knowledgeApprovalNode
-      if(info.length == 1) {
-        info.unshift(tempData)
-      } else {
+      // if(info.length == 1) {
+      //   info.unshift(tempData)
+      // } else {
         info.splice(index+1, 0,tempData)
-      }
+      // }
     },
     delRow(index,indez){
       this.tabPaneList[indez].knowledgeApprovalNode.splice(index, 1);

+ 20 - 8
src/views/modules/knowledge/warehouse/knowledgeClassList.vue

@@ -99,7 +99,8 @@
           <a-form-item label="分类名称" prop="name">
             <a-input v-model="classForm.name" :maxLength="10" placeholder="请输入" />
           </a-form-item>
-          <a-form-item label="上级分类" prop="parent" v-if="chooseLevel != 1">
+          <!-- <a-form-item label="上级分类" prop="parent" v-if="chooseLevel != 1"> -->
+          <a-form-item label="上级分类" prop="parent">
             <a-cascader v-model="classForm.parent" 
                         ref="cascader"
                         :popupStyle="{
@@ -388,7 +389,7 @@ export default {
     async handleUpdateClassifyClick(record) {
       this.title = '编辑分类'
       this.chooseLevel = record.level
-      this.changeOnSelect = false
+      // this.changeOnSelect = false
       // if(record.level == 2) {
       //   this.classifyLevelList = JSON.parse(JSON.stringify(this.classifyList))
       //   this.classifyLevelList.forEach(element => {
@@ -422,16 +423,27 @@ export default {
         this.$message.error("请输入分类名称");
         return
       }
-      if((this.chooseLevel != 0 && this.chooseLevel != 1) && !this.classForm.parent.length) {
-        this.$message.error("请选择上级分类");
+      // console.log(this.classForm)
+      // console.log(this.classForm.parent)
+      // console.log(this.classForm.parent.reverse()[0])
+      if(this.classForm.parent.reverse()[0]  == this.classForm.pkId) {
+        this.$message.error("不能选择自己为自己的上级分类");
         return
       }
-      this.saveLoading = true
+      // if((this.chooseLevel != 0 && this.chooseLevel != 1) && !this.classForm.parent.length) {
+      //   this.$message.error("请选择上级分类");
+      //   return
+      // }
+      // this.saveLoading = true
       let parentId = this.classForm.parent
-      let res = await this.api.save({...this.classForm, parent: parentId.length ? parentId.reverse()[0] : null})
+      // let res = await this.api.save({...this.classForm, parent: parentId.length ? parentId.reverse()[0] : null})
+      let res = await this.api.save({...this.classForm, parent: parentId.length ? parentId[0] : null})
       if(res.code == 200) {
-        this.reloadTable()
-        this.handleCancel()
+        if(res.success) {
+          this.reloadTable()
+          this.handleCancel()
+          this.init()
+        }
         this.saveLoading = false
       }
     },

+ 70 - 76
src/views/modules/knowledge/warehouse/knowledgeManageList.vue

@@ -66,79 +66,6 @@
                     <a-button @click="handleResetClick(true)">重置</a-button>
                     <a-button type="primary" @click="handleSearchClick">查询</a-button>
                   </div>
-                  <!-- <div style="width:80%;;display:flex;flex-wrap:wrap;">
-                    <div style="display:flex;flex-wrap:wrap;">
-                      <a-form-item
-                        style="width:320px;margin: 5px 40px 5px 0;"
-                        label="知识标题"
-                        name="titles">
-                        <a-input v-model="queryParam.titles" placeholder="请输入"/>
-                      </a-form-item>
-                      <a-form-item
-                        style="width:320px;margin: 5px 40px 5px 0;"
-                        label="知识类型"
-                        name="type">
-                        <a-select v-model="queryParam.type" placeholder="请选择" allowClear>
-                          <a-select-option v-for="(item,index) in knowledgeList" :key="index" :value="item.value">
-                            {{item.label}}
-                          </a-select-option>
-                        </a-select>
-                      </a-form-item>
-                    </div>
-                    <div style="display:flex;flex-wrap:wrap;" v-if="extend" :class="{'show-other': extend}">
-                      <a-form-item
-                        style="width:320px;margin: 5px 40px 5px 0;"
-                        label="作者"
-                        name="author" >
-                        <a-input v-model="queryParam.author" placeholder="请输入" />
-                      </a-form-item>
-                      <a-form-item
-                        style="width:320px;margin: 5px 40px 5px 0;"
-                        label="所属分类"
-                        name="categoryIds">
-                       <a-cascader v-model="categoryIds" 
-                                  :options="classifyList" 
-                                  :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
-                                  placeholder="请选择"
-                                  changeOnSelect
-                                  @change="handleClassifyChange" />
-                      </a-form-item>
-                      <a-form-item
-                        style="width:320px;margin: 5px 40px 5px 0;"
-                        label="创建时间"
-                        name="createTime" >
-                        <a-range-picker v-model="createTime" 
-                                        separator="→"
-                                        format="YYYY/MM/DD"
-                                        valueFormat="YYYY-MM-DD"
-                                        @change="handleClearTimeChange">
-                          <a-icon v-if="$store.state.appSetting.collapsed" slot="suffixIcon" type="calendar" />
-                        </a-range-picker>
-                      </a-form-item>
-                    </div>
-                  </div>
-                  <div style="width:20%;display:flex;justify-content:flex-end;align-content: flex-start;flex-wrap:wrap;">
-                    <div style="display:flex;justify-content:center;margin-top: 8px;">
-                      <a-button @click="handleResetClick">重置</a-button>
-                      <a-button type="primary" @click="handleSearchClick">查询</a-button>
-                    </div>
-                    <div style="margin-top: 8px;">
-                      <a-button type="link" @click="extend = !extend">
-                        <template v-if="!extend">
-                          <div>
-                            展开
-                            <a-icon type="down" />
-                          </div>
-                        </template>
-                        <template v-else>
-                          <div>
-                            收起
-                            <a-icon type="up" />
-                          </div>
-                        </template>
-                      </a-button>
-                    </div>
-                  </div> -->
                 </a-form>
                 <rx-button alias="knowAdd" :butn-icon="'false'" @click="handleAddKnowledgeClick">新增知识</rx-button>
                 <rx-button
@@ -150,6 +77,7 @@
                   >知识审核</rx-button
                 >
                 <rx-button alias="reauthor" :butn-icon="'false'" @click="handleReauthorShowClick">批量改派作者</rx-button>
+                <rx-button alias="changeClassify" :butn-icon="'false'" @click="handleUpdateClassifyShowClick">批量修改分类</rx-button>
               </div>
             </div>
           </div>
@@ -160,6 +88,8 @@
           class="table-style"
           style="background: #fff"
           :columns="columns"
+          :allowRowSelect="true"
+          :multiSelect="true"
           :url="api.findAllKnowledge"
           :queryParam="queryParam"
           data-field="result.data"
@@ -199,6 +129,37 @@
           </template>
         </rx-grid>
       </rx-fit>
+      <a-modal
+        v-model="updateClassifyShow"
+        title="批量修改分类"
+        centered
+        okText="执行"
+        @ok="handleUpdateOk"
+        :confirmLoading="saveLoading"
+      >
+        <a-form ref="labelRef" layout="inline">
+          <a-form-item label="分类名称" >
+             <a-cascader
+                v-model="categoryifyIds"
+                class="scroll-ckunk"
+                :popupStyle="{
+                  maxWidth: widthVar + 'px',
+                  'overflow-x': 'auto',
+                }"
+                :getPopupContainer="
+                  (triggerNode) => {
+                    return triggerNode.parentNode
+                  }
+                "
+                :options="classifyList"
+                :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
+                placeholder="请选择"
+                changeOnSelect
+                @change="handleClassifyReset"
+              />
+          </a-form-item>
+        </a-form>
+      </a-modal>
       <a-modal
         v-model="reauthorShow"
         title="批量改派作者"
@@ -353,6 +314,9 @@ export default {
       ],
       num: 0,
       classifyList: [],
+      updateClassifyShow: false,
+      knowledgeIds: [],
+      categoryifyIds: [],
       reauthorShow: false,
       reauthorFlag: 1,
       saveLoading: false,
@@ -439,8 +403,8 @@ export default {
       this.showAuditFlag = true
     },
     transCheckedTarget(arg) {
-        this.approverData.approverId = arg.approverId
-        this.approverData.approverName = arg.approverName
+      this.approverData.approverId = arg.approverId
+      this.approverData.approverName = arg.approverName
     },
     handleOk() {
       if(!this.authorForm.authorsName) {
@@ -473,6 +437,36 @@ export default {
       this.showAuditFlag = false
       this.approverData = Object.assign({},this.$options.data().approverData)
     },
+    handleUpdateClassifyShowClick() {
+      this.knowledgeIds = this.$refs.manageRef.getSelectedRows().map(item => {return item.pkId})
+      if(!this.knowledgeIds.length) {
+        this.$message.error("请选择要修改分类的知识");
+        return 
+      }
+      this.handleClassifyReset('')
+      this.updateClassifyShow = true
+    },
+    handleClassifyReset(arg) {
+      if(!arg.length) {
+        this.categoryifyIds = []
+      }
+    },
+    handleUpdateOk() {
+      if(!this.categoryifyIds.length) {
+        this.$message.error("请选择分类名称");
+        return 
+      }
+      let info = {
+        categoryId: this.categoryifyIds.slice('-1')[0],
+        knowledgeIds: this.knowledgeIds
+      }
+      api.transferCategory(info).then(res => {
+        if(res.code == 200) {
+          this.updateClassifyShow = false
+          this.reloadTable()
+        }
+      })
+    },
     // 跳转审核管理
     handleJumpPathClick() {
       this.$router.push({
@@ -513,7 +507,7 @@ export default {
     },
     // 重新加载表格
     reloadTable() {
-      this.$refs.manageRef.loadData()
+      this.$refs.manageRef.onRefresh()
     },
   },
 }