index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <div class="card-search">
  3. <a-form
  4. ref="formRef"
  5. name="advanced_search"
  6. class="ant-advanced-search-form"
  7. :model="searchParamsState"
  8. >
  9. <a-row :gutter="24">
  10. <a-col :span="6">
  11. <a-form-item label="姓名" :label-col="{ span: 8 }" name="jobUserName">
  12. <a-input v-model:value="searchParamsState.jobUserName" placeholder="" />
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="工种名称" :label-col="{ span: 8 }" name="workName">
  17. <a-input v-model:value="searchParamsState.workName" placeholder="" />
  18. </a-form-item>
  19. </a-col>
  20. <a-col :span="8">
  21. <a-form-item label="工作年限" :label-col="{ span: 6 }" name="workYear">
  22. <a-input type="number" v-model:value="searchParamsState.minWorkYear" style="width:110px;" placeholder="" />
  23. <label style="margin:10px;">-</label>
  24. <a-input type="number" v-model:value="searchParamsState.maxWorkYear" style="width:110px;" placeholder="" />
  25. </a-form-item>
  26. </a-col>
  27. <a-col :span="4" style="text-align: left">
  28. <a-button type="primary" html-type="submit" @click="onSearch">查询</a-button>
  29. <a-button
  30. style="margin: 0 8px"
  31. @click="
  32. () => {
  33. formRef.resetFields();
  34. loadData();
  35. }
  36. ">重置</a-button>
  37. <a style="font-size: 12px" @click="expand = !expand">
  38. <template v-if="expand">
  39. <UpOutlined />
  40. </template>
  41. <template v-else>
  42. <DownOutlined />
  43. </template>
  44. {{ expand ? '收缩' : '展开' }}
  45. </a>
  46. </a-col>
  47. </a-row>
  48. <a-row :gutter="24" v-show="expand">
  49. <a-col :span="6">
  50. <a-form-item label="求职类型" :label-col="{ span: 8 }" name="jobHuntTypeID">
  51. <a-select ref="select"
  52. v-model:value="searchParamsState.jobHuntTypeID"
  53. :options="jobHuntTypeList"
  54. :field-names="{ label: 'name', value: 'value' }"
  55. :allow-clear="true"
  56. @change="loadData"
  57. >
  58. </a-select>
  59. </a-form-item>
  60. </a-col>
  61. <a-col :span="6">
  62. <a-form-item label="人才类型" :label-col="{ span: 8 }" name="jobUserTypeID">
  63. <a-select ref="select"
  64. v-model:value="searchParamsState.jobUserTypeID"
  65. :options="jobUserTypeList"
  66. :field-names="{ label: 'name', value: 'value' }"
  67. :allow-clear="true"
  68. @change="loadData">
  69. </a-select>
  70. </a-form-item>
  71. </a-col>
  72. <a-col :span="8">
  73. <a-form-item label="月薪要求" :label-col="{ span: 6 }" name="salary">
  74. <a-input type="number" v-model:value="searchParamsState.minSalary" style="width:110px;" placeholder="" />
  75. <label style="margin:10px;">-</label>
  76. <a-input type="number" v-model:value="searchParamsState.maxSalary" style="width:110px;" placeholder="" />
  77. </a-form-item>
  78. </a-col>
  79. <a-col :span="4" style="text-align: left"></a-col>
  80. </a-row>
  81. <a-row :gutter="24" v-show="expand">
  82. <a-col :span="6">
  83. <a-form-item label="是否完成求职" :label-col="{ span: 8 }" name="isAccomplish">
  84. <a-select ref="select"
  85. v-model:value="searchParamsState.isAccomplish"
  86. :options="isAccomplishList"
  87. :field-names="{ label: 'name', value: 'value' }"
  88. :allow-clear="true"
  89. @change="loadData"
  90. >
  91. </a-select>
  92. </a-form-item>
  93. </a-col>
  94. <a-col :span="6"> </a-col>
  95. <a-col :span="8"> </a-col>
  96. <a-col :span="4" style="text-align: left"> </a-col>
  97. </a-row>
  98. <a-row class="edit-operation">
  99. <a-col :span="24" style="text-align: right">
  100. <a-button type="primary" html-type="submit" functioncode="T01030202" @click='onAdd' >新增</a-button>
  101. <BImportExcel functioncode="T01030205"
  102. :options="importOptions"
  103. @success="loadData"
  104. ></BImportExcel>
  105. <BExportExcel :title="'导出'" :filename="'求职意向信息'" :url="'/jobUserService/jobHunt/export'" :params="{...searchParamsState, rows:100000,jobHuntIDList:formState.selectedRowKeys.join(',')}"></BExportExcel>
  106. </a-col>
  107. </a-row>
  108. </a-form>
  109. <div class="search-result-list">
  110. <a-table :columns="columns" :data-source="dataList" :scroll="{ x: '100%', y: 500 }" :pagination="pagination"
  111. :loading="formState.loading" :row-selection="{ selectedRowKeys: formState.selectedRowKeys, onChange: onSelectChange }"
  112. :row-key="(record) => record.jobHuntID" bordered @change="handleTableChange" >
  113. <template #bodyCell="{ column, text, record }">
  114. <template v-if="column.key === 'operation'">
  115. <div class="table-operation">
  116. <a-button type="link" size="small" functioncode="T01030203" @click='onEdit(record.jobHuntID)' >编辑</a-button>
  117. <a-button type="link" size="small" functioncode="T01030204" @click="onDel(record)" >删除</a-button>
  118. </div>
  119. </template>
  120. </template>
  121. </a-table>
  122. </div>
  123. </div>
  124. </template>
  125. <script lang="ts">
  126. import {reactive, ref, computed, defineComponent, createVNode} from 'vue';
  127. import type { FormInstance, TableColumnsType, TableProps, SelectProps } from 'ant-design-vue';
  128. import { getJobHuntList, delJobHunt} from '@/api/jobUserManager/jobhunt';
  129. import { getSysDictionaryList } from '@/api/system/dictionary';
  130. import { getPaginationTotalTitle } from '@/utils/common';
  131. import dayjs from 'dayjs';
  132. import BImportExcel from "@/components/basic/excel/importExcel/importExcel.vue";
  133. import BExportExcel from "@/components/basic/excel/exportExcel/exportExcel.vue";
  134. import {message, Modal} from "ant-design-vue";
  135. import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
  136. import type {ImportProps} from "@/components/basic/excel/importExcel/ImportProps";
  137. import {useTabsViewStore} from "@/store/modules/tabsView";
  138. export default defineComponent({
  139. name: 'JobHuntList',
  140. components: {BImportExcel,BExportExcel},
  141. setup() {
  142. const formRef = ref<FormInstance>();
  143. const tabsViewStore = useTabsViewStore();
  144. const expand = ref(false);
  145. const searchParamsState = reactive({
  146. pageIndex: 1,
  147. pageSize: 20,
  148. jobUserName: null,
  149. workName:null,
  150. minWorkYear: null,
  151. maxWorkYear: null,
  152. jobHuntTypeID: null,
  153. jobUserTypeID:null,
  154. minSalary:null,
  155. maxSalary:null,
  156. isAccomplish:null
  157. });
  158. const formState = reactive({
  159. total: 0,
  160. selectedRowKeys: [],
  161. loading: false,
  162. });
  163. const columns: TableColumnsType = [
  164. {
  165. title: '序号',
  166. align: 'center',
  167. width: 80,
  168. key: 'jobHuntID',
  169. customRender: (item) =>
  170. `${searchParamsState.pageSize * (searchParamsState.pageIndex - 1) + item.index + 1}`,
  171. },
  172. { title: '姓名', dataIndex: 'jobUserName', key: 'jobUserName', width: 100,align: "center", },
  173. { title: '工种名称', dataIndex: 'workName', key: 'workName', width: 150, align: "center", },
  174. { title: '希望工作地区', dataIndex: 'areaWork', key: 'areaWork', width: 150, align: "center", },
  175. { title: '可到职日期', dataIndex: 'inDate', key: 'inDate', width: 100, align: "center",
  176. customRender: ({ record }) => record.inDate == null?"":dayjs(record.inDate).format('YYYY-MM-DD'), },
  177. { title: '工作年限', dataIndex: 'workYear', key: 'workYear' , align: "center",},
  178. { title: '求职类型', dataIndex: 'jobHuntTypeStr', key: 'jobHuntTypeStr', align: "center", },
  179. { title: '求职岗位', dataIndex: 'postName', key: 'postName', align: "center", },
  180. { title: '人才类型', dataIndex: 'jobUserTypeStr', key: 'jobUserTypeStr' , align: "center",},
  181. { title: '月薪要求', dataIndex: 'salary', key: 'salary' , align: "center",
  182. customRender: (item) => {
  183. const salary = showSalary(item.record.minSalary,item.record.maxSalary);
  184. return salary;
  185. }
  186. },
  187. { title: '操作', key: 'operation', width: 100, align: 'center' },
  188. ];
  189. const pagination = computed(() => ({
  190. total: formState.total,
  191. current: searchParamsState.pageIndex,
  192. pageSize: searchParamsState.pageSize,
  193. showSizeChanger: true,
  194. showTotal: (total) => getPaginationTotalTitle(total),
  195. }));
  196. const importOptions = ref<ImportProps>({
  197. title: '导入',
  198. url: '/jobUserService/jobHunt/importJobHunt',
  199. columns: [
  200. {cnName: '姓名', enName: 'jobUserName', width: 100},
  201. {cnName: '工种名称', enName: 'workName', width: 100},
  202. {cnName: '希望工作地区', enName: 'areaWork', width: 100},
  203. {cnName: '可到职日期', enName: 'inDate', width: 100},
  204. {cnName: '工作年限', enName: 'workYear', width: 100},
  205. {cnName: '求职类型', enName: 'jobHuntType', width: 100},
  206. {cnName: '人才类型', enName: 'jobUserType', width: 100},
  207. {cnName: '月薪要求', enName: 'salary', width: 100},
  208. ],
  209. template: {
  210. tempFileName: '求职意向导入模板.xlsx',
  211. url: '',
  212. params: null,
  213. },
  214. });
  215. const dataList = ref([]);
  216. const jobHuntTypeList = ref<SelectProps['options']>();
  217. const jobUserTypeList = ref<SelectProps['options']>();
  218. const isAccomplishList = ref<SelectProps['options']>();
  219. const showSalary =(minSalary:any,maxSalary:any)=>{
  220. if(minSalary!=null){
  221. if(maxSalary!=null){
  222. return minSalary.toString()+"-"+maxSalary.toString();
  223. }else{
  224. return "≥"+minSalary.toString();
  225. }
  226. }else{
  227. if(maxSalary!=null){
  228. return "≤"+maxSalary.toString();
  229. }else{
  230. return "";
  231. }
  232. }
  233. }
  234. const onSelectChange = (selectedRowKeys: any) => {
  235. formState.selectedRowKeys = selectedRowKeys;
  236. };
  237. const handleTableChange: TableProps['onChange'] = (pag: {
  238. pageSize: number;
  239. current: number;
  240. }) => {
  241. searchParamsState.pageIndex = pag.current;
  242. searchParamsState.pageSize = pag.pageSize;
  243. loadData();
  244. };
  245. const onSearch = () => {
  246. loadData();
  247. }
  248. const onDel= (item: any) => {
  249. if (item) {
  250. formState.selectedRowKeys.push(item.jobHuntID as never)
  251. }
  252. if (formState.selectedRowKeys.length <= 0) {
  253. message.warning('请选择需要删除的数据!');
  254. return false;
  255. }
  256. Modal.confirm({
  257. title: '确认删除选中的驿站站点?',
  258. icon: createVNode(ExclamationCircleOutlined),
  259. content: '',
  260. okText: '确认删除',
  261. okType: 'danger',
  262. okButtonProps: {},
  263. cancelText: '取消',
  264. onOk() {
  265. delJobHunt(formState.selectedRowKeys).then(() => {
  266. loadData();
  267. });
  268. },
  269. onCancel() {
  270. },
  271. });
  272. };
  273. const loadData = async function () {
  274. formState.loading = true;
  275. getJobHuntTypeList();
  276. getJobUserTypeList();
  277. getIsAccomplishList();
  278. const result: any = await getJobHuntList(searchParamsState);
  279. dataList.value = result.list;
  280. formState.total = result.total;
  281. formState.loading = false;
  282. console.log("huntParams",searchParamsState);
  283. };
  284. const onAdd =()=>{
  285. tabsViewStore.addTabByPath('/jobusermgr/jobhunt/add', {id:null});
  286. };
  287. const onEdit = (id: string) => {
  288. tabsViewStore.addTabByPath('/jobusermgr/jobhunt/edit', {id:id});
  289. };
  290. const getJobHuntTypeList = () => {
  291. getSysDictionaryList('JobHuntType').then((data) => {
  292. jobHuntTypeList.value = data;
  293. });
  294. };
  295. const getJobUserTypeList = () => {
  296. getSysDictionaryList('JobUserType').then((data) => {
  297. jobUserTypeList.value = data;
  298. });
  299. };
  300. const getIsAccomplishList = () => {
  301. getSysDictionaryList('ContractRecord').then((data) => {
  302. isAccomplishList.value = data;
  303. });
  304. };
  305. return {
  306. formRef,
  307. expand,
  308. searchParamsState,
  309. formState,
  310. columns,
  311. pagination,
  312. dataList,
  313. importOptions,
  314. jobHuntTypeList,
  315. jobUserTypeList,
  316. isAccomplishList,
  317. showSalary,
  318. loadData,
  319. onSearch,
  320. onAdd,
  321. onEdit,
  322. onDel,
  323. onSelectChange,
  324. handleTableChange,
  325. getJobHuntTypeList,
  326. getJobUserTypeList,
  327. getIsAccomplishList,
  328. };
  329. },
  330. created() {
  331. this.loadData();
  332. },
  333. activated() {
  334. if (history.state.params?.reload) this.loadData();
  335. },
  336. });
  337. </script>
  338. <style lang="less" scoped></style>