feat: sale_quotation

This commit is contained in:
louis 2024-04-12 09:55:19 +08:00
parent 780b6658c4
commit 5b38710ddf
15 changed files with 960 additions and 1 deletions

View File

@ -32,6 +32,9 @@ import * as company from './company';
import * as product from './product'; import * as product from './product';
import * as materialsInOut from './materialsInOut'; import * as materialsInOut from './materialsInOut';
import * as vehicleUsage from './vehicleUsage'; import * as vehicleUsage from './vehicleUsage';
import * as saleQuotationGroup from './saleQuotationGroup';
import * as saleQuotationComponent from './saleQuotationComponent';
import * as saleQuotationTemplate from './saleQuotationTemplate';
export default { export default {
auth, auth,
@ -64,4 +67,7 @@ export default {
materialsInOut, materialsInOut,
project, project,
vehicleUsage, vehicleUsage,
saleQuotationGroup,
saleQuotationComponent,
saleQuotationTemplate,
}; };

View File

@ -0,0 +1,104 @@
import { request, type RequestOptions } from '@/utils/request';
const baseApi = '/api/sale_quotation/sale_quotation_component';
/** 获取报价配件列表 GET /api/sale_quotation_component */
export async function saleQuotationComponentList(params: API.SaleQuotationComponentParams, options?: RequestOptions) {
return request<{
items?: API.SaleQuotationComponentEntity[];
meta?: {
itemCount?: number;
totalItems?: number;
itemsPerPage?: number;
totalPages?: number;
currentPage?: number;
};
}>(baseApi, {
method: 'GET',
params: {
// page has a default value: 1
page: '1',
// pageSize has a default value: 10
pageSize: '10',
...params,
},
...(options || {}),
});
}
/** 新增报价配件 POST /api/sale_quotation_component */
export async function saleQuotationComponentCreate(body: API.SaleQuotationComponentDto, options?: RequestOptions) {
return request<any>(baseApi, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || { successMsg: '创建成功' }),
});
}
/** 获取报价配件信息 GET /api/sale_quotation_component/${param0} */
export async function saleQuotationComponentInfo(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationComponentInfoParams,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<API.SaleQuotationComponentEntity>(`${baseApi}/${param0}`, {
method: 'GET',
params: { ...queryParams },
...(options || {}),
});
}
/** 解除报价配件和附件关联 PUT /api/sale_quotation_component/unlink-attachments/${param0} */
export async function unlinkAttachments(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationComponentUpdateParams,
body: API.SaleQuotationComponentUpdateDto,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<any>(`${baseApi}/unlink-attachments/${param0}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
params: { ...queryParams },
data: body,
...options,
});
}
/** 更新报价配件 PUT /api/sale_quotation_component/${param0} */
export async function saleQuotationComponentUpdate(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationComponentUpdateParams,
body: API.SaleQuotationComponentUpdateDto,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<any>(`${baseApi}/${param0}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
params: { ...queryParams },
data: body,
...(options || { successMsg: '更新成功' }),
});
}
/** 删除报价配件 DELETE /api/sale_quotation_component/${param0} */
export async function saleQuotationComponentDelete(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationComponentDeleteParams,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<any>(`${baseApi}/${param0}`, {
method: 'DELETE',
params: { ...queryParams },
...(options || { successMsg: '删除成功' }),
});
}

View File

