Browse Source

fix:系统配置项改为循环获取

feat_upload_server_url_0416
guoapeng 4 months ago
parent
commit
24aa350674
  1. 53
      src/pages/system/Setting.tsx

53
src/pages/system/Setting.tsx

@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
import { Button, Cascader, Input, message } from 'antd';
import { Button, Cascader, Input, message, Form } from 'antd';
import {
LoadingOutlined,
} from '@ant-design/icons';
@ -273,20 +273,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()}

Loading…
Cancel
Save