zhanbo.xu

feat: 优化代码

......@@ -5,8 +5,10 @@ VUE_APP_BASE_ENV = "dev"
VUE_APP_Version = '1.0.0'
VUE_APP_BASE_URL = 'http://101.132.100.41:7008/EcomExp'
# FedEx 在线申报工具/开发环境
VUE_APP_BASE_API = 'http://101.132.100.41:7008/EcomExp'
# http://101.132.100.41:7001/EcomExp
VUE_APP_BASE_API = /EcomExp
VUE_APP_BASE_ROUTE = '/EcomDev'
......
......@@ -103,7 +103,9 @@ export default {
//弹框关闭
popoverClose() {
this.$emit("popoverClose");
this.parentDom.$refs.tables.$refs.bodyWrapper.style.overflowY = "auto";
if (this.parentDom.$refs.tables) {
this.parentDom.$refs.tables.$refs.bodyWrapper.style.overflowY = "auto";
}
this.$store.dispatch("setLoadingState", true);
},
//弹框状态改版
......@@ -123,12 +125,16 @@ export default {
);
}
});
if (!data[`${type}PopoverType`]) {
this.parentDom.$refs.tables.$refs.bodyWrapper.style.overflowY =
"hidden";
} else {
this.parentDom.$refs.tables.$refs.bodyWrapper.style.overflowY = "auto";
if (this.parentDom.$refs.tables) {
if (!data[`${type}PopoverType`]) {
this.parentDom.$refs.tables.$refs.bodyWrapper.style.overflowY =
"hidden";
} else {
this.parentDom.$refs.tables.$refs.bodyWrapper.style.overflowY =
"auto";
}
}
this.$emit("popoverChange", {
tableData: arr,
data: data,
......
......@@ -998,9 +998,10 @@ export default {
}
},
mapCurrencyDatas(dicArr, code) {
if (code != "") {
return dicArr.filter((item) => item.itemValue == code)[0]
.itemChineseName;
// console.log(dicArr, code);
if (code != "" && code) {
const ojb = dicArr.find((item) => item.itemValue == code);
return ojb ? ojb.itemChineseName : "";
} else {
return "";
}
......
......@@ -156,6 +156,25 @@
</el-select>
</Formitem>
</el-col>
<el-col :span="5">
<Formitem label="申报业务类型" prop="declareBusinessType">
<el-select
type="text"
id="inputInner--declareBusinessType"
v-model="sreachFormData.declareBusinessType"
clearable
placeholder=""
>
<el-option
v-for="(item, index) in $store.getters.dict
.DECLARE_STATISTICS_FLAG"
:key="index"
:label="item.itemChineseName"
:value="item.itemValue"
></el-option>
</el-select>
</Formitem>
</el-col>
</el-row>
</el-form>
</div>
......@@ -292,7 +311,7 @@
ref="allLogDataReceiptStatusPopover"
dataKey="allLogDataReceiptStatus"
idKey="declareId"
:parentDom="$refs.entryTable"
:parentDom="$refs.tableRef"
:receiptDataHead="logDataHead"
:rowData="selectedLogRow"
:tableData="tableData"
......@@ -364,6 +383,10 @@
</el-tooltip>
</template>
</vxe-column>
<vxe-column
field="declareBusinessType"
title="申报业务类型"
></vxe-column>
<vxe-column field="createTime" title="创建时间"></vxe-column>
<vxe-column
field="orderReceiptStatus"
......@@ -978,6 +1001,7 @@ export default {
//查询申报数据
search(val) {
this.visiblePopover.flag = false;
this.loadings.sreachLoading = true;
this.selected = [];
if (val == 0) {
......@@ -1236,6 +1260,7 @@ export default {
this.$forceUpdate();
},
popoverCloseNew(row, declareId, type) {
this.visiblePopover.flag = false;
row[`${type}${declareId}`] = false;
this.$forceUpdate();
},
......@@ -1367,8 +1392,8 @@ export default {
item.popoverData = [];
});
this.selectedLogRow.allLogDataReceiptStatusPopoverType = false;
this.$refs.entryTable.$refs.tables.$refs.bodyWrapper.style.overflowY =
"auto";
// this.$refs.tableRef.$refs.tables.$refs.bodyWrapper.style.overflowY =
// "auto";
},
tableSelect(val) {
console.log(val.records);
......@@ -1381,10 +1406,12 @@ export default {
//分页
currentChange(val) {
console.log(val);
this.visiblePopover.flag = false;
this.page.pageIndex = val;
this.search(1);
},
sizeChange(val) {
this.visiblePopover.flag = false;
this.page.pageSize = val;
this.search(1);
},
......
'use strict'
const path = require('path')
const defaultSettings = require('./src/settings.js')
"use strict";
const path = require("path");
const defaultSettings = require("./src/settings.js");
function resolve(dir) {
return path.join(__dirname, dir)
return path.join(__dirname, dir);
}
const name = defaultSettings.title || '跨境电商在线申报' // 标题
const name = defaultSettings.title || "跨境电商在线申报"; // 标题
const port = process.env.port || process.env.npm_config_port || 8080 // 端口
const timeStamp = new Date().getTime()
const port = process.env.port || process.env.npm_config_port || 8080; // 端口
const timeStamp = new Date().getTime();
// vue.config.js 配置说明
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
// 这里只列一部分,具体配置参考文档
module.exports = {
// 部署生产环境和开发环境下的URL。
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
publicPath: process.env.NODE_ENV === "production" ? process.env.VUE_APP_BASE_ROUTE : "/",
publicPath:
process.env.NODE_ENV === "production"
? process.env.VUE_APP_BASE_ROUTE
: "/",
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
outputDir: 'dist_' + process.env.ENV,
outputDir: "dist_" + process.env.ENV,
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir: 'static',
assetsDir: "static",
// 是否开启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",
port: port,
open: true,
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
// [process.env.VUE_APP_BASE_API]: {
// target: `http://localhost:8080`,
// changeOrigin: true,
// pathRewrite: {
// ['^' + process.env.VUE_APP_BASE_API]: ''
// }
// }
[process.env.VUE_APP_BASE_API]: {
target: `http://localhost:8080`,
target: process.env.VUE_APP_BASE_URL, // 后端地址
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
}
}
["^" + process.env.VUE_APP_BASE_API]: "",
},
},
},
disableHostCheck: true
disableHostCheck: true,
},
configureWebpack: {
output: { // 输出重构 打包编译后的js文件名称,添加时间戳.
output: {
// 输出重构 打包编译后的js文件名称,添加时间戳.
filename: `static/js/js[name].${timeStamp}.js`,
chunkFilename: `static/js/chunk.[id].${timeStamp}.js`
chunkFilename: `static/js/chunk.[id].${timeStamp}.js`,
},
// 关闭 webpack 的性能提示
performance: {
hints: false
hints: false,
},
name: name,
resolve: {
alias: {
'@': resolve('src')
}
}
"@": resolve("src"),
},
},
},
css: {
extract: { // 打包后css文件名称添加时间戳
extract: {
// 打包后css文件名称添加时间戳
filename: `static/css/[name].${timeStamp}.css`,
chunkFilename: `static/css/chunk.[id].${timeStamp}.css`
}
chunkFilename: `static/css/chunk.[id].${timeStamp}.css`,
},
},
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
.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
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'),
config.when(process.env.NODE_ENV !== "development", (config) => {
config
.plugin("ScriptExtHtmlWebpackPlugin")
.after("html")
.use("script-ext-html-webpack-plugin", [
{
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './', //到根目录下
}
}
)
}
}
// `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
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: "./", //到根目录下
};
});
},
};
......