@ -0,0 +1,104 @@
import { request, type RequestOptions } from '@/utils/request';
const baseApi = '/api/sale_quotation/sale_quotation_group';
/** 获取报价分组列表 GET /api/sale_quotation_group */
export async function saleQuotationGroupList(params: API.SaleQuotationGroupParams, options?: RequestOptions) {
return request<{
items?: API.SaleQuotationGroupEntity[];
meta?: {
itemCount?: number;
totalItems?: number;
itemsPerPage?: number;
totalPages?: number;
currentPage?: number;
};
}>(baseApi, {
method: 'GET',
params: {
// page has a default value: 1
page: '1',
// pageSize has a default value: 10
pageSize: '10',
...params,
},
...(options || {}),
});
}
/** 新增报价分组 POST /api/sale_quotation_group */
export async function saleQuotationGroupCreate(body: API.SaleQuotationGroupDto, options?: RequestOptions) {
return request<any>(baseApi, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || { successMsg: '创建成功' }),
});
}
/** 获取报价分组信息 GET /api/sale_quotation_group/${param0} */
export async function saleQuotationGroupInfo(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationGroupInfoParams,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<API.SaleQuotationGroupEntity>(`${baseApi}/${param0}`, {
method: 'GET',
params: { ...queryParams },
...(options || {}),
});
}
/** 解除报价分组和附件关联 PUT /api/sale_quotation_group/unlink-attachments/${param0} */
export async function unlinkAttachments(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationGroupUpdateParams,
body: API.SaleQuotationGroupUpdateDto,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<any>(`${baseApi}/unlink-attachments/${param0}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
params: { ...queryParams },
data: body,
...options,
});
}
/** 更新报价分组 PUT /api/sale_quotation_group/${param0} */
export async function saleQuotationGroupUpdate(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationGroupUpdateParams,
body: API.SaleQuotationGroupUpdateDto,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<any>(`${baseApi}/${param0}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
params: { ...queryParams },
data: body,
...(options || { successMsg: '更新成功' }),
});
}
/** 删除报价分组 DELETE /api/sale_quotation_group/${param0} */
export async function saleQuotationGroupDelete(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationGroupDeleteParams,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<any>(`${baseApi}/${param0}`, {
method: 'DELETE',
params: { ...queryParams },
...(options || { successMsg: '删除成功' }),
});
}

View File

@ -0,0 +1,104 @@
import { request, type RequestOptions } from '@/utils/request';
const baseApi = '/api/sale_quotation/sale_quotation_template';
/** 获取报价模板列表 GET /api/sale_quotation_template */
export async function saleQuotationTemplateList(params: API.SaleQuotationTemplateParams, options?: RequestOptions) {
return request<{
items?: API.SaleQuotationTemplateEntity[];
meta?: {
itemCount?: number;
totalItems?: number;
itemsPerPage?: number;
totalPages?: number;
currentPage?: number;
};
}>(baseApi, {
method: 'GET',
params: {
// page has a default value: 1
page: '1',
// pageSize has a default value: 10
pageSize: '10',
...params,
},
...(options || {}),
});
}
/** 新增报价模板 POST /api/sale_quotation_template */
export async function saleQuotationTemplateCreate(body: API.SaleQuotationTemplateDto, options?: RequestOptions) {
return request<any>(baseApi, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || { successMsg: '创建成功' }),
});
}
/** 获取报价模板信息 GET /api/sale_quotation_template/${param0} */
export async function saleQuotationTemplateInfo(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationTemplateInfoParams,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<API.SaleQuotationTemplateEntity>(`${baseApi}/${param0}`, {
method: 'GET',
params: { ...queryParams },
...(options || {}),
});
}
/** 解除报价模板和附件关联 PUT /api/sale_quotation_template/unlink-attachments/${param0} */
export async function unlinkAttachments(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationTemplateUpdateParams,
body: API.SaleQuotationTemplateUpdateDto,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<any>(`${baseApi}/unlink-attachments/${param0}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
params: { ...queryParams },
data: body,
...options,
});
}
/** 更新报价模板 PUT /api/sale_quotation_template/${param0} */
export async function saleQuotationTemplateUpdate(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationTemplateUpdateParams,
body: API.SaleQuotationTemplateUpdateDto,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<any>(`${baseApi}/${param0}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
params: { ...queryParams },
data: body,
...(options || { successMsg: '更新成功' }),
});
}
/** 删除报价模板 DELETE /api/sale_quotation_template/${param0} */
export async function saleQuotationTemplateDelete(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.SaleQuotationTemplateDeleteParams,
options?: RequestOptions,
) {
const { id: param0, ...queryParams } = params;
return request<any>(`${baseApi}/${param0}`, {
method: 'DELETE',
params: { ...queryParams },
...(options || { successMsg: '删除成功' }),
});
}

