|
|
@ -1,5 +1,5 @@ |
|
|
|
import { useState, useEffect, useRef } from 'react'; |
|
|
|
import { Button, Cascader, Input, message } from 'antd'; |
|
|
|
import { useState, useEffect } from 'react'; |
|
|
|
import { Button, Cascader, Input, message, Form } from 'antd'; |
|
|
|
import { |
|
|
|
LoadingOutlined, |
|
|
|
} from '@ant-design/icons'; |
|
|
@ -127,32 +127,6 @@ export default function Setting(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
let newAccountInfo = useRef({ |
|
|
|
name:'', |
|
|
|
value:'' |
|
|
|
}) |
|
|
|
function onSaveAccount(){ |
|
|
|
console.log('newAccountInfo---', newAccountInfo) |
|
|
|
const accountParams = { |
|
|
|
code:"UPLOAD_USERNAME", |
|
|
|
name:accountInfo.name, |
|
|
|
value:newAccountInfo.current.value, |
|
|
|
id:accountInfo.id |
|
|
|
} |
|
|
|
sysSet(accountParams, "PUT").then(res=>{ |
|
|
|
if(res.status === 0){ |
|
|
|
dispatch(updateSystemAccountState(accountParams)) |
|
|
|
message.success("修改成功") |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
function onAccountChange(accountValue:string){ |
|
|
|
newAccountInfo.current.name = accountInfo.name || ''; |
|
|
|
newAccountInfo.current.value = accountValue; |
|
|
|
console.log('newAccountInfo--22-', newAccountInfo) |
|
|
|
} |
|
|
|
|
|
|
|
function convertToCascaderData(data:OrgItem[]) { |
|
|
|
return data.map(item => { |
|
|
|
const newItem:orgCascaderType = { |
|
|
@ -275,20 +249,55 @@ export default function Setting(){ |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const saveSet = (item:systemItem) => { |
|
|
|
const params = { |
|
|
|
id:item.id, |
|
|
|
value:item.value |
|
|
|
} |
|
|
|
sysSet(params, "PUT").then(res=>{ |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const form = () =>{ |
|
|
|
return <Form |
|
|
|
name="basic" |
|
|
|
labelCol={{ span: 3, offset: 1 }} |
|
|
|
wrapperCol={{ span: 16 }} |
|
|
|
style={{ maxWidth: 600 }} |
|
|
|
autoComplete="off" |
|
|
|
> |
|
|
|
{ |
|
|
|
systemList.map((item, index) => { |
|
|
|
return <Form.Item |
|
|
|
key={index} |
|
|
|
label={item.name} |
|
|
|
name={item.code} |
|
|
|
> |
|
|
|
{item.code === 'ORG' ? |
|
|
|
<Cascader className='w-[300px]' key={orgValues.length} defaultValue={orgValues} options={KTJOrgList} onChange={onOrgChange} placeholder="请选择局段线" /> |
|
|
|
: <Input defaultValue={item.value} onBlur={() => saveSet(item)}/>} |
|
|
|
</Form.Item> |
|
|
|
}) |
|
|
|
} |
|
|
|
</Form> |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
return <><div className={'pr-2.5 pl-2.5 w-full h-full'}> |
|
|
|
<div className={'h-full w-full bg-white p-10 rounded-2xl'}> |
|
|
|
<h1 className='text-[20px]'>系统配置</h1> |
|
|
|
<section className='p-[20px]'> |
|
|
|
<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> |
|
|
|
{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()} |
|
|
|