Browse Source

造价管理第一次文件上传

dev
zhouhaibin 12 months ago
parent
commit
c27bb2d285
  1. 68
      src/api/zaojiaManagement/productManagement/companyProductModel/companyProductModelDetails/index.ts
  2. 97
      src/api/zaojiaManagement/productManagement/companyProductModel/companyProductModelDetails/model.ts
  3. 90
      src/api/zaojiaManagement/productManagement/companyProductModel/index.ts
  4. 67
      src/api/zaojiaManagement/productManagement/companyProductModel/model.ts
  5. 59
      src/api/zaojiaManagement/productManagement/companyProducts/index.ts
  6. 227
      src/api/zaojiaManagement/productManagement/companyProducts/model.ts
  7. 63
      src/api/zaojiaManagement/productManagement/costTable/costItemDetail/index.ts
  8. 225
      src/api/zaojiaManagement/productManagement/costTable/costItemDetail/model.ts
  9. 90
      src/api/zaojiaManagement/productManagement/costTable/index.ts
  10. 70
      src/api/zaojiaManagement/productManagement/costTable/model.ts
  11. 87
      src/api/zaojiaManagement/productManagement/personProductModel/index.ts
  12. 67
      src/api/zaojiaManagement/productManagement/personProductModel/model.ts
  13. 66
      src/api/zaojiaManagement/productManagement/personProductModel/personProductModelDetails/index.ts
  14. 97
      src/api/zaojiaManagement/productManagement/personProductModel/personProductModelDetails/model.ts
  15. 57
      src/api/zaojiaManagement/productManagement/personProducts/index.ts
  16. 222
      src/api/zaojiaManagement/productManagement/personProducts/model.ts
  17. 89
      src/api/zaojiaManagement/productManagement/supplierProductModel/index.ts
  18. 67
      src/api/zaojiaManagement/productManagement/supplierProductModel/model.ts
  19. 68
      src/api/zaojiaManagement/productManagement/supplierProductModel/supplierProductModelDetails/index.ts
  20. 97
      src/api/zaojiaManagement/productManagement/supplierProductModel/supplierProductModelDetails/model.ts
  21. 60
      src/api/zaojiaManagement/productManagement/supplierProducts/index.ts
  22. 222
      src/api/zaojiaManagement/productManagement/supplierProducts/model.ts
  23. 62
      src/api/zaojiaManagement/supplierManagement/index.ts
  24. 97
      src/api/zaojiaManagement/supplierManagement/model.ts
  25. 234
      src/components/Upload/src/components/ImageUploadBefore.vue.bak
  26. 261
      src/views/zaojiaManagement/costTable/CostTableModal.vue
  27. 76
      src/views/zaojiaManagement/costTable/components/CostItemDetailModal.vue
  28. 151
      src/views/zaojiaManagement/costTable/components/CostTypeSelector.vue
  29. 246
      src/views/zaojiaManagement/costTable/components/costItemDetail.data.ts
  30. 134
      src/views/zaojiaManagement/costTable/costTable.data.ts
  31. 161
      src/views/zaojiaManagement/costTable/index.vue
  32. 95
      src/views/zaojiaManagement/productManagement/companyProducts/CompanyProductsModal.vue
  33. 240
      src/views/zaojiaManagement/productManagement/companyProducts/companyProducts.data.ts
  34. 122
      src/views/zaojiaManagement/productManagement/companyProducts/index.vue
  35. 107
      src/views/zaojiaManagement/productManagement/components/SupplierSelector.vue
  36. 64
      src/views/zaojiaManagement/productManagement/components/components.data.ts
  37. 100
      src/views/zaojiaManagement/productManagement/components/modelTemplateSet.vue
  38. 140
      src/views/zaojiaManagement/productManagement/components/productModelSet.vue
  39. 214
      src/views/zaojiaManagement/productManagement/components/uploadImage.vue.bak
  40. 106
      src/views/zaojiaManagement/productManagement/components/uploadImage1.vue.bak
  41. 100
      src/views/zaojiaManagement/productManagement/personProducts/PersonProductsModal.vue
  42. 122
      src/views/zaojiaManagement/productManagement/personProducts/index.vue
  43. 229
      src/views/zaojiaManagement/productManagement/personProducts/personProducts.data.ts
  44. 95
      src/views/zaojiaManagement/productManagement/supplierProducts/SupplierProductsModal.vue
  45. 122
      src/views/zaojiaManagement/productManagement/supplierProducts/index.vue
  46. 225
      src/views/zaojiaManagement/productManagement/supplierProducts/supplierProducts.data.ts
  47. 72
      src/views/zaojiaManagement/supplierManagement/SupplierInformationModal.vue
  48. 125
      src/views/zaojiaManagement/supplierManagement/index.vue
  49. 107
      src/views/zaojiaManagement/supplierManagement/supplierInformation.data.ts

68
src/api/zaojiaManagement/productManagement/companyProductModel/companyProductModelDetails/index.ts

@ -0,0 +1,68 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import {
CompanyProductModelDetailsVO,
CompanyProductModelDetailsForm,
CompanyProductModelDetailsQuery,
} from './model';
/**
*
* @param params
* @returns
*/
export function companyProductModelDetailsList(params?: CompanyProductModelDetailsQuery) {
return defHttp.get<CompanyProductModelDetailsVO[]>({
url: '/productManagement/companyProductModelDetails/list',
params,
});
}
/**
*
* @param params
* @returns
*/
export function companyProductModelDetailsExport(params?: CompanyProductModelDetailsQuery) {
return commonExport('/productManagement/companyProductModelDetails/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function companyProductModelDetailsInfo(id: ID) {
return defHttp.get<CompanyProductModelDetailsVO>({
url: '/productManagement/companyProductModelDetails/' + id,
});
}
/**
*
* @param data
* @returns
*/
export function companyProductModelDetailsAdd(data: CompanyProductModelDetailsForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/companyProductModelDetails', data });
}
/**
*
* @param data
* @returns
*/
export function companyProductModelDetailsUpdate(data: CompanyProductModelDetailsForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/companyProductModelDetails', data });
}
/**
*
* @param id id
* @returns
*/
export function companyProductModelDetailsRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({
url: '/productManagement/companyProductModelDetails/' + id,
});
}

97
src/api/zaojiaManagement/productManagement/companyProductModel/companyProductModelDetails/model.ts

@ -0,0 +1,97 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface CompanyProductModelDetailsVO {
/**
*
*/
id: string | number;
/**
* id
*/
modelId: string | number;
/**
*
*/
paramName: string;
/**
*
*/
parameterValue: string;
/**
*
*/
isKeyParameter: string;
/**
*
*/
isTemporary: string;
}
export interface CompanyProductModelDetailsForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
* id
*/
modelId?: string | number;
/**
*
*/
paramName?: string;
/**
*
*/
parameterValue?: string;
/**
*
*/
isKeyParameter?: string;
/**
*
*/
isTemporary?: string;
}
export interface CompanyProductModelDetailsQuery extends PageQuery {
/**
* id
*/
modelId?: string | number;
/**
*
*/
paramName?: string;
/**
*
*/
parameterValue?: string;
/**
*
*/
isKeyParameter?: string;
/**
*
*/
isTemporary?: string;
/**
*
*/
params?: any;
}

90
src/api/zaojiaManagement/productManagement/companyProductModel/index.ts

@ -0,0 +1,90 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import { CompanyProductModelVO, CompanyProductModelForm, CompanyProductModelQuery } from './model';
import { CompanyProductModelDetailsVO } from './companyProductModelDetails/model';
/**
*
* @param id
* @returns
*/
export function companyProductGetModelDetails(id: ID) {
return defHttp.get<CompanyProductModelDetailsVO[]>({
url: '/productManagement/companyProductModel/getModelDetails/' + id,
});
}
/**
*
* @param data
* @returns
*/
export function addCompanyProductModel(data: CompanyProductModelForm) {
return defHttp.post<string>({ url: '/productManagement/companyProductModel/addModel', data });
}
/**
*
* @param data
* @returns
*/
export function updateCompanyProductModel(data: CompanyProductModelForm) {
return defHttp.put<string>({ url: '/productManagement/companyProductModel/editModel', data });
}
/**
*
* @param params
* @returns
*/
export function companyProductModelList(params?: CompanyProductModelQuery) {
return defHttp.get<CompanyProductModelVO[]>({
url: '/productManagement/companyProductModel/list',
params,
});
}
/**
*
* @param params
* @returns
*/
export function companyProductModelExport(params?: CompanyProductModelQuery) {
return commonExport('/productManagement/companyProductModel/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function companyProductModelInfo(id: ID) {
return defHttp.get<CompanyProductModelVO>({
url: '/productManagement/companyProductModel/' + id,
});
}
/**
*
* @param data
* @returns
*/
export function companyProductModelAdd(data: CompanyProductModelForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/companyProductModel', data });
}
/**
*
* @param data
* @returns
*/
export function companyProductModelUpdate(data: CompanyProductModelForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/companyProductModel', data });
}
/**
*
* @param id id
* @returns
*/
export function companyProductModelRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({ url: '/productManagement/companyProductModel/' + id });
}

67
src/api/zaojiaManagement/productManagement/companyProductModel/model.ts

@ -0,0 +1,67 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface CompanyProductModelVO {
/**
*
*/
id: string | number;
/**
*
*/
description: string;
/**
* id
*/
productModelTemplateId: string | number;
/**
*
*/
isTemporary: string;
}
export interface CompanyProductModelForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
*
*/
description?: string;
/**
* id
*/
productModelTemplateId?: string | number;
/**
*
*/
isTemporary?: string;
}
export interface CompanyProductModelQuery extends PageQuery {
/**
*
*/
description?: string;
/**
* id
*/
productModelTemplateId?: string | number;
/**
*
*/
isTemporary?: string;
/**
*
*/
params?: any;
}

59
src/api/zaojiaManagement/productManagement/companyProducts/index.ts

@ -0,0 +1,59 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import { CompanyProductsVO, CompanyProductsForm, CompanyProductsQuery } from './model';
/**
*
* @param params
* @returns
*/
export function companyProductsList(params?: CompanyProductsQuery) {
return defHttp.get<CompanyProductsVO[]>({
url: '/productManagement/companyProducts/list',
params,
});
}
/**
*
* @param params
* @returns
*/
export function companyProductsExport(params?: CompanyProductsQuery) {
return commonExport('/productManagement/companyProducts/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function companyProductsInfo(id: ID) {
return defHttp.get<CompanyProductsVO>({ url: '/productManagement/companyProducts/' + id });
}
/**
*
* @param data
* @returns
*/
export function companyProductsAdd(data: CompanyProductsForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/companyProducts', data });
}
/**
*
* @param data
* @returns
*/
export function companyProductsUpdate(data: CompanyProductsForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/companyProducts', data });
}
/**
*
* @param id id
* @returns
*/
export function companyProductsRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({ url: '/productManagement/companyProducts/' + id });
}

227
src/api/zaojiaManagement/productManagement/companyProducts/model.ts

@ -0,0 +1,227 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface CompanyProductsVO {
/**
* id
*/
supplierProductsId: string | number;
/**
* id
*/
supplierInformationId: string | number;
/**
*
*/
productSpecifications: string;
/**
*
*/
productName: string;
/**
*
*/
productIdentity: string | number;
/**
*
*/
productPrice: number;
/**
*
*/
sourceInformation: string;
/**
*
*/
remarks: string;
/**
*
*/
image: string;
/**
*
*/
brand: string;
/**
*
*/
unit: string;
/**
*
*/
exTaxPrice: number;
/**
*
*/
taxrate: number;
/**
* id
*/
categoryId: string | number;
/**
* id
*/
modelId: string | number;
}
export interface CompanyProductsForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
* id
*/
supplierProductsId?: string | number;
/**
* id
*/
supplierInformationId?: string | number;
/**
*
*/
productSpecifications?: string;
/**
*
*/
productName?: string;
/**
*
*/
productIdentity?: string | number;
/**
*
*/
productPrice?: number;
/**
*
*/
sourceInformation?: string;
/**
*
*/
remarks?: string;
/**
*
*/
image?: string;
/**
*
*/
brand?: string;
/**
*
*/
unit?: string;
/**
*
*/
exTaxPrice?: number;
/**
*
*/
taxrate?: number;
/**
* id
*/
categoryId?: string | number;
/**
* id
*/
modelId?: string | number;
}
export interface CompanyProductsQuery extends PageQuery {
/**
* id
*/
supplierProductsId?: string | number;
/**
* id
*/
supplierInformationId?: string | number;
/**
*
*/
productSpecifications?: string;
/**
*
*/
productName?: string;
/**
*
*/
productIdentity?: string | number;
/**
*
*/
productPrice?: number;
/**
*
*/
sourceInformation?: string;
/**
*
*/
remarks?: string;
/**
*
*/
brand?: string;
/**
*
*/
unit?: string;
/**
*
*/
exTaxPrice?: number;
/**
*
*/
taxrate?: number;
/**
*
*/
params?: any;
}

63
src/api/zaojiaManagement/productManagement/costTable/costItemDetail/index.ts

@ -0,0 +1,63 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import { CostItemDetailVO, CostItemDetailForm, CostItemDetailQuery, ProductsVO } from './model';
export function getProductsPageByType(params?: ProductsVO) {
return defHttp.get<ProductsVO[]>({
url: '/productManagement/costItemDetail/getProductsPageByType',
params,
});
}
/**
*
* @param params
* @returns
*/
export function costItemDetailList(params?: CostItemDetailQuery) {
return defHttp.get<CostItemDetailVO[]>({ url: '/productManagement/costItemDetail/list', params });
}
/**
*
* @param params
* @returns
*/
export function costItemDetailExport(params?: CostItemDetailQuery) {
return commonExport('/productManagement/costItemDetail/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function costItemDetailInfo(id: ID) {
return defHttp.get<CostItemDetailVO>({ url: '/productManagement/costItemDetail/' + id });
}
/**
*
* @param data
* @returns
*/
export function costItemDetailAdd(data: CostItemDetailForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/costItemDetail', data });
}
/**
*
* @param data
* @returns
*/
export function costItemDetailUpdate(data: CostItemDetailForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/costItemDetail', data });
}
/**
*
* @param id id
* @returns
*/
export function costItemDetailRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({ url: '/productManagement/costItemDetail/' + id });
}

225
src/api/zaojiaManagement/productManagement/costTable/costItemDetail/model.ts