View File

@ -1507,7 +1507,42 @@ declare namespace API {
type MaterialsInventoryDeleteParams = { type MaterialsInventoryDeleteParams = {
id: number; id: number;
}; };
// SaleQuotationGroup
type SaleQuotationGroupEntity = {
/** 分组名称 */
name: string;
/** 是否删除 */
isDelete: string;
id: number;
createdAt: string;
updatedAt: string;
};
type SaleQuotationGroupDto = {
/** 分组名称 */
name: string;
};
type SaleQuotationGroupUpdateParams = {
id: number;
};
type SaleQuotationGroupParams = {
page?: number;
pageSize?: number;
name?: string;
productId?: number;
field?: string;
order?: 'ASC' | 'DESC';
_t?: number;
};
type SaleQuotationGroupInfoParams = {
id: number;
};
type SaleQuotationGroupUpdateDto = {
/** 分组名称 */
name?: string;
};
type SaleQuotationGroupDeleteParams = {
id: number;
};
// Project // Project
type ProjectEntity = { type ProjectEntity = {
/** 项目名称 */ /** 项目名称 */
@ -1890,4 +1925,94 @@ declare namespace API {
type MaterialsInOutDeleteParams = { type MaterialsInOutDeleteParams = {
id: number; id: number;
}; };
// SaleQuotationComponent
type SaleQuotationComponentEntity = {
/** 报价配件名称 */
name: string;
/** 产品规格 */
componentSpecification: string;
/** 产品备注 */
remark: string;
/** 单位 */
unit: DictItemEntity;
/** 单位 */
unitId?: number;
/** 单价 */
unitPrice: number;
/** 是否删除 */
isDelete: string;
id: number;
createdAt: string;
updatedAt: string;
};
type SaleQuotationComponentDto = {
/** 报价配件名称 */
name: string;
/** 产品规格 */
componentSpecification: string;
/** 单价 */
unitPrice: number;
/** 产品备注 */
remark: string;
/** 单位 */
unit: DictItemEntity;
};
type SaleQuotationComponentUpdateParams = {
id: number;
};
type SaleQuotationComponentParams = {
page?: number;
pageSize?: number;
name?: string;
productId?: number;
field?: string;
order?: 'ASC' | 'DESC';
_t?: number;
};
type SaleQuotationComponentInfoParams = {
id: number;
};
type SaleQuotationComponentUpdateDto = {
/** 报价配件名称 */
name?: string;
};
type SaleQuotationComponentDeleteParams = {
id: number;
};
// SaleQuotationTemplate
type SaleQuotationTemplateEntity = {
/** 报价模板名称 */
name: string;
/** 是否删除 */
isDelete: string;
id: number;
createdAt: string;
updatedAt: string;
};
type SaleQuotationTemplateDto = {
/** 报价模板名称 */
name: string;
};
type SaleQuotationTemplateUpdateParams = {
id: number;
};
type SaleQuotationTemplateParams = {
page?: number;
pageSize?: number;
name?: string;
productId?: number;
field?: string;
order?: 'ASC' | 'DESC';
_t?: number;
};
type SaleQuotationTemplateInfoParams = {
id: number;
};
type SaleQuotationTemplateUpdateDto = {
/** 报价模板名称 */
name?: string;
};
type SaleQuotationTemplateDeleteParams = {
id: number;
};
} }

View File

@ -0,0 +1,35 @@
import type { TableColumn } from '@/components/core/dynamic-table';
export type TableListItem = API.SaleQuotationComponentEntity;
export type TableColumnItem = TableColumn<TableListItem>;
export const baseColumns: TableColumnItem[] = [
{
title: '配件名称',
dataIndex: 'name',
},
{
title: '配件规格',
dataIndex: 'componentSpecification',
},
{
title: '单位',
dataIndex: 'unit',
width: 80,
customRender: ({ record }) => {
return record?.unit?.label || '';
},
},
{
title: '单价',
hideInSearch: true,
width: 80,
dataIndex: 'unitPrice',
customRender: ({ record }) => {
return parseFloat(record.unitPrice) || 0;
},
},
{
title: '备注',
dataIndex: 'remark',
},
];

View File

@ -0,0 +1,67 @@
import type { FormSchema } from '@/components/core/schema-form/';
import { DictEnum } from '@/enums/dictEnum';
import { useDictStore } from '@/store/modules/dict';
const { getDictItemsByCode } = useDictStore();
export const formSchemas: FormSchema<API.SaleQuotationComponentEntity>[] = [
{
field: 'name',
component: 'Input',
label: '配件名称',
rules: [{ required: true, type: 'string' }],
colProps: {
span: 12,
},
},
{
field: 'componentSpecification',
component: 'Input',
label: '配件规格',
colProps: {
span: 12,
},
},
{
label: '单位',
component: 'Select',
field: 'unitId',
colProps: {
span: 12,
},
componentProps: ({ formInstance, schema, formModel }) => ({
showSearch: true,
filterOption: (input: string, option: any) => {
return option.label.indexOf(input) >= 0;
},
fieldNames: {
label: 'label',
value: 'value',
},
options: getDictItemsByCode(DictEnum.Unit).map((item) => ({
value: item.id,
label: item.label,
})),
getPopupContainer: () => document.body,
defaultActiveFirstOption: true,
}),
},
{
label: '单价',
field: 'unitPrice',
component: 'InputNumber',
colProps: {
span: 12,
},
helpMessage: ({ formModel }) => {
return '成本价';
},
},
{
field: 'remark',
component: 'InputTextArea',
label: '备注',
colProps: {
span: 24,
},
},
];

View File

@ -0,0 +1,118 @@
<template>
<div v-if="columns?.length">
<DynamicTable row-key="id"
header-title="配件管理"
title-tooltip=""
:data-request="Api.saleQuotationComponent.saleQuotationComponentList"
:columns="columns"
bordered
size="small">
<template #toolbar>
<a-button type="primary"
:disabled="!$auth('sale_quotation:sale_quotation_component:create')"
@click="openEditModal({})">
新增
</a-button>
</template>
</DynamicTable>
</div>
</template>
<script setup lang="tsx">
import { useTable } from '@/components/core/dynamic-table';
import { baseColumns, type TableColumnItem, type TableListItem } from './columns';
import Api from '@/api/';
import { useFormModal, useModal } from '@/hooks/useModal';
import { formSchemas } from './formSchemas';
import { ref, onMounted } from 'vue';
defineOptions({
name: 'SaleQuotationComponent',
});
const [DynamicTable, dynamicTableInstance] = useTable({ formProps: { autoSubmitOnEnter: true } });
const [showModal] = useFormModal();
// saleQuotationComponentList;
let columns = ref<TableColumnItem[]>();
onMounted(() => {
columns.value = [
...baseColumns,
{
title: '操作',
maxWidth: 150,
width: 150,
minWidth: 150,
fixed: 'right',
dataIndex: 'ACTION',
hideInSearch: true,
actions: ({ record }) => [
{
icon: 'ant-design:edit-outlined',
tooltip: '编辑',
auth: {
perm: 'sale_quotation:sale_quotation_component:update',
effect: 'disable',
},
onClick: () => openEditModal(record),
},
{
icon: 'ant-design:delete-outlined',
color: 'red',
tooltip: '删除此配件',
auth: 'sale_quotation:sale_quotation_component:delete',
popConfirm: {
title: '你确定要删除吗?',
placement: 'left',
onConfirm: () => delRowConfirm(record.id),
},
},
],
},
];
});
/**
* @description 打开新增/编辑弹窗
*/
const openEditModal = async (record: Partial<TableListItem>) => {
const [formRef] = await showModal({
modalProps: {
title: `${record.id ? '编辑' : '新增'}配件`,
width: '50%',
onFinish: async (values) => {
if (record.id) {
await Api.saleQuotationComponent.saleQuotationComponentUpdate({ id: record.id }, values);
} else {
await Api.saleQuotationComponent.saleQuotationComponentCreate(values);
}
dynamicTableInstance?.reload();
},
},
formProps: {
labelWidth: 100,
schemas: formSchemas,
},
});
//
if (record.id) {
const info = await Api.saleQuotationComponent.saleQuotationComponentInfo({ id: record.id });
formRef?.setFieldsValue({
...info,
});
}
};
const delRowConfirm = async (record) => {
await Api.saleQuotationComponent.saleQuotationComponentDelete({ id: record });
dynamicTableInstance?.reload();
};
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,10 @@
import type { TableColumn } from '@/components/core/dynamic-table';
export type TableListItem = API.SaleQuotationGroupEntity;
export type TableColumnItem = TableColumn<TableListItem>;
export const baseColumns: TableColumnItem[] = [
{
title: '分组名称',
dataIndex: 'name',
},
];

View File

@ -0,0 +1,12 @@
import type { FormSchema } from '@/components/core/schema-form/';
export const formSchemas: FormSchema<API.SaleQuotationGroupEntity>[] = [
{
field: 'name',
component: 'Input',
label: '分组名称',
rules: [{ required: true, type: 'string' }],
colProps: {
span: 12,
},
},
];

View File

@ -0,0 +1,122 @@
<template>
<div v-if="columns?.length">
<DynamicTable row-key="id"
header-title="分组管理"
title-tooltip=""
:data-request="Api.saleQuotationGroup.saleQuotationGroupList"
:columns="columns"
bordered
size="small">
<template #toolbar>
<a-button type="primary"
:disabled="!$auth('sale_quotation:sale_quotation_group:create')"
@click="openEditModal({})">
新增
</a-button>
</template>
</DynamicTable>
</div>
</template>
<script setup lang="tsx">
import { useTable } from '@/components/core/dynamic-table';
import { baseColumns, type TableColumnItem, type TableListItem } from './columns';
import Api from '@/api/';
import { useFormModal, useModal } from '@/hooks/useModal';
import { formSchemas } from './formSchemas';
import { ref, onMounted } from 'vue';
defineOptions({
name: 'SaleQuotationGroup',
});
const [DynamicTable, dynamicTableInstance] = useTable({ formProps: { autoSubmitOnEnter: true } });
const [showModal] = useFormModal();
// saleQuotationGroupList;
let columns = ref<TableColumnItem[]>();
onMounted(() => {
columns.value = [
...baseColumns,
{
title: '操作',
maxWidth: 150,
width: 150,
minWidth: 150,
fixed: 'right',
dataIndex: 'ACTION',
hideInSearch: true,
actions: ({ record }) => [
// {
// icon: 'ant-design:plus-outlined',
// tooltip: '',
// onClick: () => openEditModal(record),
// },
{
icon: 'ant-design:edit-outlined',
tooltip: '编辑',
auth: {
perm: 'sale_quotation:sale_quotation_group:update',
effect: 'disable',
},
onClick: () => openEditModal(record),
},
{
icon: 'ant-design:delete-outlined',
color: 'red',
tooltip: '删除此分组',
auth: 'sale_quotation:sale_quotation_group:delete',
popConfirm: {
title: '你确定要删除吗?',
placement: 'left',
onConfirm: () => delRowConfirm(record.id),
},
},
],
},
];
});
/**
* @description 打开新增/编辑弹窗
*/
const openEditModal = async (record: Partial<TableListItem>) => {
const [formRef] = await showModal({
modalProps: {
title: `${record.id ? '编辑' : '新增'}分组`,
width: '50%',
onFinish: async (values) => {
if (record.id) {
await Api.saleQuotationGroup.saleQuotationGroupUpdate({ id: record.id }, values);
} else {
await Api.saleQuotationGroup.saleQuotationGroupCreate(values);
}
dynamicTableInstance?.reload();
},
},
formProps: {
labelWidth: 100,
schemas: formSchemas,
},
});
//
if (record.id) {
const info = await Api.saleQuotationGroup.saleQuotationGroupInfo({ id: record.id });
formRef?.setFieldsValue({
...info,
});
}
};
const delRowConfirm = async (record) => {
await Api.saleQuotationGroup.saleQuotationGroupDelete({ id: record });
dynamicTableInstance?.reload();
};
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,13 @@
<template>
<div>test</div>
</template>
<script setup lang='ts'>
defineOptions({
name: 'SaleQuotation'
})
</script>
<style lang='less' scoped>
</style>

View File

@ -0,0 +1,10 @@
import type { TableColumn } from '@/components/core/dynamic-table';
export type TableListItem = API.SaleQuotationTemplateEntity;
export type TableColumnItem = TableColumn<TableListItem>;
export const baseColumns: TableColumnItem[] = [
{
title: '模板名称',
dataIndex: 'name',
},
];

View File

@ -0,0 +1,12 @@
import type { FormSchema } from '@/components/core/schema-form/';
export const formSchemas: FormSchema<API.SaleQuotationTemplateEntity>[] = [
{
field: 'name',
component: 'Input',
label: '模板名称',
rules: [{ required: true, type: 'string' }],
colProps: {
span: 12,
},
},
];

View File

@ -0,0 +1,117 @@
<template>
<div v-if="columns?.length">
<DynamicTable row-key="id"
header-title="模板管理"
title-tooltip=""
:data-request="Api.saleQuotationTemplate.saleQuotationTemplateList"
:columns="columns"
bordered
size="small">
<template #toolbar>
<a-button type="primary"
:disabled="!$auth('sale_quotation:sale_quotation_group:create')"
@click="openEditModal({})">
新增
</a-button>
</template>
</DynamicTable>
</div>
</template>
<script setup lang="tsx">
import { useTable } from '@/components/core/dynamic-table';
import { baseColumns, type TableColumnItem, type TableListItem } from './columns';
import Api from '@/api/';
import { useFormModal, useModal } from '@/hooks/useModal';
import { formSchemas } from './formSchemas';
import { ref, onMounted } from 'vue';
defineOptions({
name: 'SaleQuotationTemplate',
});
const [DynamicTable, dynamicTableInstance] = useTable({ formProps: { autoSubmitOnEnter: true } });
const [showModal] = useFormModal();
// saleQuotationTemplateList;
let columns = ref<TableColumnItem[]>();
onMounted(() => {
columns.value = [
...baseColumns,
{
title: '操作',
maxWidth: 150,
width: 150,
minWidth: 150,
fixed: 'right',
dataIndex: 'ACTION',
hideInSearch: true,
actions: ({ record }) => [
{
icon: 'ant-design:edit-outlined',
tooltip: '编辑',
auth: {
perm: 'sale_quotation:sale_quotation_group:update',
effect: 'disable',
},
onClick: () => openEditModal(record),
},
{
icon: 'ant-design:delete-outlined',
color: 'red',
tooltip: '删除此模板',
auth: 'sale_quotation:sale_quotation_group:delete',
popConfirm: {
title: '你确定要删除吗?',
placement: 'left',
onConfirm: () => delRowConfirm(record.id),
},
},
],
},
];
});
/**
* @description 打开新增/编辑弹窗
*/
const openEditModal = async (record: Partial<TableListItem>) => {
const [formRef] = await showModal({
modalProps: {
title: `${record.id ? '编辑' : '新增'}模板`,
width: '50%',
onFinish: async (values) => {
if (record.id) {
await Api.saleQuotationTemplate.saleQuotationTemplateUpdate({ id: record.id }, values);
} else {
await Api.saleQuotationTemplate.saleQuotationTemplateCreate(values);
}
dynamicTableInstance?.reload();
},
},
formProps: {
labelWidth: 100,
schemas: formSchemas,
},
});
//
if (record.id) {
const info = await Api.saleQuotationTemplate.saleQuotationTemplateInfo({ id: record.id });
formRef?.setFieldsValue({
...info,
});
}
};
const delRowConfirm = async (record) => {
await Api.saleQuotationTemplate.saleQuotationTemplateDelete({ id: record });
dynamicTableInstance?.reload();
};
</script>
<style lang="less" scoped></style>