three-trees-ui 1.1.4 → 1.1.6

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": "three-trees-ui",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -92,22 +92,22 @@
92
92
  <ht-input
93
93
  v-model="queryParams[index].startDate"
94
94
  placeholder="开始日期"
95
- @click.native="showDate(index, 'startDate')"
96
95
  readonly
96
+ @click.native="showDate(index, 'startDate')"
97
97
  ></ht-input>
98
98
  <span style="margin:0 10px;">至</span>
99
99
  <ht-input
100
100
  v-model="queryParams[index].endDate"
101
101
  placeholder="结束日期"
102
- @click.native="showDate(index, 'endDate')"
103
102
  readonly
103
+ @click.native="showDate(index, 'endDate')"
104
104
  ></ht-input>
105
105
  </div>
106
106
  <ht-input
107
107
  v-else
108
108
  v-model="queryParams[index][condition.field]"
109
- @click.native="showDate(index, condition.field)"
110
109
  readonly
110
+ @click.native="showDate(index, condition.field)"
111
111
  ></ht-input>
112
112
  </div>
113
113
  <!-- 选择器 -->
@@ -172,7 +172,7 @@
172
172
  <ht-custom-dialog
173
173
  v-model="queryParams[index][condition.field]"
174
174
  :model-name="condition.config.keyBind"
175
- dialogType="search"
175
+ dialog-type="search"
176
176
  :custdialog="{
177
177
  name: '请选择',
178
178
  icon: '',
@@ -349,8 +349,8 @@
349
349
  </van-action-sheet>
350
350
  <!-- 修改时间 -->
351
351
  <van-popup
352
- v-model="isShowDatePop"
353
352
  v-if="isShowDatePop"
353
+ v-model="isShowDatePop"
354
354
  position="bottom"
355
355
  round
356
356
  >
@@ -390,6 +390,10 @@
390
390
  currentSubData: Array,
391
391
  dialogConfig: Object,
392
392
  dialogType: String,
393
+ subDialogMode: {
394
+ type: String,
395
+ default: '',
396
+ },
393
397
  },
394
398
  data() {
395
399
  return {
@@ -996,12 +1000,15 @@
996
1000
  // this.$emit('input', _val)
997
1001
  this.$emit('updateInput', _val)
998
1002
  }
999
- utils.setValueByPath(
1000
- pInst,
1001
- `${pInst.data ? 'data.' : 'model.'}${path}`,
1002
- _val,
1003
- thisIndex
1004
- )
1003
+ let bindPath = `${pInst.data ? 'data.' : 'model.'}${path}`
1004
+ if (this.subDialogMode == 1) {
1005
+ bindPath = `row.${configAttr[configAttr.length - 1]}`
1006
+ }
1007
+ if (this.subDialogMode == 1) {
1008
+ this.$set(pInst.row, configAttr[configAttr.length - 1], _val)
1009
+ } else {
1010
+ utils.setValueByPath(pInst, bindPath, _val, thisIndex)
1011
+ }
1005
1012
  }
1006
1013
  }
1007
1014
  })
@@ -1541,12 +1548,15 @@
1541
1548
  if (this.modelName && this.modelName.endsWith(path)) {
1542
1549
  this.$emit('updateInput', _val)
1543
1550
  }
1544
- utils.setValueByPath(
1545
- pInst,
1546
- `${pInst.data ? 'data.' : 'model.'}${path}`,
1547
- _val,
1548
- thisIndex
1549
- )
1551
+ let bindPath = `${pInst.data ? 'data.' : 'model.'}${path}`
1552
+ if (this.subDialogMode == 1) {
1553
+ bindPath = `row.${configAttr[configAttr.length - 1]}`
1554
+ }
1555
+ if (this.subDialogMode == 1) {
1556
+ this.$set(pInst.row, configAttr[configAttr.length - 1], _val)
1557
+ } else {
1558
+ utils.setValueByPath(pInst, bindPath, _val, thisIndex)
1559
+ }
1550
1560
  }
1551
1561
  }
1552
1562
  })
@@ -100,6 +100,7 @@
100
100
  :current-sub-data="currentSubData"
101
101
  :dialog-config="dialogConfig"
102
102
  :dialog-type="dialogType"
103
+ :sub-dialog-mode="subDialogMode"
103
104
  @calacInputSuffixHeight="calacInputSuffixHeight"
104
105
  @updateInput="updateInput"
105
106
  ></custom-mobile-dialog>
@@ -183,6 +184,10 @@
183
184
  type: String,
184
185
  default: 'form',
185
186
  },
187
+ subDialogMode: {
188
+ type: String,
189
+ default: '',
190
+ },
186
191
  },
