From 5fb9b29fec82a227135b460725390b778ef4a380 Mon Sep 17 00:00:00 2001
From: XaoLi717 <144221124+XaoLi717@users.noreply.github.com>
Date: Tue, 24 Dec 2024 08:26:58 +0800
Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=81=87=E8=8D=89=E7=A8=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/home/xjgl/index.ts | 8 +
src/router/modules/remaining.ts | 12 +-
src/views/Home/xjnr/draft/indexDraft.vue | 240 ++++++++++++++++++
src/views/Home/{ => xjnr}/xjgl/XjglCreate.vue | 40 ++-
src/views/Home/{ => xjnr}/xjgl/XjglDetail.vue | 0
src/views/Home/{ => xjnr}/xjgl/index.vue | 0
6 files changed, 291 insertions(+), 9 deletions(-)
create mode 100644 src/views/Home/xjnr/draft/indexDraft.vue
rename src/views/Home/{ => xjnr}/xjgl/XjglCreate.vue (90%)
rename src/views/Home/{ => xjnr}/xjgl/XjglDetail.vue (100%)
rename src/views/Home/{ => xjnr}/xjgl/index.vue (100%)
diff --git a/src/api/home/xjgl/index.ts b/src/api/home/xjgl/index.ts
index 3059949..597c9c3 100644
--- a/src/api/home/xjgl/index.ts
+++ b/src/api/home/xjgl/index.ts
@@ -57,4 +57,12 @@ export const XjglApi = {
exportXjgl: async (params) => {
return await request.download({ url: `/home/xjgl/export-excel`, params })
},
+ // 保存为草稿
+ saveDraft: async (data: XjglVO) => {
+ return await request.post({ url: `/home/xjgl/saveDraft`, data })
+ },
+ // 查询草稿
+ getDraft: async (params: any) => {
+ return await request.get({ url: `/home/xjgl/draft`, params })
+ },
}
diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts
index e9a44e8..0281d50 100644
--- a/src/router/modules/remaining.ts
+++ b/src/router/modules/remaining.ts
@@ -785,27 +785,27 @@ const remainingRouter: AppRouteRecordRaw[] = [
}
},
{
- path: 'xjgl/XjglCreate',
- component: () => import('@/views/Home/xjgl/XjglCreate.vue'),
+ path: 'xjnr/xjgl/XjglCreate',
+ component: () => import('@/views/Home/xjnr/xjgl/XjglCreate.vue'),
name: 'XjglCreate',
meta: {
noCache: true,
hidden: true,
canTo: true,
title: '发起销假管理流程',
- activeMenu: '/Home/xjgl/Xjglflow'
+ activeMenu: '/Home/xjnr/xjgl/Xjglflow'
}
},
{
- path: '/xjgl/KqglDetail',
- component: () => import('@/views/Home/xjgl/XjglDetail.vue'),
+ path: 'xjnr/xjgl/KqglDetail',
+ component: () => import('@/views/Home/xjnr/xjgl/XjglDetail.vue'),
name: 'XjglDetail',
meta: {
noCache: true,
hidden: true,
canTo: true,
title: '查看销假管理流程',
- activeMenu: '/Home/xjgl/Xjglflow'
+ activeMenu: '/Home/xjnr/xjgl/Xjglflow'
}
}
]
diff --git a/src/views/Home/xjnr/draft/indexDraft.vue b/src/views/Home/xjnr/draft/indexDraft.vue
new file mode 100644
index 0000000..a04f67f
--- /dev/null
+++ b/src/views/Home/xjnr/draft/indexDraft.vue
@@ -0,0 +1,240 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 详情
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/Home/xjgl/XjglCreate.vue b/src/views/Home/xjnr/xjgl/XjglCreate.vue
similarity index 90%
rename from src/views/Home/xjgl/XjglCreate.vue
rename to src/views/Home/xjnr/xjgl/XjglCreate.vue
index f75fe90..5d18dda 100644
--- a/src/views/Home/xjgl/XjglCreate.vue
+++ b/src/views/Home/xjnr/xjgl/XjglCreate.vue
@@ -100,6 +100,7 @@
确 定
+ 存为草稿
@@ -122,7 +123,7 @@ import {CalendarApi} from "@/api/home/calendar";
import {Edit} from "@element-plus/icons-vue";
/** 销假管理 表单 */
-defineOptions({ name: 'XjglForm' })
+defineOptions({ name: 'XjglCreate' })
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
@@ -275,10 +276,13 @@ const submitForm = async () => {
data.startUserSelectAssignees = startUserSelectAssignees.value
}
- const curFullPath = currentRoute.value.fullPath
+ let curFullPath = currentRoute.value.fullPath
if( curFullPath ) {
data.curfullpath = curFullPath
}
+ if (curFullPath.includes("?")) {
+ curFullPath = curFullPath.split("?")[0];
+ }
const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath )
if ( processKey) {
data.processDefinitionKey = processKey
@@ -294,10 +298,40 @@ const submitForm = async () => {
formLoading.value = false
}
}
+
+const draftButton = ref(false)
+const saveDraft = async () => {
+ // 校验表单
+ await formRef.value.validate()
+ // 提交请求
+ formLoading.value = true
+ try {
+ const data = formData.value as unknown as XjglVO
+ await XjglApi.saveDraft(data)
+ message.success(t('存为草稿成功!'))
+ // 关闭当前 Tab
+ delView(unref(currentRoute))
+ await push({ name: 'Xjgl' })
+ } finally {
+ formLoading.value = false
+ }
+}
+
/** 打开弹窗 */
onMounted(async () => {
await getUserInfo()
- const curFullPath = currentRoute.value.fullPath
+ let curFullPath = currentRoute.value.fullPath
+ if (curFullPath.includes("?")) {
+ // 使用 URLSearchParams 提取查询参数
+ const params = new URLSearchParams(curFullPath.split("?")[1]);
+ const id = params.get("id") ;
+ // 获取路径部分
+ curFullPath = curFullPath.split("?")[0];
+ if ( id != "") {
+ formData.value = await XjglApi.getXjgl(Number( id) )
+ draftButton.value= true
+ }
+ }
const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath )
if ( !processKey ) {
diff --git a/src/views/Home/xjgl/XjglDetail.vue b/src/views/Home/xjnr/xjgl/XjglDetail.vue
similarity index 100%
rename from src/views/Home/xjgl/XjglDetail.vue
rename to src/views/Home/xjnr/xjgl/XjglDetail.vue
diff --git a/src/views/Home/xjgl/index.vue b/src/views/Home/xjnr/xjgl/index.vue
similarity index 100%
rename from src/views/Home/xjgl/index.vue
rename to src/views/Home/xjnr/xjgl/index.vue