@ -0,0 +1,225 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface CostItemDetailVO {
/**
*
*/
id: string | number;
/**
* id
*/
costTableId: string | number;
/**
* id
*/
parentId: string | number;
/**
*
*/
costType: string;
/**
*
*/
constructContent: string;
/**
*
*/
costName: string;
/**
*
*/
costDescribe: string;
/**
*
*/
unit: string;
/**
*
*/
quantity: number;
/**
*
*/
unitPrice: number;
/**
*
*/
totalPrice: number;
/**
*
*/
isDetail: string;
/**
*
*/
remarks: string;
/**
*
*/
orderNo: string;
}
export interface CostItemDetailForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
* id
*/
costTableId?: string | number;
/**
* id
*/
parentId?: string | number;
/**
*
*/
costType?: string;
/**
*
*/
constructContent?: string;
/**
*
*/
costName?: string;
/**
*
*/
costDescribe?: string;
/**
*
*/
unit?: string;
/**
*
*/
quantity?: number;
/**
*
*/
unitPrice?: number;
/**
*
*/
totalPrice?: number;
/**
*
*/
isDetail?: string;
/**
*
*/
remarks?: string;
/**
*
*/
orderNo?: string;
}
export interface CostItemDetailQuery extends PageQuery {
/**
*
*/
params?: any;
}
export interface ProductsVO {
/**
*
*/
id: string | number;
/**
* id
*/
supplierInformationId: string | number;
/**
*
*/
productName: string;
/**
*
*/
productIdentity: string | number;
/**
*
*/
productPrice: number;
/**
*
*/
sourceInformation: string;
/**
*
*/
productSpecifications: string;
/**
* id
*/
supplierProductsId: string | number;
/**
*
*/
remarks: string;
/**
*
*/
image: string;
/**
*
*/
brand: string;
/**
*
*/
unit: string;
/**
*
*/
exTaxPrice: number;
/**
*
*/
taxrate: number;
productType: string;
}

90
src/api/zaojiaManagement/productManagement/costTable/index.ts

@ -0,0 +1,90 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import { CostTableVO, CostTableForm, CostTableQuery, CostDetailViewVo } from './model';
/**
*
* @param data
* @returns
*/
export function addCostTable(data: CostTableForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/costTable/addCostTable', data });
}
/**
*
* @param data
* @returns
*/
export function modifyCostTable(data: CostTableForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/costTable/modifyCostTable', data });
}
/**
*
* @param params
* @returns
*/
export function costTableList(params?: CostTableQuery) {
return defHttp.get<CostTableVO[]>({ url: '/productManagement/costTable/list', params });
}
/**
*
* @param params
* @returns
*/
export function exportDataDetail(params?) {
return commonExport('/productManagement/costTable/exportData', params ?? {});
}
/**
*
* @param params
* @returns
*/
export function costTableExport(params?: CostTableQuery) {
return commonExport('/productManagement/costTable/export', params ?? {});
}
// /**
// * 查询造价编制信息详细
// * @param id id
// * @returns
// */
// export function costTableInfo(id: ID) {
// return defHttp.get<CostTableVO>({ url: '/productManagement/costTable/' + id });
// }
/**
*
* @param id id
* @returns
*/
export function costTableInfo(id: ID) {
return defHttp.get<CostDetailViewVo>({
url: '/productManagement/costTable/getCostTableDetail/' + id,
});
}
/**
*
* @param data
* @returns
*/
export function costTableAdd(data: CostTableForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/costTable', data });
}
/**
*
* @param data
* @returns
*/
export function costTableUpdate(data: CostTableForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/costTable', data });
}
/**
*
* @param id id
* @returns
*/
export function costTableRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({ url: '/productManagement/costTable/' + id });
}

70
src/api/zaojiaManagement/productManagement/costTable/model.ts

@ -0,0 +1,70 @@
import { BaseEntity, PageQuery } from '@/api/base';
import { CostItemDetailVO } from '../costItemDetail/model';
export interface CostTableVO {
/**
*
*/
id: string | number;
/**
*
*/
projectName: string;
/**
*
*/
costDate: string;
/**
*
*/
totalInvestment: number;
}
export interface CostTableForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
*
*/
projectName?: string;
/**
*
*/
costDate?: string;
/**
*
*/
totalInvestment?: number;
}
export interface CostTableQuery extends PageQuery {
/**
*
*/
projectName?: string;
/**
*
*/
costDate?: string;
/**
*
*/
totalInvestment?: number;
/**
*
*/
params?: any;
}
export interface CostDetailViewVo extends CostTableVO {
costItemDetailList?: CostItemDetailVO[];
}

87
src/api/zaojiaManagement/productManagement/personProductModel/index.ts

@ -0,0 +1,87 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import { PersonProductModelVO, PersonProductModelForm, PersonProductModelQuery } from './model';
import { PersonProductModelDetailsVO } from './personProductModelDetails/model';
/**
* id查询个人产品模型详情
* @param id
* @returns
*/
export function personProductGetModelDetails(id: ID) {
return defHttp.get<PersonProductModelDetailsVO[]>({
url: '/productManagement/personProductModel/getModelDetails/' + id,
});
}
/**
*
* @param data
* @returns
*/
export function addPersonProductModel(data: PersonProductModelForm) {
return defHttp.post<string>({ url: '/productManagement/personProductModel/addModel', data });
}
/**
*
* @param data
* @returns
*/
export function updatePersonProductModel(data: PersonProductModelForm) {
return defHttp.put<string>({ url: '/productManagement/personProductModel/editModel', data });
}
/**
*
* @param params
* @returns
*/
export function personProductModelList(params?: PersonProductModelQuery) {
return defHttp.get<PersonProductModelVO[]>({
url: '/productManagement/personProductModel/list',
params,
});
}
/**
*
* @param params
* @returns
*/
export function personProductModelExport(params?: PersonProductModelQuery) {
return commonExport('/productManagement/personProductModel/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function personProductModelInfo(id: ID) {
return defHttp.get<PersonProductModelVO>({ url: '/productManagement/personProductModel/' + id });
}
/**
*
* @param data
* @returns
*/
export function personProductModelAdd(data: PersonProductModelForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/personProductModel', data });
}
/**
*
* @param data
* @returns
*/
export function personProductModelUpdate(data: PersonProductModelForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/personProductModel', data });
}
/**
*
* @param id id
* @returns
*/
export function personProductModelRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({ url: '/productManagement/personProductModel/' + id });
}

67
src/api/zaojiaManagement/productManagement/personProductModel/model.ts

@ -0,0 +1,67 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface PersonProductModelVO {
/**
*
*/
id: string | number;
/**
*
*/
description: string;
/**
* id
*/
productModelTemplateId: string | number;
/**
*
*/
isTemporary: string;
}
export interface PersonProductModelForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
*
*/
description?: string;
/**
* id
*/
productModelTemplateId?: string | number;
/**
*
*/
isTemporary?: string;
}
export interface PersonProductModelQuery extends PageQuery {
/**
*
*/
description?: string;
/**
* id
*/
productModelTemplateId?: string | number;
/**
*
*/
isTemporary?: string;
/**
*
*/
params?: any;
}

66
src/api/zaojiaManagement/productManagement/personProductModel/personProductModelDetails/index.ts

@ -0,0 +1,66 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import {
PersonProductModelDetailsVO,
PersonProductModelDetailsForm,
PersonProductModelDetailsQuery,
} from './model';
/**
*
* @param params
* @returns
*/
export function personProductModelDetailsList(params?: PersonProductModelDetailsQuery) {
return defHttp.get<PersonProductModelDetailsVO[]>({
url: '/productManagement/personProductModelDetails/list',
params,
});
}
/**
*
* @param params
* @returns
*/
export function personProductModelDetailsExport(params?: PersonProductModelDetailsQuery) {
return commonExport('/productManagement/personProductModelDetails/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function personProductModelDetailsInfo(id: ID) {
return defHttp.get<PersonProductModelDetailsVO>({
url: '/productManagement/personProductModelDetails/' + id,
});
}
/**
*
* @param data
* @returns
*/
export function personProductModelDetailsAdd(data: PersonProductModelDetailsForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/personProductModelDetails', data });
}
/**
*
* @param data
* @returns
*/
export function personProductModelDetailsUpdate(data: PersonProductModelDetailsForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/personProductModelDetails', data });
}
/**
*
* @param id id
* @returns
*/
export function personProductModelDetailsRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({ url: '/productManagement/personProductModelDetails/' + id });
}

97
src/api/zaojiaManagement/productManagement/personProductModel/personProductModelDetails/model.ts

@ -0,0 +1,97 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface PersonProductModelDetailsVO {
/**
*
*/
id: string | number;
/**
* id
*/
modelId: string | number;
/**
*
*/
paramName: string;
/**
*
*/
parameterValue: string;
/**
*
*/
isKeyParameter: string;
/**
*
*/
isTemporary: string;
}
export interface PersonProductModelDetailsForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
* id
*/
modelId?: string | number;
/**
*
*/
paramName?: string;
/**
*
*/
parameterValue?: string;
/**
*
*/
isKeyParameter?: string;
/**
*
*/
isTemporary?: string;
}
export interface PersonProductModelDetailsQuery extends PageQuery {
/**
* id
*/
modelId?: string | number;
/**
*
*/
paramName?: string;
/**
*
*/
parameterValue?: string;
/**
*
*/
isKeyParameter?: string;
/**
*
*/
isTemporary?: string;
/**
*
*/
params?: any;
}

57
src/api/zaojiaManagement/productManagement/personProducts/index.ts

@ -0,0 +1,57 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import { PersonProductsVO, PersonProductsForm, PersonProductsQuery } from './model';
/**
*
* @param params
* @returns
*/
export function personProductsList(params?: PersonProductsQuery) {
return defHttp.get<PersonProductsVO[]>({ url: '/productManagement/personProducts/list', params });
}
/**
*
* @param params
* @returns
*/
export function personProductsExport(params?: PersonProductsQuery) {
return commonExport('/productManagement/personProducts/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function personProductsInfo(id: ID) {
return defHttp.get<PersonProductsVO>({ url: '/productManagement/personProducts/' + id });
}
/**
*
* @param data
* @returns
*/
export function personProductsAdd(data: PersonProductsForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/personProducts', data });
}
/**
*
* @param data
* @returns
*/
export function personProductsUpdate(data: PersonProductsForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/personProducts', data });
}
/**
*
* @param id id
* @returns
*/
export function personProductsRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({ url: '/productManagement/personProducts/' + id });
}

222
src/api/zaojiaManagement/productManagement/personProducts/model.ts

@ -0,0 +1,222 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface PersonProductsVO {
/**
*
*/
id: string | number;
/**
* id
*/
supplierInformationId: string | number;
/**
*
*/
productName: string;
/**
*
*/
productIdentity: string | number;
/**
*
*/
productPrice: number;
/**
*
*/
sourceInformation: string;
/**
*
*/
productSpecifications: string;
/**
* id
*/
supplierProductsId: string | number;
/**
*
*/
remarks: string;
/**
*
*/
image: string;
/**
*
*/
brand: string;
/**
*
*/
unit: string;
/**
*
*/
exTaxPrice: number;
/**
*
*/
taxrate: number;
}
export interface PersonProductsForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
* id
*/
supplierInformationId?: string | number;
/**
*
*/
productName?: string;
/**
*
*/
productIdentity?: string | number;
/**
*
*/
productPrice?: number;
/**
*
*/
sourceInformation?: string;
/**
*
*/
productSpecifications?: string;
/**
* id
*/
supplierProductsId?: string | number;
/**
*
*/
remarks?: string;
/**
*
*/
image?: string;
/**
*
*/
brand?: string;
/**
*
*/
unit?: string;
/**
*
*/
exTaxPrice?: number;
/**
*
*/
taxrate?: number;
/**
* id
*/
categoryId?: string | number;
/**
* id
*/
modelId?: string | number;
}
export interface PersonProductsQuery extends PageQuery {
/**
* id
*/
supplierInformationId?: string | number;
/**
*
*/
productName?: string;
/**
*
*/
productIdentity?: string | number;
/**
*
*/
productPrice?: number;
/**
*
*/
sourceInformation?: string;
/**
*
*/
productSpecifications?: string;
/**
* id
*/
supplierProductsId?: string | number;
/**
*
*/
remarks?: string;
/**
*
*/
brand?: string;
/**
*
*/
unit?: string;
/**
*
*/
exTaxPrice?: number;
/**
*
*/
taxrate?: number;
/**
*
*/
params?: any;
}

89
src/api/zaojiaManagement/productManagement/supplierProductModel/index.ts

@ -0,0 +1,89 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import {
SupplierProductModelVO,
SupplierProductModelForm,
SupplierProductModelQuery,
} from './model';
import { SupplierProductModelDetailsVO } from './supplierProductModelDetails/model';
export function supplierProductGetModelDetails(id: ID) {
return defHttp.get<SupplierProductModelDetailsVO[]>({
url: '/productManagement/supplierProductModel/getModelDetails/' + id,
});
}
/**
*
* @param data
* @returns
*/
export function addSupplierProductModel(data: SupplierProductModelForm) {
return defHttp.post<string>({ url: '/productManagement/supplierProductModel/addModel', data });
}
/**
*
* @param data
* @returns
*/
export function updateSupplierProductModel(data: SupplierProductModelForm) {
return defHttp.put<string>({ url: '/productManagement/supplierProductModel/editModel', data });
}
/**
*
* @param params
* @returns
*/
export function supplierProductModelList(params?: SupplierProductModelQuery) {
return defHttp.get<SupplierProductModelVO[]>({
url: '/productManagement/supplierProductModel/list',
params,
});
}
/**
*
* @param params
* @returns
*/
export function supplierProductModelExport(params?: SupplierProductModelQuery) {
return commonExport('/productManagement/supplierProductModel/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function supplierProductModelInfo(id: ID) {
return defHttp.get<SupplierProductModelVO>({
url: '/productManagement/supplierProductModel/' + id,
});
}
/**
*
* @param data
* @returns
*/
export function supplierProductModelAdd(data: SupplierProductModelForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/supplierProductModel', data });
}
/**
*
* @param data
* @returns
*/
export function supplierProductModelUpdate(data: SupplierProductModelForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/supplierProductModel', data });
}
/**
*
* @param id id
* @returns
*/
export function supplierProductModelRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({ url: '/productManagement/supplierProductModel/' + id });
}

67
src/api/zaojiaManagement/productManagement/supplierProductModel/model.ts

@ -0,0 +1,67 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface SupplierProductModelVO {
/**
*
*/
id: string | number;
/**
*
*/
description: string;
/**
* id
*/
productModelTemplateId: string | number;
/**
*
*/
isTemporary: string;
}
export interface SupplierProductModelForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
*
*/
description?: string;
/**
* id
*/
productModelTemplateId?: string | number;
/**
*
*/
isTemporary?: string;
}
export interface SupplierProductModelQuery extends PageQuery {
/**
*
*/
description?: string;
/**
* id
*/
productModelTemplateId?: string | number;
/**
*
*/
isTemporary?: string;
/**
*
*/
params?: any;
}

68
src/api/zaojiaManagement/productManagement/supplierProductModel/supplierProductModelDetails/index.ts

