From 071b755adbc0ee98edddb6220c7a2d0decc3c271 Mon Sep 17 00:00:00 2001 From: LiLongLong <13717757313@163.com> Date: Wed, 11 Jun 2025 12:24:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BF=9D=E5=AD=98=E6=B5=8B?= =?UTF-8?q?=E9=87=8F=20=E8=87=AA=E5=8A=A8=E7=84=A6=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 4 +- package.json | 2 +- .../measure/components/MeasureConfig - 副本.tsx | 632 --------------------- src/pages/measure/components/MeasureConfig-old.tsx | 632 +++++++++++++++++++++ src/pages/measure/components/MeasureConfig.tsx | 14 +- 5 files changed, 644 insertions(+), 640 deletions(-) delete mode 100644 src/pages/measure/components/MeasureConfig - 副本.tsx create mode 100644 src/pages/measure/components/MeasureConfig-old.tsx diff --git a/.env b/.env index 4b28872..2bbd71a 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -REACT_APP_WS_URL=192.168.1.115:8080/ws -# REACT_APP_WS_URL=127.1.1.0:8080/ws \ No newline at end of file +# REACT_APP_WS_URL=192.168.1.115:8080/ws +REACT_APP_WS_URL=127.1.1.0:8080/ws \ No newline at end of file diff --git a/package.json b/package.json index e1f52a2..8f85e35 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "outline", "version": "0.1.0", "private": true, - "proxy": "http://192.168.1.115:8080", + "proxy": "http://127.0.0.1:8080", "dependencies": { "@ant-design/icons": "^6.0.0", "@babel/core": "^7.16.0", diff --git a/src/pages/measure/components/MeasureConfig - 副本.tsx b/src/pages/measure/components/MeasureConfig - 副本.tsx deleted file mode 100644 index b8a5939..0000000 --- a/src/pages/measure/components/MeasureConfig - 副本.tsx +++ /dev/null @@ -1,632 +0,0 @@ -/* eslint-disable array-callback-return */ -import { Button, Form, Input, message, Select, InputNumber } from "antd"; -import { useEffect, useState } from "react"; -import { useNavigate } from "react-router"; -import { saveMeasurement_new } from "../../../services/measure/analysis"; -import { useAppSelector } from "../../../utils/hooks"; -import { - getOrgListService, - dictionaryListService, - queryStationData -} from "../../../services/ktj/org"; -import { useAppDispatch } from "../../../utils/hooks"; -import { setOrgData } from "../../../store/ktj/orgState"; -import type { - OrgItem, - GwdDicItem, - KTJ_BASE_TYPE, - options, - dataSourceOptions, - unitTypesOptions, - unitType, - extraDescType -} from "../../../services/ktjTypes"; -import { RAIN_TYPES, XB_CODES, DATA_SOURCE } from "../../../constant/index"; -import "./MeasureAction.scss"; -export default function MeasureConfig() { - const { Option } = Select; - const navigate = useNavigate(); - const systemState = useAppSelector((store) => store.systemState); - const [messageApi, contextHolder] = message.useMessage(); - const dispatch = useAppDispatch(); - const measureState = useAppSelector((store) => store.measureState); - const [extraDesc, setExtraDesc] = useState() - const onFinish = (values: any) => { - let mtValue = values["meters"] - //百米小于100时, 补齐3位。 比如 1 :"001", 10: "010" - if (mtValue < 100) { - mtValue = String(mtValue).padStart(3, '0'); - } - const params = { - operator: values["operator"],//操作员 - name: values["name"],//测量名称 - location: values["location"],//位置 - direction: values["direction"],//方向 - tljCode: values["tljCode"],//铁路局 - gwdCode: values["gwdCode"],//铁路段 - xmCode: values["xmCode"],//铁路线 - lineClassify: values["lineClassify"],//线路分类 - dataType: values["dataType"],//采集方式 - dataSource: values["dataSource"],//数据来源 - railSize: values["railSize"],//轨型 - xbCode: values["xbCode"],//行别 - unitType: values["unitType"],//股别 - mileage: `${values['kilometre']}+${mtValue}`,//里程 - stationCode: values['stationCode'],//车站 - batch: values['batch'],//批次 - radius: values["radius"],//半径 - turnoutNum: values["turnoutNum"],//道岔号 - sleeperNum: values["sleeperNum"],//枕木号 - extraDesc:JSON.stringify(extraDesc), - alignPoints:[] - }; - - const orgItem = { - tljCode: values["tljCode"],//铁路局 - gwdCode: values["gwdCode"],//铁路段 - xmCode: values["xmCode"],//铁路线 - } - localStorage.setItem('orgInfo', JSON.stringify(orgItem)); - params.extraDesc = JSON.stringify(extraDesc) - let measureData = measureState.measureData; - if(measureData && measureData.length){ - params.alignPoints = measureData - } - localStorage.setItem('measureForm', JSON.stringify(params)) - saveMeasurement_new(params) - .then((res) => { - if (res.success) { - messageApi.error(res.data.info); - } else { - message.success("保存成功"); - navigate("../action"); - } - }) - .catch((e) => { - navigate("../action"); - }); - }; - let user = localStorage.getItem("user") || ""; - let userInfo = (user && JSON.parse(user)) || {}; - const [form] = Form.useForm(); - useEffect(() => { - queryKTJOrgList(); - queryDictionaryList(); - resetDataSource() - resetRailTypes() - }, []); - - useEffect(()=>{ - }, [measureState.measureData]) - - //给股别分类 - const [unitTypeList, setUnitTypeList] = useState([]) - const resetRailTypes = () => { - let zxOptions:unitTypesOptions = { - label:'直线', - options:[] - } - let qxOptions:unitTypesOptions = { - label:'曲线', - options:[] - } - let zxList:unitType[] = [] - let qxList:unitType[] = [] - RAIN_TYPES.map(item => { - if(item.type === 1){ - zxList.push({ - label: item.name, - value: item.code, - }) - }else{ - qxList.push({ - label: item.name, - value: item.code, - }) - } - }) - zxOptions.options = zxList - qxOptions.options = qxList - setUnitTypeList([zxOptions, qxOptions]) - } - - const [xbCodeOptions, setXbCodeOptions] = useState() - const resetDataSource = () => { - let options:dataSourceOptions[] = [] - DATA_SOURCE.map(item => { - let optionMap:any = { - label: item.name, - value: item.code, - options:[] - } - let childOptions:options[] = [] - item.child.map(ele => { - childOptions.push({ - label: ele.name, - value: ele.code - }) - optionMap.options = childOptions - }) - options.push(optionMap) - }) - setXbCodeOptions(options) - } - - //初始化科天健机构数据 - let [SJLY_List, setSJLYList] = useState([]); - let [WRPS_CJFS_List, setWRPSCJFSList] = useState([]); - let [WRPS_GGGX_List, setWRPSGGGXList] = useState([]); - let [XLFL_List, setXLFLList] = useState([]); - const queryDictionaryList = () => { - dictionaryListService().then((res) => { - if (res && res.data) { - const { WRPS_CJFS, WRPS_GGGX, XLFL } = res.data; - const SJLY:KTJ_BASE_TYPE[] = res.data.SJLY - if(SJLY && SJLY.length){ - let sjlylist = SJLY.filter(item => item.key === 'XLDC' || item.key === 'DCDC') - setSJLYList(sjlylist); - } - if(WRPS_CJFS && WRPS_CJFS.length){ - setWRPSCJFSList(WRPS_CJFS); - } - if(WRPS_GGGX && WRPS_GGGX.length){ - setWRPSGGGXList(WRPS_GGGX); - } - if(XLFL && XLFL.length){ - setXLFLList(XLFL); - } - } - }); - }; - - //获取机构数据 - const [KTJOrgList, setKTJOrgList] = useState([]); - const queryKTJOrgList = () => { - getOrgListService() - .then((res) => { - let list: options[] = []; - if (res && res.data) { - let resData: OrgItem[] = res.data; - setKTJOrgList(resData); - dispatch(setOrgData(resData)); - resData.map((item) => { - list.push({ - value: item.key, - label: item.value, - }); - }); - } - }) - .catch((e) => {}); - }; - - - //选择机构时change - const [gwdDicList, setGwdDicList] = useState([]); - const [gwdCodeValue, setGwdCodeValue] = useState(); - const [xmCodeValue, setXmCodeValue] = useState(); - const [gwdDicOptions, setGwdDicOptions] = useState([]); - const [railDicOptions, setRailDicOptions] = useState([]); - const [orgGwdDicList, setOrgGwdDicList] = useState([]) - - const onOrgChange = (value: string, option:any) => { - let list = KTJOrgList.filter((item) => item.key === value); - form.resetFields(["gwdCode", "xmCode"]); - if (list && list.length) { - let orgItem: OrgItem = list[0]; - setExtraDesc({...extraDesc,orgName:option.label}) - if (orgItem && orgItem.gwdDicList) { - let listOptoins: options[] = []; - setGwdDicList(orgItem.gwdDicList); - setOrgGwdDicList(orgItem.gwdDicList) - orgItem.gwdDicList.map((item) => { - listOptoins.push({ - value: item.key, - label: item.value, - }); - }); - setGwdDicOptions(listOptoins); - setGwdCodeValue(listOptoins[0].value); - } - } - }; - - const onGwdChange = (value: string, option:any) => { - let cloneGwdDicList = [...orgGwdDicList]; - form.resetFields(["xmCode"]); - let list = cloneGwdDicList.filter((item) => item.key === value); - if (list && list.length) { - let gwdDicItem: GwdDicItem = list[0]; - setExtraDesc({...extraDesc,gwdName:option.label}) - if (gwdDicItem && gwdDicItem.railDicList) { - let railOptions: options[] = []; - gwdDicItem.railDicList.map((item) => { - railOptions.push({ - value: item.key, - label: item.value, - }); - }); - if(railOptions && railOptions.length){ - setRailDicOptions(railOptions); - setXmCodeValue(railOptions[0].value); - } - } - } - }; - - //车站数据 - const [stationList, setStationList] = useState([]) - const queryStation = (value:string, option:any) => { - form.resetFields(["stationCode"]); - let tljCode = form.getFieldValue("tljCode") - let gwdCode = form.getFieldValue("gwdCode") - let xmCode = form.getFieldValue("xmCode") - const params = { - tljCode, - gwdCode, - xmCode - } - setExtraDesc({...extraDesc,xmName:option.label}) - queryStationData(params).then(res => { - if(res && res.data){ - setStationList(res.data) - }else{ - setStationList([]) - } - const measureForm = localStorage.getItem('measureForm') - if (measureForm) { - form.setFieldsValue({ - ...JSON.parse(measureForm) - }); - } - }) - } - - - useEffect(()=>{ - if(systemState.orgInfo){ - const cloneOrgItem = systemState.orgInfo - if(cloneOrgItem.value){ - const org = JSON.parse(cloneOrgItem.value) - onOrgChange(org[0].value, org[0]) - onGwdChange(org[1].value, org[1]) - form.setFieldsValue({ - tljCode:org[0].value, - gwdCode: org[1].value, - xmCode: org[2].value - }); - queryStation(org[2].value, org[2]) - } - } - },[KTJOrgList, xmCodeValue, gwdCodeValue, systemState.orgInfo]) - - - useEffect(()=>{ - if(systemState.accountInfo){ - const cloneAccountItem = systemState.accountInfo - if(cloneAccountItem.value){ - form.setFieldsValue({ - operator:cloneAccountItem.value - }) - } - } - },[systemState.accountInfo]) - - - const onRailTypeChange = (value:string, option:any) => { - setExtraDesc({...extraDesc,railSizeName:option.label}) - } - - //数据来源change - const [dataSource, setDataSource] = useState('') - const onDataSourceChange = (value:string, option:any) => { - setExtraDesc({...extraDesc,dataSourceName:option.label}) - form.resetFields(["xbCode"]); - setDataSource(value) - } - - //车站 - const onSatioinChange = (value:string, option:any) => { - setExtraDesc({...extraDesc,stationName:option.label}) - } - - //股别change - const [unitType, setUnitType] = useState() - const onUnitTypeChange = (value:string) => { - RAIN_TYPES.map(item => { - if(item.code === value){ - setUnitType(item.type) - } - }) - } - - useEffect(() => { - const initData = { - operator: "klj_test", - direction: "左", - } - form.setFieldsValue(initData); - }, [userInfo.nickname, form]); - - return ( - <> - {contextHolder} -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {/* - - - - - - - - - ) : ( - - - - )} - - {dataSource === "XLDC" && -
- - - - - + - - - - -
- } - - - - - {unitType === 2 && - - - - } - -
-
- - - - - - -
-
-
- - ); -} diff --git a/src/pages/measure/components/MeasureConfig-old.tsx b/src/pages/measure/components/MeasureConfig-old.tsx new file mode 100644 index 0000000..b8a5939 --- /dev/null +++ b/src/pages/measure/components/MeasureConfig-old.tsx @@ -0,0 +1,632 @@ +/* eslint-disable array-callback-return */ +import { Button, Form, Input, message, Select, InputNumber } from "antd"; +import { useEffect, useState } from "react"; +import { useNavigate } from "react-router"; +import { saveMeasurement_new } from "../../../services/measure/analysis"; +import { useAppSelector } from "../../../utils/hooks"; +import { + getOrgListService, + dictionaryListService, + queryStationData +} from "../../../services/ktj/org"; +import { useAppDispatch } from "../../../utils/hooks"; +import { setOrgData } from "../../../store/ktj/orgState"; +import type { + OrgItem, + GwdDicItem, + KTJ_BASE_TYPE, + options, + dataSourceOptions, + unitTypesOptions, + unitType, + extraDescType +} from "../../../services/ktjTypes"; +import { RAIN_TYPES, XB_CODES, DATA_SOURCE } from "../../../constant/index"; +import "./MeasureAction.scss"; +export default function MeasureConfig() { + const { Option } = Select; + const navigate = useNavigate(); + const systemState = useAppSelector((store) => store.systemState); + const [messageApi, contextHolder] = message.useMessage(); + const dispatch = useAppDispatch(); + const measureState = useAppSelector((store) => store.measureState); + const [extraDesc, setExtraDesc] = useState() + const onFinish = (values: any) => { + let mtValue = values["meters"] + //百米小于100时, 补齐3位。 比如 1 :"001", 10: "010" + if (mtValue < 100) { + mtValue = String(mtValue).padStart(3, '0'); + } + const params = { + operator: values["operator"],//操作员 + name: values["name"],//测量名称 + location: values["location"],//位置 + direction: values["direction"],//方向 + tljCode: values["tljCode"],//铁路局 + gwdCode: values["gwdCode"],//铁路段 + xmCode: values["xmCode"],//铁路线 + lineClassify: values["lineClassify"],//线路分类 + dataType: values["dataType"],//采集方式 + dataSource: values["dataSource"],//数据来源 + railSize: values["railSize"],//轨型 + xbCode: values["xbCode"],//行别 + unitType: values["unitType"],//股别 + mileage: `${values['kilometre']}+${mtValue}`,//里程 + stationCode: values['stationCode'],//车站 + batch: values['batch'],//批次 + radius: values["radius"],//半径 + turnoutNum: values["turnoutNum"],//道岔号 + sleeperNum: values["sleeperNum"],//枕木号 + extraDesc:JSON.stringify(extraDesc), + alignPoints:[] + }; + + const orgItem = { + tljCode: values["tljCode"],//铁路局 + gwdCode: values["gwdCode"],//铁路段 + xmCode: values["xmCode"],//铁路线 + } + localStorage.setItem('orgInfo', JSON.stringify(orgItem)); + params.extraDesc = JSON.stringify(extraDesc) + let measureData = measureState.measureData; + if(measureData && measureData.length){ + params.alignPoints = measureData + } + localStorage.setItem('measureForm', JSON.stringify(params)) + saveMeasurement_new(params) + .then((res) => { + if (res.success) { + messageApi.error(res.data.info); + } else { + message.success("保存成功"); + navigate("../action"); + } + }) + .catch((e) => { + navigate("../action"); + }); + }; + let user = localStorage.getItem("user") || ""; + let userInfo = (user && JSON.parse(user)) || {}; + const [form] = Form.useForm(); + useEffect(() => { + queryKTJOrgList(); + queryDictionaryList(); + resetDataSource() + resetRailTypes() + }, []); + + useEffect(()=>{ + }, [measureState.measureData]) + + //给股别分类 + const [unitTypeList, setUnitTypeList] = useState([]) + const resetRailTypes = () => { + let zxOptions:unitTypesOptions = { + label:'直线', + options:[] + } + let qxOptions:unitTypesOptions = { + label:'曲线', + options:[] + } + let zxList:unitType[] = [] + let qxList:unitType[] = [] + RAIN_TYPES.map(item => { + if(item.type === 1){ + zxList.push({ + label: item.name, + value: item.code, + }) + }else{ + qxList.push({ + label: item.name, + value: item.code, + }) + } + }) + zxOptions.options = zxList + qxOptions.options = qxList + setUnitTypeList([zxOptions, qxOptions]) + } + + const [xbCodeOptions, setXbCodeOptions] = useState() + const resetDataSource = () => { + let options:dataSourceOptions[] = [] + DATA_SOURCE.map(item => { + let optionMap:any = { + label: item.name, + value: item.code, + options:[] + } + let childOptions:options[] = [] + item.child.map(ele => { + childOptions.push({ + label: ele.name, + value: ele.code + }) + optionMap.options = childOptions + }) + options.push(optionMap) + }) + setXbCodeOptions(options) + } + + //初始化科天健机构数据 + let [SJLY_List, setSJLYList] = useState([]); + let [WRPS_CJFS_List, setWRPSCJFSList] = useState([]); + let [WRPS_GGGX_List, setWRPSGGGXList] = useState([]); + let [XLFL_List, setXLFLList] = useState([]); + const queryDictionaryList = () => { + dictionaryListService().then((res) => { + if (res && res.data) { + const { WRPS_CJFS, WRPS_GGGX, XLFL } = res.data; + const SJLY:KTJ_BASE_TYPE[] = res.data.SJLY + if(SJLY && SJLY.length){ + let sjlylist = SJLY.filter(item => item.key === 'XLDC' || item.key === 'DCDC') + setSJLYList(sjlylist); + } + if(WRPS_CJFS && WRPS_CJFS.length){ + setWRPSCJFSList(WRPS_CJFS); + } + if(WRPS_GGGX && WRPS_GGGX.length){ + setWRPSGGGXList(WRPS_GGGX); + } + if(XLFL && XLFL.length){ + setXLFLList(XLFL); + } + } + }); + }; + + //获取机构数据 + const [KTJOrgList, setKTJOrgList] = useState([]); + const queryKTJOrgList = () => { + getOrgListService() + .then((res) => { + let list: options[] = []; + if (res && res.data) { + let resData: OrgItem[] = res.data; + setKTJOrgList(resData); + dispatch(setOrgData(resData)); + resData.map((item) => { + list.push({ + value: item.key, + label: item.value, + }); + }); + } + }) + .catch((e) => {}); + }; + + + //选择机构时change + const [gwdDicList, setGwdDicList] = useState([]); + const [gwdCodeValue, setGwdCodeValue] = useState(); + const [xmCodeValue, setXmCodeValue] = useState(); + const [gwdDicOptions, setGwdDicOptions] = useState([]); + const [railDicOptions, setRailDicOptions] = useState([]); + const [orgGwdDicList, setOrgGwdDicList] = useState([]) + + const onOrgChange = (value: string, option:any) => { + let list = KTJOrgList.filter((item) => item.key === value); + form.resetFields(["gwdCode", "xmCode"]); + if (list && list.length) { + let orgItem: OrgItem = list[0]; + setExtraDesc({...extraDesc,orgName:option.label}) + if (orgItem && orgItem.gwdDicList) { + let listOptoins: options[] = []; + setGwdDicList(orgItem.gwdDicList); + setOrgGwdDicList(orgItem.gwdDicList) + orgItem.gwdDicList.map((item) => { + listOptoins.push({ + value: item.key, + label: item.value, + }); + }); + setGwdDicOptions(listOptoins); + setGwdCodeValue(listOptoins[0].value); + } + } + }; + + const onGwdChange = (value: string, option:any) => { + let cloneGwdDicList = [...orgGwdDicList]; + form.resetFields(["xmCode"]); + let list = cloneGwdDicList.filter((item) => item.key === value); + if (list && list.length) { + let gwdDicItem: GwdDicItem = list[0]; + setExtraDesc({...extraDesc,gwdName:option.label}) + if (gwdDicItem && gwdDicItem.railDicList) { + let railOptions: options[] = []; + gwdDicItem.railDicList.map((item) => { + railOptions.push({ + value: item.key, + label: item.value, + }); + }); + if(railOptions && railOptions.length){ + setRailDicOptions(railOptions); + setXmCodeValue(railOptions[0].value); + } + } + } + }; + + //车站数据 + const [stationList, setStationList] = useState([]) + const queryStation = (value:string, option:any) => { + form.resetFields(["stationCode"]); + let tljCode = form.getFieldValue("tljCode") + let gwdCode = form.getFieldValue("gwdCode") + let xmCode = form.getFieldValue("xmCode") + const params = { + tljCode, + gwdCode, + xmCode + } + setExtraDesc({...extraDesc,xmName:option.label}) + queryStationData(params).then(res => { + if(res && res.data){ + setStationList(res.data) + }else{ + setStationList([]) + } + const measureForm = localStorage.getItem('measureForm') + if (measureForm) { + form.setFieldsValue({ + ...JSON.parse(measureForm) + }); + } + }) + } + + + useEffect(()=>{ + if(systemState.orgInfo){ + const cloneOrgItem = systemState.orgInfo + if(cloneOrgItem.value){ + const org = JSON.parse(cloneOrgItem.value) + onOrgChange(org[0].value, org[0]) + onGwdChange(org[1].value, org[1]) + form.setFieldsValue({ + tljCode:org[0].value, + gwdCode: org[1].value, + xmCode: org[2].value + }); + queryStation(org[2].value, org[2]) + } + } + },[KTJOrgList, xmCodeValue, gwdCodeValue, systemState.orgInfo]) + + + useEffect(()=>{ + if(systemState.accountInfo){ + const cloneAccountItem = systemState.accountInfo + if(cloneAccountItem.value){ + form.setFieldsValue({ + operator:cloneAccountItem.value + }) + } + } + },[systemState.accountInfo]) + + + const onRailTypeChange = (value:string, option:any) => { + setExtraDesc({...extraDesc,railSizeName:option.label}) + } + + //数据来源change + const [dataSource, setDataSource] = useState('') + const onDataSourceChange = (value:string, option:any) => { + setExtraDesc({...extraDesc,dataSourceName:option.label}) + form.resetFields(["xbCode"]); + setDataSource(value) + } + + //车站 + const onSatioinChange = (value:string, option:any) => { + setExtraDesc({...extraDesc,stationName:option.label}) + } + + //股别change + const [unitType, setUnitType] = useState() + const onUnitTypeChange = (value:string) => { + RAIN_TYPES.map(item => { + if(item.code === value){ + setUnitType(item.type) + } + }) + } + + useEffect(() => { + const initData = { + operator: "klj_test", + direction: "左", + } + form.setFieldsValue(initData); + }, [userInfo.nickname, form]); + + return ( + <> + {contextHolder} +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {/* + + + + + + + + + ) : ( + + + + )} + + {dataSource === "XLDC" && +
+ + + + + + + + + + +
+ } + + + + + {unitType === 2 && + + + + } + +
+
+ + + + + + +
+
+
+ + ); +} diff --git a/src/pages/measure/components/MeasureConfig.tsx b/src/pages/measure/components/MeasureConfig.tsx index 8a1acd4..8854c68 100644 --- a/src/pages/measure/components/MeasureConfig.tsx +++ b/src/pages/measure/components/MeasureConfig.tsx @@ -1,6 +1,6 @@ /* eslint-disable array-callback-return */ import { Button, Form, Input, message, Select, InputNumber, Cascader, Row, Col } from "antd"; -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import { useNavigate } from "react-router"; import { saveMeasurement_new } from "../../../services/measure/analysis"; import { useAppSelector } from "../../../utils/hooks"; @@ -9,8 +9,7 @@ import { dictionaryListService, queryStationData } from "../../../services/ktj/org"; -import { useAppDispatch } from "../../../utils/hooks"; -import { setOrgData } from "../../../store/ktj/orgState"; +import type { InputRef } from 'antd/es/input'; import type { OrgItem, GwdDicItem, @@ -41,12 +40,17 @@ export default function MeasureConfig() { const [xbCodeOptions, setXbCodeOptions] = useState() const [unitTypeList, setUnitTypeList] = useState([]) const [unitType, setUnitType] = useState() - + const inputRef = useRef(null); useEffect(()=>{ queryDictionaryList() resetRailTypes() resetDataSource() queryRailData() + setTimeout(() => { + if(inputRef.current){ + inputRef.current.focus() + } + }, 100) }, []) @@ -331,7 +335,7 @@ export default function MeasureConfig() { name="name" rules={[{ required: true, message: "请输入测量名称" }]} > - +