Commit bdd20e06 authored by 黄奎's avatar 黄奎

页面修改

parent 9b6d29a0
......@@ -315,7 +315,7 @@ export function queryManagerPage(data) {
/**
* 新增修改管理者
*/
export function saveManager() {
export function saveManager(data) {
return request({
url: '/User/SetManager',
method: 'post',
......@@ -326,7 +326,7 @@ export function saveManager() {
/**
* 获取管理者信息
*/
export function queryManagerInfo() {
export function queryManagerInfo(data) {
return request({
url: '/User/GetManager',
method: 'post',
......@@ -338,7 +338,7 @@ export function queryManagerInfo() {
/**
* 获取管理者信息
*/
export function deleteManagerInfo() {
export function deleteManagerInfo(data) {
return request({
url: '/User/RemoveManager',
method: 'post',
......
<template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.StuId==0?'新增管理者信息':'修改管理者信息'}}</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="text-caption q-mb-md q-px-xs text-grey-6">基本资料</div>
<div class="row wrap">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.MName" ref="MName"
class="col-6 q-pr-lg q-pb-lg" label="管理者名称" :rules="[val => !!val || '请填写管理者姓名']" />
<q-input type="tel" filled stack-label maxlength="100" :dense="false" v-model="objOption.MTel" ref="MTel"
class="col-6 q-pr-lg q-pb-lg" label="联系电话" :rules="[val => !!val || '请填写管理者联系电话']" />
<div class="col-6 q-pb-lg">
<q-uploader style="display: inline-block;max-height: 320px;max-width: 100%; background-repeat:no-repeat"
:style="{'background-image':'url(' + objOption.MHead + ')'}" max-files="1" hide-upload-btn
@rejected="onRejected" label="管理者头像" :max-file-size="512*1024" accept=".jpg, image/*" auto-upload
:factory="uploadFile" no-thumbnails>
</q-uploader>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" color="dark" style="font-weight:400 !important" @click="closeSaveForm" />
<q-btn label="立即提交" color="accent" class="q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="setStudent" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
getSchoolDropdown,
saveManager
} from '../../../api/school/index'
import {
UploadSelfFile,
} from '../../../api/common/common'
export default {
components: {},
props: {
saveObj: {
type: Object,
default: null
}
},
data() {
return {
persistent: true,
objOption: {
MId: 0, //管理者编号
School_Id: 0, //学校编号
MName: "", //管理者姓名
MTel: '', //管理者电话
MHead: '', //头像
},
optionTitle: "",
schoolList: [],
saveLoading: false,
}
},
created() {
this.getSchool();
},
mounted() {
this.initObj()
},
methods: {
initObj() {
if (this.saveObj) {
this.optionTitle = "修改管理者信息"
this.objOption.MId = this.saveObj.MId;
this.objOption.School_Id = this.saveObj.School_Id;
this.objOption.MName = this.saveObj.MName;
this.objOption.MTel = this.saveObj.MTel;
this.objOption.MHead = this.saveObj.MHead;
this.$forceUpdate();
} else {
this.optionTitle = "新增管理者"
}
},
getSchool() {
getSchoolDropdown({}).then(res => {
this.schoolList = res.Data;
this.$forceUpdate();
})
},
onRejected(rejectedEntries) {
this.$q.notify({
type: 'negative',
position: "top",
message: `文件验证失败,请重新上传`
})
},
uploadFile(files) {
UploadSelfFile('studentIcon', files[0], res => {
if (res.resultCode == 1) {
this.objOption.MHead = res.FileUrl;
}
})
},
closeSaveForm() {
this.$emit('close')
this.persistent = false
},
setStudent() {
this.saveLoading = true
saveManager(this.objOption).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveLoading = false
})
},
},
}
</script>
<style>
.upload-assiatant-box .q-uploader__list {
display: none;
}
.upload-assiatant-box .q-uploader {
width: auto;
}
</style>
......@@ -3,10 +3,10 @@
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-input @input="resetSearch" clearable standout="bg-primary text-white" v-model="msg.StuName" label="学员名称" />
<q-input @input="resetSearch" clearable standout="bg-primary text-white" v-model="msg.MName" label="姓名" />
</div>
<div class="col-3">
<q-input @input="resetSearch" clearable standout="bg-primary text-white" v-model="msg.StuTel" label="学员电话" />
<q-input @input="resetSearch" clearable standout="bg-primary text-white" v-model="msg.MTel" label="电话" />
</div>
<div class="col-3">
<q-select @input="resetSearch" clearable filled stack-label option-value="SId" option-label="SName"
......@@ -18,23 +18,23 @@
</div>
</div>
<div class="page-option">
<q-btn color="accent" class="q-mr-md" icon="add" label="新增学员" @click="EditStudent(null)" />
<q-btn color="accent" class="q-mr-md" icon="add" label="新增管理者" @click="EditManager(null)" />
</div>
</div>
<div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat
class="sticky-right-column-table sticky-tow-column-table" separator="none" title="后台用户信息" :data="data"
:columns="columns" row-key="name">
<template v-slot:body-cell-StuIcon="props">
<template v-slot:body-cell-MHead="props">
<q-td auto-width :props="props">
<q-avatar size="md" v-if="props.value">
<img :src="props.value" />
</q-avatar>
<q-avatar size="md" color="teal-10" text-color="white" v-if="!props.value">
{{props.row.StuName}}</q-avatar>
{{props.row.MName}}</q-avatar>
</q-td>
</template>
<template v-slot:body-cell-StuName="props">
<template v-slot:body-cell-MName="props">
<q-td :props="props">
<div class="text-blue cursor-pointer">{{props.value}}</div>
</q-td>
......@@ -46,9 +46,8 @@
</template>
<template v-slot:body-cell-Status="props">
<q-td :props="props">
<q-toggle disable size="md" color="primary" :false-value="1" :true-value="0" v-model="props.row.Status"
title="注意:关闭后,学员将无法正常使用." />
<!--@input="DeleteMenu(props.row)"-->
<q-toggle disable size="md" color="primary" :false-value="1" :true-value="0" v-model="props.row.Status"
title="注意:关闭后,管理员将无法正常使用." />
</q-td>
</template>
<template v-slot:bottom>
......@@ -59,69 +58,57 @@
<q-td :props="props">
<div style="min-width:190px;width:100%">
<q-btn flat size="xs" icon="iconfont icon-ziyuan" color="warning" style="font-weight:400" class="q-mr-xs"
label="重置密码" @click="resetPw(props.row.StuId)" />
label="重置密码" @click="resetPw(props.row.MId)" />
<q-btn flat size="xs" icon="iconfont icon-shanchu" color="negative" style="font-weight:400"
class="q-mr-xs" label="删除" @click="deleteUser(props.row.StuId)" />
class="q-mr-xs" label="删除" @click="deleteUser(props.row.MId)" />
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
@click="EditStudent(props.row)" />
@click="EditManager(props.row)" />
</div>
</q-td>
</template>
</q-table>
<student-form v-if="isShowStuForm" :save-obj="stuOption" @close="closeStuForm" @success="refreshPage">
</student-form>
<manager-form v-if="isShowManagerForm" :save-obj="managerOption" @close="closeStuForm" @success="refreshPage">
</manager-form>
</div>
</div>
</template>
<script>
import {
getStudentPage,
queryManagerPage,
getSchoolDropdown,
deleteStudent
deleteManagerInfo
} from '../../api/school/index'
import {
resetPassword
} from '../../api/users/user.js'
import studentForm from '../../components/school/student/student-form'
import managerForm from '../../components/school/manager/manager-form'
export default {
meta: {
title: "后台用户管理"
},
components: {
studentForm,
managerForm,
},
data() {
return {
currentUrl: "",
columns: [{
name: 'StuIcon',
name: 'MHead',
label: '',
field: 'StuIcon',
field: 'MHead',
align: 'left',
},
{
name: 'StuName',
name: 'MName',
required: true,
label: '学员昵称',
label: '管理者姓名',
align: 'left',
field: row => row.StuName
field: row => row.MName
},
{
name: 'StuSex',
label: '性别',
field: 'StuSex',
align: 'left'
},
{
name: 'StuBirthStr',
label: '出生日期',
field: 'StuBirthStr',
align: 'left'
},
{
name: 'StuTel',
name: 'MTel',
label: '手机号码',
field: 'StuTel',
field: 'MTel',
align: 'left'
},
{
......@@ -130,12 +117,7 @@
field: 'SName',
align: 'left',
},
{
name: 'AreaName',
label: '区域',
field: 'AreaName',
align: 'left',
},
{
name: 'Status',
label: '状态',
......@@ -150,14 +132,14 @@
},
{
name: 'CreateTimeStr',
label: '入学时间',
label: '创建时间',
align: 'left',
field: 'CreateTimeStr'
},
{
name: 'optioned',
label: '操作',
field: 'StuId'
field: 'MId'
}
],
data: [],
......@@ -179,23 +161,23 @@
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
StuName: "",
StuTel: "",
MName: "",
MTel: "",
Status: "-1",
School_Id: 0
School_Id: 0,
},
schoolTemp: "",
pageCount: 0,
stuOption: null,
managerOption: null,
schoolList: [],
isShowStuForm: false,
isShowManagerForm: false,
resetLoading: false
}
},
mounted() {
this.currentUrl = this.$route.path
this.getSchool()
this.getStudent()
this.getManager()
},
methods: {
resetSearch() {
......@@ -205,7 +187,7 @@
} else {
this.msg.School_Id = 0
}
this.getStudent()
this.getManager()
},
resetPw(id) {
let that = this
......@@ -225,7 +207,7 @@
}).onOk(() => {
that.resetLoading = true
resetPassword({
AccountType: 4,
AccountType: 1,
AccountId: id
}).then(res => {
that.resetLoading = false
......@@ -247,8 +229,8 @@
deleteUser(id) {
let that = this
this.$q.dialog({
title: "删除学员",
message: "你正在进行删除学员行为,一旦执行无法找回,是否确认执行?",
title: "删除管理者",
message: "你正在进行删除管理者行为,一旦执行无法找回,是否确认执行?",
persistent: true,
cancel: {
label: "取消",
......@@ -261,8 +243,8 @@
}
}).onOk(() => {
that.resetLoading = true
deleteStudent({
StuId: id
deleteManagerInfo({
MId: id
}).then(res => {
this.$q.notify({
icon: 'iconfont icon-chenggong',
......@@ -271,22 +253,22 @@
message: '数据删除成功!',
position: 'top'
})
this.getStudent()
this.getManager()
})
});
},
changePage(val) {
this.msg.pageIndex = val;
this.getStudent();
this.getManager();
},
getSchool() {
getSchoolDropdown({}).then(res => {
this.schoolList = res.Data;
})
},
getStudent() {
getManager() {
this.loading = true;
getStudentPage(this.msg).then(res => {
queryManagerPage(this.msg).then(res => {
this.loading = false;
this.data = res.Data.PageData
this.pageCount = res.Data.PageCount
......@@ -295,25 +277,25 @@
})
},
refreshPage() {
if (!this.stuOption) {
if (!this.managerOption) {
this.msg.pageIndex = 1;
this.msg.StuName = "";
this.msg.StuTel = "";
this.msg.MName = "";
this.msg.MTel = "";
this.msg.Status = "-1";
this.msg.School_Id = 0;
}
this.getStudent()
this.getManager()
},
EditStudent(obj) {
EditManager(obj) {
if (obj) {
this.stuOption = obj;
this.managerOption = obj;
} else {
this.stuOption = null;
this.managerOption = null;
}
this.isShowStuForm = true;
this.isShowManagerForm = true;
},
closeStuForm() {
this.isShowStuForm = false;
this.isShowManagerForm = false;
}
},
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment