Commit cfb654e3007882fd5d4ed4ca50268e3f7b57a3de

Authored by chenhang4442024
1 parent fb677d76

fix: 优化问题列表,添加是否属于跟单部分

src/api/project/quest.ts
@@ -82,7 +82,8 @@ export const getQuestReleaseData = async (id: number) => { @@ -82,7 +82,8 @@ export const getQuestReleaseData = async (id: number) => {
82 */ 82 */
83 export const getAllQuests = async () => { 83 export const getAllQuests = async () => {
84 const res = await defHttp.post<any>({ 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 return res; 88 return res;
88 }; 89 };
@@ -95,7 +96,7 @@ export const getAllQuests = async () =&gt; { @@ -95,7 +96,7 @@ export const getAllQuests = async () =&gt; {
95 export const queryQuestTitle = async (title: string) => { 96 export const queryQuestTitle = async (title: string) => {
96 const res = await defHttp.post<any>({ 97 const res = await defHttp.post<any>({
97 url: Api.QUEST_QUERY_TITLE, 98 url: Api.QUEST_QUERY_TITLE,
98 - data: { title } 99 + data: { title ,isTrackerBlock:true}
99 }); 100 });
100 return res; 101 return res;
101 }; 102 };
src/views/project/finance/financeList/TrackEdit.vue
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 style="width: 100%" 49 style="width: 100%"
50 :filter-option="false" 50 :filter-option="false"
51 show-search 51 show-search
52 - :disabled="status === 10" 52 + :disabled="status === 10 || status === 40"
53 @search="handleSearch" 53 @search="handleSearch"
54 @change="handleTitleChange" 54 @change="handleTitleChange"
55 :loading="titleLoading" 55 :loading="titleLoading"
@@ -118,6 +118,8 @@ @@ -118,6 +118,8 @@
118 const bindedDeductAmount = ref<number | undefined>(undefined); 118 const bindedDeductAmount = ref<number | undefined>(undefined);
119 // 添加金额不一致的提示状态 119 // 添加金额不一致的提示状态
120 const amountMismatch = ref(false); 120 const amountMismatch = ref(false);
  121 + // 添加是否为模板的标志
  122 + const isSelectedTemplate = ref(false);
121 123
122 // 转换为antd需要的options格式 124 // 转换为antd需要的options格式
123 const formattedOptions = computed(() => { 125 const formattedOptions = computed(() => {
@@ -127,7 +129,30 @@ @@ -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 const [register, { closeDrawer }] = useDrawerInner((data) => { 151 const [register, { closeDrawer }] = useDrawerInner((data) => {
  152 + // 每次打开抽屉时先重置所有状态
  153 + resetAllStates();
  154 +
  155 + // 然后初始化新的状态
131 status.value = data.data.invoiceStatus; 156 status.value = data.data.invoiceStatus;
132 id.value = data.data.invoiceId; 157 id.value = data.data.invoiceId;
133 invoiceNo.value = data.data.invoiceNo; 158 invoiceNo.value = data.data.invoiceNo;
@@ -143,7 +168,7 @@ @@ -143,7 +168,7 @@
143 }); 168 });
144 169
145 // 处理API返回的数据,统一格式 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 if (!data || !Array.isArray(data) || data.length === 0) { 173 if (!data || !Array.isArray(data) || data.length === 0) {
149 return []; 174 return [];
@@ -160,8 +185,9 @@ @@ -160,8 +185,9 @@
160 185
161 // 添加新的deductAmount字段处理 186 // 添加新的deductAmount字段处理
162 const deductAmount = item.deductAmount !== undefined ? Number(item.deductAmount) : undefined; 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 }).filter(item => item.id !== null); // 过滤掉无效项 191 }).filter(item => item.id !== null); // 过滤掉无效项
166 return result; 192 return result;
167 } 193 }
@@ -180,9 +206,13 @@ @@ -180,9 +206,13 @@
180 titleOptions.value = [{ 206 titleOptions.value = [{
181 id: richTextDetail.id, 207 id: richTextDetail.id,
182 title: richTextDetail.title || '扣款原因详情', 208 title: richTextDetail.title || '扣款原因详情',
183 - deductAmount: richTextDetail.deductAmount // 确保获取deductAmount 209 + deductAmount: richTextDetail.deductAmount, // 确保获取deductAmount
  210 + isTemplate: richTextDetail.isTemplate === true // 确保是布尔值
184 }]; 211 }];
185 selectedTitleText.value = richTextDetail.title || '扣款原因详情'; 212 selectedTitleText.value = richTextDetail.title || '扣款原因详情';
  213 + // 保存是否为模板的标志
  214 + isSelectedTemplate.value = richTextDetail.isTemplate === true;
  215 +
186 // 绑定deductAmount如果存在 216 // 绑定deductAmount如果存在
187 if (richTextDetail.deductAmount !== undefined) { 217 if (richTextDetail.deductAmount !== undefined) {
188 bindedDeductAmount.value = Number(richTextDetail.deductAmount); 218 bindedDeductAmount.value = Number(richTextDetail.deductAmount);
@@ -219,6 +249,8 @@ @@ -219,6 +249,8 @@
219 const found = titleOptions.value.find(item => item.id === selectedTitle.value); 249 const found = titleOptions.value.find(item => item.id === selectedTitle.value);
220 if (found) { 250 if (found) {
221 selectedTitleText.value = found.title; 251 selectedTitleText.value = found.title;
  252 + // 保存是否为模板的标志
  253 + isSelectedTemplate.value = !!found.isTemplate;
222 // 绑定deductAmount如果存在 254 // 绑定deductAmount如果存在
223 if (found.deductAmount !== undefined) { 255 if (found.deductAmount !== undefined) {
224 bindedDeductAmount.value = Number(found.deductAmount); 256 bindedDeductAmount.value = Number(found.deductAmount);
@@ -233,9 +265,13 @@ @@ -233,9 +265,13 @@
233 titleOptions.value.push({ 265 titleOptions.value.push({
234 id: richTextDetail.id, 266 id: richTextDetail.id,
235 title: richTextDetail.title || '扣款原因详情', 267 title: richTextDetail.title || '扣款原因详情',
236 - deductAmount: richTextDetail.deductAmount // 确保获取deductAmount 268 + deductAmount: richTextDetail.deductAmount, // 确保获取deductAmount
  269 + isTemplate: richTextDetail.isTemplate === true // 确保是布尔值
237 }); 270 });
238 selectedTitleText.value = richTextDetail.title || '扣款原因详情'; 271 selectedTitleText.value = richTextDetail.title || '扣款原因详情';
  272 + // 保存是否为模板的标志
  273 + isSelectedTemplate.value = richTextDetail.isTemplate === true;
  274 +
239 // 绑定deductAmount如果存在 275 // 绑定deductAmount如果存在
240 if (richTextDetail.deductAmount !== undefined) { 276 if (richTextDetail.deductAmount !== undefined) {
241 bindedDeductAmount.value = Number(richTextDetail.deductAmount); 277 bindedDeductAmount.value = Number(richTextDetail.deductAmount);
@@ -323,6 +359,9 @@ @@ -323,6 +359,9 @@
323 const found = titleOptions.value.find(item => item.id === value); 359 const found = titleOptions.value.find(item => item.id === value);
324 if (found) { 360 if (found) {
325 selectedTitleText.value = found.title; 361 selectedTitleText.value = found.title;
  362 + // 保存是否为模板的标志 - 确保它是布尔值
  363 + isSelectedTemplate.value = found.isTemplate === true;
  364 +
326 // 绑定deductAmount 365 // 绑定deductAmount
327 bindedDeductAmount.value = found.deductAmount; 366 bindedDeductAmount.value = found.deductAmount;
328 // 检查金额是否一致 367 // 检查金额是否一致
@@ -338,13 +377,20 @@ @@ -338,13 +377,20 @@
338 bindedDeductAmount.value = undefined; 377 bindedDeductAmount.value = undefined;
339 // 重置金额不匹配状态 378 // 重置金额不匹配状态
340 amountMismatch.value = false; 379 amountMismatch.value = false;
341 - 380 + // 重置是否为模板的标志
  381 + isSelectedTemplate.value = false;
342 // 重新加载所有选项 382 // 重新加载所有选项
343 loadQuestOptions(); 383 loadQuestOptions();
344 } 384 }
345 385
346 // 检查金额是否匹配 386 // 检查金额是否匹配
347 function checkAmountMatch() { 387 function checkAmountMatch() {
  388 + // 如果是模板类型,不进行金额校验
  389 + if (isSelectedTemplate.value === true) {
  390 + amountMismatch.value = false;
  391 + return;
  392 + }
  393 +
348 if (bindedDeductAmount.value !== undefined && input1.value !== undefined) { 394 if (bindedDeductAmount.value !== undefined && input1.value !== undefined) {
349 try { 395 try {
350 // 确保转换为数字进行比较,处理可能的字符串转换问题 396 // 确保转换为数字进行比较,处理可能的字符串转换问题
@@ -381,6 +427,9 @@ @@ -381,6 +427,9 @@
381 if (visible) { 427 if (visible) {
382 // 抽屉打开时加载扣款原因选项 428 // 抽屉打开时加载扣款原因选项
383 // loadQuestOptions(); 429 // loadQuestOptions();
  430 + } else {
  431 + // 抽屉关闭时重置状态,确保下次打开时不会保留旧状态
  432 + resetAllStates();
384 } 433 }
385 } 434 }
386 435
@@ -407,8 +456,8 @@ @@ -407,8 +456,8 @@
407 return; 456 return;
408 } 457 }
409 458
410 - // 添加金额不一致的检查  
411 - if (amountMismatch.value) { 459 + // 添加金额不一致的检查,但模板类型跳过检查
  460 + if (amountMismatch.value && !isSelectedTemplate.value) {
412 error(`客户扣款金额与选择的扣款原因金额不一致!扣款原因金额为: ${bindedDeductAmount.value}`); 461 error(`客户扣款金额与选择的扣款原因金额不一致!扣款原因金额为: ${bindedDeductAmount.value}`);
413 return; 462 return;
414 } 463 }
@@ -421,7 +470,10 @@ @@ -421,7 +470,10 @@
421 deductUrl: deductUrl.value, 470 deductUrl: deductUrl.value,
422 questId: selectedTitle.value, // 传递选中的扣款原因ID 471 questId: selectedTitle.value, // 传递选中的扣款原因ID
423 }); 472 });
424 - fileList.value = []; 473 +
  474 + // 成功提交后重置状态
  475 + resetAllStates();
  476 +
425 emit('success'); 477 emit('success');
426 closeDrawer(); 478 closeDrawer();
427 } catch (err) { 479 } catch (err) {
src/views/project/finance/financeList/TrackEditCheck.vue
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
69 style="width: 100%" 69 style="width: 100%"
70 :filter-option="false" 70 :filter-option="false"
71 show-search 71 show-search
72 - :disabled="status === 10" 72 + :disabled="status === 10 || status === 40"
73 @search="handleSearch" 73 @search="handleSearch"
74 @change="handleTitleChange" 74 @change="handleTitleChange"
75 :loading="titleLoading" 75 :loading="titleLoading"
@@ -125,7 +125,9 @@ @@ -125,7 +125,9 @@
125 const bindedDeductAmount = ref<number | undefined>(undefined); 125 const bindedDeductAmount = ref<number | undefined>(undefined);
126 // 添加金额不一致的提示状态 126 // 添加金额不一致的提示状态
127 const amountMismatch = ref(false); 127 const amountMismatch = ref(false);
128 - 128 + // 添加是否为模板的标志
  129 + const isSelectedTemplate = ref(false);
  130 +
129 // 转换为antd需要的options格式 131 // 转换为antd需要的options格式
130 const formattedOptions = computed(() => { 132 const formattedOptions = computed(() => {
131 return titleOptions.value.map(item => ({ 133 return titleOptions.value.map(item => ({
@@ -133,8 +135,34 @@ @@ -133,8 +135,34 @@
133 label: item.title, 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 const [register, { closeDrawer }] = useDrawerInner((data) => { 161 const [register, { closeDrawer }] = useDrawerInner((data) => {
  162 + // 每次打开抽屉时先重置所有状态
  163 + resetAllStates();
  164 +
  165 + // 然后初始化新的状态
138 status.value = data.data.checkPayStatus; 166 status.value = data.data.checkPayStatus;
139 id.value = data.data.checkId; 167 id.value = data.data.checkId;
140 checkNo.value = data.data.checkNo; 168 checkNo.value = data.data.checkNo;
@@ -151,7 +179,7 @@ @@ -151,7 +179,7 @@
151 }); 179 });
152 180
153 // 处理API返回的数据,统一格式 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 if (!data || !Array.isArray(data) || data.length === 0) { 184 if (!data || !Array.isArray(data) || data.length === 0) {
157 return []; 185 return [];
@@ -169,7 +197,12 @@ @@ -169,7 +197,12 @@
169 // 添加新的deductAmount字段处理 197 // 添加新的deductAmount字段处理
170 const deductAmount = item.deductAmount !== undefined ? Number(item.deductAmount) : undefined; 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 }).filter(item => item.id !== null); // 过滤掉无效项 206 }).filter(item => item.id !== null); // 过滤掉无效项
174 207
175 return result; 208 return result;
@@ -185,13 +218,21 @@ @@ -185,13 +218,21 @@
185 // 使用finance.data.ts中的handleViewRichText方法获取富文本详情 218 // 使用finance.data.ts中的handleViewRichText方法获取富文本详情
186 const richTextDetail = await handleViewRichText(String(selectedTitle.value)); 219 const richTextDetail = await handleViewRichText(String(selectedTitle.value));
187 if (richTextDetail) { 220 if (richTextDetail) {
  221 + // 输出详细数据供调试
  222 +
  223 +
188 // 设置选项 224 // 设置选项
189 titleOptions.value = [{ 225 titleOptions.value = [{
190 id: richTextDetail.id, 226 id: richTextDetail.id,
191 title: richTextDetail.title || '扣款原因详情', 227 title: richTextDetail.title || '扣款原因详情',
192 - deductAmount: richTextDetail.deductAmount // 确保获取deductAmount 228 + deductAmount: richTextDetail.deductAmount, // 确保获取deductAmount
  229 + isTemplate: richTextDetail.isTemplate === true // 确保是布尔值
193 }]; 230 }];
194 selectedTitleText.value = richTextDetail.title || '扣款原因详情'; 231 selectedTitleText.value = richTextDetail.title || '扣款原因详情';
  232 + // 保存是否为模板的标志
  233 + isSelectedTemplate.value = richTextDetail.isTemplate === true;
  234 +
  235 +
195 // 绑定deductAmount如果存在 236 // 绑定deductAmount如果存在
196 if (richTextDetail.deductAmount !== undefined) { 237 if (richTextDetail.deductAmount !== undefined) {
197 bindedDeductAmount.value = Number(richTextDetail.deductAmount); 238 bindedDeductAmount.value = Number(richTextDetail.deductAmount);
@@ -228,6 +269,8 @@ @@ -228,6 +269,8 @@
228 const found = titleOptions.value.find(item => item.id === selectedTitle.value); 269 const found = titleOptions.value.find(item => item.id === selectedTitle.value);
229 if (found) { 270 if (found) {
230 selectedTitleText.value = found.title; 271 selectedTitleText.value = found.title;
  272 + // 保存是否为模板的标志
  273 + isSelectedTemplate.value = !!found.isTemplate;
231 // 绑定deductAmount如果存在 274 // 绑定deductAmount如果存在
232 if (found.deductAmount !== undefined) { 275 if (found.deductAmount !== undefined) {
233 bindedDeductAmount.value = Number(found.deductAmount); 276 bindedDeductAmount.value = Number(found.deductAmount);
@@ -242,9 +285,13 @@ @@ -242,9 +285,13 @@
242 titleOptions.value.push({ 285 titleOptions.value.push({
243 id: richTextDetail.id, 286 id: richTextDetail.id,
244 title: richTextDetail.title || '扣款原因详情', 287 title: richTextDetail.title || '扣款原因详情',
245 - deductAmount: richTextDetail.deductAmount // 确保获取deductAmount 288 + deductAmount: richTextDetail.deductAmount, // 确保获取deductAmount
  289 + isTemplate: richTextDetail.isTemplate === true // 确保是布尔值
246 }); 290 });
247 selectedTitleText.value = richTextDetail.title || '扣款原因详情'; 291 selectedTitleText.value = richTextDetail.title || '扣款原因详情';
  292 + // 保存是否为模板的标志
  293 + isSelectedTemplate.value = richTextDetail.isTemplate === true;
  294 +
248 // 绑定deductAmount如果存在 295 // 绑定deductAmount如果存在
249 if (richTextDetail.deductAmount !== undefined) { 296 if (richTextDetail.deductAmount !== undefined) {
250 bindedDeductAmount.value = Number(richTextDetail.deductAmount); 297 bindedDeductAmount.value = Number(richTextDetail.deductAmount);
@@ -334,6 +381,9 @@ @@ -334,6 +381,9 @@
334 const found = titleOptions.value.find(item => item.id === value); 381 const found = titleOptions.value.find(item => item.id === value);
335 if (found) { 382 if (found) {
336 selectedTitleText.value = found.title; 383 selectedTitleText.value = found.title;
  384 + // 保存是否为模板的标志 - 确保它是布尔值
  385 + isSelectedTemplate.value = found.isTemplate === true;
  386 +
337 // 绑定deductAmount 387 // 绑定deductAmount
338 bindedDeductAmount.value = found.deductAmount; 388 bindedDeductAmount.value = found.deductAmount;
339 // 检查金额是否一致 389 // 检查金额是否一致
@@ -349,7 +399,9 @@ @@ -349,7 +399,9 @@
349 bindedDeductAmount.value = undefined; 399 bindedDeductAmount.value = undefined;
350 // 重置金额不匹配状态 400 // 重置金额不匹配状态
351 amountMismatch.value = false; 401 amountMismatch.value = false;
352 - 402 + // 重置是否为模板的标志
  403 + isSelectedTemplate.value = false;
  404 +
353 // 重新加载所有选项 405 // 重新加载所有选项
354 loadQuestOptions(); 406 loadQuestOptions();
355 } 407 }
@@ -371,6 +423,9 @@ @@ -371,6 +423,9 @@
371 if (visible) { 423 if (visible) {
372 // 抽屉打开时加载扣款原因选项 424 // 抽屉打开时加载扣款原因选项
373 // loadQuestOptions(); 425 // loadQuestOptions();
  426 + } else {
  427 + // 抽屉关闭时重置状态,确保下次打开时不会保留旧状态
  428 + resetAllStates();
374 } 429 }
375 } 430 }
376 431
@@ -381,6 +436,12 @@ @@ -381,6 +436,12 @@
381 436
382 // 检查金额是否匹配 437 // 检查金额是否匹配
383 function checkAmountMatch() { 438 function checkAmountMatch() {
  439 + // 如果是模板类型,不进行金额校验
  440 + if (isSelectedTemplate.value === true) {
  441 + amountMismatch.value = false;
  442 + return;
  443 + }
  444 +
384 if (bindedDeductAmount.value !== undefined && input1.value !== undefined) { 445 if (bindedDeductAmount.value !== undefined && input1.value !== undefined) {
385 try { 446 try {
386 // 确保转换为数字进行比较,处理可能的字符串转换问题 447 // 确保转换为数字进行比较,处理可能的字符串转换问题
@@ -418,8 +479,8 @@ @@ -418,8 +479,8 @@
418 return; 479 return;
419 } 480 }
420 481
421 - // 添加金额不一致的检查  
422 - if (amountMismatch.value) { 482 + // 添加金额不一致的检查,但模板类型跳过检查
  483 + if (amountMismatch.value && !isSelectedTemplate.value) {
423 error(`生产科扣款金额与选择的扣款原因金额不一致!扣款原因金额为: ${bindedDeductAmount.value}`); 484 error(`生产科扣款金额与选择的扣款原因金额不一致!扣款原因金额为: ${bindedDeductAmount.value}`);
424 return; 485 return;
425 } 486 }
@@ -433,7 +494,10 @@ @@ -433,7 +494,10 @@
433 deductUrl: deductUrl.value, 494 deductUrl: deductUrl.value,
434 questId: selectedTitle.value, // 传递选中的扣款原因ID 495 questId: selectedTitle.value, // 传递选中的扣款原因ID
435 }); 496 });
436 - fileList.value = []; 497 +
  498 + // 成功提交后重置状态
  499 + resetAllStates();
  500 +
437 emit('success'); 501 emit('success');
438 closeDrawer(); 502 closeDrawer();
439 } catch (err) { 503 } catch (err) {
src/views/project/finance/financeList/index.vue
@@ -419,7 +419,9 @@ @@ -419,7 +419,9 @@
419 contentText: data.contentText || '', 419 contentText: data.contentText || '',
420 contentImages: data.contentImages || [], 420 contentImages: data.contentImages || [],
421 files: data.files || [], 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,6 +186,22 @@
186 { label: '人民币 (¥)', value: '1' } 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 const questTypeOptions = computed(() => { 206 const questTypeOptions = computed(() => {
191 return questTypeList.value.map(item => ({ 207 return questTypeList.value.map(item => ({
@@ -194,6 +210,18 @@ @@ -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 async function fetchQuestTypes() { 226 async function fetchQuestTypes() {
199 loadingQuestTypes.value = true; 227 loadingQuestTypes.value = true;
@@ -532,11 +560,51 @@ @@ -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 field: 'currencySelector', 602 field: 'currencySelector',
536 label: '扣款金额', 603 label: '扣款金额',
537 component: 'Select' as any, 604 component: 'Select' as any,
538 defaultValue: '0', 605 defaultValue: '0',
539 - required: true, 606 + required: ({ values }) => !values.isTemplate, // 模板模式下不必填
  607 + show: ({ values }) => !values.isTemplate, // 模板模式下不显示
540 componentProps: { 608 componentProps: {
541 options: currencyOptions, 609 options: currencyOptions,
542 disabled: unref(isView), 610 disabled: unref(isView),
@@ -552,7 +620,8 @@ @@ -552,7 +620,8 @@
552 field: 'deductAmount', 620 field: 'deductAmount',
553 label: ' ', 621 label: ' ',
554 component: 'InputNumber' as any, 622 component: 'InputNumber' as any,
555 - required: true, 623 + required: ({ values }) => !values.isTemplate, // 模板模式下不必填
  624 + show: ({ values }) => !values.isTemplate, // 模板模式下不显示
556 componentProps: { 625 componentProps: {
557 disabled: unref(isView), 626 disabled: unref(isView),
558 min: 0, 627 min: 0,
@@ -585,7 +654,7 @@ @@ -585,7 +654,7 @@
585 654
586 // 注册表单 655 // 注册表单
587 const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ 656 const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
588 - labelWidth: 100, 657 + labelWidth: 120,
589 schemas: getFormSchema, //这就是数据。 658 schemas: getFormSchema, //这就是数据。
590 showActionButtonGroup: false, 659 showActionButtonGroup: false,
591 baseColProps: { span: 24 }, 660 baseColProps: { span: 24 },
@@ -614,7 +683,15 @@ @@ -614,7 +683,15 @@
614 683
615 if (unref(isUpdate)) { 684 if (unref(isUpdate)) {
616 record.value = { ...data.record }; 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 if (data.record.isRmb !== undefined) { 696 if (data.record.isRmb !== undefined) {
620 currencyType.value = data.record.isRmb; 697 currencyType.value = data.record.isRmb;
@@ -635,7 +712,9 @@ @@ -635,7 +712,9 @@
635 currencySelector: data.record.isRmb !== undefined ? data.record.isRmb : '0', 712 currencySelector: data.record.isRmb !== undefined ? data.record.isRmb : '0',
636 }); 713 });
637 }, 0); 714 }, 0);
638 - 715 +
  716 + // 记录表单设置后的值
  717 + const formValues = await validate();
639 // 处理图片数据 718 // 处理图片数据
640 try { 719 try {
641 if (data.record.contentImages) { 720 if (data.record.contentImages) {
@@ -764,10 +843,22 @@ @@ -764,10 +843,22 @@
764 try { 843 try {
765 const values = await validate(); 844 const values = await validate();
766 setDrawerProps({ confirmLoading: true }); 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 values.isRmb = currencyType.value; 855 values.isRmb = currencyType.value;
  856 + }
770 857
  858 + // 确保跟单相关扣款状态保存为布尔值
  859 + if (values.isTrackerBlock !== undefined) {
  860 + values.isTrackerBlock = Boolean(values.isTrackerBlock);
  861 + }
771 // 移除辅助字段,不需要提交到后端 862 // 移除辅助字段,不需要提交到后端
772 delete values.currencySelector; 863 delete values.currencySelector;
773 864
@@ -794,6 +885,9 @@ @@ -794,6 +885,9 @@
794 setDrawerProps({ confirmLoading: false }); 885 setDrawerProps({ confirmLoading: false });
795 return; 886 return;
796 } 887 }
  888 + } else {
  889 + // 新建模式,确保isTemplate字段已设置
  890 + console.log('是否作为模板:', values.isTemplate);
797 } 891 }
798 892
799 // 调用后端API保存数据 893 // 调用后端API保存数据
@@ -968,6 +1062,26 @@ export default { @@ -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 .custom-file-upload { 1086 .custom-file-upload {
973 margin-top: 20px; 1087 margin-top: 20px;
src/views/project/quest/quest.data.tsx
@@ -137,14 +137,15 @@ export const searchFormSchema: FormSchema[] = [ @@ -137,14 +137,15 @@ export const searchFormSchema: FormSchema[] = [
137 }, 137 },
138 ]; 138 ];
139 139
140 -// 导出用于过滤财务专用数据的方法 140 +// 导出返回所有数据的方法
141 export const filterFinancialData = (dataList: any[]) => { 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 \ No newline at end of file 152 \ No newline at end of file