Browse Source

测量记录

master
LiLongLong 2 months ago
parent
commit
28ac4f980e
  1. 4
      .env
  2. 2
      package.json
  3. 2
      public/index.html
  4. 2
      public/manifest.json
  5. 4
      src/pages/measure/components/MeasureAction.tsx
  6. 5
      src/pages/measure/components/MeasureDetail.tsx
  7. 14
      src/pages/system/Setting.tsx
  8. 1
      src/services/measure/type.ts
  9. 12
      src/utils/index.ts

4
.env

@ -1,2 +1,2 @@
REACT_APP_WS_URL=192.168.1.132:8080/ws
# REACT_APP_WS_URL=127.1.1.0:8080/ws
# REACT_APP_WS_URL=192.168.1.132:8080/ws
REACT_APP_WS_URL=127.1.1.0:8080/ws

2
package.json

@ -2,7 +2,7 @@
"name": "outline", "name": "outline",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"proxy": "http://192.168.1.132:8080",
"proxy": "http://127.0.0.1:8080",
"dependencies": { "dependencies": {
"@ant-design/icons": "^6.0.0", "@ant-design/icons": "^6.0.0",
"@babel/core": "^7.16.0", "@babel/core": "^7.16.0",

2
public/index.html

@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>React App</title>
<title>廓形仪</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>

2
public/manifest.json

@ -1,5 +1,5 @@
{ {
"short_name": "React App",
"short_name": "廓形仪",
"name": "Create React App Sample", "name": "Create React App Sample",
"icons": [ "icons": [
{ {

4
src/pages/measure/components/MeasureAction.tsx

@ -194,10 +194,10 @@ export default function MeasureAction() {
message.error("请先连接设备"); message.error("请先连接设备");
return; return;
} }
if(deviceInfo.power < 10){
if(deviceInfo.power < 20){
confirm({ confirm({
title: '电量提示', title: '电量提示',
content: '电量低于10%,测量过程会有丢包风险,请确认是否继续测量!',
content: '设备电量过低,请及时充电!',
okText:'确认', okText:'确认',
cancelText:'取消', cancelText:'取消',
onOk() { onOk() {

5
src/pages/measure/components/MeasureDetail.tsx

@ -15,7 +15,7 @@ import {
import { getBaseRecordPointSetByCode } from "../../../services/track/trackShape" import { getBaseRecordPointSetByCode } from "../../../services/track/trackShape"
import { extraDescType, KTJ_BASE_TYPE } from '../../../services/ktjTypes'; import { extraDescType, KTJ_BASE_TYPE } from '../../../services/ktjTypes';
import { GX_CODE } from '../../../constant'; import { GX_CODE } from '../../../constant';
import { exportFile } from '../../../utils';
import { exportFile, padNumber } from '../../../utils';
export default function MeasureDetail() { export default function MeasureDetail() {
useEffect(()=>{ useEffect(()=>{
queryDictionaryList() queryDictionaryList()
@ -68,6 +68,9 @@ export default function MeasureDetail() {
{ {
title: '当天测量序号', title: '当天测量序号',
dataIndex: 'todayNumber', dataIndex: 'todayNumber',
render: (_, record) => (
padNumber(record.todayNumber, 4)
)
}, },
{ {
title: '创建者', title: '创建者',

14
src/pages/system/Setting.tsx

@ -34,22 +34,22 @@ export default function Setting(){
const [bleList, setBleList] = useState<bleItem[]>([]) const [bleList, setBleList] = useState<bleItem[]>([])
const dormancyList = [{ const dormancyList = [{
label: '1分钟', label: '1分钟',
value: '1',
value: 1,
},{ },{
label: '2分钟', label: '2分钟',
value: '2',
value: 2,
},{ },{
label: '5分钟', label: '5分钟',
value: '5',
value: 5,
},{ },{
label: '10分钟', label: '10分钟',
value: '10',
value: 10,
},{ },{
label: '20分钟', label: '20分钟',
value: '20',
value: 20,
},{ },{
label: '30分钟', label: '30分钟',
value: '30',
value: 30,
}] }]
const [standbyMinutes, setStandbyMinutes] = useState(10) const [standbyMinutes, setStandbyMinutes] = useState(10)
@ -374,7 +374,7 @@ export default function Setting(){
options={dormancyList} options={dormancyList}
disabled={deviceInfo.connectedType !== 'BLE_CHANNEL'} disabled={deviceInfo.connectedType !== 'BLE_CHANNEL'}
/> />
<Button type="primary" className="ml-2" onClick={onSaveStandbyMinutes} disabled={deviceInfo.connectedType !== 'BLE_CHANNEL'}></Button>
<Button type="primary" className="ml-2" onClick={onSaveStandbyMinutes} ></Button>
</div> </div>
</div> </div>

1
src/services/measure/type.ts

@ -17,6 +17,7 @@ export type DetailTable = {
dataSource:string; dataSource:string;
extraDesc:string; extraDesc:string;
railSize:string; railSize:string;
todayNumber: number
} }
export type MeasureRecord = { export type MeasureRecord = {

12
src/utils/index.ts

@ -99,4 +99,14 @@ export function exportFile(response: ArrayBuffer, fileName: string){
a.click(); a.click();
// 释放 URL 对象 // 释放 URL 对象
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
}
}
export function padNumber(num: number, length: number) {
// 将数字转换为字符串
let str = num.toString();
// 当字符串长度小于指定长度时,在前面补0
while (str.length < length) {
str = '0' + str;
}
return str;
}
Loading…
Cancel
Save