qinzhipeng_v 5 rokov pred
rodič
commit
9eec393b3d
2 zmenil súbory, kde vykonal 116 pridanie a 61 odobranie
  1. 17 0
      src/api/configure.js
  2. 99 61
      src/views/ToConfigure/configure.vue

+ 17 - 0
src/api/configure.js

@@ -45,3 +45,20 @@ export function teamIsTeamNameRepetition(data) {
     data
   })
 }
+
+// 查询团队
+export function teamQueryTeamInfo(data) {
+  return request({
+    url: TeamManagement + `/team/queryTeamInfo?teamId=` + data,
+    method: 'get'
+  })
+}
+
+// 编辑团队
+export function teamModifyTeam(data) {
+  return request({
+    url: TeamManagement + `/team/modifyTeam`,
+    method: 'post',
+    data
+  })
+}

+ 99 - 61
src/views/ToConfigure/configure.vue

@@ -5,43 +5,44 @@
         <el-tab-pane label="我的" name="second">
           <div align="right" style="margin-right: 1%;"><el-button size="mini" type="primary" @click="create_test(form)">新建团队</el-button></div>
           <div align="center" style="margin: 1%;">
-            <el-table :data="tableData" :header-cell-style="{ background: '#F0F2F4', color: '#333B4A' }" size="mini" border align="center" :show-overflow-tooltip="true">
+            <el-table :data="table_Data" :header-cell-style="{ background: '#F0F2F4', color: '#333B4A' }" size="mini" width="80%" border show-overflow-tooltip="true">
               <el-table-column label="团队名称" min-width="120" align="center"><template slot-scope="scope">{{ scope.row.teamName }}</template></el-table-column>
-              <el-table-column label="我的角色" min-width="120" align="center"><template slot-scope="scope">{{ scope.row.teamAttribute[0] }}</template></el-table-column>
-              <el-table-column label="成员名单" min-width="120" align="center"><template slot-scope="scope">{{ scope.row.date }}</template></el-table-column>
-              <el-table-column label="操作" align="center">
+              <el-table-column label="团队属性" min-width="120" align="center"><template slot-scope="scope">{{ scope.row.teamAttribute[0] }}, {{ scope.row.teamAttribute[1] }}</template></el-table-column>
+              <el-table-column label="成员名单" min-width="120" align="center">
                 <template slot-scope="scope">
-                  <el-button size="mini" type="primary" plain @click="update_test(scope.row)">编辑</el-button>
+                  <span v-for="(item, i) in scope.row.memberName" :key=" i + 'a'">{{ item }}<span style="color: red; margin-left: 2%;">Lerader</span><br></span>
+                  <span v-for="(item, index) in scope.row.memberName1" :key="index">{{ item }}<br></span>
                 </template>
               </el-table-column>
+              <el-table-column label="操作" align="center">
+                <template slot-scope="scope"><el-button size="mini" type="primary" plain @click="update_test(scope.row)">编辑</el-button></template>
+              </el-table-column>
             </el-table>
-            <el-pagination :current-page.sync="currentPage1" :page-size="100" background layout="total, prev, pager, next" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
+            <el-pagination :current-page.sync="currentPage1" :page-sizes="[15, 25, 30]" background layout="total, prev, pager, next" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
           </div>
         </el-tab-pane>
         <el-tab-pane label="全部" name="third">
           <div align="right" style="margin-right: 1%;"><el-button size="mini" type="primary" @click="create_test(form)">新建团队</el-button></div>
           <div align="center" style="margin: 1%;">
-            <el-table :data="tableData" :header-cell-style="{ background: '#F0F2F4', color: '#333B4A' }" size="mini" width="80%" border show-overflow-tooltip="true">
+            <el-table v-loading="loading" :data="tableData" :header-cell-style="{ background: '#F0F2F4', color: '#333B4A' }" size="mini" width="80%" border show-overflow-tooltip="true">
               <el-table-column label="团队名称" min-width="120" align="center"><template slot-scope="scope">{{ scope.row.teamName }}</template></el-table-column>
               <el-table-column label="团队属性" min-width="120" align="center"><template slot-scope="scope">{{ scope.row.teamAttribute[0] }}, {{ scope.row.teamAttribute[1] }}</template></el-table-column>
               <el-table-column label="成员名单" min-width="120" align="center">
                 <template slot-scope="scope">
