feat:必输列禁止设置隐藏
This commit is contained in:
parent
dd7d478eaa
commit
d9789a1a18
|
@ -423,6 +423,16 @@ var TableHeader = function (_Component) {
|
|||
"tr",
|
||||
{ key: index, style: rowStyle, className: filterable && index == rows.length - 1 ? 'filterable' : '' },
|
||||
row.map(function (da, columIndex, arr) {
|
||||
da.children = da.required ? _react2["default"].createElement(
|
||||
"span",
|
||||
null,
|
||||
_react2["default"].createElement(
|
||||
"span",
|
||||
{ className: "required" },
|
||||
"*"
|
||||
),
|
||||
da.children
|
||||
) : da.children;
|
||||
var thHover = da.drgHover ? " " + clsPrefix + "-thead th-drag-hover" : "";
|
||||
delete da.drgHover;
|
||||
var fixedStyle = "";
|
||||
|
@ -472,11 +482,6 @@ var TableHeader = function (_Component) {
|
|||
"th",
|
||||
_extends({}, da, keyTemp, { className: thClassName, "data-th-fixed": da.fixed, "data-line-key": da.key,
|
||||
"data-line-index": columIndex, "data-th-width": da.width, "data-type": "draggable" }),
|
||||
da.required ? _react2["default"].createElement(
|
||||
"span",
|
||||
{ className: "required" },
|
||||
"*"
|
||||
) : '',
|
||||
da.children,
|
||||
|
||||
// && columIndex != _rowLeng
|
||||
|
|
|
@ -229,7 +229,7 @@ function filterColumn(Table, Popover) {
|
|||
id: da.key,
|
||||
checked: da.checked
|
||||
};
|
||||
if (da.fixed) {
|
||||
if (da.fixed || da.required) {
|
||||
paramObj.disabled = true;
|
||||
} else {
|
||||
paramObj.onClick = function () {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* @title 多列表头、多列表头的拖拽表头宽度
|
||||
* @title 多列表头
|
||||
* @parent 列渲染 Custom Render
|
||||
* @description columns[n] 可以内嵌 children,以渲染分组表头。
|
||||
* 自定义表头高度需要传headerHeight,注:修改th的padding top和bottom置为0,否则会有影响
|
||||
|
@ -16,42 +16,42 @@ import dragColumn from '../../src/lib/dragColumn';
|
|||
|
||||
const columns = [
|
||||
{
|
||||
title: "Name",
|
||||
title: "姓名",
|
||||
dataIndex: "name",
|
||||
key: "name",
|
||||
width: 100,
|
||||
fixed: "left"
|
||||
},
|
||||
{
|
||||
title: "Other",
|
||||
title: "个人信息",
|
||||
width:600,
|
||||
children: [
|
||||
{
|
||||
title: "Age",
|
||||
title: "年龄",
|
||||
dataIndex: "age",
|
||||
key: "age",
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: "Address",
|
||||
title: "地址",
|
||||
children: [
|
||||
{
|
||||
title: "Street",
|
||||
title: "街道",
|
||||
dataIndex: "street",
|
||||
key: "street",
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: "Block",
|
||||
title: "单元",
|
||||
children: [
|
||||
{
|
||||
title: "Building",
|
||||
title: "楼号",
|
||||
dataIndex: "building",
|
||||
key: "building",
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: "Door No.",
|
||||
title: "门户",
|
||||
dataIndex: "number",
|
||||
key: "number",
|
||||
width: 100
|
||||
|
@ -63,17 +63,17 @@ const columns = [
|
|||
]
|
||||
},
|
||||
{
|
||||
title: "Company",
|
||||
title: "公司信息",
|
||||
width:400,
|
||||
children: [
|
||||
{
|
||||
title: "Company Address",
|
||||
title: "公司地址",
|
||||
dataIndex: "companyAddress",
|
||||
key: "companyAddress",
|
||||
width:200,
|
||||
},
|
||||
{
|
||||
title: "Company Name",
|
||||
title: "公司名称",
|
||||
dataIndex: "companyName",
|
||||
key: "companyName",
|
||||
width:200,
|
||||
|
@ -81,7 +81,7 @@ const columns = [
|
|||
]
|
||||
},
|
||||
{
|
||||
title: "Gender",
|
||||
title: "性别",
|
||||
dataIndex: "gender",
|
||||
key: "gender",
|
||||
width: 60,
|
||||
|
@ -98,9 +98,9 @@ for (let i = 0; i < 20; i++) {
|
|||
street: "Lake Park",
|
||||
building: "C",
|
||||
number: 2035,
|
||||
companyAddress: "Lake Street 42",
|
||||
companyName: "SoftLake Co",
|
||||
gender: "M"
|
||||
companyAddress: "北清路 68 号",
|
||||
companyName: "用友",
|
||||
gender: "男"
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -77,12 +77,14 @@ class Demo21 extends Component {
|
|||
key: "orderCode",
|
||||
width: 100,
|
||||
fixed: 'left',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
title: "供应商名称",
|
||||
dataIndex: "supplierName",
|
||||
key: "supplierName",
|
||||
width: 150
|
||||
width: 150,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
title: "类型",
|
||||
|
@ -96,6 +98,18 @@ class Demo21 extends Component {
|
|||
key: "purchasing",
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: "单据日期",
|
||||
dataIndex: "voucherDate",
|
||||
key: "voucherDate",
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: "审批状态",
|
||||
dataIndex: "approvalState_name",
|
||||
key: "approvalState_name",
|
||||
width: 150
|
||||
}
|
||||
]};
|
||||
}
|
||||
afterFilter = (optData,columns)=>{
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -761,6 +761,7 @@ class TableHeader extends Component {
|
|||
let _rowLeng = (row.length-1);
|
||||
return(<tr key={index} style={rowStyle} className={(filterable && index == rows.length - 1)?'filterable':''}>
|
||||
{row.map((da, columIndex, arr) => {
|
||||
da.children = da.required ? <span><span className='required'>*</span>{da.children}</span> : da.children;
|
||||
let thHover = da.drgHover
|
||||
? ` ${clsPrefix}-thead th-drag-hover`
|
||||
: "";
|
||||
|
@ -815,7 +816,6 @@ class TableHeader extends Component {
|
|||
if(!da.fixed ){
|
||||
return (<th {...da} {...keyTemp} className={thClassName} data-th-fixed={da.fixed} data-line-key={da.key}
|
||||
data-line-index={columIndex} data-th-width={da.width} data-type="draggable">
|
||||
{da.required ? <span className='required'>*</span>:''}
|
||||
{da.children}
|
||||
{
|
||||
// && columIndex != _rowLeng
|
||||
|
|
|
@ -101,7 +101,7 @@ export default function filterColumn(Table, Popover) {
|
|||
id:da.key,
|
||||
checked:da.checked
|
||||
}
|
||||
if(da.fixed){
|
||||
if(da.fixed || da.required){
|
||||
paramObj.disabled = true
|
||||
}else{
|
||||
paramObj.onClick = () => {
|
||||
|
|
Loading…
Reference in New Issue