zhangjie преди 2 години
родител
ревизия
0a52e0e4fe

+ 18 - 8
src/assets/styles/home.scss

@@ -422,8 +422,8 @@
     &-rp {
       display: block;
       position: absolute;
-      width: 6px;
-      height: 6px;
+      width: 10px;
+      height: 10px;
       background: #fe646a;
       border: 2px solid #eff0f5;
       top: -2px;
@@ -497,10 +497,10 @@
     color: #434656;
   }
 
-  .task-item {
+  .tab-task-item {
     display: flex;
     justify-content: space-between;
-    align-items: stretch;
+    align-items:center;
     padding: 10px 0;
     &:not(:last-child) {
       border-bottom: 1px solid #eff0f5;
@@ -512,7 +512,7 @@
       white-space: nowrap;
       text-overflow: ellipsis;
       overflow: hidden;
-      line-height: 22px;
+      line-height: 32px;
     }
     &-type,
     &-action {
@@ -521,13 +521,23 @@
     }
 
     &-type {
-      width: 60px;
-      padding: 5px;
-      line-height: 1;
       font-size: 12px;
       color: #fff;
       border-radius: 6px;
       text-align: center;
+      width: 36px;
+      height: 22px;
+      line-height: 22px;
+    }
+    .type-flow{
+      background: #FFBF00;
+    }
+    .type-stmms{
+      background: #832FF3;
+    }
+    .type-analysis{
+      background: #2A9BF2;
     }
+  
   }
 }

+ 1 - 0
src/assets/styles/pages.scss

