丽知中台报表更新

This commit is contained in:
hyt 2025-05-30 09:51:31 +08:00
parent c958c8d59c
commit 81bb8f55d8
7 changed files with 473 additions and 238 deletions

View File

@ -45,6 +45,8 @@ export default {
return data[3];
} else if (url.includes("ApplicationCenter")) {
return data[4];
}else if (url.includes("businessMatter")) {
return data[5];
} else {
return empty;
}

View File

@ -114,7 +114,9 @@ export default {
this.currentPath.includes("MasterDataCenter") ||
this.currentPath.includes("IntegrationTaskCenter") ||
this.currentPath.includes("businessCenter") ||
this.currentPath.includes("ApplicationCenter")
this.currentPath.includes("ApplicationCenter")||
this.currentPath.includes("businessMatter")
) {
route.meta.affix = true;
this.$store.dispatch("tagsView/addVisitedView", route);
@ -151,6 +153,7 @@ export default {
icon: "icon-gongzuotai",
show: true,
},
],
permissionsMenu: [
{
@ -177,6 +180,12 @@ export default {
icon: "el-icon-postcard",
show: false,
},
{
title: "会计事项平台",
path: "/businessMatter",
icon: "el-icon-postcard",
show: false,
},
],
};
},
@ -188,7 +197,8 @@ export default {
url.includes("MasterDataCenter") ||
url.includes("IntegrationTaskCenter") ||
url.includes("businessCenter") ||
url.includes("ApplicationCenter")
url.includes("ApplicationCenter") ||
url.includes("businessMatter")
) {
this.$store.dispatch("settings/changeSetting", {
key: "showTagsView",
@ -266,7 +276,8 @@ export default {
item.path.includes("MasterDataCenter") ||
item.path.includes("IntegrationTaskCenter") ||
item.path.includes("businessCenter") ||
item.path.includes("ApplicationCenter")
item.path.includes("ApplicationCenter") ||
item.path.includes("businessMatter")
) {
this.$store.dispatch("settings/changeSetting", {
key: "showTagsView",

View File

@ -53,13 +53,14 @@
</template>
<script>
import ScrollPane from "./ScrollPane";
import path from "path";
import { getCompanyId, getMenuNode } from "@/utils/auth";
import { ChangeCompany } from "@/api/apis/auth";
import ScrollPane from './ScrollPane'
import path from 'path'
import { getCompanyId, getMenuNode } from '@/utils/auth'
import { ChangeCompany } from '@/api/apis/auth'
export default {
components: {
ScrollPane,
ScrollPane
},
data() {
return {
@ -68,49 +69,49 @@ export default {
left: 0,
selectedTag: {},
affixTags: [],
visitedViews: [],
};
visitedViews: []
}
},
computed: {
routes() {
return this.$store.state.permission.routes;
return this.$store.state.permission.routes
},
theme() {
return this.$store.state.settings.theme;
return this.$store.state.settings.theme
},
companyID() {
return this.$store.state.user.companyID;
},
return this.$store.state.user.companyID
}
},
watch: {
"$store.getters.currentMenuNode": {
'$store.getters.currentMenuNode': {
deep: true,
immediate: true,
handler(newVal, old) {
this.visitedViews = this.getVisitedViews();
},
this.visitedViews = this.getVisitedViews()
}
},
$route() {
this.addTags();
this.moveToCurrentTag();
this.addTags()
this.moveToCurrentTag()
},
visible(value) {
if (value) {
document.body.addEventListener("click", this.closeMenu);
document.body.addEventListener('click', this.closeMenu)
} else {
document.body.removeEventListener("click", this.closeMenu);
document.body.removeEventListener('click', this.closeMenu)
}
},
companyID: {
deep: true, // true
handler: function(newV, oldV) {
if (newV) {
this.ChangeCompany(newV);
this.$vmNews("切换公司成功", "success");
this.closeAllTags(this.closeAllTags);
this.ChangeCompany(newV)
this.$vmNews('切换公司成功', 'success')
this.closeAllTags(this.closeAllTags)
}
}
}
},
},
},
mounted() {
// this.initTags();
@ -118,55 +119,57 @@ export default {
},
methods: {
getVisitedViews() {
let url = getMenuNode();
let currentData = [];
let data = this.$store.state.tagsView.visitedViews || [];
let url = getMenuNode()
let currentData = []
let data = this.$store.state.tagsView.visitedViews || []
if (url) {
if (url.includes("Workbench")) {
currentData = data[0];
} else if (url.includes("MasterDataCenter")) {
currentData = data[1];
} else if (url.includes("IntegrationTaskCenter")) {
currentData = data[2];
} else if (url.includes("businessCenter")) {
currentData = data[3];
} else if (url.includes("ApplicationCenter")) {
currentData = data[4];
if (url.includes('Workbench')) {
currentData = data[0]
} else if (url.includes('MasterDataCenter')) {
currentData = data[1]
} else if (url.includes('IntegrationTaskCenter')) {
currentData = data[2]
} else if (url.includes('businessCenter')) {
currentData = data[3]
} else if (url.includes('ApplicationCenter')) {
currentData = data[4]
} else if (url.includes('businessMatter')) {
currentData = data[5]
} else {
currentData = [];
currentData = []
}
} else {
currentData = [];
currentData = []
}
return currentData;
return currentData
},
async ChangeCompany(CompanyID) {
let params = {
CompanyID: CompanyID,
};
let res = await ChangeCompany(params);
CompanyID: CompanyID
}
let res = await ChangeCompany(params)
},
isActive(route) {
return route.path === this.$route.path;
return route.path === this.$route.path
},
activeStyle(tag) {
if (!this.isActive(tag)) return {};
if (!this.isActive(tag)) return {}
return {
"background-color": this.theme,
"border-color": this.theme,
};
'background-color': this.theme,
'border-color': this.theme
}
},
isAffix(tag) {
return tag.meta && tag.meta.affix;
return tag.meta && tag.meta.affix
},
isFirstView() {
try {
return (
this.selectedTag.fullPath === this.visitedViews[1].fullPath ||
this.selectedTag.fullPath === "/index"
);
this.selectedTag.fullPath === '/index'
)
} catch (err) {
return false;
return false
}
},
isLastView() {
@ -174,115 +177,119 @@ export default {
return (
this.selectedTag.fullPath ===
this.visitedViews[this.visitedViews.length - 1].fullPath
);
)
} catch (err) {
return false;
return false
}
},
filterAffixTags(routes, basePath = "/") {
let tags = [];
filterAffixTags(routes, basePath = '/') {
let tags = []
routes.forEach((route) => {
if (route.meta && route.meta.affix) {
const tagPath = path.resolve(basePath, route.path);
const tagPath = path.resolve(basePath, route.path)
tags.push({
fullPath: tagPath,
path: tagPath,
name: route.name,
id: route.id ? route.id : 0,
meta: {
...route.meta,
},
});
...route.meta
}
})
}
if (route.children) {
const tempTags = this.filterAffixTags(route.children, route.path);
const tempTags = this.filterAffixTags(route.children, route.path)
if (tempTags.length >= 1) {
tags = [...tags, ...tempTags];
tags = [...tags, ...tempTags]
}
}
});
return tags;
})
return tags
},
initTags() {
const affixTags = (this.affixTags = this.filterAffixTags(this.routes));
console.log(affixTags,"affixTags")
const affixTags = (this.affixTags = this.filterAffixTags(this.routes))
console.log(affixTags, 'affixTags')
for (const tag of affixTags) {
// Must have tag name
if (tag.name) {
this.$store.dispatch("tagsView/addVisitedView", tag);
this.$store.dispatch('tagsView/addVisitedView', tag)
}
}
},
addTags() {
const name = this.$route.meta.title;
const name = this.$route.meta.title
// this.$route.meta.noCache = false
if (name) {
this.$store.dispatch("tagsView/addView", this.$route);
this.$store.dispatch('tagsView/addView', this.$route)
if (this.$route.meta && this.$route.meta.link) {
this.$store.dispatch("tagsView/addIframeView", this.$route);
this.$store.dispatch('tagsView/addIframeView', this.$route)
}
}
return false;
return false
},
moveToCurrentTag() {
const tags = this.$refs.tag;
const tags = this.$refs.tag
this.$nextTick(() => {
for (const tag of tags) {
if (tag.to.path === this.$route.path) {
this.$refs.scrollPane.moveToTarget(tag);
this.$refs.scrollPane.moveToTarget(tag)
// when query is different then update
if (tag.to.fullPath !== this.$route.fullPath) {
this.$store.dispatch("tagsView/updateVisitedView", this.$route);
this.$store.dispatch('tagsView/updateVisitedView', this.$route)
}
break;
break
}
}
});
})
},
refreshSelectedTag(view) {
this.$tab.refreshPage(view);
this.$tab.refreshPage(view)
if (this.$route.meta && this.$route.meta.link) {
this.$store.dispatch("tagsView/delIframeView", this.$route);
this.$store.dispatch('tagsView/delIframeView', this.$route)
}
},
closeSelectedTag(view) {
this.$tab.closePage(view).then(({ visitedViews }) => {
let url = getMenuNode();
let currentData = [];
let data = visitedViews;
let url = getMenuNode()
let currentData = []
let data = visitedViews
if (url) {
if (url.includes("Workbench")) {
currentData = data[0];
} else if (url.includes("MasterDataCenter")) {
currentData = data[1];
} else if (url.includes("IntegrationTaskCenter")) {
currentData = data[2];
} else if (url.includes("businessCenter")) {
currentData = data[3];
} else if (url.includes("ApplicationCenter")) {
currentData = data[4];
if (url.includes('Workbench')) {
currentData = data[0]
} else if (url.includes('MasterDataCenter')) {
currentData = data[1]
} else if (url.includes('IntegrationTaskCenter')) {
currentData = data[2]
} else if (url.includes('businessCenter')) {
currentData = data[3]
} else if (url.includes('ApplicationCenter')) {
currentData = data[4]
} else if (url.includes('businessMatter')) {
currentData = data[5]
}
}
if (this.isActive(view)) {
this.toLastView(currentData, view);
this.toLastView(currentData, view)
}
});
})
},
closeRightTags() {
this.$tab.closeRightPage(this.selectedTag).then((visitedViews) => {
let url = getMenuNode();
let INDEX = null;
let url = getMenuNode()
let INDEX = null
if (url) {
if (url.includes("Workbench")) {
INDEX = 0;
} else if (url.includes("MasterDataCenter")) {
INDEX = 1;
} else if (url.includes("IntegrationTaskCenter")) {
INDEX = 2;
} else if (url.includes("businessCenter")) {
INDEX = 3;
} else if (url.includes("ApplicationCenter")) {
INDEX = 4;
if (url.includes('Workbench')) {
INDEX = 0
} else if (url.includes('MasterDataCenter')) {
INDEX = 1
} else if (url.includes('IntegrationTaskCenter')) {
INDEX = 2
} else if (url.includes('businessCenter')) {
INDEX = 3
} else if (url.includes('ApplicationCenter')) {
INDEX = 4
} else if (url.includes('businessMatter')) {
INDEX = 5
}
}
@ -292,27 +299,29 @@ export default {
(i) => i.fullPath === this.$route.fullPath
)
) {
this.toLastView(visitedViews[INDEX]);
this.toLastView(visitedViews[INDEX])
}
this.visitedViews = this.getVisitedViews();
this.visitedViews = this.getVisitedViews()
}
});
})
},
closeLeftTags() {
this.$tab.closeLeftPage(this.selectedTag).then((visitedViews) => {
let url = getMenuNode();
let INDEX = null;
let url = getMenuNode()
let INDEX = null
if (url) {
if (url.includes("Workbench")) {
INDEX = 0;
} else if (url.includes("MasterDataCenter")) {
INDEX = 1;
} else if (url.includes("IntegrationTaskCenter")) {
INDEX = 2;
} else if (url.includes("businessCenter")) {
INDEX = 3;
} else if (url.includes("ApplicationCenter")) {
INDEX = 4;
if (url.includes('Workbench')) {
INDEX = 0
} else if (url.includes('MasterDataCenter')) {
INDEX = 1
} else if (url.includes('IntegrationTaskCenter')) {
INDEX = 2
} else if (url.includes('businessCenter')) {
INDEX = 3
} else if (url.includes('ApplicationCenter')) {
INDEX = 4
} else if (url.includes('businessMatter')) {
INDEX = 5
}
}
if (INDEX != null) {
@ -321,91 +330,94 @@ export default {
(i) => i.fullPath === this.$route.fullPath
)
) {
this.toLastView(visitedViews[INDEX]);
this.toLastView(visitedViews[INDEX])
}
this.visitedViews = this.getVisitedViews();
this.visitedViews = this.getVisitedViews()
}
});
})
},
closeOthersTags() {
this.$router.push(this.selectedTag).catch(() => {});
this.$router.push(this.selectedTag).catch(() => {
})
this.$tab.closeOtherPage(this.selectedTag).then(() => {
this.moveToCurrentTag();
this.visitedViews = this.getVisitedViews();
});
this.moveToCurrentTag()
this.visitedViews = this.getVisitedViews()
})
},
closeAllTags(view) {
this.$tab.closeAllPage().then(({ visitedViews }) => {
let url = getMenuNode();
let INDEX = null;
let url = getMenuNode()
let INDEX = null
if (url) {
if (url.includes("Workbench")) {
INDEX = 0;
} else if (url.includes("MasterDataCenter")) {
INDEX = 1;
} else if (url.includes("IntegrationTaskCenter")) {
INDEX = 2;
} else if (url.includes("businessCenter")) {
INDEX = 3;
} else if (url.includes("ApplicationCenter")) {
INDEX = 4;
if (url.includes('Workbench')) {
INDEX = 0
} else if (url.includes('MasterDataCenter')) {
INDEX = 1
} else if (url.includes('IntegrationTaskCenter')) {
INDEX = 2
} else if (url.includes('businessCenter')) {
INDEX = 3
} else if (url.includes('ApplicationCenter')) {
INDEX = 4
} else if (url.includes('businessMatter')) {
INDEX = 5
}
}
if (INDEX != null) {
if (this.affixTags.some((tag) => tag.path === this.$route.path)) {
return;
return
}
this.toLastView(visitedViews[INDEX], view);
this.visitedViews = this.getVisitedViews();
this.toLastView(visitedViews[INDEX], view)
this.visitedViews = this.getVisitedViews()
}
});
})
},
toLastView(visitedViews, view) {
const latestView = visitedViews.slice(-1)[0];
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
this.$router.push(latestView.fullPath);
this.$router.push(latestView.fullPath)
} else {
// now the default is to redirect to the home page if there is no tags-view,
// you can adjust it according to your needs.
if (view.name === "Dashboard") {
if (view.name === 'Dashboard') {
// to reload home page
this.$router.replace({
path: "/redirect" + view.fullPath,
});
path: '/redirect' + view.fullPath
})
} else {
this.$router.push("/");
this.$router.push('/')
}
}
},
openMenu(tag, e) {
const menuMinWidth = 105;
const offsetLeft = this.$el.getBoundingClientRect().left; // container margin left
const offsetWidth = this.$el.offsetWidth; // container width
const maxLeft = offsetWidth - menuMinWidth; // left boundary
const left = e.clientX - offsetLeft + 15; // 15: margin right
const menuMinWidth = 105
const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
const offsetWidth = this.$el.offsetWidth // container width
const maxLeft = offsetWidth - menuMinWidth // left boundary
const left = e.clientX - offsetLeft + 15 // 15: margin right
if (left > maxLeft) {
this.left = maxLeft;
this.left = maxLeft
} else {
this.left = left;
this.left = left
}
if (this.newVersionSystem) {
this.top = e.clientY;
this.top = e.clientY
} else {
this.top = e.clientY - 40;
this.top = e.clientY - 40
}
this.visible = true;
this.selectedTag = tag;
this.visible = true
this.selectedTag = tag
},
closeMenu() {
this.visible = false;
this.visible = false
},
handleScroll() {
this.closeMenu();
},
},
};
this.closeMenu()
}
}
}
</script>
<style lang="scss" scoped>
@ -548,6 +560,7 @@ export default {
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
transform-origin: 100% 50%;
margin-right: 5px;
&:before {
// transform: scale(0.6);
display: inline-block;
@ -559,6 +572,7 @@ export default {
color: #fff;
}
}
.el-icon-close-else {
width: 16px;
height: 16px;

View File

@ -163,6 +163,15 @@ export const constantRoutes = [{
title: '业务中心',
icon: 'dashboard'
}
},
{
path: 'businessMatter',
component: () => import('@/views/newVersionView/businessMatter/index'),
name: 'businessMatter',
meta: {
title: '会计事项平台',
icon: 'dashboard'
}
}
]
},

