fix: 场景联动

This commit is contained in:
100011797 2023-03-28 15:06:19 +08:00
parent a1614752f2
commit 716df45891
10 changed files with 80 additions and 52 deletions

View File

@ -1,6 +1,6 @@
<template>
<a-space align="end">
<a-upload
<j-space align="end">
<j-upload
v-model:fileList="modelValue.upload"
name="file"
:action="FILE_UPLOAD"
@ -12,21 +12,22 @@
:showUploadList="false"
@change="uploadChange"
>
<a-button>
<j-button>
<template #icon><AIcon type="UploadOutlined" /></template>
文件上传
</a-button>
</a-upload>
</j-button>
</j-upload>
<div style="margin-left: 20px">
<a-space>
<j-space>
下载模板
<a @click="downFile('xlsx')">.xlsx</a>
<a @click="downFile('csv')">.csv</a>
</a-space>
</j-space>
</div>
</a-space>
</j-space>
<div style="margin-top: 20px" v-if="importLoading">
<a-badge v-if="flag" status="processing" text="进行中" />
<a-badge v-else status="success" text="已完成" />
<j-badge v-if="flag" status="processing" text="进行中" />
<j-badge v-else status="success" text="已完成" />
<span>总数量{{ count }}</span>
<p style="color: red">{{ errMessage }}</p>
</div>

View File

@ -4,7 +4,6 @@
width="800px"
:visible="true"
title="导入"
@ok="handleSave"
@cancel="handleCancel"
>
<div style="margin-top: 10px">
@ -44,6 +43,9 @@
</j-row>
</j-form>
</div>
<template #footer>
<j-button type="primary" @click="handleSave">关闭</j-button>
</template>
</j-modal>
</template>
@ -100,6 +102,7 @@ const handleCancel = () => {
};
const handleSave = () => {
emit('close');
emit('save');
};
</script>

View File

@ -193,6 +193,8 @@ watch(
}
});
Object.assign(modelRef, newValue);
// description describe
modelRef.describe = newValue?.describe || newValue?.description
},
{ immediate: true, deep: true },
);

View File

