| | |
| | | <template> |
| | | <div class="w-full flex-column"> |
| | | <div class="flex-0 flex-items-center mb-1 h-[38px]"> |
| | | <template v-if="visibleParams && visibleParams.length > 0"> |
| | | <template v-if="visibleParams && visibleParams.length > 0 && showFilter"> |
| | | <component |
| | | class="flex-0 m-2" |
| | | v-model="visibleParams[index].value" |
| | | v-for="(item, index) in visibleParams as any" |
| | | :key="item.id" |
| | | :id="item.id" |
| | | :is="recordSetTableMap[item.type]" |
| | | :is="recordSetMapCom[item.type]" |
| | | :data="item" |
| | | @change="(val) => handleQueryChange(val, item)" |
| | | :originData="originData" |
| | |
| | | import { TableCol } from '/@/components/table/colFilter/types'; |
| | | import { debounce, getTextWidth } from '/@/utils/util'; |
| | | import InfoDetail from './infoDetail/InfoDetail.vue'; |
| | | import { RecordSetTableType, recordSetTableMap } from './types'; |
| | | import StringInput from './components/StringInput.vue'; |
| | | import { curveQuery } from '/@/api/ai/chat'; |
| | | import { RecordSetParamsType, recordSetMapCom } from '../recordSet/types'; |
| | | |
| | | const props = defineProps({ |
| | | data: { |
| | |
| | | summaryIndex: { |
| | | type: Number, |
| | | }, |
| | | tableLimitHeight:{ |
| | | type:Number, |
| | | required:false |
| | | tableLimitHeight: { |
| | | type: Number, |
| | | required: false, |
| | | }, |
| | | showFilter:{ |
| | | type:Boolean, |
| | | default:true |
| | | } |
| | | }); |
| | | |
| | |
| | | const headerHeight = tableRef.value.$el.querySelector('.el-table__header-wrapper').clientHeight; |
| | | |
| | | // éå¶é«åº¦ |
| | | const limitHeight =props.tableLimitHeight ??containerRef.value.clientHeight; |
| | | const limitHeight = props.tableLimitHeight ?? containerRef.value.clientHeight; |
| | | |
| | | // æ± size |
| | | // size*cellHeight + size*THICK_BORDER_WIDTH + headerHeight <= limitHeight; |
| | |
| | | let res = null; |
| | | |
| | | // æ¹ååå§å¼ |
| | | if (item.type === RecordSetTableType.StringInput) { |
| | | if (item.type === RecordSetParamsType.StringInput) { |
| | | item.origin.value = val; |
| | | } else if (item.type === RecordSetParamsType.TimeRange) { |
| | | item.origin.start_value = val[0]; |
| | | item.origin.end_value = val[1]; |
| | | } else if (item.type === RecordSetParamsType.Step) { |
| | | item.origin.step_value = val; |
| | | } |
| | | try { |
| | | // ç¸å agent_key 䏿æ filter 请æ±åæ° |
| | |
| | | if (curVal.agent_key !== curAgentKey) return preVal; |
| | | |
| | | const filter = (curVal.filter ?? []).reduce((subPreVal, subCurVal) => { |
| | | if (subCurVal.type === RecordSetTableType.StringInput) { |
| | | if (subCurVal.type === RecordSetParamsType.StringInput) { |
| | | subPreVal.push({ |
| | | update: subCurVal.update, |
| | | value: subCurVal.value, |
| | | path: subCurVal.path, |
| | | }); |
| | | } else if (subCurVal.type === RecordSetParamsType.TimeRange) { |
| | | subPreVal.push( |
| | | ...[ |
| | | { |
| | | update: subCurVal.update, |
| | | value: subCurVal.start_value, |
| | | path: subCurVal.start_path, |
| | | }, |
| | | { |
| | | update: subCurVal.update, |
| | | value: subCurVal.end_value, |
| | | path: subCurVal.end_path, |
| | | }, |
| | | ] |
| | | ); |
| | | } else if (subCurVal.type === RecordSetParamsType.Step) { |
| | | subPreVal.push({ |
| | | update: subCurVal.update, |
| | | value: subCurVal.step_value, |
| | | path: subCurVal.step_path, |
| | | }); |
| | | } |
| | | |
| | |
| | | const debounceQueryUpdate = debounce(queryUpdate, 600); |
| | | |
| | | const handleQueryChange = async (val: any, item: any) => { |
| | | if (item.type === RecordSetTableType.StringInput) { |
| | | if (item.type === RecordSetParamsType.StringInput) { |
| | | debounceQueryUpdate(val, item); |
| | | }else{ |
| | | queryUpdate(val, item); |
| | | } |
| | | |
| | | // queryUpdate(val,item) |
| | | |
| | | return; |
| | | }; |
| | | |
| | | //#endregion |
| | | |
| | | const stepOptions = [ |
| | | { title: '5åé', value: '5 minutes' }, |
| | | { title: '10åé', value: '10 minutes' }, |
| | | { title: 'åå°æ¶', value: '30 minutes' }, |
| | | { title: '1å°æ¶', value: '1 hours' }, |
| | | { title: '1天', value: '1 days' }, |
| | | ]; |
| | | const getVisibleParams = (data) => { |
| | | // const visibleList = props.data?.params?.filter((item) => !item?.hide) ?? []; |
| | | // index ä½ä¸º id |
| | |
| | | return item; |
| | | }); |
| | | const newList: any[] = []; |
| | | |
| | | for (let index = 0; index < visibleList.length; index++) { |
| | | const current = visibleList[index]; |
| | | switch (current.type) { |
| | | case RecordSetTableType.StringInput: |
| | | case RecordSetParamsType.TimeRange: |
| | | newList.push({ |
| | | id: current.id, |
| | | type: RecordSetTableType.StringInput, |
| | | type: RecordSetParamsType.TimeRange, |
| | | origin: current, |
| | | value: [current.start_value, current.end_value], |
| | | title: current.title, |
| | | }); |
| | | break; |
| | | case RecordSetParamsType.Step: |
| | | newList.push({ |
| | | id: current.id, |
| | | type: RecordSetParamsType.Step, |
| | | origin: current, |
| | | value: current.step_value, |
| | | list: stepOptions, |
| | | title: current.title, |
| | | }); |
| | | break; |
| | | case RecordSetParamsType.StringInput: |
| | | newList.push({ |
| | | id: current.id, |
| | | type: RecordSetParamsType.StringInput, |
| | | origin: current, |
| | | value: current?.value ?? '', |
| | | title: current.title, |
| | |
| | | const currentItem = visibleParams.value.find((item) => item.id === index + ''); |
| | | |
| | | if (currentItem) { |
| | | if (newItem.type === RecordSetTableType.StringInput) { |
| | | if (newItem.type === RecordSetParamsType.StringInput) { |
| | | currentItem.value = newItem.value; |
| | | } |
| | | } |
| | |
| | | |
| | | updateCurrent(newSummary); |
| | | }; |
| | | const updateIndexSummary = (summary)=>{ |
| | | updateCurrent(summary?.[props.summaryIndex]) |
| | | } |
| | | |
| | | defineExpose({ |
| | | updateAll, |
| | | updateCurrent, |
| | | updateIndexSummary |
| | | }); |
| | | </script> |
| | | <style scoped lang="scss"> |