recommend.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <a-modal
  3. :width="1100"
  4. v-model:visible="visible"
  5. :title="title"
  6. :confirm-loading="confirmLoading"
  7. @ok="handleOk"
  8. ok-text="确认"
  9. cancel-text="取消"
  10. :keyboard="false"
  11. :mask-closable="false"
  12. >
  13. <div class="card-search">
  14. <a-form
  15. ref="formRef"
  16. name="advanced_search"
  17. class="ant-advanced-search-form"
  18. :model="searchParams"
  19. >
  20. <a-row :gutter="24">
  21. <a-col :span="6">
  22. <a-form-item label="求职者" :label-col="{ span: 8 }" name="name">
  23. <a-input v-model:value="searchParams.jobUserName" style="color: black;" disabled="true" placeholder=""/>
  24. </a-form-item>
  25. </a-col>
  26. <a-col :span="6">
  27. <a-form-item label="求职岗位" :label-col="{ span: 8 }" name="professionName">
  28. <a-input v-model:value="searchParams.professionName" style="color: black;" disabled="true"
  29. placeholder=""/>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :span="6">
  33. <a-form-item label="企业名称" :label-col="{ span: 8 }" name="companyName">
  34. <a-input v-model:value="searchParams.companyName" placeholder=""/>
  35. </a-form-item>
  36. </a-col>
  37. <a-col :span="4" style="text-align: left">
  38. <a-button type="primary" html-type="submit" @click="onSearch">查询</a-button>
  39. <a-button
  40. style="margin: 0 8px"
  41. @click="
  42. () => {
  43. searchParams.pageIndex = 1;
  44. searchParams.pageSize = 10;
  45. searchParams.companyName = null;
  46. loadData();
  47. }
  48. ">重置
  49. </a-button>
  50. <!-- <a style="font-size: 12px" @click="expand = !expand">-->
  51. <!-- <template v-if="expand">-->
  52. <!-- <UpOutlined />-->
  53. <!-- </template>-->
  54. <!-- <template v-else>-->
  55. <!-- <DownOutlined />-->
  56. <!-- </template>-->
  57. <!-- {{ expand ? '收缩' : '展开' }}-->
  58. <!-- </a>-->
  59. </a-col>
  60. </a-row>
  61. <a-row class="edit-operation">
  62. <a-col :span="24" style="text-align: right">
  63. <a-button type="primary" v-if="searchParams.type===0" html-type="submit" functioncode="T01030202" @click='onBatchRecommend()'>批量推荐
  64. </a-button>
  65. </a-col>
  66. </a-row>
  67. </a-form>
  68. <div class="search-result-list">
  69. <a-table :columns="columns" :data-source="dataList" :scroll="{ x: '100%', y: 500 }" :pagination="pagination"
  70. :loading="formState.loading"
  71. :row-selection="{ selectedRowKeys: formState.selectedRowKeys, onChange: onSelectChange }"
  72. :row-key="(record) => record.recommendMgtID" bordered @change="handleTableChange">
  73. <template #bodyCell="{ column, text, record }">
  74. <template v-if="searchParams.type===0 && column.key === 'operation'">
  75. <div class="table-operation">
  76. <a-button type="link" size="small" @click='onRecommend(record)'>推荐</a-button>
  77. </div>
  78. </template>
  79. </template>
  80. </a-table>
  81. </div>
  82. </div>
  83. </a-modal>
  84. </template>
  85. <script lang="ts">
  86. import {reactive, ref, computed, defineComponent} from 'vue';
  87. import type {FormInstance, TableColumnsType, TableProps} from 'ant-design-vue';
  88. import {getRecommendCompanyPostList, addRecommend} from '@/api/jobUserManager/recommendMgt';
  89. import {getPaginationTotalTitle} from '@/utils/common';
  90. import dayjs from 'dayjs';
  91. import {message} from "ant-design-vue";
  92. export default defineComponent({
  93. name: 'RecommendCompanyPostList',
  94. setup() {
  95. const visible = ref<boolean>(false);
  96. const confirmLoading = ref<boolean>(false);
  97. const formRef = ref<FormInstance>();
  98. const expand = ref(false);
  99. const title = ref<string>();
  100. const searchParams = reactive({
  101. pageIndex: 1,
  102. pageSize: 10,
  103. jobUserName: null,
  104. jobHuntID: '',
  105. professionID: '',
  106. companyName: null,
  107. professionName: null,
  108. type: 0
  109. });
  110. const formState = reactive({
  111. total: 0,
  112. selectedRowKeys: [],
  113. loading: false,
  114. });
  115. const columns: TableColumnsType = [
  116. {
  117. title: '序号',
  118. align: 'center',
  119. width: 80,
  120. key: 'recommendMgtID',
  121. customRender: (item) =>
  122. `${searchParams.pageSize * (searchParams.pageIndex - 1) + item.index + 1}`,
  123. },
  124. {title: '企业名称', dataIndex: 'companyName', key: 'companyName', width: 100, align: "center",},
  125. {title: '岗位名称', dataIndex: 'professionName', key: 'professionName', width: 150, align: "center",},
  126. {title: '招聘人数', dataIndex: 'recruitCount', key: 'recruitCount', width: 150, align: "center",},
  127. {
  128. title: '工作开始时间', dataIndex: 'startTime', key: 'startTime', width: 100, align: "center",
  129. customRender: ({record}) => record.startTime == null ? "" : dayjs(record.startTime).format('YYYY-MM-DD'),
  130. },
  131. {
  132. title: '工作结束时间', dataIndex: 'endTime', key: 'endTime', width: 100, align: "center",
  133. customRender: ({record}) => record.endTime == null ? "" : dayjs(record.endTime).format('YYYY-MM-DD'),
  134. },
  135. {title: '工作地点', dataIndex: 'companyAddress', key: 'companyAddress', width: 150, align: "center",},
  136. {title: '操作', key: 'operation', width: 60, align: 'center'},
  137. ];
  138. const pagination = computed(() => ({
  139. total: formState.total,
  140. current: searchParams.pageIndex,
  141. pageSize: searchParams.pageSize,
  142. showSizeChanger: true,
  143. showTotal: (total) => getPaginationTotalTitle(total),
  144. }));
  145. const dataList = ref([]);
  146. const addRecommendList = ref([] as any);
  147. const onSelectChange = (selectedRowKeys: any) => {
  148. formState.selectedRowKeys = selectedRowKeys;
  149. };
  150. const handleTableChange: TableProps['onChange'] = (pag: {
  151. pageSize: number;
  152. current: number;
  153. }) => {
  154. searchParams.pageIndex = pag.current;
  155. searchParams.pageSize = pag.pageSize;
  156. loadData();
  157. };
  158. const onSearch = () => {
  159. loadData();
  160. }
  161. const loadData = async function () {
  162. formState.loading = true;
  163. const result: any = await getRecommendCompanyPostList(searchParams);
  164. dataList.value = result.list;
  165. formState.total = result.total;
  166. formState.loading = false;
  167. };
  168. const show = (professionID: any, professionName: any, jobHuntID: any, jobUserName: any, type: any, titleName: string) => {
  169. visible.value = true;
  170. searchParams.jobHuntID = jobHuntID;
  171. searchParams.jobUserName = jobUserName;
  172. searchParams.professionID = professionID;
  173. searchParams.professionName = professionName;
  174. searchParams.type = type;
  175. title.value = titleName;
  176. loadData();
  177. }
  178. const onRecommend = (item: any) => {
  179. addRecommendList.value.push({
  180. recommendMgtID: item.recommendMgtID,
  181. postID: item.postID,
  182. jobHuntID: searchParams.jobHuntID,
  183. recommendType: 1
  184. });
  185. addRecommend(addRecommendList.value).then(() => {
  186. loadData();
  187. addRecommendList.value = [];
  188. });
  189. };
  190. const onBatchRecommend = () => {
  191. if (formState.selectedRowKeys.length == 0) {
  192. message.warn("请选择需要推荐的企业!")
  193. return;
  194. }
  195. formState.selectedRowKeys.forEach(id => {
  196. const item: any = dataList.value.find((x: any) => x.recommendMgtID == id)
  197. if (item) {
  198. addRecommendList.value.push({
  199. recommendMgtID: item.recommendMgtID,
  200. postID: item.postID,
  201. jobHuntID: searchParams.jobHuntID,
  202. recommendType: 1
  203. });
  204. }
  205. })
  206. addRecommend(addRecommendList.value).then(() => {
  207. loadData();
  208. addRecommendList.value = [];
  209. });
  210. };
  211. const handleOk = () => {
  212. visible.value = false;
  213. };
  214. const handleCancel = () => {
  215. visible.value = false;
  216. };
  217. return {
  218. title,
  219. visible,
  220. confirmLoading,
  221. formRef,
  222. expand,
  223. searchParams,
  224. formState,
  225. columns,
  226. pagination,
  227. dataList,
  228. show,
  229. onSearch,
  230. onRecommend,
  231. onBatchRecommend,
  232. onSelectChange,
  233. handleTableChange,
  234. loadData,
  235. handleOk,
  236. handleCancel
  237. };
  238. },
  239. created() {
  240. }
  241. });
  242. </script>
  243. <style lang="less" scoped></style>