From cb1687a5fc9f11c38383d82342ba629223c1f0e8 Mon Sep 17 00:00:00 2001 From: zhangrui Date: Thu, 22 Oct 2026 14:16:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E6=95=B0=E6=8D=AE=E6=B2=BB?= =?UTF-8?q?=E7=90=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PersonApiConfigServiceImpl.java | 3 ++- .../static/assets/platform/js/main.js | 5 +++- .../personGovernance/apiConfig/index.html | 10 ++++++- .../personGovernance/memberMatch/form.html | 26 +++++++++++++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/budwk/app/zhgh/personGovernance/apiConfig/service/impl/PersonApiConfigServiceImpl.java b/src/main/java/com/budwk/app/zhgh/personGovernance/apiConfig/service/impl/PersonApiConfigServiceImpl.java index 63f7f895..ec10216e 100644 --- a/src/main/java/com/budwk/app/zhgh/personGovernance/apiConfig/service/impl/PersonApiConfigServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/personGovernance/apiConfig/service/impl/PersonApiConfigServiceImpl.java @@ -68,7 +68,8 @@ public class PersonApiConfigServiceImpl extends BaseServiceImpl public Pagination pageData(PageForm pageForm, String configName, String sourceType, Boolean enabled) { CndPlus cnd = CndPlus.create(); cnd.andEX("configName", "like", Strings.isBlank(configName) ? null : "%" + configName + "%"); - cnd.andEX("sourceType", "=", sourceType); + // 兼容其他调用方传入空字符串,空来源类型表示不按来源筛选。 + cnd.andEX("sourceType", "=", Strings.isBlank(sourceType) ? null : sourceType.trim()); cnd.andEX("enabled", "=", enabled); // 历史保存可能将删除标记写为NULL;仅明确标记为true的配置不在列表展示。 cnd.and(Cnd.exps("delFlag", "=", false).or("delFlag", "is", null)).desc("updatedAt"); diff --git a/src/main/resources/static/assets/platform/js/main.js b/src/main/resources/static/assets/platform/js/main.js index 00c9c299..fdfea10e 100644 --- a/src/main/resources/static/assets/platform/js/main.js +++ b/src/main/resources/static/assets/platform/js/main.js @@ -12,7 +12,10 @@ $.ajaxSetup({ contentType: "application/x-www-form-urlencoded;charset=utf-8", success: function (response, textStatus, jqXHR) { if (response.code !== 0) { - this.$message.error(response.msg) + // AJAX全局回调没有Vue实例上下文,使用Element全局消息组件展示业务错误。 + if (window.ELEMENT && ELEMENT.Message) { + ELEMENT.Message.error(response.msg) + } } else { return response } diff --git a/src/main/resources/views/platform/personGovernance/apiConfig/index.html b/src/main/resources/views/platform/personGovernance/apiConfig/index.html index f75fa5af..0a28570d 100644 --- a/src/main/resources/views/platform/personGovernance/apiConfig/index.html +++ b/src/main/resources/views/platform/personGovernance/apiConfig/index.html @@ -108,7 +108,15 @@ methods: { pageData() { this.$set(this, 'tableLoading', true) - return $.post(loc() + '/pageData', this.pageForm) + const params = { + pageNumber: this.pageForm.pageNumber, + pageSize: this.pageForm.pageSize, + } + // 未选择的查询条件不提交,避免空来源类型被后端拼成 sourceType=''。 + if (this.pageForm.configName) params.configName = this.pageForm.configName + if (this.pageForm.sourceType) params.sourceType = this.pageForm.sourceType + if (this.pageForm.enabled !== '') params.enabled = this.pageForm.enabled + return $.post(loc() + '/pageData', params) .then((res) => { if (res.code === 0) { this.$set(this, 'tableData', res.data.list) diff --git a/src/main/resources/views/platform/personGovernance/memberMatch/form.html b/src/main/resources/views/platform/personGovernance/memberMatch/form.html index 41085415..8547be90 100644 --- a/src/main/resources/views/platform/personGovernance/memberMatch/form.html +++ b/src/main/resources/views/platform/personGovernance/memberMatch/form.html @@ -511,11 +511,37 @@ this.$set(row, 'matchValue', '') } }, + // 保存前递归检查两类规则树,避免无效规则进入后端后才返回校验异常。 + validateRuleGroups(groups, ruleName) { + let message = '' + this.walkGroups(groups, (group) => { + if (message) return + ;(group.conditions || []).some((condition) => { + if (!condition.mappedField) { + message = ruleName + '规则请选择映射字段' + return true + } + if (!condition.operator) { + message = ruleName + '规则请选择匹配方式' + return true + } + return false + }) + }) + return message + }, save() { if (!this.form.configName || !this.form.apiConfigId) { this.notifyWarning('请填写配置名称并选择API配置') return } + const ruleMessage = + this.validateRuleGroups(this.ruleGroups.UNION_MEMBER, '工会会员') || + this.validateRuleGroups(this.ruleGroups.WELFARE_MEMBER, '福利会员') + if (ruleMessage) { + this.notifyWarning(ruleMessage) + return + } this.$set(this, 'formLoading', true) $.post(memberBase + '/save', { data: JSON.stringify({