xsh_1997 1 tydzień temu
rodzic
commit
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
 import { getCommonProsperityProjectTypeDetails } from '@/api/commonProsperity'
4
 import { getCommonProsperityProjectTypeDetails } from '@/api/commonProsperity'
5
 import { displayEmpty } from '@/utils/displayEmpty'
5
 import { displayEmpty } from '@/utils/displayEmpty'
6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
6
 import { buildScreenYearOptions } from '@/utils/screenYearOptions'
7
+import { useDialogStatYearSync } from '@/utils/useDialogStatYearSync'
7
 
8
 
8
 const props = defineProps({
9
 const props = defineProps({
9
   modelValue: { type: Boolean, default: false }
10
   modelValue: { type: Boolean, default: false }
@@ -28,6 +29,15 @@ const pageSize = ref(10)
28
 
29
 
29
 const yearSelectOptions = buildScreenYearOptions()
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
 async function fetchList() {
41
 async function fetchList() {
32
   loading.value = true
42
   loading.value = true
33
   try {
43
   try {
@@ -53,13 +63,13 @@ function handleSearch() {
53
 }
63
 }
54
 
64
 
55
 function handleReset() {
65
 function handleReset() {
56
-  query.statYear = undefined
66
+  syncDialogYearFromGlobal()
57
   pageNum.value = 1
67
   pageNum.value = 1
58
   fetchList()
68
   fetchList()
59
 }
69
 }
60
 
70
 
61
 function onOpen() {
71
 function onOpen() {
62
-  query.statYear = undefined
72
+  syncDialogYearFromGlobal()
63
   pageNum.value = 1
73
   pageNum.value = 1
64
   fetchList()
74
   fetchList()
65
 }
75
 }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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