Commit ffd8373e authored by 杨子龙's avatar 杨子龙

表格组件

- 增加列固定配置 - 增加行点击事件
parent b132ca42
......@@ -4857,20 +4857,6 @@ const advancedWidgets = [
type: 'string',
widget: 'htmlInput',
},
optionWidth: {
title: "操作栏宽度",
type: "number",
default: 120
},
optionRender: {
title: '',
name: '操作栏内容配置',
type: 'array',
default: [
{ type: "icon", value: 'DeleteOutlined' , action: "delete"},
],
widget: 'OptionRender',
},
pagination: {
title: '是否启用分页(关闭分页后,需要配制滚动)',
type: 'boolean',
......@@ -4882,14 +4868,40 @@ const advancedWidgets = [
type: 'number',
widget: "inputNumber",
hidden: '{{formData.pagination}}',
required: true
},
scrollY: {
title: 'y轴滚动',
type: 'number',
widget: "inputNumber",
hidden: '{{formData.pagination}}',
required: true
},
optionWidth: {
title: "操作栏宽度",
type: "number",
default: 120
},
optionFixed: {
title: "操作栏固定",
type: "string",
default: "false",
widget: 'select',
enum: ['false', 'left', 'right'],
enumNames: ['关闭固定', '靠左', '靠右'],
},
optionRender: {
title: '',
name: '操作栏内容配置',
type: 'array',
default: [
{ type: "icon", value: 'DeleteOutlined' , action: "delete"},
],
widget: 'OptionRender',
},
isOpenRowEvent: {
title: '是否启动行点击事件',
type: 'boolean',
widget: "switch",
default: true,
},
hiddenCondition: {
title: '隐藏条件',
......
......@@ -21,7 +21,9 @@ const DataTable = props => {
scrollY,
statusOption,
areaTaskShine,
optionWidth
optionWidth,
optionFixed,
isOpenRowEvent
} = schema;
const [dataSource, setDataSource] = useState([]);
......@@ -243,6 +245,7 @@ const DataTable = props => {
dataIndex,
key: dataIndex,
width: item.width || 120,
fixed: item.fixed || false,
render: (_, row, index) => {
return (
<Fragment>
......@@ -263,6 +266,7 @@ const DataTable = props => {
dataIndex: '',
key: '',
width: optionWidth || 120,
fixed: optionFixed,
render: (_, row, index) => {
return getOptionRender(_, row, index);
},
......@@ -323,6 +327,17 @@ const DataTable = props => {
window.relationForm.data = data;
};
const rowClickEvent = (record) => {
return {
onClick: () => {
eventEmitter.emit(`${addons?.dataPath}_event`, {
...record,
action: "rowOnClick",
});
}
}
}
useEffect(() => {
eventEmitter.removeAllListeners(addons?.dataPath);
......@@ -378,6 +393,9 @@ const DataTable = props => {
y: scrollY,
}
}
onRow={
record => isOpenRowEvent && rowClickEvent(record)
}
dataSource={dataSource}
/>
) : (
......
......@@ -62,12 +62,14 @@ const StatusOption = props => {
item.parseStr = currentItem.parseStr;
item.isMapped = currentItem.isMapped || false;
item.width = currentItem.width || 120;
item.fixed = currentItem.fixed;
} else {
item.type = showType(current?.Widget) ? current ? current.Widget : "文本" : '文本';
item.editType = current ? current.Widget : "文本";
item.color = 'rgb(65,68,69)';
item.isMapped = false;
item.width = 120;
item.fixed = false;
}
});
......@@ -211,6 +213,34 @@ const StatusOption = props => {
);
},
},
{
title: '列固定',
dataIndex: 'fixed',
width: 80,
render: (r, _, i) => {
return (
<Select value={r || "false"}
options={[
{
label: "靠左",
value: "left"
},
{
label: "靠右",
value: "right"
},
{
label: "关闭列固定",
value: "false"
}
]}
style={{
width: '100%',
}}
onChange={e => inputChange(e, i, 'fixed', _)} />
);
},
},
{
title: '样式映射',
dataIndex: 'isMapped',
......@@ -389,7 +419,7 @@ const StatusOption = props => {
ItemTypes="stadingOrder"
color={color}
scroll={{
x: 500,
x: 600,
}}
columns={columns}
pagination={false}
......
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