Commit 4b86efb5adbfb6aebd1562cc4fc726bda7c1cf36
Merge branch 'local_fix_report_config_by_ft' into 'main_dev'
fix: 修复报表导出,报表查看,日期取值问题 See merge request yunteng/thingskit-front!1000
Showing
2 changed files
with
31 additions
and
4 deletions
... | ... | @@ -471,7 +471,6 @@ export const formSchema: BFormSchema[] = [ |
471 | 471 | dynamicRules: () => { |
472 | 472 | return [ |
473 | 473 | { |
474 | - // required: model[SchemaFiled.AGG] !== AggregateDataEnum.NONE, | |
475 | 474 | required: true, |
476 | 475 | message: '间隔时间为必填项', |
477 | 476 | type: 'number', |
... | ... | @@ -479,8 +478,11 @@ export const formSchema: BFormSchema[] = [ |
479 | 478 | ]; |
480 | 479 | }, |
481 | 480 | ifShow({ values }) { |
482 | - return values[SchemaFiled.DATA_TYPE] !== DataTypeEnum.ORIGINAL; | |
483 | - // return values[SchemaFiled.WAY] === QueryWay.TIME_PERIOD && exectueIsImmed(values.executeWay); | |
481 | + return ( | |
482 | + values[SchemaFiled.WAY] === QueryWay.TIME_PERIOD && | |
483 | + exectueIsImmed(values.executeWay) && | |
484 | + values[SchemaFiled.DATA_TYPE] !== DataTypeEnum.ORIGINAL | |
485 | + ); | |
484 | 486 | }, |
485 | 487 | componentProps({ formModel, formActionType }) { |
486 | 488 | const options = | ... | ... |
... | ... | @@ -209,15 +209,40 @@ |
209 | 209 | |
210 | 210 | const keys = attributes.length ? (attributes as any[]).at(0)?.value : ''; |
211 | 211 | |
212 | + // fix修改执行条件里的日期 | |
213 | + const tsObj: Recordable = {}; | |
214 | + | |
215 | + const { executeCondition } = data.record?.executeCondition as Recordable; | |
216 | + | |
217 | + if (!executeCondition) return; | |
218 | + | |
219 | + if ( | |
220 | + Reflect.has(executeCondition, 'prevStartTs') && | |
221 | + Reflect.has(executeCondition, 'prevEndTs') | |
222 | + ) { | |
223 | + // 有则取对应值 | |
224 | + tsObj.startTs = executeCondition?.prevStartTs; | |
225 | + tsObj.endTs = executeCondition?.prevEndTs; | |
226 | + } else { | |
227 | + // 使用之前的日期 | |
228 | + tsObj.startTs = executeCondition?.startTs; | |
229 | + tsObj.endTs = executeCondition?.endTs; | |
230 | + } | |
231 | + Reflect.deleteProperty(executeCondition, 'prevStartTs'); | |
232 | + Reflect.deleteProperty(executeCondition, 'prevEndTs'); | |
233 | + | |
212 | 234 | const sendParams = { |
213 | - ...data.record.executeCondition.executeCondition, | |
235 | + ...executeCondition, | |
214 | 236 | ...{ |
215 | 237 | keys, |
216 | 238 | }, |
239 | + ...tsObj, | |
217 | 240 | }; |
218 | 241 | |
219 | 242 | const result = await exportViewChartApi(device, sendParams); |
243 | + | |
220 | 244 | item.notFoundData = validateHasData(result); |
245 | + | |
221 | 246 | const { xAxisData, series } = getChartsOption(result as unknown as ResponsData); |
222 | 247 | |
223 | 248 | await nextTick(); | ... | ... |