diff --git a/frontend/src/api/aireport/testReport/index.ts b/frontend/src/api/aireport/testReport/index.ts index 36cade7..64da730 100644 --- a/frontend/src/api/aireport/testReport/index.ts +++ b/frontend/src/api/aireport/testReport/index.ts @@ -36,8 +36,8 @@ export const downloadReportTaskLedgerTemplateApi = (): Promise> -export const importReportTaskLedgerApi = (id: string, formData: FormData) => { - return http.post(`${REPORT_TASK_BASE_URL}/${id}/ledger/import`, formData, { +export const validateReportTaskLedgerApi = (id: string, formData: FormData) => { + return http.post(`${REPORT_TASK_BASE_URL}/${id}/ledger/validate`, formData, { headers: { 'Content-Type': 'multipart/form-data' } }) } diff --git a/frontend/src/api/aireport/testReport/interface/index.ts b/frontend/src/api/aireport/testReport/interface/index.ts index 96a06e2..a777e03 100644 --- a/frontend/src/api/aireport/testReport/interface/index.ts +++ b/frontend/src/api/aireport/testReport/interface/index.ts @@ -54,6 +54,7 @@ export namespace ReportTask { contractNumber: string standard: string[] data: string + batchId?: string phonenumber?: string } @@ -95,6 +96,7 @@ export namespace ReportTask { } export interface ReportTaskLedgerImportResult { + batchId?: string | null currentStage?: ReportTaskLedgerImportStage | string | null success?: boolean | null summaryFileName?: string | null @@ -150,6 +152,7 @@ export namespace ReportTask { export interface ReportTaskLedgerPreparedState { draftId: string + batchId: string latestImportResult: ReportTaskLedgerImportResult | null snapshot: ReportTaskLedgerImportSnapshot | null hasImported: boolean diff --git a/frontend/src/api/user/interface/user.ts b/frontend/src/api/user/interface/user.ts index 1f63584..c3dae67 100644 --- a/frontend/src/api/user/interface/user.ts +++ b/frontend/src/api/user/interface/user.ts @@ -20,60 +20,67 @@ export namespace Login { } } - // 用户管理模块 export namespace User { + /** + * 用户数据表格分页查询参数 + */ + export interface ReqUserParams extends ReqPage { + id: string // 装置序号用户ID 必填 + name?: string //用户名(别名) + loginTime?: string //最后一次登录时间 + } - /** - * 用户数据表格分页查询参数 - */ - export interface ReqUserParams extends ReqPage{ - id: string; // 装置序号用户ID 必填 - name?: string; //用户名(别名) - loginTime?: string;//最后一次登录时间 - } + // 用户接口 + export interface ResUser { + id: string //用户ID,作为唯一标识 + name: string //用户名(别名) + loginName: string //登录名 + deptId?: number //部门ID + password: string //密码 + phone?: string //手机号 + email?: string //邮箱 + loginTime?: string //最后一次登录时间 + loginErrorTimes: number //登录错误次数 + lockTime?: string //用户密码错误锁定时间 + state: number //0-删除;1-正常;2-锁定;3-待审核;4-休眠;5-密码过期 + createBy?: string //创建用户 + createTime?: string //创建时间 + updateBy?: string //更新用户 + updateTime?: string //更新时间 + roleIds?: string[] + roleNames?: string[] + roleCodes?: string[] + signatureFileId?: string + signatureFileName?: string + disabled?: boolean + } - // 用户接口 - export interface ResUser { - id: string; //用户ID,作为唯一标识 - name: string; //用户名(别名) - loginName: string;//登录名 - deptId?: number;//部门ID - password: string; //密码 - phone?: string; //手机号 - email?: string; //邮箱 - loginTime?: string;//最后一次登录时间 - loginErrorTimes: number;//登录错误次数 - lockTime?: string; //用户密码错误锁定时间 - state:number;//0-删除;1-正常;2-锁定;3-待审核;4-休眠;5-密码过期 - createBy?: string;//创建用户 - createTime?: string;//创建时间 - updateBy?: string;//更新用户 - updateTime?: string;//更新时间 - roleIds?: string[]; // - roleNames?:string[]; // - roleCodes?:string[]; // - disabled?: boolean; - } + export interface UserSaveRequest { + id?: string + name: string + loginName?: string + password?: string + deptId?: string | number + phone?: string + email?: string + roleIds?: string[] + } - // 用户接口 - export interface ResPassWordUser { - id: string; //用户ID,作为唯一标识 - oldPassword: string; //密码 - newPassword: string; //新密码 - surePassword:string; - } + // 用户接口 + export interface ResPassWordUser { + id: string //用户ID,作为唯一标识 + oldPassword: string //密码 + newPassword: string //新密码 + surePassword: string + } + /** + * 用户表格查询分页返回的对象; + */ + export interface ResUserPage extends ResPage {} + // // 用户+分页 + // export interface ReqUserParams extends ReqPage,UserBO { - /** - * 用户表格查询分页返回的对象; - */ - export interface ResUserPage extends ResPage { - - } - // // 用户+分页 - // export interface ReqUserParams extends ReqPage,UserBO { - - // } + // } } - diff --git a/frontend/src/api/user/user/index.ts b/frontend/src/api/user/user/index.ts index cb7dc06..f12a97a 100644 --- a/frontend/src/api/user/user/index.ts +++ b/frontend/src/api/user/user/index.ts @@ -1,43 +1,65 @@ +import type { AxiosResponse } from 'axios' +import http from '@/api' import type { Role } from '@/api/user/interface/role' import type { User } from '@/api/user/interface/user' -import http from '@/api' + +const buildUserFormData = (request: User.UserSaveRequest, signatureFile?: File | null) => { + const formData = new FormData() + + // 关键业务节点:新增和编辑用户都按 request JSON Part + signatureFile 文件分段提交,字段名必须与后端 @RequestPart 保持一致。 + formData.append('request', new Blob([JSON.stringify(request)], { type: 'application/json' })) + + if (signatureFile) { + formData.append('signatureFile', signatureFile) + } + + return formData +} /** * @name 用户管理模块 */ // 获取用户列表 export const getUserList = (params: User.ReqUserParams) => { - return http.post(`/sysUser/list`, params) + return http.post(`/sysUser/list`, params) } - // 新增用户 -export const addUser = (params: User.ResUser) => { - return http.post(`/sysUser/add`, params) +export const addUser = (request: User.UserSaveRequest, signatureFile?: File | null) => { + return http.post(`/sysUser/add`, buildUserFormData(request, signatureFile), { + headers: { 'Content-Type': 'multipart/form-data' } + }) } // 编辑用户 -export const updateUser = (params: User.ResUser) => { - return http.post(`/sysUser/update`, params) +export const updateUser = (request: User.UserSaveRequest, signatureFile?: File | null) => { + return http.post(`/sysUser/update`, buildUserFormData(request, signatureFile), { + headers: { 'Content-Type': 'multipart/form-data' } + }) } // 删除用户 -export const deleteUser = (params: string[] ) => { - return http.post(`/sysUser/delete`, params) +export const deleteUser = (params: string[]) => { + return http.post(`/sysUser/delete`, params) } - // 获取角色列表 export const getRoleList = () => { - return http.get(`/sysRole/simpleList`) + return http.get(`/sysRole/simpleList`) } -//修改密码 +// 修改密码 export const updatePassWord = (params: User.ResPassWordUser) => { - return http.post(`/sysUser/updatePassword`,params) + return http.post(`/sysUser/updatePassword`, params) } // 获取所有用户 -export const getAllUser= () => { - return http.get(`/sysUser/getAll`) +export const getAllUser = () => { + return http.get(`/sysUser/getAll`) +} + +export const previewUserSignature = (id: string): Promise> => { + return http.get(`/sysUser/${id}/signature`, undefined, { responseType: 'blob' }) as unknown as Promise< + AxiosResponse + > } diff --git a/frontend/src/views/aireport/testReport/components/ReportTaskFormDialog.vue b/frontend/src/views/aireport/testReport/components/ReportTaskFormDialog.vue index 62efb22..d21afcc 100644 --- a/frontend/src/views/aireport/testReport/components/ReportTaskFormDialog.vue +++ b/frontend/src/views/aireport/testReport/components/ReportTaskFormDialog.vue @@ -120,7 +120,7 @@
导入状态 - {{ canSubmit ? '已准备提交' : '待完成台账导入' }} + {{ canSubmit ? '已准备提交' : '待完成台账校验' }}
@@ -144,7 +144,7 @@ @@ -232,7 +232,7 @@ const REPORT_TASK_FORM_STEPS: Array<{ index: 1, value: 'import', title: '数据导入', - description: '先完成台账与附件导入' + description: '先完成台账与附件校验' }, { index: 2, @@ -272,6 +272,7 @@ const logPanelExpanded = ref(true) const logEntries = ref>([]) const ledgerPreparedState = ref({ draftId: '', + batchId: '', latestImportResult: null, snapshot: null, hasImported: false, @@ -395,6 +396,7 @@ const resetForm = () => { logEntries.value = [] ledgerPreparedState.value = { draftId: '', + batchId: '', latestImportResult: null, snapshot: null, hasImported: false, @@ -418,7 +420,7 @@ const applyInitialStep = (hasPreparedLedger: boolean) => { } currentStep.value = 'import' - pushLog('info', '已进入数据导入步骤,请先完成台账导入') + pushLog('info', '已进入数据导入步骤,请先完成台账校验') } const fillForm = async () => { @@ -439,6 +441,7 @@ const fillForm = async () => { activeDraftId.value = buildDraftId() ledgerPreparedState.value = { draftId: activeDraftId.value, + batchId: '', latestImportResult: null, snapshot, hasImported: Boolean(snapshot || Number(record?.pointCount) > 0), @@ -458,7 +461,7 @@ const fillForm = async () => { const goToFormStep = () => { if (!canSubmit.value) { - pushLog('warning', '当前导入尚未完成,不能进入基础信息填写步骤') + pushLog('warning', '当前校验尚未完成,不能进入基础信息填写步骤') return } @@ -468,7 +471,7 @@ const goToFormStep = () => { const goToImportStep = () => { currentStep.value = 'import' - pushLog('info', '已返回数据导入步骤,可继续沿用当前结果或重新导入台账') + pushLog('info', '已返回数据导入步骤,可继续沿用当前结果或重新校验台账') } const handleLedgerPreparedChange = (value: ReportTask.ReportTaskLedgerPreparedState) => { @@ -482,7 +485,7 @@ const handleLedgerPreparedChange = (value: ReportTask.ReportTaskLedgerPreparedSt if (!wasPrepared && checkReportTaskLedgerPrepared(nextState) && currentStep.value === 'import') { currentStep.value = 'form' - pushLog('success', '台账导入已完成,已自动进入基础信息填写步骤') + pushLog('success', '台账校验已完成,已自动进入基础信息填写步骤') } } @@ -539,14 +542,13 @@ const submitForm = async () => { } if (!checkReportTaskLedgerPrepared(ledgerPreparedState.value)) { - const message = '请先完成台账导入后再提交基础信息' + const message = '请先完成台账校验后再提交基础信息' ElMessage.warning(message) pushLog('warning', message) return } - // 关键业务节点:当前弹窗只接受已完成 ledger/import 的任务,再执行最终 add/update 保存基础信息。 - pushLog('info', props.mode === 'create' ? '开始提交新增任务基础信息' : '开始提交编辑后的任务基础信息') + pushLog('info', props.mode === 'create' ? '开始提交新增任务基础信息并写入台账数据' : '开始提交编辑后的任务基础信息并更新台账数据') emit('submit', { id: activeDraftId.value || formModel.id || undefined, no: formModel.no.trim(), @@ -556,6 +558,7 @@ const submitForm = async () => { contractNumber: formModel.contractNumber.trim(), standard: stringifyReportTaskStandardIds(formModel.standardIds), data: formModel.data.trim(), + batchId: ledgerPreparedState.value.batchId || undefined, phonenumber: formModel.phonenumber.trim() || undefined }) } @@ -563,12 +566,10 @@ const submitForm = async () => {