diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 24550b3..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Brian Liu - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/package.json b/package.json index 8aa0324..a1a6d81 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,9 @@ { "name": "erp-frontend", - "version": "2.0.0", + "version": "0.1.1", "private": true, "description": "牛安后台管理系统", "author": "Teeker <2456019588@qq.com>", - "license": "MIT", "type": "module", "scripts": { "dev": "vite --mode development", diff --git a/src/common/languages/mapping/base-info-mapping.ts b/src/common/languages/mapping/base-info-mapping.ts index b52cd7f..26540de 100644 --- a/src/common/languages/mapping/base-info-mapping.ts +++ b/src/common/languages/mapping/base-info-mapping.ts @@ -40,7 +40,7 @@ export const useStatus = () => { }; const finishedProductReceiptStatusKeyMap: Record = { - 1: "_base_info.finished_product_receipt_status.pending_outstock", + 0: "_base_info.finished_product_receipt_status.pending_outstock", 3: "_base_info.finished_product_receipt_status.outstocking", 4: "_base_info.finished_product_receipt_status.completed", }; diff --git a/src/components/base/base-pageable-table/BasePageableTable.vue b/src/components/base/base-pageable-table/BasePageableTable.vue index c6ea3b7..7d4b939 100644 --- a/src/components/base/base-pageable-table/BasePageableTable.vue +++ b/src/components/base/base-pageable-table/BasePageableTable.vue @@ -8,6 +8,9 @@ import { get } from "@/common/http/request"; interface Emits { (e: "data-loaded", data: any[]): void; (e: "expand-change", row: any, expandedRows: any[]): void; + (e: "select", selection: any[], row: any): void; + (e: "select-all", selection: any[]): void; + (e: "selection-change", selection: any[]): void; } const props = defineProps({ @@ -18,6 +21,16 @@ const props = defineProps({ parse: Function, expandRowKeys: Array as PropType<(string | number)[]>, rowKey: { type: String, default: "id" }, + // 树形数据配置 + treeProps: { + type: Object as PropType<{ children: string; hasChildren?: string }>, + default: () => ({ children: "children" }), + }, + // 是否显示为树形表格 + isTreeTable: { + type: Boolean, + default: false, + }, }); const emit = defineEmits(); const tableMainRef = ref | null>(null); @@ -67,6 +80,18 @@ const handleExpandChange = (row: any, expandedRows: any[]) => { emit("expand-change", row, expandedRows); }; +const handleSelect = (selection: any[], row: any) => { + emit("select", selection, row); +}; + +const handleSelectAll = (selection: any[]) => { + emit("select-all", selection); +}; + +const handleSelectionChange = (selection: any[]) => { + emit("selection-change", selection); +}; + const recomputeTableHeight = () => { if (!tableMainHostEl.value) return; const top = tableMainHostEl.value.getBoundingClientRect().top; @@ -85,6 +110,11 @@ defineExpose({ sort: (field: string, order: string) => { tableMainRef.value?.tableRef?.sort(field, order); }, + toggleRowSelection: (row: any, selected?: boolean) => { + tableMainRef.value?.toggleRowSelection(row, selected); + }, + getSelectionRows: () => tableMainRef.value?.getSelectionRows() || [], + clearSelection: () => tableMainRef.value?.tableRef?.clearSelection(), }); onMounted(async () => { @@ -135,7 +165,12 @@ onMounted(async () => { v-model:page-size="pageSize" :expand-row-keys="expandRowKeys" :row-key="rowKey" + :tree-props="treeProps" + :is-tree-table="isTreeTable" @expand-change="handleExpandChange" + @select="handleSelect" + @select-all="handleSelectAll" + @selection-change="handleSelectionChange" > diff --git a/src/components/base/base-table-form/BaseTableForm.vue b/src/components/base/base-table-form/BaseTableForm.vue index 5d65198..10bef4b 100644 --- a/src/components/base/base-table-form/BaseTableForm.vue +++ b/src/components/base/base-table-form/BaseTableForm.vue @@ -94,6 +94,8 @@ watch( if (!val) { // 关闭时清空选中 selectedRows.value = []; + // 清空表格内部的选择状态,避免下次打开时残留 + tableRef.value?.clearSelection(); } } ); @@ -129,7 +131,7 @@ defineExpose({