feat:svg添加成功

This commit is contained in:
1708-huayu 2025-06-11 18:33:27 +08:00
parent ec3bb0cdef
commit bad15eb312
8 changed files with 126 additions and 93 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 KiB

File diff suppressed because one or more lines are too long

View File

@ -20,6 +20,7 @@ export default function RootLayout({
<head> <head>
<title></title> <title></title>
<link rel="icon" href="/favicon.ico"/> <link rel="icon" href="/favicon.ico"/>
<script src="/static/iconfont.js"></script>
</head> </head>
<body style={{margin: 0}}>{children}</body> <body style={{margin: 0}}>{children}</body>
</html> </html>

View File

@ -6,7 +6,14 @@
padding: 6rem; padding: 6rem;
min-height: 100vh; min-height: 100vh;
} }
.icon {
/* em 当前元素的 font-size 值,如果元素没有显式设置 font-size则继承父元素的 font-size。 控制与字体大小相关的属性*/
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
.description { .description {
display: inherit; display: inherit;
justify-content: inherit; justify-content: inherit;
@ -22,6 +29,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
/* 始终基于根字体,更稳定,实现全局尺寸控制(避免嵌套问题)*/
gap: 0.5rem; gap: 0.5rem;
} }

View File

@ -16,3 +16,6 @@ input[type='number']::-webkit-outer-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
margin: 0; margin: 0;
} }
{
font-size: 16px;
}

View File

@ -1,3 +1,17 @@
.ant-select-selection-overflow-item-suffix{ .ant-select-selection-overflow-item-suffix{
visibility: hidden; visibility: hidden;
} }
.container{
padding: 0 20px;
display: flex;
/* 决定主轴方向 */
flex-direction: row;
/* 交叉轴对齐方式,垂直居中 */
align-items: center;
/* 主轴对齐方式,水平居中(可选) */
justify-content: space-between;
/* 是否换行*/
flex-wrap: wrap;
/* 多行时的垂直对齐 */
align-content: space-between;
}

View File

@ -31,89 +31,92 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
expectStartTimeParseResult[0] && expectStartTimeParseResult[0].value ? dayjs(expectStartTimeParseResult[0].value.toString()) : undefined, expectStartTimeParseResult[0] && expectStartTimeParseResult[0].value ? dayjs(expectStartTimeParseResult[0].value.toString()) : undefined,
expectStartTimeParseResult[1] && expectStartTimeParseResult[1].value ? dayjs(expectStartTimeParseResult[1].value.toString()) : undefined expectStartTimeParseResult[1] && expectStartTimeParseResult[1].value ? dayjs(expectStartTimeParseResult[1].value.toString()) : undefined
]; ];
return <Space style={{marginTop: 0, "height": "42px", "alignContent": "center"}}> return <div className="container">
<DetailModelForm haveButton={true} open={false} operationId={OPERATION_BUTTON_TYPE.ADD} <Space style={{marginTop: 0, "height": "42px", "alignContent": "center"}}>
description='添加主线任务' reloadData={refreshData}/> <DetailModelForm haveButton={true} open={false} operationId={OPERATION_BUTTON_TYPE.ADD}
{ description='添加主线任务' reloadData={refreshData}/>
!usePathname().startsWith("/task/project") && {
<Button type="primary" onClick={() => { !usePathname().startsWith("/task/project") &&
replace("/task/project"); <Button type="primary" onClick={() => {
// setCurrentPath("/task/project") replace("/task/project");
}}></Button> // setCurrentPath("/task/project")
} }}></Button>
{ }
!usePathname().startsWith("/task/four") && {
<Button type="primary" onClick={() => { !usePathname().startsWith("/task/four") &&
replace("/task/four"); <Button type="primary" onClick={() => {
// setCurrentPath("/task/four"); replace("/task/four");
}}></Button> // setCurrentPath("/task/four");
} }}></Button>
{ }
!usePathname().startsWith("/task/calendar") && {
<Button type="primary" onClick={() => { !usePathname().startsWith("/task/calendar") &&
replace("/task/calendar"); <Button type="primary" onClick={() => {
// setCurrentPath("/task/project") replace("/task/calendar");
}}></Button> // setCurrentPath("/task/project")
} }}></Button>
{ }
/*日历需要状态*/ {
!usePathname().startsWith("/task/project") && <Fragment> /*日历需要状态*/
<span style={{whiteSpace: 'nowrap'}}>:</span> !usePathname().startsWith("/task/project") && <Fragment>
<Select <span style={{whiteSpace: 'nowrap'}}>:</span>
mode="multiple" <Select
allowClear mode="multiple"
style={{minWidth: '100px'}} allowClear
placeholder="任务状态" style={{minWidth: '100px'}}
defaultValue={data.taskState.split(",")} placeholder="任务状态"
onChange={(value) => { defaultValue={data.taskState.split(",")}
console.log('onChange') onChange={(value) => {
setTaskState(value.join(',')) console.log('onChange')
}} setTaskState(value.join(','))
options={taskStateList.map(item => { }}
return {label: item.name, value: item.code} options={taskStateList.map(item => {
})} return {label: item.name, value: item.code}
/> })}
</Fragment> />
} </Fragment>
{ }
/*四相线需要状态时间*/ {
usePathname().startsWith("/task/four") && <Fragment> /*四相线需要状态时间*/
<span style={{whiteSpace: 'nowrap'}}>:</span> usePathname().startsWith("/task/four") && <Fragment>
<RangePicker <span style={{whiteSpace: 'nowrap'}}>:</span>
placeholder={['开始时间', '结束时间']} <RangePicker
defaultValue={defaultExpectStartTime} placeholder={['开始时间', '结束时间']}
allowEmpty={[true, true]} defaultValue={defaultExpectStartTime}
onChange={(dates, dateStrings) => { allowEmpty={[true, true]}
console.log('onChange:', dates, dateStrings); onChange={(dates, dateStrings) => {
if (!dates) { console.log('onChange:', dates, dateStrings);
setExpectedStartTime('') if (!dates) {
return setExpectedStartTime('')
} return
let expectStartTimeList = []; }
if (dates[0]) { let expectStartTimeList = [];
expectStartTimeList.push({ if (dates[0]) {
'name': "expectedStartTime", expectStartTimeList.push({
'value': dates[0], 'name': "expectedStartTime",
'operateType': ">=" 'value': dates[0],
}); 'operateType': ">="
} else { });
expectStartTimeList.push(undefined) } else {
} expectStartTimeList.push(undefined)
if (dates[1]) { }
expectStartTimeList.push({ if (dates[1]) {
'name': "expectedStartTime", expectStartTimeList.push({
'value': dates[1].add(1, 'day'), 'name': "expectedStartTime",
'operateType': "<" 'value': dates[1].add(1, 'day'),
}) 'operateType': "<"
} else { })
expectStartTimeList.push(undefined) } else {
} expectStartTimeList.push(undefined)
setExpectedStartTime(JSON.stringify(expectStartTimeList)) }
}} setExpectedStartTime(JSON.stringify(expectStartTimeList))
/> }}
</Fragment> />
} </Fragment>
}
</Space>
</Space> <svg style={{height: "32px", width: "32px", alignItems: "center"}} className="icon" aria-hidden="true">
<use xlinkHref="#icon-user__easyico"></use>
</svg>
</div>
} }

