|  |  |  | 
|---|
|  |  |  | <div class="chuck-add-or-edit-actions"> | 
|---|
|  |  |  | <el-button class="chuck-add-or-edit-actions" @click="handleBack">取消</el-button> | 
|---|
|  |  |  | <el-button | 
|---|
|  |  |  | v-if="isSettlement" | 
|---|
|  |  |  | v-if=" | 
|---|
|  |  |  | isSettlement && | 
|---|
|  |  |  | (!!form.auditStatus || form.auditStatus === EnumTaskSettlementAuditStatus.Fail) | 
|---|
|  |  |  | " | 
|---|
|  |  |  | class="chuck-add-or-edit-actions" | 
|---|
|  |  |  | type="primary" | 
|---|
|  |  |  | @click="handleSubmit()" | 
|---|
|  |  |  | >结算</el-button | 
|---|
|  |  |  | >结算申请</el-button | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <el-button | 
|---|
|  |  |  | v-if="isSettlement && form.auditStatus === EnumTaskSettlementAuditStatus.Pass" | 
|---|
|  |  |  | class="chuck-add-or-edit-actions" | 
|---|
|  |  |  | type="primary" | 
|---|
|  |  |  | @click="handleSubmit()" | 
|---|
|  |  |  | >提交结算</el-button | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </ChunkCell> | 
|---|
|  |  |  | 
|---|
|  |  |  | import EditAccountInfoDialog from './components/EditAccountInfoDialog.vue'; | 
|---|
|  |  |  | import SettleDetailDialog from './components/SettleDetailDialog.vue'; | 
|---|
|  |  |  | import { Message } from '@bole-core/core'; | 
|---|
|  |  |  | import { SettlementReceiveStatusText } from '@/constants'; | 
|---|
|  |  |  | import { SettlementReceiveStatusText, EnumTaskSettlementAuditStatus } from '@/constants'; | 
|---|
|  |  |  | import { | 
|---|
|  |  |  | downloadFile, | 
|---|
|  |  |  | downloadFileByUrl, | 
|---|
|  |  |  | 
|---|
|  |  |  | const route = useRoute(); | 
|---|
|  |  |  | const id = (route.params.id as string) ?? ''; | 
|---|
|  |  |  | const settlement = (route.query.settlement as string) ?? ''; | 
|---|
|  |  |  | // const settlementAccess = route.query.settlementAccess ?? ''; | 
|---|
|  |  |  | const isSettlement = computed(() => !!settlement); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const form = reactive({ | 
|---|
|  |  |  | 
|---|
|  |  |  | settlementTaskUsers: [] as API.GetSettlementTaskUsersQueryResultItem[], | 
|---|
|  |  |  |  | 
|---|
|  |  |  | settlementUrl: [] as UploadUserFile[], | 
|---|
|  |  |  |  | 
|---|
|  |  |  | settlementAccess: '' as any as EnumEnterpriseWalletAccess, | 
|---|
|  |  |  | isSettlement: isSettlement.value, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | auditStatus: '' as any as EnumTaskSettlementAuditStatus, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const BaseState = { | 
|---|
|  |  |  | 
|---|
|  |  |  | const state = reactive({ ...BaseState }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { isLoading, refetch } = useQuery({ | 
|---|
|  |  |  | queryKey: ['taskUserServices/getSettlementTaskUsers', id], | 
|---|
|  |  |  | queryKey: ['taskUserServices/getSettlementTaskUsers', id, toRef(form, 'isSettlement')], | 
|---|
|  |  |  | queryFn: async () => { | 
|---|
|  |  |  | return await taskUserServices.getSettlementTaskUsers( | 
|---|
|  |  |  | { id: id }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | showLoading: false, | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | let params: API.APIgetSettlementTaskUsersParams = { | 
|---|
|  |  |  | id: id, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | // if (form.settlementAccess) { | 
|---|
|  |  |  | //   params.settlementAccess = Number(form.settlementAccess); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | if (form.isSettlement) { | 
|---|
|  |  |  | params.isImport = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return await taskUserServices.getSettlementTaskUsers(params, { | 
|---|
|  |  |  | showLoading: false, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | placeholderData: () => ({} as API.GetSettlementTaskUsersQueryResult), | 
|---|
|  |  |  | onSuccess(res) { | 
|---|
|  |  |  | 
|---|
|  |  |  | form.settlementAmount = res?.detail?.settlementAmount ?? 0; | 
|---|
|  |  |  | form.actualSettlementAmount = res?.detail?.actualSettlementAmount ?? 0; | 
|---|
|  |  |  | form.code = res?.detail?.code; | 
|---|
|  |  |  | form.settlementAccess = res?.detail?.settlementAccess; | 
|---|
|  |  |  | form.auditStatus = res?.detail?.auditStatus; | 
|---|
|  |  |  | // form.settlementOrderName = setOssFileName(res?.detail?.settlementOrderName); | 
|---|
|  |  |  | // form.settlementOrderTime = res?.detail?.settlementOrderTime ?? ''; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | actualSettlementAmount: null as number, | 
|---|
|  |  |  | receiveAccount: '', | 
|---|
|  |  |  | bank: '', | 
|---|
|  |  |  | bankBranch: '', | 
|---|
|  |  |  | totalWorkHours: null as number, | 
|---|
|  |  |  | settlementAccess: form.settlementAccess, | 
|---|
|  |  |  | // bankBranch: '', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | actualSettlementAmount: row?.actualSettlementAmount ?? null, | 
|---|
|  |  |  | receiveAccount: row?.receiveAccount ?? '', | 
|---|
|  |  |  | bank: row?.bank ?? '', | 
|---|
|  |  |  | bankBranch: row?.bankBranch ?? '', | 
|---|
|  |  |  | totalWorkHours: null as number, | 
|---|
|  |  |  | settlementAccess: form.settlementAccess, | 
|---|
|  |  |  | // bankBranch: row?.bankBranch ?? '', | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | actualSettlementAmount: editForm.actualSettlementAmount, | 
|---|
|  |  |  | receiveAccount: editForm.receiveAccount, | 
|---|
|  |  |  | bank: editForm.bank, | 
|---|
|  |  |  | bankBranch: editForm.bankBranch, | 
|---|
|  |  |  | totalWorkHours: editForm.totalWorkHours, | 
|---|
|  |  |  | // bankBranch: editForm.bankBranch, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await taskServices.editTaskSettlementOrderRoster(params); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | Message.successMessage('操作成功'); | 
|---|
|  |  |  | form.isSettlement = false; | 
|---|
|  |  |  | refetch(); | 
|---|
|  |  |  | getList(paginationState.pageIndex); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | let res = await taskServices.importTaskSettlementOrderRosters(params); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | Message.successMessage('操作成功'); | 
|---|
|  |  |  | form.isSettlement = false; | 
|---|
|  |  |  | refetch(); | 
|---|
|  |  |  | getList(paginationState.pageIndex); | 
|---|
|  |  |  | if (res?.errors?.length > 0) { | 
|---|
|  |  |  | 
|---|
|  |  |  | workbookHeaderMap: { | 
|---|
|  |  |  | name: '姓名', | 
|---|
|  |  |  | identity: '身份证号', | 
|---|
|  |  |  | taskName: '任务名称', | 
|---|
|  |  |  | contactPhoneNumber: '手机号', | 
|---|
|  |  |  | bank: '所属银行', | 
|---|
|  |  |  | bankBranch: '所属支行', | 
|---|
|  |  |  | receiveAccount: '收款账户', | 
|---|
|  |  |  | settlementAmount: '结算金额', | 
|---|
|  |  |  | actualSettlementAmount: '实发金额', | 
|---|
|  |  |  | receiveAccount: '收款账户', | 
|---|
|  |  |  | bank: '所属银行', | 
|---|
|  |  |  | bankBranch: '开户支行名称', | 
|---|
|  |  |  | errorMessage: '错误信息', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  | code: form.code, | 
|---|
|  |  |  | settlementUserCount: form.settlementTaskUsers.length, | 
|---|
|  |  |  | actualSettlementAmount: form.actualSettlementAmount, | 
|---|
|  |  |  | settlementAccess: form.settlementAccess, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | code: '', | 
|---|
|  |  |  | settlementUserCount: 0, | 
|---|
|  |  |  | actualSettlementAmount: 0, | 
|---|
|  |  |  | settlementAccess: '' as any as EnumEnterpriseWalletAccess, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|