赵志鹏 1 year ago
parent
commit
54469121e9

+ 9 - 0
src/api/knowledge/analysis.js

@@ -39,4 +39,13 @@ returnData.searchParticipleWordCloud=function (parameter) {
     return res
   })
 }
+
+//查询数据
+returnData.searchGroups=function (parameter) {
+  var url= '/api-knowledge/common/searchGroups'
+  return rxAjax.postJson(url,parameter).then (res => {
+    return res
+  })
+}
+
 export default returnData;

+ 8 - 0
src/api/knowledge/contentData.js

@@ -25,5 +25,13 @@ contentData.deleteKnowledge=function (parameter) {
   })
 }
 
+// 撤回审批
+contentData.knowledgeWithdraw=function (parameter) {
+  var url= '/api-knowledge/knowledge/knowledgeWithdraw';
+  return rxAjax.get(url,parameter).then (res => {
+    return res
+  })
+}
+
 export  default contentData;
 

+ 7 - 0
src/api/user/org/osUser.js

@@ -26,6 +26,13 @@ OsUserApi.edit= function(pkId,groupId,tenantId) {
   return rxAjax.get(url);
 }
 
+OsUserApi.getAllUserByGroupId= function(parameter) {
+  var url= OsUserApi.baseUrl + '/getAllUserByGroupId';
+  return rxAjax.postJson(url,parameter).then(res => {
+    return res
+  });
+}
+
 OsUserApi.getOsUserList= function(parameter) {
   var url= OsUserApi.baseUrl + '/query';
   return rxAjax.postJson(url,parameter).then (res => {

BIN
src/image/withdraw.png


+ 39 - 0
src/views/modules/knowledge/components/pageList.vue

@@ -37,6 +37,12 @@
             <img src="../../../../image/look.png"/>
             <span>查看</span>
           </div>
+        </template>
+         <template v-if="item.isWithdraw == 0">
+          <div class="lookBox btnSmall" style="display:flex;align-items:center;" @click="withdrawDetail(item)">
+            <img src="../../../../image/withdraw.png" style="width:0.7vw;margin-right: 6px;border-radius: 2px;" />
+            <span>撤回</span>
+          </div>
         </template>
         <template v-if="(!showJurisdiction||item.isOrganizationId == 0)&&!hideLook">
           <div class="lookBox btnSmall" @click="download(item)" v-if="(!item.isOrganizationId && item.attachment)&&(type=='list0'||(type=='list1'&&item.approvalStatus!=4&&item.approvalStatus!=2))">
@@ -139,6 +145,25 @@
         </div>
       </div>
     </a-modal>
+    <a-modal
+      title=""
+      :visible="withdrawVisible"
+      :confirm-loading="false"
+      class="delModal"
+      :footer="null"
+      :closable="false"
+      dialogClass="delBox"
+    >
+      <div class="delBoxMain">
+        <img src="../../../../image/confirm.png" class="confirmImg"/>
+        <p class="confirmTitle">确认要撤回这个知识内容吗?</p>
+        <p class="confirmContent">您撤回后的知识内容将无法恢复,请慎重操作。</p>
+        <div>
+          <div class="btnConfirmOk" @click="confirmWithdrawOk">确认</div>
+          <div class="btnConfirmCancel" @click="closeDel">取消</div>
+        </div>
+      </div>
+    </a-modal>
   </div>
 </template>
 
@@ -196,6 +221,7 @@ export default {
   data() {
     return {
       delVisible:false,
+      withdrawVisible: false,
       header0,
       header1,
       typeArr:['pdf','word','excel','ppt','其他']
@@ -260,6 +286,18 @@ export default {
         })
       }
     },
+    withdrawDetail() {
+      this.withdrawVisible = true
+    },
+    confirmWithdrawOk() {
+      let param = {
+        knowledgeId:this.item.pkId
+      }
+      this.withdrawVisible = false
+      contentData.knowledgeWithdraw(param).then((res) => {
+        this.$emit('delRefresh',1)
+      })
+    },
     // 点击下载
     download(data){
       window.open('/api/api-system/system/core/sysFile/previewFile?fileId='+data.attachment)
@@ -267,6 +305,7 @@ export default {
     // 删除关闭
     closeDel(){
       this.delVisible = false
+      this.withdrawVisible = false
     },
     // 删除确认
     confirmOk(){

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

@@ -24,4 +24,23 @@ export function getCategoryId(data) {
   }
   _getParentCategoryName(data)
   return result.reverse()
+}
+
+// 通过分类id [1,2] 获取分类名 ['分类1', '分类2']
+export function getCategoryName(data,ids) {
+  const result = []
+  let num = 0
+  const _getParentCategoryName = (info) => {
+    for(let i of info) {
+      if(i.pkId == ids[num]) {
+        result.push(i.name)
+        num+=1
+        if(i.children && i.children.length) {
+          _getParentCategoryName(i.children)
+        }
+      }
+    }
+  }
+  _getParentCategoryName(data)
+  return result.join('|')
 }

+ 581 - 0
src/views/modules/knowledge/warehouse/components/orgPeople.vue

@@ -0,0 +1,581 @@
+<template>
+    <div style="width: 800px; height: 70vh;display:flex;flex-direction:column;">
+        <a-form ref="searchForm" layout="inline" style="display: flex;justify-content: center;margin: 20px 20px 0 20px;height:50px;">
+            <a-form-item class="orgName-style" style="width:800px;" name="staff">
+                <span slot="label">组织名称</span>
+                <a-input class="set-input" v-model="serachValue" placeholder="请输入" />
+            </a-form-item>
+            <div style="display: flex;height:40px;align-items:flex-start;justify-content: center;margin-top: 4px;">
+                <a-button style="margin-right: 8px;" @click="handleResetClick(false)">重置</a-button>
+                <a-button type="primary" @click="handleSearchOrgClick">查询</a-button>
+            </div>
+        </a-form>
+        <!-- <a-form v-if="!isOnlyOrg" ref="searchForm" layout="inline" style="display: flex;justify-content: center;margin: 0 20px;height:50px;">
+            <a-form-item class="form-item-style" style="width:100%;" label="已选组织" name="staff">
+                <a-tag v-for="(item,index) in chooseTags" :key="index">{{ item.name }}</a-tag>
+            </a-form-item>
+        </a-form> -->
+        <div v-if="!isOnlyOrg" style="display: flex;align-items:center;justify-content: center;margin: 0 20px;"> 
+            <div class="chooseOrg-style" style="width:80px;color:rgba(0, 0, 0, 0.85);">已选组织</div>
+            <div style="flex:1;display: flex;align-items:center;flex-wrap:wrap;max-height:53px;overflow-y:scroll;">
+                <template v-if="chooseTags.length">
+                    <!-- <div style="border:1px solid #e8e8e8;padding: 2px 3px;margin: 1px 2px;border-radius:2px;" v-for="(item,index) in chooseTags" :key="index">{{ item.name }}</div> -->
+                    <a-tag style="margin-bottom: 2px;margin-top: 2px" 
+                            v-for="(item,index) in chooseTags" 
+                            :key="index" 
+                            closable 
+                            @close="(e) => handleTagClose(e,index,item.id)">{{ item.name }}
+                        </a-tag>
+                    <!-- <a-tag style="margin-bottom: 2px;margin-top: 2px" 
+                        v-for="(item,index) in chooseTags" 
+                        :key="index">{{ item.name }}
+                    </a-tag> -->
+                </template>
+                <template v-else>
+                    <div>未选择组织</div>
+                </template>
+                <!-- <a-tag v-for="(item,index) in chooseTags" :key="index">{{ item.name }}</a-tag> -->
+            </div> 
+        </div>
+       <!-- 70 87 32 37.8 -->
+        <div style="display:flex;width:100%;padding: 16px;">
+            <template v-if="!isOnlyOrg">
+                <div style="width:100%;border:1px solid #e8e8e8;height:calc( 70vh - 150px );">
+                    <div class="rightDetailtop" style="text-align: center;">组织名称</div>
+                     <div  style="height:calc( 100% - 38.8px );overflow-y:auto;padding: 20px 0 0 20px;">
+                        <!-- <div v-for="(item,index) in orgDataTree" :key="index">
+                            <rx-tree
+                                :treeData="item.orgData"
+                                :async="true"
+                                v-model="item.checkedKeys"
+                                :loadByParent="treeNode => onLoadGroupTree(treeNode,index)"
+                                multiSelect
+                                :showTreeIcon="true"
+                                :expandOnLoad="0"
+                                id-field="key"
+                                text-field="title"
+                                @check="(selKeys, e) => check(selKeys, e,index)"
+                                parent-field="groupId"></rx-tree>
+                        </div> -->
+                        <rx-tree
+                            :treeData="orgData"
+                            :async="true"
+                            v-model="checkedKeys"
+                            :loadByParent="onLoadGroupTree"
+                            multiSelect
+                            id-field="key"
+                            text-field="title"
+                            @check="check"
+                            parent-field="groupId"></rx-tree>
+                    </div>
+                </div>
+            </template>
+            <rx-grid
+                v-if="isOnlyOrg"
+                style="height: calc( 70vh - 108px );overflow-y:auto;"
+                :style="{width: isOnlyOrg ? '70%' : '100%'}"
+                ref="orgTable"
+                class="rx-tree-title"
+                :allowRowSelect="isOnlyOrg ? false : true"
+                :multiSelect="isOnlyOrg ? false : true"
+                :showPage="false"
+                :columns="columnsNew"
+                :defaultPageSize="10"
+                :dataSource="tableData"
+                @rowExpand="rowExpand"
+                :expandIconColumnIndex="0"
+                :idField="'groupId'"
+                >
+                <div  slot="name" class="rx-table-row-icon" slot-scope="{text,record}">
+                    <div v-if="checkId==record.pkId" style="color:#1890ff;" class="telist rx-tree-title" :title="text">{{text}}-{{ record.pkId }}</div>
+                    <div v-else @click="checklist(record)" class="telist rx-tree-title" :title="text">{{text}}-{{ record.pkId }}</div>
+                </div>
+            </rx-grid>
+            <div v-if="isOnlyOrg" style="width:45%;height:calc( 70vh - 108px );border: 1px solid #e8e8e8;border-left:none;">
+                <div class="rightDetailtop">
+                    <a-checkbox style="position:absolute;left:30px;" :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange"></a-checkbox>
+                    <div style="width:100%;text-align:center;">员工姓名</div> 
+                </div>
+                <!-- <a-checkbox-group name="checkboxgroup" :options="options1" v-model="value" @change="onChange" /> -->
+                <a-checkbox-group v-model="personId" style="width:100%;height:calc( 70vh - 214px );overflow-y: auto;">
+                    <a-checkbox  v-for="(item) in userData" :style="radioStyle" :value="item.fullName + '/' + item.userNo" :key="item.userNo" @change="handleOnChange">
+                        {{ item.fullName + '(' + item.userNo + ')'}}
+                    </a-checkbox>
+                </a-checkbox-group>
+                <!-- <div style="height:200px;border-top: 1px solid #e8e8e8;"> -->
+                <div v-if="userData.length" style="height:56px;display:flex;align-items:center;justify-content:center;border-top:1px solid #e8e8e8;">
+                    <a-button icon="left" :disabled="queryParam.pageNo == 1" @click="handlePageNumChange('-')"></a-button>
+                    <a-button icon="right" :disabled="(queryParam.pageNo*queryParam.pageSize) >= total" style="margin-left: 20px;" @click="handlePageNumChange('+')"></a-button>
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+  import OsUserApi from '@/api/user/org/osUser'
+  import statistics from '@/api/knowledge/analysis'
+  import OsGroupApi from '@/api/user/org/osGroup'
+  import OsRelInstApi from '@/api/user/org/osRelInst'
+  import {BaseList,Util, RxLayout, RxFit, RxGrid, RxTree} from 'jpaas-common-lib'
+  export default {
+    name: 'OsUserList',
+    mixins: [BaseList],
+    components: {
+      RxLayout,
+      RxFit,
+      RxGrid,
+      RxTree
+    },
+    props: {
+        isOnlyOrg: {
+            type: Boolean,
+            default: true
+        }
+    },
+    data() {
+      return {
+            params: {
+                name: '',
+                userNo: ''
+            },
+            queryParam: {
+                pageNo: 1,
+                pageSize: 10,
+                params: {
+                    groupId: "",
+                    dim: "1", 
+                    rankLevel: "", 
+                    status: "1",
+                    name: "",
+                    userNo: ""
+                },
+                sortOrder: "asc"
+            },
+            // queryParam: {
+            //     pageNum: 1,
+            //     pageSize: 10,
+            //     relTypeId: 1,
+            //     groupId: ''
+            // },
+            indeterminate: false,
+            checkAll: false,
+            total: 0,
+            userNo: '',
+            visible: false,
+            quitUserIds: [],
+            // 表头
+            columns: [
+                {
+                    title: '员工姓名',
+                    align: 'center',
+                    dataIndex: 'fullName',
+                    scopedSlots: { customRender: 'fullName' }
+                }
+            ],
+            checkId: null,
+            serachValue: '',
+            tableData:[],
+            columnsNew: [
+                {
+                    title: '组织名称',
+                    width:250,
+                    dataIndex: 'name',
+                    ellipsis: true,
+                    scopedSlots: { customRender: 'name' }
+                }
+            ],
+            userData: [],
+            personId: [],
+            personIdArr: [],
+            radioStyle: {
+                display: 'block',
+                height: '40px',
+                lineHeight: '40px',
+                marginLeft: '30px'
+            },
+            chooseTags: [],
+            orgData: [],
+            // orgDataTree: [{
+            //     checkedKeys: {checked:[]},
+            //     orgData: []
+            // }],
+            // 组织
+            checkedTarget: {},
+            // 组织架构(多选)
+            checkedKeys:{checked:[]},
+                // 组织架构(多选)
+            checkedTargets: {
+                organizationId: [],
+                organizationName: [],
+            },
+        }
+    },
+    created() {
+    //    this.init()
+       this.getTreeData()
+       if(this.isOnlyOrg) {
+            this.getOrgListByGroupId()
+       }
+    },
+    methods: {
+        handleTagClose(e,index,id) {
+            e.preventDefault()
+            this.chooseTags.splice(index,1)
+            if(this.checkedKeys.checked.some(item => item == id)) {
+                this.checkedKeys.checked.map((item,index) => {
+                    if (item.indexOf(id) > -1) {
+                        this.checkedKeys.checked.splice(index, 1);
+                    }
+                })
+            }
+        },
+        // 多选节点
+        check(selKeys, e) {
+            if(e.checked) {
+                this.checkedKeys.checked = selKeys
+                this.chooseTags.push({
+                    id: e.node.value,
+                    name: e.node.title
+                })
+            } else {
+                let id = e.node.value
+                this.checkedKeys.checked = selKeys
+                this.chooseTags.map((item,index) => {
+                    if (item.id.indexOf(id) > -1) {
+                        this.chooseTags.splice(index, 1);
+                    }
+                })
+            }
+        },
+        // 组织名称搜索
+        handleSearchOrgClick() {
+            if(this.serachValue==''){
+                this.handleResetClick(true)
+            }else{
+                let getData={
+                    "sortOrder": "asc",
+                    "params": {
+                        "Q_DIM_ID__S_EQ": "1",
+                        "Q_RANK_LEVEL__S_EQ": null,
+                        "Q_NAME__S_LK": this.serachValue,
+                        "Q_GROUP_ID__S_NEQ": ""
+                        }
+                }
+                statistics.searchGroups(getData).then(result => {
+                    let tempData=[]
+                    result.forEach(itemData => {
+                        let tempDataFlag=result.filter(item=>{
+                            return item.pkId==itemData.parentId;
+                        });
+                        if(tempDataFlag.length==0){
+                        tempData.push(itemData)
+                        }
+                    });
+                    tempData=this.treeData(tempData);
+                    this.tableData = tempData;
+                    if(!this.isOnlyOrg) {
+                        let data = result;
+                        let temp = [];
+                        for (let i = 0; i < data.length; i++) {
+                            var rs = data[i];
+                            var _isLeaf = rs.childAmount == 0 ? true : false;
+                            temp.push({title: `${rs.name}-${rs.key}`, groupId: rs.groupId, key: rs.key, isLeaf: _isLeaf})
+                        }
+                        this.orgData = [...temp]
+                        // this.orgDataTree.push({
+                        //     checkedKeys: {checked:[]},
+                        //     orgData: [...temp]
+                        // })
+                    }
+                    this.queryParam.params.groupId = ''
+                    this.userData = []
+                })
+            }
+            //清除下拉的数据
+            // this.$refs.orgTable.expandedRowKeys=[];
+        },
+        handleResetClick(arg = false) {
+            this.serachValue = ''
+            this.getTreeData()
+            if(!this.isOnlyOrg) {
+                this.orgData = []
+                if(!arg) {
+                    this.chooseTags = []
+                    this.checkedKeys.checked = []
+                }
+            } else {
+                this.userData = []
+                this.queryParam.pageNo = 1
+                this.queryParam.pageSize = 10
+                this.personId = []
+                this.personIdArr = []
+                this.getOrgListByGroupId()
+            }
+        },
+        //组织结构
+        getTreeData(){
+            OsGroupApi.queryGroups(1,"0","yes").then(result => {
+                if(this.isOnlyOrg) {
+                    result.data=this.treeData(result.data);
+                    this.tableData = result.data
+                } else {
+                    let data = result.data;
+                    let temp = [];
+                    for (let i = 0; i < data.length; i++) {
+                        var rs = data[i];
+                        var _isLeaf = rs.childAmount == 0 ? true : false;
+                        temp.push({title: `${rs.name}-${rs.key}`, groupId: rs.groupId, key: rs.key, isLeaf: _isLeaf})
+                    }
+                    this.orgData = [...temp]
+                }
+            })
+            //清除下拉的数据
+            // this.$refs.orgTable.expandedRowKeys=[];
+        },
+        //异步加载组织
+        rowExpand(expanded,record){
+            var self=this;
+            if(expanded&&record.children&&record.children.length==0){
+            OsGroupApi.queryGroups(1,record.groupId,"yes").then(result => {
+                    result.data=this.treeData(result.data);
+                    self.updateData(self.tableData,result.data,record.groupId);
+                    this.$refs.orgTable.loadData();
+                })
+            }
+            
+        },
+        checklist(data){
+            if(this.isOnlyOrg) {
+                this.queryParam.pageNo = 1
+                this.queryParam.pageSize = 10
+                this.queryParam.params.groupId = data.pkId
+                this.personId = []
+                this.personIdArr = []
+                this.getOrgListByGroupId()
+            }
+        },
+        //判断下级是否有子级
+        treeData(data){
+            for (var i = 0; i <data.length ; i++) {
+                if(data[i].childAmount>0){
+                    data[i].children=[];
+                }
+            }
+            return data;
+        },
+        //更新数据到tableData中
+        updateData(tableData,data,groupId){
+            for (var i = 0; i <tableData.length ; i++) {
+                if(tableData[i].groupId==groupId){
+                    tableData[i].children=data;
+                        break;
+                }else {
+                    if(tableData[i].childAmount>0){
+                        this.updateData(tableData[i].children,data,groupId);
+                    }
+                }
+            }
+        },
+        getOrgListByGroupId(arg = false) {
+            this.personId = []
+            OsUserApi.getAllUserByGroupId(this.queryParam).then(res=> {
+                if(res.code == 200) {
+                    this.userData = res.result.data.map(item => {
+                        return {
+                            fullName: item.fullName,
+                            userNo: item.userNo
+                        }
+                    })
+                    if(arg) {
+                        this.personId = this.personIdArr[this.queryParam.pageNo-1]
+                        if(this.personId) {
+                            this.indeterminate = !!this.userData.length && this.userData.length < this.personId.length
+                            this.checkAll = this.userData.length === this.personId.length
+                        } else {
+                            this.indeterminate = false
+                            this.checkAll = false
+                        }
+                    }
+                    this.total = res.totalCount
+                }
+            })
+        },
+        handlePageNumChange(arg) {
+            this.personIdArr[this.queryParam.pageNo-1] = this.personId
+            if(arg == '-') {
+                this.queryParam.pageNo--
+            } else {
+                this.queryParam.pageNo++
+            }
+            this.getOrgListByGroupId(true)
+        },
+        // 员工全选
+        onCheckAllChange(e) {
+            this.personId = e.target.checked ? this.userData.map(item => `${item.fullName}/${item.userNo}`) : []
+            this.indeterminate = false
+            this.checkAll = e.target.checked
+        },
+        // 单选
+        handleOnChange() {
+            this.$nextTick(() => {
+                this.indeterminate = !!this.userData.length && this.userData.length < this.personId.length
+                this.checkAll = this.userData.length === this.personId.length
+            })
+        },
+        init() {
+            this.loadAdminDeps();
+        },
+        reset() {
+            this.queryParam.name = ""
+            this.queryParam.userNo = ""
+            this.search()
+        },
+        search(){
+            this.$refs.table.loadData()
+        },
+        close(){
+            //关闭按钮
+            this.fitSearch = false ;
+        },
+        delById(ids) {
+            return OsUserApi.delOsUser({ids: ids.join(',')});
+        },
+        dimissionByIds(ids) {
+            this.visible = true;
+            this.quitUserIds = ids;
+        },
+        getListByParams(parameter) {
+            return OsUserApi.getOsUserList(parameter)
+        },
+        //加载部门树
+        loadAdminDeps() {
+            OsGroupApi.getAdminOrg().then(resp => {
+                let data = resp.data;
+                let temp = [];
+                for (let i = 0; i < data.length; i++) {
+                    var rs = data[i];
+                    var _isLeaf = rs.childAmount == 0 ? true : false;
+                    temp.push({title: rs.name, groupId: rs.groupId, key: rs.key, isLeaf: _isLeaf})
+                }
+
+                this.orgData = [...temp];
+                // this.getAllUserTypeList();
+            })
+        },
+        //加载左树下的子节点
+        onLoadGroupTree(treeNode) {
+            if (treeNode.dataRef.children) {
+                return;
+            }
+            return OsGroupApi.getParentGroup(treeNode.dataRef.groupId).then(data => {
+                let treeData = []
+                for (let i = 0; i < data.length; i++) {
+                    var rs = data[i]
+                    var _isLeaf = rs.childAmount == 0 ? true : false;
+                    // treeData.push({title: rs.name, groupId: rs.groupId, key: rs.key,isLeaf: _isLeaf})
+                    treeData.push({title:`${rs.name}-${rs.key}`, groupId: rs.groupId, key: rs.key,isLeaf: _isLeaf})
+                }
+                var orgData = this.getGroupTree(this.orgData, treeNode.dataRef.groupId, treeData);
+                this.orgData = [...orgData];
+                // var orgData = this.getGroupTree(this.orgDataTree[index].orgData, treeNode.dataRef.groupId, treeData);
+                // this.orgDataTree[index].orgData =  [...orgData];
+            })
+        },
+        getGroupTree(orgData, groupId, treeData) {
+            if (treeData.length > 0) {
+                for (var i = 0; i < orgData.length; i++) {
+                    if (orgData[i].groupId == groupId) {
+                        orgData[i].children = treeData;
+                        break;
+                    }
+                    if (orgData[i].children) {
+                        this.getGroupTree(orgData[i].children, groupId, treeData);
+                    }
+                }
+            }
+            return orgData;
+        },
+        //选中树节点
+        selectGroupNode(selKeys, e) {
+            let node = e.node.dataRef
+            if(this.isOnlyOrg) {
+                // this.checkedTarget['approverId'] = node.groupId
+                // this.checkedTarget['approverName'] = node.title
+                // this.$emit('transCheckedTarget',this.checkedTarget)
+                //查询左树用户
+                if(selKeys.length==0){
+                    delete this.queryParam.groupId;
+                }else {
+                    this.queryParam.groupId = node.groupId;
+                }
+                this.$refs.table.loadData()
+            }
+        },
+        onSelectChange(keys,rows) { 
+            this.checkedTarget['approverId'] = rows[0].userNo
+            this.checkedTarget['approverName'] = rows[0].fullName
+            this.$emit('transCheckedTarget',this.checkedTarget)
+        },
+    },
+    beforeDestroy() {
+        this.checkedTarget = Object.assign({},this.$options.data().checkedTarget)
+    }
+}
+</script>
+<style scoped>
+.rightDetailtop{
+  background: #fafafa;
+  width: 100%;
+  height:37.8px;
+  line-height:37.8px;
+  border-bottom: 1px solid #e8e8e8;
+  position:relative;
+}
+.rx-tree-title{
+  white-space: normal;
+  overflow: hidden;
+}
+.telist{
+  cursor: pointer;
+}
+.orgName-style /deep/ .ant-form-item-label {
+    width: 80px;
+    text-align: left;
+}
+/* .rightDetailtop{
+  background: #fafafa;
+  border-bottom: 1px solid #e8e8e8;
+  width: 100%;
+  text-align: center;
+  height:54px;
+  line-height:54px;
+} */
+/deep/ .ant-card-head-title {
+    padding: 0;
+}
+/deep/.ant-table-thead > tr > th {
+  text-align: center; 
+  height: 37.8px!important;
+}
+/deep/ .ant-table-tbody > tr > td {
+  height: 37.8px!important;
+}
+/deep/ .gridContent{
+  border: 1px solid #ddd!important;
+}
+/deep/ .ant-table-row-expand-icon{
+   margin-top: 3px;
+}
+/* /deep/ .ant-checkbox-wrapper {
+    height: 36px!important;
+    line-height: 36px!important;
+} */
+.chooseOrg-style::after {
+    content: ':';
+    position: relative;
+    top: -0.5px;
+    margin: 0 8px 0 2px;
+}
+</style>
+

+ 64 - 34
src/views/modules/knowledge/warehouse/contentData.vue

@@ -203,15 +203,39 @@ export default {
       }
       this.categoryName=this.$route.query.categoryName
     }
+
+    if(this.$route.query.isBack) {
+      this.categoryValue = []
+      if(this.$route.query.categoryId!=undefined){
+        this.categoryId=this.$route.query.categoryId
+        this.categoryValue=[this.$route.query.parentp,this.$route.query.parent,this.$route.query.categoryId]
+      }else if(this.$route.query.parent!=undefined){
+        this.categoryId=this.$route.query.parent
+        this.categoryValue=[this.$route.query.parentp,this.$route.query.parent]
+      }else{
+        this.categoryId=this.$route.query.parentp
+        this.categoryValue.push(this.$route.query.parentp)
+      }
+      // console.log(this.$route.query.categoryName)
+      if(this.$route.query.categoryName) {
+        this.categoryName=this.$route.query.categoryName
+      } 
+      if(this.$route.query.tapAction) {
+        this.tapAction=this.$route.query.tapAction
+      } 
+    }
     this.getBaseData()
-    this.getData(false)
+    if(this.$route.query.isBack) {
+      this.getData(true)
+    } else {
+      this.getData(false)
+    }
     if(this.$route.query.showMy!=undefined){
       this.changeAction(2)
     }
     if (this.user.photo && this.user.photo != '') {
       this.imgUrl = '/api/api-system/system/core/sysFile/previewFile?fileId='+this.user.photo
     }
-    
   },
   mounted() {
     let innerWidth = window.innerWidth
@@ -275,15 +299,16 @@ export default {
    },
    // 跳转添加
    addData(){
-    
     if(this.categoryValue.join(',')=='999'){
       this.categoryValue=[]
     }
-    console.log(this.categoryValue)
     this.$router.push({
       name: "knowledgeAddUpdate",
       query: {
-        categoryId: this.categoryValue.join(',')
+        categoryId: this.categoryValue.join(','),
+        name: this.categoryName,
+        type: this.$route.query.type,
+        tapAction: this.tapAction
       }
     })
    },
@@ -506,37 +531,42 @@ export default {
     }
    },
    // 删除刷新页面
-   delRefresh(){
-    let param = {
-      "pageNo": this.pageNum,
-      "pageSize": 10,
-      "sortField": "APPROVAL_STATUS",
-      "sortOrder": "asc",
-      params: {
-        "createBy":this.user.userId,
-        "keyword":this.searchData.keyword,
-        "isNotAudit":5
-      }
-    }
-    contentData.findAllKnowledge(param).then((res) => {
-      res.result.data.forEach(element => {
-        element.documentName = element.attachmentName
-        element.documentRemark = element.summary
-        element.viewNum = element.views
-        element.uploadTime = element.createTime
-        element.categoryArr = []
-        this.getType(element)
-        this.getCategory(element.categoryArr,element.knowledgeCategoryAdminVo)
-      });
-      this.number1 = res.result.totalCount
-      this.number1Bas = res.result.totalCount
-      this.dataList1 = res.result.data
-      this.$nextTick(()=>{
-        if(Number(res.result.totalCount)!=0){
-          this.$refs.pageBarref1.setTotal(Number(res.result.totalCount))
+   delRefresh(arg = 0){
+    // 刷新整个页面
+    if(arg == 1) {
+      this.getData(true)
+    } else {
+      let param = {
+        "pageNo": this.pageNum,
+        "pageSize": 10,
+        "sortField": "APPROVAL_STATUS",
+        "sortOrder": "asc",
+        params: {
+          "createBy":this.user.userId,
+          "keyword":this.searchData.keyword,
+          "isNotAudit":5
         }
+      }
+      contentData.findAllKnowledge(param).then((res) => {
+        res.result.data.forEach(element => {
+          element.documentName = element.attachmentName
+          element.documentRemark = element.summary
+          element.viewNum = element.views
+          element.uploadTime = element.createTime
+          element.categoryArr = []
+          this.getType(element)
+          this.getCategory(element.categoryArr,element.knowledgeCategoryAdminVo)
+        });
+        this.number1 = res.result.totalCount
+        this.number1Bas = res.result.totalCount
+        this.dataList1 = res.result.data
+        this.$nextTick(()=>{
+          if(Number(res.result.totalCount)!=0){
+            this.$refs.pageBarref1.setTotal(Number(res.result.totalCount))
+          }
+        })
       })
-    })
+    }
    },
    // 删除刷新页面草稿
    delRefreshCg(){

+ 188 - 39
src/views/modules/knowledge/warehouse/knowledgeAddUpdate.vue

@@ -3,25 +3,27 @@
     <div class="content">
       <div class="title">{{this.knowledgeForm.bastype==1?'新增文档知识':this.knowledgeForm.bastype==2?'新增维基知识':'新增知识'}}</div>
       <a-form-model ref="knowledgeRef" :rules="knowledgeRules" :model="knowledgeForm" layout="inline" >
-        <a-form-model-item class="knowledgeAddUpdateLabel oneline" label="所选分类:" prop="categoryId" style="font-size:0.93vw">
-          <a-cascader v-model="knowledgeForm.categoryId" 
-            :popupStyle="{
-              maxWidth: widthVar + 'px',
-              'overflow-x': 'auto'
-            }"
-            @popupVisibleChange="popupVisibleChange"
-            class="addItemBox scroll-ckunk"
-            :getPopupContainer="triggerNode => { return triggerNode.parentNode }"
-            :options="classifyList" 
-            :load-data="loadData"
-            :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
-            placeholder="请选择"
-            changeOnSelect 
-            popupClassName="knowledgeCascader">
-            <a-icon slot="suffixIcon" type="caret-down" class="classifyIconBox"/>
-          </a-cascader>
+        <a-form-model-item class="knowledgeAddUpdateLabel oneline" label="所选分类:" prop="categoryId" style="font-size:0.93vw;width:46.04vw">
+          <a-tooltip placement="top" :title="categoryName">
+            <a-cascader v-model="knowledgeForm.categoryId" 
+              :popupStyle="{
+                maxWidth: widthVar + 'px',
+                'overflow-x': 'auto'
+              }"
+              @popupVisibleChange="popupVisibleChange"
+              class="addItemBox scroll-ckunk"
+              :getPopupContainer="triggerNode => { return triggerNode.parentNode }"
+              :options="classifyList" 
+              :load-data="loadData"
+              :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
+              placeholder="请选择"
+              changeOnSelect 
+              popupClassName="knowledgeCascader">
+              <a-icon slot="suffixIcon" type="caret-down" class="classifyIconBox"/>
+            </a-cascader>
+          </a-tooltip>
         </a-form-model-item>
-        <a-form-model-item v-if="!this.knowledgeForm.bastype" class="knowledgeAddUpdateLabel oneline" label="知识类型:" prop="type" style="margin-top: -5px;">
+        <a-form-model-item v-if="!this.knowledgeForm.bastype" class="knowledgeAddUpdateLabel oneline" label="知识类型:" prop="type" style="margin-top: -5px;width:46.04vw;">
           <a-select class="addItemBox" v-model="knowledgeForm.type" placeholder="请选择" :disabled="!!this.knowledgeForm.bastype">
             <a-icon slot="suffixIcon" type="caret-down" style="font-size: 1vw;"/>
             <a-select-option class="dropdownClassli" v-for="(item,index) in knowledgeList" :key="index" :value="item.value">
@@ -30,11 +32,13 @@
           </a-select>
         </a-form-model-item>
         <a-form-model-item class="knowledgeAddUpdateLabel oneline" label="知识标题:" prop="titles" style="width:46.04vw;margin-top: -5px;">
-          <a-input @change='titlesChange' class="addItemBox" :maxLength="60" v-model="knowledgeForm.titles" placeholder="请输入" >
-            <div slot="suffix" style="color: #C0C0C0;">
-              {{titlesNum}}
-            </div>
-          </a-input>
+          <a-tooltip placement="top" :title="knowledgeForm.titles">
+            <a-input @change='titlesChange' class="addItemBox" :maxLength="60" v-model="knowledgeForm.titles" placeholder="请输入" >
+              <div slot="suffix" style="color: #C0C0C0;">
+                {{titlesNum}}
+              </div>
+            </a-input>
+          </a-tooltip>
         </a-form-model-item>
         <a-form-model-item class="knowledgeAddUpdateLabel oneline" label="编辑简介:" prop="summary" style="width:calc( 46.04vw );">
           <a-input @change='summaryChange' class="textareaBox" suffix="100" :maxLength="100" v-model="knowledgeForm.summary" type="textarea" :autosize="{minRows: 3, maxRows: 6}" placeholder="请输入" >
@@ -91,6 +95,11 @@
             <a-select class="addItemBox" style="width:100%;" v-model="authName" :showArrow="false" :open="false" placeholder="请选择您建议的权限范围"></a-select>
           </div>
         </a-form-model-item>
+        <!-- <a-form-model-item label="自定义节点" class="knowledgeAddUpdateLabel oneline" style="width:calc( 46.04vw );" v-if="knowledgeForm.type==1" prop="customNodes">
+          <div @click="handleAuthNewClickshow">
+            <a-select class="addItemBox" style="width:100%;" v-model="customNodesName" :showArrow="false" :open="false" placeholder="请选择"></a-select>
+          </div>
+        </a-form-model-item> -->
         <template v-if="showOnlyOffice">
           <div class='qualityManual-container-office'>
             <vab-only-office :option='option' />
@@ -100,7 +109,8 @@
         <div class="button-group" style="width:100%;display:flex;justify-content:flex-end;">
           <a-button style="background:#406CC4;color:#fff;margin-right: 1.25vw;" @click="handleSaveClick(1)">提交</a-button>
           <a-button style="margin-right: 1.25vw;" @click="handleSaveClick(0)">暂存</a-button>
-          <a-button @click="$router.back()">取消</a-button>
+          <!-- <a-button @click="$router.back()">取消</a-button> -->
+          <a-button @click="cancle">取消</a-button>
         </div>
       </a-form-model>
     </div>
@@ -124,7 +134,21 @@
                   @transCheckedTargets="transCheckedTargets"
                   @returnSequencesInfo="handleSequencesChange"
                   @returnGradeInfo="handleGradeChange" />
-    </a-modal>  
+    </a-modal> 
+    <!-- <a-modal
+        v-model="showAuditNewFlag"
+        class="chooseAuthor"
+        width="800"
+        title="员工选择"
+        centered
+        okText="保存"
+        @ok="handleSaveNewOk"
+      >
+        <org-people-new
+          ref="orgModalRef"
+          isOnlyOrg
+        ></org-people-new>
+    </a-modal> -->
   </div>
 </template>
 
@@ -134,8 +158,9 @@ import wordIcon from '@/assets/img/warehouse/wordIcon.png'
 import { ACCESS_TOKEN } from '@/store/mutation-types';
 import editor from '../components/editor'
 import orgPeople from '../components/orgPeople'
+import orgPeopleNew from './components/orgPeople'
 import vabOnlyOffice from '../components/onlyOffice'
-import { getCategoryId } from './aJs/getClassifyTree'
+import { getCategory,getCategoryId,getCategoryName } from './aJs/getClassifyTree'
 import api from '@/api/knowledge/warehouseIndex'
 import contentData from '@/api/knowledge/contentData'
 export default {
@@ -143,13 +168,15 @@ export default {
   components: {
     editor,
     vabOnlyOffice,
-    orgPeople
+    orgPeople,
+    orgPeopleNew
   },
   data() {
     return {
       widthVar:'',
       isShowOrg:true,
       showAuditFlag:false,
+      showAuditNewFlag: false,
       loading:false,
       api,
       add,
@@ -172,8 +199,10 @@ export default {
           organizationId: ["C0000"],
           organizationName: ["惠科集团"],
           organizationTree: ["惠科集团"]
-        }
+        },
+        // customNodes: []
       },
+      customNodesName: undefined,
       options: [
         {
           value: 'zhejiang',
@@ -282,7 +311,10 @@ export default {
       sequencesInfo: {},
       // 职等
       gradesInfo: {},
-      organizationIdsInfo: {}
+      organizationIdsInfo: {},
+      categoryName: '',
+      classifyName: '',
+      timer: null
     }
   },
   created() {
@@ -294,11 +326,15 @@ export default {
     if(this.$route.query.categoryId&&this.$route.query.categoryId!='999') {
       this.knowledgeForm.categoryId = this.$route.query.categoryId.split(',')
     }
+    if(this.$route.query.name) {
+      this.classifyName = this.$route.query.name
+    }
     let pkId = this.$route.query.pkId
     if(pkId) {
       this.pkId = pkId
       api.info({pkId:pkId,isPc:1}).then(res => {
         this.knowledgeForm.categoryId = getCategoryId(res.data.knowledgeCategoryAdminVo)
+        this.categoryName = getCategory(res.data.knowledgeCategoryAdminVo)
         this.knowledgeForm.type = res.data.type.toString()
         this.knowledgeForm.titles = res.data.titles
         this.knowledgeForm.summary = res.data.summary
@@ -330,9 +366,6 @@ export default {
           this.sequencesInfo.gradeName = organizationInfo.gradeName
           this.gradesInfo.gradeLevelId = organizationInfo.gradeLevelId
           this.gradesInfo.gradeLevelName = organizationInfo.gradeLevelName
-          // console.log(this.checkedTargets)
-          // console.log(this.sequencesInfo)
-          // console.log(this.gradeLevelId)
           this.accessAuthority = info.join('/')
           this.authName = info.join('/')
         }
@@ -368,6 +401,7 @@ export default {
     }
   },
   mounted() {
+    this.initDraft()
     let innerWidth = window.innerWidth
 
     // 计算
@@ -388,16 +422,56 @@ export default {
         }
       })
     }, 1000)*/
-   
   },
   methods: {
+    initDraft() {
+      // 每隔3分钟自动存入草稿
+      let that = this
+      clearTimeout(this.timer)
+      this.timer = setTimeout(function(){
+        // 存草稿
+        that.saveDraft()
+      }, 60000*3)
+    },
+    saveDraft() {
+      let info = {
+        ...this.knowledgeForm,
+        isDraft: 0
+      }
+      if(this.knowledgeForm.categoryId.length) {
+        info.categoryId = this.knowledgeForm.categoryId.slice(-1)[0]
+      } else {
+        info.categoryId = ''
+      }
+      if(!this.pkId) {
+        api.create(info).then(res => {
+          if(res.code == 200) {
+            clearTimeout(this.timer)
+            this.pkId = res.data
+            this.initDraft()
+          }
+        })
+      } else {
+        api.save({...info, pkId: this.pkId}).then(res => {
+          if(res.code == 200) {
+            clearTimeout(this.timer)
+            console.log(res)
+            this.initDraft()
+          }
+        })
+      }
+    },
     handleAuthClickshow() {
       this.organizationIdsInfo = this.knowledgeForm.organizationIds
       this.showAuditFlag = true      
     },
+    handleAuthNewClickshow() {
+      this.showAuditNewFlag = true
+    },
     //分类修改数据
     popupVisibleChange(value) {
       if(value==false){
+        this.categoryName = getCategoryName(this.classifyList,this.knowledgeForm.categoryId)
         this.getApprover()
       }
     },
@@ -450,6 +524,22 @@ export default {
       }
       this.showAuditFlag = false
     },
+    handleSaveNewOk() {
+      let info1 = this.$refs.orgModalRef.personId
+      let info2 = this.$refs.orgModalRef.personIdArr
+      let num = this.$refs.orgModalRef.queryParam.pageNo - 1
+      info2[num] = []
+      if(info2.length) {
+        for(let i of info2) {
+          if(i && i.length) {
+            info1.push(...i)
+          }
+        }
+      }
+      this.customNodesName = info1.map(item => item.split('/')[0]).join('/')
+      this.knowledgeForm.customNodes = info1.map(item => item.split('/')[0]).join(',')
+      this.showAuditNewFlag = false
+    },
     //  title修改限制数量
     titlesChange(){
       this.titlesNum=60-this.knowledgeForm.titles.length
@@ -479,7 +569,31 @@ export default {
           }
         })
       }
-      
+    },
+    cancle() {
+      if(this.classifyName) {
+        let queryData = {
+          categoryName: this.classifyName,
+          isBack: 1,
+          type: this.$route.query.type,
+          tapAction: this.$route.query.tapAction,
+        }
+        if(this.knowledgeForm.categoryId[0]) {
+          queryData.parentp = this.knowledgeForm.categoryId[0]
+          if(this.knowledgeForm.categoryId[1]) {
+            queryData.parent = this.knowledgeForm.categoryId[1]
+            if(this.knowledgeForm.categoryId[2]) {
+              queryData.categoryId = this.knowledgeForm.categoryId[2]
+            } 
+          }
+        }
+        this.$router.replace({
+          name: "contentData",
+          query: queryData,
+        })
+      } else {
+        this.$router.back()
+      }
     },
     saveData(){
       let that = this
@@ -491,12 +605,13 @@ export default {
         this.isSubmit = true
         api.create({...this.knowledgeForm, categoryId: this.knowledgeForm.categoryId.slice(-1)[0]}).then(res => {
           if(res.code == 200) {
-            if(res.message.indexOf('知识失败')>-1){
+            if(res.message && res.message.indexOf('知识失败')>-1){
               this.$message.error(res.message);
               this.isSubmit = false
             }else{
+              this.$message.success(res.message);
               setTimeout(function(){
-                that.$router.back();
+                that.cancle()
                 that.isSubmit = false;
               },2000)
             }
@@ -505,6 +620,7 @@ export default {
     } else {
       api.save({...this.knowledgeForm, categoryId: this.knowledgeForm.categoryId.slice(-1)[0], pkId: this.pkId}).then(res => {
         if(res.code == 200) {
+          this.$message.success(res.message);
           setTimeout(() => 
             this.$router.back()
             ,2000)
@@ -527,6 +643,33 @@ export default {
       contentData.getAllKnowledgeCategory().then((res) =>{
         this.categoryData(res.data)
         this.classifyList=res.data
+        //  通过分类id获取分类名
+        if(this.knowledgeForm.categoryId && this.knowledgeForm.categoryId.length) {
+          this.categoryName = getCategoryName(this.classifyList,this.knowledgeForm.categoryId)
+        }
+        // const result = []
+        // let num = 0
+        // const _getParentCategoryName = (info) => {
+        //     // if(info!=null){
+        //     //   result.push(info.pkId)
+        //     //   if(info.parents) {
+        //     //     _getParentCategoryName(info.parents)
+        //     //   }
+        //     // }
+        //     for(let i of info) {
+        //       if(i.pkId == this.knowledgeForm.categoryId[num]) {
+        //         console.log(i)
+        //         result.push(i.name)
+        //         num+=1
+        //         if(i.children && i.children.length) {
+        //           _getParentCategoryName(i.children)
+        //         }
+        //       }
+        //     }
+        //   }
+        //   _getParentCategoryName(res.data)
+        //   this.categoryName = result.join('|')
+        // }
       })
       /*let res = await api.getKnowledgeCategory(0)
       this.classifyList = res.data.children.map(item => {
@@ -619,6 +762,9 @@ export default {
       this.option.isPrint = false
       this.showOnlyOffice = true
     }
+  },
+  beforeDestroy() {
+    clearTimeout(this.timer)
   }
 }
 </script>
@@ -727,10 +873,10 @@ export default {
   border: none;
 }
 /deep/ .ant-table-thead > tr > th {
-  padding: 20px!important;
+  height: 37.8px!important;
 }
 /deep/ .ant-table-tbody > tr > td {
-  padding: 20px!important;
+  height: 37.8px!important;
 }
 .qualityManual-container-office {
   width: 100%;
@@ -769,7 +915,7 @@ export default {
 }
 .addItemBox{
   height: 2.7vw;
-  width: 21.71875vw;
+  /* width: 21.71875vw; */
   font-size: 0.9375vw;
 }
 .addItemBox /deep/input{
@@ -869,4 +1015,7 @@ export default {
 /deep/ .ant-cascader-menu:last-child {
   margin-right: 0!important;
 }
+.chooseAuthor /deep/.ant-modal-body {
+  padding: 0px;
+}
 </style>