This commit is contained in:
饶秋霖 2024-12-01 21:37:47 +08:00
parent 1ccf172e44
commit 83523284c4
4 changed files with 327 additions and 115 deletions

44
api/system/login.js Normal file
View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询登录列表
export function listLogin(query) {
return request({
url: '/system/login/list',
method: 'get',
params: query
})
}
// 查询登录详细
export function getLogin(id) {
return request({
url: '/system/login/' + id,
method: 'get'
})
}
// 新增登录
export function addLogin(data) {
return request({
url: '/system/login',
method: 'post',
data: data
})
}
// 修改登录
export function updateLogin(data) {
return request({
url: '/system/login',
method: 'put',
data: data
})
}
// 删除登录
export function delLogin(id) {
return request({
url: '/system/login/' + id,
method: 'delete'
})
}

283
views/login/index.vue Normal file
View File

@ -0,0 +1,283 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入姓名"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="昵称" prop="nickname">
<el-input
v-model="queryParams.nickname"
placeholder="请输入昵称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input
v-model="queryParams.email"
placeholder="请输入邮箱"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="手机" prop="phonenumber">
<el-input
v-model="queryParams.phonenumber"
placeholder="请输入手机"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input
v-model="queryParams.password"
placeholder="请输入密码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['system:login:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:login:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:login:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['system:login:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="loginList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="昵称" align="center" prop="nickname" />
<el-table-column label="邮箱" align="center" prop="email" />
<el-table-column label="手机" align="center" prop="phonenumber" />
<el-table-column label="密码" align="center" prop="password" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:login:edit']">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:login:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改登录对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="loginRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="昵称" prop="nickname">
<el-input v-model="form.nickname" placeholder="请输入昵称" />
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" />
</el-form-item>
<el-form-item label="手机" prop="phonenumber">
<el-input v-model="form.phonenumber" placeholder="请输入手机" />
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="form.password" placeholder="请输入密码" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Login">
import { listLogin, getLogin, delLogin, addLogin, updateLogin } from "@/api/system/login";
const { proxy } = getCurrentInstance();
const loginList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
nickname: null,
email: null,
phonenumber: null,
password: null
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询登录列表 */
function getList() {
loading.value = true;
listLogin(queryParams.value).then(response => {
loginList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
id: null,
name: null,
nickname: null,
email: null,
phonenumber: null,
password: null
};
proxy.resetForm("loginRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加登录";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getLogin(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改登录";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["loginRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateLogin(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addLogin(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除登录编号为"' + _ids + '"的数据项?').then(function() {
return delLogin(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('system/login/export', {
...queryParams.value
}, `login_${new Date().getTime()}.xlsx`)
}
getList();
</script>

View File

@ -1,67 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Medical Information</title>
<!-- 引入Element Plus CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css">
<!-- 引入Vue 3 -->
<script src="https://unpkg.com/vue@3"></script>
<!-- 引入Element Plus JS -->
<script src="https://unpkg.com/element-plus"></script>
</head>
<body>
<div id="app">
<el-card class="box-card">
<el-row>
<el-col :span="12">
<el-form :model="form">
<el-form-item label="药品">
<el-input v-model="form.medicine"></el-input>
</el-form-item>
<el-form-item label="价格">
<el-input v-model="form.price"></el-input>
</el-form-item>
<el-form-item label="患者">
<el-input v-model="form.patient"></el-input>
</el-form-item>
</el-form>
</el-col>
<el-col :span="12">
<el-form :model="form">
<el-form-item label="主治医师">
<el-input v-model="form.doctor"></el-input>
</el-form-item>
<el-form-item label="日期">
<el-date-picker v-model="form.date" type="date" placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-form>
</el-col>
</el-row>
</el-card>
</div>
<script>
const { createApp } = Vue;
const app = createApp({
data() {
return {
form: {
medicine: '',
price: '',
patient: '',
doctor: '',
date: ''
}
};
}
});
app.use(ElementPlus);
app.mount('#app');
</script>
</body>
</html>

View File

@ -1,48 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Information</title>
<link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css">
<script src="https://unpkg.com/vue@3"></script>
<script src="https://unpkg.com/element-plus"></script>
</head>
<body>
<div id="app">
<el-card class="user-info-card">
<el-form :model="userForm">
<el-form-item label="ID">
<el-input v-model="userForm.id"></el-input>
</el-form-item>
<el-form-item label="账户">
<el-input v-model="userForm.account"></el-input>
</el-form-item>
<el-form-item label="昵称">
<el-input v-model="userForm.nickname"></el-input>
</el-form-item>
</el-form>
</el-card>
</div>
<script>
const { createApp } = Vue;
const app = createApp({
data() {
return {
userForm: {
id: '',
account: '',
nickname: ''
}
};
}
});
app.use(ElementPlus);
app.mount('#app');
</script>
</body>
</html>