xsh_1997 1 hafta önce
ebeveyn
işleme
89408dd84e

+ 38 - 0
ruoyi-screen/src/utils/useDialogStatYearSync.js

@@ -0,0 +1,38 @@
1
+import { watch } from 'vue'
2
+import { useStatYear } from '@/stores/statYear'
3
+
4
+/**
5
+ * 弹框年份单向跟随全局统计年份:
6
+ * - 全局年变化 → 写入 query.statYear
7
+ * - 弹框内改年份不影响全局
8
+ *
9
+ * @param {{ statYear: number|string|undefined }} query 弹框查询对象(需含 statYear)
10
+ * @param {{ visible?: import('vue').Ref<boolean>, onSynced?: () => void }} [options]
11
+ * @returns {{ syncDialogYearFromGlobal: () => void }}
12
+ */
13
+export function useDialogStatYearSync(query, options = {}) {
14
+  const { visible, onSynced } = options
15
+  const { statYear } = useStatYear()
16
+
17
+  function parseGlobalYear() {
18
+    const y = Number(statYear.value)
19
+    return Number.isFinite(y) ? y : undefined
20
+  }
21
+
22
+  /** 将当前全局统计年写入弹框年份 */
23
+  function syncDialogYearFromGlobal() {
24
+    query.statYear = parseGlobalYear()
25
+  }
26
+
27
+  watch(
28
+    () => statYear.value,
29
+    () => {
30
+      syncDialogYearFromGlobal()
31
+      if (visible?.value && typeof onSynced === 'function') {
32
+        onSynced()
33
+      }
34
+    }
35
+  )
36
+
37
+  return { syncDialogYearFromGlobal }
38
+}

+ 12 - 2
ruoyi-screen/src/views/commonProsperity/ProjectTypeDetailDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getCommonProsperityProjectTypeDetails } from '@/api/commonProsperity'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 
8 9
 const props = defineProps({
9 10
   modelValue: { type: Boolean, default: false }
@@ -28,6 +29,15 @@ const pageSize = ref(10)
28 29
 
29 30
 const yearSelectOptions = buildScreenYearOptions()
30 31
 
32
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
33
+  visible,
34
+  onSynced: () => {
35
+    pageNum.value = 1
36
+    fetchList()
37
+  }
38
+})
39
+
40
+
31 41
 async function fetchList() {
32 42
   loading.value = true
33 43
   try {
@@ -53,13 +63,13 @@ function handleSearch() {
53 63
 }
54 64
 
55 65
 function handleReset() {
56
-  query.statYear = undefined
66
+  syncDialogYearFromGlobal()
57 67
   pageNum.value = 1
58 68
   fetchList()
59 69
 }
60 70
 
61 71
 function onOpen() {
62
-  query.statYear = undefined
72
+  syncDialogYearFromGlobal()
63 73
   pageNum.value = 1
64 74
   fetchList()
65 75
 }

+ 12 - 2
ruoyi-screen/src/views/home/BreedingEntityQuantityDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getBreedingEntityQuantities } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -34,6 +35,15 @@ const pageNum = ref(1)
34 35
 const pageSize = ref(10)
35 36
 
36 37
 const yearSelectOptions = buildScreenYearOptions()
38
+
39
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
40
+  visible,
41
+  onSynced: () => {
42
+    pageNum.value = 1
43
+    fetchList()
44
+  }
45
+})
46
+
37 47
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
38 48
 
39 49
 async function fetchList() {
@@ -68,7 +78,7 @@ function handleSearch() {
68 78
 }
69 79
 
70 80
 function handleReset() {
71
-  query.statYear = undefined
81
+  syncDialogYearFromGlobal()
72 82
   query.statMonth = undefined
73 83
   query.townDeptId = undefined
74 84
   query.villageDeptId = undefined
@@ -81,7 +91,7 @@ function onTownChange() {
81 91
 }
82 92
 
83 93
 function onOpen() {
84
-  query.statYear = undefined
94
+  syncDialogYearFromGlobal()
85 95
   query.statMonth = undefined
86 96
   query.townDeptId = undefined
87 97
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/CooperativeDevelopmentDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getCooperativeDevelopments } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const TAB_BASIC = 'basic'
@@ -56,6 +57,15 @@ const pageSize = ref(10)
56 57
 const activeTab = ref(TAB_BASIC)
57 58
 
58 59
 const yearSelectOptions = buildScreenYearOptions()
60
+
61
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
62
+  visible,
63
+  onSynced: () => {
64
+    pageNum.value = 1
65
+    fetchList()
66
+  }
67
+})
68
+
59 69
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
60 70
 
