From 2c842209fabcb31bdca297ac90a7f307129e2ea2 Mon Sep 17 00:00:00 2001 From: yangzhq68909 <993367776@qq.com> Date: Fri, 16 May 2025 18:04:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B7=E5=81=87=E6=8F=90=E4=BA=A4=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- env/.env.development | 6 +- src/components/PageLayout/PageLayout.vue | 1 - src/pages/humanResources/absence/apply.vue | 106 +++++++++++---------- 3 files changed, 58 insertions(+), 55 deletions(-) diff --git a/env/.env.development b/env/.env.development index 639f316..44dd13a 100644 --- a/env/.env.development +++ b/env/.env.development @@ -4,7 +4,5 @@ NODE_ENV = 'development' VITE_DELETE_CONSOLE = false # 是否开启sourcemap VITE_SHOW_SOURCEMAP = true - -#VITE_SERVER_BASEURL = 'http://10.75.15.249:8080/jeecg-boot' - -VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot' \ No newline at end of file +VITE_SERVER_BASEURL = 'http://10.75.15.249:8080/jeecg-boot' +#VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot' \ No newline at end of file diff --git a/src/components/PageLayout/PageLayout.vue b/src/components/PageLayout/PageLayout.vue index ab20453..720f028 100644 --- a/src/components/PageLayout/PageLayout.vue +++ b/src/components/PageLayout/PageLayout.vue @@ -176,7 +176,6 @@ .pageContent { flex: 1; - overflow: hidden; display: flex; flex-direction: column; background-color: #f1f1f1; diff --git a/src/pages/humanResources/absence/apply.vue b/src/pages/humanResources/absence/apply.vue index afa2171..a15c445 100644 --- a/src/pages/humanResources/absence/apply.vue +++ b/src/pages/humanResources/absence/apply.vue @@ -69,6 +69,9 @@ import { getEnvBaseUrl } from '@/utils/index' + import { + startMutilProcessApi + } from '@/api/process' const message = useMessage() const toast = useToast() @@ -174,12 +177,11 @@ }) .then(() => { addApi(submitData).then(res => { - console.log('----', res) - // if (res.success) { - // startMutilProcess(res.message) - // } else { - toast.warning(res.message) - // } + if (res.success) { + startMutilProcess(res.message) + } else { + toast.warning(res.message) + } }) }) .catch(() => {}) @@ -187,6 +189,24 @@ }) } + const startMutilProcess = (id) => { + startMutilProcessApi({ + flowCode: "dev_cxc_qxj", + id, + formUrl: "modules/qxj/modules/CxcQxjBpmModel", + formUrlMobile: "leaveApplication" + }).then((res) => { + if (res.success) { + toast.success(res.message) + setTimeout(() => { + uni.navigateBack() + }, 2000) + } + }).catch((err) => { + console.log(err); + }) + } + function formatDate(date) { date = new Date(date) const year = date.getFullYear() @@ -226,10 +246,7 @@ examineleader.value = '审批领导'; } } else { - uni.showToast({ - title: res.message, - icon: 'error' - }) + toast.warning(res.message) setTimeout(() => { handleClickLeft() }, 1000) @@ -242,10 +259,7 @@ queryHisDateApi(userStore.userInfo.username).then(res => { if (ress == '员工') { // 员工需要先销假,才能新增请假信息 if (res.endtime != null && res.resumptiontime == null) { - uni.showToast({ - title: '请先销假上一条请假信息!', - icon: 'error' - }) + toast.warning('请先销假上一条请假信息!') setTimeout(() => { uni.navigateBack() }, 2000) @@ -259,57 +273,49 @@ } } resDate.value = res.resumptiontime ? dateStringToTimestamp(res.resumptiontime) : - res.endtime ? dateStringToTimestamp(res.endtime, 1) : null + res.endtime ? dateStringToTimestamp(res.endtime, 2) : null queryMinDate(); }); }) } + const queryMinDate = () => { + const today = new Date(); + const threeMonthsAgo = new Date(today); + threeMonthsAgo.setMonth(today.getMonth() - 3); + if (resDate.value && model.type[model.type.length - 1] !== '干部离返濮报备') { + minBegintime.value = resDate.value; + } else { + minBegintime.value = threeMonthsAgo.getTime(); + } + model.begintime = resDate.value ? + (resDate.value > dateStringToTimestamp() ? resDate.value : dateStringToTimestamp()) : + dateStringToTimestamp(null, 1); + minEndtime.value = model.begintime; + }; + /** * 将日期字符串转换为13位时间戳(支持yyyymmdd和yyyy-mm-dd格式) * @param {string} dateStr * @returns {number} 13位时间戳(毫秒) */ function dateStringToTimestamp(dateStr, flag) { - if (dateStr != null) { + const date = new Date(); + if (flag === 1) { + date.setDate(date.getDate() + 1); + } else if (dateStr) { const normalized = dateStr.replace(/-/g, ''); - const year = parseInt(normalized.substring(0, 4)); - const month = parseInt(normalized.substring(4, 6)) - 1; - const day = parseInt(normalized.substring(6, 8)); - const date = new Date(year, month, day); - // 如果flag为1,则增加一天 - if (flag === 1) { + date.setFullYear( + parseInt(normalized.substring(0, 4)), + parseInt(normalized.substring(4, 6)) - 1, + parseInt(normalized.substring(6, 8)) + ); + if (flag === 2) { date.setDate(date.getDate() + 1); } - return date.getTime(); - } else { // dateStr为空返回当天时间戳 - const today = new Date(); - today.setHours(0, 0, 0, 0); - return today.getTime(); } - } - - const queryMinDate = () => { - const today = new Date(); // 获取当前日期 - if (resDate.value) { - if (model.type[model.type.length - 1] != '干部离返濮报备') { - minBegintime.value = resDate.value; - } else { - const today = new Date(); // 当前日期 - const sixMonthsAgo = new Date(today); - sixMonthsAgo.setMonth(today.getMonth() - 3); // 3个月前 min-date尽量不要设置过大,避免大量数据的计算和传递导致页面性能低下。 - minBegintime.value = sixMonthsAgo.getTime(); - } - model.begintime = resDate.value > dateStringToTimestamp() ? resDate.value : dateStringToTimestamp() - } else { - const today = new Date(); // 当前日期 - const sixMonthsAgo = new Date(today); - sixMonthsAgo.setMonth(today.getMonth() - 3); // 3个月前 min-date尽量不要设置过大,避免大量数据的计算和传递导致页面性能低下。 - minBegintime.value = sixMonthsAgo.getTime(); - // 如果 resDate 不存在 返回当天 - model.begintime = dateStringToTimestamp() - } - minEndtime.value = model.begintime + date.setHours(0, 0, 0, 0); + return date.getTime(); } const begintimeConfirm = () => {