Bläddra i källkod

指定审核人需求新增

zhangjie 3 år sedan
förälder
incheckning
340fec2302

+ 2 - 0
src/assets/styles/element-ui-costom.scss

@@ -332,6 +332,8 @@
     .el-button--text {
       padding: 0;
       margin: 0 5px;
+      border: none !important;
+      outline: none !important;
       &:hover {
         transform: scale(1.1);
       }

+ 2 - 2
src/modules/base/components/ResetPwd.vue

@@ -224,7 +224,8 @@ export default {
       if (this.isSubmit) return;
       this.isSubmit = true;
       let datas = {
-        id: this.modalForm.id
+        id: this.modalForm.id,
+        oldPassword: Base64(this.modalForm.oldPassword)
       };
       if (this.needBindMobile) {
         datas = {
@@ -236,7 +237,6 @@ export default {
       if (this.needResetPwd) {
         datas = {
           ...datas,
-          oldPassword: Base64(this.modalForm.oldPassword),
           password: Base64(this.modalForm.password)
         };
       }

+ 1 - 1
src/modules/base/views/CampusManage.vue

@@ -28,7 +28,7 @@
             scope.row.createTime | timestampFilter
           }}</span>
         </el-table-column>
-        <el-table-column label="操作" width="120px">
+        <el-table-column class-name="action-column" label="操作" width="120px">
           <template slot-scope="scope">
             <el-button
               v-if="checkPrivilege('link', 'edit')"

+ 1 - 1
src/modules/base/views/ClazzManage.vue

@@ -63,7 +63,7 @@
             scope.row.createTime | timestampFilter
           }}</span>
         </el-table-column>
-        <el-table-column label="操作" width="120px">
+        <el-table-column class-name="action-column" label="操作" width="120px">
           <template slot-scope="scope">
             <el-button
               v-if="checkPrivilege('link', 'edit')"

+ 1 - 1
src/modules/base/views/CourseManage.vue

@@ -106,7 +106,7 @@
             {{ scope.row.enable | enableFilter }}
           </template>
         </el-table-column>
-        <el-table-column label="操作" width="120px">
+        <el-table-column class-name="action-column" label="操作" width="120px">
           <template slot-scope="scope">
             <el-button
               v-if="checkPrivilege('link', 'edit')"

+ 1 - 1
src/modules/base/views/StudentManage.vue

@@ -84,7 +84,7 @@
             scope.row.createTime | timestampFilter
           }}</span>
         </el-table-column>
-        <el-table-column label="操作" width="120px">
+        <el-table-column class-name="action-column" label="操作" width="120px">
           <template slot-scope="scope">
             <el-button
               v-if="checkPrivilege('link', 'edit')"

+ 7 - 1
src/modules/exam/api.js

@@ -113,6 +113,12 @@ export const taskAllApproverExchangePeople = ({ taskId, realName }) => {
     realName
   });
 };
