Commit 927fb4e2 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 19bb4439 bfc44957
......@@ -54,6 +54,7 @@
"babel-eslint": "^10.1.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-polyfill": "^6.26.0",
"cache-loader": "^4.1.0",
"compression-webpack-plugin": "^2.0.0",
"deepmerge": "^4.2.2",
"eslint": "^6.7.2",
......
<template>
<a-upload
list-type="text"
class="file-uploader"
:show-upload-list="false"
:action="action"
:headers="headers"
@change="fileChange"
>
<slot>
<div>导入</div>
</slot>
</a-upload>
<a-upload
list-type="text"
class="file-uploader"
:show-upload-list="false"
:action="action"
:headers="headers"
@change="fileChange"
>
<slot>
<div>导入</div>
</slot>
</a-upload>
</template>
<script>
import {mapMutations} from "vuex"
import {getCookie} from "@/utils/request"
import { mapMutations } from "vuex";
// import {getCookie} from "@/utils/request"
export default {
props:{
action:String
props: {
action: String,
},
data() {
return {
headers: "",
};
},
methods: {
...mapMutations("fileloading", ["settip", "setspinning"]),
/**
* 导入文件监听
*/
fileChange(info) {
if (info.file.status === "uploading") {
this.settip("文件导入中...");
this.setspinning(true);
return;
}
if (info.file.status === "error") {
this.$message.error("导入失败");
}
if (info.file.status === "done") {
this.$message("导入成功");
// 导出成功
this.$emit("success", "addfile");
}
this.setspinning(false);
this.settip("加载中...");
},
data(){
return{
headers:getCookie()
}
},
methods:{
...mapMutations('fileloading',['settip','setspinning']),
/**
* 导入文件监听
*/
fileChange(info){
if (info.file.status === 'uploading') {
this.settip('文件导入中...')
this.setspinning(true)
return;
}
if (info.file.status === 'error') {
this.$message.error("导入失败")
}
if (info.file.status === 'done') {
this.$message("导入成功")
// 导出成功
this.$emit("success",'addfile')
}
this.setspinning(false)
this.settip('加载中...')
}
}
}
},
};
</script>
<style lang="less" scoped>
</style>
\ No newline at end of file
......@@ -93,7 +93,7 @@ export default {
},
},
created() {
this.loadCacheConfig(this.$router?.options?.routes);
// this.loadCacheConfig(this.$router?.options?.routes);
this.loadCachedTabs();
const route = this.$route;
if (this.pageList.findIndex((item) => item.path === route.path) === -1) {
......@@ -115,10 +115,10 @@ export default {
this.correctPageMinHeight(this.tabsOffset);
},
watch: {
"$router.options.routes": function (val) {
this.excludeKeys = [];
this.loadCacheConfig(val);
},
// "$router.options.routes": function (val) {
// this.excludeKeys = [];
// this.loadCacheConfig(val);
// },
$route: function (newRoute) {
this.activePage = newRoute.path;
const page = this.pageList.find((item) => item.path === newRoute.path);
......@@ -364,17 +364,18 @@ export default {
}
}
},
loadCacheConfig(routes, pCache = true) {
routes.forEach((item) => {
const cacheAble = item.meta?.page?.cacheAble ?? pCache ?? true;
if (!cacheAble) {
this.excludeKeys.push(new RegExp(`${item.path}\\d+$`));
}
if (item.children) {
this.loadCacheConfig(item.children, cacheAble);
}
});
},
// loadCacheConfig(routes, pCache = true) {
// routes.forEach((item) => {
// const cacheAble = item.meta?.page?.cacheAble ?? pCache ?? true;
// if (!cacheAble) {
// this.excludeKeys.push(new RegExp(`${item.path}\\d+$`));
// }
// console.log(this.excludeKeys);
// if (item.children) {
// this.loadCacheConfig(item.children, cacheAble);
// }
// });
// },
...mapMutations("setting", ["correctPageMinHeight"]),
},
};
......
......@@ -63,21 +63,17 @@
</span>
</template>
<!-- 部门 -->
<template slot="belongDept" slot-scope="text">
{{ text.belongDept ? text.belongDept : "--" }}
<template slot="deptCode" slot-scope="text">
{{ text.deptCode ? text.deptCode : "--" }}
</template>
<!-- 到现场次数 -->
<template slot="num" slot-scope="text">
<span
v-if="text.windowToTheSceneNum && text.windowToTheSceneNum != ''"
>{{ text.windowToTheSceneNum }}</span
>
<span
v-else-if="
text.onlineToTheSceneNum && text.onlineToTheSceneNum != ''
"
>{{ text.onlineToTheSceneNum }}</span
>
<span v-if="text.windowToTheSceneNum">{{
text.windowToTheSceneNum
}}</span>
<span v-else-if="text.onlineToTheSceneNum">{{
text.onlineToTheSceneNum
}}</span>
<span v-else>--</span>
</template>
<!-- 操作 -->
......@@ -152,8 +148,8 @@
</span>
</template>
<!-- 部门 -->
<template slot="belongDept" slot-scope="text">
{{ text.belongDept ? text.belongDept : "--" }}
<template slot="deptCode" slot-scope="text">
{{ text.deptCode ? text.deptCode : "--" }}
</template>
<template slot="action" slot-scope="text">
<a href="javascript:;" class="jion" @click="handleIn(text.id)"
......@@ -204,10 +200,10 @@ const leftColumns = [
scopedSlots: { customRender: "index" },
},
{
title: "部门",
title: "部门编号",
width: "20%",
scopedSlots: {
customRender: "belongDept",
customRender: "deptCode",
},
},
{
......@@ -239,10 +235,10 @@ const rightColumns = [
scopedSlots: { customRender: "num" },
},
{
title: "部门",
title: "部门编号",
width: "20%",
scopedSlots: {
customRender: "belongDept",
customRender: "deptCode",
},
},
{
......
......@@ -105,8 +105,8 @@
</span>
</template>
<!-- 部门 -->
<template slot="belongDept" slot-scope="text">
{{ text.belongDept ? text.belongDept : "--" }}
<template slot="deptCode" slot-scope="text">
{{ text.deptCode ? text.deptCode : "--" }}
</template>
<template slot="action" slot-scope="text">
<a href="javascript:;" class="jion" @click="handleIn(text)">关联</a>
......@@ -281,10 +281,10 @@ const rightColumns = [
scopedSlots: { customRender: "num" },
},
{
title: "部门",
title: "部门编号",
width: "20%",
scopedSlots: {
customRender: "belongDept",
customRender: "deptCode",
},
},
{
......
......@@ -428,7 +428,6 @@ export default {
}
})
.flat();
console.log(data);
this.business = this.delChildren(this.business);
},
// 新增部门
......
This diff is collapsed.
let path = require('path')
const webpack = require('webpack')
const ThemeColorReplacer = require('webpack-theme-color-replacer')
const {getThemeColors, modifyVars} = require('./src/utils/themeUtil')
const {resolveCss} = require('./src/utils/theme-color-replacer-extend')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
let path = require("path");
const webpack = require("webpack");
const ThemeColorReplacer = require("webpack-theme-color-replacer");
const { getThemeColors, modifyVars } = require("./src/utils/themeUtil");
const { resolveCss } = require("./src/utils/theme-color-replacer-extend");
const CompressionWebpackPlugin = require("compression-webpack-plugin");
const productionGzipExtensions = ['js', 'css']
const isProd = process.env.NODE_ENV === 'production'
const productionGzipExtensions = ["js", "css"];
const isProd = process.env.NODE_ENV === "production";
const assetsCDN = {
// webpack build externals
......@@ -20,79 +20,80 @@ const assetsCDN = {
// '@antv/data-set': 'DataSet',
// 'js-cookie': 'Cookies'
// },
css: [
],
css: [],
js: [
'//cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js',
'//cdn.jsdelivr.net/npm/vue-router@3.3.4/dist/vue-router.min.js',
'//cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.min.js',
'//cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js',
'//cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js',
'//cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js',
'//cdn.jsdelivr.net/npm/@antv/data-set@0.11.4/build/data-set.min.js',
'//cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js'
]
}
"//cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js",
"//cdn.jsdelivr.net/npm/vue-router@3.3.4/dist/vue-router.min.js",
"//cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.min.js",
"//cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js",
"//cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js",
"//cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js",
"//cdn.jsdelivr.net/npm/@antv/data-set@0.11.4/build/data-set.min.js",
"//cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js",
],
};
module.exports = {
devServer: {
disableHostCheck: true,
port:8080,
port: 8080,
proxy: {
'/api': { //此处要与 /services/api.js 中的 API_PROXY_PREFIX 值保持一致
"/api": {
//此处要与 /services/api.js 中的 API_PROXY_PREFIX 值保持一致
target: process.env.VUE_APP_API_BASE_URL,
changeOrigin: true,
pathRewrite: {
'^/api': ''
"^/api": "",
},
// cookieDomainRewrite: 'localhost',
}
}
},
},
},
pluginOptions: {
'style-resources-loader': {
preProcessor: 'less',
"style-resources-loader": {
preProcessor: "less",
patterns: [path.resolve(__dirname, "./src/theme/theme.less")],
}
},
},
configureWebpack: config => {
configureWebpack: (config) => {
config.entry.app = ["babel-polyfill", "whatwg-fetch", "./src/main.js"];
config.performance = {
hints: false
}
hints: false,
};
config.plugins.push(
new ThemeColorReplacer({
fileName: 'css/theme-colors-[contenthash:8].css',
fileName: "css/theme-colors-[contenthash:8].css",
matchColors: getThemeColors(),
injectCss: true,
resolveCss
resolveCss,
})
)
);
// Ignore all locale files of moment.js
// config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
// 生产环境下将资源压缩成gzip格式
if (isProd) {
// add `CompressionWebpack` plugin to webpack plugins
config.plugins.push(new CompressionWebpackPlugin({
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
}))
config.plugins.push(
new CompressionWebpackPlugin({
algorithm: "gzip",
test: new RegExp("\\.(" + productionGzipExtensions.join("|") + ")$"),
threshold: 10240,
minRatio: 0.8,
})
);
}
// if prod, add externals
if (isProd) {
config.externals = assetsCDN.externals
config.externals = assetsCDN.externals;
}
},
chainWebpack: config => {
chainWebpack: (config) => {
// 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
if (isProd) {
config.plugin('optimize-css')
.tap(args => {
args[0].cssnanoOptions.preset[1].colormin = false
return args
})
config.plugin("optimize-css").tap((args) => {
args[0].cssnanoOptions.preset[1].colormin = false;
return args;
});
}
// 生产环境下使用CDN
// if (isProd) {
......@@ -108,14 +109,14 @@ module.exports = {
less: {
lessOptions: {
modifyVars: modifyVars(),
javascriptEnabled: true
}
}
}
javascriptEnabled: true,
},
},
},
},
publicPath: './',
publicPath: "./",
// publicPath: process.env.VUE_APP_PUBLIC_PATH,
outputDir: 'dist',
assetsDir: 'static',
productionSourceMap: false
}
outputDir: "dist",
assetsDir: "static",
productionSourceMap: false,
};
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment