修复bug
This commit is contained in:
@@ -627,8 +627,12 @@
|
|||||||
this.isShowPreview = true
|
this.isShowPreview = true
|
||||||
},
|
},
|
||||||
|
|
||||||
getHtml() {
|
getHtml(template, printData) {
|
||||||
return this.elementToString(this.hiprintTemplate.getHtml(this.printData))
|
this.hiprintTemplate = newHiprintPrintTemplate('temulables')
|
||||||
|
|
||||||
|
this.hiprintTemplate.update(template)
|
||||||
|
const html = this.elementToString(this.hiprintTemplate.getHtml(printData))
|
||||||
|
return html
|
||||||
},
|
},
|
||||||
|
|
||||||
clearPaper() {
|
clearPaper() {
|
||||||
|
|||||||
@@ -64,24 +64,31 @@
|
|||||||
style="margin-top: 8px;"
|
style="margin-top: 8px;"
|
||||||
@getList="getList"
|
@getList="getList"
|
||||||
:loading="isLoading">
|
: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 }">
|
<template v-slot="{ row }">
|
||||||
<div class="table-options">
|
<div class="table-options">
|
||||||
<el-button type="text" @click="toAddSku(row.id)">管理SKU</el-button>
|
<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="toAdd(row.id)">编辑</el-button>
|
||||||
<el-button type="text" @click="remove(row.id)">删除</el-button>
|
<el-button type="text" @click="remove(row.id)">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</ai-table>
|
</ai-table>
|
||||||
|
<Print ref="printRef" :isPrint="true"></Print>
|
||||||
</template>
|
</template>
|
||||||
</ai-list>
|
</ai-list>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Print from '@/components/print/Print'
|
||||||
export default {
|
export default {
|
||||||
name: 'PringTemplate',
|
name: 'PringTemplate',
|
||||||
|
|
||||||
|
components: {
|
||||||
|
Print
|
||||||
|
},
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
colConfigs: [
|
colConfigs: [
|
||||||
@@ -111,6 +118,24 @@
|
|||||||
this.$router.push(`/addLabelsTemplate?id=${id}`)
|
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) {
|
toAddSku (id) {
|
||||||
this.$router.push(`/skuManage?id=${id}`)
|
this.$router.push(`/skuManage?id=${id}`)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user