|
|
@ -8,7 +8,7 @@ import { OrgItem } from '../../services/ktjTypes'; |
|
|
|
import {bleItem, child, GwdItem, orgCascaderType, systemItem} from './types'; |
|
|
|
import { sysSet } from '../../services/user/system'; |
|
|
|
import { useAppDispatch, useAppSelector } from "../../utils/hooks"; |
|
|
|
import { updateSystemAccountState, updateSystemAllState, updateSystemOrgState } from '../../store/system/systemSlice'; |
|
|
|
import { updateSystemAccountState, updateSystemOrgState } from '../../store/system/systemSlice'; |
|
|
|
import {createWebSocket, sharedWsUrl} from "../../services/socket"; |
|
|
|
import {start, stop, disconnect, connect} from "../../services/ble/ble"; |
|
|
|
|
|
|
@ -65,8 +65,7 @@ export default function Setting(){ |
|
|
|
value: cloneOrgItem.value |
|
|
|
} |
|
|
|
setOrgInfo(orgItem) |
|
|
|
let systemInfo = systemState.systemInfo |
|
|
|
setSystemList(systemInfo) |
|
|
|
querySettingData() |
|
|
|
} |
|
|
|
}, [systemState.orgInfo]) |
|
|
|
|
|
|
@ -81,6 +80,7 @@ export default function Setting(){ |
|
|
|
value: cloneAccountItem.value |
|
|
|
} |
|
|
|
setAccountInfo(accountInfo) |
|
|
|
querySettingData() |
|
|
|
} |
|
|
|
}, [systemState.accountInfo]) |
|
|
|
|
|
|
@ -129,6 +129,30 @@ export default function Setting(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
let newAccountInfo = { |
|
|
|
name:'', |
|
|
|
value: '' |
|
|
|
} |
|
|
|
function onSaveAccount(){ |
|
|
|
const accountParams = { |
|
|
|
code:"UPLOAD_USERNAME", |
|
|
|
name:accountInfo.name, |
|
|
|
value:newAccountInfo.value, |
|
|
|
id:accountInfo.id |
|
|
|
} |
|
|
|
sysSet(accountParams, "PUT").then(res=>{ |
|
|
|
if(res.status === 0){ |
|
|
|
dispatch(updateSystemAccountState(accountParams)) |
|
|
|
message.success("修改成功") |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
function onAccountChange(accountValue:string){ |
|
|
|
newAccountInfo.name = accountInfo.name || ''; |
|
|
|
newAccountInfo.value = accountValue; |
|
|
|
} |
|
|
|
|
|
|
|
function convertToCascaderData(data:OrgItem[]) { |
|
|
|
return data.map(item => { |
|
|
|
const newItem:orgCascaderType = { |
|
|
@ -257,17 +281,8 @@ export default function Setting(){ |
|
|
|
value |
|
|
|
} |
|
|
|
sysSet(params, "PUT").then(res=>{ |
|
|
|
if(res.status === 0){ |
|
|
|
const list:systemItem[] = JSON.parse(JSON.stringify(systemList)) |
|
|
|
list.forEach(el => { |
|
|
|
if(item.id === el.id){ |
|
|
|
el.value = value |
|
|
|
} |
|
|
|
}) |
|
|
|
dispatch(updateSystemAllState(list)) |
|
|
|
message.success("修改成功") |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const form = () =>{ |
|
|
@ -301,14 +316,6 @@ export default function Setting(){ |
|
|
|
<h1 className='text-[20px]'>系统配置</h1> |
|
|
|
<section className='p-[20px]'> |
|
|
|
{form()} |
|
|
|
{/*<div>*/} |
|
|
|
{/* <span>铁路局:</span>*/} |
|
|
|
{/* <Cascader className='w-[300px]' key={orgValues.length} defaultValue={orgValues} options={KTJOrgList} onChange={onOrgChange} placeholder="请选择局段线" /></div>*/} |
|
|
|
{/*<div className='mt-[10px]'>*/} |
|
|
|
{/* <span> {accountInfo.name}:</span>*/} |
|
|
|
{/* <Input key={accountInfo.value} defaultValue={accountInfo.value} onChange={(e)=>{onAccountChange(e.target.value)}} className='w-[300px]'></Input>*/} |
|
|
|
{/* <Button className='ml-[10px]' size='small' type="primary" onClick={onSaveAccount}>保存</Button>*/} |
|
|
|
{/*</div>*/} |
|
|
|
</section> |
|
|
|
<h1 className='text-[20px]'>设备配置</h1> |
|
|
|
{connectionStatus()} |
|
|
|