@ -0,0 +1,68 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import {
SupplierProductModelDetailsVO,
SupplierProductModelDetailsForm,
SupplierProductModelDetailsQuery,
} from './model';
/**
*
* @param params
* @returns
*/
export function supplierProductModelDetailsList(params?: SupplierProductModelDetailsQuery) {
return defHttp.get<SupplierProductModelDetailsVO[]>({
url: '/productManagement/supplierProductModelDetails/list',
params,
});
}
/**
*
* @param params
* @returns
*/
export function supplierProductModelDetailsExport(params?: SupplierProductModelDetailsQuery) {
return commonExport('/productManagement/supplierProductModelDetails/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function supplierProductModelDetailsInfo(id: ID) {
return defHttp.get<SupplierProductModelDetailsVO>({
url: '/productManagement/supplierProductModelDetails/' + id,
});
}
/**
*
* @param data
* @returns
*/
export function supplierProductModelDetailsAdd(data: SupplierProductModelDetailsForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/supplierProductModelDetails', data });
}
/**
*
* @param data
* @returns
*/
export function supplierProductModelDetailsUpdate(data: SupplierProductModelDetailsForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/supplierProductModelDetails', data });
}
/**
*
* @param id id
* @returns
*/
export function supplierProductModelDetailsRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({
url: '/productManagement/supplierProductModelDetails/' + id,
});
}

97
src/api/zaojiaManagement/productManagement/supplierProductModel/supplierProductModelDetails/model.ts

@ -0,0 +1,97 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface SupplierProductModelDetailsVO {
/**
*
*/
id: string | number;
/**
* id
*/
modelId: string | number;
/**
*
*/
paramName: string;
/**
*
*/
parameterValue: string;
/**
*
*/
isKeyParameter: string;
/**
*
*/
isTemporary: string;
}
export interface SupplierProductModelDetailsForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
* id
*/
modelId?: string | number;
/**
*
*/
paramName?: string;
/**
*
*/
parameterValue?: string;
/**
*
*/
isKeyParameter?: string;
/**
*
*/
isTemporary?: string;
}
export interface SupplierProductModelDetailsQuery extends PageQuery {
/**
* id
*/
modelId?: string | number;
/**
*
*/
paramName?: string;
/**
*
*/
parameterValue?: string;
/**
*
*/
isKeyParameter?: string;
/**
*
*/
isTemporary?: string;
/**
*
*/
params?: any;
}

60
src/api/zaojiaManagement/productManagement/supplierProducts/index.ts

@ -0,0 +1,60 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import { SupplierProductsVO, SupplierProductsForm, SupplierProductsQuery } from './model';
/**
*
* @param params
* @returns
*/
export function supplierProductsList(params?: SupplierProductsQuery) {
return defHttp.get<SupplierProductsVO[]>({
url: '/productManagement/supplierProducts/list',
params,
});
}
/**
*
* @param params
* @returns
*/
export function supplierProductsExport(params?: SupplierProductsQuery) {
return commonExport('/productManagement/supplierProducts/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function supplierProductsInfo(id: ID) {
return defHttp.get<SupplierProductsVO>({ url: '/productManagement/supplierProducts/' + id });
}
/**
*
* @param data
* @returns
*/
export function supplierProductsAdd(data: SupplierProductsForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/supplierProducts', data });
}
/**
*
* @param data
* @returns
*/
export function supplierProductsUpdate(data: SupplierProductsForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/supplierProducts', data });
}
/**
*
* @param id id
* @returns
*/
export function supplierProductsRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({ url: '/productManagement/supplierProducts/' + id });
}

222
src/api/zaojiaManagement/productManagement/supplierProducts/model.ts

@ -0,0 +1,222 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface SupplierProductsVO {
/**
* id
*/
supplierInformationId: string | number;
/**
*
*/
productSpecifications: string;
/**
*
*/
productName: string;
/**
*
*/
productIdentity: string | number;
/**
*
*/
productPrice: number;
/**
*
*/
sourceInformation: string;
/**
*
*/
remarks: string;
/**
*
*/
image: string;
/**
*
*/
brand: string;
/**
*
*/
unit: string;
/**
*
*/
exTaxPrice: number;
/**
*
*/
taxrate: number;
/**
* id
*/
categoryId: string | number;
/**
* id
*/
modelId: string | number;
}
export interface SupplierProductsForm extends BaseEntity {
/**
* id
*/
supplierInformationId?: string | number;
/**
*
*/
productSpecifications?: string;
/**
*
*/
productName?: string;
/**
*
*/
productIdentity?: string | number;
/**
*
*/
productPrice?: number;
/**
*
*/
sourceInformation?: string;
/**
*
*/
remarks?: string;
/**
*
*/
image?: string;
/**
*
*/
brand?: string;
/**
*
*/
unit?: string;
/**
*
*/
exTaxPrice?: number;
/**
*
*/
taxrate?: number;
/**
* id
*/
categoryId?: string | number;
/**
* id
*/
modelId?: string | number;
}
export interface SupplierProductsQuery extends PageQuery {
/**
* id
*/
supplierInformationId?: string | number;
/**
*
*/
productSpecifications?: string;
/**
*
*/
productName?: string;
/**
*
*/
productIdentity?: string | number;
/**
*
*/
productPrice?: number;
/**
*
*/
sourceInformation?: string;
/**
*
*/
remarks?: string;
/**
*
*/
image?: string;
/**
*
*/
brand?: string;
/**
*
*/
unit?: string;
/**
*
*/
exTaxPrice?: number;
/**
*
*/
taxrate?: number;
/**
* id
*/
categoryId?: string | number;
/**
* id
*/
modelId?: string | number;
/**
*
*/
params?: any;
}

62
src/api/zaojiaManagement/supplierManagement/index.ts

@ -0,0 +1,62 @@
import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import { SupplierInformationVO, SupplierInformationForm, SupplierInformationQuery } from './model';
/**
*
* @param params
* @returns
*/
export function supplierInformationList(params?: SupplierInformationQuery) {
return defHttp.get<SupplierInformationVO[]>({
url: '/productManagement/supplierInformation/list',
params,
});
}
/**
*
* @param params
* @returns
*/
export function supplierInformationExport(params?: SupplierInformationQuery) {
return commonExport('/productManagement/supplierInformation/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function supplierInformationInfo(id: ID) {
return defHttp.get<SupplierInformationVO>({
url: '/productManagement/supplierInformation/' + id,
});
}
/**
*
* @param data
* @returns
*/
export function supplierInformationAdd(data: SupplierInformationForm) {
return defHttp.postWithMsg<void>({ url: '/productManagement/supplierInformation', data });
}
/**
*
* @param data
* @returns
*/
export function supplierInformationUpdate(data: SupplierInformationForm) {
return defHttp.putWithMsg<void>({ url: '/productManagement/supplierInformation', data });
}
/**
*
* @param id id
* @returns
*/
export function supplierInformationRemove(id: ID | IDS) {
return defHttp.deleteWithMsg<void>({ url: '/productManagement/supplierInformation/' + id });
}

97
src/api/zaojiaManagement/supplierManagement/model.ts

@ -0,0 +1,97 @@
import { BaseEntity, PageQuery } from '@/api/base';
export interface SupplierInformationVO {
/**
*
*/
id: string | number;
/**
*
*/
supplierName: string;
/**
*
*/
supplierContacts: string;
/**
*
*/
position: string;
/**
*
*/
supplierContactsPhone: string;
/**
*
*/
supplierType: string;
}
export interface SupplierInformationForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
*
*/
supplierName?: string;
/**
*
*/
supplierContacts?: string;
/**
*
*/
position?: string;
/**
*
*/
supplierContactsPhone?: string;
/**
*
*/
supplierType?: string;
}
export interface SupplierInformationQuery extends PageQuery {
/**
*
*/
supplierName?: string;
/**
*
*/
supplierContacts?: string;
/**
*
*/
position?: string;
/**
*
*/
supplierContactsPhone?: string;
/**
*
*/
supplierType?: string;
/**
*
*/
params?: any;
}

234
src/components/Upload/src/components/ImageUploadBefore.vue.bak

@ -0,0 +1,234 @@
<template>
<div>
<Upload
v-bind="$attrs"
v-model:file-list="fileList"
:list-type="listType"
:accept="getStringAccept"
:multiple="multiple"
:maxCount="maxNumber"
:before-upload="beforeUpload"
:custom-request="request"
:disabled="disabled"
@preview="handlePreview"
@remove="handleRemove"
>
<div v-if="fileList && fileList.length < maxNumber">
<plus-outlined />
<div style="margin-top: 8px">{{ t('component.upload.upload') }}</div>
</div>
</Upload>
<Modal :open="previewOpen" :title="previewTitle" :footer="null" @cancel="handleCancel">
<img alt="" style="width: 100%" :src="previewImage" />
</Modal>
</div>
</template>
<script lang="ts" setup>
import { ref, toRefs, watch } from 'vue';
import { PlusOutlined } from '@ant-design/icons-vue';
import type { UploadFile, UploadProps } from 'ant-design-vue';
import { Modal, Upload } from 'ant-design-vue';
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import { useMessage } from '@/hooks/web/useMessage';
import { isArray, isFunction, isObject, isString } from '@/utils/is';
import { warn } from '@/utils/log';
import { useI18n } from '@/hooks/web/useI18n';
import { useUploadType } from '../hooks/useUpload';
import { uploadContainerProps } from '../props';
import { checkFileType } from '../helper';
import { UploadResultStatus } from '@/components/Upload/src/types/typing';
import { get, omit } from 'lodash-es';
defineOptions({ name: 'ImageUpload' });
const emit = defineEmits(['change', 'update:value', 'delete']);
const props = defineProps({
...omit(uploadContainerProps, ['previewColumns', 'beforePreviewData']),
});
const { t } = useI18n();
const { createMessage } = useMessage();
const { accept, helpText, maxNumber, maxSize } = toRefs(props);
const isInnerOperate = ref<boolean>(false);
const { getStringAccept } = useUploadType({
acceptRef: accept,
helpTextRef: helpText,
maxNumberRef: maxNumber,
maxSizeRef: maxSize,
});
const previewOpen = ref<boolean>(false);
const previewImage = ref<string>('');
const previewTitle = ref<string>('');
const fileList = ref<UploadProps['fileList']>([]);
const isLtMsg = ref<boolean>(true);
const isActMsg = ref<boolean>(true);
const isFirstRender = ref<boolean>(true);
let fileData = ref()
watch(
() => props.value,
(v) => {
if (isInnerOperate.value) {
isInnerOperate.value = false;
return;
}
let value: string[] = [];
if (v) {
if (isArray(v)) {
value = v;
} else {
value.push(v);
}
fileList.value = value.map((item, i) => {
if (item && isString(item)) {
return {
uid: -i + '',
name: item.substring(item.lastIndexOf('/') + 1),
status: 'done',
url: item,
};
} else if (item && isObject(item)) {
return item;
} else {
return;
}
}) as UploadProps['fileList'];
}
emit('update:value', value);
if (!isFirstRender.value) {
emit('change', value);
isFirstRender.value = false;
}
},
{
immediate: true,
deep: true,
},
);
function getBase64<T extends string | ArrayBuffer | null>(file: File) {
return new Promise<T>((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
resolve(reader.result as T);
};
reader.onerror = (error) => reject(error);
});
}
const handlePreview = async (file: UploadFile) => {
if (!file.url && !file.preview) {
file.preview = await getBase64<string>(file.originFileObj!);
}
previewImage.value = file.url || file.preview || '';
previewOpen.value = true;
previewTitle.value =
file.name || previewImage.value.substring(previewImage.value.lastIndexOf('/') + 1);
};
const handleRemove = async (file: UploadFile) => {
if (fileList.value) {
const index = fileList.value.findIndex((item) => item.uid === file.uid);
index !== -1 && fileList.value.splice(index, 1);
const value = getValue();
isInnerOperate.value = true;
emit('update:value', value);
emit('change', value);
emit('delete', file);
}
};
const handleCancel = () => {
previewOpen.value = false;
previewTitle.value = '';
};
const beforeUpload = (file: File) => {
const { maxSize, accept } = props;
const isAct = checkFileType(file, accept);
if (!isAct) {
createMessage.error(t('component.upload.acceptUpload', [accept]));
isActMsg.value = false;
//
setTimeout(() => (isActMsg.value = true), 1000);
}
const isLt = file.size / 1024 / 1024 > maxSize;
if (isLt) {
createMessage.error(t('component.upload.maxSizeMultiple', [maxSize]));
isLtMsg.value = false;
//
setTimeout(() => (isLtMsg.value = true), 1000);
}
return (isAct && !isLt) || Upload.LIST_IGNORE;
};
async function request(info: UploadRequestOption<any>) {
fileData.value=info
isInnerOperate.value = true;
const value = getValue();
let a= fileList.value
emit('update:value', a);
emit('change', value);
}
function submit(){
customRequest(fileData.value)
}
async function customRequest(info: UploadRequestOption<any>) {
const { api, uploadParams = {}, name, filename, resultField } = props;
if (!api || !isFunction(api)) {
return warn('upload api must exist and be a function');
}
try {
const res = await api?.({
data: {
...uploadParams,
},
file: info.file,
name: name,
filename: filename,
});
if (props.resultField) {
let result = get(res, resultField);
info.onSuccess!(result);
} else {
// resultField
info.onSuccess!(res);
}
const value = getValue();
isInnerOperate.value = true;
emit('update:value', value);
emit('change', value);
} catch (e: any) {
console.log(e);
info.onError!(e);
}
}
function getValue() {
const list = (fileList.value || [])
.filter((item) => item?.status === UploadResultStatus.DONE)
.map((item: any) => {
if (item?.response && props?.resultField) {
return item?.response;
}
//key url
return item?.url || item?.response?.url;
});
return list;
}
defineExpose({
submit
});
</script>
<style lang="less">
.ant-upload-select-picture-card i {
color: #999;
font-size: 32px;
}
.ant-upload-select-picture-card .ant-upload-text {
margin-top: 8px;
color: #666;
}
</style>

261
src/views/zaojiaManagement/costTable/CostTableModal.vue

