From 5b38710ddfd9755042527e6e0b836ef7e923ee31 Mon Sep 17 00:00:00 2001 From: louis <869322496@qq.com> Date: Fri, 12 Apr 2024 09:55:19 +0800 Subject: [PATCH] feat: sale_quotation --- src/api/backend/api/index.ts | 6 + src/api/backend/api/saleQuotationComponent.ts | 104 ++++++++++++++ src/api/backend/api/saleQuotationGroup.ts | 104 ++++++++++++++ src/api/backend/api/saleQuotationTemplate.ts | 104 ++++++++++++++ src/api/backend/api/typings.d.ts | 127 +++++++++++++++++- .../sale_quotation/component/columns.tsx | 35 +++++ .../sale_quotation/component/formSchemas.ts | 67 +++++++++ src/views/sale_quotation/component/index.vue | 118 ++++++++++++++++ src/views/sale_quotation/group/columns.tsx | 10 ++ src/views/sale_quotation/group/formSchemas.ts | 12 ++ src/views/sale_quotation/group/index.vue | 122 +++++++++++++++++ src/views/sale_quotation/index.vue | 13 ++ src/views/sale_quotation/template/columns.tsx | 10 ++ .../sale_quotation/template/formSchemas.ts | 12 ++ src/views/sale_quotation/template/index.vue | 117 ++++++++++++++++ 15 files changed, 960 insertions(+), 1 deletion(-) create mode 100644 src/api/backend/api/saleQuotationComponent.ts create mode 100644 src/api/backend/api/saleQuotationGroup.ts create mode 100644 src/api/backend/api/saleQuotationTemplate.ts create mode 100644 src/views/sale_quotation/component/columns.tsx create mode 100644 src/views/sale_quotation/component/formSchemas.ts create mode 100644 src/views/sale_quotation/component/index.vue create mode 100644 src/views/sale_quotation/group/columns.tsx create mode 100644 src/views/sale_quotation/group/formSchemas.ts create mode 100644 src/views/sale_quotation/group/index.vue create mode 100644 src/views/sale_quotation/index.vue create mode 100644 src/views/sale_quotation/template/columns.tsx create mode 100644 src/views/sale_quotation/template/formSchemas.ts create mode 100644 src/views/sale_quotation/template/index.vue diff --git a/src/api/backend/api/index.ts b/src/api/backend/api/index.ts index eaf51e9..b000249 100644 --- a/src/api/backend/api/index.ts +++ b/src/api/backend/api/index.ts @@ -32,6 +32,9 @@ import * as company from './company'; import * as product from './product'; import * as materialsInOut from './materialsInOut'; import * as vehicleUsage from './vehicleUsage'; +import * as saleQuotationGroup from './saleQuotationGroup'; +import * as saleQuotationComponent from './saleQuotationComponent'; +import * as saleQuotationTemplate from './saleQuotationTemplate'; export default { auth, @@ -64,4 +67,7 @@ export default { materialsInOut, project, vehicleUsage, + saleQuotationGroup, + saleQuotationComponent, + saleQuotationTemplate, }; diff --git a/src/api/backend/api/saleQuotationComponent.ts b/src/api/backend/api/saleQuotationComponent.ts new file mode 100644 index 0000000..aa0760f --- /dev/null +++ b/src/api/backend/api/saleQuotationComponent.ts @@ -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(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(`${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(`${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(`${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(`${baseApi}/${param0}`, { + method: 'DELETE', + params: { ...queryParams }, + ...(options || { successMsg: '删除成功' }), + }); +} diff --git a/src/api/backend/api/saleQuotationGroup.ts b/src/api/backend/api/saleQuotationGroup.ts new file mode 100644 index 0000000..7194bbe --- /dev/null +++ b/src/api/backend/api/saleQuotationGroup.ts @@ -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(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(`${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(`${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(`${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(`${baseApi}/${param0}`, { + method: 'DELETE', + params: { ...queryParams }, + ...(options || { successMsg: '删除成功' }), + }); +} diff --git a/src/api/backend/api/saleQuotationTemplate.ts b/src/api/backend/api/saleQuotationTemplate.ts new file mode 100644 index 0000000..c81a3b6 --- /dev/null +++ b/src/api/backend/api/saleQuotationTemplate.ts @@ -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(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(`${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(`${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(`${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(`${baseApi}/${param0}`, { + method: 'DELETE', + params: { ...queryParams }, + ...(options || { successMsg: '删除成功' }), + }); +} diff --git a/src/api/backend/api/typings.d.ts b/src/api/backend/api/typings.d.ts index c6e19c6..2723f0e 100644 --- a/src/api/backend/api/typings.d.ts +++ b/src/api/backend/api/typings.d.ts @@ -1507,7 +1507,42 @@ declare namespace API { type MaterialsInventoryDeleteParams = { 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 type ProjectEntity = { /** 项目名称 */ @@ -1890,4 +1925,94 @@ declare namespace API { type MaterialsInOutDeleteParams = { 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; + }; } diff --git a/src/views/sale_quotation/component/columns.tsx b/src/views/sale_quotation/component/columns.tsx new file mode 100644 index 0000000..85805ca --- /dev/null +++ b/src/views/sale_quotation/component/columns.tsx @@ -0,0 +1,35 @@ +import type { TableColumn } from '@/components/core/dynamic-table'; + +export type TableListItem = API.SaleQuotationComponentEntity; +export type TableColumnItem = TableColumn; +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', + }, +]; diff --git a/src/views/sale_quotation/component/formSchemas.ts b/src/views/sale_quotation/component/formSchemas.ts new file mode 100644 index 0000000..6d33856 --- /dev/null +++ b/src/views/sale_quotation/component/formSchemas.ts @@ -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[] = [ + { + 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, + }, + }, +]; diff --git a/src/views/sale_quotation/component/index.vue b/src/views/sale_quotation/component/index.vue new file mode 100644 index 0000000..ddadbb9 --- /dev/null +++ b/src/views/sale_quotation/component/index.vue @@ -0,0 +1,118 @@ + + + + + diff --git a/src/views/sale_quotation/group/columns.tsx b/src/views/sale_quotation/group/columns.tsx new file mode 100644 index 0000000..42c8e65 --- /dev/null +++ b/src/views/sale_quotation/group/columns.tsx @@ -0,0 +1,10 @@ +import type { TableColumn } from '@/components/core/dynamic-table'; + +export type TableListItem = API.SaleQuotationGroupEntity; +export type TableColumnItem = TableColumn; +export const baseColumns: TableColumnItem[] = [ + { + title: '分组名称', + dataIndex: 'name', + }, +]; diff --git a/src/views/sale_quotation/group/formSchemas.ts b/src/views/sale_quotation/group/formSchemas.ts new file mode 100644 index 0000000..0769e63 --- /dev/null +++ b/src/views/sale_quotation/group/formSchemas.ts @@ -0,0 +1,12 @@ +import type { FormSchema } from '@/components/core/schema-form/'; +export const formSchemas: FormSchema[] = [ + { + field: 'name', + component: 'Input', + label: '分组名称', + rules: [{ required: true, type: 'string' }], + colProps: { + span: 12, + }, + }, +]; diff --git a/src/views/sale_quotation/group/index.vue b/src/views/sale_quotation/group/index.vue new file mode 100644 index 0000000..7cbef31 --- /dev/null +++ b/src/views/sale_quotation/group/index.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/src/views/sale_quotation/index.vue b/src/views/sale_quotation/index.vue new file mode 100644 index 0000000..f9b3217 --- /dev/null +++ b/src/views/sale_quotation/index.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/src/views/sale_quotation/template/columns.tsx b/src/views/sale_quotation/template/columns.tsx new file mode 100644 index 0000000..7027a24 --- /dev/null +++ b/src/views/sale_quotation/template/columns.tsx @@ -0,0 +1,10 @@ +import type { TableColumn } from '@/components/core/dynamic-table'; + +export type TableListItem = API.SaleQuotationTemplateEntity; +export type TableColumnItem = TableColumn; +export const baseColumns: TableColumnItem[] = [ + { + title: '模板名称', + dataIndex: 'name', + }, +]; diff --git a/src/views/sale_quotation/template/formSchemas.ts b/src/views/sale_quotation/template/formSchemas.ts new file mode 100644 index 0000000..11d171f --- /dev/null +++ b/src/views/sale_quotation/template/formSchemas.ts @@ -0,0 +1,12 @@ +import type { FormSchema } from '@/components/core/schema-form/'; +export const formSchemas: FormSchema[] = [ + { + field: 'name', + component: 'Input', + label: '模板名称', + rules: [{ required: true, type: 'string' }], + colProps: { + span: 12, + }, + }, +]; diff --git a/src/views/sale_quotation/template/index.vue b/src/views/sale_quotation/template/index.vue new file mode 100644 index 0000000..8844bc0 --- /dev/null +++ b/src/views/sale_quotation/template/index.vue @@ -0,0 +1,117 @@ + + + + +