@10yun/cv-mobile-ui 0.5.2 → 0.5.3
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
|
@@ -59,8 +59,8 @@ export default {
|
|
|
59
59
|
items_index: [0, 0, 0], //当前下标
|
|
60
60
|
lastRetDataIndex: [0, 0, 0], // 最终确定选中的下标
|
|
61
61
|
localDataType: 'text',
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
localDataValue: 'value',
|
|
63
|
+
localDataText: 'label',
|
|
64
64
|
localProvince: {},
|
|
65
65
|
localCity: {},
|
|
66
66
|
localCounty: {}
|
|
@@ -53,6 +53,9 @@ export default {
|
|
|
53
53
|
localArr: [],
|
|
54
54
|
// 当前选中下标
|
|
55
55
|
localIndex: null,
|
|
56
|
+
localDataType: 'text',
|
|
57
|
+
localDataValue: 'value',
|
|
58
|
+
localDataText: 'label',
|
|
56
59
|
iconTop: false,
|
|
57
60
|
pickerLists: []
|
|
58
61
|
};
|
|
@@ -102,14 +105,14 @@ export default {
|
|
|
102
105
|
* 处理-选中
|
|
103
106
|
*/
|
|
104
107
|
_dealValue() {
|
|
105
|
-
this.
|
|
108
|
+
this.localDataType = this.dataType != 'text' ? 'value' : 'text';
|
|
106
109
|
//默认Value
|
|
107
110
|
let tempArr = this.localArr;
|
|
108
111
|
let localIndex = null;
|
|
109
112
|
for (let index = 0; index < tempArr.length; index++) {
|
|
110
|
-
if (this.
|
|
113
|
+
if (this.localDataType == 'text' && this.localVal == tempArr[index].text) {
|
|
111
114
|
localIndex = index;
|
|
112
|
-
} else if (this.
|
|
115
|
+
} else if (this.localDataType == 'value' && this.localVal == tempArr[index].value) {
|
|
113
116
|
localIndex = index;
|
|
114
117
|
}
|
|
115
118
|
}
|
|
@@ -145,7 +148,7 @@ export default {
|
|
|
145
148
|
|
|
146
149
|
this.localIndex = localIndex;
|
|
147
150
|
const rowData = this.localArr[localIndex];
|
|
148
|
-
if (this.
|
|
151
|
+
if (this.localDataType == 'text') {
|
|
149
152
|
this.localVal = rowData.text;
|
|
150
153
|
} else {
|
|
151
154
|
this.localVal = rowData.value;
|
|
@@ -52,9 +52,9 @@ export default {
|
|
|
52
52
|
type: String,
|
|
53
53
|
default: 'text'
|
|
54
54
|
},
|
|
55
|
-
|
|
55
|
+
dataTree: {
|
|
56
56
|
type: String,
|
|
57
|
-
default: '
|
|
57
|
+
default: 'tree'
|
|
58
58
|
},
|
|
59
59
|
joint: {
|
|
60
60
|
type: String,
|
|
@@ -83,7 +83,9 @@ export default {
|
|
|
83
83
|
items_sub: [],
|
|
84
84
|
items_index: [0, 0], //当前下标
|
|
85
85
|
lastRetDataIndex: [0, 0], // 最终确定选中的下标
|
|
86
|
-
localDataType: ''
|
|
86
|
+
localDataType: '',
|
|
87
|
+
localDataValue: 'value',
|
|
88
|
+
localDataText: 'label'
|
|
87
89
|
};
|
|
88
90
|
},
|
|
89
91
|
created() {
|
|
@@ -107,7 +109,7 @@ export default {
|
|
|
107
109
|
let items = [];
|
|
108
110
|
let dataValue = this.dataValue ? this.dataValue : 'value';
|
|
109
111
|
let dataText = this.dataText ? this.dataText : 'text';
|
|
110
|
-
let
|
|
112
|
+
let tree = this.dataTree;
|
|
111
113
|
let items_index = this.items_index;
|
|
112
114
|
let dataType = this.localDataType;
|
|
113
115
|
for (let i in original) {
|
|
@@ -125,11 +127,11 @@ export default {
|
|
|
125
127
|
value: data[dataValue].toString(),
|
|
126
128
|
text: data[dataText]
|
|
127
129
|
});
|
|
128
|
-
if (original[i][
|
|
129
|
-
let
|
|
130
|
+
if (original[i][tree]) {
|
|
131
|
+
let tree_data = original[i][tree];
|
|
130
132
|
let temp = [];
|
|
131
|
-
for (const ii in
|
|
132
|
-
let data =
|
|
133
|
+
for (const ii in tree_data) {
|
|
134
|
+
let data = tree_data[ii];
|
|
133
135
|
|
|
134
136
|
//查找二级绑定参数
|
|
135
137
|
if (this.localVal[1]) {
|
|
@@ -144,7 +146,7 @@ export default {
|
|
|
144
146
|
text: data[dataText]
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
|
-
items[i].
|
|
149
|
+
items[i].tree = temp;
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
152
|
if (!items) {
|
|
@@ -152,7 +154,7 @@ export default {
|
|
|
152
154
|
}
|
|
153
155
|
//默认Value
|
|
154
156
|
this.items = items;
|
|
155
|
-
this.items_sub = items[items_index[0] ?? 0].
|
|
157
|
+
this.items_sub = items[items_index[0] ?? 0].tree;
|
|
156
158
|
this.range_data = [items, this.items_sub];
|
|
157
159
|
this.last_range_data = [...this.range_data];
|
|
158
160
|
this.items_index = items_index;
|
|
@@ -180,7 +182,7 @@ export default {
|
|
|
180
182
|
items_index[0] = e.detail.value;
|
|
181
183
|
items_index[1] = 0;
|
|
182
184
|
let range_data = this.range_data;
|
|
183
|
-
range_data[1] = range_data[0][items_index[0]].
|
|
185
|
+
range_data[1] = range_data[0][items_index[0]].tree;
|
|
184
186
|
this.range_data = range_data;
|
|
185
187
|
}
|
|
186
188
|
this.items_index = items_index;
|
|
@@ -194,10 +196,10 @@ export default {
|
|
|
194
196
|
let items = this.items;
|
|
195
197
|
if (this.dataType == 'text') {
|
|
196
198
|
value[0] = items[items_index[0]].text;
|
|
197
|
-
value[1] = items[items_index[0]].
|
|
199
|
+
value[1] = items[items_index[0]].tree[items_index[1]].text;
|
|
198
200
|
} else {
|
|
199
201
|
value[0] = items[items_index[0]].value;
|
|
200
|
-
value[1] = items[items_index[0]].
|
|
202
|
+
value[1] = items[items_index[0]].tree[items_index[1]].value;
|
|
201
203
|
}
|
|
202
204
|
this.localVal = value;
|
|
203
205
|
this.$emit('input', value);
|
|
@@ -63,9 +63,9 @@ export default {
|
|
|
63
63
|
type: String,
|
|
64
64
|
default: 'text'
|
|
65
65
|
},
|
|
66
|
-
|
|
66
|
+
dataTree: {
|
|
67
67
|
type: String,
|
|
68
|
-
default: '
|
|
68
|
+
default: 'tree'
|
|
69
69
|
},
|
|
70
70
|
joint: {
|
|
71
71
|
type: String,
|
|
@@ -118,7 +118,8 @@ export default {
|
|
|
118
118
|
let items = [];
|
|
119
119
|
let dataValue = this.dataValue ? this.dataValue : 'value';
|
|
120
120
|
let dataText = this.dataText ? this.dataText : 'text';
|
|
121
|
-
|
|
121
|
+
|
|
122
|
+
let tree = this.dataTree;
|
|
122
123
|
let items_index = this.items_index;
|
|
123
124
|
let dataType = this.localDataType;
|
|
124
125
|
for (let i in original) {
|
|
@@ -132,16 +133,15 @@ export default {
|
|
|
132
133
|
items_index[0] = i;
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
|
-
|
|
136
136
|
items.push({
|
|
137
137
|
value: data[dataValue].toString(),
|
|
138
138
|
text: data[dataText]
|
|
139
139
|
});
|
|
140
|
-
if (original[i][
|
|
141
|
-
let
|
|
140
|
+
if (original[i][tree]) {
|
|
141
|
+
let tree_data = original[i][tree];
|
|
142
142
|
let temp = [];
|
|
143
|
-
for (const ii in
|
|
144
|
-
let data =
|
|
143
|
+
for (const ii in tree_data) {
|
|
144
|
+
let data = tree_data[ii];
|
|
145
145
|
|
|
146
146
|
//查找二级绑定参数
|
|
147
147
|
if (this.localVal.length >= 2) {
|
|
@@ -155,14 +155,14 @@ export default {
|
|
|
155
155
|
value: data[dataValue].toString(),
|
|
156
156
|
text: data[dataText]
|
|
157
157
|
});
|
|
158
|
-
if (
|
|
159
|
-
|
|
158
|
+
if (tree_data[ii][tree] == undefined) {
|
|
159
|
+
tree_data[ii][tree] = [{}];
|
|
160
160
|
}
|
|
161
|
-
if (
|
|
162
|
-
let
|
|
161
|
+
if (tree_data[ii][tree]) {
|
|
162
|
+
let tree_data2 = tree_data[ii][tree];
|
|
163
163
|
let temp2 = [];
|
|
164
|
-
for (const iii in
|
|
165
|
-
let data =
|
|
164
|
+
for (const iii in tree_data2) {
|
|
165
|
+
let data = tree_data2[iii];
|
|
166
166
|
//查找三级绑定参数
|
|
167
167
|
if (this.localVal.length >= 3) {
|
|
168
168
|
if (dataType == 'text' && this.localVal[2] == data[dataText]) {
|
|
@@ -183,10 +183,10 @@ export default {
|
|
|
183
183
|
text: data[dataText]
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
-
temp[ii].
|
|
186
|
+
temp[ii].tree = temp2;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
items[i].
|
|
189
|
+
items[i].tree = temp;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
if (!items) {
|
|
@@ -194,8 +194,8 @@ export default {
|
|
|
194
194
|
}
|
|
195
195
|
//默认Value
|
|
196
196
|
this.items = items;
|
|
197
|
-
this.items_sub = items[items_index[0] ?? 0].
|
|
198
|
-
this.items_sub2 = this.items_sub[items_index[1] ?? 0].
|
|
197
|
+
this.items_sub = items[items_index[0] ?? 0].tree;
|
|
198
|
+
this.items_sub2 = this.items_sub[items_index[1] ?? 0].tree;
|
|
199
199
|
this.range_data = [items, this.items_sub, this.items_sub2];
|
|
200
200
|
this.items_index = items_index;
|
|
201
201
|
this.last_range_data = [...this.range_data];
|
|
@@ -225,15 +225,15 @@ export default {
|
|
|
225
225
|
//滑动二级
|
|
226
226
|
items_index[1] = e.detail.value;
|
|
227
227
|
items_index[2] = 0;
|
|
228
|
-
range_data[2] = range_data[1][items_index[1]].
|
|
228
|
+
range_data[2] = range_data[1][items_index[1]].tree || [];
|
|
229
229
|
// this.range_data = range_data;
|
|
230
230
|
} else if (e.detail.column == 0) {
|
|
231
231
|
//滑动一级
|
|
232
232
|
items_index[0] = e.detail.value;
|
|
233
233
|
items_index[1] = 0;
|
|
234
234
|
items_index[2] = 0;
|
|
235
|
-
range_data[1] = range_data[0][items_index[0]].
|
|
236
|
-
range_data[2] = range_data[1][items_index[1]].
|
|
235
|
+
range_data[1] = range_data[0][items_index[0]].tree || [];
|
|
236
|
+
range_data[2] = range_data[1][items_index[1]].tree || [];
|
|
237
237
|
// this.range_data = range_data;
|
|
238
238
|
}
|
|
239
239
|
this.$set(this, 'range_data', range_data);
|
|
@@ -249,17 +249,17 @@ export default {
|
|
|
249
249
|
let value = [];
|
|
250
250
|
let items = this.items;
|
|
251
251
|
// 2022-07-22,修复三级选项为空时取值异常
|
|
252
|
-
if (!items[items_index[0]].
|
|
253
|
-
items[items_index[0]].
|
|
252
|
+
if (!items[items_index[0]].tree[items_index[1]].tree || items[items_index[0]].tree[items_index[1]].tree.length == 0) {
|
|
253
|
+
items[items_index[0]].tree[items_index[1]].tree = [{ text: '', value: '' }];
|
|
254
254
|
}
|
|
255
|
-
if (this.
|
|
255
|
+
if (this.localDataType == 'text') {
|
|
256
256
|
value[0] = items[items_index[0]].text;
|
|
257
|
-
value[1] = items[items_index[0]].
|
|
258
|
-
value[2] = items[items_index[0]].
|
|
257
|
+
value[1] = items[items_index[0]].tree[items_index[1]].text;
|
|
258
|
+
value[2] = items[items_index[0]].tree[items_index[1]].tree[items_index[2]].text;
|
|
259
259
|
} else {
|
|
260
260
|
value[0] = items[items_index[0]].value;
|
|
261
|
-
value[1] = items[items_index[0]].
|
|
262
|
-
value[2] = items[items_index[0]].
|
|
261
|
+
value[1] = items[items_index[0]].tree[items_index[1]].value;
|
|
262
|
+
value[2] = items[items_index[0]].tree[items_index[1]].tree[items_index[2]].value;
|
|
263
263
|
}
|
|
264
264
|
this.$emit('input', value);
|
|
265
265
|
}
|