|
@@ -1,6 +1,6 @@
|
|
|
<script setup>
|
|
|
import { schema } from './config.js';
|
|
|
-import { postDaily } from '@/api/daily';
|
|
|
+import { getRecentMsg, getDetailByDay, postDaily } from '@/api/daily';
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
|
@@ -11,32 +11,21 @@ const formData = ref({});
|
|
|
|
|
|
const holidays = ref([])
|
|
|
|
|
|
-onMounted(() => {
|
|
|
-
|
|
|
- setTimeout(() => {
|
|
|
-
|
|
|
- holidays.value = [
|
|
|
- { testDate: '2024/06/01', exists: false },
|
|
|
- { testDate: '2024/06/02', exists: false },
|
|
|
- { testDate: '2024/06/03', exists: false },
|
|
|
- { testDate: '2024/06/04', exists: false },
|
|
|
- { testDate: '2024/06/05', exists: false },
|
|
|
- { testDate: '2024/06/06', exists: true },
|
|
|
- { testDate: '2024/06/07', exists: true }
|
|
|
- ]
|
|
|
-
|
|
|
- }, 2000);
|
|
|
-
|
|
|
-})
|
|
|
-
|
|
|
const isHoliday = ({ dayjs }) => {
|
|
|
- return holidays.value.find(({ testDate }) => dayjs.format('YYYY/MM/DD') === testDate)?.exists
|
|
|
+ return holidays.value.find(({ testDate }) => dayjs.format('YYYY/MM/DD') === testDate)?.exists;
|
|
|
};
|
|
|
|
|
|
const isExistData = computed(() => Object.keys(unref(formData)).length);
|
|
|
|
|
|
|
|
|
-// 提交数据
|
|
|
+const queryRecent = async () => {
|
|
|
+
|
|
|
+ const { data } = await getRecentMsg();
|
|
|
+
|
|
|
+ holidays.value = data;
|
|
|
+}
|
|
|
+
|
|
|
+// btn - 提交数据
|
|
|
const onSubmit = () => {
|
|
|
|
|
|
if (!isExistData.value) {
|
|
@@ -44,34 +33,53 @@ const onSubmit = () => {
|
|
|
}
|
|
|
|
|
|
proxy.$modal.confirm('是否确认提交?').then(async () => {
|
|
|
-15
|
|
|
+
|
|
|
+ const dateTime = holidays.value.find(({ testDate: day }) => day === unref(testDate));
|
|
|
+
|
|
|
+ await postDaily({
|
|
|
+ id: dateTime?.id,
|
|
|
+ testDate: unref(testDate),
|
|
|
+ ...unref(formData)
|
|
|
+ });
|
|
|
+
|
|
|
+ queryRecent();
|
|
|
+
|
|
|
proxy.$modal.msgSuccess("提交成功");
|
|
|
|
|
|
isVisible.value = !isVisible.value;
|
|
|
|
|
|
- // await postDaily({testDate: unref(testDate), ...unref(formData)});
|
|
|
-
|
|
|
+ testDate.value = null;
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-// 下一步
|
|
|
+// btn - 下一步
|
|
|
const handleNextStep = async () => {
|
|
|
if (!testDate.value) {
|
|
|
return proxy.$modal.msgError("请先选择需要填写日报日期");
|
|
|
}
|
|
|
+
|
|
|
+ const { data = {} } = await getDetailByDay({ testDate: unref(testDate) })
|
|
|
+
|
|
|
+ formData.value = data;
|
|
|
+
|
|
|
isVisible.value = true;
|
|
|
}
|
|
|
|
|
|
-// 上一步
|
|
|
+// btn - 上一步
|
|
|
const onBackStep = async () => {
|
|
|
if (isExistData.value) {
|
|
|
return proxy.$modal.confirm('测到当前日报已填写,是否返回上一步?').then(function () {
|
|
|
isVisible.value = false
|
|
|
}).catch(() => {});
|
|
|
}
|
|
|
+
|
|
|
isVisible.value = false;
|
|
|
}
|
|
|
+
|
|
|
+onMounted(async () => {
|
|
|
+ queryRecent();
|
|
|
+})
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -90,8 +98,9 @@ const onBackStep = async () => {
|
|
|
<template #default="cell">
|
|
|
<div class="cell" :class="{ current: cell.isCurrent }">
|
|
|
<span class="text">{{ cell.text }}</span>
|
|
|
- <span v-if="isHoliday(cell) === false" class="holiday" />
|
|
|
- <span v-if="isHoliday(cell) === true" class="blue"></span>
|
|
|
+ <el-tooltip :content="isHoliday(cell) ? '已填写' : '未填写'" placement="top" v-if="isHoliday(cell) !== undefined">
|
|
|
+ <span :class="isHoliday(cell) ? 'blue' : 'holiday'" />
|
|
|
+ </el-tooltip>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-date-picker>
|