show.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <Modal v-model:visible="visible" title="岗位信息" @ok="handleOk()" @cancel="handleCancel()" style="width:800px;">
  3. <div>
  4. <Form ref="modalFormRef" autocomplete="off">
  5. <div class="search-result-list">
  6. <a-table :columns="columns" :data-source="curPositionList" :scroll="{ x:'100%', y: 500 }" :pagination="pagination"
  7. @change="handleTableChange"
  8. :row-selection="{ selectedRowKeys: formState.selectedRowKeys, onChange: onSelectChange}"
  9. :row-key="record=>record.postID"
  10. bordered>
  11. <template #bodyCell="{ column, text, record }">
  12. <template v-if="column.key === 'operation'">
  13. <div class="table-operation">
  14. <!-- <a-button type="link" size="small" @click='onDetail(record)' functioncode="T01020103">详情</a-button>-->
  15. </div>
  16. </template>
  17. </template>
  18. </a-table>
  19. </div>
  20. </Form>
  21. </div>
  22. </Modal>
  23. </template>
  24. <script setup lang="ts">
  25. import {Form, Modal, TableColumnsType, TableProps} from 'ant-design-vue';
  26. import {computed, reactive, ref} from "vue";
  27. import type {FormInstance} from 'ant-design-vue';
  28. import Button from "@/components/basic/button/button.vue";
  29. import dayjs from "dayjs";
  30. import {getPaginationTotalTitle} from "@/utils/common";
  31. defineOptions({
  32. name: 'positionShowModal',
  33. inheritAttrs: false,
  34. components: {Form,Modal,Button}
  35. });
  36. const modalFormRef = ref<FormInstance>();
  37. const visible = ref<boolean>(false);
  38. const curPositionList = ref([]);
  39. const searchParams = reactive({
  40. pageIndex: 1,
  41. pageSize: 10,
  42. });
  43. const formState = reactive({
  44. total: 0,
  45. selectedRowKeys: [],
  46. });
  47. const columns: TableColumnsType = [
  48. {title: '序号', align: "center", key: 'companyID', width:60,
  49. customRender: item => `${searchParams.pageSize * (searchParams.pageIndex - 1) + item.index + 1}`},
  50. {title: '岗位名称', dataIndex: 'professionName', key: 'professionName',width: 200, align: "center"},
  51. {title: '招聘人数', dataIndex: 'recruitCount', key: 'recruitCount', width: 120, align: "center"},
  52. {title: '招聘开始日期', dataIndex: 'startTime', key: 'startTime', width: 120,align: "center",
  53. customRender: (item) => {return item.record.startTime == null ? "" : (dayjs(item.record.startTime).format('YYYY-MM-DD'))}
  54. },
  55. {title: '招聘结束日期', dataIndex: 'endTime', key: 'endTime', width: 120,align: "center",
  56. customRender: (item) => {return item.record.endTime == null ? "" : (dayjs(item.record.endTime).format('YYYY-MM-DD'))}
  57. },
  58. //{title: '操作', key: 'operation', fixed: 'right', width: 100, align: "center"},
  59. ];
  60. const pagination = computed(() => ({
  61. total: formState.total,
  62. current: searchParams.pageIndex,
  63. pageSize: searchParams.pageSize,
  64. showSizeChanger: true,
  65. showTotal: total => getPaginationTotalTitle(total)
  66. }));
  67. const handleTableChange: TableProps['onChange'] = (pag: { pageSize: number; current: number },) => {
  68. searchParams.pageIndex = pag.current;
  69. searchParams.pageSize = pag.pageSize;
  70. };
  71. const onSelectChange = (selectedRowKeys: any) => {
  72. formState.selectedRowKeys = selectedRowKeys;
  73. };
  74. const show = (curPostList:any) => {
  75. visible.value = false;
  76. curPositionList.value = curPostList;
  77. formState.total = curPositionList.value.length;
  78. visible.value = true;
  79. };
  80. defineExpose({show});
  81. const emits = defineEmits(['modalClosed']);
  82. const handleModalClosed = (e) => {
  83. emits('modalClosed', e);
  84. };
  85. const handleOk = () => {
  86. visible.value = false;
  87. handleModalClosed(true);
  88. };
  89. const handleCancel = () => {
  90. visible.value = false;
  91. };
  92. </script>