vue2-client 1.8.0-1 → 1.8.0-10

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 (34) hide show
  1. package/.env +1 -0
  2. package/jest-transform-stub.js +5 -6
  3. package/jest.setup.js +7 -7
  4. package/package.json +5 -10
  5. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +2 -1
  6. package/src/base-client/components/common/XAddForm/XAddForm.vue +21 -5
  7. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +86 -53
  8. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +117 -0
  9. package/src/base-client/components/common/XDescriptions/index.js +3 -0
  10. package/src/base-client/components/common/XDescriptions/index.md +83 -0
  11. package/src/base-client/components/common/XFormTable/XFormTable.vue +11 -22
  12. package/src/base-client/components/common/XFormTable/index.md +1 -0
  13. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +1 -0
  14. package/src/base-client/plugins/tabs-page-plugin.js +5 -4
  15. package/src/config/default/antd.config.js +11 -6
  16. package/src/config/default/setting.config.js +0 -2
  17. package/src/layouts/PageLayout.vue +1 -1
  18. package/src/layouts/header/AdminHeader.vue +2 -2
  19. package/src/layouts/header/HeaderNotice.vue +3 -2
  20. package/src/layouts/tabs/TabsHead.vue +1 -2
  21. package/src/layouts/tabs/TabsView.vue +7 -7
  22. package/src/pages/CreateQueryPage.vue +4 -3
  23. package/src/pages/system/dictionary/index.vue +1 -0
  24. package/src/pages/system/monitor/loginInfor/index.vue +1 -0
  25. package/src/pages/system/monitor/operLog/index.vue +1 -0
  26. package/src/pages/system/ticket/index.vue +1 -0
  27. package/src/services/api/common.js +17 -18
  28. package/src/services/apiService.js +2 -2
  29. package/src/utils/authority-utils.js +12 -12
  30. package/src/utils/request.js +2 -1
  31. package/src/utils/routerUtil.js +4 -1
  32. package/vue.config.js +12 -6
  33. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
  34. package/webpack.config.js +0 -12
package/.env CHANGED
@@ -14,3 +14,4 @@ VUE_APP_SINGLEVALUE_KEY=admin.singlevalue
14
14
  VUE_APP_DIVISIONSOHCHINA=admin.divisionsohchina
15
15
  VUE_APP_WEB_CONFIG_KEY=admin.webconfig
16
16
  VUE_APP_API_BASE_URL=http://123.60.214.109:8405
