|
@ -172,11 +172,11 @@ const remove = () => { |
|
|
const selectedRows = props.grid.getSelectedRows(); |
|
|
const selectedRows = props.grid.getSelectedRows(); |
|
|
if (tickedRows?.length > 0) { |
|
|
if (tickedRows?.length > 0) { |
|
|
tickedRows.forEach((item) => { |
|
|
tickedRows.forEach((item) => { |
|
|
ids.push(item[props.grid.props.primaryKey]); |
|
|
ids.push(props.grid.props.localMode ? item['_rowKey_'] : item[props.grid.props.primaryKey]); |
|
|
}); |
|
|
}); |
|
|
} else if (selectedRows?.length > 0) { |
|
|
} else if (selectedRows?.length > 0) { |
|
|
selectedRows.forEach((item) => { |
|
|
selectedRows.forEach((item) => { |
|
|
ids.push(item[props.grid.props.primaryKey]); |
|
|
ids.push(props.grid.props.localMode ? item['_rowKey_'] : item[props.grid.props.primaryKey]); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
let flag = true; |
|
|
let flag = true; |
|
@ -212,8 +212,7 @@ const remove = () => { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch((error) => { |
|
|
.catch((error) => { |
|
|
console.error(error); |
|
|
console.error('[w-grid]Remove error:', error); |
|
|
console.info('==========error==========', error); |
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -259,7 +258,7 @@ const resetDefaultValues = () => { |
|
|
props.grid.refresh(); |
|
|
props.grid.refresh(); |
|
|
}) |
|
|
}) |
|
|
.catch((error) => { |
|
|
.catch((error) => { |
|
|
console.error(error); |
|
|
console.error('[w-grid]ResetDefaultValues error:', error); |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -374,13 +373,13 @@ const buttonObj = reactive({ |
|
|
}, |
|
|
}, |
|
|
click: () => { |
|
|
click: () => { |
|
|
if (props.grid.props.selectMode !== selectMode.cell) { |
|
|
if (props.grid.props.selectMode !== selectMode.cell) { |
|
|
console.warn(`Select mode is not 'cell', Cannot use cell editing function`); |
|
|
console.warn('[w-grid]`selectMode` property is not `cell`, Cannot use cell editing function.'); |
|
|
return false; |
|
|
return false; |
|
|
} else if (Object.keys(table.cellSelected).length === 0 || !table.cellSelected['colName']) { |
|
|
} else if (Object.keys(table.cellSelected).length === 0 || !table.cellSelected['colName']) { |
|
|
NotifyManager.info('请选择要编辑的单元格'); |
|
|
NotifyManager.info('请选择要编辑的单元格'); |
|
|
return false; |
|
|
return false; |
|
|
} else if (table.columns.findIndex((item) => item['name'] === table.cellSelected['colName'] && item['type']) < 0) { |
|
|
} else if (table.columns.findIndex((item) => item['name'] === table.cellSelected['colName'] && item['type']) < 0) { |
|
|
console.warn(`The column selected is not configured with a component type for editing.`); |
|
|
console.warn('[w-grid]The column selected is not configured with a component type for editing.'); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
table.bodyEditStatus = editStatus.cell; |
|
|
table.bodyEditStatus = editStatus.cell; |
|
@ -399,13 +398,13 @@ const buttonObj = reactive({ |
|
|
}, |
|
|
}, |
|
|
click: () => { |
|
|
click: () => { |
|
|
if (props.grid.props.selectMode !== selectMode.cell) { |
|
|
if (props.grid.props.selectMode !== selectMode.cell) { |
|
|
console.warn(`Select mode is not 'cell', Cannot use cell editing function`); |
|
|
console.warn('[w-grid]`selectMode` property is not `cell`, Cannot use cell editing function.'); |
|
|
return false; |
|
|
return false; |
|
|
} else if (Object.keys(table.cellSelected).length === 0 || !table.cellSelected['colName']) { |
|
|
} else if (Object.keys(table.cellSelected).length === 0 || !table.cellSelected['colName']) { |
|
|
NotifyManager.info('请选择要编辑的单元格'); |
|
|
NotifyManager.info('请选择要编辑的单元格'); |
|
|
return false; |
|
|
return false; |
|
|
} else if (table.columns.findIndex((item) => item['name'] === table.cellSelected['colName'] && item['type']) < 0) { |
|
|
} else if (table.columns.findIndex((item) => item['name'] === table.cellSelected['colName'] && item['type']) < 0) { |
|
|
console.warn(`The column selected is not configured with a component type for editing.`); |
|
|
console.warn('[w-grid]The column selected is not configured with a component type for editing.'); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
// 弹出模态框编辑,但是只编辑该列的值 |
|
|
// 弹出模态框编辑,但是只编辑该列的值 |
|
@ -425,7 +424,7 @@ const buttonObj = reactive({ |
|
|
}, |
|
|
}, |
|
|
click: () => { |
|
|
click: () => { |
|
|
if (table.columns.findIndex((item) => item['type']) < 0) { |
|
|
if (table.columns.findIndex((item) => item['type']) < 0) { |
|
|
console.warn(`Not configured with a component type for editing.`); |
|
|
console.warn('[w-grid]Not configured with a component type for editing.'); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
table.bodyEditStatus = editStatus.row; |
|
|
table.bodyEditStatus = editStatus.row; |
|
@ -438,7 +437,7 @@ const buttonObj = reactive({ |
|
|
label: t('action.edit'), |
|
|
label: t('action.edit'), |
|
|
click: () => { |
|
|
click: () => { |
|
|
if (table.columns.findIndex((item) => item['type']) < 0) { |
|
|
if (table.columns.findIndex((item) => item['type']) < 0) { |
|
|
console.warn(`Not configured with a component type for editing.`); |
|
|
console.warn('[w-grid]Not configured with a component type for editing.'); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
table.bodyEditStatus = editStatus.rows; |
|
|
table.bodyEditStatus = editStatus.rows; |
|
@ -623,7 +622,7 @@ const handleChildrenBtn = (arr, moreQueryShow) => { |
|
|
for (let i = 0; i < arr.length; i++) { |
|
|
for (let i = 0; i < arr.length; i++) { |
|
|
const btn = arr[i]; |
|
|
const btn = arr[i]; |
|
|
if (typeof btn === 'string' && !buttonObj[btn]) { |
|
|
if (typeof btn === 'string' && !buttonObj[btn]) { |
|
|
throw new Error(`'` + btn + `'` + ' toolbar action NOT exist'); |
|
|
throw new Error('[w-grid]`' + btn + '`' + ' toolbar action NOT exist.'); |
|
|
} else if (Array.isArray(btn) && btn.length > 0) { |
|
|
} else if (Array.isArray(btn) && btn.length > 0) { |
|
|
const handleResult = handleChildrenBtn(btn, moreQueryShow); |
|
|
const handleResult = handleChildrenBtn(btn, moreQueryShow); |
|
|
if (handleResult && handleResult.length > 0) { |
|
|
if (handleResult && handleResult.length > 0) { |
|
@ -670,7 +669,7 @@ const handleToolbarActions = () => { |
|
|
} |
|
|
} |
|
|
props.grid.props.toolbarActions.forEach((btn: any, index) => { |
|
|
props.grid.props.toolbarActions.forEach((btn: any, index) => { |
|
|
if (typeof btn === 'string' && !buttonObj[btn]) { |
|
|
if (typeof btn === 'string' && !buttonObj[btn]) { |
|
|
throw new Error(`'` + btn + `'` + ' toolbar action NOT exist'); |
|
|
throw new Error('[w-grid]`' + btn + '`' + ' toolbar action NOT exist.'); |
|
|
} else if (typeof btn === 'string' && buttonObj[btn]) { |
|
|
} else if (typeof btn === 'string' && buttonObj[btn]) { |
|
|
if (btn === buttonObj.query.name && moreQueryShow) { |
|
|
if (btn === buttonObj.query.name && moreQueryShow) { |
|
|
buttons_.value.push([buttonObj[btn], buttonObj[buttonObj.moreQuery.name]]); |
|
|
buttons_.value.push([buttonObj[btn], buttonObj[buttonObj.moreQuery.name]]); |
|
@ -716,7 +715,7 @@ const dbClickOperation = (row) => { |
|
|
row['expand'] = Tools.isEmpty(row['expand']) ? true : !row['expand']; |
|
|
row['expand'] = Tools.isEmpty(row['expand']) ? true : !row['expand']; |
|
|
} else { |
|
|
} else { |
|
|
if (!buttonObj[props.grid.props.dbClickOperation] && checkConfigNotContains(buttons_.value)) { |
|
|
if (!buttonObj[props.grid.props.dbClickOperation] && checkConfigNotContains(buttons_.value)) { |
|
|
throw new Error(`'` + props.grid.props.dbClickOperation + `'` + ' toolbar action NOT exist'); |
|
|
throw new Error('[w-grid]`' + props.grid.props.dbClickOperation + '`' + ' toolbar action NOT exist.'); |
|
|
} else if ( |
|
|
} else if ( |
|
|
props.grid.props.dbClickOperation !== buttonObj.separator && |
|
|
props.grid.props.dbClickOperation !== buttonObj.separator && |
|
|
buttonObj[props.grid.props.dbClickOperation] && |
|
|
buttonObj[props.grid.props.dbClickOperation] && |
|
|