feat:表头颜色

This commit is contained in:
shixiaohua 2024-04-23 15:38:51 +08:00
parent 5325ecd535
commit a55e567899
3 changed files with 26 additions and 13 deletions

View File

@ -144,7 +144,7 @@ export const taskPriorityList: DictType[] = [
code: '1',
name: '不重要紧急',
order: 2,
color: 'blue'
color: '#fafafa'
}, {
id: 0,
code: '0',

View File

@ -57,7 +57,7 @@ export default function Layout({children}: { children: React.ReactNode }) {
<div>
<div className='firstRow' style={{display: 'flex'}}>
<div className='leftUp'>
<TreeTable search={leftUp}/>
<TreeTable search={leftUp} priority='3'/>
</div>
<div id='tenUp' className='up'>
@ -65,7 +65,7 @@ export default function Layout({children}: { children: React.ReactNode }) {
</div>
<div className='rightUp' >
<TreeTable search={rightUp}/>
<TreeTable search={rightUp} priority='2'/>
</div>
</div>
<div id='left' className='left'>
@ -73,14 +73,14 @@ export default function Layout({children}: { children: React.ReactNode }) {
</div>
<div className='secondRow' style={{display: 'flex'}}>
<div className='leftDown'>
<TreeTable search={leftDown}/>
<TreeTable search={leftDown} priority='1'/>
</div>
<div className='up'>
<span id='upDown'></span>
</div>
{/*<div style={{float:'left',width:'48%',height: '48vh',background:"gray"}}>{children}</div>*/}
<div className='rightDown'>
<TreeTable search={rightDown}/>
<TreeTable search={rightDown} priority='0'/>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
'use client'
import React, {useEffect, useState} from 'react';
import {Table} from 'antd';
import {ConfigProvider, Table} from 'antd';
import type {TableColumnsType, TableProps} from 'antd';
import {getTaskTreeResult, taskPriorityList, taskStateList, taskTreeResult} from "@/app/lib/task/project/data";
import {DataType, ResponseVO, ResultPage} from "@/app/lib/definitions";
@ -71,6 +71,7 @@ const rowSelection: TableRowSelection<DataType> = {
interface TableSearchType {
search?: any
priority:string
}
const TreeTable: React.FC<TableSearchType> = (props) => {
@ -112,15 +113,22 @@ const TreeTable: React.FC<TableSearchType> = (props) => {
}
})
}
console.log('taskPriorityList.find((item)=>item.code===props.priority)?.color',props.priority,taskPriorityList.find((item)=>item.code===props.search.priority)?.color)
useEffect(() => {
refreshDate();
}, [props.search]);
return (
<>
{/*<Space align="center" style={{ marginBottom: 16 }}>*/}
{/* CheckStrictly: <Switch checked={checkStrictly} onChange={setCheckStrictly} />*/}
{/*</Space>*/}
{/*<ColorPicker defaultValue="#1677ff" showText/>*/}
<ConfigProvider
theme={{
components: {
Table: {
headerBg:taskPriorityList.find((item)=>item.code===props.priority)?.color
/* 这里是你的组件 token */
},
},
}}
>
<Table
columns={columns}
// rowSelection={{ ...rowSelection, checkStrictly}}
@ -128,6 +136,11 @@ const TreeTable: React.FC<TableSearchType> = (props) => {
pagination={{ pageSize: 5 }}
scroll={{ y: 280 }}
/>
</ConfigProvider>
{/*<Space align="center" style={{ marginBottom: 16 }}>*/}
{/* CheckStrictly: <Switch checked={checkStrictly} onChange={setCheckStrictly} />*/}
{/*</Space>*/}
{/*<ColorPicker defaultValue="#1677ff" showText/>*/}
</>
);
};