用户信息管理-分区与地区联动

This commit is contained in:
khalil
2025-06-03 12:07:27 +08:00
parent 06d0613981
commit 476f769142
2 changed files with 63 additions and 51 deletions

View File

@@ -78,6 +78,8 @@
label="公会长ID"
>
</el-table-column>
<el-table-column align="center" prop="agencyOwnerRegionDesc" label="公会长地区">
</el-table-column>
<el-table-column align="center" prop="diamondFlow" label="钻石流水">
<template v-slot="scope">
{{

View File

@@ -47,6 +47,7 @@
</div>
<div class="part form-group">
<div class="gender">性别: <span></span></div>
<div class="phoneAreaCode">手机区号: <span></span></div>
<div class="phone">手机: <span></span></div>
<div class="email">email: <span></span></div>
<div class="birth">出生日期: <span></span></div>
@@ -142,14 +143,17 @@
</div>
</div>
<div class="form-group">
<label for="editPhone" class="col-sm-3 control-label">手机:</label>
<div class="col-sm-8 control-label">
<label for="editPhone" class="col-sm-3 control-label">手机:</label>
<div class="col-sm-2 control-label">
<select name="phoneAreaCode" id="phoneAreaCode" class="form-control validate[required]"></select>
</div>
<div class="col-sm-6 control-label">
<input type="text" class="form-control" name="editPhone" id="editPhone">
<a href="javascript:void(0)" id="removePhone">解绑</a>
</div>
</div>
<div class="form-group">
<label for="editPhone" class="col-sm-3 control-label">邮箱:</label>
<label for="editEmail" class="col-sm-3 control-label">邮箱:</label>
<div class="col-sm-8 control-label">
<input type="text" class="form-control" name="editEmail" id="editEmail">
<a href="javascript:void(0)" id="removeEmail">解绑</a>
@@ -307,6 +311,7 @@ export default {
data() {
return {
partitionInfos: [],
phoneAreaCodes: [],
};
},
setup() {
@@ -322,31 +327,12 @@ export default {
created() {
this.$nextTick(function () {
this.initPartition();
this.initPhoneAreaCode();
this.initData();
$("#partitionId").on("change", function() {
var selectedValue = $(this).val();
$.ajax({
type: "get",
url: "/admin/regionInfo/listByPartitionId",
data: { partitionId: selectedValue,containAll:false },
dataType: "json",
success: function (res) {
var regionId = $("#regionId");
regionId.empty();
if(res.code == 200){
for (var i = 0; i < res.data.length; i++) {
var option = $("<option>", {
text: JSON.parse(res.data[i].name).zh,
value:res.data[i].id
});
regionId.append(option);
}
}
}
})
});
var selectedValue = $(this).val();
this.initRegionInfo(selectedValue);
});
});
},
methods: {
@@ -377,7 +363,7 @@ export default {
},
uniqueId: 'code',
toolbar: '#toolbar',
url: '/admin/userCheckAdmin/getlist',
url: '/admin/userCheckAdmin/list',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
@@ -397,6 +383,7 @@ export default {
},
{ field: 'account.uid', title: 'Uid', align: 'center', valign: 'middle' },
{ field: 'users.nick', title: '用户昵称', align: 'center', valign: 'middle' },
{ field: 'users.phoneAreaCode', title: '区号', align: 'center', valign: 'middle' },
{ field: 'users.phone', title: '手机号', align: 'center', valign: 'middle' },
{ field: 'users.email', title: '邮箱', align: 'center', valign: 'middle' },
{ field: 'users.userDesc', title: '简介', align: 'center', valign: 'middle' },
@@ -699,11 +686,12 @@ export default {
}
$("#editUser").ajaxSubmit(options);
});
$('#table').on('click', '.opt-edit', function () {
$('#imgUrl').val('');
$('#picUrl').attr('src', '');
$('#uploadPhotoFile').val('');
$("#needSend").prop("checked", true);
$("#notSend").prop("checked", true);
$('#msg').val('');
$('#msgDiv').show();
$.ajax({
@@ -722,9 +710,12 @@ export default {
var avatar = users ? users.avatar : '';
var gender = users ? users.gender : 1;
var defUser = users ? users.defUser : 1;
let partitionId = users.partitionId;
const partitionId = users.partitionId;
const regionId = users.regionId;
$this.initRegionInfo(partitionId, regionId)
$('#editNick').val(nick);
$('#phoneAreaCode').val(account.phoneAreaCode);
$('#editPhone').val(account.phone);
$('#addImgUrl').attr('src', avatar);
$('#editAvatar').val(avatar);
@@ -745,29 +736,7 @@ export default {
'<td><button class="btn btn-danger" type="button" onclick="delPhoto(this)">删除</button></td></tr>');
$photos.append($photo);
});
// 获取选择地区
$.ajax({
type: "get",
url: "/admin/regionInfo/listByPartitionId",
data: { partitionId: partitionId,containAll:false },
dataType: "json",
success: function (res) {
var regionId = $("#regionId");
regionId.empty();
if(res.code == 200){
for (var i = 0; i < res.data.length; i++) {
var option = $("<option>", {
text: JSON.parse(res.data[i].name).zh,
value:res.data[i].id
});
regionId.append(option);
}
$("#regionId").val(users.regionId);
}
}
})
}
$('#editModal').modal('show');
}
@@ -916,6 +885,7 @@ export default {
gender: $('#editGender').val(),
avatar: $('#editAvatar').val(),
uid: $('#editUid').val(),
phoneAreaCode: $('#phoneAreaCode').val(),
phone: $('#editPhone').val(),
defUser: $('#editDefUser').val(),
alipayAccount: $('#alipayAccount').val(),
@@ -1043,6 +1013,46 @@ export default {
);
});
},
initRegionInfo(partitionId, regionId) {
$.ajax({
type: "get",
url: "/admin/regionInfo/listByPartitionId",
data: { partitionId: partitionId, containAll:false },
dataType: "json",
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);
}
}
}
})
},
initPhoneAreaCode() {
$.ajax({
type: "get",
url: "/admin/userCheckAdmin/listPhoneAreaCode",
dataType: "json",
success: function (res) {
let data = res.data;
this.phoneAreaCodes = data;
buildSelectOption(
"#phoneAreaCode",
null,
data.map((v) => {
return {
value: v,
text: v,
};
})
);
}
});
},
},
};