feat(消息管理): 消息管理限制最少一个接收人
This commit is contained in:
parent
7f3c0d60ba
commit
0247634c34
|
@ -283,6 +283,8 @@
|
||||||
}
|
}
|
||||||
.arco-textarea {
|
.arco-textarea {
|
||||||
.ms-scroll-bar();
|
.ms-scroll-bar();
|
||||||
|
|
||||||
|
padding-right: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** form-item **/
|
/** form-item **/
|
||||||
|
|
|
@ -168,7 +168,7 @@
|
||||||
addText: string;
|
addText: string;
|
||||||
maxHeight?: string;
|
maxHeight?: string;
|
||||||
defaultVals?: any[]; // 当外层是编辑状态时,可传入已填充的数据
|
defaultVals?: any[]; // 当外层是编辑状态时,可传入已填充的数据
|
||||||
isShowDrag: boolean; // 是否可以拖拽
|
isShowDrag?: boolean; // 是否可以拖拽
|
||||||
formWidth?: string; // 自定义表单区域宽度
|
formWidth?: string; // 自定义表单区域宽度
|
||||||
showEnable?: boolean; // 是否显示启用禁用switch状态
|
showEnable?: boolean; // 是否显示启用禁用switch状态
|
||||||
}>(),
|
}>(),
|
||||||
|
|
|
@ -27,6 +27,7 @@ export interface MsSearchSelectProps {
|
||||||
labelKey?: string; // 选项的 label 字段名,默认为 label
|
labelKey?: string; // 选项的 label 字段名,默认为 label
|
||||||
options: SelectOptionData[];
|
options: SelectOptionData[];
|
||||||
multiple?: boolean; // 是否多选
|
multiple?: boolean; // 是否多选
|
||||||
|
atLeastOne?: boolean; // 是否至少选择一个,多选模式下有效
|
||||||
remoteFieldsMap?: RemoteFieldsMap; // 远程模式下的结果 key 映射,例如 { value: 'id' },表示远程请求时,会将返回结果的 id 赋值到 value 字段
|
remoteFieldsMap?: RemoteFieldsMap; // 远程模式下的结果 key 映射,例如 { value: 'id' },表示远程请求时,会将返回结果的 id 赋值到 value 字段
|
||||||
remoteExtraParams?: Record<string, any>; // 远程模式下的额外参数
|
remoteExtraParams?: Record<string, any>; // 远程模式下的额外参数
|
||||||
notAutoInitSearch?: boolean; // 是否禁用 arco-select 的初始化自动搜索功能
|
notAutoInitSearch?: boolean; // 是否禁用 arco-select 的初始化自动搜索功能
|
||||||
|
@ -229,7 +230,22 @@ export default defineComponent(
|
||||||
default: () =>
|
default: () =>
|
||||||
filterOptions.value.map((item) => (
|
filterOptions.value.map((item) => (
|
||||||
<a-tooltip content={item.tooltipContent} mouse-enter-delay={500}>
|
<a-tooltip content={item.tooltipContent} mouse-enter-delay={500}>
|
||||||
<a-option key={item.id} value={item}>
|
<a-option
|
||||||
|
key={item[props.valueKey || 'value']}
|
||||||
|
value={item}
|
||||||
|
tag-props={
|
||||||
|
props.multiple && props.atLeastOne
|
||||||
|
? { closable: Array.isArray(innerValue.value) && innerValue.value.length > 1 }
|
||||||
|
: {}
|
||||||
|
}
|
||||||
|
disabled={
|
||||||
|
props.multiple &&
|
||||||
|
props.atLeastOne &&
|
||||||
|
Array.isArray(innerValue.value) &&
|
||||||
|
innerValue.value.find((e) => e[props.valueKey || 'value'] === item[props.valueKey || 'value']) &&
|
||||||
|
innerValue.value.length === 1
|
||||||
|
}
|
||||||
|
>
|
||||||
<div class="one-line-text" style={getOptionComputedStyle.value}>
|
<div class="one-line-text" style={getOptionComputedStyle.value}>
|
||||||
{optionItemLabelRender(item)}
|
{optionItemLabelRender(item)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -320,6 +336,7 @@ export default defineComponent(
|
||||||
onUpdate:model-value={(value: ModelType) => emit('update:modelValue', value)}
|
onUpdate:model-value={(value: ModelType) => emit('update:modelValue', value)}
|
||||||
onSearch={handleSearch}
|
onSearch={handleSearch}
|
||||||
onPopupVisibleChange={(val: boolean) => emit('popupVisibleChange', val)}
|
onPopupVisibleChange={(val: boolean) => emit('popupVisibleChange', val)}
|
||||||
|
onRemove={(val: string | number | boolean | Record<string, any> | undefined) => emit('remove', val)}
|
||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
prefix: props.prefix ? () => t(props.prefix || '') : null,
|
prefix: props.prefix ? () => t(props.prefix || '') : null,
|
||||||
|
@ -364,7 +381,8 @@ export default defineComponent(
|
||||||
'loading',
|
'loading',
|
||||||
'fallbackOption',
|
'fallbackOption',
|
||||||
'labelKey',
|
'labelKey',
|
||||||
|
'atLeastOne',
|
||||||
],
|
],
|
||||||
emits: ['update:modelValue', 'remoteSearch', 'popupVisibleChange', 'update:loading'],
|
emits: ['update:modelValue', 'remoteSearch', 'popupVisibleChange', 'update:loading', 'remove'],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
:options="defaultReceivers"
|
:options="defaultReceivers"
|
||||||
:search-keys="['label']"
|
:search-keys="['label']"
|
||||||
allow-search
|
allow-search
|
||||||
allow-clear
|
:at-least-one="true"
|
||||||
value-key="id"
|
value-key="id"
|
||||||
label-key="name"
|
label-key="name"
|
||||||
:multiple="true"
|
:multiple="true"
|
||||||
|
@ -77,6 +77,7 @@
|
||||||
label: (val as Record<string, any>).name,
|
label: (val as Record<string, any>).name,
|
||||||
value: val,
|
value: val,
|
||||||
})"
|
})"
|
||||||
|
@remove="changeMessageReceivers(false, record, dataIndex as string)"
|
||||||
@popup-visible-change="changeMessageReceivers($event, record, dataIndex as string)"
|
@popup-visible-change="changeMessageReceivers($event, record, dataIndex as string)"
|
||||||
/>
|
/>
|
||||||
<span v-else></span>
|
<span v-else></span>
|
||||||
|
@ -336,6 +337,10 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
function editRobot(record: TableMessageChildrenItem, dataIndex: string) {
|
function editRobot(record: TableMessageChildrenItem, dataIndex: string) {
|
||||||
|
if (record.receivers?.length === 0) {
|
||||||
|
Message.warning(t('project.messageManagement.unsetReceiversTip'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
router.push({
|
router.push({
|
||||||
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_MESSAGE_MANAGEMENT_EDIT,
|
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_MESSAGE_MANAGEMENT_EDIT,
|
||||||
query: {
|
query: {
|
||||||
|
|
|
@ -146,6 +146,7 @@
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import useLocale from '@/locale/useLocale';
|
import useLocale from '@/locale/useLocale';
|
||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
|
import useUserStore from '@/store/modules/user';
|
||||||
import { sleep } from '@/utils';
|
import { sleep } from '@/utils';
|
||||||
|
|
||||||
import type { Field, MessageTemplateDetail } from '@/models/projectManagement/message';
|
import type { Field, MessageTemplateDetail } from '@/models/projectManagement/message';
|
||||||
|
@ -153,6 +154,7 @@
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
const userStore = useUserStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { currentLocale } = useLocale();
|
const { currentLocale } = useLocale();
|
||||||
|
|
||||||
|
@ -183,6 +185,7 @@
|
||||||
taskType: route.query.taskType as string,
|
taskType: route.query.taskType as string,
|
||||||
event: route.query.event as string,
|
event: route.query.event as string,
|
||||||
projectId: appStore.currentProjectId,
|
projectId: appStore.currentProjectId,
|
||||||
|
receiverIds: messageDetail.value?.receiverIds || [userStore.id || ''],
|
||||||
});
|
});
|
||||||
Message.success(t('project.messageManagement.saveSuccess'));
|
Message.success(t('project.messageManagement.saveSuccess'));
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
|
|
|
@ -98,5 +98,6 @@ export default {
|
||||||
'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',
|
||||||
|
'project.messageManagement.unsetReceiversTip': 'Please set the message recipients before configuring the template.',
|
||||||
'project.messageManagement.noMatchField': 'No matching fields yet',
|
'project.messageManagement.noMatchField': 'No matching fields yet',
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,5 +90,6 @@ export default {
|
||||||
'project.messageManagement.saveReceiverSuccess': '接收人修改成功',
|
'project.messageManagement.saveReceiverSuccess': '接收人修改成功',
|
||||||
'project.messageManagement.unsetReceiverTip': '启用机器人前请先设置消息接收人',
|
'project.messageManagement.unsetReceiverTip': '启用机器人前请先设置消息接收人',
|
||||||
'project.messageManagement.receiverNotNull': '请最少设置一位消息接收人',
|
'project.messageManagement.receiverNotNull': '请最少设置一位消息接收人',
|
||||||
|
'project.messageManagement.unsetReceiversTip': '配置模版前请先设置消息接收人',
|
||||||
'project.messageManagement.noMatchField': '暂无匹配字段',
|
'project.messageManagement.noMatchField': '暂无匹配字段',
|
||||||
};
|
};
|
||||||
|
|
|
@ -108,12 +108,12 @@
|
||||||
{
|
{
|
||||||
title: 'system.resourcePool.tableColumnCreateTime',
|
title: 'system.resourcePool.tableColumnCreateTime',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
width: 170,
|
width: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'system.resourcePool.tableColumnUpdateTime',
|
title: 'system.resourcePool.tableColumnUpdateTime',
|
||||||
dataIndex: 'updateTime',
|
dataIndex: 'updateTime',
|
||||||
width: 170,
|
width: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'system.resourcePool.tableColumnActions',
|
title: 'system.resourcePool.tableColumnActions',
|
||||||
|
|
|
@ -281,7 +281,6 @@
|
||||||
columns,
|
columns,
|
||||||
size: 'default',
|
size: 'default',
|
||||||
selectable: true,
|
selectable: true,
|
||||||
pageSimple: true,
|
|
||||||
showSetting: true,
|
showSetting: true,
|
||||||
},
|
},
|
||||||
(record) => ({
|
(record) => ({
|
||||||
|
|
Loading…
Reference in New Issue