|
|
@@ -12,30 +12,39 @@
|
|
|
</em>
|
|
|
<el-input v-model="panel.name" placeholder="请输入课程表名称" :disabled="panel.inputState"/>
|
|
|
</el-col>
|
|
|
- <el-col :span="5" v-if="!panel.inputState">
|
|
|
+ <el-col :span="5">
|
|
|
<em>
|
|
|
<span style="color: red">*</span> 课程表时间:
|
|
|
</em>
|
|
|
- <el-date-picker
|
|
|
- v-model="panel.week" type="week" :picker-options="{ 'firstDayOfWeek': 1 }"
|
|
|
- format="yyyy 第 WW 周" placeholder="选择周"/>
|
|
|
+ <el-date-picker v-model="panel.week" type="week" :picker-options="{ 'firstDayOfWeek': 1 }"
|
|
|
+ @change="changeWeek()"
|
|
|
+ format="yyyy 第 WW 周" placeholder="选择周" :disabled="panel.inputState"/>
|
|
|
</el-col>
|
|
|
- <el-button type="default" class="seeTemp" @click="$router.push('/lessonManage')">返回课程表</el-button>
|
|
|
+ <el-button type="default" class="seeTemp" @click="$router.push('/lessonTableManage')">返回课程表</el-button>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</div>
|
|
|
<br/>
|
|
|
- <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
|
|
- <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>
|
|
|
-
|
|
|
- <!--todo 读取后台保存状态,新保存后不跳走-->
|
|
|
+
|
|
|
+ <el-row :gutter="1">
|
|
|
+ <el-col :span="10">
|
|
|
+ <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
|
|
+ <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-col>
|
|
|
+ <el-col :span="3">
|
|
|
+ <em v-if="activeDate">
|
|
|
+ <span style="height: 40px;line-height: 40px">当前选中日期: {{ activeDate }} </span>
|
|
|
+ </em>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
<div class="table">
|
|
|
<el-table v-for="tab in tabs" :data="tab.tableData" v-if="tab.days == activeName" border
|
|
|
is-horizontal-resize :default-sort="{ prop: 'date', order: 'descending' }"
|
|
|
@@ -44,39 +53,39 @@
|
|
|
<el-table-column prop="timeScope" label="时间" width="230px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-time-picker is-range v-model="scope.row.timeLong" range-separator="至" start-placeholder="开始时间"
|
|
|
- end-placeholder="结束时间" placeholder="选择时间范围" :readonly="scope.row.Locking == 1"
|
|
|
- ></el-time-picker>
|
|
|
+ end-placeholder="结束时间" placeholder="选择时间范围" :readonly="scope.row.locking == 1"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="ClassId" label="课程" align="center">
|
|
|
+ <el-table-column prop="class_id" label="课程" align="center">
|
|
|
<!--locking是1的不可编辑课程和时间-->
|
|
|
<template slot-scope="scope">
|
|
|
- <el-select v-model="scope.row.ClassId" @change="getRowTop(scope.row)" :disabled="scope.row.Locking == 1">
|
|
|
+ <el-select v-model="scope.row.class_id" @change="getLessonInfo(scope.row)"
|
|
|
+ :disabled="scope.row.locking == 1">
|
|
|
<el-option v-for="item in panel.options" :key="item.value" :label="item.label" :value="item.value"/>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="OrderToplimit" label="预约名额" align="center">
|
|
|
+ <el-table-column prop="order_toplimit" label="预约名额" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input-number v-model="scope.row.OrderToplimit" :min="1" :max="9999" label/>
|
|
|
+ <el-input-number v-model="scope.row.order_toplimit" :min="1" :max="9999" label/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="ConsumeHour" label="消耗课时" align="center">
|
|
|
+ <el-table-column prop="consume_hour" label="消耗课时" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input-number v-model="scope.row.ConsumeHour" :min="0" :max="9999" label/>
|
|
|
+ <el-input-number v-model="scope.row.consume_hour" :min="0" :max="9999" label/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="Status" label="操作" width="150px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button type="text" class="gary" @click="lessonRowEdit(scope)">编辑</el-button>
|
|
|
- <el-button type="text" class="red" @click="delRow(scope)">删除</el-button>
|
|
|
+ <el-button type="text" class="red" @click="lessonRowDelete(scope)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<div class="rowBottom">
|
|
|
- <el-button type="default" @click="$router.push('/lessonManage')">返回课程表</el-button>
|
|
|
+ <el-button type="default" @click="$router.push('/lessonTableManage')">返回课程表</el-button>
|
|
|
<!--ID为0是新建,不为0是修改-->
|
|
|
- <el-button type="primary" class="pull-right" @click="confirmLessonTable"
|
|
|
+ <el-button type="primary" class="pull-right" @click="confirmAddLessonTable"
|
|
|
v-if="this.$route.query.id == 0" :disabled="searchBtnStatus">提交
|
|
|
</el-button>
|
|
|
<el-button type="primary" class="pull-right" @click="confirmEditLessonTable"
|
|
|
@@ -99,7 +108,7 @@
|
|
|
<div style="margin-left: -40px">
|
|
|
<el-form-item label="微信可见" style="float: left;">
|
|
|
<el-switch
|
|
|
- v-model="form.wxVisible"
|
|
|
+ v-model="form.wx_visible"
|
|
|
:active-value="1"
|
|
|
:inactive-value="0"
|
|
|
active-color="#409EFF"
|
|
|
@@ -108,9 +117,9 @@
|
|
|
</el-switch>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="是否拼课" style="float: left;">
|
|
|
+ <el-form-item label="开放预约" style="float: left;">
|
|
|
<el-switch
|
|
|
- v-model="form.isClassGroup"
|
|
|
+ v-model="form.wx_order"
|
|
|
:active-value="1"
|
|
|
:inactive-value="0"
|
|
|
active-color="#409EFF"
|
|
|
@@ -119,9 +128,9 @@
|
|
|
</el-switch>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="开放预约">
|
|
|
+ <el-form-item label="是否拼课">
|
|
|
<el-switch
|
|
|
- v-model="form.wxOrder"
|
|
|
+ v-model="form.is_classgroup"
|
|
|
:active-value="1"
|
|
|
:inactive-value="0"
|
|
|
active-color="#409EFF"
|
|
|
@@ -130,19 +139,24 @@
|
|
|
</el-switch>
|
|
|
</el-form-item>
|
|
|
|
|
|
+ <span v-if="form.is_classgroup">
|
|
|
+ <el-form-item label="最小拼课人数">
|
|
|
+ <el-input-number v-model="form.order_minilimit" :min="0" :max="99999" label="(天)"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="拼课截止时间" :required="true">
|
|
|
- <el-date-picker v-model="form.lastLesson" type="date" placeholder="选择日期">
|
|
|
- </el-date-picker>
|
|
|
+ <el-date-picker v-model="form.last_classon" type="datetime" placeholder="选择日期时间" align="right"
|
|
|
+ :picker-options="pickerOptions"/>
|
|
|
</el-form-item>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="float:right;">
|
|
|
- <h4 align="left">课程设置</h4>
|
|
|
+ <h4>课程设置</h4>
|
|
|
<hr/>
|
|
|
<div style="margin-left: -30px">
|
|
|
<el-form-item label="心率课" style="float: left">
|
|
|
<el-switch
|
|
|
- v-model="form.isHr"
|
|
|
+ v-model="form.is_hr"
|
|
|
:active-value="1"
|
|
|
:inactive-value="0"
|
|
|
active-color="#409EFF"
|
|
|
@@ -152,7 +166,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="评分课" style="float: left">
|
|
|
<el-switch
|
|
|
- v-model="form.isScore"
|
|
|
+ v-model="form.is_score"
|
|
|
:active-value="1"
|
|
|
:inactive-value="0"
|
|
|
active-color="#409EFF"
|
|
|
@@ -160,18 +174,19 @@
|
|
|
style="z-index: 1">
|
|
|
</el-switch>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="最小人数">
|
|
|
- <el-input-number v-model="form.orderMiniLimit" :min="0" :max="99999" label="(天)"></el-input-number>
|
|
|
- </el-form-item>
|
|
|
+
|
|
|
<el-form-item label="课程类型" :required="true">
|
|
|
- <el-select v-model="form.courseType" type="date" placeholder="选择日期">
|
|
|
+ <el-select style="width: 180px" v-model="form.course_type" align="left">
|
|
|
+ <el-option v-for="item in courseOptions" :key="item.value" :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-form>
|
|
|
- <div class="dialogFooter" >
|
|
|
- <el-button type="primary" size="small">确定</el-button>
|
|
|
+ <div class="dialogFooter">
|
|
|
+ <el-button type="primary" @click="confirmEditRow()" size="small">确定</el-button>
|
|
|
<el-button @click="dialogLessonVisable = false" size="small">取消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
@@ -180,14 +195,10 @@
|
|
|
|
|
|
<script>
|
|
|
import Global from '../../Global.js'
|
|
|
+
|
|
|
import {
|
|
|
- STTBasicAdd,
|
|
|
- STTDetailListQuery,
|
|
|
- STTDetailBatchSave,
|
|
|
- ClassListQuery,
|
|
|
- STTDetailAllowDelCheck,
|
|
|
- ClassDetailOne
|
|
|
-} from "../../api/getApiRes";
|
|
|
+ StandardRequest
|
|
|
+} from "@/grpc/base_pb";
|
|
|
|
|
|
let qs = require('qs');
|
|
|
export default {
|
|
|
@@ -195,20 +206,23 @@ export default {
|
|
|
return {
|
|
|
pageTitle: '新增课程表',
|
|
|
dialogLessonVisable: false,
|
|
|
- dialogdata: [],
|
|
|
- dialogValue: [],
|
|
|
temId: '',
|
|
|
activeName: '1',
|
|
|
+ activeDate: '',
|
|
|
tableData: [],
|
|
|
+ pickerOptions: {
|
|
|
+ shortcuts: [
|
|
|
+ {
|
|
|
+ text: '今天',
|
|
|
+ onClick(picker) {
|
|
|
+ picker.$emit('pick', new Date());
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ },
|
|
|
// panel 配置项目
|
|
|
panel: {
|
|
|
inputState: false,
|
|
|
name: '',
|
|
|
- usercode: '',
|
|
|
- username: '',
|
|
|
- compname: '',
|
|
|
- keyword: '',
|
|
|
- USERCODE: '',
|
|
|
week: '',
|
|
|
taskstatus: 99,
|
|
|
draw: 1,
|
|
|
@@ -221,7 +235,6 @@ export default {
|
|
|
loading: false,
|
|
|
fileList: [],
|
|
|
multipleSelection: [],
|
|
|
- detectedmac: '',
|
|
|
options: [],
|
|
|
time1: globalBt(),
|
|
|
},
|
|
|
@@ -234,13 +247,20 @@ export default {
|
|
|
},
|
|
|
testRow: {
|
|
|
timeLong: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 23, 59)],
|
|
|
- BeginStr: '08:30',
|
|
|
- EndStr: '23:59',
|
|
|
- ClassId: '',
|
|
|
- OrderToplimit: 1,
|
|
|
- ConsumeHour: 1,
|
|
|
- WxOrder: 1,
|
|
|
- WxVisible: 0,
|
|
|
+ begin_str: '08:30',
|
|
|
+ end_str: '23:59',
|
|
|
+ class_id: '',
|
|
|
+ order_toplimit: 10,
|
|
|
+ consume_hour: 2,
|
|
|
+ wx_visible: 1,
|
|
|
+ wx_order: 1,
|
|
|
+ is_score: 0,
|
|
|
+ is_hr: 1,
|
|
|
+ course_type: 1,
|
|
|
+ is_classgroup: 0,
|
|
|
+ order_minilimit: 0,
|
|
|
+ last_classon: getDate(new Date(), 0, 0, 0),
|
|
|
+ curr_date: getDate(new Date(), 0, 0, 0)
|
|
|
},
|
|
|
tabs: [
|
|
|
{
|
|
|
@@ -266,78 +286,132 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
form: {
|
|
|
- wxVisible: 0,
|
|
|
- isClassGroup: 0,
|
|
|
- wxOrder: 0,
|
|
|
- orderMiniLimit: 0,
|
|
|
- lastLesson: 0,
|
|
|
- isHr: 0,
|
|
|
- courseType: 0
|
|
|
+ wx_visible: 0,
|
|
|
+ wx_order: 0,
|
|
|
+ is_score: 0,
|
|
|
+ is_hr: 0,
|
|
|
+ course_type: 1,
|
|
|
+ is_classgroup: 0,
|
|
|
+ order_minilimit: 0,
|
|
|
+ last_classon: '',
|
|
|
+ curr_date: ''
|
|
|
},
|
|
|
searchBtnStatus: false,
|
|
|
+ courseOptions: courseOptions()
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
// 加载课程选项
|
|
|
this.panelSelect();
|
|
|
if (parseInt(this.$route.query.id) == 0) {
|
|
|
- // 深拷贝赋初始值
|
|
|
+ console.log('新增课程表');
|
|
|
this.pageTitle = '新增课程表'
|
|
|
this.deepValue();
|
|
|
this.panel.name = '';
|
|
|
this.panel.week = '';
|
|
|
this.panel.inputState = false
|
|
|
} else {
|
|
|
- // 读取赋值
|
|
|
+ console.log('编辑课程表');
|
|
|
this.pageTitle = '编辑课程表'
|
|
|
this.getTableQuery();
|
|
|
- this.panel.inputState = true
|
|
|
+ this.panel.inputState = true;
|
|
|
+ this.activeDate = getDate(this.panel.week, 0, 0, parseInt(this.activeName) - 2);
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ $route(to) {
|
|
|
+ if (to.name == 'lessonTableManageEdit') {
|
|
|
+ this.temId = this.$route.query.id;
|
|
|
+ console.log('新增课程表');
|
|
|
+ this.panelSelect();
|
|
|
+ if (parseInt(this.temId) == 0) {
|
|
|
+ this.pageTitle = '新增课程表'
|
|
|
+ this.deepValue();
|
|
|
+ this.panel.name = '';
|
|
|
+ this.panel.week = '';
|
|
|
+ this.panel.inputState = false
|
|
|
+ } else {
|
|
|
+ this.pageTitle = '编辑课程表'
|
|
|
+ this.panel.week = '';
|
|
|
+ this.getTableQuery();
|
|
|
+ this.panel.inputState = true
|
|
|
+ this.activeDate = getDate(this.panel.week, 0, 0, parseInt(this.activeName) - 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ changeWeek() {
|
|
|
+ let that = this;
|
|
|
+ if (that.panel.week != '') {
|
|
|
+ that.activeDate = getDate(that.panel.week, 0, 0, parseInt(that.activeName) - 2);
|
|
|
+ console.log(that.activeDate);
|
|
|
+ }
|
|
|
+ },
|
|
|
// 加载选项
|
|
|
panelSelect() {
|
|
|
let that = this;
|
|
|
- let param = {
|
|
|
- token: localStorage.token,
|
|
|
- vipType: '',
|
|
|
+ const jsonStr = {
|
|
|
+ shopId: localStorage.shopId,
|
|
|
+ classType: 1,
|
|
|
start: 1,
|
|
|
- expDay: 0,
|
|
|
tableMax: 9999,
|
|
|
};
|
|
|
- let postdata = qs.stringify(param);
|
|
|
- ClassListQuery(postdata).then(res => {
|
|
|
- let json = res;
|
|
|
- if (json.Code == 0) {
|
|
|
- // that.dialogdata = json.Rs;
|
|
|
- if (json.Rs == null) return false
|
|
|
- that.panel.options = turnClassResToOption(json.Rs)
|
|
|
- console.log(that.panel.options);
|
|
|
+
|
|
|
+ let paraRequest = new StandardRequest();
|
|
|
+ paraRequest.setShopid(localStorage.shopId);
|
|
|
+ paraRequest.setJsonstr(JSON.stringify(jsonStr));
|
|
|
+ paraRequest.setSign(getSignStr(jsonStr));
|
|
|
+ console.log(paraRequest);
|
|
|
+ that.client.classQuery(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
|
|
|
+ if (err == null) {
|
|
|
+ console.log(StandardReply.getJsonrst());
|
|
|
+ let res = JSON.parse(StandardReply);
|
|
|
+ if (res.code === 0) {
|
|
|
+ if (res.rs != null) {
|
|
|
+ that.panel.options = turnClassResToOption(res.rs)
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ that.$message.error(res.memo + ',错误代码:' + res.code);
|
|
|
+ }
|
|
|
} else {
|
|
|
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
|
|
|
+ let res = err;
|
|
|
+ that.$message.error(res.message + ',错误代码:' + res.code);
|
|
|
+ console.log(res);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
// 选择课程后,获取当前课程的建议上课人数和课时消耗
|
|
|
- getRowTop(row) {
|
|
|
+ getLessonInfo(row) {
|
|
|
let that = this;
|
|
|
- console.log(row);
|
|
|
- let param = {
|
|
|
- token: localStorage.token,
|
|
|
- classId: row.ClassId,
|
|
|
+ const jsonStr = {
|
|
|
+ shopId: localStorage.shopId,
|
|
|
+ classId: row.class_id
|
|
|
};
|
|
|
- let postdata = qs.stringify(param);
|
|
|
- ClassDetailOne(postdata).then(res => {
|
|
|
- let json = res;
|
|
|
- if (json.Code == 0) {
|
|
|
- row.OrderToplimit = json.Rs.TopLimit;
|
|
|
- row.ConsumeHour = json.Rs.ConsumeHour;
|
|
|
- // row.WxOrder = json.Rs.WxOrder; //不支持联动
|
|
|
- row.WxVisible = json.Rs.WxVisible;
|
|
|
+ let paraRequest = new StandardRequest();
|
|
|
+ paraRequest.setShopid(localStorage.shopId);
|
|
|
+ paraRequest.setJsonstr(JSON.stringify(jsonStr));
|
|
|
+ paraRequest.setSign(getSignStr(jsonStr));
|
|
|
+ console.log(paraRequest);
|
|
|
+ that.client.classSimpleQuery(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
|
|
|
+ if (err == null) {
|
|
|
+ console.log(StandardReply.getJsonrst());
|
|
|
+ let res = JSON.parse(StandardReply);
|
|
|
+ if (res.code === 0) {
|
|
|
+ row.order_toplimit = res.rs[0].top_limit;
|
|
|
+ row.consume_hour = res.rs[0].consume_hour;
|
|
|
+ row.wx_visible = res.rs[0].wx_visible;
|
|
|
+ } else {
|
|
|
+ that.$message.error(res.memo + ',错误代码:' + res.code);
|
|
|
+ }
|
|
|
} else {
|
|
|
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
|
|
|
+ let res = err;
|
|
|
+ that.$message.error(res.message + ',错误代码:' + res.code);
|
|
|
+ console.log(res);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
confirmEditLessonTable() {
|
|
|
let id = this.$route.query.id
|
|
|
@@ -345,36 +419,46 @@ export default {
|
|
|
this.EditLessonTable(id);
|
|
|
},
|
|
|
// 删除
|
|
|
- delRow(scope) {
|
|
|
- if (!scope.row.StdId) {
|
|
|
+ lessonRowDelete(scope) {
|
|
|
+ if (!scope.row.std_id) {
|
|
|
let delIndex = parseInt(scope.$index)
|
|
|
let curIndex = parseInt(this.activeName) - 1;
|
|
|
this.tabs[curIndex].tableData.splice(delIndex, 1)
|
|
|
} else {
|
|
|
- this.checkCannotDel(scope)
|
|
|
+ this.checkDelRow(scope)
|
|
|
}
|
|
|
},
|
|
|
// 检测课表中课程可否删除
|
|
|
- checkCannotDel(scope) {
|
|
|
+ checkDelRow(scope) {
|
|
|
let that = this;
|
|
|
- let param = {
|
|
|
- token: localStorage.token,
|
|
|
- stdId: scope.row.StdId,
|
|
|
+ const jsonStr = {
|
|
|
+ UUStdId: scope.row.uu_std_id
|
|
|
};
|
|
|
- let postdata = qs.stringify(param);
|
|
|
- STTDetailAllowDelCheck(postdata).then(res => {
|
|
|
- let json = res;
|
|
|
- if (json.Code == 0) {
|
|
|
- let delIndex = parseInt(scope.$index)
|
|
|
- let curIndex = parseInt(this.activeName) - 1;
|
|
|
- this.tabs[curIndex].tableData.splice(delIndex, 1)
|
|
|
+ let paraRequest = new StandardRequest();
|
|
|
+ paraRequest.setShopid(localStorage.shopId);
|
|
|
+ paraRequest.setJsonstr(JSON.stringify(jsonStr));
|
|
|
+ paraRequest.setSign(getSignStr(jsonStr));
|
|
|
+ console.log(paraRequest);
|
|
|
+ that.client.sTTDetailAllowDelCheck(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
|
|
|
+ if (err == null) {
|
|
|
+ console.log(StandardReply.getJsonrst());
|
|
|
+ let res = JSON.parse(StandardReply);
|
|
|
+ if (res.code === 0) {
|
|
|
+ let delIndex = parseInt(scope.$index)
|
|
|
+ let curIndex = parseInt(this.activeName) - 1;
|
|
|
+ this.tabs[curIndex].tableData.splice(delIndex, 1)
|
|
|
+ } else {
|
|
|
+ that.$message.error(res.memo + ',错误代码:' + res.code);
|
|
|
+ }
|
|
|
} else {
|
|
|
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
|
|
|
+ let res = err;
|
|
|
+ that.$message.error(res.message + ',错误代码:' + res.code);
|
|
|
+ console.log(res);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
// 提交课程
|
|
|
- confirmLessonTable() {
|
|
|
+ confirmAddLessonTable() {
|
|
|
if (!this.panel.name) {
|
|
|
this.$message.error('名称不能为空');
|
|
|
return false
|
|
|
@@ -403,23 +487,34 @@ export default {
|
|
|
}
|
|
|
}, 1000)
|
|
|
|
|
|
-
|
|
|
- let param = {
|
|
|
- token: localStorage.token,
|
|
|
+ const jsonStr = {
|
|
|
+ shopId: localStorage.shopId,
|
|
|
name: this.panel.name,
|
|
|
- incomingDate: nonTfmtDatetoLength(this.panel.week, 10),//对应日期 字符串 年-月-日 格式,
|
|
|
+ incomingDate: nonTfmtDatetoLength(this.panel.week, 10)//对应日期 字符串 年-月-日 格式
|
|
|
};
|
|
|
- let postdata = qs.stringify(param);
|
|
|
- STTBasicAdd(postdata).then(res => {
|
|
|
- let json = res;
|
|
|
- if (json.Code == 0) {
|
|
|
- that.panel.tabId = json.Id;
|
|
|
- // 提交课程内容
|
|
|
- that.EditLessonTable(json.Id);
|
|
|
+
|
|
|
+ let paraRequest = new StandardRequest();
|
|
|
+ paraRequest.setShopid(localStorage.shopId);
|
|
|
+ paraRequest.setJsonstr(JSON.stringify(jsonStr));
|
|
|
+ paraRequest.setSign(getSignStr(jsonStr));
|
|
|
+ console.log(paraRequest);
|
|
|
+ that.client.sTTBasicAdd(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
|
|
|
+ if (err == null) {
|
|
|
+ console.log(StandardReply.getJsonrst());
|
|
|
+ let res = JSON.parse(StandardReply);
|
|
|
+ if (res.code === 0) {
|
|
|
+ that.panel.tabId = res.newid;
|
|
|
+ // 提交课程内容
|
|
|
+ that.EditLessonTable(res.newid);
|
|
|
+ } else {
|
|
|
+ that.$message.error(res.memo + ',错误代码:' + res.code);
|
|
|
+ }
|
|
|
} else {
|
|
|
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
|
|
|
+ let res = err;
|
|
|
+ that.$message.error(res.message + ',错误代码:' + res.code);
|
|
|
+ console.log(res);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
// 保存课程
|
|
|
EditLessonTable(planId) {
|
|
|
@@ -434,54 +529,65 @@ export default {
|
|
|
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.LessonIndex = parseInt(j + 1);
|
|
|
+ thisRow.lesson_index = parseInt(j + 1);
|
|
|
if (planId) {
|
|
|
- thisRow.StbId = parseInt(planId);
|
|
|
+ thisRow.stb_id = parseInt(planId);
|
|
|
} else {
|
|
|
- thisRow.StbId = parseInt(this.$route.query.id);
|
|
|
+ thisRow.stb_id = parseInt(this.$route.query.id);
|
|
|
}
|
|
|
- thisRow.WeekDay = parseInt(i + 1);
|
|
|
- thisRow.BeginStr = getHoursAndMin(thisRow.timeLong[0]);
|
|
|
- thisRow.EndStr = getHoursAndMin(thisRow.timeLong[1]);
|
|
|
- thisRow.StdId = thisRow.StdId ? thisRow.StdId : 0;
|
|
|
+ thisRow.std_id = thisRow.std_id ? thisRow.std_id : 0;
|
|
|
+ thisRow.week_day = parseInt(i + 1);
|
|
|
+ thisRow.begin_str = getHoursAndMin(thisRow.timeLong[0]);
|
|
|
+ thisRow.end_str = getHoursAndMin(thisRow.timeLong[1]);
|
|
|
+ console.log(thisRow.last_classon, thisRow.curr_date);
|
|
|
+ thisRow.last_classon = nonTfmtDate(thisRow.last_classon);
|
|
|
+ thisRow.curr_date = nonTfmtDate(thisRow.curr_date).toString().substring(0, 10);
|
|
|
this.$delete(thisRow, 'Base');
|
|
|
this.$delete(thisRow, 'SpdId');
|
|
|
planRs.push(thisRow);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- let res = JSON.stringify(planRs);
|
|
|
- // 如果传入0就用url里的,如果非0就用传入的
|
|
|
- // let uploadPlanId = planId == 0 ? this.$route.query.id : planId;
|
|
|
- let param = {
|
|
|
- token: localStorage.token,
|
|
|
+ const jsonStr = {
|
|
|
stbId: planId,
|
|
|
- stbRs: res,
|
|
|
+ stbRs: planRs,
|
|
|
};
|
|
|
- let postdata = qs.stringify(param);
|
|
|
- STTDetailBatchSave(postdata).then(res => {
|
|
|
- let json = res;
|
|
|
- if (json.Code == 0) {
|
|
|
- that.$message({
|
|
|
- showClose: true,
|
|
|
- message: '课程已上传成功!',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- this.$router.push({
|
|
|
- path: '/lessonManage'
|
|
|
- });
|
|
|
- // 提交后清掉内存里的课表
|
|
|
- this.clearTableRAM();
|
|
|
- // this.getTableQuery();
|
|
|
+
|
|
|
+ let paraRequest = new StandardRequest();
|
|
|
+ paraRequest.setShopid(localStorage.shopId);
|
|
|
+ paraRequest.setJsonstr(JSON.stringify(jsonStr));
|
|
|
+ paraRequest.setSign(getSignStr(jsonStr));
|
|
|
+ console.log(paraRequest);
|
|
|
+ that.client.sTTBasicDetailBatchSave(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
|
|
|
+ if (err == null) {
|
|
|
+ console.log(StandardReply.getJsonrst());
|
|
|
+ let res = JSON.parse(StandardReply);
|
|
|
+ if (res.code === 0) {
|
|
|
+ that.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '课程已上传成功!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.$router.push({
|
|
|
+ path: '/lessonTableManage'
|
|
|
+ });
|
|
|
+ // 提交后清掉内存里的课表
|
|
|
+ this.clearTableRAM();
|
|
|
+ // this.getTableQuery();
|
|
|
+ } else {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/lessonTableManage'
|
|
|
+ });
|
|
|
+ // 提交后清掉内存里的课表
|
|
|
+ this.clearTableRAM();
|
|
|
+ that.$message.error(res.memo + ',错误代码:' + res.code);
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.$router.push({
|
|
|
- path: '/lessonManage'
|
|
|
- });
|
|
|
- // 提交后清掉内存里的课表
|
|
|
- this.clearTableRAM();
|
|
|
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
|
|
|
+ let res = err;
|
|
|
+ that.$message.error(res.message + ',错误代码:' + res.code);
|
|
|
+ console.log(res);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
clearTableRAM() {
|
|
|
this.tabs = [
|
|
|
@@ -513,7 +619,7 @@ export default {
|
|
|
let res = true
|
|
|
for (let i = 0; i < this.tabs.length; i++) {
|
|
|
for (let j = 0; j < this.tabs[i].tableData.length; j++) {
|
|
|
- if (!this.tabs[i].tableData[j].ClassId) {
|
|
|
+ if (!this.tabs[i].tableData[j].class_id) {
|
|
|
let days = numberToWeekdays(i + 1);
|
|
|
let lessonIndex = j + 1;
|
|
|
this.$message.error(days + '第' + lessonIndex + '节课有课程未选择,请选择后再提交')
|
|
|
@@ -540,14 +646,14 @@ export default {
|
|
|
let res = this.deepClone(rows);
|
|
|
this.tabs[index].tableData.push(res);
|
|
|
},
|
|
|
- // 深拷贝赋初始值
|
|
|
+ //深拷贝赋初始值
|
|
|
deepValue() {
|
|
|
let that = this;
|
|
|
- let valus = [
|
|
|
+ let values = [
|
|
|
this.testRow
|
|
|
];
|
|
|
this.tabs.map(function (item) {
|
|
|
- let res = that.deepClone(valus);
|
|
|
+ let res = that.deepClone(values);
|
|
|
item.tableData = res;
|
|
|
})
|
|
|
},
|
|
|
@@ -556,25 +662,28 @@ export default {
|
|
|
objClone = JSON.parse(_obj);
|
|
|
return objClone
|
|
|
},
|
|
|
- handleClick() {
|
|
|
- },
|
|
|
- changeWechat(e, row) {
|
|
|
- // if(parseInt(e) == 0){
|
|
|
- // this.$message.success('当前课程微信已不可见');
|
|
|
- // }else{
|
|
|
- // this.$message.success('当前课程微信不可见');
|
|
|
- // }
|
|
|
- },
|
|
|
- changeWechatOrder(e, row) {
|
|
|
- // if(parseInt(e) == 0){
|
|
|
- // this.$message.success('当前课程微信已不可预约');
|
|
|
- // }else{
|
|
|
- // this.$message.success('当前课程微信可预约');
|
|
|
- // }
|
|
|
+ handleClick: function (tab, event) {
|
|
|
+ let that = this;
|
|
|
+ if (that.panel.week != '') {
|
|
|
+ that.activeDate = getDate(that.panel.week, 0, 0, parseInt(that.activeName) - 2);
|
|
|
+ console.log(that.activeDate);
|
|
|
+ }
|
|
|
},
|
|
|
// 编辑课表行
|
|
|
- lessonRowEdit() {
|
|
|
- this.dialogLessonVisable = true
|
|
|
+ lessonRowEdit(scope) {
|
|
|
+ let that = this;
|
|
|
+ that.form = scope.row
|
|
|
+ that.dialogLessonVisable = true
|
|
|
+ if (that.panel.week != '') {
|
|
|
+ that.form.last_classon = getDate(that.panel.week, 0, 0, parseInt(that.activeName) - 2);//动态生成拼课截止时间为当天课程
|
|
|
+ that.form.curr_date = getDate(that.panel.week, 0, 0, parseInt(that.activeName) - 2);//动态生成拼课截止时间为当天课程
|
|
|
+ console.log(that.form.last_classon);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //确认标记课表行
|
|
|
+ confirmEditRow() {
|
|
|
+ let that = this;
|
|
|
+ that.dialogLessonVisable = false
|
|
|
},
|
|
|
handleSelectionChange(val) {
|
|
|
this.multipleSelection = val;
|
|
|
@@ -583,66 +692,57 @@ export default {
|
|
|
getTableQuery() {
|
|
|
let that = this;
|
|
|
that.loading = true;
|
|
|
- let param = {
|
|
|
- token: localStorage.token,
|
|
|
- stbId: this.$route.query.id,//
|
|
|
- };
|
|
|
// 只能读取,不能修改
|
|
|
this.panel.name = this.$route.query.name;
|
|
|
+ this.panel.week = this.$route.query.week;
|
|
|
|
|
|
+ const jsonStr = {
|
|
|
+ stbId: this.$route.query.id
|
|
|
+ };
|
|
|
|
|
|
- let postdata = qs.stringify(param);
|
|
|
- STTDetailListQuery(postdata).then(res => {
|
|
|
- let json = res;
|
|
|
- let Rs = json.Rs
|
|
|
- let bt = '';
|
|
|
- let et = '';
|
|
|
- if (json.Code == 0) {
|
|
|
- that.loading = false;
|
|
|
- // 清掉上次的记录
|
|
|
- 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 + 1) {
|
|
|
- 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].tableData.push(item);
|
|
|
-
|
|
|
+ let paraRequest = new StandardRequest();
|
|
|
+ paraRequest.setShopid(localStorage.shopId);
|
|
|
+ paraRequest.setJsonstr(JSON.stringify(jsonStr));
|
|
|
+ paraRequest.setSign(getSignStr(jsonStr));
|
|
|
+ console.log(paraRequest);
|
|
|
+ that.client.sTTDetailListQuery(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
|
|
|
+ if (err == null) {
|
|
|
+ console.log(StandardReply.getJsonrst());
|
|
|
+ let res = JSON.parse(StandardReply);
|
|
|
+ if (res.code === 0) {
|
|
|
+ let Rs = res.rs
|
|
|
+ let bt = '';
|
|
|
+ let et = '';
|
|
|
+ that.loading = false;
|
|
|
+ // 清掉上次的记录
|
|
|
+ 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.week_day == i + 1) {
|
|
|
+ bt = new Date(2016, 9, 10, item.begin_str.substr(0, 2), item.begin_str.substr(3, 2));
|
|
|
+ et = new Date(2016, 9, 10, item.end_str.substr(0, 2), item.end_str.substr(3, 2));
|
|
|
+ item.timeLong = [bt, et];
|
|
|
+ that.tabs[i].tableData.push(item);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ that.allTableData = [];
|
|
|
+ that.recordsTotal = 0;
|
|
|
+ }
|
|
|
} else {
|
|
|
- that.allTableData = [];
|
|
|
- that.recordsTotal = 0;
|
|
|
+ that.$message.error(res.memo + ',错误代码:' + res.code);
|
|
|
}
|
|
|
} else {
|
|
|
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- },
|
|
|
- watch: {
|
|
|
- $route(to) {
|
|
|
- if (to.name == 'EditLessonManage') {
|
|
|
- this.temId = this.$route.query.id;
|
|
|
- this.panelSelect();
|
|
|
- if (parseInt(this.temId) == 0) {
|
|
|
- this.pageTitle = '新增课程表'
|
|
|
- this.deepValue();
|
|
|
- this.panel.name = '';
|
|
|
- this.panel.week = '';
|
|
|
- this.panel.inputState = false
|
|
|
- } else {
|
|
|
- this.pageTitle = '编辑课程表'
|
|
|
- this.getTableQuery();
|
|
|
- this.panel.inputState = true
|
|
|
+ let res = err;
|
|
|
+ that.$message.error(res.message + ',错误代码:' + res.code);
|
|
|
+ console.log(res);
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
}
|