| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="idSerial" label="证件号码"></el-table-column> |
| | | <el-table-column label="操作" width="100"> |
| | | <el-table-column label="操作" width="150"> |
| | | <template #default="scope"> |
| | | <el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onOpenUserDialog('修改', scope.row)">修改</el-button> |
| | | <el-button style="color: red" :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onRowDel(scope.row)">删除</el-button> |
| | | <el-button v-if="isAdmin" size="small" text type="primary" @click="updatePwd(scope.row)">重置密码</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <br /> |
| | | </el-card> |
| | | <userDialog ref="userRef" @getUserList="initUserTableData"/> |
| | | <update-pwd ref="pwdRef"></update-pwd> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { userApi } from '/@/api/systemManage/user'; |
| | | import { departmentApi } from '/@/api/systemManage/department'; |
| | | import { useRoleApi } from '/@/api/systemManage/role'; |
| | | import updatePwd from '/@/components/updatePwd/index.vue' |
| | | import Cookies from 'js-cookie'; |
| | | |
| | | // 定义接口来定义对象的类型 |
| | | interface TableDataRow { |
| | |
| | | |
| | | export default defineComponent({ |
| | | name: 'systemUser', |
| | | components: { userDialog }, |
| | | components: { userDialog, updatePwd }, |
| | | setup() { |
| | | const userRef = ref(); |
| | | const pwdRef = ref(); |
| | | const isAdmin = ref(false); |
| | | const state = reactive<TableDataState>({ |
| | | userTableData: { |
| | | data: [], |
| | |
| | | state.userTableData.listQuery.pageIndex = val; |
| | | initUserTableData(); |
| | | }; |
| | | let roles = []; |
| | | // 页面加载时 |
| | | onMounted(() => { |
| | | initUserTableData(); |
| | |
| | | getRoleData(); |
| | | // getExpertsData(); |
| | | getDepList() |
| | | roles = JSON.parse(Cookies.get('roles')) |
| | | roles.forEach((item:any) => { |
| | | if(item.roleId && item.roleName == '超级管理员'){ |
| | | isAdmin.value = true |
| | | } |
| | | }) |
| | | }); |
| | | const updatePwd = (val: any) => { |
| | | pwdRef.value.openDialog('',val.id); |
| | | } |
| | | return { |
| | | userRef, |
| | | reset, |
| | | onOpenUserDialog, |
| | | onRowDel, |
| | | pwdRef, |
| | | onHandleSizeChange, |
| | | initUserTableData, |
| | | searchByName, |
| | | updatePwd, |
| | | onHandleCurrentChange, |
| | | isAdmin, |
| | | ...toRefs(state) |
| | | }; |
| | | } |