-                  <span v-for="item in scope.row.memberName" :key="item">{{ item }}<span style="color: red; margin-left: 2%;">Lerader</span><br></span>
+                  <span v-for="(item, index) in scope.row.memberName" :key="index+'a'">{{ item }}<span style="color: red; margin-left: 2%;">Lerader</span><br></span>
                   <span v-for="(item, index) in scope.row.memberName1" :key="index">{{ item }}<br></span>
                 </template>
               </el-table-column>
               <el-table-column label="操作" align="center">
-                <template slot-scope="scope">
-                  <el-button size="mini" type="primary" plain @click="update_test(scope.row)">编辑</el-button>
-                </template>
+                <template slot-scope="scope"><el-button size="mini" type="primary" plain @click="update_test(scope.row)">编辑</el-button></template>
               </el-table-column>
             </el-table>
-            <el-pagination :current-page.sync="currentPage1" :page-size="100" background layout="total, prev, pager, next" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
+            <el-pagination :current-page.sync="currentPage1" :page-sizes="[15, 25, 30]" background layout="total, prev, pager, next" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
           </div>
         </el-tab-pane>
       </el-tabs>
     </div>
-    <el-dialog title="新建团队" :visible.sync="dialogFormVisible" width="30%" center>
+    <el-dialog :title="title_name" :visible.sync="dialogFormVisible" width="30%" center>
       <el-form ref="form" label-position="left" :model="form" :rules="rules" label-width="110px">
         <el-form-item label="团队名称" prop="teamName">
           <el-input v-model="form.teamName" autocomplete="off" placeholder="请输入团队名称,不得超过20个汉字" @blur="blur_teamName(form.teamName)" />
@@ -53,7 +54,7 @@
         </el-form-item>
         <el-form-item label="团队Lerader">
           <el-select v-model="form.lerader" style="width: 100%;" multiple filterable remote reserve-keyword placeholder="请输入姓名或者邮箱前缀" :remote-method="remoteMethod" :loading="loading" @change="team_lerader(form.lerader)">
-            <el-option v-for="item in options" :key="item.empId" :label="item.name" :value="test2(item, 1)">
+            <el-option v-for="item in options" :key="item.idap" :label="item.name" :value="test2(item, 1)">
               <span style="float: left">{{ item.name }}</span>
               <span style="float: right; color: #8492a6; font-size: 13px,">{{ item.idap }}</span>
             </el-option>
@@ -61,7 +62,7 @@
         </el-form-item>
         <el-form-item label="团队成员" prop="dates">
           <el-select v-model="form.dates" style="width: 100%;" multiple filterable remote reserve-keyword placeholder="请输入姓名或者邮箱前缀" :remote-method="remoteMethod" :loading="loading" @change="team_dates(form.dates)">
-            <el-option v-for="item in options" :key="item.empId" :label="item.name" :value="test2(item, 0)">
+            <el-option v-for="item in options" :key="item.idap" :label="item.name" :value="test2(item, 0)">
               <span style="float: left">{{ item.name }}</span>
               <span style="float: right; color: #8492a6; font-size: 13px,">{{ item.idap }}</span>
             </el-option>
@@ -77,7 +78,7 @@
 </template>
 <script>
 
