|
@@ -24,13 +24,12 @@
|
|
</el-date-picker>
|
|
</el-date-picker>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
- <data-table :fields="fields" :data="filterData()" :opera="opera" @apply="toApply">
|
|
|
|
|
|
+ <data-table :fields="fields" :data="filterData()" :opera="opera" @apply="toApply" @cancel="toCancel">
|
|
<template #custom="{item, row}">
|
|
<template #custom="{item, row}">
|
|
<template v-if="item.prop === 'time'">
|
|
<template v-if="item.prop === 'time'">
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="24" v-for="(i, index) in row[item.prop]" :key="`${index}`">
|
|
<el-col :span="24" v-for="(i, index) in row[item.prop]" :key="`${index}`">
|
|
<span v-if="index < 2"> {{ i }}</span>
|
|
<span v-if="index < 2"> {{ i }}</span>
|
|
- <!-- 暂时显示2段 -->
|
|
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</template>
|
|
</template>
|
|
@@ -71,7 +70,7 @@ export default {
|
|
metaInfo: { title: '计划一览' },
|
|
metaInfo: { title: '计划一览' },
|
|
name: 'index',
|
|
name: 'index',
|
|
props: {},
|
|
props: {},
|
|
- components: { listFrame, dataTable },
|
|
|
|
|
|
+ components: { listFrame, dataTable }, //
|
|
data: function() {
|
|
data: function() {
|
|
var _this = this;
|
|
var _this = this;
|
|
return {
|
|
return {
|
|
@@ -83,13 +82,19 @@ export default {
|
|
opera: [
|
|
opera: [
|
|
{
|
|
{
|
|
label: '申请授课',
|
|
label: '申请授课',
|
|
- icon: 'el-icon-document',
|
|
|
|
method: 'apply',
|
|
method: 'apply',
|
|
display: i => !_this.applyList.find(f => f.termid == i.termid && f.date == i.day && f.subid == i.subid),
|
|
display: i => !_this.applyList.find(f => f.termid == i.termid && f.date == i.day && f.subid == i.subid),
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- label: '今日已申请',
|
|
|
|
- display: i => _this.applyList.find(f => f.termid == i.termid && f.date == i.day && f.subid == i.subid),
|
|
|
|
|
|
+ label: '取消申请',
|
|
|
|
+ method: 'cancel',
|
|
|
|
+ type: 'danger',
|
|
|
|
+ display: i => _this.canCancel(i),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: '已经申请(已过时限无法修改)',
|
|
|
|
+ type: 'danger',
|
|
|
|
+ display: i => _this.applyList.find(f => f.termid == i.termid && f.date == i.day && f.subid == i.subid) && !_this.canCancel(i),
|
|
},
|
|
},
|
|
],
|
|
],
|
|
fields: [
|
|
fields: [
|
|
@@ -117,7 +122,7 @@ export default {
|
|
...subject({ getSubjectList: 'query' }),
|
|
...subject({ getSubjectList: 'query' }),
|
|
...teacher({ getTeacher: 'fetch' }),
|
|
...teacher({ getTeacher: 'fetch' }),
|
|
...mapActions(['query', 'delete', 'fetch']),
|
|
...mapActions(['query', 'delete', 'fetch']),
|
|
- ...teaplan({ apply: 'create', applyFetch: 'query' }),
|
|
|
|
|
|
+ ...teaplan({ apply: 'create', applyFetch: 'query', cancelApply: 'delete' }),
|
|
async getTeacherInfo() {
|
|
async getTeacherInfo() {
|
|
const res = await this.getTeacher(this.user.userid);
|
|
const res = await this.getTeacher(this.user.userid);
|
|
if (res.errcode == '0') this.$set(this, `teacher`, res.data);
|
|
if (res.errcode == '0') this.$set(this, `teacher`, res.data);
|
|
@@ -177,6 +182,18 @@ export default {
|
|
});
|
|
});
|
|
} else this.teaApply(data);
|
|
} else this.teaApply(data);
|
|
},
|
|
},
|
|
|
|
+ async toCancel({ data }) {
|
|
|
|
+ const { termid, subid, day } = data;
|
|
|
|
+ const r = this.applyList.find(f => f.termid == termid && f.date == day && f.subid == subid);
|
|
|
|
+ if (r) {
|
|
|
|
+ const res = await this.cancelApply(r._id);
|
|
|
|
+ if (this.$checkRes(res, '取消成功', res.errmsg || '取消失败')) {
|
|
|
|
+ this.searchApply();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error('未找到申请的信息');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
async teaApply(data) {
|
|
async teaApply(data) {
|
|
// 修改,老师报课没有限制
|
|
// 修改,老师报课没有限制
|
|
let { termid, day: date, subid } = data;
|
|
let { termid, day: date, subid } = data;
|
|
@@ -236,6 +253,19 @@ export default {
|
|
this.$set(this, `classTypeList`, res.data);
|
|
this.$set(this, `classTypeList`, res.data);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ // 是否可以取消申请
|
|
|
|
+ canCancel(i) {
|
|
|
|
+ const r = this.applyList.find(f => f.termid == i.termid && f.date == i.day && f.subid == i.subid);
|
|
|
|
+ if (r) {
|
|
|
|
+ const { day } = i;
|
|
|
|
+ if (day) {
|
|
|
|
+ const today = moment().format('YYYY-MM-DD');
|
|
|
|
+ const sub = moment(day).diff(today, 'days');
|
|
|
|
+ if (sub > 5) return true;
|
|
|
|
+ else return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState(['user', 'defaultOption']),
|
|
...mapState(['user', 'defaultOption']),
|