Commit 3b0be895 authored by zhangwenshuai's avatar zhangwenshuai

增加行锁定

parent cee48c4a
......@@ -60,7 +60,7 @@ const Cell = (props: CellProps) => {
}
};
const turnIntoEditStatus = (data:any) => {
const turnIntoEditStatus = (data: any) => {
setStatus('edit');
if (typeof onEmitMsg === 'function') {
onEmitMsg({ ...data, status: EDIT_STATUS.EDITING });
......@@ -80,9 +80,10 @@ const Cell = (props: CellProps) => {
return;
}
let temp: CellDataProps[] = [];
cellData && cellData.map((item: CellDataProps) => {
temp.push({ text: item.text, value: item.value });
});
cellData &&
cellData.map((item: CellDataProps) => {
temp.push({ text: item.text, value: item.value });
});
if (temp.length === 0) {
temp = emptyModel;
}
......@@ -132,8 +133,8 @@ const Cell = (props: CellProps) => {
const { current = 1, pageSize = 20 } = paginationConfig || {};
// 构造序号
const getIndex = () => {
if(typeof showIndex === 'function'){
return showIndex(props)
if (typeof showIndex === 'function') {
return showIndex(props);
}
return (current - 1) * pageSize + rowIndex + 1;
};
......@@ -196,9 +197,7 @@ const Cell = (props: CellProps) => {
/>
</div>
)}
{
renderFirstLeft&&renderFirstLeft({record})
}
{renderFirstLeft && renderFirstLeft({ record })}
</div>
);
};
......@@ -225,7 +224,7 @@ const Cell = (props: CellProps) => {
} else {
detailConfig = config[String(columnType)] || config['1'];
}
if(Number(columnType)===8){
if (Number(columnType) === 8) {
empty = false;
}
const DetailComp: any = detailConfig.detailComp;
......@@ -243,12 +242,17 @@ const Cell = (props: CellProps) => {
<div
className={s.detailCell}
onClick={() => {
// 不可编辑状态
if (!cellEditable || readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag)) {
// 不可编辑状态(无编辑权限、列只读、行锁定、单元格只读)
if (
!cellEditable ||
readOnlyFlag ||
record.isLocked ||
(dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag)
) {
return false;
}
// 获取当前节点的选中状态
const dom:any = cellUnit.current;
const dom: any = cellUnit.current;
let selected = false;
if (dom && dom.getAttribute('data-selected-cell')) {
selected = dom.getAttribute('data-selected-cell') === '1';
......@@ -264,9 +268,9 @@ const Cell = (props: CellProps) => {
// 否则进入选中状态
if (dom) {
// 先清除所有dom的选中状态及样式
const doms:any = document.querySelectorAll(`.cellUnit.table_${tableId}`);
const doms: any = document.querySelectorAll(`.cellUnit.table_${tableId}`);
if (doms) {
doms.forEach((item:any) => {
doms.forEach((item: any) => {
item.setAttribute('data-selected-cell', '0');
item.classList.remove(s.selected);
});
......@@ -403,7 +407,7 @@ const Cell = (props: CellProps) => {
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
>
{columnIndex === 0 && position!=='right' && renderFirst()}
{columnIndex === 0 && position !== 'right' && renderFirst()}
<div
id={`cellUnit_${tableId}_${record.id}_${columnName}`}
className={classNames(
......
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