armg hace 1 año
padre
commit
8c1f656aa7

+ 172 - 51
ruoyi-ui/src/components/flow/User/index.vue

@@ -29,7 +29,14 @@
       </el-col>
       <!--用户数据-->
       <el-col :span="18" :xs="24">
-        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+        <el-form
+          :model="queryParams"
+          ref="queryForm"
+          size="small"
+          :inline="true"
+          v-show="showSearch"
+          label-width="68px"
+        >
           <el-form-item label="用户名称" prop="userName">
             <el-input
               v-model="queryParams.userName"
@@ -49,34 +56,129 @@
             />
           </el-form-item>
           <el-form-item>
-            <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-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>
         </el-form>
-        <el-table v-show="checkType === 'multiple'" ref="dataTable" v-loading="loading" :row-key="getRowKey" :data="userList" @selection-change="handleMultipleUserSelect">
-          <el-table-column type="selection" :reserve-selection="true" width="50" align="center" />
-          <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
-          <el-table-column label="登录账号" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="用户姓名" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
+        <el-table
+          v-show="checkType === 'multiple'"
+          ref="dataTable"
+          v-loading="loading"
+          :row-key="getRowKey"
+          :data="userList"
+          @selection-change="handleMultipleUserSelect"
+        >
+          <el-table-column
+            type="selection"
+            :reserve-selection="true"
+            width="50"
+            align="center"
+          />
+          <el-table-column
+            label="用户编号"
+            align="center"
+            key="userId"
+            prop="userId"
+            v-if="columns[0].visible"
+          />
+          <el-table-column
+            label="登录账号"
+            align="center"
+            key="userName"
+            prop="userName"
+            v-if="columns[1].visible"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="用户姓名"
+            align="center"
+            key="nickName"
+            prop="nickName"
+            v-if="columns[2].visible"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="部门"
+            align="center"
+            key="deptName"
+            prop="dept.deptName"
+            v-if="columns[3].visible"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="手机号码"
+            align="center"
+            key="phonenumber"
+            prop="phonenumber"
+            v-if="columns[4].visible"
+            width="120"
+          />
         </el-table>
-        <el-table v-show="checkType === 'single'" v-loading="loading" :data="userList" @current-change="handleSingleUserSelect">
-          <el-table-column  width="55" align="center" >
+        <el-table
+          v-show="checkType === 'single'"
+          v-loading="loading"
+          :data="userList"
+          @current-change="handleSingleUserSelect"
+        >
+          <el-table-column width="55" align="center">
             <template slot-scope="scope">
-              <el-radio v-model="radioSelected" :label="scope.row.userId">{{''}}</el-radio>
+              <el-radio v-model="radioSelected" :label="scope.row.userId">{{
+                ""
+              }}</el-radio>
             </template>
           </el-table-column>
-          <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
-          <el-table-column label="登录账号" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="用户姓名" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
+          <el-table-column
+            label="用户编号"
+            align="center"
+            key="userId"
+            prop="userId"
+            v-if="columns[0].visible"
+          />
+          <el-table-column
+            label="登录账号"
+            align="center"
+            key="userName"
+            prop="userName"
+            v-if="columns[1].visible"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="用户姓名"
+            align="center"
+            key="nickName"
+            prop="nickName"
+            v-if="columns[2].visible"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="部门"
+            align="center"
+            key="deptName"
+            prop="dept.deptName"
+            v-if="columns[3].visible"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="手机号码"
+            align="center"
+            key="phonenumber"
+            prop="phonenumber"
+            v-if="columns[4].visible"
+            width="120"
+          />
         </el-table>
         <pagination
-          v-show="total>0"
+          v-show="total > 0"
           :total="total"
-          :page-sizes="[5,10]"
+          :page-sizes="[5, 10]"
           :page.sync="queryParams.pageNum"
           :limit.sync="queryParams.pageSize"
           @pagination="getList"
@@ -90,11 +192,11 @@
 import { listUser, deptTreeSelect } from "@/api/system/user";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import {StrUtil} from "@/utils/StrUtil";
