feat(消息管理&界面配置): 消息管理模版支持换行&界面配置图片固定比例

This commit is contained in:
baiqi 2023-10-18 13:41:13 +08:00 committed by 刘瑞斌
parent 7cfc18a007
commit b7cc4fb45e
8 changed files with 25 additions and 16 deletions

View File

@ -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',

View File

@ -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' : '',

View File

@ -9,6 +9,7 @@ export interface MsTreeFieldNames extends TreeFieldNames {
}
export type MsTreeNodeData = {
hideMoreAction?: boolean; // 隐藏更多操作
[key: string]: any;
} & TreeNodeData;

View File

@ -24,7 +24,7 @@
width: 55%;
.img {
width: 100%;
object-fit: cover;
object-fit: fill;
}
}
</style>

View File

@ -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}`,
})
);

View File

@ -194,7 +194,8 @@
// 使 ${variableName}
function replaceVariableStr(str: string, fields: Field[], isSubject = false) {
const regex = /\$\{([^}]+)\}/g;
return str.replace(regex, (match, variableName) => {
return str
.replace(regex, (match, variableName) => {
// variableName name
const variable = fields.find((v) => v.id === variableName);
if (variableName === 'name' && !isSubject) {
@ -204,12 +205,13 @@
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(() => {

View File

@ -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',

View File

@ -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': '请最少设置一位消息接收人',