| | |
| | | </u-form-item> |
| | | </template> |
| | | <!-- approveType=3 出差相关字段 --> |
| | | <u-form-item v-if="approveType === 3" |
| | | prop="location" |
| | | label="出差地点" |
| | | required> |
| | | <u-input v-model="form.location" |
| | | placeholder="请输入出差地点" |
| | | clearable /> |
| | | </u-form-item> |
| | | <template v-if="approveType === 3"> |
| | | <u-form-item prop="location" |
| | | label="出差地点" |
| | | required> |
| | | <u-input v-model="form.location" |
| | | placeholder="请输入出差地点" |
| | | clearable /> |
| | | </u-form-item> |
| | | <u-form-item prop="startDateTime" |
| | | label="出差开始时间" |
| | | required> |
| | | <u-input v-model="form.startDateTime" |
| | | readonly |
| | | placeholder="请选择出差开始时间" |
| | | @click="showTripStartDateTimePicker" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" |
| | | @click="showTripStartDateTimePicker"></up-icon> |
| | | </template> |
| | | </u-form-item> |
| | | <u-form-item prop="endDateTime" |
| | | label="出差结束时间" |
| | | required> |
| | | <u-input v-model="form.endDateTime" |
| | | readonly |
| | | placeholder="请选择出差结束时间" |
| | | @click="showTripEndDateTimePicker" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" |
| | | @click="showTripEndDateTimePicker"></up-icon> |
| | | </template> |
| | | </u-form-item> |
| | | </template> |
| | | <!-- approveType=4 报销相关字段 --> |
| | | <u-form-item v-if="approveType === 4" |
| | | prop="price" |
| | |
| | | @cancel="showEndDate = false" |
| | | mode="date" /> |
| | | </up-popup> |
| | | <!-- 出差开始时间选择器 --> |
| | | <up-popup :show="showTripStartDateTime" |
| | | mode="bottom" |
| | | @close="showTripStartDateTime = false"> |
| | | <up-datetime-picker :show="true" |
| | | v-model="tripStartDateTimeValue" |
| | | @confirm="onTripStartDateTimeConfirm" |
| | | @cancel="showTripStartDateTime = false" |
| | | mode="datetime" /> |
| | | </up-popup> |
| | | <!-- 出差结束时间选择器 --> |
| | | <up-popup :show="showTripEndDateTime" |
| | | mode="bottom" |
| | | @close="showTripEndDateTime = false"> |
| | | <up-datetime-picker :show="true" |
| | | v-model="tripEndDateTimeValue" |
| | | @confirm="onTripEndDateTimeConfirm" |
| | | @cancel="showTripEndDateTime = false" |
| | | mode="datetime" /> |
| | | </up-popup> |
| | | </template> |
| | | <!-- 底部按钮 --> |
| | | <view class="footer-btns" |
| | |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import CommonUpload from "@/components/CommonUpload.vue"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { formatDateToYMD } from "@/utils/ruoyi"; |
| | | import { formatDateToYMD, parseTime } from "@/utils/ruoyi"; |
| | | import { |
| | | getDept, |
| | | approveProcessGetInfo, |
| | |
| | | storageBlobDTOS: [], |
| | | startDate: "", |
| | | endDate: "", |
| | | startDateTime: "", |
| | | endDateTime: "", |
| | | location: "", |
| | | price: "", |
| | | }, |
| | |
| | | ], |
| | | endDate: [ |
| | | { required: false, message: "请选择结束时间", trigger: "change" }, |
| | | ], |
| | | startDateTime: [ |
| | | { required: false, message: "请选择出差开始时间", trigger: "change" }, |
| | | ], |
| | | endDateTime: [ |
| | | { required: false, message: "请选择出差结束时间", trigger: "change" }, |
| | | ], |
| | | location: [{ required: false, message: "请输入出差地点", trigger: "blur" }], |
| | | price: [{ required: false, message: "请输入报销金额", trigger: "blur" }], |
| | |
| | | const startDateValue = ref(Date.now()); |
| | | const showEndDate = ref(false); |
| | | const endDateValue = ref(Date.now()); |
| | | const showTripStartDateTime = ref(false); |
| | | const tripStartDateTimeValue = ref(Date.now()); |
| | | const showTripEndDateTime = ref(false); |
| | | const tripEndDateTimeValue = ref(Date.now()); |
| | | const userStore = useUserStore(); |
| | | const approveType = ref(0); |
| | | const isInitialLoading = ref(false); |
| | |
| | | const onEndDateConfirm = e => { |
| | | form.value.endDate = formatDateToYMD(e.value); |
| | | showEndDate.value = false; |
| | | }; |
| | | |
| | | const showTripStartDateTimePicker = () => { |
| | | showTripStartDateTime.value = true; |
| | | }; |
| | | |
| | | const onTripStartDateTimeConfirm = e => { |
| | | form.value.startDateTime = parseTime(e.value, "{y}-{m}-{d} {h}:{i}"); |
| | | showTripStartDateTime.value = false; |
| | | }; |
| | | |
| | | const showTripEndDateTimePicker = () => { |
| | | showTripEndDateTime.value = true; |
| | | }; |
| | | |
| | | const onTripEndDateTimeConfirm = e => { |
| | | form.value.endDateTime = parseTime(e.value, "{y}-{m}-{d} {h}:{i}"); |
| | | showTripEndDateTime.value = false; |
| | | }; |
| | | |
| | | const fetchDetailData = async row => { |
| | |
| | | return; |
| | | } |
| | | |
| | | if (Number(approveType.value) === 3) { |
| | | if (!form.value.location || !String(form.value.location).trim()) { |
| | | showToast("请输入出差地点"); |
| | | return; |
| | | } |
| | | |
| | | if (!form.value.startDateTime) { |
| | | showToast("请选择出差开始时间"); |
| | | return; |
| | | } |
| | | |
| | | if (!form.value.endDateTime) { |
| | | showToast("请选择出差结束时间"); |
| | | return; |
| | | } |
| | | |
| | | const start = new Date(String(form.value.startDateTime).replace(/-/g, "/")); |
| | | const end = new Date(String(form.value.endDateTime).replace(/-/g, "/")); |
| | | if ( |
| | | Number.isFinite(start.getTime()) && |
| | | Number.isFinite(end.getTime()) && |
| | | end < start |
| | | ) { |
| | | showToast("出差结束时间不能早于开始时间"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | formRef.value |
| | | .validate() |
| | | .then(valid => { |
| | |
| | | box-shadow: 0 0.25rem 0.625rem 0 rgba(3, 88, 185, 0.2); |
| | | border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; |
| | | } |
| | | </style> |
| | | </style> |