样式更改

This commit is contained in:
lyp 2025-03-14 18:09:36 +08:00
parent 4339e89f37
commit ea6f9471b8
3 changed files with 129 additions and 24 deletions

View File

@ -67,6 +67,7 @@ type propsInfo = {
closeModal?: any
};
export default function BelongPeople(props: propsInfo) {
// const [propsShow,setPropsShow] = useState(props.belongPeopleInfo.authorId?true)
// const nav = useNavigate();
// const pathParams = useParams();
const [messageApi, contextHolder] = message.useMessage();
@ -127,15 +128,43 @@ export default function BelongPeople(props: propsInfo) {
selectedRowKeys,
onChange: (selectedRowKeys: React.Key[], selectedRows: typeof tableBelongData[0][]) => {
setSelectedRowKeys(selectedRowKeys);
if (selectedRows.length > 0) {
setauthorName(selectedRows[0].name);
setauthorIdCardType(selectedRows[0].idCardType);
setauthorIdCard(selectedRows[0].idCardNo);
setauthorType(selectedRows[0].type);
setauthorProvinceCity(selectedRows[0].provinceCity);
setauthorCrcAccount(selectedRows[0].isCrcAccount);
setAuthorId(selectedRows[0].projOwnerId);
// if (selectedRows.length > 0) {
// setauthorName(selectedRows[0].name);
// setauthorIdCardType(selectedRows[0].idCardType);
// setauthorIdCard(selectedRows[0].idCardNo);
// setauthorType(selectedRows[0].type);
// setauthorProvinceCity(selectedRows[0].provinceCity);
// setauthorCrcAccount(selectedRows[0].isCrcAccount);
// setAuthorId(selectedRows[0].projOwnerId);
// }
const isClearingSelection = selectedRowKeys.length === 0;
if (isClearingSelection) {
setauthorName('');
setauthorIdCardType('');
setauthorIdCard('');
setauthorType('');
// setauthorNameEn('');
setauthorProvinceCity('');
setauthorCrcAccount(0);
// setauthorCrcAccountPassword('');
// setauthorCrcAccountUsername('');
setAuthorId('');
} else {
// 正常选中时,更新相关状态
setSelectedRowKeys(selectedRowKeys);
const firstSelectedRow = selectedRows[0];
setauthorName(firstSelectedRow.name);
setauthorIdCardType(firstSelectedRow.idCardType);
setauthorIdCard(firstSelectedRow.idCardNo);
setauthorType(firstSelectedRow.type);
// setauthorNameEn(firstSelectedRow.nameEn);
setauthorProvinceCity(firstSelectedRow.provinceCity);
setauthorCrcAccount(firstSelectedRow.isCrcAccount);
// setauthorCrcAccountPassword(firstSelectedRow.crcAccountPassword);
// setauthorCrcAccountUsername(firstSelectedRow.crcAccountUsername);
setAuthorId(firstSelectedRow.projOwnerId);
}
},
};
// 单行选择触发单选
@ -483,20 +512,44 @@ export default function BelongPeople(props: propsInfo) {
</div>
<div className='showInfo' style={{ display: props.isShow ? 'block' : 'none' }} >
{authorName ? (<>
<div style={{ display: 'flex' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ marginRight: ' 10px' }}>:</div>
<div style={{ display: authorName ? 'none' : 'block' }}></div>
<div style={{ display: authorName ? 'block' : 'none' }}>
{authorName}/{authorType == 'PERSONAL' ? '自然人' : '企业-组织'}/{authorIdCardType == 'ID_CARD' ? '身份证' : '营业执照'}/{authorIdCard}
</div>
<Button style={{ display: authorName ? 'block' : 'none', height: 30, marginLeft: 10 }} onClick={() => {
// lyp
setauthorName('');
setauthorIdCardType('');
setauthorIdCard('');
setauthorType('');
setauthorProvinceCity('');
setAuthorId('');
setSelectedRowKeys([]);
}}></Button>
</div>
</>) : (<>
<div style={{ display: 'flex' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ marginRight: ' 10px' }}>:</div>
<div style={{ display: props.belongPeopleInfo.authorName ? 'none' : 'block' }}></div>
<div style={{ display: props.belongPeopleInfo.authorName ? 'block' : 'none' }}>
{props.belongPeopleInfo.authorName}/{props.belongPeopleInfo.authorType == 'PERSONAL' ? '自然人' : '企业-组织'}/{props.belongPeopleInfo.authorIdCardType == 'ID_CARD' ? '身份证' : '营业执照'}/{props.belongPeopleInfo.authorIdCard}
</div>
<Button style={{ display: props.belongPeopleInfo.authorName ? 'block' : 'none', height: 30, marginLeft: 10 }} onClick={() => {
// lyp
props.setBelongPeopleInfo({
authorName: '',
authorType: '',
authorIdCardType: '',
authorIdCard: '',
authorCrcAccount: '',
authorId: '',
authorProvinceCity: ''
})
}}></Button>
</div>
</>)}
@ -527,10 +580,18 @@ export default function BelongPeople(props: propsInfo) {
// 阻止默认的行点击事件,以避免选中行时触发其他操作
event.stopPropagation();
// 更新选中的行
belongRowSelection.onChange([record.projOwnerId], [record]);
// belongRowSelection.onChange([record.projOwnerId], [record]);
const isSelected = belongRowSelection.selectedRowKeys.includes(record.projOwnerId);
if (isSelected) {
// 如果已经选中,则清空选中状态
belongRowSelection.onChange([], []);
} else {
// 如果未选中,则更新选中的行
belongRowSelection.onChange([record.projOwnerId], [record]);
}
}
},
style: { cursor: 'pointer' }
style: { cursor: 'pointer' }
};
}}
>
@ -813,24 +874,31 @@ export default function BelongPeople(props: propsInfo) {
<div style={{ display: props.isShow ? 'block' : 'none' }}>
<div className="belongPeopleModal-btn" style={{ display: 'flex', justifyContent: 'flex-end' }} >
<Button onClick={() => {
props.closeModal()
}}></Button>
<Button style={{
marginLeft: 20
}} type="primary"
onClick={() => {
props.setBelongPeopleInfo({
authorName,
authorType,
authorIdCardType,
authorIdCard,
if (props.belongPeopleInfo.authorId && !authorId) {
props.closeModal()
return
} else {
props.setBelongPeopleInfo({
authorName,
authorType,
authorIdCardType,
authorIdCard,
authorCrcAccount,
authorId,
authorProvinceCity
})
props.setValue(authorName)
props.closeModal()
}
authorCrcAccount,
authorId,
authorProvinceCity
})
props.setValue(authorName)
props.closeModal()
}}
></Button>
</div>

View File

@ -638,6 +638,7 @@ export default function ProjNew() {
</Form.Item>
<div style={{
display:belongPeopleInfo.authorId? 'none' : 'unset',
position: 'absolute', right: 20,
// fontSize: 16,
color: " #1F79FF", cursor: 'pointer',
@ -647,6 +648,28 @@ export default function ProjNew() {
}} onClick={() => {
setBelongModal(true)
}}></div>
<div style={{
display:belongPeopleInfo.authorId? 'unset' : 'none',
position: 'absolute', right: 0,
// fontSize: 16,
color: " #1F79FF", cursor: 'pointer',
// background:'pink',
width: 50,
textAlign: 'center',
}} onClick={() => {
setValue('')
setBelongPeopleInfo({
authorName: '',
authorType: '',
authorIdCardType: '',
authorIdCard: '',
authorCrcAccount: '',
authorId: '',
authorProvinceCity: ''
})
}}></div>
</div>
<div className='formItemOne' style={{ position: 'relative' }}>
<div className='formItem-title '>

View File

@ -770,12 +770,26 @@ export default function ProjEditStep2(props: any) {
/>
</div> */}
</div>
<div className='showInfo'>
<div className='showInfo' style={{alignItems:'center'}}>
<div style={{ marginRight: '22px' }}>:</div>
<div style={{ display: authorName == '' ? 'block' : 'none' }}></div>
<div style={{ display: authorName == '' ? 'none' : 'block' }}>
{authorName}/{authorType == 'PERSONAL' ? '自然人' : '企业-组织'}/{authorIdCardType == 'ID_CARD' ? '身份证' : '营业执照'}/{authorIdCard}
</div>
<Button style={{ display: authorName == '' ? 'none' : 'block',height:30,marginLeft:10 }} onClick={()=>{
// lyp
setauthorName('');
setauthorIdCardType('');
setauthorIdCard('');
setauthorType('');
setauthorNameEn('');
setauthorProvinceCity('');
setauthorCrcAccount(0);
setauthorCrcAccountPassword('');
setauthorCrcAccountUsername('');
setAuthorId('');
setSelectedRowKeys([]);
}}></Button>
</div>
<div className='belongPeople-bot'>
{/* 表格 */}