用户信息查询-编辑-地区-加载禁用态

This commit is contained in:
khalil
2025-06-05 14:20:24 +08:00
parent e387d93d8e
commit 42ee226cc1

View File

@@ -188,12 +188,12 @@
<div class="form-group">
<label for="editPhone"
class="col-sm-3 control-label">手机号:</label>
<div class="col-sm-2 control-label">
<div class="col-sm-3 control-label">
<select name="phoneAreaCode"
id="phoneAreaCode"
class="form-control validate[required]"></select>
</div>
<div class="col-sm-6 control-label">
<div class="col-sm-5 control-label">
<input type="text"
class="form-control"
name="editPhone"
@@ -459,10 +459,13 @@ export default {
this.initPartition();
this.initPhoneAreaCode();
this.initData();
const $this = this;
$("#partitionId").on("change", function () {
var selectedValue = $(this).val();
this.initRegionInfo(selectedValue);
$this.initRegionInfo(selectedValue);
});
});
},
methods: {
@@ -1151,21 +1154,34 @@ export default {
});
},
initRegionInfo (partitionId, regionId) {
const regionSelect = $("#regionId");
$.ajax({
type: "get",
url: "/admin/regionInfo/listByPartitionId",
data: { partitionId: partitionId, containAll: false },
dataType: "json",
beforeSend: function () {
regionSelect.prop("disabled", true);
},
success: function (res) {
var regionSelect = $("#regionId");
regionSelect.empty();
if (res.code === 200) {
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);
}
if (res.code !== 200) {
//报错
throw new Error(res);
}
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,
data.map((v) => {
return {
value: v,
text: v,
value: v.phoneAreaCode,
text: v.phoneAreaCode + "(" + v.desc + ")",
};
})
);