wupengfei
11 小时以前 9c8b6d1cf6b43c6652b5183cd0183e8e257001f7
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<template>
  <ProTabs
    v-model="queryState.status"
    name="home-tab"
    :showPaneContent="false"
    class="home-tabs"
    isTransparent
    title-gutter="12"
    title-scroll
  >
    <ProTabPane :title="`灵工待签约`" :pane-key="Status.FlexJobWait"></ProTabPane>
    <ProTabPane :title="`企业待签约`" :pane-key="Status.EnterpriseWait"></ProTabPane>
    <ProTabPane :title="`已签约`" :pane-key="Status.Pass"></ProTabPane>
    <!-- <ProTabPane :title="`已解约`" :pane-key="EnumTaskUserSignContractStatus.Stop"></ProTabPane> -->
  </ProTabs>
  <InfiniteLoading
    scrollViewClassName="common-infinite-scroll-list home-list"
    v-bind="infiniteLoadingProps"
    :key="queryState.status"
  >
    <template #renderItem="{ item }">
      <FlexJobCard
        :show-done-detail="false"
        :show-footer-left="false"
        :name="item.name"
        :gender="item.gender"
        :age="item.age"
        :isReal="item.userIsReal"
        :personalIdentityContent="item.personalIdentityContent"
        :educationalBackgroundContent="item.educationalBackgroundContent"
        :taskCount="item.taskCount"
        :avatar="item.avatar"
        :workExperience="item.workExperience"
        :workSeniority="item.workSeniority"
        @click="goDetail(item)"
      >
        <template #footerRight>
          <template
            v-if="item.enterpriseSignContractStatus === EnumTaskUserSignContractStatus.Pass"
          >
            <nut-button
              class="flexJobManage-card-plain-button"
              type="default"
              plain
              @click.stop="handleUnsign(item)"
              >解约</nut-button
            >
            <nut-button type="primary" @click.stop="checkContract(item)">查看合约</nut-button>
          </template>
          <nut-button
            v-if="item.userSignContractStatus === EnumTaskUserSignContractStatus.Wait"
            type="primary"
            @click.stop="goFlexJobSign(item)"
            >邀请签约</nut-button
          >
          <nut-button
            v-if="item.enterpriseSignContractStatus === EnumTaskUserSignContractStatus.Wait"
            type="primary"
            @click.stop="goFlexJobSign(item)"
            >企业签约</nut-button
          >
        </template>
      </FlexJobCard>
    </template>
  </InfiniteLoading>
</template>
 
<script setup lang="ts">
import { FlexJobCard, ProTabs, ProTabPane } from '@12333/components';
import { RouterPath } from '@/constants';
import { useInfiniteLoading } from '@12333/hooks';
import {
  EnumTaskUserHireStatus,
  EnumTaskUserSignContractStatus,
  EnumPagedListOrder,
} from '@12333/constants';
import * as enterpriseEmployeeServices from '@12333/services/apiV2/enterpriseEmployee';
import Taro from '@tarojs/taro';
import { Message, openDocument, setOSSLink } from '@12333/utils';
 
defineOptions({
  name: 'InnerPage',
});
 
const enum Status {
  FlexJobWait = 1,
  EnterpriseWait = 2,
  Pass = 3,
}
 
const queryState = reactive({
  status: Status.FlexJobWait,
});
 
const { infiniteLoadingProps, invalidateQueries } = useInfiniteLoading(
  ({ pageParam }) => {
    let params: API.GetEnterpriseEmployeesQuery = {
      pageModel: {
        rows: 20,
        page: pageParam,
        orderInput: [{ property: 'id', order: EnumPagedListOrder.Desc }],
      },
      hireStatus: EnumTaskUserHireStatus.Pass,
    };
    if (Number(queryState.status) === Status.FlexJobWait) {
      params.userSignContractStatus = EnumTaskUserSignContractStatus.Wait;
    }
    if (Number(queryState.status) === Status.EnterpriseWait) {
      params.enterpriseSignContractStatus = EnumTaskUserSignContractStatus.Wait;
    }
    if (Number(queryState.status) === Status.Pass) {
      params.userSignContractStatus = EnumTaskUserSignContractStatus.Pass;
    }
 
    return enterpriseEmployeeServices.getEnterpriseEmployees(params, {
      showLoading: false,
    });
  },
  {
    queryKey: ['enterpriseEmployeeServices/getEnterpriseEmployees', queryState],
  }
);
 
function checkContract(item: API.GetEnterpriseEmployeesQueryResultItem) {
  if (!item.contractUrl) {
    Message.warning('协议无法查看,请稍后再试');
    return;
  }
  openDocument(setOSSLink(item.contractUrl));
}
 
function goDetail(item: API.GetEnterpriseEmployeesQueryResultItem) {
  Taro.navigateTo({
    url: `${RouterPath.flexJobDetailFromManage}?enterpriseEmployeeId=${item.id}`,
  });
}
 
async function handleUnsign(item: API.GetEnterpriseEmployeesQueryResultItem) {
  try {
    await Message.confirm({ message: '确定要解约吗?' });
    let params: API.StopElectronSignCommand = {
      ids: [item.id],
    };
    let res = await enterpriseEmployeeServices.stopElectronSign(params);
    if (res) {
      Message.success('解约成功');
      invalidateQueries();
    }
  } catch (error) {}
}
function goFlexJobSign(item: API.GetEnterpriseEmployeesQueryResultItem) {
  Taro.navigateTo({
    url: `${RouterPath.flexJobSign}?enterpriseEmployeeId=${item.id}`,
  });
}
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
 
.flexJobManage-page-wrapper {
  .flexJobManage-card-plain-button {
    margin-right: 30px;
 
    &.nut-button--plain {
      border-width: 1px;
    }
  }
}
</style>