用户信息查询-编辑-地区-加载禁用态
This commit is contained in:
@@ -188,12 +188,12 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="editPhone"
|
<label for="editPhone"
|
||||||
class="col-sm-3 control-label">手机号:</label>
|
class="col-sm-3 control-label">手机号:</label>
|
||||||
<div class="col-sm-2 control-label">
|
<div class="col-sm-3 control-label">
|
||||||
<select name="phoneAreaCode"
|
<select name="phoneAreaCode"
|
||||||
id="phoneAreaCode"
|
id="phoneAreaCode"
|
||||||
class="form-control validate[required]"></select>
|
class="form-control validate[required]"></select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6 control-label">
|
<div class="col-sm-5 control-label">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
name="editPhone"
|
name="editPhone"
|
||||||
@@ -459,10 +459,13 @@ export default {
|
|||||||
this.initPartition();
|
this.initPartition();
|
||||||
this.initPhoneAreaCode();
|
this.initPhoneAreaCode();
|
||||||
this.initData();
|
this.initData();
|
||||||
|
|
||||||
|
const $this = this;
|
||||||
$("#partitionId").on("change", function () {
|
$("#partitionId").on("change", function () {
|
||||||
var selectedValue = $(this).val();
|
var selectedValue = $(this).val();
|
||||||
this.initRegionInfo(selectedValue);
|
$this.initRegionInfo(selectedValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -1151,21 +1154,34 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
initRegionInfo (partitionId, regionId) {
|
initRegionInfo (partitionId, regionId) {
|
||||||
|
const regionSelect = $("#regionId");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: "/admin/regionInfo/listByPartitionId",
|
url: "/admin/regionInfo/listByPartitionId",
|
||||||
data: { partitionId: partitionId, containAll: false },
|
data: { partitionId: partitionId, containAll: false },
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
beforeSend: function () {
|
||||||
|
regionSelect.prop("disabled", true);
|
||||||
|
},
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
var regionSelect = $("#regionId");
|
if (res.code !== 200) {
|
||||||
regionSelect.empty();
|
//报错
|
||||||
if (res.code === 200) {
|
throw new Error(res);
|
||||||
for (var i = 0; i < res.data.length; i++) {
|
|
||||||
const regionInfo = res.data[i];
|
|
||||||
const option = $("<option>", { text: regionInfo.name, value: regionInfo.id, selected: regionId && regionId === regionInfo.id });
|
|
||||||
regionSelect.append(option);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
regionSelect.empty();
|
||||||
|
for (var i = 0; i < res.data.length; i++) {
|
||||||
|
const regionInfo = res.data[i];
|
||||||
|
const option = $("<option>", { text: regionInfo.name, value: regionInfo.id, selected: regionId && regionId === regionInfo.id });
|
||||||
|
regionSelect.append(option);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (err) {
|
||||||
|
console.log(err);
|
||||||
|
$("#tipMsg").text("获取手机区号失败,错误码:");
|
||||||
|
$("#tipModal").modal('show');
|
||||||
|
},
|
||||||
|
complete: function () {
|
||||||
|
regionSelect.prop("disabled", false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -1182,8 +1198,8 @@ export default {
|
|||||||
null,
|
null,
|
||||||
data.map((v) => {
|
data.map((v) => {
|
||||||
return {
|
return {
|
||||||
value: v,
|
value: v.phoneAreaCode,
|
||||||
text: v,
|
text: v.phoneAreaCode + "(" + v.desc + ")",
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user