Browse Source

修复按钮不存在导致循环报错问题

main
likunming 4 months ago
parent
commit
ca0be67638
  1. 9
      io.sc.platform.core.frontend/src/platform/components/grid/GridTop.vue
  2. 8
      io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue
  3. 1
      io.sc.platform.core.frontend/src/platform/components/grid/css/grid.css
  4. 18
      io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue

9
io.sc.platform.core.frontend/src/platform/components/grid/GridTop.vue

@ -32,6 +32,7 @@ import { useQuasar, exportFile } from 'quasar';
import { axios, Tools, t, NotifyManager } from '@/platform'; import { axios, Tools, t, NotifyManager } from '@/platform';
import { selectedMode, formStatus, editStatus } from './ts/grid'; import { selectedMode, formStatus, editStatus } from './ts/grid';
import GridConfig from './GridConfig.vue'; import GridConfig from './GridConfig.vue';
import { throws } from 'assert';
const $q = useQuasar(); const $q = useQuasar();
@ -607,7 +608,9 @@ const handleChildrenBtn = (arr, moreQueryShow) => {
const tempArr = <any>[]; const tempArr = <any>[];
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 (Array.isArray(btn) && btn.length > 0) { if (typeof btn === 'string' && !buttonObj[btn]) {
throw new Error(`'` + btn + `'` + ' toolbar action NOT exits');
} 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) {
tempArr.push(handleResult); tempArr.push(handleResult);
@ -652,7 +655,9 @@ const handleToolbarActions = () => {
moreQueryShow = true; moreQueryShow = true;
} }
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 exits');
} 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]]);
} else { } else {

8
io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue

@ -182,6 +182,13 @@ const props = defineProps({
foreignKey: { type: String, default: 'parent' }, // foreignKey: { type: String, default: 'parent' }, //
refreshData: { type: Boolean, default: false }, // primaryKey refreshData: { type: Boolean, default: false }, // primaryKey
dbClickOperation: { type: String, default: 'view' }, // nameclickexpand()none() dbClickOperation: { type: String, default: 'view' }, // nameclickexpand()none()
groupMode: { type: String, default: '' },
group: {
type: Array,
default: () => {
return [];
},
},
appendRows: { appendRows: {
// //
type: Array, type: Array,
@ -901,7 +908,6 @@ const setRowDataExtraProperty = (rows: []) => {
// //
table.mergeRecords = {}; table.mergeRecords = {};
sortByProperties(rows, mergeColumns); sortByProperties(rows, mergeColumns);
console.info('rows=========', rows);
} }
if (rows && rows.length > 0) { if (rows && rows.length > 0) {
rows.forEach((item: any, index) => { rows.forEach((item: any, index) => {

1
io.sc.platform.core.frontend/src/platform/components/grid/css/grid.css

@ -6,7 +6,6 @@
} }
.w-grid .q-table__top { .w-grid .q-table__top {
padding: var(--tableTopPadding) var(--tableTopPadding); padding: var(--tableTopPadding) var(--tableTopPadding);
border-bottom: 0px !important;
} }
.w-grid .q-table__middle .q-table th { .w-grid .q-table__middle .q-table th {
padding: var(--tableHeaderPadding) 8px; padding: var(--tableHeaderPadding) 8px;

18
io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue

@ -475,8 +475,8 @@ const buttonClick = async (button) => {
context: context, context: context,
selectedColName: props.grid.getSelectedCell()['colName'], selectedColName: props.grid.getSelectedCell()['colName'],
}); });
if (button.afterClick) { nextTick(async () => {
nextTick(async () => { if (button.afterClick) {
await button.afterClick({ await button.afterClick({
selected: firstSelectedComputed.value, selected: firstSelectedComputed.value,
selecteds: selectedComputed.value, selecteds: selectedComputed.value,
@ -486,13 +486,13 @@ const buttonClick = async (button) => {
context: context, context: context,
selectedColName: props.grid.getSelectedCell()['colName'], selectedColName: props.grid.getSelectedCell()['colName'],
}); });
let data = undefined; }
if (button?.name !== 'add' && button?.name !== 'addTop' && button?.name !== 'addChild') { let data = undefined;
data = firstSelectedComputed.value; if (button?.name !== 'add' && button?.name !== 'addTop' && button?.name !== 'addChild') {
} data = firstSelectedComputed.value;
props.grid.emit('afterEditorOpen', { grid: props.grid, data: data }); }
}); props.grid.emit('afterEditorOpen', { grid: props.grid, data: data });
} });
} }
}; };

Loading…
Cancel
Save