style(sdy): 格式化代码以符合团队样式指南
- 标准化组件标签的闭合方式和缩进 - 统一导入语句的空格和换行格式 - 调整对象属性的换行和对齐方式 - 规范条件渲染表达式的格式 - 优化长逻辑行的换行和可读性 - 统一箭头函数和三元运算符的格式
This commit is contained in:
@@ -21,7 +21,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'applyStatus'">
|
<template v-if="column.key === 'applyStatus'">
|
||||||
<a-tag v-if="record.applyStatus === 10" color="orange">跟进中</a-tag>
|
<a-tag v-if="record.applyStatus === 10" color="orange"
|
||||||
|
>跟进中</a-tag
|
||||||
|
>
|
||||||
<a-tag v-if="record.applyStatus === 20" color="green">已签约</a-tag>
|
<a-tag v-if="record.applyStatus === 20" color="green">已签约</a-tag>
|
||||||
<a-tag v-if="record.applyStatus === 30" color="red">已取消</a-tag>
|
<a-tag v-if="record.applyStatus === 30" color="red">已取消</a-tag>
|
||||||
</template>
|
</template>
|
||||||
@@ -40,7 +42,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'comments'">
|
<template v-if="column.key === 'comments'">
|
||||||
<div class="text-gray-400">{{ record.comments }}</div>
|
<div class="text-gray-400">{{ record.comments }}</div>
|
||||||
<div class="text-gray-400" v-if="record.comments">{{ record.updateTime }}</div>
|
<div class="text-gray-400" v-if="record.comments">{{
|
||||||
|
record.updateTime
|
||||||
|
}}</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'createTime'">
|
<template v-if="column.key === 'createTime'">
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
@@ -50,21 +54,21 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<a @click="openEdit(record)" class="ele-text-primary">
|
<a @click="openEdit(record)" class="ele-text-primary">
|
||||||
<EditOutlined/>
|
<EditOutlined />
|
||||||
编辑
|
编辑
|
||||||
</a>
|
</a>
|
||||||
<template v-if="record.applyStatus !== 20">
|
<template v-if="record.applyStatus !== 20">
|
||||||
<a-divider type="vertical"/>
|
<a-divider type="vertical" />
|
||||||
<a @click="approveApply(record)" class="ele-text-success">
|
<a @click="approveApply(record)" class="ele-text-success">
|
||||||
<CheckOutlined/>
|
<CheckOutlined />
|
||||||
已签约
|
已签约
|
||||||
</a>
|
</a>
|
||||||
<a-divider type="vertical"/>
|
<a-divider type="vertical" />
|
||||||
<a @click="rejectApply(record)" class="ele-text-warning">
|
<a @click="rejectApply(record)" class="ele-text-warning">
|
||||||
<CloseOutlined/>
|
<CloseOutlined />
|
||||||
驳回
|
驳回
|
||||||
</a>
|
</a>
|
||||||
<a-divider type="vertical"/>
|
<a-divider type="vertical" />
|
||||||
<a-popconfirm
|
<a-popconfirm
|
||||||
v-if="record.applyStatus != 20"
|
v-if="record.applyStatus != 20"
|
||||||
title="确定要删除此申请记录吗?"
|
title="确定要删除此申请记录吗?"
|
||||||
@@ -72,7 +76,7 @@
|
|||||||
placement="topRight"
|
placement="topRight"
|
||||||
>
|
>
|
||||||
<a class="ele-text-danger">
|
<a class="ele-text-danger">
|
||||||
<DeleteOutlined/>
|
<DeleteOutlined />
|
||||||
删除
|
删除
|
||||||
</a>
|
</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
@@ -83,358 +87,372 @@
|
|||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<ShopDealerApplyEdit v-model:visible="showEdit" :data="current" @done="reload"/>
|
<ShopDealerApplyEdit
|
||||||
|
v-model:visible="showEdit"
|
||||||
|
:data="current"
|
||||||
|
@done="reload"
|
||||||
|
/>
|
||||||
</a-page-header>
|
</a-page-header>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {createVNode, ref} from 'vue';
|
import { createVNode, ref } from 'vue';
|
||||||
import {message, Modal} from 'ant-design-vue';
|
import { message, Modal } from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
ExclamationCircleOutlined,
|
ExclamationCircleOutlined,
|
||||||
CheckOutlined,
|
CheckOutlined,
|
||||||
CloseOutlined,
|
CloseOutlined,
|
||||||
EditOutlined,
|
EditOutlined,
|
||||||
DeleteOutlined
|
DeleteOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import type {EleProTable} from 'ele-admin-pro';
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
import type {
|
import type {
|
||||||
DatasourceFunction,
|
DatasourceFunction,
|
||||||
ColumnItem
|
ColumnItem
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
import Search from './components/search.vue';
|
import Search from './components/search.vue';
|
||||||
import {getPageTitle} from '@/utils/common';
|
import { getPageTitle } from '@/utils/common';
|
||||||
import ShopDealerApplyEdit from './components/shopDealerApplyEdit.vue';
|
import ShopDealerApplyEdit from './components/shopDealerApplyEdit.vue';
|
||||||
import {
|
import {
|
||||||
pageShopDealerApply,
|
pageShopDealerApply,
|
||||||
removeShopDealerApply,
|
removeShopDealerApply,
|
||||||
removeBatchShopDealerApply,
|
removeBatchShopDealerApply,
|
||||||
batchApproveShopDealerApply,
|
batchApproveShopDealerApply,
|
||||||
updateShopDealerApply
|
updateShopDealerApply
|
||||||
} from '@/api/shop/shopDealerApply';
|
} from '@/api/shop/shopDealerApply';
|
||||||
import type {ShopDealerApply, ShopDealerApplyParam} from '@/api/shop/shopDealerApply/model';
|
import type {
|
||||||
|
ShopDealerApply,
|
||||||
|
ShopDealerApplyParam
|
||||||
|
} from '@/api/shop/shopDealerApply/model';
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
const selection = ref<ShopDealerApply[]>([]);
|
const selection = ref<ShopDealerApply[]>([]);
|
||||||
// 当前编辑数据
|
// 当前编辑数据
|
||||||
const current = ref<ShopDealerApply | null>(null);
|
const current = ref<ShopDealerApply | null>(null);
|
||||||
// 是否显示编辑弹窗
|
// 是否显示编辑弹窗
|
||||||
const showEdit = ref(false);
|
const showEdit = ref(false);
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
// 表格数据源
|
// 表格数据源
|
||||||
const datasource: DatasourceFunction = ({
|
const datasource: DatasourceFunction = ({
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
where.type = 4;
|
|
||||||
return pageShopDealerApply({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
page,
|
||||||
limit
|
limit,
|
||||||
});
|
where,
|
||||||
};
|
orders,
|
||||||
|
filters
|
||||||
// 表格列配置
|
}) => {
|
||||||
const columns = ref<ColumnItem[]>([
|
if (filters) {
|
||||||
{
|
where.status = filters.status;
|
||||||
title: '用户ID',
|
|
||||||
dataIndex: 'userId',
|
|
||||||
key: 'userId',
|
|
||||||
align: 'center',
|
|
||||||
width: 90,
|
|
||||||
fixed: 'left'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '客户名称',
|
|
||||||
dataIndex: 'customer',
|
|
||||||
key: 'customer'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '最后跟进情况',
|
|
||||||
dataIndex: 'comments',
|
|
||||||
key: 'comments',
|
|
||||||
align: 'left'
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '收益基数',
|
|
||||||
// dataIndex: 'rate',
|
|
||||||
// key: 'rate',
|
|
||||||
// align: 'left'
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: '报备人信息',
|
|
||||||
dataIndex: 'applicantInfo',
|
|
||||||
key: 'applicantInfo',
|
|
||||||
align: 'left',
|
|
||||||
fixed: 'left',
|
|
||||||
customRender: ({record}) => {
|
|
||||||
return `${record.nickName || '-'} (${record.phone || '-'})`;
|
|
||||||
}
|
}
|
||||||
},
|
where.type = 4;
|
||||||
{
|
return pageShopDealerApply({
|
||||||
title: '状态',
|
...where,
|
||||||
dataIndex: 'applyStatus',
|
...orders,
|
||||||
key: 'applyStatus',
|
page,
|
||||||
align: 'center',
|
limit
|
||||||
width: 120
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '申请时间',
|
|
||||||
// dataIndex: 'applyTime',
|
|
||||||
// key: 'applyTime',
|
|
||||||
// align: 'center',
|
|
||||||
// width: 120,
|
|
||||||
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '审核时间',
|
|
||||||
// dataIndex: 'auditTime',
|
|
||||||
// key: 'auditTime',
|
|
||||||
// align: 'center',
|
|
||||||
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: '添加时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
sorter: true,
|
|
||||||
ellipsis: true
|
|
||||||
}
|
|
||||||
// {
|
|
||||||
// title: '操作',
|
|
||||||
// key: 'action',
|
|
||||||
// fixed: 'right',
|
|
||||||
// align: 'center',
|
|
||||||
// width: 380,
|
|
||||||
// hideInSetting: true
|
|
||||||
// }
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: ShopDealerApplyParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({where: where});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 审核通过 */
|
|
||||||
const approveApply = (row: ShopDealerApply) => {
|
|
||||||
Modal.confirm({
|
|
||||||
title: '审核通过确认',
|
|
||||||
content: `确定要通过 ${row.realName} 的经销商申请吗?`,
|
|
||||||
icon: createVNode(CheckOutlined),
|
|
||||||
okText: '确认通过',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
const hide = message.loading('正在处理审核...', 0);
|
|
||||||
try {
|
|
||||||
await updateShopDealerApply({
|
|
||||||
...row,
|
|
||||||
applyId: row.applyId,
|
|
||||||
applyStatus: 20
|
|
||||||
});
|
|
||||||
hide();
|
|
||||||
message.success('审核通过成功');
|
|
||||||
reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
hide();
|
|
||||||
message.error(error.message || '审核失败,请重试');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 审核驳回 */
|
|
||||||
const rejectApply = (row: ShopDealerApply) => {
|
|
||||||
let rejectReason = '';
|
|
||||||
Modal.confirm({
|
|
||||||
title: '审核驳回',
|
|
||||||
content: createVNode('div', null, [
|
|
||||||
createVNode('p', null, `申请人: ${row.realName} (${row.mobile})`),
|
|
||||||
createVNode('p', {style: 'margin-top: 12px;'}, '请输入驳回原因:'),
|
|
||||||
createVNode('textarea', {
|
|
||||||
placeholder: '请输入驳回原因...',
|
|
||||||
style: 'width: 100%; height: 80px; margin-top: 8px; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;',
|
|
||||||
onInput: (e: any) => {
|
|
||||||
rejectReason = e.target.value;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
icon: createVNode(CloseOutlined),
|
|
||||||
okText: '确认驳回',
|
|
||||||
okType: 'danger',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
if (!rejectReason.trim()) {
|
|
||||||
message.error('请输入驳回原因');
|
|
||||||
return Promise.reject();
|
|
||||||
}
|
|
||||||
const hide = message.loading('正在处理审核...', 0);
|
|
||||||
try {
|
|
||||||
await updateShopDealerApply({
|
|
||||||
...row,
|
|
||||||
applyStatus: 30,
|
|
||||||
rejectReason: rejectReason.trim()
|
|
||||||
});
|
|
||||||
hide();
|
|
||||||
message.success('审核驳回成功');
|
|
||||||
reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
hide();
|
|
||||||
message.error(error.message || '审核失败,请重试');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: ShopDealerApply) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: ShopDealerApply) => {
|
|
||||||
if (!row.applyId) {
|
|
||||||
message.error('删除失败:缺少必要参数');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hide = message.loading('正在删除申请记录...', 0);
|
|
||||||
removeShopDealerApply(row.applyId)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg || '删除成功');
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message || '删除失败');
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 批量删除 */
|
// 表格列配置
|
||||||
const removeBatch = () => {
|
const columns = ref<ColumnItem[]>([
|
||||||
if (!selection.value.length) {
|
{
|
||||||
message.error('请至少选择一条数据');
|
title: '用户ID',
|
||||||
return;
|
dataIndex: 'userId',
|
||||||
}
|
key: 'userId',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '客户名称',
|
||||||
|
dataIndex: 'customer',
|
||||||
|
key: 'customer'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '最后跟进情况',
|
||||||
|
dataIndex: 'comments',
|
||||||
|
key: 'comments',
|
||||||
|
align: 'left'
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '收益基数',
|
||||||
|
// dataIndex: 'rate',
|
||||||
|
// key: 'rate',
|
||||||
|
// align: 'left'
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '报备人信息',
|
||||||
|
dataIndex: 'applicantInfo',
|
||||||
|
key: 'applicantInfo',
|
||||||
|
align: 'left',
|
||||||
|
fixed: 'left',
|
||||||
|
customRender: ({ record }) => {
|
||||||
|
return `${record.nickName || '-'} (${record.phone || '-'})`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'applyStatus',
|
||||||
|
key: 'applyStatus',
|
||||||
|
align: 'center',
|
||||||
|
width: 120
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '申请时间',
|
||||||
|
// dataIndex: 'applyTime',
|
||||||
|
// key: 'applyTime',
|
||||||
|
// align: 'center',
|
||||||
|
// width: 120,
|
||||||
|
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '审核时间',
|
||||||
|
// dataIndex: 'auditTime',
|
||||||
|
// key: 'auditTime',
|
||||||
|
// align: 'center',
|
||||||
|
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '添加时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true
|
||||||
|
}
|
||||||
|
// {
|
||||||
|
// title: '操作',
|
||||||
|
// key: 'action',
|
||||||
|
// fixed: 'right',
|
||||||
|
// align: 'center',
|
||||||
|
// width: 380,
|
||||||
|
// hideInSetting: true
|
||||||
|
// }
|
||||||
|
]);
|
||||||
|
|
||||||
const validIds = selection.value.filter(d => d.applyId).map(d => d.applyId);
|
/* 搜索 */
|
||||||
if (!validIds.length) {
|
const reload = (where?: ShopDealerApplyParam) => {
|
||||||
message.error('选中的数据中没有有效的ID');
|
selection.value = [];
|
||||||
return;
|
tableRef?.value?.reload({ where: where });
|
||||||
}
|
};
|
||||||
|
|
||||||
Modal.confirm({
|
/* 审核通过 */
|
||||||
title: '批量删除确认',
|
const approveApply = (row: ShopDealerApply) => {
|
||||||
content: `确定要删除选中的 ${validIds.length} 条申请记录吗?此操作不可恢复。`,
|
Modal.confirm({
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
title: '审核通过确认',
|
||||||
maskClosable: true,
|
content: `确定要通过 ${row.realName} 的经销商申请吗?`,
|
||||||
okText: '确认删除',
|
icon: createVNode(CheckOutlined),
|
||||||
okType: 'danger',
|
okText: '确认通过',
|
||||||
cancelText: '取消',
|
okType: 'primary',
|
||||||
onOk: () => {
|
cancelText: '取消',
|
||||||
const hide = message.loading(`正在删除 ${validIds.length} 条记录...`, 0);
|
onOk: async () => {
|
||||||
removeBatchShopDealerApply(validIds)
|
const hide = message.loading('正在处理审核...', 0);
|
||||||
.then((msg) => {
|
try {
|
||||||
|
await updateShopDealerApply({
|
||||||
|
...row,
|
||||||
|
applyId: row.applyId,
|
||||||
|
applyStatus: 20
|
||||||
|
});
|
||||||
hide();
|
hide();
|
||||||
message.success(msg || `成功删除 ${validIds.length} 条记录`);
|
message.success('审核通过成功');
|
||||||
|
reload();
|
||||||
|
} catch (error: any) {
|
||||||
|
hide();
|
||||||
|
message.error(error.message || '审核失败,请重试');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 审核驳回 */
|
||||||
|
const rejectApply = (row: ShopDealerApply) => {
|
||||||
|
let rejectReason = '';
|
||||||
|
Modal.confirm({
|
||||||
|
title: '审核驳回',
|
||||||
|
content: createVNode('div', null, [
|
||||||
|
createVNode('p', null, `申请人: ${row.realName} (${row.mobile})`),
|
||||||
|
createVNode('p', { style: 'margin-top: 12px;' }, '请输入驳回原因:'),
|
||||||
|
createVNode('textarea', {
|
||||||
|
placeholder: '请输入驳回原因...',
|
||||||
|
style:
|
||||||
|
'width: 100%; height: 80px; margin-top: 8px; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;',
|
||||||
|
onInput: (e: any) => {
|
||||||
|
rejectReason = e.target.value;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
icon: createVNode(CloseOutlined),
|
||||||
|
okText: '确认驳回',
|
||||||
|
okType: 'danger',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: async () => {
|
||||||
|
if (!rejectReason.trim()) {
|
||||||
|
message.error('请输入驳回原因');
|
||||||
|
return Promise.reject();
|
||||||
|
}
|
||||||
|
const hide = message.loading('正在处理审核...', 0);
|
||||||
|
try {
|
||||||
|
await updateShopDealerApply({
|
||||||
|
...row,
|
||||||
|
applyStatus: 30,
|
||||||
|
rejectReason: rejectReason.trim()
|
||||||
|
});
|
||||||
|
hide();
|
||||||
|
message.success('审核驳回成功');
|
||||||
|
reload();
|
||||||
|
} catch (error: any) {
|
||||||
|
hide();
|
||||||
|
message.error(error.message || '审核失败,请重试');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: ShopDealerApply) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: ShopDealerApply) => {
|
||||||
|
if (!row.applyId) {
|
||||||
|
message.error('删除失败:缺少必要参数');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hide = message.loading('正在删除申请记录...', 0);
|
||||||
|
removeShopDealerApply(row.applyId)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg || '删除成功');
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message || '删除失败');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 批量删除 */
|
||||||
|
const removeBatch = () => {
|
||||||
|
if (!selection.value.length) {
|
||||||
|
message.error('请至少选择一条数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const validIds = selection.value
|
||||||
|
.filter((d) => d.applyId)
|
||||||
|
.map((d) => d.applyId);
|
||||||
|
if (!validIds.length) {
|
||||||
|
message.error('选中的数据中没有有效的ID');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Modal.confirm({
|
||||||
|
title: '批量删除确认',
|
||||||
|
content: `确定要删除选中的 ${validIds.length} 条申请记录吗?此操作不可恢复。`,
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
okText: '确认删除',
|
||||||
|
okType: 'danger',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
const hide = message.loading(
|
||||||
|
`正在删除 ${validIds.length} 条记录...`,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
removeBatchShopDealerApply(validIds)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg || `成功删除 ${validIds.length} 条记录`);
|
||||||
|
selection.value = [];
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message || '批量删除失败');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 批量通过 */
|
||||||
|
const batchApprove = () => {
|
||||||
|
if (!selection.value.length) {
|
||||||
|
message.error('请至少选择一条数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pendingApplies = selection.value.filter(
|
||||||
|
(item) => item.applyStatus === 10
|
||||||
|
);
|
||||||
|
if (!pendingApplies.length) {
|
||||||
|
message.error('所选申请中没有待审核的记录');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Modal.confirm({
|
||||||
|
title: '批量通过确认',
|
||||||
|
content: `确定要通过选中的 ${pendingApplies.length} 个申请吗?`,
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
okText: '确认通过',
|
||||||
|
okType: 'primary',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: async () => {
|
||||||
|
const hide = message.loading('正在批量通过...', 0);
|
||||||
|
try {
|
||||||
|
const ids = pendingApplies.map((item) => item.applyId);
|
||||||
|
await batchApproveShopDealerApply(ids);
|
||||||
|
hide();
|
||||||
|
message.success(`成功通过 ${pendingApplies.length} 个申请`);
|
||||||
selection.value = [];
|
selection.value = [];
|
||||||
reload();
|
reload();
|
||||||
})
|
} catch (error: any) {
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
hide();
|
||||||
message.error(e.message || '批量删除失败');
|
message.error(error.message || '批量审核失败,请重试');
|
||||||
});
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量通过 */
|
|
||||||
const batchApprove = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pendingApplies = selection.value.filter(item => item.applyStatus === 10);
|
|
||||||
if (!pendingApplies.length) {
|
|
||||||
message.error('所选申请中没有待审核的记录');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Modal.confirm({
|
|
||||||
title: '批量通过确认',
|
|
||||||
content: `确定要通过选中的 ${pendingApplies.length} 个申请吗?`,
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
okText: '确认通过',
|
|
||||||
okType: 'primary',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
const hide = message.loading('正在批量通过...', 0);
|
|
||||||
try {
|
|
||||||
const ids = pendingApplies.map(item => item.applyId);
|
|
||||||
await batchApproveShopDealerApply(ids);
|
|
||||||
hide();
|
|
||||||
message.success(`成功通过 ${pendingApplies.length} 个申请`);
|
|
||||||
selection.value = [];
|
|
||||||
reload();
|
|
||||||
} catch (error: any) {
|
|
||||||
hide();
|
|
||||||
message.error(error.message || '批量审核失败,请重试');
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 导出数据 */
|
|
||||||
const exportData = () => {
|
|
||||||
const hide = message.loading('正在导出申请数据...', 0);
|
|
||||||
// 这里调用导出API
|
|
||||||
setTimeout(() => {
|
|
||||||
hide();
|
|
||||||
message.success('申请数据导出成功');
|
|
||||||
}, 2000);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ShopDealerApply) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
query();
|
/* 导出数据 */
|
||||||
|
const exportData = () => {
|
||||||
|
const hide = message.loading('正在导出申请数据...', 0);
|
||||||
|
// 这里调用导出API
|
||||||
|
setTimeout(() => {
|
||||||
|
hide();
|
||||||
|
message.success('申请数据导出成功');
|
||||||
|
}, 2000);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: ShopDealerApply) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: 'ShopDealerApply'
|
name: 'ShopDealerApply'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,50 +1,54 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
<ele-pro-table
|
<ele-pro-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:datasource="datasource"
|
:datasource="datasource"
|
||||||
:customRow="customRow"
|
:customRow="customRow"
|
||||||
tool-class="ele-toolbar-form"
|
tool-class="ele-toolbar-form"
|
||||||
class="sys-org-table"
|
class="sys-org-table"
|
||||||
>
|
>
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
<search
|
<search
|
||||||
@search="reload"
|
@search="reload"
|
||||||
:selection="selection"
|
:selection="selection"
|
||||||
@add="openEdit"
|
@add="openEdit"
|
||||||
@remove="removeBatch"
|
@remove="removeBatch"
|
||||||
@batchMove="openMove"
|
@batchMove="openMove"
|
||||||
/>
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'image'">
|
||||||
|
<a-image :src="record.image" :width="50" />
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
<template v-if="column.key === 'status'">
|
||||||
<template v-if="column.key === 'image'">
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
<a-image :src="record.image" :width="50" />
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'status'">
|
|
||||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
|
||||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
|
||||||
</template>
|
|
||||||
<template v-if="column.key === 'action'">
|
|
||||||
<a-space>
|
|
||||||
<a @click="openEdit(record)">修改</a>
|
|
||||||
<a-divider type="vertical" />
|
|
||||||
<a-popconfirm
|
|
||||||
title="确定要删除此记录吗?"
|
|
||||||
@confirm="remove(record)"
|
|
||||||
>
|
|
||||||
<a class="ele-text-danger">删除</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</template>
|
</template>
|
||||||
</ele-pro-table>
|
<template v-if="column.key === 'action'">
|
||||||
</a-card>
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<ShopDealerCapitalEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
<ShopDealerCapitalEdit
|
||||||
|
v-model:visible="showEdit"
|
||||||
|
:data="current"
|
||||||
|
@done="reload"
|
||||||
|
/>
|
||||||
</a-page-header>
|
</a-page-header>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -58,10 +62,17 @@
|
|||||||
ColumnItem
|
ColumnItem
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
import Search from './components/search.vue';
|
import Search from './components/search.vue';
|
||||||
import {getPageTitle} from '@/utils/common';
|
import { getPageTitle } from '@/utils/common';
|
||||||
import ShopDealerCapitalEdit from './components/shopDealerCapitalEdit.vue';
|
import ShopDealerCapitalEdit from './components/shopDealerCapitalEdit.vue';
|
||||||
import { pageShopDealerCapital, removeShopDealerCapital, removeBatchShopDealerCapital } from '@/api/shop/shopDealerCapital';
|
import {
|
||||||
import type { ShopDealerCapital, ShopDealerCapitalParam } from '@/api/shop/shopDealerCapital/model';
|
pageShopDealerCapital,
|
||||||
|
removeShopDealerCapital,
|
||||||
|
removeBatchShopDealerCapital
|
||||||
|
} from '@/api/shop/shopDealerCapital';
|
||||||
|
import type {
|
||||||
|
ShopDealerCapital,
|
||||||
|
ShopDealerCapitalParam
|
||||||
|
} from '@/api/shop/shopDealerCapital/model';
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
@@ -127,7 +138,11 @@
|
|||||||
50: { text: '新人注册奖', color: 'processing' }
|
50: { text: '新人注册奖', color: 'processing' }
|
||||||
};
|
};
|
||||||
const type = typeMap[text] || { text: '未知', color: 'default' };
|
const type = typeMap[text] || { text: '未知', color: 'default' };
|
||||||
return { type: 'tag', props: { color: type.color }, children: type.text };
|
return {
|
||||||
|
type: 'tag',
|
||||||
|
props: { color: type.color },
|
||||||
|
children: type.text
|
||||||
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -137,12 +152,15 @@
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
customRender: ({ text, record }) => {
|
customRender: ({ text, record }) => {
|
||||||
const amount = parseFloat(text || '0').toFixed(2);
|
const amount = parseFloat(text || '0').toFixed(2);
|
||||||
const isIncome = record.flowType === 10 || record.flowType === 40 || record.flowType === 50;
|
const isIncome =
|
||||||
|
record.flowType === 10 ||
|
||||||
|
record.flowType === 40 ||
|
||||||
|
record.flowType === 50;
|
||||||
return {
|
return {
|
||||||
type: 'span',
|
type: 'span',
|
||||||
props: {
|
props: {
|
||||||
style: {
|
style: {
|
||||||
color: isIncome ? '#424242' : '#ff4d4f',
|
color: isIncome ? '#424242' : '#ff4d4f'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
children: `${isIncome ? '' : '-'} ${amount}`
|
children: `${isIncome ? '' : '-'} ${amount}`
|
||||||
@@ -161,7 +179,7 @@
|
|||||||
dataIndex: 'toUserId',
|
dataIndex: 'toUserId',
|
||||||
key: 'toUserId',
|
key: 'toUserId',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
customRender: ({ text }) => text ? `ID: ${text}` : '-'
|
customRender: ({ text }) => (text ? `ID: ${text}` : '-')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '描述',
|
title: '描述',
|
||||||
|
|||||||
Reference in New Issue
Block a user