This commit is contained in:
zmj 2024-05-24 13:50:31 +08:00
parent 5641321dcc
commit e522e5b8a5
3 changed files with 28 additions and 12 deletions

View File

@ -1,12 +1,14 @@
<template>
<el-calendar v-model="now">
<template #dateCell="{ data }">
<div class="content" @click="handleEdit(data)">
<div class="content" @click.stop="handleEdit(data)">
{{ data.day.split('-').slice(1).join('-') }}
<div class="task-li" v-for="item in formData" @click.stop="handleEdit(item)">
<div v-if="item.date.includes(data.day)">
<span> {{ item.start + ' ' + item.title }} </span>
<div v-if="calcLaberTime(data.day)" class="laber-time">
[ 当天总工时 {{ calcLaberTime(data.day) }}]
</div>
<div class="task-li" v-for="item in formData.filter(item => item.date.includes(data.day))" :key="item.id"
@click.stop="handleEdit(item)">
<span> {{ item.start + ' ' + item.title }} </span>
</div>
</div>
</template>
@ -50,6 +52,16 @@ function getDatesBetween(startDate, endDate) {
return list
}
const calcLaberTime = (time) => {
let list = formData.value.filter(item => {
return item.date[0] == time
})
let sum = list.reduce((pre, cur) => {
return Number(pre) + Number(cur.labor_time)
}, 0)
return sum
}
//
const handleEdit = async (data) => {
@ -76,7 +88,6 @@ const getLists = async () => {
labor_time: item.labor_time
}
})
console.log(formData.value);
}
getLists()
@ -110,4 +121,9 @@ getLists()
white-space: nowrap;
}
}
.laber-time {
font-size: 12px;
background-color: #F1F1F1;
}
</style>

View File

@ -1,7 +1,6 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit"
@close="handleClose">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
<el-form-item label="类型" prop="type">
<el-select v-model="formData.type" clearable placeholder="请选择类型" class="flex-1">
@ -11,7 +10,8 @@
</el-select>
</el-form-item>
<el-form-item label="接受人员" prop="type_user">
<el-input v-model="formData.type_user_names" @click="userclick" clearable placeholder="点击选择接受人员" />
<el-input v-model="formData.type_user_names" :disabled="mode == 'edit'" @click="userclick" clearable
placeholder="点击选择接受人员" />
</el-form-item>
<el-form-item label="汇报工作内容" prop="works">
<el-input v-model="formData.works" clearable placeholder="请输入汇报工作内容" type="textarea" />
@ -98,8 +98,8 @@ const formRules = reactive<any>({
type_user: [
{
required: true,
message: "请输入接受人员ID",
trigger: ["blur"],
message: "请选择接受人员",
trigger: ["cahnge"],
},
],
works: [

View File

@ -19,7 +19,7 @@ import sendReport from './components/sendReport.vue'
import reciveReport from './components/reciveReport.vue'
const activeName = ref('second')
const activeName = ref('first')