123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <template>
- <div>
- <el-dialog
- title="选择学员"
- append-to-body
- width="800px"
- :visible.sync="transStudentVisible"
- >
- <el-form
- :model="form"
- ref="form"
- label-suffix=": "
- inline
- label-width="90px"
- >
- <el-row>
- <el-col :span="12">
- <el-form-item
- :label="'声部筛选'"
- style="margin-right: 0"
- prop="sound"
- >
- <select-all
- v-model="form.sound"
- style="width: 100%"
- clearable
- multiple
- collapse-tags
- filterable
- placeholder="请选择声部"
- >
- <el-option
- v-for="(item, index) in soundList"
- :key="index"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </select-all>
- </el-form-item>
- </el-col>
- </el-row>
- <el-transfer
- filterable
- :titles="['所有学员', '已选学员']"
- filter-placeholder="请输入学生姓名"
- :filter-method="filterStudent"
- v-model="seleched"
- :render-content="renderFunc"
- :data="data"
- :class="{ hideReturn: !canDelUser }"
- >
- <template #left-footer>
- <div class="footer line">
- <span>姓名</span>
- <span>性别</span>
- <span>专业</span>
- </div>
- </template>
- <template #right-footer>
- <div class="footer line">
- <span>姓名</span>
- <span>性别</span>
- <span>专业</span>
- </div>
- </template>
- </el-transfer>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="$listeners.close">取 消</el-button>
- <el-button type="primary" @click="submit">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { genderType } from "@/constant";
- import { uniqBy } from "lodash";
- export default {
- props: ["studentList", "soundList", "activeType", "activeListStudent"],
- computed: {
- data() {
- return uniqBy([...this.studentList, ...this.activeListStudent], "userId")
- .filter((item) => {
- if (this.form.sound.length) {
- return (
- this.form.sound.includes(item.subjectId) ||
- this.seleched.includes(item.userId)
- );
- }
- return true;
- })
- .map((item) => ({
- value: item.userId,
- key: item.userId,
- name: item.name,
- subjectName: item.subjectName,
- gender: genderType[item.gender],
- }));
- },
- showName() {
- return !this.isOnlyChangeUser && this.activeType != "MUSIC_NETWORK";
- },
- canDelUser() {
- // console.log(this.isStudentRemove)
- return (
- this.$route.query.type !== "resetTeam" ||
- !this.isOnlyChangeUser ||
- this.isStudentRemove
- );
- },
- },
- data() {
- return {
- sound: [],
- form: {
- name: "",
- coreTeacher: "",
- assistant: "",
- sound: [],
- },
- seleched: [],
- transStudentVisible: true,
- };
- },
- watch: {
- activeListStudent() {
- this.setSelectedUser();
- },
- },
- mounted() {
- this.setSelectedUser();
- },
- methods: {
- setSelectedUser() {
- const ids = this.activeListStudent.map((item) => item.userId);
- this.seleched = [...ids];
- },
- filterStudent(query, item) {
- return (
- item.name.indexOf(query) > -1 ||
- item.subjectName.indexOf(query) > -1 ||
- item.gender.indexOf(query) > -1
- );
- },
- renderFunc(h, option) {
- return (
- <div class="line">
- <el-tooltip
- class="item"
- effect="dark"
- placement="top"
- open-delay={300}
- >
- <span slot="content">{option.name}</span>
- <span class="select-item">{option.name}</span>
- </el-tooltip>
- <span>{option.gender}</span>
- <el-tooltip
- class="item"
- effect="dark"
- placement="top"
- open-delay={300}
- >
- <span slot="content">{option.subjectName}</span>
- <span class="select-item">{option.subjectName}</span>
- </el-tooltip>
- </div>
- );
- },
- change(val) {
- this.$listeners.changeActiveChioseSound(val);
- this.$listeners.searchStudent();
- },
- submit() {
- if (
- !this.isOnlyChangeUser &&
- this.activeType == "HIGH_ONLINE" &&
- (this.seleched.length < 1 || this.seleched.length > 6)
- ) {
- return this.$message.error("线上技能班必须为1-6人");
- }
- this.$emit("submit", this.seleched);
- this.transStudentVisible = false
- },
- openDialog() {
- this.transStudentVisible = true;
- },
- },
- };
- </script>
- <style lang="less" scoped>
- ::v-deep .el-transfer {
- display: flex;
- align-items: center;
- .el-transfer__buttons {
- display: flex;
- width: 110px;
- flex-direction: column;
- > button {
- &:last-child {
- margin-left: 0;
- }
- }
- }
- .el-transfer-panel {
- width: 300px;
- }
- }
- .footer {
- margin-left: 35px;
- margin-right: auto;
- height: 40px;
- line-height: 40px;
- }
- .hideReturn {
- ::v-deep .el-transfer__buttons button:first-child {
- display: none;
- }
- }
- ::v-deep .el-checkbox-group {
- padding-bottom: 40px;
- }
- ::v-deep .line {
- width: 220px;
- display: flex;
- justify-content: space-around;
- height: 30px;
- line-height: 30px;
- .select-item {
- width: 33.33333%;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- }
- ::v-deep .dialog-footer {
- margin-top: 20px;
- display: block;
- text-align: right;
- }
- </style>
|