You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1051 lines
40 KiB

3 months ago
<template>
<div>
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
<div class="searchwrap" style="display: flex;align-items: center;">
<div>
<div>
<el-input v-model="select.keyword" placeholder="请输入关键词"></el-input>
</div>
<div>
<el-input v-model="select.name" placeholder="请输入姓名"></el-input>
</div>
<div>
<el-input v-model="select.company_name" placeholder="请输入公司名称"></el-input>
</div>
<xy-selectors style="width:auto" @reset="resetSelect" @search="select.page=1,getList()">
<template v-slot:selected>
<div class="selected-wrap">
<div>
<el-date-picker style="width:100%" v-model="select.year"
type="year" placeholder="查询年份" value-format="yyyy" format="yyyy">
</el-date-picker>
</div>
<div>
<el-date-picker style="width:100%" @change="changeStartDate" v-model="select.courses_start_date" type="date"
placeholder="课程开始日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd">
</el-date-picker>
</div>
<div>
<el-date-picker style="width:100%" @change="changeDate" v-model="select.courses_end_date" type="date"
placeholder="课程结束日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd">
</el-date-picker>
</div>
<div>
<el-select filterable v-model="select.course_type" placeholder="请选择课程体系" clearable>
<el-option v-for="item in courseTypeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
<div>
<el-input v-model="select.course_name" placeholder="请输入课程名称"></el-input>
</div>
<div>
<el-select filterable v-model="select.status" placeholder="请选择审核状态" clearable>
<el-option v-for="item in apply_status_list" :key="item.id" :label="item.value" :value="item.id">
</el-option>
</el-select>
</div>
3 months ago
<div>
<el-select v-model="select.is_chart" placeholder="课程是否统计" clearable style="width: 150px;">
<el-option label="否" :value="0"></el-option>
<el-option label="是" :value="1"></el-option>
</el-select>
</div>
3 months ago
<div style="width: 200px;">
<el-select v-model="select.is_rencai" placeholder="是否高层次科技人才" clearable>
<el-option label="是" :value="1"></el-option>
</el-select>
</div>
3 months ago
<div v-if="!isIndex2Route">
<el-select filterable v-model="select.is_schoolmate" placeholder="请选择是否校友" clearable>
<el-option v-for="item in is_schoolmate_list" :key="item.id" :label="item.value" :value="item.id">
</el-option>
</el-select>
</div>
<div>
<el-select filterable style="width:100%" v-model="select.is_yh_invested" placeholder="请选择集团标签" clearable>
<el-option label="被投企业" :value="1">
</el-option>
</el-select>
</div>
<div style="width:250px">
<el-select filterable style="width:100%" v-model="companyType"
@change="(e)=>{changeSelectType(e,'company_type')}" multiple collapse-tags
placeholder="请选择企业资质" clearable>
<el-option v-for="(item,index) in formSelect.company_type_all" :key="index" :label="item"
:value="item">
</el-option>
</el-select>
</div>
<div style="width:200px">
<el-select filterable style="width:100%" v-model="talentTagsType"
@change="(e)=>{changeSelectType(e,'talent_tags')}" multiple collapse-tags placeholder="请选择人才标签" clearable>
<el-option v-for="(item,index) in formSelect.talent_tags" :key="index" :label="item.value" :value="item.value">
</el-option>
</el-select>
</div>
<div style="width:200px">
<el-select filterable style="width:100%" v-model="typeSelect" @change="(e)=>{changeSelectType(e,'type')}" multiple collapse-tags
placeholder="请选择个人荣誉" clearable>
<el-option v-for="item in formSelect.type" :key="item.id" :label="item.value" :value="item.value">
</el-option>
</el-select>
</div>
<div>
<el-select filterable v-model="select.from" placeholder="请选择学员标签" clearable style="width: 100%;">
<el-option v-for="(item,index) in formSelect.from_tag" :key="index" :label="item.value" :value="item.value">
</el-option>
</el-select>
</div>
<div style="width:250px">
<el-select filterable v-model="select.is_company_market" placeholder="请选择是否上市企业" clearable style="width: 100%;">
<el-option label="是" :value="1"></el-option>
<el-option label="否" :value="0"></el-option>
</el-select>
</div>
<div style="width:200px">
<el-select filterable style="width:100%" v-model="companyArea"
multiple collapse-tags
@change="(e)=>{changeSelectType(e,'company_area')}"
placeholder="请选择所属区域" clearable>
<el-option v-for="item in formSelect.company_area" :key="item.id" :label="item.value"
:value="item.value">
</el-option>
</el-select>
</div>
<div style="width:250px">
<el-select filterable style="width:100%" v-model="companyIndustry" multiple collapse-tags
@change="(e)=>{changeSelectType(e,'company_industry')}" placeholder="请选择所属领域" clearable>
<el-option v-for="item in formSelect.company_industry" :key="item.id" :label="item.value"
:value="item.value">
</el-option>
<!-- <el-option v-for="item in formSelect.company_industry_detail" :key="item.id" :label="item.value"
:value="item.value">
</el-option> -->
</el-select>
</div>
<div>
<el-select filterable v-model="select.has_openid" placeholder="是否绑定小程序" clearable>
<el-option v-for="item in false_or_true" :key="item.id" :label="item.value" :value="item.id">
</el-option>
</el-select>
</div>
<div>
<el-input v-model="select.mobile" placeholder="请输入手机号"></el-input>
</div>
<div>
<el-select filterable style="width:100%" v-model="educationType"
@change="(e)=>{changeSelectType(e,'education')}" multiple collapse-tags placeholder="请选择学历" clearable>
<el-option v-for="item in formSelect.education" :key="item.id" :label="item.value"
:value="item.value">
</el-option>
</el-select>
</div>
<div style="width:200px">
<el-input v-model="select.school" placeholder="请输入最高毕业院校"></el-input>
</div>
<div style="width:250px">
<el-date-picker unlink-panels v-model="birthdayDates" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
style="width:100%" @change="changeBirthdayDates" type="daterange" range-separator="至"
start-placeholder="出生日期" end-placeholder="出生日期">
</el-date-picker>
</div>
<div>
<el-input v-model="select.company_position" placeholder="请输入职务"></el-input>
</div>
<div>
<el-select filterable v-model="select.company_has_share" placeholder="是否有股份" clearable>
<el-option v-for="item in shareList" :key="item.value" :label="item.value" :value="item.value">
</el-option>
</el-select>
</div>
<div>
<el-select filterable v-model="select.company_need_fund" placeholder="是否需要融资" clearable>
<el-option v-for="item in yuanheList" :key="item.value" :label="item.value" :value="item.value">
</el-option>
</el-select>
</div>
<div >
<el-select filterable v-model="select.is_vip" placeholder="请选择学员身份" clearable>
<el-option v-for="item in is_vip_list" :key="item.id" :label="item.value" :value="item.id">
</el-option>
</el-select>
</div>
<div style="width:250px">
<el-date-picker
v-model="signDates"
unlink-panels
type="daterange"
range-separator="至"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
start-placeholder="报名开始日期"
end-placeholder="报名结束日期"
:picker-options="signDatePickerOptions"
@change="changeSignDates"
style="width:100%"
></el-date-picker>
</div>
<div style="width:250px">
<el-date-picker unlink-panels v-model="companyDates" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
style="width:100%" @change="changeCompanyDates" type="daterange" range-separator="至"
start-placeholder="公司成立日期" end-placeholder="公司成立日期">
</el-date-picker>
</div>
<div>
<el-input v-model="select.address" placeholder="请输入企业地址"></el-input>
</div>
3 months ago
3 months ago
</div>
</template>
</xy-selectors>
<div>
<el-button type="primary" size="small" @click="select.page=1,getList()"></el-button>
<el-button type="primary" size="small" @click="resetSelect"></el-button>
<el-button type="primary" size="small" @click="importTable"></el-button>
<el-button type="primary" size="small" @click="openSpecialImport"></el-button>
<el-button type="primary" size="small" @click="exportExcel"></el-button>
<el-button type="primary" size="small" @click="openBatchUpdateModal"></el-button>
</div>
</div>
</div>
</div>
</lx-header>
</div>
</div>
<div>
<div v-if="!isIndex2Route" class="txl">{{searyear?searyear+'':''}}{{year_total}}{{year_training_total}}{{alltotal}}{{training_total}}</div>
<xy-table :list="list" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange" :showIndex="false"
@selection-change="selectionChange" :total="total" :table-item="table_item">
<template v-slot:index>
<el-table-column align='center' fixed="left" label="" width="50" header-align="center">
<template slot-scope="scope">
{{getIndex(scope.$index)}}
</template>
</el-table-column>
</template>
<template v-slot:course_list>
<el-table-column align='left' label="课程" width="380" header-align="center">
<template slot-scope="scope">
<div v-for="(item,index) in scope.row.course_signs">
<div v-if="item.course"
style="width:100%;display: flex;justify-content: space-between;align-items: center;margin-bottom:5px">
<div>
{{item.course.year?item.course.year:''}}{{item.course.type_detail.name+' | '}}{{item.course.name}}
</div>
<template v-for="state in apply_status_list">
<el-tag style="margin-left:20px" :type="state.type"
v-if="item.status===state.id">{{state.value}}</el-tag>
</template>
</div>
</div>
</template>
</el-table-column>
</template>
<template v-slot:headimgurl>
<el-table-column align='center' label="头像" width="100" header-align="center">
<template slot-scope="scope">
<el-image
v-if="scope.row.headimgurl"
style="width: 50px; height: 50px;border-radius: 100%;"
:src="scope.row.headimgurl"
:preview-src-list="[scope.row.headimgurl]">
</el-image>
</template>
</el-table-column>
</template>
<template v-slot:mobile>
<el-table-column align='center' label="联系方式" width="120" header-align="center">
<template slot-scope="scope">
{{base.maskPhoneNumber(scope.row.mobile)}}
</template>
</el-table-column>
</template>
<template v-slot:is_schoolmate>
<el-table-column align='center' label="是否校友库学员" width="120" header-align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_schoolmate===1" type=""></el-tag>
<el-tag v-else type="info"></el-tag>
</template>
</el-table-column>
</template>
<!-- <template v-slot:is_black>
<el-table-column align='center' label="是否黑名单" width="120" header-align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_black===1" type=""></el-tag>
<el-tag v-else type="info"></el-tag>
</template>
</el-table-column>
</template> -->
<template v-slot:is_vip>
<el-table-column align='center' label="学员身份" width="120" header-align="center">
<template slot-scope="scope">
<!-- <div v-for="item in is_schoolmate_list">
<div v-if="scope.row.is_vip===item.id">{{item.value}}</div>
</div> -->
<div v-if="scope.row.is_vip===1"></div>
<div v-else></div>
</template>
</el-table-column>
</template>
<template v-slot:is_wx>
<el-table-column align='center' label="是否绑定小程序" width="120" header-align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.openid">
</el-tag>
<el-tag v-else type="info">
</el-tag>
</template>
</el-table-column>
</template>
<template v-slot:from>
<el-table-column align='center' label="学员标签" width="120" header-align="center">
<template slot-scope="scope">
<div v-if="scope.row.from">
<el-tag
v-for="tag in getStudentTags(scope.row.from)"
:key="tag"
style="margin: 2px;"
>
{{ tag }}
</el-tag>
</div>
<span v-else></span>
</template>
</el-table-column>
</template>
<template v-slot:talent_tags>
<el-table-column align='center' label="人才标签" width="120" header-align="center">
<template slot-scope="scope">
<div v-if="scope.row.talent_tags">
<el-tag v-for="tag in getStudentTags(scope.row.talent_tags)" :key="tag" style="margin: 2px;">{{ tag }}</el-tag>
</div>
<span v-else></span>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='center' label="操作" fixed="right" width="180" header-align="center">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="edit('editor',scope.row.id)"></el-button>
<el-button type="primary" size="small" @click="showDetail('show',scope.row.id)"></el-button>
</template>
</el-table-column>
</template>
</xy-table>
</div>
<student-detail ref="studentDetail"></student-detail>
<editDetail ref="editDetail" @refresh="getList"></editDetail>
<imports ref="imports" :table-name="'users'" @refresh="getList"></imports>
<special-import ref="specialImport" @refresh="getList"></special-import>
<batch-update v-model="batchUpdateVisible" :selected-users="seleSchoolmates" @success="handleBatchUpdateSuccess"></batch-update>
</div>
</template>
<script>
import studentDetail from './components/detail.vue';
import editDetail from './components/editDetail.vue';
import batchUpdate from './components/batchUpdate.vue';
import specialImport from './components/specialImport.vue';
import myMixins from "@/mixin/selectMixin.js";
import formMixin from "@/mixin/formMixin.js";
import {
indexStudy,
updateSchoolmate
} from '@/api/student/index.js'
import imports from "@/views/component/imports.vue"
import {
index as indexTypes
} from "@/api/course/courseType.js"
import {
download
} from "@/utils/downloadRequest";
export default {
mixins: [myMixins, formMixin],
components: {
studentDetail,
editDetail,
imports,
specialImport,
batchUpdate
},
data() {
return {
path: '',
// 多选 获取
companyDates: [],
birthdayDates: [],
signDates: [],
companyType: [],
typeSelect: [],
educationType:[],
talentTagsType:[],
companyIndustry:[],
companyArea:[],
select: {
keyword: '',
name: '',
year:'',
mobile: '',
from:'',
talent_tags:'',
course_name: '',
company_name: '',
school: '',
start_birthday: '',
end_birthday: '',
start_company_date: '',
end_company_date: '',
company_has_share: '',
company_need_fund: '',
company_position: '',
company_area: '',
company_type: '',
company_industry: '',
is_yh_invested: '',
is_vip: '',
is_schoolmate: '',
courses_start_date: '',
courses_end_date: '',
education: '',
type: '',
status: "",
course_type: '',
has_openid:'',
sign_start_date: '',
sign_end_date: '',
is_company_market: '',
is_chart: '',
is_rencai: '',
address: '',
page: 1,
page_size: 10,
},
signDatePickerOptions: {
shortcuts: [
{
text: '本月',
onClick(picker) {
const end = new Date()
const start = new Date(end.getFullYear(), end.getMonth(), 1)
picker.$emit('pick', [start, end])
}
},
{
text: '三个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setMonth(start.getMonth() - 3)
picker.$emit('pick', [start, end])
}
},
{
text: '半年',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setMonth(start.getMonth() - 6)
picker.$emit('pick', [start, end])
}
},
{
text: '本年',
onClick(picker) {
const end = new Date()
const start = new Date(end.getFullYear(), 0, 1)
picker.$emit('pick', [start, end])
}
}
]
},
// 批量更新相关
batchUpdateVisible: false,
courseTypeList: [],
list: [],
total: 0,
year_total: 0,
alltotal: 0,
year_training_total: 0,
training_total: 0,
searyear: '',
seleSchoolmates: [],
table_item: [{
type: 'selection',
width: 50,
fixed: 'left'
}, {
prop: 'index',
label: '',
align: 'center',
width: 50,
fixed: 'left'
}, {
prop: 'course_list',
label: '课程名称',
align: 'left',
}, {
prop: 'username',
label: '姓名',
align: 'center',
width: 120
}, {
prop: 'sex',
label: '性别',
align: 'center',
width: 120
}, {
prop: 'no',
label: '学号',
align: 'center',
width: 180
},{
prop: 'headimgurl',
label: '头像',
align: 'center',
width: 100
},{
prop: 'idcard',
label: '身份证号',
align: 'center',
width: 180
}, {
prop: 'mobile',
label: '联系方式',
align: 'center',
width: 120,
}, {
prop: 'birthday',
label: '出生年月',
align: 'center',
width: 120,
}, {
prop: 'email',
label: '邮箱',
align: 'center',
width: 120,
}, {
prop: 'is_company_schoolmate_text',
label: '是否校友企业',
align: 'center',
width: 120,
}, {
prop: 'company_name',
label: '公司名称',
align: 'left',
width: 200
}, {
prop: 'company.company_name',
label: '企查查名称',
align: 'left',
width: 200,
}, {
prop: 'company_position',
label: '职务',
align: 'center',
width: 120,
}, {
prop: 'from',
label: '学员标签',
align: 'center',
width: 120,
}, {
prop: 'talent_tags',
label: '人才标签',
align: 'center',
width: 120,
},{
prop: 'is_schoolmate',
label: '是否校友库学员',
align: 'center',
width: 120,
},
// {
// prop: 'is_vip',
// label: '学员身份',
// align: 'center',
// width: 120,
// },
{
prop: 'is_yuanhe',
label: '集团标签',
align: 'center',
width: 120,
customFn:(row)=>{
if(row.company){
return(row.company.is_yh_invested?<el-tag type="danger">被投企业</el-tag>:'')
}
}
},
{
prop: 'is_wx',
label: '是否绑定小程序',
align: 'center',
width: 120,
}]
}
},
computed: {
isIndex2Route() {
return this.$route.name === 'index_2' || this.$route.path.includes('index_2')
}
},
created() {
// 检查路由,如果是 index_2设置 is_schoolmate=1
if (this.isIndex2Route) {
this.select.is_schoolmate = 1
}
this.getList()
this.getCourseType()
},
methods: {
changeSelectType(e, selectName) {
if (e) {
this.select[selectName] = e.join(",")
} else {
this.select[selectName] = ''
}
},
changeCompanyDates(e) {
if (e) {
this.select.start_company_date = e[0]
this.select.end_company_date = e[1]
} else {
this.select.start_company_date = ''
this.select.end_company_date = ''
}
},
changeBirthdayDates(e) {
if (e) {
this.select.start_birthday = e[0]
this.select.end_birthday = e[1]
} else {
this.select.start_birthday = ''
this.select.end_birthday = ''
}
},
// 处理报名日期变化
changeSignDates(e) {
if (e && Array.isArray(e) && e.length === 2) {
this.select.sign_start_date = e[0] || ''
this.select.sign_end_date = e[1] || ''
} else {
this.select.sign_start_date = ''
this.select.sign_end_date = ''
}
},
exportExcel() {
let _export = {
'all_course': '课程名称',
'from': '学员标签',
'talent_tags': '人才标签',
'no':'学号',
'company.is_yh_invested_text': '集团标签',
'is_vip_text': '学员身份',
'is_schoolmate_text': '是否校友库学员'
}
this.selectFormList.map(item => {
if (item.prop === 'index') {
} else {
_export[item.field] = item.name
}
})
download(
'/api/admin/users/study',
'get', {
export_fields: _export,
keyword: this.select.keyword || '',
name: this.select.name || '',
year: this.select.year || '',
mobile: this.select.mobile || '',
from: this.select.from || '',
talent_tags: this.select.talent_tags || '',
company_name: this.select.company_name || '',
school: this.select.school || '',
start_birthday: this.select.start_birthday || '',
end_birthday: this.select.end_birthday || '',
start_company_date: this.select.start_company_date || '',
end_company_date: this.select.end_company_date || '',
course_name: this.select.course_name || '',
company_has_share: this.select.company_has_share || '',
company_need_fund: this.select.company_need_fund || '',
company_position: this.select.company_position || '',
company_area: this.select.company_area || '',
company_type: this.select.company_type || '',
company_industry: this.select.company_industry || '',
is_vip: this.select.is_vip || '',
is_yh_invested: this.select.is_yh_invested || '',
courses_start_date: this.select.courses_start_date || '',
courses_end_date: this.select.courses_end_date || '',
is_schoolmate: this.select.is_schoolmate || '',
is_black: this.select.is_black || '',
education: this.select.education || '',
type: this.select.type || '',
status: this.select.status || '',
course_type: this.select.course_type || '',
has_openid: this.select.has_openid || '',
is_company_market: this.select.is_company_market || '',
is_chart: this.select.is_chart !== '' && this.select.is_chart !== null ? this.select.is_chart : '',
is_rencai: this.select.is_rencai !== '' && this.select.is_rencai !== null ? this.select.is_rencai : '',
address: this.select.address || '',
is_export: 1,
page: 1,
page_size: 99999
},
`学员信息.xlsx`)
},
importTable(row) {
// this.$refs.imports.tableData = {
// 'data[course_id]': row.course_id,
// 'data[course_content_id]': row.id
// }
this.$refs.imports.show()
// {"course_id":15,"course_content_id":188}
},
openSpecialImport() {
this.$refs.specialImport.show()
},
pageIndexChange(e) {
this.select.page = e
this.getList()
},
pageSizeChange(e) {
this.select.page_size = e
this.select.page = 1
this.getList()
},
getIndex(e) {
let perSize = (this.select.page - 1) * this.select.page_size
let index = perSize + e + 1
return index
},
resetSelect() {
this.companyType = []
this.typeSelect = []
this.educationType=[]
this.talentTagsType=[]
this.companyIndustry=[]
this.companyArea=[]
this.select.keyword = ''
this.select.name = ''
this.select.year = ''
this.select.mobile = ''
this.select.from = ''
this.select.company_name = ''
this.select.talent_tags = ''
this.select.school = ''
this.select.company_has_share = ''
this.select.company_need_fund = ''
this.select.start_company_date = ''
this.select.start_birthday = ''
this.birthdayDates = []
this.select.end_birthday = ''
this.select.end_company_date = ''
this.companyDates = []
this.select.course_name = ''
this.select.company_position = ''
this.select.company_area = ''
this.select.company_type = ''
this.select.company_industry = ''
this.select.is_yh_invested = ''
this.select.is_vip = ''
this.select.is_yh_invested = ''
this.select.courses_start_date = ''
this.select.courses_end_date = ''
this.select.is_schoolmate = ''
this.select.education = ''
this.select.type = ''
this.select.status = ''
this.select.course_type = ''
this.select.has_openid = ''
this.select.sign_start_date = ''
this.select.sign_end_date = ''
this.signDates = []
this.select.is_company_market = ''
this.select.is_chart = ''
this.select.is_rencai = ''
this.select.address = ''
this.select.page = 1
this.getList()
},
async getList() {
const res = await indexStudy({
page: this.select.page,
page_size: this.select.page_size,
keyword: this.select.keyword || '',
name: this.select.name || '',
year: this.select.year || '',
mobile: this.select.mobile || '',
company_name: this.select.company_name || '',
from: this.select.from || '',
talent_tags: this.select.talent_tags || '',
school: this.select.school || '',
start_birthday: this.select.start_birthday || '',
end_birthday: this.select.end_birthday || '',
start_company_date: this.select.start_company_date || '',
end_company_date: this.select.end_company_date || '',
course_name: this.select.course_name || '',
company_has_share: this.select.company_has_share || '',
company_need_fund: this.select.company_need_fund || '',
company_position: this.select.company_position || '',
company_area: this.select.company_area || '',
company_type: this.select.company_type || '',
company_industry: this.select.company_industry || '',
is_yh_invested: this.select.is_yh_invested || '',
is_vip: this.select.is_vip || '',
courses_start_date: this.select.courses_start_date || '',
courses_end_date: this.select.courses_end_date || '',
is_schoolmate: this.select.is_schoolmate || '',
education: this.select.education || '',
type: this.select.type || '',
status: this.select.status || '',
has_openid: this.select.has_openid || '',
course_type: this.select.course_type || '',
is_chart: this.select.is_chart !== '' && this.select.is_chart !== null ? this.select.is_chart : '',
is_rencai: this.select.is_rencai !== '' && this.select.is_rencai !== null ? this.select.is_rencai : '',
sign_start_date: this.select.sign_start_date || '',
sign_end_date: this.select.sign_end_date || '',
is_company_market: this.select.is_company_market || '',
address: this.select.address || ''
})
this.list = res.list.data
this.total = res.list.total
// 获取统计数据
this.year_total = res.year_total || 0
this.year_training_total = res.year_training_total || 0
this.training_total = res.training_total || 0
this.alltotal = res.total || 0
this.searyear = this.select.year ? this.select.year : ''
},
changeDate(e) {
this.select.courses_end_date = e || ''
},
changeStartDate(e) {
this.select.courses_start_date = e || ''
},
// 批量设置校友库
selectionChange(e) {
console.log(e)
this.seleSchoolmates = e
},
// 批量设置校友库
updateSchoolmates(vip) {
if (this.seleSchoolmates.length > 0) {
if (vip == 0) {
// 批量取消校友库
this.$confirm(
`确定要将选中的 ${this.seleSchoolmates.length} 名学员从校友库移除吗?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
// 直接取消校友库,不加入黑名单
this.submitUpdateSchoolmates(vip);
}).catch(() => {
// 用户取消操作
console.log('用户取消了操作');
});
} else {
// 批量设置为校友 - 检查黑名单状态
const blacklistedUsers = this.seleSchoolmates.filter(user => user.is_black == 1);
if (blacklistedUsers.length > 0) {
// 有黑名单学员,给出提示
const blacklistedNames = blacklistedUsers.map(user => user.username || user.name || '未知用户').join('、');
const otherUsers = this.seleSchoolmates.filter(user => user.is_black != 1);
this.$confirm(
`以下学员\n\n${blacklistedNames}\n\n目前处于黑名单中需先将其设置为非黑名单才可以加入到校友库中是否先将其他学员设置为校友`,
'黑名单提示',
{
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning',
dangerouslyUseHTMLString: true
}
).then(() => {
// 选择是,剔除黑名单学员后提交
if (otherUsers.length > 0) {
this.submitUpdateSchoolmates(vip, otherUsers);
} else {
this.$Message.warning('没有可设置为校友的学员');
}
}).catch(() => {
// 选择否,不执行任何操作
console.log('用户取消了操作');
});
} else {
// 没有黑名单学员,直接设置为校友
this.$confirm(
`确定要将选中的 ${this.seleSchoolmates.length} 名学员加入校友库吗?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
this.submitUpdateSchoolmates(vip);
}).catch(() => {
console.log('用户取消了操作');
});
}
}
} else {
this.$Message.warning("请先选择学员")
return
}
},
// 提交更新校友库状态
submitUpdateSchoolmates(vip, users = null) {
// 如果传入了users参数使用传入的用户列表否则使用默认的seleSchoolmates
const targetUsers = users || this.seleSchoolmates;
let ids = []
targetUsers.map(item => {
ids.push(item.id)
})
updateSchoolmate({
is_schoolmate: vip,
ids: ids.join(','),
is_black: 0 // 固定设置为非黑名单
}).then(res => {
const userCount = targetUsers.length;
const operation = vip === 1 ? '加入校友库' : '从校友库移除';
if (users && users.length !== this.seleSchoolmates.length) {
// 如果有黑名单学员被剔除,显示特殊提示
this.$Message.success(`批量${operation}成功,共处理 ${userCount} 名学员`)
} else {
this.$Message.success(`批量${operation}成功`)
}
this.getList()
}).catch(error => {
this.$Message.error("批量设置失败:" + (error.message || '未知错误'))
})
},
edit(type, id) {
this.$refs.editDetail.id = id
this.$refs.editDetail.type = type
this.$refs.editDetail.isShow = true
},
showDetail(type, id) {
this.$refs.studentDetail.id = id
this.$refs.studentDetail.type = type
this.$refs.studentDetail.isShow = true
},
async getCourseType() {
const res = await indexTypes({
page: 1,
page_size: 999
})
this.courseTypeList = res.data
},
// 批量更新信息
openBatchUpdateModal() {
if (this.seleSchoolmates.length > 0) {
this.batchUpdateVisible = true
} else {
this.$Message.warning("请先选择学员")
return
}
},
handleBatchUpdateSuccess() {
this.getList()
},
getStudentTags(tags) {
if (!tags) return [];
return tags.split(',').map(tag => tag.trim());
}
},
watch: {
isShow(newVal) {
if (!newVal) {
// 重置统计数据
this.year_total = 0
this.alltotal = 0
this.year_training_total = 0
this.training_total = 0
this.searyear = ''
}
}
}
}
</script>
<style lang="scss" scoped>
.txl {
display: flex;
align-items: center;
margin-bottom: 10px;
font-size: 18px;
&>div {
margin-right: 15px;
}
}
.searchwrap {
display: flex;
align-items: center;
flex-wrap: wrap;
&>div,.selected-wrap {
display: flex;
align-items: center;
flex-wrap: wrap;
&>div {
margin-right: 10px;
margin-bottom: 10px;
width: 150px;
&:last-child {
width: auto
}
}
}
}
</style>