vue2-client 1.8.248 → 1.8.250

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.8.248",
3
+ "version": "1.8.250",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -2,7 +2,7 @@
2
2
  <a-modal
3
3
  :confirm-loading="loading"
4
4
  :destroyOnClose="true"
5
- :title="customTitle || businessTitle"
5
+ :title="customTitle? customTitle : businessTitle"
6
6
  :visible="visible"
7
7
  :width="1000"
8
8
  :zIndex="1001"
@@ -69,6 +69,7 @@
69
69
  <script>
70
70
  import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
71
71
  import dayjs from 'dayjs'
72
+ import { mapState } from 'vuex'
72
73
 
73
74
  export default {
74
75
  name: 'XForm',
@@ -101,9 +102,12 @@ export default {
101
102
  getDataParams: {},
102
103
  // 当前环境
103
104
  env: 'prod',
105
+ // 暂存 form 的默认值
106
+ defaultMap: {}
104
107
  }
105
108
  },
106
109
  computed: {
110
+ ...mapState('account', { currUser: 'user' }),
107
111
  // 过滤掉仅用于新增/修改场景的表单项
108
112
  realJsonData: function () {
109
113
  return this.formItems.filter(item => (!item.isOnlyAddOrEdit && item.type !== 'group') || (item.type === 'group' && item.groupItems.some(groupItem => !groupItem.isOnlyAddOrEdit)))
@@ -178,9 +182,20 @@ export default {
178
182
  if (item.queryFormDefault) {
179
183
  if (['datePicker', 'rangePicker', 'yearPicker', 'monthPicker'].includes(item.type)) {
180
184
  formData[item.model] = this.getDateRange(item.type, item.queryFormDefault)
185
+ } else if (['treeSelect'].includes(item.type) && ['curOrgId', 'curDepId', 'curUserId'].includes(item.queryFormDefault)) {
186
+ if (item.queryFormDefault === 'curOrgId') {
187
+ formData[item.model] = [this.currUser.orgid]
188
+ }
189
+ if (item.queryFormDefault === 'curDepId') {
190
+ formData[item.model] = [this.currUser.depids]
191
+ }
192
+ if (item.queryFormDefault === 'curUserId') {
193
+ formData[item.model] = [this.currUser.id]
194
+ }
181
195
  } else {
182
196
  formData[item.model] = item.queryFormDefault
183
197
  }
198
+ this.defaultMap[item.model] = formData[item.model]
184
199
  }
185
200
  if (item.rule) {
186
201
  this.rules[item.model] = []
@@ -237,6 +252,10 @@ export default {
237
252
  if (Array.isArray(this.form[key]) && !this.form[key][0]) {
238
253
  this.form[key] = undefined
239
254
  }
255
+ // 如果 form 中没有值,但是有默认值
256
+ if (this.form[key] === undefined && this.defaultMap[key] !== undefined) {
257
+ this.form = Object.assign({}, this.form, this.defaultMap)
258
+ }
240
259
  }
241
260
  const requestParameters = Object.assign({}, this.form)
242
261
  const data = {
@@ -145,7 +145,6 @@ export default {
145
145
  formItems: res.formJson,
146
146
  showSubmitBtn: false,
147
147
  serviceName: this.serviceName,
148
- modifyModelData: modifyModelData,
149
148
  fixedAddForm: modifyModelData.data,
150
149
  businessType: this.businessType,
151
150
  ...res