index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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="name">
  12. <a-input v-model:value="searchParamsState.name" placeholder="" :allow-clear="true"/>
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="所属驿站" :label-col="{ span: 8 }" name="siteID">
  17. <a-select
  18. ref="select"
  19. v-model:value="searchParamsState.siteID"
  20. :options="siteList"
  21. :field-names="{ label: 'siteName', value: 'siteID' }"
  22. :allow-clear="true"
  23. @change="loadData"
  24. >
  25. </a-select>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :span="6">
  29. <a-form-item label="就业状态" :label-col="{ span: 8 }" name="jobStatus">
  30. <a-select
  31. ref="select"
  32. v-model:value="searchParamsState.jobStatus"
  33. :options="jobStatusList"
  34. :field-names="{ label: 'name', value: 'value' }"
  35. :allow-clear="true"
  36. @change="loadData"
  37. >
  38. </a-select>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :span="6" style="text-align: left">
  42. <a-button type="primary" html-type="submit" @click="onFinish">查询</a-button>
  43. <a-button
  44. style="margin: 0 8px"
  45. @click="
  46. () => {
  47. formRef.resetFields();
  48. loadData();
  49. }
  50. ">重置</a-button>
  51. <a style="font-size: 12px" @click="expand = !expand">
  52. <template v-if="expand">
  53. <UpOutlined />
  54. </template>
  55. <template v-else>
  56. <DownOutlined />
  57. </template>
  58. {{ expand ? '收缩' : '展开' }}
  59. </a>
  60. </a-col>
  61. </a-row>
  62. <a-row :gutter="24" v-show="expand">
  63. <a-col :span="6">
  64. <a-form-item label="性别" :label-col="{ span: 8 }" name="sexId">
  65. <a-select
  66. ref="select"
  67. v-model:value="searchParamsState.sexId"
  68. :options="sexTypeList"
  69. :field-names="{ label: 'name', value: 'value' }"
  70. :allow-clear="true"
  71. @change="loadData"
  72. >
  73. </a-select>
  74. </a-form-item>
  75. </a-col>
  76. <a-col :span="6">
  77. <a-form-item label="最高学历" :label-col="{ span: 8 }" name="educationId">
  78. <a-select
  79. ref="select"
  80. v-model:value="searchParamsState.educationTypeId"
  81. :options="educationTypeList"
  82. :field-names="{ label: 'name', value: 'value' }"
  83. :allow-clear="true"
  84. @change="loadData"
  85. >
  86. </a-select>
  87. </a-form-item>
  88. </a-col>
  89. <a-col :span="6">
  90. <a-form-item label="重点人员类别" :label-col="{ span: 8 }" name="emphasisTypeId">
  91. <a-select
  92. ref="select"
  93. v-model:value="searchParamsState.emphasisTypeId"
  94. :options="emphasisTypeList"
  95. :field-names="{ label: 'name', value: 'value' }"
  96. :allow-clear="true"
  97. @change="loadData"
  98. >
  99. </a-select>
  100. </a-form-item>
  101. </a-col>
  102. </a-row>
  103. <a-row class="edit-operation">
  104. <a-col :span="24" style="text-align: right">
  105. <a-button type="primary" html-type="submit" @click='onAdd' functioncode="T01030102">新增</a-button>
  106. <BExportExcel :title="'导出'" :filename="'求职人员信息'"
  107. :url="'jobUserService/jobUser/export'"
  108. :params="{...exportSearchParams, isExport: true, rows:10000,jobUserIDList:formState.selectedRowKeys.join(',')}"></BExportExcel>
  109. </a-col>
  110. </a-row>
  111. </a-form>
  112. <div class="search-result-list">
  113. <a-table
  114. :columns="columns"
  115. :data-source="dataList"
  116. :scroll="{ x: '100%', y: 500 }"
  117. :pagination="pagination"
  118. :loading="formState.loading"
  119. :row-selection="{ selectedRowKeys: formState.selectedRowKeys, onChange: onSelectChange }"
  120. :row-key="(record) => record.jobUserID"
  121. bordered
  122. @change="handleTableChange">
  123. <template #bodyCell="{ column, text, record }">
  124. <template v-if="column.key === 'operation'">
  125. <div class="table-operation">
  126. <a-button type="link" size="small" functioncode="T01030106" @click='onVitae(record)'>个人简历</a-button>
  127. <a-button type="link" size="small" functioncode="T01030103" @click='onEdit(record)'>编辑</a-button>
  128. <a-button type="link" size="small" functioncode="T01030104" @click="onDel(record)">删除</a-button>
  129. </div>
  130. </template>
  131. </template>
  132. </a-table>
  133. </div>
  134. </div>
  135. </template>
  136. <script lang="ts">
  137. import {computed, createVNode, defineComponent, reactive, ref} from 'vue';
  138. import type {FormInstance, SelectProps, TableColumnsType, TableProps} from 'ant-design-vue';
  139. import {message, Modal} from "ant-design-vue";
  140. import {del, getList} from '@/api/jobUserManager/jobuser';
  141. import {getSysDictionaryList} from '@/api/system/dictionary';
  142. import {getPaginationTotalTitle} from '@/utils/common';
  143. import {useTabsViewStore} from "@/store/modules/tabsView";
  144. import {DownOutlined, ExclamationCircleOutlined, UpOutlined} from "@ant-design/icons-vue";
  145. import BExportExcel from "@/components/basic/excel/exportExcel/exportExcel.vue";
  146. import BImportExcel from "@/components/basic/excel/importExcel/importExcel.vue";
  147. import {getSiteList} from "@/api/baseSettings/siteInfo";
  148. export default defineComponent({
  149. name: 'JobUserList',
  150. components: {DownOutlined, UpOutlined, BExportExcel, BImportExcel},
  151. setup() {
  152. const modalRoleUserRef = ref();
  153. const expand = ref(false);
  154. const modalRoleEditRef = ref();
  155. const formRef = ref<FormInstance>();
  156. const searchParamsState = reactive({
  157. pageIndex: 1,
  158. pageSize: 20,
  159. name: null,
  160. siteId: null,
  161. jobStatus: null,
  162. sexId: null,
  163. educationTypeId: null,
  164. emphasisTypeId: null
  165. });
  166. // 导出Excel查询参数
  167. const exportSearchParams = computed(() => {
  168. let data = JSON.parse(JSON.stringify(searchParamsState));
  169. data.pageSize = formState.total;
  170. return data;
  171. })
  172. const formState = reactive({
  173. total: 0,
  174. selectedRowKeys: [],
  175. loading: false,
  176. });
  177. const columns: TableColumnsType = [
  178. {
  179. title: '序号',
  180. align: 'center',
  181. width: 80,
  182. key: 'jobUserID',
  183. customRender: (item) =>
  184. `${searchParamsState.pageSize * (searchParamsState.pageIndex - 1) + item.index + 1}`,
  185. },
  186. {title: '姓名', dataIndex: 'name', key: 'name', width: 100,align: "center"},
  187. {title: '公民身份号码', dataIndex: 'identityNumber', key: 'identityNumber', width: 170,align: "center"},
  188. {title: '性别', dataIndex: 'genderName', key: 'genderName', width: 80,align: "center"},
  189. {title: '民族', dataIndex: 'nationName', key: 'nationName', width: 80, align: "center"},
  190. {title: '联系电话', dataIndex: 'userMobile', key: 'userMobile',align: "center"},
  191. {title: '所属驿站', dataIndex: 'siteName', key: 'siteName',align: "center"},
  192. {
  193. title: '年龄', dataIndex: 'age', key: 'age',align: "center", customRender: item => {
  194. return calculateAge(item.record.identityNumber);
  195. }
  196. },
  197. {title: '最高学历', dataIndex: 'cultureName', key: 'cultureName', align: "center"},
  198. {title: '地址', dataIndex: 'address', key: 'address',align: "center"},
  199. {title: '就业状态', dataIndex: 'jobStatusName', key: 'jobStatusName',align: "center"},
  200. {title: '重点人员类别', dataIndex: 'keyTypeName', key: 'keyTypeName',align: "center"},
  201. {title: '操作', key: 'operation', width: 170, align: 'center'},
  202. ];
  203. const pagination = computed(() => ({
  204. total: formState.total,
  205. current: searchParamsState.pageIndex,
  206. pageSize: searchParamsState.pageSize,
  207. showSizeChanger: true,
  208. showTotal: (total) => getPaginationTotalTitle(total),
  209. }));
  210. const dataList = ref([]);
  211. const siteList = ref<any>([]);
  212. const jobStatusList = ref<SelectProps['options']>();
  213. const sexTypeList = ref<SelectProps['options']>();
  214. const educationTypeList = ref<SelectProps['options']>();
  215. const emphasisTypeList = ref<SelectProps['options']>();
  216. const calculateAge = (idCardNumber) => {
  217. // 假设身份证号中出生日期的格式为YYYYMMDD
  218. const birthYear = parseInt(idCardNumber.substring(6, 10), 10);
  219. const birthMonth = parseInt(idCardNumber.substring(10, 12), 10);
  220. const birthDay = parseInt(idCardNumber.substring(12, 14), 10);
  221. // 获取当前日期
  222. const currentDate = new Date();
  223. const currentYear = currentDate.getFullYear();
  224. const currentMonth = currentDate.getMonth() + 1; // 月份从 0 开始
  225. const currentDay = currentDate.getDate();
  226. // 计算年龄
  227. let age = currentYear - birthYear;
  228. if (currentMonth < birthMonth || (currentMonth === birthMonth && currentDay < birthDay)) {
  229. age--; // 生日还未过,减去一岁
  230. }
  231. return age;
  232. }
  233. const onSelectChange = (selectedRowKeys: any) => {
  234. formState.selectedRowKeys = selectedRowKeys;
  235. };
  236. const handleTableChange: TableProps['onChange'] = (pag: {
  237. pageSize: number;
  238. current: number;
  239. }) => {
  240. searchParamsState.pageIndex = pag.current;
  241. searchParamsState.pageSize = pag.pageSize;
  242. loadData();
  243. };
  244. const onFinish = () => {
  245. loadData();
  246. };
  247. const loadData = async function () {
  248. formState.loading = true;
  249. getAllSites();
  250. const result: any = await getList(searchParamsState);
  251. dataList.value = result.list;
  252. //console.log(dataList.value);
  253. formState.total = result.total;
  254. formState.loading = false;
  255. // console.log("userParams",searchParamsState);
  256. };
  257. const getAllSites = () => {
  258. getSiteList({pageIndex:1,pageSize:9999}).then((result :any) => {
  259. siteList.value = result.list;
  260. })
  261. }
  262. const getJobStatusList = () => {
  263. getSysDictionaryList('jobStatus').then((data) => {
  264. jobStatusList.value = data;
  265. });
  266. };
  267. const getSexList = () => {
  268. getSysDictionaryList('Gender').then((data) => {
  269. sexTypeList.value = data;
  270. });
  271. };
  272. const getEducationList = () => {
  273. getSysDictionaryList('HighestDegree').then((data) => {
  274. educationTypeList.value = data;
  275. });
  276. };
  277. const getEmphasisTypeList = () => {
  278. getSysDictionaryList('KeyPersonType').then((data) => {
  279. emphasisTypeList.value = data;
  280. });
  281. };
  282. const tabsViewStore = useTabsViewStore();
  283. const onAdd = () => {
  284. tabsViewStore.addTabByPath('/jobusermgr/jobseeker/add', null);
  285. };
  286. const onEdit = (item: any) => {
  287. tabsViewStore.addTabByPath('/jobusermgr/jobseeker/edit', {id: item.jobUserID});
  288. };
  289. const onVitae = (item: any) => {
  290. tabsViewStore.addTabByPath('/jobusermgr/jobseeker/vitae', {id: item.jobUserID});
  291. };
  292. const onDel = (item: any) => {
  293. if (item) {
  294. formState.selectedRowKeys.push(item.jobUserID as never)
  295. }
  296. if (formState.selectedRowKeys.length <= 0) {
  297. message.warning('请选择需要删除的数据!');
  298. return false;
  299. }
  300. Modal.confirm({
  301. title: '确认删除?',
  302. icon: createVNode(ExclamationCircleOutlined),
  303. content: '',
  304. okText: '确认删除',
  305. okType: 'danger',
  306. okButtonProps: {},
  307. cancelText: '取消',
  308. onOk() {
  309. del(formState.selectedRowKeys).then(() => {
  310. loadData();
  311. });
  312. },
  313. onCancel() {
  314. },
  315. })
  316. }
  317. return {
  318. modalRoleUserRef,
  319. modalRoleEditRef,
  320. formRef,
  321. loadData,
  322. onAdd,
  323. onDel,
  324. onEdit,
  325. searchParamsState,
  326. formState,
  327. columns,
  328. pagination,
  329. dataList,
  330. siteList,
  331. jobStatusList,
  332. sexTypeList,
  333. educationTypeList,
  334. emphasisTypeList,
  335. onSelectChange,
  336. handleTableChange,
  337. onFinish,
  338. getJobStatusList,
  339. getSexList,
  340. getEducationList,
  341. getEmphasisTypeList,
  342. calculateAge,
  343. onVitae,
  344. expand,
  345. exportSearchParams
  346. };
  347. },
  348. created() {
  349. this.loadData();
  350. this.getJobStatusList();
  351. this.getSexList();
  352. this.getEducationList();
  353. this.getEmphasisTypeList();
  354. },
  355. activated() {
  356. if (history.state.params?.reload) this.loadData();
  357. },
  358. });
  359. </script>
  360. <style lang="less" scoped></style>