fix: bug#12122
This commit is contained in:
parent
5ac7ff4906
commit
8d817c5365
|
@ -14,7 +14,7 @@
|
||||||
:rules="[
|
:rules="[
|
||||||
{
|
{
|
||||||
validator: (_rule, value) => checkValue(_rule, value, item),
|
validator: (_rule, value) => checkValue(_rule, value, item),
|
||||||
trigger: ['change', 'blur'],
|
trigger: ['blur', 'change'],
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
|
@ -103,6 +103,7 @@ const getType = (item: any) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkValue = (_rule: any, value: any, item: any) => {
|
const checkValue = (_rule: any, value: any, item: any) => {
|
||||||
|
console.log('checkValue',value)
|
||||||
if(!value){
|
if(!value){
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,8 +65,8 @@
|
||||||
v-else
|
v-else
|
||||||
style="width: calc(100% - 120px)"
|
style="width: calc(100% - 120px)"
|
||||||
placeholder="请选择收信人"
|
placeholder="请选择收信人"
|
||||||
@select="
|
@change="
|
||||||
(key, node) => onChange(source, key, node?.isRelation, node?.name)
|
(key, label) => onChange(source, key, undefined, label)
|
||||||
"
|
"
|
||||||
:tree-data="treeData"
|
:tree-data="treeData"
|
||||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||||
|
@ -209,6 +209,7 @@ const treeData = ref<any[]>([
|
||||||
]);
|
]);
|
||||||
const mySource = ref<string>('relation');
|
const mySource = ref<string>('relation');
|
||||||
const labelMap = new Map();
|
const labelMap = new Map();
|
||||||
|
const treeDataMap = new Map()
|
||||||
|
|
||||||
const getRelationUsers = async (notifyType: string, notifierId: string) => {
|
const getRelationUsers = async (notifyType: string, notifierId: string) => {
|
||||||
let resp = undefined;
|
let resp = undefined;
|
||||||
|
@ -250,6 +251,7 @@ const getUser = async (_source: string, triggerType: string) => {
|
||||||
}
|
}
|
||||||
if (platformResp.status === 200) {
|
if (platformResp.status === 200) {
|
||||||
newTree[0].children = platformResp.result.map((item: any) => {
|
newTree[0].children = platformResp.result.map((item: any) => {
|
||||||
|
treeDataMap.set(item.id, item)
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
|
@ -265,6 +267,7 @@ const getUser = async (_source: string, triggerType: string) => {
|
||||||
key: 'p2',
|
key: 'p2',
|
||||||
selectable: false,
|
selectable: false,
|
||||||
children: relationResp.result.map((item: any) => {
|
children: relationResp.result.map((item: any) => {
|
||||||
|
treeDataMap.set(item.id, item)
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
|
@ -324,6 +327,7 @@ const onChange = (
|
||||||
_name?: string,
|
_name?: string,
|
||||||
) => {
|
) => {
|
||||||
let _values: any = undefined;
|
let _values: any = undefined;
|
||||||
|
|
||||||
const _names: string[] = Array.isArray(_name) ? _name : [_name || ''];
|
const _names: string[] = Array.isArray(_name) ? _name : [_name || ''];
|
||||||
if (Array.isArray(_value)) {
|
if (Array.isArray(_value)) {
|
||||||
if (props?.notify?.notifyType === 'email') {
|
if (props?.notify?.notifyType === 'email') {
|
||||||
|
@ -339,7 +343,9 @@ const onChange = (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_values = getObj(_source, _value, isRelation);
|
const item = treeDataMap.get(_value)
|
||||||
|
const _isRelation = item.isRelation
|
||||||
|
_values = getObj(_source, _value, _isRelation);
|
||||||
}
|
}
|
||||||
emit('update:value', _values);
|
emit('update:value', _values);
|
||||||
emit('change', _names.filter((item) => !!item).join(','));
|
emit('change', _names.filter((item) => !!item).join(','));
|
||||||
|
|
|
@ -316,13 +316,13 @@ const termsTypeSelect = (e: { key: string, name: string }) => {
|
||||||
|
|
||||||
const valueSelect = (v: any, label: string, labelObj: Record<number, any>, option: any) => {
|
const valueSelect = (v: any, label: string, labelObj: Record<number, any>, option: any) => {
|
||||||
if (paramsValue.value?.source === 'metric') {
|
if (paramsValue.value?.source === 'metric') {
|
||||||
paramsValue.metric = option?.id
|
paramsValue.value.metric = option?.id
|
||||||
}
|
}
|
||||||
|
|
||||||
const newValues = { ...paramsValue }
|
const newValues = { ...paramsValue }
|
||||||
|
|
||||||
if (paramsValue.value?.source !== 'metric') {
|
if (paramsValue.value?.source !== 'metric') {
|
||||||
delete newValues.metric
|
delete newValues.value.metric
|
||||||
}
|
}
|
||||||
|
|
||||||
emit('update:value', { ...newValues })
|
emit('update:value', { ...newValues })
|
||||||
|
|
Loading…
Reference in New Issue