View File

@ -6,7 +6,7 @@ import {
import type {ActionType, FormInstance, ProColumns, ProFormInstance} from '@ant-design/pro-components'; import type {ActionType, FormInstance, ProColumns, ProFormInstance} from '@ant-design/pro-components';
import {ProTable, TableDropdown} from '@ant-design/pro-components'; import {ProTable, TableDropdown} from '@ant-design/pro-components';
import {Button, DatePicker, Dropdown, Space, Switch, Tag, Tooltip} from 'antd'; import {Button, DatePicker, Dropdown, Space, Switch, Tag, Tooltip} from 'antd';
import React, {useContext, useEffect, useRef} from 'react'; import React, {Fragment, useContext, useEffect, useRef} from 'react';
import {DataType} from "@/lib/definitions"; import {DataType} from "@/lib/definitions";
import { import {
getTaskTreeResult, getTaskTreeResult,
@ -21,6 +21,7 @@ import '@/ui/task/project/TreeTablePro.modules.css'
import {useSearchParams} from "next/navigation"; import {useSearchParams} from "next/navigation";
const TreeTablePro: React.FC = () => { const TreeTablePro: React.FC = () => {
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const formRef = useRef<ProFormInstance>(); const formRef = useRef<ProFormInstance>();
@ -33,12 +34,6 @@ const TreeTablePro: React.FC = () => {
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
console.log("TreeTablePro",useSearchParams().get('pid')) console.log("TreeTablePro",useSearchParams().get('pid'))
const columns: ProColumns<DataType>[] = [ const columns: ProColumns<DataType>[] = [
{
key:'code',
title: '任务编码',
dataIndex: 'code',
width: '10%',
},
{ {
key: 'name', key: 'name',
title: '任务名称', title: '任务名称',
@ -55,6 +50,14 @@ const TreeTablePro: React.FC = () => {
}, },
], ],
}, },
render:(_, record)=>{
return <Fragment>
<svg className="icon" aria-hidden="true">
<use xlinkHref="#icon-tuandui"></use>
</svg>
{record.name}
</Fragment>
}
}, },
{ {
key: 'description', key: 'description',