提交代码

This commit is contained in:
遥望-倪浩天 2024-09-25 17:43:38 +08:00
parent 0bc67c300f
commit c550e8bb49
3 changed files with 106 additions and 1 deletions

View File

@ -119,3 +119,14 @@ export const updatePasswordByOldPassword = (account,oldPassword,newPassword,tena
} }
}); });
} }
//根据用户名与租户Id验证密码是否正确
export const getUserById = (id) => {
return request({
url: '/api/' + moduleName + '/ui/administrator/getUserById',
method: 'get',
params: {
id,
}
});
}

View File

@ -0,0 +1,75 @@
<template>
<el-dialog title="User Info" v-model="state.isShowDialog" width="35%" center>
<el-form :model="state.ruleForm" size="default" label-width="90px" :rules="rules" ref="adminAddFormRef">
<el-form-item label="name" >
<el-input v-model="state.ruleForm.name" clearable disabled></el-input>
</el-form-item>
<el-form-item label="email" >
<el-input v-model="state.ruleForm.email" clearable disabled></el-input>
</el-form-item>
<el-form-item label="account" >
<el-input v-model="state.ruleForm.account" clearable disabled></el-input>
</el-form-item>
<el-form-item label="occupation" >
<el-input v-model="state.ruleForm.occupation" clearable disabled></el-input>
</el-form-item>
<el-form-item label="country" >
<el-input v-model="state.ruleForm.country" clearable disabled></el-input>
</el-form-item>
<el-form-item label="phone" >
<el-input v-model="state.ruleForm.phone" clearable disabled></el-input>
</el-form-item>
<el-form-item label="organization" >
<el-input v-model="state.ruleForm.organization" clearable disabled></el-input>
</el-form-item>
<el-form-item label="role" >
<el-tag type="info" v-if="state.ruleForm.roleId == '1123598816738675203'">Admin</el-tag>
<el-tag type="info" v-if="state.ruleForm.roleId == '1793193529859244033'">Chief admin</el-tag>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script setup>
import {reactive, ref} from "vue";
import {getUserById, updateAdmin} from '/@/api/response/administrator.js';
import {ElMessage} from "element-plus";
import { getList } from '/@/api/system/role';
const adminAddFormRef = ref();
const emit = defineEmits(['callback']);
const state = reactive({
isShowDialog: false,
isLoading:false,
ruleForm: {
},
})
//
const resetField = () => {
adminAddFormRef.value.resetFields();
}
//
const openDialog = (row) => {
state.isShowDialog = true;
getUserById(row.id).then(res => {
state.ruleForm = res
});
};
//
const closeDialog = () => {
state.isShowDialog = false;
//
state.ruleForm.tableData = [];
resetField();
};
//
defineExpose({
openDialog,
});
</script>
<style scoped>
</style>

View File

@ -7,6 +7,12 @@
<!-- <el-table-column type="selection" width="60" @select="selectRow" />--> <!-- <el-table-column type="selection" width="60" @select="selectRow" />-->
<el-table-column prop="userName" label="Name" show-overflow-tooltip></el-table-column> <el-table-column prop="userName" label="Name" show-overflow-tooltip></el-table-column>
<!-- <el-table-column prop="userEmail" label="E-mail" show-overflow-tooltip></el-table-column>--> <!-- <el-table-column prop="userEmail" label="E-mail" show-overflow-tooltip></el-table-column>-->
<el-table-column fixed="right" label="particulars" min-width="120">
<template #default="scope">
<el-tag type="info" ref="selectUserDetails" @click="getSelectUserDetails(scope.row)">
<el-icon><ele-Tickets /></el-icon></el-tag>
</template>
</el-table-column>
<el-table-column prop="userStatus" label="role" show-overflow-tooltip> <el-table-column prop="userStatus" label="role" show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
<el-tag type="info" v-if="scope.row.userStatus == 1">Admin</el-tag> <el-tag type="info" v-if="scope.row.userStatus == 1">Admin</el-tag>
@ -85,7 +91,12 @@
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%" @selection-change="selectionChange"> <el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%" @selection-change="selectionChange">
<!-- <el-table-column type="selection" width="60" @select="selectRow" />--> <!-- <el-table-column type="selection" width="60" @select="selectRow" />-->
<el-table-column prop="name" label="Name" show-overflow-tooltip></el-table-column> <el-table-column prop="name" label="Name" show-overflow-tooltip></el-table-column>
<!-- <el-table-column prop="email" label="E-mail" show-overflow-tooltip></el-table-column>--> <el-table-column fixed="right" label="particulars" min-width="120">
<template #default="scope">
<el-tag type="info" ref="selectUserDetails" @click="getSelectUserDetails(scope.row)">
<el-icon><ele-Tickets /></el-icon></el-tag>
</template>
</el-table-column>
<el-table-column prop="userStatus" label="role" show-overflow-tooltip> <el-table-column prop="userStatus" label="role" show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
<el-tag type="info" v-if="scope.row.roleId == '1123598816738675203'">Admin</el-tag> <el-tag type="info" v-if="scope.row.roleId == '1123598816738675203'">Admin</el-tag>
@ -129,6 +140,7 @@
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
<SelectUserDetails ref="selectUserDetailsRef" @callback="getTableData"/>
</div> </div>
</template> </template>
@ -139,10 +151,12 @@ import { getAdminPage } from '/@/api/response/administrator.js';
import { ref, reactive, onMounted } from 'vue'; import { ref, reactive, onMounted } from 'vue';
import { useThemeConfig } from '/@/stores/themeConfig'; import { useThemeConfig } from '/@/stores/themeConfig';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import SelectUserDetails from './selectUserDetails.vue';
const storesThemeConfig = useThemeConfig(); const storesThemeConfig = useThemeConfig();
const { website } = storeToRefs(storesThemeConfig); const { website } = storeToRefs(storesThemeConfig);
const formRef = ref(); const formRef = ref();
const selectUserDetailsRef = ref();
const dataIndex=[]; const dataIndex=[];
let chiefCount=0 let chiefCount=0
let adminCount=0 let adminCount=0
@ -190,6 +204,10 @@ const state = reactive({
selectType: [] selectType: []
}); });
const getSelectUserDetails = (row) => {
selectUserDetailsRef.value.openDialog(row);
}
const sendToLeft = (index,row) => { const sendToLeft = (index,row) => {
if (row.roleId == '1793193529859244033') { if (row.roleId == '1793193529859244033') {
chiefCount=chiefCount-1 chiefCount=chiefCount-1
@ -453,6 +471,7 @@ const getTableDataNew = () => {
state.tableDataNew.data = da.records; state.tableDataNew.data = da.records;
state.tableDataNew.data.forEach((item) => { state.tableDataNew.data.forEach((item) => {
item.userId = item.adminId; item.userId = item.adminId;
item.id = item.adminId;
item.name = item.userName; item.name = item.userName;
item.email = item.userEmail; item.email = item.userEmail;
item.roleId = item.userStatus==0?'1793193529859244033':'1123598816738675203'; item.roleId = item.userStatus==0?'1793193529859244033':'1123598816738675203';