diff --git a/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue b/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue index 7e9397cc..0f96b8c8 100644 --- a/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue +++ b/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue @@ -525,7 +525,7 @@ const queryFormFieldsComputed = computed(() => { }); const toolbarButtonsComputed = computed(() => { localFlag.value; - return buttons_; + return buttons_.value; }); const table = reactive({ @@ -551,13 +551,6 @@ const table = reactive({ }); provide('table', table); -const expandIconComputed = computed(() => { - return table.treeExpand ? 'expand_less' : 'expand_more'; -}); -const expandLabelI18nKeyComputed = computed(() => { - return table.treeExpand ? 'action.expandUp' : 'action.expandDown'; -}); - const remove = () => { const ids = []; if (getTickedRowsComputed.value && getTickedRowsComputed.value.length > 0) { @@ -814,9 +807,12 @@ const buttonObj = reactive({ }, expand: { name: 'expand', - icon: expandIconComputed, - labelI18nKey: expandLabelI18nKeyComputed, - label: t(expandLabelI18nKeyComputed.value), + icon: (args) => { + return table.treeExpand ? 'expand_less' : 'expand_more'; + }, + label: (args) => { + return table.treeExpand ? t('action.collapseAll') : t('action.expandAll'); + }, click: () => { expandFun(table.rows, table.treeExpand); table.treeExpand = !table.treeExpand; @@ -853,7 +849,7 @@ const expandFun = (arr, treeExpand) => { }; // 处理toobar -const buttons_ = []; +const buttons_ = ref([]); const handleChildrenBtn = (arr) => { const tempArr = []; for (let i = 0; i < arr.length; i++) { @@ -874,17 +870,17 @@ const handleChildrenBtn = (arr) => { return tempArr; }; const handleToolbarActions = () => { - buttons_.splice(0, buttons_.length); + buttons_.value.splice(0, buttons_.value.length); props.toolbarActions.forEach((btn: any, index) => { if (typeof btn === 'string' && buttonObj[btn]) { - buttons_.push(buttonObj[btn]); + buttons_.value.push(buttonObj[btn]); } else if (Array.isArray(btn) && btn.length > 0) { - buttons_.push(handleChildrenBtn(btn)); + buttons_.value.push(handleChildrenBtn(btn)); } else if (typeof btn === 'object' && btn.extend && buttonObj[btn.extend]) { // 继承内置按钮 - buttons_.push({ ...buttonObj[btn.extend], ...btn, _click: buttonObj[btn.extend].click }); + buttons_.value.push({ ...buttonObj[btn.extend], ...btn, _click: buttonObj[btn.extend].click }); } else { - buttons_.push(btn); + buttons_.value.push(btn); } }); }; @@ -1831,7 +1827,7 @@ const stickyHeaderColumn = (time = 500) => { tableRef.value.$el.getElementsByClassName('q-table__bottom')[0].style.setProperty('--tableBottomHeight', 50 + 'px'); tableRef.value.$el.getElementsByClassName('q-table__bottom')[0].style.setProperty('--tableBottomButtonHeight', 40 + 'px'); } - if (props.title || buttons_.length > 0 || props.configButton) { + if (props.title || buttons_.value.length > 0 || props.configButton) { tableRef.value.$el.getElementsByClassName('q-table__top')[0].style.setProperty('--tableTopPadding', '8px'); } else { tableRef.value.$el.getElementsByClassName('q-table__top')[0].style.setProperty('--tableTopPadding', '0px'); @@ -2223,7 +2219,7 @@ const handlerQueryFormShowField = () => { }); } else { // 一行应该显示的字段个数 - const rowColsNum = queryFormRef.value.getColsNum() * (props.queryFormRowNum || 1); + const rowColsNum = (Tools.isUndefinedOrNull(queryFormRef.value) ? 4 : queryFormRef.value.getColsNum()) * (props.queryFormRowNum || 1); let currRowColsNum = 0; props.queryFormFields.forEach((item: any) => { if (Tools.hasOwnProperty(item, 'colSpan')) { diff --git a/io.sc.platform.core.frontend/src/platform/components/toolbar/ChildrenBtn.vue b/io.sc.platform.core.frontend/src/platform/components/toolbar/ChildrenBtn.vue index 0c6c4277..f68bccea 100644 --- a/io.sc.platform.core.frontend/src/platform/components/toolbar/ChildrenBtn.vue +++ b/io.sc.platform.core.frontend/src/platform/components/toolbar/ChildrenBtn.vue @@ -14,7 +14,7 @@ " > - {{ button[0].label }} + {{ getLabel(button[0].label) }} @@ -31,6 +31,8 @@ :button="childrenBtn" :grid="grid" :button-click="buttonClick" + :get-icon="getIcon" + :get-label="getLabel" > @@ -88,6 +92,18 @@ const props = defineProps({ return () => {}; }, }, + getIcon: { + type: Function, + default: () => { + return () => {}; + }, + }, + getLabel: { + type: Function, + default: () => { + return () => {}; + }, + }, dense: { type: Boolean, default: false }, }); const firstSelectedComputed = computed(() => { diff --git a/io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue b/io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue index 6f403e54..b8ee4f3d 100644 --- a/io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue +++ b/io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue @@ -1,5 +1,5 @@ @@ -92,14 +100,14 @@ outline v-bind="btn.data" align="center" - :icon="dense ? undefined : btn.data.icon" - :label="dense ? '' : btn.data.label" + :icon="dense ? undefined : getIcon(btn.data.icon)" + :label="dense ? '' : getLabel(btn.data.label)" class="class-action-item" @click="buttonClick(btn.data)" >
- - {{ btn.data.label }} + + {{ getLabel(btn.data.label) }}
@@ -110,13 +118,15 @@ unelevated outline label="" + no-wrap + no-caps :icon="undefined" - padding="0px 0px" :dense="dense" class="class-action-item" + content-class="w-toolbar-btn-dropdown" > @@ -128,6 +138,8 @@ :button="childrenBtn.data" :grid="grid" :button-click="buttonClick" + :get-icon="getIcon" + :get-label="getLabel" :dense="dense" > {{ childrenBtn.data.label }} + {{ getLabel(childrenBtn.data.label) }} @@ -161,7 +174,7 @@ - diff --git a/io.sc.platform.core.frontend/src/platform/i18n/messages.json b/io.sc.platform.core.frontend/src/platform/i18n/messages.json index 712545b8..8678e087 100644 --- a/io.sc.platform.core.frontend/src/platform/i18n/messages.json +++ b/io.sc.platform.core.frontend/src/platform/i18n/messages.json @@ -141,8 +141,8 @@ "action.export": "Export", "action.export.failed": "Export Failed", "action.submit": "Submit", - "action.expandUp": "Expand Up", - "action.expandDown": "Expand Down", + "action.expandAll": "Expand All", + "action.collapseAll": "Collapse All", "tip.noData": "No Data", "tip.dataLoading": "Data Loading", diff --git a/io.sc.platform.core.frontend/src/platform/i18n/messages_tw_CN.json b/io.sc.platform.core.frontend/src/platform/i18n/messages_tw_CN.json index a08ea741..16ac1b9e 100644 --- a/io.sc.platform.core.frontend/src/platform/i18n/messages_tw_CN.json +++ b/io.sc.platform.core.frontend/src/platform/i18n/messages_tw_CN.json @@ -141,8 +141,8 @@ "action.export": "導出", "action.export.failed": "導出失敗", "action.submit": "提交", - "action.expandUp": "全部收起", - "action.expandDown": "全部展开", + "action.expandAll": "全部展开", + "action.collapseAll": "全部收起", "tip.noData": "未查找到任何數據", "tip.dataLoading": "數據加載中", diff --git a/io.sc.platform.core.frontend/src/platform/i18n/messages_zh_CN.json b/io.sc.platform.core.frontend/src/platform/i18n/messages_zh_CN.json index e6fdaf51..8cdb7a2b 100644 --- a/io.sc.platform.core.frontend/src/platform/i18n/messages_zh_CN.json +++ b/io.sc.platform.core.frontend/src/platform/i18n/messages_zh_CN.json @@ -141,8 +141,8 @@ "action.export": "导出", "action.export.failed": "导出失败", "action.submit": "提交", - "action.expandUp": "全部收起", - "action.expandDown": "全部展开", + "action.expandAll": "全部展开", + "action.collapseAll": "全部收起", "tip.noData": "未查找到任何数据", "tip.dataLoading": "数据加载中",