Procházet zdrojové kódy

考生承诺书调整

zhangjie před 1 rokem
rodič
revize
8d44dd9eae

+ 23 - 0
card/components/CardConfigPropEdit.vue

@@ -70,6 +70,16 @@
                 :disabled="modalForm.examNumberStyle === 'FILL'"
                 >启用“手写签名”</el-checkbox
               >
+              <el-checkbox v-model="modalForm.undertakingEnable"
+                >启用考生承诺书</el-checkbox
+              >
+              <el-button
+                v-if="modalForm.undertakingEnable"
+                type="text"
+                class="btn-primary ml-2"
+                @click="toEditUndertaking"
+                >编辑</el-button
+              >
             </el-form-item>
             <div class="part-box part-box-pad part-box-border">
               <h4 class="part-box-tips">题卡版头变量印刷字段配置:</h4>
@@ -136,6 +146,12 @@
         </div>
       </div>
     </el-drawer>
+
+    <!-- ModifyCardRuleUndertaking -->
+    <modify-card-rule-undertaking
+      ref="ModifyCardRuleUndertaking"
+      v-model="modalForm.undertakingBody"
+    ></modify-card-rule-undertaking>
   </div>
 </template>
 
@@ -144,6 +160,7 @@ import { mapState, mapMutations, mapActions } from "vuex";
 import { objAssign } from "../plugins/utils";
 import { EXAM_NUMBER_STYLE, PAPER_TYPE } from "@/constants/enumerate";
 import { examRuleDetail, getEnums } from "@/modules/base/api";