17
+ VUE_APP_SYSTEM_NAME=af-system
@@ -1,9 +1,8 @@
1
1
  module.exports = {
2
- process() {
3
- return 'module.exports = {};';
2
+ process () {
3
+ return 'module.exports = {};'
4
4
  },
5
- getCacheKey() {
6
- return 'lessTransform';
5
+ getCacheKey () {
6
+ return 'lessTransform'
7
7
  },
8
- };
9
-
8
+ }
package/jest.setup.js CHANGED
@@ -1,7 +1,7 @@
1
- global.matchMedia = global.matchMedia || function () {
2
- return {
3
- matches: false,
4
- addListener: function () {},
5
- removeListener: function () {}
6
- }
7
- }
1
+ global.matchMedia = global.matchMedia || function () {
2
+ return {
3
+ matches: false,
4
+ addListener: function () {},
5
+ removeListener: function () {}
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.0-1",
3
+ "version": "1.8.0-10",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
@@ -32,6 +32,7 @@
32
32
  "js-base64": "^3.7.5",
33
33
  "js-cookie": "^2.2.1",
34
34
  "jsencrypt": "^3.3.2",
35
+ "lodash.clonedeep": "^4.5.0",
35
36
  "lodash.get": "^4.4.2",
36
37
  "mockjs": "^1.1.0",
37
38
  "nprogress": "^0.2.0",
@@ -57,17 +58,12 @@
57
58
  "@vue/cli-service": "^5.0.8",
58
59
  "@vue/eslint-config-standard": "^8.0.1",
59
60
  "@vue/test-utils": "^1.3.6",
60
- "@vuepress/plugin-back-to-top": "^1.9.9",
61
61
  "babel-jest": "^26.6.3",
62
62
  "babel-plugin-transform-remove-console": "^6.9.4",
63
63
  "compression-webpack-plugin": "^10.0.0",
64
64
  "css-minimizer-webpack-plugin": "^5.0.1",
65
65
  "deepmerge": "^4.3.1",
66
- "document-register-element": "^1.14.10",
67
66
  "eslint": "^8.51.0",
68
- "eslint-plugin-import": "^2.28.1",
69
- "eslint-plugin-node": "^11.1.0",
70
- "eslint-plugin-promise": "^6.1.1",
71
67
  "eslint-plugin-vue": "^9.17.0",
72
68
  "fast-deep-equal": "^3.1.3",
73
69
  "jest": "^26.6.3",
@@ -77,17 +73,16 @@
77
73
  "script-loader": "^0.7.2",
78
74
  "style-resources-loader": "^1.5.0",
79
75
  "vue-cli-plugin-style-resources-loader": "^0.1.5",
80
- "vue-custom-element": "^3.3.0",
81
76
  "vue-jest": "^4.0.1",
82
77
  "vue-template-compiler": "^2.7.14",
83
- "vuepress": "^1.9.9",
84
78
  "webpack": "^5.88.2",
85
79
  "webpack-theme-color-replacer": "^1.4.7",
86
- "whatwg-fetch": "^3.6.2"
80
+ "whatwg-fetch": "^3.6.19"
87
81
  },
88
82
  "browserslist": [
89
83
  "> 1%",
90
84
  "last 2 versions",
91
- "not ie <= 10"
85
+ "not dead",
86
+ "not ie 11"
92
87
  ]
93
88
  }
@@ -653,6 +653,7 @@ export default {
653
653
  rule: {
654
654
  required: 'false'
655
655
  },
656
+ column: [],
656
657
  selectKey: undefined,
657
658
  queryType: '=',
658
659
  formType: 'input',
@@ -680,7 +681,7 @@ export default {
680
681
  // 编辑数据字段前准备数据
681
682
  editColumnItemExecute (_item) {
682
683
  this.type = '修改'
683
- const defaultValue = { formType: 'input', type: 'string', addOrEdit: 'all', slot: { type: 'default' }, rule: {}, selectKey: {} }
684
+ const defaultValue = { formType: 'input', type: 'string', addOrEdit: 'all', slot: { type: 'default' }, rule: {}, selectKey: {}, column: [] }
684
685
  if (!_item.queryType) {
685
686
  defaultValue.queryType = '='
686
687
  }
@@ -9,7 +9,11 @@
9
9
  okText="提交"
10
10
  @cancel="close"
11
11
  @ok="$refs.nativeForm.onSubmit()">
12
- <x-add-native-form ref="nativeForm" @onSubmit="onSubmit" @tempTableModify="tempTableModify"/>
12
+ <x-add-native-form
13
+ ref="nativeForm"
14
+ @afterSubmit="afterSubmit"
15
+ @onSubmit="onSubmit"
16
+ @tempTableModify="tempTableModify"/>
13
17
  </a-modal>
14
18
  </template>
15
19
  <script>
@@ -43,6 +47,7 @@ export default {
43
47
  },
44
48
  methods: {
45
49
  init (params) {
50
+ params.showSubmitBtn = false
46
51
  const {
47
52
  businessType, title
48
53
  } = params
@@ -50,7 +55,7 @@ export default {
50
55
  this.title = title
51
56
  this.visible = true
52
57
  const that = this
53
- that.$nextTick(function () {
58
+ that.$nextTick(() => {
54
59
  that.$refs.nativeForm.init(params)
55
60
  })
56
61
  },
@@ -60,9 +65,20 @@ export default {
60
65
  },
61
66
  onSubmit (params) {
62
67
  this.loading = true
63
- this.$emit('onSubmit', params, () => {
64
- this.close()
65
- })
68
+ if (this.$listeners.onSubmit) {
69
+ // 交由父级处理
70
+ this.$emit('onSubmit', params, () => {
71
+ this.close()
72
+ })
73
+ } else {
74
+ // 触发默认提交事件
75
+ this.$refs.nativeForm.defaultSubmit(params.realForm, () => {
76
+ this.close()
77
+ })
78
+ }
79
+ },
80
+ afterSubmit (params) {
81
+ this.$emit('afterSubmit', params)
66
82
  },
67
83
  tempTableModify (params) {
68
84
  this.$emit('tempTableModify', params)
@@ -1,63 +1,66 @@
1
1
  <template>
2
- <a-form-model
3
- v-if="loaded"
4
- ref="selectForm"
5
- :zIndex="1001"
6
- :model="form"
7
- :rules="rules">
8
- <a-row :gutter="16">
9
- <x-form-item
10
- v-for="(item, index) in realJsonData"
11
- :key="index"
12
- :attr="item"
13
- :disabled="itemDisabled(item)"
14
- :files="files"
15
- :form="form"
16
- :images="images"
17
- :service-name="serviceName"
18
- mode="新增/修改"
19
- :get-data-params="getDataParams"
20
- />
21
- </a-row>
22
- <a-row :gutter="16" v-for="(groupItem, groupIndex) in groupJsonData" :key="groupIndex">
23
- <a-card :title="groupItem.name" :bordered="false" size="small">
2
+ <div>
3
+ <a-form-model
4
+ v-if="loaded"
5
+ ref="selectForm"
6
+ :zIndex="1001"
7
+ :model="form"
8
+ :rules="rules">
9
+ <a-row :gutter="16">
24
10
  <x-form-item
25
- v-for="(item, index) in groupItem.groupItems"
11
+ v-for="(item, index) in realJsonData"
26
12
  :key="index"
27
13
  :attr="item"
28
14
  :disabled="itemDisabled(item)"
29
15
  :files="files"
30
- :form="form[groupItem.model]"
31
- :images="images"
32
- :service-name="serviceName"
33
- mode="新增/修改"
34
- :get-data-params="getDataParams"
35
- />
36
- </a-card>
37
- </a-row>
38
- <a-row :gutter="16" v-for="(item, key) in simpleFormJsonData" :key="'row' + key">
39
- <a-card :title="item.name" :bordered="false" size="small">
40
- <x-form-item
41
- v-for="(formItem, formItemIndex) in item.value"
42
- :key="key + formItemIndex"
43
- :attr="formItem"
44
- :disabled="itemDisabled(formItem)"
45
- :files="files"
46
16
  :form="form"
47
17
  :images="images"
48
18
  :service-name="serviceName"
49
19
  mode="新增/修改"
50
20
  :get-data-params="getDataParams"
51
21
  />
52
- </a-card>
53
- </a-row>
54
- </a-form-model>
22
+ </a-row>
23
+ <a-row :gutter="16" v-for="(groupItem, groupIndex) in groupJsonData" :key="groupIndex">
24
+ <a-card :title="groupItem.name" :bordered="false" size="small">
25
+ <x-form-item
26
+ v-for="(item, index) in groupItem.groupItems"
27
+ :key="index"
28
+ :attr="item"
29
+ :disabled="itemDisabled(item)"
30
+ :files="files"
31
+ :form="form[groupItem.model]"
32
+ :images="images"
33
+ :service-name="serviceName"
34
+ mode="新增/修改"
35
+ :get-data-params="getDataParams"
36
+ />
37
+ </a-card>
38
+ </a-row>
39
+ <a-row :gutter="16" v-for="(item, key) in simpleFormJsonData" :key="'row' + key">
40
+ <a-card :title="item.name" :bordered="false" size="small">
41
+ <x-form-item
42
+ v-for="(formItem, formItemIndex) in item.value"
43
+ :key="key + formItemIndex"
44
+ :attr="formItem"
45
+ :disabled="itemDisabled(formItem)"
46
+ :files="files"
47
+ :form="form"
48
+ :images="images"
49
+ :service-name="serviceName"
50
+ mode="新增/修改"
51
+ :get-data-params="getDataParams"
52
+ />
53
+ </a-card>
54
+ </a-row>
55
+ </a-form-model>
56
+ <a-button v-if="showSubmitBtn" :loading="loading" type="primary" @click="onSubmit()">提交</a-button>
57
+ </div>
55
58
  </template>
56
59
  <script>
57
60
  import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
58
61
  import { formatDate } from '@vue2-client/utils/util'
59
62
  import { mapState } from 'vuex'
60
- import { runLogic } from '@vue2-client/services/api/common'
63
+ import { addOrModify, runLogic } from '@vue2-client/services/api/common'
61
64
 
62
65
  export default {
63
66
  name: 'XAddNativeForm',
@@ -82,10 +85,16 @@ export default {
82
85
  loading: false,
83
86
  // 表单Model
84
87
  form: {},
88
+ // 配置名称
89
+ configName: undefined,
90
+ // 配置内容,用于查询配置生成器的预览
91
+ configContent: undefined,
85
92
  // 表单项集合
86
93
  formItems: [],
87
94
  // 服务名称
88
95
  serviceName: undefined,
96
+ // 是否显示提交按钮
97
+ showSubmitBtn: true,
89
98
  // 修改有文件的表单时使用
90
99
  files: [],
91
100
  images: [],
@@ -142,9 +151,11 @@ export default {
142
151
  methods: {
143
152
  init (params) {
144
153
  const {
145
- formItems, viewMode, isHandleFormKey = true, serviceName, isTableTemp = false, modifyModelData = {}, businessType, title, fixedAddForm = {}, getDataParams = {}, simpleFormJsonData = {}
154
+ configName, configContent, formItems, viewMode, isHandleFormKey = true, showSubmitBtn = true, serviceName, isTableTemp = false, modifyModelData = {}, businessType, title, fixedAddForm = {}, getDataParams = {}, simpleFormJsonData = {}
146
155
  } = params
147
156
  this.loaded = false
157
+ this.configName = configName
158
+ this.configContent = configContent
148
159
  if (typeof formItems === 'string') {
149
160
  this.formItems = JSON.parse(formItems)
150
161
  } else {
@@ -152,6 +163,7 @@ export default {
152
163
  }
153
164
  this.viewMode = viewMode
154
165
  this.isHandleFormKey = isHandleFormKey
166
+ this.showSubmitBtn = showSubmitBtn
155
167
  this.serviceName = serviceName
156
168
  this.businessType = businessType
157
169
  this.title = title
@@ -334,21 +346,42 @@ export default {
334
346
  }
335
347
  if (this.viewMode) {
336
348
  this.$message.info('预览模式禁止新增和修改')
337
- console.log({
349
+ return false
350
+ }
351
+ if (this.$listeners.onSubmit) {
352
+ // 交由父级处理
353
+ this.$emit('onSubmit', {
338
354
  businessType: this.businessType,
339
355
  serviceName: this.serviceName,
340
356
  realForm: realForm,
341
357
  currUserName: this.currUser.name
342
358
  })
343
- return false
359
+ } else {
360
+ this.defaultSubmit(realForm)
361
+ }
362
+ })
363
+ },
364
+ // 默认提交事件
365
+ defaultSubmit (realForm, callback) {
366
+ // 组织请求
367
+ const requestParameters = {
368
+ queryParamsName: this.configName,
369
+ queryParams: this.configContent,
370
+ form: realForm,
371
+ businessType: this.businessType,
372
+ operator: this.currUser.name
373
+ }
374
+ addOrModify(requestParameters, this.serviceName).then(data => {
375
+ this.$message.success(this.businessType + '成功!')
376
+ // commit
377
+ this.$emit('afterSubmit', { type: this.businessType, id: data.id, form: requestParameters.form })
378
+ }).catch(e => {
379
+ this.$message.error(this.businessType + '失败:' + e)
380
+ }).finally(() => {
381
+ this.loading = false
382
+ if (callback) {
383
+ callback()
344
384
  }
345
- // 交由父级处理
346
- this.$emit('onSubmit', {
347
- businessType: this.businessType,
348
- serviceName: this.serviceName,
349
- realForm: realForm,
350
- currUserName: this.currUser.name
351
- })
352
385
  })
353
386
  },
354
387
  // 获取表单字段实际值
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <div>
3
+ <a-skeleton :loading="loading" :paragraph="{ rows: 4 }" />
4
+ <div v-show="!loading">
5
+ <template v-if="!loadError">
6
+ <a-descriptions v-if="realData" :column="isMobile ? 1 : column" size="small" :title="title">
7
+ <a-descriptions-item
8
+ v-for="(value, key) in realData"
9
+ :key="key"
10
+ :label="key">
11
+ {{ formatText(value) }}
12
+ </a-descriptions-item>
13
+ </a-descriptions>
14
+ </template>
15
+ <template v-else>
16
+ <a-empty>
17
+ <span slot="description"> 页面配置不存在,请联系系统管理员 </span>
18
+ </a-empty>
19
+ </template>
20
+ </div>
21
+ </div>
22
+ </template>
23
+ <script>
24
+
25
+ import { mapState } from 'vuex'
26
+ import { getConfig } from '@vue2-client/services/api'
27
+
28
+ export default {
29
+ name: 'XDescriptions',
30
+ components: {
31
+ },
32
+ props: {
33
+ // 标题
34
+ title: {
35
+ type: String,
36
+ required: true
37
+ },
38
+ // 内容
39
+ content: {
40
+ type: Object,
41
+ required: true
42
+ },
43
+ // 模型名
44
+ model: {
45
+ type: String,
46
+ required: true
47
+ },
48
+ // 配置名称
49
+ configName: {
50
+ type: String,
51
+ required: true
52
+ },
53
+ // 配置所属命名空间
54
+ serviceName: {
55
+ type: String,
56
+ default: undefined
57
+ },
58
+ // 每列显示数量
59
+ column: {
60
+ type: Number,
61
+ default: 2
62
+ }
63
+ },
64
+ created () {
65
+ this.initConfig()
66
+ },
67
+ data () {
68
+ return {
69
+ // 加载状态
70
+ loading: false,
71
+ loadError: false,
72
+ realData: undefined
73
+ }
74
+ },
75
+ computed: {
76
+ ...mapState('setting', ['isMobile'])
77
+ },
78
+ methods: {
79
+ initConfig () {
80
+ this.loading = true
81
+ this.loadError = false
82
+ if (this.configName) {
83
+ this.getConfig()
84
+ } else {
85
+ this.loading = false
86
+ this.loadError = true
87
+ }
88
+ },
89
+ getConfig () {
90
+ getConfig(this.configName, this.serviceName, (res) => {
91
+ const mapIndex = {}
92
+ res.formJson.filter(item => {
93
+ const model = item.model
94
+ return model.indexOf(this.model) > 0
95
+ })[0].groupItems.forEach(item => {
96
+ mapIndex[item.model.substring(item.model.indexOf('_') + 1)] = item.name
97
+ })
98
+ const result = {}
99
+ for (const key of Object.keys(this.content)) {
100
+ const name = mapIndex[key]
101
+ if (name) {
102
+ result[name] = this.content[key]
103
+ } else {
104
+ result[key] = this.content[key]
105
+ }
106
+ }
107
+ this.realData = result
108
+ this.loading = false
109
+ })
110
+ },
111
+ // 文字格式化
112
+ formatText (value) {
113
+ return value || '--'
114
+ }
115
+ }
116
+ }
117
+ </script>
@@ -0,0 +1,3 @@
1
+ import XDescriptions from './XDescriptions.vue'
2
+
3
+ export default XDescriptions
@@ -0,0 +1,83 @@
1
+ # XDescriptions
2
+
3
+ 动态Descriptions控件,根据JSON配置动态生成Descriptions
4
+
5
+
6
+ ## 何时使用
7
+
8
+ 当需要一个动态生成的Descriptions时
9
+
10
+
11
+ 引用方式:
12
+
13
+ ```javascript
14
+ import XDescriptions from '@vue2-client/base-client/components/XDescriptions/XDescriptions'
15
+
16
+ export default {
17
+ components: {
18
+ XDescriptions
19
+ }
20
+ }
21
+ ```
22
+
23
+
24
+
25
+ ## 代码演示
26
+
27
+ ```html
28
+ <x-descriptions
29
+ title="设备属性"
30
+ :content="details.prop_json"
31
+ :queryParamsName="queryParamsName">
32
+ </x-descriptions>
33
+ ```
34
+
35
+ ## API
36
+
37
+ | 参数 | 说明 | 类型 | 默认值 |
38
+ |-----------------|-------------|--------|------|
39
+ | title | 业务名称 | String | '' |
40
+ | content | 业务内容 | String | '' |
41
+ | queryParamsName | 查询配置JSON文件名 | String | null |
42
+ | serviceName | 配置所属命名空间 | String | null |
43
+
44
+ ## 例子1
45
+ ----
46
+ (基础使用)
47
+
48
+ ```vue
49
+ <template>
50
+ <x-descriptions
51
+ title="设备属性"
52
+ :content="details.prop_json"
53
+ :configName="configName">
54
+ </x-descriptions>
55
+ </template>
56
+
57
+ <script>
58
+ import XDescriptions from '@vue2-client/base-client/components/XDescriptions/XDescriptions'
59
+
60
+ export default {
61
+ components: {
62
+ XDescriptions
63
+ },
64
+ data () {
65
+ return {
66
+ // 查询配置文件名
67
+ configName: 'logQueryParams',
68
+ details: {
69
+ prop_json: {
70
+ 规格: 'G2.5'
71
+ }
72
+ }
73
+ }
74
+ },
75
+ created () {
76
+
77
+ },
78
+ methods: {
79
+
80
+ }
81
+ }
82
+ </script>
83
+ ```
@@ -5,7 +5,7 @@
5
5
  <template v-if="!loadError">
6
6
  <x-add-form
7
7
  ref="xAddForm"
8
- @onSubmit="onAddOrEditSubmit"
8
+ @afterSubmit="onAddOrEditSubmitAfterSubmit"
9
9
  />
10
10
  <x-form
11
11
  ref="xForm"
@@ -57,7 +57,7 @@ import XForm from '@vue2-client/base-client/components/common/XForm'
57
57
  import XAddForm from '@vue2-client/base-client/components/common/XAddForm'
58
58
  import XTable from '@vue2-client/base-client/components/common/XTable'
59
59
  import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
60
- import { addOrModify, getConfig, getConfigByLogic, parseConfig } from '@vue2-client/services/api/common'
60
+ import { getConfig, getConfigByLogic, parseConfig } from '@vue2-client/services/api/common'
61
61
  import { mapState } from 'vuex'
62
62
 
63
63
  export default {
@@ -240,27 +240,12 @@ export default {
240
240
  }
241
241
  },
242
242
  /**
243
- * 提交新增表单事件
243
+ * 提交新增/修改表单后事件
244
244
  */
245
- onAddOrEditSubmit (res, callback) {
246
- // 组织请求
247
- const requestParameters = {
248
- queryParamsName: this.queryParamsName,
249
- queryParams: this.queryParamsJson,
250
- form: res.realForm,
251
- businessType: res.businessType,
252
- operator: res.currUserName
253
- }
254
- addOrModify(requestParameters, this.serviceName).then(data => {
255
- this.$message.success(res.businessType + '成功!')
256
- this.refreshTable(res.businessType === '新增')
257
- // commit
258
- this.$emit('afterSubmit', { type: res.businessType, id: data.id, form: requestParameters.form })
259
- }).catch(e => {
260
- this.$message.error(res.businessType + '失败:' + e)
261
- }).finally(() => {
262
- callback()
263
- })
245
+ onAddOrEditSubmitAfterSubmit (res) {
246
+ this.refreshTable(res.businessType === '新增')
247
+ // commit
248
+ this.$emit('afterSubmit', res)
264
249
  },
265
250
  /**
266
251
  * 表格查询后事件
@@ -288,6 +273,8 @@ export default {
288
273
  businessType: '新增',
289
274
  title: this.title,
290
275
  isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
276
+ configName: this.queryParamsName,
277
+ configContent: this.queryParamsJson,
291
278
  formItems: res.formJson,
292
279
  viewMode: this.viewMode,
293
280
  isTableTemp: this.isTableTemp,
@@ -306,6 +293,8 @@ export default {
306
293
  businessType: '修改',
307
294
  title: this.title,
308
295
  isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
296
+ configName: this.queryParamsName,
297
+ configContent: this.queryParamsJson,
309
298
  formItems: res.formJson,
310
299
  viewMode: this.viewMode,
311
300
  isTableTemp: this.isTableTemp,
@@ -38,6 +38,7 @@ export default {
38
38
  | title | 业务名称 | String | '' |
39
39
  | queryParamsName | 查询配置JSON文件名 | String | null |
40
40
  | queryParamsJson | 查询配置文件Json,用于查询配置生成器的预览 | Object | null |
41
+ | serviceName | 配置所属命名空间 | String | null |
41
42
  | logicName | 通过logic获取表单表格配置 | String | null |
42
43
  | logicParam | 执行logic传递的参数 | Object | null |
43
44
  | fixedQueryForm | 固定查询表单,会和查询表单合并查询 | Object | {} |
@@ -44,6 +44,7 @@
44
44
  title="字典数据配置"
45
45
  :fixed-add-form="fixedAddForm"
46
46
  :fixed-query-form="fixedQueryForm"
47
+ serviceName="af-system"
47
48
  queryParamsName="crud_dictionary_value_manage"
48
49
  @afterSubmit="afterSubmit"
49
50
  >
@@ -17,8 +17,9 @@ const TabsPagePlugin = {
17
17
  },
18
18
  $setPageTitle (route, title) {
19
19
  if (title) {
20
- let path = typeof route === 'object' ? route.path : route
21
- path = path && path.split('?')[0]
20
+ // let path = typeof route === 'object' ? route.path : route
21
+ // path = path && path.split('?')[0]
22
+ const path = typeof route === 'object' ? this.$router.resolve(route).route.fullPath : route
22
23
  this.$store.commit('setting/setCustomTitle', { path, title })
23
24
  }
24
25
  }
@@ -26,8 +27,8 @@ const TabsPagePlugin = {
26
27
  computed: {
27
28
  customTitle () {
28
29
  const customTitles = this.$store.state.setting.customTitles
29
- const path = this.$route.path.split('?')[0]
30
- const custom = customTitles.find(item => item.path === path)
30
+ // const path = this.$route.path.split('?')[0]
31
+ const custom = customTitles.find(item => item.path === this.$route.fullPath)
31
32
  return custom && custom.title
32
33
  }
33
34
  }
@@ -22,10 +22,11 @@ const ANTD = {
22
22
  'component-background': '#fff',
23
23
  'heading-color': 'rgba(0, 0, 0, 0.85)',
24
24
  'text-color': 'rgba(0, 0, 0, 0.65)',
25
- 'text-color-inverse': '#fff',
25
+ 'text-color-inverse': '#fefefe',
26
26
  'text-color-secondary': 'rgba(0, 0, 0, 0.45)',
27
27
  'shadow-color': 'rgba(0, 0, 0, 0.15)',
28
28
  'border-color-split': '#f0f0f0',
29
+ 'border-color-base': '#d9d9d9',
29
30
  'background-color-light': '#fafafa',
30
31
  'background-color-base': '#f5f5f5',
31
32
  'table-selected-row-bg': '#fafafa',
@@ -34,8 +35,9 @@ const ANTD = {
34
35
  'disabled-color': 'rgba(0, 0, 0, 0.25)',
35
36
  'menu-dark-color': 'rgba(254, 254, 254, 0.65)',
36
37
  'menu-dark-highlight-color': '#fefefe',
38
+ 'menu-dark-selected-item-icon-color': '#fefefe',
37
39
  'menu-dark-arrow-color': '#fefefe',
38
- 'btn-primary-color': '#fff'
40
+ 'btn-primary-color': '#fefefe'
39
41
  },
40
42
  light: {
41
43
  'layout-body-background': '#f0f2f5',
@@ -43,10 +45,11 @@ const ANTD = {
43
45
  'component-background': '#fff',
44
46
  'heading-color': 'rgba(0, 0, 0, 0.85)',
45
47
  'text-color': 'rgba(0, 0, 0, 0.65)',
46
- 'text-color-inverse': '#fff',
48
+ 'text-color-inverse': '#fefefe',
47
49
  'text-color-secondary': 'rgba(0, 0, 0, 0.45)',
48
50
  'shadow-color': 'rgba(0, 0, 0, 0.15)',
49
51
  'border-color-split': '#f0f0f0',
52
+ 'border-color-base': '#d9d9d9',
50
53
  'background-color-light': '#fafafa',
51
54
  'background-color-base': '#f5f5f5',
52
55
  'table-selected-row-bg': '#fafafa',
@@ -56,7 +59,7 @@ const ANTD = {
56
59
  'menu-dark-color': 'rgba(1, 1, 1, 0.65)',
57
60
  'menu-dark-highlight-color': '#fefefe',
58
61
  'menu-dark-arrow-color': '#fefefe',
59
- 'btn-primary-color': '#fff'
62
+ 'btn-primary-color': '#fefefe'
60
63
  },
61
64
  night: {
62
65
  'layout-body-background': '#000',
@@ -64,10 +67,11 @@ const ANTD = {
64
67
  'component-background': '#141414',
65
68
  'heading-color': 'rgba(255, 255, 255, 0.85)',
66
69
  'text-color': 'rgba(255, 255, 255, 0.85)',
67
- 'text-color-inverse': '#141414',
70
+ 'text-color-inverse': '#fefefe',
68
71
  'text-color-secondary': 'rgba(255, 255, 255, 0.45)',
69
72
  'shadow-color': 'rgba(255, 255, 255, 0.15)',
70
73
  'border-color-split': '#303030',
74
+ 'border-color-base': '#282828',
71
75
  'background-color-light': '#ffffff0a',
72
76
  'background-color-base': '#2a2a2a',
73
77
  'table-selected-row-bg': '#ffffff0a',
@@ -76,8 +80,9 @@ const ANTD = {
76
80
  'disabled-color': 'rgba(255, 255, 255, 0.25)',
77
81
  'menu-dark-color': 'rgba(254, 254, 254, 0.65)',
78
82
  'menu-dark-highlight-color': '#fefefe',
83
+ 'menu-dark-selected-item-icon-color': '#fefefe',
79
84
  'menu-dark-arrow-color': '#fefefe',
80
- 'btn-primary-color': '#141414'
85
+ 'btn-primary-color': '#fefefe'
81
86
  }
82
87
  }
83
88
  }
@@ -40,8 +40,6 @@ module.exports = {
40
40
  // 通知
41
41
  notice: true
42
42
  },
43
- // 配置的默认命名空间
44
- defaultServiceName: 'af-system',
45
43
  // 旧系统路径
46
44
  iframeSrc: '../singlepage/page.html',
47
45
  // 兼容旧版本 V3(最新V3产品) OA(公司OA)
@@ -99,7 +99,7 @@ export default {
99
99
  const routes = this.$route.matched
100
100
  const path = this.$route.path
101
101
  const breadcrumb = []
102
- routes.filter(item => path.includes(item.path))
102
+ routes.filter(item => path.includes(item.path) || item.regex.test(path))
103
103
  .forEach(route => {
104
104
  const path = route.path.length === 0 ? '/home' : route.path
105
105
  breadcrumb.push(this.$t(getI18nKey(path)))
@@ -42,8 +42,8 @@ import { indexedDB } from '@vue2-client/utils/indexedDB'
42
42
 
43
43
  const loadComponents = (value) => {
44
44
  const component = {
45
- HeaderSearch: import('./HeaderSearch'),
46
- HeaderNotice: import('./HeaderNotice'),
45
+ HeaderSearch: import('@vue2-client/layouts/header/HeaderSearch'),
46
+ HeaderNotice: import('@vue2-client/layouts/header/HeaderNotice')
47
47
  }
48
48
  if (!value) {
49
49
  return component
@@ -135,9 +135,10 @@ export default {
135
135
  this.loading = false
136
136
  return
137
137
  }
138
- this.loadding = true
138
+ if (this.show) return
139
+ this.loading = true
139
140
  setTimeout(() => {
140
- this.loadding = false
141
+ this.loading = false
141
142
  }, 1000)
142
143
  }
143
144
  }
@@ -97,8 +97,7 @@
97
97
  this.$emit('contextmenu', pageKey, e)
98
98
  },
99
99
  pageName (page) {
100
- const pagePath = page.fullPath.split('?')[0]
101
- const custom = this.customTitles.find(item => item.path === pagePath)
100
+ const custom = this.customTitles.find(item => item.path === page.path)
102
101
  return (custom && custom.title) || page.title || this.$t(getI18nKey(page.keyPath))
103
102
  }
104
103
  }
@@ -14,7 +14,7 @@
14
14
  <div :class="['tabs-view-content', layout, pageWidth]" :style="`margin-top: ${multiPage ? -24 : 0}px`">
15
15
  <page-toggle-transition v-show="!$route.meta.singlePage" :disabled="animate.disabled" :animate="animate.name" :direction="animate.direction">
16
16
  <a-keep-alive :exclude-keys="excludeKeys" v-if="multiPage && cachePage" v-model="clearCaches">
17
- <router-view v-if="!refreshing" ref="tabContent" :key="$route.path" />
17
+ <router-view v-if="!refreshing" ref="tabContent" :key="$route.fullPath" />
18
18
  </a-keep-alive>
19
19
  <router-view ref="tabContent" v-else-if="!refreshing" />
20
20
  </page-toggle-transition>
@@ -75,10 +75,10 @@ export default {
75
75
  this.loadCacheConfig(this.$router?.options?.routes)
76
76
  this.loadCachedTabs()
77
77
  const route = this.$route
78
- if (this.pageList.findIndex(item => item.path === route.path) === -1) {
78
+ if (this.pageList.findIndex(item => item.path === route.fullPath) === -1) {
79
79
  this.pageList.push(this.createPage(route))
80
80
  }
81
- this.activePage = route.path
81
+ this.activePage = route.fullPath
82
82
  if (this.multiPage) {
83
83
  this.$nextTick(() => {
84
84
  this.setCachedKey(route)
@@ -99,8 +99,8 @@ export default {
99
99
  this.loadCacheConfig(val)
100
100
  },
101
101
  $route: function (newRoute) {
102
- this.activePage = newRoute.path
103
- const page = this.pageList.find(item => item.path === newRoute.path)
102
+ this.activePage = newRoute.fullPath
103
+ const page = this.pageList.find(item => item.path === newRoute.fullPath)
104
104
  if (!this.multiPage) {
105
105
  this.pageList = [this.createPage(newRoute)]
106
106
  } else if (page) {
@@ -288,7 +288,7 @@ export default {
288
288
  keyPath: route.matched[route.matched.length - 1].path,
289
289
  fullPath: route.fullPath,
290
290
  loading: false,
291
- path: route.path,
291
+ path: route.fullPath,
292
292
  title: route.meta && route.meta.page && route.meta.page.title,
293
293
  unclose: route.meta && route.meta.page && (route.meta.page.closable === false)
294
294
  }
@@ -340,7 +340,7 @@ export default {
340
340
  this.allSinglePages.push(item)
341
341
  }
342
342
  if (!cacheAble) {
343
- this.excludeKeys.push(new RegExp(`${item.path}\\d+$`))
343
+ this.excludeKeys.push(new RegExp(`${item.path.replace(/:[^/]*/g, '[^/]*')}(\\?.*)?\\d*$`))
344
344
  }
345
345
  if (item.children) {
346
346
  this.loadCacheConfig(item.children, cacheAble)
@@ -24,7 +24,7 @@
24
24
  >
25
25
  <a-form-model :model="form" :rules="rules" ref="liuliModel">
26
26
  <a-form-model-item label="命名空间" prop="namespaceName">
27
- <a-input v-model="form.namespaceName" :placeholder="'默认值:' + this.defaultServiceName"/>
27
+ <a-input v-model="form.namespaceName" :placeholder="'默认值:' + systemName"/>
28
28
  </a-form-model-item>
29
29
  <a-form-model-item label="配置名称" prop="configName">
30
30
  <a-input v-model="form.configName"/>
@@ -58,7 +58,6 @@
58
58
  <script>
59
59
  import CreateQuery from '@vue2-client/base-client/components/common/CreateQuery'
60
60
  import CreateSimpleFormQuery from '@vue2-client/base-client/components/common/CreateSimpleFormQuery'
61
- import { mapState } from 'vuex'
62
61
  import { getNativeConfig } from '@vue2-client/services/api/common'
63
62
 
64
63
  export default {
@@ -88,7 +87,9 @@ export default {
88
87
  }
89
88
  },
90
89
  computed: {
91
- ...mapState('setting', ['defaultServiceName'])
90
+ systemName () {
91
+ return process.env.VUE_APP_SYSTEM_NAME
92
+ }
92
93
  },
93
94
  methods: {
94
95
  showDrawer () {
@@ -6,6 +6,7 @@
6
6
  :visible.sync="detailVisible"
7
7
  />
8
8
  <x-form-table
9
+ serviceName="af-system"
9
10
  :queryParamsName="queryParamsName"
10
11
  title="字典"
11
12
  @action="toDetail">
@@ -2,6 +2,7 @@
2
2
  <a-card :bordered="false">
3
3
  <x-form-table
4
4
  title="登录日志"
5
+ serviceName="af-system"
5
6
  :queryParamsName="queryParamsName"
6
7
  @action="toDetail">
7
8
  </x-form-table>
@@ -3,6 +3,7 @@
3
3
  <x-form-table
4
4
  title="操作日志"
5
5
  :queryParamsName="queryParamsName"
6
+ serviceName="af-system"
6
7
  @action="toDetail">
7
8
  </x-form-table>
8
9
  </a-card>
@@ -239,6 +239,7 @@
239
239
  <x-form-table
240
240
  v-if="tabActiveKey === 'workHistory'"
241
241
  :fixed-query-form="fixedQueryForm"
242
+ serviceName="af-system"
242
243
  :queryParamsName="queryParamsName"
243
244
  title="已提交工单"
244
245
  @action="toDetail">
@@ -5,7 +5,6 @@ import { blobValidate } from '@vue2-client/utils/common'
5
5
  import errorCode from '@vue2-client/utils/errorCode'
6
6
  import { saveAs } from 'file-saver'
7
7
  import { post } from '@vue2-client/services/api/restTools'
8
- import setting from '@vue2-client/store/modules/setting'
9
8
 
10
9
  const commonApi = {
11
10
  // 获取配置
@@ -36,15 +35,15 @@ const commonApi = {
36
35
  getEmpTree: '/api/af-system/logic/getEmpTree',
37
36
  }
38
37
 
39
- export function getConfigUrl (serviceName = setting.state.defaultServiceName) {
38
+ export function getConfigUrl (serviceName = process.env.VUE_APP_SYSTEM_NAME) {
40
39
  return '/api/' + serviceName + '/' + commonApi.getConfig
41
40
  }
42
41
 
43
- export function getNativeConfigUrl (serviceName = setting.state.defaultServiceName) {
42
+ export function getNativeConfigUrl (serviceName = process.env.VUE_APP_SYSTEM_NAME) {
44
43
  return '/api/' + serviceName + '/' + commonApi.getNativeConfig
45
44
  }
46
45
 
47
- export function parseConfigUrl (serviceName = setting.state.defaultServiceName) {
46
+ export function parseConfigUrl (serviceName = process.env.VUE_APP_SYSTEM_NAME) {
48
47
  return '/api/' + serviceName + '/' + commonApi.parseConfig
49
48
  }
50
49
 
@@ -61,11 +60,11 @@ export function getDictionaryParam () {
61
60
  * @param serviceName 命名空间名称
62
61
  * @param callback 回调函数
63
62
  */
64
- export function getConfig (configName, serviceName = setting.state.defaultServiceName, callback) {
63
+ export function getConfig (configName, serviceName = process.env.VUE_APP_SYSTEM_NAME, callback) {
65
64
  indexedDB.getByWeb(configName, getConfigUrl(serviceName), { configName: configName }, callback)
66
65
  }
67
66
 
68
- export function getNativeConfig (configName, serviceName = setting.state.defaultServiceName) {
67
+ export function getNativeConfig (configName, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
69
68
  return post(getNativeConfigUrl(serviceName), { configName: configName })
70
69
  }
71
70
 
@@ -76,7 +75,7 @@ export function getNativeConfig (configName, serviceName = setting.state.default
76
75
  * @param serviceName 命名空间名称
77
76
  * @param callback 回调函数
78
77
  */
79
- export function getConfigByLogic (logicName, parameter, serviceName = setting.state.defaultServiceName, callback) {
78
+ export function getConfigByLogic (logicName, parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME, callback) {
80
79
  indexedDB.getByWeb(`${logicName}_${JSON.stringify(parameter)}`, '/api/' + serviceName + '/logic/' + logicName,
81
80
  parameter, callback)
82
81
  }
@@ -87,7 +86,7 @@ export function getConfigByLogic (logicName, parameter, serviceName = setting.st
87
86
  * @param configType 配置类型
88
87
  * @param serviceName 命名空间名称
89
88
  */
90
- export function parseConfig (configContent, configType, serviceName = setting.state.defaultServiceName) {
89
+ export function parseConfig (configContent, configType, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
91
90
  const url = parseConfigUrl(serviceName)
92
91
  return post(url, {
93
92
  configType: configType,
@@ -98,61 +97,61 @@ export function parseConfig (configContent, configType, serviceName = setting.st
98
97
  /**
99
98
  * 通用执行业务逻辑
100
99
  */
101
- export function runLogic (logicName, parameter, serviceName = setting.state.defaultServiceName) {
100
+ export function runLogic (logicName, parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
102
101
  return post('/api/' + serviceName + '/logic/' + logicName, parameter)
103
102
  }
104
103
 
105
104
  /**
106
105
  * 通用查询
107
106
  */
108
- export function query (parameter, serviceName = setting.state.defaultServiceName) {
107
+ export function query (parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
109
108
  return post('/api/' + serviceName + '/' + commonApi.query, parameter, null)
110
109
  }
111
110
 
112
111
  /**
113
112
  * 通用表单查询
114
113
  */
115
- export function queryWithResource (parameter, serviceName = setting.state.defaultServiceName) {
114
+ export function queryWithResource (parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
116
115
  return post('/api/' + serviceName + '/' + commonApi.queryWithResource, parameter, null)
117
116
  }
118
117
 
119
118
  /**
120
119
  * 通用新增/修改
121
120
  */
122
- export function addOrModify (parameter, serviceName = setting.state.defaultServiceName) {
121
+ export function addOrModify (parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
123
122
  return post('/api/' + serviceName + '/' + commonApi.addOrModify, parameter, null)
124
123
  }
125
124
 
126
125
  /**
127
126
  * 通用删除
128
127
  */
129
- export function remove (parameter, serviceName = setting.state.defaultServiceName) {
128
+ export function remove (parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
130
129
  return post('/api/' + serviceName + '/' + commonApi.delete, parameter, null)
131
130
  }
132
131
 
133
132
  /**
134
133
  * 通用导入
135
134
  */
136
- export function importData (parameter, serviceName = setting.state.defaultServiceName) {
135
+ export function importData (parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
137
136
  return post('/api/' + serviceName + '/' + commonApi.importData, parameter, null)
138
137
  }
139
138
 
140
139
  /**
141
140
  * 通用导出
142
141
  */
143
- export function exportData (parameter, serviceName = setting.state.defaultServiceName) {
142
+ export function exportData (parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
144
143
  return post('/api/' + serviceName + '/' + commonApi.exportData, parameter, null)
145
144
  }
146
145
 
147
146
  /**
148
147
  * 通用上传
149
148
  */
150
- export function upload (parameter, serviceName = setting.state.defaultServiceName, config) {
149
+ export function upload (parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME, config) {
151
150
  return post('/api/' + serviceName + '/' + commonApi.upload, parameter, config)
152
151
  }
153
152
 
154
153
  // 通用下载
155
- export function download (parameter, filename, serviceName = setting.state.defaultServiceName) {
154
+ export function download (parameter, filename, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
156
155
  const notificationKey = 'download'
157
156
  notification.open({
158
157
  key: notificationKey,
@@ -192,7 +191,7 @@ export function download (parameter, filename, serviceName = setting.state.defau
192
191
  }
193
192
 
194
193
  // 文件删除
195
- export function fileDelete (parameter, serviceName = setting.state.defaultServiceName) {
194
+ export function fileDelete (parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
196
195
  return post('/api/' + serviceName + '/' + commonApi.fileEntity, parameter)
197
196
  }
198
197
 
@@ -5,8 +5,8 @@
5
5
  module.exports = {
6
6
  LOGIN: `/rs/logic/getLogin`,
7
7
  MODIFY_PASSWORD: '/rs/user/modifypwd',
8
- V4_LOGIN: '/auth/login',
9
- V4_LOGOUT: '/auth/logout',
8
+ V4_LOGIN: '/api/af-auth/login',
9
+ V4_LOGOUT: '/api/af-auth/logout',
10
10
  ROUTES: `/rs/user/userLogin`,
11
11
  SEARCH: `/rs/search`,
12
12
  GOODS: `/goods`,
@@ -8,10 +8,12 @@ function hasPermission (authority, permissions) {
8
8
  let required = '*'
9
9
  if (typeof authority === 'string') {
10
10
  required = authority
11
+ } else if (Array.isArray(authority)) {
12
+ required = authority
11
13
  } else if (typeof authority === 'object') {
12
14
  required = authority.permission
13
15
  }
14
- return required === '*' || (permissions && permissions.findIndex(item => item === required || item.id === required) !== -1)
16
+ return required === '*' || hasAnyItem(required, permissions, (r, t) => !!(r === t || r === t.id))
15
17
  }
16
18
 
17
19
  /**
@@ -24,25 +26,23 @@ function hasRole (authority, roles) {
24
26
  if (typeof authority === 'object') {
25
27
  required = authority.role
26
28
  }
27
- return authority === '*' || hasAnyRole(required, roles)
29
+ return authority === '*' || hasAnyItem(required, roles, (r, t) => !!(r === t || r === t.id))
28
30
  }
29
31
 
30
32
  /**
31
- * 判断是否有需要的任意一个角色
32
- * @param required {String | Array[String]} 需要的角色,可以是单个角色或者一个角色数组
33
- * @param roles 拥有的角色
33
+ * 判断目标数组是否有所需元素
34
+ * @param {String | String[]}required 所需元素,数组或单个元素
35
+ * @param {String[]|Object[]} source 目标数组
36
+ * @param {Function} filter 匹配条件
37
+ * (r: String, s: String|Object) => boolean
34
38
  * @returns {boolean}
35
39
  */
36
- function hasAnyRole (required, roles) {
40
+ function hasAnyItem (required, source, filter) {
37
41
  if (!required) {
38
42
  return false
39
- } else if (Array.isArray(required)) {
40
- return roles.findIndex(role => {
41
- return required.findIndex(item => item === role || item === role.id) !== -1
42
- }) !== -1
43
- } else {
44
- return roles.findIndex(role => role === required || role.id === required) !== -1
45
43
  }
44
+ const checkedList = Array.isArray(required) ? required : [required]
45
+ return !!source.find(s => checkedList.find(r => filter(r, s)))
46
46
  }
47
47
 
48
48
  /**
@@ -5,6 +5,7 @@ import notification from 'ant-design-vue/es/notification'
5
5
  import errorCode from '@vue2-client/utils/errorCode'
6
6
  import qs from 'qs'
7
7
  import { logout } from '@vue2-client/services/user'
8
+ import { V4_LOGIN } from '@vue2-client/services/apiService'
8
9
 
9
10
  // 是否显示重新登录
10
11
  let isReloginShow
@@ -134,7 +135,7 @@ function loadInterceptors () {
134
135
  // 如果 token 存在
135
136
  // 让每个请求携带自定义 token 请根据实际情况自行修改
136
137
  if (token) {
137
- if (config.url !== '/auth/login') {
138
+ if (config.url !== V4_LOGIN) {
138
139
  // 判断是否为V4环境
139
140
  const compatible = getSystemVersion()
140
141
  if (compatible === 'V4') {
@@ -117,6 +117,9 @@ function parseRoutes (routesConfig, routerMap) {
117
117
  redirect: routeCfg.redirect || router.redirect,
118
118
  meta: { ...meta, authority: meta.authority || '*' }
119
119
  }
120
+ if (router.beforeEnter) {
121
+ route.beforeEnter = router.beforeEnter
122
+ }
120
123
  if (routeCfg.invisible || router.invisible) {
121
124
  route.meta.invisible = true
122
125
  }
@@ -265,7 +268,7 @@ function formatAuthority (routes, pAuthorities = []) {
265
268
  let authority = {}
266
269
  if (!meta.authority) {
267
270
  authority = defaultAuthority
268
- } else if (typeof meta.authority === 'string') {
271
+ } else if (typeof meta.authority === 'string' || Array.isArray(meta.authority)) {
269
272
  authority.permission = meta.authority
270
273
  } else if (typeof meta.authority === 'object') {
271
274
  authority = meta.authority
package/vue.config.js CHANGED
@@ -24,11 +24,6 @@ module.exports = {
24
24
  ws: false,
25
25
  changeOrigin: true
26
26
  },
27
- '/auth': {
28
- pathRewrite: { '^/auth/': '/rs/auth/' },
29
- target: local,
30
- changeOrigin: true
31
- },
32
27
  '/api': {
33
28
  pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
34
29
  // pathRewrite: { '^/api': '/' },
@@ -40,6 +35,9 @@ module.exports = {
40
35
  target: 'http://127.0.0.1:4789',
41
36
  changeOrigin: true
42
37
  }
38
+ },
39
+ client: {
40
+ overlay: false
43
41
  }
44
42
  },
45
43
  pluginOptions: {
@@ -49,6 +47,14 @@ module.exports = {
49
47
  }
50
48
  },
51
49
  configureWebpack: config => {
50
+ config.context = path.resolve(__dirname, './')
51
+ config.resolve = {
52
+ extensions: ['.js', '.vue', '.json'],
53
+ alias: {
54
+ '@': path.resolve('src'),
55
+ '@vue2-client': path.resolve('src')
56
+ }
57
+ }
52
58
  config.entry.app = ['core-js/stable', 'regenerator-runtime/runtime', 'whatwg-fetch', './src/main.js']
53
59
  config.performance = {
54
60
  hints: false
@@ -70,7 +76,7 @@ module.exports = {
70
76
  if (isProd) {
71
77
  // add `CompressionWebpack` plugin to webpack plugins
72
78
  config.plugins.push(new CompressionWebpackPlugin({
73
- algorithm: require('zlib').createGzip,
79
+ algorithm: 'gzip',
74
80
  test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
75
81
  threshold: 10240,
76
82
  minRatio: 0.8
@@ -1,15 +1,15 @@
1
- # vue2迁移vue3
2
-
3
- 1. 完成vue-cli,webpack,babel,eslint的升级
4
- - core-js 3.30.1 -> 3.33.0
5
- - add regenerator-runtime
6
- - @babel/core 7.21.4 -> 7.22.20
7
- - babel-eslint 10.1.0 -> @babel/eslint-parser 7.22.15
8
- - @vue/cli 4.5.19 -> 5.0.8
9
- - babel-jest 25.5.1 -> 26.6.3
10
- - eslint 6.8.0 -> 7.32.0
11
- - jest 24.0.0 -> 26.6.3
12
- - webpack 4.46.0 -> 5.88.2
13
- 2. 完成vue2的2.7升级
14
- - vue 2.6.14 -> 2.7.14
15
- - eslint 7.32.0 -> 8.51.0
1
+ # vue2迁移vue3
2
+
3
+ 1. 完成vue-cli,webpack,babel,eslint的升级
4
+ - core-js 3.30.1 -> 3.33.0
5
+ - add regenerator-runtime
6
+ - @babel/core 7.21.4 -> 7.22.20
7
+ - babel-eslint 10.1.0 -> @babel/eslint-parser 7.22.15
8
+ - @vue/cli 4.5.19 -> 5.0.8
9
+ - babel-jest 25.5.1 -> 26.6.3
10
+ - eslint 6.8.0 -> 7.32.0
11
+ - jest 24.0.0 -> 26.6.3
12
+ - webpack 4.46.0 -> 5.88.2
13
+ 2. 完成vue2的2.7升级
14
+ - vue 2.6.14 -> 2.7.14
15
+ - eslint 7.32.0 -> 8.51.0
package/webpack.config.js DELETED
@@ -1,12 +0,0 @@
1
- 'use strict'
2
- const path = require('path')
3
-
4
- module.exports = {
5
- context: path.resolve(__dirname, './'),
6
- resolve: {
7
- extensions: ['.js', '.vue', '.json'],
8
- alias: {
9
- '@vue2-client': path.resolve('src')
10
- }
11
- }
12
- }