diff --git a/.github/workflows/gitee.yml b/.github/workflows/gitee.yml index bc89406ea..652dfe457 100644 --- a/.github/workflows/gitee.yml +++ b/.github/workflows/gitee.yml @@ -26,7 +26,7 @@ jobs: - name: Deploy 🔧 run: | - pnpm install + pnpm install --no-frozen-lockfile sed -i "s#VITE_PUBLIC_PATH = /#VITE_PUBLIC_PATH = /vue-pure-admin/#g" $(pwd)/.env.production pnpm build cd dist diff --git a/package.json b/package.json index 23bc72957..b51855338 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@logicflow/core": "^1.2.5", "@logicflow/extension": "^1.2.5", "@pureadmin/descriptions": "^1.1.1", - "@pureadmin/table": "^2.0.0", + "@pureadmin/table": "^2.1.0", "@pureadmin/utils": "^1.8.9", "@vueuse/core": "^10.1.2", "@vueuse/motion": "2.0.0-beta.12", @@ -57,12 +57,12 @@ "mockjs": "^1.1.0", "nprogress": "^0.2.0", "path": "^0.12.7", - "pinia": "^2.0.35", + "pinia": "^2.0.36", "qrcode": "^1.5.3", "qs": "^6.11.1", "responsive-storage": "^2.2.0", "sortablejs": "^1.15.0", - "swiper": "^9.2.4", + "swiper": "^9.3.0", "typeit": "^8.7.1", "v-contextmenu": "3.0.0", "vue": "^3.2.47", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 205484be9..8a5e2bd38 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,7 +12,7 @@ specifiers: "@logicflow/core": ^1.2.5 "@logicflow/extension": ^1.2.5 "@pureadmin/descriptions": ^1.1.1 - "@pureadmin/table": ^2.0.0 + "@pureadmin/table": ^2.1.0 "@pureadmin/theme": ^3.0.0 "@pureadmin/utils": ^1.8.9 "@types/element-resize-detector": 1.1.3 @@ -60,7 +60,7 @@ specifiers: nprogress: ^0.2.0 path: ^0.12.7 picocolors: ^1.0.0 - pinia: ^2.0.35 + pinia: ^2.0.36 postcss: ^8.4.23 postcss-html: ^1.5.0 postcss-import: ^15.1.0 @@ -87,7 +87,7 @@ specifiers: stylelint-prettier: ^3.0.0 stylelint-scss: ^5.0.0 svgo: ^3.0.2 - swiper: ^9.2.4 + swiper: ^9.3.0 tailwindcss: ^3.3.2 terser: ^5.17.1 typeit: ^8.7.1 @@ -120,7 +120,7 @@ dependencies: "@logicflow/core": 1.2.5 "@logicflow/extension": 1.2.5 "@pureadmin/descriptions": 1.1.1_element-plus@2.3.4 - "@pureadmin/table": 2.0.0_element-plus@2.3.4 + "@pureadmin/table": 2.1.0_element-plus@2.3.4 "@pureadmin/utils": 1.8.9_echarts@5.4.2+vue@3.2.47 "@vueuse/core": 10.1.2_vue@3.2.47 "@vueuse/motion": 2.0.0-beta.12_vue@3.2.47 @@ -143,12 +143,12 @@ dependencies: mockjs: 1.1.0 nprogress: 0.2.0 path: 0.12.7 - pinia: 2.0.35_dtjfskxukdxv24psui2m5c75zy + pinia: 2.0.36_dtjfskxukdxv24psui2m5c75zy qrcode: 1.5.3 qs: 6.11.1 responsive-storage: 2.2.0 sortablejs: 1.15.0 - swiper: 9.2.4 + swiper: 9.3.0 typeit: 8.7.1 v-contextmenu: 3.0.0_vue@3.2.47 vue: 3.2.47 @@ -2495,10 +2495,10 @@ packages: vue: 3.2.47 dev: false - /@pureadmin/table/2.0.0_element-plus@2.3.4: + /@pureadmin/table/2.1.0_element-plus@2.3.4: resolution: { - integrity: sha512-B5+vniSskCOjXLbQA+quPtySoOdwrhQOV93ruSwaUUZvRXxbfro1C3tAhUk/xYSeg8CbGrjoKdXYtN+yGjn6YA== + integrity: sha512-svPWYqT/7XScfaM/LFYd1bXIq/kMbOeRQ/5pi79XvxtO4CyA9Y6uiFxQzW1m8rwPDGc2wfs5DiiayyS53Bdv9A== } peerDependencies: element-plus: ^2.0.0 @@ -9464,10 +9464,10 @@ packages: engines: { node: ">=0.10.0" } dev: true - /pinia/2.0.35_dtjfskxukdxv24psui2m5c75zy: + /pinia/2.0.36_dtjfskxukdxv24psui2m5c75zy: resolution: { - integrity: sha512-P1IKKQWhxGXiiZ3atOaNI75bYlFUbRxtJdhPLX059Z7+b9Z04rnTZdSY8Aph1LA+/4QEMAYHsTQ638Wfe+6K5g== + integrity: sha512-4UKApwjlmJH+VuHKgA+zQMddcCb3ezYnyewQ9NVrsDqZ/j9dMv5+rh+1r48whKNdpFkZAWVxhBp5ewYaYX9JcQ== } peerDependencies: "@vue/composition-api": ^1.4.0 @@ -11763,10 +11763,10 @@ packages: picocolors: 1.0.0 dev: true - /swiper/9.2.4: + /swiper/9.3.0: resolution: { - integrity: sha512-L7y3K/iiMXNYQ94FbfcJn7jex4QPnS4+voXGupTdC+UHW4XrR40QDdm4c9hXJ+Br0Il7PP0vP1W3goM9/Ly6Sg== + integrity: sha512-iELlQVvWLdyfUjQSfhg8UTKBvgfm3uCfv3wJ3f9wbSWP6spzoOTLcob87A8ywPS2FRc552JmrnyL5+LYfN8j9Q== } engines: { node: ">= 4.7.0" } dependencies: diff --git a/src/components/RePureTableBar/src/bar.tsx b/src/components/RePureTableBar/src/bar.tsx index 75bd67b1b..6f14627a0 100644 --- a/src/components/RePureTableBar/src/bar.tsx +++ b/src/components/RePureTableBar/src/bar.tsx @@ -1,5 +1,5 @@ -import { delay } from "@pureadmin/utils"; import { useEpThemeStoreHook } from "@/store/modules/epTheme"; +import { delay, getKeyList, cloneDeep } from "@pureadmin/utils"; import { defineComponent, ref, computed, type PropType } from "vue"; import ExpandIcon from "./svg/expand.svg?component"; import RefreshIcon from "./svg/refresh.svg?component"; @@ -15,6 +15,11 @@ const props = { /** 对于树形表格,如果想启用展开和折叠功能,传入当前表格的ref即可 */ tableRef: { type: Object as PropType + }, + /** 需要展示的列 */ + columns: { + type: Array as PropType, + default: () => [] } }; @@ -24,10 +29,14 @@ export default defineComponent({ emits: ["refresh"], setup(props, { emit, slots, attrs }) { const buttonRef = ref(); - const checkList = ref([]); const size = ref("default"); const isExpandAll = ref(true); const loading = ref(false); + const checkAll = ref(true); + const isIndeterminate = ref(false); + let checkColumnList = getKeyList(cloneDeep(props?.columns), "label"); + const checkedColumns = ref(checkColumnList); + const dynamicColumns = ref(cloneDeep(props?.columns)); const getDropdownItemStyle = computed(() => { return s => { @@ -50,6 +59,19 @@ export default defineComponent({ ]; }); + const topClass = computed(() => { + return [ + "flex", + "justify-between", + "pt-[3px]", + "px-[11px]", + "border-b-[1px]", + "border-solid", + "border-[#dcdfe6]", + "dark:border-[#303030]" + ]; + }); + function onReFresh() { loading.value = true; emit("refresh"); @@ -70,6 +92,33 @@ export default defineComponent({ }); } + function handleCheckAllChange(val: boolean) { + checkedColumns.value = val ? checkColumnList : []; + isIndeterminate.value = false; + dynamicColumns.value.map(column => + val ? (column.hide = false) : (column.hide = true) + ); + } + + function handleCheckedColumnsChange(value: string[]) { + const checkedCount = value.length; + checkAll.value = checkedCount === checkColumnList.length; + isIndeterminate.value = + checkedCount > 0 && checkedCount < checkColumnList.length; + } + + function handleCheckColumnListChange(val: boolean, index: number) { + dynamicColumns.value[index].hide = !val; + } + + function onReset() { + checkAll.value = true; + isIndeterminate.value = false; + checkColumnList = getKeyList(cloneDeep(props?.columns), "label"); + checkedColumns.value = checkColumnList; + dynamicColumns.value = cloneDeep(props?.columns); + } + const dropdown = { dropdown: () => ( @@ -150,11 +199,56 @@ export default defineComponent({ - - - - - + +
+ handleCheckAllChange(value)} + /> + onReset()}> + 重置 + +
+ +
+ handleCheckedColumnsChange(value)} + > + + {checkColumnList.map((item, index) => { + return ( + + handleCheckColumnListChange(value, index) + } + > + + {item} + + + ); + })} + + +
@@ -177,7 +271,10 @@ export default defineComponent({ content="列设置" /> - {slots.default({ size: size.value, checkList: checkList.value })} + {slots.default({ + size: size.value, + dynamicColumns: dynamicColumns.value + })} ); diff --git a/src/views/pure-table/high/page/index.vue b/src/views/pure-table/high/page/index.vue index 0ec700a83..b5e5c9f22 100644 --- a/src/views/pure-table/high/page/index.vue +++ b/src/views/pure-table/high/page/index.vue @@ -54,7 +54,7 @@ const { row-key="id" alignWhole="center" showOverflowTooltip - :size="tableSize" + :size="tableSize as any" :loading="loading" :loading-config="loadingConfig" :height="tableSize === 'small' ? 352 : 440" diff --git a/src/views/system/dept/hook.tsx b/src/views/system/dept/hook.tsx index eadc976ff..cb68f03e1 100644 --- a/src/views/system/dept/hook.tsx +++ b/src/views/system/dept/hook.tsx @@ -12,17 +12,10 @@ export function useDept() { const loading = ref(true); const columns: TableColumnList = [ - { - type: "selection", - width: 55, - align: "left", - hide: ({ checkList }) => !checkList.includes("勾选列") - }, { label: "序号", type: "index", - minWidth: 70, - hide: ({ checkList }) => !checkList.includes("序号列") + minWidth: 70 }, { label: "部门名称", diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 6bd4b1bc6..736260194 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -73,6 +73,7 @@ const { @@ -81,7 +82,7 @@ const { 新增部门 -