@ -0,0 +1,261 @@
<template>
<BasicModal
v-bind="$attrs"
:title="title"
@register="registerInnerModal"
@ok="handleSubmit"
@cancel="resetForm"
width="80%"
>
<Form ref="formRef" :model="entityData" :label-col="{ span: 2 }" :rules="formRules">
<!--表单区域 -->
<FormItem label="项目名称" name="projectName">
<a-input v-model:value="entityData.projectName" />
</FormItem>
<FormItem label="总投资" name="totalInvestment">
<a-input type="number" v-model:value="entityData.totalInvestment" disabled />
</FormItem>
</Form>
<!--表格区域-->
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleAdd" v-auth="'productManagement:costItemDetail:add'"
>新增</a-button
>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
stopButtonPropagation
:actions="[
{
label: '新增子项',
icon: IconEnum.ADD,
type: 'primary',
ghost: true,
auth: 'productManagement:costItemDetail:add',
onClick: handleAddChild.bind(null, record),
},
{
label: '修改',
icon: IconEnum.EDIT,
type: 'primary',
ghost: true,
auth: 'productManagement:costItemDetail:edit',
onClick: handleEdit.bind(null, record),
},
]"
:dropDownActions="[
{
label: '删除',
icon: IconEnum.DELETE,
type: 'primary',
danger: true,
ghost: true,
auth: 'productManagement:costItemDetail:remove',
onClick: handleDelete.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
<CostItemDetailModal @register="registerModal" @reload="reload" @getFormData="getFormData" />
</BasicModal>
</template>
<script setup lang="ts">
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { computed, reactive, ref, unref } from 'vue';
import { BasicModal, useModalInner, useModal } from '@/components/Modal';
import {
costTableInfo,
modifyCostTable,
addCostTable,
} from '@/api/zaojiaManagement/productManagement/costTable';
import { IconEnum } from '@/enums/appEnum';
import { FormItem, Form } from 'ant-design-vue';
import { detailColumns } from './components/costItemDetail.data';
import { buildUUID } from '@/utils/uuid';
import CostItemDetailModal from './components/CostItemDetailModal.vue';
const emit = defineEmits(['register', 'reload']);
const currentRow = ref<Recordable>([]);
const isUpdate = ref<boolean>(false);
const formRef = ref(null);
const entityData = reactive({
id: '',
projectName: '',
totalInvestment: 0 as number,
costItemDetailList: [],
});
const title = computed<string>(() => {
return isUpdate.value ? '编辑造价编制信息' : '新增造价编制信息';
});
const [registerModal, { openModal }] = useModal();
const [registerInnerModal, { modalLoading, closeModal }] = useModalInner(
async (data: { record?: Recordable; update: boolean }) => {
modalLoading(true);
const { record, update } = data;
isUpdate.value = update;
if (update && record) {
const ret = await costTableInfo(record.id);
entityData.id = ret.id as string;
entityData.projectName = ret.projectName;
entityData.totalInvestment = ret.totalInvestment;
setTableData(ret.costItemDetailList);
removeEmptyChildren(ret.costItemDetailList);
//
// await setFieldsValue(ret);
} else {
entityData.id = buildUUID();
entityData.projectName = '';
entityData.totalInvestment = 0;
setTableData([]);
}
modalLoading(false);
},
);
const [
registerTable,
{
reload,
getDataSource,
setTableData,
deleteTableDataRecord,
updateTableDataRecord,
insertTableDataRecord,
},
] = useTable({
title: '造价编制详情',
dataSource: [],
rowKey: 'id',
showIndexColumn: false,
useSearchForm: false,
columns: detailColumns,
actionColumn: {
width: 200,
title: '操作',
key: 'action',
fixed: 'right',
},
});
const formRules = reactive({
//
projectName: [{ required: true, message: '【项目名称】不能为空', trigger: 'blur' }],
totalInvestment: [{ required: true, message: '【总投资】不能为空', trigger: 'blur' }],
});
function handleEdit(record) {
currentRow.value = record;
openModal(true, { record, update: true });
}
function handleAdd() {
openModal(true, { update: false });
currentRow.value = [];
}
async function handleDelete(record: Recordable) {
// await costItemDetailRemove([record.id]);
deleteTableDataRecord(record.id);
//id
if (record.parentId) {
let res = getDataSource();
removeEmptyChildren(res);
}
}
function handleAddChild(record: Recordable) {
currentRow.value = record;
openModal(true, { record, update: false });
}
function getFormData(formData: Recordable, isChild: boolean, isUpdate: boolean) {
if (unref(isUpdate)) {
updateTableDataRecord(currentRow.value.id, formData);
//
updatePrice();
return;
}
formData.costTableId = entityData.id;
if (!unref(isChild)) {
insertTableDataRecord(formData);
} else {
if (currentRow.value.children) {
currentRow.value.children.push(formData);
} else {
currentRow.value.children = [formData];
}
updateTableDataRecord(currentRow.value.id, currentRow);
}
//
updatePrice();
}
//,children null
function removeEmptyChildren(obj) {
if (Array.isArray(obj)) {
for (const item of obj) {
removeEmptyChildren(item);
}
} else if (typeof obj === 'object' && obj !== null) {
if (obj.children && obj.children.length === 0) {
delete obj.children;
updateTableDataRecord(obj.id, obj);
} else if (obj.children && obj.children.length > 0) {
removeEmptyChildren(obj.children);
}
}
}
function calculateSubtotal(item) {
if (item.isDetail == '1') {
return Number(item.totalPrice);
}
let subtotal = 0;
if (item.children && item.children.length > 0) {
subtotal += item.children.reduce((acc, child) => acc + calculateSubtotal(child), 0);
}
item.totalPrice = subtotal;
if (item.children && item.children.length > 0) {
for (let i = 0; i < item.children.length; i++) {
if (item.children[i].isDetail == '0') {
//
item.children[i].totalPrice = calculateSubtotal(item.children[i]);
}
}
}
return subtotal;
}
function updatePrice() {
entityData.totalInvestment = 0;
const tableData = getDataSource();
if (tableData.length > 0) {
tableData.forEach((item) => {
calculateSubtotal(item);
entityData.totalInvestment += Number(item.totalPrice);
console.log('calculateSubtotal', item, entityData);
});
}
}
async function handleSubmit() {
entityData.costItemDetailList = getDataSource();
formRef.value
.validate()
.then(async () => {
if (unref(isUpdate)) {
await modifyCostTable(entityData);
} else {
await addCostTable(entityData);
}
emit('reload');
closeModal();
})
.catch((error) => {});
}
function resetForm() {
closeModal();
}
</script>
<style></style>

76
src/views/zaojiaManagement/costTable/components/CostItemDetailModal.vue

@ -0,0 +1,76 @@
<template>
<BasicModal
v-bind="$attrs"
:title="title"
@register="registerInnerModal"
@ok="handleSubmit"
@cancel="resetForm"
>
<BasicForm @register="registerForm">
<template #costNameSlot="{ model, field }">
<CostTypeSelector v-model="model[field]" @updateCostInfo="updateCostInfo" />
</template>
</BasicForm>
</BasicModal>
</template>
<script setup lang="ts">
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { computed, ref } from 'vue';
import { modalSchemas } from './costItemDetail.data';
import { buildUUID } from '@/utils/uuid';
import CostTypeSelector from './CostTypeSelector.vue';
defineOptions({ name: 'CostItemDetailModal' });
const emit = defineEmits(['register', 'reload', 'getFormData']);
const isChild = ref<boolean>(false);
const isUpdate = ref<boolean>(false);
const title = computed<string>(() => {
return isUpdate.value ? '编辑造价编制详情' : '新增造价编制详情';
});
const [registerInnerModal, { modalLoading, closeModal }] = useModalInner(
async (data: { record?: Recordable; update: boolean }) => {
modalLoading(true);
const { record, update } = data;
isUpdate.value = update;
//
if (update && record) {
await setFieldsValue(record);
}
//
if (!update && record) {
isChild.value = true;
await setFieldsValue({ isDetail: record.isDetail, parentId: record.id });
} else {
isChild.value = false;
}
modalLoading(false);
},
);
const [registerForm, { setFieldsValue, resetForm, validate }] = useForm({
labelWidth: 100,
showActionButtonGroup: false,
baseColProps: { span: 24 },
schemas: modalSchemas,
});
async function handleSubmit() {
const data = await validate();
if (!isUpdate.value) {
data.id = buildUUID();
}
emit('getFormData', data, isChild, isUpdate);
closeModal();
}
function updateCostInfo(rowData) {
setFieldsValue({
unit: rowData.unit,
unitPrice: rowData.productPrice,
costDescribe: rowData.productSpecifications,
});
}
</script>
<style scoped></style>

151
src/views/zaojiaManagement/costTable/components/CostTypeSelector.vue

@ -0,0 +1,151 @@
<template>
<PageWrapper dense>
<a-input v-model:value="displayName" disabled style="width: 80%" />
<a-button :icon="h(EditFilled)" type="primary" @click="init" />
<a-button :icon="h(DeleteFilled)" @click="clear" />
<BasicModal
title="费用选择"
@register="registerTabelModal"
@ok="handleSubmit"
@cancel="closeTableModal"
width="80%"
>
<a-layout>
<a-layout-sider> <BasicTree :treeData="treeData" @select="clickNode" /> </a-layout-sider>
<a-layout-content
><BasicTable @register="registerTable">
<template #toolbar>
<a-button
type="primary"
@click="handleAdd"
v-auth="'productManagement:personProducts:add'"
>新增个人费用</a-button
>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'image'">
<Image v-if="record.image" :src="record.image" :height="30" />
</template>
</template> </BasicTable
></a-layout-content>
</a-layout>
</BasicModal>
<PersonProductsModal @register="registerModal" @reload="reload" />
</PageWrapper>
</template>
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable } from '@/components/Table';
import { BasicModal, useModal } from '@/components/Modal';
import { BasicTree } from '@/components/Tree';
import { getProductsPageByType } from '@/api/zaojiaManagement/productManagement/costTable/costItemDetail';
import PersonProductsModal from '@/views/zaojiaManagement/productManagement/personProducts/PersonProductsModal.vue';
import {
formSchemas,
columns,
} from '@/views/zaojiaManagement/productManagement/personProducts/personProducts.data';
import { ref, h, watch } from 'vue';
import { DeleteFilled, EditFilled } from '@ant-design/icons-vue';
import { useMessage } from '@/hooks/web/useMessage';
import { TreeItem } from '@/components/Tree';
import { Image } from 'ant-design-vue';
const { createWarningModal } = useMessage();
const emit = defineEmits(['update:modelValue', 'updateCostInfo']);
defineOptions({ name: 'SupplierSelector' });
const prop = defineProps(['modelValue']);
const [registerTabelModal, { openModal: openTableModal, closeModal: closeTableModal }] =
useModal();
const [registerTable, { reload, getSelectRows }] = useTable({
rowSelection: {
type: 'radio',
},
title: '产品信息管理列表',
api: getProductsPageByType,
showIndexColumn: false,
rowKey: 'id',
useSearchForm: true,
formConfig: {
schemas: formSchemas,
baseColProps: {
xs: 24,
sm: 24,
md: 24,
lg: 6,
},
},
columns: columns,
beforeFetch: (params) => {
params.productType = productType.value;
},
});
const [registerModal, { openModal }] = useModal();
let displayName = ref('');
let productType = ref('all');
const treeData: TreeItem[] = [
{
title: '全产品库',
key: 'all',
icon: 'home|svg',
},
{
title: '供应商产品库',
key: 'supplierProducts',
icon: 'home|svg',
},
{
title: '公司产品库',
key: 'companyProducts',
icon: 'home|svg',
},
{
title: '个人产品库',
key: 'personProducts',
icon: 'home|svg',
},
];
function handleAdd() {
openModal(true, { update: false });
}
function init() {
openTableModal();
}
function handleSubmit() {
let row = getSelectRows();
console.log(row);
if (row.length > 0) {
displayName.value = row[0].productName;
emit('update:modelValue', row[0].productName);
emit('updateCostInfo', row[0]);
closeTableModal();
} else {
createWarningModal({ title: '警告信息', content: '请选择一个费用产品' });
}
}
function clear() {
displayName.value = '';
emit('update:modelValue', '');
}
function clickNode(selectedKeys) {
console.log('selectedKeys', selectedKeys);
let nodeKey = selectedKeys[0];
productType.value = nodeKey;
reload();
}
watch(
() => prop.modelValue,
(newval) => {
if (newval) {
displayName.value = newval;
}
},
{ immediate: true },
);
</script>
<style scoped></style>

246
src/views/zaojiaManagement/costTable/components/costItemDetail.data.ts

@ -0,0 +1,246 @@
import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
// import { h } from 'vue';
// import { Input } from 'ant-design-vue';
export const formSchemas: FormSchema[] = [];
export const detailColumns: BasicColumn[] = [
// {
// title: '排序',
// dataIndex: 'orderNo',
// },
// {
// title: '父类id',
// dataIndex: 'parentId',
// ifShow:false
// },
{
title: '费用类型',
dataIndex: 'costType',
},
{
title: '建设内容',
dataIndex: 'constructContent',
},
{
title: '费用名称',
dataIndex: 'costName',
},
{
title: '费用描述',
dataIndex: 'costDescribe',
},
{
title: '单位',
dataIndex: 'unit',
},
{
title: '数量',
dataIndex: 'quantity',
},
{
title: '单价',
dataIndex: 'unitPrice',
},
{
title: '总价',
dataIndex: 'totalPrice',
},
{
title: '是否明细',
dataIndex: 'isDetail',
ifShow: false,
},
{
title: '备注',
dataIndex: 'remarks',
},
];
export const modalSchemas: FormSchema[] = [
{
label: '主键',
field: 'id',
ifShow: false,
component: 'Input',
},
{
label: '造价表id',
field: 'costTableId',
component: 'Input',
ifShow: false,
},
{
label: '父类id',
field: 'parentId',
required: false,
component: 'Input',
ifShow: false,
},
{
label: '是否明细',
field: 'isDetail',
required: true,
component: 'Switch',
componentProps: ({ formActionType }) => {
return {
checkedValue: '1',
checkedChildren: '是',
unCheckedValue: '0',
unCheckedChildren: '否',
onChange: (value) => {
const { setFieldsValue } = formActionType;
if (value == '0') {
setFieldsValue({
costName: '',
constructContent: '',
});
} else {
setFieldsValue({
costType: '',
costDescribe: '',
unit: '',
quantity: '',
unitPrice: '',
totalPrice: '',
});
}
},
};
},
defaultValue: '0',
},
{
label: '费用类型',
field: 'costType',
required: true,
component: 'Input',
ifShow: ({ values }) => {
return values.isDetail == '0';
},
},
{
label: '建设内容',
field: 'constructContent',
required: true,
component: 'InputTextArea',
ifShow: ({ values }) => {
return values.isDetail == '0';
},
},
{
label: '费用名称',
field: 'costName',
required: false,
slot: 'costNameSlot',
ifShow: ({ values }) => {
return values.isDetail == '1';
},
},
{
label: '费用描述',
field: 'costDescribe',
required: false,
component: 'InputTextArea',
ifShow: ({ values }) => {
return values.isDetail == '1';
},
},
{
label: '单位',
field: 'unit',
required: false,
component: 'Input',
ifShow: ({ values }) => {
return values.isDetail == '1';
},
},
{
label: '数量',
field: 'quantity',
required: false,
component: 'InputNumber',
componentProps: ({ formModel, formActionType }) => {
return {
min: 0,
precision: 0,
onChange: async () => {
let price = formModel.unitPrice ? formModel.unitPrice : 0;
let buyNums = formModel.quantity ? formModel.quantity : 0;
const { setFieldsValue } = formActionType;
setFieldsValue({
totalPrice: price * buyNums,
});
},
};
},
ifShow: ({ values }) => {
return values.isDetail == '1';
},
},
{
label: '单价',
field: 'unitPrice',
required: false,
component: 'InputNumber',
componentProps: ({ formModel, formActionType }) => {
return {
min: 0,
precision: 2,
onChange: async () => {
let price = formModel.unitPrice ? formModel.unitPrice : 0;
let buyNums = formModel.quantity ? formModel.quantity : 0;
const { setFieldsValue } = formActionType;
setFieldsValue({
totalPrice: price * buyNums,
});
},
};
},
ifShow: ({ values }) => {
return values.isDetail == '1';
},
},
{
label: '总价',
field: 'totalPrice',
required: false,
component: 'Input',
dynamicDisabled: true,
ifShow: ({ values }) => {
return values.isDetail == '1';
},
//渲染 values当前表单所有值
// render: ({ values }) => {
// let price = values.unitPrice ? values.unitPrice : 0;
// let buyNums = values.quantity ? values.quantity : 0;
// return String(price * buyNums);
// },
// render: ({ model, field }) => {
// //渲染自定义组件,以Input为例
// return h(Input, {
// value: model["unitPrice"]*model["quantity"],
// style: { width: '100%' },
// type: 'number',
// disabled:true,
// onchange: (e: ChangeEvent) => {
// model[field] = 123;
// },
// });
// },
},
{
label: '备注',
field: 'remarks',
required: false,
component: 'Input',
},
// {
// label: '排序',
// field: 'orderNo',
// required: false,
// component: 'Input',
// },
];

