Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
xieyonghong 2023-02-23 17:30:36 +08:00
commit 7d0fbc0e1c
3 changed files with 42 additions and 5 deletions

View File

@ -51,11 +51,30 @@
<a-form-item <a-form-item
:name="['templateDetailTable', index, 'value']" :name="['templateDetailTable', index, 'value']"
:rules="{ :rules="{
required: true, required: record.required,
message: '该字段为必填字段', message: '该字段为必填字段',
}" }"
> >
<ToUser
v-if="record.type === 'user'"
v-model:toUser="record.value"
:type="data.type"
:config-id="formData.configId"
/>
<ToOrg
v-else-if="record.type === 'org'"
:type="data.type"
:config-id="formData.configId"
v-model:toParty="record.value"
/>
<ToTag
v-else-if="record.type === 'tag'"
:type="data.type"
:config-id="formData.configId"
v-model:toTag="record.value"
/>
<ValueItem <ValueItem
v-else
v-model:modelValue="record.value" v-model:modelValue="record.value"
:itemType="record.type" :itemType="record.type"
/> />
@ -78,6 +97,9 @@ import type {
} from '@/views/notice/Template/types'; } from '@/views/notice/Template/types';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import ToUser from '../Detail/components/ToUser.vue';
import ToOrg from '../Detail/components/ToOrg.vue';
import ToTag from '../Detail/components/ToTag.vue';
type Emits = { type Emits = {
(e: 'update:visible', data: boolean): void; (e: 'update:visible', data: boolean): void;
@ -110,7 +132,8 @@ const getConfigList = async () => {
}; };
const { result } = await TemplateApi.getConfig(params); const { result } = await TemplateApi.getConfig(params);
configList.value = result; configList.value = result;
formData.value.configId = result[0]?.id; //
if (configList.value.length) formData.value.configId = props.data.configId;
}; };
watch( watch(
@ -131,6 +154,7 @@ const getTemplateDetail = async () => {
formData.value.templateDetailTable = result.variableDefinitions.map( formData.value.templateDetailTable = result.variableDefinitions.map(
(m: any) => ({ (m: any) => ({
...m, ...m,
type: m.expands ? m.expands.businessType : m.type,
value: undefined, value: undefined,
}), }),
); );

View File

@ -27,11 +27,17 @@ const _value = computed({
get: () => props.toParty, get: () => props.toParty,
set: (val: string) => emit('update:toParty', val), set: (val: string) => emit('update:toParty', val),
}); });
const typeObj = {
weixin: 'wechat',
dingTalk: 'dingtalk',
};
const options = ref([]); const options = ref([]);
const queryData = async () => { const queryData = async () => {
if (!props.configId) return; if (!props.configId) return;
const { result } = await templateApi.getDept(props.type, props.configId); const { result } = await templateApi.getDept(
typeObj[props.type],
props.configId,
);
options.value = result.map((item: any) => ({ options.value = result.map((item: any) => ({
label: item.name, label: item.name,
value: item.id, value: item.id,

View File

@ -28,10 +28,17 @@ const _value = computed({
set: (val: string) => emit('update:toUser', val), set: (val: string) => emit('update:toUser', val),
}); });
const typeObj = {
weixin: 'wechat',
dingTalk: 'dingtalk',
};
const options = ref([]); const options = ref([]);
const queryData = async () => { const queryData = async () => {
if (!props.configId) return; if (!props.configId) return;
const { result } = await templateApi.getUser(props.type, props.configId); const { result } = await templateApi.getUser(
typeObj[props.type],
props.configId,
);
options.value = result.map((item: any) => ({ options.value = result.map((item: any) => ({
label: item.name, label: item.name,
value: item.id, value: item.id,