瀏覽代碼

支部党课学习 - 关联用户

Wang Zi Wen 2 年之前
父節點
當前提交
e0112f7690
共有 1 個文件被更改,包括 144 次插入77 次删除
  1. 144 77
      ruoyi-ui/src/views/branch/study/index.vue

+ 144 - 77
ruoyi-ui/src/views/branch/study/index.vue

@@ -1,70 +1,7 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="时间" prop="studyTime">
-        <el-date-picker clearable style="width: 200px"
-          v-model="queryParams.studyTime"
-          type="date"
-          value-format="yyyy-MM-dd"
-          placeholder="选择时间">
-        </el-date-picker>
-      </el-form-item>
-      <el-form-item label="地点" prop="studyVenue">
-        <el-input
-          v-model="queryParams.studyVenue"
-          placeholder="请输入地点"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="授课人" prop="lecturer">
-        <el-input
-          v-model="queryParams.lecturer"
-          placeholder="请输入授课人"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="记录人" prop="recorder">
-        <el-input
-          v-model="queryParams.recorder"
-          placeholder="请输入记录人"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="参加人员" prop="participants">
-        <el-input
-          v-model="queryParams.participants"
-          placeholder="请输入参加人员"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="缺席人员" prop="absentees">
-        <el-input
-          v-model="queryParams.absentees"
-          placeholder="请输入缺席人员"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="内容" prop="contents">
-        <el-input
-          v-model="queryParams.contents"
-          placeholder="请输入内容"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="备注" prop="remarks">
-        <el-input
-          v-model="queryParams.remarks"
-          placeholder="请输入备注"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </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>
@@ -135,10 +72,10 @@
         </template>
       </el-table-column>
       <el-table-column label="地点" align="center" prop="studyVenue" />
-      <el-table-column label="授课人" align="center" prop="lecturer" />
-      <el-table-column label="记录人" align="center" prop="recorder" />
-      <el-table-column label="参加人员" align="center" prop="participants" width="120" />
-      <el-table-column label="缺席人员" align="center" prop="absentees" />
+      <el-table-column label="授课人" align="center" prop="lecturerString" width="120" />
+      <el-table-column label="记录人" align="center" prop="recorderString" width="120" />
+      <el-table-column label="参加人员" align="center" prop="participantsString" width="120" />
+      <el-table-column label="缺席人员" align="center" prop="absenteesString" width="120" />
       <el-table-column label="内容" align="center" prop="contents" width="350" />
       <el-table-column label="备注" align="center" prop="remarks"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
@@ -184,16 +121,44 @@
           <el-input v-model="form.studyVenue" placeholder="请输入地点" />
         </el-form-item>
         <el-form-item label="授课人" prop="lecturer">
-          <el-input v-model="form.lecturer" placeholder="请输入授课人" />
+          <el-select v-model="form.lecturer" multiple placeholder="请选择授课人">
+            <el-option
+              v-for="dict in userList"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            ></el-option>
+          </el-select>
         </el-form-item>
         <el-form-item label="记录人" prop="recorder">
-          <el-input v-model="form.recorder" placeholder="请输入记录人" />
+          <el-select v-model="form.recorder" multiple placeholder="请选择记录人">
+            <el-option
+              v-for="dict in userList"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            ></el-option>
+          </el-select>
         </el-form-item>
         <el-form-item label="参加人员" prop="participants">
-          <el-input v-model="form.participants" placeholder="请输入参加人员" />
+          <el-select v-model="form.participants" multiple placeholder="请选择参加人员">
+            <el-option
+              v-for="dict in userList"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            ></el-option>
+          </el-select>
         </el-form-item>
         <el-form-item label="缺席人员" prop="absentees">
-          <el-input v-model="form.absentees" placeholder="请输入缺席人员" />
+          <el-select v-model="form.absentees" multiple placeholder="请选择缺席人员">
+            <el-option
+              v-for="dict in userList"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            ></el-option>
+          </el-select>
         </el-form-item>
         <el-form-item label="内容" prop="contents">
           <el-input v-model="form.contents" placeholder="请输入内容" type="textarea" rows="4" />
