| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728 |
- <template>
- <div class="context">
- <div class="panel">
- <h5>课程管理
- </h5>
- <div class="panel-body">
- <div class="panel_control">
- <el-row :gutter="20">
- <el-date-picker
- v-model="panel.timeScope"
- type="daterange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- <el-col :span="4">
- <el-button size="" type="primary" @click="query" :disabled="serachBtnStatus" plain>查询
- </el-button>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- <div class="table">
- <el-table
- :data="tableData"
- border
- is-horizontal-resize
- :default-sort="{prop: 'date', order: 'descending'}"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- class=""
- @selection-change="handleSelectionChange"
- >
- >
- <el-table-column
- type="index"
- label="序号"
- align="center"
- width="50">
- </el-table-column>
- <el-table-column
- prop="BeginTime"
- label="上课时间"
- :formatter="filterFmtDate"
- >
- </el-table-column>
- <el-table-column
- prop="ClassName"
- label="课程"
- sortable
- >
- <template slot-scope="scope">
- <span class="lessonSpan"
- :style="{background:scope.row.ClassColor}">{{scope.row.ClassName}}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="ConsumeHour"
- label="消耗课时"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="OrderNum"
- label="实际预约人数"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="SvName"
- label="区域"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="FinishClass"
- label="当前状态"
- sortable
- >
- <template slot-scope="scope">
- <span v-if="scope.row.FinishClass == 0" style="color: red">未上课</span>
- <span v-if="scope.row.FinishClass == 1">已下课</span>
- <span v-if="scope.row.FinishClass == 2" style="color: yellowgreen">已上课</span>
- <span v-if="scope.row.FinishClass == 3">准备上课</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="Status"
- label="操作"
- >
- <template slot-scope="scope">
- <!--<el-button type="primary" round size="mini" @click="checkClassOverPrepare(scope.row)">-->
- <!--下课-->
- <!--</el-button>-->
- <el-button type="primary" round size="mini" v-if="scope.row.FinishClass == 0"
- @click="showDialogMemberVisible(scope.row)">
- 上课
- </el-button>
- <el-button type="primary" round size="mini"
- v-if="scope.row.FinishClass == 3 || scope.row.FinishClass == 2"
- @click="seeEdit(scope.row)"
- >
- 管理
- </el-button>
- <!--修改区域 todo-->
- <el-button type="primary" round plain size="mini" v-if="scope.row.FinishClass == 3"
- @click="changeShopVenue(scope.row)"
- >
- 编辑
- </el-button>
- <el-button type="primary" round plain size="mini" v-if="scope.row.FinishClass == 1"
- @click="seeDetail(scope.row)"
- >
- 详情
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <br>
- <el-pagination
- background
- :total="pageination.total"
- :page-size="pageination.pageItem"
- @current-change="pageChange"
- ></el-pagination>
- </div>
- <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="650px">
- <div class="dialogContent">
- <h5 class="classNames">{{className}}</h5>
- <div class="">
- <el-form ref="form" :model="form" label-width="160px">
- <el-form-item label="区域" :required="true">
- <el-select v-model="form.svId" filterable placeholder="请选择" @change="changeLocationValue">
- <el-option
- v-for="item in form.svList"
- :key="item.SvId"
- :label="item.Name"
- :value="item.SvId">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="类型" :required="true">
- <el-select v-model="form.classType" filterable placeholder="请选择">
- <el-option
- v-for="item in form.ClassTypeOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="组队方式" v-if="form.classType == 2">
- <el-select v-model="form.pkNum" filterable placeholder="请选择">
- <el-option
- v-for="item in form.PKTypeOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-form>
- </div>
- </div>
- <div class="dialogFooter">
- <el-button type="primary" size="small" v-if="form.btnType == 0" @click="getClassStartPrepare()">确定
- </el-button>
- <el-button type="primary" size="small" v-if="form.btnType == 1" @click="getClassStartPrepareForEdit()">
- 确定
- </el-button>
- <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import Global from '../Global.js'
- import {
- ClassPreFinishListQuery,
- ClassOverPrepare,
- ClassDetailQuery,
- QueryShopVenue,
- ClassStartPrepare,
- } from "../api/getApiRes";
- let qs = require('qs');
- export default {
- data() {
- return {
- dialogMemberVisible: false,
- serachBtnStatus: false,
- dialogVisible: false,//其他dialog
- dialogFinishVisible: false,//确认下课dialog
- dialogLesson: false,//课时调整
- dialogGift: false,//赠送课时调整
- dialogExpTime: false,//有效期调整
- dialogLessonTable: false,//会员课程
- dialogTitle: '上课准备',
- className: '',
- current: getNowDate(),
- dialogValue: [],
- // panel 配置项目
- panel: {
- usercode: '',
- username: '',
- compname: '',
- keyword: '',
- USERCODE: '',
- endType: '',
- taskstatus: 99,
- draw: 1,
- start: 0,
- recordsTotal: 0,
- tableData: [],
- allTableData: [],
- limit: '10',
- multipleSort: false,
- loading: false,
- fileList: [],
- multipleSelection: [],
- detectedmac: '',
- options: [
- {value: 99, label: '全部'},
- {value: 1, label: '进行中'},
- {value: 2, label: '已完成'},
- ],
- endTypeOptions: [
- {value: 99, label: '全部'},
- {value: 30, label: '近一个月'},
- {value: 7, label: '近一周'},
- {value: 1, label: '当日'},
- ],
- time1: globalBt(),
- timeScope: globalBt2(1),
- },
- multipleSelection: [],
- pageination: {
- pageItem: 100,
- pageoptions: pageOptions(),
- total: 100,
- pageIndex: 1,
- },
- form: {
- name: '',
- svId: '',
- svName: '',
- classType: 1,
- userCode: '',
- coach: '',
- coachOptions: [],
- shopId: '',
- memberType: 1,
- lesson: 1,
- gift: 1,
- pktype: 1,
- pkNum: 2,
- btnType: 0,//0新建,1编辑
- memo: '',
- expTime: '',
- StdId: '',
- svList: [],//区域列表
- dialogdata: [],//穿梭待选
- dialogValue: [],//穿梭已选
- ClassTypeOptions: [
- {value: 1, label: '团课'},
- {value: 2, label: '竞技PK'},
- {value: 3, label: '私教'},
- ],
- PKTypeOptions: [
- {value: 2, label: '2队PK'},
- {value: 3, label: '3队PK'},
- ],
- },
- memberTypes: [
- {value: 1, label: '年会员'},
- {value: 2, label: '充值会员'},
- ],
- tableData: []
- }
- },
- mounted() {
- this.getTableQuery();
- },
- methods: {
- // 更改上课区域
- changeShopVenue(row) {
- this.dialogMemberVisible = true;
- this.form.btnType = 1;//0新建,1编辑
- // 读取本行信息
- this.dialogMemberVisible = true;
- this.className = row.ClassName + ' ' + row.BeginStr + ' - ' + row.EndStr;
- this.form.StdId = row.StdId;
- this.getQueryShopVenue();
- this.form.svList = row.SvId;
- this.form.classType = row.ClassType;
- this.form.pkNum = row.PkNum;
- },
- // 准备上课
- getClassStartPrepare() {
- let that = this;
- if (!that.form.svId) {
- that.$message.error('上课区域不能为空');
- return false
- }
- // 不是竞技pk的时候为0
- let uppkNum = that.form.classType == 2 ? that.form.pkNum : 0;
- let param = {
- token: localStorage.token,
- stdId: that.form.StdId,
- svId: that.form.svId,
- svName: that.form.svName,
- classType: that.form.classType,
- pkNum: uppkNum,
- };
- let postdata = qs.stringify(param);
- console.log(that.form.BeginStr);
- return false
- ClassStartPrepare(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // NewId: 0
- that.dialogMemberVisible = false;
- this.getTableQuery();
- this.$router.push({
- path: '/courseEdit', query: {
- StdId: that.form.StdId,
- ClassName: that.form.ClassName,
- BeginStr: that.form.BeginStr,
- EndStr: that.form.EndStr,
- }
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 编辑
- getClassStartPrepareForEdit() {
- let that = this;
- if (!that.form.svId) {
- that.$message.error('上课区域不能为空');
- return false
- }
- // 不是竞技pk的时候为0
- let uppkNum = that.form.classType == 2 ? that.form.pkNum : 0;
- let param = {
- token: localStorage.token,
- stdId: that.form.StdId,
- svId: that.form.svId,
- svName: that.form.svName,
- classType: that.form.classType,
- pkNum: uppkNum,
- };
- let postdata = qs.stringify(param);
- ClassStartPrepare(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // NewId: 0
- that.dialogMemberVisible = false;
- this.getTableQuery();
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- seeDetail(row) {
- this.$router.push({
- path: '/classInfoDetail', query: {
- StdId: row.StdId,
- ClassName: row.ClassName,
- BeginStr: row.BeginStr,
- EndStr: row.EndStr,
- }
- });
- },
- seeEdit(row) {
- this.$router.push({
- path: '/courseEdit', query: {
- StdId: row.StdId,
- ClassName: row.ClassName,
- BeginStr: row.BeginStr,
- EndStr: row.EndStr,
- }
- });
- },
- // 获取select的label
- changeLocationValue(val) {
- //locations是v-for里面的也是datas里面的值
- let obj = {};
- obj = this.form.svList.find((item) => {
- return item.SvId === val;
- });
- this.form.svName = obj.Name;
- },
- // 获取区域列表
- getQueryShopVenue() {
- let that = this;
- let param = {
- key: localStorage.ServiceKey,
- shopId: localStorage.ServiceId,
- };
- let postdata = qs.stringify(param);
- QueryShopVenue(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.form.svList = json.Rs;
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- vipSelect(stdId) {
- let that = this;
- // 筛选相同的stdid的classId
- that.form.stdList.map(function (item) {
- if (item.value == stdId) {
- let param = {
- token: localStorage.token,
- // classId: item.classId
- };
- let postdata = qs.stringify(param);
- // VipUserListQuery
- VipUserSimpleQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.form.userId = '';
- that.form.userList = turnResToOptionBySimViper(json.Rs);
- } else {
- that.$message.error(json.Memo);
- }
- })
- }
- })
- },
- showDialogMemberVisible(row) {
- this.dialogMemberVisible = true;
- this.form.btnType = 0;//0新建,1编辑编辑
- // clear
- this.form.svList = "";
- this.form.classType = 1;
- this.form.pkNum = "";
- this.className = row.ClassName + ' ' + row.BeginStr + ' - ' + row.EndStr;
- this.form.StdId = row.StdId;
- this.getQueryShopVenue();
- },
- // 检测当前课是否处于可改变状态
- // 固定下当前已预约人数列表
- checkClassOverPrepare(row) {
- let that = this;
- let param = {
- token: localStorage.token,
- stdId: row.StdId,
- };
- let postdata = qs.stringify(param);
- ClassOverPrepare(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.goFinish(row);
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- goFinish(row) {
- this.$router.push({
- path: '/finishDetail', query: {
- id: row.StdId,
- classId: row.ClassId,
- ClassName: row.ClassName,
- BeginTime: row.BeginTime,
- }
- });
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- // 查询按钮
- query() {
- let that = this;
- that.serachBtnStatus = true;
- let totalTime = 2;
- let clock = window.setInterval(() => {
- totalTime--;
- if (totalTime < 0) {
- totalTime = 2;
- that.serachBtnStatus = false;
- }
- }, 1000);
- this.getTableQuery();
- this.$message.success('查询完毕');
- },
- // 页面数据查询
- getTableQuery() {
- let that = this;
- that.loading = true;
- let param = {
- token: localStorage.token,
- tagname: that.panel.tagname,//标签名
- bt: nonTfmtDatetoLength(that.panel.timeScope[0], 10) + " 00:00:00",
- et: nonTfmtDatetoLength(that.panel.timeScope[1], 10) + " 23:59:59",
- start: 1,//
- tableMax: 9999,//
- };
- let postdata = qs.stringify(param);
- ClassDetailQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.loading = false;
- if (json.Rs) {
- that.allTableData = json.Rs;
- that.recordsTotal = json.Rs.length;
- } else {
- that.allTableData = [];
- that.recordsTotal = 0;
- }
- // 设置分页数据
- that.setPaginations();
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 设置分页数据
- setPaginations() {
- // 分页属性
- let that = this;
- that.pageination.total = that.recordsTotal;
- // 默认分页
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- },
- // 每页显示数量
- handleSizeChange() {
- let that = this;
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- that.draw = that.pageination.pageItem;
- // that.getTableQuery();
- },
- // 翻页
- pageChange(pageIndex) {
- let that = this;
- // 获取当前页
- let index = that.pageination.pageItem * (pageIndex - 1);
- // 数据总数
- let nums = that.pageination.pageItem * pageIndex;
- // 容器
- let tables = [];
- for (var i = index; i < nums; i++) {
- if (that.allTableData[i]) {
- tables.push(that.allTableData[i])
- }
- this.tableData = tables;
- }
- that.start = index * that.draw;
- // that.getTableQuery();
- },
- // 过滤时间
- filterFmtDate(value, row, column) {
- let that = this;
- return nonTfmtDate(column, 11);
- },
- },
- watch: {
- $route(to) {
- if (to.name == 'finish') {
- this.getTableQuery();
- }
- },
- },
- }
- </script>
- <style scoped>
- @import "../assets/css/panel.css";
- .context {
- height: 770px;
- overflow-y: scroll;
- display: block;
- margin: 0 auto;
- background-color: #fff !important;
- padding: 30px;
- }
- .panel-body {
- padding: 20px;
- background: #F0F2F5;
- }
- .change {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- padding-top: 10px;
- padding-bottom: 10px;
- }
- .change button {
- float: left;
- }
- .change button.pull-right {
- float: right;
- }
- .dialogTitle {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- color: #000000;
- font-size: 18px;
- text-align: center;
- }
- .dialogTitle em {
- float: none;
- font-style: normal;
- color: #3799FF;
- margin: 0;
- }
- /deep/ .el-transfer-panel__item .el-checkbox__input {
- left: 40px;
- }
- .dialogFooter {
- width: 90%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-top: 10px;
- }
- .dialogFooter button {
- float: right;
- margin-left: 10px;
- }
- .dialogContent {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .dialogContent .pull-left {
- width: 30%;
- float: left;
- }
- .dialogContent .pull-right {
- width: 70%;
- float: right;
- }
- .blueTitle {
- width: 200px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-top: 10px;
- margin-bottom: 40px;
- background: #F0F2F5;
- border-radius: 19px;
- text-align: center;
- color: #3799FF;
- font-size: 16px;
- padding: 5px 24px;
- }
- .current {
- width: 158px;
- height: 23px;
- /*float: left;*/
- border-radius: 250px;
- text-align: center;
- background: #F0F2F5;
- color: #545454;
- font-size: 14px;
- padding: 3px 10px;
- margin-left: 20px;
- }
- .lessonSpan {
- width: 78px;
- height: 22px;
- border-radius: 11px;
- margin-right: 5px;
- float: left;
- margin-bottom: 3px;
- text-align: center;
- color: #000;
- font-size: 12px;
- }
- .classNames {
- width: 211px;
- height: 25px;
- background: #f0f2f5;
- font-family: "Source Han Sans CN";
- font-weight: normal;
- font-size: 16px;
- color: #3799ff;
- border-radius: 250px;
- text-align: center;
- margin: 0 auto;
- margin-bottom: 10px;
- }
- /deep/ .el-date-editor .el-range-separator {
- line-height: 25px;
- }
- </style>
|