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