diff --git a/src/views/camel-oil-info/prefetch/components/prefetch-logs.vue b/src/views/camel-oil-info/prefetch/components/prefetch-logs.vue index df0a3a8..4b760f7 100644 --- a/src/views/camel-oil-info/prefetch/components/prefetch-logs.vue +++ b/src/views/camel-oil-info/prefetch/components/prefetch-logs.vue @@ -84,18 +84,26 @@ :key="log.timestamp || index" class="log-entry" > -
- {{ formatDateTime(log.timestamp) }} -
-
-
- 响应数据: -
-
+
+ {{ formatDateTime(log.timestamp) }} + | + {{ log.responseData || '无响应数据' }} -
+
+ +
+ + 加载更多日志... +
+ +
+ 已加载全部日志 +
@@ -103,7 +111,7 @@ diff --git a/src/views/camel-oil-info/prefetch/components/settings-form.vue b/src/views/camel-oil-info/prefetch/components/settings-form.vue index e5c830f..563734e 100644 --- a/src/views/camel-oil-info/prefetch/components/settings-form.vue +++ b/src/views/camel-oil-info/prefetch/components/settings-form.vue @@ -7,136 +7,167 @@ label-align="left" @submit="handleSubmit" > - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + + + + - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + -
-
+ + + + + + + + + + + + + + + + + + + +
@@ -196,11 +228,11 @@ -
+
- + @@ -278,9 +310,6 @@ const columns: TableColumnData[] = [ ]; const addDenomination = () => { - if (!formModel.targetDenominations) { - formModel.targetDenominations = []; - } formModel.targetDenominations.push({ denomination: null, minCapacity: null, @@ -288,6 +317,23 @@ const addDenomination = () => { }); }; +const validateDenomination = (index: number) => { + const currentItem = formModel.targetDenominations[index]; + if (!currentItem.denomination) return; + + // 检查是否有重复的面额 + const duplicateIndex = formModel.targetDenominations.findIndex( + (item, i) => i !== index && item.denomination === currentItem.denomination + ); + + if (duplicateIndex !== -1) { + Message.warning( + `面额 ${currentItem.denomination} 已存在,请修改为不同的面额值` + ); + currentItem.denomination = null; + } +}; + const removeDenomination = (index: number) => { formModel.targetDenominations.splice(index, 1); }; @@ -297,10 +343,7 @@ const handleSubmit = async () => { // 验证豪猪平台设置 if (formModel.useHaozhuPlatform) { if (!formModel.haozhuUsername || !formModel.haozhuPassword) { - Message.warning({ - content: '启用豪猪平台时请填写用户名和密码', - duration: 3000 - }); + Message.warning('启用豪猪平台时请填写用户名和密码'); return; } } @@ -312,21 +355,29 @@ const handleSubmit = async () => { ) { for (let i = 0; i < formModel.targetDenominations.length; i++) { const item = formModel.targetDenominations[i]; - if (!item.denomination || !item.minCapacity || !item.targetCapacity) { - Message.warning({ - content: `请完善第${i + 1}个面额设置的必填项`, - duration: 3000 - }); + if ( + !item.denomination || + item.minCapacity === null || + !item.targetCapacity + ) { + Message.warning(`请完善第${i + 1}个面额设置的必填项`); return; } if (item.minCapacity >= item.targetCapacity) { - Message.warning({ - content: `第${i + 1}个面额设置的最小库存必须小于目标库存`, - duration: 3000 - }); + Message.warning(`第${i + 1}个面额设置的最小库存必须小于目标库存`); return; } } + + // 检查面额重复 + const denominations = formModel.targetDenominations.map( + item => item.denomination + ); + const uniqueDenominations = [...new Set(denominations)]; + if (denominations.length !== uniqueDenominations.length) { + Message.warning('存在重复的面额设置,请确保每个面额值都是唯一的'); + return; + } } setLoading(true); @@ -334,16 +385,10 @@ const handleSubmit = async () => { kamiApiCamelOilV1UpdateSettingsReq: { ...formModel } }); - Message.success({ - content: '设置保存成功', - duration: 2000 - }); + Message.success('设置保存成功'); } catch (error) { console.error('保存设置失败:', error); - Message.error({ - content: '保存设置失败', - duration: 2000 - }); + Message.error('保存设置失败'); } finally { setLoading(false); } @@ -364,38 +409,17 @@ const loadSettings = async () => { } } catch (error) { console.error('获取设置失败:', error); - Message.error({ - content: '获取设置失败', - duration: 2000 - }); + Message.error('获取设置失败'); } finally { setLoading(false); } }; // 组件挂载时加载设置 -onMounted(() => { - loadSettings(); -}); +onMounted(loadSettings);