134
src/views/zaojiaManagement/costTable/costTable.data.ts

@ -0,0 +1,134 @@
import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
export const formSchemas: FormSchema[] = [
{
label: '主键',
field: 'id',
show: false,
component: 'Input',
},
{
label: '项目名称',
field: 'projectName',
component: 'Input',
},
{
label: '造价日期',
field: 'costDate',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '总投资',
field: 'totalInvestment',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
title: '主键',
dataIndex: 'id',
ifShow: false,
},
{
title: '项目名称',
dataIndex: 'projectName',
},
{
title: '造价日期',
dataIndex: 'costDate',
},
{
title: '总投资',
dataIndex: 'totalInvestment',
},
];
export const modalSchemas: FormSchema[] = [
{
label: '主键',
field: 'id',
required: true,
component: 'Input',
show: false,
},
{
label: '项目名称',
field: 'projectName',
required: true,
component: 'Input',
},
{
label: '造价日期',
field: 'costDate',
required: true,
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '总投资',
field: 'totalInvestment',
required: true,
component: 'Input',
},
];
export const detailColumns: BasicColumn[] = [
{
title: '排序',
dataIndex: 'orderNo',
},
{
title: '父类id',
dataIndex: 'parentId',
ifShow: false,
},
{
title: '费用类型',
dataIndex: 'costType',
},
{
title: '建设内容',
dataIndex: 'constructContent',
},
{
title: '费用名称',
dataIndex: 'costName',
},
{
title: '费用描述',
dataIndex: 'costDescribe',
},
{
title: '单位',
dataIndex: 'unit',
},
{
title: '数量',
dataIndex: 'quantity',
},
{
title: '单价',
dataIndex: 'unitPrice',
},
{
title: '总价',
dataIndex: 'totalPrice',
},
{
title: '是否明细',
dataIndex: 'isDetail',
},
{
title: '备注',
dataIndex: 'remarks',
},
];

161
src/views/zaojiaManagement/costTable/index.vue

@ -0,0 +1,161 @@
<template>
<PageWrapper dense>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button
@click="exportData"
v-auth="'productManagement:costTable:export'"
:disabled="!selected"
>获取文档</a-button
>
<a-button
@click="downloadExcel(costTableExport, '造价编制信息数据', getForm().getFieldsValue())"
v-auth="'productManagement:costTable:export'"
>导出</a-button
>
<a-button
type="primary"
danger
@click="multipleRemove(costTableRemove)"
:disabled="!selected"
v-auth="'productManagement:costTable:remove'"
>删除</a-button
>
<a-button type="primary" @click="handleAdd" v-auth="'productManagement:costTable:add'"
>新增</a-button
>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
stopButtonPropagation
:actions="[
{
label: '修改',
icon: IconEnum.EDIT,
type: 'primary',
ghost: true,
auth: 'productManagement:costTable:edit',
onClick: handleEdit.bind(null, record),
},
{
label: '删除',
icon: IconEnum.DELETE,
type: 'primary',
danger: true,
ghost: true,
auth: 'productManagement:costTable:remove',
popConfirm: {
placement: 'left',
title: '是否删除造价编制信息[' + record.projectName + ']?',
confirm: handleDelete.bind(null, record),
},
},
]"
/>
</template>
</template>
</BasicTable>
<CostTableModal ref="addPage" @register="registerModal" @reload="reload" />
<!-- <ModifyPage ref="modifyPage" @refresh="onLoad" />
<ViewPage ref="viewPage" /> -->
</PageWrapper>
</template>
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import {
costTableList,
costTableExport,
costTableRemove,
exportDataDetail,
} from '@/api/zaojiaManagement/productManagement/costTable';
import { downloadExcel } from '@/utils/file/download';
import { useModal } from '@/components/Modal';
import CostTableModal from './CostTableModal.vue';
import { formSchemas, columns } from './costTable.data';
import { IconEnum } from '@/enums/appEnum';
defineOptions({ name: 'CostTable' });
// import ModifyPage from './modify.vue';
// import ViewPage from './view.vue';
const [registerModal, { openModal }] = useModal();
// function rowSave(row, done, loading) {
// proxy.$refs.addPage.init();
// }
// function rowDel(row, index) {
// api.remove(row.id);
// onLoad();
// }
// function rowUpdate(row, index, done, loading) {
// proxy.$refs.modifyPage.init(row.id);
// }
// function onLoad() {
// pageInfo.pageNum = page.currentPage;
// const params = Object.assign(queryCondition.value, pageInfo, sortInfo);
// api.page(params).then((res) => {
// data.value = res.data.records;
// page.total = res.data.total;
// // res.data.total
// });
// }
// function rowDblclick(row, index) {
// proxy.$refs.viewPage.init(row.id);
// }
// function searchChange(val, done) {
// onLoad();
// done();
// }
const [registerTable, { reload, multipleRemove, selected, getForm, getSelectRows }] = useTable({
rowSelection: {
type: 'radio',
},
title: '造价编制信息列表',
api: costTableList,
showIndexColumn: false,
rowKey: 'id',
useSearchForm: true,
formConfig: {
schemas: formSchemas,
baseColProps: {
xs: 24,
sm: 24,
md: 24,
lg: 6,
},
},
columns: columns,
actionColumn: {
width: 200,
title: '操作',
key: 'action',
fixed: 'right',
},
});
function handleEdit(record: Recordable) {
openModal(true, { record, update: true });
}
function handleAdd() {
openModal(true, { update: false });
}
async function handleDelete(record: Recordable) {
await costTableRemove([record.id]);
await reload();
}
function exportData() {
if (selected) {
let rows = getSelectRows();
downloadExcel(exportDataDetail, '造价编制信息数据', { id: rows[0].id });
}
}
</script>
<style>
.el-input,
.el-input-number {
width: 100% !important;
}
</style>

95
src/views/zaojiaManagement/productManagement/companyProducts/CompanyProductsModal.vue

@ -0,0 +1,95 @@
<template>
<BasicModal
v-bind="$attrs"
:title="title"
@register="registerInnerModal"
@ok="handleSubmit"
@cancel="resetForm"
:closeFunc="closeFunc"
>
<BasicForm @register="registerForm">
<template #supplierInformationIdSlot="{ model, field }">
<SupplierSelector v-model="model[field]" />
</template>
<template #productSpecificationsSlot="{ model, field }">
<productModelSet
v-model="model[field]"
:moduleParam="moduleParam"
v-model:modelId="model['modelId']"
/>
</template>
<template #imageSlot="{ model, field }">
<ImageUpload v-model:value="model[field]" :api="uploadApi" />
</template>
</BasicForm>
</BasicModal>
</template>
<script setup lang="ts">
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { computed, ref, unref } from 'vue';
import {
companyProductsInfo,
companyProductsAdd,
companyProductsUpdate,
} from '@/api/zaojiaManagement/productManagement/companyProducts';
import { modalSchemas } from './companyProducts.data';
import SupplierSelector from '@/views/zaojiaManagement/productManagement/components/SupplierSelector.vue';
import productModelSet from '@/views/zaojiaManagement/productManagement/components/productModelSet.vue';
import { ImageUpload } from '@/components/Upload';
import { uploadApi } from '@/api/upload';
defineOptions({ name: 'CompanyProductsModal' });
const emit = defineEmits(['register', 'reload']);
const isUpdate = ref<boolean>(false);
const title = computed<string>(() => {
return isUpdate.value ? '编辑公司产品管理' : '新增公司产品管理';
});
const moduleParam = ref<Object>({ name: '个人产品管理', value: 'companyProducts' });
const [registerInnerModal, { modalLoading, closeModal }] = useModalInner(
async (data: { record?: Recordable; update: boolean }) => {
modalLoading(true);
const { record, update } = data;
isUpdate.value = update;
if (update && record) {
const ret = await companyProductsInfo(record.id);
await setFieldsValue(ret);
}
modalLoading(false);
},
);
const [registerForm, { setFieldsValue, resetForm, validate }] = useForm({
labelWidth: 100,
showActionButtonGroup: false,
baseColProps: { span: 24 },
schemas: modalSchemas,
});
async function handleSubmit() {
try {
modalLoading(true);
const data = await validate();
if (unref(isUpdate)) {
data['image'] = data['image'][0];
await companyProductsUpdate(data);
} else {
data['image'] = data['image'][0];
await companyProductsAdd(data);
}
emit('reload');
closeModal();
await resetForm();
} catch (e) {
} finally {
modalLoading(false);
}
}
async function closeFunc() {
return true;
}
</script>
<style scoped></style>

240
src/views/zaojiaManagement/productManagement/companyProducts/companyProducts.data.ts

@ -0,0 +1,240 @@
import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
export const formSchemas: FormSchema[] = [
{
label: '关联厂商产品id',
field: 'supplierProductsId',
component: 'Input',
ifShow: false,
},
{
label: '供应商',
field: 'supplierInformationId',
component: 'Input',
},
{
label: '公司产品规格',
field: 'productSpecifications',
component: 'Input',
},
{
label: '产品名称',
field: 'productName',
component: 'Input',
},
{
label: '产品标识',
field: 'productIdentity',
component: 'Input',
},
{
label: '产品价格',
field: 'productPrice',
component: 'Input',
},
{
label: '信息来源',
field: 'sourceInformation',
component: 'Input',
},
{
label: '备注',
field: 'remarks',
component: 'Input',
},
{
label: '品牌',
field: 'brand',
component: 'Input',
},
{
label: '单位',
field: 'unit',
component: 'Input',
},
{
label: '除税价',
field: 'exTaxPrice',
component: 'Input',
},
{
label: '税率',
field: 'taxrate',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
title: '主键',
dataIndex: 'id',
ifShow: false,
},
{
title: '关联厂商产品id',
dataIndex: 'supplierProductsId',
ifShow: false,
},
{
title: '供应商',
dataIndex: 'supplierInformationId',
ifShow: false,
},
{
title: '公司产品规格',
dataIndex: 'productSpecifications',
},
{
title: '产品名称',
dataIndex: 'productName',
},
{
title: '产品标识',
dataIndex: 'productIdentity',
},
{
title: '产品价格',
dataIndex: 'productPrice',
},
{
title: '信息来源',
dataIndex: 'sourceInformation',
},
{
title: '备注',
dataIndex: 'remarks',
},
{
title: '图片',
dataIndex: 'image',
},
{
title: '品牌',
dataIndex: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
},
{
title: '除税价',
dataIndex: 'exTaxPrice',
},
{
title: '税率',
dataIndex: 'taxrate',
},
{
title: '分类id',
dataIndex: 'categoryId',
ifShow: false,
},
{
title: '型号id',
dataIndex: 'modelId',
ifShow: false,
},
];
export const modalSchemas: FormSchema[] = [
{
label: '主键',
field: 'id',
required: false,
component: 'Input',
show: false,
},
{
label: '关联厂商产品id',
field: 'supplierProductsId',
required: false,
component: 'Input',
ifShow: false,
},
{
label: '供应商',
field: 'supplierInformationId',
required: false,
slot: 'supplierInformationIdSlot',
},
{
label: '公司产品规格',
field: 'productSpecifications',
required: false,
slot: 'productSpecificationsSlot',
},
{
label: '产品名称',
field: 'productName',
required: true,
component: 'Input',
},
{
label: '产品标识',
field: 'productIdentity',
required: false,
component: 'Input',
},
{
label: '产品价格',
field: 'productPrice',
required: true,
component: 'Input',
},
{
label: '信息来源',
field: 'sourceInformation',
required: false,
component: 'Input',
},
{
label: '备注',
field: 'remarks',
required: false,
component: 'Input',
},
{
label: '图片',
field: 'image',
required: false,
slot: 'imageSlot',
},
{
label: '品牌',
field: 'brand',
required: false,
component: 'Input',
},
{
label: '单位',
field: 'unit',
required: false,
component: 'Input',
},
{
label: '除税价',
field: 'exTaxPrice',
required: false,
component: 'Input',
},
{
label: '税率',
field: 'taxrate',
required: false,
component: 'Input',
},
{
label: '分类id',
field: 'categoryId',
required: false,
component: 'Input',
ifShow: false,
},
{
label: '型号id',
field: 'modelId',
required: false,
component: 'Input',
ifShow: false,
},
];

122
src/views/zaojiaManagement/productManagement/companyProducts/index.vue

@ -0,0 +1,122 @@
<template>
<PageWrapper dense>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button
@click="
downloadExcel(companyProductsExport, '公司产品管理数据', getForm().getFieldsValue())
"
v-auth="'productManagement:companyProducts:export'"
>导出</a-button
>
<a-button
type="primary"
danger
@click="multipleRemove(companyProductsRemove)"
:disabled="!selected"
v-auth="'productManagement:companyProducts:remove'"
>删除</a-button
>
<a-button type="primary" @click="handleAdd" v-auth="'productManagement:companyProducts:add'"
>新增</a-button
>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
stopButtonPropagation
:actions="[
{
label: '修改',
icon: IconEnum.EDIT,
type: 'primary',
ghost: true,
auth: 'productManagement:companyProducts:edit',
onClick: handleEdit.bind(null, record),
},
{
label: '删除',
icon: IconEnum.DELETE,
type: 'primary',
danger: true,
ghost: true,
auth: 'productManagement:companyProducts:remove',
popConfirm: {
placement: 'left',
title: '是否删除公司产品管理[' + record.id + ']?',
confirm: handleDelete.bind(null, record),
},
},
]"
/>
</template>
<template v-if="column.dataIndex === 'image'">
<Image v-if="record.image" :src="record.image" :height="30" />
</template>
</template>
</BasicTable>
<CompanyProductsModal @register="registerModal" @reload="reload" />
</PageWrapper>
</template>
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import {
companyProductsList,
companyProductsExport,
companyProductsRemove,
} from '@/api/zaojiaManagement/productManagement/companyProducts';
import { downloadExcel } from '@/utils/file/download';
import { useModal } from '@/components/Modal';
import CompanyProductsModal from './CompanyProductsModal.vue';
import { formSchemas, columns } from './companyProducts.data';
import { IconEnum } from '@/enums/appEnum';
import { Image } from 'ant-design-vue';
defineOptions({ name: 'CompanyProducts' });
const [registerTable, { reload, multipleRemove, selected, getForm }] = useTable({
rowSelection: {
type: 'checkbox',
},
title: '公司产品管理列表',
api: companyProductsList,
showIndexColumn: false,
rowKey: 'id',
useSearchForm: true,
formConfig: {
schemas: formSchemas,
baseColProps: {
xs: 24,
sm: 24,
md: 24,
lg: 6,
},
},
columns: columns,
actionColumn: {
width: 200,
title: '操作',
key: 'action',
fixed: 'right',
},
});
const [registerModal, { openModal }] = useModal();
function handleEdit(record: Recordable) {
openModal(true, { record, update: true });
}
function handleAdd() {
openModal(true, { update: false });
}
async function handleDelete(record: Recordable) {
await companyProductsRemove([record.id]);
await reload();
}
</script>
<style scoped></style>

