提交
This commit is contained in:
parent
6d52c2d2db
commit
2ada816d09
@ -1,64 +1,64 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-card class="!border-none" v-loading="loading" shadow="never">
|
<el-card class="!border-none" v-loading="loading" shadow="never">
|
||||||
<el-button v-perms="['flow_type/add']" type="primary" @click="handleAdd">
|
<el-button v-perms="['flow_type/add']" type="primary" @click="handleAdd">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<icon name="el-icon-Plus" />
|
<icon name="el-icon-Plus" />
|
||||||
</template>
|
</template>
|
||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<el-calendar v-model="dateValue">
|
<el-calendar v-model="dateValue">
|
||||||
<template #dateCell="{ data }">
|
<template #dateCell="{ data }">
|
||||||
<div style="width: 100%; height: 100%">
|
<div style="width: 100%; height: 100%">
|
||||||
<p
|
<p
|
||||||
:class="data.isSelected ? 'is-selected' : ''"
|
:class="data.isSelected ? 'is-selected' : ''"
|
||||||
style="padding: 8px 8px 0 8px"
|
style="padding: 8px 8px 0 8px"
|
||||||
>
|
>
|
||||||
{{ data.day.split("-").slice(1).join("-") }}
|
{{ data.day.split('-').slice(1).join('-') }}
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
class="task"
|
class="task"
|
||||||
@click="clickTask(item)"
|
@click="clickTask(item)"
|
||||||
v-for="(item, index) in taskListFilter(data.day)"
|
v-for="(item, index) in taskListFilter(data.day)"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
{{ item.template_name }}
|
{{ item.template_name }}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-calendar>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</el-card>
|
||||||
</el-calendar>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<edit-popup
|
<edit-popup
|
||||||
ref="editRef"
|
ref="editRef"
|
||||||
:dateValue="dateValue"
|
:dateValue="dateValue"
|
||||||
@success="loadTask"
|
@success="loadTask"
|
||||||
@close="showEdit = false"
|
@close="showEdit = false"
|
||||||
/>
|
/>
|
||||||
<EditTowPopup
|
<EditTowPopup
|
||||||
ref="editTowRef"
|
ref="editTowRef"
|
||||||
:task="task"
|
:task="task"
|
||||||
:type="popupType"
|
:type="popupType"
|
||||||
@success="loadTask"
|
@success="loadTask"
|
||||||
@close="showEditTow = false"
|
@close="showEditTow = false"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="task">
|
<script lang="ts" setup name="task">
|
||||||
import { timeFormat } from "@/utils/util";
|
import { timeFormat } from '@/utils/util'
|
||||||
import feedback from "@/utils/feedback";
|
import feedback from '@/utils/feedback'
|
||||||
// import { getRoutePath } from "router";
|
// import { getRoutePath } from "router";
|
||||||
import EditPopup from "./edit.vue";
|
import EditPopup from './edit.vue'
|
||||||
import EditTowPopup from "./editTow.vue";
|
import EditTowPopup from './editTow.vue'
|
||||||
import { reactive, watch } from "vue";
|
import { reactive, watch } from 'vue'
|
||||||
import { apiTaskList, apiTaskDetails } from "@/api/task";
|
import { apiTaskList, apiTaskDetails } from '@/api/task'
|
||||||
import { apiTaskSchedulingPlanAdd } from "@/api/task_scheduling_plan";
|
import { apiTaskSchedulingPlanAdd } from '@/api/task_scheduling_plan'
|
||||||
const route = useRoute();
|
const route = useRoute()
|
||||||
|
|
||||||
const dateValue = ref(new Date());
|
const dateValue = ref(new Date())
|
||||||
// watch(
|
// watch(
|
||||||
// () => dateValue,
|
// () => dateValue,
|
||||||
// async (newValue, oldValue) => {
|
// async (newValue, oldValue) => {
|
||||||
@ -80,134 +80,133 @@ const dateValue = ref(new Date());
|
|||||||
|
|
||||||
// 当前点击的任务
|
// 当前点击的任务
|
||||||
const task = ref({
|
const task = ref({
|
||||||
create_user_id: 0,
|
create_user_id: 0,
|
||||||
end_time: "",
|
end_time: '',
|
||||||
id: 0,
|
id: 0,
|
||||||
scheduling_id: 0,
|
scheduling_id: 0,
|
||||||
start_time: "",
|
start_time: '',
|
||||||
status: 0,
|
status: 0,
|
||||||
template_id: 0,
|
template_id: 0,
|
||||||
template_name: "",
|
template_name: ''
|
||||||
});
|
})
|
||||||
const popupType = ref("add");
|
const popupType = ref('add')
|
||||||
const clickTask = (e: any) => {
|
const clickTask = (e: any) => {
|
||||||
popupType.value = "show";
|
popupType.value = 'show'
|
||||||
task.value = e;
|
task.value = e
|
||||||
handleSelect();
|
handleSelect()
|
||||||
};
|
}
|
||||||
|
|
||||||
// 加载
|
// 加载
|
||||||
const loading = ref(true);
|
const loading = ref(true)
|
||||||
|
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>();
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
const editTowRef = shallowRef<InstanceType<typeof EditPopup>>();
|
const editTowRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
// 是否显示编辑框
|
// 是否显示编辑框
|
||||||
const showEdit = ref(false);
|
const showEdit = ref(false)
|
||||||
const showEditTow = ref(false);
|
const showEditTow = ref(false)
|
||||||
|
|
||||||
// 查询条件
|
// 查询条件
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
start_time: "",
|
scheduling_id: '',
|
||||||
end_time: "",
|
start_time: '',
|
||||||
page_no: 1,
|
end_time: '',
|
||||||
pageSize: 150,
|
page_no: 1,
|
||||||
});
|
pageSize: 150
|
||||||
|
})
|
||||||
const taskList = ref<any>([]);
|
if (route.query.id) {
|
||||||
|
queryParams.scheduling_id = route.query.id.toString()
|
||||||
|
}
|
||||||
|
const taskList = ref<any>([])
|
||||||
|
|
||||||
// 查询
|
// 查询
|
||||||
const loadTask = async () => {
|
const loadTask = async () => {
|
||||||
apiTaskList(queryParams).then((res) => {
|
apiTaskList(queryParams).then((res) => {
|
||||||
taskList.value = res.lists;
|
taskList.value = res.lists
|
||||||
});
|
})
|
||||||
loading.value = false;
|
loading.value = false
|
||||||
};
|
}
|
||||||
|
|
||||||
const start_date = ref("");
|
const start_date = ref('')
|
||||||
const end_date = ref("");
|
const end_date = ref('')
|
||||||
// 计算当前显示的第一天和最后一天
|
// 计算当前显示的第一天和最后一天
|
||||||
const initShowDate = (dateStr = "") => {
|
const initShowDate = (dateStr = '') => {
|
||||||
const currentDate = dateStr ? new Date(dateStr) : new Date();
|
const currentDate = dateStr ? new Date(dateStr) : new Date()
|
||||||
const currentYear = currentDate.getFullYear();
|
const currentYear = currentDate.getFullYear()
|
||||||
const currentMonth = currentDate.getMonth();
|
const currentMonth = currentDate.getMonth()
|
||||||
const lastDay = new Date(currentYear, currentMonth + 1, 0).getDay(); //获取第一天星期
|
const lastDay = new Date(currentYear, currentMonth + 1, 0).getDay() //获取第一天星期
|
||||||
const startDay = new Date(currentYear, currentMonth, 1).getDay(); //获取最后一天星期
|
const startDay = new Date(currentYear, currentMonth, 1).getDay() //获取最后一天星期
|
||||||
// console.log(new Date(currentYear, currentMonth, 1-startDay).getDate());
|
// console.log(new Date(currentYear, currentMonth, 1-startDay).getDate());
|
||||||
// console.log(new Date(currentYear, currentMonth + 1, 6-lastDay).getDate());
|
// console.log(new Date(currentYear, currentMonth + 1, 6-lastDay).getDate());
|
||||||
start_date.value = timeFormat(
|
start_date.value = timeFormat(new Date(currentYear, currentMonth, 1 - startDay).getTime()) //获取第一天时间
|
||||||
new Date(currentYear, currentMonth, 1 - startDay).getTime()
|
end_date.value = timeFormat(new Date(currentYear, currentMonth + 1, 6 - lastDay).getTime()) //获取最后一天时间
|
||||||
); //获取第一天时间
|
if (queryParams.start_time != start_date.value) {
|
||||||
end_date.value = timeFormat(
|
queryParams.start_time = start_date.value
|
||||||
new Date(currentYear, currentMonth + 1, 6 - lastDay).getTime()
|
queryParams.end_time = end_date.value
|
||||||
); //获取最后一天时间
|
loading.value = true
|
||||||
if (queryParams.start_time != start_date.value) {
|
loadTask()
|
||||||
queryParams.start_time = start_date.value;
|
}
|
||||||
queryParams.end_time = end_date.value;
|
}
|
||||||
loading.value = true;
|
initShowDate()
|
||||||
loadTask();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
initShowDate();
|
|
||||||
|
|
||||||
// 过滤的任务列表
|
// 过滤的任务列表
|
||||||
const taskListFilter = (e: any) => {
|
const taskListFilter = (e: any) => {
|
||||||
return taskList.value
|
return taskList.value
|
||||||
.filter((item: any) => {
|
.filter((item: any) => {
|
||||||
let now = new Date(e).getTime() / 1000;
|
const now = new Date(e).getTime() / 1000
|
||||||
let start = new Date(item.start_time).getTime() / 1000;
|
const start = new Date(item.start_time).getTime() / 1000
|
||||||
let end = new Date(item.end_time).getTime() / 1000;
|
const end = new Date(item.end_time).getTime() / 1000
|
||||||
return now - start >= 0 && now - end <= 0;
|
return now - start >= 0 && now - end <= 0
|
||||||
})
|
})
|
||||||
.slice(0, 5);
|
.slice(0, 5)
|
||||||
};
|
}
|
||||||
|
|
||||||
// 添加
|
// 添加
|
||||||
const handleAdd = async () => {
|
const handleAdd = async () => {
|
||||||
popupType.value = "add";
|
popupType.value = 'add'
|
||||||
showEditTow.value = true;
|
showEditTow.value = true
|
||||||
await nextTick();
|
await nextTick()
|
||||||
editTowRef.value?.open("add");
|
editTowRef.value?.open('add')
|
||||||
editTowRef.value?.updatedForm();
|
editTowRef.value?.updatedForm()
|
||||||
};
|
}
|
||||||
// 查询
|
// 查询
|
||||||
const handleSelect = async () => {
|
const handleSelect = async () => {
|
||||||
popupType.value = "show";
|
popupType.value = 'show'
|
||||||
showEditTow.value = true;
|
showEditTow.value = true
|
||||||
await nextTick();
|
await nextTick()
|
||||||
editTowRef.value?.open("show");
|
editTowRef.value?.open('show')
|
||||||
editTowRef.value?.updatedForm();
|
editTowRef.value?.updatedForm()
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.is-selected {
|
.is-selected {
|
||||||
color: #1989fa;
|
color: #1989fa;
|
||||||
}
|
}
|
||||||
.el-calendar-table .el-calendar-day {
|
.el-calendar-table .el-calendar-day {
|
||||||
min-height: 8.2rem;
|
min-height: 8.2rem;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.task {
|
.task {
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
/* color: #f7ba2a; */
|
/* color: #f7ba2a; */
|
||||||
color: #1989fa;
|
color: #1989fa;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
white-space: nowrap; /* 设置文本不换行 */
|
white-space: nowrap; /* 设置文本不换行 */
|
||||||
overflow: hidden; /* 隐藏溢出的部分 */
|
overflow: hidden; /* 隐藏溢出的部分 */
|
||||||
text-overflow: ellipsis; /* 在溢出的部分显示省略号 */
|
text-overflow: ellipsis; /* 在溢出的部分显示省略号 */
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: rgba($color: #f38200, $alpha: 0.7);
|
background-color: rgba($color: #f38200, $alpha: 0.7);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.the {
|
.the {
|
||||||
color: #ff5100;
|
color: #ff5100;
|
||||||
}
|
}
|
||||||
.tow {
|
.tow {
|
||||||
color: #f38200;
|
color: #f38200;
|
||||||
}
|
}
|
||||||
.fou {
|
.fou {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user