Commit 3b0be895 authored by zhangwenshuai's avatar zhangwenshuai

增加行锁定

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