Oliver
2022-12-22 73b48dd59a2d47b365b87784371c4ef57dde659b
src/views/operate/writManager/components/inquest_record/edit.vue
@@ -260,6 +260,13 @@
      });
    },
    handlePrint(e) {},
    judgeLength(word, length, char) {
      let wordLength = word.length;
      for (let index = 0; wordLength + index < length; index++) {
        word += char ? "  " : " ";
      }
      return word;
    },
    handleExport(e) {
      let that = this;
      loadFile(
@@ -267,7 +274,7 @@
        "/inquest_record.docx", //"https://docxtemplater.com/tag-example.docx"
        function (error, content) {
          // eslint-disable-next-line no-debugger
          debugger;
          if (error) {
            throw error;
          }
@@ -276,8 +283,29 @@
            paragraphLoop: true,
            linebreaks: true,
          });
          debugger;
          doc.setData(that.form);
          var data = that.form;
          data.jc_address = that.judgeLength(data.jc_address, 20, true);
          data.jc_user1 = that.judgeLength(data.jc_user1, 9, true);
          data.jc_user2 = that.judgeLength(data.jc_user2, 9, true);
          data.jc_card1 = that.judgeLength(data.jc_card1, 13, false);
          data.jc_card2 = that.judgeLength(data.jc_card2, 12, false);
          data.recorder = that.judgeLength(data.recorder, 9, true);
          data.weather = that.judgeLength(data.weather, 7, true);
          data.bjc_name = that.judgeLength(data.bjc_name, 16, true);
          data.bjc_code = that.judgeLength(data.bjc_code, 36, false);
          data.bjc_address = that.judgeLength(data.bjc_address, 11, true);
          data.bjc_phone = that.judgeLength(data.bjc_phone, 12, false);
          data.current_person = that.judgeLength(data.current_person, 12, true);
          data.position = that.judgeLength(data.position, 9, true);
          data.current_person_phone = that.judgeLength(
            data.current_person_phone,
            24,
            false
          );
          data.relation = that.judgeLength(data.relation, 6, true);
          data.eyewitness = that.judgeLength(data.eyewitness, 25, true);
          doc.setData(data);
          /*向文档中写入数据*/
          doc.render();
@@ -299,7 +327,7 @@
<style scoped>
.content {
  width: 90%;
  width: 805px;
  margin: auto;
  line-height: 2 !important;
}