ClaimJobUserTableCom.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <!-- 认领求职人员对话框 -->
  2. <template>
  3. <div>
  4. <a-modal
  5. width="1300px"
  6. v-model:visible="visible"
  7. title="认领求职人员"
  8. @ok="handleOk"
  9. @cancel="handleOk"
  10. :keyboard="false"
  11. :mask-closable="false"
  12. >
  13. <template #footer>
  14. <a-button key="submit" type="primary" @click="handleOk">关闭</a-button>
  15. </template>
  16. <a-form ref="formRef" class="ant-advanced-search-form" :model="searchParamsState">
  17. <a-row :gutter="24">
  18. <a-col :span="6">
  19. <a-form-item label="姓名" :label-col="{ span: 6 }" name="name">
  20. <a-input v-model:value="searchParamsState.name" placeholder="" :allow-clear="true"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :span="6">
  24. <a-form-item label="地址" :label-col="{ span: 6 }" name="address">
  25. <a-input v-model:value="searchParamsState.address" placeholder="" :allow-clear="true"/>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :span="6">
  29. <a-form-item label="重点人员类别" :label-col="{ span: 8 }" name="keyPersonTypeID">
  30. <a-select
  31. ref="select"
  32. v-model:value="searchParamsState.keyPersonTypeID"
  33. :options="keyPersonTypeList"
  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="loadData">查询</a-button>
  43. <a-button
  44. style="margin: 0 8px"
  45. @click="
  46. () => {
  47. formRef.resetFields();
  48. loadData();
  49. }
  50. ">重置
  51. </a-button>
  52. </a-col>
  53. </a-row>
  54. <a-row :gutter="24">
  55. <a-col :span="6">
  56. <a-form-item label="身份证号" :label-col="{ span: 6 }" name="name">
  57. <a-input v-model:value="searchParamsState.IdentityNumber" placeholder="" :allow-clear="true"/>
  58. </a-form-item>
  59. </a-col>
  60. </a-row>
  61. </a-form>
  62. <a-row class="edit-operation" style="margin-bottom: 10px">
  63. <a-col :span="24" class="flex-space-between">
  64. <div>
  65. </div>
  66. <div>
  67. <a-button type="primary" html-type="submit" @click='onClaimJobUser(formState.selectedRowKeys)'
  68. :disabled="formState.selectedRowKeys.length == 0"
  69. :loading="claimJobUserLoading">
  70. 批量调整
  71. </a-button>
  72. </div>
  73. </a-col>
  74. </a-row>
  75. <a-table :dataSource="jobUserList"
  76. :columns="originalColumns"
  77. bordered
  78. :scroll="{ x: '100%', y: 500 }"
  79. :pagination="tablePagination"
  80. :loading="formState.loading"
  81. :row-selection="{ selectedRowKeys: formState.selectedRowKeys, onChange: onSelectChange }"
  82. :row-key="(record) => record.jobUserID"
  83. @change="handleTableChange">
  84. <template #bodyCell="{ column, text, record }">
  85. <template v-if="column.key === 'serviceTime'">
  86. <div>
  87. {{ dayjs(record.serviceTime).format('YYYY-MM-DD') }}
  88. </div>
  89. </template>
  90. <template v-if="column.key === 'operation'">
  91. <div class="table-operation">
  92. <a-button type="link" size="small" :loading="claimJobUserLoading"
  93. @click="onClaimJobUser([record.jobUserID])">调整到本驿站
  94. </a-button>
  95. </div>
  96. </template>
  97. </template>
  98. </a-table>
  99. </a-modal>
  100. </div>
  101. </template>
  102. <script setup lang="ts">
  103. import {claimJobUser, getClaimJobUserList} from "@/api/jobUserManager/jobuser";
  104. import {computed, reactive, ref} from "vue";
  105. import dayjs from "dayjs";
  106. import {getPaginationTotalTitle} from "@/utils/common";
  107. import {type FormInstance, Modal, type SelectProps, type TableProps} from "ant-design-vue";
  108. import {getSysDictionaryList} from "@/api/system/dictionary";
  109. import {useUserStore} from "@/store/modules/user";
  110. import crtyptoHelp from "@/utils/crypto";
  111. const userStore = useUserStore();
  112. const userInfo = ref(userStore.getUserInfo);
  113. const emit = defineEmits(["modalOk"]);
  114. const formRef = ref<FormInstance>();
  115. // 查询参数
  116. const searchParamsState = reactive({
  117. pageIndex: 1,
  118. pageSize: 20,
  119. name: null,
  120. address: null,
  121. keyPersonTypeID: null,
  122. IdentityNumber: null
  123. });
  124. // 对话框显示关闭开关
  125. const visible = ref(false);
  126. // 求职人员数据
  127. const jobUserList = ref()
  128. // 数据表格定义
  129. const originalColumns = [
  130. {
  131. title: '序号',
  132. align: 'center',
  133. width: 80,
  134. key: 'jobUserID',
  135. customRender: (item) =>
  136. `${searchParamsState.pageSize * (searchParamsState.pageIndex - 1) + item.index + 1}`,
  137. isDisabled: true
  138. },
  139. {title: '姓名', dataIndex: 'name', key: 'name', width: 100, align: "center"},
  140. {title: '性别', dataIndex: 'sexName', key: 'sexName', width: 80, align: "center"},
  141. {title: '联系电话', dataIndex: 'userMobile', key: 'userMobile', align: "center"},
  142. {title: '所属驿站', dataIndex: 'siteName', key: 'siteName', align: "center"},
  143. {title: '年龄', dataIndex: 'age', key: 'age', align: "center"},
  144. {title: '就业状态', dataIndex: 'jobStatusName', key: 'jobStatusName', align: "center"},
  145. {title: '重点人员类别', dataIndex: 'keyTypeName', key: 'keyTypeName', align: "center"},
  146. {title: '地址', dataIndex: 'address', key: 'address', align: "center", isDefaultClose: true},
  147. {title: '操作', key: 'operation', width: 110, align: 'center', isDisabled: true},
  148. ];
  149. const formState = reactive({
  150. total: 0,
  151. selectedRowKeys: [],
  152. loading: false,
  153. });
  154. // 表格分页数据
  155. const tablePagination = computed(() => ({
  156. total: formState.total,
  157. current: searchParamsState.pageIndex,
  158. pageSize: searchParamsState.pageSize,
  159. showSizeChanger: true,
  160. showTotal: (total) => getPaginationTotalTitle(total),
  161. }));
  162. const keyPersonTypeList = ref<SelectProps['options']>();
  163. // 调整按钮加载
  164. const claimJobUserLoading = ref(false);
  165. // 数据加载
  166. async function loadData() {
  167. formState.loading = true;
  168. let params = JSON.parse(JSON.stringify(searchParamsState));
  169. params.IdentityNumber = crtyptoHelp.encryptDesText(params.IdentityNumber);
  170. await getClaimJobUserList(params).then((result: any) => {
  171. jobUserList.value = result.list;
  172. formState.total = result.total;
  173. }).finally(() => {
  174. formState.loading = false;
  175. });
  176. }
  177. // 表格分页触发事件
  178. const handleTableChange: TableProps['onChange'] = (pag: {
  179. pageSize: number;
  180. current: number;
  181. }) => {
  182. searchParamsState.pageIndex = pag.current;
  183. searchParamsState.pageSize = pag.pageSize;
  184. loadData();
  185. };
  186. // 对话框确定事件
  187. function handleOk() {
  188. visible.value = false;
  189. emit("modalOk");
  190. }
  191. // 表格数据选择
  192. const onSelectChange = (selectedRowKeys: any) => {
  193. formState.selectedRowKeys = selectedRowKeys;
  194. };
  195. const getKeyPersonTypeList = () => {
  196. getSysDictionaryList('KeyPersonType').then((data) => {
  197. keyPersonTypeList.value = data;
  198. });
  199. };
  200. // 显示
  201. function show() {
  202. visible.value = true;
  203. loadData();
  204. getKeyPersonTypeList();
  205. }
  206. function onClaimJobUser(ids) {
  207. if (!userInfo.value.siteID) {
  208. Modal.error({
  209. title: '提示',
  210. content: `当前账号未绑定驿站,请切换账号重试!`,
  211. });
  212. return;
  213. }
  214. if (ids.length == 0) {
  215. return;
  216. }
  217. claimJobUserLoading.value = true;
  218. claimJobUser(ids, userInfo.value.siteID).then((result: any) => {
  219. if (result > 0) {
  220. loadData();
  221. emit("modalOk");
  222. }
  223. }).finally(() => {
  224. claimJobUserLoading.value = false;
  225. })
  226. }
  227. defineExpose({
  228. show
  229. })
  230. </script>
  231. <style scoped>
  232. </style>