|
|
@@ -1,7 +1,7 @@
|
|
|
|
|
|
<template>
|
|
|
<div style="display:flex">
|
|
|
- <canvas id="mycanvas" width="400" hight="400"></canvas>
|
|
|
+ <!-- <canvas id="mycanvas" width="400" hight="400"></canvas> -->
|
|
|
<div style="display:inline-block;margin:0 auto;text-align: center;">
|
|
|
<!--安装培训确认单-->
|
|
|
<div ref="container" style="background:#ffffff" v-if="detail.workorder.type == '安装培训'">
|
|
|
@@ -376,6 +376,16 @@ export default {
|
|
|
descriptions5:'',
|
|
|
descriptions6:'',
|
|
|
descriptions7:''
|
|
|
+ },
|
|
|
+ folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
|
|
|
+ params: {
|
|
|
+ "classname": "system.attachment.huawei.OBS",
|
|
|
+ "method": "getFileName",
|
|
|
+ "content": {
|
|
|
+ "filename": '',
|
|
|
+ "filetype": '',
|
|
|
+ "parentid": ""//归属文件夹ID
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -388,17 +398,44 @@ export default {
|
|
|
"sa_workorder_confirmationid": this.$route.query.id
|
|
|
}
|
|
|
})
|
|
|
- res.data.confirmationcontent.forEach(e => {
|
|
|
- Object.keys(e).map((key,index)=>{
|
|
|
- this.text.descriptions4 += e[key].amount
|
|
|
- if (key.includes('现场培训内容')) {
|
|
|
- this.text.descriptions1 = e[key].confirm_value
|
|
|
- }
|
|
|
- if (key.includes('测试培训效果')) {
|
|
|
- this.text.descriptions2 = e[key].confirm_value
|
|
|
- }
|
|
|
+ if (res.data.workorder.type == '安装测试') {
|
|
|
+ res.data.confirmationcontent.forEach(e => {
|
|
|
+ Object.keys(e).map((key,index)=>{
|
|
|
+ this.text.descriptions4 += e[key].amount
|
|
|
+ if (key.includes('现场培训内容')) {
|
|
|
+ this.text.descriptions1 = e[key].confirm_value
|
|
|
+ }
|
|
|
+ if (key.includes('是否需要拆卸配件或整拆')) {
|
|
|
+ this.text.descriptions2 = e[key].confirm_value
|
|
|
+ }
|
|
|
+ if (key.includes('维修方案')) {
|
|
|
+ this.text.descriptions3 = e[key].confirm_value?e[key].confirm_value:e[key].textcontent
|
|
|
+ }
|
|
|
+ if (key.includes('实施内容记录')) {
|
|
|
+ this.text.descriptions5 = e[key].confirm_value?e[key].confirm_value:e[key].textcontent
|
|
|
+ }
|
|
|
+ if (key.includes('与现场协商试运行测试并验收')) {
|
|
|
+ this.text.descriptions6 = e[key].confirm_value?e[key].confirm_value:e[key].textcontent
|
|
|
+ }
|
|
|
+ if (key.includes('现场交代注意事项')) {
|
|
|
+ this.text.descriptions7 = e[key].confirm_value?e[key].confirm_value:e[key].textcontent
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
+ } else {
|
|
|
+ res.data.confirmationcontent.forEach(e => {
|
|
|
+ Object.keys(e).map((key,index)=>{
|
|
|
+ this.text.descriptions4 += e[key].amount
|
|
|
+ if (key.includes('现场培训内容')) {
|
|
|
+ this.text.descriptions1 = e[key].confirm_value
|
|
|
+ }
|
|
|
+ if (key.includes('测试培训效果')) {
|
|
|
+ this.text.descriptions2 = e[key].confirm_value
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
this.detail = res.data
|
|
|
this.signatureName = this.detail.attinfos.filter(e=>{
|
|
|
if (e.usetype === 'signature') {
|
|
|
@@ -406,21 +443,23 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
if (this.signatureName.length) {
|
|
|
- let canvas = document.getElementById('mycanvas')
|
|
|
+ // let canvas = document.getElementById('mycanvas')
|
|
|
// let node = this.$refs.nameImage
|
|
|
- // var CANVAS = document.createElement('canvas')
|
|
|
- // CANVAS.width = 100;
|
|
|
- // CANVAS.height = 100;
|
|
|
- var context = canvas.getContext('2d');
|
|
|
+ let that = this
|
|
|
+ var CANVAS = document.createElement('canvas')
|
|
|
+ CANVAS.width = 100;
|
|
|
+ CANVAS.height = 100;
|
|
|
+ var context = CANVAS.getContext('2d');
|
|
|
var img = new Image();
|
|
|
img.crossOrigin = "anonymous"
|
|
|
img.src = this.signatureName[0].url;
|
|
|
+ // img.src = 'http://localhost:8087/img/wallhaven-0pq8gm.08c576fa.jpeg'
|
|
|
|
|
|
img.onload=function() {
|
|
|
console.log(img);
|
|
|
context.drawImage(img,0,0,100,100 );
|
|
|
- let dataURL = canvas.toDataURL("image/jpg");
|
|
|
- this.$refs.nameImage.src = dataURL
|
|
|
+ let dataURL = CANVAS.toDataURL("image/jpg");
|
|
|
+ that.$refs.nameImage.src = dataURL
|
|
|
}
|
|
|
}
|
|
|
console.log(this.detail)
|
|
|
@@ -429,22 +468,10 @@ export default {
|
|
|
let that = this
|
|
|
domtoimage.toBlob(this.$refs.container)
|
|
|
.then(function (blob) {
|
|
|
- let file = new File([blob], this.detail.workorder.type, { type: blob.type })
|
|
|
- console.log("File对象", file);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // console.log('触发');
|
|
|
- // let blobUrl = window.URL.createObjectURL(blob)
|
|
|
- // let link = document.createElement('a')
|
|
|
- // link.download = that.detail.workorder.type
|
|
|
- // link.style.display = 'none'
|
|
|
- // link.href = blobUrl
|
|
|
- // // 触发点击
|
|
|
- // document.body.appendChild(link)
|
|
|
- // link.click()
|
|
|
- // // 移除
|
|
|
- // document.body.removeChild(link)
|
|
|
+ let file = new File([blob], that.detail.workorder.type, { type: blob.type })
|
|
|
+ that.params.content.filename = that.detail.workorder.type + '.jpg'
|
|
|
+ that.params.content.filetype = 'jpg'
|
|
|
+ that.getUploadUrl(file,'jpg')
|
|
|
})
|
|
|
},
|
|
|
// 获取华为云上传地址
|
|
|
@@ -464,7 +491,7 @@ export default {
|
|
|
let config = {
|
|
|
headers: ext === 'pdf' ? { 'Content-Type': 'application/pdf' } : ext === 'svg'?{ 'Content-Type': 'image/svg+xml' } : { 'Content-Type': 'application/octet-stream' },
|
|
|
}
|
|
|
- const res = await this.$upload.hw_upload(url, file.raw, config)
|
|
|
+ const res = await this.$upload.hw_upload(url, file, config)
|
|
|
this.createFileRecord(obsfilename)
|
|
|
},
|
|
|
|
|
|
@@ -481,6 +508,18 @@ export default {
|
|
|
}
|
|
|
const res = await this.$api.requested(param)
|
|
|
if (res.code === 1) {
|
|
|
+ let res2 = await this.$api.requested({
|
|
|
+ "classname": "system.attachment.Attachment",
|
|
|
+ "method": "createFileLink",
|
|
|
+ "content": {
|
|
|
+ "ownertable": "sa_workorder_confirmation",
|
|
|
+ "ownerid": this.$route.query.id,
|
|
|
+ "usetype": "default",
|
|
|
+ "attachmentids": [
|
|
|
+ res.data.attachmentids[0]
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ })
|
|
|
this.$emit('onSuccess',res)
|
|
|
}
|
|
|
},
|