diff --git a/src/api/project/constructionUser/index.ts b/src/api/project/constructionUser/index.ts index 6f8fe98..dee8ffe 100644 --- a/src/api/project/constructionUser/index.ts +++ b/src/api/project/constructionUser/index.ts @@ -1,4 +1,4 @@ -import request from '@/utils/request'; +import request, { download } from '@/utils/request'; import { AxiosPromise } from 'axios'; import { ConstructionUserForm, @@ -9,7 +9,8 @@ import { ConstructionUserPlayCardForm, ConstructionUserSalaryForm, ConstructionUserExitForm, - ConstructionUserTemplateForm + ConstructionUserTemplateForm, + ConstructionUserMembeForm } from '@/api/project/constructionUser/types'; /** @@ -159,9 +160,31 @@ export const getConstructionUserExit = (query: ConstructionUserExitForm) => { * @param query */ export const dowloadConstructionUserTemplate = (query: ConstructionUserTemplateForm) => { + let { projectId } = query; + const fileName = projectId + '_project.zip'; + return download('/project/constructionUserFile/exportFileTemplate', query, fileName); +}; + +/** + * 施工人员退场 + * @param data + */ +export const delConstructionUserMember = (data: ConstructionUserMembeForm) => { return request({ - url: '/project/constructionUserFile/exportFileTemplate', - method: 'get', - params: query + url: '/project/projectTeamMember/', + method: 'delete', + data + }); +}; + +/** + * 上传施工人员文件压缩包,批量导入存储施工人员文件 + * @param data + */ +export const importConstructionUserInfo = (file: string) => { + return request({ + url: '/project/constructionUserFile/upload/zip', + method: 'post', + data: { file } }); }; diff --git a/src/api/project/constructionUser/types.ts b/src/api/project/constructionUser/types.ts index 51e9075..ed25ef9 100644 --- a/src/api/project/constructionUser/types.ts +++ b/src/api/project/constructionUser/types.ts @@ -197,6 +197,25 @@ export interface skipType { id: string | number; } +export interface ConstructionUserMembeForm { + /** + * 用户id + */ + id: string | number; + /** + * 用户姓名 + */ + userName: string | number; + /** + * 文件路径 + */ + filePath: string; + /** + * 备注 + */ + remark: string | number; +} + export interface ConstructionUserTemplateForm { /** * 项目id @@ -300,6 +319,10 @@ export interface ConstructionUserForm extends BaseEntity { * 分包公司id */ contractorId?: string | number; + /** + * 结算方式 + */ + wageMeasureUnit?: string | number; /** * 班组id diff --git a/src/api/project/constructionUserFile/types.ts b/src/api/project/constructionUserFile/types.ts index 75a9851..30c4473 100644 --- a/src/api/project/constructionUserFile/types.ts +++ b/src/api/project/constructionUserFile/types.ts @@ -40,6 +40,10 @@ export interface ConstructionUserExitVO { * 用户id */ userId: string | number; + /** + * 文件路径地址 + */ + pathUrl: Array; /** * 身份证号码 diff --git a/src/api/project/projectTeamMember/types.ts b/src/api/project/projectTeamMember/types.ts index ab4f202..dc5ba3b 100644 --- a/src/api/project/projectTeamMember/types.ts +++ b/src/api/project/projectTeamMember/types.ts @@ -24,6 +24,11 @@ export interface ProjectTeamMemberVO { */ postId: string | number; + /** + * 施工人员姓名 + */ + memberName: string; + /** * 备注 */ diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index 2dc5933..6640258 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -16,8 +16,9 @@ :list-type="isConstruction ? 'picture-card' : 'text'" > - 选取文件 - + 选取文件 + 导入员工资料 + - + - @@ -129,8 +150,8 @@ import { } from '@/api/project/projectTeamMember'; import { computed, reactive, ref } from 'vue'; import { useUserStoreHook } from '@/store/modules/user'; -import { listConstructionUser } from '@/api/project/constructionUser'; -import { ConstructionUserQuery, ConstructionUserVO } from '@/api/project/constructionUser/types'; +import { listConstructionUser, delConstructionUserMember } from '@/api/project/constructionUser'; +import { ConstructionUserQuery, ConstructionUserVO, ConstructionUserMembeForm } from '@/api/project/constructionUser/types'; // 获取用户 store const userStore = useUserStoreHook(); @@ -138,10 +159,16 @@ const userStore = useUserStoreHook(); const currentProject = computed(() => userStore.selectedProject); const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { user_post_type } = toRefs(proxy?.useDict('user_post_type')); - +const memberStatus = ref(false); interface Props { projectTeamVo: ProjectTeamVO; } +const memberForm = reactive({ + id: undefined, + filePath: undefined, + remark: undefined, + userName: undefined +}); const props = defineProps(); // 是否可见 @@ -160,6 +187,9 @@ const data = reactive>({ }, rules: { id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }] + }, + memberRules: { + filePath: [{ required: true, message: '请上传退场文件', trigger: 'blur' }] } }); const buttonLoading = ref(false); @@ -170,12 +200,13 @@ const multiple = ref(true); const total = ref(0); const queryFormRef = ref(); const projectTeamMemberFormRef = ref(); +const memberFormRef = ref(); const dialog = reactive({ visible: false, title: '' }); -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules, memberRules } = toRefs(data); const projectTeamMemberList = ref([]); /** 查询项目班组下的成员列表 */ const getList = async () => { @@ -277,6 +308,31 @@ const submitForm = () => { }); }; +/** 确定退场按钮 */ +const submitMemberForm = async () => { + memberFormRef.value?.validate(async (valid: boolean) => { + if (valid) { + buttonLoading.value = true; + await delConstructionUserMember(memberForm).finally(() => (buttonLoading.value = false)); + proxy?.$modal.msgSuccess('操作成功'); + dialog.visible = false; + await getList(); + memberForm.filePath = undefined; + memberForm.remark = undefined; + } + }); + memberStatus.value = false; +}; + +/** 退场按钮操作 */ +const handleExit = async (row?: ProjectTeamMemberVO) => { + const _ids = row?.id || ids.value; + memberForm.userName = row?.memberName; + console.log('🚀 ~ handleDelete ~ row:', row); + memberForm.id = row?.id; + memberStatus.value = true; +}; + /** 删除按钮操作 */ const handleDelete = async (row?: ProjectTeamMemberVO) => { const _ids = row?.id || ids.value; diff --git a/src/views/project/projectTeam/index.vue b/src/views/project/projectTeam/index.vue index ecfb730..a80153a 100644 --- a/src/views/project/projectTeam/index.vue +++ b/src/views/project/projectTeam/index.vue @@ -86,7 +86,7 @@ - +