feat(消息管理&界面配置): 消息管理模版支持换行&界面配置图片固定比例
This commit is contained in:
parent
7cfc18a007
commit
b7cc4fb45e
|
@ -34,7 +34,7 @@
|
|||
|
||||
import useContainerShadow from '@/hooks/useContainerShadow';
|
||||
|
||||
import type { CommonList, TableQueryParams } from '@/models/common';
|
||||
import type { CommonList } from '@/models/common';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
|
@ -43,10 +43,10 @@
|
|||
cardMinWidth: number; // 卡片最小宽度px
|
||||
shadowLimit: number; // 滚动距离高度,用于计算顶部底部阴影
|
||||
remoteParams?: Record<string, any>; // 远程数据模式下,请求数据的参数
|
||||
remoteFunc?: (v: TableQueryParams) => Promise<CommonList<any>>; // 远程数据模式下,请求数据的函数
|
||||
gap?: number; // 卡片之间的间距
|
||||
isProportional?: boolean; // 是否等比正方形
|
||||
paddingBottomSpace?: string; // 是否存在底部的间距
|
||||
remoteFunc?: (v: any) => Promise<CommonList<any>>; // 远程数据模式下,请求数据的函数
|
||||
}>(),
|
||||
{
|
||||
mode: 'static',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<div ref="treeContainerRef" :class="['ms-tree-container', containerStatusClass]">
|
||||
<a-tree
|
||||
v-show="treeData.length > 0"
|
||||
v-bind="props"
|
||||
ref="treeRef"
|
||||
v-model:expanded-keys="expandedKeys"
|
||||
|
@ -16,6 +17,7 @@
|
|||
</template>
|
||||
<template v-if="$slots['extra']" #extra="_props">
|
||||
<div
|
||||
v-if="_props.hideMoreAction !== true"
|
||||
:class="[
|
||||
'ms-tree-node-extra',
|
||||
innerFocusNodeKey === _props[props.fieldNames.key] ? 'ms-tree-node-extra--focus' : '',
|
||||
|
|
|
@ -9,6 +9,7 @@ export interface MsTreeFieldNames extends TreeFieldNames {
|
|||
}
|
||||
|
||||
export type MsTreeNodeData = {
|
||||
hideMoreAction?: boolean; // 隐藏更多操作
|
||||
[key: string]: any;
|
||||
} & TreeNodeData;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
width: 55%;
|
||||
.img {
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
object-fit: fill;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
v-model:model-value="robotFilters"
|
||||
:options="robotOptions"
|
||||
:allow-search="false"
|
||||
allow-clear
|
||||
class="mr-[8px] w-[240px]"
|
||||
:prefix="t('project.messageManagement.robot')"
|
||||
value-key="id"
|
||||
|
@ -62,6 +63,7 @@
|
|||
:options="defaultReceivers"
|
||||
:search-keys="['label']"
|
||||
allow-search
|
||||
allow-clear
|
||||
value-key="id"
|
||||
label-key="name"
|
||||
:multiple="true"
|
||||
|
@ -365,7 +367,7 @@
|
|||
enable: val, // 消息配置是否启用
|
||||
});
|
||||
Message.success(
|
||||
t('project.messageManagement.enableRobotSuccess', {
|
||||
t(val ? 'project.messageManagement.enableRobotSuccess' : 'project.messageManagement.disableRobotSuccess', {
|
||||
name: `${record.functionName}-${record.eventName}-${record.projectRobotConfigMap?.[dataIndex].robotName}`,
|
||||
})
|
||||
);
|
||||
|
|
|
@ -194,22 +194,24 @@
|
|||
// 使用正则表达式替换 ${variableName} 格式的字符串内的变量名为变量描述
|
||||
function replaceVariableStr(str: string, fields: Field[], isSubject = false) {
|
||||
const regex = /\$\{([^}]+)\}/g;
|
||||
return str.replace(regex, (match, variableName) => {
|
||||
// 在数组中查找匹配的 variableName,并返回其 name 属性
|
||||
const variable = fields.find((v) => v.id === variableName);
|
||||
if (variableName === 'name' && !isSubject) {
|
||||
return variable ? `<span style='color: rgb(var(--primary-6))'><${variable.name}></span>` : match;
|
||||
}
|
||||
if (isSubject) {
|
||||
return variable ? variable.name : match;
|
||||
}
|
||||
return variable ? `<${variable.name}>` : match;
|
||||
});
|
||||
return str
|
||||
.replace(regex, (match, variableName) => {
|
||||
// 在数组中查找匹配的 variableName,并返回其 name 属性
|
||||
const variable = fields.find((v) => v.id === variableName);
|
||||
if (variableName === 'name' && !isSubject) {
|
||||
return variable ? `<span style='color: rgb(var(--primary-6))'><${variable.name}></span>` : match;
|
||||
}
|
||||
if (isSubject) {
|
||||
return variable ? variable.name : match;
|
||||
}
|
||||
return variable ? `<${variable.name}>` : match;
|
||||
})
|
||||
.replace(/\n/g, '<br>');
|
||||
}
|
||||
|
||||
// 使用正则表达式替换 {{name}} 为高亮的关键字
|
||||
function replacePreviewName(str: string) {
|
||||
return str.replace(/{{(.*?)}}/g, `<span style='color: rgb(var(--primary-6))'><$1></span>`);
|
||||
return str.replace(/{{(.*?)}}/g, `<span style='color: rgb(var(--primary-6))'><$1></span>`).replace(/\n/g, '<br>');
|
||||
}
|
||||
|
||||
const subject = computed(() => {
|
||||
|
|
|
@ -94,6 +94,7 @@ export default {
|
|||
'project.messageManagement.desc': 'Description',
|
||||
'project.messageManagement.saveSuccess': 'Template saved successfully',
|
||||
'project.messageManagement.enableRobotSuccess': '{name} is enabled',
|
||||
'project.messageManagement.disableRobotSuccess': '{name} is disabled',
|
||||
'project.messageManagement.saveReceiverSuccess': 'Recipient modified successfully',
|
||||
'project.messageManagement.unsetReceiverTip': 'Please set up message recipients before enabling the robot',
|
||||
'project.messageManagement.receiverNotNull': 'Please set at least one message recipient',
|
||||
|
|
|
@ -86,6 +86,7 @@ export default {
|
|||
'project.messageManagement.desc': '描述',
|
||||
'project.messageManagement.saveSuccess': '模版保存成功',
|
||||
'project.messageManagement.enableRobotSuccess': '{name} 已启用',
|
||||
'project.messageManagement.disableRobotSuccess': '{name} 已禁用',
|
||||
'project.messageManagement.saveReceiverSuccess': '接收人修改成功',
|
||||
'project.messageManagement.unsetReceiverTip': '启用机器人前请先设置消息接收人',
|
||||
'project.messageManagement.receiverNotNull': '请最少设置一位消息接收人',
|
||||
|
|
Loading…
Reference in New Issue