Commit c283675271453d133eb3a73feb0e3fccf8a4dbb3

Authored by fengwotao
1 parent 86d40b53

fix:DEFECT-1175 and 1176 报表配置刚开始为聚合数据,然后再点击编辑,选择聚合条件少了计数, and 编辑时,求和显示为count了

@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 </BasicDrawer> 41 </BasicDrawer>
42 </template> 42 </template>
43 <script lang="ts" setup> 43 <script lang="ts" setup>
44 - import { ref, computed, unref, reactive, watch, Ref } from 'vue'; 44 + import { ref, computed, unref, reactive, watch, Ref, nextTick } from 'vue';
45 import { BasicForm, useForm } from '/@/components/Form'; 45 import { BasicForm, useForm } from '/@/components/Form';
46 import { formSchema, organizationId } from './config.data'; 46 import { formSchema, organizationId } from './config.data';
47 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; 47 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
@@ -198,6 +198,7 @@ @@ -198,6 +198,7 @@
198 const isViewDetail = ref(false); 198 const isViewDetail = ref(false);
199 199
200 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { 200 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
  201 + await nextTick();
201 await resetFields(); 202 await resetFields();
202 setDrawerProps({ confirmLoading: false }); 203 setDrawerProps({ confirmLoading: false });
203 isUpdate.value = !!data?.isUpdate; 204 isUpdate.value = !!data?.isUpdate;
@@ -222,6 +223,10 @@ @@ -222,6 +223,10 @@
222 await setFieldsValue(editResData.data); 223 await setFieldsValue(editResData.data);
223 //回显嵌套数据 224 //回显嵌套数据
224 await setFieldsValue({ 225 await setFieldsValue({
  226 + dateGroupGap:
  227 + editResData.data.queryCondition?.queryMode === 1
  228 + ? editResData.data.queryCondition?.interval
  229 + : null,
225 agg: editResData.data.queryCondition?.agg, 230 agg: editResData.data.queryCondition?.agg,
226 interval: editResData.data.queryCondition?.interval, 231 interval: editResData.data.queryCondition?.interval,
227 limit: editResData.data.queryCondition?.limit, 232 limit: editResData.data.queryCondition?.limit,
@@ -266,6 +271,7 @@ @@ -266,6 +271,7 @@
266 { label: '最大值', value: AggregateDataEnum.MAX }, 271 { label: '最大值', value: AggregateDataEnum.MAX },
267 { label: '平均值', value: AggregateDataEnum.AVG }, 272 { label: '平均值', value: AggregateDataEnum.AVG },
268 { label: '求和', value: AggregateDataEnum.SUM }, 273 { label: '求和', value: AggregateDataEnum.SUM },
  274 + { label: '计数', value: AggregateDataEnum.COUNT },
269 { label: '空', value: AggregateDataEnum.NONE }, 275 { label: '空', value: AggregateDataEnum.NONE },
270 ]; 276 ];
271 const updateSchemaAgg = (options: {}) => { 277 const updateSchemaAgg = (options: {}) => {
@@ -276,8 +282,8 @@ @@ -276,8 +282,8 @@
276 }, 282 },
277 }); 283 });
278 }; 284 };
279 - if (editResData.data.dataType == 1) updateSchemaAgg(dataCompareOpions.slice(0, 4));  
280 - else updateSchemaAgg(dataCompareOpions.slice(4, 5)); 285 + if (editResData.data.dataType == 1) updateSchemaAgg(dataCompareOpions.slice(0, 5));
  286 + else updateSchemaAgg(dataCompareOpions.slice(5, 6));
281 //回显执行方式和查询周期 287 //回显执行方式和查询周期
282 const dataQueryOpions = [ 288 const dataQueryOpions = [
283 { label: '固定周期', value: QueryWay.LATEST }, 289 { label: '固定周期', value: QueryWay.LATEST },
@@ -442,7 +448,7 @@ @@ -442,7 +448,7 @@
442 } 448 }
443 queryCondition = { 449 queryCondition = {
444 agg: values.agg, 450 agg: values.agg,
445 - interval: values.interval, 451 + interval: values?.queryMode === 'latest' ? values.interval : values.dateGroupGap,
446 limit: values.limit, 452 limit: values.limit,
447 ...{ 453 ...{
448 startTs: startTs.value, 454 startTs: startTs.value,