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. 4
      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 { selectedMode, formStatus, editStatus } from './ts/grid';
import GridConfig from './GridConfig.vue';
import { throws } from 'assert';
const $q = useQuasar();
@ -607,7 +608,9 @@ const handleChildrenBtn = (arr, moreQueryShow) => {
const tempArr = <any>[];
for (let i = 0; i < arr.length; 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);
if (handleResult && handleResult.length > 0) {
tempArr.push(handleResult);
@ -652,7 +655,9 @@ const handleToolbarActions = () => {
moreQueryShow = true;
}
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) {
buttons_.value.push([buttonObj[btn], buttonObj[buttonObj.moreQuery.name]]);
} 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' }, //
refreshData: { type: Boolean, default: false }, // primaryKey
dbClickOperation: { type: String, default: 'view' }, // nameclickexpand()none()
groupMode: { type: String, default: '' },
group: {
type: Array,
default: () => {
return [];
},
},
appendRows: {
//
type: Array,
@ -901,7 +908,6 @@ const setRowDataExtraProperty = (rows: []) => {
//
table.mergeRecords = {};
sortByProperties(rows, mergeColumns);
console.info('rows=========', rows);
}
if (rows && rows.length > 0) {
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 {
padding: var(--tableTopPadding) var(--tableTopPadding);
border-bottom: 0px !important;
}
.w-grid .q-table__middle .q-table th {
padding: var(--tableHeaderPadding) 8px;

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

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

Loading…
Cancel
Save