|
@@ -19,8 +19,6 @@ export const CompositeIndexForm = memo(({
|
|
|
const modals = useAppSelector(selectModals);
|
|
|
const metricsRef = useRef([]);
|
|
|
const [metrics,setMetrics]=useState([]);
|
|
|
- const [analyzes,setAnalyzes]=useState([]);
|
|
|
- const [dateDims, setDateDims] = useState([]);
|
|
|
const [metricFormData, setMetricFormData] = useState([]);
|
|
|
useEffect(() => {
|
|
|
const initialSelector = async (modelId)=>{
|
|
@@ -59,26 +57,25 @@ export const CompositeIndexForm = memo(({
|
|
|
dimensions = Array.isArray(data.dimensions) ? data.dimensions : [];
|
|
|
metrics = Array.isArray(data.metrics) ? data.metrics : [];
|
|
|
}
|
|
|
- const analyze = dimensions.filter(({type})=>type!=="time").map(({name, bizName, description, id})=>({
|
|
|
+ const analyze = dimensions.filter(({type})=>type!=="time").map(({name, bizName, description, id, modelId})=>({
|
|
|
label: description|| name|| bizName,
|
|
|
- value: id
|
|
|
+ value: id,
|
|
|
+ modelId,
|
|
|
}))
|
|
|
- const date = dimensions.filter(({type})=>type==="time").map(({name, bizName, description, id})=>({
|
|
|
+ const date = dimensions.filter(({type})=>type==="time").map(({name, bizName, description, id, modelId})=>({
|
|
|
label: description|| name|| bizName,
|
|
|
- value: id
|
|
|
+ value: id,
|
|
|
+ modelId,
|
|
|
}))
|
|
|
- // todo批量设置不清空
|
|
|
setMetrics(
|
|
|
metrics.filter(item=>item.bizName!==initialValues?.bizName).map((v) => {
|
|
|
return {
|
|
|
...v,
|
|
|
- analyzeArr: analyze,
|
|
|
- dateArr: date,
|
|
|
+ analyzeArr: analyze.filter(a => a.modelId == v.modelId),
|
|
|
+ dateArr: date.filter(a => a.modelId == v.modelId),
|
|
|
}
|
|
|
})
|
|
|
);
|
|
|
- setAnalyzes(analyze);
|
|
|
- setDateDims(date);
|
|
|
metricsRef.current=metrics;
|
|
|
}
|
|
|
}))
|
|
@@ -89,7 +86,6 @@ export const CompositeIndexForm = memo(({
|
|
|
const onComputedEditorChange = useCallback((expression)=>{
|
|
|
if (expression){
|
|
|
const data = computedEditorRef.current?.formatValue(expression,'change');
|
|
|
- console.log(data);
|
|
|
setMetricFormData(data?.metrics)
|
|
|
onChange?.(data)
|
|
|
}
|
|
@@ -120,19 +116,15 @@ export const CompositeIndexForm = memo(({
|
|
|
/>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
- <ProFormGroup style={{marginLeft: 105}}>
|
|
|
- <ProFormSelect
|
|
|
- name="dataFormatType"
|
|
|
- label={t('formItem.dataFormat')}
|
|
|
- valueEnum={DATA_TYPE}
|
|
|
- width={480}
|
|
|
- />
|
|
|
- <ProFormDigit name="decimalPlaces" placeholder={t("placeholder.decimalPlaces")} initialValue={initialValues?.dataFormat?.decimalPlaces} min={1} max={10}/>
|
|
|
- </ProFormGroup>
|
|
|
- <Row >
|
|
|
+ <Row gutter={10} style={{border: '1px solid #ccc',marginBottom: '16px', borderRight: 'none'}}>
|
|
|
{metricFormData.map((item, index) => {
|
|
|
return <>
|
|
|
- <Col span={Math.floor(24 / (metricFormData.length + 1))} key={index}>
|
|
|
+ <Col
|
|
|
+ span={Math.floor(24 / (metricFormData.length))}
|
|
|
+ style={{borderRight: '1px solid #ccc'}}
|
|
|
+ key={index}
|
|
|
+ >
|
|
|
+ <div style={{padding: '12px'}}>{item.name}</div>
|
|
|
<ProFormSelect
|
|
|
name={['dimensionId',index]}
|
|
|
options={item?.analyzeArr}
|
|
@@ -151,6 +143,15 @@ export const CompositeIndexForm = memo(({
|
|
|
</>
|
|
|
})}
|
|
|
</Row>
|
|
|
+ <ProFormGroup style={{marginLeft: 105}}>
|
|
|
+ <ProFormSelect
|
|
|
+ name="dataFormatType"
|
|
|
+ label={t('formItem.dataFormat')}
|
|
|
+ valueEnum={DATA_TYPE}
|
|
|
+ width={480}
|
|
|
+ />
|
|
|
+ <ProFormDigit name="decimalPlaces" placeholder={t("placeholder.decimalPlaces")} initialValue={initialValues?.dataFormat?.decimalPlaces} min={1} max={10}/>
|
|
|
+ </ProFormGroup>
|
|
|
</>
|
|
|
)
|
|
|
})
|