减免审批流完善
This commit is contained in:
parent
bae3f46304
commit
35d3a53628
|
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||||
// 获取减免申请审核列表
|
// 获取减免申请审核列表
|
||||||
export function getReceiveApplyApi(query) {
|
export function getReceiveApplyApi(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/material/leaseTask/auditList',
|
url: '/material/derateRecordQuery/getAuditList',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
|
|
@ -25,10 +25,10 @@ export function getAuditingDetailsApi(query) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 减免申请审核提交接口
|
// 减免申请审核提交接口
|
||||||
export function submitAuditingApi(query) {
|
export function submitAuditingApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/material/ma_type/getMaTypeTreeSelect',
|
url: '/material/sysWorkflowRecordHistory/update',
|
||||||
method: 'get',
|
method: 'post',
|
||||||
params: query
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
<template slot="description">
|
<template slot="description">
|
||||||
<div class="custom-description">
|
<div class="custom-description">
|
||||||
<!-- {{ step.description }} -->
|
<!-- {{ step.description }} -->
|
||||||
|
审核结果:
|
||||||
<el-tag size="mini" type="primary" v-if="step.isAccept === 0">待审批</el-tag>
|
<el-tag size="mini" type="primary" v-if="step.isAccept === 0">待审批</el-tag>
|
||||||
<el-tag size="mini" type="success" v-if="step.isAccept === 1">已通过</el-tag>
|
<el-tag size="mini" type="success" v-if="step.isAccept === 1">已通过</el-tag>
|
||||||
<el-tag size="mini" type="danger" v-if="step.isAccept === 2">已驳回</el-tag>
|
<el-tag size="mini" type="danger" v-if="step.isAccept === 2">已驳回</el-tag>
|
||||||
|
|
@ -315,8 +315,15 @@ export default {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.custom-description {
|
||||||
|
padding: 8px 0 8px 20px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
.node-info {
|
.node-info {
|
||||||
padding: 6px 0;
|
// padding: 2px 0;
|
||||||
color: #ccc;
|
padding-left: 20px;
|
||||||
|
color: #666;
|
||||||
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -72,20 +72,9 @@
|
||||||
>
|
>
|
||||||
<!-- 插槽 -->
|
<!-- 插槽 -->
|
||||||
<template v-slot="scope" v-if="column.prop == 'taskStatus'">
|
<template v-slot="scope" v-if="column.prop == 'taskStatus'">
|
||||||
<el-tag v-if="scope.row.taskStatus == '0'" type="warning" size="mini" style="margin-right: 5px">
|
<el-tag v-if="scope.row.taskStatus == '0'" type="warning" size="mini">待审核</el-tag>
|
||||||
待审核
|
<el-tag v-else-if="scope.row.taskStatus == '1'" size="mini">审核中</el-tag>
|
||||||
</el-tag>
|
<el-tag v-else-if="scope.row.taskStatus == '2'" type="success" size="mini">已完成</el-tag>
|
||||||
<el-tag v-else-if="scope.row.taskStatus == '1'" size="mini" style="margin-right: 5px">
|
|
||||||
审核中
|
|
||||||
</el-tag>
|
|
||||||
<el-tag
|
|
||||||
v-else-if="scope.row.taskStatus == '2'"
|
|
||||||
type="success"
|
|
||||||
size="mini"
|
|
||||||
style="margin-right: 5px"
|
|
||||||
>
|
|
||||||
已完成
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- 操作 -->
|
<!-- 操作 -->
|
||||||
|
|
|
||||||
|
|
@ -93,17 +93,27 @@
|
||||||
<template slot="description">
|
<template slot="description">
|
||||||
<div class="custom-description">
|
<div class="custom-description">
|
||||||
<!-- {{ step.description }} -->
|
<!-- {{ step.description }} -->
|
||||||
|
审核结果:
|
||||||
<el-tag size="mini" type="primary" v-if="step.isAccept === 0">待审批</el-tag>
|
<el-tag size="mini" type="primary" v-if="step.isAccept === 0">待审批</el-tag>
|
||||||
<el-tag size="mini" type="success" v-if="step.isAccept === 1">已通过</el-tag>
|
<el-tag size="mini" type="success" v-if="step.isAccept === 1">已通过</el-tag>
|
||||||
<el-tag size="mini" type="danger" v-if="step.isAccept === 2">已驳回</el-tag>
|
<el-tag size="mini" type="danger" v-if="step.isAccept === 2">已驳回</el-tag>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="node-info" v-if="step.createTime">
|
||||||
|
审核时间:
|
||||||
|
{{ step.createTime }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="node-info" v-if="step.remark">
|
||||||
|
审核意见:
|
||||||
|
{{ step.remark }}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-step>
|
</el-step>
|
||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="auditing-container">
|
<div class="auditing-container" v-if="pagesType === 1">
|
||||||
<el-input
|
<el-input
|
||||||
type="textarea"
|
type="textarea"
|
||||||
v-model="auditingParams.remark"
|
v-model="auditingParams.remark"
|
||||||
|
|
@ -112,8 +122,8 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-row class="btn-container">
|
<el-row class="btn-container">
|
||||||
<el-button type="success" size="mini" @click="onSubmitPass">通过</el-button>
|
<el-button type="success" size="mini" @click="onHandleAuditing(1)">通过</el-button>
|
||||||
<el-button type="danger" size="mini" @click="onSubmitReject">驳回</el-button>
|
<el-button type="danger" size="mini" @click="onHandleAuditing(2)">驳回</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -151,24 +161,57 @@ export default {
|
||||||
remark: '', // 审核意见
|
remark: '', // 审核意见
|
||||||
typeId: '', // 当前审核记录中的 typeId
|
typeId: '', // 当前审核记录中的 typeId
|
||||||
taskId: '' // 外层列表的taskId
|
taskId: '' // 外层列表的taskId
|
||||||
}
|
},
|
||||||
|
pagesType: 1,
|
||||||
|
userId: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
// 判断当前路由页面是否有查询参数
|
// 判断当前路由页面是否有查询参数
|
||||||
if (this.$route.query) {
|
if (this.$route.query) {
|
||||||
const { id, taskId } = this.$route.query
|
const { id, taskId, type } = this.$route.query
|
||||||
|
this.pagesType = type
|
||||||
this.getLeaseTaskDetailFun(id, taskId)
|
this.getLeaseTaskDetailFun(id, taskId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.userId = sessionStorage.getItem('userId')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 通过
|
// 通过 或 驳回
|
||||||
onSubmitPass() {
|
async onHandleAuditing(type) {
|
||||||
// 组装参数
|
// 组装参数
|
||||||
const auditingParams = {}
|
const currentAuditing = this.auditingList.filter(e => e.configValues.includes(this.userId)) // 获取当前审核的节点
|
||||||
|
const currentIndex = this.auditingList.findIndex(e => e.configValues.includes(this.userId)) // 获取当前的索引
|
||||||
|
|
||||||
|
const { recordId, id, typeId, isAccept } = currentAuditing[0]
|
||||||
|
|
||||||
|
if (isAccept != 0) {
|
||||||
|
this.$modal.msgError('当前已审核,不可重复审核')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Object.assign(this.auditingParams, {
|
||||||
|
typeId,
|
||||||
|
recordId,
|
||||||
|
nodeId: id
|
||||||
|
})
|
||||||
|
this.auditingParams.isAccept = type
|
||||||
|
if (currentIndex !== this.auditingList.length - 1) {
|
||||||
|
this.auditingParams.nextNodeId = this.auditingList[currentIndex + 1].id
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await submitAuditingApi(this.auditingParams)
|
||||||
|
console.log(res, '提交结果')
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$modal.msgSuccess('审核成功')
|
||||||
|
setTimeout(() => {
|
||||||
|
const obj = { path: '/business-examine/reduction-apply' }
|
||||||
|
this.$tab.closeOpenPage(obj)
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(this.auditingParams, ' this.auditingParams组装好的参数')
|
||||||
},
|
},
|
||||||
// 驳回
|
|
||||||
onSubmitReject() {},
|
|
||||||
// 获取数据详情 和 审核记录详情
|
// 获取数据详情 和 审核记录详情
|
||||||
async getLeaseTaskDetailFun(id, taskId) {
|
async getLeaseTaskDetailFun(id, taskId) {
|
||||||
const { data: res } = await getDiscountViewList(id)
|
const { data: res } = await getDiscountViewList(id)
|
||||||
|
|
@ -298,4 +341,16 @@ export default {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.custom-description {
|
||||||
|
padding: 8px 0 8px 20px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-info {
|
||||||
|
// padding: 2px 0;
|
||||||
|
padding-left: 20px;
|
||||||
|
color: #666;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -107,18 +107,18 @@
|
||||||
type="text"
|
type="text"
|
||||||
size="mini"
|
size="mini"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleAuditing(scope.row)"
|
@click="handleAuditing(scope.row, 1)"
|
||||||
>
|
>
|
||||||
审核
|
审核
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
|
v-if="scope.row.taskStatus == 2"
|
||||||
type="text"
|
type="text"
|
||||||
size="mini"
|
size="mini"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-search"
|
||||||
style="color: #f56c6c"
|
@click="handleAuditing(scope.row, 2)"
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
>
|
>
|
||||||
删除
|
查看
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -366,6 +366,7 @@ import { downloadFile, downloadFileData } from '@/utils/download'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
import Treeselect from '@riophae/vue-treeselect'
|
import Treeselect from '@riophae/vue-treeselect'
|
||||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||||
|
import { getReceiveApplyApi } from '@/api/reduction-apply/index.js'
|
||||||
export default {
|
export default {
|
||||||
name: '',
|
name: '',
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -487,7 +488,7 @@ export default {
|
||||||
endTime: this.queryParams.time && this.queryParams.time[1]
|
endTime: this.queryParams.time && this.queryParams.time[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
getReliefRecordList(params).then(response => {
|
getReceiveApplyApi(params).then(response => {
|
||||||
this.total = response.total
|
this.total = response.total
|
||||||
this.formList = response.rows
|
this.formList = response.rows
|
||||||
// console.log('22222222',this.pushReviewList)
|
// console.log('22222222',this.pushReviewList)
|
||||||
|
|
@ -600,12 +601,13 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
//编辑
|
//编辑
|
||||||
handleAuditing(row) {
|
handleAuditing(row, type) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'reduction-apply',
|
name: 'reduction-apply',
|
||||||
query: {
|
query: {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
taskId: row.taskId
|
taskId: row.taskId,
|
||||||
|
type
|
||||||
}
|
}
|
||||||
}) // 跳转审核详情页面
|
}) // 跳转审核详情页面
|
||||||
// this.isView = false
|
// this.isView = false
|
||||||
|
|
|
||||||
|
|
@ -306,10 +306,10 @@ export default {
|
||||||
const isSortPass = this.dataList.findIndex(e => e.nodeSort === this.form.nodeSort)
|
const isSortPass = this.dataList.findIndex(e => e.nodeSort === this.form.nodeSort)
|
||||||
|
|
||||||
// 判断当前输入顺序是否存在
|
// 判断当前输入顺序是否存在
|
||||||
if (isSortPass > -1) {
|
// if (isSortPass > -1) {
|
||||||
this.$modal.msgError('当前输入的流程顺序已存在,请重新输入')
|
// this.$modal.msgError('当前输入的流程顺序已存在,请重新输入')
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
// 组装参数
|
// 组装参数
|
||||||
this.form.configValues = this.form.configValuesList.join(',')
|
this.form.configValues = this.form.configValuesList.join(',')
|
||||||
|
|
||||||
|
|
|
||||||
252
vue.config.js
252
vue.config.js
|
|
@ -2,7 +2,7 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
function resolve(dir) {
|
function resolve(dir) {
|
||||||
return path.join(__dirname, dir)
|
return path.join(__dirname, dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
const CompressionPlugin = require('compression-webpack-plugin')
|
const CompressionPlugin = require('compression-webpack-plugin')
|
||||||
|
|
@ -15,131 +15,131 @@ const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
||||||
//官方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 = {
|
||||||
// 部署生产环境和开发环境下的URL。
|
// 部署生产环境和开发环境下的URL。
|
||||||
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
||||||
// 例如 https://www.bonus.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.bonus.vip/admin/,则设置 baseUrl 为 /admin/。
|
// 例如 https://www.bonus.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.bonus.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||||
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
|
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
|
||||||
// 在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: '0.0.0.0',
|
||||||
port: port,
|
port: 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:18080`,
|
// target: `http://localhost:18080`,
|
||||||
// target: `http://192.168.0.15:18080`,//马
|
// target: `http://192.168.0.15:18080`,//马
|
||||||
// target: `http://192.168.0.244:18580`,//测试
|
// target: `http://192.168.0.244:18580`,//测试
|
||||||
// target: `http://192.168.2.223:18080`,//山
|
// target: `http://192.168.2.223:18080`,//山
|
||||||
// target: `http://192.168.2.23:18080`,//洪
|
// target: `http://192.168.2.23:18080`,//洪
|
||||||
// target: `http://192.168.0.234:18080`,//阮
|
target: `http://192.168.0.234:18080`, //阮
|
||||||
// target: `http://192.168.137.1:18080`,//
|
// target: `http://192.168.137.1:18080`,//
|
||||||
// target: `http://192.168.0.15:18080`,// 韩傲宇
|
// target: `http://192.168.0.15:18080`,// 韩傲宇
|
||||||
target: `http://192.168.2.209:18080`, // 赵福海
|
// target: `http://192.168.2.209:18080`, // 赵福海
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://192.168.0.21:17861',
|
target: 'http://192.168.0.21:17861',
|
||||||
//设置允许跨域——此处我经过测试发现可有可无
|
//设置允许跨域——此处我经过测试发现可有可无
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
'^/api': ''
|
'^/api': ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
disableHostCheck: true
|
||||||
},
|
},
|
||||||
disableHostCheck: true
|
css: {
|
||||||
},
|
loaderOptions: {
|
||||||
css: {
|
sass: {
|
||||||
loaderOptions: {
|
sassOptions: { outputStyle: 'expanded' }
|
||||||
sass: {
|
}
|
||||||
sassOptions: { outputStyle: 'expanded' }
|
}
|
||||||
}
|
},
|
||||||
|
configureWebpack: {
|
||||||
|
name: name,
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': resolve('src')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// http://doc.bonus.vip/bonus-vue/other/faq.html#使用gzip解压缩静态文件
|
||||||
|
new CompressionPlugin({
|
||||||
|
cache: false, // 不启用文件缓存
|
||||||
|
test: /\.(js|css|html|jpe?g|png|gif|svg)?$/i, // 压缩文件格式
|
||||||
|
filename: '[path][base].gz[query]', // 压缩后的文件名
|
||||||
|
algorithm: 'gzip', // 使用gzip压缩
|
||||||
|
minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩
|
||||||
|
deleteOriginalAssets: false // 压缩后删除原文件
|
||||||
|
})
|
||||||
|
]
|
||||||
|
},
|
||||||
|
chainWebpack(config) {
|
||||||
|
config.plugins.delete('preload') // TODO: need test
|
||||||
|
config.plugins.delete('prefetch') // TODO: need test
|
||||||
|
|
||||||
|
// 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 => {
|
||||||
|
config
|
||||||
|
.plugin('ScriptExtHtmlWebpackPlugin')
|
||||||
|
.after('html')
|
||||||
|
.use('script-ext-html-webpack-plugin', [
|
||||||
|
{
|
||||||
|
// `runtime` must same as runtimeChunk name. default is `runtime`
|
||||||
|
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
|
||||||
|
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
|
||||||
|
priority: 20 // the weight needs to be larger than libs and app or it will be packaged into libs or app
|
||||||
|
},
|
||||||
|
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')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
|
||||||
configureWebpack: {
|
|
||||||
name: name,
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
'@': resolve('src')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
// http://doc.bonus.vip/bonus-vue/other/faq.html#使用gzip解压缩静态文件
|
|
||||||
new CompressionPlugin({
|
|
||||||
cache: false, // 不启用文件缓存
|
|
||||||
test: /\.(js|css|html|jpe?g|png|gif|svg)?$/i, // 压缩文件格式
|
|
||||||
filename: '[path][base].gz[query]', // 压缩后的文件名
|
|
||||||
algorithm: 'gzip', // 使用gzip压缩
|
|
||||||
minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩
|
|
||||||
deleteOriginalAssets: false // 压缩后删除原文件
|
|
||||||
})
|
|
||||||
]
|
|
||||||
},
|
|
||||||
chainWebpack(config) {
|
|
||||||
config.plugins.delete('preload') // TODO: need test
|
|
||||||
config.plugins.delete('prefetch') // TODO: need test
|
|
||||||
|
|
||||||
// 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 => {
|
|
||||||
config
|
|
||||||
.plugin('ScriptExtHtmlWebpackPlugin')
|
|
||||||
.after('html')
|
|
||||||
.use('script-ext-html-webpack-plugin', [
|
|
||||||
{
|
|
||||||
// `runtime` must same as runtimeChunk name. default is `runtime`
|
|
||||||
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
|
|
||||||
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
|
|
||||||
priority: 20 // the weight needs to be larger than libs and app or it will be packaged into libs or app
|
|
||||||
},
|
|
||||||
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')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue