Bladeren bron

报告异常情况优化

zhangjie 1 jaar geleden
bovenliggende
commit
8aec56c3e7

+ 51 - 46
src/modules/base/components/ModifyPrintTemplate.vue

@@ -4,6 +4,7 @@
     :visible.sync="modalIsShow"
     :title="title"
     width="600px"
+    top="10px"
     :close-on-click-modal="false"
     :close-on-press-escape="false"
     append-to-body
@@ -45,52 +46,54 @@
           ></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item
-        v-if="modalForm.classify === 'SIGN'"
-        label="考生数据显示方式:"
-        prop="diallel"
-      >
-        <el-radio-group v-model="modalForm.diallel">
-          <el-radio :label="false">单列</el-radio>
-          <el-radio :label="true">双列</el-radio>
-        </el-radio-group>
-      </el-form-item>
-      <el-form-item
-        v-if="modalForm.classify === 'SIGN'"
-        prop="testDesc"
-        label="文字说明:"
-      >
-        <el-input
-          v-model="modalForm.textDesc"
-          type="textarea"
-          resize="none"
-          :rows="2"
-          :maxlength="500"
-          clearable
-          show-word-limit
-          placeholder="建议不超过500个字"
-        ></el-input>
-      </el-form-item>
-      <el-form-item
-        v-if="modalForm.classify === 'SIGN'"
-        label="显示字段:"
-        prop="fields"
-      >
-        <el-checkbox
-          v-for="field in signDatas.basic"
-          :key="field.code"
-          v-model="field.enable"
-          >{{ field.name }}</el-checkbox
-        >
-        <el-divider></el-divider>
-        <el-checkbox
-          v-for="field in signDatas.table"
-          :key="field.code"
-          v-model="field.enable"
-          >{{ field.name }}</el-checkbox
-        >
-      </el-form-item>
-
+      <template v-if="modalForm.classify === 'SIGN'">
+        <el-form-item label="考生数据显示方式:" prop="diallel">
+          <el-radio-group v-model="modalForm.diallel">
+            <el-radio :label="false">单列</el-radio>
+            <el-radio :label="true">双列</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="是否增加空白页:" prop="addBlankPage">
+          <el-radio-group v-model="modalForm.addBlankPage">
+            <el-radio :label="false">否</el-radio>
+            <el-radio :label="true">是</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="考生信息行间距:" prop="lineHeightTimes">
+          <el-radio-group v-model="modalForm.lineHeightTimes">
+            <el-radio :label="1">1倍</el-radio>
+            <el-radio :label="1.5">1.5倍</el-radio>
+            <el-radio :label="2">2倍</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item prop="testDesc" label="文字说明:">
+          <el-input
+            v-model="modalForm.textDesc"
+            type="textarea"
+            resize="none"
+            :rows="2"
+            :maxlength="500"
+            clearable
+            show-word-limit
+            placeholder="建议不超过500个字"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="显示字段:" prop="fields">
+          <el-checkbox
+            v-for="field in signDatas.basic"
+            :key="field.code"
+            v-model="field.enable"
+            >{{ field.name }}</el-checkbox
+          >
+          <el-divider></el-divider>
+          <el-checkbox
+            v-for="field in signDatas.table"
+            :key="field.code"
+            v-model="field.enable"
+            >{{ field.name }}</el-checkbox
+          >
+        </el-form-item>
+      </template>
       <el-form-item
         v-else-if="modalForm.classify === 'PACKAGE'"
         label="显示字段:"
@@ -147,6 +150,8 @@ const initModalForm = {
   remark: "",
   classify: "",
   diallel: true,
+  addBlankPage: false,
+  lineHeightTimes: 1,
   textDesc: "",
   attachmentId: "",
 };

+ 29 - 9
src/modules/mark/components/report/Report.vue

@@ -2,18 +2,26 @@
   <div class="report">
     <template v-if="dataReady">
       <report-summary></report-summary>
-      <report-college></report-college>
-      <report-class></report-class>
-      <report-teacher></report-teacher>
-      <report-question type="objective"></report-question>
-      <report-question type="subjective"></report-question>
+      <report-college v-if="college.length"></report-college>
+      <report-class v-if="classData.length"></report-class>
+      <report-teacher
+        v-if="teacher.length || teacherClass.length"
+      ></report-teacher>
+      <report-question
+        v-if="objective.length"
+        type="objective"
+      ></report-question>
+      <report-question
+        v-if="subjective.length"
+        type="subjective"
+      ></report-question>
     </template>
   </div>
 </template>
 
 <script>
 import reportData from "./data";
-import { mapMutations } from "vuex";
+import { mapState, mapMutations } from "vuex";
 import ReportSummary from "./ReportSummary.vue";
 import ReportCollege from "./ReportCollege.vue";
 import ReportClass from "./ReportClass.vue";
