-
-
+
+
+
-
-
备注:{{ form.remark || '请输入备注' }}
+
+ 备注:{{ remark }}
-
-
@@ -40,44 +39,73 @@
import html2canvas from 'html2canvas'
export default {
name: 'WorkReport',
-
label: '工作汇报',
+ props: ['config'],
+
data () {
return {
- waterSrc: '',
- form: {
- unit: '',
- title: '',
- date: '',
- name: '',
- remark: ''
- },
- imgs: []
+ title: '工作汇报',
+ subTitle: '',
+ reporter: '',
+ date: '',
+ unit: '',
+ remark: '',
+ isShowTitle: true,
+ isShowSubTitle: true,
+ isShowDate: true,
+ isShowReporter: true,
+ isShowUnit: true,
+ isShowRemark: false,
+ imgs: [],
+ configList: []
}
},
+ watch: {
+ configList: {
+ handler: function (v) {
+ if (v.length) {
+ const title = v.filter(v => v.type === '17')[0]
+ const subTitle = v.filter(v => v.type === '18')[0]
+ const reporter = v.filter(v => v.type === '19')[0]
+ const date = v.filter(v => v.type === '1')[0]
+ const unit = v.filter(v => v.type === '20')[0]
+ const remark = v.filter(v => v.type === '4')[0]
+ this.isShowTitle = title.status === '1'
+ this.isShowRemark = remark.status === '1'
+ this.isShowUnit = unit.status === '1'
+ this.isShowReporter = reporter.status === '1'
+ this.isShowDate = date.status === '1'
+ this.isShowSubTitle = subTitle.status === '1'
+ this.title = title.defaultValue || ''
+ this.subTitle = subTitle.defaultValue || ''
+ this.reporter = reporter.defaultValue || ''
+ this.date = date.defaultValue || this.$dayjs(new Date).format('YYYY-MM-DD')
+ this.unit = unit.defaultValue || ''
+ this.remark = remark.defaultValue || ''
+ }
+ },
+ deep: true
+ },
+ },
+
mounted () {
+ this.configList = JSON.parse(JSON.stringify(this.config))
+
uni.$on('change', e => {
- console.log(e)
- e.forEach(v => {
- this.form[v.key] = v.value
- })
+ this.configList = e
})
},
methods: {
- save () {
+ screenshot () {
const height = this.$refs.report.offsetHeight - this.$refs.add.offsetHeight
- html2canvas(this.$refs.report, {
+
+ return html2canvas(this.$refs.report, {
allowTaint: true,
useCORS: true,
height
- }).then((canvas) => {
- let dataURL = canvas.toDataURL('image/png')
- this.waterSrc = dataURL
- }).catch(e => {
- console.log(e)
})
},
@@ -90,7 +118,6 @@
formData.append('file', res.tempFiles[0])
this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) {
- console.log(res.data)
this.imgs.push(res.data.url)
}
})
@@ -98,41 +125,10 @@
})
},
- linkTo (path) {
- const data = [
- {
- type: 'text',
- key: 'unit',
- value: '',
- label: '汇报单位'
- },
- {
- type: 'text',
- key: 'title',
- value: '',
- label: '标题'
- },
- {
- type: 'text',
- key: 'name',
- value: '',
- label: '汇报人'
- },
- {
- type: 'date',
- key: 'date',
- value: '',
- label: '汇报日期'
- },
- {
- type: 'textarea',
- key: 'remark',
- value: '',
- label: '备注'
- }
- ]
+ linkTo () {
+ uni.setStorageSync('waterConfig', this.configList)
uni.navigateTo({
- url: `${path}?params=${JSON.stringify(data)}`
+ url: './WatermarkConfig'
})
}
}
@@ -158,6 +154,7 @@
}
.imgs {
+ margin-top: 20px;
image {
display: block;
width: 100%;