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