修复bug
This commit is contained in:
@@ -627,8 +627,12 @@
|
||||
this.isShowPreview = true
|
||||
},
|
||||
|
||||
getHtml() {
|
||||
return this.elementToString(this.hiprintTemplate.getHtml(this.printData))
|
||||
getHtml(template, printData) {
|
||||
this.hiprintTemplate = newHiprintPrintTemplate('temulables')
|
||||
|
||||
this.hiprintTemplate.update(template)
|
||||
const html = this.elementToString(this.hiprintTemplate.getHtml(printData))
|
||||
return html
|
||||
},
|
||||
|
||||
clearPaper() {
|
||||
|
||||
@@ -64,24 +64,31 @@
|
||||
style="margin-top: 8px;"
|
||||
@getList="getList"
|
||||
:loading="isLoading">
|
||||
<el-table-column slot="options" label="操作" align="center" fixed="right" width="220px">
|
||||
<el-table-column slot="options" label="操作" align="center" fixed="right" width="240px">
|
||||
<template v-slot="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" @click="toAddSku(row.id)">管理SKU</el-button>
|
||||
<el-button type="text" @click="savePDF(row.id)">保存PDF</el-button>
|
||||
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
|
||||
<el-button type="text" @click="remove(row.id)">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
<Print ref="printRef" :isPrint="true"></Print>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Print from '@/components/print/Print'
|
||||
export default {
|
||||
name: 'PringTemplate',
|
||||
|
||||
components: {
|
||||
Print
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
colConfigs: [
|
||||
@@ -111,6 +118,24 @@
|
||||
this.$router.push(`/addLabelsTemplate?id=${id}`)
|
||||
},
|
||||
|
||||
savePDF (id) {
|
||||
this.isLoading = true
|
||||
|
||||
this.$http.post(`/api/template/detail?id=${id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
const template = JSON.parse(res.data.content)
|
||||
|
||||
this.$http.post(`/api/templateSku/getPage?size=-1&templateId=${id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
const html = this.$refs.printRef.toPrint(template, res.data.records)
|
||||
console.log(html)
|
||||
this.isLoading = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toAddSku (id) {
|
||||
this.$router.push(`/skuManage?id=${id}`)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user