107
src/views/zaojiaManagement/productManagement/components/SupplierSelector.vue

@ -0,0 +1,107 @@
<template>
<PageWrapper dense>
<a-input v-model:value="displayName" disabled style="width: 80%" />
<a-button :icon="h(EditFilled)" type="primary" @click="init" />
<a-button :icon="h(DeleteFilled)" @click="clear" />
<BasicModal
title="供应商选择"
@register="registerTabelModal"
@ok="handleSubmit"
@cancel="closeTableModal"
width="80%"
>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button
type="primary"
@click="handleAdd"
v-auth="'productManagement:supplierInformation:add'"
>新增</a-button
>
</template>
</BasicTable>
</BasicModal>
<SupplierInformationModal @register="registerModal" @reload="reload" />
</PageWrapper>
</template>
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable } from '@/components/Table';
import { BasicModal, useModal } from '@/components/Modal';
import {
supplierInformationList,
supplierInformationInfo,
} from '@/api/zaojiaManagement/supplierManagement';
import SupplierInformationModal from '../../supplierManagement/SupplierInformationModal.vue';
import { formSchemas, columns } from '../../supplierManagement/supplierInformation.data';
import { ref, h, watch } from 'vue';
import { DeleteFilled, EditFilled } from '@ant-design/icons-vue';
import { useMessage } from '@/hooks/web/useMessage';
const { createWarningModal } = useMessage();
const emit = defineEmits(['update:modelValue']);
defineOptions({ name: 'SupplierSelector' });
const prop = defineProps(['modelValue']);
const [registerTabelModal, { openModal: openTableModal, closeModal: closeTableModal }] =
useModal();
const [registerTable, { reload, getSelectRows }] = useTable({
rowSelection: {
type: 'radio',
},
title: '供应商信息管理列表',
api: supplierInformationList,
showIndexColumn: false,
rowKey: 'id',
useSearchForm: true,
formConfig: {
schemas: formSchemas,
baseColProps: {
xs: 24,
sm: 24,
md: 24,
lg: 6,
},
},
columns: columns,
});
const [registerModal, { openModal }] = useModal();
let displayName = ref('');
function handleAdd() {
openModal(true, { update: false });
}
function init() {
openTableModal();
}
function handleSubmit() {
let row = getSelectRows();
console.log(row);
if (row.length > 0) {
displayName.value = row[0].supplierName;
emit('update:modelValue', row[0].id);
closeTableModal();
} else {
createWarningModal({ title: '警告信息', content: '请选择一个供应商' });
}
}
function clear() {
displayName.value = '';
emit('update:modelValue', '');
}
watch(
() => prop.modelValue,
(newVal) => {
if (newVal) {
supplierInformationInfo(newVal).then((res) => {
displayName.value = res.supplierName as string;
});
}
},
{ immediate: true },
);
</script>
<style scoped></style>

64
src/views/zaojiaManagement/productManagement/components/components.data.ts

@ -0,0 +1,64 @@
import { FormSchema } from '@/components/Form';
import { BasicColumn } from '@/components/Table';
export const productModelSetSchemas: FormSchema[] = [
{
label: 'id',
field: 'id',
show: false,
component: 'Input',
},
{
label: '型号模板',
field: 'productModelTemplateId',
required: false,
slot: 'productModelTemplateIdSlot',
},
{
label: '产品描述',
field: 'description',
required: false,
component: 'InputTextArea',
dynamicDisabled: true,
componentProps: {
rows: 3,
},
},
{
label: '产品规格',
field: 'modelDeatils',
required: false,
slot: 'modelDeatilsSlot',
},
];
export const modelTemplateSetColumns: BasicColumn[] = [
{
title: '主键',
dataIndex: 'id',
ifShow: false,
},
{
title: '指标名称',
dataIndex: 'paramName',
edit: true, //是否开启单元格编辑
editable: true, //是否处于编辑状态
},
{
title: '指标参数',
dataIndex: 'parameterValue',
edit: true, //是否开启单元格编辑
editable: true, //是否处于编辑状态
},
{
title: '是否关键指标',
dataIndex: 'isKeyParameter',
edit: true, //是否开启单元格编辑
editable: true, //是否处于编辑状态
editComponent: 'Switch',
editComponentProps: {
checkedValue: '1',
unCheckedValue: '0',
unCheckedChildren: '否',
checkedChildren: '是',
},
},
];

100
src/views/zaojiaManagement/productManagement/components/modelTemplateSet.vue

@ -0,0 +1,100 @@
<template>
<PageWrapper dense>
<BasicTable @register="registerTable" @edit-change="handleEditChange">
<template #toolbar>
<a-button type="primary" @click="handleAdd" v-auth="'system:supplierInformation:add'"
>新增</a-button
>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
stopButtonPropagation
:actions="[
{
label: '删除',
icon: IconEnum.DELETE,
type: 'primary',
danger: true,
ghost: true,
auth: 'productManagement:personProducts:remove',
onClick: handleDelete.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
</PageWrapper>
</template>
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable, TableAction, EditRecordRow } from '@/components/Table';
import { IconEnum } from '@/enums/appEnum';
import { modelTemplateSetColumns } from './components.data';
const emit = defineEmits(['update:modelValue', 'getDescription']);
defineOptions({ name: 'SupplierSelector' });
const prop = defineProps(['modelValue']);
const [
registerTable,
{ getDataSource, insertTableDataRecord, deleteTableDataRecord, setTableData },
] = useTable({
title: '模型规格列表',
dataSource: [{ paramName: '', parameterValue: '', isKeyParameter: '1' }],
showIndexColumn: false,
useSearchForm: false,
// formConfig: {
// schemas: modelTemplateSetColumns,
// baseColProps: {
// xs: 24,
// sm: 24,
// md: 24,
// lg: 6,
// },
// },
columns: modelTemplateSetColumns,
actionColumn: {
width: 200,
title: '操作',
key: 'action',
fixed: 'right',
},
});
function handleAdd() {
insertTableDataRecord({ isKeyParameter: '0' });
}
function handleDelete(record) {
console.log('handleDelete', record);
deleteTableDataRecord(record.key);
let res = getDescriptionDetail();
emit('getDescription', res);
}
function handleEditChange(record: EditRecordRow) {
let res = getDescriptionDetail();
emit('getDescription', res);
}
function getDescriptionDetail() {
let tabListData = getDataSource();
console.log('handleEditEnd', tabListData);
let description = '';
for (let i = 0; i < tabListData.length; i++) {
let rowData = tabListData[i];
if (rowData.paramName) {
description =
// this.formData.description + rowData.paramName + ':' + rowData.parameterIndex + ';\n'
description + rowData.paramName + ':' + rowData.parameterValue + ';';
}
}
return description;
}
defineExpose({
setTableData,
getDataSource,
});
</script>
<style scoped></style>

140
src/views/zaojiaManagement/productManagement/components/productModelSet.vue

@ -0,0 +1,140 @@
<template>
<PageWrapper dense>
<a-textarea rows="4" v-model:value="displayName" disabled style="width: 100%" />
<a-button :icon="h(EditFilled)" type="primary" @click="init" />
<a-button :icon="h(DeleteFilled)" @click="clear" />
<BasicModal
title="产品规格设置"
@register="registerTabelModal"
@ok="handleSubmit"
@cancel="closeTableModal"
width="80%"
>
<BasicForm @register="registerForm">
<template #modelDeatilsSlot="{ model, field }">
<modelTemplateSet
ref="modelTemplateSetRef"
v-model="model[field]"
@getDescription="getDescription"
/>
</template>
<!-- <template #productSpecificationsSlot="{ model, field }">
<productModelSet v-model="model[field]" />
</template> -->
</BasicForm>
</BasicModal>
</PageWrapper>
</template>
<script setup lang="ts">
defineOptions({ name: 'SupplierSelector' });
import { PageWrapper } from '@/components/Page';
import { BasicForm, useForm } from '@/components/Form';
import { BasicModal, useModal } from '@/components/Modal';
import { productModelSetSchemas } from './components.data';
import { ref, h, watch, nextTick, reactive } from 'vue';
import { DeleteFilled, EditFilled } from '@ant-design/icons-vue';
import { useMessage } from '@/hooks/web/useMessage';
import modelTemplateSet from './modelTemplateSet.vue';
import {
personProductModelInfo,
personProductGetModelDetails,
updatePersonProductModel,
addPersonProductModel,
} from '@/api/zaojiaManagement/productManagement/personProductModel';
import {
supplierProductModelInfo,
supplierProductGetModelDetails,
updateSupplierProductModel,
addSupplierProductModel,
} from '@/api/zaojiaManagement/productManagement/supplierProductModel';
import {
companyProductModelInfo,
companyProductGetModelDetails,
updateCompanyProductModel,
addCompanyProductModel,
} from '@/api/zaojiaManagement/productManagement/companyProductModel';
const prop = defineProps(['modelValue', 'moduleParam', 'modelId']);
const emit = defineEmits(['update:modelValue', 'update:modelId']);
const modelTemplateSetRef = ref(null);
const [registerTabelModal, { openModal: openTableModal, closeModal: closeTableModal }] =
useModal();
const [registerForm, { setFieldsValue, getFieldsValue }] = useForm({
labelWidth: 100,
showActionButtonGroup: false,
baseColProps: { span: 24 },
schemas: productModelSetSchemas,
});
let modelInfo = reactive<any>({});
let addModel = reactive<any>(addPersonProductModel);
let updateModel = reactive<any>(updatePersonProductModel);
let getModelInfo = reactive<any>(personProductModelInfo);
let getModelDetails = reactive<any>(personProductGetModelDetails);
if (prop.moduleParam.value == 'personProducts') {
addModel = addPersonProductModel;
updateModel = updatePersonProductModel;
getModelInfo = personProductModelInfo;
getModelDetails = personProductGetModelDetails;
} else if (prop.moduleParam.value == 'supplierProducts') {
addModel = addSupplierProductModel;
updateModel = updateSupplierProductModel;
getModelInfo = supplierProductModelInfo;
getModelDetails = supplierProductGetModelDetails;
} else {
addModel = addCompanyProductModel;
updateModel = updateCompanyProductModel;
getModelInfo = companyProductModelInfo;
getModelDetails = companyProductGetModelDetails;
}
let displayName = ref('');
async function init() {
let res = await getModelDetails(prop.modelId);
openTableModal();
nextTick(() => {
if (res.length != 0 && res) {
modelTemplateSetRef.value.setTableData(res);
setFieldsValue({ id: modelInfo.id });
setFieldsValue({ productModelTemplateId: modelInfo.productModelTemplateId });
setFieldsValue({ description: modelInfo.description });
}
});
}
async function handleSubmit() {
//modelValue
let id = '';
let res = await getFieldsValue();
res['modelDeatils'] = modelTemplateSetRef.value.getDataSource();
if (!prop.modelId) {
id = await addModel(res);
} else {
id = await updateModel(res);
}
emit('update:modelId', id);
emit('update:modelValue', displayName.value);
closeTableModal();
}
function clear() {
displayName.value = '';
emit('update:modelId', null);
emit('update:modelValue', null);
}
function getDescription(description: string) {
displayName.value = description;
setFieldsValue({ description: description });
}
watch(
() => prop.modelId,
async (newVal) => {
modelInfo = await getModelInfo(newVal);
if (modelInfo) {
displayName.value = modelInfo.description;
}
},
{ immediate: true },
);
</script>
<style scoped></style>

214
src/views/zaojiaManagement/productManagement/components/uploadImage.vue.bak

@ -0,0 +1,214 @@
<template>
<div>
<Upload
v-bind="$attrs"
v-model:file-list="fileList"
list-type="picture"
accept=".png, .jpg"
:maxCount="1"
:before-upload="beforeUpload"
:custom-request="customRequest"
@preview="handlePreview"
@remove="handleRemove"
>
<div v-if="fileList && fileList.length < maxNumber">
<plus-outlined />
<div style="margin-top: 8px">{{ t('component.upload.upload') }}</div>
</div>
</Upload>
<Modal :open="previewOpen" :title="previewTitle" :footer="null" @cancel="handleCancel">
<img alt="" style="width: 100%" :src="previewImage" />
</Modal>
</div>
</template>
<script lang="ts" setup>
import { ref, toRefs, watch } from 'vue';
import { PlusOutlined } from '@ant-design/icons-vue';
import type { UploadFile, UploadProps } from 'ant-design-vue';
import { Modal, Upload } from 'ant-design-vue';
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import { useMessage } from '@/hooks/web/useMessage';
import { isArray, isFunction, isObject, isString } from '@/utils/is';
import { warn } from '@/utils/log';
import { useI18n } from '@/hooks/web/useI18n';
import { useUploadType } from '../hooks/useUpload';
import { uploadContainerProps } from '../props';
import { checkFileType } from '../helper';
import { UploadResultStatus } from '@/components/Upload/src/types/typing';
import { get, omit } from 'lodash-es';
defineOptions({ name: 'ImageUpload' });
const emit = defineEmits(['change', 'update:value', 'delete']);
const props = defineProps({
...omit(uploadContainerProps, ['previewColumns', 'beforePreviewData']),
});
const { t } = useI18n();
const { createMessage } = useMessage();
const { accept, helpText, maxNumber, maxSize } = toRefs(props);
const isInnerOperate = ref<boolean>(false);
const previewOpen = ref<boolean>(false);
const previewImage = ref<string>('');
const previewTitle = ref<string>('');
const fileList = ref<UploadProps['fileList']>([]);
const isLtMsg = ref<boolean>(true);
const isActMsg = ref<boolean>(true);
const isFirstRender = ref<boolean>(true);
watch(
() => props.value,
(v) => {
if (isInnerOperate.value) {
isInnerOperate.value = false;
return;
}
let value: string[] = [];
if (v) {
if (isArray(v)) {
value = v;
} else {
value.push(v);
}
fileList.value = value.map((item, i) => {
if (item && isString(item)) {
return {
uid: -i + '',
name: item.substring(item.lastIndexOf('/') + 1),
status: 'done',
url: item,
};
} else if (item && isObject(item)) {
return item;
} else {
return;
}
}) as UploadProps['fileList'];
}
emit('update:value', value);
if (!isFirstRender.value) {
emit('change', value);
isFirstRender.value = false;
}
},
{
immediate: true,
deep: true,
},
);
function getBase64<T extends string | ArrayBuffer | null>(file: File) {
return new Promise<T>((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
resolve(reader.result as T);
};
reader.onerror = (error) => reject(error);
});
}
const handlePreview = async (file: UploadFile) => {
if (!file.url && !file.preview) {
file.preview = await getBase64<string>(file.originFileObj!);
}
previewImage.value = file.url || file.preview || '';
previewOpen.value = true;
previewTitle.value =
file.name || previewImage.value.substring(previewImage.value.lastIndexOf('/') + 1);
};
const handleRemove = async (file: UploadFile) => {
if (fileList.value) {
const index = fileList.value.findIndex((item) => item.uid === file.uid);
index !== -1 && fileList.value.splice(index, 1);
const value = getValue();
isInnerOperate.value = true;
emit('update:value', value);
emit('change', value);
emit('delete', file);
}
};
const handleCancel = () => {
previewOpen.value = false;
previewTitle.value = '';
};
const beforeUpload = (file: File) => {
const { maxSize, accept } = props;
const isAct = checkFileType(file, accept);
if (!isAct) {
createMessage.error(t('component.upload.acceptUpload', [accept]));
isActMsg.value = false;
//
setTimeout(() => (isActMsg.value = true), 1000);
}
const isLt = file.size / 1024 / 1024 > maxSize;
if (isLt) {
createMessage.error(t('component.upload.maxSizeMultiple', [maxSize]));
isLtMsg.value = false;
//
setTimeout(() => (isLtMsg.value = true), 1000);
}
return (isAct && !isLt) || Upload.LIST_IGNORE;
};
async function customRequest(info: UploadRequestOption<any>) {
const { api, uploadParams = {}, name, filename, resultField } = props;
if (!api || !isFunction(api)) {
return warn('upload api must exist and be a function');
}
try {
const res = await api?.({
data: {
...uploadParams,
},
file: info.file,
name: name,
filename: filename,
});
if (props.resultField) {
let result = get(res, resultField);
info.onSuccess!(result);
} else {
// resultField
info.onSuccess!(res);
}
const value = getValue();
isInnerOperate.value = true;
emit('update:value', value);
emit('change', value);
} catch (e: any) {
console.log(e);
info.onError!(e);
}
}
function getValue() {
const list = (fileList.value || [])
.filter((item) => item?.status === UploadResultStatus.DONE)
.map((item: any) => {
if (item?.response && props?.resultField) {
return item?.response;
}
//key url
return item?.url || item?.response?.url;
});
return list;
}
</script>
<style lang="less">
.ant-upload-select-picture-card i {
color: #999;
font-size: 32px;
}
.ant-upload-select-picture-card .ant-upload-text {
margin-top: 8px;
color: #666;
}
</style>