@@ -408,6 +408,7 @@
 }
 // privilege-set
 .privilege-set {
+  overflow: auto;
   .cell-check-list {
     text-align: left;
     padding-left: 20px;

+ 6 - 27
src/modules/exam/components/ApplyContent.vue

@@ -453,12 +453,6 @@
       @confirm="uploadConfirm"
       ref="UploadPaperDialog"
     ></upload-paper-dialog>
-    <!-- card-option-dialog -->
-    <card-option-dialog
-      ref="CardOptionDialog"
-      :data="task"
-      @confirm="cardConfirm"
-    ></card-option-dialog>
     <!-- image-preview -->
     <simple-image-preview
       :cur-image="curImage"
@@ -482,7 +476,6 @@
 
 <script>
 import UploadPaperDialog from "./UploadPaperDialog";
-import CardOptionDialog from "./CardOptionDialog";
 import {
   taskApplyDetail,
   updateTaskApply,
@@ -534,7 +527,6 @@ export default {
   name: "apply-content",
   components: {
     UploadPaperDialog,
-    CardOptionDialog,
     SimpleImagePreview,
     SelectUserDialog,
     ModifyCard
@@ -893,12 +885,12 @@ export default {
     toEditCard(attachment) {
       this.curAttachment = { ...attachment };
       this.$ls.set("prepareTcPCard", {
-        cardId: this.task.cardId,
-        examTaskId: this.task.examTaskId,
-        courseCode: this.task.courseCode,
-        courseName: this.task.courseName,
-        makeMethod: this.task.makeMethod,
-        cardRuleId: this.task.cardRuleId,
+        cardId: this.curTaskApply.cardId,
+        examTaskId: this.curTaskApply.examTaskId,
+        courseCode: this.curTaskApply.courseCode,
+        courseName: this.curTaskApply.courseName,
+        makeMethod: this.curTaskApply.makeMethod,
+        cardRuleId: this.curTaskApply.cardRuleId,
         type: "CUSTOM",
         createMethod: "STANDARD"
       });
@@ -951,19 +943,6 @@ export default {
       const data = await attachmentPreview(attachment.attachmentId);
       window.open(data.url);
     },
-    cardConfirm(data) {
-      const { makeMethod } = data;
-
-      if (makeMethod === "CUST") {
-        this.silentSave();
-        this.curTaskApply = this.$objAssign(this.curTaskApply, data);
-      } else if (makeMethod === "SELECT") {
-        this.curTaskApply = this.$objAssign(this.curTaskApply, data);
-      } else {
-        this.$ls.set("prepareTcPCard", data);
-        this.$refs.ModifyCard.open();
-      }
-    },
     toSelectNextFlowUser() {
       if (!this.IS_NEED_SELECT_APPROVE_USER) return;
 

+ 109 - 61
src/modules/exam/components/ModifyTaskPaper.vue

@@ -113,19 +113,53 @@
                 <i>{{ attachment.filename }}</i>
               </el-button>
             </td>
-            <td :rowspan="paperAttachments.length" v-if="index === 0">
-              <el-button
-                v-if="CAN_EDIT_CARD"
-                type="text"
-                class="btn-primary"
-                @click="toCreateOrViewCard"
-                >{{ cardTodoName }}</el-button
-              >
+            <td>
+              <template v-if="CAN_EDIT_CARD">
+                <el-select
+                  class="mr-2"
+                  v-model="attachment.cardId"
+                  placeholder="请选择"
+                  style="width: 200px"
+                  filterable
+                  @change="cardChange(attachment)"
+                >
+                  <el-option
+                    v-for="item in cards"
+                    :key="item.id"
+                    :value="item.id"
+                    :label="item.title"
+                  >
+                  </el-option>
+                </el-select>
+                <el-button
+                  class="btn-primary"
+                  type="text"
+                  :disabled="!attachment.cardId"
+                  @click="toViewCard(attachment)"
+                  >预览</el-button
+                >
+                <el-button
+                  class="btn-primary"
+                  type="text"
+                  :disabled="
+                    !attachment.cardId || attachment.cardType === 'GENERIC'
+                  "
+                  @click="toEditCard(attachment)"
+                  >编辑</el-button
+                >
+                <el-button
+                  class="btn-primary"
+                  type="text"
+                  :disabled="!canCreateCard"
+                  @click="toCreateCard(attachment)"
+                  >新建</el-button
+                >
+              </template>
               <el-button
                 v-else
                 type="text"
                 class="btn-primary"
-                @click="toViewCard"
+                @click="toViewCard(attachment)"
               >
                 查看题卡
               </el-button>
@@ -180,20 +214,13 @@
       @confirm="uploadConfirm"
       ref="UploadPaperDialog"
     ></upload-paper-dialog>
-    <!-- card-option-dialog -->
-    <card-option-dialog
-      ref="CardOptionDialog"
-      :data="curTaskApply"
-      @confirm="cardConfirm"
-    ></card-option-dialog>
     <!-- ModifyCard -->
-    <modify-card ref="ModifyCard"></modify-card>
+    <modify-card ref="ModifyCard" @modified="cardModified"></modify-card>
   </div>
 </template>
 
 <script>
 import UploadPaperDialog from "./UploadPaperDialog";
-import CardOptionDialog from "./CardOptionDialog";
 import ModifyCard from "../../card/components/ModifyCard";
 import { taskApplyDetail, taskPaperApplyEdit } from "../api";
 import { attachmentPreview } from "../../login/api";
@@ -220,7 +247,7 @@ const initTaskApply = {
 
 export default {
   name: "modify-task-paper",
-  components: { UploadPaperDialog, CardOptionDialog, ModifyCard },
+  components: { UploadPaperDialog, ModifyCard },
   props: {
     instance: {
       type: Object,
@@ -251,22 +278,18 @@ export default {
     CAN_EDIT_CARD() {
       return this.editType === "EDIT" && !this.instance.exposedPaperType;
     },
-    cardTodoName() {
-      let name = "查看题卡";
-      if (this.CAN_EDIT_CARD) {
-        if (this.curTaskApply.makeMethod === "SELECT") {
-          name = "选择题卡";
-        } else {
-          name = "编辑题卡";
-        }
-      }
-      return name;
-    },
     maxFetchCount() {
       return this.paperAttachments.length < 1
         ? 1
         : this.paperAttachments.length;
     },
+    canCreateCard() {
+      return (
+        this.curTaskApply.courseCode &&
+        this.curTaskApply.examId &&
+        this.curTaskApply.cardRuleId !== COMMON_CARD_RULE_ID
+      );
+    },
     exposedMode() {
       return !!this.curTaskApply.exposedPaperType;
     }
@@ -291,6 +314,14 @@ export default {
       const examRule = await examRuleDetail();
       this.includePaper = examRule && examRule.includePaper;
     },
+    async getCardList() {
+      if (!this.curTaskApply.courseCode || !this.curTaskApply.examId) return;
+      const data = await cardForSelectList({
+        courseCode: this.curTaskApply.courseCode,
+        examId: this.curTaskApply.examId
+      });
+      this.cards = data || [];
+    },
     async visibleChange() {
       const data = await taskApplyDetail(this.instance.id);
       this.curTaskApply = this.$objAssign(initTaskApply, data || {});
@@ -312,6 +343,12 @@ export default {
           : true;
         paper.isExposed = exposedPaperTypes.includes(paper.name);
       });
+
+      this.$nextTick(() => {
+        if (this.CAN_EDIT_CARD) {
+          this.getCardList();
+        }
+      });
     },
     cancel() {
       this.modalIsShow = false;
@@ -370,18 +407,19 @@ export default {
       const data = await attachmentPreview(attachment.attachmentId);
       window.open(data.url);
     },
-    toViewCard() {
+    toViewCard(attachment) {
       window.open(
         this.getRouterPath({
           name: "CardPreview",
           params: {
-            cardId: this.curTaskApply.cardId,
+            cardId: attachment.cardId,
             viewType: "view"
           }
         })
       );
     },
-    toEditCard() {
+    toEditCard(attachment) {
+      this.curAttachment = { ...attachment };
       this.$ls.set("prepareTcPCard", {
         cardId: this.curTaskApply.cardId,
         examTaskId: this.curTaskApply.examTaskId,
@@ -395,25 +433,44 @@ export default {
       });
       this.$refs.ModifyCard.open();
     },
-    async toCreateOrViewCard() {
-      this.task = this.getTaskData();
-      if (this.CAN_EDIT_CARD) {
-        if (this.curTaskApply.makeMethod === "SELECT") {
-          this.$refs.CardOptionDialog.open();
-        } else {
-          this.toEditCard();
-        }
-      } else {
-        this.toViewCard();
+    async cardModified(cardId) {
+      if (!cardId) return;
+      let card = this.cards.find(item => item.id === cardId);
+      if (!card) {
+        await this.getCardList();
+        card = this.cards.find(item => item.id === cardId);
+      }
+
+      const aind = this.paperAttachments.findIndex(
+        item => item.name === this.curAttachment.name
+      );
+      if (aind !== -1) {
+        this.paperAttachments[aind].cardId = card && card.id;
       }
     },
-    cardConfirm(data) {
-      this.curTaskApply = this.$objAssign(this.curTaskApply, data);
+    toCreateCard(attachment) {
+      if (!this.curTaskApply.cardRuleId) {
+        this.$message.error("题卡规则缺失!");
+        return;
+      }
+      this.curAttachment = { ...attachment };
+      this.$ls.set("prepareTcPCard", {
+        courseCode: this.curTaskApply.courseCode,
+        courseName: this.curTaskApply.courseName,
+        schoolName: this.$ls.get("schoolName"),
+        makeMethod: "SELF",
+        cardRuleId: this.curTaskApply.cardRuleId,
+        type: "CUSTOM",
+        createMethod: "STANDARD"
+      });
+      this.$refs.ModifyCard.open();
     },
-    getTaskData() {
-      let data = { ...this.curTaskApply };
-
-      return data;
+    cardChange(attachment) {
+      const card = this.cards.find(item => item.id === attachment.cardId);
+      if (card) {
+        attachment.cardType = card.type;
+        attachment.cardTitle = card.title;
+      }
     },
     checkDataValid() {
       const attachmentValid = !this.paperAttachments.some(
@@ -425,18 +482,12 @@ export default {
         return;
       }
 
-      if (!this.curTaskApply.cardId) {
-        this.$message.error("请选择题卡创建方式!");
+      const cardValid = !this.paperAttachments.some(item => !item.cardId);
+      if (!cardValid) {
+        this.$message.error("有试卷类型未选择题卡!");
         return;
       }
 
-      if (
-        this.curTaskApply.makeMethod !== "SELECT" &&
-        this.curTaskApply.status !== "SUBMIT"
-      ) {
-        this.$message.error("请先提交题卡!");
-        return;
-      }
       return true;
     },
     async submit() {
@@ -448,11 +499,8 @@ export default {
         .then(async () => {
           const datas = {
             examTaskId: this.curTaskApply.examTaskId,
-            cardId: this.curTaskApply.cardId,
             paperType: this.paperAttachments.map(item => item.name).join(","),
-            paperAttachmentIds: JSON.stringify(this.paperAttachments, (k, v) =>
-              k === "editable" || k === "url" ? undefined : v
-            )
+            paperAttachmentIds: JSON.stringify(this.paperAttachments)
           };
           const data = await taskPaperApplyEdit(datas).catch(() => {});
           if (!data) return;

+ 13 - 1
src/modules/exam/components/WaitTaskAnalysis.vue

@@ -73,11 +73,23 @@ export default {
     };
   },
   mounted() {
-    this.getList();
+    this.initData();
   },
   methods: {
     ...mapMutations("exam", ["updateWaitTask"]),
     ...mapActions("exam", ["updateWaitTaskCount"]),
+    async initData() {
+      await this.getList();
+
+      const presetTaskId = this.$route.query.tid;
+      if (presetTaskId) {
+        this.$nextTick(() => {
+          const curRow = this.dataList.find(item => item.id === presetTaskId);
+          if (!curRow) return;
+          this.toDo(curRow);
+        });
+      }
+    },
     async getList() {
       const datas = {
         pageNumber: this.current,

+ 4 - 22
src/modules/exam/components/WaitTaskFlow.vue

@@ -92,22 +92,16 @@ export default {
     ...mapMutations("exam", ["updateWaitTask"]),
     ...mapActions("exam", ["updateWaitTaskCount"]),
     async initData() {
-      const cachePageInfo = this.$ls.get("cachePageInfo");
-      if (cachePageInfo) {
-        this.current = cachePageInfo.page;
-        await this.getList();
+      await this.getList();
 
+      const presetTaskId = this.$route.query.tid;
+      if (presetTaskId) {
         this.$nextTick(() => {
-          const curRow = this.dataList.find(
-            item => item.id === cachePageInfo.curRowId
-          );
+          const curRow = this.dataList.find(item => item.id === presetTaskId);
           if (!curRow) return;
           this.toDo(curRow);
         });
-      } else {
-        this.toPage(1);
       }
-      this.$ls.remove("cachePageInfo");
     },
     async getList() {
       const datas = {
@@ -131,18 +125,6 @@ export default {
       this.getList();
       this.updateWaitTaskCount();
     }
-  },
-  beforeRouteLeave(to, from, next) {
-    console.log(to);
-    if (to.name === "CardEdit") {
-      this.$ls.set("cachePageInfo", {
-        page: this.current,
-        curRowId: this.curTask.id
-      });
-    } else {
-      this.$ls.remove("cachePageInfo");
-    }
-    next();
   }
 };
 </script>

+ 13 - 1
src/modules/exam/components/WaitTaskStmms.vue

@@ -74,11 +74,23 @@ export default {
     };
   },
   mounted() {
-    this.getList();
+    this.initData();
   },
   methods: {
     ...mapMutations("exam", ["updateWaitTask"]),
     ...mapActions("exam", ["updateWaitTaskCount"]),
+    async initData() {
+      await this.getList();
+
+      const presetTaskId = this.$route.query.tid;
+      if (presetTaskId) {
+        this.$nextTick(() => {
+          const curRow = this.dataList.find(item => item.id === presetTaskId);
+          if (!curRow) return;
+          this.toDo(curRow);
+        });
+      }
+    },
     async getList() {
       const datas = {
         pageNumber: this.current,

+ 5 - 9
src/modules/exam/views/WaitTask.vue

@@ -50,19 +50,15 @@ export default {
       return `wait-task-${this.curTab}`;
     }
   },
+  created() {
+    if (this.$route.query.type) {
+      this.curTab = this.$route.query.type;
+    }
+  },
   methods: {
     selectMenu(tab) {
       this.curTab = tab;
     }
-  },
-  beforeRouteEnter(to, from, next) {
-    if (from.name === "CardEdit") {
-      next(vm => {
-        vm.tab = "flow";
-      });
-    } else {
-      next();
-    }
   }
 };
 </script>

+ 7 - 4
src/modules/print/components/ModifyPlanPaper.vue

@@ -124,8 +124,11 @@
             >{{ attachment.filename }}
           </el-button>
         </td>
-        <td :rowspan="paperAttachments.length" v-if="index === 0">
-          <el-button type="text" class="btn-primary" @click="toViewCard"
+        <td>
+          <el-button
+            type="text"
+            class="btn-primary"
+            @click="toViewCard(attachment)"
             >查看答题卡</el-button
           >
         </td>
@@ -261,12 +264,12 @@ export default {
       const data = await attachmentPreview(attachment.attachmentId);
       window.open(data.url);
     },
-    toViewCard() {
+    toViewCard(attachment) {
       window.open(
         this.getRouterPath({
           name: "CardPreview",
           params: {
-            cardId: this.cardId,
+            cardId: attachment.cardId,
             viewType: "view"
           }
         })

+ 4 - 4
src/views/Home.vue

@@ -308,10 +308,10 @@ export default {
       let privilegeMap = {};
       const pageSetTypes = ["conditions", "buttons", "lists", "links"];
       data.forEach(item => {
-        const isPage = [...pageSetTypes, "urls"].some(
-          type => item[type] && item[type].length
-        );
-        if (!isPage) return;
+        // const isPage = [...pageSetTypes, "urls"].some(
+        //   type => item[type] && item[type].length
+        // );
+        // if (!isPage) return;
         privilegeMap[item.url] = [];
         pageSetTypes.forEach((type, index) => {
           if (item[type] && item[type].length) {

+ 29 - 11
src/views/HomePage.vue

@@ -29,12 +29,18 @@
     </div>
     <div v-if="hasWaitTaskPrivilege" class="tab-box tab-task">
       <h2 class="tab-box-title">代办任务</h2>
-      <div class="tab-box-body task-list">
-        <div v-for="item in waitTaskList" :key="item.id" class="task-item">
-          <div :class="['task-item-type', `type-${item.type}`]"></div>
-          <div class="task-item-cont">{{ item.content }}</div>
-          <div class="task-item-action action-column">
-            <el-button class="btn-primary" type="text" @click="toDo(item)"
+      <div class="tab-box-body tab-task-list">
+        <div v-for="item in waitTaskList" :key="item.id" class="tab-task-item">
+          <div :class="['tab-task-item-type', `type-${item.type}`]">
+            {{ typeNames[item.type] }}
+          </div>
+          <div class="tab-task-item-cont">{{ item.content }}</div>
+          <div class="tab-task-item-action action-column">
+            <el-button
+              class="btn-primary"
+              size="small"
+              type="text"
+              @click="toDo(item)"
               >立即处理</el-button
             >
           </div>
@@ -73,6 +79,11 @@ export default {
       waitTaskFilter: {
         pageNumber: 1,
         pageSize: 2
+      },
+      typeNames: {
+        flow: "流程",
+        stmms: "阅卷",
+        analysis: "教研"
       }
     };
   },
@@ -97,7 +108,7 @@ export default {
 
       const roleSource = this.$ls.get("user", {
         roleSource: []
-      });
+      }).roleSource;
 
       // 阅卷角色查询
       if (validRouters.includes("MarkerLogin")) {
@@ -106,7 +117,7 @@ export default {
           item =>
             item.router !== "MarkerLogin" ||
             (item.router === "MarkerLogin" &&
-              !markerRoles.includes(item.params.trigger))
+              markerRoles.includes(item.params.trigger))
         );
       }
 
@@ -119,7 +130,7 @@ export default {
           item =>
             item.router !== "AnalysisReportView" ||
             (item.router === "AnalysisReportView" &&
-              !analysisRoles.includes(item.params.trigger))
+              analysisRoles.includes(item.params.trigger))
         );
       }
 
@@ -149,7 +160,7 @@ export default {
         return {
           id: item.id,
           type: "flow",
-          content: `${flowTaskName},${item.paperNumber},${item.courseName}(${item.courseCode})`
+          content: `${flowTaskName},试卷编号${item.paperNumber},${item.courseName}(${item.courseCode})`
         };
       });
       this.waitTaskList.push(...dataList);
@@ -160,7 +171,7 @@ export default {
         return {
           id: item.id,
           type: "stmms",
-          content: `${item.thirdRelateName}(${item.thirdRelateId}),${paperNumber},${item.paperType}`
+          content: `${item.thirdRelateName}(${item.thirdRelateId}),试卷编号${paperNumber},${item.paperType}`
         };
       });
       this.waitTaskList.push(...dataList);
@@ -184,6 +195,13 @@ export default {
     },
     toDo(item) {
       console.log(item);
+      this.$router.push({
+        name: "WaitTask",
+        query: {
+          tid: item.id,
+          type: item.type
+        }
+      });
     }
   }
 };