Browse Source

修改bug

Zhang Li, BBF-411-2(Neusoft) 2 years ago
parent
commit
b53bd8ab38

+ 139 - 59
src/views/modules/knowledge/map/addUpdateMap.vue

@@ -6,7 +6,7 @@
         <div class="body">
           <div class="content">
             <a-form-model ref="mapRef" :model="mapForm" :rules="mapRules" layout="inline" hideRequiredMark>
-              <a-row :gutter="24" type="flex">
+              <a-row :gutter="24" type="flex" style="align-items: center;">
                 <a-col :span="12"> 
                   <span class="titleBox">基础信息</span>
                 </a-col>
@@ -22,53 +22,92 @@
                   </a-select-option>
                 </a-select>
               </a-form-model-item>
-              <a-form-model-item style="margin-left: 12px;" label="*地图名称:" prop="name">
+              <a-form-model-item style="margin-left: 12px;margin-bottom: 20px;" label="*地图名称:" prop="name">
                 <a-input v-model="mapForm.name" placeholder="请输入" :maxLength="10" />
               </a-form-model-item>
-              <span class="titleBox">权限信息</span>
-              <a-form-model-item style="margin-left: 12px;" label="*所属组织:" prop="groupId">
-                <a-tree-select
-                  v-model="mapForm.groupId"
-                  
-                  allow-clear
-                  :dropdown-style="{ minHeight: '200px', maxHeight: '400px', overflow: 'auto' }"
-                  :tree-data="orgData"
-                  multiple
-                  placeholder="请选择"
-                  
-                  treeNodeLabelProp="label"
-                  @change="handleTreeChange"
-                  @select="handleTreeSelect"
-                  :treeDataSimpleMode="true"
-                >
-                </a-tree-select>
-              </a-form-model-item>
-              <a-form-model-item style="margin-left: 12px;" label="*阅读权限:" prop="groupPurview">
-                <a-select v-model="mapForm.groupPurview" placeholder="请选择" :disabled="!mapForm.groupId.length" :showArrow="false">
-                  <a-select-option v-for="(item,index) in authList" :key="index" :value="item.value" >
-                    {{item.label}}
-                  </a-select-option>
-                </a-select>
-              </a-form-model-item>
-              <template v-if="mapForm.groupPurview == 2">
-                <a-form-model-item style="margin-left: 12px;" label="可阅读者">
-                  <a-button class="totBtn" style="margin-top: 6px;float: left;" type="primary" @click="handleAddUserShow">添加员工</a-button>
-                </a-form-model-item>
-                <rx-grid
-                  class="table-style"
-                  :columns="userColumns"
-                  :dataSource="userList"
-                  :defaultPageSize="5"
-                  :heightauto="true"
-                    
-                  > 
-                  <template slot="groupSummary" slot-scope="{text}">
-                    <div style="white-space: pre-line">{{ text }}</div>
-                  </template>
-                  <template slot="action" slot-scope="{text,record}">
-                    <rx-button class="clearBtn" alias="knowEdit" :butn-icon="'none'" @click="handleRemoveUserClick(record)">移除</rx-button>
+              <!-- <span class="titleBox">权限信息</span> -->
+              <a-row :gutter="24" type="flex" style="height:32px;align-items: center;">
+                <a-col :span="12"> 
+                  <span class="titleBox">权限信息</span>
+                  <span v-if="pkId" style="margin-left: 19px;color: #1890ff;cursor: pointer;" @click="extend = !extend">{{ extend ? '收缩∧' : '展开∨' }}</span>
+                </a-col>
+              </a-row>
+              <template v-if="!pkId || extend">
+                <div style="margin-left: 12px;">
+                  <a-form-model-item  label="*所属组织:" prop="groupId">
+                  <a-tree-select
+                    v-model="mapForm.groupId"
+                    allow-clear
+                    :dropdown-style="{ minHeight: '200px', maxHeight: '400px', overflow: 'auto' }"
+                    :tree-data="orgData"
+                    multiple
+                    placeholder="请选择"
+                    treeNodeLabelProp="label"
+                    @change="handleTreeChange"
+                    @select="handleTreeSelect"
+                    :treeDataSimpleMode="true"
+                  >
+                  </a-tree-select>
+                  </a-form-model-item>
+                  <a-form-model-item label="*阅读权限:" prop="groupPurview">
+                    <a-select v-model="mapForm.groupPurview" placeholder="请选择" :disabled="!mapForm.groupId.length" :showArrow="false">
+                      <a-select-option v-for="(item,index) in authList" :key="index" :value="item.value" >
+                        {{item.label}}
+                      </a-select-option>
+                    </a-select>
+                  </a-form-model-item>
+                  <template v-if="mapForm.groupPurview == 2">
+                    <a-form-model-item>
+                      <span slot="label">&ensp;可阅读者</span>
+                      <a-button class="totBtn" style="margin-top: 6px;float: left;" type="primary" @click="handleAddUserShow">添加员工</a-button>
+                    </a-form-model-item>
+                    <template v-if="userList.length">
+                      <!-- <rx-grid
+                        ref="peopleRef"
+                        :columns="userColumns"
+                        :dataSource="userList"
+                        :defaultPageSize="5"
+                        :heightauto="true"
+                        > 
+                        <template slot="groupSummary" slot-scope="{text}">
+                          <div style="white-space: pre-line">{{ text }}</div>
+                        </template>
+                        <template slot="action" slot-scope="{text,record}">
+                          <rx-button class="clearBtn" alias="knowEdit" :butn-icon="'none'" @click="handleRemoveUserClick(record)">移除</rx-button>
+                        </template>
+                      </rx-grid> -->
+                      <a-table style="width:100%;" 
+                               :columns="userColumns" 
+                               :data-source="userList.slice((pageParam.pageNo-1)*pageParam.pageSize,pageParam.pageNo*pageParam.pageSize)" 
+                               :heightauto="true" 
+                               :scroll="{ x: 800}"
+                               :pagination="false">
+                        <template slot="groupSummary" slot-scope="text, record">
+                          <div style="white-space: pre-line">{{ text }}</div>
+                        </template>
+                        <template slot="action" slot-scope="text, record">
+                          <rx-button class="clearBtn" alias="knowEdit" :butn-icon="'none'" @click="handleRemoveUserClick(record)">移除</rx-button>
+                        </template>
+                      </a-table>
+                      <div style="width: 100%;display: flex;justify-content: flex-end;margin-top: 15px;">
+                        <a-pagination
+                          v-model="pageParam.pageNo"
+                          :page-size-options="['5']"
+                          :total="userList.length"
+                          show-size-changer
+                          showQuickJumper
+                          :page-size="pageParam.pageSize"
+                          @showSizeChange="handleShowSizeChange"
+                          @change="onChange"
+                          >
+                          <template slot="buildOptionText" slot-scope="props">
+                            <span>{{ props.value }}条/页</span>
+                          </template>
+                        </a-pagination>
+                        </div>
+                    </template>
                   </template>
