|
|
|
@ -5,23 +5,49 @@
|
|
|
|
|
<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="primary" icon="el-icon-search" @click="handleQuery()">搜索</el-button>
|
|
|
|
|
<el-button type="danger" @click="clearSearch()">清除参数</el-button>
|
|
|
|
|
<el-button type="primary" icon="el-icon-plus" @click="addDrugs()">新增</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<el-table :data="users" border class="table" header-cell-class-name="table-header">
|
|
|
|
|
<el-table :data="table1List" 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-column prop="drug1" label="药品A名称" align="center"></el-table-column>
|
|
|
|
|
<el-table-column prop="drug2" label="药品B名称" align="center"></el-table-column>
|
|
|
|
|
<el-table-column prop="reaction" label="相互作用效果" align="center"></el-table-column>
|
|
|
|
|
<el-table-column label="操作" width="180" align="center">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
|
|
|
|
|
<el-button type="text" icon="el-icon-delete" style="color: var(--orangeRed)" @click="handleDelete(scope.row)">
|
|
|
|
|
删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<el-dialog title="新增药品作用" :visible.sync="dialogVisible">
|
|
|
|
|
<el-form :model="formData" :rules="rules" ref="drugForm" label-width="100px" class="demo-ruleForm">
|
|
|
|
|
<el-form-item label="药品A名称" prop="drug1">
|
|
|
|
|
<el-input v-model="formData.drug1"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="药品B名称" prop="drug2">
|
|
|
|
|
<el-input v-model="formData.drug2"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="相互作用效果" prop="reaction">
|
|
|
|
|
<el-input v-model="formData.reaction"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitForm('drugForm')">提 交</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<div class="pagination">
|
|
|
|
|
<el-pagination
|
|
|
|
|
@size-change="handleSizeChange"
|
|
|
|
|
@current-change="handleCurrentChange"
|
|
|
|
|
:current-page="currentPage1"
|
|
|
|
|
:current-page="1"
|
|
|
|
|
:page-sizes="[10, 15, 20, 25]"
|
|
|
|
|
:page-size="10"
|
|
|
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
@ -30,32 +56,15 @@
|
|
|
|
|
</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>
|
|
|
|
|
|
|
|
|
|
import {addTable1, listTable1, listTotal} from "../../utils/table1";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
@ -73,6 +82,9 @@ export default {
|
|
|
|
|
userType: null
|
|
|
|
|
},
|
|
|
|
|
editVisible: false,
|
|
|
|
|
table1List: [
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
@ -81,6 +93,24 @@ export default {
|
|
|
|
|
drug2: null,
|
|
|
|
|
reaction: null
|
|
|
|
|
},
|
|
|
|
|
// 新增药品作用的数据
|
|
|
|
|
formData: {
|
|
|
|
|
drug1: "",
|
|
|
|
|
drug2: "",
|
|
|
|
|
reaction: ""
|
|
|
|
|
},
|
|
|
|
|
dialogVisible: false,
|
|
|
|
|
rules: {
|
|
|
|
|
drug1: [
|
|
|
|
|
{ required: true, message: "请输入药品A名称", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
drug2: [
|
|
|
|
|
{ required: true, message: "请输入药品B名称", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
reaction: [
|
|
|
|
|
{ required: true, message: "请输入相互作用效果", trigger: "blur" }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -89,129 +119,96 @@ export default {
|
|
|
|
|
watch: {},
|
|
|
|
|
|
|
|
|
|
created() {
|
|
|
|
|
this.getUsers();
|
|
|
|
|
// this.getUsers();
|
|
|
|
|
this.handleQuery();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
clearSearch() {
|
|
|
|
|
this.pagination = {
|
|
|
|
|
current: 1,
|
|
|
|
|
size: 10,
|
|
|
|
|
total: 0,
|
|
|
|
|
searchKey: "",
|
|
|
|
|
userStatus: null,
|
|
|
|
|
userType: null
|
|
|
|
|
}
|
|
|
|
|
this.getUsers();
|
|
|
|
|
// 新增药品操作
|
|
|
|
|
addDrugs(){
|
|
|
|
|
this.dialogVisible = true;
|
|
|
|
|
},
|
|
|
|
|
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"
|
|
|
|
|
});
|
|
|
|
|
/** 查询药品作用列表条数 */
|
|
|
|
|
getTotal() {
|
|
|
|
|
listTotal(this.queryParams).then(response => {
|
|
|
|
|
this.pagination.total = parseInt(response);
|
|
|
|
|
console.log(this.pagination.total);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
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"
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
handleSizeChange(val) {
|
|
|
|
|
this.queryParams.pageSize = val; // 修改每页显示数量
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
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: '已取消保存!'
|
|
|
|
|
});
|
|
|
|
|
handleCurrentChange(val) {
|
|
|
|
|
this.queryParams.pageNum = val; // 修改每页显示数量
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.queryParams.pageNum = 1;
|
|
|
|
|
this.getList();
|
|
|
|
|
this.getTotal();
|
|
|
|
|
},
|
|
|
|
|
/** 查询药品作用管理列表 */
|
|
|
|
|
getList() {
|
|
|
|
|
// this.loading = true;
|
|
|
|
|
this.table1List = []; // 初始化为空数组
|
|
|
|
|
listTable1(this.queryParams).then(response => {
|
|
|
|
|
this.table1List = response;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
editUser(user) {
|
|
|
|
|
this.changeUser.id = user.id;
|
|
|
|
|
this.changeUser.userType = user.userType;
|
|
|
|
|
this.editVisible = true;
|
|
|
|
|
clearSearch() {
|
|
|
|
|
this.queryParams = {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
drug1: null,
|
|
|
|
|
drug2: null,
|
|
|
|
|
reaction: null
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
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();
|
|
|
|
|
// 提交新增药品作用表单
|
|
|
|
|
submitForm(formName) {
|
|
|
|
|
this.$refs[formName].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
addTable1(this.formData).then(() => {
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
this.getTotal();
|
|
|
|
|
this.$message({
|
|
|
|
|
message: "修改成功!",
|
|
|
|
|
message: "新增成功",
|
|
|
|
|
type: "success"
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: error.message,
|
|
|
|
|
type: "error"
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
this.$message.error(error);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 编辑药品作用
|
|
|
|
|
handleEdit(row) {
|
|
|
|
|
this.changeUser.id = row.id;
|
|
|
|
|
this.changeUser.userType = row.userType;
|
|
|
|
|
this.editVisible = true;
|
|
|
|
|
},
|
|
|
|
|
// 删除药品作用
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
this.confirm("此操作将永久删除该药品作用, 是否继续?", "提示", {
|
|
|
|
|
confirmButtonText: "确定",
|
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
|
type: "warning"
|
|
|
|
|
}).then(() => {
|
|
|
|
|
// TODO:调用删除接口
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|