md
This commit is contained in:
parent
ff00d1d485
commit
248166b74a
@ -93,15 +93,12 @@ export default {
|
||||
this.$emit('reset')
|
||||
},
|
||||
resetForm() {
|
||||
console.log("hhhhhh1==>resetForm11");
|
||||
if (this.$refs["searchForm"]) {
|
||||
this.$refs["searchForm"].resetFields();
|
||||
}
|
||||
},
|
||||
resetFields(){
|
||||
console.log("hhhhhh1==>resetFields111");
|
||||
if (this.$refs["searchForm"]) {
|
||||
console.log("hhhhhh1==>resetFields222");
|
||||
this.$refs["searchForm"].resetFields();
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,24 +43,24 @@ export default class PdfUtils {
|
||||
await fs.promises.writeFile(outputPath, modifiedPdfBytes);
|
||||
}
|
||||
|
||||
async getPdfByTpl(tplBase64Data, data) {
|
||||
const templateBytes = await fs.promises.readFile(templatePath);
|
||||
pdfDoc = await PDFDocument.load(templateBytes);
|
||||
async getPdfByTpl(tplStr, params) {
|
||||
const tplBase64Str = 'data:application/pdf;base64,' + tplStr
|
||||
pdfDoc = await PDFDocument.load(tplBase64Str);
|
||||
pdfDoc.registerFontkit(fontkit);
|
||||
font = await pdfDoc.embedFont(fontBytes);
|
||||
const form = pdfDoc.getForm();
|
||||
|
||||
for (const fieldKey in data) {
|
||||
const field = form.getTextField(fieldKey);
|
||||
for (const field in params) {
|
||||
const field = form.getTextField(field);
|
||||
if (field) {
|
||||
field.setText(data[fieldKey]);
|
||||
field.setText(data[field]);
|
||||
field.updateAppearances(font)
|
||||
}
|
||||
}
|
||||
const uint8Array = await newPdf.save();
|
||||
let mergeBuffer = Buffer.from(uint8Array);
|
||||
|
||||
const modifiedPdfBytes = await pdfDoc.save();
|
||||
var blob=new Blob([mergeBuffer]);
|
||||
|
||||
await fs.promises.writeFile(outputPath, modifiedPdfBytes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -46,10 +46,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
|
||||
</search-form>
|
||||
|
||||
|
||||
@ -424,6 +421,12 @@ export default {
|
||||
handleShowMoreInput(){
|
||||
this.moreInputVisible = !this.moreInputVisible;
|
||||
},
|
||||
// 排序 查询字段是表格中字段名字 动态取值排序顺序
|
||||
handleSortChange(column) {
|
||||
this.queryParams.orderByColumn = column.prop;
|
||||
this.queryParams.isAsc = column.order;
|
||||
this.getList();
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user