diff --git a/src/main/java/io/v/nutz/zgfw/controller/condolence/CondolenceReadCon.java b/src/main/java/io/v/nutz/zgfw/controller/condolence/CondolenceReadCon.java
index 86b4e92..bd3512c 100644
--- a/src/main/java/io/v/nutz/zgfw/controller/condolence/CondolenceReadCon.java
+++ b/src/main/java/io/v/nutz/zgfw/controller/condolence/CondolenceReadCon.java
@@ -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();
}
diff --git a/src/main/java/io/v/nutz/zgfw/model/condolence/CondolenceType.java b/src/main/java/io/v/nutz/zgfw/model/condolence/CondolenceType.java
index a0df335..71758ef 100644
--- a/src/main/java/io/v/nutz/zgfw/model/condolence/CondolenceType.java
+++ b/src/main/java/io/v/nutz/zgfw/model/condolence/CondolenceType.java
@@ -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)
diff --git a/src/main/resources/views/platform/zgfw/condolence/TypeMange.html b/src/main/resources/views/platform/zgfw/condolence/TypeMange.html
index f12da87..4c210b4 100644
--- a/src/main/resources/views/platform/zgfw/condolence/TypeMange.html
+++ b/src/main/resources/views/platform/zgfw/condolence/TypeMange.html
@@ -66,6 +66,15 @@ layout("/layouts/platform.html"){
+
+
+ 是
+ 否
+
+
+
@@ -152,6 +161,13 @@ layout("/layouts/platform.html"){
+
+
+ 是
+ 否
+
+
+
@@ -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()
diff --git a/src/main/resources/views/platform/zgfw/condolence/read.html b/src/main/resources/views/platform/zgfw/condolence/read.html
index 979eb34..dc75369 100644
--- a/src/main/resources/views/platform/zgfw/condolence/read.html
+++ b/src/main/resources/views/platform/zgfw/condolence/read.html
@@ -142,7 +142,8 @@ layout("/layouts/platform.html"){
-
+
是
否
@@ -162,7 +163,8 @@ layout("/layouts/platform.html"){
查看
-
+
导出领据
@@ -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() {