View File

@ -6,6 +6,7 @@ const state = {
[],
[],
[],
[],
],
cachedViews: [
[],
@ -13,6 +14,7 @@ const state = {
[],
[],
[],
[],
],
iframeViews: [
[],
@ -20,7 +22,9 @@ const state = {
[],
[],
[],
]
[]
],
}
const mutations = {
@ -38,6 +42,10 @@ const mutations = {
Index = 3
} else if (url.includes("ApplicationCenter")) {
Index = 4
}else if (url.includes("businessMatter")) {
Index = 4
}else if (url.includes("businessMatter")) {
Index = 5;
}
}
if (Index != null) {
@ -63,6 +71,8 @@ const mutations = {
Index = 3
} else if (url.includes("ApplicationCenter")) {
Index = 4
}else if (url.includes("businessMatter")) {
Index = 5;
}
}
if (Index != null) {
@ -97,6 +107,8 @@ const mutations = {
Index = 3
} else if (url.includes("ApplicationCenter")) {
Index = 4
}else if (url.includes("businessMatter")) {
Index = 5;
}
}
if (Index != null) {
@ -120,6 +132,8 @@ const mutations = {
Index = 3
} else if (url.includes("ApplicationCenter")) {
Index = 4
}else if (url.includes("businessMatter")) {
Index = 5;
}
}
if (Index != null) {
@ -146,6 +160,8 @@ const mutations = {
Index = 3
} else if (url.includes("ApplicationCenter")) {
Index = 4
}else if (url.includes("businessMatter")) {
Index = 5;
}
}
if (Index != null) {
@ -167,6 +183,8 @@ const mutations = {
Index = 3
} else if (url.includes("ApplicationCenter")) {
Index = 4
}else if (url.includes("businessMatter")) {
Index = 5;
}
}
if (Index != null) {
@ -189,6 +207,8 @@ const mutations = {
Index = 3
} else if (url.includes("ApplicationCenter")) {
Index = 4
}else if (url.includes("businessMatter")) {
Index = 5;
}
}
if (Index != null) {
@ -212,6 +232,8 @@ const mutations = {
INDEX = 3
} else if (url.includes("ApplicationCenter")) {
INDEX = 4
}else if (url.includes("businessMatter")) {
Index = 5;
}
}
if (INDEX != null) {
@ -239,6 +261,8 @@ const mutations = {
INDEX = 3
} else if (url.includes("ApplicationCenter")) {
INDEX = 4
}else if (url.includes("businessMatter")) {
INDEX = 5;
}
}
if (INDEX != null) {
@ -261,6 +285,8 @@ const mutations = {
INDEX = 3
} else if (url.includes("ApplicationCenter")) {
INDEX = 4
}else if (url.includes("businessMatter")) {
INDEX = 5;
}
}
if (INDEX != null) {
@ -281,6 +307,8 @@ const mutations = {
INDEX = 3
} else if (url.includes("ApplicationCenter")) {
INDEX = 4
}else if (url.includes("businessMatter")) {
INDEX = 5;
}
}
if (INDEX != null) {
@ -301,6 +329,8 @@ const mutations = {
INDEX = 3
} else if (url.includes("ApplicationCenter")) {
INDEX = 4
}else if (url.includes("businessMatter")) {
INDEX = 5;
}
}
if (INDEX != null) {
@ -326,6 +356,8 @@ const mutations = {
INDEX = 3
} else if (url.includes("ApplicationCenter")) {
INDEX = 4
}else if (url.includes("businessMatter")) {
INDEX = 5;
}
}
if (INDEX != null) {
@ -364,6 +396,8 @@ const mutations = {
INDEX = 3
} else if (url.includes("ApplicationCenter")) {
INDEX = 4
}else if (url.includes("businessMatter")) {
INDEX = 5;
}
}
if (INDEX != null) {

View File

@ -0,0 +1,172 @@
/**
desc 业务中心
*/
<template>
<div class="workbench">
<h3 class="workbench-title">全部应用</h3>
<el-tabs>
<el-tab-pane
v-for="(item, index) in routeData"
:key="index"
:label="item.meta ? item.meta.title : ''"
v-if="item.meta"
>
<div class="menuContainer">
<div
v-for="(list, listIndex) in item.children"
class="menuBox"
@click="goRoute(item, list)"
v-if="!list.meta.hidden"
>
<img class="menuIcon" :src="list.meta.icon" v-if="list.meta.icon" />
<img class="menuIcon" src="../logo1.png" v-else />
<p class="menuContent">{{ list.meta.title }}</p>
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { TagsView } from "@/layout/components";
import request from "@/utils/request";
export default {
name: "ApplicationCenter",
components: {
TagsView,
},
created() {
this.$store.dispatch("settings/changeSetting", {
key: "showTagsView",
value: true,
});
},
data() {
return {
routeData: [], //
};
},
mounted() {
let routeList = localStorage.getItem("routeList")
? JSON.parse(localStorage.getItem("routeList"))
: [];
this.routeData = this.OrganizeMenus(routeList);
},
methods: {
goRoute(val, item) {
let routeData = this.$router.resolve({
path: item.path,
name: item.name,
query: { mdmCode: item.meta.mdmCode, viewType: item.meta.viewType },
});
window.open(routeData.href, "_self");
},
// icon
handlerIcon(item) {
let str = "";
if (item.includes("?")) {
str = item.split("?")[1];
} else {
str = item;
}
return str;
},
handlerIconColor(item) {
let color = "";
if (item.includes("?")) {
color = item.split("?")[0];
} else {
color = "#1478F6";
}
return color;
},
//
OrganizeMenus(data) {
let arrData = [];
//
let arrID = ["97c96223dc7747498328562f526a71a1"];
arrID.forEach((a) => {
data.forEach((b) => {
if (a === b.id) {
arrData.push(b);
}
});
});
arrData.forEach((bItem) => {
if (bItem.children && bItem.children.length > 0) {
bItem.children.forEach((cItem) => {
if (cItem.meta.icon) {
this.getLogoUrl(cItem.meta.icon).then((res) => {
let imageUrl =
"data:image/png/jpg;base64," +
btoa(
new Uint8Array(res).reduce(
(el, byte) => el + String.fromCharCode(byte),
""
)
);
this.$set(cItem.meta, "icon", imageUrl);
});
}
});
}
});
return arrData;
},
getLogoUrl(id) {
return request({
url:
"/kangarooDataCenterV3/entranceController/fileDownloadNew?id=" + id,
method: "get",
responseType: "arraybuffer",
}).then((res) => {
return res;
});
},
},
};
</script>
<style lang="scss" scoped>
.workbench {
background: #fff;
padding: 15px;
//margin: 0 10px;
}
.workbench-title {
margin: 15px 0;
}
.menuContainer {
display: flex;
flex-wrap: wrap;
background-color: #fff;
}
.menuBox {
display: flex;
align-items: center;
background: #fafafa;
padding: 10px 15px;
border-radius: 10px;
width: 200px;
margin: 10px;
cursor: pointer;
}
.menuIcon {
width: 36px;
height: 36px;
line-height: 36px;
border-radius: 12px;
margin-right: 10px;
}
.menuContent {
font-size: 14px;
color: #333333;
}
</style>

View File

@ -1,17 +1,17 @@
"use strict";
const path = require("path");
'use strict'
const path = require('path')
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')
const name = process.env.VUE_APP_TITLE || "用安数智中台"; // 网页标题
const name = process.env.VUE_APP_TITLE || '用安数智中台' // 网页标题
const port = process.env.port || process.env.npm_config_port || 80; // 端口
const port = process.env.port || process.env.npm_config_port || 80 // 端口
const webpack = require('webpack');
const webpack = require('webpack')
// vue.config.js 配置说明
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
@ -21,18 +21,18 @@ module.exports = {
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
// publicPath: process.env.NODE_ENV === "production" ? "/" : "./",
publicPath: "./",
publicPath: './',
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: "dist",
outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir: "webPc",
assetsDir: 'webPc',
// 是否开启eslint保存检测有效值ture | false | 'error'
lintOnSave: process.env.NODE_ENV === "development",
lintOnSave: process.env.NODE_ENV === 'development',
// 如果你不需要生产环境的 source map可以将其设置为 false 以加速生产环境构建。
productionSourceMap: false,
// webpack-dev-server 相关配置
devServer: {
host: "0.0.0.0",
host: '0.0.0.0',
// host:"localhost",z
port: port,
open: true,
@ -40,110 +40,103 @@ module.exports = {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
// target: `http://hzya.ufyct.com:9067/`,
target: `http://ufidahz.com.cn:9067/`,
// target: `http://127.0.0.1:9081/`,
// target: `http://192.168.2.78:9999`,
// target: `http://192.168.2.85:9999`,
target: `http://192.168.2.189:10086`,//一凡
// target: `http://192.168.2.78:8080`,
// target: `http://192.168.2.78:10086`,
// target: `http://192.168.2.185:10086`,
// target: `http://192.168.2.83:9999`,
// target:'http://39.170.109.90:8081/',
// target:'http://192.168.2.75:1024/',
changeOrigin: true,
pathRewrite: {
["^" + process.env.VUE_APP_BASE_API]: "",
['^' + process.env.VUE_APP_BASE_API]: ''
}
}
},
},
},
disableHostCheck: true,
disableHostCheck: true
},
css: {
loaderOptions: {
sass: {
sassOptions: { outputStyle: "expanded" },
},
},
sassOptions: { outputStyle: 'expanded' }
}
}
},
configureWebpack: {
name: name,
resolve: {
alias: {
"@": resolve("src"),
},
'@': resolve('src')
}
},
plugins: [
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
new CompressionPlugin({
cache: false, // 不启用文件缓存
test: /\.(js|css|html)?$/i, // 压缩文件格式
filename: "[path].gz[query]", // 压缩后的文件名
algorithm: "gzip", // 使用gzip压缩
minRatio: 0.8, // 压缩率小于1才会压缩
filename: '[path].gz[query]', // 压缩后的文件名
algorithm: 'gzip', // 使用gzip压缩
minRatio: 0.8 // 压缩率小于1才会压缩
}),
new webpack.ProvidePlugin({
'window.Quill': 'quill/dist/quill.js',
'Quill': 'quill/dist/quill.js'
})
],
]
},
chainWebpack(config) {
config.plugins.delete("preload"); // TODO: need test
config.plugins.delete("prefetch"); // TODO: need test
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('svg').exclude.add(resolve('src/assets/icons')).end()
config.module
.rule("icons")
.rule('icons')
.test(/\.svg$/)
.include.add(resolve("src/assets/icons"))
.include.add(resolve('src/assets/icons'))
.end()
.use("svg-sprite-loader")
.loader("svg-sprite-loader")
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: "icon-[name]",
symbolId: 'icon-[name]'
})
.end();
.end()
config.when(process.env.NODE_ENV !== "development", (config) => {
config.when(process.env.NODE_ENV !== 'development', (config) => {
config
.plugin("ScriptExtHtmlWebpackPlugin")
.after("html")
.use("script-ext-html-webpack-plugin", [
.plugin('ScriptExtHtmlWebpackPlugin')
.after('html')
.use('script-ext-html-webpack-plugin', [
{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/,
},
inline: /runtime\..*\.js$/
}
])
.end();
.end()
config.optimization.splitChunks({
chunks: "all",
chunks: 'all',
cacheGroups: {
libs: {
name: "chunk-libs",
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: "initial", // only package third parties that are initially dependent
chunks: 'initial' // only package third parties that are initially dependent
},
elementUI: {
name: "chunk-elementUI", // split elementUI into a single package
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
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
},
commons: {
name: "chunk-commons",
test: resolve("src/components"), // can customize your rules
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true,
},
},
});
config.optimization.runtimeChunk("single"),
reuseExistingChunk: true
}
}
})
config.optimization.runtimeChunk('single'),
{
from: path.resolve(__dirname, "./public/robots.txt"), //防爬虫文件
to: "./", //到根目录下
};
});
},
};
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './' //到根目录下
}
})
}
}