| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395 |
- <template>
- <div class="m-container">
- <h2>
- <div class="squrt"></div> vip参数设置
- </h2>
- <div class="m-core">
- <div class="listWrap">
- <div class="left">
- <div class="newBand"
- @click="addGroupCategory">新建</div>
- <el-table :data='leftList'
- :header-cell-style="{background:'#EDEEF0',color:'#444'}">
- <el-table-column label="课程形式"
- prop="name"
- width="180">
- </el-table-column>
- <el-table-column label="班级人数"
- prop="studentNum"
- width="180">
- </el-table-column>
- <el-table-column label="课程课时"
- prop="singleClassMinutes"
- width="180">
- </el-table-column>
- <el-table-column label="操作"
- width="180">
- <template slot-scope="scope">
- <div>
- <el-button type="text"
- @click="resetGroupCategory(scope.row)">修改</el-button>
- <el-popover placement="top"
- width="160"
- :ref="scope.row.id">
- <p>您确定删除该课程形态吗?</p>
- <div style="text-align: right; margin: 0">
- <el-button size="mini"
- type="text"
- @click="scope._self.$refs[scope.row.id].doClose()">取消</el-button>
- <el-button type="primary"
- size="mini"
- @click="removeGroupCategory(scope)">确定</el-button>
- </div>
- <el-button type="text"
- slot="reference">删除</el-button>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="right">
- <div class="newBand"
- @click="addVipTimer">新建</div>
- <el-table :data='rightList'
- :header-cell-style="{background:'#EDEEF0',color:'#444'}">
- <el-table-column label="达到课时总数/次"
- prop="maxClassTimes"
- width="180">
- </el-table-column>
- <el-table-column label="可排课时间段"
- prop="month"
- width="180">
- </el-table-column>
- <el-table-column label="操作"
- width="180">
- <template slot-scope="scope">
- <div>
- <el-button type="text"
- @click="resetTimerList(scope.row)">修改</el-button>
- <el-popover placement="top"
- width="160"
- :ref="scope.row.id">
- <p>您确定删除该周期循环吗?</p>
- <div style="text-align: right; margin: 0">
- <el-button size="mini"
- type="text"
- @click="scope._self.$refs[scope.row.id].doClose()">取消</el-button>
- <el-button type="primary"
- size="mini"
- @click="removeDefaultClassesCycle(scope)">确定</el-button>
- </div>
- <el-button type="text"
- slot="reference">删除</el-button>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- </div>
- <!-- 课程类型新增弹窗 -->
- <el-dialog title="vip课程形式"
- class="courseMask"
- width="500px"
- :visible.sync="vipStatus">
- <el-form :model="vipStatusFrom"
- ref='vipStatus'>
- <el-form-item label="课程形式"
- prop='name'
- :label-width="formLabelWidth">
- <el-input v-model="vipStatusFrom.name"
- autocomplete="off"></el-input>
- </el-form-item>
- <el-form-item label="班级人数"
- prop="num"
- :label-width="formLabelWidth">
- <el-input v-model="vipStatusFrom.num"
- autocomplete="off"></el-input>
- </el-form-item>
- <el-form-item label="课程课时"
- prop="timer"
- :label-width="formLabelWidth">
- <!-- <el-input v-model="vipStatusFrom.timer"
- autocomplete="off"></el-input> -->
- <el-tag :key="tag"
- effect="dark"
- type="info"
- v-for="tag in dynamicTags"
- closable
- :disable-transitions="false"
- @close="handleClose(tag)">
- {{tag}}
- </el-tag>
- <el-input class="input-new-tag"
- v-if="inputVisible"
- v-model="inputValue"
- ref="saveTagInput"
- style="width:100px;"
- size="small"
- @keyup.enter.native="handleInputConfirm">
- </el-input>
- <el-button v-if="!inputVisible"
- class="button-new-tag"
- size="small"
- @click="showInput">+ 添加</el-button>
- <el-button v-if="inputVisible"
- class="button-new-tag"
- size="small"
- @click="handleInputConfirm">保存</el-button>
- </el-form-item>
- </el-form>
- <div slot="footer"
- class="dialog-footer">
- <el-button @click="closeVipStatus">取 消</el-button>
- <el-button type="primary"
- @click="addVipStatus">确 定</el-button>
- </div>
- </el-dialog>
- <!-- 周期循环新增弹窗 -->
- <el-dialog title="vip时间段"
- width="500px"
- :visible.sync="timerStatus">
- <el-form :model="vipTimerFrom"
- ref='timerStatus'>
- <el-form-item label="达到课时总数/次"
- prop='count'
- :label-width="formLabelWidth">
- <el-input v-model="vipTimerFrom.count"
- autocomplete="off"></el-input>
- </el-form-item>
- <el-form-item label="可排课时间段/月"
- prop="timer"
- :label-width="formLabelWidth">
- <el-input v-model="vipTimerFrom.timer"
- autocomplete="off"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer"
- class="dialog-footer">
- <el-button @click="timerStatus=false">取 消</el-button>
- <el-button type="primary"
- @click="addTimerStatus">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { vipGroupCategory, getDefaultClassesCycle, addVipGroupCategory, resetVipGroupCategory, removeVipGroupCategory, addDefaultClassesCycle, resetDefaultClassesCycle, removeDefaultClassesCycle } from "@/api/vipSeting"
- export default {
- data () {
- return {
- leftList: [],
- rightList: [],
- vipStatus: false, // 课程形态弹窗状态
- formLabelWidth: '120px',
- vipStatusFrom: {
- name: '',
- num: '',
- timer: [],
- isAdd: true,
- id: ''
- }, // 弹窗内容
- statusRemovevisible: false,
- timerStatus: false, //课程时间段弹窗状态
- vipTimerFrom: {
- count: '',
- timer: '',
- isAdd: true,
- id: ''
- },
- dynamicTags: [],
- inputVisible: false,
- inputValue: ''
- }
- },
- mounted () {
- this.getVipGroupCategoryList()
- this.getDefaultClassesCycle()
- },
- methods: {
- handleClose (tag) {
- this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
- },
- showInput () {
- this.inputVisible = true;
- this.$nextTick(_ => {
- this.$refs.saveTagInput.$refs.input.focus();
- });
- },
- handleInputConfirm () {
- let inputValue = this.inputValue;
- if (inputValue) {
- this.dynamicTags.push(inputValue);
- }
- this.inputVisible = false;
- this.inputValue = '';
- },
- getVipGroupCategoryList () {
- // 获取默认左边参数
- vipGroupCategory().then(res => {
- if (res.code == 200) {
- this.leftList = res.data;
- }
- })
- },
- getDefaultClassesCycle () {
- // 获取默认右边参数
- getDefaultClassesCycle().then(res => {
- this.rightList = res.data;
- })
- },
- // 新增分类
- addGroupCategory () {
- this.vipStatus = true;
- this.vipStatusFrom.isAdd = true;
- this.vipStatusFrom.id = '';
- this.vipStatusFrom.name = ''
- this.vipStatusFrom.num = ''
- this.dynamicTags = [];
- },
- closeVipStatus () {
- this.vipStatus = false;
- },
- addVipStatus () {
- // 点击添加后 发送请求单独添加=> 刷新列表
- // 判断是添加还是修改
- if (this.vipStatusFrom.isAdd) {
- // 添加
- addVipGroupCategory({
- name: this.vipStatusFrom.name,
- singleClassMinutes: this.dynamicTags.join(','),
- studentNum: this.vipStatusFrom.num
- }).then(res => {
- if (res.code == 200) {
- this.getVipGroupCategoryList();
- this.vipStatus = false;
- }
- })
- } else {
- // 修改
- resetVipGroupCategory({
- name: this.vipStatusFrom.name,
- singleClassMinutes: this.dynamicTags.join(','),
- studentNum: this.vipStatusFrom.num,
- id: this.vipStatusFrom.id
- }).then(res => {
- this.getVipGroupCategoryList();
- this.vipStatus = false;
- })
- }
- },
- resetGroupCategory (row) {
- // 修改课程形式
- this.vipStatus = true;
- this.vipStatusFrom.name = row.name;
- this.vipStatusFrom.timer = row.singleClassMinutes.split(',');
- this.dynamicTags = row.singleClassMinutes.split(',');
- this.vipStatusFrom.num = row.studentNum;
- this.vipStatusFrom.id = row.id;
- this.vipStatusFrom.isAdd = false;
- },
- removeGroupCategory (scope) {
- // 删除
- removeVipGroupCategory({
- id: scope.row.id
- }).then(res => {
- if (res.code == 200) {
- // scope._self.$refs[scope.$index].doClose();
- this.getVipGroupCategoryList();
- }
- })
- },
- // 新增时间段
- addVipTimer () {
- this.timerStatus = true;
- this.vipTimerFrom.isAdd = true;
- this.vipTimerFrom.id = '';
- },
- addTimerStatus () {
- // 点击添加后 发送请求单独添加=> 刷新列表
- // 判断是添加还是修改
- if (this.vipTimerFrom.isAdd) {
- // 添加
- addDefaultClassesCycle({
- organId: null,
- maxClassTimes: this.vipTimerFrom.count,
- month: this.vipTimerFrom.timer,
- }).then(res => {
- if (res.code == 200) {
- this.getDefaultClassesCycle();
- this.timerStatus = false;
- }
- })
- } else {
- // 修改
- resetDefaultClassesCycle({
- maxClassTimes: this.vipTimerFrom.count,
- month: this.vipTimerFrom.timer,
- id: this.vipTimerFrom.id
- }).then(res => {
- this.getDefaultClassesCycle();
- this.timerStatus = false;
- })
- }
- },
- resetTimerList (row) {
- this.timerStatus = true;
- this.vipTimerFrom.count = row.maxClassTimes;
- this.vipTimerFrom.timer = row.month;
- this.vipTimerFrom.id = row.id;
- this.vipTimerFrom.isAdd = false;
- },
- // 删除时间管理
- removeDefaultClassesCycle (scope) {
- removeDefaultClassesCycle({
- id: scope.row.id
- }).then(res => {
- if (res.code == 200) {
- scope._self.$refs[scope.row.id].doClose()
- this.getDefaultClassesCycle();
- }
- })
- },
- },
- watch: {
- vipStatus (val) {
- if (!val) {
- this.$refs['vipStatus'].resetFields();
- }
- },
- timerStatus (val) {
- if (!val) {
- this.$refs['timerStatus'].resetFields();
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .left {
- margin-right: 20px;
- }
- .listWrap {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
- </style>
- <style lang="scss">
- .courseMask {
- .el-tag.el-tag--info {
- margin-right: 4px;
- }
- }
- </style>
|