GP12报表分页优化

This commit is contained in:
2025-03-10 18:24:53 +08:00
parent 5717388e68
commit 81df92861e
3 changed files with 131 additions and 123 deletions

View File

@@ -5,7 +5,9 @@
"scripts": { "scripts": {
"dev": "vue-cli-service serve", "dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build", "build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging" "build:stage": "vue-cli-service build --mode staging",
"generateAnalyzFile": "webpack --profile --json stats.json",
"analyz": "webpack-bundle-analyzer --port 8888./dist/stats.json"
}, },
"husky": { "husky": {
"hooks": { "hooks": {
@@ -90,7 +92,8 @@
"stylus": "^0.54.5", "stylus": "^0.54.5",
"stylus-loader": "^3.0.2", "stylus-loader": "^3.0.2",
"svg-sprite-loader": "4.1.3", "svg-sprite-loader": "4.1.3",
"vue-template-compiler": "2.6.12" "vue-template-compiler": "2.6.12",
"webpack-bundle-analyzer": "^4.10.2"
}, },
"engines": { "engines": {
"node": ">=8.9", "node": ">=8.9",

View File

@@ -291,8 +291,8 @@ export default {
GetReviseList(this.queryParams).then(res => { GetReviseList(this.queryParams).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.allDataList = res.data.list; //this.allDataList = res.data.list;
this.dataList = Object.freeze(res.data.pageList.map(item => Object.freeze(item))) this.dataList = res.data.pageList;
this.total = res.data.total; this.total = res.data.total;
this.statistics = res.data.statistics; this.statistics = res.data.statistics;
this.mergeTable(3); this.mergeTable(3);

View File

@@ -3,130 +3,135 @@ const path = require('path')
const defaultSettings = require('./src/settings.js') const defaultSettings = require('./src/settings.js')
function resolve(dir) { function resolve(dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir)
} }
const name = defaultSettings.title // 标题 const name = defaultSettings.title // 标题
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions //官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
// 这里只列一部分,具体配置参考文档 // 这里只列一部分,具体配置参考文档
module.exports = { module.exports = {
css: { css: {
sourceMap: process.env.NODE_ENV == 'production' ? false : true, //开启css source maps功能前端可以看到css具体的行数 sourceMap: process.env.NODE_ENV == 'production' ? false : true, //开启css source maps功能前端可以看到css具体的行数
loaderOptions: { loaderOptions: {
sass: { sass: {
sassOptions: { outputStyle: 'expanded' }, sassOptions: { outputStyle: 'expanded' },
}, },
}, },
}, },
// 部署生产环境和开发环境下的URL。 // 部署生产环境和开发环境下的URL。
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上 // 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.baidu.com/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.baidu.com/admin/,则设置 baseUrl 为 /admin/。 // 例如 https://www.baidu.com/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.baidu.com/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.VUE_APP_ROUTER_PREFIX, publicPath: process.env.VUE_APP_ROUTER_PREFIX,
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist // 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: 'dist', outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir: 'static', assetsDir: 'static',
// 是否开启eslint保存检测有效值ture | false | 'error' // 是否开启eslint保存检测有效值ture | false | 'error'
lintOnSave: process.env.NODE_ENV === 'development', lintOnSave: process.env.NODE_ENV === 'development',
// 如果你不需要生产环境的 source map可以将其设置为 false 以加速生产环境构建。 // 如果你不需要生产环境的 source map可以将其设置为 false 以加速生产环境构建。
productionSourceMap: false, productionSourceMap: false,
// webpack-dev-server 相关配置 // webpack-dev-server 相关配置
devServer: { devServer: {
host: '0.0.0.0', //项目启动host host: '0.0.0.0', //项目启动host
port: 8887, // 项目启动port, port: 8887, // 项目启动port,
open: true, open: true,
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
// detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: {
[process.env.VUE_APP_BASE_API]: { target: 'http://localhost:8888', // 后端接口地址
target: 'http://localhost:8888', // 后端接口地址 // target: 'http://192.168.0.31:8888/', // 后端接口地址
// target: 'http://192.168.0.31:8888/', // 后端接口地址 changeOrigin: true,
changeOrigin: true, pathRewrite: {
pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '', //需要rewrite的
['^' + process.env.VUE_APP_BASE_API]: '', //需要rewrite的 },
}, },
},
msgHub: { msgHub: {
target: 'http://localhost:8888/msgHub', target: 'http://localhost:8888/msgHub',
// target: 'http://192.168.0.31:8888/msgHub', // target: 'http://192.168.0.31:8888/msgHub',
ws: true, ws: true,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^/msgHub']: '', //需要rewrite的 ['^/msgHub']: '', //需要rewrite的
}, },
}, },
},
disableHostCheck: true,
},
configureWebpack: {
name: name,
resolve: {
//设置路径别名,@代表根目录, @代表 src/文件夹
alias: {
'@': resolve('src'),
},
},
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: 'disabled', // 默认不自动启动
generateStatsFile: true, // 生成stats.json文件
statsFilename: 'stats.json',
}),
],
},
chainWebpack(config) {
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
//config.plugin('analyzer').use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
// set svg-sprite-loader
config.module.rule('svg').exclude.add(resolve('src/assets/icons')).end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/assets/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]',
})
.end()
}, config.when(process.env.NODE_ENV !== 'development', (config) => {
disableHostCheck: true, config
}, .plugin('ScriptExtHtmlWebpackPlugin')
configureWebpack: { .after('html')
name: name, .use('script-ext-html-webpack-plugin', [
resolve: { {
//设置路径别名,@代表根目录, @代表 src/文件夹 // `runtime` must same as runtimeChunk name. default is `runtime`
alias: { inline: /runtime\..*\.js$/,
'@': resolve('src'), },
}, ])
}, .end()
plugins: [], config.optimization.splitChunks({
}, chunks: 'all',
chainWebpack(config) { cacheGroups: {
config.plugins.delete('preload') // TODO: need test libs: {
config.plugins.delete('prefetch') // TODO: need test name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
// set svg-sprite-loader priority: 10,
config.module.rule('svg').exclude.add(resolve('src/assets/icons')).end() chunks: 'initial', // only package third parties that are initially dependent
config.module },
.rule('icons') elementUI: {
.test(/\.svg$/) name: 'chunk-elementUI', // split elementUI into a single package
.include.add(resolve('src/assets/icons')) priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
.end() test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
.use('svg-sprite-loader') },
.loader('svg-sprite-loader') commons: {
.options({ name: 'chunk-commons',
symbolId: 'icon-[name]', test: resolve('src/components'), // can customize your rules
}) minChunks: 3, // minimum common number
.end() priority: 5,
reuseExistingChunk: true,
config.when(process.env.NODE_ENV !== 'development', (config) => { },
config },
.plugin('ScriptExtHtmlWebpackPlugin') })
.after('html') config.optimization.runtimeChunk('single'),
.use('script-ext-html-webpack-plugin', [ {
{ from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
// `runtime` must same as runtimeChunk name. default is `runtime` to: './', //到根目录下
inline: /runtime\..*\.js$/, }
}, ]) })
.end() },
config.optimization.splitChunks({ }
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial', // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true,
},
},
})
config.optimization.runtimeChunk('single'),
{
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './', //到根目录下
}
})
},
}