diff --git a/src/api/home/bgyp/index.ts b/src/api/home/bgyp/index.ts index 78368cb..0fd15ad 100644 --- a/src/api/home/bgyp/index.ts +++ b/src/api/home/bgyp/index.ts @@ -51,4 +51,12 @@ export const BgypApi = { exportBgyp: async (params) => { return await request.download({ url: `/home/bgyp/export-excel`, params }) }, + // 保存为草稿 + saveDraft: async (data: BgypVO) => { + return await request.post({ url: `/home/bgyp/saveDraft`, data }) + }, +// 查询草稿 + getDraft: async (params: any) => { + return await request.get({ url: `/home/bgyp/draft`, params }) + }, } diff --git a/src/api/home/clgl/index.ts b/src/api/home/clgl/index.ts index bbabf9f..e10e905 100644 --- a/src/api/home/clgl/index.ts +++ b/src/api/home/clgl/index.ts @@ -56,4 +56,12 @@ export const ClglApi = { exportClgl: async (params) => { return await request.download({ url: `/home/clgl/export-excel`, params }) }, + // 保存为草稿 + saveDraft: async (data: ClglVO) => { + return await request.post({ url: `/home/clgl/saveDraft`, data }) + }, + // 查询草稿 + getDraft: async (params: any) => { + return await request.get({ url: `/home/clgl/draft`, params }) + }, } diff --git a/src/api/home/hygl/index.ts b/src/api/home/hygl/index.ts index 8ca28b5..48fc588 100644 --- a/src/api/home/hygl/index.ts +++ b/src/api/home/hygl/index.ts @@ -63,4 +63,12 @@ export const HyglApi = { exportHygl: async (params) => { return await request.download({ url: `/home/hygl/export-excel`, params }) }, + // 保存为草稿 + saveDraft: async (data: HyglVO) => { + return await request.post({ url: `/home/hygl/saveDraft`, data }) + }, +// 查询草稿 + getDraft: async (params: any) => { + return await request.get({ url: `/home/hygl/draft`, params }) + }, } diff --git a/src/api/home/jbgl/index.ts b/src/api/home/jbgl/index.ts index e63d827..0126a3d 100644 --- a/src/api/home/jbgl/index.ts +++ b/src/api/home/jbgl/index.ts @@ -51,4 +51,12 @@ export const JbglApi = { exportJbgl: async (params) => { return await request.download({ url: `/home/jbgl/export-excel`, params }) }, + // 保存为草稿 + saveDraft: async (data: JbglVO) => { + return await request.post({ url: `/home/jbgl/saveDraft`, data }) + }, +// 查询草稿 + getDraft: async (params: any) => { + return await request.get({ url: `/home/jbgl/draft`, params }) + }, } diff --git a/src/api/home/kqgl/index.ts b/src/api/home/kqgl/index.ts index 82e1da3..5d841b4 100644 --- a/src/api/home/kqgl/index.ts +++ b/src/api/home/kqgl/index.ts @@ -45,4 +45,12 @@ export const KqglApi = { exportKqgl: async (params) => { return await request.download({ url: `/home/kqgl/export-excel`, params }) }, + // 保存为草稿 + saveDraft: async (data: KqglVO) => { + return await request.post({ url: `/home/kqgl/saveDraft`, data }) + }, +// 查询草稿 + getDraft: async (params: any) => { + return await request.get({ url: `/home/kqgl/draft`, params }) + }, } 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..12a64eb 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -713,27 +713,27 @@ const remainingRouter: AppRouteRecordRaw[] = [ } }, { - path: 'jbgl/JbglCreate', - component: () => import('@/views/Home/jbgl/JbglCreate.vue'), + path: 'jbnr/jbgl/JbglCreate', + component: () => import('@/views/Home/jbnr/jbgl/JbglCreate.vue'), name: 'JbglCreate', meta: { noCache: true, hidden: true, canTo: true, title: '发起加班管理流程', - activeMenu: '/Home/jbgl/Jbglflow' + activeMenu: '/Home/jbnr/jbgl/Jbglflow' } }, { - path: 'jbgl/JbglDetail', - component: () => import('@/views/Home/jbgl/JbglDetail.vue'), + path: 'jbnr/jbgl/JbglDetail', + component: () => import('@/views/Home/jbnr/jbgl/JbglDetail.vue'), name: 'JbglDetail', meta: { noCache: true, hidden: true, canTo: true, title: '查看加班管理流程', - activeMenu: '/Home/jbgl/Jbglflow' + activeMenu: '/Home/jbnr/jbgl/Jbglflow' } }, { @@ -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/Index.vue b/src/views/Home/Index.vue index 928c649..8488f23 100644 --- a/src/views/Home/Index.vue +++ b/src/views/Home/Index.vue @@ -106,49 +106,49 @@ - - + + - + - + - - - + + + - - + + - - + + - + @@ -157,12 +157,12 @@ - - - - - - + + + + + + diff --git a/src/views/Home/bgnr/bgyp/BgypCreate.vue b/src/views/Home/bgnr/bgyp/BgypCreate.vue index abc9e0c..25352ce 100644 --- a/src/views/Home/bgnr/bgyp/BgypCreate.vue +++ b/src/views/Home/bgnr/bgyp/BgypCreate.vue @@ -86,6 +86,7 @@ @@ -164,6 +165,23 @@ const userList = ref([]) // 用户列表 const deptInfo = ref('') // 部门信息 const userInfo = ref('') // 用户名字 +const draftButton = ref(false) +const saveDraft = async () => { + // 校验表单 + await formRef.value.validate() + // 提交请求 + formLoading.value = true + try { + const data = formData.value as unknown as BgypVO + await BgypApi.saveDraft(data) + message.success(t('存为草稿成功!')) + // 关闭当前 Tab + delView(unref(currentRoute)) + await push({ name: 'Bgyp' }) + } finally { + formLoading.value = false + } +} /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 @@ -183,11 +201,14 @@ 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 @@ -215,8 +236,18 @@ const formRules = reactive({ 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 BgypApi.getBgyp(Number( id) ) + draftButton.value= true + } + } const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath ) if ( !processKey ) { diff --git a/src/views/Home/bgnr/bgyp/BgypDetail.vue b/src/views/Home/bgnr/bgyp/BgypDetail.vue index d4ec48e..0e341e9 100644 --- a/src/views/Home/bgnr/bgyp/BgypDetail.vue +++ b/src/views/Home/bgnr/bgyp/BgypDetail.vue @@ -26,25 +26,25 @@ - + - + - + @@ -53,7 +53,7 @@ - + @@ -63,22 +63,24 @@ type="date" value-format="x" placeholder="选择申请时间" - disabled + :disabled="!isEditable('usageDate')" /> - + diff --git a/src/views/Home/bgnr/bgyp/index.vue b/src/views/Home/bgnr/bgyp/index.vue index 9f59bfb..e3cec3c 100644 --- a/src/views/Home/bgnr/bgyp/index.vue +++ b/src/views/Home/bgnr/bgyp/index.vue @@ -125,7 +125,6 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import {dateFormatter2} from '@/utils/formatTime' import download from '@/utils/download' import { BgypApi, BgypVO } from '@/api/home/bgyp' -import router from "@/router"; import * as LeaveApi from '@/api/bpm/leave' /** 办公用品管理 列表 */ @@ -170,6 +169,7 @@ const getList = async () => { } } +const router = useRouter() // 路由 /**发起操作 */ const handleCreate =async () => { await router.push({name: 'BgypCreate'}) diff --git a/src/views/Home/bgnr/draft/indexDraftBgyp.vue b/src/views/Home/bgnr/draft/indexDraftBgyp.vue new file mode 100644 index 0000000..5587589 --- /dev/null +++ b/src/views/Home/bgnr/draft/indexDraftBgyp.vue @@ -0,0 +1,212 @@ + + + diff --git a/src/views/Home/clnr/clgl/ClglCreate.vue b/src/views/Home/clnr/clgl/ClglCreate.vue index 4831f88..4d5cdbe 100644 --- a/src/views/Home/clnr/clgl/ClglCreate.vue +++ b/src/views/Home/clnr/clgl/ClglCreate.vue @@ -145,6 +145,7 @@ @@ -262,6 +263,24 @@ const changeDriverForm = (val:any) => { form.carDriverInfo = val.contactInfo } +const draftButton = ref(false) +const saveDraft = async () => { + // 校验表单 + await formRef.value.validate() + // 提交请求 + formLoading.value = true + try { + const data = formData.value as unknown as ClglVO + await ClglApi.saveDraft(data) + message.success(t('存为草稿成功!')) + // 关闭当前 Tab + delView(unref(currentRoute)) + await push({ name: 'Clgl' }) + } finally { + formLoading.value = false + } +} + /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 const submitForm = async () => { @@ -281,11 +300,14 @@ 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 @@ -326,7 +348,18 @@ const getUserInfo = async () => { 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 ClglApi.getClgl(Number( id) ) + draftButton.value= true + } + } const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath ) diff --git a/src/views/Home/clnr/clgl/ClglDetail.vue b/src/views/Home/clnr/clgl/ClglDetail.vue index 0904aec..8734b45 100644 --- a/src/views/Home/clnr/clgl/ClglDetail.vue +++ b/src/views/Home/clnr/clgl/ClglDetail.vue @@ -25,15 +25,15 @@ - + - + {{ dict.label }} @@ -42,32 +42,32 @@ - + - + - + - + @@ -79,7 +79,7 @@ type="date" value-format="x" placeholder="选择用车开始时间" - disabled + :disabled="!isEditable('carStart')" /> @@ -90,7 +90,7 @@ type="date" value-format="x" placeholder="选择用车结束时间" - disabled + :disabled="!isEditable('carEnd')" /> @@ -98,29 +98,31 @@ - + - + - + - + diff --git a/src/views/Home/hynr/draft/indexDraftHygl.vue b/src/views/Home/hynr/draft/indexDraftHygl.vue new file mode 100644 index 0000000..b94a8c8 --- /dev/null +++ b/src/views/Home/hynr/draft/indexDraftHygl.vue @@ -0,0 +1,265 @@ + + + diff --git a/src/views/Home/hynr/hygl/HyglCreate.vue b/src/views/Home/hynr/hygl/HyglCreate.vue index ef0ff62..ade15de 100644 --- a/src/views/Home/hynr/hygl/HyglCreate.vue +++ b/src/views/Home/hynr/hygl/HyglCreate.vue @@ -153,6 +153,7 @@ @@ -260,6 +261,24 @@ userInfo.value = formData.value.userName ?? ''; }; + const draftButton = ref(false) + const saveDraft = async () => { + // 校验表单 + await formRef.value.validate() + // 提交请求 + formLoading.value = true + try { + const data = formData.value as unknown as HyglVO + await HyglApi.saveDraft(data) + message.success(t('存为草稿成功!')) + // 关闭当前 Tab + delView(unref(currentRoute)) + await push({ name: 'Hygl' }) + } finally { + formLoading.value = false + } + } + /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 const submitForm = async () => { @@ -279,11 +298,14 @@ 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 @@ -329,8 +351,18 @@ await getUserInfo() await getList() - 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 HyglApi.getHygl(Number( id) ) + draftButton.value= true + } + } const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath ) if ( !processKey ) { diff --git a/src/views/Home/hynr/hygl/HyglDetail.vue b/src/views/Home/hynr/hygl/HyglDetail.vue index 118b656..fc86f12 100644 --- a/src/views/Home/hynr/hygl/HyglDetail.vue +++ b/src/views/Home/hynr/hygl/HyglDetail.vue @@ -25,13 +25,13 @@ - + - + - + @@ -41,7 +41,7 @@ type="datetime" value-format="x" placeholder="选择会议开始时间" - disabled + :disabled="!isEditable('startDate')" /> @@ -52,7 +52,7 @@ type="datetime" value-format="x" placeholder="选择会议结束时间" - disabled + :disabled="!isEditable('endDate')" /> @@ -65,13 +65,13 @@ type="date" value-format="x" placeholder="选择申请时间" - disabled + :disabled="!isEditable('time')" /> - + - + - + - + - + @@ -113,7 +113,7 @@ v-model="formData.roomId" placeholder="请选择会议室" @change="getAddress()" - disabled + :disabled="!isEditable('roomId')" > - + - + - + diff --git a/src/views/Home/jbgl/JbglCreate.vue b/src/views/Home/jbnr/jbgl/JbglCreate.vue similarity index 89% rename from src/views/Home/jbgl/JbglCreate.vue rename to src/views/Home/jbnr/jbgl/JbglCreate.vue index 9e6f16d..faf6889 100644 --- a/src/views/Home/jbgl/JbglCreate.vue +++ b/src/views/Home/jbnr/jbgl/JbglCreate.vue @@ -93,6 +93,7 @@ @@ -175,6 +176,25 @@ const getUserInfo = async () => { deptInfo.value = formData.value.deptName ?? ''; userInfo.value = formData.value.userName ?? ''; }; + +const draftButton = ref(false) +const saveDraft = async () => { + // 校验表单 + await formRef.value.validate() + // 提交请求 + formLoading.value = true + try { + const data = formData.value as unknown as JbglVO + await JbglApi.saveDraft(data) + message.success(t('存为草稿成功!')) + // 关闭当前 Tab + delView(unref(currentRoute)) + await push({ name: 'Jbgl' }) + } finally { + formLoading.value = false + } +} + /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 const submitForm = async () => { @@ -193,11 +213,14 @@ 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 @@ -215,8 +238,18 @@ const submitForm = async () => { 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 JbglApi.getJbgl(Number( id) ) + draftButton.value= true + } + } const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath ) if ( !processKey ) { diff --git a/src/views/Home/jbgl/JbglDetail.vue b/src/views/Home/jbnr/jbgl/JbglDetail.vue similarity index 69% rename from src/views/Home/jbgl/JbglDetail.vue rename to src/views/Home/jbnr/jbgl/JbglDetail.vue index 485e0b0..59b9589 100644 --- a/src/views/Home/jbgl/JbglDetail.vue +++ b/src/views/Home/jbnr/jbgl/JbglDetail.vue @@ -26,7 +26,7 @@ - + @@ -35,13 +35,13 @@ - + @@ -53,7 +53,7 @@ type="date" value-format="x" placeholder="选择申请时间" - disabled + :disabled="!isEditable('usageDate')" /> @@ -66,7 +66,7 @@ type="datetime" value-format="x" placeholder="选择加班开始时间" - disabled + :disabled="!isEditable('startDate')" /> @@ -77,27 +77,29 @@ type="datetime" value-format="x" placeholder="选择加班结束时间" - disabled + :disabled="!isEditable('endDate')" /> - + - + diff --git a/src/views/Home/jbgl/JbglForm.vue b/src/views/Home/jbnr/jbgl/JbglForm.vue similarity index 100% rename from src/views/Home/jbgl/JbglForm.vue rename to src/views/Home/jbnr/jbgl/JbglForm.vue diff --git a/src/views/Home/jbgl/index.vue b/src/views/Home/jbnr/jbgl/index.vue similarity index 99% rename from src/views/Home/jbgl/index.vue rename to src/views/Home/jbnr/jbgl/index.vue index 15dadc2..e2141d1 100644 --- a/src/views/Home/jbgl/index.vue +++ b/src/views/Home/jbnr/jbgl/index.vue @@ -156,7 +156,6 @@ import download from '@/utils/download' import { JbglApi, JbglVO } from '@/api/home/jbgl' import JbglForm from './JbglForm.vue' import * as LeaveApi from '@/api/bpm/leave' -import router from "@/router"; /** 加班管理 列表 */ defineOptions({ name: 'Jbgl' }) @@ -189,6 +188,7 @@ const queryParams = reactive({ const queryFormRef = ref() // 搜索的表单 const exportLoading = ref(false) // 导出的加载中 +const router = useRouter() // 路由 /**发起操作 */ const handleCreate = () => { router.push({ name: 'JbglCreate' }) diff --git a/src/views/Home/kqnr/draft/indexDraftKqgl.vue b/src/views/Home/kqnr/draft/indexDraftKqgl.vue new file mode 100644 index 0000000..2fa804b --- /dev/null +++ b/src/views/Home/kqnr/draft/indexDraftKqgl.vue @@ -0,0 +1,209 @@ + + + diff --git a/src/views/Home/kqnr/kqgl/KqglCreate.vue b/src/views/Home/kqnr/kqgl/KqglCreate.vue index ae6d7a0..d2dfa66 100644 --- a/src/views/Home/kqnr/kqgl/KqglCreate.vue +++ b/src/views/Home/kqnr/kqgl/KqglCreate.vue @@ -76,6 +76,7 @@ @@ -297,6 +298,10 @@ const changeStatus = async ()=>{ } }; +//流程 +const { query } = useRoute() // 查询参数 +const queryId = query.id as unknown as number // 从 URL 传递过来的 id 编号 + /** 打开弹窗 设置时间戳为固定信息 */ const open = async () => { pop.value=false//每次打开渲染span @@ -306,9 +311,15 @@ const open = async () => { formLoading.value = true try { await getUserInfo() //获取当前用户,部门数据 - //创建的我就新建数据,还有新建标识,把标识传递过去 - await createUser() - await getList(dateKey.value) + // 通过queryId判断 草稿模式走草稿逻辑 新建模式走新建逻辑 + if (queryId){ + formData.value = await KqglApi.getKqgl(queryId) + await getList() //如果是修改那么我获取列表标识使用有的标识 + } else { + //创建的我就新建数据,还有新建标识,把标识传递过去 + await createUser() + await getList(dateKey.value) + } await changeStatus()//把字符串工作状态更改为数组 await getWorkDay()//获取工作日信息 } finally { @@ -336,19 +347,29 @@ 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 } - data.date = dateKey.value //创建后提交的时候才会更新标识 - await KqglApi.createKqgl(data) - await updateUser() //提交的时候更新考勤数据 + // 提交的时候也是,因为草稿保存时key已经保存过了,所以草稿模式不需要再保存key,会覆盖原数据, + // 判断 新建模式就正常保存key + if (queryId){ + await KqglApi.createKqgl(data) + await updateUser() //提交的时候更新考勤数据 + }else { + data.date = dateKey.value //创建后提交的时候才会更新标识 + await KqglApi.createKqgl(data) + await updateUser() //提交的时候更新考勤数据 + } message.success(t('common.createSuccess')) delView(unref(currentRoute)) @@ -357,13 +378,44 @@ 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 KqglVO + // 这里时考勤独有的需要保存一下key + data.date = dateKey.value //创建后提交的时候才会更新标识 + await KqglApi.saveDraft(data) + await updateUser() //提交的时候更新考勤数据 + message.success(t('存为草稿成功!')) + // 关闭当前 Tab + delView(unref(currentRoute)) + await push({ name: 'Kqgl' }) + } finally { + formLoading.value = false + } +} /** 初始化 */ onMounted(async () => { await open() - 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 KqglApi.getKqgl(Number( id) ) + draftButton.value= true + } + } const processKey = await FormProcessMappingApi.selectProcessKey( curFullPath ) if ( !processKey ) { diff --git a/src/views/Home/kqnr/kqgl/KqglDetail.vue b/src/views/Home/kqnr/kqgl/KqglDetail.vue index 57beb57..9a35923 100644 --- a/src/views/Home/kqnr/kqgl/KqglDetail.vue +++ b/src/views/Home/kqnr/kqgl/KqglDetail.vue @@ -11,7 +11,7 @@ v-loading="formLoading" > - + @@ -33,7 +33,7 @@ type="date" value-format="x" placeholder="选择考勤日期" - disabled + :disabled="!isEditable('date')" /> @@ -78,11 +78,13 @@ 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 68% rename from src/views/Home/xjgl/XjglDetail.vue rename to src/views/Home/xjnr/xjgl/XjglDetail.vue index 69aa986..2b27799 100644 --- a/src/views/Home/xjgl/XjglDetail.vue +++ b/src/views/Home/xjnr/xjgl/XjglDetail.vue @@ -8,9 +8,10 @@ :model="formData" :rules="formRules" label-width="100px" + v-loading="formLoading" > - + @@ -39,7 +40,7 @@ type="date" value-format="x" placeholder="选择销假开始时间" - disabled + :disabled="!isEditable('startTime')" /> @@ -50,7 +51,7 @@ type="date" value-format="x" placeholder="选择销假结束时间" - disabled + :disabled="!isEditable('endTime')" /> @@ -60,14 +61,14 @@ - + - + - + - + @@ -91,12 +92,15 @@