+export const taskApproverNextPeople = ({ taskId, courseCode }) => {
+  return $postParam("/api/admin/flow/task/approver/next/people", {
+    taskId,
+    courseCode
+  });
+};
 // 命题老师创建命题任务
 export const teacherCreateTaskApply = datas => {
   return $post("/api/admin/exam/task/save_task_apply", datas);
@@ -136,7 +142,7 @@ export const taskReviewAuditedListPage = datas => {
 };
 export const updateTaskReview = datas => {
   // return $post("/api/admin/exam/task/review_save", datas);
-  return $postParam("/api/admin/flow/task/approve", datas);
+  return $post("/api/admin/flow/task/approve", datas);
 };
 export const batchUpdateTaskReview = datas => {
   return $post("/api/admin/exam/task/review_save_batch", datas);

+ 109 - 13
src/modules/exam/components/ApplyContent.vue

@@ -177,6 +177,30 @@
         <p v-else>暂无</p>
       </div>
 
+      <!--  -->
+      <div v-if="IS_APPLY && needSetApproveUser" class="task-audit">
+        <el-form>
+          <el-form-item label="指定审批人:">
+            <el-select
+              v-model="approveUserIds"
+              placeholder="请选择"
+              multiple
+              filterable
+              clearable
+              style="width: 800px"
+            >
+              <el-option
+                v-for="user in approveUserList"
+                :key="user.id"
+                :value="user.id"
+                :label="`${user.realName}(${user.orgName})`"
+              >
+                {{ user.realName }}({{ user.orgName }})
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
+      </div>
       <!-- audit -->
       <div v-if="IS_AUDIT" class="task-audit">
         <el-form
@@ -250,6 +274,28 @@
               ></el-option>
             </el-select>
           </el-form-item>
+          <el-form-item
+            v-if="needSetApproveUser && auditModal.approvePass === 'PASS'"
+            label="指定审批人:"
+          >
+            <el-select
+              v-model="approveUserIds"
+              placeholder="请选择"
+              multiple
+              filterable
+              clearable
+              style="width: 800px"
+            >
+              <el-option
+                v-for="user in approveUserList"
+                :key="user.id"
+                :value="user.id"
+                :label="`${user.realName}(${user.orgName})`"
+              >
+                {{ user.realName }}({{ user.orgName }})
+              </el-option>
+            </el-select>
+          </el-form-item>
         </el-form>
       </div>
     </div>
@@ -314,7 +360,8 @@ import {
   taskAllFlowSetups,
   taskAllApproverPeople,
   taskAllApproverExchangePeople,
-  taskApproverExchange
+  taskApproverExchange,
+  taskApproverNextPeople
 } from "../api";
 import { attachmentPreview } from "../../login/api";
 import SimpleImagePreview from "@/components/SimpleImagePreview";
@@ -424,6 +471,9 @@ export default {
         ]
       },
       approveExchangePeople: [],
+      needSetApproveUser: false,
+      approveUserIds: [],
+      approveUserList: [], //审批人
       // image-preview
       curImage: {},
       curImageIndex: 0
@@ -553,19 +603,47 @@ export default {
         return item;
       });
 
