Browse Source

车站可能空

master
zhangjiming 4 months ago
parent
commit
a0db23bacf
  1. 36
      src/pages/MeasureSave.tsx

36
src/pages/MeasureSave.tsx

@ -33,7 +33,9 @@ export default function MeasureSave() {
const [directionCode, setDirectionCode] = useState<string[]>([XB_CODES[0].value]);
const [dataSourceCode, setDataSourceCode] = useState<string[]>([DATA_SOURCE[0].value]);
const [lineClassCode, setLineClassCode] = useState<string[]>([LINE_CLASSIFY[0].value]);
const [stationCode, setStationCode] = useState<string[]>([contextState.stationList[0].value]);
const [stationCode, setStationCode] = useState<string[]>(
contextState.stationList.length > 0 ? [contextState.stationList[0].value] : []
);
const [unitType, setUnitType] = useState<string[]>([UNIT_TYPES[0].value]);
const onInputChange = (evt: ChangeEvent<HTMLInputElement>) => {
@ -74,7 +76,10 @@ export default function MeasureSave() {
gwdCode: gwd,
xmCode: xm,
xbCode: XB_CODES.find((x) => x.value === directionCode[0])!.label,
stationCode: contextState.stationList.find((s) => s.value === stationCode[0])!.label,
stationCode:
stationCode.length > 0
? contextState.stationList.find((s) => s.value === stationCode[0])!.label
: '',
lineClassify: LINE_CLASSIFY.find((l) => l.value === lineClassCode[0])!.label,
dataSource: DATA_SOURCE.find((d) => d.value === dataSourceCode[0])!.label,
unitType: UNIT_TYPES.find((u) => u.value === unitType[0])!.label,
@ -91,7 +96,7 @@ export default function MeasureSave() {
gwdCode: contextState.currGWDCode,
xmCode: contextState.currXMCode,
xbCode: directionCode[0],
stationCode: stationCode[0],
stationCode: stationCode.length > 0 ? stationCode[0] : '',
lineClassify: lineClassCode[0],
dataSource: dataSourceCode[0],
turnoutNum: turnoutNum.toFixed(),
@ -177,6 +182,20 @@ export default function MeasureSave() {
onChange={onInputChange}
/>
</div>
<div
className="h-12 flex items-center border-b border-[#eee]"
onClick={() => {
if (contextState.stationList.length > 0) {
setStationPickerVisible(true);
}
}}
>
<span></span>
<span className="ml-auto mr-4">
{contextState.stationList.find((r) => r.value === stationCode[0])?.label || ''}
</span>
<img src={icon_arr_r} alt="arr" />
</div>
</>
) : (
<div className="h-12 flex items-center border-b border-[#eee]">
@ -199,16 +218,7 @@ export default function MeasureSave() {
<span></span>
</div>
)}
<div
className="h-12 flex items-center border-b border-[#eee]"
onClick={() => setStationPickerVisible(true)}
>
<span></span>
<span className="ml-auto mr-4">
{contextState.stationList.find((r) => r.value === stationCode[0])?.label || ''}
</span>
<img src={icon_arr_r} alt="arr" />
</div>
<div
className="h-12 flex items-center border-b border-[#eee]"
onClick={() => setLineClassPickerVisible(true)}

Loading…
Cancel
Save