61 71
 function parseBusinessScopeList(value) {
@@ -109,7 +119,7 @@ function handleSearch() {
109 119
 }
110 120
 
111 121
 function handleReset() {
112
-  query.statYear = undefined
122
+  syncDialogYearFromGlobal()
113 123
   query.statMonth = undefined
114 124
   query.townDeptId = undefined
115 125
   query.villageDeptId = undefined
@@ -123,7 +133,7 @@ function onTownChange() {
123 133
 }
124 134
 
125 135
 function onOpen() {
126
-  query.statYear = undefined
136
+  syncDialogYearFromGlobal()
127 137
   query.statMonth = undefined
128 138
   query.townDeptId = undefined
129 139
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/FamilyRanchDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getFamilyRanches } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const TAB_BASIC = 'basic'
@@ -45,6 +46,15 @@ const pageSize = ref(10)
45 46
 const activeTab = ref(TAB_BASIC)
46 47
 
47 48
 const yearSelectOptions = buildScreenYearOptions()
49
+
50
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
51
+  visible,
52
+  onSynced: () => {
53
+    pageNum.value = 1
54
+    fetchList()
55
+  }
56
+})
57
+
48 58
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
49 59
 
50 60
 async function fetchList() {
@@ -79,7 +89,7 @@ function handleSearch() {
79 89
 }
80 90
 
81 91
 function handleReset() {
82
-  query.statYear = undefined
92
+  syncDialogYearFromGlobal()
83 93
   query.statMonth = undefined
84 94
   query.townDeptId = undefined
85 95
   query.villageDeptId = undefined
@@ -93,7 +103,7 @@ function onTownChange() {
93 103
 }
94 104
 
95 105
 function onOpen() {
96
-  query.statYear = undefined
106
+  syncDialogYearFromGlobal()
97 107
   query.statMonth = undefined
98 108
   query.townDeptId = undefined
99 109
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/FarmerHouseholdDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getFarmerHouseholds } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const TAB_CAP_FLOOR = 'capFloor'
@@ -39,6 +40,15 @@ const pageSize = ref(10)
39 40
 const activeTab = ref(TAB_CAP_FLOOR)
40 41
 
41 42
 const yearSelectOptions = buildScreenYearOptions()
43
+
44
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
45
+  visible,
46
+  onSynced: () => {
47
+    pageNum.value = 1
48
+    fetchList()
49
+  }
50
+})
51
+
42 52
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
43 53
 
44 54
 async function fetchList() {
@@ -73,7 +83,7 @@ function handleSearch() {
73 83
 }
74 84
 
75 85
 function handleReset() {
76
-  query.statYear = undefined
86
+  syncDialogYearFromGlobal()
77 87
   query.statMonth = undefined
78 88
   query.townDeptId = undefined
79 89
   query.villageDeptId = undefined
@@ -87,7 +97,7 @@ function onTownChange() {
87 97
 }
88 98
 
89 99
 function onOpen() {
90
-  query.statYear = undefined
100
+  syncDialogYearFromGlobal()
91 101
   query.statMonth = undefined
92 102
   query.townDeptId = undefined
93 103
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/GrasslandAreaDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getFarmerHouseholds } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -34,6 +35,15 @@ const pageNum = ref(1)
34 35
 const pageSize = ref(10)
35 36
 
36 37
 const yearSelectOptions = buildScreenYearOptions()
38
+
39
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
40
+  visible,
41
+  onSynced: () => {
42
+    pageNum.value = 1
43
+    fetchList()
44
+  }
45
+})
46
+
37 47
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
38 48
 
39 49
 async function fetchList() {
@@ -68,7 +78,7 @@ function handleSearch() {
68 78
 }
69 79
 
70 80
 function handleReset() {
71
-  query.statYear = undefined
81
+  syncDialogYearFromGlobal()
72 82
   query.statMonth = undefined
73 83
   query.townDeptId = undefined
74 84
   query.villageDeptId = undefined
@@ -81,7 +91,7 @@ function onTownChange() {
81 91
 }
82 92
 
83 93
 function onOpen() {
84
-  query.statYear = undefined
94
+  syncDialogYearFromGlobal()
85 95
   query.statMonth = undefined
86 96
   query.townDeptId = undefined
87 97
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/HerdInventoryDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getYakHerdInventories } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -34,6 +35,15 @@ const pageNum = ref(1)
34 35
 const pageSize = ref(10)
35 36
 
36 37
 const yearSelectOptions = buildScreenYearOptions()
38
+
39
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
40
+  visible,
41
+  onSynced: () => {
42
+    pageNum.value = 1
43
+    fetchList()
44
+  }
45
+})
46
+
37 47
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
38 48
 