@ -117,11 +117,16 @@ const routeChange = async (id: string) => {
});
}
}
watch(
() => route.params.id,
(id) => routeChange(id as string),
{ immediate: true }
)
// watch(
// () => route.params.id,
// (id) => routeChange(id as string),
// { immediate: true }
// )
onMounted(() => {
routeChange(route.params.id as string)
})
watch(
() => [props.visible, props.type],

View File

@ -12,7 +12,7 @@
placeholder="请输入时间"
v-model:value="_value"
:precision="3"
:min="0"
:min="0.001"
:max="65535"
>
<template #addonAfter>
@ -60,8 +60,8 @@ const unit = ref<'seconds' | 'minutes' | 'hours'>(
watch(
() => props.value,
(newVal) => {
_value.value = newVal?.time || 0
unit.value = newVal?.unit || 'seconds'
_value.value = newVal?.time || 0;
unit.value = newVal?.unit || 'seconds';
},
{
immediate: true,
@ -73,17 +73,21 @@ const onCancel = () => {
emit('cancel');
};
const onOk = () => {
if (unref(_value) || unref(_value) === 0) {
if (unref(_value)) {
emit(
'save',
{
time: _value.value,
unit: unit.value,
},
{
name: `${_value.value} ${
timeUnitEnum[unit.value]
}执行后续动作`,
},
);
} else {
onlyMessage('请输入时间', 'error');
}
emit(
'save',
{
time: _value.value,
unit: unit.value,
},
{ name: `${_value.value} ${timeUnitEnum[unit.value]}后,执行后续动作` },
);
};
</script>

View File

@ -172,9 +172,8 @@ const handleClick = (_detail: any) => {
};
watch(() => props.value?.[0]?.value, (newVal) => {
console.log(newVal, '123')
if(newVal){
detail(newVal[0]?.value).then(resp => {
detail(newVal).then(resp => {
emit('change', resp.result);
})
}

View File

@ -99,7 +99,7 @@ const handleItem = (data: any) => {
valueType: data.valueType ? data.valueType.type : '-',
format: data.valueType ? data.valueType.format : undefined,
options: data.valueType ? data.valueType.elements : undefined,
value: data.value,
value: data?.value,
};
};
@ -135,9 +135,9 @@ watch(
options.value = newTag.map((item: any) => {
return { label: item.name, value: item.id, ...item };
});
if (newVal && newVal[0] && newVal[0].name && newTag && newTag.length) {
if (newVal && newVal[0] && newVal[0]?.name && newTag && newTag.length) {
const names: string[] = [];
const newTagList = newVal[0].value
const newTagList = newVal[0]?.value
.filter((valueItem: any) => {
return newTag.some(
(item: any) => valueItem.column === item.id,
@ -151,8 +151,8 @@ watch(
names.push(oldItem.name);
return {
...handleItem(oldItem),
value: valueItem.value,
type: valueItem.type,
value: valueItem?.value,
type: valueItem?.type,
};
}
return valueItem;
@ -169,12 +169,12 @@ watch(
);
const onValueChange = () => {
const _data = tagList.value.filter((item) => !!item.value);
const _data = tagList.value.filter((item) => !!item?.value);
const newValue = _data.map((item: any) => {
return {
column: item.id,
type: item.type,
value: item.value,
type: item?.type,
value: item?.value,
};
});
emits('update:value', [{ value: newValue, name: '标签' }]);

View File

@ -77,10 +77,10 @@
钉钉
</span>
<span class="notify-text-highlight">{{
options?.orgName || ''
options?.sendTo || ''
}}</span>
<span class="notify-text-highlight">{{
options?.sendTo || ''
options?.orgName || ''
}}</span>
发送
<span class="notify-text-highlight">
@ -107,10 +107,10 @@
微信
</span>
<span class="notify-text-highlight">{{
options?.orgName || ''
options?.sendTo || ''
}}</span>
<span class="notify-text-highlight">{{
options?.sendTo || ''
options?.orgName || ''
}}</span>
<span class="notify-text-highlight">{{
options?.tagName || ''

View File

@ -44,7 +44,12 @@
v-else-if="getType(item) === 'link'"
v-model:value="modelRef[item.id]"
/>
<BuildIn v-else :item="item" v-model:value="modelRef[item.id]" />
<BuildIn
v-else
:item="item"
v-model:value="modelRef[item.id]"
@change="(val) => onChange(val, 'build-in')"
/>
</j-form-item>
</j-form>
</template>
@ -79,7 +84,6 @@ const formRef = ref();
const modelRef = reactive({});
watchEffect(() => {
console.log(props?.value)
Object.assign(modelRef, props?.value);
});
@ -88,6 +92,9 @@ const getType = (item: any) => {
};
const checkValue = (_rule: any, value: any, item: any) => {
if(!value){
return Promise.resolve();
}
const type = item.expands?.businessType || item?.type;
if (type === 'file') {
return Promise.resolve();
@ -153,7 +160,7 @@ const checkValue = (_rule: any, value: any, item: any) => {
if (
props.notify.notifyType &&
['sms', 'voice'].includes(props?.notify?.notifyType) &&
value?.source !== 'relation'
value?.source !== 'relation' && value?.value
) {
const reg = /^[1][3-9]\d{9}$/;
if (!reg.test(value?.value)) {
@ -173,6 +180,8 @@ const onChange = (val: any, type: any) => {
emit('change', { tagName: val });
} else if (type === 'user') {
emit('change', { sendTo: val });
} else if (type === 'build-in') {
// emit('change', { sendTo: val });
}
};

View File

@ -16,12 +16,14 @@
placeholder="请选择参数"
style="width: calc(100% - 120px)"
:fieldNames="{ label: 'name', value: 'id' }"
@change="(val) => itemOnChange(undefined, val)"
@change="(val, label) => itemOnChange(undefined, val, label)"
>
<template #title="{ fullName, description }">
<j-space>
{{ fullName }}
<span style="color: grey; margin-left: 5px">{{ description }}</span>
<span style="color: grey; margin-left: 5px">{{
description
}}</span>
</j-space>
</template>
</j-tree-select>
@ -84,7 +86,7 @@ const props = defineProps({
},
});
const emit = defineEmits(['update:value']);
const emit = defineEmits(['update:value', 'change']);
const source = computed(() => {
return props.value?.source || 'fixed';
@ -97,15 +99,18 @@ const sourceChange = (val: any) => {
emit('update:value', {
...props.value,
source: val,
value: undefined
value: undefined,
});
};
const itemOnChange = (val: any, _upperKey?: string) => {
const itemOnChange = (val: any, _upperKey?: string, label?: any) => {
emit('update:value', {
...props.value,
value: val,
upperKey: _upperKey
upperKey: _upperKey,
});
emit('change', {
sendTo: label?.[0] || val,
});
};
@ -164,7 +169,7 @@ watch(
watch(
() => props.value.upperKey,
(newVal) => {
upperKey.value = newVal
upperKey.value = newVal;
},
{ immediate: true },
);