@@ -249,6 +214,7 @@ import { treeselect } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { listUser} from "@/api/system/user";
 
 export default {
   name: "Study",
@@ -312,7 +278,9 @@ export default {
         // studyId: [
         //   { required: true, message: "主键id不能为空", trigger: "blur" }
         // ],
-      }
+      },
+      // 用户列表
+      userList: [],
     };
   },
   watch: {
@@ -330,13 +298,88 @@ export default {
     this.getTreeselect();
   },
   methods: {
+    /** 查询用户列表 */
+    getUserList() {
+      listUser().then(response => {
+        let rows = response.rows;
+        let userList = [];
+        for(let i = 0; i < rows.length; i++) {
+          if (rows[i].userName != "admin") {
+            let user = { "dictValue" : rows[i].userId, "dictLabel" : rows[i].nickName};
+            userList.push(user);
+          }
+        }
+        this.userList = userList;
+      });
+    },
     /** 查询支部党课学习列表 */
     getList() {
       this.loading = true;
-      listStudy(this.queryParams).then(response => {
-        this.studyList = response.rows;
-        this.total = response.total;
-        this.loading = false;
+      listUser().then(response => {
+        let rows = response.rows;
+        let userList = [];
+        for (let i = 0; i < rows.length; i++) {
+          if (rows[i].userName != "admin") {
+            let user = {"dictValue": rows[i].userId, "dictLabel": rows[i].nickName};
+            userList.push(user);
+          }
+        }
+        this.userList = userList;
+        listStudy(this.queryParams).then(response => {
+          this.studyList = response.rows;
+          for (let i = 0; i < this.studyList.length; i++) {
+            if (this.studyList[i].lecturer != null) {
+              let lecturer = this.studyList[i].lecturer.split(",");
+              let lecturerString = "";
+              for (let j = 0; j < lecturer.length; j++) {
+                if (j > 0) {
+                  lecturerString += "、" + this.selectDictLabel(this.userList, lecturer[j]);
+                } else {
+                  lecturerString += this.selectDictLabel(this.userList, lecturer[j]);
+                }
+              }
+              this.studyList[i].lecturerString = lecturerString;
+            }
+            if (this.studyList[i].recorder != null) {
+              let recorder = this.studyList[i].recorder.split(",");
+              let recorderString = "";
+              for (let j = 0; j < recorder.length; j++) {
+                if (j > 0) {
+                  recorderString += "、" + this.selectDictLabel(this.userList, recorder[j]);
+                } else {
+                  recorderString += this.selectDictLabel(this.userList, recorder[i]);
+                }
+              }
+              this.studyList[i].recorderString = recorderString;
+            }
+            if (this.studyList[i].participants != null) {
+              let participants = this.studyList[i].participants.split(",");
+              let participantsString = "";
+              for (let j = 0; j < participants.length; j++) {
+                if (j > 0) {
+                  participantsString += "、" + this.selectDictLabel(this.userList, participants[j]);
+                } else {
+                  participantsString += this.selectDictLabel(this.userList, participants[j]);
+                }
+              }
+              this.studyList[i].participantsString = participantsString;
+            }
+            if (this.studyList[i].absentees != null) {
+              let absentees = this.studyList[i].absentees.split(",");
+              let absenteesString = "";
+              for (let j = 0; j < absentees.length; j++) {
+                if (j > 0) {
+                  absenteesString += "、" + this.selectDictLabel(this.userList, absentees[j]);
+                } else {
+                  absenteesString += this.selectDictLabel(this.userList, absentees[j]);
+                }
+              }
+              this.studyList[i].absenteesString = absenteesString;
+            }
+          }
+          this.total = response.total;
+          this.loading = false;
+        });
       });
     },
     /** 查询部门下拉树结构 */
@@ -398,12 +441,36 @@ export default {
       const studyId = row.studyId || this.ids
       getStudy(studyId).then(response => {
         this.form = response.data;
+        if (this.form.lecturer != null) {
+          this.form.lecturer = this.form.lecturer.split(",").map(Number);
+        }
+        if (this.form.recorder != null) {
+          this.form.recorder = this.form.recorder.split(",").map(Number);
+        }
+        if (this.form.participants != null) {
+          this.form.participants = this.form.participants.split(",").map(Number);
+        }
+        if (this.form.absentees != null) {
+          this.form.absentees = this.form.absentees.split(",").map(Number);
+        }
         this.open = true;
         this.title = "修改支部党课学习";
       });
     },
     /** 提交按钮 */
     submitForm() {
+      if (this.form.lecturer != null) {
+        this.form.lecturer = this.form.lecturer.join();
+      }
+      if (this.form.recorder != null) {
+        this.form.recorder = this.form.recorder.join();
+      }
+      if (this.form.participants != null) {
+        this.form.participants = this.form.participants.join();
+      }
+      if (this.form.absentees != null) {
+        this.form.absentees = this.form.absentees.join();
+      }
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.studyId != null) {