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