diff --git a/snowy-admin-web/package.json b/snowy-admin-web/package.json index 1fdb8073..02670749 100644 --- a/snowy-admin-web/package.json +++ b/snowy-admin-web/package.json @@ -17,63 +17,66 @@ "prod": "vite --mode production" }, "dependencies": { - "@ant-design/colors": "4.0.1", - "@ant-design/icons-vue": "^6.0.1", + "@ant-design/colors": "6.0.0", + "@ant-design/icons-vue": "^6.1.0", "@antv/g2plot": "^2.4.10", - "@chenfengyuan/vue-qrcode": "2", + "@chenfengyuan/vue-qrcode": "2.0.0", "@highlightjs/vue-plugin": "^2.1.0", - "@tinymce/tinymce-vue": "4.0.5", - "ant-design-vue": "3.2.10", - "axios": "0.24.0", + "@tinymce/tinymce-vue": "5.0.0", + "ant-design-vue": "3.2.13", + "axios": "1.1.3", + "core-js": "^3.26.0", "cropperjs": "1.5.12", - "dayjs": "^1.11.5", - "echarts": "5.2.2", + "dayjs": "^1.11.6", + "echarts": "^5.4.0", "echarts-stat": "^1.2.0", "enquire.js": "^2.1.6", + "fuse.js": "^6.6.2", "highlight.js": "^11.6.0", + "hotkeys-js": "^3.10.0", + "js-pinyin": "^0.1.9", "lodash-es": "^4.17.21", "nprogress": "0.2.0", "screenfull": "^6.0.2", "sm-crypto": "^0.3.11", "snowflake-id": "^1.1.0", - "sortablejs": "1.14.0", - "tinymce": "5.10.2", - "vue": "3.2.31", + "sortablejs": "^1.15.0", + "tinymce": "^6.2.0", + "vue": "3.2.41", "vue-cropper": "^1.0.1", - "vue-i18n": "^9.1.10", - "vue-router": "4.0.12", + "vue-i18n": "^9.2.2", + "vue-router": "^4.1.6", "vue3-colorpicker": "^2.0.4", - "vue3-tree-org": "^3.1.6", - "vuedraggable-es": "4.1.0", - "vuex": "4.0.2" + "vue3-tree-org": "^4.1.1", + "vuedraggable-es": "^4.1.1", + "vuex": "^4.1.0" }, "devDependencies": { - "@antfu/eslint-config": "^0.29.2", - "@antfu/utils": "0.6.0", + "@antfu/eslint-config": "^0.29.3", + "@babel/eslint-parser": "^7.19.1", "@vitejs/plugin-legacy": "^1.6.4", "@vitejs/plugin-vue": "^2.1.0", "@vitejs/plugin-vue-jsx": "^1.3.8", - "@vue/compiler-sfc": "^3.2.31", - "@vue/eslint-config-standard": "^4.0.0", - "antd-dayjs-vite-plugin": "^1.2.2", + "@vue/compiler-sfc": "^3.2.41", + "@vue/eslint-config-standard": "^8.0.1", "antd-less-to-css-variable": "^1.0.5", - "autoprefixer": "^10.4.2", - "babel-eslint": "10.1.0", - "eslint": "^7.11.0", + "autoprefixer": "^10.4.13", + "eslint": "^8.26.0", "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-vue": "^9.1.1", - "less": "^4.1.2", - "postcss": "^8.4.7", - "prettier": "^2.4.1", - "rollup-plugin-visualizer": "^5.7.1", - "tailwindcss": "^3.0.23", - "typescript": "^4.5.5", - "unplugin-auto-import": "^0.11.1", - "unplugin-vue-components": "^0.17.14", + "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-vue": "^9.7.0", + "less": "^4.1.3", + "postcss": "^8.4.18", + "prettier": "^2.7.1", + "rollup-plugin-visualizer": "^5.8.3", + "tailwindcss": "^3.2.1", + "typescript": "^4.8.4", + "unplugin-auto-import": "^0.11.4", + "unplugin-vue-components": "^0.22.9", "vite": "2.8.6", + "vite-plugin-compression": "^0.5.1", "vite-plugin-vue-setup-extend": "^0.4.0", - "vue-eslint-parser": "^9.0.3" + "vue-eslint-parser": "^9.1.0" }, "browserslist": [ "> 1%", diff --git a/snowy-admin-web/src/App.vue b/snowy-admin-web/src/App.vue index 91f18bdf..8822efca 100644 --- a/snowy-admin-web/src/App.vue +++ b/snowy-admin-web/src/App.vue @@ -8,22 +8,21 @@ import i18n from '@/locales' import store from '@/store' import config from '@/config' - import configApi from '@/api/dev/configApi' - import { message } from 'ant-design-vue' import tool from '@/utils/tool' store.commit('initTheme') const locale = i18n.global.messages[i18n.global.locale].lang - - let formData = ref(config.SYS_BASE_CONFIG) - configApi.configSysBaseList().then((data) => { - if (data) { - data.forEach((item) => { - formData.value[item.configKey] = item.configValue - }) - tool.data.set('SNOWY_SYS_BASE_CONFIG', formData.value) - store.commit('SET_sysBaseConfig', formData.value) - } - }) + if (!tool.data.get('SNOWY_SYS_BASE_CONFIG')) { + let formData = ref(config.SYS_BASE_CONFIG) + configApi.configSysBaseList().then((data) => { + if (data) { + data.forEach((item) => { + formData.value[item.configKey] = item.configValue + }) + tool.data.set('SNOWY_SYS_BASE_CONFIG', formData.value) + store.commit('SET_sysBaseConfig', formData.value) + } + }) + } diff --git a/snowy-admin-web/src/components/Table/index.vue b/snowy-admin-web/src/components/Table/index.vue index 5d11336e..d66aa7ae 100644 --- a/snowy-admin-web/src/components/Table/index.vue +++ b/snowy-admin-web/src/components/Table/index.vue @@ -13,10 +13,8 @@ data() { return { needTotalList: [], - selectedRows: [], selectedRowKeys: [], - localLoading: false, localDataSource: [], localPagination: Object.assign({}, this.pagination), @@ -44,7 +42,7 @@ default: 1 }, size: { - // type: Number, + type: String, default: '10' }, showSizeChanger: { @@ -140,7 +138,7 @@ size: this.size, //this.compSize, size// 改动 showSizeChanger: this.showSizeChanger, showTotal: (total, range) => { - return `${range[0]}-${range[1]}共${total}条` + return `${range[0]}-${range[1]} 共 ${total} 条 ` } })) || false @@ -155,14 +153,9 @@ * @param bool Boolean */ refresh(bool = false) { - bool && - (this.localPagination = Object.assign( - {}, - { - current: 1, - size: this.size - } - )) + bool && (this.localPagination = Object.assign({}, { + current: 1, size: this.size + })) this.loadData() }, /** @@ -173,30 +166,22 @@ */ loadData(pagination, filters, sorter) { this.localLoading = true - const parameter = Object.assign( - { - current: - (pagination && pagination.current) || - (this.showPagination && this.localPagination.current) || - this.pageNum, - size: (pagination && pagination.pageSize) || (this.showPagination && this.localPagination.size) || this.size + const parameter = Object.assign({ + current: (pagination && pagination.current) || + this.showPagination && this.localPagination.current || this.pageNum, + size: (pagination && pagination.pageSize) || + this.showPagination && this.localPagination.pageSize || this.pageSize }, - (sorter && - sorter.field && { - sortField: sorter.field - }) || - {}, - (sorter && - sorter.order && { - sortOrder: sorter.order - }) || - {}, - { + (sorter && sorter.field && { + sortField: sorter.field + }) || {}, + (sorter && sorter.order && { + sortOrder: sorter.order + }) || {}, { ...filters } ) const result = this.data(parameter) - // 对接自己的通用数据接口需要修改下方代码中的 r.current, r.totalCount, r.data // eslint-disable-next-line if ( (typeof result === 'object' || typeof result === 'function') && @@ -213,6 +198,9 @@ current: r.current, // pageNo, // 返回结果中的当前分页数 total: r.total, // totalRows, // 返回结果中的总记录数 showSizeChanger: this.showSizeChanger, + showTotal: (total, range) => { + return `${range[0]}-${range[1]} 共 ${total} 条 ` + }, size: (pagination && pagination.size) || this.localPagination.size })) || false @@ -226,11 +214,14 @@ this.loadData() return } - - // 这里用于判断接口是否有返回 r.totalCount(total) 且 this.showPagination = true 且 current 和 size 存在 且 totalCount 小于等于 current * size 的大小 // 当情况满足时,表示数据不满足分页大小,关闭 table 分页功能 try { - if (['auto', true].includes(this.showPagination) && r.total <= r.pages * this.localPagination.size) { + /* + if ((['auto', true].includes(this.showPagination) && r.total <= (r.pages * this.localPagination.size))) { + this.localPagination.hideOnSinglePage = true + } + */ + if (!this.showPagination) { this.localPagination.hideOnSinglePage = true } } catch (e) { @@ -238,8 +229,11 @@ } // 返回结果中的数组数据 if (this.showPagination === false) { - // 因为按住小诺的套路,不分页的直接是在data中,我们在界面中直接就是返回了data - this.localDataSource = r + // 既然配置了不分页,那么我们这里接收到肯定是数组 + this.localDataSource = [] + if (r instanceof Array) { + this.localDataSource = r + } } else { this.localDataSource = r.records } @@ -321,7 +315,7 @@ const needTotalItems = this.needTotalList.map((item) => { return ( - {item.title}总计{' '} + {item.title} 总计 {' '} {!item.customRender ? item.total : item.customRender(item.total)} ) @@ -400,24 +394,23 @@ } // 斑马纹 - const changeRowClass = (val) => { + const changeRowClass = (value) => { + const val = value.target.checked this.localSettings.rowClassNameSwitch = val const evenClass = val ? (_record, index) => (index % 2 === 1 ? 'table-striped' : null) : this.rowClassName this.localSettings.rowClassName = evenClass } - return (