shijiplus-web-plugin 0.1.27 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shijiplus-web-plugin",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "files": [
5
5
  "src"
6
6
  ],
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  import PlusCircleProgressModal from './plus-circle-progress-modal.vue'
3
2
  export default {
4
3
  data() {
@@ -92,18 +91,19 @@ export default {
92
91
  // Main export function
93
92
  async invokeExportExcel(searchForm, apiFunction) {
94
93
  // 3. Initialize the progress modal
95
- const instance = this.$getComponentInstance(PlusCircleProgressModal)
96
- instance.$on('on-close', () => {
97
- setTimeout(() => {
98
- this.$removeVComp(instance)
99
- }, 500)
100
- })
94
+ let instance = null
101
95
  try {
102
96
  // 0. Validate the date range (limit to 1 month)
103
97
  const startDate = new Date(searchForm.startDate || searchForm.startTime || "")
104
98
  const endDate = new Date(searchForm.endDate || searchForm.startTime || "")
105
99
  const oneMonthInMs = 31 * 24 * 60 * 60 * 1000 // 1 个月的毫秒数
106
100
 
101
+ if (!startDate || isNaN(startDate.getTime()) || !endDate || isNaN(endDate.getTime())) {
102
+ setTimeout(() => {
103
+ this.$Message.error('请选择有效的导出开始和结束时间', 3)
104
+ }, 0)
105
+ return
106
+ }
107
107
  if (endDate - startDate > oneMonthInMs) {
108
108
  setTimeout(() => {
109
109
  this.$Message.error('导出时间范围不能超过1个月,请调整后重试', 3)
@@ -133,7 +133,12 @@ export default {
133
133
 
134
134
  // 2. Get the 4-hour intervals from startDate to endDate
135
135
  const intervals = this.getDateRange(startDate, endDate)
136
-
136
+ instance = this.$getComponentInstance(PlusCircleProgressModal)
137
+ instance.$on('on-close', () => {
138
+ setTimeout(() => {
139
+ this.$removeVComp(instance)
140
+ }, 500)
141
+ })
137
142
  instance.show()
138
143
 
139
144
  // 4. Fetch data interval by interval and update progress