@@ -44,11 +52,19 @@ export default {
       dataReady: false,
     };
   },
+  computed: {
+    ...mapState("report", [
+      "scoreRange",
+      "college",
+      "classData",
+      "teacher",
+      "teacherClass",
+      "objective",
+      "subjective",
+    ]),
+  },
   mounted() {
     this.initData();
-    this.$nextTick(() => {
-      this.fillCatalogNum();
-    });
   },
   methods: {
     ...mapMutations("report", ["setData", "resetData"]),
@@ -80,6 +96,10 @@ export default {
         },
       });
       this.dataReady = true;
+
+      this.$nextTick(() => {
+        this.fillCatalogNum();
+      });
     },
     fillCatalogNum() {
       document.querySelectorAll(".foot-right").forEach((item, index) => {

+ 36 - 17
src/modules/mark/components/report/ReportQuestion.vue

@@ -1,20 +1,13 @@
 <template>
   <div class="report-question">
-    <report-box
-      v-for="(cgroup, cindex) in questionCharts"
-      :key="`chart-${cindex}`"
-      :title="title"
-    >
-      <div class="question-chart" :style="cgroup.style">
-        <v-chart :option="cgroup.chart" :init-options="initOption"></v-chart>
+    <report-box v-for="(page, pindex) in pages" :key="pindex" :title="title">
+      <div v-if="page.charts" class="question-chart" :style="page.charts.style">
+        <v-chart
+          :option="page.charts.chart"
+          :init-options="initOption"
+        ></v-chart>
       </div>
-    </report-box>
-    <report-box
-      v-for="(tgroup, tindex) in questionTables"
-      :key="`table-${tindex}`"
-      :title="title"
-    >
-      <table class="report-table report-table-border">
+      <table v-if="page.tables" class="report-table report-table-border">
         <tr>
           <th>题目名称</th>
           <th>大题号</th>
@@ -24,7 +17,7 @@
           <th>得分率(%)</th>
           <th>满分率(%)</th>
         </tr>
-        <tr v-for="(item, ind) in tgroup" :key="ind">
+        <tr v-for="(item, ind) in page.tables" :key="ind">
           <td>{{ item.title }}</td>
           <td>{{ item.mainNumber }}</td>
           <td>{{ item.subNumber }}</td>
@@ -54,6 +47,7 @@ export default {
     return {
       questionCharts: [],
       questionTables: [],
+      pages: [],
       chartSplitRange: 30,
       initOption,
     };
@@ -74,7 +68,8 @@ export default {
     initData() {
       const question =
         this.type === "subjective" ? this.subjective : this.objective;
-      this.questionCharts = sectionArr(question, this.chartSplitRange).map(
+
+      const questionCharts = sectionArr(question, this.chartSplitRange).map(
         (data) => {
           return {
             chart: getBarPointTopicOptions(data),
@@ -83,7 +78,31 @@ export default {
           };
         }
       );
-      this.questionTables = sectionArr(question, this.chartSplitRange);
+      const questionTables = sectionArr(question, this.chartSplitRange);
+
+      let pages = [];
+      if (question.length <= 14) {
+        pages = [
+          {
+            charts: questionCharts[0],
+            tables: questionTables[0],
+          },
+        ];
+      } else {
+        questionCharts.forEach((chart) => {
+          pages.push({
+            charts: chart,
+            tables: null,
+          });
+        });
+        questionTables.forEach((table) => {
+          pages.push({
+            charts: null,
+            tables: table,
+          });
+        });
+      }
+      this.pages = pages;
     },
     getChartStyle(count) {
       const labelHeight = 28;

+ 3 - 2
src/modules/mark/components/report/data.js

@@ -90,7 +90,7 @@ for (let i = 0; i < teacherCount; i++) {
 // 试题
 let objective = [];
 let objectiveMainCount = 3;
-let objectiveSubCount = getRandomNumer(10, 30);
+let objectiveSubCount = getRandomNumer(5, 10);
 for (let i = 0; i < objectiveMainCount; i++) {
   for (let j = 0; j < objectiveSubCount; j++) {
     objective.push({
@@ -104,9 +104,10 @@ for (let i = 0; i < objectiveMainCount; i++) {
     });
   }
 }
+// objective = objective.slice(0, 10);
 let subjective = [];
 let subjectiveMainCount = 4;
-let subjectiveSubCount = getRandomNumer(10, 30);
+let subjectiveSubCount = getRandomNumer(2, 4);
 for (let i = 0; i < subjectiveMainCount; i++) {
   for (let j = 0; j < subjectiveSubCount; j++) {
     subjective.push({

+ 1 - 1
src/modules/mark/components/report/store.js

@@ -13,7 +13,7 @@ const state = {
 const mutations = {
   setData(state, data) {
     Object.keys(state).forEach((k) => {
-      state[k] = data[k];
+      state[k] = data[k] || state[k];
     });
   },
   resetData(state) {