amis-saas-7476 table2字段调整

Change-Id: I20cd6c63447a08785ae5de1d3477033a0a98871d
This commit is contained in:
wanglinfang 2022-10-19 15:37:46 +08:00
parent e6e06534a3
commit 25d808d9b2
4 changed files with 35 additions and 36 deletions

View File

@ -121,8 +121,8 @@ import './plugin/Steps';
import './plugin/Sparkline';
import './plugin/Submit';
import './plugin/Table';
import './plugin/Table-v2';
import './plugin/TableCell-v2';
import './plugin/Table2';
import './plugin/TableCell2';
import './plugin/Tabs';
import './plugin/Tasks';
import './plugin/Time';

View File

@ -527,7 +527,7 @@ export class CRUDPlugin extends BasePlugin {
return;
}
// 可能会出错但是cards table-v2 list 配置面板结构统一,因此
// 可能会出错但是cards table2 list 配置面板结构统一,因此
(context.data as any).tabs.forEach((tab: any) => {
if (tab.title === '属性') {
tab.body[0].body.forEach((collapse: any) => {
@ -707,7 +707,7 @@ export class CRUDPlugin extends BasePlugin {
);
if (appendCols?.length) {
appendCols.forEach((col: any) => {
if (existColsName.includes(col.key)) {
if (existColsName.includes(col.name)) {
return;
}
@ -760,7 +760,6 @@ export class CRUDPlugin extends BasePlugin {
// });
// });
// }
return columns;
}
@ -1383,14 +1382,14 @@ export class CRUDPlugin extends BasePlugin {
columns: [
{
title: 'A',
key: 'a'
name: 'a'
},
{
title: 'B',
key: 'b'
name: 'b'
},
{
key: 'operation',
name: 'operation',
title: '操作',
buttons: [
{
@ -1534,7 +1533,7 @@ export class TableCRUDPlugin extends CRUDPlugin {
mode: 'table2',
columns: [
{
key: 'id',
name: 'id',
title: 'ID',
type: 'container',
body: [
@ -1544,7 +1543,7 @@ export class TableCRUDPlugin extends CRUDPlugin {
]
},
{
key: 'engine',
name: 'engine',
title: '示例',
type: 'container',
body: [

View File

@ -25,19 +25,19 @@ import {getEventControlConfig} from '../renderer/event-control/helper';
import {SchemaObject} from 'amis/lib/Schema';
import {getArgsWrapper} from '../renderer/event-control/helper';
export class TableV2Plugin extends BasePlugin {
export class Table2Plugin extends BasePlugin {
// 关联渲染器名字
rendererName = 'table2';
$schema = '/schemas/TableSchema.json';
// 组件名称
name = '表格V2';
name = '表格2';
isBaseComponent = true;
panelJustify = true;
disabledRendererPlugin = true;
description =
'用来展示表格数据,可以配置列信息,然后关联数据便能完成展示。支持嵌套、超级表头、列固定、表头固顶、合并单元格等等。当前组件需要配置数据源,不自带数据拉取,请优先使用 「CRUD」 组件。';
docLink = '/amis/zh-CN/components/table-v2';
docLink = '/amis/zh-CN/components/table2';
icon = 'fa fa-table';
scaffold: SchemaObject = {
@ -74,11 +74,11 @@ export class TableV2Plugin extends BasePlugin {
columns: [
{
title: 'A',
key: 'a'
name: 'a'
},
{
title: 'B',
key: 'b'
name: 'b'
}
]
};
@ -101,7 +101,7 @@ export class TableV2Plugin extends BasePlugin {
},
{
type: 'input-text',
name: 'key',
name: 'name',
placeholder: '绑定字段名'
},
{
@ -326,7 +326,7 @@ export class TableV2Plugin extends BasePlugin {
const columns: EditorNodeType = node.children.find(
item => item.isRegion && item.region === 'columns'
);
if (columns) {
for (let current of columns.children) {
const schema = current.schema;
if (schema && schema.key) {
@ -340,6 +340,7 @@ export class TableV2Plugin extends BasePlugin {
};
}
}
}
const result: any = {
$id: 'table2',
@ -822,8 +823,8 @@ export class TableV2Plugin extends BasePlugin {
if (Array.isArray(props.columns)) {
props.columns.forEach((column: any) => {
if (column.key) {
setVariable(mockedData, column.key, mockValue(column));
if (column.name) {
setVariable(mockedData, column.name, mockValue(column));
}
});
}
@ -905,4 +906,4 @@ export class TableV2Plugin extends BasePlugin {
}
}
registerEditorPlugin(TableV2Plugin);
registerEditorPlugin(Table2Plugin);

View File

@ -1,6 +1,6 @@
import {Button, Icon} from 'amis';
import React from 'react';
import {FormItemProps, getVariable} from 'amis-core';
import {getVariable} from 'amis-core';
import {
BasePlugin,
@ -20,7 +20,7 @@ import {TabsSchema} from 'amis/lib/renderers/Tabs';
import {SchemaObject} from 'amis/lib/Schema';
import {remarkTpl} from '../component/BaseControl';
export class TableCellV2Plugin extends BasePlugin {
export class TableCell2Plugin extends BasePlugin {
panelTitle = '列配置';
panelIcon = 'fa fa-columns';
@ -42,7 +42,7 @@ export class TableCellV2Plugin extends BasePlugin {
? false
: {
sameName: context.info.renderer.isFormItem ? 'name' : undefined,
name: 'key',
name: 'name',
type: 'ae-DataBindingControl',
label: '列字段',
onBindingChange(
@ -557,7 +557,6 @@ export class TableCellV2Plugin extends BasePlugin {
const parent = dom.parentElement?.parentElement;
const groupId = parent?.getAttribute('data-group-id');
const wrapper = dom.closest('table')!.parentElement?.parentElement;
return [].slice.call(
wrapper?.querySelectorAll(
`th[data-group-id="${groupId}"],
@ -585,4 +584,4 @@ export class TableCellV2Plugin extends BasePlugin {
}
}
registerEditorPlugin(TableCellV2Plugin);
registerEditorPlugin(TableCell2Plugin);