Blame view

ant-design-vue-jeecg/src/views/jeecg/PrintDemo.vue 4.63 KB
肖超群 authored
1
2
3
4
5
6
7
8
9
10
11
<template>
  <a-card :bordered="false" :class="{'abcdefg':true}">
    <div class="no-print" style="text-align: right">
      <a-button v-print="'#printContent'" ghost type="primary">打印</a-button>
    </div>
    <section ref="print" id="printContent" class="abcdefg">
      <div style="text-align: center">
        <p style="font-size: 24px;font-weight: 800">打印测试表单</p>
      </div>
      <!--签字-->
      <a-col :md="24" :sm="24">
肖超群 authored
12
13
        <div class="sign" style="text-align: left;height: inherit">
          <a-col :span="24">
肖超群 authored
14
15
16
          <span>
            打印人员:
          </span>
肖超群 authored
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
            <a-input style="width: 30%" v-model="printer"/>
            <span style="margin-left: 12.5%">打印日期:</span>
            <a-input style="width: 30%" v-model="printTime"/>
          </a-col>
          <a-col :span="24">
          </a-col>
          <a-col :span="24" style="margin-top: 20px">
            <span>打印内容:</span>
            <a-input style="width: 80%" v-model="printContent"/>
          </a-col>
          <a-col :span="24" style="margin-top: 20px">
            <span>打印目的:</span>
            <a-input style="width: 80%" v-model="printReason"/>
          </a-col>
          <a-col style="margin-top: 20px" :span="24">
            <span>打印图片:</span>
            <br/>
            <a-upload
              action="/jsonplaceholder.typicode.com/posts/"
              listType="picture-card"
              :fileList="fileList"
              @preview="handlePreview"
              @change="handleChange">
              <div v-if="fileList.length < 3">
                <a-icon type="plus"/>
                <div class="ant-upload-text">Upload</div>
              </div>
            </a-upload>
            <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
              <img alt="example" style="width: 100%" :src="previewImage"/>
            </a-modal>
          </a-col>
        </div>
肖超群 authored
50
51
52
53
54
55
      </a-col>
    </section>
  </a-card>
  <!--</page-layout>-->
</template>
<script>
肖超群 authored
56
57
58
import ACol from "ant-design-vue/es/grid/Col";
import ARow from "ant-design-vue/es/grid/Row";
import ATextarea from 'ant-design-vue/es/input/TextArea'
肖超群 authored
59
肖超群 authored
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
export default {
  components: {
    ATextarea,
    ARow,
    ACol,
  },
  name: 'Printgzsld',
  props: {
    reBizCode: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      columns: [{}
      ],
      labelCol: {
        xs: {span: 24},
        sm: {span: 2},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 8},
      },
      printer: '张三',
      printTime: '2019-02-01 12:00:00',
      printContent: '打印内容就是,做一个打印测试',
      printReason: '做一个打印测试',
      previewVisible: false,
      previewImage: '',
      fileList: [{
        uid: '-1',
        name: 'xxx.png',
        status: 'done',
        url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
      },
        {
          uid: '-2',
          name: 'pic1.png',
肖超群 authored
100
          status: 'done',
肖超群 authored
101
          url: 'https://www.gizbot.com/img/2016/11/whatsapp-error-lead-image-08-1478607387.jpg',
肖超群 authored
102
        }
肖超群 authored
103
104
105
106
      ],
      url: {
        loadApplicant: "/sps/register/loadApplicants",
        loadRegisterFiles: "/sps/register/getRegisterFilesConfig",
肖超群 authored
107
      }
肖超群 authored
108
109
110
111
112
113
114
115
    }
  },
  created() {
    this.getDate();
  },
  methods: {
    loadData() {
肖超群 authored
116
    },
肖超群 authored
117
118
    getDate() {
      // 当前时间
肖超群 authored
119
    },
肖超群 authored
120
121
122
123
124
125
126
127
128
    handleCancel() {
      this.previewVisible = false
    },
    handlePreview(file) {
      this.previewImage = file.url || file.thumbUrl
      this.previewVisible = true
    },
    handleChange({fileList}) {
      this.fileList = fileList
肖超群 authored
129
130
    }
  }
肖超群 authored
131
}
肖超群 authored
132
133
</script>
<style scoped>
肖超群 authored
134
135
136
137
138
/*update_begin author:scott date:20191203 for:打印机打印的字体模糊问题 */
* {
  color: #000000 !important;
  -webkit-tap-highlight-color: #000000 !important;
}
肖超群 authored
139
肖超群 authored
140
/*update_end author:scott date:20191203 for:打印机打印的字体模糊问题 */
肖超群 authored
141
肖超群 authored
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
.abcdefg .ant-card-body {
  margin-left: 0%;
  margin-right: 0%;
  margin-bottom: 1%;
  border: 0px solid black;
  min-width: 800px;
  color: #000000 !important;
}

.explain {
  text-align: left;
  margin-left: 50px;
  color: #000000 !important;
}

.explain .ant-input, .sign .ant-input {
  font-weight: bolder;
  text-align: center;
  border-left-width: 0px !important;
  border-top-width: 0px !important;
  border-right-width: 0px !important;
}

.explain div {
  margin-bottom: 10px;
}

/* you can make up upload button and sample style by using stylesheets */
.ant-upload-select-picture-card i {
  font-size: 32px;
  color: #999;
}

.ant-upload-select-picture-card .ant-upload-text {
  margin-top: 8px;
  color: #666;
}
肖超群 authored
179
</style>