From 790e8e9f5052d1a75a1b8be318e11e0df9bed56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=8C=E5=85=88=E8=88=9C?= <2499071264@qq.com> Date: Sat, 31 Oct 2026 14:36:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=89=B9=E6=AE=8A=E6=85=B0=E9=97=AE-?= =?UTF-8?q?=E8=81=8C=E5=B7=A5=E6=85=B0=E9=97=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CondolenceReadController.java | 21 ++++++++++ .../SpecialCondolenceApplyController.java | 15 +++---- .../SpecialCondolenceReadController.java | 1 + .../service/SpecialCondolenceRecipients.java | 33 ++++++++------- .../service/SpecialCondolenceService.java | 1 + .../impl/SpecialCondolenceServiceImpl.java | 41 +++++++++++++++---- .../20261031/职工慰问_慰问预览菜单权限.sql | 7 ++++ .../specialcondolence/apply/config.html | 2 +- .../specialcondolence/apply/index.html | 27 ++++++++---- .../specialcondolence/apply/recipients.css | 2 + .../specialcondolence/apply/recipients.html | 4 +- .../specialcondolence/apply/recipients.js | 11 +++-- .../specialcondolence/read/index.html | 2 +- .../specialcondolence/apply/index.html | 10 ++--- 14 files changed, 121 insertions(+), 56 deletions(-) create mode 100644 src/main/resources/db/script/20261031/职工慰问_慰问预览菜单权限.sql diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/condolence/controller/CondolenceReadController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/condolence/controller/CondolenceReadController.java index 033776e..fbe7e4f 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/condolence/controller/CondolenceReadController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/condolence/controller/CondolenceReadController.java @@ -14,6 +14,8 @@ import com.budwk.app.base.utils.PageUtil; import com.budwk.app.flow.entity.ProcessInstance; import com.budwk.app.flow.enums.ProcessInstanceStateEnum; import com.budwk.app.sys.param.SysMsgSummaryPageForm; +import com.budwk.app.web.commons.auth.utils.AuthUtil; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; import com.budwk.app.zhgh.staffbenefit.condolence.model.Condolence; import com.budwk.app.zhgh.staffbenefit.condolence.service.CondolenceService; import io.swagger.annotations.Api; @@ -96,6 +98,7 @@ public class CondolenceReadController { cnd.andEX("YEAR(info.createTime)", "=", year); cnd.andEX("info.applyUnionId", "=", unionId); cnd.andEX("info.applyUnitId", "=", unitId); + applyReadScope(cnd, "info"); if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { SqlExpressionGroup seg = new SqlExpressionGroup(); @@ -142,6 +145,7 @@ public class CondolenceReadController { cnd.andEX("YEAR(con.createTime)", "=", year); cnd.andEX("con.applyUnionId", "=", unionId); cnd.andEX("con.applyUnitId", "=", unitId); + applyReadScope(cnd, "con"); if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { SqlExpressionGroup seg = new SqlExpressionGroup(); seg.or("con.helpUserName", "like", "%" + pageForm.getSearchKeyword() + "%"); @@ -166,4 +170,21 @@ public class CondolenceReadController { Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list); CommonDownloadUtil.download("申报人汇总.xlsx", workbook, response); } + + private void applyReadScope(Cnd cnd, String alias) { + if (AuthUtil.hasPermission("all_school")) { + return; + } + if (AuthUtil.hasPermission("branch_union")) { + String unionId = SecurityUtil.getUnionId(); + if (StrUtil.isNotBlank(unionId)) { + cnd.and(alias + ".applyUnionId", "=", unionId); + return; + } + } else if (AuthUtil.hasPermission("self")) { + cnd.and(alias + ".createdBy", "=", SecurityUtil.getUserId()); + return; + } + cnd.and("1", "=", 0); + } } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/controller/SpecialCondolenceApplyController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/controller/SpecialCondolenceApplyController.java index ba6f725..2b58ab4 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/controller/SpecialCondolenceApplyController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/controller/SpecialCondolenceApplyController.java @@ -83,7 +83,7 @@ public class SpecialCondolenceApplyController { public Result save(@Param("data") SpecialCondolence specialcondolence) { if(StrUtil.isBlank(specialcondolence.getId())) specialcondolence.setCreateTime(DateUtil.now()); prepareApplication(specialcondolence); - specialcondolenceService.saveApplication(specialcondolence); + specialcondolenceService.saveDraftApplication(specialcondolence); return Result.success(); } @@ -213,23 +213,20 @@ public class SpecialCondolenceApplyController { for (int r = 1; r <= sheet.getLastRowNum(); r++) { org.apache.poi.ss.usermodel.Row excelRow = sheet.getRow(r); if (excelRow == null) continue; + String prefix = "慰问对象" + (result.size() + 1) + " "; cn.hutool.json.JSONObject row = new cn.hutool.json.JSONObject(); boolean empty = true; for (int c = 0; c < fields.length; c++) { org.apache.poi.ss.usermodel.Cell cell = excelRow.getCell(c); String value = formatter.formatCellValue(cell).trim(); - if (c != 1 && cell != null && cell.getCellType() == org.apache.poi.ss.usermodel.CellType.FORMULA) throw new com.budwk.app.base.exception.BaseException("第" + (r + 1) + "行不支持公式,请填写实际值"); - if ((c == 2 || c == 5) && cell != null && cell.getCellType() == org.apache.poi.ss.usermodel.CellType.NUMERIC) throw new com.budwk.app.base.exception.BaseException("第" + (r + 1) + "行工号、身份证和收款账户请使用文本格式,避免数字失真"); + if (c != 1 && cell != null && cell.getCellType() == org.apache.poi.ss.usermodel.CellType.FORMULA) throw new com.budwk.app.base.exception.BaseException(prefix + "不支持公式,请填写实际值"); + if ((c == 2 || c == 5) && cell != null && cell.getCellType() == org.apache.poi.ss.usermodel.CellType.NUMERIC) throw new com.budwk.app.base.exception.BaseException(prefix + "工号、身份证和收款账户请使用文本格式,避免数字失真"); row.set(fields[c], value); empty = empty && value.isEmpty(); } if (empty) continue; - for (int c = 0; c < fields.length; c++) { - if (c != 1 && row.getStr(fields[c]).isEmpty()) throw new com.budwk.app.base.exception.BaseException("第" + (r + 1) + "行:请填写" + headers[c]); - } - if (!com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients.validIdCard(row.getStr("idCard"))) throw new com.budwk.app.base.exception.BaseException("第" + (r + 1) + "行身份证号码格式不正确"); - if (!row.getStr("bankCardNumber").matches("[0-9]{6,30}")) throw new com.budwk.app.base.exception.BaseException("第" + (r + 1) + "行收款账户格式不正确"); - com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients.resolveUser(row, dao, "第" + (r + 1) + "行:"); + if (!com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients.validIdCard(row.getStr("idCard"))) throw new com.budwk.app.base.exception.BaseException(prefix + "身份证号码格式不正确"); + if (!row.getStr("bankCardNumber").matches("[0-9]{6,30}")) throw new com.budwk.app.base.exception.BaseException(prefix + "收款账户格式不正确"); result.add(row); } } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/controller/SpecialCondolenceReadController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/controller/SpecialCondolenceReadController.java index 6fe106e..f557898 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/controller/SpecialCondolenceReadController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/controller/SpecialCondolenceReadController.java @@ -71,6 +71,7 @@ public class SpecialCondolenceReadController { Sql sql = Sqls.create(""" SELECT info.*, + (SELECT COUNT(*) FROM special_condolence_recipient recipient WHERE recipient.applyId = info.id AND recipient.delFlag = false) AS recipientCount, ins.id AS instanceId, type.name as typeName, ins.state instanceState, diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/SpecialCondolenceRecipients.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/SpecialCondolenceRecipients.java index 7112600..00e40de 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/SpecialCondolenceRecipients.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/SpecialCondolenceRecipients.java @@ -32,7 +32,7 @@ public final class SpecialCondolenceRecipients { row.set("type", info.getType()); row.set("money", info.getPerMoney().toPlainString()); row.set("occurTime", info.getOccurTime()); - resolveUser(row, dao, prefix); + if (cn.hutool.core.util.StrUtil.isNotBlank(row.getStr("helpUserId"))) resolveUser(row, dao, prefix); String[] fields = {"helpUserName", "type", "idCard", "bankOfDeposit", "bankUserName", "bankCardNumber", "money", "occurTime"}; for (String field : fields) { String value = row.getStr(field); @@ -80,24 +80,27 @@ public final class SpecialCondolenceRecipients { if (cn.hutool.core.util.StrUtil.isNotBlank(userId)) { user = dao.fetch(com.budwk.app.sys.views.View_user.class, org.nutz.dao.Cnd.where("id", "=", userId)); } else { - org.nutz.dao.Cnd identity = org.nutz.dao.Cnd.where("unionId", "=", unionId) - .and("idCard", "=", row.getStr("idCard")).and("username", "=", row.getStr("helpUserName")); - java.util.List dispatched = dao.query(com.budwk.app.sys.views.View_user.class, - identity.and("personType", "=", "劳务派遣人员")); - if (dispatched.size() > 1) throw new BaseException(prefix + "劳务派遣人员身份重复,请核对档案"); - if (dispatched.size() == 1) { - user = dispatched.get(0); - } else { - if (cn.hutool.core.util.StrUtil.isBlank(row.getStr("helpLoginName"))) throw new BaseException(prefix + "普通人员必须填写工号"); - java.util.List users = dao.query(com.budwk.app.sys.views.View_user.class, - org.nutz.dao.Cnd.where("unionId", "=", unionId).and("loginname", "=", row.getStr("helpLoginName")) - .and("username", "=", row.getStr("helpUserName")).and("idCard", "=", row.getStr("idCard"))); - if (users.size() != 1) throw new BaseException(prefix + "工号、姓名、身份证不匹配或不属于申请人本工会"); - user = users.get(0); + java.util.List users = dao.query(com.budwk.app.sys.views.View_user.class, + org.nutz.dao.Cnd.where("idCard", "=", row.getStr("idCard")) + .and("username", "=", row.getStr("helpUserName"))); + if (users.isEmpty()) throw new BaseException(prefix + "姓名、身份证与人员档案不匹配"); + java.util.List members = users.stream() + .filter(member -> java.util.Objects.equals(member.getUnionId(), unionId)) + .collect(java.util.stream.Collectors.toList()); + if (members.isEmpty()) throw new BaseException(prefix + "只能选择申请人本工会人员"); + String loginName = row.getStr("helpLoginName"); + if (cn.hutool.core.util.StrUtil.isNotBlank(loginName)) { + members = members.stream().filter(member -> "劳务派遣人员".equals(member.getPersonType()) + || java.util.Objects.equals(member.getLoginname(), loginName)) + .collect(java.util.stream.Collectors.toList()); } + if (members.isEmpty()) throw new BaseException(prefix + "工号与慰问对象不一致"); + if (members.size() > 1) throw new BaseException(prefix + "人员身份重复,请核对档案"); + user = members.get(0); } if (user == null) throw new BaseException(prefix + "慰问对象不存在"); if (!java.util.Objects.equals(user.getUnionId(), unionId)) throw new BaseException(prefix + "只能选择申请人本工会人员"); + if (!"劳务派遣人员".equals(user.getPersonType()) && cn.hutool.core.util.StrUtil.isBlank(row.getStr("helpLoginName"))) throw new BaseException(prefix + "普通人员必须填写工号"); if (!"劳务派遣人员".equals(user.getPersonType()) && (cn.hutool.core.util.StrUtil.isBlank(row.getStr("helpLoginName")) || !java.util.Objects.equals(user.getLoginname(), row.getStr("helpLoginName")))) throw new BaseException(prefix + "工号与慰问对象不一致"); if (cn.hutool.core.util.StrUtil.isNotBlank(user.getIdCard()) && !user.getIdCard().equalsIgnoreCase(row.getStr("idCard"))) throw new BaseException(prefix + "身份证号码与所选人员不一致"); row.set("helpUserId", user.getId()); diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/SpecialCondolenceService.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/SpecialCondolenceService.java index 8c6eb97..e86afff 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/SpecialCondolenceService.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/SpecialCondolenceService.java @@ -12,6 +12,7 @@ import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolence */ public interface SpecialCondolenceService extends BaseService { void saveApplication(SpecialCondolence info); + void saveDraftApplication(SpecialCondolence info); SpecialCondolence loadApplication(String id); void deleteApplication(String id); } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/impl/SpecialCondolenceServiceImpl.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/impl/SpecialCondolenceServiceImpl.java index 50898ea..084cf57 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/impl/SpecialCondolenceServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/specialcondolence/service/impl/SpecialCondolenceServiceImpl.java @@ -3,6 +3,7 @@ package com.budwk.app.zhgh.staffbenefit.specialcondolence.service.impl; import com.budwk.app.base.service.impl.BaseServiceImpl; import com.budwk.app.zhgh.staffbenefit.specialcondolence.model.SpecialCondolenceRecipient; import com.budwk.app.zhgh.staffbenefit.specialcondolence.service.SpecialCondolenceRecipients; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import org.nutz.ioc.aop.Aop; @@ -35,6 +36,28 @@ public class SpecialCondolenceServiceImpl extends BaseServiceImpl()); + info.getRecipients().removeIf(row -> row == null || java.util.stream.Stream.of( + "helpUserId", "helpUserName", "helpLoginName", "idCard", "bankOfDeposit", "bankUserName", "bankCardNumber") + .allMatch(field -> StrUtil.isBlank(row.getStr(field)))); + for (JSONObject row : info.getRecipients()) { + row.set("type", info.getType()); + row.set("typeCode", info.getTypeCode()); + row.set("way", info.getWay()); + row.set("money", info.getPerMoney()); + row.set("occurTime", info.getOccurTime()); + } + info.setMoney(info.getPerMoney() == null ? null : info.getPerMoney().multiply(BigDecimal.valueOf(info.getRecipients().size())).doubleValue()); + persistApplication(info); + } + + private void persistApplication(SpecialCondolence info) { dao().insertOrUpdate(info); dao().clear(SpecialCondolenceRecipient.class, Cnd.where("applyId", "=", info.getId())); @@ -42,20 +65,20 @@ public class SpecialCondolenceServiceImpl extends BaseServiceImpl - + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/index.html index c64602b..c933b40 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/index.html @@ -51,7 +51,7 @@ layout("/layouts/platform.html"){ - + @@ -205,8 +205,6 @@ layout("/layouts/platform.html"){ } }, onSave() { - this.$refs.formRef.validate((valid, invalidFields) => { - if (!valid) { this.showInvalidApplicationTab(invalidFields); return } this.$confirm("您确定保存吗?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", @@ -219,11 +217,23 @@ layout("/layouts/platform.html"){ } }) }) - }) + }, + async validateApplication(callback) { + const form = this.$refs.formRef + const fields = form.fields.filter(field => field.prop && !field.prop.startsWith('recipients')) + const results = await Promise.all(fields.map(field => new Promise(resolve => { + field.validate('', message => resolve(!message)) + }))) + if (results.some(valid => !valid)) { + this.activeApplicationTab = 'form' + this.$message.error('请完善基础信息的必填信息') + return + } + if (!this.ensureApplicationRecipients()) return + form.validate(callback) }, onSubmit() { - if (!this.ensureApplicationRecipients()) return - this.$refs.formRef.validate((valid, invalidFields) => { + this.validateApplication((valid, invalidFields) => { if (!valid) { this.showInvalidApplicationTab(invalidFields); return } if (valid) { this.$confirm("您确定要提交吗?", "提示", { @@ -244,8 +254,7 @@ layout("/layouts/platform.html"){ }) }, onFinishTask() { - if (!this.ensureApplicationRecipients()) return - this.$refs.formRef.validate((valid, invalidFields) => { + this.validateApplication((valid, invalidFields) => { if (!valid) { this.showInvalidApplicationTab(invalidFields); return } if (valid) { this.$confirm("您确定要提交吗?", "提示", { @@ -275,7 +284,7 @@ layout("/layouts/platform.html"){ this.selectQueryUser(this.formData.helpLoginName, this.helpUserOptions) this.selectQueryUser(this.formData.certifierLoginName, this.certifierUserOptions) this.selectQueryUser(this.formData.handlerLoginName, this.handlerUserOptions) - this.chooseType = this.typeOptions.find(o => o.id === this.formData.type) + this.chooseType = this.typeOptions.find(o => o.id === this.formData.type) || {} } }) } else { diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.css b/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.css index 31fb55e..176ab48 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.css +++ b/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.css @@ -65,3 +65,5 @@ .special-condolence-apply .flow-task-form .el-form-item__error { color: #f56c6c !important; } .special-condolence-apply .el-form-item.is-error .el-input__inner, .special-condolence-apply .el-form-item.is-error .el-textarea__inner { border-color: #f56c6c; } + +.special-condolence-apply .flow-task-form .special-condolence-signature-item .el-form-item__error { position: static; padding-top: 6px; line-height: 20px; white-space: normal; } diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.html b/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.html index 6846e35..11f0d89 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.html @@ -8,8 +8,8 @@ - - + + diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.js b/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.js index f26526b..5b4cd52 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.js +++ b/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/apply/recipients.js @@ -34,7 +34,7 @@ const specialCondolenceRecipients = { }, ensureApplicationRecipients() { const rows = this.formData.recipients - if (!Array.isArray(rows) || rows.length === 0 || rows.some(row => !row || !String(row.helpUserId || '').trim())) { + if (!Array.isArray(rows) || rows.length === 0 || rows.some(row => !row || !String(row.helpUserId || row.helpUserName || '').trim())) { this.activeApplicationTab = 'recipients' this.notifyRecipientError('请先选择慰问对象,并填写完整信息') return false @@ -95,15 +95,18 @@ const specialCondolenceRecipients = { try { const data = new FormData() data.append('file', request.file) - const result = await this.$axios.post('/platform/special_condolence/apply/importRecipients', data) + const response = await axios.post('/platform/special_condolence/apply/importRecipients', data, { + headers: { 'x-requested-with': 'XMLHttpRequest' } + }) + const result = response.data if (result.code === 0) { const rows = this.formData.recipients.filter(r => r.helpUserName || r.type || r.idCard || r.bankCardNumber || r.bankUserName || r.bankOfDeposit || r.money) this.$set(this.formData, 'recipients', rows.concat(result.data)) this.importVisible = false this.$message.success('导入成功,共' + result.data.length + '人') - } else this.$message.error(result.msg || '导入失败') + } else this.$message.error('导入失败:' + (result.msg || '请检查文件内容后重试')) } catch (error) { - this.$message.error('导入失败,请检查文件内容后重试') + this.$message.error('导入失败:' + (error.response?.data?.msg || error.msg || '请检查文件内容后重试')) } finally { this.importLoading = false } diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/read/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/read/index.html index e88ea1c..8e6f5bc 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/read/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/specialcondolence/read/index.html @@ -110,7 +110,7 @@ layout("/layouts/platform.html"){ {prop: 'applyUnionName', label: '所属工会'}, {prop: 'applyUnitName', label: '所属单位'}, {prop: 'typeName', label: '慰问类型'}, - {prop: 'taskName', label: '当前节点'}, + {prop: 'recipientCount', label: '慰问人数'}, {prop: 'instanceState', label: '流程状态'}, ], unionList: [], diff --git a/src/main/resources/views/platform/zhghh5/staffbenefit/specialcondolence/apply/index.html b/src/main/resources/views/platform/zhghh5/staffbenefit/specialcondolence/apply/index.html index 540490f..fb71fd0 100644 --- a/src/main/resources/views/platform/zhghh5/staffbenefit/specialcondolence/apply/index.html +++ b/src/main/resources/views/platform/zhghh5/staffbenefit/specialcondolence/apply/index.html @@ -197,7 +197,7 @@ layout("/layouts/platform_h5.html"){ - + 删除 - + @@ -340,8 +340,8 @@ layout("/layouts/platform_h5.html"){ }, mobileRecipientRules(field, person) { const names = { helpUserId: '慰问对象', helpLoginName: '工号', idCard: '身份证号码', bankOfDeposit: '开户行', bankUserName: '户名', bankCardNumber: '收款账户' } - if (field === 'helpLoginName') return [{ validator: value => person.personType === '劳务派遣人员' || !!String(value || '').trim(), message: '普通人员工号不能为空' }] - if (field === 'helpUserId') return [{ validator: () => !!person.helpUserId, message: '请选择慰问对象' }] + if (field === 'helpLoginName') return [{ validator: value => !person.helpUserId || person.personType === '劳务派遣人员' || !!String(value || '').trim(), message: '请完善慰问对象信息(工号不能为空)' }] + if (field === 'helpUserId') return [{ validator: () => !!(person.helpUserId || person.helpUserName), message: '请选择慰问对象' }] const rules = [{ validator: value => !!String(value || '').trim(), message: '请填写' + names[field] }] if (field === 'idCard') rules.push({ validator: value => this.validRecipientIdCard(value), message: '身份证号码不正确' }) if (field === 'bankCardNumber') rules.push({ pattern: /^[0-9]{6,30}$/, message: '收款账户须为6至30位数字' }) @@ -464,7 +464,6 @@ layout("/layouts/platform_h5.html"){ this.showTypePicker = false }, onSave() { - this.$refs.formRef.validate().then(() => { this.$dialog.confirm({ title: "提示", message: "您确定保存吗?" @@ -476,7 +475,6 @@ layout("/layouts/platform_h5.html"){ } }) }) - }).catch(errors => this.showInvalidApplicationTab(errors)) }, async onSubmit() { this.$refs.formRef.validate().then(() => {