vue2-client 1.14.63 → 1.14.65

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.
Files changed (32) hide show
  1. package/.env.message +19 -19
  2. package/.history/public/his/editor/editor_20250606134713.html +51 -0
  3. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527173925.vue +509 -0
  4. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174316.vue +524 -0
  5. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174419.vue +524 -0
  6. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174422.vue +524 -0
  7. package/.history/src/base-client/components/common/XForm/XFormItem_20250508134122.vue +1320 -0
  8. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171604.vue +1332 -0
  9. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171613.vue +1331 -0
  10. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171703.vue +1331 -0
  11. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171720.vue +1331 -0
  12. package/.history/src/base-client/components/common/XForm/XFormItem_20250527174327.vue +1339 -0
  13. package/Users/objecrt/af-vue2-client/src/base-client/components/his/XShiftSchedule/XShiftSchedule.vue +36 -0
  14. package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +1 -0
  15. package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +2 -1
  16. package/package.json +109 -109
  17. package/src/base-client/components/TreeList/TreeList.vue +91 -0
  18. package/src/base-client/components/TreeList/TreeNode.vue +81 -0
  19. package/src/base-client/components/common/XCardSet/XTiltle.vue +191 -0
  20. package/src/base-client/components/common/XFormTable/XFormTable.vue +895 -895
  21. package/src/base-client/components/common/XFormTable/demo.vue +86 -86
  22. package/src/base-client/components/common/XTable/XTable.vue +1564 -1564
  23. package/src/base-client/components/his/XTextCard/XTextCard.vue +207 -207
  24. package/src/base-client/components/his/XTreeRows/TreeNode.vue +100 -100
  25. package/src/base-client/components/his/XTreeRows/XTreeRows.vue +197 -197
  26. package/src/base-client/components/his/threeTestOrders/dome.vue +53 -2
  27. package/src/base-client/components/his/threeTestOrders/editor.vue +111 -111
  28. package/src/base-client/components/his/threeTestOrders/index.md +0 -0
  29. package/src/base-client/components/his/threeTestOrders/textBox.vue +457 -463
  30. package/src/base-client/components/his/threeTestOrders/threeTestOrders.vue +55 -19
  31. package/src/utils/routerUtil.js +3 -0
  32. package/vue.config.js +220 -220
@@ -4,16 +4,27 @@
4
4
  <a-row class="box">
5
5
  病历号&nbsp;&nbsp;<a-input v-model="vitalSignsId" style="width: 160px"></a-input>
6
6
  <a-button-group style="margin-left: 20px;">
7
- <a-button plain type="primary" @click="showVitalSignsModal('create')" :loading="loading" :disabled="!editorReady">创建体温单</a-button>
8
- <a-button plain type="primary" @click="showVitalSignsModal('update')" :loading="loading" :disabled="!editorReady">更新体温单</a-button>
7
+ <a-button v-if="showCreateButton"
8
+ plain
9
+ type="primary"
10
+ @click="showVitalSignsModal('create')"
11
+ :loading="loading"
12
+ :disabled="!editorReady">创建体温单</a-button>
13
+ <a-button v-if="showUpdateButton"
14
+ plain
15
+ type="primary"
16
+ @click="showVitalSignsModal('update')"
17
+ :loading="loading"
18
+ :disabled="!editorReady">更新体温单</a-button>
9
19
  </a-button-group>
10
- <a-button-group style="margin: 0 20px;">
20
+ <a-button-group v-if="showClearButton" style="margin: 0 20px;">
11
21
  <a-button plain type="primary" @click="execCommand('print')" :loading="loading" :disabled="!editorReady">打印</a-button>
12
22
  </a-button-group>
13
23
  <!-- 修改清空体温单按钮样式,使其更加醒目 -->
14
24
  <a-button
15
25
  type="primary"
16
26
  danger
27
+ v-if="showClearButton"
17
28
  @click="clearVitalSigns"
18
29
  :loading="loading"
19
30
  :disabled="!editorReady"
@@ -70,19 +81,45 @@ const modalTitles = {
70
81
  update: '更新体温单'
71
82
  }
72
83
 
