|
@@ -1,52 +1,66 @@
|
|
|
<template>
|
|
|
<div class="app-container app-calendar-container">
|
|
|
<div>
|
|
|
- <el-button type="primary" @click="handlePerFormList('ADD')">排期配置</el-button>
|
|
|
+ <el-button type="primary" v-hasPermi="['ticketMr:schedulingConfiguration:add']" @click="handleAdd('ADD')">配置排期</el-button>
|
|
|
+ <el-button type="primary" v-hasPermi="['ticketMr:schedulingConfiguration:delect']" @click="checkIsClear()">批量清空</el-button>
|
|
|
+ <el-button type="primary" @click="quickQueryFun()">快速查询</el-button>
|
|
|
</div>
|
|
|
- <div v-loading="loading">
|
|
|
- <el-calendar v-model="timeValue" v-if="showCalendar">
|
|
|
+ <div v-loading="loading" class="calendar-dialog">
|
|
|
+ <el-calendar v-model="timeValue">
|
|
|
<template
|
|
|
slot="dateCell"
|
|
|
slot-scope="{date, data}">
|
|
|
- <div @click.stop="selectTime(data.day)" :class="[data.day == today?'today_yes':'today_no']">
|
|
|
- <span>{{ data.day.split('-').slice(1).join('-') }}</span>
|
|
|
+ <div
|
|
|
+ :class="['calendar_box', selectTime(data)]"
|
|
|
+ @mouseover="mouseoverFun(data)"
|
|
|
+ @click.stop="clickTimeFun(data)"
|
|
|
+ >
|
|
|
+ <div class="calendar_box-date">
|
|
|
+ <span>{{ data.day.split('-').slice(1).join('-') }}</span>
|
|
|
+ <span @click="handlePerFormList('ADD',data)">详情</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div style="width: 100%; display: flex;flex-wrap: wrap;" >
|
|
|
<div
|
|
|
:key="index"
|
|
|
:style="{marginLeft: index%2 == 0?'':'20px',color: item.status == 1 ?'#67c23a':'#909399'}"
|
|
|
v-for="(item,index) in getPerFormList(data)"
|
|
|
- @click.stop="handlePerFormDeatils(item)"
|
|
|
>
|
|
|
{{ item.performTimeStart }}-{{ item.performTimeEnd }}
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
-
|
|
|
</template>
|
|
|
</el-calendar>
|
|
|
- <!-- <calendarBox /> -->
|
|
|
</div>
|
|
|
- <!-- 排期详情 -->
|
|
|
- <perFormDeatils ref="perFormDeatils" @getList="getList" />
|
|
|
-
|
|
|
+ <!-- 排期配置 -->
|
|
|
+ <addAndEdit ref="addAndEdit" @getList="getList" />
|
|
|
+
|
|
|
<!-- 排期列表 -->
|
|
|
<perFormListBox ref="perFormListBox" @getList="getList" />
|
|
|
+
|
|
|
+ <!-- 快速查询 -->
|
|
|
+ <quickQuery ref="quickQuery" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
-import { calendarList } from '@/api/ticketMr/schedulingConfiguration'
|
|
|
+import {
|
|
|
+ calendarList,
|
|
|
+ deleteByDateApi,
|
|
|
+ } from '@/api/ticketMr/schedulingConfiguration'
|
|
|
|
|
|
import moment from "moment"
|
|
|
import calendarBox from './dialog/calendarBox.vue';
|
|
|
-import perFormDeatils from './dialog/perFormDeatils.vue';
|
|
|
+
|
|
|
import perFormListBox from './dialog/perFormListBox.vue';
|
|
|
+import addAndEdit from "./dialog/addAndEdit";
|
|
|
+import quickQuery from './dialog/quickQuery.vue';
|
|
|
export default {
|
|
|
name: "SchedulingConfiguration",
|
|
|
dicts: [],
|
|
|
- components: { calendarBox,perFormDeatils,perFormListBox },
|
|
|
+ components: { calendarBox,perFormListBox,addAndEdit,quickQuery },
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
@@ -59,6 +73,12 @@ export default {
|
|
|
endDate: null,
|
|
|
},
|
|
|
timeValue: new Date(),
|
|
|
+ timeValueObj: {
|
|
|
+ prev: null,
|
|
|
+ next: null,
|
|
|
+ hover: null
|
|
|
+ },
|
|
|
+
|
|
|
perFormList: [],
|
|
|
showCalendar: false,
|
|
|
today: moment().format("YYYY-MM-DD")
|
|
@@ -98,28 +118,95 @@ export default {
|
|
|
})
|
|
|
return list
|
|
|
},
|
|
|
- selectTime(value){
|
|
|
- console.log("value====",value)
|
|
|
- // this.queryParams = {
|
|
|
- // startDate: moment(value).startOf('month').format("YYYY-MM-DD"),
|
|
|
- // endDate: moment(value).endOf('month').format("YYYY-MM-DD"),
|
|
|
- // }
|
|
|
- // this.getList();
|
|
|
+ /** 选中得时间 */
|
|
|
+ selectTime(data) {
|
|
|
+ let srt = ''
|
|
|
+ let newTime = moment(data.day).startOf('day').valueOf()
|
|
|
+ let newTime1 = moment().startOf('day').valueOf()
|
|
|
+ if(newTime < newTime1 ) {
|
|
|
+ return "disable_time"
|
|
|
+ }
|
|
|
+ if( this.timeValueObj ) {
|
|
|
+ if( this.timeValueObj.prev && this.timeValueObj.next ) {
|
|
|
+ let minTime = moment(this.timeValueObj.prev).valueOf()
|
|
|
+ let maxTime = moment(this.timeValueObj.next).valueOf()
|
|
|
+ if(newTime == minTime || newTime == maxTime) {
|
|
|
+ return 'is-select_time_self'
|
|
|
+ }
|
|
|
+ if(minTime > maxTime){
|
|
|
+ if(minTime >= newTime && maxTime <= newTime){
|
|
|
+ srt = 'is-select_time'
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if(minTime <= newTime && maxTime >= newTime){
|
|
|
+ srt = 'is-select_time'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if( this.timeValueObj.prev && !this.timeValueObj.next && this.timeValueObj.hover ){
|
|
|
+ let minTime = moment(this.timeValueObj.prev).valueOf()
|
|
|
+ let maxTime = moment(this.timeValueObj.hover).valueOf()
|
|
|
+ if(newTime == minTime || newTime == maxTime) {
|
|
|
+ return 'is-select_time_self'
|
|
|
+ }
|
|
|
+ if(minTime > maxTime){
|
|
|
+ if(minTime >= newTime && maxTime <= newTime){
|
|
|
+ srt = 'is-select_time_hover'
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if(minTime <= newTime && maxTime >= newTime){
|
|
|
+ srt = 'is-select_time_hover'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return srt
|
|
|
+ },
|
|
|
+ clickTimeFun(data) {
|
|
|
+ let newTime1 = moment(data.day).startOf('day').valueOf()
|
|
|
+ let newTime = moment().startOf('day').valueOf()
|
|
|
+ if(newTime1 < newTime ) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(moment(data.day).format("YYYY-MM") != moment(this.timeValue).format("YYYY-MM") ) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if( !this.timeValueObj || !this.timeValueObj.prev ) {
|
|
|
+ this.timeValueObj.prev = moment(data.day).format("YYYY-MM-DD")
|
|
|
+ }else if( this.timeValueObj.prev && !this.timeValueObj.next ){
|
|
|
+ this.timeValueObj.next = moment(data.day).format("YYYY-MM-DD")
|
|
|
+ }else if( this.timeValueObj.prev && this.timeValueObj.next ) {
|
|
|
+ this.timeValueObj.prev = moment(data.day).format("YYYY-MM-DD")
|
|
|
+ this.timeValueObj.next = null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mouseoverFun(data) {
|
|
|
+ if(moment(data.day).format("YYYY-MM") != moment(this.timeValue).format("YYYY-MM") ) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if( this.timeValueObj.prev && !this.timeValueObj.next ){
|
|
|
+ this.timeValueObj.hover = moment(data.day).format("YYYY-MM-DD")
|
|
|
+ this.timeValue = new Date(this.timeValueObj.hover)
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleUpdate(row) {
|
|
|
- this.$refs["addAndEdit"].openDialog("修改数据", row);
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd(type) {
|
|
|
+ if( this.timeValueObj.prev && this.timeValueObj.next ) {
|
|
|
+ this.openPrice = true
|
|
|
+ this.formPrice = {}
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.$refs["addAndEdit"].openDialog("配置排期", this.timeValueObj, type);
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ this.$message.error("请选择时间区间!!!");
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
- /** 排期详情 */
|
|
|
- handlePerFormDeatils(row) {
|
|
|
- this.$refs["perFormDeatils"].openDialog("排期详情", row);
|
|
|
+ quickQueryFun(type){
|
|
|
+ this.$refs["quickQuery"].openDialog("快速查询", null, type);
|
|
|
},
|
|
|
-
|
|
|
/** 排期列表 */
|
|
|
- handlePerFormList() {
|
|
|
- this.$refs["perFormListBox"].openDialog("排期详情", null);
|
|
|
+ handlePerFormList(type,data) {
|
|
|
+ this.$refs["perFormListBox"].openDialog("排期详情", {performDate: data.day},type);
|
|
|
},
|
|
|
// 获取日历显示时间范围
|
|
|
getRange(date){
|
|
@@ -177,7 +264,59 @@ export default {
|
|
|
endDate: lastDay,
|
|
|
}
|
|
|
this.getList();
|
|
|
- }
|
|
|
+ },
|
|
|
+ checkIsClear(){
|
|
|
+ if (this.timeValueObj.prev && this.timeValueObj.next) {
|
|
|
+ let minTime = moment(this.timeValueObj.prev).valueOf()
|
|
|
+ let maxTime = moment(this.timeValueObj.next).valueOf()
|
|
|
+ let startDate = null
|
|
|
+ let endDate = null
|
|
|
+ if (minTime > maxTime) {
|
|
|
+ startDate = this.timeValueObj.next
|
|
|
+ endDate = this.timeValueObj.prev
|
|
|
+ } else {
|
|
|
+ startDate = this.timeValueObj.prev
|
|
|
+ endDate = this.timeValueObj.next
|
|
|
+ }
|
|
|
+ this.$modal.confirm('确定要清空勾选"' + startDate + '——' + endDate + '"的日期范围内的数据吗?').then(()=> {
|
|
|
+ this.clearCalendarPrice()
|
|
|
+ }).catch(() => {});
|
|
|
+ } else {
|
|
|
+ this.$message.error("请选择时间区间!!!");
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ /** 一键清除 */
|
|
|
+ async clearCalendarPrice() {
|
|
|
+ try {
|
|
|
+ if( this.timeValueObj.prev && this.timeValueObj.next ) {
|
|
|
+ let minTime = moment(this.timeValueObj.prev).valueOf()
|
|
|
+ let maxTime = moment(this.timeValueObj.next).valueOf()
|
|
|
+ let startDate = null
|
|
|
+ let endDate = null
|
|
|
+ if(minTime > maxTime){
|
|
|
+ startDate = this.timeValueObj.next
|
|
|
+ endDate = this.timeValueObj.prev
|
|
|
+ }else {
|
|
|
+ startDate = this.timeValueObj.prev
|
|
|
+ endDate = this.timeValueObj.next
|
|
|
+ }
|
|
|
+ let res = await deleteByDateApi({
|
|
|
+ startDate: startDate,
|
|
|
+ endDate: endDate
|
|
|
+ })
|
|
|
+ if(res.code == 200) {
|
|
|
+ this.openPrice = false
|
|
|
+ this.$modal.msgSuccess(res.msg);
|
|
|
+ this.getCalendarPrice()
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ this.$message.error("请选择时间区间!!!");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
watch:{
|
|
|
timeValue(newValue,oldValue){
|
|
@@ -198,7 +337,8 @@ export default {
|
|
|
min-height: 86px;
|
|
|
}
|
|
|
.app-calendar-container ::v-deep .is-today {
|
|
|
- background-color: rgba(255, 240, 24, 0.5);
|
|
|
+ background-color: rgba(255, 240, 24, 0);
|
|
|
+ border: 1px solid #0F40F5;
|
|
|
}
|
|
|
.app-calendar-container ::v-deep .prev {
|
|
|
background-color: rgba(223, 230, 236,0.5) !important;
|
|
@@ -212,4 +352,45 @@ export default {
|
|
|
.today_no {
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+/** 今天 */
|
|
|
+.el-calendar-table td.is-today {
|
|
|
+ .calendar_box {
|
|
|
+ color: #0F40F5;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.calendar_box {
|
|
|
+ width: 100%;
|
|
|
+ min-height: 86px;
|
|
|
+ .calendar_box-date {
|
|
|
+ display: flex;
|
|
|
+ width: 100% ;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.disable_time {
|
|
|
+ user-select: none;
|
|
|
+ cursor: not-allowed;
|
|
|
+}
|
|
|
+
|
|
|
+.is-select_time_self {
|
|
|
+ background-color: #C2D4FF;
|
|
|
+}
|
|
|
+
|
|
|
+.is-select_time {
|
|
|
+ background-color: #E4ECFF;
|
|
|
+}
|
|
|
+
|
|
|
+.is-select_time_hover {
|
|
|
+ background-color: #C2D4FF;
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style lang="scss">
|
|
|
+.calendar-dialog ::v-deep .el-calendar-table .el-calendar-day {
|
|
|
+ padding: none !important;
|
|
|
+ height: auto;
|
|
|
+}
|
|
|
</style>
|