+import { StrUtil } from "@/utils/StrUtil";
 
 export default {
   name: "FlowUser",
-  dicts: ['sys_normal_disable', 'sys_user_sex'],
+  dicts: ["sys_normal_disable", "sys_user_sex"],
   components: { Treeselect },
   // 接受父组件的值
   props: {
@@ -102,13 +204,13 @@ export default {
     selectValues: {
       type: Number | String | Array,
       default: null,
-      required: false
+      required: false,
     },
     // 表格类型
     checkType: {
       type: String,
-      default: 'multiple',
-      required: true
+      default: "multiple",
+      required: true,
     },
   },
   data() {
@@ -139,7 +241,7 @@ export default {
       form: {},
       defaultProps: {
         children: "children",
-        label: "label"
+        label: "label",
       },
       // 查询参数
       queryParams: {
@@ -148,7 +250,7 @@ export default {
         userName: undefined,
         phonenumber: undefined,
         status: undefined,
-        deptId: undefined
+        deptId: undefined,
       },
       // 列信息
       columns: [
@@ -158,10 +260,10 @@ export default {
         { key: 3, label: `部门`, visible: true },
         { key: 4, label: `手机号码`, visible: true },
         { key: 5, label: `状态`, visible: true },
-        { key: 6, label: `创建时间`, visible: true }
+        { key: 6, label: `创建时间`, visible: true },
       ],
       radioSelected: null, // 单选框传值
-      selectUserList: [] // 回显数据传值
+      selectUserList: [], // 回显数据传值
     };
   },
   watch: {
@@ -173,30 +275,50 @@ export default {
       handler(newVal) {
         if (StrUtil.isNotBlank(newVal)) {
           if (newVal instanceof Number) {
-            this.radioSelected = newVal
+            this.radioSelected = newVal;
           } else {
             this.selectUserList = newVal;
+            if (this.userList.length > 0) {
+              this.$nextTick(() => {
+                this.$refs.dataTable.clearSelection();
+                newVal?.split(",").forEach((key) => {
+                  let item = this.userList.find((item) => key == item.userId);
+                  if (item) {
+                    this.$refs.dataTable.toggleRowSelection(item, true);
+                  }
+                });
+              });
+            }
           }
+        } else {
+          this.$nextTick(() => {
+            this.$refs.dataTable.clearSelection();
+          });
         }
       },
-      immediate: true
+      immediate: true,
     },
     userList: {
       handler(newVal) {
-        if (StrUtil.isNotBlank(newVal)  && this.selectUserList.length > 0) {
+        if (
+          StrUtil.isNotBlank(newVal) &&
+          this.selectUserList.length > 0 &&
+          newVal.length > 0
+        ) {
           this.$nextTick(() => {
             this.$refs.dataTable.clearSelection();
-            this.selectUserList?.split(',').forEach(key => {
-              this.$refs.dataTable.toggleRowSelection(newVal.find(
-                item => key == item.userId
-              ), true)
+            this.selectUserList?.split(",").forEach((key) => {
+              let item = newVal.find((item) => key == item.userId);
+              if (item) {
+                this.$refs.dataTable.toggleRowSelection(item, true);
+              }
             });
           });
         }
       },
       immediate: true, // 立即生效
-      deep: true  //监听对象或数组的时候,要用到深度监听
-    }
+      deep: true, //监听对象或数组的时候,要用到深度监听
+    },
   },
   created() {
     this.getList();
@@ -206,22 +328,21 @@ export default {
     /** 查询用户列表 */
     getList() {
       this.loading = true;
-      listUser(this.queryParams).then(response => {
-          this.userList = response.rows;
-          this.total = response.total;
-          this.loading = false;
-        }
-      );
+      listUser(this.queryParams).then((response) => {
+        this.userList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
     },
     /** 查询部门下拉树结构 */
     getDeptTree() {
-      deptTreeSelect().then(response => {
+      deptTreeSelect().then((response) => {
         this.deptOptions = response.data;
       });
     },
     // 保存选中的数据id,row-key就是要指定一个key标识这一行的数据
-    getRowKey (row) {
-      return row.id
+    getRowKey(row) {
+      return row.id;
     },
     // 筛选节点
     filterNode(value, data) {
@@ -235,12 +356,12 @@ export default {
     },
     // 多选框选中数据
     handleMultipleUserSelect(selection) {
-      this.$emit('handleUserSelect', selection);
+      this.$emit("handleUserSelect", selection);
     },
     // 单选框选中数据
     handleSingleUserSelect(selection) {
-      this.radioSelected = selection.userId;//点击当前行时,radio同样有选中效果
-      this.$emit('handleUserSelect', selection);
+      this.radioSelected = selection.userId; //点击当前行时,radio同样有选中效果
+      this.$emit("handleUserSelect", selection);
     },
     /** 搜索按钮操作 */
     handleQuery() {
@@ -255,7 +376,7 @@ export default {
       this.$refs.tree.setCurrentKey(null);
       this.handleQuery();
     },
-  }
+  },
 };
 </script>
 <style>

+ 11 - 5
ruoyi-ui/src/views/invest/components/meetingList.vue

@@ -390,7 +390,7 @@
         <el-form-item label="会议参与人" prop="participants">
           <div
             class="el-input__inner inputSimulation"
-            @click="userVisible = true"
+            @click="handleSelectPeople()"
           >
             <!-- @click="openSelectDept(2)" -->
             {{ form.participants ? form.participants : "请选择会议参与人" }}
@@ -423,6 +423,7 @@
       :show-close="false"
     >
       <flow-user
+        ref="flowUser"
         :checkType="checkType"
         :selectValues="selectValues"
         @handleUserSelect="handleUserSelect"
@@ -472,6 +473,7 @@ export default {
     },
     open: function (newValue, oldValue) {
       if (newValue === false) {
+        this.selectValues = null;
         this.queryParams.projectPoolId = null;
         this.meetingType = null;
         this.pageType = null;
@@ -480,7 +482,7 @@ export default {
   },
   data() {
     return {
-      showMenu:false,
+      showMenu: false,
       // 人员选择器
       checkType: "multiple",
       // 数据回显
@@ -591,6 +593,9 @@ export default {
     this.getList();
   },
   methods: {
+    handleSelectPeople() {
+      this.userVisible = true;
+    },
     /*用户选中赋值*/
     checkUserComplete() {
       this.userVisible = false;
@@ -599,7 +604,7 @@ export default {
     // 用户选中数据
     handleUserSelect(selection) {
       const that = this;
-      if (selection) {
+      if (selection && selection[0]) {
         if (selection instanceof Array) {
           const userIds = selection.map((item) => item.userId);
           const nickName = selection.map((item) => item.nickName);
@@ -676,8 +681,7 @@ export default {
       if (type == 2) {
         // this.$refs.selecDepts1.show(type);
       } else {
-        this.$refs.selecDepts.show(type);
-        this.$refs.selecDepts.handler(this.form.promoter,this.form.promoterId)
+        this.$refs.selecDepts.show(type, this.form.promoterId);
       }
     },
     getDeptUserInfo(info) {
@@ -784,6 +788,7 @@ export default {
     /** 新增按钮操作 */
     handleAdd(projectId) {
       let that = this;
+      this.selectValues = null;
       this.reset();
       if (projectId && typeof projectId === "string") {
         this.pageType = "1";
@@ -813,6 +818,7 @@ export default {
         this.form.projectGroup = response.data.tProjectPool.projectGroup;
         this.open = true;
         this.title = "修改会议";
+        this.selectValues = response.data.participantsId;
         setTimeout(() => {
           this.$refs.fileItems.getListFileBusinessId(id);
         }, 200);

+ 16 - 19
ruoyi-ui/src/views/invest/components/selecDept.vue

@@ -136,7 +136,6 @@ export default {
   },
   data() {
     return {
-      selectValues: [],
       type: 1,
       // 遮罩层
       visible: false,
@@ -161,12 +160,12 @@ export default {
   },
   methods: {
     // 显示弹框
-    show(type) {
+    show(type, promoterId) {
       this.queryParams.deptId = this.deptId;
       if (type) {
         this.type = type;
       }
-      this.getList();
+      this.getList(promoterId);
       this.visible = true;
     },
     clickRow(row) {
@@ -174,7 +173,6 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      console.log("多选框选中数据",selection)
       if (this.type == 1) {
         if (selection.length > 1) {
           this.$modal.msg("只能选择一个跟进人");
@@ -194,10 +192,23 @@ export default {
       }
     },
     // 查询表数据
-    getList() {
+    getList(promoterId) {
       listUser(this.queryParams).then((res) => {
         this.userList = res.rows;
         this.total = res.total;
+        if (promoterId) {
+          promoterId = parseInt(promoterId);
+          this.$nextTick(() => {
+            this.$refs.table.toggleRowSelection(
+              this.userList.find((item) => {
+                if (promoterId == item.userId) {
+                  return item;
+                }
+              }),
+              true
+            );
+          });
+        }
       });
     },
     /** 搜索按钮操作 */
@@ -222,20 +233,6 @@ export default {
       }
       this.visible = false;
     },
-    handler(promoter, promoterId) {
-      console.log(promoter, promoterId);
-      // this.$nextTick(() => {
-      this.ids = [];
-      // table与table的ref绑定的一样
-      // this.$refs.table.clearSelection();
-      // selectRoleList?.split(",").forEach((key) => {
-      //   this.$refs.table.toggleRowSelection(
-      //     selectRoleList.find((item) => key == item.roleId),
-      //     true
-      //   );
-      // });
-      // });
-    },
   },
 };
 </script>