+import ModifyCardRuleUndertaking from "@/modules/base/components/ModifyCardRuleUndertaking.vue";
 
 const initModalForm = {
   examNumberStyle: "",
@@ -152,6 +169,8 @@ const initModalForm = {
   examAbsent: true,
   discipline: true,
   writeSign: true,
+  undertakingEnable: false,
+  undertakingBody: "",
   requiredFields: [],
   extendFields: [],
   attention: "",
@@ -161,6 +180,7 @@ const initModalForm = {
 
 export default {
   name: "card-config-prop-edit",
+  components: { ModifyCardRuleUndertaking },
   data() {
     return {
       modalForm: { ...initModalForm },
@@ -307,6 +327,9 @@ export default {
         this.modalForm[type].push({ ...field });
       });
     },
+    toEditUndertaking() {
+      this.$refs.ModifyCardRuleUndertaking.open();
+    },
     open() {
       this.drawer = true;
       this.initData();

+ 1 - 1
card/components/CardDesign.vue

@@ -186,7 +186,7 @@
               :current="pageNo + 1"
             ></page-number>
             <elem-undertaking
-              v-if="cardConfig.undertakingEnable && pageNo % 2 === 1"
+              v-if="cardConfig.undertakingEnable && pageNo === pages.length - 1"
               :content="cardConfig.undertakingBody"
             ></elem-undertaking>
           </div>

+ 1 - 1
card/components/CardView.vue

@@ -78,7 +78,7 @@
             :current="pageNo + 1"
           ></page-number>
           <elem-undertaking
-            v-if="cardConfig.undertakingEnable && pageNo % 2 === 1"
+            v-if="cardConfig.undertakingEnable && pageNo === pages.length - 1"
             :content="cardConfig.undertakingBody"
           ></elem-undertaking>
         </div>

+ 1 - 20
card/components/PagePropEdit.vue

@@ -46,24 +46,10 @@
           >查看题卡结构<i class="el-icon-arrow-right"></i
         ></el-button>
       </el-form-item>
-      <el-form-item label="考生承诺书" label-width="80px">
-        <el-checkbox v-model="form.undertakingEnable" @change="cardConfigChange"
-          >启用</el-checkbox
-        >
-        <el-button
-          v-if="form.undertakingEnable"
-          type="text"
-          class="btn-primary ml-2"
-          @click="toEditUndertaking"
-          >编辑</el-button
-        >
-      </el-form-item>
     </el-form>
 
     <!-- PageStructDialog -->
     <page-struct-dialog ref="PageStructDialog"></page-struct-dialog>
-    <!-- EditUndertaking -->
-    <edit-undertaking ref="EditUndertaking"></edit-undertaking>
   </div>
 </template>
 
@@ -71,7 +57,6 @@
 import { mapState, mapMutations, mapActions } from "vuex";
 import { objAssign } from "../plugins/utils";
 import PageStructDialog from "./PageStructDialog.vue";
-import EditUndertaking from "../elements/undertaking/EditUndertaking.vue";
 
 const COLUMN_OPTIONS = [
   {
@@ -106,7 +91,7 @@ const COLUMN_OPTIONS = [
 
 export default {
   name: "page-prop-edit",
-  components: { PageStructDialog, EditUndertaking },
+  components: { PageStructDialog },
   data() {
     return {
       columnOptions: [],
@@ -118,7 +103,6 @@ export default {
         columnGap: 4,
         aOrB: false,
         showForbidArea: false,
-        undertakingEnable: false,
       },
       prePageSize: "A3",
     };
@@ -202,9 +186,6 @@ export default {
     toViewStruct() {
       this.$refs.PageStructDialog.open();
     },
-    toEditUndertaking() {
-      this.$refs.EditUndertaking.open();
-    },
   },
 };
 </script>

+ 177 - 152
src/modules/base/components/ModifyCardRule.vue

@@ -1,83 +1,84 @@
 <template>
-  <el-dialog
-    class="modify-card-rule"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10px"
-    width="950px"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    @open="visibleChange"
-  >
-    <el-form
-      ref="modalFormComp"
-      label-width="130px"
-      :rules="rules"
-      :model="modalForm"
+  <div>
+    <el-dialog
+      class="modify-card-rule"
+      :visible.sync="modalIsShow"
+      :title="title"
+      top="10px"
+      width="950px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      append-to-body
+      @open="visibleChange"
     >
-      <el-form-item prop="name" label="题卡规则名称:">
-        <el-input
-          v-model.trim="modalForm.name"
-          placeholder="建议不超过30个字,规则名称不允许重复"
-          style="width: 100%"
-          clearable
-          :disabled="!editable"
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="remark" label="备注:">
-        <el-input
-          v-model="modalForm.remark"
-          type="textarea"
-          resize="none"
-          :rows="2"
-          :maxlength="50"
-          :disabled="!editable"
-          clearable
-          show-word-limit
-          placeholder="建议不超过50个字"
-        ></el-input>
-      </el-form-item>
-      <el-form-item
-        prop="examNumberStyle"
-        label="考号版式:"
-        class="inline-block"
+      <el-form
+        ref="modalFormComp"
+        label-width="130px"
+        :rules="rules"
+        :model="modalForm"
       >
-        <el-select
-          v-model="modalForm.examNumberStyle"
-          style="width: 142px"
-          placeholder="请选择"
-          :disabled="!editable"
-          @change="numStyleChange"
+        <el-form-item prop="name" label="题卡规则名称:">
+          <el-input
+            v-model.trim="modalForm.name"
+            placeholder="建议不超过30个字,规则名称不允许重复"
+            style="width: 100%"
+            clearable
+            :disabled="!editable"
+          ></el-input>
+        </el-form-item>
+        <el-form-item prop="remark" label="备注:">
+          <el-input
+            v-model="modalForm.remark"
+            type="textarea"
+            resize="none"
+            :rows="2"
+            :maxlength="50"
+            :disabled="!editable"
+            clearable
+            show-word-limit
+            placeholder="建议不超过50个字"
+          ></el-input>
+        </el-form-item>
+        <el-form-item
+          prop="examNumberStyle"
+          label="考号版式:"
+          class="inline-block"
         >
-          <el-option
-            v-for="(val, key) in EXAM_NUMBER_STYLE"
-            :key="key"
-            :value="key"
-            :label="val"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item
-        prop="examNumberDigit"
-        label="考号位数:"
-        class="inline-block"
-      >
-        <el-input-number
-          v-if="modalForm.examNumberStyle === 'FILL'"
-          v-model="modalForm.examNumberDigit"
-          :min="5"
-          :max="15"
-          :step="1"
-          step-strictly
-          :controls="false"
-          style="width: 100px"
-        ></el-input-number>
-        <span v-else>
-          {{ modalForm.examNumberDigit }}
-        </span>
-      </el-form-item>
-      <!-- <el-form-item prop="paperType" label="AB卷版式:" class="inline-block">
+          <el-select
+            v-model="modalForm.examNumberStyle"
+            style="width: 142px"
+            placeholder="请选择"
+            :disabled="!editable"
+            @change="numStyleChange"
+          >
+            <el-option
+              v-for="(val, key) in EXAM_NUMBER_STYLE"
+              :key="key"
+              :value="key"
+              :label="val"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item
+          prop="examNumberDigit"
+          label="考号位数:"
+          class="inline-block"
+        >
+          <el-input-number
+            v-if="modalForm.examNumberStyle === 'FILL'"
+            v-model="modalForm.examNumberDigit"
+            :min="5"
+            :max="15"
+            :step="1"
+            step-strictly
+            :controls="false"
+            style="width: 100px"
+          ></el-input-number>
+          <span v-else>
+            {{ modalForm.examNumberDigit }}
+          </span>
+        </el-form-item>
+        <!-- <el-form-item prop="paperType" label="AB卷版式:" class="inline-block">
         <el-select
           v-model="modalForm.paperType"
           style="width: 142px"
@@ -92,95 +93,114 @@
           ></el-option>
         </el-select>
       </el-form-item> -->
-      <el-form-item>
-        <el-checkbox v-model="modalForm.examAbsent" :disabled="!editable"
-          >启用“缺考填涂”</el-checkbox
-        >
-        <el-checkbox v-model="modalForm.discipline" :disabled="!editable"
-          >启用“违纪填涂”</el-checkbox
-        >
-        <el-checkbox
-          v-model="modalForm.writeSign"
-          :disabled="modalForm.examNumberStyle === 'FILL' || !editable"
-          >启用“手写签名”</el-checkbox
-        >
-      </el-form-item>
-      <div class="part-box part-box-pad part-box-border">
-        <h4 class="part-box-tips">题卡版头变量印刷字段配置:</h4>
-        <el-form-item label="必选字段:" label-width="115px" required>
-          <el-checkbox
-            v-for="column in modalForm.requiredFields"
-            :key="column.code"
-            v-model="column.enable"
-            disabled
-            >{{ column.name }}</el-checkbox
+        <el-form-item>
+          <el-checkbox v-model="modalForm.examAbsent" :disabled="!editable"
+            >启用“缺考填涂”</el-checkbox
+          >
+          <el-checkbox v-model="modalForm.discipline" :disabled="!editable"
+            >启用“违纪填涂”</el-checkbox
           >
-        </el-form-item>
-        <el-form-item label="扩展字段:" label-width="115px">
           <el-checkbox
-            v-for="column in modalForm.extendFields"
-            :key="column.code"
-            v-model="column.enable"
-            :disabled="!editable"
-            >{{ column.name }}</el-checkbox
+            v-model="modalForm.writeSign"
+            :disabled="modalForm.examNumberStyle === 'FILL' || !editable"
+            >启用“手写签名”</el-checkbox
+          >
+          <el-checkbox v-model="modalForm.undertakingEnable"
+            >启用考生承诺书</el-checkbox
+          >
+          <el-button
+            v-if="modalForm.undertakingEnable"
+            type="text"
+            class="btn-primary ml-2"
+            @click="toEditUndertaking"
+            >编辑</el-button
           >
         </el-form-item>
-      </div>
-      <el-form-item prop="titleRule" label="题卡标题规则:">
-        <!-- <el-input
+        <div class="part-box part-box-pad part-box-border">
+          <h4 class="part-box-tips">题卡版头变量印刷字段配置:</h4>
+          <el-form-item label="必选字段:" label-width="115px" required>
+            <el-checkbox
+              v-for="column in modalForm.requiredFields"
+              :key="column.code"
+              v-model="column.enable"
+              disabled
+              >{{ column.name }}</el-checkbox
+            >
+          </el-form-item>
+          <el-form-item label="扩展字段:" label-width="115px">
+            <el-checkbox
+              v-for="column in modalForm.extendFields"
+              :key="column.code"
+              v-model="column.enable"
+              :disabled="!editable"
+              >{{ column.name }}</el-checkbox
+            >
+          </el-form-item>
+        </div>
+        <el-form-item prop="titleRule" label="题卡标题规则:">
+          <!-- <el-input
             v-model="modalForm.titleRule"
             :disabled="!editable"
           ></el-input> -->
-        <card-title-rule-edit
-          v-model="modalForm.titleRule"
-          :disabled="!editable"
-          :field-sourses="fieldSourses"
-          v-if="fieldSourses.length"
-          ref="CardTitleRuleEdit"
-        ></card-title-rule-edit>
-      </el-form-item>
-      <el-form-item prop="attention" label="注意事项:">
-        <el-input
-          type="textarea"
-          :rows="4"
-          v-model="modalForm.attention"
-          :disabled="!editable"
-        ></el-input>
-        <p class="tips-info">
-          提示:换行之后,题卡注意事项会展示为多条内容,内容序号会被自动添加。
-        </p>
-      </el-form-item>
-      <el-form-item prop="objectiveAttention" label="客观题注意事项:">
-        <el-input
-          v-model="modalForm.objectiveAttention"
-          :disabled="!editable"
-        ></el-input>
-      </el-form-item>
-      <el-form-item prop="subjectiveAttention" label="主观题注意事项:">
-        <el-input
-          v-model="modalForm.subjectiveAttention"
-          :disabled="!editable"
-        ></el-input>
-      </el-form-item>
-    </el-form>
+          <card-title-rule-edit
+            v-model="modalForm.titleRule"
+            :disabled="!editable"
+            :field-sourses="fieldSourses"
+            v-if="fieldSourses.length"
+            ref="CardTitleRuleEdit"
+          ></card-title-rule-edit>
+        </el-form-item>
+        <el-form-item prop="attention" label="注意事项:">
+          <el-input
+            type="textarea"
+            :rows="4"
+            v-model="modalForm.attention"
+            :disabled="!editable"
+          ></el-input>
+          <p class="tips-info">
+            提示:换行之后,题卡注意事项会展示为多条内容,内容序号会被自动添加。
+          </p>
+        </el-form-item>
+        <el-form-item prop="objectiveAttention" label="客观题注意事项:">
+          <el-input
+            v-model="modalForm.objectiveAttention"
+            :disabled="!editable"
+          ></el-input>
+        </el-form-item>
+        <el-form-item prop="subjectiveAttention" label="主观题注意事项:">
+          <el-input
+            v-model="modalForm.subjectiveAttention"
+            :disabled="!editable"
+          ></el-input>
+        </el-form-item>
+      </el-form>
 
-    <div slot="footer">
-      <el-button
-        v-if="editable"
-        type="primary"
-        :disabled="isSubmit"
-        @click="submit"
-        >确认</el-button
-      >
-      <el-button @click="cancel">取消</el-button>
-    </div>
-  </el-dialog>
+      <div slot="footer">
+        <el-button
+          v-if="editable"
+          type="primary"
+          :disabled="isSubmit"
+          @click="submit"
+          >确认</el-button
+        >
+        <el-button @click="cancel">取消</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- ModifyCardRuleUndertaking -->
+    <modify-card-rule-undertaking
+      ref="ModifyCardRuleUndertaking"
+      v-model="modalForm.undertakingBody"
+    ></modify-card-rule-undertaking>
+  </div>
 </template>
 
 <script>
 import { EXAM_NUMBER_STYLE, PAPER_TYPE } from "@/constants/enumerate";
 import { saveCardRule } from "../api";
 import CardTitleRuleEdit from "./CardTitleRuleEdit";
+import ModifyCardRuleUndertaking from "./ModifyCardRuleUndertaking.vue";
+import { UNDERTAKING_BODY } from "../../../../card/enumerate";
 
 const initModalForm = {
   id: null,
@@ -192,6 +212,8 @@ const initModalForm = {
   examAbsent: true,
   discipline: true,
   writeSign: true,
+  undertakingEnable: false,
+  undertakingBody: UNDERTAKING_BODY,
   requiredFields: [],
   extendFields: [],
   titleRule: "",
@@ -202,7 +224,7 @@ const initModalForm = {
 
 export default {
   name: "modify-card-rule",
-  components: { CardTitleRuleEdit },
+  components: { CardTitleRuleEdit, ModifyCardRuleUndertaking },
   props: {
     instance: {
       type: Object,
@@ -367,6 +389,9 @@ export default {
         this.modalForm.examNumberDigit = 10;
       }
     },
+    toEditUndertaking() {
+      this.$refs.ModifyCardRuleUndertaking.open();
+    },
     async submit() {
       const valid = await this.$refs.modalFormComp.validate().catch(() => {});
       if (!valid) return;

+ 111 - 0
src/modules/base/components/ModifyCardRuleUndertaking.vue

@@ -0,0 +1,111 @@
+<template>
+  <el-dialog
+    class="edit-undertaking edit-dialog"
+    :visible.sync="modalIsShow"
+    title="编辑承诺书"
+    top="10vh"
+    width="640px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    :before-close="cancel"
+    append-to-body
+    @open="initData"
+  >
+    <h3 class="ut-title">考生承诺书</h3>
+    <p>本人郑重承诺:</p>
+    <el-form
+      ref="modalFormComp"
+      :model="modalForm"
+      :rules="rules"
+      label-width="0"
+    >
+      <el-form-item prop="undertakingBody">
+        <el-input
+          type="textarea"
+          :rows="4"
+          placeholder="请输入内容"
+          v-model="modalForm.undertakingBody"
+          maxlength="100"
+          show-word-limit
+          class="ut-textarea"
+          @input="contentChange"
+        >
+        </el-input>
+      </el-form-item>
+    </el-form>
+    <p class="ut-std">承诺人(签名):</p>
+
+    <div slot="footer">
+      <el-button type="primary" @click="submit">确认</el-button>
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+export default {
+  name: "modify-card-rule-undertaking",
+  props: {
+    value: {
+      type: String,
+      default: "",
+    },
+  },
+  data() {
+    return {
+      modalForm: { undertakingBody: "" },
+      modalIsShow: false,
+      rules: {
+        undertakingBody: [
+          {
+            required: true,
+            message: "请输入文本内容",
+            trigger: "change",
+          },
+        ],
+      },
+    };
+  },
+  methods: {
+    initData() {
+      this.modalForm = {
+        undertakingBody: this.value,
+      };
+    },
+    contentChange() {
+      this.modalForm.undertakingBody = this.modalForm.undertakingBody.replace(
+        "\n",
+        ""
+      );
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    async submit() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+      this.$emit("input", this.modalForm.undertakingBody);
+      this.cancel();
+    },
+  },
+};
+</script>
+
+<style scoped>
+.ut-title {
+  text-align: center;
+}
+.ut-std {
+  text-align: right;
+  margin-right: 100px;
+}
+.ut-textarea >>> .el-textarea__inner {
+  padding: 5px;
+  text-indent: 28px;
+  font-size: 14px;
+  margin: 0 -5px;
+}
+</style>

+ 0 - 3
src/modules/card/views/CardEdit.vue

@@ -29,7 +29,6 @@ import CardFreeDesign from "../../../../card/modules/free/components/CardFreeDes
 import CardPreviewDialog from "../components/CardPreviewDialog.vue";
 import { examRuleDetail } from "../../base/api";
 import { getEnums } from "../../login/api";
-import { UNDERTAKING_BODY } from "../../../../card/enumerate";
 import timeMixin from "@/mixins/timeMixin";
 import { MD5 } from "@/plugins/md5";
 
@@ -161,8 +160,6 @@ export default {
             columnNumber: 2,
             columnGap: 20,
             showForbidArea: false,
-            undertakingEnable: false,
-            undertakingBody: UNDERTAKING_BODY,
             cardDesc: "",
             makeMethod: this.prepareTcPCard.makeMethod,
           },