Bläddra i källkod

sop任务新建时,快捷选择部门员工

三七 1 vecka sedan
förälder
incheckning
4d54d0bef9

+ 8 - 0
src/api/qw/user.js

@@ -26,6 +26,14 @@ export function myDepartListUser(query) {
   })
 }
 
+export function getQwUserByDept(data) {
+  return request({
+    url: '/qw/user/getQwUserByDept',
+    method: 'post',
+    data: data
+  })
+}
+
 // 查询企微用户列表
 export function listUser(query) {
   return request({

+ 2 - 1
src/views/qw/sop/addSop.vue

@@ -369,7 +369,7 @@
         <el-button type="primary" @click="submitForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
-      <el-dialog :title="listUser.title" :visible.sync="listUser.open" width="700px" append-to-body>
+      <el-dialog :title="listUser.title" :visible.sync="listUser.open" width="1000px" append-to-body>
         <qwUserList ref="QwUserList" @selectUserList="selectUserList"></qwUserList>
       </el-dialog>
 
@@ -827,6 +827,7 @@ export default {
     //企业微信员工
     selectUserList(list) {
       this.listUser.open = false;
+      console.log("list",list)
       list.forEach(obj => {
         if (!this.userSelectList.some(item => item == obj.id)) {
           this.userSelectList.push(obj.id);

+ 11 - 10
src/views/qw/user/cuDeptIdIndex.vue

@@ -76,8 +76,9 @@
       <el-table-column label="企微成员ID" align="center" prop="id" />
       <el-table-column label="企微账号" align="center" prop="qwUserId" />
       <el-table-column label="企微昵称" align="center" prop="qwUserName" />
+      <el-table-column label="所属企微部门" align="center" prop="departmentName" />
       <el-table-column label="员工称呼" align="center" prop="welcomeText" />
-      <el-table-column label="所属部门" align="center" prop="isDel">
+      <el-table-column label="员工状态" align="center" prop="isDel">
         <template slot-scope="scope">
           <el-tag v-if="scope.row.isDel == 0" type="success">正常</el-tag>
           <el-tag v-else type="error">离职</el-tag>
@@ -118,15 +119,15 @@
 <!--        </template>-->
 <!--      </el-table-column>-->
 <!--      <el-table-column label="插件版本" align="center" prop="version"/>-->
-      <el-table-column label="服务器地址" align="center" prop="loginCodeUrl">
-        <template slot-scope="scope">
-          <el-tooltip class="item" effect="dark" :content="scope.row.loginCodeUrl" placement="top">
-            <div style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; text-overflow: ellipsis;">
-              <span>{{ scope.row.loginCodeUrl }}</span>
-            </div>
-          </el-tooltip>
-        </template>
-      </el-table-column>
+<!--      <el-table-column label="服务器地址" align="center" prop="loginCodeUrl">-->
+<!--        <template slot-scope="scope">-->
+<!--          <el-tooltip class="item" effect="dark" :content="scope.row.loginCodeUrl" placement="top">-->
+<!--            <div style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; text-overflow: ellipsis;">-->
+<!--              <span>{{ scope.row.loginCodeUrl }}</span>-->
+<!--            </div>-->
+<!--          </el-tooltip>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
         <template slot-scope="scope">
           <el-button

+ 17 - 16
src/views/qw/user/index.vue

@@ -88,8 +88,9 @@
       <el-table-column label="企微成员ID" align="center" prop="id" />
       <el-table-column label="企微账号" align="center" prop="qwUserId" />
       <el-table-column label="企微昵称" align="center" prop="qwUserName" />
+      <el-table-column label="所属企微部门" align="center" prop="departmentName" />
       <el-table-column label="员工称呼" align="center" prop="welcomeText" />
-      <el-table-column label="所属部门" align="center" prop="isDel">
+      <el-table-column label="员工状态" align="center" prop="isDel">
         <template slot-scope="scope">
           <el-tag v-if="scope.row.isDel == 0" type="success">正常</el-tag>
           <el-tag v-else type="error">离职</el-tag>
@@ -130,21 +131,21 @@
       <!--        </template>-->
       <!--      </el-table-column>-->
       <!--      <el-table-column label="插件版本" align="center" prop="version"/>-->
-      <el-table-column label="服务器地址" align="center" prop="loginCodeUrl">
-        <template slot-scope="scope">
-          <el-tooltip class="item" effect="dark" :content="scope.row.loginCodeUrl" placement="top">
-            <div style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; text-overflow: ellipsis;">
-              <span>{{ scope.row.loginCodeUrl }}</span>
-            </div>
-          </el-tooltip>
-        </template>
-      </el-table-column>
-
-      <el-table-column label="自动发课" align="center" prop="isAuto">
-        <template slot-scope="scope">
-          <dict-tag :options="isAutoOptions" :value="scope.row.isAuto"/>
-        </template>
-      </el-table-column>
+<!--      <el-table-column label="服务器地址" align="center" prop="loginCodeUrl">-->
+<!--        <template slot-scope="scope">-->
+<!--          <el-tooltip class="item" effect="dark" :content="scope.row.loginCodeUrl" placement="top">-->
+<!--            <div style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; text-overflow: ellipsis;">-->
+<!--              <span>{{ scope.row.loginCodeUrl }}</span>-->
+<!--            </div>-->
+<!--          </el-tooltip>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+
+<!--      <el-table-column label="自动发课" align="center" prop="isAuto">-->
+<!--        <template slot-scope="scope">-->
+<!--          <dict-tag :options="isAutoOptions" :value="scope.row.isAuto"/>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
         <template slot-scope="scope">
           <el-button

+ 6 - 5
src/views/qw/user/myIndex.vue

@@ -88,6 +88,7 @@
       <el-table-column label="企微成员ID" align="center" prop="id" />
       <el-table-column label="企微账号" align="center" prop="qwUserId" />
       <el-table-column label="企微昵称" align="center" prop="qwUserName" />
+      <el-table-column label="所属企微部门" align="center" prop="departmentName" />
       <el-table-column label="员工称呼" align="center" prop="welcomeText" />
       <el-table-column label="员工状态" align="center" prop="isDel">
         <template slot-scope="scope">
@@ -140,11 +141,11 @@
 <!--        </template>-->
 <!--      </el-table-column>-->
 
-      <el-table-column label="自动发课" align="center" prop="isAuto">
-        <template slot-scope="scope">
-          <dict-tag :options="isAutoOptions" :value="scope.row.isAuto"/>
-        </template>
-      </el-table-column>
+<!--      <el-table-column label="自动发课" align="center" prop="isAuto">-->
+<!--        <template slot-scope="scope">-->
+<!--          <dict-tag :options="isAutoOptions" :value="scope.row.isAuto"/>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" fixed="right">
         <template slot-scope="scope">
           <el-button

+ 160 - 9
src/views/qw/user/qwUserList.vue

@@ -20,7 +20,28 @@
         />
       </el-form-item>
 
+      <el-form-item label="企微员工昵称" prop="qwUserName">
+        <el-input
+          v-model="queryParams.qwUserName"
+          placeholder="请输入企微员工昵称"
+          clearable
+          size="small"
+          @keydown.enter.native="handleQueryEnter"
+        />
+      </el-form-item>
+
+      <el-form-item label="企微员工部门" prop="deptName">
+        <el-input
+          v-model="queryParams.deptName"
+          placeholder="请输入企微员工部门"
+          clearable
+          size="small"
+          @keydown.enter.native="handleQueryEnter"
+        />
+      </el-form-item>
+
       <el-form-item>
+        <el-button type="danger" icon="el-icon-circle-check" size="mini" @click="handleAddAllQwDept">快捷添加企微部门员工</el-button>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">刷新/重置</el-button>
       </el-form-item>
@@ -39,18 +60,64 @@
       <el-button type="warning" icon="el-icon-search" @click="confirmSelect">确定选择</el-button>
     </div>
 
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="handlePaginationChange"
-    />
+    <el-dialog title="快捷部门选择" :visible.sync="handleAddAllQwDeptOpen" width="700px"  append-to-body >
+
+      <el-form :model="queryParamsDept" ref="queryFormDept" :inline="true" v-show="showSearch" label-width="100px" @submit.prevent="handleQueryDept">
+
+        <el-form-item label="部门昵称" prop="deptName">
+          <el-input
+            v-model="queryParamsDept.deptName"
+            placeholder="请输入部门昵称"
+            clearable
+            size="small"
+          />
+        </el-form-item>
+
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryDept">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetQueryDept">刷新/重置</el-button>
+        </el-form-item>
+      </el-form>
+
+      <el-table border v-loading="loading" :data="deptList" @selection-change="handleSelectionChangeDept">
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column label="部门id" align="center" prop="id" width="160"/>
+        <el-table-column label="部门编号" align="center" prop="deptId" width="160"/>
+        <el-table-column label="部门名称" align="center" prop="deptName" width="150"/>
+        <el-table-column label="操作" align="center"  width="100px" fixed="right">
+          <template slot-scope="scope">
+            <el-button
+              size="mini"
+              type="text"
+              style="color: blue;"
+              @click="handleChangeDept(scope.row)"
+              v-hasPermi="['qw:sop:remove']"
+            >选择此部门
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <div style="margin-top: 30px;display: flex;justify-content: center">
+        <el-button type="warning" icon="el-icon-search" @click="confirmSelectDept">确定选择</el-button>
+      </div>
+
+      <pagination
+        v-show="totalDept>0"
+        :total="totalDept"
+        :page.sync="queryParamsDept.pageNum"
+        :limit.sync="queryParamsDept.pageSize"
+        @pagination="getDeptList"
+      />
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
 import { listUser, getUser, delUser, addUser, updateUser, exportUser } from "@/api/qw/user";
+import {listQwDept} from "../../../api/qw/qwDept";
+import {getQwUserByDept} from "../../../api/qw/user";
 
 
 export default {
@@ -65,6 +132,7 @@ export default {
       exportLoading: false,
       // 选中数组
       selectUsers: [],
+      selectDeptList: [],
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -73,6 +141,7 @@ export default {
       showSearch: true,
       // 总条数
       total: 0,
+      totalDept: 0,
       // 企微用户表格数据
       userList: [],
       // 弹出层标题
@@ -87,8 +156,18 @@ export default {
         companyId: null,
         companyUserId: null,
         corpId: null,
-        nickName: null
+        nickName: null,
+        deptName: null,
+        qwUserName: null
       },
+      queryParamsDept:{
+        pageNum: 1,
+        pageSize: 10,
+        corpId:null,
+        deptName:null,
+      },
+      handleAddAllQwDeptOpen:false,
+      deptList:null,
       // 表单参数
       form: {},
 
@@ -151,6 +230,23 @@ export default {
       this.$emit("selectUserList",this.selectUsers);
       this.resetSelect();
     },
+
+    confirmSelectDept(){
+
+        getQwUserByDept({ deptIds: this.selectDeptList,corpId:row.corpId}).then(response => {
+        // 合并responseIds到selectUsers并去重
+        this.selectUsers=response.data
+
+        setTimeout(() => {
+          this.handleAddAllQwDeptOpen=false;
+          this.$emit("selectUserList",this.selectUsers);
+          this.resetSelect();
+        }, 200);
+
+      });
+
+    },
+
     //重置选择
     resetSelect(){
       this.$refs.userList.clearSelection();
@@ -164,7 +260,9 @@ export default {
         companyId: null,
         companyUserId: null,
         corpId: null,
-        nickName: null
+        nickName: null,
+        deptName: null,
+        qwUserName:null
       },
         this.getList();
     },
@@ -173,6 +271,27 @@ export default {
       this.queryParams.pageNum = 1;
       this.getList();
     },
+    handleQueryDept() {
+      this.queryParamsDept.pageNum = 1;
+      this.getDeptList();
+    },
+
+
+
+    handleAddAllQwDept(){
+
+      this.getDeptList()
+      this.handleAddAllQwDeptOpen = true;
+    },
+
+    getDeptList(){
+      this.queryParamsDept.corpId=this.queryParams.corpId;
+      listQwDept(this.queryParamsDept).then(res=>{
+        this.deptList=res.rows;
+        this.totalDept = res.total;
+      })
+    },
+
     handleQueryEnter(event){
       // 确保事件对象存在
       if (event && event.preventDefault) {
@@ -185,6 +304,38 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
+    /** 重置按钮操作 */
+    resetQueryDept() {
+      this.resetForm("queryFormDept");
+      this.handleQueryDept();
+    },
+
+    handleChangeDept(row){
+
+      getQwUserByDept({ deptIds: [row.deptId],corpId:row.corpId}).then(response => {
+
+        // 合并responseIds到selectUsers并去重
+        this.selectUsers=response.data
+
+        setTimeout(() => {
+          this.handleAddAllQwDeptOpen=false;
+          this.$emit("selectUserList",this.selectUsers);
+          this.resetSelect();
+        }, 200);
+
+      });
+    },
+
+    handleSelectionChangeDept(selection){
+
+      // 合并选中项
+      this.selectDeptList =selection.map(item => item.deptId)
+
+      // 更新 single 和 multiple
+      this.single = this.selectDeptList.length !== 1;
+      this.multiple = !this.selectDeptList.length;
+
+    },
 
     // 多选框选中数据
     handleSelectionChange(selection) {