-      if (this.flows.length) {
-        const curFlow = this.flows.find(item => item.isCurrent);
-        if (curFlow)
-          this.setups = this.flows
-            .filter(item => item.setup < curFlow.setup)
-            .map(item => {
-              return {
-                taskKey: item.taskKey,
-                setup: item.setup,
-                taskName: item.taskName
-              };
-            });
+      if (!this.flows.length) {
+        this.$emit("step-change", this.flows);
+        return;
+      }
+
+      const curFlow = this.flows.find(item => item.isCurrent);
+      if (curFlow) {
+        this.setups = this.flows
+          .filter(item => item.setup < curFlow.setup)
+          .map(item => {
+            return {
+              taskKey: item.taskKey,
+              setup: item.setup,
+              taskName: item.taskName
+            };
+          });
+      }
+
+      // 下一节点审批人
+      const nextFlow = this.flows.find(
+        item => item.setup > this.curTaskApply.setup
+      );
+      if (
+        (this.IS_APPLY || this.IS_AUDIT) &&
+        nextFlow &&
+        !nextFlow.approveUser.length
+      ) {
+        // 获取审批人
+        this.needSetApproveUser = true;
+        let datas = {};
+        if (this.IS_APPLY) {
+          datas.courseCode = this.curTaskApply.courseCode;
+        }
+        if (this.IS_AUDIT) {
+          datas.taskId = this.curTaskApply.flowId;
+        }
+        const data = await taskApproverNextPeople(datas);
+        this.approveUserList =
+          data && data.approveUserList && data.approveUserList[0].approveUser;
       }
+
       this.$emit("step-change", this.flows);
     },
     async getExchangeApproverPeople() {
@@ -746,6 +824,7 @@ export default {
       data.paperConfirmAttachmentIds = JSON.stringify(
         this.paperConfirmAttachments
       );
+      if (this.needSetApproveUser) data.approveUserIds = this.approveUserIds;
       return data;
     },
     checkDataValid() {
@@ -774,6 +853,12 @@ export default {
         this.$message.error("请先提交题卡!");
         return;
       }
+
+      if (this.needSetApproveUser && !this.approveUserIds.length) {
+        this.$message.error("请指定审批人!");
+        return;
+      }
+
       return true;
     },
     async toSave() {
@@ -815,6 +900,15 @@ export default {
       const valid = await this.$refs.auditModalComp.validate().catch(() => {});
       if (!valid) return;
 
+      if (
+        this.auditModal.approvePass === "PASS" &&
+        this.needSetApproveUser &&
+        !this.approveUserIds.length
+      ) {
+        this.$message.error("请指定审批人!");
+        return;
+      }
+
       const actionName = this.TASK_AUDIT_RESULT[this.auditModal.approvePass];
       const result = await this.$confirm(
         `确定${actionName}该申请吗?`,
@@ -835,6 +929,8 @@ export default {
       } else {
         let datas = { ...this.auditModal };
         datas.taskId = this.curTaskApply.flowTaskId;
+        if (this.auditModal.approvePass === "PASS")
+          datas.approveUserIds = this.approveUserIds;
         const data = await updateTaskReview(datas).catch(() => {});
         if (!data) return;
       }

+ 62 - 3
src/modules/exam/components/CreateTaskApply.vue

@@ -246,6 +246,31 @@
           show-word-limit
           placeholder="建议不超过100个字"
         ></el-input>
+
+        <!--  -->
+        <div v-if="needSetApproveUser" class="task-audit">
+          <el-form>
+            <el-form-item label="指定审批人:">
+              <el-select
+                v-model="approveUserIds"
+                placeholder="请选择"
+                multiple
+                filterable
+                clearable
+                style="width: 800px"
+              >
+                <el-option
+                  v-for="user in approveUserList"
+                  :key="user.id"
+                  :value="user.id"
+                  :label="`${user.realName}(${user.orgName})`"
+                >
+                  {{ user.realName }}({{ user.orgName }})
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-form>
+        </div>
       </div>
       <div class="task-action">
         <el-button type="primary" :disabled="isSubmit" @click="submit"
@@ -289,7 +314,8 @@ import {
   teacherCreateTaskApply,
   teacherCancelTaskApply,
   switchCardCreateMethod,
-  taskAllApproverPeople
+  taskAllApproverPeople,
+  taskApproverNextPeople
 } from "../api";
 import UploadPaperDialog from "./UploadPaperDialog";
 import CardOptionDialog from "./CardOptionDialog";
@@ -393,6 +419,10 @@ export default {
       curUploadType: "paper",
       attachmentLimitCount: 26,
       abc: "abcdefghijklmnopqrstuvwxyz".toUpperCase(),
+      // 指定审核人,当查询到下一级没有审批人时需要手动指定
+      needSetApproveUser: false,
+      approveUserIds: [],
+      approveUserList: [],
       // image-preview
       curImage: {},
       curImageIndex: 0
@@ -439,6 +469,9 @@ export default {
       this.examTaskDetail.review = this.examRule.review;
       this.examTaskDetail.customCard = this.examRule.customCard;
       this.paperAttachments = [];
+      this.needSetApproveUser = false;
+      this.approveUserIds = [];
+      this.approveUserList = [];
     },
     visibleChange() {
       this.initData();
@@ -614,6 +647,10 @@ export default {
         return;
       }
       this.examTask.courseName = val.name;
+
+      this.needSetApproveUser = false;
+      this.approveUserList = [];
+      this.approveUserIds = [];
       this.clearCard();
       this.updateApproverPeople();
     },
@@ -639,6 +676,17 @@ export default {
           ...approvePeople[flow.setup]
         };
       });
+
+      // 下一节点审批人
+      const nextFlow = this.flows[1];
+      if (nextFlow && !nextFlow.approveUser.length) {
+        this.needSetApproveUser = true;
+        const data = await taskApproverNextPeople({
+          courseCode: this.examTask.courseCode
+        });
+        this.approveUserList =
+          data && data.approveUserList && data.approveUserList[0].approveUser;
+      }
     },
     getTaskDetailData() {
       let data = { ...this.examTaskDetail };
@@ -677,6 +725,12 @@ export default {
         this.$message.error("请先提交题卡!");
         return;
       }
+
+      if (this.needSetApproveUser && !this.approveUserIds.length) {
+        this.$message.error("请指定审批人!");
+        return;
+      }
+
       return true;
     },
     async toSave(silent) {
@@ -686,10 +740,12 @@ export default {
       if (this.isSubmit) return;
       this.isSubmit = true;
       this.getTaskDetailData();
-      const datas = {
+      let datas = {
         examTaskDetail: this.examTaskDetail,
         examTask: this.examTask
       };
+      if (this.needSetApproveUser) datas.approveUserIds = this.approveUserIds;
+
       const data = await teacherCreateTaskApply(datas).catch(() => {});
       this.isSubmit = false;
       if (!data) return;
@@ -715,10 +771,13 @@ export default {
         .then(async () => {
           this.getTaskDetailData();
           this.examTaskDetail.operateType = "SUBMIT";
-          const datas = {
+          let datas = {
             examTaskDetail: this.examTaskDetail,
             examTask: this.examTask
           };
+          if (this.needSetApproveUser)
+            datas.approveUserIds = this.approveUserIds;
+
           const data = await teacherCreateTaskApply(datas).catch(() => {});
 
           if (!data) return;

+ 12 - 4
src/modules/exam/components/createExamAndPrintTask/CreateExamAndPrintTask.vue

@@ -165,6 +165,7 @@ export default {
       examRule: {},
       infos: {},
       templateSources: {},
+      approveUserIds: [],
       // step
       steps: STEPS_LIST,
       current: 0,
@@ -227,6 +228,7 @@ export default {
         printPlan,
         printTask: { ...initPrintTask }
       };
+      this.approveUserIds = [];
 
       this.dataReady = true;
     },
@@ -253,7 +255,10 @@ export default {
       }
     },
     dataChange(data) {
-      console.log(data);
+      if (data["approveUserIds"]) {
+        this.approveUserIds = data.approveUserIds;
+        delete data.approveUserIds;
+      }
       Object.entries(data).forEach(([key, val]) => {
         this.infos[key] = Object.assign(this.infos[key], val);
       });
@@ -301,10 +306,13 @@ export default {
         examPrintPlan,
         examDetail: this.infos.printTask
       };
-
-      const data = await teacherSubmitTaskApply({
+      let datas = {
         examTaskContent: JSON.stringify(examTaskContent)
-      }).catch(() => {});
+      };
+      if (this.approveUserIds.length)
+        datas.approveUserIds = this.approveUserIds;
+
+      const data = await teacherSubmitTaskApply(datas).catch(() => {});
       this.loading = false;
       if (!data) return;
       this.$message.success("提交成功!");

+ 63 - 2
src/modules/exam/components/createExamAndPrintTask/InfoExamTask.vue

@@ -206,6 +206,31 @@
           show-word-limit
           placeholder="建议不超过100个字"
         ></el-input>
+
+        <!--  -->
+        <div v-if="approveUserList.length" class="task-audit">
+          <el-form>
+            <el-form-item label="指定审批人:">
+              <el-select
+                v-model="approveUserIds"
+                placeholder="请选择"
+                multiple
+                filterable
+                clearable
+                style="width: 800px"
+              >
+                <el-option
+                  v-for="user in approveUserList"
+                  :key="user.id"
+                  :value="user.id"
+                  :label="`${user.realName}(${user.orgName})`"
+                >
+                  {{ user.realName }}({{ user.orgName }})
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-form>
+        </div>
       </div>
     </div>
 
@@ -230,7 +255,11 @@
 import UploadPaperDialog from "../UploadPaperDialog";
 import SimpleImagePreview from "@/components/SimpleImagePreview";
 import { CARD_SOURCE_TYPE } from "@/constants/enumerate";
-import { cardForSelectList } from "../../api";
+import {
+  cardForSelectList,
+  taskAllApproverPeople,
+  taskApproverNextPeople
+} from "../../api";
 import { courseQuery } from "../../../base/api";
 
 export default {
@@ -290,6 +319,10 @@ export default {
       curUploadType: "paper",
       attachmentLimitCount: 26,
       abc: "abcdefghijklmnopqrstuvwxyz".toUpperCase(),
+      // 指定审核人,当查询到下一级没有审批人时需要手动指定
+      needSetApproveUser: false,
+      approveUserIds: [],
+      approveUserList: [],
       // image-preview
       curImage: {},
       curImageIndex: 0
@@ -381,14 +414,22 @@ export default {
         return;
       }
 
+      if (this.needSetApproveUser && !this.approveUserIds.length) {
+        this.$message.error("请指定审批人!");
+        this.$emit("on-ready");
+        return;
+      }
+
       this.updateData();
       this.$emit("next-step");
     },
     getData() {
-      return {
+      let data = {
         examTask: this.examTask,
         examTaskDetail: this.getTaskDetailData()
       };
+      if (this.needSetApproveUser) data.approveUserIds = this.approveUserIds;
+      return data;
     },
     updateData() {
       this.$emit("data-change", this.getData());
@@ -481,7 +522,27 @@ export default {
 
       this.examTaskDetail.cardId = "";
       this.cards = [];
+      this.needSetApproveUser = false;
+      this.approveUserList = [];
+      this.approveUserIds = [];
       this.getCardList();
+      this.updateApproverPeople();
+    },
+    async updateApproverPeople() {
+      const data = await taskAllApproverPeople({
+        courseCode: this.examTask.courseCode
+      });
+
+      // 下一节点审批人
+      const nextFlow = data.approveUserList[1];
+      if (nextFlow && !nextFlow.approveUser.length) {
+        this.needSetApproveUser = true;
+        const data = await taskApproverNextPeople({
+          courseCode: this.examTask.courseCode
+        });
+        this.approveUserList =
+          data && data.approveUserList && data.approveUserList[0].approveUser;
+      }
     },
     getTaskDetailData() {
       let data = { ...this.examTaskDetail };

+ 7 - 66
src/modules/login/views/Login.vue

@@ -78,31 +78,15 @@ import { login, getSmsCode, getSchoolInfo, getSysConfig } from "../api";
 import { Base64 } from "@/plugins/crypto";
 import ResetPwd from "@/modules/base/components/ResetPwd";
 import { ORG_CODE } from "@/constants/app";
-
-const wstorage = {
-  set(key, value, expire = null) {
-    window.localStorage.setItem(key, JSON.stringify({ value, expire }));
-  },
-  get(key, defaultVal = null) {
-    const lsvalue = JSON.parse(window.localStorage.getItem(key));
-    return lsvalue && (!lsvalue.expire || lsvalue.expire > new Date().getTime())
-      ? lsvalue.value
-      : defaultVal;
-  },
-  remove(key) {
-    window.localStorage.removeItem(key);
-  }
-};
-
-const codeWaitingTime = 60;
-const nameWaitTime = "login";
+import fetchSmsMixins from "../fetchSmsMixins";
 
 export default {
   name: "login",
   components: { ResetPwd },
+  mixins: [fetchSmsMixins],
   data() {
     return {
-      nameWaitTime,
+      nameWaitTime: "login",
       smsCodeRequired: false,
       loginModel: {
         schoolCode: ORG_CODE,
@@ -131,12 +115,7 @@ export default {
       userInfo: {},
       roles: [],
       isSubmit: false,
-      schoolLogo: "",
-      // code
-      isFetchingCode: false,
-      codeContent: "获取验证码",
-      codeWaitingTime,
-      time: codeWaitingTime
+      schoolLogo: ""
     };
   },
   mounted() {
@@ -181,8 +160,9 @@ export default {
 
       // 强制修改密码和绑定手机号
       if (
-        !data.userLoginCheckResult.pwdCount ||
-        !data.userLoginCheckResult.mobileNumber
+        data.userLoginCheckResult &&
+        (!data.userLoginCheckResult.pwdCount ||
+          !data.userLoginCheckResult.mobileNumber)
       ) {
         this.userInfo = {
           ...this.loginModel,
@@ -203,17 +183,6 @@ export default {
       }
     },
     // code valid
-    setWaitingTime() {
-      let codetime = wstorage.get(this.nameWaitTime);
-      if (codetime) {
-        let num = Math.floor((codetime.expire - new Date().getTime()) / 1000);
-        if (num > 0) {
-          this.time = num;
-          this.isFetchingCode = true;
-          this.changeContent();
-        }
-      }
-    },
     checkField(field) {
       return new Promise((resolve, reject) => {
         this.$refs.loginForm.validateField(field, unvalid => {
@@ -267,34 +236,6 @@ export default {
         };
         this.$refs.ResetPwd.open();
       }
-    },
-    changeContent() {
-      if (!this.isFetchingCode) return;
-      this.codeContent = "倒计时" + this.time + "s";
-      const circleTime = time => {
-        let t = setInterval(() => {
-          if (time > 1) {
-            time--;
-            let expire = new Date().getTime() + time * 1000;
-            wstorage.set(
-              this.nameWaitTime,
-              {
-                time,
-                expire
-              },
-              expire
-            );
-            this.codeContent = "倒计时" + time + "s";
-          } else {
-            this.time = this.codeWaitingTime;
-            wstorage.remove(this.nameWaitTime);
-            this.codeContent = "获取验证码";
-            this.isFetchingCode = false;
-            clearInterval(t);
-          }
-        }, 1e3);
-      };
-      circleTime(this.time);
     }
   }
 };