|
|
@ -131,55 +131,34 @@ const generateTdIfComputed = computed(() => { |
|
|
|
return true; |
|
|
|
}); |
|
|
|
|
|
|
|
const mergeGroupByFieldContainsIf = (fieldName: string) => { |
|
|
|
const mergeGroupByField = tools.cm.mergeGroupByField.value; |
|
|
|
if (Array.isArray(mergeGroupByField) && mergeGroupByField.length > 0) { |
|
|
|
const index = mergeGroupByField.findIndex((item) => item === fieldName); |
|
|
|
if (index > -1) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
}; |
|
|
|
const sortByContainsIf = (fieldName: string) => { |
|
|
|
if (tools.props.sortBy && tools.props.sortBy.length > 0) { |
|
|
|
const findResult = tools.props.sortBy.findIndex((item) => { |
|
|
|
if (item.startsWith('-') && item.substring(1) === fieldName) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
return item === fieldName; |
|
|
|
}); |
|
|
|
return findResult > -1; |
|
|
|
} |
|
|
|
return false; |
|
|
|
}; |
|
|
|
|
|
|
|
const tdClick = () => { |
|
|
|
// 判定是否要退出编辑模式 |
|
|
|
const cellSelected = tools.table.store.cellSelected; |
|
|
|
if (cellSelected) { |
|
|
|
if (tools.props.localMode && tools.table.store.inlineEditStatus === Constant.EDIT_STATUS.CELL && tools.props.selectMode === Constant.SELECT_MODE.CELL) { |
|
|
|
if (cellSelected.colName !== props.col['name'] || cellSelected.row[rowKey] !== props.scope.row[rowKey]) { |
|
|
|
tools.editFM.exitInlineEdit(); |
|
|
|
} |
|
|
|
} else if ( |
|
|
|
tools.props.localMode && |
|
|
|
tools.table.store.inlineEditStatus === Constant.EDIT_STATUS.ROW && |
|
|
|
tools.props.selectMode === Constant.SELECT_MODE.CELL |
|
|
|
) { |
|
|
|
if (cellSelected.row[rowKey] !== props.scope.row[rowKey]) { |
|
|
|
tools.editFM.exitInlineEdit(); |
|
|
|
if (props.scope.row[Constant.FIELD_NAMES.SELECTABLE]) { |
|
|
|
// 判定是否要退出编辑模式 |
|
|
|
const cellSelected = tools.table.store.cellSelected; |
|
|
|
if (cellSelected) { |
|
|
|
if (tools.props.localMode && tools.table.store.inlineEditStatus === Constant.EDIT_STATUS.CELL && tools.props.selectMode === Constant.SELECT_MODE.CELL) { |
|
|
|
if (cellSelected.colName !== props.col['name'] || cellSelected.row[rowKey] !== props.scope.row[rowKey]) { |
|
|
|
tools.editFM.exitInlineEdit(); |
|
|
|
} |
|
|
|
} else if ( |
|
|
|
tools.props.localMode && |
|
|
|
tools.table.store.inlineEditStatus === Constant.EDIT_STATUS.ROW && |
|
|
|
tools.props.selectMode === Constant.SELECT_MODE.CELL |
|
|
|
) { |
|
|
|
if (cellSelected.row[rowKey] !== props.scope.row[rowKey]) { |
|
|
|
tools.editFM.exitInlineEdit(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (tools.table.store.inlineEditStatus === Constant.EDIT_STATUS.NONE && tools.props.selectMode === Constant.SELECT_MODE.CELL) { |
|
|
|
tools.table.store.cellSelected = { |
|
|
|
row: toRaw(props.scope.row), |
|
|
|
rowKey: props.scope.row[rowKey], |
|
|
|
primaryKey: props.scope.row[tools.props.primaryKey], |
|
|
|
colName: props.col['name'], |
|
|
|
value: props.scope.row[props.col['name']], |
|
|
|
}; |
|
|
|
if (tools.table.store.inlineEditStatus === Constant.EDIT_STATUS.NONE && tools.props.selectMode === Constant.SELECT_MODE.CELL) { |
|
|
|
tools.table.store.cellSelected = { |
|
|
|
row: toRaw(props.scope.row), |
|
|
|
rowKey: props.scope.row[rowKey], |
|
|
|
primaryKey: props.scope.row[tools.props.primaryKey], |
|
|
|
colName: props.col['name'], |
|
|
|
value: props.scope.row[props.col['name']], |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|