This commit is contained in:
yanran200730
2022-05-30 17:13:17 +08:00
parent 46e96a591d
commit c0dd166af3
5 changed files with 33 additions and 2 deletions

View File

@@ -62,7 +62,7 @@
save () {
this.$loading()
this.$refs.reportItem.screenshot().then(canvas => {
this.$refs.reportItem.screenshot() && this.$refs.reportItem.screenshot().then(canvas => {
let dataURL = canvas.toDataURL('image/png')
const file = this.dataURLtoFile(dataURL, 'photo.png')
let formData = new FormData()

View File

@@ -42,6 +42,7 @@
<script>
import html2canvas from 'html2canvas'
import RenderContent from './RenderContent.vue'
import { mapFieldLable } from './../../config'
export default {
name: 'Daily',
label: '日报',
@@ -119,6 +120,13 @@
methods: {
screenshot () {
for (let i = 0; i < this.configList.length; i ++) {
if (['2', '3', '4', '5'].indexOf(this.configList[i].fieldType) === -1 && this.configList[i].fieldType && !this.configList[i].defaultValue && this.configList[i].status === '1') {
this.$u.toast(`请输入${mapFieldLable(this.config[i].type)}`)
return false
}
}
const height = this.$refs.report.offsetHeight - this.$refs.add.offsetHeight
return html2canvas(this.$refs.report, {

View File

@@ -43,6 +43,7 @@
<script>
import html2canvas from 'html2canvas'
import { mapFieldLable } from './../../config'
import RenderContent from './RenderContent.vue'
export default {
name: 'InspectLog',
@@ -128,6 +129,13 @@
methods: {
screenshot () {
for (let i = 0; i < this.configList.length; i ++) {
if (['2', '3', '4', '5'].indexOf(this.configList[i].fieldType) === -1 && this.configList[i].fieldType && !this.configList[i].defaultValue && this.configList[i].status === '1') {
this.$u.toast(`请输入${mapFieldLable(this.config[i].type)}`)
return false
}
}
const height = this.$refs.report.offsetHeight - this.$refs.add.offsetHeight
return html2canvas(this.$refs.report, {

View File

@@ -55,6 +55,7 @@
<script>
import html2canvas from 'html2canvas'
import RenderContent from './RenderContent.vue'
import { mapFieldLable } from './../../config'
export default {
name: 'MeetingMminutes',
@@ -149,6 +150,13 @@
methods: {
screenshot () {
for (let i = 0; i < this.configList.length; i ++) {
if (['2', '3', '4', '5'].indexOf(this.configList[i].fieldType) === -1 && this.configList[i].fieldType && !this.configList[i].defaultValue && this.configList[i].status === '1') {
this.$u.toast(`请输入${mapFieldLable(this.config[i].type)}`)
return false
}
}
const height = this.$refs.report.offsetHeight - this.$refs.add.offsetHeight
return html2canvas(this.$refs.report, {

View File

@@ -41,6 +41,7 @@
<script>
import html2canvas from 'html2canvas'
import RenderContent from './RenderContent.vue'
import { mapFieldLable } from './../../config'
export default {
name: 'WorkReport',
@@ -119,8 +120,14 @@
methods: {
screenshot () {
const height = this.$refs.report.offsetHeight - this.$refs.add.offsetHeight
for (let i = 0; i < this.configList.length; i ++) {
if (['2', '3', '4', '5'].indexOf(this.configList[i].fieldType) === -1 && this.configList[i].fieldType && !this.configList[i].defaultValue && this.configList[i].status === '1') {
this.$u.toast(`请输入${mapFieldLable(this.config[i].type)}`)
return false
}
}
const height = this.$refs.report.offsetHeight - this.$refs.add.offsetHeight
return html2canvas(this.$refs.report, {
allowTaint: true,
useCORS: true,