爱心帮扶-职工慰问-慰问类型设置:新增‘是否有领据’选项,如果没有领据,慰问阅览导出附件时就标记为‘已导出’;修复导出后‘是否导出字段’不自动刷新问题;

This commit is contained in:
dd3s_206
2026-09-17 14:46:15 +08:00
parent 3080eaa2cb
commit faac94c6e2
4 changed files with 82 additions and 10 deletions
@@ -113,7 +113,8 @@ public class CondolenceReadCon {
be.unionname be_unionname,
state.state_name,
state.state_color,
type.`code`
type.`code`,
type.hasReceipt AS has_receipt
FROM
condolence con
LEFT JOIN `user` be ON con.be_user = be.id
@@ -375,6 +376,7 @@ public class CondolenceReadCon {
type.`name` AS type_name,
type.money,
type.`code` typeCode,
type.hasReceipt AS has_receipt,
c.remark,
c.deadImmediateFamily,
c.inpatientSurgicalName,
@@ -402,6 +404,10 @@ public class CondolenceReadCon {
sql.setParam("id", id);
NutMap nutMap = condolenceService.fetch(sql);
if (nutMap.get("has_receipt") != null && !nutMap.getBoolean("has_receipt")) {
return;
}
if (StrUtil.isNotBlank(nutMap.getString("lkrSignData"))) {
try {
nutMap.put("lkr", ViTool.poiBase64Image7030(nutMap.getString("lkrSignData")));
@@ -451,6 +457,8 @@ public class CondolenceReadCon {
nutMap.put("detail", username + "其它慰问");
} else if (typeCode.equals("J")) {
nutMap.put("detail", username + "取环慰问");
} else {
nutMap.put("detail", username + nutMap.getString("type_name"));
}
double m = nutMap.getDouble("money");
String cm = Convert.digitToChinese(m);
@@ -461,7 +469,8 @@ public class CondolenceReadCon {
try {
String fileName = nutMap.getString("unionname") + nutMap.getString("detail") + "领据";
response.addHeader("Content-Type", "application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
response.addHeader("Content-Disposition", "attachment;filename="
+ URLEncoder.encode(fileName + ".docx", StandardCharsets.UTF_8));
ServletOutputStream outputStream = response.getOutputStream();
Configure config = Configure.newBuilder().build();
XWPFTemplate.compile(officeTemplateUtil.getPath("condolenceDocument2"), config).render(nutMap).writeAndClose(response.getOutputStream());
@@ -574,6 +583,7 @@ public class CondolenceReadCon {
bwwr.username AS bwwrname,
bwwr.unionname,
type.`name` AS type_name,
type.hasReceipt AS has_receipt,
c.files
FROM
`condolence` c
@@ -602,9 +612,13 @@ public class CondolenceReadCon {
zipOutputStream.write(bytes, 0, bytes.length);
zipOutputStream.closeEntry();
}
zipOutputStream.finish();
response.flushBuffer();
}
zipOutputStream.finish();
if (condolence.get("has_receipt") != null && !condolence.getBoolean("has_receipt")) {
condolenceService.update(Chain.make("isExport", 1), Cnd.where("id", "=", id));
}
response.flushBuffer();
} catch (Exception e) {
e.printStackTrace();
}
@@ -57,6 +57,11 @@ public class CondolenceType {
@ColDefine(type = ColType.BOOLEAN)
private Boolean isUploadFile;
@Column
@Comment("是否有领据")
@ColDefine(type = ColType.BOOLEAN)
private Boolean hasReceipt;
@Column
@Comment("上传附件说明")
@ColDefine(type = ColType.VARCHAR,width = 200)
@@ -66,6 +66,15 @@ layout("/layouts/platform.html"){
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="是否有领据"
show-overflow-tooltip
prop="hasReceipt">
<template scope="{row}">
<span v-if="row.hasReceipt != false" class="text-success">是</span>
<span v-else class="text-danger">否</span>
</template>
</el-table-column>
<el-table-column label="是否禁用" prop="isDisabled" header-align="center"
align="center">
<template scope="{row}">
@@ -152,6 +161,13 @@ layout("/layouts/platform.html"){
</el-radio-group>
</el-form-item>
<el-form-item label="是否有领据" prop="hasReceipt">
<el-radio-group v-model="formData.hasReceipt">
<el-radio-button :label="true">是</el-radio-button>
<el-radio-button :label="false">否</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="上传附件说明" prop="uploadFileDesc" v-if="formData.isUploadFile">
<el-input v-model="formData.uploadFileDesc" type="textarea" :rows="3" maxlength="200"
show-word-limit clearable></el-input>
@@ -239,6 +255,7 @@ layout("/layouts/platform.html"){
openAdd() {
this.formData = {
isUploadFile: true,
hasReceipt: true,
goodsAlbum: []
}
this.dialogVisible = true
@@ -315,6 +332,9 @@ layout("/layouts/platform.html"){
if (code == 0) {
this.formData = data
this.$set(this.formData, 'goodsAlbum', data.goodsAlbum || [])
if (data.hasReceipt == null) {
this.$set(this.formData, 'hasReceipt', true)
}
this.dialogVisible = true
if (this.$refs['form']) {
this.$refs['form'].resetFields()
@@ -142,7 +142,8 @@ layout("/layouts/platform.html"){
<el-table-column align="center" prop="state_id" header-align="center"
label="是否导出" sortable>
<template scope="scope">
<span v-if="scope.row.exportdocumentno" class="text-success">
<span v-if="scope.row.exportdocumentno || (scope.row.has_receipt == false && scope.row.isexport)"
class="text-success">
是
</span>
<span v-else class="text-danger">否</span>
@@ -162,7 +163,8 @@ layout("/layouts/platform.html"){
<el-dropdown-item :command="{type:'view',data:row}">
查看
</el-dropdown-item>
<el-dropdown-item :command="{type:'exportReceipt',data:row}">
<el-dropdown-item v-if="row.has_receipt != false"
:command="{type:'exportReceipt',data:row}">
导出领据
</el-dropdown-item>
<el-dropdown-item :command="{type:'exportFiles',data:row}">
@@ -230,13 +232,44 @@ layout("/layouts/platform.html"){
} else if (type == 'Print') {
condolence.doPrint(data.id)
} else if (type == 'exportReceipt') {
if (!['D', 'E', 'F', 'G', 'H', 'I', 'J'].includes(data.code)) {
this.notifyWarning('只有住院和去世类型才可导出领据')
if (data.has_receipt == false) {
this.notifyWarning('该慰问类型没有领据')
return
}
window.open(loc() + '/exportReceipt?id=' + data.id)
this.downloadAndRefresh(loc() + '/exportReceipt?id=' + data.id, '慰问领据.docx')
} else if (type == 'exportFiles') {
window.open(loc() + '/exportFiles?id=' + data.id)
this.downloadAndRefresh(loc() + '/exportFiles?id=' + data.id, '申请附件.zip')
}
},
async downloadAndRefresh(url, defaultFileName) {
const loading = this.$loading({
lock: true,
text: '正在导出,请稍候',
spinner: 'el-icon-loading'
})
try {
const response = await axios.get(url, {responseType: 'blob'})
const disposition = response.headers['content-disposition'] || ''
let fileName = disposition.includes('filename=')
? disposition.substring(disposition.indexOf('filename=') + 9).replace(/"/g, '')
: defaultFileName
fileName = decodeURIComponent(fileName.replace(/\+/g, ' '))
const downloadUrl = window.URL.createObjectURL(response.data)
const link = document.createElement('a')
link.href = downloadUrl
link.download = fileName
link.style.display = 'none'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(downloadUrl)
this.pageData()
} catch (e) {
this.notifyError('导出失败')
} finally {
loading.close()
}
},
doExportSummary() {