106
src/views/zaojiaManagement/productManagement/components/uploadImage1.vue.bak

@ -0,0 +1,106 @@
<template>
<el-upload
v-model:file-list="fileList"
class="upload-demo"
action
:on-preview="handlePreview"
:on-remove="handleRemove"
list-type="picture-card"
:limit="1"
:http-request="ImgUploadSectionFile"
:before-upload="beforeAvatarUpload"
:on-change="handleEditChange"
:on-exceed="handleExceed"
accept=".png, .jpg"
>
<!-- <el-button type="primary">上传图片</el-button> -->
<template #tip>
<div class="el-upload__tip">支持 jpg/png 最大尺寸为10Mb</div>
</template>
</el-upload>
<el-dialog v-model="dialogVisible">
<img w-full :src="dialogImageUrl" alt="Preview Image" />
</el-dialog>
</template>
<script lang="ts" setup>
import { ref,defineEmits,defineProps} from 'vue'
import { ElMessage } from 'element-plus'
import type { UploadProps, UploadUserFile } from 'element-plus'
const propsData= defineProps(["modelValue","moduleParam"])
const emits= defineEmits(['update:modelValue'])
const fileList = ref<UploadUserFile[]>([])
let dialogVisible = ref(false)
let dialogImageUrl = ref()
if(propsData.modelValue){
fileList.value.push({url:propsData.modelValue,name:propsData.modelValue.split('/')[propsData.modelValue.split('/').length-1]})
console.log(fileList.value)
}
// const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
// console.log(uploadFile, uploadFiles)
// }
const handlePreview: UploadProps['onPreview'] = (file) => {
console.log(file)
dialogImageUrl.value = file.url
dialogVisible.value = true
}
//
function handleRemove(file, fileList) {
if (fileList.length === 0) {
fileList = []
} else {
let dl = fileList.indexOf(file)
fileList.splice(dl, 1)
}
console.log('remove', file, fileList)
// hideUploadEdit = fileList.length >= limitNum
}
// on-change
function handleEditChange(file, fileList) {
console.log('file:', file, fileList)
// hideUploadEdit = fileList.length >= limitNum
// console.log("this.fileList:", this.fileList);
// console.log("this.hideUploadEdit:", this.hideUploadEdit);
}
// http-request
function ImgUploadSectionFile(param) {
console.log('param', param)
emits("update:modelValue",param.file)
}
// before-upload
// false Promise reject
function beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'
const isLt2M = file.size / 1024 / 1024 < 10
if (!isJPG) {
ElMessage.error('上传图片只能是 JPG 或 PNG 格式!')
}
if (!isLt2M) {
ElMessage.error('上传图片大小不能超过 10MB!')
}
return isJPG && isLt2M
}
function handleExceed() {
ElMessage.warning('最多只能上传一个文件')
}
</script>
<!-- :limit="limitNum" //
:class="{hide:hideUploadEdit}" //
:on-remove="handleRemove" //
:on-change="handleEditChange" //()
:http-request="ImgUploadSectionFile" //
:before-upload="beforeAvatarUpload" //
:with-credentials="true" // cookie
:auto-upload="true" //(false)
accept=".png, .jpg" //
action="" //url
list-type="picture-card" //
:file-list="fileList" //
-->

100
src/views/zaojiaManagement/productManagement/personProducts/PersonProductsModal.vue

@ -0,0 +1,100 @@
<template>
<BasicModal
v-bind="$attrs"
:title="title"
@register="registerInnerModal"
@ok="handleSubmit"
@cancel="resetForm"
:closeFunc="closeFunc"
>
<BasicForm @register="registerForm">
<template #supplierInformationIdSlot="{ model, field }">
<SupplierSelector v-model="model[field]" />
</template>
<template #productSpecificationsSlot="{ model, field }">
<productModelSet
v-model="model[field]"
:moduleParam="moduleParam"
v-model:modelId="model['modelId']"
/>
</template>
<template #imageSlot="{ model, field }">
<ImageUpload v-model:value="model[field]" :api="uploadApi" />
</template>
</BasicForm>
</BasicModal>
</template>
<script setup lang="ts">
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { computed, ref, unref } from 'vue';
import {
personProductsInfo,
personProductsAdd,
personProductsUpdate,
} from '@/api/zaojiaManagement/productManagement/personProducts';
import { modalSchemas } from './personProducts.data';
import SupplierSelector from '@/views/zaojiaManagement/productManagement/components/SupplierSelector.vue';
import productModelSet from '@/views/zaojiaManagement/productManagement/components/productModelSet.vue';
import { uploadApi } from '@/api/upload';
import { ImageUpload } from '@/components/Upload';
defineOptions({ name: 'PersonProductsModal' });
const emit = defineEmits(['register', 'reload']);
const isUpdate = ref<boolean>(false);
const title = computed<string>(() => {
return isUpdate.value ? '编辑个人产品管理' : '新增个人产品管理';
});
const moduleParam = ref<Object>({ name: '个人产品管理', value: 'personProducts' });
const [registerInnerModal, { modalLoading, closeModal }] = useModalInner(
async (data: { record?: Recordable; update: boolean }) => {
modalLoading(true);
const { record, update } = data;
isUpdate.value = update;
if (update && record) {
const ret = await personProductsInfo(record.id);
await setFieldsValue(ret);
}
modalLoading(false);
},
);
const [registerForm, { setFieldsValue, resetForm, validate }] = useForm({
labelWidth: 100,
showActionButtonGroup: false,
baseColProps: { span: 24 },
schemas: modalSchemas,
});
async function handleSubmit() {
try {
modalLoading(true);
console.log();
const data = await validate();
if (unref(isUpdate)) {
if (data['image'] && data['image'].length > 0) {
data['image'] = data['image'][0];
}
await personProductsUpdate(data);
} else {
if (data['image'] && data['image'].length > 0) {
data['image'] = data['image'][0];
}
await personProductsAdd(data);
}
emit('reload');
closeModal();
await resetForm();
} catch (e) {
} finally {
modalLoading(false);
}
}
async function closeFunc() {
return true;
}
</script>
<style scoped></style>

122
src/views/zaojiaManagement/productManagement/personProducts/index.vue

@ -0,0 +1,122 @@
<template>
<PageWrapper dense>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button
@click="
downloadExcel(personProductsExport, '个人产品管理数据', getForm().getFieldsValue())
"
v-auth="'productManagement:personProducts:export'"
>导出</a-button
>
<a-button
type="primary"
danger
@click="multipleRemove(personProductsRemove)"
:disabled="!selected"
v-auth="'productManagement:personProducts:remove'"
>删除</a-button
>
<a-button type="primary" @click="handleAdd" v-auth="'productManagement:personProducts:add'"
>新增</a-button
>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
stopButtonPropagation
:actions="[
{
label: '修改',
icon: IconEnum.EDIT,
type: 'primary',
ghost: true,
auth: 'productManagement:personProducts:edit',
onClick: handleEdit.bind(null, record),
},
{
label: '删除',
icon: IconEnum.DELETE,
type: 'primary',
danger: true,
ghost: true,
auth: 'productManagement:personProducts:remove',
popConfirm: {
placement: 'left',
title: '是否删除个人产品管理[' + record.id + ']?',
confirm: handleDelete.bind(null, record),
},
},
]"
/>
</template>
<template v-if="column.dataIndex === 'image'">
<Image v-if="record.image" :src="record.image" :height="30" />
</template>
</template>
</BasicTable>
<PersonProductsModal @register="registerModal" @reload="reload" />
</PageWrapper>
</template>
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import {
personProductsList,
personProductsExport,
personProductsRemove,
} from '@/api/zaojiaManagement/productManagement/personProducts';
import { downloadExcel } from '@/utils/file/download';
import { useModal } from '@/components/Modal';
import PersonProductsModal from './PersonProductsModal.vue';
import { formSchemas, columns } from './personProducts.data';
import { IconEnum } from '@/enums/appEnum';
import { Image } from 'ant-design-vue';
defineOptions({ name: 'PersonProducts' });
const [registerTable, { reload, multipleRemove, selected, getForm }] = useTable({
rowSelection: {
type: 'checkbox',
},
title: '个人产品管理列表',
api: personProductsList,
showIndexColumn: false,
rowKey: 'id',
useSearchForm: true,
formConfig: {
schemas: formSchemas,
baseColProps: {
xs: 24,
sm: 24,
md: 24,
lg: 6,
},
},
columns: columns,
actionColumn: {
width: 200,
title: '操作',
key: 'action',
fixed: 'right',
},
});
const [registerModal, { openModal }] = useModal();
function handleEdit(record: Recordable) {
openModal(true, { record, update: true });
}
function handleAdd() {
openModal(true, { update: false });
}
async function handleDelete(record: Recordable) {
await personProductsRemove([record.id]);
await reload();
}
</script>
<style scoped></style>

229
src/views/zaojiaManagement/productManagement/personProducts/personProducts.data.ts

@ -0,0 +1,229 @@
import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
export const formSchemas: FormSchema[] = [
{
label: '供应商',
field: 'supplierInformationId',
component: 'Input',
},
{
label: '产品名称',
field: 'productName',
component: 'Input',
},
{
label: '产品型号',
field: 'productIdentity',
component: 'Input',
},
{
label: '产品价格',
field: 'productPrice',
component: 'Input',
},
{
label: '信息来源',
field: 'sourceInformation',
component: 'Input',
},
{
label: '个人产品规格',
field: 'productSpecifications',
component: 'Input',
},
{
label: '关联厂商产品id',
field: 'supplierProductsId',
component: 'Input',
},
{
label: '备注',
field: 'remarks',
component: 'Input',
},
{
label: '品牌',
field: 'brand',
component: 'Input',
},
{
label: '单位',
field: 'unit',
component: 'Input',
},
{
label: '除税价',
field: 'exTaxPrice',
component: 'Input',
},
{
label: '税率',
field: 'taxrate',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
title: '主键',
dataIndex: 'id',
ifShow: false,
},
{
title: '供应商',
dataIndex: 'supplierInformationId',
ifShow: false,
},
{
title: '产品名称',
dataIndex: 'productName',
},
{
title: '产品型号',
dataIndex: 'productIdentity',
},
{
title: '个人产品规格',
dataIndex: 'productSpecifications',
},
{
title: '产品价格',
dataIndex: 'productPrice',
},
{
title: '信息来源',
dataIndex: 'sourceInformation',
},
{
title: '关联厂商产品id',
dataIndex: 'supplierProductsId',
},
{
title: '备注',
dataIndex: 'remarks',
},
{
title: '图片',
dataIndex: 'image',
},
{
title: '品牌',
dataIndex: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
},
{
title: '除税价',
dataIndex: 'exTaxPrice',
},
{
title: '税率',
dataIndex: 'taxrate',
},
];
export const modalSchemas: FormSchema[] = [
{
label: '主键',
field: 'id',
required: false,
component: 'Input',
show: false,
},
{
label: '供应商',
field: 'supplierInformationId',
required: false,
slot: 'supplierInformationIdSlot',
},
{
label: '产品名称',
field: 'productName',
required: true,
component: 'Input',
},
{
label: '产品型号',
field: 'productIdentity',
required: false,
component: 'Input',
},
{
label: '个人产品规格',
field: 'productSpecifications',
required: false,
slot: 'productSpecificationsSlot',
},
{
label: '产品价格',
field: 'productPrice',
required: true,
component: 'Input',
},
{
label: '信息来源',
field: 'sourceInformation',
required: false,
component: 'Input',
},
{
label: '关联厂商产品id',
field: 'supplierProductsId',
required: false,
component: 'Input',
ifShow: false,
},
{
label: '备注',
field: 'remarks',
required: false,
component: 'Input',
},
{
label: '图片',
field: 'image',
required: false,
slot: 'imageSlot',
},
{
label: '品牌',
field: 'brand',
required: false,
component: 'Input',
},
{
label: '单位',
field: 'unit',
required: false,
component: 'Input',
},
{
label: '除税价',
field: 'exTaxPrice',
required: false,
component: 'Input',
},
{
label: '税率',
field: 'taxrate',
required: false,
component: 'Input',
},
{
label: '分类id',
field: 'categoryId',
required: false,
component: 'Input',
ifShow: false,
},
{
label: '型号id',
field: 'modelId',
required: true,
component: 'Input',
ifShow: false,
},
];

95
src/views/zaojiaManagement/productManagement/supplierProducts/SupplierProductsModal.vue

