mali-applet-ui 1.0.182 → 1.0.183

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.
@@ -101,6 +101,8 @@ export default {
101
101
  } else {
102
102
  item.errRule = null
103
103
  }
104
+ } else {
105
+ item.errRule = null
104
106
  }
105
107
  }
106
108
  return errMaps ? Promise.resolve(errMaps) : Promise.resolve()
@@ -48,6 +48,7 @@ export default {
48
48
  },
49
49
  data () {
50
50
  return {
51
+ defaulList: [],
51
52
  dataList: []
52
53
  }
53
54
  },
@@ -67,19 +68,16 @@ export default {
67
68
  }
68
69
  return XEUtils.eqNull(this.value) || this.value === ''
69
70
  },
71
+ selectRows () {
72
+ return this.getSelectRows(this.value)
73
+ },
70
74
  selectLabel () {
71
- let rest = []
72
- if (this.type === 'checkbox') {
73
- rest = this.dataList.filter(item => this.value.includes(item[this.optValueField]))
74
- } else if (this.type === 'radio') {
75
- rest = this.dataList.filter(item => this.value === item[this.optValueField])
76
- }
77
- return rest.map(item => item[this.optLabelField]).join(',')
75
+ return this.selectRows.map(item => item[this.optLabelField]).join(',')
78
76
  }
79
77
  },
80
78
  watch: {
81
79
  defaultOptions () {
82
- this.dataList = this.defaultOptions
80
+ this.defaulList = this.defaultOptions
83
81
  },
84
82
  options () {
85
83
  this.dataList = this.options
@@ -87,13 +85,26 @@ export default {
87
85
  },
88
86
  created () {
89
87
  if (this.defaultOptions) {
90
- this.dataList = this.defaultOptions
88
+ this.defaulList = this.defaultOptions
91
89
  }
92
90
  if (this.options) {
93
91
  this.dataList = this.options
94
92
  }
95
93
  },
96
94
  methods: {
95
+ getSelectRows (value) {
96
+ const vals = XEUtils.isArray(value) ? value : [value]
97
+ return vals.map(val => {
98
+ let item = this.dataList.find(item => val === item[this.optValueField])
99
+ if (!item) {
100
+ item = this.defaulList.find(item => val === item[this.optValueField])
101
+ }
102
+ return item || {
103
+ [this.optLabelField]: val,
104
+ [this.optValueField]: val
105
+ }
106
+ })
107
+ },
97
108
  tapEvent () {
98
109
  if (this.disabled) {
99
110
  return
@@ -56,6 +56,7 @@ export default {
56
56
  },
57
57
  data () {
58
58
  return {
59
+ defaulList: [],
59
60
  dataList: []
60
61
  }
61
62
  },
@@ -87,7 +88,7 @@ export default {
87
88
  },
88
89
  watch: {
89
90
  defaultOptions () {
90
- this.dataList = this.defaultOptions
91
+ this.defaulList = this.defaultOptions
91
92
  },
92
93
  options () {
93
94
  this.dataList = this.options
@@ -95,7 +96,7 @@ export default {
95
96
  },
96
97
  created () {
97
98
  if (this.defaultOptions) {
98
- this.dataList = this.defaultOptions
99
+ this.defaulList = this.defaultOptions
99
100
  }
100
101
  if (this.options) {
101
102
  this.dataList = this.options
@@ -110,13 +111,17 @@ export default {
110
111
  this.$emit('click', {})
111
112
  },
112
113
  getSelectRows (value) {
113
- if (!this.dataList || !this.dataList.length) {
114
- return []
115
- }
116
- if (this.type === 'checkbox') {
117
- return this.dataList.filter(item => value.includes(item[this.optValueField]))
118
- }
119
- return this.dataList.filter(item => value === item[this.optValueField])
114
+ const vals = XEUtils.isArray(value) ? value : [value]
115
+ return vals.map(val => {
116
+ let item = this.dataList.find(item => val === item[this.optValueField])
117
+ if (!item) {
118
+ item = this.defaulList.find(item => val === item[this.optValueField])
119
+ }
120
+ return item || {
121
+ [this.optLabelField]: val,
122
+ [this.optValueField]: val
123
+ }
124
+ })
120
125
  },
121
126
  openUserEvent () {
122
127
  if (this.disabled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.0.182",
3
+ "version": "1.0.183",
4
4
  "description": "vue2 码里云小程序组件库",
5
5
  "files": [
6
6
  "lib",