vue2-client 1.7.10 → 1.7.11

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.
@@ -1,3 +1,3 @@
1
- import Upload from './Upload'
2
-
3
- export default Upload
1
+ import Upload from './Upload'
2
+
3
+ export default Upload
@@ -19,6 +19,20 @@
19
19
  :get-data-params="getDataParams"
20
20
  />
21
21
  </a-row>
22
+ <a-row :gutter="16" v-for="(groupItem, groupIndex) in groupJsonData" :key="groupIndex">
23
+ <x-form-item
24
+ v-for="(item, index) in groupItem.groupItems"
25
+ :key="index"
26
+ :attr="item"
27
+ :disabled="itemDisabled(item)"
28
+ :files="files"
29
+ :form="form[groupItem.model]"
30
+ :images="images"
31
+ :service-name="serviceName"
32
+ mode="新增/修改"
33
+ :get-data-params="getDataParams"
34
+ />
35
+ </a-row>
22
36
  <a-row :gutter="16" v-for="(item, key) in simpleFormJsonData" :key="'row' + key">
23
37
  <a-card :title="item.name" :bordered="false" size="small">
24
38
  <x-form-item
@@ -93,6 +107,22 @@ export default {
93
107
  return item.addOrEdit && item.addOrEdit !== 'no' && item.addOrEdit !== 'silenceAdd' && item.addOrEdit !== 'version' && !this.itemDisabled(item)
94
108
  })
95
109
  },
110
+ // 过滤出用于新增/修改场景的表单项
111
+ groupJsonData: function () {
112
+ return this.formItems.filter((item) => {
113
+ return item.type === 'group'
114
+ }).map((item) => {
115
+ item.groupItems = item.groupItems.filter((item) => {
116
+ return item.addOrEdit && item.addOrEdit !== 'no' && item.addOrEdit !== 'silenceAdd' && item.addOrEdit !== 'version' && !this.itemDisabled(item)
117
+ }).map((groupItem) => {
118
+ // 只保留第一个下划线后面的内容
119
+ groupItem.model = groupItem.model.substring(groupItem.model.indexOf('_') + 1)
120
+ return groupItem
121
+ })
122
+ return item
123
+ }
124
+ )
125
+ },
96
126
  // 过滤出用于静默新增场景的表单项
