|
|
@@ -1,290 +1,295 @@
|
|
|
<style lang="scss">
|
|
|
-
|
|
|
- </style>
|
|
|
- <template>
|
|
|
- <section class="content">
|
|
|
- <div class="breadcrumb">
|
|
|
- <el-breadcrumb separator="/">
|
|
|
- <el-breadcrumb-item><a href="/">系统管理</a></el-breadcrumb-item>
|
|
|
- <el-breadcrumb-item>用户管理</el-breadcrumb-item>
|
|
|
- </el-breadcrumb>
|
|
|
- </div>
|
|
|
- <el-form :model="queryParams" label-width="80px" class="filter-form" :inine="true">
|
|
|
- <el-row>
|
|
|
- <el-col :span="4">
|
|
|
- <el-form-item label="学校">
|
|
|
- <el-select size="mini" v-model="queryParams.school_id">
|
|
|
- <el-option label="人大附中" value="人大附中">人大附中</el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="4">
|
|
|
- <el-form-item label="年级" v-model="queryParams.grade_id">
|
|
|
- <el-select size="mini">
|
|
|
- <el-option label="高三一班" value="高三一班">高三一班</el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label-width="10" style="margin-left: 10px">
|
|
|
- <el-button type="primary" @click="getData" size="mini"
|
|
|
- >筛选</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- icon="el-icon-plus"
|
|
|
- size="mini"
|
|
|
- @click="handleAdd"
|
|
|
- >新增</el-button
|
|
|
- >
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
- <el-table
|
|
|
- v-loading="loading"
|
|
|
- :data="list"
|
|
|
- style="width: 100%; margin-top: 10px"
|
|
|
- height="50vh"
|
|
|
- >
|
|
|
- <el-table-column align="center" prop="name" label="班级" />
|
|
|
- <el-table-column align="center" prop="phone" label="年级" />
|
|
|
- <el-table-column label="教师">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-link type="primary">查看</el-link>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="学生">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-link type="primary">查看</el-link>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" prop="ctime" label="创建时间" />
|
|
|
- <el-table-column align="center" prop="date" label="操作" width="320">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button @click="edit(scope.row.id)" size="mini" type="warning"
|
|
|
- >编辑</el-button
|
|
|
- >
|
|
|
- <el-button @click="del(scope.row.id)" size="mini" type="danger"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <Page
|
|
|
- ref="pageButton"
|
|
|
- :current="form.page"
|
|
|
- :page_size="form.page_size"
|
|
|
- :total="total"
|
|
|
- @pageChange="gopage"
|
|
|
- />
|
|
|
- <!-- 新增医生 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="医生类型" prop="role">
|
|
|
- <el-select
|
|
|
- v-model="form.role"
|
|
|
- placeholder="请选择医生类型"
|
|
|
- filterable
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in $const.doctorRoleList"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
+ .area{
|
|
|
+ .el-select{
|
|
|
+ width: 120px;
|
|
|
+ display: inline-block;
|
|
|
+ margin-right: 6px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|
|
|
+<template>
|
|
|
+ <section class="content">
|
|
|
+ <div class="breadcrumb">
|
|
|
+ <el-breadcrumb separator="/">
|
|
|
+ <el-breadcrumb-item><a href="/">系统管理</a></el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item>用户管理</el-breadcrumb-item>
|
|
|
+ </el-breadcrumb>
|
|
|
+ </div>
|
|
|
+ <el-form :model="queryParams" size="mini" label-width="80px" class="filter-form" :inine="true">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item label="用户名">
|
|
|
+ <el-input clearable placeholder="请输入名称" v-model="queryParams.name"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="带教医生" prop="parent_id" v-if="form.role == 3">
|
|
|
- <el-select
|
|
|
- v-model="form.parent_id"
|
|
|
- placeholder="请输入医生姓名"
|
|
|
- clearable
|
|
|
- filterable
|
|
|
- size="mini"
|
|
|
+ </el-col><el-col :span="11">
|
|
|
+ <el-form-item label-width="10" style="margin-left: 10px">
|
|
|
+ <el-button type="primary" @click="getData" size="mini"
|
|
|
+ >搜索</el-button
|
|
|
>
|
|
|
- <el-option
|
|
|
- v-for="item in doctorList"
|
|
|
- :key="item.value"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="名称" prop="name">
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- v-model="form.name"
|
|
|
- placeholder="请输入名称"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="手机号" prop="phone">
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- v-model="form.phone"
|
|
|
- placeholder="请输入手机号"
|
|
|
- ></el-input>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ >添加用户</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ @click="del(-1)"
|
|
|
+ >批量删除</el-button>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="医院" prop="hospital_name">
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- v-model="form.hospital_name"
|
|
|
- placeholder="请输入医院"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- <!-- <el-form-item label="图片" prop>
|
|
|
- <el-upload
|
|
|
- class="avatar-uploader"
|
|
|
- action="/api/admin/uploadfile"
|
|
|
- :data="{watermark:0}"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="handleAvatarSuccess"
|
|
|
- :before-upload="beforeAvatarUpload"
|
|
|
- >
|
|
|
- <img v-if="form.img" :src="form.img" class="avatar" />
|
|
|
- <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
- </el-upload>
|
|
|
- </el-form-item> -->
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
- <el-button @click="open = false">取 消</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
- </section>
|
|
|
- </template>
|
|
|
- <script>
|
|
|
- import Page from "../../components/Page";
|
|
|
- export default {
|
|
|
- components: {
|
|
|
- Page,
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- loading: false,
|
|
|
- queryParams: {
|
|
|
- page: 1,
|
|
|
- },
|
|
|
- form: {},
|
|
|
- form1: {},
|
|
|
- form2: {},
|
|
|
- list: [{}, {}],
|
|
|
- total: 0,
|
|
|
- title: "新增用户",
|
|
|
- open: false,
|
|
|
- doctorList: [],
|
|
|
- rules: {},
|
|
|
- };
|
|
|
- },
|
|
|
- methods: {
|
|
|
- del(id) {
|
|
|
- this.$confirm("确认删除?", "提示", {
|
|
|
- type: "warning",
|
|
|
- }).then(() => {
|
|
|
- this.$api
|
|
|
- .delDoctorInfo({
|
|
|
- id: id,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (!res.data.code) {
|
|
|
- this.$msgSuccess("删除成功");
|
|
|
- this.getData();
|
|
|
- } else {
|
|
|
- this.$msgError(res.data.message);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- gopage(size) {
|
|
|
- if (size) {
|
|
|
- this.queryParams.page_size = size;
|
|
|
- }
|
|
|
- this.queryParams.page = this.$refs.pageButton.page;
|
|
|
- this.getData();
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="list"
|
|
|
+ style="width: 100%; margin-top: 10px"
|
|
|
+ height="55vh"
|
|
|
+ @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55"></el-table-column>
|
|
|
+ <el-table-column prop="name" label="用户名" />
|
|
|
+ <el-table-column label="姓名" prop="realname"></el-table-column>
|
|
|
+ <el-table-column prop="role_id" label="角色" />
|
|
|
+ <el-table-column prop="school_id" label="学校" />
|
|
|
+ <el-table-column prop="phone" label="联系方式" />
|
|
|
+
|
|
|
+ <el-table-column align="center" prop="ctime" label="创建时间" />
|
|
|
+ <el-table-column align="center" prop="date" label="操作" width="320">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button @click="edit(scope.row)" size="mini" type="info" plain
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button @click="del(scope.row.id)" size="mini" type="info" plain
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <Page
|
|
|
+ ref="pageButton"
|
|
|
+ :current="form.page"
|
|
|
+ :page_size="form.page_size"
|
|
|
+ :total="total"
|
|
|
+ @pageChange="gopage"
|
|
|
+ />
|
|
|
+ <!-- 新增班级-->
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form-item label="账号" prop="name">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="form.name"
|
|
|
+ placeholder="请输入账号"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="姓名" prop="realname">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="form.realname"
|
|
|
+ placeholder="请输入姓名"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="密码" prop="password">
|
|
|
+ <el-input
|
|
|
+ clearable type="password"
|
|
|
+ v-model="form.password"
|
|
|
+ placeholder="请输入密码"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="确认密码" prop="re_password">
|
|
|
+ <el-input
|
|
|
+ clearable type="password"
|
|
|
+ v-model="form.re_password"
|
|
|
+ placeholder="请确认密码"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="联系方式" prop="phone">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="form.phone"
|
|
|
+ placeholder="请输入联系方式"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="学校账号" prop="is_active">
|
|
|
+ <el-switch
|
|
|
+ v-model="form.is_active">
|
|
|
+ </el-switch>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="学校" prop="school_id">
|
|
|
+ <el-select
|
|
|
+ v-model="form.school_id"
|
|
|
+ placeholder="请选择学校"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in schoolList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="角色" prop='role_id'>
|
|
|
+ <el-select
|
|
|
+ v-model="form.role_id"
|
|
|
+ placeholder="请选择"
|
|
|
+ clearable
|
|
|
+ filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="item in roleList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm">保存</el-button>
|
|
|
+ <el-button @click="open = false">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </section>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import Page from "../../components/Page";
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ Page,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ queryParams: {
|
|
|
+ page: 1,
|
|
|
},
|
|
|
- getData() {
|
|
|
- this.loading = true;
|
|
|
- this.$api.getDoctorsList(this.queryParams).then((res) => {
|
|
|
- this.list = res.data.data.list;
|
|
|
- this.total = res.data.data.total;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
-
|
|
|
+ form: {},
|
|
|
+ form1: {},
|
|
|
+ form2: {},
|
|
|
+ list: [{}, {}],
|
|
|
+ total: 0,
|
|
|
+ title: "新增学校",
|
|
|
+ open: false,
|
|
|
+ schoolList: [],
|
|
|
+ roleList:[],
|
|
|
+ rules: {},
|
|
|
+ ids:''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ const ids=[]
|
|
|
+ val.forEach(item=>{
|
|
|
+ ids.push(item.id)
|
|
|
+ })
|
|
|
+ this.ids=ids.join(',')
|
|
|
+ },
|
|
|
+ del(id) {
|
|
|
+ if(id == -1){
|
|
|
+ if(this.ids){
|
|
|
+ id=this.ids
|
|
|
+ }else{
|
|
|
+ this.msgInfo('请选择删除的数据');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$confirm("确认删除?", "提示", {
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
this.$api
|
|
|
- .getDoctorsSearchList({
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- this.doctorList = res.data.data;
|
|
|
- this.$set(this.doctorList, res.data.data);
|
|
|
- // this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
- handleAdd() {
|
|
|
- this.open = true;
|
|
|
- this.title = "新增医生";
|
|
|
- this.form = {};
|
|
|
- },
|
|
|
- edit(id) {
|
|
|
- this.title = "编辑医生";
|
|
|
- this.$api
|
|
|
- .getDoctorInfo({
|
|
|
+ .delUser({
|
|
|
id: id,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
- this.form = res.data.data;
|
|
|
- this.open = true;
|
|
|
- });
|
|
|
- },
|
|
|
- /** 提交按钮 */
|
|
|
- submitForm() {
|
|
|
- this.$refs["form"].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- if (this.form.id != null) {
|
|
|
- this.$api.editDoctorInfo(this.form).then((res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- this.msgSuccess("成功!");
|
|
|
- this.open = false;
|
|
|
- this.getData();
|
|
|
- } else {
|
|
|
- this.msgError(res.data.message);
|
|
|
- }
|
|
|
- });
|
|
|
+ if (!res.data.code) {
|
|
|
+ this.msgSuccess("删除成功");
|
|
|
+ this.getData();
|
|
|
} else {
|
|
|
- this.$api.addDoctorInfo(this.form).then((res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- this.msgSuccess("成功!");
|
|
|
- this.open = false;
|
|
|
- this.getData();
|
|
|
- } else {
|
|
|
- this.msgError(res.data.message);
|
|
|
- }
|
|
|
- });
|
|
|
+ this.msgError(res.data.message);
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- remoteMethod(query) {
|
|
|
- if (query !== "") {
|
|
|
- // this.loading = true;
|
|
|
- this.$api
|
|
|
- .getDoctorsSearchList({
|
|
|
- name: query,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- this.doctorList = res.data.data;
|
|
|
- this.$set(this.doctorList, res.data.data);
|
|
|
- // this.loading = false;
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.doctorList = [];
|
|
|
- }
|
|
|
- },
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
- created() {
|
|
|
+ gopage(size) {
|
|
|
+ if (size) {
|
|
|
+ this.queryParams.page_size = size;
|
|
|
+ }
|
|
|
+ this.queryParams.page = this.$refs.pageButton.page;
|
|
|
this.getData();
|
|
|
},
|
|
|
- };
|
|
|
- </script>
|
|
|
+ getList(){
|
|
|
+ this.$api.schoolList().then((res) => {
|
|
|
+ this.schoolList = res.data.data.list;
|
|
|
+ });
|
|
|
+ this.$api.roleList().then((res) => {
|
|
|
+ this.roleList = res.data.data.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getData() {
|
|
|
+ this.loading = true;
|
|
|
+ this.$api.userList(this.queryParams).then((res) => {
|
|
|
+ this.list = res.data.data.list;
|
|
|
+ this.total = res.data.data.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleAdd() {
|
|
|
+ this.open = true;
|
|
|
+ this.title = "新增用户";
|
|
|
+ this.form = {};
|
|
|
+ },
|
|
|
+ edit(item) {
|
|
|
+ this.title = "编辑";
|
|
|
+ this.form = item;
|
|
|
+ this.open = true;
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if(this.form.password != this.form.re_password){
|
|
|
+ this.msgError('两次密码不一致');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.form.id != null) {
|
|
|
+ this.$api.editUser(this.form).then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.msgSuccess("成功!");
|
|
|
+ this.open = false;
|
|
|
+ this.getData();
|
|
|
+ } else {
|
|
|
+ this.msgError(res.data.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$api.addUser(this.form).then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.msgSuccess("成功!");
|
|
|
+ this.open = false;
|
|
|
+ this.getData();
|
|
|
+ } else {
|
|
|
+ this.msgError(res.data.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList()
|
|
|
+ this.getData();
|
|
|
+
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|