Commit 9641390ffc4a78cdcc2ca30e876262a618b9e7bf

Authored by fengwotao
1 parent 03ccb74b

fix: 修复报表导出,报表查看,日期取值问题

@@ -471,7 +471,6 @@ export const formSchema: BFormSchema[] = [ @@ -471,7 +471,6 @@ export const formSchema: BFormSchema[] = [
471 dynamicRules: () => { 471 dynamicRules: () => {
472 return [ 472 return [
473 { 473 {
474 - // required: model[SchemaFiled.AGG] !== AggregateDataEnum.NONE,  
475 required: true, 474 required: true,
476 message: '间隔时间为必填项', 475 message: '间隔时间为必填项',
477 type: 'number', 476 type: 'number',
@@ -479,8 +478,11 @@ export const formSchema: BFormSchema[] = [ @@ -479,8 +478,11 @@ export const formSchema: BFormSchema[] = [
479 ]; 478 ];
480 }, 479 },
481 ifShow({ values }) { 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 componentProps({ formModel, formActionType }) { 487 componentProps({ formModel, formActionType }) {
486 const options = 488 const options =
@@ -209,15 +209,40 @@ @@ -209,15 +209,40 @@
209 209
210 const keys = attributes.length ? (attributes as any[]).at(0)?.value : ''; 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 const sendParams = { 234 const sendParams = {
213 - ...data.record.executeCondition.executeCondition, 235 + ...executeCondition,
214 ...{ 236 ...{
215 keys, 237 keys,
216 }, 238 },
  239 + ...tsObj,
217 }; 240 };
218 241
219 const result = await exportViewChartApi(device, sendParams); 242 const result = await exportViewChartApi(device, sendParams);
  243 +
220 item.notFoundData = validateHasData(result); 244 item.notFoundData = validateHasData(result);
  245 +
221 const { xAxisData, series } = getChartsOption(result as unknown as ResponsData); 246 const { xAxisData, series } = getChartsOption(result as unknown as ResponsData);
222 247
223 await nextTick(); 248 await nextTick();