97
127
  silenceAddJsonData: function () {
98
128
  return this.formItems.filter(function (item) {
@@ -132,6 +162,15 @@ export default {
132
162
  const item = this.realJsonData[i]
133
163
  this.setFormProps(formData, item)
134
164
  }
165
+ // 设置表单分组项目相关参数
166
+ for (let i = 0; i < this.groupJsonData.length; i++) {
167
+ const groupItem = this.groupJsonData[i]
168
+ formData[groupItem.model] = {}
169
+ for (let j = 0; j < groupItem.groupItems.length; j++) {
170
+ const item = groupItem.groupItems[j]
171
+ this.setFormProps(formData[groupItem.model], item)
172
+ }
173
+ }
135
174
  // 设置动态简易表单项的相关参数
136
175
  for (const key in this.simpleFormJsonData) {
137
176
  for (const item of this.simpleFormJsonData[key].value) {
@@ -234,10 +273,6 @@ export default {
234
273
  if (!valid) {
235
274
  return false
236
275
  }
237
- if (this.viewMode) {
238
- this.$message.info('预览模式禁止新增和修改')
239
- return false
240
- }
241
276
  this.loading = true
242
277
  for (const key of Object.keys(this.form)) {
243
278
  if (this.form[key] === null || this.form[key] === '') {
@@ -293,6 +328,16 @@ export default {
293
328
  realForm[realKey] = value
294
329
  }
295
330
  }
331
+ if (this.viewMode) {
332
+ this.$message.info('预览模式禁止新增和修改')
333
+ console.log({
334
+ businessType: this.businessType,
335
+ serviceName: this.serviceName,
336
+ realForm: realForm,
337
+ currUserName: this.currUser.name
338
+ })
339
+ return false
340
+ }
296
341
  // 交由父级处理
297
342
  this.$emit('onSubmit', {
298
343
  businessType: this.businessType,
@@ -347,6 +392,16 @@ export default {
347
392
  this.form[item.model] = undefined
348
393
  }
349
394
  }
395
+ // 对分组表单进行处理
396
+ for (let i = 0; i < this.groupJsonData.length; i++) {
397
+ const item = this.groupJsonData[i]
398
+ try {
399
+ if (modifyModelData.data[item.model]) {
400
+ this.form[item.model] = JSON.parse(modifyModelData.data[item.model])
401
+ }
402
+ } catch (e) {
403
+ }
404
+ }
350
405
  // 追加版本号信息
351
406
  for (const item of this.versionJsonData) {
352
407
  if (!modifyModelData.data[item.model]) {
@@ -15,6 +15,16 @@
15
15
  :service-name="serviceName"
16
16
  :get-data-params="getDataParams"
17
17
  />
18
+ <div v-for="(groupItem, groupIndex) in groupJsonData" :key="groupIndex">
19
+ <x-form-item
20
+ v-for="(item, index) in groupItem.groupItems"
21
+ :key="index"
22
+ :attr="item"
23
+ :form="form"
24
+ :service-name="serviceName"
25
+ :get-data-params="getDataParams"
26
+ />
27
+ </div>
18
28
  <div v-show="advanced">
19
29
  <x-form-item
20
30
  v-for="(item, index) in realJsonData.slice(6)"
@@ -87,6 +97,20 @@ export default {
87
97
  realJsonData: function () {
88
98
  return this.formItems.filter(item => !item.isOnlyAddOrEdit)
89
99
  },
100
+ // 过滤出用于新增/修改场景的表单项
101
+ groupJsonData: function () {
102
+ return this.formItems.filter((item) => {
103
+ return item.type === 'group'
104
+ }).map((item) => {
105
+ item.groupItems = item.groupItems.filter(item => !item.isOnlyAddOrEdit).map((groupItem) => {
106
+ // 只保留第一个下划线后面的内容
107
+ groupItem.model = groupItem.model.substring(groupItem.model.indexOf('_') + 1)
108
+ return groupItem
109
+ })
110
+ return item
111
+ }
112
+ )
113
+ },
90
114
  },
91
115
  methods: {
92
116
  init (params) {
@@ -1,41 +1,41 @@
1
- import XForm from './common/XForm'
2
- import XAddForm from './common/XAddForm'
3
- import XAddNativeForm from './common/XAddNativeForm'
4
- import XFormCol from './common/XFormCol'
5
- import XTable from './common/XTable'
6
- import XTreeOne from './common/XTreeOne'
7
- import XImportExcel from './common/XImportExcel'
8
- import XDataDrawer from './common/XDataDrawer'
9
- import XCard from './common/XCard'
10
- import XBadge from './common/XBadge'
11
- import Upload from './common/Upload'
12
- import JSONToTree from './common/JSONToTree'
13
- import FormGroupEdit from './common/FormGroupEdit'
14
- import FormGroupQuery from './common/FormGroupQuery'
15
- import AddressSearchCombobox from './common/AddressSearchCombobox'
16
- import AmapMarker from './common/AmapMarker'
17
- import CreateQuery from './common/CreateQuery'
18
- import CreateSimpleFormQuery from './common/CreateSimpleFormQuery'
19
- import PersonSetting from './common/PersonSetting'
20
-
21
- export default {
22
- XForm,
23
- XAddForm,
24
- XAddNativeForm,
25
- XFormCol,
26
- XTable,
27
- XTreeOne,
28
- XImportExcel,
29
- XDataDrawer,
30
- XCard,
31
- XBadge,
32
- Upload,
33
- JSONToTree,
34
- FormGroupEdit,
35
- FormGroupQuery,
36
- AddressSearchCombobox,
37
- AmapMarker,
38
- CreateQuery,
39
- CreateSimpleFormQuery,
40
- PersonSetting
41
- }
1
+ import XForm from './common/XForm'
2
+ import XAddForm from './common/XAddForm'
3
+ import XAddNativeForm from './common/XAddNativeForm'
4
+ import XFormCol from './common/XFormCol'
5
+ import XTable from './common/XTable'
6
+ import XTreeOne from './common/XTreeOne'
7
+ import XImportExcel from './common/XImportExcel'
8
+ import XDataDrawer from './common/XDataDrawer'
9
+ import XCard from './common/XCard'
10
+ import XBadge from './common/XBadge'
11
+ import Upload from './common/Upload'
12
+ import JSONToTree from './common/JSONToTree'
13
+ import FormGroupEdit from './common/FormGroupEdit'
14
+ import FormGroupQuery from './common/FormGroupQuery'
15
+ import AddressSearchCombobox from './common/AddressSearchCombobox'
16
+ import AmapMarker from './common/AmapMarker'
17
+ import CreateQuery from './common/CreateQuery'
18
+ import CreateSimpleFormQuery from './common/CreateSimpleFormQuery'
19
+ import PersonSetting from './common/PersonSetting'
20
+
21
+ export default {
22
+ XForm,
23
+ XAddForm,
24
+ XAddNativeForm,
25
+ XFormCol,
26
+ XTable,
27
+ XTreeOne,
28
+ XImportExcel,
29
+ XDataDrawer,
30
+ XCard,
31
+ XBadge,
32
+ Upload,
33
+ JSONToTree,
34
+ FormGroupEdit,
35
+ FormGroupQuery,
36
+ AddressSearchCombobox,
37
+ AmapMarker,
38
+ CreateQuery,
39
+ CreateSimpleFormQuery,
40
+ PersonSetting
41
+ }
@@ -25,6 +25,11 @@ module.exports = {
25
25
  label: 'SQL生成查询表达式',
26
26
  value: 'sqlQueryCondition',
27
27
  noMatch: ['file', 'image', 'textarea', 'personSetting']
28
+ },
29
+ {
30
+ label: '字段组存储',
31
+ value: 'group',
32
+ noMatch: ['file', 'image', 'textarea', 'personSetting']
28
33
  }
29
34
  ],
30
35
  // 表单类型
@@ -6,6 +6,7 @@ const routesConfig = [
6
6
  'login',
7
7
  'submitTicket',
8
8
  'settings',
9
+ 'createQuery',
9
10
  'root',
10
11
  {
11
12
  router: 'exp404',
@@ -1,24 +1,24 @@
1
- import { METHOD, request } from '@vue2-client/utils/request'
2
-
3
- /**
4
- * GET请求
5
- * @param url 请求地址
6
- * @param parameter 路径参数
7
- * @returns {Promise<AxiosResponse<T>>}
8
- */
9
- function get (url, parameter) {
10
- return request(url, METHOD.GET, parameter)
11
- }
12
-
13
- /**
14
- * POST请求
15
- * @param url 请求地址
16
- * @param parameter 请求参数
17
- * @param config
18
- * @returns {Promise<AxiosResponse<T>>}
19
- */
20
- function post (url, parameter, config = {}) {
21
- return request(url, METHOD.POST, parameter, config)
22
- }
23
-
24
- export { get, post }
1
+ import { METHOD, request } from '@vue2-client/utils/request'
2
+
3
+ /**
4
+ * GET请求
5
+ * @param url 请求地址
6
+ * @param parameter 路径参数
7
+ * @returns {Promise<AxiosResponse<T>>}
8
+ */
9
+ function get (url, parameter) {
10
+ return request(url, METHOD.GET, parameter)
11
+ }
12
+
13
+ /**
14
+ * POST请求
15
+ * @param url 请求地址
16
+ * @param parameter 请求参数
17
+ * @param config
18
+ * @returns {Promise<AxiosResponse<T>>}
19
+ */
20
+ function post (url, parameter, config = {}) {
21
+ return request(url, METHOD.POST, parameter, config)
22
+ }
23
+
24
+ export { get, post }