|
|
@@ -412,19 +412,21 @@ const handleSubmit = async () => {
|
|
|
try {
|
|
|
await formRef.value.validate();
|
|
|
|
|
|
+ console.log("🚀 ~ handleSubmit ~ allDeptTreeData.value:", selectData.value)
|
|
|
const formData = {
|
|
|
...form,
|
|
|
commissionRatioLevel1: form.commissionRatioLevel1 || 0,
|
|
|
commissionRatioLevel2: form.commissionRatioLevel2 || 0,
|
|
|
commissionRatioLevel3: form.commissionRatioLevel3 || 0,
|
|
|
systemCode: localStorage.getItem('login_system'),
|
|
|
- excludeDepts: allDeptTreeData.value.map(v => ({ id: v.id, isDistribution: selectData.value.map(k => k.id).includes(v.id) ? '0' : '1' }))
|
|
|
+ excludeDepts: allDeptTreeData.value?.map(v => ({ id: v.id, isDistribution: selectData.value?.map(k => k.id).includes(v.id) ? '0' : '1' })) ?? []
|
|
|
};
|
|
|
await api.saleApi.saveSetting(formData);
|
|
|
|
|
|
ElMessage.success('保存成功');
|
|
|
getDetail()
|
|
|
} catch (error) {
|
|
|
+ console.log("🚀 ~ handleSubmit ~ error:", error)
|
|
|
}
|
|
|
};
|
|
|
const handleUpdate = async () => {
|
|
|
@@ -439,7 +441,7 @@ const handleUpdate = async () => {
|
|
|
commissionRatioLevel2: form.commissionRatioLevel2 || 0,
|
|
|
commissionRatioLevel3: form.commissionRatioLevel3 || 0,
|
|
|
systemCode: localStorage.getItem('login_system'),
|
|
|
- excludeDepts: allDeptTreeData.value.map(v => ({ id: v.id, isDistribution: selectData.value.map(k => k.id).includes(v.id) ? '0' : '1' }))
|
|
|
+ excludeDepts: allDeptTreeData.value?.map(v => ({ id: v.id, isDistribution: selectData.value?.map(k => k.id).includes(v.id) ? '0' : '1' })) ?? []
|
|
|
};
|
|
|
await api.saleApi.update(formData).then((res: any) => {
|
|
|
if (res.code == 200) {
|