开始做管理药品的后台功能2

master
ynmlzdwsp 11 months ago
parent 17ff7b6175
commit 7a3be7c18f

@ -24,6 +24,8 @@
</svg> </svg>
<span>&nbsp;首页</span> <span>&nbsp;首页</span>
</div> </div>
<!--头像-->
<div class="header-user-con"> <div class="header-user-con">
<el-dropdown placement="bottom"> <el-dropdown placement="bottom">
<el-avatar class="user-avatar" :size="40" <el-avatar class="user-avatar" :size="40"
@ -34,6 +36,7 @@
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
</div> </div>
</div> </div>
</template> </template>

@ -29,6 +29,7 @@
</template> </template>
</el-submenu> </el-submenu>
</template> </template>
<template v-else> <template v-else>
<el-menu-item :index="item.index" :key="item.index"> <el-menu-item :index="item.index" :key="item.index">
<i :class="item.icon"></i> <i :class="item.icon"></i>
@ -61,6 +62,11 @@
index: "/userList", index: "/userList",
title: "用户管理", title: "用户管理",
isBoss: true isBoss: true
}, {
icon: "el-icon-refrigerator",
index: "/drugReaction",
title: "药品管理",
isBoss: false
}, { }, {
icon: "el-icon-postcard", icon: "el-icon-postcard",
index: "/postList", index: "/postList",

@ -0,0 +1,260 @@
<template>
<div>
<div>
<div class="handle-box">
<el-input v-model="queryParams.drug1" placeholder="药品A名称" class="handle-input mrb10"></el-input>
<el-input v-model="queryParams.drug2" placeholder="药品B名称" class="handle-input mrb10"></el-input>
<el-input v-model="queryParams.reaction" placeholder="相互作用效果" class="handle-input mrb10"></el-input>
<el-button type="primary" icon="el-icon-search" @click="searchUser()"></el-button>
<el-button type="danger" @click="clearSearch()"></el-button>
</div>
<el-table :data="users" border class="table" header-cell-class-name="table-header">
<el-table-column prop="id" label="ID" width="55" align="center"></el-table-column>
<el-table-column prop="username" label="药品A名称" align="center"></el-table-column>
<el-table-column prop="phoneNumber" label="药品B名称" align="center"></el-table-column>
<el-table-column prop="email" label="相互作用效果" align="center"></el-table-column>
<el-table-column prop="introduction" label="简介" align="center"></el-table-column>
<el-table-column prop="createTime" label="注册时间" align="center"></el-table-column>
</el-table>
<div class="pagination">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage1"
:page-sizes="[10, 15, 20, 25]"
:page-size="10"
layout="total, sizes, prev, pager, next, jumper"
:total=this.pagination.total>
</el-pagination>
</div>
</div>
<!-- 编辑弹出框 -->
<el-dialog title="修改用户类型"
:visible.sync="editVisible"
width="30%"
:before-close="handleClose"
:append-to-body="true"
destroy-on-close
center>
<div class="myCenter">
<el-radio-group v-model="changeUser.userType">
<el-radio-button :label="0">Boss</el-radio-button>
<el-radio-button :label="1">管理员</el-radio-button>
<el-radio-button :label="2">普通用户</el-radio-button>
</el-radio-group>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose()"> </el-button>
<el-button type="primary" @click="saveEdit()"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
pagination: {
current: 1,
size: 10,
total: 0,
searchKey: "",
userStatus: null,
userType: null
},
users: [],
changeUser: {
id: null,
userType: null
},
editVisible: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
drug1: null,
drug2: null,
reaction: null
},
}
},
computed: {},
watch: {},
created() {
this.getUsers();
},
mounted() {
},
methods: {
clearSearch() {
this.pagination = {
current: 1,
size: 10,
total: 0,
searchKey: "",
userStatus: null,
userType: null
}
this.getUsers();
},
getUsers() {
this.$http.post(this.$constant.baseURL + "/admin/user/list", this.pagination, true)
.then((res) => {
if (!this.$common.isEmpty(res.data)) {
this.users = res.data.records;
this.pagination.total = res.data.total;
}
})
.catch((error) => {
this.$message({
message: error.message,
type: "error"
});
});
},
changeUserStatus(user) {
this.$http.get(this.$constant.baseURL + "/admin/user/changeUserStatus", {
userId: user.id,
flag: user.userStatus
}, true)
.then((res) => {
this.$message({
message: "修改成功!",
type: "success"
});
})
.catch((error) => {
this.$message({
message: error.message,
type: "error"
});
});
},
changeUserAdmire(user) {
if (!this.$common.isEmpty(user.admire)) {
this.$confirm('确认保存?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'success',
center: true
}).then(() => {
this.$http.get(this.$constant.baseURL + "/admin/user/changeUserAdmire", {
userId: user.id,
admire: user.admire
}, true)
.then((res) => {
this.$message({
message: "修改成功!",
type: "success"
});
})
.catch((error) => {
this.$message({
message: error.message,
type: "error"
});
});
}).catch(() => {
this.$message({
type: 'success',
message: '已取消保存!'
});
});
}
},
editUser(user) {
this.changeUser.id = user.id;
this.changeUser.userType = user.userType;
this.editVisible = true;
},
handlePageChange(val) {
this.pagination.current = val;
this.getUsers();
},
searchUser() {
this.pagination.total = 0;
this.pagination.current = 1;
this.getUsers();
},
handleClose() {
this.changeUser = {
id: null,
userType: null
};
this.editVisible = false;
},
saveEdit() {
this.$http.get(this.$constant.baseURL + "/admin/user/changeUserType", {
userId: this.changeUser.id,
userType: this.changeUser.userType
}, true)
.then((res) => {
this.handleClose();
this.getUsers();
this.$message({
message: "修改成功!",
type: "success"
});
})
.catch((error) => {
this.$message({
message: error.message,
type: "error"
});
});
}
}
}
</script>
<style scoped>
.handle-box {
margin-bottom: 20px;
}
.handle-select {
width: 120px;
}
.handle-input {
width: 160px;
display: inline-block;
}
.table {
width: 100%;
font-size: 14px;
}
.mrb10 {
margin-right: 10px;
margin-bottom: 10px;
}
.table-td-thumb {
display: block;
margin: auto;
width: 40px;
height: 40px;
}
.pagination {
margin: 20px 0;
text-align: right;
}
.el-switch {
margin: 5px;
}
</style>