-import { teamCreateTeam, memberQueryMemberInfoByIDAPorName, teamQueryTeamInfoList, configShowTeamAndMemberEnum, teamIsTeamNameRepetition } from '@/api/configure'
+import { teamCreateTeam, memberQueryMemberInfoByIDAPorName, teamQueryTeamInfoList, configShowTeamAndMemberEnum, teamIsTeamNameRepetition, teamQueryTeamInfo, teamModifyTeam } from '@/api/configure'
 
 export default {
   name: 'PersonalWorkbench',
@@ -86,7 +87,9 @@ export default {
       userInformation: localStorage.getItem('username'),
       bizJson: localStorage.getItem('key'),
       dialogFormVisible: false,
+      dialogFormVisibleQuery: false,
       activeName: 'second',
+      title_name: '',
       currentPage1: 1,
       gridData: [],
       arr_team: [],
@@ -99,6 +102,7 @@ export default {
       teamMemberRelateInfos: [],
       form: {},
       tableData: [],
+      table_Data: [],
       options: [],
       lerader: [],
       tates: [],
@@ -117,16 +121,15 @@ export default {
     this.get_list(this.userInformation)
   },
   methods: {
-    // 获取团队人员信息
-    test2(item, e) {
+    test2(item, e) { // 获取团队人员信息
       if (typeof this.test[item.idap] === 'undefined') {
         item.role = e
         this.test[item.idap] = item
       }
       return item.idap
     },
-    // 获得list
-    get_list(e) {
+    get_list(e) { // 获得list
+      this.tableData = []
       var arr = { memberIDAP: e, curIndex: this.curIndex, pageSize: this.pageSize }
       teamQueryTeamInfoList(arr).then(res => {
         if (res.code === 200 && res.data.list !== null) {
@@ -140,12 +143,13 @@ export default {
             item.teamLeaderRelateInfoResponseList.map(item2 => {
               item.memberName.push(item2.memberName)
             })
-            item.teamMemberRelateInfoResponseList.map(item3 => {
-              item.memberName1.push(item3.memberName)
+            item.teamMemberRelateInfoResponseList.map(value => {
+              item.memberName1.push(value.memberName)
             })
-            this.tableData = res.data.list
+            e === undefined ? this.tableData = res.data.list : this.table_Data = res.data.list
           })
           this.total = res.data.total
+          this.loading = false
         }
       })
     },
@@ -162,36 +166,55 @@ export default {
         this.options = []
       }
     },
-
-    // 团队名称重复
-    blur_teamName(e) {
+    blur_teamName(e) { // 团队名称重复
       teamIsTeamNameRepetition({ teamName: e }).then(res => {
         if (res.data === true) {
           this.$set(this.form, 'teamName', '')
+          this.$message({ message: '团队名称已存在,请重新设置', type: 'error' })
         }
       })
     },
-
-    // 点击新增按钮
-    create_test() {
+    create_test() { // 点击新增按钮
       this.dialogFormVisible = true
-      this.form = {}
+      this.title_name = '新建团队'
+      this.$set(this.form, 'teamName', '')
+      this.$set(this.form, 'teamAttribute', '')
+      this.$set(this.form, 'lerader', [])
       this.$set(this.form, 'dates', [])
       this.$set(this.form, 'name', [])
       if (this.$refs['form'] !== undefined) {
         this.$refs['form'].resetFields()
       }
     },
-
-    // 点击编辑按钮
-    update_test(e) {
-      console.log(e)
+    update_test(e) { // 点击编辑按钮
+      this.title_name = '编辑团队'
       this.dialogFormVisible = true
-      this.form = e
+      teamQueryTeamInfo(e.teamId).then(res => {
+        const teamLeaderRelateInfoResponseList = []
+        const teamMemberRelateInfoResponseList = []
+        const leader = []
+        const teamMember = []
+        res.data.teamLeaderRelateInfoResponseList.map(item => {
+          teamLeaderRelateInfoResponseList.push({ name: item.memberName, idap: item.memberIDAP, teamId: item.teamId })
+          leader.push(item.memberIDAP)
+          this.arr.push({ memberIDAP: item.memberIDAP, department: item.deptid, role: 1 })
+        })
+        res.data.teamMemberRelateInfoResponseList.map(item => {
+          teamMemberRelateInfoResponseList.push({ name: item.memberName, idap: item.memberIDAP, teamId: item.teamId })
+          teamMember.push(item.memberIDAP)
+          this.arry.push({ memberIDAP: item.memberIDAP, department: item.deptid, role: 0 })
+        })
+        var set_options = []
+        set_options = teamLeaderRelateInfoResponseList.concat(teamMemberRelateInfoResponseList)
+        const hash = {}
+        this.options = set_options.reduce((preVal, curVal) => {
+          hash[curVal.idap] ? '' : hash[curVal.idap] = true && preVal.push(curVal)
+          return preVal
+        }, [])
+        this.form = { teamName: res.data.teamName, teamAttribute: res.data.teamAttribute[0], lerader: leader, dates: teamMember, teamId: e.teamId }
+      })
     },
-
-    // 改变lerader
-    team_lerader(e) {
+    team_lerader(e) { // 改变lerader
       this.form.arr = []
       for (const i in e) {
         this.form.arr.push(this.test[e[i]])
@@ -199,9 +222,9 @@ export default {
       this.arr = this.form.arr.map(item => {
         return { memberIDAP: item.idap, department: item.deptid, role: 1 }
       })
+      this.options = []
     },
-    // 改变成员
-    team_dates(e) {
+    team_dates(e) { // 改变成员
       this.form.arry = []
       for (const i in e) {
         this.form.arry.push(this.test[e[i]])
@@ -209,11 +232,8 @@ export default {
       this.arry = this.form.arry.map(item => {
         return { memberIDAP: item.idap, department: item.deptid, role: 0 }
       })
-      console.log(this.arry)
     },
-
-    // 创建团队
-    Preservation(form) {
+    Preservation(form) { // 创建团队
       this.$refs['form'].validate((valid) => {
         if (valid) {
           var team = {
@@ -223,30 +243,48 @@ export default {
             creator: this.userInformation,
             modifier: this.userInformation
           }
-          teamCreateTeam(team).then(res => {
-            if (res.code === 200) {
-              this.dialogFormVisible = false
-              this.$message({ message: res.msg, type: 'success' })
-            } else {
-              this.dialogFormVisible = true
-              this.$message({ message: res.msg, type: 'error' })
-            }
-          })
+          switch (this.title_name) {
+            case '新建团队':
+              teamCreateTeam(team).then(res => {
+                if (res.code === 200) {
+                  this.dialogFormVisible = false
+                  this.$message({ message: res.msg, type: 'success' })
+                  this.get_list()
+                } else {
+                  this.dialogFormVisible = true
+                  this.$message({ message: res.msg, type: 'error' })
+                }
+              })
+              break
+            case '编辑团队':
+              team.teamId = form.teamId
+              teamModifyTeam(team).then(res => {
+                if (res.code === 200) {
+                  this.dialogFormVisible = false
+                  this.$message({ message: res.msg, type: 'success' })
+                  this.get_list()
+                } else {
+                  this.dialogFormVisible = true
+                  this.$message({ message: res.msg, type: 'error' })
+                }
+              })
+              break
+          }
         }
       })
     },
-    // 切换(我的/全部)
-    handleClick(tab, event) {
+    handleClick(tab, event) { // 切换(我的/全部)
+      this.loading = true
       tab.index === '0' ? this.get_list(this.userInformation) : this.get_list()
     },
-    //  分页
-    handleSizeChange(val) {
-      console.log(`每页 ${val} 条`)
+    handleSizeChange(size) { //  分页
+      this.pageSize = size
+      this.get_list()
     },
-    handleCurrentChange(val) {
-      console.log(`当前页: ${val}`)
+    handleCurrentChange(curIndex) { //  分页
+      this.curIndex = curIndex
+      this.get_list()
     },
-
     get_select() { // 获取下拉菜单数据
       configShowTeamAndMemberEnum().then(res => {
         this.teamRoleEnum = res.data.teamRoleEnum // 团队属性