+
+
+
强度: {{ passwordStrengthText }}
@@ -64,7 +64,7 @@
-
+
@@ -140,24 +140,24 @@ const state = reactive({
id: 0,
tenantName: '',
tenantType: '' as number | '',
- contactPerson: '',
- phone: '',
- city: [] as string[],
- tenantAccount: '',
- password: '',
+ userNickname: '',
+ mobile: '',
+ cityMergerName: [] as string[],
+ userName: '',
+ userPassword: '',
confirmPassword: '',
businessLicense: '',
},
rules: {
tenantName: [{ required: true, message: '请输入租户名称', trigger: 'blur' }],
tenantType: [{ required: true, message: '请选择租户类型', trigger: 'change' }],
- contactPerson: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
- phone: [
+ userNickname: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
+ mobile: [
{ required: true, message: '请输入电话', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
],
- city: [{ required: true, message: '请选择所属城市', trigger: 'change' }],
- tenantAccount: [
+ cityMergerName: [{ required: true, message: '请选择所属城市', trigger: 'change' }],
+ userName: [
{ required: true, message: '请输入租户账号', trigger: 'blur' },
{ pattern: /^[a-zA-Z0-9]{6,}$/, message: '账号必须为字母或数字,且长度至少6位', trigger: 'blur' }
],
@@ -166,7 +166,7 @@ const state = reactive({
{ required: true, message: '请再次输入密码', trigger: 'blur' },
{
validator: (rule: any, value: any, callback: any) => {
- if (value !== state.ruleForm.password) {
+ if (value !== state.ruleForm.userPassword) {
callback(new Error('两次输入密码不一致'));
} else {
callback();
@@ -184,7 +184,7 @@ const { isShowDialog, ruleForm, rules, passwordStrength } = toRefs(state);
// 密码强度检测
const checkPasswordStrength = () => {
- const pwd = state.ruleForm.password;
+ const pwd = state.ruleForm.userPassword;
let strength = 0;
if (pwd.length >= 6) strength++;
if (/[A-Z]/.test(pwd)) strength++;
@@ -219,8 +219,8 @@ const openDialog = (row?: any) => {
// 由于没有反查函数,这里如果 row.city 是字符串,我们暂时将其直接放入数组,或者需要调用专门的工具函数
// 简单处理:如果 row.city 是字符串,尝试回显
let cityArray: string[] = [];
- if (row.city && typeof row.city === 'string') {
- const storedCode = row.city;
+ if (row.cityMergerName && typeof row.cityMergerName === 'string') {
+ const storedCode = row.cityMergerName;
// 判断是否为直辖市代码 (11xxxx, 12xxxx, 31xxxx, 50xxxx)
if (/^(11|12|31|50)/.test(storedCode)) {
// 直辖市,回显为 [2位代码] (如 '11')
@@ -234,19 +234,19 @@ const openDialog = (row?: any) => {
cityArray = [provinceCode, cityCode];
}
}
- } else if (Array.isArray(row.city)) {
- cityArray = row.city;
+ } else if (Array.isArray(row.cityMergerName)) {
+ cityArray = row.cityMergerName;
}
state.ruleForm = {
id: row.id,
tenantName: row.tenantName,
tenantType: row.tenantType,
- contactPerson: row.contactPerson,
- phone: row.phone,
- city: cityArray,
- tenantAccount: row.tenantAccount,
- password: '', // 修改时不显示密码
+ userNickname: row.userNickname,
+ mobile: row.mobile,
+ cityMergerName: cityArray,
+ userName: row.userName,
+ userPassword: '', // 修改时不显示密码
confirmPassword: '',
businessLicense: row.businessLicense,
};
@@ -269,8 +269,8 @@ const onSubmit = () => {
if (valid) {
// 处理城市数据提交:取数组最后一位
const submitForm: any = { ...state.ruleForm };
- if (Array.isArray(submitForm.city) && submitForm.city.length > 0) {
- let lastCode = String(submitForm.city[submitForm.city.length - 1]);
+ if (Array.isArray(submitForm.cityMergerName) && submitForm.cityMergerName.length > 0) {
+ let lastCode = String(submitForm.cityMergerName[submitForm.cityMergerName.length - 1]);
// 特殊处理直辖市:如果选中的是省级代码,转换为市级代码 (市辖区)
const municipalityMap: Record
= {
'11': '110100', '110000': '110100', // 北京
@@ -284,9 +284,9 @@ const onSubmit = () => {
// 普通省市,如果是4位代码,补齐为6位
lastCode = lastCode + '00';
}
- submitForm.city = lastCode;
+ submitForm.cityCode = lastCode;
} else {
- submitForm.city = '';
+ submitForm.cityCode = '';
}
// 转换为FormData
@@ -315,9 +315,9 @@ const onSubmit = () => {
} else {
// 过滤掉密码字段,或者后端接口决定是否更新密码
// 根据需求,修改时不能修改密码
- if (formData.has('password')) formData.delete('password');
+ if (formData.has('userPassword')) formData.delete('userPassword');
if (formData.has('confirmPassword')) formData.delete('confirmPassword');
- if (formData.has('tenantAccount')) formData.delete('tenantAccount');
+ if (formData.has('userName')) formData.delete('userName');
editTenant(formData).then(() => {
ElMessage.success('修改成功');
@@ -334,11 +334,11 @@ const resetForm = () => {
id: 0,
tenantName: '',
tenantType: '',
- contactPerson: '',
- phone: '',
- city: [],
- tenantAccount: '',
- password: '',
+ userNickname: '',
+ mobile: '',
+ cityMergerName: [],
+ userName: '',
+ userPassword: '',
confirmPassword: '',
businessLicense: '',
};
diff --git a/src/views/system/tenant/index.vue b/src/views/system/tenant/index.vue
index 5409688..fb622ab 100644
--- a/src/views/system/tenant/index.vue
+++ b/src/views/system/tenant/index.vue
@@ -68,6 +68,7 @@
style="width: 50px; height: 50px"
:src="scope.row.businessLicense"
:preview-src-list="[scope.row.businessLicense]"
+ preview-teleported
fit="cover"
v-if="scope.row.businessLicense"
/>
@@ -172,7 +173,13 @@ const tenantList = () => {
getTenantList(params)
.then((res: any) => {
- state.tableData.data = res.data.list ?? [];
+ const imgAddressPrefix = res.data.imgAddressPrefix || '';
+ const list = res.data.list ?? [];
+ // 拼接营业执照完整地址
+ state.tableData.data = list.map((item: any) => ({
+ ...item,
+ businessLicense: item.businessLicense ? imgAddressPrefix + item.businessLicense : '',
+ }));
state.tableData.total = res.data.total;
})
.catch(() => {