|
@@ -588,9 +588,9 @@
|
|
|
pageType: '',
|
|
|
isDDPrint: false,
|
|
|
isEWPrint: false,
|
|
|
- imgUrl: ""
|
|
|
+ imgUrl: "",
|
|
|
+ serverIp: ""
|
|
|
},
|
|
|
- computed: {},
|
|
|
methods: {
|
|
|
tableRowClassName({
|
|
|
row,
|
|
@@ -617,26 +617,32 @@
|
|
|
printSmall() { },
|
|
|
printBig() { },
|
|
|
closeDialog() {
|
|
|
- if (this.tableData.length == 1) {//this.tableData 条数为1 认为单个打印
|
|
|
+ var that = this
|
|
|
+ if (location.host == "www.eliangeyun.com") {
|
|
|
+ that.serverIp = "https://api2.eliangeyun.com"
|
|
|
+ } else {
|
|
|
+ that.serverIp = localStorage.getItem("serverIp")
|
|
|
+ }
|
|
|
+ if (that.tableData.length == 1) {//this.tableData 条数为1 认为单个打印
|
|
|
html2canvas(document.querySelector("#saveImg"), { foreignObjectRendering: true, allowTaint: true }).then((canvas) => {
|
|
|
let dataURL = canvas.toDataURL('image/png')
|
|
|
- this.imgUrl = dataURL
|
|
|
- if (this.imgUrl !== '') {
|
|
|
- let b = this.dataURLtoFile(this.imgUrl, 'printImage')
|
|
|
+ that.imgUrl = dataURL
|
|
|
+ if (that.imgUrl !== '') {
|
|
|
+ let b = that.dataURLtoFile(that.imgUrl, 'printImage')
|
|
|
let formdata = new FormData()
|
|
|
formdata.append('file', b)
|
|
|
axios({
|
|
|
method: 'post',
|
|
|
- url: "http://192.168.110.9:9888/appendix/admin",
|
|
|
+ url: "https://api2.eliangeyun.com/appendix/admin",
|
|
|
data: formdata,
|
|
|
}).then((response) => {
|
|
|
// 编辑接口
|
|
|
- this.weighingList = this.tableData[0]
|
|
|
- this.weighingList.pictureAddress = response.data.data.url
|
|
|
+ that.weighingList = that.tableData[0]
|
|
|
+ that.weighingList.pictureAddress = response.data.data.url
|
|
|
axios({//皮重检斤接口
|
|
|
method: 'post',
|
|
|
- url: "http://192.168.110.9:9888/weighingManagement/api/editTare",
|
|
|
- data: this.weighingList,
|
|
|
+ url: that.serverIp + "/weighingManagement/api/editTare",
|
|
|
+ data: that.weighingList,
|
|
|
}).then((response) => {//入库单截图上传成功
|
|
|
})
|
|
|
})
|
|
@@ -644,9 +650,39 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ // async getImgBase64() {
|
|
|
+ // var that = this
|
|
|
+ // let ele = document.querySelector("#saveImg")
|
|
|
+ // const width = ele.offsetWidth
|
|
|
+ // const height = ele.offsetHeight
|
|
|
+ // let canvas = await html2canvas(ele, {
|
|
|
+ // scale: 2,
|
|
|
+ // width,
|
|
|
+ // height,
|
|
|
+ // backgroundColor: "red",
|
|
|
+ // foreignObjectRendering:true,
|
|
|
+ // allowTaint:true
|
|
|
+ // })
|
|
|
+ // let dataURL = canvas.toDataURL('image/png')
|
|
|
+ // that.imgUrl = dataURL
|
|
|
+ // if (that.imgUrl !== '') {
|
|
|
+ // let b = that.dataURLtoFile(that.imgUrl, 'printImage')
|
|
|
+ // let formdata = new FormData()
|
|
|
+ // formdata.append('file', b)
|
|
|
+ // document.body.appendChild(canvas)
|
|
|
+ // // axios({
|
|
|
+ // // method: 'post',
|
|
|
+ // // url: "https://api2.eliangeyun.com/appendix/admin",
|
|
|
+ // // data: formdata,
|
|
|
+ // // }).then((response) => {
|
|
|
+ // // debugger
|
|
|
+ // // })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
},
|
|
|
updated() {
|
|
|
this.closeDialog()
|
|
|
+ // this.getImgBase64()
|
|
|
},
|
|
|
mounted() {
|
|
|
let _data = {}
|
|
@@ -683,13 +719,12 @@
|
|
|
this.tableData = JSON.parse(_data.replace(/baifenhao/g, '%'))
|
|
|
}
|
|
|
// sessionStorage.setItem('record_print', JSON.stringify(response))
|
|
|
- // this.tableData = JSON.parse(sessionStorage.getItem("record_print"))
|
|
|
-
|
|
|
+ // this.tableData = JSON.parse(sessionStorage.getItem("record_print")
|
|
|
document.title = "粮食检斤单"
|
|
|
- window.print()
|
|
|
window.onafterprint = function (event) {
|
|
|
window.history.back(-1)
|
|
|
};
|
|
|
+ window.print()
|
|
|
},
|
|
|
watch: {}
|
|
|
})
|