|
|
@@ -8,7 +8,8 @@ export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
tenantId: '', |
|
|
|
printData: [], |
|
|
|
templateId: '', |
|
|
|
// printData: [], |
|
|
|
value: { |
|
|
|
title: 'demo', |
|
|
|
width: 750, |
|
|
@@ -52,20 +53,20 @@ export default { |
|
|
|
.then(res => { |
|
|
|
console.log(res, 'res') |
|
|
|
if (res.data.code == 200) { |
|
|
|
this.$message.success("新增成功!") |
|
|
|
this.$router.back() |
|
|
|
this.$message.success("保存成功!") |
|
|
|
// this.$router.back() |
|
|
|
} else { |
|
|
|
this.$message.error("新增失败!") |
|
|
|
this.$message.error("保存失败!") |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.error(err); |
|
|
|
this.$message.error("新增失败!") |
|
|
|
this.$message.error("保存失败!") |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
getWidgets() { |
|
|
|
const url = baseUrl + "/print/printDatas?type=2" |
|
|
|
getWidgets(type) { |
|
|
|
const url = baseUrl + `/print/printDatas?type=${type}` |
|
|
|
this.$axios.get(url) |
|
|
|
.then(res => { |
|
|
|
console.log(res, 'res') |
|
|
@@ -83,15 +84,33 @@ export default { |
|
|
|
.catch(err => { |
|
|
|
console.error(err); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
getPrintData(tenantId, templateId) { |
|
|
|
const url = baseUrl + `/print/getTemplate?tenantId=${tenantId}&templateId=${templateId}` |
|
|
|
this.$axios.get(url) |
|
|
|
.then(res => { |
|
|
|
console.log(res, 'res') |
|
|
|
this.value = res.data.data.contentJson |
|
|
|
if (!this.value.tempItems || !this.value.tempItems.length) { |
|
|
|
this.value.tempItems = [] |
|
|
|
} |
|
|
|
this.getWidgets(this.value.type) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.error(err); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
created() { |
|
|
|
this.printData = this.$route.query.printData |
|
|
|
// this.printData = this.$route.query.printData |
|
|
|
this.tenantId = this.$route.query.tenantId |
|
|
|
this.templateId = this.$route.query.templateId |
|
|
|
try { |
|
|
|
this.value = this.printData |
|
|
|
this.getWidgets(this.value.type) |
|
|
|
// this.value = this.printData |
|
|
|
// this.getWidgets(this.value.type) |
|
|
|
this.getPrintData(this.tenantId, this.templateId) |
|
|
|
} catch (err) { |
|
|
|
console.error(err) |
|
|
|
} |
|
|
|