【新增】模板库

This commit is contained in:
yanran200730
2024-10-28 22:09:57 +08:00
parent 8225f21d14
commit 6618242f7f
5 changed files with 147 additions and 38 deletions

View File

@@ -95,6 +95,7 @@
<el-button slot="reference" size="small" :type="'other' == curPaperType ? 'primary' : ''">自定义纸张</el-button>
</el-popover>
</el-button-group>
<el-button @click="isShowTemplate = true" type="warning" size="small" style="margin-left: 10px;">模板库</el-button>
</div>
</div>
<div class="center-wrapper">
@@ -180,6 +181,28 @@
</el-form-item>
</el-form>
</ai-dialog>
<ai-dialog :visible.sync="isShowTemplate" title="模板库" width="960" customFooter>
<ai-table
:tableData="templateList"
:col-configs="templateColConfigs"
:total="templateTotal"
:current.sync="searchTemplate.current"
:size.sync="searchTemplate.size"
style="margin-top: 8px;"
height="400"
@getList="getTemplateList">
<el-table-column slot="options" label="操作" align="center">
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" @click="updateTempate(row), isShowTemplate = false">使用</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<div class="dialog-footer" slot="footer">
<el-button @click="isShowImage = false">取消</el-button>
</div>
</ai-dialog>
</div>
</template>
@@ -249,6 +272,8 @@
html: '',
isShowPreview: false,
hiprintTemplate: null,
isShowTemplate: false,
templateList: [],
curPaper: {
type: 'other',
width: 200,
@@ -279,9 +304,18 @@
size: 10,
type: 1
},
searchTemplate: {
current: 1,
size: 10,
type: 1
},
templateTotal: 0,
isShowImage: false,
tableData: [],
total: 0
total: 0,
templateColConfigs: [
{ prop: 'name', label: '模板名称', align: 'center' }
]
}
},
@@ -342,6 +376,8 @@
this.buildLeftElement()
this.buildDesigner()
this.getConfig()
this.getTemplateList()
}
},
@@ -355,14 +391,28 @@
}
this.isShowDynamicForm = true
console.log(this.dynamicFrom)
},
removeField(index) {
this.dynamicFromList.splice(index, 1)
},
updateTempate(row) {
this.hiprintTemplate.update(JSON.parse(row.content))
},
getTemplateList() {
this.$http.post(`/api/templateRecommend/getRecommendPage`, null, {
params: this.searchTemplate
}).then(res => {
if (res.code === 0) {
this.templateList = res.data.records
this.templateTotal = res.data.total
}
})
},
getConfig() {
this.$http.post(`/api/material/getPage?current=${this.search.current}&size=${this.search.size}&type=${this.search.type}`).then(res => {
if (res.code === 0) {