From 7a4005f612164ab24f9f1d36d851ae5656357e53 Mon Sep 17 00:00:00 2001 From: zjf <1799650030@qq.com> Date: Thu, 11 Sep 2025 17:52:03 +0800 Subject: [PATCH] api --- src/pages/integrated/todo/index.vue | 36 ----------- src/sheep/api/feedback.ts | 51 +++++++++++++++ src/sheep/api/maintenance.ts | 43 +++++++++++++ src/sheep/api/task.ts | 97 +++++++++++++++++++++++++++++ src/sheep/api/visitor.ts | 43 +++++++++++++ 5 files changed, 234 insertions(+), 36 deletions(-) create mode 100644 src/sheep/api/feedback.ts create mode 100644 src/sheep/api/maintenance.ts create mode 100644 src/sheep/api/task.ts create mode 100644 src/sheep/api/visitor.ts diff --git a/src/pages/integrated/todo/index.vue b/src/pages/integrated/todo/index.vue index 5278d5e..2e7b542 100644 --- a/src/pages/integrated/todo/index.vue +++ b/src/pages/integrated/todo/index.vue @@ -483,7 +483,6 @@ async function viewProcess(item: any) { try { // 调用第一个接口:查询任务详情 (view=true) const taskRes = await taskApi.queryTask(item.taskId, true) - console.log('任务详情(view=true):', taskRes) // 调用第二个接口:格式化开始节点显示 const formatData = { @@ -498,10 +497,8 @@ async function viewProcess(item: any) { taskId: item.taskId } - console.log('发送给formatStartNodeShow的数据:', formatData) const formatRes = await taskApi.formatStartNodeShow(formatData) - console.log('格式化显示:', formatRes) // 从接口返回的数据中提取动态字段和审批流程 const taskData = taskRes as any @@ -537,7 +534,6 @@ async function viewProcess(item: any) { isViewMode: true } - console.log('设置的任务数据(查看模式):', currentTask.value) // 显示审批弹窗 showApprovalModal.value = true @@ -564,7 +560,6 @@ async function startProcess(item: any) { try { // 调用第一个接口:查询任务详情 const taskRes = await taskApi.queryTask(item.taskId, false) - console.log('任务详情:', taskRes) // 调用第二个接口:格式化开始节点显示 const formatData = { @@ -579,10 +574,8 @@ async function startProcess(item: any) { taskId: item.taskId } - console.log('发送给formatStartNodeShow的数据:', formatData) const formatRes = await taskApi.formatStartNodeShow(formatData) - console.log('格式化显示:', formatRes) // 从接口返回的数据中提取动态字段和审批流程 const taskData = taskRes as any @@ -616,7 +609,6 @@ async function startProcess(item: any) { approvalFlow: approvalFlow } - console.log('设置的任务数据:', currentTask.value) // 显示审批弹窗 showApprovalModal.value = true @@ -641,7 +633,6 @@ function hideApprovalModal() { // 处理拒绝 function handleReject() { - console.log('handleReject - 设置 pendingApproval.value = false') pendingApproval.value = false approvalComment.value = '' showCommentModal.value = true @@ -649,7 +640,6 @@ function handleReject() { // 处理提交(同意) function handleSubmit() { - console.log('handleSubmit - 设置 pendingApproval.value = true') pendingApproval.value = true approvalComment.value = '' showCommentModal.value = true @@ -665,7 +655,6 @@ async function handleTransfer() { // 提交审批结果 async function submitApproval(approved: boolean) { - console.log('submitApproval 被调用,参数 approved:', approved, '类型:', typeof approved) if (isProcessing.value) return @@ -677,8 +666,6 @@ async function submitApproval(approved: boolean) { try { // 检查任务数据 - console.log('当前任务数据:', currentTask.value) - console.log('审核意见:', approvalComment.value) if (!currentTask.value.taskId) { throw new Error('任务ID不存在') @@ -693,8 +680,6 @@ async function submitApproval(approved: boolean) { mcmxoxqvzau0u_approve_condition: approved } - console.log('approved 值:', approved) - console.log('mcmxoxqvzau0u_approve_condition 值:', paramMap.mcmxoxqvzau0u_approve_condition) const taskLocalParamMap = { approveDesc: approvalComment.value || (approved ? '同意申请' : '拒绝申请') @@ -706,13 +691,9 @@ async function submitApproval(approved: boolean) { taskLocalParamMap: taskLocalParamMap } - console.log('构建的paramMap:', paramMap) - console.log('构建的taskLocalParamMap:', taskLocalParamMap) - console.log('审批请求参数:', requestData) const res = await taskApi.completeTask(requestData) - console.log('审批结果:', res) uni.showToast({ title: approved ? '提交成功' : '拒绝成功', @@ -753,8 +734,6 @@ function confirmApproval() { return } - console.log('confirmApproval - pendingApproval.value:', pendingApproval.value) - console.log('confirmApproval - approvalComment.value:', approvalComment.value) // 先保存 pendingApproval 的值,因为 hideCommentModal 会重置它 const approvalValue = pendingApproval.value @@ -774,7 +753,6 @@ async function showUserSelection() { try { // 获取用户选择列表 - 使用抽取的API const res = await taskApi.getDeptOrgUsers(0) - console.log('用户选择列表:', res) const responseData = res as any if (responseData.code === 0 && responseData.data) { @@ -811,9 +789,6 @@ function removeSelectedUser() { } function confirmDelegateForm() { - console.log('confirmDelegateForm 被调用') - console.log('selectedUser.value:', selectedUser.value) - console.log('delegateFormComment.value:', delegateFormComment.value) // 清除之前的错误提示 userSelectError.value = '' @@ -823,17 +798,14 @@ function confirmDelegateForm() { // 验证表单 if (!selectedUser.value) { - console.log('验证失败:未选择转办人员') userSelectError.value = '请选择转办人员' hasError = true } if (!delegateFormComment.value || delegateFormComment.value.length < 2) { - console.log('验证失败:审核意见太短') commentError.value = '请输入审核意见(至少2字)' hasError = true } else if (delegateFormComment.value.length > 100) { - console.log('验证失败:审核意见太长') commentError.value = '审核意见不能超过100字' hasError = true } @@ -842,7 +814,6 @@ function confirmDelegateForm() { return } - console.log('验证通过,准备提交转办') // 设置转办数据并提交 delegateComment.value = delegateFormComment.value // 先提交转办,再关闭弹窗 @@ -868,7 +839,6 @@ async function selectUser(user: any) { uni.showLoading({ title: '加载中...', mask: true }) const res = await taskApi.getDeptOrgUsers(user.id) - console.log('下级部门数据:', res) const responseData = res as any if (responseData.code === 0 && responseData.data) { @@ -903,9 +873,7 @@ async function selectUser(user: any) { } } else { // 如果是员工,直接选择并关闭弹窗 - console.log('选择员工:', user) selectedUser.value = user - console.log('selectedUser.value:', selectedUser.value) hideDelegateModal() // 返回到转办表单弹窗 showDelegateFormModal.value = true @@ -989,11 +957,8 @@ function confirmDelegate() { } async function submitDelegate() { - console.log('submitDelegate 被调用') - console.log('isProcessing.value:', isProcessing.value) if (isProcessing.value) { - console.log('正在处理中,跳过') return } @@ -1017,7 +982,6 @@ async function submitDelegate() { } }) - console.log('转办结果:', res) const responseData = res as any if (responseData.code === 0) { diff --git a/src/sheep/api/feedback.ts b/src/sheep/api/feedback.ts new file mode 100644 index 0000000..03fa126 --- /dev/null +++ b/src/sheep/api/feedback.ts @@ -0,0 +1,51 @@ +import request from "@/sheep/utils/request" + +export default { + /** + * 提交意见反馈 + */ + submitFeedback: (data: { + title: string; + description: string; + picUrl?: string; + type: string; + contact?: string; + }) => + request({ + url: '/integrated/feedback/app/save', + method: 'POST', + data, + }), + + /** + * 获取我的反馈列表 + */ + getFeedbackList: (params: { current: number; size: number }) => + request({ + url: '/integrated/feedback/app/page', + method: 'GET', + params, + }), + + /** + * 获取反馈详情 + */ + getFeedbackDetail: (id: string) => + request({ + url: '/integrated/feedback/app/getDetails', + method: 'GET', + params: { id }, + }), + + /** + * 获取反馈类型字典 + */ + getFeedbackType: () => + request({ + url: '/integrated/feedback/app/getFeedbackType', + method: 'GET', + }), +} + + + diff --git a/src/sheep/api/maintenance.ts b/src/sheep/api/maintenance.ts new file mode 100644 index 0000000..a9bd89d --- /dev/null +++ b/src/sheep/api/maintenance.ts @@ -0,0 +1,43 @@ +import request from "@/sheep/utils/request" + +export default { + /** + * 提交维修申请 + */ + submitRepair: (data: { + title: string; + picUrl?: string; + description: string; + dateFound: string; + location: string; + urgency: string; + maintainType: number; + }) => + request({ + url: '/integrated/maintenanceOrder/app/apply', + method: 'POST', + data, + }), + + /** + * 获取我的维修记录列表 + */ + getRepairList: (params: { current: number; size: number }) => + request({ + url: '/integrated/maintenanceOrder/app/my', + method: 'GET', + params, + }), + + /** + * 获取维修详情 + */ + getRepairDetail: (id: string | number) => + request({ + url: `/integrated/maintenanceOrder/app/my/${id}`, + method: 'GET', + }), +} + + + diff --git a/src/sheep/api/task.ts b/src/sheep/api/task.ts new file mode 100644 index 0000000..4a61393 --- /dev/null +++ b/src/sheep/api/task.ts @@ -0,0 +1,97 @@ +import request from "@/sheep/utils/request" + +export default { + /** + * 查询任务详情 + */ + queryTask: (taskId: string, view: boolean = false) => + request({ + url: "/task/task/queryTask", + method: "GET", + params: { taskId, view }, + }), + + /** + * 格式化开始节点显示 + */ + formatStartNodeShow: (data: { + flowId: string; + processInstanceId: string; + paramMap: any; + taskId: string; + }) => + request({ + url: "/task/process-instance/formatStartNodeShow", + method: "POST", + data, + }), + + /** + * 完成任务(审批) + */ + completeTask: (data: { + taskId: string; + paramMap: any; + taskLocalParamMap: { + approveDesc: string; + }; + }) => + request({ + url: "/task/task/completeTask", + method: "POST", + data, + }), + + /** + * 转办任务 + */ + delegateTask: (data: { + taskId: string; + assignee: string; + comment?: string; + }) => + request({ + url: "/task/task/delegate", + method: "POST", + data, + }), + + /** + * 获取用户选择列表 + */ + getUserSelectionList: () => + request({ + url: "/task/task/getUserSelectionList", + method: "GET", + }), + + /** + * 获取部门组织架构和用户列表 + */ + getDeptOrgUsers: (parentDeptId: number = 0) => + request({ + url: "/admin/dept/org", + method: "GET", + params: { + type: "user", + parentDeptId, + }, + }), + + /** + * 设置转办人员 + */ + setAssignee: (data: { + paramMap: any; + taskId: string; + targetUserIdList: string[]; + taskLocalParamMap: { + approveDesc: string; + }; + }) => + request({ + url: "/task/task/setAssignee", + method: "POST", + data, + }), +} diff --git a/src/sheep/api/visitor.ts b/src/sheep/api/visitor.ts new file mode 100644 index 0000000..f85cf20 --- /dev/null +++ b/src/sheep/api/visitor.ts @@ -0,0 +1,43 @@ +import request from "@/sheep/utils/request" + +export default { + /** + * 提交访客申请 + */ + submitVisitor: (data: { + visitorName: string; + visitorPhone: string; + purpose: string; + visitDate: string; + visitTime: string; + hostName: string; + remark?: string; + }) => + request({ + url: '/integrated/visitor/submit', + method: 'POST', + data, + }), + + /** + * 获取访客记录列表 + */ + getVisitorList: (params: { current: number; size: number }) => + request({ + url: '/integrated/visitor/my-list', + method: 'GET', + params, + }), + + /** + * 获取访客详情 + */ + getVisitorDetail: (id: string) => + request({ + url: `/integrated/visitor/detail/${id}`, + method: 'GET', + }), +} + + +