|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <list-search @searchData="searchData" @clearData="clearData" :search_params="commomParams.search"></list-search>
- <a-c-operation @refresh="clearData">
-
- </a-c-operation>
- <a-c-table :data="commomParams.table.data" :columns="commomParams.table.columns" :pagination="commomParams.page"
- @page="getPage" :loading="loading">
- <template #status="{ record }">
- <div v-if="record.status == 1">
- <a-popconfirm title="是否禁用该求职者账号?" @confirm="handleUser(record, 2)">
- <a-space>
- <a-tag color="green" >使用中</a-tag>
- <a-button type="primary" size="small" danger>禁用该账号</a-button>
- </a-space>
- </a-popconfirm>
- </div>
- <div v-if="record.status == 2">
- <a-popconfirm title="是否启用该求职者账号?" @confirm="handleUser(record, 1)">
- <a-space> <a-tag color="red">已禁用</a-tag>
- <a-button type="primary" size="small">启用该账号</a-button>
- </a-space>
- </a-popconfirm>
- </div>
-
- </template>
- <template #default="{ record }">
- <a-row :gutter="10">
- <a-col><a-button type="primary" size="small" primary @click="edit(record)">编辑</a-button></a-col>
- <a-popconfirm title="是否删除该求职者账号?" @confirm="del(record.id)">
- <a-col><a-button type="primary" size="small" danger>删除</a-button></a-col>
- </a-popconfirm>
- </a-row>
- </template>
- </a-c-table>
- <list-add :edit_record="edit_record" @successAdd="successAdd" @closeAdd="closeAdd"></list-add>
- </template>
-
-
- <script lang="ts" setup>
- import { ref, onMounted, watch, computed, createVNode } from 'vue';
- import ListSearch from '@/views/customer/list/search/index.vue';
- import ListAdd from '@/views/customer/list/add/add.vue';
- import { GetCustomerList, GetCustomerDetail, PostCustomerUpdate, PostCustomerDel } from '@/apis/models';
- import { UserOutlined, DownOutlined } from '@ant-design/icons-vue';
- import { useCommon } from '@/hooks/useCommon';
- import { cols } from '@/views/customer/list/columns';
- let { store, commomParams, showModal, showOtherModal1, message, ExclamationCircleOutlined, Modal } = useCommon();
- let loading = ref<Boolean>(true);
- onMounted(() => {
- getData(commomParams.value.search);
- })
-
- const searchData = (data : object) => {
- commomParams.value.search = data
- getData();
- }
-
- const clearData = (data : object) => {
- if (data) {
- commomParams.value.search = data
- } else {
- commomParams.value.search = {
- page: 1,
- pagesize: 10,
- sort: 'id',
- sortby: 'desc',
- keyword: ''
- }
- }
- getData();
- }
-
-
- const getPage = (data : object) => {
- commomParams.value.search.page = data.current;
- commomParams.value.search.pagesize = data.pageSize;
- getData();
- }
- const getData = async () => {
- try {
- loading.value = true;
- let res = await GetCustomerList(commomParams.value.search);
- loading.value = false;
- commomParams.value.table.data = res.data.customers;
- commomParams.value.table.columns = cols;
- commomParams.value.page = {
- current: commomParams.value.search.page,
- pageSize: commomParams.value.search.pagesize,
- total: res.data.total,
- pageSizeOptions: ['10', '20', '30', '40'],
- hideOnSinglePage: false,
- showSizeChanger: true
- };
- } catch {
- commomParams.value.search = {
- page: 1,
- pagesize: 10,
- sort: 'id',
- sortby: 'desc',
- keyword: ''
- }
- loading.value = false;
- }
- }
-
-
- // 编辑
- let edit_record = ref<Object>(null)
- const edit = (record : object) => {
- edit_record.value = record;
- showModal()
- }
- const successAdd = () => {
- getData();
- }
- const closeAdd = () => {
- edit_record.value = null;
- }
-
- // 禁用
- const handleUser = (record : object, status : Number) => {
- PostCustomerUpdate({ id: record.id, status: status }).then(res => {
- getData();
- Modal.destroyAll();
- })
- }
-
-
- // 删除
- const del = (id : number) => {
- commomParams.value.delRecord = { id: id };
- PostCustomerDel(commomParams.value.delRecord).then(res => {
- message.success('删除成功');
- getData();
- })
- }
- </script>
-
- <style lang="less" scoped>
-
- </style>
|