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/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/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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 详情
+
+
+
+
+
+
+
+
+
+