您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
1年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <list-search @searchData="searchData" @clearData="clearData" :search_params="commomParams.search"></list-search>
  3. <a-c-operation @refresh="clearData">
  4. </a-c-operation>
  5. <a-c-table :data="commomParams.table.data" :columns="commomParams.table.columns" :pagination="commomParams.page"
  6. @page="getPage" :loading="loading">
  7. <template #status="{ record }">
  8. <div v-if="record.status == 1">
  9. <a-popconfirm title="是否禁用该求职者账号?" @confirm="handleUser(record, 2)">
  10. <a-space>
  11. <a-tag color="green" >使用中</a-tag>
  12. <a-button type="primary" size="small" danger>禁用该账号</a-button>
  13. </a-space>
  14. </a-popconfirm>
  15. </div>
  16. <div v-if="record.status == 2">
  17. <a-popconfirm title="是否启用该求职者账号?" @confirm="handleUser(record, 1)">
  18. <a-space> <a-tag color="red">已禁用</a-tag>
  19. <a-button type="primary" size="small">启用该账号</a-button>
  20. </a-space>
  21. </a-popconfirm>
  22. </div>
  23. </template>
  24. <template #default="{ record }">
  25. <a-row :gutter="10">
  26. <a-col><a-button type="primary" size="small" primary @click="edit(record)">编辑</a-button></a-col>
  27. <a-popconfirm title="是否删除该求职者账号?" @confirm="del(record.id)">
  28. <a-col><a-button type="primary" size="small" danger>删除</a-button></a-col>
  29. </a-popconfirm>
  30. </a-row>
  31. </template>
  32. </a-c-table>
  33. <list-add :edit_record="edit_record" @successAdd="successAdd" @closeAdd="closeAdd"></list-add>
  34. </template>
  35. <script lang="ts" setup>
  36. import { ref, onMounted, watch, computed, createVNode } from 'vue';
  37. import ListSearch from '@/views/customer/list/search/index.vue';
  38. import ListAdd from '@/views/customer/list/add/add.vue';
  39. import { GetCustomerList, GetCustomerDetail, PostCustomerUpdate, PostCustomerDel } from '@/apis/models';
  40. import { UserOutlined, DownOutlined } from '@ant-design/icons-vue';
  41. import { useCommon } from '@/hooks/useCommon';
  42. import { cols } from '@/views/customer/list/columns';
  43. let { store, commomParams, showModal, showOtherModal1, message, ExclamationCircleOutlined, Modal } = useCommon();
  44. let loading = ref<Boolean>(true);
  45. onMounted(() => {
  46. getData(commomParams.value.search);
  47. })
  48. const searchData = (data : object) => {
  49. commomParams.value.search = data
  50. getData();
  51. }
  52. const clearData = (data : object) => {
  53. if (data) {
  54. commomParams.value.search = data
  55. } else {
  56. commomParams.value.search = {
  57. page: 1,
  58. pagesize: 10,
  59. sort: 'id',
  60. sortby: 'desc',
  61. keyword: ''
  62. }
  63. }
  64. getData();
  65. }
  66. const getPage = (data : object) => {
  67. commomParams.value.search.page = data.current;
  68. commomParams.value.search.pagesize = data.pageSize;
  69. getData();
  70. }
  71. const getData = async () => {
  72. try {
  73. loading.value = true;
  74. let res = await GetCustomerList(commomParams.value.search);
  75. loading.value = false;
  76. commomParams.value.table.data = res.data.customers;
  77. commomParams.value.table.columns = cols;
  78. commomParams.value.page = {
  79. current: commomParams.value.search.page,
  80. pageSize: commomParams.value.search.pagesize,
  81. total: res.data.total,
  82. pageSizeOptions: ['10', '20', '30', '40'],
  83. hideOnSinglePage: false,
  84. showSizeChanger: true
  85. };
  86. } catch {
  87. commomParams.value.search = {
  88. page: 1,
  89. pagesize: 10,
  90. sort: 'id',
  91. sortby: 'desc',
  92. keyword: ''
  93. }
  94. loading.value = false;
  95. }
  96. }
  97. // 编辑
  98. let edit_record = ref<Object>(null)
  99. const edit = (record : object) => {
  100. edit_record.value = record;
  101. showModal()
  102. }
  103. const successAdd = () => {
  104. getData();
  105. }
  106. const closeAdd = () => {
  107. edit_record.value = null;
  108. }
  109. // 禁用
  110. const handleUser = (record : object, status : Number) => {
  111. PostCustomerUpdate({ id: record.id, status: status }).then(res => {
  112. getData();
  113. Modal.destroyAll();
  114. })
  115. }
  116. // 删除
  117. const del = (id : number) => {
  118. commomParams.value.delRecord = { id: id };
  119. PostCustomerDel(commomParams.value.delRecord).then(res => {
  120. message.success('删除成功');
  121. getData();
  122. })
  123. }
  124. </script>
  125. <style lang="less" scoped>
  126. </style>