Ver código fonte

feat: 课程条码卡格式,通用规则调整

zhangjie 11 meses atrás
pai
commit
654abc7531

+ 20 - 0
card/mixins/exchange.js

@@ -106,6 +106,12 @@ export default {
           exchange.fill_area = exchange.fill_area.concat(pnoInfo);
         }
 
+        // 课程代码条码
+        const extraInfo = this.getExtraInfo(this.curPageDom);
+        Object.entries(extraInfo).forEach(([key, vals]) => {
+          exchange[key] = exchange[key].concat(vals);
+        });
+
         page.exchange = exchange;
       });
 
@@ -113,6 +119,20 @@ export default {
 
       return npages;
     },
+    getExtraInfo(pageDom) {
+      const info = {
+        barcode: [],
+      };
+      const courseBarDom = pageDom.querySelector(".course-barcode");
+      if (courseBarDom) {
+        info.barcode.push({
+          field: "courseCode",
+          area: this.getOffsetInfo(courseBarDom),
+        });
+      }
+
+      return info;
+    },
     getPageNumberInfo() {
       const dom = document.getElementById(`preview-page-box-0`);
       let options = [];

+ 24 - 6
card/modules/free/cardFormatTransform.js

@@ -252,6 +252,21 @@ function getPageNumberInfo() {
   ];
 }
 
+function getExtraInfo(pageDom) {
+  const info = {
+    barcode: [],
+  };
+  const courseBarDom = pageDom.querySelector(".course-barcode");
+  if (courseBarDom) {
+    info.barcode.push({
+      field: "courseCode",
+      area: getOffsetInfo(courseBarDom),
+    });
+  }
+
+  return info;
+}
+
 function parsePageExchange(pages) {
   initFillAreaIndex();
 
@@ -262,17 +277,14 @@ function parsePageExchange(pages) {
     .getBoundingClientRect();
   const pageNumberInfo = pages.length > 2 ? getPageNumberInfo() : null;
   npages.forEach((page, pindex) => {
-    curPageOffsetInfo = document
-      .getElementById(`preview-page-box-${pindex}`)
-      .getBoundingClientRect();
+    const curPageDom = document.getElementById(`preview-page-box-${pindex}`);
+    curPageOffsetInfo = curPageDom.getBoundingClientRect();
 
     let exchange = {
       card_type: 2,
       page_size: page.pageSize,
       page_image: "",
-      locator: elementInfoFunc.LOCATOR(
-        document.getElementById(`preview-page-box-${pindex}`)
-      ),
+      locator: elementInfoFunc.LOCATOR(curPageDom),
       fill_locator: [],
       check_area: {
         black_line: [],
@@ -312,6 +324,12 @@ function parsePageExchange(pages) {
       exchange.fill_area = exchange.fill_area.concat(pnoInfo);
     }
 
+    // 课程代码条码
+    const extraInfo = getExtraInfo(curPageDom);
+    Object.entries(extraInfo).forEach(([key, vals]) => {
+      exchange[key] = exchange[key].concat(vals);
+    });
+
     page.exchange = exchange;
   });
 

+ 2 - 3
src/modules/base/components/RuleSign.vue

@@ -57,10 +57,9 @@ export default {
         "siteNumber",
         "studentName",
         "studentCode",
-        "clazzName",
-        "ticketNumber",
         "courseName",
-        "teachClazzName",
+        "className",
+        "teachClassName",
       ],
       rules: {
         basic: [

+ 3 - 3
src/modules/exam/components/createExamAndPrintTask/ModifyExamTaskStudent.vue

@@ -12,7 +12,7 @@
   >
     <div class="user-search">
       <el-form inline>
-        <el-form-item>
+        <!-- <el-form-item>
           <el-select v-model="filter.courseId" placeholder="请选择" filterable>
             <el-option-group
               v-for="item in courses"
@@ -28,7 +28,7 @@
               </el-option>
             </el-option-group>
           </el-select>
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item>
           <el-input
             v-model="filter.teacher"
@@ -193,7 +193,6 @@ export default {
     async visibleChange() {
       this.filter = this.$objAssign(this.filter, this.filterParams);
       await this.getStudents();
-      await this.getCourses();
 
       this.$refs.UserTree.setCheckedKeys([]);
       this.selectedUsers = [];
@@ -220,6 +219,7 @@ export default {
       if (!this.filterParams.teachingRoomId) return;
       const res = await courseQuery({
         teachingRoomId: this.filterParams.teachingRoomId,
+        examId: this.filterParams.examId,
       });
       const teachingCourseIds = res.teachCourseList.map((item) => item.id);
       this.courses = [