-                </rx-grid>
+                </div>
               </template>
             </a-form-model>
             <a-form-model style="margin-top: 10px;">
@@ -109,7 +148,7 @@
         centered
         okText="保存"
         @ok="handleSaveUserOk">
-        <org-people ref="orgPeopleRef" style="width:1000px;height:460px" :groupIds="groupIds"></org-people>
+        <org-people ref="orgPeopleRef" style="width:1000px;height:460px" :groupIds="groupIds" @transCheckedTarget="transCheckedTarget"></org-people>
       </a-modal>  
       <!-- 学习路径 -->
       <a-modal v-model="showRouteFlag" 
@@ -150,7 +189,7 @@
               <a-input v-model="learnForm.outerContentName" placeholder="请输入" />
             </a-form-model-item>
             <a-form-model-item label="访问地址" prop="outerAccessUrl" v-show="learnForm.type==1">
-              <a-input v-model="learnForm.outerAccessUrl" placeholder="请输入" />
+              <a-input v-model="learnForm.outerAccessUrl" placeholder="请输入一个网址" />
             </a-form-model-item>
             <a-form-model-item label="知识分类:" prop="classify" v-show="learnForm.type==2">
               <a-cascader v-model="learnForm.classify" 
@@ -200,6 +239,7 @@ export default {
       },
       api,
       classApi,
+      extend: true,
       saveLoading: false,
       // 地图id
       pkId: '',
@@ -229,6 +269,11 @@ export default {
       },
       showUserFlag: false,
       showUseNum: 0,