@ -111,7 +111,7 @@
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="currentPage1" :current-page="currentPage1"
:page-sizes="[10, 15, 20, 15]" :page-sizes="[10, 15, 20, 25]"
:page-size="10" :page-size="10"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total=this.pagination.total> :total=this.pagination.total>

@ -131,7 +131,7 @@
<el-avatar <el-avatar
style="margin-bottom: 10px" style="margin-bottom: 10px"
:size="36" :size="36"
:src="!$common.isEmpty($store.state.currentUser)?$store.state.currentUser.avatar:$store.state.webInfo.avatar"> :src="item.avatar ">
</el-avatar> </el-avatar>
<div style="margin-left: 10px;height: 36px;line-height: 36px;overflow: hidden;max-width: 80px"> <div style="margin-left: 10px;height: 36px;line-height: 36px;overflow: hidden;max-width: 80px">
{{ item.username }} {{ item.username }}

@ -123,7 +123,13 @@ const routes = [
path: '/resourcePathList', path: '/resourcePathList',
name: 'resourcePathList', name: 'resourcePathList',
component: () => import('../components/admin/resourcePathList') component: () => import('../components/admin/resourcePathList')
}] },
, {
path: '/drugReaction',
name: 'drugReaction',
component: () => import('../components/admin/drugReaction')
}
]
}, },
{ {
path: '/verify', path: '/verify',

Loading…
Cancel
Save