84
+ // 接受父组件传递的属性
85
+ defineProps({
86
+ showCreateButton: {
87
+ type: Boolean,
88
+ default: false
89
+ },
90
+ showUpdateButton: {
91
+ type: Boolean,
92
+ default: false
93
+ },
94
+ // 添加打印按钮是否显示属性
95
+ showPrintButton: {
96
+ type: Boolean,
97
+ default: false
98
+ },
99
+ showClearButton: {
100
+ type: Boolean,
101
+ default: false
102
+ },
103
+ // 时间模式 -2 ~ 2
104
+ adjustHour: {
105
+ type: Number,
106
+ default: 0
107
+ }
108
+ })
109
+
73
110
  // 显示弹窗
74
- const showVitalSignsModal = (type) => {
111
+ function showVitalSignsModal (type) {
75
112
  modalType.value = type
76
113
  modalVisible.value = true
77
114
  }
78
115
 
79
116
  // 关闭弹窗
80
- const closeModal = () => {
117
+ function closeModal () {
81
118
  modalVisible.value = false
82
119
  }
83
120
 
84
121
  // 编辑器初始化
85
- const onEditorReady = (editorObj) => {
122
+ function onEditorReady (editorObj) {
86
123
  try {
87
124
  if (!editorObj) {
88
125
  throw new Error('传入的editor对象为null或undefined')
@@ -108,7 +145,7 @@ const onEditorReady = (editorObj) => {
108
145
  }
109
146
 
110
147
  // 执行命令
111
- const execCommand = (cmd) => {
148
+ function execCommand (cmd) {
112
149
  if (!editorReady.value || !editor) return
113
150
  loading.value = true
114
151
  try {
@@ -122,15 +159,13 @@ const execCommand = (cmd) => {
122
159
  }
123
160
 
124
161
  // 清空体温单
125
- const clearVitalSigns = async () => {
162
+ async function clearVitalSigns () {
126
163
  if (!editorReady.value || !editor) {
127
164
  message.error('体温单编辑器未加载完成,请等待或刷新页面重试')
128
165
  return
129
166
  }
130
-
131
167
  loading.value = true
132
168
  generating.value = true
133
-
134
169
  try {
135
170
  // 重新加载editor.html页面来完全重置编辑器
136
171
  try {
@@ -145,7 +180,6 @@ const clearVitalSigns = async () => {
145
180
  try {
146
181
  // 等待iframe重新加载完成
147
182
  await new Promise(resolve => setTimeout(resolve, 500))
148
-
149
183
  // 获取新的editor对象
150
184
  const newEditorObj = iframe.contentWindow.editor
151
185
  if (newEditorObj) {
@@ -158,7 +192,6 @@ const clearVitalSigns = async () => {
158
192
  resolve()
159
193
  }
160
194
  }, 100)
161
-
162
195
  // 最多等待5秒
163
196
  setTimeout(() => {
164
197
  clearInterval(checkInterval)
@@ -166,7 +199,6 @@ const clearVitalSigns = async () => {
166
199
  }, 5000)
167
200
  })
168
201
  }
169
-
170
202
  // 更新全局editor引用
171
203
  editor = newEditorObj
172
204
  window.iframeEditor = newEditorObj
@@ -183,7 +215,6 @@ const clearVitalSigns = async () => {
183
215
  iframe.onload = null
184
216
  }
185
217
  }
186
-
187
218
  // 重新加载iframe
188
219
  iframe.src = currentSrc + '?t=' + new Date().getTime()
189
220
  return
@@ -191,7 +222,6 @@ const clearVitalSigns = async () => {
191
222
  } catch (reloadErr) {
192
223
  console.warn('重新加载iframe失败,将尝试其他方法清空体温单:', reloadErr)
193
224
  }
194
-
195
225
  // 备用清空方法
196
226
  try {
197
227
  const iframe = editorComponent.value.$refs.editorIframe
@@ -259,8 +289,10 @@ const clearVitalSigns = async () => {
259
289
  generating.value = false
260
290
  }
261
291
  }
292
+
262
293
  // 处理表单提交
263
- const handleSubmit = async (formData) => {
294
+ async function handleSubmit (formData) {
295
+ console.log('表单数据:', formData)
264
296
  if (!editorReady.value || !editor) {
265
297
  message.error('体温单编辑器未加载完成,请等待或刷新页面重试')
266
298
  return
@@ -286,7 +318,7 @@ const handleSubmit = async (formData) => {
286
318
  } catch (err) {
287
319
  // 备用方案
288
320
  if (editor && typeof editor.createVitalSigns === 'function') {
289
- result = editor.createVitalSigns(formData)
321
+ editor.createVitalSigns(formData)
290
322
  } else {
291
323
  throw new Error('无法调用createVitalSigns方法')
292
324
  }
@@ -326,16 +358,20 @@ onMounted(() => {
326
358
  defineExpose({
327
359
  // 属性
328
360
  vitalSignsId,
329
- // 方法
361
+ // 清空体温单方法
330
362
  clearVitalSigns,
363
+ // 展示更新和创建弹框 创建参数:(String) create, 更新参数:(String) update
331
364
  showVitalSignsModal,
365
+ // 触发打印函数 参数:(String) print
332
366
  execCommand,
333
367
  // 获取当前体温单ID的方法
334
368
  getVitalSignsId: () => vitalSignsId.value,
335
369
  // 设置体温单ID的方法
336
370
  setVitalSignsId: (id) => {
337
371
  vitalSignsId.value = id
338
- }
372
+ },
373
+ // 创建体温单 参数:(Object) data
374
+ handleSubmit
339
375
  })
340
376
  </script>
341
377
 
@@ -458,6 +458,9 @@ function parsefunc (func) {
458
458
  if (row.configName) {
459
459
  route.meta.configName = row.configName
460
460
  }
461
+ if (row.component) {
462
+ route.meta.type = row.component
463
+ }
461
464
  }
462
465
  if (row.children && row.children.length > 0) {
463
466
  route.children = parsefunc(row.children)
package/vue.config.js CHANGED
@@ -1,220 +1,220 @@
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
- const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
8
- // const CopyPlugin = require('copy-webpack-plugin')
9
-
10
- const productionGzipExtensions = ['js', 'css']
11
- const isProd = process.env.NODE_ENV === 'production'
12
-
13
- // v4 产品演示
14
- const v3Server = 'http://aote-office.8866.org:31567'
15
- // const gateway = 'http://192.168.50.67:31467'
16
- // const testUpload = 'http://123.60.214.109:8406'
17
- const OSSServerDev = 'http://192.168.50.67:30351'
18
- // const revenue = 'http://aote-office.8866.org:31567'
19
- const revenue = 'http://aote-office.8866.org:31567'
20
- // const OSSServerProd = 'http://192.168.50.67:31351'
21
- // const testUploadLocal = 'http://127.0.0.1:9001'
22
- // v3 铜川
23
- // const v3Server = 'http://61.134.55.234:8405'
24
- // const gateway = 'http://61.134.55.234:8456/webmeter'
25
- // v3 涉县
26
- // const v3Server = 'http://221.193.244.147:9600'
27
- // const gateway = 'http://221.193.244.147:9600/webmeter'
28
- // 本地
29
- // const local = 'http://localhost:8080'
30
-
31
- module.exports = {
32
- devServer: {
33
- // development server port 8000
34
- port: 8020,
35
- // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
36
- proxy: {
37
- // '/apply-image': {
38
- // target: revenue,
39
- // },
40
- '/rs': {
41
- target: v3Server,
42
- ws: false,
43
- changeOrigin: true
44
- },
45
- // '/api/af-system/resource': {
46
- // pathRewrite: { '^/api/af-system': '/' },
47
- // target: testUpload,
48
- // changeOrigin: true
49
- // },
50
- '/api/af-revenue/logic/openapi/': {
51
- // pathRewrite: { '^/api/af-revenue/logic/openapi/': '/logic/' },
52
- target: revenue,
53
- changeOrigin: true
54
- },
55
- '/api/af-scada': {
56
- target: revenue,
57
- changeOrigin: true
58
- },
59
- '/api/af-runtime': {
60
- pathRewrite: { '^/api/af-runtime/': '/' },
61
- target: 'http://127.0.0.1:9001',
62
- // target: revenue,
63
- changeOrigin: true
64
- },
65
- '/api/af-revenue': {
66
- // pathRewrite: { '^/api/af-revenue/': '/' },
67
- target: revenue,
68
- changeOrigin: true
69
- },
70
- '/api/af-liuli': {
71
- // pathRewrite: { '^/api/af-liuli/': '/' },
72
- // target: 'http://127.0.0.1:9014',
73
- target: revenue,
74
- changeOrigin: true
75
- },
76
- '/api/af-gaslink': {
77
- // pathRewrite: { '^/api/af-gaslink/': '/' },
78
- // target: 'http://127.0.0.1:9036',
79
- target: revenue,
80
- changeOrigin: true
81
- },
82
- '/api': {
83
- // v3用
84
- // pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
85
- // pathRewrite: { '^/api/': '/' },
86
- target: revenue,
87
- changeOrigin: true
88
- },
89
- '/devApi': {
90
- // v3用
91
- // pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
92
- // pathRewrite: { '^/api/': '/' },
93
- target: revenue,
94
- changeOrigin: true
95
- },
96
- '/resource': {
97
- // pathRewrite: { '^/resource': '/' },
98
- target: revenue,
99
- changeOrigin: true
100
- },
101
- '/ai': {
102
- target: 'http://192.168.50.67:31761',
103
- pathRewrite: { '^/ai': '/' },
104
- changeOrigin: true
105
- },
106
- '/oss': {
107
- target: OSSServerDev,
108
- pathRewrite: { '^/oss': '/' },
109
- changeOrigin: true
110
- },
111
- },
112
- client: {
113
- overlay: false
114
- }
115
- },
116
- pluginOptions: {
117
- 'style-resources-loader': {
118
- preProcessor: 'less',
119
- patterns: [path.resolve(__dirname, './src/theme/theme.less')]
120
- }
121
- },
122
- configureWebpack: config => {
123
- config.devtool = 'inline-source-map'
124
- // 忽略.md文件
125
- config.module.rules.push(
126
- {
127
- test: /\.md$/,
128
- exclude: /node_modules/,
129
- use: 'ignore-loader'
130
- }
131
- )
132
- config.context = path.resolve(__dirname, './')
133
- config.resolve = {
134
- extensions: ['.js', '.vue', '.json'],
135
- alias: {
136
- '@vue2-client': path.resolve('src'),
137
- '@': path.resolve('src'),
138
- }
139
- }
140
- config.entry.app = ['core-js/stable', 'regenerator-runtime/runtime', 'whatwg-fetch', './src/main.js']
141
- config.performance = {
142
- hints: false
143
- }
144
- if (isProd) {
145
- config.plugins.push(
146
- new ThemeColorReplacer({
147
- fileName: 'css/theme-colors-[contenthash:8].css',
148
- matchColors: getThemeColors(),
149
- injectCss: true,
150
- resolveCss
151
- })
152
- )
153
- }
154
- // Ignore all locale files of moment.js
155
- config.plugins.push(new webpack.IgnorePlugin({
156
- resourceRegExp: /^\.\/locale$/,
157
- contextRegExp: /moment$/
158
- }))
159
-
160
- config.plugins.push(
161
- // new CopyPlugin({
162
- // patterns: [{ from: 'node_modules/amis/sdk', to: 'amis/sdk' }],
163
- // })
164
- )
165
-
166
- // 生产环境下将资源压缩成gzip格式
167
- if (isProd) {
168
- // add `CompressionWebpack` plugin to webpack plugins
169
- config.plugins.push(new CompressionWebpackPlugin({
170
- algorithm: 'gzip',
171
- test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
172
- threshold: 10240,
173
- minRatio: 0.8
174
- }))
175
- }
176
- // if prod, add externals
177
- // if (isProd) {
178
- // config.externals = assetsCDN.externals
179
- // }
180
- },
181
- chainWebpack: config => {
182
- // 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
183
- if (isProd) {
184
- config.optimization.minimizer('css').use(CssMinimizerPlugin, [{
185
- minimizerOptions: {
186
- preset: [
187
- 'default',
188
- {
189
- discardComments: { removeAll: true },
190
- colormin: false,
191
- }
192
- ],
193
- ignoreOrder: true
194
- }
195
- }])
196
- }
197
- config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
198
- },
199
- css: {
200
- extract: !isProd
201
- ? {
202
- filename: 'css/[name].css',
203
- chunkFilename: 'css/[name].css',
204
- }
205
- : true,
206
- loaderOptions: {
207
- less: {
208
- lessOptions: {
209
- modifyVars: modifyVars(),
210
- javascriptEnabled: true
211
- }
212
- },
213
- sass: {}
214
- }
215
- },
216
- publicPath: process.env.VUE_APP_PUBLIC_PATH,
217
- outputDir: 'dist',
218
- assetsDir: 'static',
219
- productionSourceMap: false
220
- }
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
+ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
8
+ // const CopyPlugin = require('copy-webpack-plugin')
9
+
10
+ const productionGzipExtensions = ['js', 'css']
11
+ const isProd = process.env.NODE_ENV === 'production'
12
+
13
+ // v4 产品演示
14
+ const v3Server = 'http://aote-office.8866.org:31567'
15
+ // const gateway = 'http://192.168.50.67:31467'
16
+ // const testUpload = 'http://123.60.214.109:8406'
17
+ const OSSServerDev = 'http://192.168.50.67:30351'
18
+ // const revenue = 'http://aote-office.8866.org:31567'
19
+ const revenue = 'http://aote-office.8866.org:31567'
20
+ // const OSSServerProd = 'http://192.168.50.67:31351'
21
+ // const testUploadLocal = 'http://127.0.0.1:9001'
22
+ // v3 铜川
23
+ // const v3Server = 'http://61.134.55.234:8405'
24
+ // const gateway = 'http://61.134.55.234:8456/webmeter'
25
+ // v3 涉县
26
+ // const v3Server = 'http://221.193.244.147:9600'
27
+ // const gateway = 'http://221.193.244.147:9600/webmeter'
28
+ // 本地
29
+ // const local = 'http://localhost:8080'
30
+
31
+ module.exports = {
32
+ devServer: {
33
+ // development server port 8000
34
+ port: 8020,
35
+ // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
36
+ proxy: {
37
+ // '/apply-image': {
38
+ // target: revenue,
39
+ // },
40
+ '/rs': {
41
+ target: v3Server,
42
+ ws: false,
43
+ changeOrigin: true
44
+ },
45
+ // '/api/af-system/resource': {
46
+ // pathRewrite: { '^/api/af-system': '/' },
47
+ // target: testUpload,
48
+ // changeOrigin: true
49
+ // },
50
+ '/api/af-revenue/logic/openapi/': {
51
+ // pathRewrite: { '^/api/af-revenue/logic/openapi/': '/logic/' },
52
+ target: revenue,
53
+ changeOrigin: true
54
+ },
55
+ '/api/af-scada': {
56
+ target: revenue,
57
+ changeOrigin: true
58
+ },
59
+ '/api/af-runtime': {
60
+ pathRewrite: { '^/api/af-runtime/': '/' },
61
+ target: 'http://127.0.0.1:9001',
62
+ // target: revenue,
63
+ changeOrigin: true
64
+ },
65
+ '/api/af-revenue': {
66
+ // pathRewrite: { '^/api/af-revenue/': '/' },
67
+ target: revenue,
68
+ changeOrigin: true
69
+ },
70
+ '/api/af-liuli': {
71
+ // pathRewrite: { '^/api/af-liuli/': '/' },
72
+ // target: 'http://127.0.0.1:9014',
73
+ target: revenue,
74
+ changeOrigin: true
75
+ },
76
+ '/api/af-gaslink': {
77
+ // pathRewrite: { '^/api/af-gaslink/': '/' },
78
+ // target: 'http://127.0.0.1:9036',
79
+ target: revenue,
80
+ changeOrigin: true
81
+ },
82
+ '/api': {
83
+ // v3用
84
+ // pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
85
+ // pathRewrite: { '^/api/': '/' },
86
+ target: revenue,
87
+ changeOrigin: true
88
+ },
89
+ '/devApi': {
90
+ // v3用
91
+ // pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
92
+ // pathRewrite: { '^/api/': '/' },
93
+ target: revenue,
94
+ changeOrigin: true
95
+ },
96
+ '/resource': {
97
+ // pathRewrite: { '^/resource': '/' },
98
+ target: revenue,
99
+ changeOrigin: true
100
+ },
101
+ '/ai': {
102
+ target: 'http://192.168.50.67:31761',
103
+ pathRewrite: { '^/ai': '/' },
104
+ changeOrigin: true
105
+ },
106
+ '/oss': {
107
+ target: OSSServerDev,
108
+ pathRewrite: { '^/oss': '/' },
109
+ changeOrigin: true
110
+ },
111
+ },
112
+ client: {
113
+ overlay: false
114
+ }
115
+ },
116
+ pluginOptions: {
117
+ 'style-resources-loader': {
118
+ preProcessor: 'less',
119
+ patterns: [path.resolve(__dirname, './src/theme/theme.less')]
120
+ }
121
+ },
122
+ configureWebpack: config => {
123
+ config.devtool = 'inline-source-map'
124
+ // 忽略.md文件
125
+ config.module.rules.push(
126
+ {
127
+ test: /\.md$/,
128
+ exclude: /node_modules/,
129
+ use: 'ignore-loader'
130
+ }
131
+ )
132
+ config.context = path.resolve(__dirname, './')
133
+ config.resolve = {
134
+ extensions: ['.js', '.vue', '.json'],
135
+ alias: {
136
+ '@vue2-client': path.resolve('src'),
137
+ '@': path.resolve('src'),
138
+ }
139
+ }
140
+ config.entry.app = ['core-js/stable', 'regenerator-runtime/runtime', 'whatwg-fetch', './src/main.js']
141
+ config.performance = {
142
+ hints: false
143
+ }
144
+ if (isProd) {
145
+ config.plugins.push(
146
+ new ThemeColorReplacer({
147
+ fileName: 'css/theme-colors-[contenthash:8].css',
148
+ matchColors: getThemeColors(),
149
+ injectCss: true,
150
+ resolveCss
151
+ })
152
+ )
153
+ }
154
+ // Ignore all locale files of moment.js
155
+ config.plugins.push(new webpack.IgnorePlugin({
156
+ resourceRegExp: /^\.\/locale$/,
157
+ contextRegExp: /moment$/
158
+ }))
159
+
160
+ config.plugins.push(
161
+ // new CopyPlugin({
162
+ // patterns: [{ from: 'node_modules/amis/sdk', to: 'amis/sdk' }],
163
+ // })
164
+ )
165
+
166
+ // 生产环境下将资源压缩成gzip格式
167
+ if (isProd) {
168
+ // add `CompressionWebpack` plugin to webpack plugins
169
+ config.plugins.push(new CompressionWebpackPlugin({
170
+ algorithm: 'gzip',
171
+ test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
172
+ threshold: 10240,
173
+ minRatio: 0.8
174
+ }))
175
+ }
176
+ // if prod, add externals
177
+ // if (isProd) {
178
+ // config.externals = assetsCDN.externals
179
+ // }
180
+ },
181
+ chainWebpack: config => {
182
+ // 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
183
+ if (isProd) {
184
+ config.optimization.minimizer('css').use(CssMinimizerPlugin, [{
185
+ minimizerOptions: {
186
+ preset: [
187
+ 'default',
188
+ {
189
+ discardComments: { removeAll: true },
190
+ colormin: false,
191
+ }
192
+ ],
193
+ ignoreOrder: true
194
+ }
195
+ }])
196
+ }
197
+ config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
198
+ },
199
+ css: {
200
+ extract: !isProd
201
+ ? {
202
+ filename: 'css/[name].css',
203
+ chunkFilename: 'css/[name].css',
204
+ }
205
+ : true,
206
+ loaderOptions: {
207
+ less: {
208
+ lessOptions: {
209
+ modifyVars: modifyVars(),
210
+ javascriptEnabled: true
211
+ }
212
+ },
213
+ sass: {}
214
+ }
215
+ },
216
+ publicPath: process.env.VUE_APP_PUBLIC_PATH,
217
+ outputDir: 'dist',
218
+ assetsDir: 'static',
219
+ productionSourceMap: false
220
+ }