feat: 收信人, 部门和标签组件封装
This commit is contained in:
parent
516127a168
commit
3b660203ea
|
@ -16,10 +16,10 @@ export default {
|
|||
debug: (data: any, configId: string, templateId: string) => post(`/notifier/${configId}/${templateId}/_send`, data),
|
||||
getHistory: (data: any, id: string) => post(`/notify/history/template/${id}/_query`, data),
|
||||
// 钉钉/微信, 根据配置获取部门和用户
|
||||
getDept: (type: string, id: string) => get(`/notifier/${type}/corp/${id}/departments`),
|
||||
getUser: (type: string, id: string) => get(`/notifier/${type}/corp/${id}/users`),
|
||||
getDept: (type: string, id: string) => get<any>(`/notifier/${type}/corp/${id}/departments`),
|
||||
getUser: (type: string, id: string) => get<any>(`/notifier/${type}/corp/${id}/users`),
|
||||
// 微信获取标签推送
|
||||
getTags: (id: string) => get(`/notifier/wechat/corp/${id}/tags`),
|
||||
getTags: (id: string) => get<any>(`/notifier/wechat/corp/${id}/tags`),
|
||||
// 语音/短信获取阿里云模板
|
||||
getAliTemplate: (id: any) => get(`/notifier/sms/aliyun/${id}/templates`),
|
||||
// 短信获取签名
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<template>
|
||||
<a-select
|
||||
:options="options"
|
||||
@change="change"
|
||||
placeholder="请选择收信部门"
|
||||
style="width: 100%"
|
||||
:allowClear="true"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import templateApi from '@/api/notice/template';
|
||||
|
||||
type Emits = {
|
||||
(e: 'update:toParty', data: string): void;
|
||||
};
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const props = defineProps({
|
||||
type: { type: String, default: '' },
|
||||
configId: { type: String, default: '' },
|
||||
});
|
||||
|
||||
const options = ref([]);
|
||||
const queryData = async () => {
|
||||
const { result } = await templateApi.getDept(props.type, props.configId);
|
||||
options.value = result.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
};
|
||||
queryData();
|
||||
|
||||
const change = (e: any) => {
|
||||
emit('update:toParty', e);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.configId,
|
||||
() => {
|
||||
queryData();
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
|
@ -0,0 +1,46 @@
|
|||
<template>
|
||||
<a-select
|
||||
:options="options"
|
||||
@change="change"
|
||||
placeholder="请选择标签推送,多个标签用,号分隔"
|
||||
style="width: 100%"
|
||||
:allowClear="true"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import templateApi from '@/api/notice/template';
|
||||
|
||||
type Emits = {
|
||||
(e: 'update:toTag', data: string): void;
|
||||
};
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const props = defineProps({
|
||||
type: { type: String, default: '' },
|
||||
configId: { type: String, default: '' },
|
||||
});
|
||||
|
||||
const options = ref([]);
|
||||
const queryData = async () => {
|
||||
const { result } = await templateApi.getTags(props.configId);
|
||||
options.value = result.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
};
|
||||
queryData();
|
||||
|
||||
const change = (e: any) => {
|
||||
emit('update:toTag', e);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.configId,
|
||||
() => {
|
||||
queryData();
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
|
@ -0,0 +1,46 @@
|
|||
<template>
|
||||
<a-select
|
||||
:options="options"
|
||||
@change="change"
|
||||
placeholder="请选择收信人"
|
||||
style="width: 100%"
|
||||
:allowClear="true"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import templateApi from '@/api/notice/template';
|
||||
|
||||
type Emits = {
|
||||
(e: 'update:toUser', data: string): void;
|
||||
};
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const props = defineProps({
|
||||
type: { type: String, default: '' },
|
||||
configId: { type: String, default: '' },
|
||||
});
|
||||
|
||||
const options = ref([]);
|
||||
const queryData = async () => {
|
||||
const { result } = await templateApi.getUser(props.type, props.configId);
|
||||
options.value = result.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
};
|
||||
queryData();
|
||||
|
||||
const change = (e: any) => {
|
||||
emit('update:toUser', e);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.configId,
|
||||
() => {
|
||||
queryData();
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
|
@ -180,58 +180,33 @@
|
|||
<a-row :gutter="10">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="收信人">
|
||||
<a-select
|
||||
v-model:value="
|
||||
<ToUser
|
||||
v-model:to-user="
|
||||
formData.template.toUser
|
||||
"
|
||||
placeholder="请选择收信人"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="(
|
||||
item, index
|
||||
) in ROBOT_MSG_TYPE"
|
||||
:key="index"
|
||||
:value="item.value"
|
||||
>
|
||||
{{ item.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
:type="formData.type"
|
||||
:config-id="formData.configId"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="收信部门">
|
||||
<a-select
|
||||
v-model:value="
|
||||
<ToOrg
|
||||
v-model:to-user="
|
||||
formData.template.toParty
|
||||
"
|
||||
placeholder="请选择收信部门"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="(
|
||||
item, index
|
||||
) in ROBOT_MSG_TYPE"
|
||||
:key="index"
|
||||
:value="item.value"
|
||||
>
|
||||
{{ item.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
:type="formData.type"
|
||||
:config-id="formData.configId"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item label="标签推送">
|
||||
<a-select
|
||||
v-model:value="formData.template.toTag"
|
||||
placeholder="请选择标签推送"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="(item, index) in ROBOT_MSG_TYPE"
|
||||
:key="index"
|
||||
:value="item.value"
|
||||
>
|
||||
{{ item.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<ToTag
|
||||
v-model:to-user="formData.template.toTag"
|
||||
:type="formData.type"
|
||||
:config-id="formData.configId"
|
||||
/>
|
||||
</a-form-item>
|
||||
</template>
|
||||
<!-- 邮件 -->
|
||||
|
@ -496,6 +471,9 @@ import Doc from './doc/index';
|
|||
import MonacoEditor from '@/components/MonacoEditor/index.vue';
|
||||
import Attachments from './components/Attachments.vue';
|
||||
import VariableDefinitions from './components/VariableDefinitions.vue';
|
||||
import ToUser from './components/ToUser.vue';
|
||||
import ToOrg from './components/ToOrg.vue';
|
||||
import ToTag from './components/ToTag.vue';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
|
Loading…
Reference in New Issue