three-trees-ui 1.1.3 → 1.1.5

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.3",
3
+ "version": "1.1.5",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -33,7 +33,7 @@
33
33
  import emitter from '@/mixins/emitter.js'
34
34
  import mobileMode from '@/mixins/mobileMode.js'
35
35
  import { Notification } from 'element-ui'
36
- import { Notify } from 'vant'
36
+ // import { Notify } from 'vant'
37
37
 
38
38
  import Vue from 'vue'
39
39
  export default {
@@ -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
- 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
  },