Commit 29c41829 authored by 涂伟's avatar 涂伟

fix: '1.新建表类型隐藏事件表;2.新建表字段校验内置字段逻辑优化;3.新建表校验提示样式优化'

parent 863630c9
......@@ -40,7 +40,7 @@ const editor = props => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
obj.tableName = obj.tableType.substr(0, obj.tableType.length - 1) + '_' + obj.tableName;
obj.tableName = `${obj.tableType.substr(0, obj.tableType.length - 1)}_${obj.tableName}`;
createTable({
...obj,
})
......@@ -56,8 +56,8 @@ const editor = props => {
setChartName(res.data.tableInfo.Name);
loadTableFields({ tableName: res.data.tableInfo.Name }).then(response => {
if (response.data.root.length) {
let arr = [],
newArr = [];
let arr = [];
let newArr = [];
response.data.root.map(item => {
newArr.push(item.fieldName);
if (item.isCheck) {
......@@ -185,7 +185,7 @@ const editor = props => {
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
forceRender
getContainer={false}
>
<Form form={form} {...layout}>
......
......@@ -62,6 +62,7 @@ const EditableCell = ({
width,
dataSource,
tableDataCount,
defaultData,
...restProps
}) => {
const [editing, setEditing] = useState(false);
......@@ -218,9 +219,13 @@ const EditableCell = ({
},
{
validator: (rule, value) => {
let list = JSON.parse(JSON.stringify(dataSource));
// 合并内置字段
if (
value &&
dataSource.some((item, i) => item.Name === value && item.keyIndex !== record.keyIndex)
[...defaultData, ...list].some(
(item, i) => item.Name === value && item.keyIndex !== record.keyIndex,
)
) {
return Promise.reject(new Error('字段名称重复,请重新输入'));
}
......@@ -643,6 +648,7 @@ const TableView = props => {
align: col.align,
dataSource,
tableDataCount,
defaultData,
handleSave,
}),
};
......
......@@ -39,7 +39,7 @@
// width: 180px;
padding: 0 5px;
background-color: #ff4d4f;
top: -50px;
top: 40px;
left: 50%;
transform: translateX(-50%);
border-radius: 5px;
......
......@@ -96,8 +96,10 @@ const TableManager = props => {
GetDefaultTableFields().then(res => {
if (res.code === 0) {
let list = [];
setDefaultFieldsList(res.data);
res.data.forEach(item => {
// 过滤掉事件表
let resList = res.data.filter(item => item.value !== '事件表');
setDefaultFieldsList(resList);
resList.forEach(item => {
list.push(item.value);
});
setDefaultFields(list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment