按天复制课程
This commit is contained in:
@@ -20,3 +20,10 @@ export function remove(ids) {
|
||||
export function save(params) {
|
||||
return http.post('/venue/lesson', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制课程
|
||||
*/
|
||||
export function copy(params) {
|
||||
return http.post('/venue/lesson/copy', params)
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
<el-button size="small" type="text" @click="handleEdit(scope.row.id)">编辑</el-button>
|
||||
<el-button size="small" type="text" v-if="scope.row.saleNum > 0" @click="handleInfo(scope.row.id)">预约记录</el-button>
|
||||
<el-button size="small" type="text" @click="showimg(scope.row.id)">复制</el-button>
|
||||
<el-button size="small" type="text" @click="showCopyByDay(scope.row.id)">按天复制</el-button>
|
||||
<el-button size="small" v-if="scope.row.saleNum <= 0" type="text" class="danger" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -124,6 +125,29 @@
|
||||
<el-button @click="dialogFormVisible = false">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog title="复制该课程所在日期的所有课程到目标日期范围" :visible.sync="dialogFormByDay">
|
||||
<div class="dialog_div">
|
||||
<span>选择复制起期:</span>
|
||||
<el-date-picker
|
||||
class="filter-item" v-model="copyParam.leftDate" type="date" placeholder="选择复制起期"
|
||||
:picker-options="startDatePicker"
|
||||
value-format="yyyy-MM-dd" format="yyyy-MM-dd">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div class="dialog_div">
|
||||
<span>选择复制止期:</span>
|
||||
<el-date-picker
|
||||
class="filter-item" v-model="copyParam.rightDate" type="date" placeholder="选择复制止期"
|
||||
:picker-options="endDatePicker"
|
||||
value-format="yyyy-MM-dd" format="yyyy-MM-dd">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="copyLessonByDay">保存</el-button>
|
||||
<el-button @click="dialogFormByDay = false">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -137,7 +161,7 @@
|
||||
|
||||
<script>
|
||||
import { findByVenueType } from '@/api//coach'
|
||||
import { remove, find, save } from '@/api//venue/lesson'
|
||||
import { remove, find, save, copy } from '@/api//venue/lesson'
|
||||
import waves from '@/directive/waves.js' // 水波纹指令
|
||||
import Pagination from '@/components/Pagination'
|
||||
import moment from 'moment'
|
||||
@@ -152,6 +176,7 @@ export default {
|
||||
return {
|
||||
coaches: [],
|
||||
dialogFormVisible: false,
|
||||
dialogFormByDay: false,
|
||||
params: {
|
||||
search_eq_v$venueId: undefined,
|
||||
search_eq_v$date: undefined,
|
||||
@@ -162,11 +187,18 @@ export default {
|
||||
leftTime: undefined,
|
||||
rightTime: undefined
|
||||
},
|
||||
copyParam: {
|
||||
lessonId: undefined,
|
||||
leftDate: '',
|
||||
rightDate: ''
|
||||
},
|
||||
pickerOptions: {
|
||||
disabledDate(time) {
|
||||
return Date.now() > time
|
||||
disabledDate(date) {
|
||||
return Date.now() > date
|
||||
}
|
||||
},
|
||||
startDatePicker: this.beginDate(),
|
||||
endDatePicker: this.processDate(),
|
||||
time: undefined,
|
||||
times: '',
|
||||
data: '',
|
||||
@@ -223,9 +255,44 @@ export default {
|
||||
this.dialogFormVisible = true
|
||||
this.findById(id)
|
||||
},
|
||||
|
||||
/**
|
||||
* 按天复制
|
||||
*/
|
||||
showCopyByDay(id) {
|
||||
this.copyParam.lessonId = id
|
||||
this.dialogFormByDay = true
|
||||
},
|
||||
|
||||
onDateChange(value) {
|
||||
|
||||
},
|
||||
|
||||
beginDate() {
|
||||
const self = this
|
||||
return {
|
||||
disabledDate(time) {
|
||||
if (self.copyParam.rightDate && time.getTime() > Date.now()) {
|
||||
return new Date(self.form.rightDate).getTime() < time.getTime()
|
||||
} else {
|
||||
return time.getTime() < Date.now()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
processDate() {
|
||||
const self = this
|
||||
return {
|
||||
disabledDate(time) {
|
||||
if (self.copyParam.leftDate) {
|
||||
return new Date(self.copyParam.leftDate).getTime() > time.getTime()
|
||||
} else {
|
||||
return time.getTime() < Date.now()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onTimeChange(value) {
|
||||
if (value) {
|
||||
this.form.startTime = value[0] + ':00.000'
|
||||
@@ -265,6 +332,31 @@ export default {
|
||||
this.dialogFormVisible = false
|
||||
},
|
||||
|
||||
/**
|
||||
* 保存复制的课程
|
||||
*/
|
||||
copyLessonByDay() {
|
||||
if (this.copyParam.leftDate === '' || this.copyParam.leftDate === null) {
|
||||
this.$message({
|
||||
message: '请选择起始日期!',
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.copyParam.rightDate === '' || this.copyParam.rightDate === null) {
|
||||
this.$message({
|
||||
message: '请选择结束日期!',
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
copy(this.copyParam).then(response => {
|
||||
this.$refs.pagination.handleSearch()
|
||||
}).finally(() => {
|
||||
this.dialogFormByDay = false
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询复制课程信息
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user