vue2-client 1.10.10 → 1.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.10.10",
3
+ "version": "1.10.11",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -1,17 +1,24 @@
1
1
  <template>
2
2
  <div>
3
- <a-upload
4
- v-if="uploadStyle === 'simple'"
5
- :accept="model.accept?.join('')"
6
- :customRequest="uploadFiles"
7
- :multiple="model.acceptCount && model.acceptCount>1"
8
- :file-list="uploadedFileList"
9
- :remove="deleteFileItem">
10
- <a-button style="margin-top: 2%">
11
- <a-icon type="upload"/>
12
- 上传
13
- </a-button>
14
- </a-upload>
3
+ <template v-if="uploadStyle === 'simple'">
4
+ <a-space>
5
+ <a-upload
6
+ :accept="model.accept?.join('')"
7
+ :customRequest="uploadFiles"
8
+ :multiple="model.acceptCount && model.acceptCount>1"
9
+ :file-list="uploadedFileList"
10
+ :remove="deleteFileItem">
11
+ <a-button style="margin-top: 2%">
12
+ <a-icon type="upload"/>
13
+ 上传
14
+ </a-button>
15
+ </a-upload>
16
+ <!-- <a-button style="margin-top: 2%">
17
+ <a-icon type="upload"/>
18
+ 高拍仪
19
+ </a-button> -->
20
+ </a-space>
21
+ </template>
15
22
  <a-upload-dragger
16
23
  v-else-if="model.type === 'file'"
17
24
  :accept="model.accept?.join('')"
@@ -104,6 +111,7 @@ export default {
104
111
  created () {
105
112
  const list = this.model.type === 'file' ? [...this.files] : [...this.images]
106
113
  if (this.model.useType) {
114
+ // {uid,url,name,f_use_type?,f_form_type?}
107
115
  this.uploadedFileList = list.filter(item => item.f_use_type === this.model.useType)
108
116
  } else {
109
117
  this.uploadedFileList = list
@@ -155,6 +155,9 @@ export default {
155
155
  inject: {
156
156
  inXFormGroup: {
157
157
  default: false
158
+ },
159
+ formGroupContext: {
160
+ default: null
158
161
  }
159
162
  },
160
163
  props: {},
@@ -205,8 +208,7 @@ export default {
205
208
  // 提交按钮名称
206
209
  btnName: '提交',
207
210
  // 提交按钮位置 start / center / end
208
- btnPlace: 'center',
209
- activeTab: 0
211
+ btnPlace: 'center'
210
212
  }
211
213
  },
212
214
  computed: {
@@ -244,6 +246,12 @@ export default {
244
246
  }]
245
247
  }
246
248
  },
249
+ // 拥有自定义校验函数得表单项
250
+ customValidateItems: function () {
251
+ return this.formItems.filter((item) => {
252
+ return item?.rule?.type === 'customJs'
253
+ })
254
+ },
247
255
  // 过滤出用于新增/修改场景的表单项
248
256
  groupJsonData: function () {
249
257
  return this.formItems.filter((item) => {
@@ -316,6 +324,42 @@ export default {
316
324
  getSelf: () => this,
317
325
  }
318
326
  },
327
+ /** //todo 本来想要实现 配置 自定义函数时,表单项得红星提示,根据自定义校验函数得返回值来判断
328
+ * 但是监听不到父组件formgorup得其他form得变化,所以暂时不实现
329
+ */
330
+ //
331
+ // watch: {
332
+ // form: {
333
+ // handler (val) {
334
+ // // 遍历表单配置
335
+ // if (this.customValidateItems.length > 0) {
336
+ // for (const item of this.customValidateItems) {
337
+ // const itemIndex = this.formItems.findIndex(formItem => formItem.model === item.model)
338
+ // if (itemIndex < 0) {
339
+ // continue
340
+ // }
341
+ // try {
342
+ // this.customJsValidate(null, val[item.model], (res) => {
343
+ // // 如果返回error则设置错误信息
344
+ // if (res instanceof Error) {
345
+ // // 设置表单项的错误状态
346
+ // this.$set(this.formItems[itemIndex], 'tempRequired', true)
347
+ // } else {
348
+ // // 清除错误状态
349
+ // this.$set(this.formItems[itemIndex], 'tempRequired', true)
350
+ // }
351
+ // }, item)
352
+ // } catch (e) {
353
+ // console.error(e)
354
+ // this.$set(this.formItems[itemIndex], 'tempRequired', true)
355
+ // }
356
+ // }
357
+ // console.log('customValidateItems', JSON.stringify(this.customValidateItems))
358
+ // }
359
+ // },
360
+ // deep: true
361
+ // }
362
+ // },
319
363
  methods: {
320
364
  runLogic,
321
365
  getConfigByNameAsync,
@@ -77,7 +77,8 @@ export default {
77
77
  },
78
78
  provide () {
79
79
  return {
80
- inXFormGroup: true
80
+ inXFormGroup: true,
81
+ formGroupContext: this
81
82
  }
82
83
  },
83
84
  methods: {
@@ -135,6 +136,10 @@ export default {
135
136
  }
136
137
  }).filter(ref => ref !== null)
137
138
  },
139
+ getNativeForm (group) {
140
+ const formref = this.getNativeFormRef(group)
141
+ return formref.length ? formref[0].form : null
142
+ },
138
143
  initData (index) {
139
144
  // 定义当前表单配置
140
145
  const res = this.groups[index]
@@ -617,7 +617,7 @@ export default {
617
617
  } else if (item.model === model && item.editRow) {
618
618
  acc = item
619
619
  }
620
- return acc
620
+ return Object.assign(acc, { tableContext: this, tableIndex: index })
621
621
  }, null)
622
622
  if (aa) {
623
623
  const tempConfig = JSON.parse(JSON.stringify(aa))
@@ -84,9 +84,9 @@ routerResource.example = {
84
84
  path: 'default',
85
85
  name: '示例页面',
86
86
  // component: () => import('@vue2-client/base-client/components/common/XAddNativeForm/demo.vue'),
87
- // component: () => import('@vue2-client/base-client/components/common/XFormGroup/demo.vue'),
87
+ component: () => import('@vue2-client/base-client/components/common/XFormGroup/demo.vue'),
88
88
  // component: () => import('@vue2-client/base-client/components/common/XReport/XReportDemo.vue'),
89
- component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
89
+ // component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
90
90
  // component: () => import('@vue2-client/base-client/components/common/XDatePicker/demo.vue'),
91
91
  // component: () => import('@vue2-client/base-client/components/common/XTab/XTabDemo.vue'),
92
92
  // component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
package/vue.config.js CHANGED
@@ -57,8 +57,8 @@ module.exports = {
57
57
  changeOrigin: true
58
58
  },
59
59
  '/api/af-revenue': {
60
- pathRewrite: { '^/api/af-revenue/': '/' },
61
- target: 'http://127.0.0.1:9026',
60
+ // pathRewrite: { '^/api/af-revenue/': '/' },
61
+ target: revenue,
62
62
  changeOrigin: true
63
63
  },
64
64
  '/api/af-liuli': {
@@ -83,7 +83,7 @@ module.exports = {
83
83
  '/devApi': {
84
84
  // v3用
85
85
  // pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
86
- pathRewrite: { '^/api/': '/' },
86
+ // pathRewrite: { '^/api/': '/' },
87
87
  target: revenue,
88
88
  changeOrigin: true
89
89
  },