vue2-client 1.2.32 → 1.2.35

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 (28) hide show
  1. package/.eslintrc.js +1 -0
  2. package/CHANGELOG.md +15 -0
  3. package/package.json +1 -1
  4. package/src/base-client/all.js +2 -0
  5. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +46 -19
  6. package/src/base-client/components/common/Upload/Upload.vue +124 -0
  7. package/src/base-client/components/common/Upload/index.js +3 -0
  8. package/src/base-client/components/common/XAddForm/XAddForm.vue +1 -0
  9. package/src/base-client/components/common/XAddNativeForm/index.js +3 -3
  10. package/src/base-client/components/common/XAddNativeForm/index.md +56 -56
  11. package/src/base-client/components/common/XForm/XFormItem.vue +6 -33
  12. package/src/base-client/components/common/XFormTable/XFormTable.vue +484 -484
  13. package/src/base-client/components/common/XFormTable/index.md +5 -0
  14. package/src/base-client/components/common/XTable/index.md +255 -255
  15. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
  16. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +131 -131
  17. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -528
  18. package/src/config/default/setting.config.js +34 -34
  19. package/src/pages/login/Login.vue +198 -198
  20. package/src/pages/system/ticket/index.vue +440 -437
  21. package/src/router/async/config.async.js +26 -26
  22. package/src/router/async/router.map.js +59 -59
  23. package/src/router/index.js +27 -27
  24. package/src/services/api/EmployeeDetailsViewApi.js +16 -16
  25. package/src/services/api/applyInstallApi.js +14 -14
  26. package/src/services/api/restTools.js +3 -2
  27. package/src/utils/request.js +198 -197
  28. package/vue.config.js +143 -143
package/.eslintrc.js CHANGED
@@ -9,6 +9,7 @@ module.exports = {
9
9
  '@vue/standard'
10
10
  ],
