344 lines
17 KiB
HTML
344 lines
17 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>账号管理 - OA系统</title>
|
||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
||
<!-- 统一布局样式 -->
|
||
<link rel="stylesheet" href="unified-layout.css">
|
||
<style>
|
||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||
body {
|
||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
|
||
background: #f0f2f5;
|
||
overflow: hidden;
|
||
}
|
||
.layout-container {
|
||
height: 100vh;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
background: #409EFF; }
|
||
.main-container {
|
||
flex: 1;
|
||
display: flex;
|
||
overflow: hidden;
|
||
}
|
||
.app-main {
|
||
flex: 1;
|
||
overflow: hidden;
|
||
display: flex;
|
||
flex-direction: column;
|
||
background: #f0f2f5;
|
||
}
|
||
.sidebar {
|
||
width: 210px;
|
||
background: #fff;
|
||
border-right: 1px solid #e6e6e6;
|
||
overflow-y: auto;
|
||
}
|
||
.el-menu {
|
||
border-right: none;
|
||
}
|
||
.menu-item { padding: 12px 24px; cursor: pointer; }
|
||
.menu-item.active {
|
||
background: #409EFF;
|
||
color: #fff;
|
||
}
|
||
.content {
|
||
flex: 1;
|
||
padding: 20px;
|
||
overflow-y: auto;
|
||
background: #fff;
|
||
margin: 10px;
|
||
border-radius: 4px;
|
||
}
|
||
.page-header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; }
|
||
.page-title { font-size: 20px; font-weight: 500; }
|
||
.search-form { background: #fafafa; padding: 16px; border-radius: 4px; margin-bottom: 16px; }
|
||
.form-row { display: flex; gap: 16px; margin-bottom: 12px; }
|
||
.form-item { flex: 1; }
|
||
.form-input, .form-select { width: 100%; padding: 6px 12px; border: 1px solid #d9d9d9; border-radius: 4px; }
|
||
.btn { padding: 6px 16px; border: none; border-radius: 4px; cursor: pointer; }
|
||
.btn-primary { background: #409EFF; color: white; }
|
||
.btn-default { background: white; color: #333; border: 1px solid #d9d9d9; }
|
||
table { width: 100%; border-collapse: collapse; }
|
||
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #f0f0f0; }
|
||
th { background: #fafafa; font-weight: 500; }
|
||
.role-badge { padding: 2px 8px; border-radius: 4px; font-size: 12px; }
|
||
.role-manager { background: #fff7e6; color: #d46b08; }
|
||
.role-staff { background: #e6f7ff; color: #409EFF; }
|
||
.action-link { color: #409EFF; cursor: pointer; margin-right: 12px; }
|
||
</style>
|
||
<!-- Vue.js -->
|
||
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
|
||
<!-- Element UI JS -->
|
||
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||
<script src="common.js"></script>
|
||
</head>
|
||
<body>
|
||
<div id="app">
|
||
|
||
<div class="layout-container">
|
||
<div class="main-container">
|
||
<div class="sidebar">
|
||
<div class="menu-item" onclick="window.location.href='settings-org.html'">组织架构</div>
|
||
<div class="menu-item active">账号管理</div>
|
||
<div class="menu-item" onclick="window.location.href='settings-role.html'">权限配置</div>
|
||
<div class="menu-item" onclick="window.location.href='settings-workflow.html'">流程配置</div>
|
||
<div class="menu-item" onclick="window.location.href='settings-notice.html'">系统公告</div>
|
||
<div class="menu-item" onclick="window.location.href='settings-dict.html'">字典管理</div>
|
||
<div class="menu-item" onclick="window.location.href='settings-param.html'">参数配置</div>
|
||
<div class="menu-item" onclick="window.location.href='settings-log.html'">操作日志</div>
|
||
</div>
|
||
<div class="content">
|
||
<div class="page-header">
|
||
<div class="page-title">账号管理</div>
|
||
<div style="display: flex; gap: 8px;">
|
||
<button class="btn btn-default" onclick="importUsers()">📥 批量导入</button>
|
||
<button class="btn btn-primary" onclick="addUser()">+ 新增账号</button>
|
||
</div>
|
||
</div>
|
||
<div class="search-form">
|
||
<div class="form-row">
|
||
<div class="form-item">
|
||
<input type="text" class="form-input" placeholder="用户名/姓名">
|
||
</div>
|
||
<div class="form-item">
|
||
<select class="form-select">
|
||
<option>全部部门</option>
|
||
<option>经营管理部</option>
|
||
<option>财务部</option>
|
||
<option>行政部</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-item" style="display: flex; gap: 8px;">
|
||
<button class="btn btn-primary">查询</button>
|
||
<button class="btn btn-default">重置</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>用户名</th>
|
||
<th>姓名</th>
|
||
<th>部门</th>
|
||
<th>职位</th>
|
||
<th>角色</th>
|
||
<th>状态</th>
|
||
<th>操作</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>zhangsan</td>
|
||
<td>张三</td>
|
||
<td>经营管理部</td>
|
||
<td>部门负责人</td>
|
||
<td><span class="role-badge role-manager">部门负责人</span></td>
|
||
<td>启用</td>
|
||
<td>
|
||
<span class="action-link" onclick="editUser('1')">编辑</span>
|
||
<span class="action-link" onclick="resetPassword('1')">重置密码</span>
|
||
<span class="action-link" style="color: #ff4d4f;" onclick="deleteUser('1')">删除</span>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>lisi</td>
|
||
<td>李四</td>
|
||
<td>经营管理部</td>
|
||
<td>员工</td>
|
||
<td><span class="role-badge role-staff">员工</span></td>
|
||
<td>启用</td>
|
||
<td>
|
||
<span class="action-link" onclick="editUser('2')">编辑</span>
|
||
<span class="action-link" onclick="resetPassword('2')">重置密码</span>
|
||
<span class="action-link" style="color: #ff4d4f;" onclick="deleteUser('2')">删除</span>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
function importUsers() {
|
||
const content = `
|
||
<div style="margin-bottom: 16px;">
|
||
<div style="font-size: 14px; color: #606266; margin-bottom: 12px;">
|
||
<strong>导入说明:</strong><br>
|
||
1. 请先下载Excel模板<br>
|
||
2. 按照模板格式填写用户信息<br>
|
||
3. 上传填写好的Excel文件<br>
|
||
4. 系统将自动验证并导入数据
|
||
</div>
|
||
<div style="display: flex; gap: 8px; margin-bottom: 16px;">
|
||
<button class="btn btn-default" onclick="downloadUserTemplate()" style="padding: 8px 16px; border: 1px solid #dcdfe6; border-radius: 4px; background: white; color: #606266; cursor: pointer;">📥 下载模板</button>
|
||
</div>
|
||
<div>
|
||
<label style="display: block; margin-bottom: 8px; color: #606266; font-size: 14px;">
|
||
<span style="color: #ff4d4f;">*</span>选择Excel文件
|
||
</label>
|
||
<input type="file" id="importUserFile" accept=".xlsx,.xls" style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;">
|
||
<div style="font-size: 12px; color: #999; margin-top: 4px;">支持.xlsx和.xls格式,文件大小不超过10MB</div>
|
||
</div>
|
||
</div>
|
||
<div id="importUserPreview" style="display: none; margin-top: 16px;">
|
||
<div style="font-size: 14px; color: #606266; margin-bottom: 8px;"><strong>数据预览:</strong></div>
|
||
<div style="max-height: 200px; overflow-y: auto; border: 1px solid #e6e6e6; border-radius: 4px; padding: 8px; background: #fafafa; font-size: 12px;" id="previewUserContent"></div>
|
||
</div>
|
||
`;
|
||
|
||
CommonUtils.createModal('批量导入用户', content, () => {
|
||
const fileInput = document.getElementById('importUserFile');
|
||
const file = fileInput.files[0];
|
||
|
||
if (!file) {
|
||
CommonUtils.showMessage('请选择要导入的Excel文件', 'error');
|
||
return false;
|
||
}
|
||
|
||
if (file.size > 10 * 1024 * 1024) {
|
||
CommonUtils.showMessage('文件大小不能超过10MB', 'error');
|
||
return false;
|
||
}
|
||
|
||
// 模拟数据预览
|
||
const previewContent = document.getElementById('previewUserContent');
|
||
previewContent.innerHTML = `
|
||
预览数据(前5条):<br>
|
||
1. wangwu - 王五 - 财务部 - 员工<br>
|
||
2. zhaoliu - 赵六 - 行政部 - 员工<br>
|
||
3. sunqi - 孙七 - 经营管理部 - 员工<br>
|
||
4. zhouba - 周八 - 技术部 - 部门负责人<br>
|
||
5. wujiu - 吴九 - 财务部 - 员工<br>
|
||
<br>
|
||
<strong>共5条数据,全部验证通过</strong>
|
||
`;
|
||
document.getElementById('importUserPreview').style.display = 'block';
|
||
|
||
// 确认导入
|
||
CommonUtils.confirm('确认导入这5条用户数据?', () => {
|
||
CommonUtils.showMessage('导入成功!共导入5条用户数据', 'success');
|
||
setTimeout(() => {
|
||
window.location.reload();
|
||
}, 1500);
|
||
return true;
|
||
});
|
||
|
||
return false;
|
||
});
|
||
}
|
||
function downloadUserTemplate() {
|
||
CommonUtils.showMessage('正在下载模板...', 'info');
|
||
setTimeout(() => {
|
||
CommonUtils.showMessage('模板下载成功', 'success');
|
||
}, 500);
|
||
}
|
||
function addUser() {
|
||
const content = `
|
||
<form style="padding: 10px 0;">
|
||
<div style="margin-bottom: 16px;">
|
||
<label style="display: block; margin-bottom: 8px; color: #606266;">用户名 <span style="color: #f56c6c;">*</span></label>
|
||
<input type="text" id="new-user-username" class="form-input" required>
|
||
</div>
|
||
<div style="margin-bottom: 16px;">
|
||
<label style="display: block; margin-bottom: 8px; color: #606266;">姓名 <span style="color: #f56c6c;">*</span></label>
|
||
<input type="text" id="new-user-name" class="form-input" required>
|
||
</div>
|
||
<div style="margin-bottom: 16px;">
|
||
<label style="display: block; margin-bottom: 8px; color: #606266;">部门</label>
|
||
<select id="new-user-dept" class="form-select">
|
||
<option>经营管理部</option>
|
||
<option>财务部</option>
|
||
<option>行政部</option>
|
||
</select>
|
||
</div>
|
||
<div style="margin-bottom: 16px;">
|
||
<label style="display: block; margin-bottom: 8px; color: #606266;">角色</label>
|
||
<select id="new-user-role" class="form-select">
|
||
<option>员工</option>
|
||
<option>部门负责人</option>
|
||
<option>财务</option>
|
||
</select>
|
||
</div>
|
||
</form>
|
||
`;
|
||
CommonUtils.createModal('新增账号', content, () => {
|
||
const username = document.getElementById('new-user-username').value.trim();
|
||
const name = document.getElementById('new-user-name').value.trim();
|
||
if (!username || !name) {
|
||
CommonUtils.showMessage('请填写必填项', 'error');
|
||
return false;
|
||
}
|
||
CommonUtils.showMessage('账号已创建');
|
||
return true;
|
||
});
|
||
}
|
||
function editUser(id) {
|
||
const content = `
|
||
<form style="padding: 10px 0;">
|
||
<div style="margin-bottom: 16px;">
|
||
<label style="display: block; margin-bottom: 8px; color: #606266;">用户名 <span style="color: #f56c6c;">*</span></label>
|
||
<input type="text" id="user-username" class="form-input" value="zhangsan" required>
|
||
</div>
|
||
<div style="margin-bottom: 16px;">
|
||
<label style="display: block; margin-bottom: 8px; color: #606266;">姓名 <span style="color: #f56c6c;">*</span></label>
|
||
<input type="text" id="user-name" class="form-input" value="张三" required>
|
||
</div>
|
||
<div style="margin-bottom: 16px;">
|
||
<label style="display: block; margin-bottom: 8px; color: #606266;">部门</label>
|
||
<select id="user-dept" class="form-select">
|
||
<option>经营管理部</option>
|
||
<option>财务部</option>
|
||
<option>行政部</option>
|
||
</select>
|
||
</div>
|
||
<div style="margin-bottom: 16px;">
|
||
<label style="display: block; margin-bottom: 8px; color: #606266;">角色</label>
|
||
<select id="user-role" class="form-select">
|
||
<option>部门负责人</option>
|
||
<option>员工</option>
|
||
<option>财务</option>
|
||
</select>
|
||
</div>
|
||
</form>
|
||
`;
|
||
|
||
CommonUtils.createModal('编辑用户', content, () => {
|
||
const username = document.getElementById('user-username').value.trim();
|
||
const name = document.getElementById('user-name').value.trim();
|
||
if (!username || !name) {
|
||
CommonUtils.showMessage('请填写必填项', 'error');
|
||
return false;
|
||
}
|
||
CommonUtils.showMessage('用户信息已更新');
|
||
return true;
|
||
});
|
||
}
|
||
|
||
function resetPassword(id) {
|
||
CommonUtils.createModal('确认重置', '确认重置该用户密码为默认密码?', () => {
|
||
CommonUtils.showMessage('密码已重置为默认密码:123456');
|
||
return true;
|
||
});
|
||
}
|
||
|
||
function deleteUser(id) {
|
||
CommonUtils.createModal('确认删除', '确认删除该用户吗?删除后无法恢复。', () => {
|
||
CommonUtils.showMessage('用户已删除');
|
||
return true;
|
||
});
|
||
}
|
||
</script>
|
||
<script src="unified-layout.js"></script>
|
||
<script>
|
||
initUnifiedLayout('settings');
|
||
</script>
|
||
</div>
|
||
</body>
|
||
</html>
|
||
|