Commit f14b70f1 authored by 黄奎's avatar 黄奎

页面修改

parent 241b960f
<template>
<div class="page-body">
<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 filled v-model="msg.StuName" label="名称" maxlength="20" />
</div>
<div class="col-3">
<q-input @input="resetSearch" clearable filled v-model="msg.StuTel" label="电话" maxlength="20" />
</div>
</div>
<div class="page-option">
<q-btn color="accent" class="q-mr-md" icon="add" label="新增客户" @click="EditStudent(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">
<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.substring(0,1)}}</q-avatar>
</q-td>
</template>
<template v-slot:body-cell-StuName="props">
<q-td :props="props">
<div class="text-blue cursor-pointer" @click="getStuRight(props.row)">{{props.value}}</div>
</q-td>
</template>
<template v-slot:body-cell-StuSex="props">
<q-td :props="props">
<q-badge :color="props.value==1?'negative':'primary'" :label="props.value==1?'女':'男'" />
</q-td>
</template>
<template v-slot:body-cell-Status="props">
<q-td :props="props">
<q-toggle size="md" color="primary" :false-value="1" :true-value="0" v-model="props.row.Status"
title="注意:关闭后,学员将无法正常使用." @input="deleteStudentInfo(props.row)" />
</q-td>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
</template>
</q-table>
<student-form v-if="isShowStuForm" :save-obj="stuOption" @close="closeStuForm" @success="refreshPage">
</student-form>
<studentRight-form v-if="isShowStuRight" :save-obj="stuOption" @close="closeStuForm" @success="refreshPage">
</studentRight-form>
</div>
</div>
</template>
<script>
import {
getStudentPage,
getSchoolDropdown,
deleteStudent,
createStudentAccount
} from '../../api/school/index'
import {
queryEmployee
} from '../../api/users/user'
import {
resetPassword
} from '../../api/users/user.js'
import studentForm from '../../components/school/student/student-form'
import studentRightForm from '../../components/school/student/studentRight-form'
export default {
meta: {
title: "客户管理"
},
components: {
studentForm,
studentRightForm
},
data() {
return {
currentUrl: "",
columns: [{
name: 'StuIcon',
label: '',
field: 'StuIcon',
align: 'left',
},
{
name: 'StuName',
required: true,
label: '昵称',
align: 'left',
field: row => row.StuName
},
{
name: 'StuSex',
label: '性别',
field: 'StuSex',
align: 'left'
},
{
name: 'StuBirthStr',
label: '出生日期',
field: 'StuBirthStr',
align: 'left'
},
{
name: 'StuTel',
label: '手机号码',
field: 'StuTel',
align: 'left'
},
{
name: 'CreateTypeStr',
label: '客户来源',
field: 'CreateTypeStr',
align: 'left',
},
{
name: 'StuStageName',
label: '客户阶段',
field: 'StuStageName',
align: 'left',
},
{
name: 'CreateTimeStr',
label: '创建时间',
field: 'CreateTimeStr',
align: 'left',
},
{
name: 'CreateByName',
label: '负责人',
align: 'left',
field: 'CreateByName'
}
],
data: [],
loading: true,
AuditOpts: [{
label: '全部',
value: '-1'
},
{
label: '正常',
value: '0'
},
{
label: '禁用',
value: '1'
},
],
msg: {
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
StuName: "",
StuTel: "",
Status: "-1",
CreateBy: ""
},
schoolTemp: "",
pageCount: 0,
stuOption: null,
schoolList: [],
isShowStuForm: false,
resetLoading: false,
isShowStuRight: false,
employeeList: [],
myEmployeeList: [],
}
},
created() {
this.getEmployeeList();
this.getSchool()
},
mounted() {
this.currentUrl = this.$route.path
this.getStudent()
},
methods: {
//获取员工列表
getEmployeeList() {
queryEmployee({
IsLeave: 1
}).then(res => {
this.employeeList = res.Data;
this.myEmployeeList = res.Data;
})
},
//筛选员工
filterEmployee(val, update, abort) {
update(() => {
this.myEmployeeList = this.employeeList.filter(
v => v.EmployeeName.indexOf(val) > -1
);
});
},
resetSearch() {
this.msg.pageIndex = 1;
if (this.schoolTemp) {
this.msg.School_Id = this.schoolTemp.SId
} else {
this.msg.School_Id = 0
}
this.getStudent()
},
//创建账号
createAccount(id) {
let that = this
createStudentAccount({
StuId: id,
}).then(res => {
that.$q.dialog({
title: "创建账号",
message: res.Message,
persistent: true,
ok: {
label: "确认",
flat: true,
focus: true
}
}).onOk(() => {
that.getStudent();
}).onCancel(() => {
that.getStudent();
})
})
},
resetPw(id) {
let that = this
this.$q.dialog({
title: "重置密码",
message: "你正在进行重置密码行为,是否确认执行",
persistent: true,
cancel: {
label: "取消",
flat: true
},
ok: {
label: "确认重置",
flat: true,
focus: true
}
}).onOk(() => {
that.resetLoading = true
resetPassword({
AccountType: 4,
AccountId: id
}).then(res => {
that.resetLoading = false
that.$q.dialog({
title: "密码重置成功",
message: res.Message,
persistent: true,
ok: {
label: "确认",
flat: true,
focus: true
}
})
}).catch(() => {
that.resetLoading = false
});
});
},
deleteStudentInfo(obj) {
let that = this;
var str = (obj.Status == 1 ? "【禁用】" : "【启用】");
this.$q.dialog({
title: str + "学员",
message: "你正在进行" + str + "学员行为,一旦执行无法找回,是否确认执行?",
persistent: true,
cancel: {
label: "取消",
flat: true
},
ok: {
label: "确认",
flat: true,
focus: true
}
}).onOk(() => {
that.resetLoading = true
deleteStudent({
StuId: obj.StuId,
Status: obj.Status
}).then(res => {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据操作成功!',
position: 'top'
})
this.getStudent()
})
}).onCancel(() => {
obj.Status = obj.Status == 1 ? 0 : 1;
});
},
changePage(val) {
this.msg.pageIndex = val;
this.getStudent();
},
getSchool() {
getSchoolDropdown({}).then(res => {
this.schoolList = res.Data;
})
},
getStudent() {
this.loading = true;
getStudentPage(this.msg).then(res => {
this.loading = false;
this.data = res.Data.PageData
this.pageCount = res.Data.PageCount
}).catch(() => {
this.loading = false
})
},
refreshPage() {
if (!this.stuOption) {
this.msg.pageIndex = 1;
this.msg.StuName = "";
this.msg.StuTel = "";
this.msg.Status = "-1";
this.msg.School_Id = 0;
}
this.getStudent()
},
EditStudent(obj) {
if (obj) {
this.stuOption = obj;
} else {
this.stuOption = null;
}
this.isShowStuForm = true;
},
closeStuForm() {
this.isShowStuForm = false;
this.isShowStuRight = false;
},
//点击学生姓名弹出
getStuRight(obj) {
if (obj) {
this.stuOption = obj;
} else {
this.stuOption = null;
}
this.isShowStuRight = true;
}
},
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass')
</style>
\ No newline at end of file
......@@ -3,18 +3,14 @@
<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 filled v-model="msg.StuName" label="学员名称" maxlength="20" />
<q-input @input="resetSearch" clearable filled v-model="msg.StuName" label="名称" maxlength="20" />
</div>
<div class="col-3">
<q-input @input="resetSearch" clearable filled v-model="msg.StuTel" label="学员电话" maxlength="20" />
<q-input @input="resetSearch" clearable filled v-model="msg.StuTel" label="电话" maxlength="20" />
</div>
<div class="col-3">
<q-select @input="resetSearch" clearable filled stack-label option-value="SId" option-label="SName"
v-model="schoolTemp" ref="School_Id" :options="schoolList" label="所属校区" :dense="false" />
</div>
<div class="col-3">
<q-select @input="resetSearch" filled v-model="msg.Status" :options="AuditOpts" emit-value map-options
label="状态" />
<q-select filled v-model="msg.CreateBy" @filter="filterEmployee" use-input :options="myEmployeeList"
option-label="EmployeeName" option-value="Id" emit-value map-options label="负责人" />
</div>
</div>
<div class="page-option">
......@@ -23,7 +19,7 @@
</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"
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">
<q-td auto-width :props="props">
......@@ -69,6 +65,9 @@
deleteStudent,
createStudentAccount
} from '../../api/school/index'
import {
queryEmployee
} from '../../api/users/user'
import {
resetPassword
} from '../../api/users/user.js'
......@@ -77,7 +76,7 @@
export default {
meta: {
title: "客户管理(学员)"
title: "客户管理"
},
components: {
studentForm,
......@@ -164,7 +163,7 @@
StuName: "",
StuTel: "",
Status: "-1",
School_Id: 0
CreateBy: ""
},
schoolTemp: "",
pageCount: 0,
......@@ -172,15 +171,37 @@
schoolList: [],
isShowStuForm: false,
resetLoading: false,
isShowStuRight: false
isShowStuRight: false,
employeeList: [],
myEmployeeList: [],
}
},
created() {
this.getEmployeeList();
this.getSchool()
},
mounted() {
this.currentUrl = this.$route.path
this.getSchool()
this.getStudent()
},
methods: {
//获取员工列表
getEmployeeList() {
queryEmployee({
IsLeave: 1
}).then(res => {
this.employeeList = res.Data;
this.myEmployeeList = res.Data;
})
},
//筛选员工
filterEmployee(val, update, abort) {
update(() => {
this.myEmployeeList = this.employeeList.filter(
v => v.EmployeeName.indexOf(val) > -1
);
});
},
resetSearch() {
this.msg.pageIndex = 1;
if (this.schoolTemp) {
......
......@@ -930,6 +930,11 @@ const routes = [{
component: () =>
import("pages/sale/activeOrderStatistics.vue")
},
{
path: "/sale/mystu", //我的客户
component: () =>
import("pages/sale/mystu.vue")
},
{
path: "/activity/activeType", //活动 活动类型
component: () =>
......
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