From b5df0404b6821cf31c2e9fabf996a808eaecb947 Mon Sep 17 00:00:00 2001 From: zhenghl Date: Sun, 4 Jan 2026 15:00:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=9A=E5=8A=A1=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=EF=BC=8C=E7=BB=8F=E8=90=A5=E5=BC=82=E5=B8=B8=E7=A7=BB?= =?UTF-8?q?=E5=87=BA=E5=92=8C=E4=B8=A5=E9=87=8D=E8=BF=9D=E6=B3=95=E7=A7=BB?= =?UTF-8?q?=E5=87=BA=EF=BC=8C=E5=88=86=E5=88=AB=E5=86=8D=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E2=80=9C=E7=BA=BF=E4=B8=8A=E7=94=B3=E8=AF=B7=E2=80=9D=E5=92=8C?= =?UTF-8?q?=E2=80=9C=E7=BA=BF=E4=B8=8B=E7=94=B3=E8=AF=B7=E2=80=9D=E7=9A=84?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/increpack.js | 61 +++++++++++++++++++ build/index.js | 35 +++++++++++ .../comprehensive/comprehensiveStatistics.vue | 60 ++++++++++-------- vue.config.js | 2 +- 4 files changed, 130 insertions(+), 28 deletions(-) create mode 100644 build/increpack.js create mode 100644 build/index.js diff --git a/build/increpack.js b/build/increpack.js new file mode 100644 index 0000000..ca70170 --- /dev/null +++ b/build/increpack.js @@ -0,0 +1,61 @@ +const path = require('path') +const fs = require('fs') +var compressing = require('compressing') +const axios = require('axios') +const child_process = require('child_process') + +function parseTime(time, format = 'yyyy-MM-dd hh:mm:ss') { + const date = time instanceof Date ? time : new Date(time) + + const o = { + 'M+': date.getMonth() + 1, // 月份 + 'd+': date.getDate(), // 日 + 'h+': date.getHours(), // 小时 + 'm+': date.getMinutes(), // 分 + 's+': date.getSeconds(), // 秒 + 'q+': Math.floor((date.getMonth() + 3) / 3), // 季度 + 'S': date.getMilliseconds() // 毫秒 + } + if (/(y+)/.test(format)) { + format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)) + } + for (const k in o) { + if (new RegExp('(' + k + ')').test(format)) { + format = format.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) + } + } + return format +} + +/** + * 打包插件 v2.0 + * youfool + */ +class IncrePack { + constructor(options) { + this.options = options + } + apply(compiler) { + const projectPath = path.join(__dirname, '../') + const distPath = projectPath + 'dist' + compiler.hooks.done.tap('IncrePack', async (compilation, callback) => { + // 排除开发环境 + if (process.env.ENV !== 'development') { + + const increName = `${this.options.name}.zip` + // 打包压缩 + const tempFile = projectPath + '/' + increName + compressing.zip.compressDir(distPath, tempFile, { ignoreBase: true }) + .then(() => { + // 剪切回dist目录下 + fs.renameSync(tempFile, distPath + '/' + increName) + console.log('------------------打包成功------------------') + }) + .catch(err => { + console.error(err) + }) + } + }) + } +} +module.exports = IncrePack diff --git a/build/index.js b/build/index.js new file mode 100644 index 0000000..0c57de2 --- /dev/null +++ b/build/index.js @@ -0,0 +1,35 @@ +const { run } = require('runjs') +const chalk = require('chalk') +const config = require('../vue.config.js') +const rawArgv = process.argv.slice(2) +const args = rawArgv.join(' ') + +if (process.env.npm_config_preview || rawArgv.includes('--preview')) { + const report = rawArgv.includes('--report') + + run(`vue-cli-service build ${args}`) + + const port = 9526 + const publicPath = config.publicPath + + var connect = require('connect') + var serveStatic = require('serve-static') + const app = connect() + + app.use( + publicPath, + serveStatic('./dist', { + index: ['index.html', '/'] + }) + ) + + app.listen(port, function () { + console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`)) + if (report) { + console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`)) + } + + }) +} else { + run(`vue-cli-service build ${args}`) +} diff --git a/src/views/comprehensive/comprehensiveStatistics.vue b/src/views/comprehensive/comprehensiveStatistics.vue index e2fa53d..39d4381 100644 --- a/src/views/comprehensive/comprehensiveStatistics.vue +++ b/src/views/comprehensive/comprehensiveStatistics.vue @@ -21,7 +21,7 @@
- 查询 + 查询
@@ -56,35 +56,41 @@ style="wdith:100%;border:1px solid #8CC3FB" :cell-style="{'text-align':'center'}" > - - - - - - + + + + + + + + + - - - - + + + + + + + - - - - + - - - - - - - - - + + + + + + + + + - - + + @@ -127,7 +133,7 @@ export default { } }, mounted() { - // this.search() //不做初始化查询 + // this.search() //不做初始化查询 }, methods: { tableRowClassName({ row, rowIndex }) { diff --git a/vue.config.js b/vue.config.js index d2ce1aa..4326faa 100644 --- a/vue.config.js +++ b/vue.config.js @@ -45,7 +45,7 @@ module.exports = { // 如果有多个mock请往里面继续添加 [process.env.VUE_APP_BASE_API]: { timeout: 60000, - target: `http://localhost:8086`, + target: `http://219.148.175.145:56666`, // target: `http://127.0.0.1:8090`, // target: `http://172.22.80.129`, changeOrigin: true