Commit cfb654e3007882fd5d4ed4ca50268e3f7b57a3de
1 parent
fb677d76
fix: 优化问题列表,添加是否属于跟单部分
Showing
6 changed files
with
270 additions
and
36 deletions
src/api/project/quest.ts
... | ... | @@ -82,7 +82,8 @@ export const getQuestReleaseData = async (id: number) => { |
82 | 82 | */ |
83 | 83 | export const getAllQuests = async () => { |
84 | 84 | const res = await defHttp.post<any>({ |
85 | - url: Api.QUEST_GET_ALL | |
85 | + url: Api.QUEST_GET_ALL, | |
86 | + data: { isTrackerBlock: true } | |
86 | 87 | }); |
87 | 88 | return res; |
88 | 89 | }; |
... | ... | @@ -95,7 +96,7 @@ export const getAllQuests = async () => { |
95 | 96 | export const queryQuestTitle = async (title: string) => { |
96 | 97 | const res = await defHttp.post<any>({ |
97 | 98 | url: Api.QUEST_QUERY_TITLE, |
98 | - data: { title } | |
99 | + data: { title ,isTrackerBlock:true} | |
99 | 100 | }); |
100 | 101 | return res; |
101 | 102 | }; | ... | ... |
src/views/project/finance/financeList/TrackEdit.vue
... | ... | @@ -49,7 +49,7 @@ |
49 | 49 | style="width: 100%" |
50 | 50 | :filter-option="false" |
51 | 51 | show-search |
52 | - :disabled="status === 10" | |
52 | + :disabled="status === 10 || status === 40" | |
53 | 53 | @search="handleSearch" |
54 | 54 | @change="handleTitleChange" |
55 | 55 | :loading="titleLoading" |
... | ... | @@ -118,6 +118,8 @@ |
118 | 118 | const bindedDeductAmount = ref<number | undefined>(undefined); |
119 | 119 | // 添加金额不一致的提示状态 |
120 | 120 | const amountMismatch = ref(false); |
121 | + // 添加是否为模板的标志 | |
122 | + const isSelectedTemplate = ref(false); | |
121 | 123 | |
122 | 124 | // 转换为antd需要的options格式 |
123 | 125 | const formattedOptions = computed(() => { |
... | ... | @@ -127,7 +129,30 @@ |
127 | 129 | })); |
128 | 130 | }); |
129 | 131 | |
132 | + | |
133 | + // 添加完全重置状态的函数 | |
134 | + function resetAllStates() { | |
135 | + // 重置扣款金额相关状态 | |
136 | + bindedDeductAmount.value = undefined; | |
137 | + amountMismatch.value = false; | |
138 | + isSelectedTemplate.value = false; | |
139 | + | |
140 | + // 重置选择状态 | |
141 | + selectedTitle.value = undefined; | |
142 | + selectedTitleText.value = ''; | |
143 | + | |
144 | + // 重置选项 | |
145 | + titleOptions.value = []; | |
146 | + | |
147 | + // 重置文件上传 | |
148 | + fileList.value = []; | |
149 | + } | |
150 | + | |
130 | 151 | const [register, { closeDrawer }] = useDrawerInner((data) => { |
152 | + // 每次打开抽屉时先重置所有状态 | |
153 | + resetAllStates(); | |
154 | + | |
155 | + // 然后初始化新的状态 | |
131 | 156 | status.value = data.data.invoiceStatus; |
132 | 157 | id.value = data.data.invoiceId; |
133 | 158 | invoiceNo.value = data.data.invoiceNo; |
... | ... | @@ -143,7 +168,7 @@ |
143 | 168 | }); |
144 | 169 | |
145 | 170 | // 处理API返回的数据,统一格式 |
146 | - function normalizeData(data: any[]): { id: number; title: string; deductAmount?: number }[] { | |
171 | + function normalizeData(data: any[]): { id: number; title: string; deductAmount?: number; isTemplate?: boolean }[] { | |
147 | 172 | |
148 | 173 | if (!data || !Array.isArray(data) || data.length === 0) { |
149 | 174 | return []; |
... | ... | @@ -160,8 +185,9 @@ |
160 | 185 | |
161 | 186 | // 添加新的deductAmount字段处理 |
162 | 187 | const deductAmount = item.deductAmount !== undefined ? Number(item.deductAmount) : undefined; |
163 | - | |
164 | - return { id, title, deductAmount }; | |
188 | + // 正确处理isTemplate字段,确保它是布尔值 | |
189 | + const isTemplate = item.isTemplate !== undefined ? Boolean(item.isTemplate) : undefined; | |
190 | + return { id, title, deductAmount, isTemplate }; | |
165 | 191 | }).filter(item => item.id !== null); // 过滤掉无效项 |
166 | 192 | return result; |
167 | 193 | } |
... | ... | @@ -180,9 +206,13 @@ |
180 | 206 | titleOptions.value = [{ |
181 | 207 | id: richTextDetail.id, |
182 | 208 | title: richTextDetail.title || '扣款原因详情', |
183 | - deductAmount: richTextDetail.deductAmount // 确保获取deductAmount | |
209 | + deductAmount: richTextDetail.deductAmount, // 确保获取deductAmount | |
210 | + isTemplate: richTextDetail.isTemplate === true // 确保是布尔值 | |
184 | 211 | }]; |
185 | 212 | selectedTitleText.value = richTextDetail.title || '扣款原因详情'; |
213 | + // 保存是否为模板的标志 | |
214 | + isSelectedTemplate.value = richTextDetail.isTemplate === true; | |
215 | + | |
186 | 216 | // 绑定deductAmount如果存在 |
187 | 217 | if (richTextDetail.deductAmount !== undefined) { |
188 | 218 | bindedDeductAmount.value = Number(richTextDetail.deductAmount); |
... | ... | @@ -219,6 +249,8 @@ |
219 | 249 | const found = titleOptions.value.find(item => item.id === selectedTitle.value); |
220 | 250 | if (found) { |
221 | 251 | selectedTitleText.value = found.title; |
252 | + // 保存是否为模板的标志 | |
253 | + isSelectedTemplate.value = !!found.isTemplate; | |
222 | 254 | // 绑定deductAmount如果存在 |
223 | 255 | if (found.deductAmount !== undefined) { |
224 | 256 | bindedDeductAmount.value = Number(found.deductAmount); |
... | ... | @@ -233,9 +265,13 @@ |
233 | 265 | titleOptions.value.push({ |
234 | 266 | id: richTextDetail.id, |
235 | 267 | title: richTextDetail.title || '扣款原因详情', |
236 | - deductAmount: richTextDetail.deductAmount // 确保获取deductAmount | |
268 | + deductAmount: richTextDetail.deductAmount, // 确保获取deductAmount | |
269 | + isTemplate: richTextDetail.isTemplate === true // 确保是布尔值 | |
237 | 270 | }); |
238 | 271 | selectedTitleText.value = richTextDetail.title || '扣款原因详情'; |
272 | + // 保存是否为模板的标志 | |
273 | + isSelectedTemplate.value = richTextDetail.isTemplate === true; | |
274 | + | |
239 | 275 | // 绑定deductAmount如果存在 |
240 | 276 | if (richTextDetail.deductAmount !== undefined) { |
241 | 277 | bindedDeductAmount.value = Number(richTextDetail.deductAmount); |
... | ... | @@ -323,6 +359,9 @@ |
323 | 359 | const found = titleOptions.value.find(item => item.id === value); |
324 | 360 | if (found) { |
325 | 361 | selectedTitleText.value = found.title; |
362 | + // 保存是否为模板的标志 - 确保它是布尔值 | |
363 | + isSelectedTemplate.value = found.isTemplate === true; | |
364 | + | |
326 | 365 | // 绑定deductAmount |
327 | 366 | bindedDeductAmount.value = found.deductAmount; |
328 | 367 | // 检查金额是否一致 |
... | ... | @@ -338,13 +377,20 @@ |
338 | 377 | bindedDeductAmount.value = undefined; |
339 | 378 | // 重置金额不匹配状态 |
340 | 379 | amountMismatch.value = false; |
341 | - | |
380 | + // 重置是否为模板的标志 | |
381 | + isSelectedTemplate.value = false; | |
342 | 382 | // 重新加载所有选项 |
343 | 383 | loadQuestOptions(); |
344 | 384 | } |
345 | 385 | |
346 | 386 | // 检查金额是否匹配 |
347 | 387 | function checkAmountMatch() { |
388 | + // 如果是模板类型,不进行金额校验 | |
389 | + if (isSelectedTemplate.value === true) { | |
390 | + amountMismatch.value = false; | |
391 | + return; | |
392 | + } | |
393 | + | |
348 | 394 | if (bindedDeductAmount.value !== undefined && input1.value !== undefined) { |
349 | 395 | try { |
350 | 396 | // 确保转换为数字进行比较,处理可能的字符串转换问题 |
... | ... | @@ -381,6 +427,9 @@ |
381 | 427 | if (visible) { |
382 | 428 | // 抽屉打开时加载扣款原因选项 |
383 | 429 | // loadQuestOptions(); |
430 | + } else { | |
431 | + // 抽屉关闭时重置状态,确保下次打开时不会保留旧状态 | |
432 | + resetAllStates(); | |
384 | 433 | } |
385 | 434 | } |
386 | 435 | |
... | ... | @@ -407,8 +456,8 @@ |
407 | 456 | return; |
408 | 457 | } |
409 | 458 | |
410 | - // 添加金额不一致的检查 | |
411 | - if (amountMismatch.value) { | |
459 | + // 添加金额不一致的检查,但模板类型跳过检查 | |
460 | + if (amountMismatch.value && !isSelectedTemplate.value) { | |
412 | 461 | error(`客户扣款金额与选择的扣款原因金额不一致!扣款原因金额为: ${bindedDeductAmount.value}`); |
413 | 462 | return; |
414 | 463 | } |
... | ... | @@ -421,7 +470,10 @@ |
421 | 470 | deductUrl: deductUrl.value, |
422 | 471 | questId: selectedTitle.value, // 传递选中的扣款原因ID |
423 | 472 | }); |
424 | - fileList.value = []; | |
473 | + | |
474 | + // 成功提交后重置状态 | |
475 | + resetAllStates(); | |
476 | + | |
425 | 477 | emit('success'); |
426 | 478 | closeDrawer(); |
427 | 479 | } catch (err) { | ... | ... |
src/views/project/finance/financeList/TrackEditCheck.vue
... | ... | @@ -69,7 +69,7 @@ |
69 | 69 | style="width: 100%" |
70 | 70 | :filter-option="false" |
71 | 71 | show-search |
72 | - :disabled="status === 10" | |
72 | + :disabled="status === 10 || status === 40" | |
73 | 73 | @search="handleSearch" |
74 | 74 | @change="handleTitleChange" |
75 | 75 | :loading="titleLoading" |
... | ... | @@ -125,7 +125,9 @@ |
125 | 125 | const bindedDeductAmount = ref<number | undefined>(undefined); |
126 | 126 | // 添加金额不一致的提示状态 |
127 | 127 | const amountMismatch = ref(false); |
128 | - | |
128 | + // 添加是否为模板的标志 | |
129 | + const isSelectedTemplate = ref(false); | |
130 | + | |
129 | 131 | // 转换为antd需要的options格式 |
130 | 132 | const formattedOptions = computed(() => { |
131 | 133 | return titleOptions.value.map(item => ({ |
... | ... | @@ -133,8 +135,34 @@ |
133 | 135 | label: item.title, |
134 | 136 | })); |
135 | 137 | }); |
138 | + | |
139 | + // 添加完全重置状态的函数 | |
140 | + function resetAllStates() { | |
141 | + // 重置扣款金额相关状态 | |
142 | + bindedDeductAmount.value = undefined; | |
143 | + amountMismatch.value = false; | |
144 | + isSelectedTemplate.value = false; | |
145 | + | |
146 | + // 重置选择状态 | |
147 | + selectedTitle.value = undefined; | |
148 | + selectedTitleText.value = ''; | |
149 | + | |
150 | + // 重置选项 | |
151 | + titleOptions.value = []; | |
152 | + | |
153 | + // 重置文件上传 | |
154 | + fileList.value = []; | |
155 | + | |
156 | + // 重置部门和金额输入 | |
157 | + input1.value = 0; | |
158 | + deductDept.value = ''; | |
159 | + } | |
136 | 160 | |
137 | 161 | const [register, { closeDrawer }] = useDrawerInner((data) => { |
162 | + // 每次打开抽屉时先重置所有状态 | |
163 | + resetAllStates(); | |
164 | + | |
165 | + // 然后初始化新的状态 | |
138 | 166 | status.value = data.data.checkPayStatus; |
139 | 167 | id.value = data.data.checkId; |
140 | 168 | checkNo.value = data.data.checkNo; |
... | ... | @@ -151,7 +179,7 @@ |
151 | 179 | }); |
152 | 180 | |
153 | 181 | // 处理API返回的数据,统一格式 |
154 | - function normalizeData(data: any[]): { id: number; title: string; deductAmount?: number }[] { | |
182 | + function normalizeData(data: any[]): { id: number; title: string; deductAmount?: number; isTemplate?: boolean }[] { | |
155 | 183 | |
156 | 184 | if (!data || !Array.isArray(data) || data.length === 0) { |
157 | 185 | return []; |
... | ... | @@ -169,7 +197,12 @@ |
169 | 197 | // 添加新的deductAmount字段处理 |
170 | 198 | const deductAmount = item.deductAmount !== undefined ? Number(item.deductAmount) : undefined; |
171 | 199 | |
172 | - return { id, title, deductAmount }; | |
200 | + // 正确处理isTemplate字段,确保它是布尔值 | |
201 | + const isTemplate = item.isTemplate !== undefined ? Boolean(item.isTemplate) : undefined; | |
202 | + | |
203 | + | |
204 | + | |
205 | + return { id, title, deductAmount, isTemplate }; | |
173 | 206 | }).filter(item => item.id !== null); // 过滤掉无效项 |
174 | 207 | |
175 | 208 | return result; |
... | ... | @@ -185,13 +218,21 @@ |
185 | 218 | // 使用finance.data.ts中的handleViewRichText方法获取富文本详情 |
186 | 219 | const richTextDetail = await handleViewRichText(String(selectedTitle.value)); |
187 | 220 | if (richTextDetail) { |
221 | + // 输出详细数据供调试 | |
222 | + | |
223 | + | |
188 | 224 | // 设置选项 |
189 | 225 | titleOptions.value = [{ |
190 | 226 | id: richTextDetail.id, |
191 | 227 | title: richTextDetail.title || '扣款原因详情', |
192 | - deductAmount: richTextDetail.deductAmount // 确保获取deductAmount | |
228 | + deductAmount: richTextDetail.deductAmount, // 确保获取deductAmount | |
229 | + isTemplate: richTextDetail.isTemplate === true // 确保是布尔值 | |
193 | 230 | }]; |
194 | 231 | selectedTitleText.value = richTextDetail.title || '扣款原因详情'; |
232 | + // 保存是否为模板的标志 | |
233 | + isSelectedTemplate.value = richTextDetail.isTemplate === true; | |
234 | + | |
235 | + | |
195 | 236 | // 绑定deductAmount如果存在 |
196 | 237 | if (richTextDetail.deductAmount !== undefined) { |
197 | 238 | bindedDeductAmount.value = Number(richTextDetail.deductAmount); |
... | ... | @@ -228,6 +269,8 @@ |
228 | 269 | const found = titleOptions.value.find(item => item.id === selectedTitle.value); |
229 | 270 | if (found) { |
230 | 271 | selectedTitleText.value = found.title; |
272 | + // 保存是否为模板的标志 | |
273 | + isSelectedTemplate.value = !!found.isTemplate; | |
231 | 274 | // 绑定deductAmount如果存在 |
232 | 275 | if (found.deductAmount !== undefined) { |
233 | 276 | bindedDeductAmount.value = Number(found.deductAmount); |
... | ... | @@ -242,9 +285,13 @@ |
242 | 285 | titleOptions.value.push({ |
243 | 286 | id: richTextDetail.id, |
244 | 287 | title: richTextDetail.title || '扣款原因详情', |
245 | - deductAmount: richTextDetail.deductAmount // 确保获取deductAmount | |
288 | + deductAmount: richTextDetail.deductAmount, // 确保获取deductAmount | |
289 | + isTemplate: richTextDetail.isTemplate === true // 确保是布尔值 | |
246 | 290 | }); |
247 | 291 | selectedTitleText.value = richTextDetail.title || '扣款原因详情'; |
292 | + // 保存是否为模板的标志 | |
293 | + isSelectedTemplate.value = richTextDetail.isTemplate === true; | |
294 | + | |
248 | 295 | // 绑定deductAmount如果存在 |
249 | 296 | if (richTextDetail.deductAmount !== undefined) { |
250 | 297 | bindedDeductAmount.value = Number(richTextDetail.deductAmount); |
... | ... | @@ -334,6 +381,9 @@ |
334 | 381 | const found = titleOptions.value.find(item => item.id === value); |
335 | 382 | if (found) { |
336 | 383 | selectedTitleText.value = found.title; |
384 | + // 保存是否为模板的标志 - 确保它是布尔值 | |
385 | + isSelectedTemplate.value = found.isTemplate === true; | |
386 | + | |
337 | 387 | // 绑定deductAmount |
338 | 388 | bindedDeductAmount.value = found.deductAmount; |
339 | 389 | // 检查金额是否一致 |
... | ... | @@ -349,7 +399,9 @@ |
349 | 399 | bindedDeductAmount.value = undefined; |
350 | 400 | // 重置金额不匹配状态 |
351 | 401 | amountMismatch.value = false; |
352 | - | |
402 | + // 重置是否为模板的标志 | |
403 | + isSelectedTemplate.value = false; | |
404 | + | |
353 | 405 | // 重新加载所有选项 |
354 | 406 | loadQuestOptions(); |
355 | 407 | } |
... | ... | @@ -371,6 +423,9 @@ |
371 | 423 | if (visible) { |
372 | 424 | // 抽屉打开时加载扣款原因选项 |
373 | 425 | // loadQuestOptions(); |
426 | + } else { | |
427 | + // 抽屉关闭时重置状态,确保下次打开时不会保留旧状态 | |
428 | + resetAllStates(); | |
374 | 429 | } |
375 | 430 | } |
376 | 431 | |
... | ... | @@ -381,6 +436,12 @@ |
381 | 436 | |
382 | 437 | // 检查金额是否匹配 |
383 | 438 | function checkAmountMatch() { |
439 | + // 如果是模板类型,不进行金额校验 | |
440 | + if (isSelectedTemplate.value === true) { | |
441 | + amountMismatch.value = false; | |
442 | + return; | |
443 | + } | |
444 | + | |
384 | 445 | if (bindedDeductAmount.value !== undefined && input1.value !== undefined) { |
385 | 446 | try { |
386 | 447 | // 确保转换为数字进行比较,处理可能的字符串转换问题 |
... | ... | @@ -418,8 +479,8 @@ |
418 | 479 | return; |
419 | 480 | } |
420 | 481 | |
421 | - // 添加金额不一致的检查 | |
422 | - if (amountMismatch.value) { | |
482 | + // 添加金额不一致的检查,但模板类型跳过检查 | |
483 | + if (amountMismatch.value && !isSelectedTemplate.value) { | |
423 | 484 | error(`生产科扣款金额与选择的扣款原因金额不一致!扣款原因金额为: ${bindedDeductAmount.value}`); |
424 | 485 | return; |
425 | 486 | } |
... | ... | @@ -433,7 +494,10 @@ |
433 | 494 | deductUrl: deductUrl.value, |
434 | 495 | questId: selectedTitle.value, // 传递选中的扣款原因ID |
435 | 496 | }); |
436 | - fileList.value = []; | |
497 | + | |
498 | + // 成功提交后重置状态 | |
499 | + resetAllStates(); | |
500 | + | |
437 | 501 | emit('success'); |
438 | 502 | closeDrawer(); |
439 | 503 | } catch (err) { | ... | ... |
src/views/project/finance/financeList/index.vue
... | ... | @@ -419,7 +419,9 @@ |
419 | 419 | contentText: data.contentText || '', |
420 | 420 | contentImages: data.contentImages || [], |
421 | 421 | files: data.files || [], |
422 | - questType: data.questType || '' | |
422 | + questType: data.questType || '', | |
423 | + deductAmount: data.deductAmount, // 确保传递扣款金额 | |
424 | + isRmb: data.isRmb // 确保传递货币类型 | |
423 | 425 | }; |
424 | 426 | |
425 | 427 | // 打开抽屉组件显示数据 | ... | ... |
src/views/project/quest/QuestDrawer.vue
... | ... | @@ -186,6 +186,22 @@ |
186 | 186 | { label: '人民币 (¥)', value: '1' } |
187 | 187 | ]; |
188 | 188 | |
189 | + // 是否作为模板 - 用于动态控制表单显示 | |
190 | + const isTemplateEnabled = ref(false); | |
191 | + | |
192 | + // 监听模板状态变化 | |
193 | + function handleTemplateChange(value: boolean) { | |
194 | + isTemplateEnabled.value = value; | |
195 | + } | |
196 | + | |
197 | + // 是否为跟单相关扣款 | |
198 | + const isTrackerBlockEnabled = ref(false); | |
199 | + | |
200 | + // 监听跟单相关扣款状态变化 | |
201 | + function handleTrackerBlockChange(value: boolean) { | |
202 | + isTrackerBlockEnabled.value = value; | |
203 | + } | |
204 | + | |
189 | 205 | // 问题类型选项计算属性 |
190 | 206 | const questTypeOptions = computed(() => { |
191 | 207 | return questTypeList.value.map(item => ({ |
... | ... | @@ -194,6 +210,18 @@ |
194 | 210 | })); |
195 | 211 | }); |
196 | 212 | |
213 | + // 是否作为模板的选项 | |
214 | + const templateOptions = [ | |
215 | + { label: '是', value: true }, | |
216 | + { label: '否', value: false } | |
217 | + ]; | |
218 | + | |
219 | + // 是否为跟单相关扣款的选项 | |
220 | + const trackerBlockOptions = [ | |
221 | + { label: '是', value: true }, | |
222 | + { label: '否', value: false } | |
223 | + ]; | |
224 | + | |
197 | 225 | // 获取问题类型列表 |
198 | 226 | async function fetchQuestTypes() { |
199 | 227 | loadingQuestTypes.value = true; |
... | ... | @@ -532,11 +560,51 @@ |
532 | 560 | }), |
533 | 561 | }, |
534 | 562 | { |
563 | + field: 'isTemplate', | |
564 | + label: '是否作为模板', | |
565 | + component: 'RadioButtonGroup' as any, | |
566 | + defaultValue: false, | |
567 | + required: true, | |
568 | + componentProps: { | |
569 | + options: templateOptions, | |
570 | + // 编辑模式和查看模式下都禁用 | |
571 | + disabled: unref(isView), | |
572 | + // 添加自定义样式类 | |
573 | + class: 'template-radio-group', | |
574 | + // 监听变化 | |
575 | + onChange: handleTemplateChange, | |
576 | + style: 'width: 100%;', // 保证控件利用可用空间 | |
577 | + }, | |
578 | + colProps: { span: 12 }, // 占用半行 | |
579 | + itemProps: { | |
580 | + labelAlign: 'left', // 标签左对齐 | |
581 | + }, | |
582 | + }, | |
583 | + { | |
584 | + field: 'isTrackerBlock', | |
585 | + label: '是否跟单相关扣款', | |
586 | + component: 'RadioButtonGroup' as any, | |
587 | + defaultValue: false, | |
588 | + required: true, | |
589 | + componentProps: { | |
590 | + options: trackerBlockOptions, | |
591 | + disabled: unref(isView), | |
592 | + class: 'template-radio-group', // 复用同样的样式 | |
593 | + onChange: handleTrackerBlockChange, | |
594 | + style: 'width: 100%;', // 保证控件利用可用空间 | |
595 | + }, | |
596 | + colProps: { span: 12 }, // 占用半行 | |
597 | + itemProps: { | |
598 | + labelAlign: 'left', // 标签左对齐 | |
599 | + }, | |
600 | + }, | |
601 | + { | |
535 | 602 | field: 'currencySelector', |
536 | 603 | label: '扣款金额', |
537 | 604 | component: 'Select' as any, |
538 | 605 | defaultValue: '0', |
539 | - required: true, | |
606 | + required: ({ values }) => !values.isTemplate, // 模板模式下不必填 | |
607 | + show: ({ values }) => !values.isTemplate, // 模板模式下不显示 | |
540 | 608 | componentProps: { |
541 | 609 | options: currencyOptions, |
542 | 610 | disabled: unref(isView), |
... | ... | @@ -552,7 +620,8 @@ |
552 | 620 | field: 'deductAmount', |
553 | 621 | label: ' ', |
554 | 622 | component: 'InputNumber' as any, |
555 | - required: true, | |
623 | + required: ({ values }) => !values.isTemplate, // 模板模式下不必填 | |
624 | + show: ({ values }) => !values.isTemplate, // 模板模式下不显示 | |
556 | 625 | componentProps: { |
557 | 626 | disabled: unref(isView), |
558 | 627 | min: 0, |
... | ... | @@ -585,7 +654,7 @@ |
585 | 654 | |
586 | 655 | // 注册表单 |
587 | 656 | const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ |
588 | - labelWidth: 100, | |
657 | + labelWidth: 120, | |
589 | 658 | schemas: getFormSchema, //这就是数据。 |
590 | 659 | showActionButtonGroup: false, |
591 | 660 | baseColProps: { span: 24 }, |
... | ... | @@ -614,7 +683,15 @@ |
614 | 683 | |
615 | 684 | if (unref(isUpdate)) { |
616 | 685 | record.value = { ...data.record }; |
686 | + // 设置模板状态 | |
687 | + if (data.record.isTemplate !== undefined) { | |
688 | + isTemplateEnabled.value = data.record.isTemplate; | |
689 | + } | |
617 | 690 | |
691 | + // 设置跟单相关扣款状态 | |
692 | + if (data.record.isTrackerBlock !== undefined) { | |
693 | + isTrackerBlockEnabled.value = data.record.isTrackerBlock; | |
694 | + } | |
618 | 695 | // 设置货币类型 |
619 | 696 | if (data.record.isRmb !== undefined) { |
620 | 697 | currencyType.value = data.record.isRmb; |
... | ... | @@ -635,7 +712,9 @@ |
635 | 712 | currencySelector: data.record.isRmb !== undefined ? data.record.isRmb : '0', |
636 | 713 | }); |
637 | 714 | }, 0); |
638 | - | |
715 | + | |
716 | + // 记录表单设置后的值 | |
717 | + const formValues = await validate(); | |
639 | 718 | // 处理图片数据 |
640 | 719 | try { |
641 | 720 | if (data.record.contentImages) { |
... | ... | @@ -764,10 +843,22 @@ |
764 | 843 | try { |
765 | 844 | const values = await validate(); |
766 | 845 | setDrawerProps({ confirmLoading: true }); |
767 | - | |
846 | + | |
847 | + | |
848 | + // 如果是模板,不需要扣款金额 | |
849 | + if (values.isTemplate) { | |
850 | + // 设置默认值或清空扣款金额 | |
851 | + values.deductAmount = 0; | |
852 | + values.isRmb = '0'; // 默认美元 | |
853 | + } else { | |
768 | 854 | // 添加货币类型参数 |
769 | 855 | values.isRmb = currencyType.value; |
856 | + } | |
770 | 857 | |
858 | + // 确保跟单相关扣款状态保存为布尔值 | |
859 | + if (values.isTrackerBlock !== undefined) { | |
860 | + values.isTrackerBlock = Boolean(values.isTrackerBlock); | |
861 | + } | |
771 | 862 | // 移除辅助字段,不需要提交到后端 |
772 | 863 | delete values.currencySelector; |
773 | 864 | |
... | ... | @@ -794,6 +885,9 @@ |
794 | 885 | setDrawerProps({ confirmLoading: false }); |
795 | 886 | return; |
796 | 887 | } |
888 | + } else { | |
889 | + // 新建模式,确保isTemplate字段已设置 | |
890 | + console.log('是否作为模板:', values.isTemplate); | |
797 | 891 | } |
798 | 892 | |
799 | 893 | // 调用后端API保存数据 |
... | ... | @@ -968,6 +1062,26 @@ export default { |
968 | 1062 | } |
969 | 1063 | } |
970 | 1064 | |
1065 | + | |
1066 | + | |
1067 | +/* 自定义禁用状态下的单选按钮组样式 */ | |
1068 | +:deep(.template-radio-group) { | |
1069 | + .ant-radio-button-wrapper-disabled.ant-radio-button-wrapper-checked { | |
1070 | + /* 选中且禁用状态下的样式 */ | |
1071 | + background-color: #e6f7ff !important; | |
1072 | + color: #1890ff !important; | |
1073 | + border-color: #1890ff !important; | |
1074 | + opacity: 0.8; | |
1075 | + font-weight: bold; | |
1076 | + } | |
1077 | + | |
1078 | + /* 常规禁用状态下的样式 */ | |
1079 | + .ant-radio-button-wrapper-disabled { | |
1080 | + color: rgba(0, 0, 0, 0.65) !important; | |
1081 | + background-color: #f5f5f5; | |
1082 | + opacity: 0.8; | |
1083 | + } | |
1084 | +} | |
971 | 1085 | /* 自定义文件上传样式 */ |
972 | 1086 | .custom-file-upload { |
973 | 1087 | margin-top: 20px; | ... | ... |
src/views/project/quest/quest.data.tsx
... | ... | @@ -137,14 +137,15 @@ export const searchFormSchema: FormSchema[] = [ |
137 | 137 | }, |
138 | 138 | ]; |
139 | 139 | |
140 | -// 导出用于过滤财务专用数据的方法 | |
140 | +// 导出返回所有数据的方法 | |
141 | 141 | export const filterFinancialData = (dataList: any[]) => { |
142 | - const currentRole = user?.roleSmallVO?.code; | |
143 | - console.log('角色'+currentRole); | |
144 | - // 如果用户是管理员或财务,返回所有数据 | |
145 | - if (currentRole === ROLE.ADMIN || currentRole === ROLE.FINANCE) { | |
146 | - return dataList; | |
147 | - } | |
142 | + // const currentRole = user?.roleSmallVO?.code; | |
143 | + // console.log('角色'+currentRole); | |
144 | + // // 如果用户是管理员或财务,返回所有数据 | |
145 | + // if (currentRole === ROLE.ADMIN || currentRole === ROLE.FINANCE) { | |
146 | + // return dataList; | |
147 | + // } | |
148 | 148 | // 否则过滤掉财务专用的数据 |
149 | - return dataList.filter(item => item.questType !== '财务专用'); | |
149 | + // return dataList.filter(item => item.questType !== '财务专用'); | |
150 | + return dataList | |
150 | 151 | }; |
151 | 152 | \ No newline at end of file | ... | ... |