Commit c04095817ac95f5535acf30ceb77484583ceae80
1 parent
fe947a0f
fix: 净利润分析四个页面新增搜索时全选搜索结果功能,首次打开页面日期选择器失效bug修改
Showing
9 changed files
with
320 additions
and
36 deletions
src/views/project/finance/financeProfit/ProductProfit/InnerData/data.tsx
... | ... | @@ -9,6 +9,8 @@ import { useOrderInfo } from '/@/hooks/component/order'; |
9 | 9 | |
10 | 10 | const innerNoOptions = ref([]); |
11 | 11 | const projectNoOptions = ref([]); |
12 | +const allProjectNoOptions = ref([]); | |
13 | +export { allProjectNoOptions }; | |
12 | 14 | const orderStore = useOrderStoreWithOut(); |
13 | 15 | const { |
14 | 16 | customerCode, |
... | ... | @@ -38,11 +40,10 @@ export const searchFormSchema = [ |
38 | 40 | showSearch: true, |
39 | 41 | mode: 'multiple', |
40 | 42 | onSearch: async (value: any) => { |
41 | - projectNoOptions.value = await queryNoOptions('projectNo', value); | |
43 | + const result = await queryNoOptions('projectNo', value); | |
44 | + projectNoOptions.value = result; | |
45 | + allProjectNoOptions.value = result; | |
42 | 46 | }, |
43 | - // onSearch: async (value: any) => { | |
44 | - // projectNoOptions.value = await queryNoOptions('projectNo', value); | |
45 | - // }, | |
46 | 47 | }, |
47 | 48 | }, |
48 | 49 | { | ... | ... |
src/views/project/finance/financeProfit/ProductProfit/InnerData/index.vue
... | ... | @@ -46,6 +46,11 @@ |
46 | 46 | :style="{ borderRadius: '5px 5px 5px 5px' }" |
47 | 47 | >导出</a-button |
48 | 48 | > |
49 | + <a-button | |
50 | + type="primary" | |
51 | + @click="handleAllProjectNoQuery" | |
52 | + style="margin-left: 8px;position: fixed;right: 29%;top: 107.5px;" | |
53 | + >全选</a-button> | |
49 | 54 | </template> |
50 | 55 | </BasicTable> |
51 | 56 | <!-- <BasicModal |
... | ... | @@ -68,7 +73,7 @@ |
68 | 73 | <script setup lang="ts"> |
69 | 74 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
70 | 75 | import { getInnerProfit, setInnerStatus } from '@/api/project/invoice'; |
71 | - import { searchFormSchema, COLUMNS } from './data'; | |
76 | + import { searchFormSchema, COLUMNS, allProjectNoOptions } from './data'; | |
72 | 77 | import { BasicModal, useModal } from '/@/components/Modal'; |
73 | 78 | import { useMessage } from '/@/hooks/web/useMessage'; |
74 | 79 | import { onMounted, ref, computed } from 'vue'; |
... | ... | @@ -111,7 +116,7 @@ |
111 | 116 | message.value = ''; |
112 | 117 | } |
113 | 118 | }; |
114 | - const [registerTable, { reload, setSelectedRowKeys, getForm }] = useTable({ | |
119 | + const [registerTable, { reload, setSelectedRowKeys, getForm, setProps }] = useTable({ | |
115 | 120 | api: getInnerProfit, |
116 | 121 | bordered: true, |
117 | 122 | columns: COLUMNS, |
... | ... | @@ -485,5 +490,60 @@ |
485 | 490 | } |
486 | 491 | setSelectedRowKeys(checkedKeys.value as any); |
487 | 492 | } |
493 | + | |
494 | + function handleAllProjectNoQuery() { | |
495 | + // 检查是否有项目号选项 | |
496 | + if (!allProjectNoOptions.value || allProjectNoOptions.value.length === 0) { | |
497 | + createMessage.warn('没有可查询的项目号!'); | |
498 | + return; | |
499 | + } | |
500 | + | |
501 | + // 获取所有项目号的value值 | |
502 | + const allProjectNos = allProjectNoOptions.value.map(item => { | |
503 | + // 处理不同的数据结构 | |
504 | + if (typeof item === 'string') { | |
505 | + return item; | |
506 | + } else if (item && typeof item === 'object' && 'value' in item) { | |
507 | + return item.value; | |
508 | + } else if (item && typeof item === 'object' && 'label' in item) { | |
509 | + return item.label; | |
510 | + } | |
511 | + return item; | |
512 | + }).filter(Boolean); // 过滤掉空值 | |
513 | + | |
514 | + if (allProjectNos.length === 0) { | |
515 | + createMessage.warn('没有有效的项目号!'); | |
516 | + return; | |
517 | + } | |
518 | + | |
519 | + // 使用setProps方法持久化设置searchInfo,这样分页时不会丢失查询条件 | |
520 | + try { | |
521 | + // 提示用户查询成功 | |
522 | + createMessage.success(`正在查询 ${allProjectNos.length} 个项目号的数据...`); | |
523 | + | |
524 | + // 使用setProps持久化设置searchInfo,这样分页时会保持查询条件 | |
525 | + setProps({ | |
526 | + searchInfo: { | |
527 | + projectNo: allProjectNos | |
528 | + } | |
529 | + }); | |
530 | + | |
531 | + // 获取表单实例并设置表单值,将项目号填入搜索框 | |
532 | + const formInstance = getForm(); | |
533 | + if (formInstance && formInstance.setFieldsValue) { | |
534 | + formInstance.setFieldsValue({ | |
535 | + projectNo: allProjectNos | |
536 | + }); | |
537 | + } | |
538 | + | |
539 | + // 重新加载表格数据,回到第一页 | |
540 | + reload({ | |
541 | + page: 1 | |
542 | + }); | |
543 | + } catch (error) { | |
544 | + console.error('查询失败:', error); | |
545 | + createMessage.error('查询失败,请检查网络连接!'); | |
546 | + } | |
547 | + } | |
488 | 548 | </script> |
489 | 549 | <style></style> | ... | ... |
src/views/project/finance/financeProfit/ProductProfit/InnerProduce/data.tsx
... | ... | @@ -27,6 +27,8 @@ const userStore = useUserStoreWithOut(); |
27 | 27 | // ]; |
28 | 28 | const innerNoOptions = ref([]); |
29 | 29 | const projectNoOptions = ref([]); |
30 | +const allProjectNoOptions = ref([]); | |
31 | +export { allProjectNoOptions }; | |
30 | 32 | const orderStore = useOrderStoreWithOut(); |
31 | 33 | const { |
32 | 34 | customerCode, |
... | ... | @@ -56,11 +58,10 @@ export const searchFormSchema = [ |
56 | 58 | showSearch: true, |
57 | 59 | mode: 'multiple', |
58 | 60 | onSearch: async (value: any) => { |
59 | - projectNoOptions.value = await queryNoOptions('projectNo', value); | |
61 | + const result = await queryNoOptions('projectNo', value); | |
62 | + projectNoOptions.value = result; | |
63 | + allProjectNoOptions.value = result; | |
60 | 64 | }, |
61 | - // onSearch: async (value: any) => { | |
62 | - // projectNoOptions.value = await queryNoOptions('projectNo', value); | |
63 | - // }, | |
64 | 65 | }, |
65 | 66 | }, |
66 | 67 | { | ... | ... |
src/views/project/finance/financeProfit/ProductProfit/InnerProduce/index.vue
... | ... | @@ -49,6 +49,11 @@ |
49 | 49 | :style="{ borderRadius: '5px 5px 5px 5px' }" |
50 | 50 | >导出</a-button |
51 | 51 | > |
52 | + <a-button | |
53 | + type="primary" | |
54 | + @click="handleAllProjectNoQuery" | |
55 | + style="margin-left: 8px;position: fixed;right: 29%;top: 107.5px;" | |
56 | + >全选</a-button> | |
52 | 57 | </template> |
53 | 58 | </BasicTable> |
54 | 59 | <!-- <BasicModal |
... | ... | @@ -71,7 +76,7 @@ |
71 | 76 | <script setup lang="ts"> |
72 | 77 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
73 | 78 | import { getInnerProduceProfit, setInnerProfitSetStatus } from '@/api/project/invoice'; |
74 | - import { searchFormSchema, COLUMNS } from './data'; | |
79 | + import { searchFormSchema, COLUMNS, allProjectNoOptions } from './data'; | |
75 | 80 | import { BasicModal, useModal } from '/@/components/Modal'; |
76 | 81 | import { useMessage } from '/@/hooks/web/useMessage'; |
77 | 82 | import { onMounted, ref, computed } from 'vue'; |
... | ... | @@ -110,7 +115,7 @@ |
110 | 115 | message.value = ''; |
111 | 116 | } |
112 | 117 | }; |
113 | - const [registerTable, { reload, setSelectedRowKeys }] = useTable({ | |
118 | + const [registerTable, { reload, setSelectedRowKeys, setProps, getForm }] = useTable({ | |
114 | 119 | api: getInnerProduceProfit, |
115 | 120 | bordered: true, |
116 | 121 | columns: COLUMNS, |
... | ... | @@ -408,5 +413,60 @@ |
408 | 413 | handleClearChoose(); |
409 | 414 | reload(); |
410 | 415 | } |
416 | + | |
417 | + function handleAllProjectNoQuery() { | |
418 | + // 检查是否有项目号选项 | |
419 | + if (!allProjectNoOptions.value || allProjectNoOptions.value.length === 0) { | |
420 | + createMessage.warn('没有可查询的项目号!'); | |
421 | + return; | |
422 | + } | |
423 | + | |
424 | + // 获取所有项目号的value值 | |
425 | + const allProjectNos = allProjectNoOptions.value.map(item => { | |
426 | + // 处理不同的数据结构 | |
427 | + if (typeof item === 'string') { | |
428 | + return item; | |
429 | + } else if (item && typeof item === 'object' && 'value' in item) { | |
430 | + return item.value; | |
431 | + } else if (item && typeof item === 'object' && 'label' in item) { | |
432 | + return item.label; | |
433 | + } | |
434 | + return item; | |
435 | + }).filter(Boolean); // 过滤掉空值 | |
436 | + | |
437 | + if (allProjectNos.length === 0) { | |
438 | + createMessage.warn('没有有效的项目号!'); | |
439 | + return; | |
440 | + } | |
441 | + | |
442 | + // 使用setProps方法持久化设置searchInfo,这样分页时不会丢失查询条件 | |
443 | + try { | |
444 | + // 提示用户查询成功 | |
445 | + createMessage.success(`正在查询 ${allProjectNos.length} 个项目号的数据...`); | |
446 | + | |
447 | + // 使用setProps持久化设置searchInfo,这样分页时会保持查询条件 | |
448 | + setProps({ | |
449 | + searchInfo: { | |
450 | + projectNo: allProjectNos | |
451 | + } | |
452 | + }); | |
453 | + | |
454 | + // 获取表单实例并设置表单值,将项目号填入搜索框 | |
455 | + const formInstance = getForm(); | |
456 | + if (formInstance && formInstance.setFieldsValue) { | |
457 | + formInstance.setFieldsValue({ | |
458 | + projectNo: allProjectNos | |
459 | + }); | |
460 | + } | |
461 | + | |
462 | + // 重新加载表格数据,回到第一页 | |
463 | + reload({ | |
464 | + page: 1 | |
465 | + }); | |
466 | + } catch (error) { | |
467 | + console.error('查询失败:', error); | |
468 | + createMessage.error('查询失败,请检查网络连接!'); | |
469 | + } | |
470 | + } | |
411 | 471 | </script> |
412 | 472 | <style></style> | ... | ... |
src/views/project/finance/financeProfit/ServiceProfit/PackageProfit/data.tsx
... | ... | @@ -9,6 +9,8 @@ import { useOrderInfo } from '/@/hooks/component/order'; |
9 | 9 | |
10 | 10 | const innerNoOptions = ref([]); |
11 | 11 | const projectNoOptions = ref([]); |
12 | +const allProjectNoOptions = ref([]); | |
13 | +export { allProjectNoOptions }; | |
12 | 14 | const orderStore = useOrderStoreWithOut(); |
13 | 15 | const { |
14 | 16 | customerCode, |
... | ... | @@ -38,11 +40,10 @@ export const searchFormSchema = [ |
38 | 40 | showSearch: true, |
39 | 41 | mode: 'multiple', |
40 | 42 | onSearch: async (value: any) => { |
41 | - projectNoOptions.value = await queryNoOptions('projectNo', value); | |
43 | + const result = await queryNoOptions('projectNo', value); | |
44 | + projectNoOptions.value = result; | |
45 | + allProjectNoOptions.value = result; | |
42 | 46 | }, |
43 | - // onSearch: async (value: any) => { | |
44 | - // projectNoOptions.value = await queryNoOptions('projectNo', value); | |
45 | - // }, | |
46 | 47 | }, |
47 | 48 | }, |
48 | 49 | { | ... | ... |
src/views/project/finance/financeProfit/ServiceProfit/PackageProfit/index.vue
... | ... | @@ -49,6 +49,11 @@ |
49 | 49 | :style="{ borderRadius: '5px 5px 5px 5px' }" |
50 | 50 | >导出</a-button |
51 | 51 | > |
52 | + <a-button | |
53 | + type="primary" | |
54 | + @click="handleAllProjectNoQuery" | |
55 | + style="margin-left: 8px;position: fixed;right: 29%;top: 107.5px;" | |
56 | + >全选</a-button> | |
52 | 57 | </template> |
53 | 58 | </BasicTable> |
54 | 59 | <!-- <BasicModal |
... | ... | @@ -71,7 +76,7 @@ |
71 | 76 | <script setup lang="ts"> |
72 | 77 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
73 | 78 | import { getPackageProfit, setPackStatus } from '@/api/project/invoice'; |
74 | - import { searchFormSchema, COLUMNS } from './data'; | |
79 | + import { searchFormSchema, COLUMNS, allProjectNoOptions } from './data'; | |
75 | 80 | import { BasicModal, useModal } from '/@/components/Modal'; |
76 | 81 | import { useMessage } from '/@/hooks/web/useMessage'; |
77 | 82 | import { onMounted, ref, computed } from 'vue'; |
... | ... | @@ -115,7 +120,7 @@ |
115 | 120 | message.value = ''; |
116 | 121 | } |
117 | 122 | }; |
118 | - const [registerTable, { reload, setSelectedRowKeys, getForm }] = useTable({ | |
123 | + const [registerTable, { reload, setSelectedRowKeys, getForm, setProps }] = useTable({ | |
119 | 124 | api: getPackageProfit, |
120 | 125 | bordered: true, |
121 | 126 | columns: COLUMNS, |
... | ... | @@ -479,5 +484,60 @@ |
479 | 484 | } |
480 | 485 | setSelectedRowKeys(checkedKeys.value as any); |
481 | 486 | } |
487 | + | |
488 | + function handleAllProjectNoQuery() { | |
489 | + // 检查是否有项目号选项 | |
490 | + if (!allProjectNoOptions.value || allProjectNoOptions.value.length === 0) { | |
491 | + createMessage.warn('没有可查询的项目号!'); | |
492 | + return; | |
493 | + } | |
494 | + | |
495 | + // 获取所有项目号的value值 | |
496 | + const allProjectNos = allProjectNoOptions.value.map(item => { | |
497 | + // 处理不同的数据结构 | |
498 | + if (typeof item === 'string') { | |
499 | + return item; | |
500 | + } else if (item && typeof item === 'object' && 'value' in item) { | |
501 | + return item.value; | |
502 | + } else if (item && typeof item === 'object' && 'label' in item) { | |
503 | + return item.label; | |
504 | + } | |
505 | + return item; | |
506 | + }).filter(Boolean); // 过滤掉空值 | |
507 | + | |
508 | + if (allProjectNos.length === 0) { | |
509 | + createMessage.warn('没有有效的项目号!'); | |
510 | + return; | |
511 | + } | |
512 | + | |
513 | + // 使用setProps方法持久化设置searchInfo,这样分页时不会丢失查询条件 | |
514 | + try { | |
515 | + // 提示用户查询成功 | |
516 | + createMessage.success(`正在查询 ${allProjectNos.length} 个项目号的数据...`); | |
517 | + | |
518 | + // 使用setProps持久化设置searchInfo,这样分页时会保持查询条件 | |
519 | + setProps({ | |
520 | + searchInfo: { | |
521 | + projectNo: allProjectNos | |
522 | + } | |
523 | + }); | |
524 | + | |
525 | + // 获取表单实例并设置表单值,将项目号填入搜索框 | |
526 | + const formInstance = getForm(); | |
527 | + if (formInstance && formInstance.setFieldsValue) { | |
528 | + formInstance.setFieldsValue({ | |
529 | + projectNo: allProjectNos | |
530 | + }); | |
531 | + } | |
532 | + | |
533 | + // 重新加载表格数据,回到第一页 | |
534 | + reload({ | |
535 | + page: 1 | |
536 | + }); | |
537 | + } catch (error) { | |
538 | + console.error('查询失败:', error); | |
539 | + createMessage.error('查询失败,请检查网络连接!'); | |
540 | + } | |
541 | + } | |
482 | 542 | </script> |
483 | 543 | <style></style> | ... | ... |
src/views/project/finance/financeProfit/ServiceProfit/ServiceProfit/FinanceEdit.vue
... | ... | @@ -25,10 +25,24 @@ |
25 | 25 | /> |
26 | 26 | <div style="margin: 16px 0"></div> |
27 | 27 | <div style="font-size: 15px">项目开始时间</div> |
28 | - <a-date-picker v-model:value="input3" :disabled="status3 === 'LOCKED'" auto-size /> | |
28 | + <a-date-picker | |
29 | + v-model:value="input3" | |
30 | + :disabled="status3 === 'LOCKED'" | |
31 | + auto-size | |
32 | + placeholder="请选择项目开始时间" | |
33 | + format="YYYY-MM-DD" | |
34 | + value-format="YYYY-MM-DD" | |
35 | + /> | |
29 | 36 | <div style="margin: 16px 0"></div> |
30 | 37 | <div style="font-size: 15px">项目结束时间</div> |
31 | - <a-date-picker v-model:value="input4" :disabled="status4 === 'LOCKED'" auto-size /> | |
38 | + <a-date-picker | |
39 | + v-model:value="input4" | |
40 | + :disabled="status4 === 'LOCKED'" | |
41 | + auto-size | |
42 | + placeholder="请选择项目结束时间" | |
43 | + format="YYYY-MM-DD" | |
44 | + value-format="YYYY-MM-DD" | |
45 | + /> | |
32 | 46 | <div style="margin: 16px 0"></div> |
33 | 47 | <div style="font-size: 15px">西班牙已发提成¥</div> |
34 | 48 | <a-input |
... | ... | @@ -59,11 +73,14 @@ |
59 | 73 | import { defineComponent, ref, computed, unref, toRaw, reactive } from 'vue'; |
60 | 74 | import { getServiceEdit } from '@/api/project/invoice'; |
61 | 75 | import { useMessage } from '/@/hooks/web/useMessage'; |
76 | + import { useUserStoreWithOut } from '/@/store/modules/user'; | |
62 | 77 | import { ROLE } from './type.d'; |
63 | 78 | import type { Dayjs } from 'dayjs'; |
64 | 79 | import dayjs from 'dayjs'; |
65 | 80 | |
66 | 81 | const emit = defineEmits(['success']); |
82 | + const userStore = useUserStoreWithOut(); | |
83 | + const user = userStore.getUserInfo; | |
67 | 84 | const role = computed(() => { |
68 | 85 | return user?.roleSmallVO?.code; |
69 | 86 | }); |
... | ... | @@ -141,8 +158,8 @@ |
141 | 158 | |
142 | 159 | const input1 = ref(); |
143 | 160 | const input2 = ref(); |
144 | - const input3 = ref(); | |
145 | - const input4 = ref(); | |
161 | + const input3 = ref<Dayjs | null>(null); | |
162 | + const input4 = ref<Dayjs | null>(null); | |
146 | 163 | |
147 | 164 | const input5 = ref(); |
148 | 165 | const id = ref(); |
... | ... | @@ -177,11 +194,23 @@ |
177 | 194 | status5.value = data?.data?.lockFields?.paidRmbCommission; |
178 | 195 | } |
179 | 196 | id.value = data?.data?.projectNoPrefix; |
180 | - input1.value = data?.data?.developmentCopyRmbTotalPrice.toFixed(2); | |
181 | - input2.value = data?.data?.spainPaidRmbCommission.toFixed(2); | |
182 | - input3.value = dayjs(formatDateToDateOnly(data?.data?.projectStartTime)); | |
183 | - input4.value = dayjs(formatDateToDateOnly(data?.data?.projectEndTime)); | |
184 | - input5.value = data?.data?.paidRmbCommission.toFixed(2); | |
197 | + input1.value = data?.data?.developmentCopyRmbTotalPrice?.toFixed(2) || ''; | |
198 | + input2.value = data?.data?.spainPaidRmbCommission?.toFixed(2) || ''; | |
199 | + | |
200 | + // 确保日期值正确设置 | |
201 | + if (data?.data?.projectStartTime) { | |
202 | + input3.value = dayjs(formatDateToDateOnly(data.data.projectStartTime)); | |
203 | + } else { | |
204 | + input3.value = null; | |
205 | + } | |
206 | + | |
207 | + if (data?.data?.projectEndTime) { | |
208 | + input4.value = dayjs(formatDateToDateOnly(data.data.projectEndTime)); | |
209 | + } else { | |
210 | + input4.value = null; | |
211 | + } | |
212 | + | |
213 | + input5.value = data?.data?.paidRmbCommission?.toFixed(2) || ''; | |
185 | 214 | |
186 | 215 | resetFields(); |
187 | 216 | setDrawerProps({ confirmLoading: false }); |
... | ... | @@ -217,8 +246,8 @@ |
217 | 246 | if (!visible) { |
218 | 247 | input1.value = ''; |
219 | 248 | input2.value = ''; |
220 | - input3.value = ''; | |
221 | - input4.value = ''; | |
249 | + input3.value = null; | |
250 | + input4.value = null; | |
222 | 251 | input5.value = ''; |
223 | 252 | } |
224 | 253 | } | ... | ... |
src/views/project/finance/financeProfit/ServiceProfit/ServiceProfit/data.tsx
... | ... | @@ -27,6 +27,8 @@ const userStore = useUserStoreWithOut(); |
27 | 27 | // ]; |
28 | 28 | const innerNoOptions = ref([]); |
29 | 29 | const projectNoOptions = ref([]); |
30 | +const allProjectNoOptions = ref([]); | |
31 | +export { allProjectNoOptions }; | |
30 | 32 | const orderStore = useOrderStoreWithOut(); |
31 | 33 | const { |
32 | 34 | customerCode, |
... | ... | @@ -55,12 +57,11 @@ export const searchFormSchema = [ |
55 | 57 | options: projectNoOptions, |
56 | 58 | showSearch: true, |
57 | 59 | mode: 'multiple', |
58 | - onSearch: async (value: any) => { | |
59 | - projectNoOptions.value = await queryNoOptions('projectNo', value); | |
60 | + onSearch: async (value) => { | |
61 | + const result = await queryNoOptions('projectNo', value); | |
62 | + projectNoOptions.value = result; | |
63 | + allProjectNoOptions.value = result; | |
60 | 64 | }, |
61 | - // onSearch: async (value: any) => { | |
62 | - // projectNoOptions.value = await queryNoOptions('projectNo', value); | |
63 | - // }, | |
64 | 65 | }, |
65 | 66 | }, |
66 | 67 | // { | ... | ... |
src/views/project/finance/financeProfit/ServiceProfit/ServiceProfit/index.vue
... | ... | @@ -36,6 +36,11 @@ |
36 | 36 | :style="{ borderRadius: '5px 5px 5px 5px' }" |
37 | 37 | >导出</a-button |
38 | 38 | > |
39 | + <a-button | |
40 | + type="primary" | |
41 | + @click="handleAllProjectNoQuery" | |
42 | + style="margin-left: 8px;position: fixed;right: 29%;top: 107.5px;" | |
43 | + >全选</a-button> | |
39 | 44 | </template> |
40 | 45 | </BasicTable> |
41 | 46 | <CheckDetail @register="checkModalRegister" :onGoFormDetail="handleGoFormDetail" /> |
... | ... | @@ -46,7 +51,8 @@ |
46 | 51 | <script setup lang="ts"> |
47 | 52 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
48 | 53 | import { getServiceProfit, setBusinessProfitSetStatus } from '@/api/project/invoice'; |
49 | - import { searchFormSchema, COLUMNS } from './data'; | |
54 | + import { saveConfig } from '@/api/sys/config'; | |
55 | + import { searchFormSchema, COLUMNS, allProjectNoOptions } from './data'; | |
50 | 56 | import axios from 'axios'; |
51 | 57 | import { useMessage } from '/@/hooks/web/useMessage'; |
52 | 58 | import { onMounted, ref, computed, unref } from 'vue'; |
... | ... | @@ -73,7 +79,7 @@ |
73 | 79 | const role = computed(() => { |
74 | 80 | return user?.roleSmallVO?.code; |
75 | 81 | }); |
76 | - const [registerTable, { reload, getSelectRowKeys, getDataSource, setSelectedRowKeys }] = useTable({ | |
82 | + const [registerTable, { reload, getSelectRowKeys, getDataSource, setSelectedRowKeys, setProps, getForm }] = useTable({ | |
77 | 83 | title: '', |
78 | 84 | api: getServiceProfit, |
79 | 85 | bordered: true, |
... | ... | @@ -192,13 +198,23 @@ |
192 | 198 | |
193 | 199 | async function handleStatus(record, status) { |
194 | 200 | try { |
201 | + // 检查必要参数是否存在 | |
202 | + if (!record.customerCode || !record.projectNoPrefix) { | |
203 | + createMessage.error('缺少必要的参数:客户编码或项目号'); | |
204 | + return; | |
205 | + } | |
206 | + | |
195 | 207 | await setBusinessProfitSetStatus({ |
196 | 208 | customerCode: record.customerCode, |
197 | 209 | projectNo: record.projectNoPrefix, |
210 | + status: status // 添加状态参数 | |
198 | 211 | }); |
212 | + | |
213 | + createMessage.success('状态更新成功!'); | |
199 | 214 | reload(); |
200 | 215 | } catch (error) { |
201 | 216 | console.error('Error updating status:', error); |
217 | + createMessage.error('状态更新失败:' + (error.message || '未知错误')); | |
202 | 218 | } |
203 | 219 | } |
204 | 220 | |
... | ... | @@ -365,5 +381,60 @@ |
365 | 381 | } |
366 | 382 | setSelectedRowKeys(checkedKeys.value as any); |
367 | 383 | } |
384 | + // 6/25未完成工作:全选查询 | |
385 | + function handleAllProjectNoQuery() { | |
386 | + // 检查是否有项目号选项 | |
387 | + if (!allProjectNoOptions.value || allProjectNoOptions.value.length === 0) { | |
388 | + createMessage.warn('没有可查询的项目号!'); | |
389 | + return; | |
390 | + } | |
391 | + | |
392 | + // 获取所有项目号的value值 | |
393 | + const allProjectNos = allProjectNoOptions.value.map(item => { | |
394 | + // 处理不同的数据结构 | |
395 | + if (typeof item === 'string') { | |
396 | + return item; | |
397 | + } else if (item && typeof item === 'object' && 'value' in item) { | |
398 | + return item.value; | |
399 | + } else if (item && typeof item === 'object' && 'label' in item) { | |
400 | + return item.label; | |
401 | + } | |
402 | + return item; | |
403 | + }).filter(Boolean); // 过滤掉空值 | |
404 | + | |
405 | + if (allProjectNos.length === 0) { | |
406 | + createMessage.warn('没有有效的项目号!'); | |
407 | + return; | |
408 | + } | |
409 | + | |
410 | + // 使用setProps方法持久化设置searchInfo,这样分页时不会丢失查询条件 | |
411 | + try { | |
412 | + // 提示用户查询成功 | |
413 | + createMessage.success(`正在查询 ${allProjectNos.length} 个项目号的数据...`); | |
414 | + | |
415 | + // 使用setProps持久化设置searchInfo,这样分页时会保持查询条件 | |
416 | + setProps({ | |
417 | + searchInfo: { | |
418 | + projectNo: allProjectNos | |
419 | + } | |
420 | + }); | |
421 | + | |
422 | + // 获取表单实例并设置表单值,将项目号填入搜索框 | |
423 | + const formInstance = getForm(); | |
424 | + if (formInstance && formInstance.setFieldsValue) { | |
425 | + formInstance.setFieldsValue({ | |
426 | + projectNo: allProjectNos | |
427 | + }); | |
428 | + } | |
429 | + | |
430 | + // 重新加载表格数据,回到第一页 | |
431 | + reload({ | |
432 | + page: 1 | |
433 | + }); | |
434 | + } catch (error) { | |
435 | + console.error('查询失败:', error); | |
436 | + createMessage.error('查询失败,请检查网络连接!'); | |
437 | + } | |
438 | + } | |
368 | 439 | </script> |
369 | 440 | <style></style> | ... | ... |