|
@@ -10,10 +10,9 @@
|
|
|
<em> <span style="color: red">*</span>课程表模板名称:</em>
|
|
<em> <span style="color: red">*</span>课程表模板名称:</em>
|
|
|
<el-input v-model="panel.name" placeholder="请输入课程表模板名称"></el-input>
|
|
<el-input v-model="panel.name" placeholder="请输入课程表模板名称"></el-input>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
- <!-- 默认不通用-->
|
|
|
|
|
- <!-- todo-->
|
|
|
|
|
- <!-- <el-button class="seeTemp" @click.native="seeWeekTemp">预览模板</el-button>-->
|
|
|
|
|
- <el-button type="default" class="seeTemp" @click="$router.push('/lessonTemplate')">返回课程表模板</el-button>
|
|
|
|
|
|
|
+ <!--默认不通用-->
|
|
|
|
|
+ <!--<el-button class="seeTemp" @click.native="seeWeekTemp">预览模板</el-button>-->
|
|
|
|
|
+ <el-button type="default" class="seeTemp" @click="$router.push('/lessonTableTemplate')">返回课程表模板</el-button>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -40,7 +39,6 @@
|
|
|
class=""
|
|
class=""
|
|
|
@selection-change="handleSelectionChange"
|
|
@selection-change="handleSelectionChange"
|
|
|
>
|
|
>
|
|
|
- >
|
|
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
prop="timeScope"
|
|
prop="timeScope"
|
|
|
label="时间"
|
|
label="时间"
|
|
@@ -65,7 +63,7 @@
|
|
|
align="center"
|
|
align="center"
|
|
|
>
|
|
>
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-select v-model="scope.row.class_id" @change="getRowTop(scope.row)">
|
|
|
|
|
|
|
+ <el-select v-model="scope.row.class_id" @change="getLessonTopMember(scope.row)">
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in panel.options"
|
|
v-for="item in panel.options"
|
|
|
:key="item.value"
|
|
:key="item.value"
|
|
@@ -76,21 +74,21 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="TopLimit"
|
|
|
|
|
|
|
+ prop="top_limit"
|
|
|
label="预约名额"
|
|
label="预约名额"
|
|
|
align="center"
|
|
align="center"
|
|
|
>
|
|
>
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-input-number v-model="scope.row.TopLimit" :min="1" :max="9999" label=""></el-input-number>
|
|
|
|
|
|
|
+ <el-input-number v-model="scope.row.top_limit" :min="1" :max="9999" label=""></el-input-number>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="ConsumeHour"
|
|
|
|
|
|
|
+ prop="consume_hour"
|
|
|
label="消耗课时"
|
|
label="消耗课时"
|
|
|
align="center"
|
|
align="center"
|
|
|
>
|
|
>
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-input-number v-model="scope.row.ConsumeHour" :min="0" :max="9999"
|
|
|
|
|
|
|
+ <el-input-number v-model="scope.row.consume_hour" :min="0" :max="9999"
|
|
|
label=""></el-input-number>
|
|
label=""></el-input-number>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -106,12 +104,12 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
<div class="rowBottom">
|
|
<div class="rowBottom">
|
|
|
- <el-button type="default" @click="$router.push('/lessonTemplate')">返回课程表模板</el-button>
|
|
|
|
|
|
|
+ <el-button type="default" @click="$router.push('/lessonTableTemplate')">返回课程表模板</el-button>
|
|
|
<!--ID为0是新建,不为0是修改-->
|
|
<!--ID为0是新建,不为0是修改-->
|
|
|
- <el-button type="primary" class="pull-right" @click="confirmLessonTable"
|
|
|
|
|
|
|
+ <el-button type="primary" class="pull-right" @click="confirmLessonTemplateAdd"
|
|
|
v-if="this.$route.query.id == 0" :disabled="serachBtnStatus">提交
|
|
v-if="this.$route.query.id == 0" :disabled="serachBtnStatus">提交
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <el-button type="primary" class="pull-right" @click="confirmEditLessonTable"
|
|
|
|
|
|
|
+ <el-button type="primary" class="pull-right" @click="confirmLessonTableEdit"
|
|
|
v-if="this.$route.query.id != 0" :disabled="serachBtnStatus">提交
|
|
v-if="this.$route.query.id != 0" :disabled="serachBtnStatus">提交
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<el-button type="primary" class="pull-right" @click="addRow">新增课程</el-button>
|
|
<el-button type="primary" class="pull-right" @click="addRow">新增课程</el-button>
|
|
@@ -124,21 +122,6 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<br>
|
|
<br>
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- <el-dialog title="增删课程会员" :visible.sync="dialogVisible">
|
|
|
|
|
- <div class="dialogTitle">
|
|
|
|
|
- <span>基础功能</span>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div>
|
|
|
|
|
- <el-transfer filterable v-model="dialogValue" :data="dialogdata"></el-transfer>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="dialogFooter">
|
|
|
|
|
- <el-button type="primary" size="small">确定</el-button>
|
|
|
|
|
- <el-button @click="dialogVisible = false" size="small">取消</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
-
|
|
|
|
|
<el-dialog title="预览" :visible.sync="previewShow" width="1200px">
|
|
<el-dialog title="预览" :visible.sync="previewShow" width="1200px">
|
|
|
<preview :preview-date="previewDate" :big-title="BigTitle" :small-title="smallTitle"></preview>
|
|
<preview :preview-date="previewDate" :big-title="BigTitle" :small-title="smallTitle"></preview>
|
|
|
<div class="dialogFooter">
|
|
<div class="dialogFooter">
|
|
@@ -155,13 +138,6 @@ import preview from '@/components/preview.vue'
|
|
|
import {
|
|
import {
|
|
|
StandardRequest
|
|
StandardRequest
|
|
|
} from "@/grpc/base_pb";
|
|
} from "@/grpc/base_pb";
|
|
|
-import {
|
|
|
|
|
- SttPlanBasicAdd,
|
|
|
|
|
- SttPlanDetailBatchSave,
|
|
|
|
|
- SttPlanBasicEdit,
|
|
|
|
|
- ClassDetailOne,
|
|
|
|
|
- ClassListQuery,
|
|
|
|
|
-} from "../../api/getApiRes";
|
|
|
|
|
|
|
|
|
|
let qs = require('qs');
|
|
let qs = require('qs');
|
|
|
export default {
|
|
export default {
|
|
@@ -210,11 +186,11 @@ export default {
|
|
|
},
|
|
},
|
|
|
testRow: {
|
|
testRow: {
|
|
|
timeLong: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 23, 59)],
|
|
timeLong: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 23, 59)],
|
|
|
- BeginStr: '08:30',
|
|
|
|
|
- EndStr: '23:59',
|
|
|
|
|
- ClassId: '',
|
|
|
|
|
- TopLimit: 1,
|
|
|
|
|
- ConsumeHour: 0,
|
|
|
|
|
|
|
+ begin_str: '08:30',
|
|
|
|
|
+ end_str: '23:59',
|
|
|
|
|
+ class_id: '',
|
|
|
|
|
+ top_limit: 1,
|
|
|
|
|
+ consume_hour: 0,
|
|
|
},
|
|
},
|
|
|
tabs: [
|
|
tabs: [
|
|
|
{
|
|
{
|
|
@@ -244,19 +220,14 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
- console.log('加载课程选项');
|
|
|
|
|
-
|
|
|
|
|
// 加载课程选项
|
|
// 加载课程选项
|
|
|
this.panelSelect();
|
|
this.panelSelect();
|
|
|
- if (this.$route.query.id === 0) {
|
|
|
|
|
|
|
+ if (this.$route.query.id == 0) {
|
|
|
|
|
+ this.panel.name = '';
|
|
|
this.pageTitle = '新增课程表模板'
|
|
this.pageTitle = '新增课程表模板'
|
|
|
- // 深拷贝赋初始值
|
|
|
|
|
this.deepValue();
|
|
this.deepValue();
|
|
|
- this.panel.name = '';
|
|
|
|
|
} else {
|
|
} else {
|
|
|
- console.log(this.$route.query.id);
|
|
|
|
|
this.pageTitle = '编辑课程表模板'
|
|
this.pageTitle = '编辑课程表模板'
|
|
|
- // 读取赋值
|
|
|
|
|
this.getTableQuery();
|
|
this.getTableQuery();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -297,27 +268,36 @@ export default {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
// 选择课程后,获取当前课程的建议上课人数和课时消耗
|
|
// 选择课程后,获取当前课程的建议上课人数和课时消耗
|
|
|
- getRowTop(row) {
|
|
|
|
|
|
|
+ getLessonTopMember(row) {
|
|
|
let that = this;
|
|
let that = this;
|
|
|
- console.log(row);
|
|
|
|
|
- let param = {
|
|
|
|
|
- token: localStorage.token,
|
|
|
|
|
- classId: row.class_id,
|
|
|
|
|
|
|
+ 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.TopLimit = json.Rs.TopLimit;
|
|
|
|
|
- row.ConsumeHour = json.Rs.ConsumeHour;
|
|
|
|
|
|
|
+ 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.top_limit = res.rs[0].top_limit;
|
|
|
|
|
+ row.consume_hour = res.rs[0].consume_hour;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ that.$message.error(res.memo + ',错误代码:' + res.code);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
|
|
|
|
|
|
|
+ let res = err;
|
|
|
|
|
+ that.$message.error(res.message + ',错误代码:' + res.code);
|
|
|
|
|
+ console.log(res);
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
- confirmEditLessonTable() {
|
|
|
|
|
|
|
+ confirmLessonTableEdit() {
|
|
|
let that = this;
|
|
let that = this;
|
|
|
-
|
|
|
|
|
// 按钮倒计时
|
|
// 按钮倒计时
|
|
|
that.serachBtnStatus = true;
|
|
that.serachBtnStatus = true;
|
|
|
let totalTime = 2;
|
|
let totalTime = 2;
|
|
@@ -341,25 +321,36 @@ export default {
|
|
|
this.$message.error('模板名称不能大于20个字符');
|
|
this.$message.error('模板名称不能大于20个字符');
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
|
|
+ //检查每天的课程是否都提交了
|
|
|
if (!this.checkData()) {
|
|
if (!this.checkData()) {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
- let param = {
|
|
|
|
|
- token: localStorage.token,
|
|
|
|
|
|
|
+ const jsonStr = {
|
|
|
planId: this.$route.query.id,
|
|
planId: this.$route.query.id,
|
|
|
planName: this.panel.name
|
|
planName: this.panel.name
|
|
|
};
|
|
};
|
|
|
- let postdata = qs.stringify(param);
|
|
|
|
|
- SttPlanBasicEdit(postdata).then(res => {
|
|
|
|
|
- let json = res;
|
|
|
|
|
- if (json.Code == 0) {
|
|
|
|
|
- let id = that.$route.query.id;
|
|
|
|
|
- // 提交课程内容
|
|
|
|
|
- that.LessonTemplateEdit(id);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let paraRequest = new StandardRequest();
|
|
|
|
|
+ paraRequest.setShopid(localStorage.shopId);
|
|
|
|
|
+ paraRequest.setJsonstr(JSON.stringify(jsonStr));
|
|
|
|
|
+ paraRequest.setSign(getSignStr(jsonStr));
|
|
|
|
|
+ console.log(paraRequest);
|
|
|
|
|
+ that.client.sttPlanBasicEdit(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
|
|
|
|
|
+ if (err == null) {
|
|
|
|
|
+ console.log(StandardReply.getJsonrst());
|
|
|
|
|
+ let res = JSON.parse(StandardReply);
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ let id = that.$route.query.id;
|
|
|
|
|
+ // 提交课程内容
|
|
|
|
|
+ that.LessonTableTemplateEdit(id);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ that.$message.error(res.memo + ',错误代码:' + res.code);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
|
|
|
|
|
|
|
+ let res = err;
|
|
|
|
|
+ that.$message.error(res.message + ',错误代码:' + res.code);
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
// 删除
|
|
// 删除
|
|
|
delRow(scope) {
|
|
delRow(scope) {
|
|
@@ -367,8 +358,8 @@ export default {
|
|
|
let curIndex = parseInt(this.activeName) - 1;
|
|
let curIndex = parseInt(this.activeName) - 1;
|
|
|
this.tabs[curIndex].tableData.splice(delIndex, 1)
|
|
this.tabs[curIndex].tableData.splice(delIndex, 1)
|
|
|
},
|
|
},
|
|
|
- // 提交课程模板
|
|
|
|
|
- confirmLessonTable() {
|
|
|
|
|
|
|
+ // 提交新增课程模板
|
|
|
|
|
+ confirmLessonTemplateAdd() {
|
|
|
if (!this.panel.name) {
|
|
if (!this.panel.name) {
|
|
|
this.$message.error('模板名称不能为空');
|
|
this.$message.error('模板名称不能为空');
|
|
|
return false
|
|
return false
|
|
@@ -385,21 +376,34 @@ export default {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
let that = this;
|
|
let that = this;
|
|
|
- let param = {
|
|
|
|
|
- token: localStorage.token,
|
|
|
|
|
- planName: this.panel.name,
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const jsonStr = {
|
|
|
|
|
+ shopId: localStorage.shopId,
|
|
|
|
|
+ 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;
|
|
|
|
|
- // 提交课程内容
|
|
|
|
|
- that.LessonTemplateEdit(json.Id);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let paraRequest = new StandardRequest();
|
|
|
|
|
+ paraRequest.setShopid(localStorage.shopId);
|
|
|
|
|
+ paraRequest.setJsonstr(JSON.stringify(jsonStr));
|
|
|
|
|
+ paraRequest.setSign(getSignStr(jsonStr));
|
|
|
|
|
+ console.log(paraRequest);
|
|
|
|
|
+ that.client.sttPlanBasicAdd(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.LessonTableTemplateEdit(res.newid);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ that.$message.error(res.memo + ',错误代码:' + res.code);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
|
|
|
|
|
|
|
+ let res = err;
|
|
|
|
|
+ that.$message.error(res.message + ',错误代码:' + res.code);
|
|
|
|
|
+ console.log(res);
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
// 数据组装
|
|
// 数据组装
|
|
|
DataAssembly() {
|
|
DataAssembly() {
|
|
@@ -407,15 +411,15 @@ export default {
|
|
|
for (let i = 0; i < this.tabs.length; i++) {
|
|
for (let i = 0; i < this.tabs.length; i++) {
|
|
|
for (let j = 0; j < this.tabs[i].tableData.length; j++) {
|
|
for (let j = 0; j < this.tabs[i].tableData.length; j++) {
|
|
|
thisRow = this.tabs[i].tableData[j];
|
|
thisRow = this.tabs[i].tableData[j];
|
|
|
- thisRow.lessonIndex = parseInt(j);
|
|
|
|
|
|
|
+ thisRow.lesson_index = parseInt(j);
|
|
|
if (planId) {
|
|
if (planId) {
|
|
|
- thisRow.PlanId = parseInt(planId);
|
|
|
|
|
|
|
+ thisRow.plan_id = parseInt(planId);
|
|
|
} else {
|
|
} else {
|
|
|
- thisRow.PlanId = parseInt(this.$route.query.id);
|
|
|
|
|
|
|
+ thisRow.plan_id = parseInt(this.$route.query.id);
|
|
|
}
|
|
}
|
|
|
- thisRow.WeekDay = parseInt(i + 1);
|
|
|
|
|
- thisRow.BeginStr = getHoursAndMin(thisRow.timeLong[0]);
|
|
|
|
|
- thisRow.EndStr = getHoursAndMin(thisRow.timeLong[1]);
|
|
|
|
|
|
|
+ thisRow.week_day = parseInt(i + 1);
|
|
|
|
|
+ thisRow.begin_str = getHoursAndMin(thisRow.timeLong[0]);
|
|
|
|
|
+ thisRow.end_str = getHoursAndMin(thisRow.timeLong[1]);
|
|
|
this.$delete(thisRow, 'Base');
|
|
this.$delete(thisRow, 'Base');
|
|
|
this.$delete(thisRow, 'SpdId');
|
|
this.$delete(thisRow, 'SpdId');
|
|
|
this.DataAssemblyRs.push(thisRow)
|
|
this.DataAssemblyRs.push(thisRow)
|
|
@@ -423,65 +427,71 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// 修改课程模板
|
|
// 修改课程模板
|
|
|
- EditLessonTable(planId) {
|
|
|
|
|
|
|
+ LessonTemplateEdit(planId) {
|
|
|
let that = this;
|
|
let that = this;
|
|
|
- // 提交数据
|
|
|
|
|
-
|
|
|
|
|
let planRs = [];
|
|
let planRs = [];
|
|
|
let thisRow = {};
|
|
let thisRow = {};
|
|
|
|
|
+
|
|
|
for (let i = 0; i < this.tabs.length; i++) {
|
|
for (let i = 0; i < this.tabs.length; i++) {
|
|
|
for (let j = 0; j < this.tabs[i].tableData.length; j++) {
|
|
for (let j = 0; j < this.tabs[i].tableData.length; j++) {
|
|
|
thisRow = this.tabs[i].tableData[j];
|
|
thisRow = this.tabs[i].tableData[j];
|
|
|
- thisRow.lessonIndex = parseInt(j);
|
|
|
|
|
|
|
+ console.log(i,'--',j);
|
|
|
|
|
+ console.log(thisRow);
|
|
|
|
|
+ thisRow.lesson_index = parseInt(j);
|
|
|
if (planId) {
|
|
if (planId) {
|
|
|
- thisRow.PlanId = parseInt(planId);
|
|
|
|
|
|
|
+ thisRow.plan_id = parseInt(planId);
|
|
|
} else {
|
|
} else {
|
|
|
- thisRow.PlanId = parseInt(this.$route.query.id);
|
|
|
|
|
|
|
+ thisRow.plan_id = parseInt(this.$route.query.id);
|
|
|
}
|
|
}
|
|
|
- thisRow.WeekDay = parseInt(i + 1);
|
|
|
|
|
- thisRow.BeginStr = getHoursAndMin(thisRow.timeLong[0]);
|
|
|
|
|
- thisRow.EndStr = getHoursAndMin(thisRow.timeLong[1]);
|
|
|
|
|
|
|
+ thisRow.week_day = parseInt(i + 1);
|
|
|
|
|
+ thisRow.begin_str = getHoursAndMin(thisRow.timeLong[0]);
|
|
|
|
|
+ thisRow.end_str = getHoursAndMin(thisRow.timeLong[1]);
|
|
|
this.$delete(thisRow, 'Base');
|
|
this.$delete(thisRow, 'Base');
|
|
|
this.$delete(thisRow, 'SpdId');
|
|
this.$delete(thisRow, 'SpdId');
|
|
|
planRs.push(thisRow)
|
|
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,
|
|
|
|
|
- // planId: this.$route.query.id,
|
|
|
|
|
|
|
+ const jsonStr = {
|
|
|
planId: planId,
|
|
planId: planId,
|
|
|
- planRs: res,
|
|
|
|
|
|
|
+ planRs: planRs,
|
|
|
};
|
|
};
|
|
|
- let postdata = qs.stringify(param);
|
|
|
|
|
- // 得等数组装完才能校验
|
|
|
|
|
- SttPlanDetailBatchSave(postdata).then(res => {
|
|
|
|
|
- let json = res;
|
|
|
|
|
- if (json.Code == 0) {
|
|
|
|
|
- that.$message({
|
|
|
|
|
- showClose: true,
|
|
|
|
|
- message: '课程模板已上传成功!',
|
|
|
|
|
- type: 'success'
|
|
|
|
|
- });
|
|
|
|
|
- this.$router.push({
|
|
|
|
|
- path: '/lessonTemplateEdit'
|
|
|
|
|
- });
|
|
|
|
|
- // 提交后清掉内存里的课表
|
|
|
|
|
- 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.sttPlanDetailBatchSave(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: '/lessonTableTemplate'
|
|
|
|
|
+ });
|
|
|
|
|
+ // 提交后清掉内存里的课表
|
|
|
|
|
+ this.clearTableRAM();
|
|
|
|
|
+ // this.getTableQuery();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // this.$router.push({
|
|
|
|
|
+ // path: '/lessonTable'
|
|
|
|
|
+ // });
|
|
|
|
|
+ // 提交后清掉内存里的课表
|
|
|
|
|
+ // this.clearTableRAM();
|
|
|
|
|
+ that.$message.error(res.memo + ',错误代码:' + res.code);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- // this.$router.push({
|
|
|
|
|
- // path: '/lessonTable'
|
|
|
|
|
- // });
|
|
|
|
|
- // 提交后清掉内存里的课表
|
|
|
|
|
- // this.clearTableRAM();
|
|
|
|
|
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
|
|
|
|
|
|
|
+ let res = err;
|
|
|
|
|
+ that.$message.error(res.message + ',错误代码:' + res.code);
|
|
|
|
|
+ console.log(res);
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
clearTableRAM() {
|
|
clearTableRAM() {
|
|
|
this.tabs = [
|
|
this.tabs = [
|
|
@@ -514,10 +524,10 @@ export default {
|
|
|
let res = true;
|
|
let res = true;
|
|
|
for (let i = 0; i < this.tabs.length; i++) {
|
|
for (let i = 0; i < this.tabs.length; i++) {
|
|
|
for (let j = 0; j < this.tabs[i].tableData.length; j++) {
|
|
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 days = numberToWeekdays(i + 1);
|
|
|
- let lessonIndex = j + 1;
|
|
|
|
|
- this.$message.error(days + '第' + lessonIndex + '节课有课程未选择,请选择后再提交');
|
|
|
|
|
|
|
+ let lesson_index = j + 1;
|
|
|
|
|
+ this.$message.error(days + '第' + lesson_index + '节课有课程未选择,请选择后再提交');
|
|
|
res = false;
|
|
res = false;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -526,15 +536,14 @@ export default {
|
|
|
return res
|
|
return res
|
|
|
},
|
|
},
|
|
|
checkData2() {
|
|
checkData2() {
|
|
|
- // 目前报错规则:StbId WeekDay ClassId 不能为空为 0 BeginStr EndStr 必须是5位数字符串
|
|
|
|
|
|
|
+ // 目前报错规则:StbId week_day class_id 不能为空为 0 begin_str end_str 必须是5位数字符串
|
|
|
let that = this;
|
|
let that = this;
|
|
|
this.DataAssembly();
|
|
this.DataAssembly();
|
|
|
let tableDate = this.DataAssemblyRs;
|
|
let tableDate = this.DataAssemblyRs;
|
|
|
- console.log(123);
|
|
|
|
|
tableDate.map(function (item) {
|
|
tableDate.map(function (item) {
|
|
|
- if (!item.ClassId) {
|
|
|
|
|
- let days = numberToWeekdays(item.WeekDay);
|
|
|
|
|
- let lessonIndex = parseInt(item.lessonIndex + 1);
|
|
|
|
|
|
|
+ if (!item.class_id) {
|
|
|
|
|
+ let days = numberToWeekdays(item.week_day);
|
|
|
|
|
+ let lessonIndex = parseInt(item.lesson_index + 1);
|
|
|
that.$message.error(days + '第' + lessonIndex + '节课有课程未选择,请选择后再提交');
|
|
that.$message.error(days + '第' + lessonIndex + '节课有课程未选择,请选择后再提交');
|
|
|
return false
|
|
return false
|
|
|
} else {
|
|
} else {
|
|
@@ -550,12 +559,11 @@ export default {
|
|
|
let res = this.deepClone(rows);
|
|
let res = this.deepClone(rows);
|
|
|
this.tabs[index].tableData.push(res);
|
|
this.tabs[index].tableData.push(res);
|
|
|
},
|
|
},
|
|
|
- // 深拷贝赋初始值
|
|
|
|
|
|
|
+ //深拷贝赋初始值
|
|
|
deepValue() {
|
|
deepValue() {
|
|
|
let that = this;
|
|
let that = this;
|
|
|
let value = [
|
|
let value = [
|
|
|
this.testRow
|
|
this.testRow
|
|
|
- // {BeginStr: '08:30', EndStr: '09:30', ClassId: 0, TopLimit: 0, ConsumeHour: 0},
|
|
|
|
|
];
|
|
];
|
|
|
this.tabs.map(function (item) {
|
|
this.tabs.map(function (item) {
|
|
|
let res = that.deepClone(value);
|
|
let res = that.deepClone(value);
|
|
@@ -601,7 +609,6 @@ export default {
|
|
|
let bt = '';
|
|
let bt = '';
|
|
|
let et = '';
|
|
let et = '';
|
|
|
that.loading = false;
|
|
that.loading = false;
|
|
|
-
|
|
|
|
|
if (res.rs) {
|
|
if (res.rs) {
|
|
|
// 遍历分配
|
|
// 遍历分配
|
|
|
res.rs.map(function (item) {
|
|
res.rs.map(function (item) {
|
|
@@ -634,12 +641,12 @@ export default {
|
|
|
// 去重
|
|
// 去重
|
|
|
unique(arr) {
|
|
unique(arr) {
|
|
|
const res = new Map();
|
|
const res = new Map();
|
|
|
- return arr.filter((arr) => !res.has(arr.EndStr) && res.set(arr.EndStr, 1))
|
|
|
|
|
|
|
+ return arr.filter((arr) => !res.has(arr.end_str) && res.set(arr.end_str, 1))
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
$route(to) {
|
|
$route(to) {
|
|
|
- if (to.name == 'lessonTemplateEdit') {
|
|
|
|
|
|
|
+ if (to.name == 'lessonTableTemplateEdit') {
|
|
|
this.temId = this.$route.query.id;
|
|
this.temId = this.$route.query.id;
|
|
|
this.panelSelect();
|
|
this.panelSelect();
|
|
|
if (parseInt(this.temId) == 0) {
|
|
if (parseInt(this.temId) == 0) {
|