vue2-client 1.2.28-test2 → 1.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -56
- package/package.json +2 -1
- package/src/base-client/all.js +2 -2
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +1308 -1205
- package/src/base-client/components/common/ScrollList/SrcollList.vue +113 -0
- package/src/base-client/components/common/ScrollList/index.js +3 -0
- package/src/base-client/components/common/XForm/XFormItem.vue +42 -0
- package/src/config/CreateQueryConfig.js +80 -80
- package/vue.config.js +143 -143
- package/src/base-client/components/iot/DataAnalysisViewGD/DataAnalysisViewGD.vue +0 -549
- package/src/base-client/components/iot/DataAnalysisViewGD/WindowTemplate/WindowInfotemp.vue +0 -99
- package/src/base-client/components/iot/DataAnalysisViewGD/WindowTemplate/index.js +0 -3
- package/src/base-client/components/iot/DataAnalysisViewGD/index.js +0 -3
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-list
|
|
3
|
+
:data-source="model.rows"
|
|
4
|
+
:bordered="bordered"
|
|
5
|
+
v-infinite-scroll="handleInfiniteOnLoad"
|
|
6
|
+
class="srcoll-list-infinite-container"
|
|
7
|
+
:infinite-scroll-disabled="busy"
|
|
8
|
+
:infinite-scroll-distance="distance"
|
|
9
|
+
>
|
|
10
|
+
<a-list-item slot="renderItem" class="srcoll_list_li" slot-scope="item,index" @click="selectItem(index,item)">
|
|
11
|
+
<slot :item="item" :index="index" >
|
|
12
|
+
</slot>
|
|
13
|
+
</a-list-item>
|
|
14
|
+
<div v-if="loading && !busy" class="srcoll-list-loading-container">
|
|
15
|
+
<a-spin />
|
|
16
|
+
</div>
|
|
17
|
+
</a-list>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import infiniteScroll from 'vue-infinite-scroll'
|
|
22
|
+
import { post } from '@vue2-client/services/api/restTools'
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
name: 'SrcollList1',
|
|
26
|
+
directives: { infiniteScroll },
|
|
27
|
+
props: {
|
|
28
|
+
'busy': { // 是否执行回调
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
'distance': { // 距底部多少像素触发回调
|
|
33
|
+
type: Number,
|
|
34
|
+
default: 1
|
|
35
|
+
},
|
|
36
|
+
'bordered': { // 是否显示列表边框
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
},
|
|
40
|
+
'model': {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: () => {
|
|
43
|
+
return {}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
data () {
|
|
48
|
+
return {
|
|
49
|
+
selectRow: {},
|
|
50
|
+
loading: false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
mounted () {
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
selectItem (index, item) {
|
|
57
|
+
this.$emit('selectItem', index, item)
|
|
58
|
+
},
|
|
59
|
+
handleInfiniteOnLoad () {
|
|
60
|
+
this.loading = true
|
|
61
|
+
if (this.model.pageNo < this.model.totalPage || this.model.pageNo == 0) {
|
|
62
|
+
this.model.pageNo = this.model.pageNo + 1
|
|
63
|
+
post(this.model.url, { data: this.model }).then((res) => {
|
|
64
|
+
this.model.rows = this.model.rows.concat(res.data).map((item, index) => ({ ...item, index }))
|
|
65
|
+
this.loading = false
|
|
66
|
+
this.model.totalPage = res.totalPage
|
|
67
|
+
this.model.totalCount = res.totalCount
|
|
68
|
+
})
|
|
69
|
+
} else {
|
|
70
|
+
this.loading = false
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
search () {
|
|
74
|
+
this.model.pageNo = 0
|
|
75
|
+
this.model.rows = []
|
|
76
|
+
this.handleInfiniteOnLoad()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<style scoped>
|
|
83
|
+
.srcoll-list-infinite-container {
|
|
84
|
+
border-radius: 4px;
|
|
85
|
+
height: 100%;
|
|
86
|
+
overflow-y: scroll;
|
|
87
|
+
}
|
|
88
|
+
/*滚动条样式*/
|
|
89
|
+
.srcoll-list-infinite-container::-webkit-scrollbar {
|
|
90
|
+
width: 4px;
|
|
91
|
+
/*height: 4px;*/
|
|
92
|
+
}
|
|
93
|
+
.srcoll-list-infinite-container::-webkit-scrollbar-thumb {
|
|
94
|
+
border-radius: 10px;
|
|
95
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
|
|
96
|
+
background: rgba(0,0,0,0.2);
|
|
97
|
+
}
|
|
98
|
+
.srcoll-list-infinite-container::-webkit-scrollbar-track {
|
|
99
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
|
|
100
|
+
border-radius: 0;
|
|
101
|
+
background: rgba(0,0,0,0.1);
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
.srcoll-list-loading-container {
|
|
105
|
+
position: absolute;
|
|
106
|
+
bottom: 10%;
|
|
107
|
+
width: 100%;
|
|
108
|
+
text-align: center;
|
|
109
|
+
}
|
|
110
|
+
.srcoll_list_li:hover{
|
|
111
|
+
background-color: rgb(203,234,241);
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
@@ -161,7 +161,49 @@
|
|
|
161
161
|
</a-form-model-item>
|
|
162
162
|
</x-form-col>
|
|
163
163
|
<!-- TODO 文件上传 -->
|
|
164
|
+
<x-form-col
|
|
165
|
+
:xl="24"
|
|
166
|
+
:xxl="24"
|
|
167
|
+
:xs="24"
|
|
168
|
+
:sm="24"
|
|
169
|
+
:md="24"
|
|
170
|
+
:lg="24"
|
|
171
|
+
v-else-if="attr.type === 'file'">
|
|
172
|
+
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
173
|
+
<a-upload-dragger
|
|
174
|
+
name="file"
|
|
175
|
+
:multiple="true"
|
|
176
|
+
:action="'/webmeteruploadapi/upload/'+attr.resUploadMode">
|
|
177
|
+
<p class="ant-upload-drag-icon">
|
|
178
|
+
<a-icon type="inbox"/>
|
|
179
|
+
</p>
|
|
180
|
+
<p class="ant-upload-text">
|
|
181
|
+
点击或拖动文件到该区域上传
|
|
182
|
+
</p>
|
|
183
|
+
<p class="ant-upload-hint">
|
|
184
|
+
支持单个或多个文件
|
|
185
|
+
</p>
|
|
186
|
+
</a-upload-dragger>
|
|
187
|
+
</a-form-model-item>
|
|
188
|
+
</x-form-col>
|
|
164
189
|
<!-- TODO 图片上传 -->
|
|
190
|
+
<x-form-col
|
|
191
|
+
:xl="24"
|
|
192
|
+
:xxl="24"
|
|
193
|
+
:xs="24"
|
|
194
|
+
:sm="24"
|
|
195
|
+
:md="24"
|
|
196
|
+
:lg="24"
|
|
197
|
+
v-else-if="attr.type === 'image'">
|
|
198
|
+
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
199
|
+
<a-upload list-type="picture-card" :file-list="[]">
|
|
200
|
+
<a-icon type="plus"/>
|
|
201
|
+
<div class="ant-upload-text">
|
|
202
|
+
Upload
|
|
203
|
+
</div>
|
|
204
|
+
</a-upload>
|
|
205
|
+
</a-form-model-item>
|
|
206
|
+
</x-form-col>
|
|
165
207
|
</template>
|
|
166
208
|
<script>
|
|
167
209
|
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
// 文件上传类型
|
|
3
|
-
|
|
4
|
-
{
|
|
5
|
-
label: 'word文档',
|
|
6
|
-
accept: '.doc,.docx,'
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
label: 'excel表格',
|
|
10
|
-
accept: '.xlsx,.xls,'
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
label: 'ppt幻灯片',
|
|
14
|
-
accept: '.ppt,.pptx,'
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
label: '图片',
|
|
18
|
-
accept: '.jpg,.jpeg,.ico,.gif,svg,.webp,.png,.bmp,.pjpeg,'
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
label: '视频',
|
|
22
|
-
accept: '.mp4,.mov,.m4v,.wmv,.asf,.asx,.rm,.rmvb,.3gp,.avi,.mkv,'
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
label: '音频',
|
|
26
|
-
accept: '.mp3,.cda,.wav,.aif,.aiff,.ape,.ra,'
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: '压缩包',
|
|
30
|
-
accept: '.zip,.rar,.7z,'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
label: '其他文本',
|
|
34
|
-
accept: '.json,.txt,'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: '无限制',
|
|
38
|
-
accept: '*'
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
// 查询方式
|
|
42
|
-
queryType: [
|
|
43
|
-
{
|
|
44
|
-
label: '相等(=)', key: '=', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
label: '不相等(!=)', key: '!=', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
label: '全模糊(like)', key: 'LIKE', match: 'input;select;radio;cascader;selects'
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
label: '左模糊(left like)', key: 'LEFT_LIKE', match: 'input;select;radio;cascader;selects'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
label: '右模糊(right like)', key: 'RIGHT_LIKE', match: 'input;select;radio;cascader;selects'
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
label: '大于(>)', key: '>', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
label: '大于等于(>=)', key: '>=', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
label: '小于(<)', key: '<', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
label: '小于等于(<=)', key: '<=', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
label: '包含(in)', key: 'IN', match: 'checkbox;select;cascader;selects'
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
label: '不包含(not in)', key: 'NOT_IN', match: 'checkbox;select;cascader;selects'
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
label: '之间(between)', key: 'BETWEEN', match: 'rangePicker'
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
// 文件上传类型
|
|
3
|
+
fileType: [
|
|
4
|
+
{
|
|
5
|
+
label: 'word文档',
|
|
6
|
+
accept: '.doc,.docx,'
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
label: 'excel表格',
|
|
10
|
+
accept: '.xlsx,.xls,'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
label: 'ppt幻灯片',
|
|
14
|
+
accept: '.ppt,.pptx,'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: '图片',
|
|
18
|
+
accept: '.jpg,.jpeg,.ico,.gif,svg,.webp,.png,.bmp,.pjpeg,'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: '视频',
|
|
22
|
+
accept: '.mp4,.mov,.m4v,.wmv,.asf,.asx,.rm,.rmvb,.3gp,.avi,.mkv,'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: '音频',
|
|
26
|
+
accept: '.mp3,.cda,.wav,.aif,.aiff,.ape,.ra,'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: '压缩包',
|
|
30
|
+
accept: '.zip,.rar,.7z,'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: '其他文本',
|
|
34
|
+
accept: '.json,.txt,'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: '无限制',
|
|
38
|
+
accept: '*'
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
// 查询方式
|
|
42
|
+
queryType: [
|
|
43
|
+
{
|
|
44
|
+
label: '相等(=)', key: '=', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: '不相等(!=)', key: '!=', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: '全模糊(like)', key: 'LIKE', match: 'input;select;radio;cascader;selects'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: '左模糊(left like)', key: 'LEFT_LIKE', match: 'input;select;radio;cascader;selects'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: '右模糊(right like)', key: 'RIGHT_LIKE', match: 'input;select;radio;cascader;selects'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: '大于(>)', key: '>', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
label: '大于等于(>=)', key: '>=', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: '小于(<)', key: '<', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: '小于等于(<=)', key: '<=', match: 'input;select;radio;monthPicker;datePicker;cascader;selects'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: '包含(in)', key: 'IN', match: 'checkbox;select;cascader;selects'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: '不包含(not in)', key: 'NOT_IN', match: 'checkbox;select;cascader;selects'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: '之间(between)', key: 'BETWEEN', match: 'rangePicker'
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
package/vue.config.js
CHANGED
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const webpack = require('webpack')
|
|
3
|
-
const ThemeColorReplacer = require('webpack-theme-color-replacer')
|
|
4
|
-
const { getThemeColors, modifyVars } = require('./src/utils/themeUtil')
|
|
5
|
-
const { resolveCss } = require('./src/utils/theme-color-replacer-extend')
|
|
6
|
-
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
|
7
|
-
|
|
8
|
-
const productionGzipExtensions = ['js', 'css']
|
|
9
|
-
const isProd = process.env.NODE_ENV === 'production'
|
|
10
|
-
|
|
11
|
-
const assetsCDN = {
|
|
12
|
-
// webpack build externals
|
|
13
|
-
externals: {
|
|
14
|
-
vue: 'Vue',
|
|
15
|
-
'vue-router': 'VueRouter',
|
|
16
|
-
vuex: 'Vuex',
|
|
17
|
-
axios: 'axios',
|
|
18
|
-
nprogress: 'NProgress',
|
|
19
|
-
clipboard: 'ClipboardJS',
|
|
20
|
-
'@antv/data-set': 'DataSet',
|
|
21
|
-
'js-cookie': 'Cookies'
|
|
22
|
-
},
|
|
23
|
-
css: [
|
|
24
|
-
],
|
|
25
|
-
js: [
|
|
26
|
-
'//cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js',
|
|
27
|
-
'//cdn.jsdelivr.net/npm/vue-router@3.3.4/dist/vue-router.min.js',
|
|
28
|
-
'//cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.min.js',
|
|
29
|
-
'//cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js',
|
|
30
|
-
'//cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js',
|
|
31
|
-
'//cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js',
|
|
32
|
-
'//cdn.jsdelivr.net/npm/@antv/data-set@0.11.4/build/data-set.min.js',
|
|
33
|
-
'//cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js'
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const server = 'http://121.36.106.17:8400'
|
|
38
|
-
|
|
39
|
-
const local = 'http://123.60.214.109:8405/webmeter'
|
|
40
|
-
|
|
41
|
-
module.exports = {
|
|
42
|
-
devServer: {
|
|
43
|
-
// development server port 8000
|
|
44
|
-
port: 8001,
|
|
45
|
-
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
|
|
46
|
-
proxy: {
|
|
47
|
-
'/rs': {
|
|
48
|
-
target: server,
|
|
49
|
-
ws: false,
|
|
50
|
-
changeOrigin: true
|
|
51
|
-
},
|
|
52
|
-
'/image': {
|
|
53
|
-
target: server,
|
|
54
|
-
ws: false,
|
|
55
|
-
changeOrigin: true
|
|
56
|
-
},
|
|
57
|
-
'/webapps': {
|
|
58
|
-
target: server,
|
|
59
|
-
ws: false,
|
|
60
|
-
changeOrigin: true
|
|
61
|
-
},
|
|
62
|
-
'/webmeterapi': {
|
|
63
|
-
pathRewrite: { '^/webmeterapi': '/rs/logic' },
|
|
64
|
-
target: local,
|
|
65
|
-
changeOrigin: true
|
|
66
|
-
},
|
|
67
|
-
'/webmeteruploadapi': {
|
|
68
|
-
pathRewrite: { '^/webmeteruploadapi': '/rs/file' },
|
|
69
|
-
target: local,
|
|
70
|
-
changeOrigin: true
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
pluginOptions: {
|
|
75
|
-
'style-resources-loader': {
|
|
76
|
-
preProcessor: 'less',
|
|
77
|
-
patterns: [path.resolve(__dirname, './src/theme/theme.less')]
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
configureWebpack: config => {
|
|
81
|
-
config.entry.app = ['babel-polyfill', 'whatwg-fetch', './src/main.js']
|
|
82
|
-
config.performance = {
|
|
83
|
-
hints: false
|
|
84
|
-
}
|
|
85
|
-
config.plugins.push(
|
|
86
|
-
new ThemeColorReplacer({
|
|
87
|
-
fileName: 'css/theme-colors-[contenthash:8].css',
|
|
88
|
-
matchColors: getThemeColors(),
|
|
89
|
-
injectCss: true,
|
|
90
|
-
resolveCss
|
|
91
|
-
})
|
|
92
|
-
)
|
|
93
|
-
// Ignore all locale files of moment.js
|
|
94
|
-
config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
|
|
95
|
-
// 生产环境下将资源压缩成gzip格式
|
|
96
|
-
if (isProd) {
|
|
97
|
-
// add `CompressionWebpack` plugin to webpack plugins
|
|
98
|
-
config.plugins.push(new CompressionWebpackPlugin({
|
|
99
|
-
algorithm: 'gzip',
|
|
100
|
-
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
|
|
101
|
-
threshold: 10240,
|
|
102
|
-
minRatio: 0.8
|
|
103
|
-
}))
|
|
104
|
-
}
|
|
105
|
-
// if prod, add externals
|
|
106
|
-
if (isProd) {
|
|
107
|
-
config.externals = assetsCDN.externals
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
chainWebpack: config => {
|
|
111
|
-
// 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
|
|
112
|
-
if (isProd) {
|
|
113
|
-
config.plugin('optimize-css')
|
|
114
|
-
.tap(args => {
|
|
115
|
-
args[0].cssnanoOptions.preset[1].colormin = false
|
|
116
|
-
return args
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
// 生产环境下使用CDN
|
|
120
|
-
if (isProd) {
|
|
121
|
-
config.plugin('html')
|
|
122
|
-
.tap(args => {
|
|
123
|
-
args[0].cdn = assetsCDN
|
|
124
|
-
return args
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
|
|
128
|
-
},
|
|
129
|
-
css: {
|
|
130
|
-
loaderOptions: {
|
|
131
|
-
less: {
|
|
132
|
-
lessOptions: {
|
|
133
|
-
modifyVars: modifyVars(),
|
|
134
|
-
javascriptEnabled: true
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
publicPath: process.env.VUE_APP_PUBLIC_PATH,
|
|
140
|
-
outputDir: 'dist',
|
|
141
|
-
assetsDir: 'static',
|
|
142
|
-
productionSourceMap: false
|
|
143
|
-
}
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const webpack = require('webpack')
|
|
3
|
+
const ThemeColorReplacer = require('webpack-theme-color-replacer')
|
|
4
|
+
const { getThemeColors, modifyVars } = require('./src/utils/themeUtil')
|
|
5
|
+
const { resolveCss } = require('./src/utils/theme-color-replacer-extend')
|
|
6
|
+
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
|
7
|
+
|
|
8
|
+
const productionGzipExtensions = ['js', 'css']
|
|
9
|
+
const isProd = process.env.NODE_ENV === 'production'
|
|
10
|
+
|
|
11
|
+
const assetsCDN = {
|
|
12
|
+
// webpack build externals
|
|
13
|
+
externals: {
|
|
14
|
+
vue: 'Vue',
|
|
15
|
+
'vue-router': 'VueRouter',
|
|
16
|
+
vuex: 'Vuex',
|
|
17
|
+
axios: 'axios',
|
|
18
|
+
nprogress: 'NProgress',
|
|
19
|
+
clipboard: 'ClipboardJS',
|
|
20
|
+
'@antv/data-set': 'DataSet',
|
|
21
|
+
'js-cookie': 'Cookies'
|
|
22
|
+
},
|
|
23
|
+
css: [
|
|
24
|
+
],
|
|
25
|
+
js: [
|
|
26
|
+
'//cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js',
|
|
27
|
+
'//cdn.jsdelivr.net/npm/vue-router@3.3.4/dist/vue-router.min.js',
|
|
28
|
+
'//cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.min.js',
|
|
29
|
+
'//cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js',
|
|
30
|
+
'//cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js',
|
|
31
|
+
'//cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js',
|
|
32
|
+
'//cdn.jsdelivr.net/npm/@antv/data-set@0.11.4/build/data-set.min.js',
|
|
33
|
+
'//cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js'
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const server = 'http://121.36.106.17:8400'
|
|
38
|
+
const local = 'http://localhost:8445/webmeter'
|
|
39
|
+
// const local = 'http://123.60.214.109:8405/webmeter'
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
devServer: {
|
|
43
|
+
// development server port 8000
|
|
44
|
+
port: 8001,
|
|
45
|
+
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
|
|
46
|
+
proxy: {
|
|
47
|
+
'/rs': {
|
|
48
|
+
target: server,
|
|
49
|
+
ws: false,
|
|
50
|
+
changeOrigin: true
|
|
51
|
+
},
|
|
52
|
+
'/image': {
|
|
53
|
+
target: server,
|
|
54
|
+
ws: false,
|
|
55
|
+
changeOrigin: true
|
|
56
|
+
},
|
|
57
|
+
'/webapps': {
|
|
58
|
+
target: server,
|
|
59
|
+
ws: false,
|
|
60
|
+
changeOrigin: true
|
|
61
|
+
},
|
|
62
|
+
'/webmeterapi': {
|
|
63
|
+
pathRewrite: { '^/webmeterapi': '/rs/logic' },
|
|
64
|
+
target: local,
|
|
65
|
+
changeOrigin: true
|
|
66
|
+
},
|
|
67
|
+
'/webmeteruploadapi': {
|
|
68
|
+
pathRewrite: { '^/webmeteruploadapi': '/rs/file' },
|
|
69
|
+
target: local,
|
|
70
|
+
changeOrigin: true
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
pluginOptions: {
|
|
75
|
+
'style-resources-loader': {
|
|
76
|
+
preProcessor: 'less',
|
|
77
|
+
patterns: [path.resolve(__dirname, './src/theme/theme.less')]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
configureWebpack: config => {
|
|
81
|
+
config.entry.app = ['babel-polyfill', 'whatwg-fetch', './src/main.js']
|
|
82
|
+
config.performance = {
|
|
83
|
+
hints: false
|
|
84
|
+
}
|
|
85
|
+
config.plugins.push(
|
|
86
|
+
new ThemeColorReplacer({
|
|
87
|
+
fileName: 'css/theme-colors-[contenthash:8].css',
|
|
88
|
+
matchColors: getThemeColors(),
|
|
89
|
+
injectCss: true,
|
|
90
|
+
resolveCss
|
|
91
|
+
})
|
|
92
|
+
)
|
|
93
|
+
// Ignore all locale files of moment.js
|
|
94
|
+
config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
|
|
95
|
+
// 生产环境下将资源压缩成gzip格式
|
|
96
|
+
if (isProd) {
|
|
97
|
+
// add `CompressionWebpack` plugin to webpack plugins
|
|
98
|
+
config.plugins.push(new CompressionWebpackPlugin({
|
|
99
|
+
algorithm: 'gzip',
|
|
100
|
+
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
|
|
101
|
+
threshold: 10240,
|
|
102
|
+
minRatio: 0.8
|
|
103
|
+
}))
|
|
104
|
+
}
|
|
105
|
+
// if prod, add externals
|
|
106
|
+
if (isProd) {
|
|
107
|
+
config.externals = assetsCDN.externals
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
chainWebpack: config => {
|
|
111
|
+
// 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
|
|
112
|
+
if (isProd) {
|
|
113
|
+
config.plugin('optimize-css')
|
|
114
|
+
.tap(args => {
|
|
115
|
+
args[0].cssnanoOptions.preset[1].colormin = false
|
|
116
|
+
return args
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
// 生产环境下使用CDN
|
|
120
|
+
if (isProd) {
|
|
121
|
+
config.plugin('html')
|
|
122
|
+
.tap(args => {
|
|
123
|
+
args[0].cdn = assetsCDN
|
|
124
|
+
return args
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
|
|
128
|
+
},
|
|
129
|
+
css: {
|
|
130
|
+
loaderOptions: {
|
|
131
|
+
less: {
|
|
132
|
+
lessOptions: {
|
|
133
|
+
modifyVars: modifyVars(),
|
|
134
|
+
javascriptEnabled: true
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
publicPath: process.env.VUE_APP_PUBLIC_PATH,
|
|
140
|
+
outputDir: 'dist',
|
|
141
|
+
assetsDir: 'static',
|
|
142
|
+
productionSourceMap: false
|
|
143
|
+
}
|