|
|
@@ -1,6 +1,5 @@
|
|
|
<template>
|
|
|
<div class="context">
|
|
|
- todo
|
|
|
<div class="panel">
|
|
|
<h5>{{pageTitle}}</h5>
|
|
|
</div>
|
|
|
@@ -9,43 +8,45 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="9">
|
|
|
<em>课程表模板名称:</em>
|
|
|
- <span>{{panel.name}}</span>
|
|
|
-<!-- <el-input v-model="panel.name" placeholder="请输入课程表模板名称"></el-input>-->
|
|
|
+ <el-input v-model="panel.name" placeholder="请输入课程表模板名称"></el-input>
|
|
|
</el-col>
|
|
|
+ <!-- 默认不通用-->
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</div>
|
|
|
<br>
|
|
|
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
|
|
- <el-tab-pane label="星期一" name="Monday"></el-tab-pane>
|
|
|
- <el-tab-pane label="星期二" name="Tuesday"></el-tab-pane>
|
|
|
- <el-tab-pane label="星期三" name="Wednesday"></el-tab-pane>
|
|
|
- <el-tab-pane label="星期四" name="Thursday"></el-tab-pane>
|
|
|
- <el-tab-pane label="星期五" name="Friday"></el-tab-pane>
|
|
|
- <el-tab-pane label="星期六" name="Saturday"></el-tab-pane>
|
|
|
- <el-tab-pane label="星期天" name="Sunday"></el-tab-pane>
|
|
|
+ <el-tab-pane label="星期一" name="1"></el-tab-pane>
|
|
|
+ <el-tab-pane label="星期二" name="2"></el-tab-pane>
|
|
|
+ <el-tab-pane label="星期三" name="3"></el-tab-pane>
|
|
|
+ <el-tab-pane label="星期四" name="4"></el-tab-pane>
|
|
|
+ <el-tab-pane label="星期五" name="5"></el-tab-pane>
|
|
|
+ <el-tab-pane label="星期六" name="6"></el-tab-pane>
|
|
|
+ <el-tab-pane label="星期天" name="7"></el-tab-pane>
|
|
|
</el-tabs>
|
|
|
<el-button class="seeTemp">预览模板</el-button>
|
|
|
<div class="table">
|
|
|
<el-table
|
|
|
- :data="tableData"
|
|
|
+ v-for="tab in tabs"
|
|
|
+ :data="tab.tableData"
|
|
|
+ v-if="tab.days == activeName"
|
|
|
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
|
|
|
prop="timeScope"
|
|
|
label="时间"
|
|
|
width="260px"
|
|
|
+ align="center"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-time-picker
|
|
|
is-range
|
|
|
- v-model="scope.row.timeScope"
|
|
|
+ v-model="scope.row.timeLong"
|
|
|
range-separator="至"
|
|
|
start-placeholder="开始时间"
|
|
|
end-placeholder="结束时间"
|
|
|
@@ -54,11 +55,12 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="name"
|
|
|
+ prop="ClassId"
|
|
|
label="课程"
|
|
|
+ align="center"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-select v-model="scope.row.vipType">
|
|
|
+ <el-select v-model="scope.row.ClassId">
|
|
|
<el-option
|
|
|
v-for="item in panel.options"
|
|
|
:key="item.value"
|
|
|
@@ -69,46 +71,47 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="Recovered"
|
|
|
+ prop="TopLimit"
|
|
|
label="预约名额"
|
|
|
+ align="center"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input-number v-model="scope.row.Recovered" :min="1" :max="9999" label=""></el-input-number>
|
|
|
+ <el-input-number v-model="scope.row.TopLimit" :min="1" :max="9999" label=""></el-input-number>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="Recovered"
|
|
|
+ prop="ConsumeHour"
|
|
|
label="消耗课时"
|
|
|
+ align="center"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input-number v-model="scope.row.Recovered" :min="1" :max="9999" label=""></el-input-number>
|
|
|
+ <el-input-number v-model="scope.row.ConsumeHour" :min="1" :max="9999"
|
|
|
+ label=""></el-input-number>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
<el-table-column
|
|
|
prop="Status"
|
|
|
label="操作"
|
|
|
width="100px"
|
|
|
+ align="center"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" class="red">删除</el-button>
|
|
|
+ <el-button type="text" class="red" @click="delRow(scope)">删除</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 class="rowBottom">
|
|
|
- <el-button type="primary">新增课表</el-button>
|
|
|
- <el-button type="primary">提交</el-button>
|
|
|
+ <el-button type="primary" @click="addRow">新增课表</el-button>
|
|
|
+ <!-- ID为0是新建,不为0是修改-->
|
|
|
+ <el-button type="primary" @click="confirmLessonTable" v-if="this.$route.query.id == 0">提交</el-button>
|
|
|
+ <el-button type="primary" @click="EditLessonTable" v-if="this.$route.query.id != 0">提交</el-button>
|
|
|
+ <em class="red wrning">
|
|
|
+ *所有操作提交后生效
|
|
|
+ </em>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <br>
|
|
|
+
|
|
|
|
|
|
<el-dialog title="增删课程会员" :visible.sync="dialogVisible">
|
|
|
<div class="dialogTitle">
|
|
|
@@ -128,7 +131,12 @@
|
|
|
<script>
|
|
|
import Global from '../Global.js'
|
|
|
import {
|
|
|
+ SttPlanBasicAdd,
|
|
|
+ SttPlanDetailListQuery,
|
|
|
+ SttPlanDetailBatchSave,
|
|
|
+ SttPlanBasicEdit,
|
|
|
testTable,
|
|
|
+ testTableLong,
|
|
|
testSelect
|
|
|
} from "../api/getApiRes";
|
|
|
|
|
|
@@ -141,7 +149,8 @@
|
|
|
dialogdata: [],
|
|
|
dialogValue: [],
|
|
|
temId: '',
|
|
|
- activeName: 'Monday',
|
|
|
+ activeName: '1',
|
|
|
+ tableData: [],
|
|
|
// panel 配置项目
|
|
|
panel: {
|
|
|
usercode: '',
|
|
|
@@ -175,21 +184,170 @@
|
|
|
total: 100,
|
|
|
pageIndex: 1,
|
|
|
},
|
|
|
- tableData: []
|
|
|
+ testRow: {
|
|
|
+ timeLong:[new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)],
|
|
|
+ BeginStr: '08:30',
|
|
|
+ EndStr: '09:30',
|
|
|
+ ClassId: 1,
|
|
|
+ TopLimit: 0,
|
|
|
+ ConsumeHour: 0,
|
|
|
+ },
|
|
|
+ tabs: [
|
|
|
+ {
|
|
|
+ tableData: [], days: '1'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tableData: [
|
|
|
+ // {name:'1'},
|
|
|
+ ], days: '2'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tableData: [], days: '3'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tableData: [], days: '4'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tableData: [], days: '5'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tableData: [], days: '6'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ tableData: [], days: '7'
|
|
|
+ },
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getTableQuery();
|
|
|
+ if (this.$route.query.id == 0) {
|
|
|
+ // 深拷贝赋初始值
|
|
|
+ this.deepValue();
|
|
|
+ } else {
|
|
|
+ // 读取赋值
|
|
|
+ this.getTableQuery();
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
- handleClick(){
|
|
|
- console.log(123);
|
|
|
+ // 删除
|
|
|
+ delRow(scope){
|
|
|
+ let delIndex = parseInt(scope.$index)
|
|
|
+ let curIndex = parseInt(this.activeName) -1;
|
|
|
+ this.tabs[curIndex].tableData.splice(delIndex, 1)
|
|
|
+ },
|
|
|
+ // 提交课程模板
|
|
|
+ confirmLessonTable() {
|
|
|
+ if (!this.panel.name) {
|
|
|
+ this.$message.error('模板名称不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.panel.name.length < 3) {
|
|
|
+ this.$message.error('模板名称不能小于3个字符');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.panel.name.length > 20) {
|
|
|
+ this.$message.error('模板名称不能大于20个字符');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let that = this;
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ planName: this.panel.name,
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ SttPlanBasicAdd(postdata).then(res => {
|
|
|
+ let json = res;
|
|
|
+ if (json.Code == 0) {
|
|
|
+ that.panel.tabId = json.Id;
|
|
|
+ console.log(json.Id);
|
|
|
+ } else {
|
|
|
+ that.$message.error(json.Memo);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 修改课程模板
|
|
|
+ EditLessonTable() {
|
|
|
+ let that = this;
|
|
|
+ // if (this.checkData()) {
|
|
|
+ // this.$message.error('数据内容不完整,请检查后重新输入');
|
|
|
+ // return false
|
|
|
+ // }
|
|
|
+ // 提交数据
|
|
|
+
|
|
|
+ let planRs = [];
|
|
|
+ let thisRow = {};
|
|
|
+ let timeLong = []
|
|
|
+ for (let i = 0; i < this.tabs.length; i++) {
|
|
|
+ for (let j = 0; j < this.tabs[i].tableData.length; j++) {
|
|
|
+ thisRow = this.tabs[i].tableData[j];
|
|
|
+ thisRow.PlanId = parseInt(this.$route.query.id);
|
|
|
+ thisRow.WeekDay = parseInt(i + 1);
|
|
|
+ thisRow.BeginStr = getHoursAndMin(thisRow.timeLong[0]);
|
|
|
+ thisRow.EndStr = getHoursAndMin(thisRow.timeLong[1]);
|
|
|
+ this.$delete(thisRow, 'Base');
|
|
|
+ this.$delete(thisRow, 'SpdId');
|
|
|
+ // this.$delete(thisRow, 'timeLong');
|
|
|
+ planRs.push(thisRow)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let res = JSON.stringify(planRs);
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ planId: this.$route.query.id,
|
|
|
+ planRs: res,
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ SttPlanDetailBatchSave(postdata).then(res => {
|
|
|
+ let json = res;
|
|
|
+ if (json.Code == 0) {
|
|
|
+ that.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '课程模板上传成功!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.getTableQuery();
|
|
|
+ } else {
|
|
|
+ that.$message.error(json.Memo);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 检查数据
|
|
|
+ checkData() {
|
|
|
+ // todo
|
|
|
+ let tableDate = this.tabs;
|
|
|
+ tableDate.map(function (item) {
|
|
|
+ console.log(item.tableData);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 新增一行
|
|
|
+ addRow() {
|
|
|
+ // 读取当前周几
|
|
|
+ let index = parseInt(this.activeName) - 1;
|
|
|
+ let rows = this.testRow;
|
|
|
+ let res = this.deepClone(rows);
|
|
|
+ this.tabs[index].tableData.push(res);
|
|
|
+ },
|
|
|
+ // 深拷贝赋初始值
|
|
|
+ deepValue() {
|
|
|
+ let that = this;
|
|
|
+ let valus = [
|
|
|
+ {BeginStr: '08:30', EndStr: '09:30', ClassId: 0, TopLimit: 0, ConsumeHour: 0},
|
|
|
+ ];
|
|
|
+ this.tabs.map(function (item) {
|
|
|
+ let res = that.deepClone(valus);
|
|
|
+ item.tableData = res;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ deepClone(obj) {
|
|
|
+ let _obj = JSON.stringify(obj),
|
|
|
+ objClone = JSON.parse(_obj);
|
|
|
+ return objClone
|
|
|
+ },
|
|
|
+ handleClick() {
|
|
|
},
|
|
|
changeWechat(e, row) {
|
|
|
- console.log(e);
|
|
|
- console.log(row);
|
|
|
+ // todo
|
|
|
this.$message.success('当前用户微信已可见');
|
|
|
- // this.$message.success('当前用户微信已不可见');
|
|
|
},
|
|
|
// 增删会员课程
|
|
|
lessonStudenChange() {
|
|
|
@@ -198,92 +356,48 @@
|
|
|
handleSelectionChange(val) {
|
|
|
this.multipleSelection = val;
|
|
|
},
|
|
|
- // 查询按钮
|
|
|
- query() {
|
|
|
- // this.getTableQuery();
|
|
|
- this.$message.success('查询完毕');
|
|
|
- },
|
|
|
// 页面数据查询
|
|
|
getTableQuery() {
|
|
|
let that = this;
|
|
|
- // this.getGetChildRegionSelect(0, 1);
|
|
|
that.loading = true;
|
|
|
- // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
|
|
|
let param = {
|
|
|
token: localStorage.token,
|
|
|
- supregionid: 0,//
|
|
|
- regionid: this.panel.regionid,//
|
|
|
- comid: 1,//
|
|
|
- tagname: that.panel.tagname,//标签名
|
|
|
- start: 1,//
|
|
|
- tableMax: 9999,//
|
|
|
+ planId: this.$route.query.id,//
|
|
|
};
|
|
|
+ this.panel.name = this.$route.query.name;
|
|
|
let postdata = qs.stringify(param);
|
|
|
- testTable(postdata).then(res => {
|
|
|
+ SttPlanDetailListQuery(postdata).then(res => {
|
|
|
let json = res;
|
|
|
+ let Rs = json.Rs
|
|
|
+ let bt = '';
|
|
|
+ let et = '';
|
|
|
if (json.Code == 0) {
|
|
|
that.loading = false;
|
|
|
- if (json.Rs) {
|
|
|
- that.allTableData = json.Rs;
|
|
|
- that.recordsTotal = json.Rs.length;
|
|
|
+ // 清掉上次的记录
|
|
|
+ for (let i = 0; i < that.tabs.length; i++) {
|
|
|
+ that.tabs[i].tableData = []
|
|
|
+ }
|
|
|
+ if (Rs) {
|
|
|
+ // 遍历分配
|
|
|
+ Rs.map(function (item) {
|
|
|
+ for (let i = 0; i < 7; i++) {
|
|
|
+ if (item.WeekDay == i) {
|
|
|
+ bt = new Date(2016, 9, 10, item.BeginStr.substr(0, 2), item.BeginStr.substr(3, 2));
|
|
|
+ et = new Date(2016, 9, 10, item.EndStr.substr(0, 2), item.EndStr.substr(3, 2));
|
|
|
+ item.timeLong = [bt, et];
|
|
|
+ that.tabs[i - 1].tableData.push(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
} 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();
|
|
|
- },
|
|
|
- // 自动排序
|
|
|
- sortChange(params) {
|
|
|
- console.log(params)
|
|
|
- },
|
|
|
- // 过滤时间
|
|
|
- filterFmtDate(value, row, column) {
|
|
|
- let that = this;
|
|
|
- return globalfmtDate(column, 11);
|
|
|
- },
|
|
|
},
|
|
|
watch: {
|
|
|
$route() {
|
|
|
@@ -386,7 +500,7 @@
|
|
|
margin-left: 10px;
|
|
|
}
|
|
|
|
|
|
- /deep/ .panel_control .el-input {
|
|
|
+ /deep/ .panel_control .el-input {
|
|
|
width: 200px;
|
|
|
float: left;
|
|
|
}
|
|
|
@@ -398,19 +512,23 @@
|
|
|
line-height: 45px;
|
|
|
margin-right: 10px;
|
|
|
}
|
|
|
+
|
|
|
.seeTemp {
|
|
|
position: relative;
|
|
|
float: right;
|
|
|
bottom: 60px;
|
|
|
}
|
|
|
+
|
|
|
.table {
|
|
|
position: relative;
|
|
|
top: -50px;
|
|
|
}
|
|
|
+
|
|
|
.el-range-editor.el-input__inner {
|
|
|
width: 220px;
|
|
|
padding: 3px 6px;
|
|
|
}
|
|
|
+
|
|
|
.rowBottom {
|
|
|
width: 100%;
|
|
|
overflow: hidden;
|
|
|
@@ -418,8 +536,13 @@
|
|
|
margin: 0 auto;
|
|
|
margin-top: 10px;
|
|
|
}
|
|
|
+
|
|
|
.rowBottom button {
|
|
|
float: left;
|
|
|
margin-right: 10px;
|
|
|
}
|
|
|
+ .wrning {
|
|
|
+ float: right;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
</style>
|