|
@@ -93,7 +93,8 @@ const PCA = {
|
93
|
93
|
data() {
|
94
|
94
|
return {
|
95
|
95
|
selected: [],
|
96
|
|
- selectData: []
|
|
96
|
+ selectData: [],
|
|
97
|
+ selectIndex: [0, 0]
|
97
|
98
|
};
|
98
|
99
|
},
|
99
|
100
|
render(createElement) {
|
|
@@ -113,7 +114,10 @@ const PCA = {
|
113
|
114
|
this.picker.show();
|
114
|
115
|
},
|
115
|
116
|
selectHandler(selectedVal, selectedIndex, selectedTxt) {
|
|
117
|
+ console.log(selectedVal, selectedIndex, selectedTxt, "baba", this);
|
|
118
|
+ this.getRoomData(selectedVal[1]);
|
116
|
119
|
this.selected = selectedTxt;
|
|
120
|
+ this.selectIndex = selectedIndex;
|
117
|
121
|
this.$emit("input", selectedVal);
|
118
|
122
|
},
|
119
|
123
|
getAreaData() {
|
|
@@ -138,6 +142,7 @@ const PCA = {
|
138
|
142
|
});
|
139
|
143
|
},
|
140
|
144
|
getPlaceData() {
|
|
145
|
+ this.$parent.$parent.$parent.$parent.$parent.loadShow = true;
|
141
|
146
|
var that = this;
|
142
|
147
|
this.$http
|
143
|
148
|
.post("service/user/data/fetchDataList/place", {
|
|
@@ -147,7 +152,7 @@ const PCA = {
|
147
|
152
|
wechatAreaId: ""
|
148
|
153
|
}
|
149
|
154
|
})
|
150
|
|
- .then(function(res) {
|
|
155
|
+ .then(res => {
|
151
|
156
|
var data = res.data.list;
|
152
|
157
|
for (var i = 0; i < data.length; i++) {
|
153
|
158
|
for (var j = 0; j < that.selectData.length; j++) {
|
|
@@ -159,18 +164,49 @@ const PCA = {
|
159
|
164
|
}
|
160
|
165
|
}
|
161
|
166
|
}
|
|
167
|
+ console.log(that.selectData);
|
|
168
|
+ let loginUser = JSON.parse(localStorage.getItem("loginUser"));
|
|
169
|
+ let areaIndex = that.selectData.findIndex(
|
|
170
|
+ v => v.value == loginUser.place.area.id
|
|
171
|
+ );
|
|
172
|
+ let placeIndex = that.selectData
|
|
173
|
+ .find(v => v.value == loginUser.place.area.id)
|
|
174
|
+ .children.findIndex(v => v.value == loginUser.place.id);
|
|
175
|
+ that.selectIndex = [areaIndex, placeIndex];
|
162
|
176
|
that.picker = that.$createCascadePicker({
|
163
|
177
|
title: "区域地点选择",
|
164
|
178
|
data: that.selectData,
|
165
|
|
- selectedIndex: [0, 0],
|
|
179
|
+ selectedIndex: that.selectIndex,
|
166
|
180
|
onSelect: that.selectHandler
|
167
|
181
|
});
|
|
182
|
+ this.$parent.$parent.$parent.$parent.$parent.loadShow = false;
|
168
|
183
|
});
|
169
|
184
|
},
|
170
|
185
|
getParamsPlace() {
|
171
|
186
|
var data = JSON.parse(localStorage.getItem("loginUser"));
|
172
|
187
|
this.selected[0] = data.place.area.area;
|
173
|
188
|
this.selected[1] = data.place.place;
|
|
189
|
+ this.getRoomData(data.place.id);
|
|
190
|
+ },
|
|
191
|
+ getRoomData(placeId) {
|
|
192
|
+ this.$http
|
|
193
|
+ .post("service/user/data/fetchDataList/room", {
|
|
194
|
+ idx: 0,
|
|
195
|
+ sum: 1000,
|
|
196
|
+ room: { place: { id: placeId } }
|
|
197
|
+ })
|
|
198
|
+ .then(result => {
|
|
199
|
+ let arr = [];
|
|
200
|
+ result.data.list.forEach(item => {
|
|
201
|
+ arr.push({ value: item.room, text: item.room });
|
|
202
|
+ });
|
|
203
|
+ this.$parent.$parent.$parent.$parent.$parent.fields.forEach(item => {
|
|
204
|
+ // 初始化房间号下拉框列表
|
|
205
|
+ if (item.modelKey == "room") {
|
|
206
|
+ item.props.options = arr;
|
|
207
|
+ }
|
|
208
|
+ });
|
|
209
|
+ });
|
174
|
210
|
}
|
175
|
211
|
},
|
176
|
212
|
created() {
|
|
@@ -188,9 +224,9 @@ const delay = (function() {
|
188
|
224
|
})();
|
189
|
225
|
export default {
|
190
|
226
|
watch: {
|
191
|
|
- "model.uuu": {
|
192
|
|
- handler(newV, oldV) {
|
193
|
|
- this.model.address = newV;
|
|
227
|
+ "model.room": {
|
|
228
|
+ handler(newV) {
|
|
229
|
+ this.model.address = newV || "";
|
194
|
230
|
}
|
195
|
231
|
}
|
196
|
232
|
},
|
|
@@ -241,7 +277,7 @@ export default {
|
241
|
277
|
deptId: "",
|
242
|
278
|
contacts: "",
|
243
|
279
|
assetId: "",
|
244
|
|
- uuu: ""
|
|
280
|
+ room: ""
|
245
|
281
|
},
|
246
|
282
|
// showPrompting:false,
|
247
|
283
|
promptingConent: "",
|
|
@@ -343,14 +379,14 @@ export default {
|
343
|
379
|
},
|
344
|
380
|
{
|
345
|
381
|
type: "select",
|
346
|
|
- modelKey: "uuu",
|
|
382
|
+ modelKey: "room",
|
347
|
383
|
label: "房间号",
|
348
|
384
|
props: {
|
349
|
385
|
placeholder: "请选择房间号",
|
350
|
|
- options: ['2015', '2016', '2017', '2018', '2019', '2020']
|
|
386
|
+ options: []
|
351
|
387
|
},
|
352
|
388
|
rules: {
|
353
|
|
- required: true
|
|
389
|
+ required: false
|
354
|
390
|
}
|
355
|
391
|
}
|
356
|
392
|
]
|