11
11
  rules: {
12
+ 'comma-dangle': 'off',
12
13
  'no-console': 'off',
13
14
  'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
14
15
  'generator-star-spacing': 'off',
package/CHANGELOG.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
+ **##1.2.35 -2022-04-13 @江超**
5
+ - 功能修改:
6
+ - [工单提交] 页面不再需要登录,而是通过路径传参获取信息
7
+ - 生成环境不再使用CDN加速
8
+
9
+ **##1.2.34 -2022-04-11 @张振宇**
10
+ - 功能修改:
11
+ - 文件上传组件完善
12
+ - [request.js] post请求可以自定义请求头参数了
13
+ - [.eslint] 不限制json结尾的逗号了
14
+
15
+ **##1.2.33 -2022-04-11 @朱子峰**
16
+ - 功能修改:
17
+ - [XFormTable]:临时表数据插入BUG修复,增加不需要数据初始化的判断
18
+
4
19
  **##1.2.32 -2022-04-07 @朱子峰**
5
20
  - 功能修改:
6
21
  - [XFormTable]:新增判断,如果表名以##开始,则在查询时为其创建临时表
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.2.32",
3
+ "version": "1.2.35",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -25,6 +25,7 @@ import CreateSimpleFormQuery from '@vue2-client/base-client/components/common/Cr
25
25
  import FormGroupQuery from '@vue2-client/base-client/components/common/FormGroupQuery'
26
26
  import FormGroupEdit from '@vue2-client/base-client/components/common/FormGroupEdit'
27
27
  import JSONToTree from '@vue2-client/base-client/components/common/JSONToTree'
28
+ import Upload from '@vue2-client/base-client/components/common/Upload'
28
29
 
29
30
  // 插件
30
31
  import Plugins from '@vue2-client/base-client/plugins'
@@ -55,3 +56,4 @@ Vue.component('CreateSimpleFormQuery', CreateSimpleFormQuery)
55
56
  Vue.component('FormGroupQuery', FormGroupQuery)
56
57
  Vue.component('FormGroupEdit', FormGroupEdit)
57
58
  Vue.component('JSONToTree', JSONToTree)
59
+ Vue.component('Upload', Upload)
@@ -213,7 +213,7 @@
213
213
  </a-col>
214
214
  <a-col :span="8">
215
215
  <a-form-model-item
216
- v-show="!(item.formType === 'file' || item.formType === 'image')"
216
+ v-if="!(item.formType === 'file' || item.formType === 'image')"
217
217
  label="数据字段名"
218
218
  prop="key">
219
219
  <a-input v-model="item.key" placeholder="请输入数据字段名" ref="key">
@@ -237,9 +237,10 @@
237
237
  </a-col>
238
238
  </a-row>
239
239
  <template v-if="dataMode.queryForm || dataMode.addOrEditForm">
240
- <a-row :gutter="16" v-if="item.formType === 'file' || item.formType === 'image'">
240
+ <a-row :gutter="24" v-if="item.formType === 'file' || item.formType === 'image'">
241
241
  <a-col :span="8">
242
242
  <a-form-model-item
243
+ style="margin-bottom: 0"
243
244
  label="允许上传文件数量"
244
245
  prop="accept"
245
246
  v-if="item.formType === 'file' || item.formType === 'image'">
@@ -254,23 +255,21 @@
254
255
  </a-col>
255
256
  <a-col :span="8">
256
257
  <a-form-model-item
257
- label="文件上传模式"
258
- prop="resUploadMode"
258
+ label="上传至仓库"
259
+ prop="resUploadStock"
259
260
  v-if="item.formType === 'file' || item.formType === 'image'">
260
- <a-select v-model="item.resUploadMode" placeholder="文件上传模式,默认为服务器" @change="changeFormType(item)">
261
- <a-select-option key="server">服务器</a-select-option>
262
- <a-select-option key="oss">腾讯云对象存储</a-select-option>
263
- <a-select-option key="base64" :disabled="item.formType === 'file'">Base64</a-select-option>
264
- <a-popover slot="suffixIcon" title="关于资源上传模式" placement="right">
265
- <template slot="content">
266
- <p>指定文件上传到服务器,对象存储还是以base64方式存储</p>
267
- <br/>
268
- <p><span style="font-weight: bold">服务器:</span>文件上传到服务器,数据库需存储文件于服务器的路径</p>
269
- <p><span style="font-weight: bold">对象存储:</span>文件上传到云对象存储,数据库需存储文件于对象存储的路径</p>
270
- <p><span style="font-weight: bold">base64:</span>文件以base64字符串方式存入数据库中(仅图片上传表单支持)</p>
271
- </template>
272
- <a-icon type="info-circle" style="color: rgba(0,0,0,.45)"/>
273
- </a-popover>
261
+ <a-select v-model="item.resUploadStock" placeholder="选择文件上传到的仓库" @change="changeStock">
262
+ <a-select-option v-for="stock in stockList" :key="stock.id">{{ stock.f_name }}</a-select-option>
263
+ </a-select>
264
+ </a-form-model-item>
265
+ </a-col>
266
+ <a-col :span="8">
267
+ <a-form-model-item
268
+ label="仓库扩展路径"
269
+ prop="pathKey"
270
+ v-if="(item.formType === 'file' || item.formType === 'image') && (lowerPath.length > 0 || item.pathKey)">
271
+ <a-select v-model="item.pathKey" placeholder="仓库扩展路径">
272
+ <a-select-option v-for="pathKey in lowerPath" :key="pathKey.label">{{ pathKey.label }}</a-select-option>
274
273
  </a-select>
275
274
  </a-form-model-item>
276
275
  </a-col>
@@ -731,9 +730,12 @@ export default {
731
730
  accept: '',
732
731
  addOrEdit: '',
733
732
  selectKeyName: '',
733
+ resUploadStock: '',
734
734
  acceptCount: '',
735
735
  dataModeArray: []
736
736
  },
737
+ stockList: [],
738
+ lowerPath: [],
737
739
  itemMap: {},
738
740
  selectIndex: null,
739
741
  selectType: undefined,
@@ -1014,7 +1016,13 @@ export default {
1014
1016
  if (this.itemMap[key]) {
1015
1017
  this.type = '修改'
1016
1018
  this.item = Object.assign({ formType: 'input', type: 'string' }, this.itemMap[key])
1017
- if (this.item.formType === 'selects') {
1019
+ if (this.item.formType === 'file' || this.item.formType === 'image') {
1020
+ this.getStocks()
1021
+ if (this.item.resUploadStock) {
1022
+ this.lowerPath = this.stockList.filter(item => item.id == this.item.resUploadStock)[0]?.f_lower_path_json ?? []
1023
+ }
1024
+ }
1025
+ if (this.item.formType === 'selects') {
1018
1026
  // 因为 groupIndex 可能有很多值 单选框不行 赋给一个新的变量
1019
1027
  this.item.groupIndexView = this.item.groupIndex === 1 ? 1 : 'None'
1020
1028
  }
@@ -1281,17 +1289,36 @@ export default {
1281
1289
  this.dataModeArrayData = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
1282
1290
  }, 100)
1283
1291
  },
1292
+ // 获取所有仓库
1293
+ getStocks () {
1294
+ if (this.stockList.length === 0) {
1295
+ post('/webmeterapi/getFilesStock', {}).then(res => {
1296
+ this.stockList = res.sort((a, b) => b.progress - a.progress)
1297
+ }).catch(e => {})
1298
+ }
1299
+ },
1284
1300
  changeFormType (item) {
1285
1301
  if (item.formType === 'file' || item.formType === 'image') {
1286
1302
  this.item.accept = item.formType === 'file' ? ['*'] : ['.jpg,.jpeg,.ico,.gif,svg,.webp,.png,.bmp,.pjpeg,']
1287
1303
  this.item.resUploadMode = 'server'
1304
+ this.item.key = 'FilesId'
1288
1305
  this.dataModeArrayData = ['addOrEditForm']
1306
+ this.getStocks()
1289
1307
  } else {
1290
1308
  this.dataModeArrayData = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
1291
1309
  delete this.item.accept
1292
1310
  delete this.item.resUploadMode
1293
1311
  }
1294
1312
  },
1313
+ // 修改上传到哪个仓库
1314
+ changeStock (stock) {
1315
+ if (stock) {
1316
+ const stockValue = this.stockList.filter(item => item.id === stock)[0]
1317
+ this.lowerPath = stockValue.f_lower_path_json ?? []
1318
+ this.item.resUploadMode = stockValue.f_stock_type
1319
+ this.item.stockAlias = stockValue.f_alias
1320
+ }
1321
+ },
1295
1322
  changeSelectKey (item) {
1296
1323
  if (item.selectType === 'key' && item.selectKey) {
1297
1324
  item.slot.type = 'badge'
@@ -0,0 +1,124 @@
1
+ <template>
2
+ <div>
3
+ <a-upload-dragger
4
+ v-if="model.type === 'file'"
5
+ name="file"
6
+ :multiple="true"
7
+ :remove="deleteFileItem"
8
+ :customRequest="uploadFiles"
9
+ :file-list="uploadedFileList">
10
+ <p class="ant-upload-drag-icon">
11
+ <a-icon type="inbox"/>
12
+ </p>
13
+ <p class="ant-upload-text">
14
+ 点击或拖动文件到该区域上传
15
+ </p>
16
+ <p class="ant-upload-hint">
17
+ 支持单个或多个文件
18
+ </p>
19
+ </a-upload-dragger>
20
+ <a-upload
21
+ v-if=" model.type === 'image'"
22
+ list-type="picture-card"
23
+ :customRequest="uploadFiles"
24
+ :remove="deleteFileItem"
25
+ :file-list="uploadedFileList">
26
+ <a-icon type="plus"/>
27
+ <div class="ant-upload-text">
28
+ Upload
29
+ </div>
30
+ </a-upload>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+
36
+ import { post } from '@vue2-client/services/api'
37
+ import { mapState } from 'vuex'
38
+
39
+ export default {
40
+ name: 'uploads',
41
+ data () {
42
+ return {
43
+ uploadedFileList: [],
44
+ }
45
+ },
46
+ props: {
47
+ // 表单属性
48
+ model: {
49
+ type: Object,
50
+ default: () => {
51
+ return {}
52
+ }
53
+ }
54
+ },
55
+ computed: {
56
+ ...mapState('account', { currUser: 'user' })
57
+ },
58
+ methods: {
59
+ uploadFiles (info) {
60
+ // 初始化文件信息
61
+ const fileInfo = {
62
+ uid: info.file.uid,
63
+ name: info.file.name,
64
+ status: 'uploading',
65
+ response: '',
66
+ url: '',
67
+ }
68
+ // 放入上传列表中,以便于显示上传进度
69
+ this.uploadedFileList.push(fileInfo)
70
+ // 组装上传数据
71
+ const headers = {
72
+ 'Content-Type': 'multipart/form-data',
73
+ }
74
+ const formData = new FormData()
75
+ formData.append('avatar', info.file)
76
+ formData.append('resUploadMode', this.model.resUploadMode)
77
+ if (this.model.pathKey) {
78
+ formData.append('pathKey', this.model.pathKey)
79
+ }
80
+ formData.append('stockAlias', this.model.stockAlias)
81
+ formData.append('resUploadStock', this.model.resUploadStock)
82
+ formData.append('filename', info.file.name)
83
+ formData.append('filesize', (info.file.size / 1024 / 1024).toFixed(4))
84
+ formData.append('f_operator', this.currUser.username)
85
+
86
+ let url = '/webmeteruploadapi/upload'
87
+ if (process.env.NODE_ENV === 'production') {
88
+ url = `/${this.model.stockAlias}/webmeteruploadapi/upload`
89
+ }
90
+ post(url, formData, { headers }).then(res => {
91
+ // 根据服务端返回的结果判断成功与否,设置文件条目的状态
92
+ if (res.success) {
93
+ fileInfo.status = 'done'
94
+ fileInfo.response = JSON.parse(res.data)
95
+ fileInfo.id = JSON.parse(res.data).id
96
+ fileInfo.url = JSON.parse(res.data).f_downloadpath
97
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
98
+ this.$message.success('上传成功!')
99
+ } else {
100
+ fileInfo.status = 'error'
101
+ fileInfo.response = res.data
102
+ this.$message.error('上传失败!')
103
+ }
104
+ }).catch((e) => {
105
+ fileInfo.status = 'error'
106
+ fileInfo.response = e
107
+ this.$message.error(`请求失败!${e}`)
108
+ })
109
+ },
110
+ // 删除文件
111
+ deleteFileItem (file) {
112
+ // 找到当前文件所在列表的索引
113
+ const index = this.uploadedFileList.indexOf(file)
114
+ // 从列表中移除该文件
115
+ this.uploadedFileList.splice(index, 1)
116
+ this.$emit('setFiles', this.uploadedFileList.filter(item => item.status === 'done').map(item => item.id))
117
+ return true
118
+ }
119
+ }
120
+ }
121
+ </script>
122
+ <style lang="less" scoped>
123
+
124
+ </style>
@@ -0,0 +1,3 @@
1
+ import Upload from './Upload'
2
+
3
+ export default Upload
@@ -5,6 +5,7 @@
5
5
  :width="1000"
6
6
  @cancel="onClose"
7
7
  okText="提交"
8
+ :destroyOnClose="true"
8
9
  :confirm-loading="loading"
9
10
  :zIndex="1001"
10
11
  @ok="onSubmit">
@@ -1,3 +1,3 @@
1
- import XAddNativeForm from './XAddNativeForm'
2
-
3
- export default XAddNativeForm
1
+ import XAddNativeForm from './XAddNativeForm'
2
+
3
+ export default XAddNativeForm
@@ -1,56 +1,56 @@
1
- # XAddNativeForm
2
-
3
- 动态新增/修改表单控件,根据JSON配置生成一个完整的可供新增/修改数据的动态表单
4
-
5
-
6
- ## 何时使用
7
-
8
- 当需要一个可供新增/修改数据的动态生成的表单时
9
-
10
-
11
- 引用方式:
12
-
13
- ```javascript
14
- import XAddNativeForm from '@vue2-client/base-client/components/XAddNativeForm/XAddNativeForm'
15
-
16
- export default {
17
- components: {
18
- XAddNativeForm
19
- }
20
- }
21
- ```
22
-
23
-
24
-
25
- ## 代码演示
26
-
27
- ```html
28
- <x-add-form
29
- :business-type="businessType"
30
- :json-data="formItems"
31
- :modify-model-data="modifyModelData"
32
- :loading="loading"
33
- @onSubmit="onSubmit">
34
- </x-add-form>
35
- ```
36
-
37
- ## API
38
-
39
- | 参数 | 说明 | 类型 | 默认值 |
40
- |-----------------|--------------------------|---------|-------|
41
- | businessType | 业务类型 | String | '' |
42
- | jsonData | JSON配置,根据[工具>查询配置生成]功能生成 | Object | {} |
43
- | modifyModelData | 修改操作前查询出的业务数据 | Object | {} |
44
- | loading | 新增或修改业务是否执行中 | Boolean | false |
45
- | fixedAddForm | 固定新增表单,会和新增表单合并 | Object | {} |
46
- | @onSubmit | 表单的提交事件 | event | - |
47
-
48
- ## 例子1
49
- ----
50
- 参考XFormTable组件
51
- ```
52
-
53
- 注意事项
54
- ----
55
-
56
- > 本组件已经实现了自适应布局,在不同分辨率下的设备均可得到基本理想的展示效果
1
+ # XAddNativeForm
2
+
3
+ 动态新增/修改表单控件,根据JSON配置生成一个完整的可供新增/修改数据的动态表单
4
+
5
+
6
+ ## 何时使用
7
+
8
+ 当需要一个可供新增/修改数据的动态生成的表单时
9
+
10
+
11
+ 引用方式:
12
+
13
+ ```javascript
14
+ import XAddNativeForm from '@vue2-client/base-client/components/XAddNativeForm/XAddNativeForm'
15
+
16
+ export default {
17
+ components: {
18
+ XAddNativeForm
19
+ }
20
+ }
21
+ ```
22
+
23
+
24
+
25
+ ## 代码演示
26
+
27
+ ```html
28
+ <x-add-form
29
+ :business-type="businessType"
30
+ :json-data="formItems"
31
+ :modify-model-data="modifyModelData"
32
+ :loading="loading"
33
+ @onSubmit="onSubmit">
34
+ </x-add-form>
35
+ ```
36
+
37
+ ## API
38
+
39
+ | 参数 | 说明 | 类型 | 默认值 |
40
+ |-----------------|--------------------------|---------|-------|
41
+ | businessType | 业务类型 | String | '' |
42
+ | jsonData | JSON配置,根据[工具>查询配置生成]功能生成 | Object | {} |
43
+ | modifyModelData | 修改操作前查询出的业务数据 | Object | {} |
44
+ | loading | 新增或修改业务是否执行中 | Boolean | false |
45
+ | fixedAddForm | 固定新增表单,会和新增表单合并 | Object | {} |
46
+ | @onSubmit | 表单的提交事件 | event | - |
47
+
48
+ ## 例子1
49
+ ----
50
+ 参考XFormTable组件
51
+ ```
52
+
53
+ 注意事项
54
+ ----
55
+
56
+ > 本组件已经实现了自适应布局,在不同分辨率下的设备均可得到基本理想的展示效果
@@ -168,40 +168,9 @@
168
168
  :sm="24"
169
169
  :md="24"
170
170
  :lg="24"
171
- v-else-if="attr.type === 'file'">
171
+ v-else-if="attr.type === 'file' || attr.type === 'image'">
172
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>
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>
173
+ <upload :model="attr" @setFiles="setFiles"></upload>
205
174
  </a-form-model-item>
206
175
  </x-form-col>
207
176
  </template>
@@ -265,6 +234,10 @@ export default {
265
234
  }
266
235
  },
267
236
  methods: {
237
+ // 文件框时设置上传组件的值
238
+ setFiles (fileIds) {
239
+ this.form[this.attr.model] = fileIds
240
+ },
268
241
  // 懒加载检索方法
269
242
  fetchFunction (value) {
270
243
  this.lastFetchId += 1