39 49
 async function fetchList() {
@@ -68,7 +78,7 @@ function handleSearch() {
68 78
 }
69 79
 
70 80
 function handleReset() {
71
-  query.statYear = undefined
81
+  syncDialogYearFromGlobal()
72 82
   query.statMonth = undefined
73 83
   query.townDeptId = undefined
74 84
   query.villageDeptId = undefined
@@ -81,7 +91,7 @@ function onTownChange() {
81 91
 }
82 92
 
83 93
 function onOpen() {
84
-  query.statYear = undefined
94
+  syncDialogYearFromGlobal()
85 95
   query.statMonth = undefined
86 96
   query.townDeptId = undefined
87 97
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/ImbalanceWarningDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getGrassLivestockImbalanceWarnings } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -36,6 +37,15 @@ const pageSize = ref(10)
36 37
 /** 弹框年份:2021~当年 */
37 38
 const yearSelectOptions = buildScreenYearOptions()
38 39
 
40
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
41
+  visible,
42
+  onSynced: () => {
43
+    pageNum.value = 1
44
+    fetchList()
45
+  }
46
+})
47
+
48
+
39 49
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
40 50
 
41 51
 function familyRanchName(row) {
@@ -86,7 +96,7 @@ function handleSearch() {
86 96
 }
87 97
 
88 98
 function handleReset() {
89
-  query.statYear = undefined
99
+  syncDialogYearFromGlobal()
90 100
   query.statMonth = undefined
91 101
   query.townDeptId = undefined
92 102
   query.villageDeptId = undefined
@@ -99,7 +109,7 @@ function onTownChange() {
99 109
 }
100 110
 
101 111
 async function onOpen() {
102
-  query.statYear = undefined
112
+  syncDialogYearFromGlobal()
103 113
   query.statMonth = undefined
104 114
   query.townDeptId = undefined
105 115
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/LivestockOutboundDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getYakOutboundReports } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const OUTBOUND_TOTAL_PROPS = [
@@ -43,6 +44,15 @@ const pageNum = ref(1)
43 44
 const pageSize = ref(10)
44 45
 
45 46
 const yearSelectOptions = buildScreenYearOptions()
47
+
48
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
49
+  visible,
50
+  onSynced: () => {
51
+    pageNum.value = 1
52
+    fetchList()
53
+  }
54
+})
55
+
46 56
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
47 57
 
48 58
 function toNum(val) {
@@ -94,7 +104,7 @@ function handleSearch() {
94 104
 }
95 105
 
96 106
 function handleReset() {
97
-  query.statYear = undefined
107
+  syncDialogYearFromGlobal()
98 108
   query.statMonth = undefined
99 109
   query.townDeptId = undefined
100 110
   query.villageDeptId = undefined
@@ -107,7 +117,7 @@ function onTownChange() {
107 117
 }
108 118
 
109 119
 function onOpen() {
110
-  query.statYear = undefined
120
+  syncDialogYearFromGlobal()
111 121
   query.statMonth = undefined
112 122
   query.townDeptId = undefined
113 123
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/LivestockOwnershipDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getLivestockOwnershipHouseholds } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -34,6 +35,15 @@ const pageNum = ref(1)
34 35
 const pageSize = ref(10)
35 36
 
36 37
 const yearSelectOptions = buildScreenYearOptions()
38
+
39
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
40
+  visible,
41
+  onSynced: () => {
42
+    pageNum.value = 1
43
+    fetchList()
44
+  }
45
+})
46
+
37 47
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
38 48
 
39 49
 /** 接口无村居数字段;本表为村×年月粒度,有村则计 1 */
@@ -76,7 +86,7 @@ function handleSearch() {
76 86
 }
77 87
 
78 88
 function handleReset() {
79
-  query.statYear = undefined
89
+  syncDialogYearFromGlobal()
80 90
   query.statMonth = undefined
81 91
   query.townDeptId = undefined
82 92
   query.villageDeptId = undefined
@@ -89,7 +99,7 @@ function onTownChange() {
89 99
 }
90 100
 
91 101
 function onOpen() {
92
-  query.statYear = undefined
102
+  syncDialogYearFromGlobal()
93 103
   query.statMonth = undefined
94 104
   query.townDeptId = undefined
95 105
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/PerCapitaIncomeDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getPerCapitaIncomes } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 
8 9
 const props = defineProps({
9 10
   modelValue: { type: Boolean, default: false }
@@ -29,6 +30,15 @@ const pageSize = ref(10)
29 30
 /** 弹框年份:2021~当年 */
30 31
 const yearSelectOptions = buildScreenYearOptions()
31 32
 
33
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
34
+  visible,
35
+  onSynced: () => {
36
+    pageNum.value = 1
37
+    fetchList()
38
+  }
39
+})
40
+
41
+
32 42
 function formatPercent(val) {
33 43
   if (val === null || val === undefined || val === '') {
34 44
     return displayEmpty(null)
@@ -65,13 +75,13 @@ function handleSearch() {
65 75
 }
66 76
 
67 77
 function handleReset() {
68
-  query.statYear = undefined
78
+  syncDialogYearFromGlobal()
69 79
   pageNum.value = 1
70 80
   fetchList()
71 81
 }
72 82
 
73 83
 function onOpen() {
74
-  query.statYear = undefined
84
+  syncDialogYearFromGlobal()
75 85
   pageNum.value = 1
76 86
   fetchList()
77 87
 }

+ 12 - 2
ruoyi-screen/src/views/home/SelfConsumptionDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getYakOutboundReports } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -34,6 +35,15 @@ const pageNum = ref(1)
34 35
 const pageSize = ref(10)
35 36
 
36 37
 const yearSelectOptions = buildScreenYearOptions()
38
+
39
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
40
+  visible,
41
+  onSynced: () => {
42
+    pageNum.value = 1
43
+    fetchList()
44
+  }
45
+})
46
+
37 47
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
38 48
 
39 49
 function toNum(val) {
@@ -87,7 +97,7 @@ function handleSearch() {
87 97
 }
88 98
 
89 99
 function handleReset() {
90
-  query.statYear = undefined
100
+  syncDialogYearFromGlobal()
91 101
   query.statMonth = undefined
92 102
   query.townDeptId = undefined
93 103
   query.villageDeptId = undefined
@@ -100,7 +110,7 @@ function onTownChange() {
100 110
 }
101 111
 
102 112
 function onOpen() {
103
-  query.statYear = undefined
113
+  syncDialogYearFromGlobal()
104 114
   query.statMonth = undefined
105 115
   query.townDeptId = undefined
106 116
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/YakHerdInventoryDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getYakHerdInventories } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -34,6 +35,15 @@ const pageNum = ref(1)
34 35
 const pageSize = ref(10)
35 36
 
36 37
 const yearSelectOptions = buildScreenYearOptions()
38
+
39
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
40
+  visible,
41
+  onSynced: () => {
42
+    pageNum.value = 1
43
+    fetchList()
44
+  }
45
+})
46
+
37 47
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
38 48
 
39 49
 async function fetchList() {
@@ -68,7 +78,7 @@ function handleSearch() {
68 78
 }
69 79
 
70 80
 function handleReset() {
71
-  query.statYear = undefined
81
+  syncDialogYearFromGlobal()
72 82
   query.statMonth = undefined
73 83
   query.townDeptId = undefined
74 84
   query.villageDeptId = undefined
@@ -81,7 +91,7 @@ function onTownChange() {
81 91
 }
82 92
 
83 93
 function onOpen() {
84
-  query.statYear = undefined
94
+  syncDialogYearFromGlobal()
85 95
   query.statMonth = undefined
86 96
   query.townDeptId = undefined
87 97
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/home/YakInventoryOutboundDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getYakInventoryOutbounds } from '@/api/home'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -34,6 +35,15 @@ const pageNum = ref(1)
34 35
 const pageSize = ref(10)
35 36
 
36 37
 const yearSelectOptions = buildScreenYearOptions()
38
+
39
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
40
+  visible,
41
+  onSynced: () => {
42
+    pageNum.value = 1
43
+    fetchList()
44
+  }
45
+})
46
+
37 47
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
38 48
 
39 49
 async function fetchList() {
@@ -68,7 +78,7 @@ function handleSearch() {
68 78
 }
69 79
 
70 80
 function handleReset() {
71
-  query.statYear = undefined
81
+  syncDialogYearFromGlobal()
72 82
   query.statMonth = undefined
73 83
   query.townDeptId = undefined
74 84
   query.villageDeptId = undefined
@@ -81,7 +91,7 @@ function onTownChange() {
81 91
 }
82 92
 
83 93
 function onOpen() {
84
-  query.statYear = undefined
94
+  syncDialogYearFromGlobal()
85 95
   query.statMonth = undefined
86 96
   query.townDeptId = undefined
87 97
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/livestockResources/ProductOutputDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getLivestockProductOutputs } from '@/api/livestockResources'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -34,6 +35,15 @@ const pageNum = ref(1)
34 35
 const pageSize = ref(10)
35 36
 
36 37
 const yearSelectOptions = buildScreenYearOptions()
38
+
39
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
40
+  visible,
41
+  onSynced: () => {
42
+    pageNum.value = 1
43
+    fetchList()
44
+  }
45
+})
46
+
37 47
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
38 48
 
39 49
 function formatOutput(val) {
@@ -79,7 +89,7 @@ function handleSearch() {
79 89
 }
80 90
 
81 91
 function handleReset() {
82
-  query.statYear = undefined
92
+  syncDialogYearFromGlobal()
83 93
   query.statMonth = undefined
84 94
   query.townDeptId = undefined
85 95
   query.villageDeptId = undefined
@@ -92,7 +102,7 @@ function onTownChange() {
92 102
 }
93 103
 
94 104
 function onOpen() {
95
-  query.statYear = undefined
105
+  syncDialogYearFromGlobal()
96 106
   query.statMonth = undefined
97 107
   query.townDeptId = undefined
98 108
   query.villageDeptId = undefined

+ 12 - 2
ruoyi-screen/src/views/livestockResources/ThreeAssetsProblemReportDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getThreeAssetsProblemReports } from '@/api/livestockResources'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -34,6 +35,15 @@ const pageSize = ref(10)
34 35
 
35 36
 const yearSelectOptions = buildScreenYearOptions()
36 37
 
38
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
39
+  visible,
40
+  onSynced: () => {
41
+    pageNum.value = 1
42
+    fetchList()
43
+  }
44
+})
45
+
46
+
37 47
 async function fetchList() {
38 48
   loading.value = true
39 49
   try {
@@ -65,7 +75,7 @@ function handleSearch() {
65 75
 }
66 76
 
67 77
 function handleReset() {
68
-  query.statYear = undefined
78
+  syncDialogYearFromGlobal()
69 79
   query.townDeptId = undefined
70 80
   query.villageDeptId = undefined
71 81
   pageNum.value = 1
@@ -77,7 +87,7 @@ function onTownChange() {
77 87
 }
78 88
 
79 89
 function onOpen() {
80
-  query.statYear = undefined
90
+  syncDialogYearFromGlobal()
81 91
   query.townDeptId = undefined
82 92
   query.villageDeptId = undefined
83 93
   pageNum.value = 1

+ 12 - 2
ruoyi-screen/src/views/livestockResources/VaccinationDataDialog.vue

@@ -4,6 +4,7 @@ import ScreenModal from '@/components/ScreenModal.vue'
4 4
 import { getLivestockVaccinationData } from '@/api/livestockResources'
5 5
 import { displayEmpty } from '@/utils/displayEmpty'
6 6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7 8
 import { useScreenTownVillageOptions } from '@/utils/screenTownVillage'
8 9
 
9 10
 const props = defineProps({
@@ -34,6 +35,15 @@ const pageNum = ref(1)
34 35
 const pageSize = ref(10)
35 36
 
36 37
 const yearSelectOptions = buildScreenYearOptions()
38
+
39
+const { syncDialogYearFromGlobal } = useDialogStatYearSync(query, {
40
+  visible,
41
+  onSynced: () => {
42
+    pageNum.value = 1
43
+    fetchList()
44
+  }
45
+})
46
+
37 47
 const monthOptions = Array.from({ length: 12 }, (_, i) => i + 1)
38 48
 
39 49
 function formatRate(val) {
@@ -79,7 +89,7 @@ function handleSearch() {
79 89
 }
80 90
 
81 91
 function handleReset() {
82
-  query.statYear = undefined
92
+  syncDialogYearFromGlobal()
83 93
   query.statMonth = undefined
84 94
   query.townDeptId = undefined
85 95
   query.villageDeptId = undefined
@@ -92,7 +102,7 @@ function onTownChange() {
92 102
 }
93 103
 
94 104
 function onOpen() {
95
-  query.statYear = undefined
105
+  syncDialogYearFromGlobal()
96 106
   query.statMonth = undefined
97 107
   query.townDeptId = undefined
98 108
   query.villageDeptId = undefined