From 0da369366a21dacfe1ab5bc940bbfce5fa8e3cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=8C=E5=85=88=E8=88=9C?= <2499071264@qq.com> Date: Mon, 9 Nov 2026 17:39:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BA=BA=E5=91=98=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=B2=BB=E7=90=86=E8=BF=81=E7=A7=BB4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/platform/css/personGovernance.css | 10 ++- .../personGovernance/apiConfig/form.html | 81 ++++++++++++++++++- 2 files changed, 87 insertions(+), 4 deletions(-) diff --git a/src/main/resources/static/assets/platform/css/personGovernance.css b/src/main/resources/static/assets/platform/css/personGovernance.css index c314d22..fb1cb8d 100644 --- a/src/main/resources/static/assets/platform/css/personGovernance.css +++ b/src/main/resources/static/assets/platform/css/personGovernance.css @@ -509,8 +509,8 @@ } .person-governance-task-cron { - flex: 0 1 420px; - max-width: 420px; + flex: 0 1 340px; + max-width: 340px; } .person-governance-cron-hint, @@ -579,7 +579,11 @@ } /* 两种数据来源共用右侧清空入口,窄屏换行后仍靠右,不挤压周期控件。 */ -.person-governance-mapping-toolbar > .person-governance-clear-mappings { +.person-governance-mapping-toolbar > .person-governance-mapping-actions { + display: flex; + align-items: center; + flex-wrap: nowrap; + white-space: nowrap; flex: none; margin-left: auto; } diff --git a/src/main/resources/views/platform/personGovernance/apiConfig/form.html b/src/main/resources/views/platform/personGovernance/apiConfig/form.html index 272c9fe..5535ec0 100644 --- a/src/main/resources/views/platform/personGovernance/apiConfig/form.html +++ b/src/main/resources/views/platform/personGovernance/apiConfig/form.html @@ -133,11 +133,14 @@ +
清空 + 快捷映射 +
@@ -158,7 +161,7 @@
- + @@ -178,11 +181,14 @@
+
清空 + 快捷映射 +
保存配置
+ + + +
+ 取消 + 确认填充 +
+
{ + if (!entry || typeof entry !== 'object' || Array.isArray(entry) || !Object.keys(entry).length) { + throw new Error('数组中的每项必须是以系统字段名为键的对象') + } + Object.keys(entry).forEach((targetField) => { + const column = this.targetColumns.find((item) => item.columnName === targetField) + if (!column) throw new Error('目标表不存在系统字段:' + targetField) + if (seen.has(targetField)) throw new Error('系统字段重复:' + targetField) + seen.add(targetField) + const value = entry[targetField] + if (!value || typeof value !== 'object' || Array.isArray(value)) { + throw new Error(targetField + ' 的映射必须为对象') + } + const sourceField = value.sourceField === undefined ? value.id : value.sourceField + const sourceComment = value.sourceComment === undefined ? value['来源字段说明'] : value.sourceComment + if (typeof sourceField !== 'string' || !sourceField.trim()) { + throw new Error(targetField + ' 缺少来源字段 id 或 sourceField') + } + if (sourceComment !== undefined && typeof sourceComment !== 'string') { + throw new Error(targetField + ' 的来源字段说明必须为字符串') + } + const source = this.sourceColumns.find((item) => item.columnName === sourceField.trim()) + if (this.form.sourceType === 'SYSTEM_TABLE' && !source) { + throw new Error('来源表不存在字段:' + sourceField) + } + updates.push({ column, sourceField: sourceField.trim(), sourceComment, + defaultComment: source ? source.columnComment || '' : '' }) + }) + }) + } catch (error) { + this.notifyWarning(error instanceof SyntaxError ? 'JSON 格式不正确,请使用双引号并参考示例填写' : error.message) + return + } + updates.forEach((update) => { + let row = this.mappings.find((item) => item.targetField === update.column.columnName) + if (!row) { + row = { sourceField: '', sourceComment: '', targetField: update.column.columnName, + targetComment: update.column.columnComment || '', required: update.column.isNullable === 'NO', identityFlag: false } + this.mappings.push(row) + } + this.$set(row, 'sourceField', update.sourceField) + this.$set(row, 'sourceComment', update.sourceComment === undefined + ? row.sourceComment || update.defaultComment : update.sourceComment) + }) + this.$set(this, 'quickMappingVisible', false) + this.layoutTable('mappingTable') + this.notifySuccess('已填充 ' + updates.length + ' 条字段映射') + }, isIdentityMapping(row) { return Boolean(row && row.sourceField && row.sourceField.trim() && row.targetField && row.targetField.trim()