|
|
|
@ -14,6 +14,22 @@ |
|
|
|
<el-form label-position="top" class="data-source-form"> |
|
|
|
<!-- 可选:分组显示 --> |
|
|
|
<template v-if="hasViewGroups"> |
|
|
|
<!-- 系统变量组 --> |
|
|
|
<div class="view-group"> |
|
|
|
<div class="view-title">系统变量</div> |
|
|
|
<div class="checkbox-grid"> |
|
|
|
<label |
|
|
|
v-for="sysVar in systemVariables" |
|
|
|
:key="sysVar.fieldName" |
|
|
|
class="checkbox-item system-var"> |
|
|
|
<el-checkbox :label="sysVar.fieldName" v-model="selectedKeys"> |
|
|
|
<span class="label-inner"> |
|
|
|
<span class="field-name" :title="sysVar.description">{{ sysVar.displayName }}</span> |
|
|
|
</span> |
|
|
|
</el-checkbox> |
|
|
|
</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
v-for="group in viewGroups" |
|
|
|
:key="group.viewSource" |
|
|
|
@ -38,6 +54,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<template v-else> |
|
|
|
<!-- 数据字段组 --> |
|
|
|
<div class="view-group"> |
|
|
|
<div class="view-title">可用数据字段</div> |
|
|
|
<div class="checkbox-grid"> |
|
|
|
@ -86,7 +103,14 @@ export default { |
|
|
|
emits: ['update:visible', 'confirm'], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
selectedKeys: [] |
|
|
|
selectedKeys: [], |
|
|
|
systemVariables: [ |
|
|
|
{ |
|
|
|
fieldName: 'CURRENT_DATE_YYYYMMDD', |
|
|
|
displayName: '日期(YYYYMMDD)', |
|
|
|
description: '日期,格式:YYYYMMDD,如:20241218' |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -119,15 +143,26 @@ export default { |
|
|
|
return name + (key.fieldDescription ? `(${key.fieldDescription})` : '') |
|
|
|
}, |
|
|
|
initializeSelection() { |
|
|
|
if (!this.currentText || !this.dataKeys || !this.dataKeys.length) { |
|
|
|
if (!this.currentText) { |
|
|
|
this.selectedKeys = [] |
|
|
|
return |
|
|
|
} |
|
|
|
const found = [] |
|
|
|
this.dataKeys.forEach(k => { |
|
|
|
const pat = new RegExp(`#\\{${k.fieldName}\\}`, 'g') |
|
|
|
if (pat.test(this.currentText)) found.push(k.fieldName) |
|
|
|
|
|
|
|
// 检查系统变量 |
|
|
|
this.systemVariables.forEach(sysVar => { |
|
|
|
const pat = new RegExp(`#\\{${sysVar.fieldName}\\}`, 'g') |
|
|
|
if (pat.test(this.currentText)) found.push(sysVar.fieldName) |
|
|
|
}) |
|
|
|
|
|
|
|
// 检查数据字段 |
|
|
|
if (this.dataKeys && this.dataKeys.length) { |
|
|
|
this.dataKeys.forEach(k => { |
|
|
|
const pat = new RegExp(`#\\{${k.fieldName}\\}`, 'g') |
|
|
|
if (pat.test(this.currentText)) found.push(k.fieldName) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
this.selectedKeys = found |
|
|
|
}, |
|
|
|
handleClose() { |
|
|
|
@ -135,6 +170,13 @@ export default { |
|
|
|
}, |
|
|
|
handleConfirm() { |
|
|
|
const processed = this.selectedKeys.map(s => { |
|
|
|
// 首先检查是否是系统变量 |
|
|
|
const sysVar = this.systemVariables.find(sv => sv.fieldName === s) |
|
|
|
if (sysVar) { |
|
|
|
return s // 系统变量直接返回字段名 |
|
|
|
} |
|
|
|
|
|
|
|
// 然后检查数据字段 |
|
|
|
const f = this.dataKeys.find(k => k.fieldName === s) |
|
|
|
return f && f.originalFieldName ? f.originalFieldName : s |
|
|
|
}) |
|
|
|
@ -289,4 +331,39 @@ export default { |
|
|
|
color: #fff; |
|
|
|
border: none; |
|
|
|
} |
|
|
|
|
|
|
|
/* 系统变量特殊样式 */ |
|
|
|
.checkbox-item.system-var { |
|
|
|
background: linear-gradient(135deg, #fff7e6, #fff2d9); |
|
|
|
border-color: #ffd591; |
|
|
|
} |
|
|
|
|
|
|
|
.checkbox-item.system-var:hover { |
|
|
|
background: linear-gradient(135deg, #fff4e6, #ffefcc); |
|
|
|
border-color: #ffcc7a; |
|
|
|
} |
|
|
|
|
|
|
|
.checkbox-item.system-var .field-name { |
|
|
|
color: #d46b08; |
|
|
|
font-weight: 800; |
|
|
|
} |
|
|
|
|
|
|
|
/* 使用提示样式 */ |
|
|
|
.usage-tip { |
|
|
|
background: #fff7e6; |
|
|
|
border: 1px solid #ffd591; |
|
|
|
border-radius: 4px; |
|
|
|
padding: 8px 12px; |
|
|
|
margin-bottom: 12px; |
|
|
|
font-size: 13px; |
|
|
|
color: #d46b08; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
gap: 6px; |
|
|
|
} |
|
|
|
|
|
|
|
.usage-tip i { |
|
|
|
font-size: 14px; |
|
|
|
color: #faad14; |
|
|
|
} |
|
|
|
</style> |