@ -0,0 +1,95 @@
<template>
<BasicModal
v-bind="$attrs"
:title="title"
@register="registerInnerModal"
@ok="handleSubmit"
@cancel="resetForm"
:closeFunc="closeFunc"
>
<BasicForm @register="registerForm">
<template #supplierInformationIdSlot="{ model, field }">
<SupplierSelector v-model="model[field]" />
</template>
<template #productSpecificationsSlot="{ model, field }">
<productModelSet
v-model="model[field]"
:moduleParam="moduleParam"
v-model:modelId="model['modelId']"
/>
</template>
<template #imageSlot="{ model, field }">
<ImageUpload v-model:value="model[field]" :api="uploadApi" />
</template>
</BasicForm>
</BasicModal>
</template>
<script setup lang="ts">
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { computed, ref, unref } from 'vue';
import {
supplierProductsInfo,
supplierProductsAdd,
supplierProductsUpdate,
} from '@/api/zaojiaManagement/productManagement/supplierProducts';
import { modalSchemas } from './supplierProducts.data';
import SupplierSelector from '@/views/zaojiaManagement/productManagement/components/SupplierSelector.vue';
import productModelSet from '@/views/zaojiaManagement/productManagement/components/productModelSet.vue';
import { uploadApi } from '@/api/upload';
import { ImageUpload } from '@/components/Upload';
defineOptions({ name: 'SupplierProductsModal' });
const emit = defineEmits(['register', 'reload']);
const isUpdate = ref<boolean>(false);
const title = computed<string>(() => {
return isUpdate.value ? '编辑供应商产品管理' : '新增供应商产品管理';
});
const moduleParam = ref<Object>({ name: '个人产品管理', value: 'supplierProducts' });
const [registerInnerModal, { modalLoading, closeModal }] = useModalInner(
async (data: { record?: Recordable; update: boolean }) => {
modalLoading(true);
const { record, update } = data;
isUpdate.value = update;
if (update && record) {
const ret = await supplierProductsInfo(record.id);
await setFieldsValue(ret);
}
modalLoading(false);
},
);
const [registerForm, { setFieldsValue, resetForm, validate }] = useForm({
labelWidth: 100,
showActionButtonGroup: false,
baseColProps: { span: 24 },
schemas: modalSchemas,
});
async function handleSubmit() {
try {
modalLoading(true);
const data = await validate();
if (unref(isUpdate)) {
data['image'] = data['image'][0];
await supplierProductsUpdate(data);
} else {
data['image'] = data['image'][0];
await supplierProductsAdd(data);
}
emit('reload');
closeModal();
await resetForm();
} catch (e) {
} finally {
modalLoading(false);
}
}
async function closeFunc() {
return true;
}
</script>
<style scoped></style>

122
src/views/zaojiaManagement/productManagement/supplierProducts/index.vue

@ -0,0 +1,122 @@
<template>
<PageWrapper dense>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button
@click="
downloadExcel(supplierProductsExport, '供应商产品管理数据', getForm().getFieldsValue())
"
v-auth="'supplierProducts:supplierProducts:export'"
>导出</a-button
>
<a-button
type="primary"
danger
@click="multipleRemove(supplierProductsRemove)"
:disabled="!selected"
v-auth="'supplierProducts:supplierProducts:remove'"
>删除</a-button
>
<a-button type="primary" @click="handleAdd" v-auth="'supplierProducts:supplierProducts:add'"
>新增</a-button
>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
stopButtonPropagation
:actions="[
{
label: '修改',
icon: IconEnum.EDIT,
type: 'primary',
ghost: true,
auth: 'supplierProducts:supplierProducts:edit',
onClick: handleEdit.bind(null, record),
},
{
label: '删除',
icon: IconEnum.DELETE,
type: 'primary',
danger: true,
ghost: true,
auth: 'supplierProducts:supplierProducts:remove',
popConfirm: {
placement: 'left',
title: '是否删除供应商产品管理[' + record.id + ']?',
confirm: handleDelete.bind(null, record),
},
},
]"
/>
</template>
<template v-if="column.dataIndex === 'image'">
<Image v-if="record.image" :src="record.image" :height="30" />
</template>
</template>
</BasicTable>
<SupplierProductsModal @register="registerModal" @reload="reload" />
</PageWrapper>
</template>
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import {
supplierProductsList,
supplierProductsExport,
supplierProductsRemove,
} from '@/api/zaojiaManagement/productManagement/supplierProducts';
import { downloadExcel } from '@/utils/file/download';
import { useModal } from '@/components/Modal';
import SupplierProductsModal from './SupplierProductsModal.vue';
import { formSchemas, columns } from './supplierProducts.data';
import { IconEnum } from '@/enums/appEnum';
import { Image } from 'ant-design-vue';
defineOptions({ name: 'SupplierProducts' });
const [registerTable, { reload, multipleRemove, selected, getForm }] = useTable({
rowSelection: {
type: 'checkbox',
},
title: '供应商产品管理列表',
api: supplierProductsList,
showIndexColumn: false,
rowKey: 'id',
useSearchForm: true,
formConfig: {
schemas: formSchemas,
baseColProps: {
xs: 24,
sm: 24,
md: 24,
lg: 6,
},
},
columns: columns,
actionColumn: {
width: 200,
title: '操作',
key: 'action',
fixed: 'right',
},
});
const [registerModal, { openModal }] = useModal();
function handleEdit(record: Recordable) {
openModal(true, { record, update: true });
}
function handleAdd() {
openModal(true, { update: false });
}
async function handleDelete(record: Recordable) {
await supplierProductsRemove([record.id]);
await reload();
}
</script>
<style scoped></style>

225
src/views/zaojiaManagement/productManagement/supplierProducts/supplierProducts.data.ts

@ -0,0 +1,225 @@
import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
export const formSchemas: FormSchema[] = [
{
label: '供应商',
field: 'supplierInformationId',
component: 'Input',
},
{
label: '供应商产品规格',
field: 'productSpecifications',
component: 'Input',
},
{
label: '产品名称',
field: 'productName',
component: 'Input',
},
{
label: '产品标识',
field: 'productIdentity',
component: 'Input',
},
{
label: '产品价格',
field: 'productPrice',
component: 'Input',
},
{
label: '信息来源',
field: 'sourceInformation',
component: 'Input',
},
{
label: '备注',
field: 'remarks',
component: 'Input',
},
{
label: '品牌',
field: 'brand',
component: 'Input',
},
{
label: '单位',
field: 'unit',
component: 'Input',
},
{
label: '除税价',
field: 'exTaxPrice',
component: 'Input',
},
{
label: '税率',
field: 'taxrate',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
title: '主键',
dataIndex: 'id',
ifShow: false,
},
{
title: '供应商',
dataIndex: 'supplierInformationId',
ifShow: false,
},
{
title: '供应商产品规格',
dataIndex: 'productSpecifications',
// ellipsis:false,
// width:300,
// customRender
},
{
title: '产品名称',
dataIndex: 'productName',
// ellipsis:false
},
{
title: '产品标识',
dataIndex: 'productIdentity',
},
{
title: '产品价格',
dataIndex: 'productPrice',
},
{
title: '信息来源',
dataIndex: 'sourceInformation',
},
{
title: '备注',
dataIndex: 'remarks',
},
{
title: '图片',
dataIndex: 'image',
},
{
title: '品牌',
dataIndex: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
},
{
title: '除税价',
dataIndex: 'exTaxPrice',
},
{
title: '税率',
dataIndex: 'taxrate',
},
{
title: '分类id',
dataIndex: 'categoryId',
ifShow: false,
},
{
title: '型号id',
dataIndex: 'modelId',
ifShow: false,
},
];
export const modalSchemas: FormSchema[] = [
{
label: '主键',
field: 'id',
required: false,
component: 'Input',
show: false,
},
{
label: '供应商',
field: 'supplierInformationId',
required: true,
slot: 'supplierInformationIdSlot',
},
{
label: '供应商产品规格',
field: 'productSpecifications',
required: true,
slot: 'productSpecificationsSlot',
},
{
label: '产品名称',
field: 'productName',
required: true,
component: 'Input',
},
{
label: '产品标识',
field: 'productIdentity',
required: false,
component: 'Input',
},
{
label: '产品价格',
field: 'productPrice',
required: true,
component: 'Input',
},
{
label: '信息来源',
field: 'sourceInformation',
required: false,
component: 'Input',
},
{
label: '备注',
field: 'remarks',
required: false,
component: 'Input',
},
{
label: '图片',
field: 'image',
required: false,
slot: 'imageSlot',
},
{
label: '品牌',
field: 'brand',
required: false,
component: 'Input',
},
{
label: '单位',
field: 'unit',
required: true,
component: 'Input',
},
{
label: '除税价',
field: 'exTaxPrice',
required: false,
component: 'Input',
},
{
label: '税率',
field: 'taxrate',
required: false,
component: 'Input',
},
{
label: '分类id',
field: 'categoryId',
required: false,
component: 'Input',
},
{
label: '型号id',
field: 'modelId',
required: false,
component: 'Input',
ifShow: false,
},
];

72
src/views/zaojiaManagement/supplierManagement/SupplierInformationModal.vue

@ -0,0 +1,72 @@
<template>
<BasicModal
v-bind="$attrs"
:title="title"
@register="registerInnerModal"
@ok="handleSubmit"
@cancel="resetForm"
>
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script setup lang="ts">
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { computed, ref, unref } from 'vue';
import {
supplierInformationInfo,
supplierInformationAdd,
supplierInformationUpdate,
} from '@/api/zaojiaManagement/supplierManagement';
import { modalSchemas } from './supplierInformation.data';
defineOptions({ name: 'SupplierInformationModal' });
const emit = defineEmits(['register', 'reload']);
const isUpdate = ref<boolean>(false);
const title = computed<string>(() => {
return isUpdate.value ? '编辑供应商信息管理' : '新增供应商信息管理';
});
const [registerInnerModal, { modalLoading, closeModal }] = useModalInner(
async (data: { record?: Recordable; update: boolean }) => {
modalLoading(true);
const { record, update } = data;
isUpdate.value = update;
if (update && record) {
const ret = await supplierInformationInfo(record.id);
await setFieldsValue(ret);
}
modalLoading(false);
},
);
const [registerForm, { setFieldsValue, resetForm, validate }] = useForm({
labelWidth: 100,
showActionButtonGroup: false,
baseColProps: { span: 24 },
schemas: modalSchemas,
});
async function handleSubmit() {
try {
modalLoading(true);
const data = await validate();
if (unref(isUpdate)) {
await supplierInformationUpdate(data);
} else {
await supplierInformationAdd(data);
}
emit('reload');
closeModal();
await resetForm();
} catch (e) {
} finally {
modalLoading(false);
}
}
</script>
<style scoped></style>

125
src/views/zaojiaManagement/supplierManagement/index.vue

@ -0,0 +1,125 @@
<template>
<PageWrapper dense>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button
@click="
downloadExcel(
supplierInformationExport,
'供应商信息管理数据',
getForm().getFieldsValue(),
)
"
v-auth="'productManagement:supplierInformation:export'"
>导出</a-button
>
<a-button
type="primary"
danger
@click="multipleRemove(supplierInformationRemove)"
:disabled="!selected"
v-auth="'productManagement:supplierInformation:remove'"
>删除</a-button
>
<a-button
type="primary"
@click="handleAdd"
v-auth="'productManagement:supplierInformation:add'"
>新增</a-button
>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
stopButtonPropagation
:actions="[
{
label: '修改',
icon: IconEnum.EDIT,
type: 'primary',
ghost: true,
auth: 'productManagement:supplierInformation:edit',
onClick: handleEdit.bind(null, record),
},
{
label: '删除',
icon: IconEnum.DELETE,
type: 'primary',
danger: true,
ghost: true,
auth: 'productManagement:supplierInformation:remove',
popConfirm: {
placement: 'left',
title: '是否删除供应商信息管理[' + record.id + ']?',
confirm: handleDelete.bind(null, record),
},
},
]"
/>
</template>
</template>
</BasicTable>
<SupplierInformationModal @register="registerModal" @reload="reload" />
</PageWrapper>
</template>
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import {
supplierInformationList,
supplierInformationExport,
supplierInformationRemove,
} from '@/api/zaojiaManagement/supplierManagement';
import { downloadExcel } from '@/utils/file/download';
import { useModal } from '@/components/Modal';
import SupplierInformationModal from './SupplierInformationModal.vue';
import { formSchemas, columns } from './supplierInformation.data';
import { IconEnum } from '@/enums/appEnum';
defineOptions({ name: 'SupplierInformation' });
const [registerTable, { reload, multipleRemove, selected, getForm }] = useTable({
rowSelection: {
type: 'checkbox',
},
title: '供应商信息管理列表',
api: supplierInformationList,
showIndexColumn: false,
rowKey: 'id',
useSearchForm: true,
formConfig: {
schemas: formSchemas,
baseColProps: {
xs: 24,
sm: 24,
md: 24,
lg: 6,
},
},
columns: columns,
actionColumn: {
width: 200,
title: '操作',
key: 'action',
fixed: 'right',
},
});
const [registerModal, { openModal }] = useModal();
function handleEdit(record: Recordable) {
openModal(true, { record, update: true });
}
function handleAdd() {
openModal(true, { update: false });
}
async function handleDelete(record: Recordable) {
await supplierInformationRemove([record.id]);
await reload();
}
</script>
<style scoped></style>

107
src/views/zaojiaManagement/supplierManagement/supplierInformation.data.ts

@ -0,0 +1,107 @@
import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
import { getDictOptions } from '@/utils/dict';
import { useRender } from '@/hooks/component/useRender';
export const formSchemas: FormSchema[] = [
{
label: '供应商名称',
field: 'supplierName',
component: 'Input',
},
{
label: '供应商联系人',
field: 'supplierContacts',
component: 'Input',
},
{
label: '职位',
field: 'position',
component: 'Input',
},
{
label: '供应商联系电话',
field: 'supplierContactsPhone',
component: 'Input',
},
{
label: '供应商类型',
field: 'supplierType',
component: 'Select',
componentProps: {
options: getDictOptions('supplier_type'),
},
},
];
const { renderDict } = useRender();
export const columns: BasicColumn[] = [
{
title: '主键',
dataIndex: 'id',
ifShow: false,
},
{
title: '供应商名称',
dataIndex: 'supplierName',
},
{
title: '供应商联系人',
dataIndex: 'supplierContacts',
},
{
title: '职位',
dataIndex: 'position',
},
{
title: '供应商联系电话',
dataIndex: 'supplierContactsPhone',
},
{
title: '供应商类型',
dataIndex: 'supplierType',
customRender: ({ value }) => renderDict(value, 'supplier_type'),
},
];
export const modalSchemas: FormSchema[] = [
{
label: '主键',
field: 'id',
// required: true,
component: 'Input',
show: false,
},
{
label: '供应商名称',
field: 'supplierName',
required: true,
component: 'Input',
},
{
label: '供应商联系人',
field: 'supplierContacts',
required: true,
component: 'Input',
},
{
label: '职位',
field: 'position',
required: false,
component: 'Input',
},
{
label: '供应商电话',
field: 'supplierContactsPhone',
required: true,
component: 'Input',
},
{
label: '供应商类型',
field: 'supplierType',
required: false,
component: 'Select',
componentProps: {
options: getDictOptions('supplier_type'),
},
},
];
Loading…
Cancel
Save