feat: 1.修改提示词模板的不用角色的操作权限。
2. 对接数据看板的数据。 3. 添加入口模块管理的页面。
This commit is contained in:
@@ -140,28 +140,26 @@ export function BasicInfo({ onChange, initialData, evaluationPointGroups = [], r
|
||||
|
||||
// 处理条款号输入框失去焦点
|
||||
const handleLawArticlesBlur = () => {
|
||||
if (!lawArticlesText) return;
|
||||
|
||||
// 将输入的文本转换为数组
|
||||
const articles = lawArticlesText
|
||||
.split(',')
|
||||
.map(article => article.trim())
|
||||
.filter(article => article !== '');
|
||||
|
||||
|
||||
// 创建一个新的引用法律对象,保留现有字段
|
||||
const referencesLaws = {
|
||||
...(formData.references_laws || {}),
|
||||
articles: articles.length > 0 ? articles : []
|
||||
articles: articles // ✅ 清空时会是空数组
|
||||
};
|
||||
|
||||
|
||||
// 更新表单数据
|
||||
const newData = {
|
||||
...formData,
|
||||
references_laws: referencesLaws
|
||||
};
|
||||
|
||||
|
||||
setFormData(newData);
|
||||
|
||||
|
||||
if (onChange) {
|
||||
onChange(newData);
|
||||
}
|
||||
@@ -171,6 +169,9 @@ export function BasicInfo({ onChange, initialData, evaluationPointGroups = [], r
|
||||
useEffect(() => {
|
||||
if (formData.references_laws?.articles && formData.references_laws.articles.length > 0) {
|
||||
setLawArticlesText(formData.references_laws.articles.join(','));
|
||||
} else {
|
||||
// ✅ 当 articles 为空时,也清空输入框
|
||||
setLawArticlesText('');
|
||||
}
|
||||
}, [formData.references_laws?.articles]);
|
||||
|
||||
|
||||
@@ -31,20 +31,23 @@ export function Table<T extends Record<string, any>>({
|
||||
className = '',
|
||||
onRow,
|
||||
}: TableProps<T>) {
|
||||
// 防御性检查:确保 dataSource 始终是数组
|
||||
const safeDataSource = dataSource || [];
|
||||
|
||||
const getRowKey = (record: T, index: number): string => {
|
||||
if (typeof rowKey === 'function') {
|
||||
return rowKey(record);
|
||||
}
|
||||
return String(record[rowKey]);
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div className={`ant-table-wrapper ${className} ${loading ? 'ant-table-loading' : ''}`}>
|
||||
<table className={`ant-table ${bordered ? 'ant-table-bordered' : ''}`}>
|
||||
<thead>
|
||||
<tr>
|
||||
{columns.map((column, index) => (
|
||||
<th
|
||||
<th
|
||||
key={column.key || column.dataIndex?.toString() || index}
|
||||
className={column.className}
|
||||
style={{
|
||||
@@ -58,8 +61,8 @@ export function Table<T extends Record<string, any>>({
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{dataSource.length > 0 ? (
|
||||
dataSource.map((record, index) => (
|
||||
{safeDataSource.length > 0 ? (
|
||||
safeDataSource.map((record, index) => (
|
||||
<tr
|
||||
key={getRowKey(record, index)}
|
||||
{...(onRow ? onRow(record, index) : {})}
|
||||
|
||||
Reference in New Issue
Block a user