+      pageParam: {
+        pageNo: 1,
+        pageSize: 5,
+      },
+      choosePeople: [],
       userList:[],
       userColumns: [
         {
@@ -325,6 +370,18 @@ export default {
     }
   },
   methods: {
+    transCheckedTarget(arg) {
+      this.choosePeople = arg
+    },
+    // 每页条数
+    handleShowSizeChange(current, pageSize) {
+      this.pageParam.pageNo = current
+      this.pageParam.pageSize = pageSize;
+    },
+    // 跳转
+    onChange(pageNumber) {
+      this.pageParam.pageNo = pageNumber
+    },
     load(pkId = false) {
       // 获取所属组织
       OsGroupApi.getAllOsGroupList({dimId:1}).then(res => {
@@ -443,20 +500,22 @@ export default {
     },
     // 添加员工
     handleSaveUserOk() {
-      let res = this.$refs.orgPeopleRef.$refs.mapRef.getSelectedRows()
-      if(!res.length) {
+      // let res = this.$refs.orgPeopleRef.$refs.mapRef.getSelectedRows()
+      // console.log(res)
+      if(!this.choosePeople.length) {
         this.$message.error('请先选择员工');
       }
-      res.forEach(item => {
+      this.choosePeople.forEach(item => {
         item.createTime = getTimeNow()
       })
       this.showUserFlag = false
       // if(this.pkId) {
-      this.userList = [ ...this.userList, ...res ]
+      this.userList = [ ...this.userList, ...this.choosePeople ]
       const map = new Map()
       let filterList = this.userList.filter(el => !map.has(el.userId) && map.set(el.userId,true))
       this.userList = filterList
       this.$refs.orgPeopleRef.$refs.mapRef.selectedRowKeys = []
+      this.choosePeople = []
       // } else {
       //   this.userList = [ ...res ]
       // }
@@ -473,6 +532,10 @@ export default {
           cancelText: '取消',
           onOk() {
             that.userList = that.userList.filter(item => item.userId != record.userId)
+            console.log(that.userList.length/that.pageParam.pageSize)
+            if((that.userList.length/that.pageParam.pageSize + 1) == that.pageParam.pageNo) {
+              that.onChange(that.pageParam.pageNo - 1)
+            }
           },
       });
     },
@@ -480,6 +543,15 @@ export default {
     addMapRoute(){
       this.showRouteTitle = '添加学习路径'
       this.routeForm = Object.assign({},this.$options.data().routeForm)
+      if(this.tabRouteList.length) {
+        if(this.tabRouteList.length  == 1) {
+          this.routeForm.sort = this.tabRouteList[0].sort + 1
+        } else {
+          let tabRouteinfo = JSON.parse(JSON.stringify(this.tabRouteList))
+          let computedSort = tabRouteinfo.sort((a,b) => b.sort - a.sort)[0].sort
+          this.routeForm.sort = computedSort + 1
+        }
+      }
       this.showRouteFlag = true
     },
     // 保存学习路径
@@ -498,6 +570,7 @@ export default {
           ...this.routeForm,
         })
       } else {
+        console.log(this.routeForm)
         // 找到tabRouteList中大于等于routeForm.sort的索引
         let itemIndex = this.tabRouteList.findIndex(item => item.sort >= this.routeForm.sort)
         if(itemIndex == -1) {
@@ -512,7 +585,6 @@ export default {
           })
         }
       }
-  
       //  直接push后排序
       // this.tabRouteList.push({
       //   ...this.routeForm,
@@ -560,7 +632,7 @@ export default {
           ],
           outerAccessUrl: [
             { required: true, message: '请输入访问地址', trigger: 'blur'},
-            { pattern: /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?/, message: '访问地址格式不正确,请以https或http开头', trigger: 'blur'},
+            { pattern: /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?/, message: '访问地址格式不正确,请以https://或http://开头', trigger: 'blur'},
           ]
         }
         this.learnRules = {  
@@ -611,20 +683,26 @@ export default {
     },
     // 保存学习内容
     handleSaveLearnOk() {
-      this.saveLoading = true
       this.$refs.learnRef.validate(valid => {
           if(valid) {
             let tabs = this.tabRouteList[parseInt(this.tabsKeys)-1].contents
             if(this.learnForm.type == 1) {
-              if(tabs.some(item => item.outerSystemName == this.learnForm.outerSystemName) || tabs.some(item => item.outerContentName == this.learnForm.outerContentName)) {
+              // 在相同系统下 内容要不同
+              // if(tabs.some(item => item.outerSystemName == this.learnForm.outerSystemName) || tabs.some(item => item.outerContentName == this.learnForm.outerContentName)) {
+              //   this.$message.error('已添加相同的学习内容')
+              //   return
+              // }
+              let systemInfo = tabs.filter(item => item.outerSystemName == this.learnForm.outerSystemName)
+              if(systemInfo.some(item => item.outerContentName == this.learnForm.outerContentName)) {
                 this.$message.error('已添加相同的学习内容')
-                this.saveLoading = false
                 return
               }
+              this.saveLoading = true
               tabs.unshift({
                 ...this.learnForm
               })
             } else {
+              this.saveLoading = true
               tabs.unshift({
                 ...this.learnForm,
                 ...this.knowledgeInfo
@@ -772,7 +850,7 @@ export default {
       background: #f8f8f8;
       form{
         background: @white;
-        padding: 20px 40px 8px;
+        padding: 20px 40px;
       }
       .ant-form-item {
         width: 50%;
@@ -827,8 +905,7 @@ export default {
   padding: 23px 0;
 }
 /deep/ .ant-tabs-ink-bar {
-  width: 120px!important;
-  bottom: 3px;
+  bottom: 2px;
   height: 1.5px;
 }
 /deep/ .ant-tabs-nav-container {
@@ -849,6 +926,9 @@ export default {
 /* /deep/ .ant-select-selection__choice {
   padding: 0 10px;
 } */
+/* /deep/ .rx-gridBox {
+  margin-left: 12px;
+} */
 /deep/.gridContent {
   border: none!important;;
 }

+ 1 - 47
src/views/modules/knowledge/map/components/orgPeople.vue

@@ -206,55 +206,9 @@
             }
             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)
-            } else {
-                let organizationTree = getParentNode(e.node)
-                this.checkedTarget['organizationId'] = node.groupId
-                this.checkedTarget['organizationName'] = node.title
-                this.checkedTarget['organizationTree'] = organizationTree
-                this.$emit('transCheckedTarget',this.checkedTarget)
-            }   
-            if(this.isOnlyOrg) {
-                //this.selectGroupId=node.groupId;
-                //查询左树用户
-                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
-            console.log(this.checkedTarget)
-            this.$emit('transCheckedTarget',this.checkedTarget)
+            this.$emit('transCheckedTarget',rows)
         },
-        // 选择职系
-        handleSequencesChange(arg) {
-            if(arg) {
-                this.sequencesInfo.gradeName = this.sequencesList.find(item => item.value == arg).label
-            } else {
-                this.sequencesInfo = {}
-            }
-            this.$emit('returnSequencesInfo',this.sequencesInfo)
-        },
-        // 选择职级
-        handleGradeChange(arg) {
-            if(arg) {
-                this.gradesInfo.gradeLevelName = arg
-            } else {
-                this.gradesInfo = {}
-            }
-            this.$emit('returnGradeInfo',this.gradesInfo)
-        }
     },
 }
 </script>

+ 4 - 5
src/views/modules/knowledge/map/components/pageList.vue

@@ -22,8 +22,8 @@
             </template>
           </div>
           <div class="flex-ac" style="width: 50%;justify-content: flex-end;">
-            <div class="button-style" @click="handleDelDataClick(index)">
-              <span>移除</span>
+            <div class="button-style" @click="handleLookDataClick(item)">
+              <span>查看</span>
             </div>
             <div v-if="index != 0" class="button-style" @click="handleActionDataClick(index, 'up')">
               <span>上升</span>
@@ -31,8 +31,8 @@
             <div v-if="index != (contents.length - 1)" class="button-style" @click="handleActionDataClick(index, 'down')">
               <span>下降</span>
             </div>
-            <div class="button-style" @click="handleLookDataClick(item)">
-              <span>查看</span>
+            <div class="button-style" @click="handleDelDataClick(index)">
+              <span>移除</span>
             </div>
           </div>
         </div>
@@ -175,7 +175,6 @@ export default {
         width:16px;
         height:16px;
         margin-right: 3px;
-        margin-top: 2px;
       }
     }
   }