wupengfei
4 天以前 a51125457eb11c447c0e9be8ccdfe5517d5cd106
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<template>
  <LoadingLayout :loading="isLoading" :error="isError" :loadError="refetch">
    <JobDetailContent :isCollapse="true">
      <template #footer>
        <PageFooterBtn type="primary" plain @click="taskWorkerHireRefuse(10)">谢绝</PageFooterBtn>
        <PageFooterBtn type="primary" @click="taskWorkerHireRefuse(20)">录用</PageFooterBtn>
      </template>
    </JobDetailContent>
  </LoadingLayout>
</template>
 
<script setup lang="ts">
import Taro from '@tarojs/taro';
import { useQuery } from '@tanstack/vue-query';
import * as taskUserServices from '@12333/services/apiV2/taskUser';
import { Message } from '@12333/utils';
 
defineOptions({
  name: 'InnerPage',
});
 
const router = Taro.useRouter();
const id = router.params?.id ?? '';
 
const {
  isLoading,
  isError,
  data: detail,
  refetch,
} = useQuery({
  queryKey: ['taskServices/getTaskInfo', id],
  queryFn: async () => {
    return await taskServices.getTaskInfo(
      { id: id },
      {
        showLoading: false,
      }
    );
  },
  placeholderData: () => ({} as API.GetTaskInfoQueryResult),
});
 
async function taskWorkerHireRefuse(hireStatus: FlexTaskWorkerHireEnum) {
  try {
    let params: API.SetTaskUserHireCommand = {
      id: id,
      hireStatus: hireStatus,
    };
    let res = await taskUserServices.setTaskUserHire(params);
    if (res) {
      Message.success('操作成功');
      refetch({
        type: 'inactive',
      });
    }
  } catch (error) {}
}
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
</style>