187
192
  data() {
188
193
  return {
@@ -158,83 +158,88 @@
158
158
  resolve(true)
159
159
  return
160
160
  }
161
- const expandList = JSON.parse(this.formExpand)
162
-
163
- if (!expandList.list) {
164
- resolve(true)
165
- return
166
- }
167
- const subTableList = expandList.list.filter((it) => {
168
- return (
169
- (this.isMobile && it.ctrlType == 'subDiv') ||
170
- (!this.isMobile && it.ctrlType === 'subtable')
171
- )
172
- })
173
- if (!this.isMobile) {
174
- // pc端找到 分页的子表 校验
175
- const havePageSub = subTableList.filter((k) => {
176
- return k.subtablePagination
177
- })
178
- if (!havePageSub.length) {
161
+ try {
162
+ const expandList = JSON.parse(this.formExpand)
163
+ if (!expandList.list) {
179
164
  resolve(true)
180
165
  return
181
166
  }
182
- }
183
- const mainAlias = Object.keys(this.data)[0]
184
- const mainData = this.data[mainAlias]
185
- const errorResult = []
186
-
187
- Object.keys(mainData).forEach((key) => {
188
- if (key.startsWith('sub_')) {
189
- const curSubConfig = subTableList.find((sub) => {
190
- return sub.name == key.replace('sub_', '')
167
+ const subTableList = expandList.list.filter((it) => {
168
+ return (
169
+ (this.isMobile && it.ctrlType == 'subDiv') ||
170
+ (!this.isMobile && it.ctrlType === 'subtable')
171
+ )
172
+ })
173
+ if (!this.isMobile) {
174
+ // pc端找到 分页的子表 校验
175
+ const havePageSub = subTableList.filter((k) => {
176
+ return k.subtablePagination
191
177
  })
192
- const subAlias = key.replace('sub_', '')
193
- const subPermission = this.permission.fields[subAlias]
194
- mainData[key].forEach((item, index) => {
195
- Object.keys(item).forEach((subKey) => {
196
- if (subPermission[subKey] == 'b' && !item[subKey]) {
197
- const subItem = curSubConfig.list.find((l) => {
198
- return l.name === subKey
199
- })
200
- let haveIndex = errorResult.findIndex((it) => {
201
- return (
202
- it.tableName === curSubConfig.desc &&
203
- it.fieldName === subItem.desc
204
- )
205
- })
206
- if (haveIndex === -1) {
207
- errorResult.push({
208
- tableName: curSubConfig.desc,
209
- index: index + 1,
210
- fieldName: subItem.desc,
178
+ if (!havePageSub.length) {
179
+ resolve(true)
180
+ return
181
+ }
182
+ }
183
+ const mainAlias = Object.keys(this.data)[0]
184
+ const mainData = this.data[mainAlias]
185
+ const errorResult = []
186
+
187
+ Object.keys(mainData).forEach((key) => {
188
+ if (key.startsWith('sub_')) {
189
+ const curSubConfig = subTableList.find((sub) => {
190
+ return sub.name == key.replace('sub_', '')
191
+ })
192
+ const subAlias = key.replace('sub_', '')
193
+ const subPermission = this.permission.fields[subAlias]
194
+ mainData[key].forEach((item, index) => {
195
+ Object.keys(item).forEach((subKey) => {
196
+ if (subPermission[subKey] == 'b' && !item[subKey]) {
197
+ const subItem = curSubConfig.list.find((l) => {
198
+ return l.name === subKey
211
199
  })
200
+ let haveIndex = errorResult.findIndex((it) => {
201
+ return (
202
+ it.tableName === curSubConfig.desc &&
203
+ it.fieldName === subItem.desc
204
+ )
205
+ })
206
+ if (haveIndex === -1) {
207
+ errorResult.push({
208
+ tableName: curSubConfig.desc,
209
+ index: index + 1,
210
+ fieldName: subItem.desc,
211
+ })
212
+ }
212
213
  }
213
- }
214
+ })
214
215
  })
215
- })
216
- }
217
- })
218
- if (errorResult.length > 0) {
219
- const messages = errorResult.map((k) => {
220
- return `${k.tableName},【${k.fieldName}】必填`
216
+ }
221
217
  })
222
- // 判断是移动端还是pc
223
- if (utils.isMobile()) {
224
- this.$notify({
225
- message: messages.join('\n'),
226
- background: '#f25130',
218
+ if (errorResult.length > 0) {
219
+ const messages = errorResult.map((k) => {
220
+ return `${k.tableName},【${k.fieldName}】必填`
227
221
  })
222
+ // 判断是移动端还是pc
223
+ if (utils.isMobile()) {
224
+ this.$notify({
225
+ message: messages.join('\n'),
226
+ background: '#f25130',
227
+ })
228
+ } else {
229
+ Notification.error({
230
+ title: this.$t('ht.common.warmTips'),
231
+ dangerouslyUseHTMLString: true,
232
+ message: messages.join('<br/>'),
233
+ })
234
+ }
235
+ resolve(false)
228
236
  } else {
229
- Notification.error({
230
- title: this.$t('ht.common.warmTips'),
231
- dangerouslyUseHTMLString: true,
232
- message: messages.join('<br/>'),
233
- })
237
+ resolve(true)
234
238
  }
235
- resolve(false)
236
- } else {
239
+ } catch (e) {
237
240
  resolve(true)
241
+ console.error('formExpand 格式错误')
242
+ return
238
243
  }
239
244
  })
240
245
  },
@@ -616,6 +616,7 @@ export default {
616
616
  this.data[boAlias]['sub_' + subTableName] &&
617
617
  this.data[boAlias]['sub_' + subTableName].length < 1
618
618
  ) {
619
+ subInitData.sub_guid = this.guid()
619
620
  this.data[boAlias]['sub_' + subTableName].push(
620
621
  JSON.parse(JSON.stringify(subInitData))
621
622
  )