|
@@ -8,6 +8,7 @@ import { useEffect, useState } from 'react'
|
|
|
export default function Component(props: { item: any, strTime: string, showPicker: Function, cancel: Function, confirm: Function }) {
|
|
export default function Component(props: { item: any, strTime: string, showPicker: Function, cancel: Function, confirm: Function }) {
|
|
|
const [metricItem, setMetricItem] = useState(props.item)
|
|
const [metricItem, setMetricItem] = useState(props.item)
|
|
|
const [enable, setEnable] = useState(true)
|
|
const [enable, setEnable] = useState(true)
|
|
|
|
|
+ const [currentSel, setCurrentSel] = useState<any>({})
|
|
|
// const [disableCode,setDisableCode] = useState(0)
|
|
// const [disableCode,setDisableCode] = useState(0)
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
@@ -26,28 +27,38 @@ export default function Component(props: { item: any, strTime: string, showPicke
|
|
|
var obj = item;
|
|
var obj = item;
|
|
|
const { unit_options, chosen_unit } = item;
|
|
const { unit_options, chosen_unit } = item;
|
|
|
if (unit_options && unit_options.length > 0) {
|
|
if (unit_options && unit_options.length > 0) {
|
|
|
- unit_options.map(temp => {
|
|
|
|
|
|
|
+ unit_options.map((temp, i) => {
|
|
|
if (temp.unit == chosen_unit) {
|
|
if (temp.unit == chosen_unit) {
|
|
|
obj = temp
|
|
obj = temp
|
|
|
|
|
+ var tempMap = JSON.parse(JSON.stringify(currentSel))
|
|
|
|
|
+ tempMap[index] = i;
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
- debugger
|
|
|
|
|
- return <View key={index}>
|
|
|
|
|
|
|
+ return <View key={index} style={{position:'relative'}}>
|
|
|
{
|
|
{
|
|
|
(metricItem as any).schemas.length > 1 && <Text style={{
|
|
(metricItem as any).schemas.length > 1 && <Text style={{
|
|
|
textAlign: 'center', width: '100%', display: 'flex',
|
|
textAlign: 'center', width: '100%', display: 'flex',
|
|
|
justifyContent: 'center', color: (metricItem as any).theme_color,
|
|
justifyContent: 'center', color: (metricItem as any).theme_color,
|
|
|
// opacity:item.code==disableCode?0.4:1
|
|
// opacity:item.code==disableCode?0.4:1
|
|
|
- }}>{obj.name}</Text>
|
|
|
|
|
|
|
+ }}>{item.name}</Text>
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ unit_options && unit_options.length > 1 && <View style={{position:'absolute',right:20,}}>
|
|
|
|
|
+ <Text style={{color:'#fff'}}>切换</Text>
|
|
|
|
|
+ </View>
|
|
|
}
|
|
}
|
|
|
<SlidngScale step={obj.step} min={obj.min} max={obj.max}
|
|
<SlidngScale step={obj.step} min={obj.min} max={obj.max}
|
|
|
default_value={obj.default_value}
|
|
default_value={obj.default_value}
|
|
|
scale={obj.scale}
|
|
scale={obj.scale}
|
|
|
- unit={obj.unit?obj.unit:item.unit}
|
|
|
|
|
|
|
+ unit={obj.unit ? obj.unit : item.default_unit}
|
|
|
special={obj.special ?? null}
|
|
special={obj.special ?? null}
|
|
|
themeColor={(metricItem as any).theme_color}
|
|
themeColor={(metricItem as any).theme_color}
|
|
|
- changed={(e) => { obj.tempValue = e }}
|
|
|
|
|
|
|
+ changed={(e) => {
|
|
|
|
|
+ item.tempValue = e;
|
|
|
|
|
+ item.tempUnit = obj.unit ? obj.unit : item.default_unit
|
|
|
|
|
+ debugger
|
|
|
|
|
+ }}
|
|
|
updateStatus={(isEnable) => {
|
|
updateStatus={(isEnable) => {
|
|
|
setEnable(isEnable)
|
|
setEnable(isEnable)
|
|
|
}} />
|
|
}} />
|