根据选择项目跟新材料管理
This commit is contained in:
63
src/api/materials/company/index.ts
Normal file
63
src/api/materials/company/index.ts
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import { AxiosPromise } from 'axios';
|
||||||
|
import { CompanyVO, CompanyForm, CompanyQuery } from '@/api/materials/company/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公司列表
|
||||||
|
* @param query
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const listCompany = (query?: CompanyQuery): AxiosPromise<CompanyVO[]> => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/company/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公司详细
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const getCompany = (id: string | number): AxiosPromise<CompanyVO> => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/company/' + id,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增公司
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const addCompany = (data: CompanyForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/company',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改公司
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const updateCompany = (data: CompanyForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/company',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除公司
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const delCompany = (id: string | number | Array<string | number>) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/company/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
};
|
96
src/api/materials/company/types.ts
Normal file
96
src/api/materials/company/types.ts
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
export interface CompanyVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司名称
|
||||||
|
*/
|
||||||
|
companyName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
projectId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 帐号状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
status: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资质情况
|
||||||
|
*/
|
||||||
|
qualification: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CompanyForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司名称
|
||||||
|
*/
|
||||||
|
companyName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
projectId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 帐号状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
status?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资质情况
|
||||||
|
*/
|
||||||
|
qualification?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CompanyQuery extends PageQuery {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司名称
|
||||||
|
*/
|
||||||
|
companyName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
projectId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 帐号状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
status?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资质情况
|
||||||
|
*/
|
||||||
|
qualification?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
63
src/api/materials/materials/index.ts
Normal file
63
src/api/materials/materials/index.ts
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import { AxiosPromise } from 'axios';
|
||||||
|
import { MaterialsVO, MaterialsForm, MaterialsQuery } from '@/api/materials/materials/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询材料名称列表
|
||||||
|
* @param query
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const listMaterials = (query?: MaterialsQuery): AxiosPromise<MaterialsVO[]> => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materials/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询材料名称详细
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const getMaterials = (id: string | number): AxiosPromise<MaterialsVO> => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materials/' + id,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增材料名称
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const addMaterials = (data: MaterialsForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materials',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改材料名称
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const updateMaterials = (data: MaterialsForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materials',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除材料名称
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const delMaterials = (id: string | number | Array<string | number>) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materials/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
};
|
291
src/api/materials/materials/types.ts
Normal file
291
src/api/materials/materials/types.ts
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
export interface MaterialsVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料名称
|
||||||
|
*/
|
||||||
|
materialsName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司id
|
||||||
|
*/
|
||||||
|
companyId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
projectId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格型号名称
|
||||||
|
*/
|
||||||
|
typeSpecificationName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格型号文件路径
|
||||||
|
*/
|
||||||
|
typeSpecificationUrl: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合格证编号名称
|
||||||
|
*/
|
||||||
|
certificateConformityName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合格证编号文件路径
|
||||||
|
*/
|
||||||
|
certificateConformityUrl: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量说明书编号
|
||||||
|
*/
|
||||||
|
qualityName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量说明书文件路径
|
||||||
|
*/
|
||||||
|
qualityUrl: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验报告编号
|
||||||
|
*/
|
||||||
|
inspectionReportName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验报告文件路径
|
||||||
|
*/
|
||||||
|
inspectionReportUrl: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复试报告编号
|
||||||
|
*/
|
||||||
|
reexamineReportName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复试报告文件路径
|
||||||
|
*/
|
||||||
|
reexamineReportUrl: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用部位
|
||||||
|
*/
|
||||||
|
usePart: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计量单位
|
||||||
|
*/
|
||||||
|
weightId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预计材料数量
|
||||||
|
*/
|
||||||
|
quantityCount: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
status: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MaterialsForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料名称
|
||||||
|
*/
|
||||||
|
materialsName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司id
|
||||||
|
*/
|
||||||
|
companyId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
projectId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格型号名称
|
||||||
|
*/
|
||||||
|
typeSpecificationName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格型号文件路径
|
||||||
|
*/
|
||||||
|
typeSpecificationUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合格证编号名称
|
||||||
|
*/
|
||||||
|
certificateConformityName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合格证编号文件路径
|
||||||
|
*/
|
||||||
|
certificateConformityUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量说明书编号
|
||||||
|
*/
|
||||||
|
qualityName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量说明书文件路径
|
||||||
|
*/
|
||||||
|
qualityUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验报告编号
|
||||||
|
*/
|
||||||
|
inspectionReportName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验报告文件路径
|
||||||
|
*/
|
||||||
|
inspectionReportUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复试报告编号
|
||||||
|
*/
|
||||||
|
reexamineReportName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复试报告文件路径
|
||||||
|
*/
|
||||||
|
reexamineReportUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用部位
|
||||||
|
*/
|
||||||
|
usePart?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计量单位
|
||||||
|
*/
|
||||||
|
weightId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预计材料数量
|
||||||
|
*/
|
||||||
|
quantityCount?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
status?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MaterialsQuery extends PageQuery {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料名称
|
||||||
|
*/
|
||||||
|
materialsName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司id
|
||||||
|
*/
|
||||||
|
companyId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
projectId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格型号名称
|
||||||
|
*/
|
||||||
|
typeSpecificationName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格型号文件路径
|
||||||
|
*/
|
||||||
|
typeSpecificationUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合格证编号名称
|
||||||
|
*/
|
||||||
|
certificateConformityName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合格证编号文件路径
|
||||||
|
*/
|
||||||
|
certificateConformityUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量说明书编号
|
||||||
|
*/
|
||||||
|
qualityName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 质量说明书文件路径
|
||||||
|
*/
|
||||||
|
qualityUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验报告编号
|
||||||
|
*/
|
||||||
|
inspectionReportName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检验报告文件路径
|
||||||
|
*/
|
||||||
|
inspectionReportUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复试报告编号
|
||||||
|
*/
|
||||||
|
reexamineReportName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复试报告文件路径
|
||||||
|
*/
|
||||||
|
reexamineReportUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用部位
|
||||||
|
*/
|
||||||
|
usePart?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计量单位
|
||||||
|
*/
|
||||||
|
weightId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预计材料数量
|
||||||
|
*/
|
||||||
|
quantityCount?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
status?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
63
src/api/materials/materialsInventory/index.ts
Normal file
63
src/api/materials/materialsInventory/index.ts
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import { AxiosPromise } from 'axios';
|
||||||
|
import { MaterialsInventoryVO, MaterialsInventoryForm, MaterialsInventoryQuery } from '@/api/materials/materialsInventory/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询材料出/入库列表
|
||||||
|
* @param query
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const listMaterialsInventory = (query?: MaterialsInventoryQuery): AxiosPromise<MaterialsInventoryVO[]> => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsInventory/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询材料出/入库详细
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const getMaterialsInventory = (id: string | number): AxiosPromise<MaterialsInventoryVO> => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsInventory/' + id,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增材料出/入库
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const addMaterialsInventory = (data: MaterialsInventoryForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsInventory',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改材料出/入库
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export const updateMaterialsInventory = (data: MaterialsInventoryForm) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsInventory',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除材料出/入库
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
export const delMaterialsInventory = (id: string | number | Array<string | number>) => {
|
||||||
|
return request({
|
||||||
|
url: '/materials/materialsInventory/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
};
|
201
src/api/materials/materialsInventory/types.ts
Normal file
201
src/api/materials/materialsInventory/types.ts
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
export interface MaterialsInventoryVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料id
|
||||||
|
*/
|
||||||
|
materialsId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
projectId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入库状态
|
||||||
|
*/
|
||||||
|
outPut: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出/入库的数量
|
||||||
|
*/
|
||||||
|
number: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出/入库操作时间
|
||||||
|
*/
|
||||||
|
outPutTime: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余库存数量(记录最后一次操作留下的库存数)
|
||||||
|
*/
|
||||||
|
residue: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人(入库人、领料人)
|
||||||
|
*/
|
||||||
|
operator: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料出入证明
|
||||||
|
*/
|
||||||
|
path: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理方式
|
||||||
|
*/
|
||||||
|
disposition: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交接单位(班组)
|
||||||
|
*/
|
||||||
|
recipient: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用人
|
||||||
|
*/
|
||||||
|
shipper: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MaterialsInventoryForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料id
|
||||||
|
*/
|
||||||
|
materialsId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
projectId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入库状态
|
||||||
|
*/
|
||||||
|
outPut?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出/入库的数量
|
||||||
|
*/
|
||||||
|
number?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出/入库操作时间
|
||||||
|
*/
|
||||||
|
outPutTime?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余库存数量(记录最后一次操作留下的库存数)
|
||||||
|
*/
|
||||||
|
residue?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人(入库人、领料人)
|
||||||
|
*/
|
||||||
|
operator?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料出入证明
|
||||||
|
*/
|
||||||
|
path?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理方式
|
||||||
|
*/
|
||||||
|
disposition?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交接单位(班组)
|
||||||
|
*/
|
||||||
|
recipient?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用人
|
||||||
|
*/
|
||||||
|
shipper?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MaterialsInventoryQuery extends PageQuery {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料id
|
||||||
|
*/
|
||||||
|
materialsId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
projectId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出入库状态
|
||||||
|
*/
|
||||||
|
outPut?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出/入库的数量
|
||||||
|
*/
|
||||||
|
number?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出/入库操作时间
|
||||||
|
*/
|
||||||
|
outPutTime?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余库存数量(记录最后一次操作留下的库存数)
|
||||||
|
*/
|
||||||
|
residue?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人(入库人、领料人)
|
||||||
|
*/
|
||||||
|
operator?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料出入证明
|
||||||
|
*/
|
||||||
|
path?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理方式
|
||||||
|
*/
|
||||||
|
disposition?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交接单位(班组)
|
||||||
|
*/
|
||||||
|
recipient?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用人
|
||||||
|
*/
|
||||||
|
shipper?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,21 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="select-container">
|
<div class="select-container">
|
||||||
<label for="projectSelect" class="select-label">项目列表:</label>
|
<label for="projectSelect" class="select-label">项目列表:</label>
|
||||||
<el-select
|
<el-select
|
||||||
id="projectSelect"
|
id="projectSelect"
|
||||||
v-model="selectedProjectId"
|
v-model="selectedProjectId"
|
||||||
placeholder="选择工程"
|
placeholder="全部工程项目"
|
||||||
clearable
|
clearable
|
||||||
filterable
|
filterable
|
||||||
@change="handleSelect"
|
@change="handleSelect"
|
||||||
style="width: 120px;margin-right: 20px;"
|
style="width: 150px; margin-right: 20px"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option v-for="project in projects" :key="project.id" :label="project.name" :value="project.id" />
|
||||||
v-for="project in projects"
|
|
||||||
:key="project.id"
|
|
||||||
:label="project.name"
|
|
||||||
:value="project.id"
|
|
||||||
/>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -25,16 +20,24 @@ import { ref, computed, watch } from 'vue';
|
|||||||
import { useUserStore } from '@/store/modules/user';
|
import { useUserStore } from '@/store/modules/user';
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const projects = computed(() => userStore.projects);
|
const projects = computed(() => [
|
||||||
|
{ id: '', name: '全部工程项目' }, // 添加空选项
|
||||||
|
...userStore.projects
|
||||||
|
]);
|
||||||
|
|
||||||
const selectedProjectId = ref(userStore.selectedProject?.id || '');
|
const selectedProjectId = ref(userStore.selectedProject?.id || '');
|
||||||
|
|
||||||
// 监听 userStore.selectedProject 变化,更新 selectedProjectId
|
// 监听 userStore.selectedProject 变化,更新 selectedProjectId
|
||||||
watch(() => userStore.selectedProject, (newProject) => {
|
watch(
|
||||||
selectedProjectId.value = newProject?.id || '';
|
() => userStore.selectedProject,
|
||||||
}, { deep: true });
|
(newProject) => {
|
||||||
|
selectedProjectId.value = newProject?.id ?? ''; // 避免 undefined 导致 placeholder 显示
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
const handleSelect = (projectId: string) => {
|
const handleSelect = (projectId: string) => {
|
||||||
const selectedProject = projects.value.find(p => p.id === projectId);
|
const selectedProject = projects.value.find((p) => p.id === projectId);
|
||||||
if (selectedProject) {
|
if (selectedProject) {
|
||||||
userStore.setSelectedProject(selectedProject);
|
userStore.setSelectedProject(selectedProject);
|
||||||
}
|
}
|
||||||
@ -100,4 +103,4 @@ const handleSelect = (projectId: string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -91,7 +91,7 @@ export const constantRoutes: RouteRecordRaw[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/test',
|
path: '/test',
|
||||||
component: () => import('@/views/personnelManagement/project/projectRelevancy/component/ShuttleFrame.vue'),
|
component: () => import('@/views/materials/materials/index.vue'),
|
||||||
hidden: true
|
hidden: true
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -6,6 +6,16 @@ import defAva from '@/assets/images/profile.jpg';
|
|||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
|
// 添加两个函数用于操作localStorage
|
||||||
|
const saveSelectedProjectToStorage = (project) => {
|
||||||
|
localStorage.setItem('selectedProject', JSON.stringify(project));
|
||||||
|
};
|
||||||
|
|
||||||
|
const getSelectedProjectFromStorage = () => {
|
||||||
|
const stored = localStorage.getItem('selectedProject');
|
||||||
|
return stored ? JSON.parse(stored) : null;
|
||||||
|
};
|
||||||
|
|
||||||
export const useUserStore = defineStore('user', () => {
|
export const useUserStore = defineStore('user', () => {
|
||||||
const token = ref(getToken());
|
const token = ref(getToken());
|
||||||
const name = ref('');
|
const name = ref('');
|
||||||
@ -17,7 +27,9 @@ export const useUserStore = defineStore('user', () => {
|
|||||||
const permissions = ref<Array<string>>([]); // 用户权限编码集合 → 判断按钮权限
|
const permissions = ref<Array<string>>([]); // 用户权限编码集合 → 判断按钮权限
|
||||||
|
|
||||||
const projects = ref<Array<{ id: string; name: string }>>([]);
|
const projects = ref<Array<{ id: string; name: string }>>([]);
|
||||||
const selectedProject = ref<{ id: string; name: string } | null>(projects.value[0]); // 默认选中第一个
|
// 从localStorage获取缓存的项目,如果没有则默认为null
|
||||||
|
const selectedProject = ref<{ id: string; name: string } | null>(getSelectedProjectFromStorage());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
* @param userInfo
|
* @param userInfo
|
||||||
@ -54,30 +66,31 @@ export const useUserStore = defineStore('user', () => {
|
|||||||
userId.value = user.userId;
|
userId.value = user.userId;
|
||||||
tenantId.value = user.tenantId;
|
tenantId.value = user.tenantId;
|
||||||
|
|
||||||
|
|
||||||
// **新增项目数据获取**
|
// **新增项目数据获取**
|
||||||
const [projectErr, projectRes] = await to(getUserProject());
|
const [projectErr, projectRes] = await to(getUserProject());
|
||||||
if (projectRes?.data) {
|
if (projectRes?.data) {
|
||||||
const projectList = projectRes.data.map(p => ({
|
const projectList = projectRes.data.map((p) => ({
|
||||||
id: p.projectId,
|
id: p.projectId,
|
||||||
name: p.projectName || '未知项目'
|
name: p.projectName || '未知项目'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
setProjects(projectList);
|
setProjects(projectList);
|
||||||
|
|
||||||
if (projectList.length > 0) {
|
// 如果有缓存的选中项目,且该项目在当前项目列表中存在,则使用缓存的项目
|
||||||
|
const storedProject = getSelectedProjectFromStorage();
|
||||||
|
if (storedProject && projectList.some((p) => p.id === storedProject.id)) {
|
||||||
|
setSelectedProject(storedProject);
|
||||||
|
} else if (projectList.length > 0) {
|
||||||
|
// 否则默认选择第一个项目
|
||||||
setSelectedProject(projectList[0]);
|
setSelectedProject(projectList[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 注销
|
// 注销
|
||||||
const logout = async (): Promise<void> => {
|
const logout = async (): Promise<void> => {
|
||||||
await logoutApi();
|
await logoutApi();
|
||||||
@ -85,6 +98,8 @@ export const useUserStore = defineStore('user', () => {
|
|||||||
roles.value = [];
|
roles.value = [];
|
||||||
permissions.value = [];
|
permissions.value = [];
|
||||||
removeToken();
|
removeToken();
|
||||||
|
// 清除项目缓存
|
||||||
|
localStorage.removeItem('selectedProject');
|
||||||
};
|
};
|
||||||
|
|
||||||
const setAvatar = (value: string) => {
|
const setAvatar = (value: string) => {
|
||||||
@ -97,11 +112,14 @@ export const useUserStore = defineStore('user', () => {
|
|||||||
|
|
||||||
const setSelectedProject = (project: { id: string; name: string }) => {
|
const setSelectedProject = (project: { id: string; name: string }) => {
|
||||||
selectedProject.value = project;
|
selectedProject.value = project;
|
||||||
|
// 将选中的项目保存到localStorage
|
||||||
|
saveSelectedProjectToStorage(project);
|
||||||
|
|
||||||
// ** 切换项目后,需要清空当前项目下的所有缓存数据 **
|
// ** 切换项目后,需要清空当前项目下的所有缓存数据 **
|
||||||
// 清空 pinia 缓存
|
// 清空 pinia 缓存
|
||||||
// store.$reset();
|
// store.$reset();
|
||||||
// console.log("选择的新项目名称:" + selectedProject.value.name)
|
// console.log("选择的新项目名称:" + selectedProject.value.name)
|
||||||
// console.log("选择的新项目id:" + selectedProject.value.id)
|
// console.log("选择的新项目id:" + selectedProject.value.id)
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
292
src/views/materials/company/index.vue
Normal file
292
src/views/materials/company/index.vue
Normal file
@ -0,0 +1,292 @@
|
|||||||
|
<template>
|
||||||
|
<div class="p-2">
|
||||||
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
||||||
|
:leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
|
<el-form-item label="公司名称" prop="companyName">
|
||||||
|
<el-input v-model="queryParams.companyName" placeholder="请输入公司名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目id" prop="projectId">
|
||||||
|
<el-input v-model="queryParams.projectId" placeholder="请输入项目id" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="资质情况" prop="qualification">
|
||||||
|
<el-input v-model="queryParams.qualification" placeholder="请输入资质情况" clearable
|
||||||
|
@keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
|
||||||
|
<el-card shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||||
|
v-hasPermi="['materials:company:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()"
|
||||||
|
v-hasPermi="['materials:company:edit']">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()"
|
||||||
|
v-hasPermi="['materials:company:remove']">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
|
v-hasPermi="['materials:company:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="materialsInventoryList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<!-- <el-table-column label="主键id" align="center" prop="id" v-if="true" /> -->
|
||||||
|
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||||
|
<el-table-column label="项目名称" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ getProjectName(scope.row.projectId) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="公司名称" align="center" prop="companyName" />
|
||||||
|
<el-table-column label="公司状态" align="center" prop="status">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span :style="{
|
||||||
|
color: row.status === 0 ? 'green' : 'red',
|
||||||
|
backgroundColor: row.status === 0 ? '#E6F9E6' : '#FDE2E2',
|
||||||
|
padding: '5px 10px',
|
||||||
|
borderRadius: '5px',
|
||||||
|
display: 'inline-block'
|
||||||
|
}">
|
||||||
|
{{ row.status === 0 ? '正常' : '不正常' }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="资质情况" align="center" prop="qualification" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip content="修改" placement="top">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['materials:company:edit']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip content="删除" placement="top">
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['materials:company:remove']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
</el-card>
|
||||||
|
<!-- 添加或修改公司对话框 -->
|
||||||
|
|
||||||
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||||
|
<el-form ref="companyFormRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="公司名称" prop="companyName">
|
||||||
|
<el-input v-model="form.companyName" placeholder="请输入公司名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目id" prop="projectId">
|
||||||
|
<el-input v-model="form.projectId" placeholder="请输入项目id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="资质情况" prop="qualification">
|
||||||
|
<el-input v-model="form.qualification" placeholder="请输入资质情况" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Company" lang="ts">
|
||||||
|
import { listCompany, getCompany, delCompany, addCompany, updateCompany } from '@/api/materials/company';
|
||||||
|
import { CompanyVO, CompanyQuery, CompanyForm } from '@/api/materials/company/types';
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
|
const companyList = ref<CompanyVO[]>([]);
|
||||||
|
const buttonLoading = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref<Array<string | number>>([]);
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
|
||||||
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
|
const companyFormRef = ref<ElFormInstance>();
|
||||||
|
|
||||||
|
const dialog = reactive<DialogOption>({
|
||||||
|
visible: false,
|
||||||
|
title: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const initFormData: CompanyForm = {
|
||||||
|
id: undefined,
|
||||||
|
companyName: undefined,
|
||||||
|
projectId: undefined,
|
||||||
|
status: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
qualification: undefined,
|
||||||
|
}
|
||||||
|
const data = reactive<PageData<CompanyForm, CompanyQuery>>({
|
||||||
|
form: { ...initFormData },
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
companyName: undefined,
|
||||||
|
projectId: undefined,
|
||||||
|
status: undefined,
|
||||||
|
qualification: undefined,
|
||||||
|
params: {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
id: [
|
||||||
|
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询公司列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
const res = await listCompany(queryParams.value);
|
||||||
|
companyList.value = res.records;
|
||||||
|
total.value = res.total;
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 取消按钮 */
|
||||||
|
const cancel = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 表单重置 */
|
||||||
|
const reset = () => {
|
||||||
|
form.value = { ...initFormData };
|
||||||
|
companyFormRef.value?.resetFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value?.resetFields();
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 多选框选中数据 */
|
||||||
|
const handleSelectionChange = (selection: CompanyVO[]) => {
|
||||||
|
ids.value = selection.map(item => item.id);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
const handleAdd = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = "添加公司";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
const handleUpdate = async (row?: CompanyVO) => {
|
||||||
|
reset();
|
||||||
|
const _id = row?.id || ids.value[0]
|
||||||
|
const res = await getCompany(_id);
|
||||||
|
Object.assign(form.value, res.data);
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = "修改公司";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
const submitForm = () => {
|
||||||
|
companyFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
buttonLoading.value = true;
|
||||||
|
if (form.value.id) {
|
||||||
|
await updateCompany(form.value).finally(() => buttonLoading.value = false);
|
||||||
|
} else {
|
||||||
|
await addCompany(form.value).finally(() => buttonLoading.value = false);
|
||||||
|
}
|
||||||
|
proxy?.$modal.msgSuccess("操作成功");
|
||||||
|
dialog.visible = false;
|
||||||
|
await getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (row?: CompanyVO) => {
|
||||||
|
const _ids = row?.id || ids.value;
|
||||||
|
await proxy?.$modal.confirm('是否确认删除公司编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||||
|
await delCompany(_ids);
|
||||||
|
proxy?.$modal.msgSuccess("删除成功");
|
||||||
|
await getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = () => {
|
||||||
|
proxy?.download('materials/company/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `company_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
|
// 获取用户 store
|
||||||
|
const userStore = useUserStoreHook();
|
||||||
|
|
||||||
|
// 从 store 中获取项目列表和当前选中的项目
|
||||||
|
const projectList = computed(() => userStore.projects);
|
||||||
|
const currentProject = computed(() => userStore.selectedProject);
|
||||||
|
const materialsInventoryList = computed(() => {
|
||||||
|
// 如果有选中的项目,则只显示该项目的数据
|
||||||
|
if (currentProject.value && currentProject.value.id) {
|
||||||
|
return companyList.value.filter(item =>
|
||||||
|
item.projectId === currentProject.value.id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// 没有选中项目则显示所有数据
|
||||||
|
return companyList.value;
|
||||||
|
});
|
||||||
|
// 根据 projectId 获取对应的 projectName
|
||||||
|
const getProjectName = (projectId) => {
|
||||||
|
const project = projectList.value.find(p => p.id === projectId);
|
||||||
|
return project ? project.name : projectId; // 如果找不到对应的项目名,则显示 ID
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
398
src/views/materials/materials/index.vue
Normal file
398
src/views/materials/materials/index.vue
Normal file
@ -0,0 +1,398 @@
|
|||||||
|
<template>
|
||||||
|
<div class="p-2">
|
||||||
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
|
<el-form-item label="材料名称" prop="materialsName">
|
||||||
|
<el-input v-model="queryParams.materialsName" placeholder="请输入材料名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="公司id" prop="companyId">
|
||||||
|
<el-input v-model="queryParams.companyId" placeholder="请输入公司id" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="项目id" prop="projectId">
|
||||||
|
<el-input v-model="queryParams.projectId" placeholder="请输入项目id" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="规格型号名称" prop="typeSpecificationName">
|
||||||
|
<el-input v-model="queryParams.typeSpecificationName" placeholder="请输入规格型号名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格型号文件路径" prop="typeSpecificationUrl">
|
||||||
|
<el-input v-model="queryParams.typeSpecificationUrl" placeholder="请输入规格型号文件路径" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="合格证编号名称" prop="certificateConformityName">
|
||||||
|
<el-input v-model="queryParams.certificateConformityName" placeholder="请输入合格证编号名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="合格证编号文件路径" prop="certificateConformityUrl">
|
||||||
|
<el-input v-model="queryParams.certificateConformityUrl" placeholder="请输入合格证编号文件路径" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="质量说明书编号" prop="qualityName">
|
||||||
|
<el-input v-model="queryParams.qualityName" placeholder="请输入质量说明书编号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="质量说明书文件路径" prop="qualityUrl">
|
||||||
|
<el-input v-model="queryParams.qualityUrl" placeholder="请输入质量说明书文件路径" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="检验报告编号" prop="inspectionReportName">
|
||||||
|
<el-input v-model="queryParams.inspectionReportName" placeholder="请输入检验报告编号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="检验报告文件路径" prop="inspectionReportUrl">
|
||||||
|
<el-input v-model="queryParams.inspectionReportUrl" placeholder="请输入检验报告文件路径" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="复试报告编号" prop="reexamineReportName">
|
||||||
|
<el-input v-model="queryParams.reexamineReportName" placeholder="请输入复试报告编号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="复试报告文件路径" prop="reexamineReportUrl">
|
||||||
|
<el-input v-model="queryParams.reexamineReportUrl" placeholder="请输入复试报告文件路径" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="使用部位" prop="usePart">
|
||||||
|
<el-input v-model="queryParams.usePart" placeholder="请输入使用部位" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="计量单位" prop="weightId">
|
||||||
|
<el-input v-model="queryParams.weightId" placeholder="请输入计量单位" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="预计材料数量" prop="quantityCount">
|
||||||
|
<el-input v-model="queryParams.quantityCount" placeholder="请输入预计材料数量" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
|
||||||
|
<el-card shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['materials:materials:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['materials:materials:edit']">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['materials:materials:remove']">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['materials:materials:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="materialsInventoryList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<!-- <el-table-column label="主键id" align="center" prop="id" v-if="true" /> -->
|
||||||
|
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||||
|
<el-table-column label="材料名称" align="center" prop="materialsName" />
|
||||||
|
<!-- <el-table-column label="公司id" align="center" prop="companyId" /> -->
|
||||||
|
<el-table-column label="公司名称" align="center" prop="companyVo.companyName" />
|
||||||
|
<el-table-column label="项目名称" align="center" prop="">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ getProjectName(scope.row.projectId) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="规格型号名称" align="center" prop="typeSpecificationName" />
|
||||||
|
<el-table-column label="规格型号文件路径" align="center" prop="typeSpecificationUrl" />
|
||||||
|
<el-table-column label="合格证编号名称" align="center" prop="certificateConformityName" />
|
||||||
|
<el-table-column label="合格证编号文件路径" align="center" prop="certificateConformityUrl" />
|
||||||
|
<el-table-column label="质量说明书编号" align="center" prop="qualityName" />
|
||||||
|
<el-table-column label="质量说明书文件路径" align="center" prop="qualityUrl" />
|
||||||
|
<el-table-column label="检验报告编号" align="center" prop="inspectionReportName" />
|
||||||
|
<el-table-column label="检验报告文件路径" align="center" prop="inspectionReportUrl" />
|
||||||
|
<el-table-column label="复试报告编号" align="center" prop="reexamineReportName" />
|
||||||
|
<el-table-column label="复试报告文件路径" align="center" prop="reexamineReportUrl" />
|
||||||
|
<el-table-column label="使用部位" align="center" prop="usePart" />
|
||||||
|
<el-table-column label="计量单位" align="center" prop="weightId" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="预计材料数量" align="center" prop="quantityCount" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status" >
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span :style="{
|
||||||
|
color: row.status === 0 ? 'green' : 'red',
|
||||||
|
backgroundColor: row.status === 0 ? '#E6F9E6' : '#FDE2E2',
|
||||||
|
padding: '5px 10px',
|
||||||
|
borderRadius: '5px',
|
||||||
|
display: 'inline-block'
|
||||||
|
}">
|
||||||
|
{{ row.status === 0 ? '正常' : '异常' }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip content="修改" placement="top">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['materials:materials:edit']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip content="删除" placement="top">
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['materials:materials:remove']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
</el-card>
|
||||||
|
<!-- 添加或修改材料名称对话框 -->
|
||||||
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||||
|
<el-form ref="materialsFormRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="材料名称" prop="materialsName">
|
||||||
|
<el-input v-model="form.materialsName" placeholder="请输入材料名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="公司id" prop="companyId">
|
||||||
|
<el-input v-model="form.companyId" placeholder="请输入公司id" />
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="项目id" prop="projectId">
|
||||||
|
<el-input v-model="form.projectId" placeholder="请输入项目id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格型号名称" prop="typeSpecificationName">
|
||||||
|
<el-input v-model="form.typeSpecificationName" placeholder="请输入规格型号名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格型号文件路径" prop="typeSpecificationUrl">
|
||||||
|
<el-input v-model="form.typeSpecificationUrl" placeholder="请输入规格型号文件路径" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="合格证编号名称" prop="certificateConformityName">
|
||||||
|
<el-input v-model="form.certificateConformityName" placeholder="请输入合格证编号名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="合格证编号文件路径" prop="certificateConformityUrl">
|
||||||
|
<el-input v-model="form.certificateConformityUrl" placeholder="请输入合格证编号文件路径" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="质量说明书编号" prop="qualityName">
|
||||||
|
<el-input v-model="form.qualityName" placeholder="请输入质量说明书编号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="质量说明书文件路径" prop="qualityUrl">
|
||||||
|
<el-input v-model="form.qualityUrl" placeholder="请输入质量说明书文件路径" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="检验报告编号" prop="inspectionReportName">
|
||||||
|
<el-input v-model="form.inspectionReportName" placeholder="请输入检验报告编号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="检验报告文件路径" prop="inspectionReportUrl">
|
||||||
|
<el-input v-model="form.inspectionReportUrl" placeholder="请输入检验报告文件路径" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="复试报告编号" prop="reexamineReportName">
|
||||||
|
<el-input v-model="form.reexamineReportName" placeholder="请输入复试报告编号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="复试报告文件路径" prop="reexamineReportUrl">
|
||||||
|
<el-input v-model="form.reexamineReportUrl" placeholder="请输入复试报告文件路径" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="使用部位" prop="usePart">
|
||||||
|
<el-input v-model="form.usePart" placeholder="请输入使用部位" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="计量单位" prop="weightId">
|
||||||
|
<el-input v-model="form.weightId" placeholder="请输入计量单位" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="预计材料数量" prop="quantityCount">
|
||||||
|
<el-input v-model="form.quantityCount" placeholder="请输入预计材料数量" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Materials" lang="ts">
|
||||||
|
import { listMaterials, getMaterials, delMaterials, addMaterials, updateMaterials } from '@/api/materials/materials';
|
||||||
|
import { MaterialsVO, MaterialsQuery, MaterialsForm } from '@/api/materials/materials/types';
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
|
const materialsList = ref<MaterialsVO[]>([]);
|
||||||
|
const buttonLoading = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref<Array<string | number>>([]);
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
|
||||||
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
|
const materialsFormRef = ref<ElFormInstance>();
|
||||||
|
|
||||||
|
const dialog = reactive<DialogOption>({
|
||||||
|
visible: false,
|
||||||
|
title: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const initFormData: MaterialsForm = {
|
||||||
|
id: undefined,
|
||||||
|
materialsName: undefined,
|
||||||
|
companyId: undefined,
|
||||||
|
projectId: undefined,
|
||||||
|
companyVo: undefined,
|
||||||
|
typeSpecificationName: undefined,
|
||||||
|
typeSpecificationUrl: undefined,
|
||||||
|
certificateConformityName: undefined,
|
||||||
|
certificateConformityUrl: undefined,
|
||||||
|
qualityName: undefined,
|
||||||
|
qualityUrl: undefined,
|
||||||
|
inspectionReportName: undefined,
|
||||||
|
inspectionReportUrl: undefined,
|
||||||
|
reexamineReportName: undefined,
|
||||||
|
reexamineReportUrl: undefined,
|
||||||
|
usePart: undefined,
|
||||||
|
weightId: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
quantityCount: undefined,
|
||||||
|
status: undefined,
|
||||||
|
}
|
||||||
|
const data = reactive<PageData<MaterialsForm, MaterialsQuery>>({
|
||||||
|
form: {...initFormData},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
materialsName: undefined,
|
||||||
|
companyId: undefined,
|
||||||
|
projectId: undefined,
|
||||||
|
companyVo: undefined,
|
||||||
|
typeSpecificationName: undefined,
|
||||||
|
typeSpecificationUrl: undefined,
|
||||||
|
certificateConformityName: undefined,
|
||||||
|
certificateConformityUrl: undefined,
|
||||||
|
qualityName: undefined,
|
||||||
|
qualityUrl: undefined,
|
||||||
|
inspectionReportName: undefined,
|
||||||
|
inspectionReportUrl: undefined,
|
||||||
|
reexamineReportName: undefined,
|
||||||
|
reexamineReportUrl: undefined,
|
||||||
|
usePart: undefined,
|
||||||
|
weightId: undefined,
|
||||||
|
quantityCount: undefined,
|
||||||
|
status: undefined,
|
||||||
|
params: {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
id: [
|
||||||
|
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询材料名称列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
const res = await listMaterials(queryParams.value);
|
||||||
|
materialsList.value = res.records;
|
||||||
|
total.value = res.total;
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 取消按钮 */
|
||||||
|
const cancel = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 表单重置 */
|
||||||
|
const reset = () => {
|
||||||
|
form.value = {...initFormData};
|
||||||
|
materialsFormRef.value?.resetFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value?.resetFields();
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 多选框选中数据 */
|
||||||
|
const handleSelectionChange = (selection: MaterialsVO[]) => {
|
||||||
|
ids.value = selection.map(item => item.id);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
const handleAdd = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = "添加材料名称";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
const handleUpdate = async (row?: MaterialsVO) => {
|
||||||
|
reset();
|
||||||
|
const _id = row?.id || ids.value[0]
|
||||||
|
const res = await getMaterials(_id);
|
||||||
|
Object.assign(form.value, res.data);
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = "修改材料名称";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
const submitForm = () => {
|
||||||
|
materialsFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
buttonLoading.value = true;
|
||||||
|
if (form.value.id) {
|
||||||
|
await updateMaterials(form.value).finally(() => buttonLoading.value = false);
|
||||||
|
} else {
|
||||||
|
await addMaterials(form.value).finally(() => buttonLoading.value = false);
|
||||||
|
}
|
||||||
|
proxy?.$modal.msgSuccess("操作成功");
|
||||||
|
dialog.visible = false;
|
||||||
|
await getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (row?: MaterialsVO) => {
|
||||||
|
const _ids = row?.id || ids.value;
|
||||||
|
await proxy?.$modal.confirm('是否确认删除材料名称编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||||
|
await delMaterials(_ids);
|
||||||
|
proxy?.$modal.msgSuccess("删除成功");
|
||||||
|
await getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = () => {
|
||||||
|
proxy?.download('materials/materials/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `materials_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
|
// 获取用户 store
|
||||||
|
const userStore = useUserStoreHook();
|
||||||
|
|
||||||
|
// 从 store 中获取项目列表和当前选中的项目
|
||||||
|
const projectList = computed(() => userStore.projects);
|
||||||
|
const currentProject = computed(() => userStore.selectedProject);
|
||||||
|
const materialsInventoryList = computed(() => {
|
||||||
|
// 如果有选中的项目,则只显示该项目的数据
|
||||||
|
if (currentProject.value && currentProject.value.id) {
|
||||||
|
return materialsList.value.filter(item =>
|
||||||
|
item.projectId === currentProject.value.id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// 没有选中项目则显示所有数据
|
||||||
|
return materialsList.value;
|
||||||
|
});
|
||||||
|
// 根据 projectId 获取对应的 projectName
|
||||||
|
const getProjectName = (projectId) => {
|
||||||
|
const project = projectList.value.find(p => p.id === projectId);
|
||||||
|
return project ? project.name : projectId; // 如果找不到对应的项目名,则显示 ID
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
</script>
|
362
src/views/materials/materialsInventory/index.vue
Normal file
362
src/views/materials/materialsInventory/index.vue
Normal file
@ -0,0 +1,362 @@
|
|||||||
|
<template>
|
||||||
|
<div class="p-2">
|
||||||
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||||
|
<el-form-item label="材料id" prop="materialsId">
|
||||||
|
<el-input v-model="queryParams.materialsId" placeholder="请输入材料id" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目id" prop="projectId">
|
||||||
|
<el-input v-model="queryParams.projectId" placeholder="请输入项目id" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="出入库状态" prop="outPut">
|
||||||
|
<el-input v-model="queryParams.outPut" placeholder="请输入出入库状态" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="出/入库的数量" prop="number">
|
||||||
|
<el-input v-model="queryParams.number" placeholder="请输入出/入库的数量" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="出/入库操作时间" prop="outPutTime">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="queryParams.outPutTime"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择出/入库操作时间"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="剩余库存数量" prop="residue">
|
||||||
|
<el-input v-model="queryParams.residue" placeholder="请输入剩余库存数量" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="操作人" prop="operator">
|
||||||
|
<el-input v-model="queryParams.operator" placeholder="请输入操作人" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="材料出入证明" prop="path">
|
||||||
|
<el-input v-model="queryParams.path" placeholder="请输入材料出入证明" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="处理方式" prop="disposition">
|
||||||
|
<el-input v-model="queryParams.disposition" placeholder="请输入处理方式" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="交接单位" prop="recipient">
|
||||||
|
<el-input v-model="queryParams.recipient" placeholder="请输入交接单位" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="领用人" prop="shipper">
|
||||||
|
<el-input v-model="queryParams.shipper" placeholder="请输入领用人" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
|
||||||
|
<el-card shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['materials:materialsInventory:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['materials:materialsInventory:edit']">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['materials:materialsInventory:remove']">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['materials:materialsInventory:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="materialsInventoryListNew" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<!-- <el-table-column label="主键id" align="center" prop="id" v-if="true" /> -->
|
||||||
|
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||||
|
<!-- <el-table-column label="材料id" align="center" prop="materialsId" /> -->
|
||||||
|
<el-table-column label="材料名称" align="center" prop="materialsVo.materialsName" />
|
||||||
|
<el-table-column label="项目名称" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ getProjectName(scope.row.projectId) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="出入库状态" align="center" prop="outPut" />
|
||||||
|
<el-table-column label="出/入库的数量" align="center" prop="number" />
|
||||||
|
<el-table-column label="出/入库操作时间" align="center" prop="outPutTime" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.outPutTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="剩余库存数量" align="center" prop="residue" />
|
||||||
|
<el-table-column label="操作人" align="center" prop="operator" />
|
||||||
|
<el-table-column label="材料出入证明" align="center" prop="path" />
|
||||||
|
<el-table-column label="处理方式" align="center" prop="disposition" />
|
||||||
|
<el-table-column label="交接单位" align="center" prop="recipient" />
|
||||||
|
<el-table-column label="领用人" align="center" prop="shipper" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tooltip content="修改" placement="top">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['materials:materialsInventory:edit']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip content="删除" placement="top">
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['materials:materialsInventory:remove']"></el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
</el-card>
|
||||||
|
<!-- 添加或修改材料出/入库对话框 -->
|
||||||
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||||
|
<el-form ref="materialsInventoryFormRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="材料名称" prop="materialsVo.materialsName">
|
||||||
|
<el-input v-model="form.materialsVo.materialsName" placeholder="请输入材料名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目id " prop="projectId">
|
||||||
|
<el-input v-model="form.projectId" placeholder="请输入项目id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="出入库状态" prop="outPut">
|
||||||
|
<el-input v-model="form.outPut" placeholder="请输入出入库状态" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="出/入库的数量" prop="number">
|
||||||
|
<el-input v-model="form.number" placeholder="请输入出/入库的数量" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="出/入库操作时间" prop="outPutTime">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.outPutTime"
|
||||||
|
type="datetime"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
placeholder="请选择出/入库操作时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="剩余库存数量" prop="residue">
|
||||||
|
<el-input v-model="form.residue" placeholder="请输入剩余库存数量" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="操作人" prop="operator">
|
||||||
|
<el-input v-model="form.operator" placeholder="请输入操作人" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="材料出入证明" prop="path">
|
||||||
|
<el-input v-model="form.path" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="处理方式" prop="disposition">
|
||||||
|
<el-input v-model="form.disposition" placeholder="请输入处理方式" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="交接单位" prop="recipient">
|
||||||
|
<el-input v-model="form.recipient" placeholder="请输入交接单位" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="领用人" prop="shipper">
|
||||||
|
<el-input v-model="form.shipper" placeholder="请输入领用人" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="MaterialsInventory" lang="ts">
|
||||||
|
import { listMaterialsInventory, getMaterialsInventory, delMaterialsInventory, addMaterialsInventory, updateMaterialsInventory } from '@/api/materials/materialsInventory';
|
||||||
|
import { MaterialsInventoryVO, MaterialsInventoryQuery, MaterialsInventoryForm } from '@/api/materials/materialsInventory/types';
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
|
const materialsInventoryList = ref<MaterialsInventoryVO[]>([]);
|
||||||
|
const buttonLoading = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref<Array<string | number>>([]);
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
|
||||||
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
|
const materialsInventoryFormRef = ref<ElFormInstance>();
|
||||||
|
|
||||||
|
const dialog = reactive<DialogOption>({
|
||||||
|
visible: false,
|
||||||
|
title: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const initFormData: MaterialsInventoryForm = {
|
||||||
|
id: undefined,
|
||||||
|
materialsId: undefined,
|
||||||
|
projectId: undefined,
|
||||||
|
outPut: undefined,
|
||||||
|
number: undefined,
|
||||||
|
outPutTime: undefined,
|
||||||
|
residue: undefined,
|
||||||
|
operator: undefined,
|
||||||
|
path: undefined,
|
||||||
|
disposition: undefined,
|
||||||
|
recipient: undefined,
|
||||||
|
shipper: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
materialsVo: {
|
||||||
|
id: undefined,
|
||||||
|
materialsName: undefined,
|
||||||
|
materialsCode: undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const data = reactive<PageData<MaterialsInventoryForm, MaterialsInventoryQuery>>({
|
||||||
|
form: {...initFormData},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
materialsId: undefined,
|
||||||
|
projectId: undefined,
|
||||||
|
outPut: undefined,
|
||||||
|
number: undefined,
|
||||||
|
outPutTime: undefined,
|
||||||
|
residue: undefined,
|
||||||
|
operator: undefined,
|
||||||
|
path: undefined,
|
||||||
|
disposition: undefined,
|
||||||
|
recipient: undefined,
|
||||||
|
shipper: undefined,
|
||||||
|
params: {
|
||||||
|
},
|
||||||
|
materialsVo: {
|
||||||
|
id: undefined,
|
||||||
|
materialsName: undefined,
|
||||||
|
materialsCode: undefined,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
id: [
|
||||||
|
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
materialsId: [
|
||||||
|
{ required: true, message: "材料id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询材料出/入库列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
const res = await listMaterialsInventory(queryParams.value);
|
||||||
|
materialsInventoryList.value = res.records;
|
||||||
|
total.value = res.total;
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 取消按钮 */
|
||||||
|
const cancel = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 表单重置 */
|
||||||
|
const reset = () => {
|
||||||
|
form.value = {...initFormData};
|
||||||
|
materialsInventoryFormRef.value?.resetFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value?.resetFields();
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 多选框选中数据 */
|
||||||
|
const handleSelectionChange = (selection: MaterialsInventoryVO[]) => {
|
||||||
|
ids.value = selection.map(item => item.id);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
const handleAdd = () => {
|
||||||
|
reset();
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = "添加材料出/入库";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
const handleUpdate = async (row?: MaterialsInventoryVO) => {
|
||||||
|
reset();
|
||||||
|
const _id = row?.id || ids.value[0]
|
||||||
|
const res = await getMaterialsInventory(_id);
|
||||||
|
Object.assign(form.value, res.data);
|
||||||
|
dialog.visible = true;
|
||||||
|
dialog.title = "修改材料出/入库";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
const submitForm = () => {
|
||||||
|
materialsInventoryFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
buttonLoading.value = true;
|
||||||
|
if (form.value.id) {
|
||||||
|
await updateMaterialsInventory(form.value).finally(() => buttonLoading.value = false);
|
||||||
|
} else {
|
||||||
|
await addMaterialsInventory(form.value).finally(() => buttonLoading.value = false);
|
||||||
|
}
|
||||||
|
proxy?.$modal.msgSuccess("操作成功");
|
||||||
|
dialog.visible = false;
|
||||||
|
await getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (row?: MaterialsInventoryVO) => {
|
||||||
|
const _ids = row?.id || ids.value;
|
||||||
|
await proxy?.$modal.confirm('是否确认删除材料出/入库编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||||
|
await delMaterialsInventory(_ids);
|
||||||
|
proxy?.$modal.msgSuccess("删除成功");
|
||||||
|
await getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = () => {
|
||||||
|
proxy?.download('materials/materialsInventory/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `materialsInventory_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
import { useUserStoreHook } from '@/store/modules/user';
|
||||||
|
// 获取用户 store
|
||||||
|
const userStore = useUserStoreHook();
|
||||||
|
|
||||||
|
// 从 store 中获取项目列表和当前选中的项目
|
||||||
|
const projectList = computed(() => userStore.projects);
|
||||||
|
const currentProject = computed(() => userStore.selectedProject);
|
||||||
|
const materialsInventoryListNew = computed(() => {
|
||||||
|
// 如果有选中的项目,则只显示该项目的数据
|
||||||
|
if (currentProject.value && currentProject.value.id) {
|
||||||
|
return materialsInventoryList.value.filter(item =>
|
||||||
|
item.projectId === currentProject.value.id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// 没有选中项目则显示所有数据
|
||||||
|
return materialsInventoryList.value;
|
||||||
|
});
|
||||||
|
// 根据 projectId 获取对应的 projectName
|
||||||
|
const getProjectName = (projectId) => {
|
||||||
|
const project = projectList.value.find(p => p.id === projectId);
|
||||||
|
return project ? project.name : projectId; // 如果找不到对应的项目名,则显示 ID
|
||||||
|
};
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
</script>
|
@ -52,7 +52,7 @@
|
|||||||
<el-form-item label="显示隐藏" prop="showHidden">
|
<el-form-item label="显示隐藏" prop="showHidden">
|
||||||
<el-input v-model="queryParams.showHidden" placeholder="请输入显示隐藏" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.showHidden" placeholder="请输入显示隐藏" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否删除" prop="isDelete">
|
<el-form-item label="是否删除" prop="isDelete">
|
||||||
<el-input v-model="queryParams.isDelete" placeholder="请输入是否删除" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.isDelete" placeholder="请输入是否删除" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
@ -92,12 +92,12 @@
|
|||||||
<el-table-column label="" align="center" prop="id" v-if="true" />
|
<el-table-column label="" align="center" prop="id" v-if="true" />
|
||||||
<el-table-column label="项目名称" align="center" prop="projectName" />
|
<el-table-column label="项目名称" align="center" prop="projectName" />
|
||||||
<el-table-column label="项目简称" align="center" prop="shortName" />
|
<el-table-column label="项目简称" align="center" prop="shortName" />
|
||||||
<el-table-column label="父项目id" align="center" prop="pId" />
|
<!-- <el-table-column label="父项目id" align="center" prop="pId" /> -->
|
||||||
<el-table-column label="状态" align="center" prop="status" />
|
<el-table-column label="状态" align="center" prop="status" />
|
||||||
<el-table-column label="项目图片" align="center" prop="picUrl" />
|
<el-table-column label="项目图片" align="center" prop="picUrl" />
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="项目类型" align="center" prop="type" />
|
<el-table-column label="项目类型" align="center" prop="type" />
|
||||||
<el-table-column label="项目类型" align="center" prop="isType" />
|
<!-- <el-table-column label="项目类型" align="center" prop="isType" /> -->
|
||||||
<!-- <el-table-column label="删除时间" align="center" prop="deletedAt" width="180">
|
<!-- <el-table-column label="删除时间" align="center" prop="deletedAt" width="180">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ parseTime(scope.row.deletedAt, '{y}-{m}-{d}') }}</span>
|
<span>{{ parseTime(scope.row.deletedAt, '{y}-{m}-{d}') }}</span>
|
||||||
@ -111,10 +111,10 @@
|
|||||||
<el-table-column label="开工时间" align="center" prop="onStreamTime" />
|
<el-table-column label="开工时间" align="center" prop="onStreamTime" />
|
||||||
<el-table-column label="打卡范围" align="center" prop="punchRange" />
|
<el-table-column label="打卡范围" align="center" prop="punchRange" />
|
||||||
<el-table-column label="设计总量" align="center" prop="designTotal" />
|
<el-table-column label="设计总量" align="center" prop="designTotal" />
|
||||||
<el-table-column label="安全协议书" align="center" prop="securityAgreement" />
|
<!-- <el-table-column label="安全协议书" align="center" prop="securityAgreement" /> -->
|
||||||
<el-table-column label="排序字段" align="center" prop="sort" />
|
<!-- <el-table-column label="排序字段" align="center" prop="sort" />/ -->
|
||||||
<el-table-column label="显示隐藏" align="center" prop="showHidden" />
|
<!-- <el-table-column label="显示隐藏" align="center" prop="showHidden" /> -->
|
||||||
<el-table-column label="是否删除" align="center" prop="isDelete" />
|
<!-- <el-table-column label="是否删除" align="center" prop="isDelete" /> -->
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip content="修改" placement="top">
|
<el-tooltip content="修改" placement="top">
|
||||||
@ -138,9 +138,9 @@
|
|||||||
<el-form-item label="项目简称" prop="shortName">
|
<el-form-item label="项目简称" prop="shortName">
|
||||||
<el-input v-model="form.shortName" placeholder="请输入项目简称" />
|
<el-input v-model="form.shortName" placeholder="请输入项目简称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="父项目id" prop="pId">
|
<!-- <el-form-item label="父项目id" prop="pId">
|
||||||
<el-input v-model="form.pId" placeholder="请输入父项目id" />
|
<el-input v-model="form.pId" placeholder="请输入父项目id" />
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="项目图片" prop="picUrl">
|
<el-form-item label="项目图片" prop="picUrl">
|
||||||
<el-input v-model="form.picUrl" placeholder="请输入项目图片" />
|
<el-input v-model="form.picUrl" placeholder="请输入项目图片" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -175,7 +175,7 @@
|
|||||||
<el-form-item label="设计总量" prop="designTotal">
|
<el-form-item label="设计总量" prop="designTotal">
|
||||||
<el-input v-model="form.designTotal" placeholder="请输入设计总量" />
|
<el-input v-model="form.designTotal" placeholder="请输入设计总量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="安全协议书" prop="securityAgreement">
|
<!-- <el-form-item label="安全协议书" prop="securityAgreement">
|
||||||
<el-input v-model="form.securityAgreement" placeholder="请输入安全协议书" />
|
<el-input v-model="form.securityAgreement" placeholder="请输入安全协议书" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序字段" prop="sort">
|
<el-form-item label="排序字段" prop="sort">
|
||||||
@ -186,7 +186,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否删除" prop="isDelete">
|
<el-form-item label="是否删除" prop="isDelete">
|
||||||
<el-input v-model="form.isDelete" placeholder="请输入是否删除" />
|
<el-input v-model="form.isDelete" placeholder="请输入是否删除" />
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@ -327,7 +327,7 @@ const handleAdd = () => {
|
|||||||
reset();
|
reset();
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = '添加项目';
|
dialog.title = '添加项目';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
|
@ -35,17 +35,20 @@ const getProjectList = async () => {
|
|||||||
console.error('获取项目列表失败:', error);
|
console.error('获取项目列表失败:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getUserProjects = async () => {
|
const getUserProjects = async () => {
|
||||||
if (!props.userId) return;
|
if (!props.userId) return;
|
||||||
try {
|
try {
|
||||||
const res = await listUserProjects({ userId: props.userId });
|
const res = await listUserProjects({ userId: props.userId });
|
||||||
|
|
||||||
// **确保 `res.rows` 是数组**
|
// 修改这里,使用 res.records 而不是 res.rows
|
||||||
selectedProjects.value = Array.isArray(res.rows) ? res.rows.map((item) => item.projectId) : [];
|
selectedProjects.value = Array.isArray(res.records)
|
||||||
|
? res.records.map((item) => item.projectId)
|
||||||
|
: [];
|
||||||
|
|
||||||
|
console.log('已加载用户关联项目:', selectedProjects.value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取用户关联的项目失败:', error);
|
console.error('获取用户关联的项目失败:', error);
|
||||||
selectedProjects.value = []; // **请求失败时清空列表**
|
selectedProjects.value = []; // 请求失败时清空列表
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -226,8 +226,8 @@ const selectedUserId = ref<number>();
|
|||||||
const handleUpdate = (row?: ProjectRelevancyVO) => {
|
const handleUpdate = (row?: ProjectRelevancyVO) => {
|
||||||
const currentRow = row || projectRelevancyList.value.find((item) => item.id === ids.value[0]);
|
const currentRow = row || projectRelevancyList.value.find((item) => item.id === ids.value[0]);
|
||||||
if (currentRow) {
|
if (currentRow) {
|
||||||
selectedUserId.value = currentRow.userId;
|
selectedUserId.value = currentRow.userId;
|
||||||
shuttleVisible.value = true;
|
shuttleVisible.value = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -268,9 +268,9 @@ const handleExport = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const projectList = ref<any[]>([]);
|
const projectList = ref<any[]>([]);
|
||||||
const projectItem = new Map();
|
const projectItem = new Map();
|
||||||
const selectedProject = ref<any | null>(null);
|
const selectedProject = ref<any | null>(null);
|
||||||
|
|
||||||
// 获取项目列表的方法
|
// 获取项目列表的方法
|
||||||
const getProjectList = async () => {
|
const getProjectList = async () => {
|
||||||
|
@ -126,9 +126,21 @@
|
|||||||
<el-tooltip v-if="scope.row.userId !== 1" content="分配角色" placement="top">
|
<el-tooltip v-if="scope.row.userId !== 1" content="分配角色" placement="top">
|
||||||
<el-button v-hasPermi="['system:user:edit']" link type="primary" icon="CircleCheck" @click="handleAuthRole(scope.row)"></el-button>
|
<el-button v-hasPermi="['system:user:edit']" link type="primary" icon="CircleCheck" @click="handleAuthRole(scope.row)"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
<el-tooltip v-if="scope.row.userId !== 1" content="编辑关联项目" placement="top">
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['system:user:edit']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Edit"
|
||||||
|
@click="handleUpdateProject(scope.row)"
|
||||||
|
></el-button>
|
||||||
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<el-dialog v-model="shuttleVisible" title="编辑关联项目" width="auto" destroy-on-close>
|
||||||
|
<shuttle-frame :userId="selectedUserId" @close="shuttleVisible = false" />
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total > 0"
|
v-show="total > 0"
|
||||||
@ -287,7 +299,7 @@
|
|||||||
<script setup name="User" lang="ts">
|
<script setup name="User" lang="ts">
|
||||||
import api from '@/api/system/user';
|
import api from '@/api/system/user';
|
||||||
import { UserForm, UserQuery, UserVO } from '@/api/system/user/types';
|
import { UserForm, UserQuery, UserVO } from '@/api/system/user/types';
|
||||||
import {DeptTreeVO, DeptVO} from '@/api/system/dept/types';
|
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
|
||||||
import { RoleVO } from '@/api/system/role/types';
|
import { RoleVO } from '@/api/system/role/types';
|
||||||
import { PostQuery, PostVO } from '@/api/system/post/types';
|
import { PostQuery, PostVO } from '@/api/system/post/types';
|
||||||
import { treeselect } from '@/api/system/dept';
|
import { treeselect } from '@/api/system/dept';
|
||||||
@ -295,6 +307,8 @@ import { globalHeaders } from '@/utils/request';
|
|||||||
import { to } from 'await-to-js';
|
import { to } from 'await-to-js';
|
||||||
import { optionselect } from '@/api/system/post';
|
import { optionselect } from '@/api/system/post';
|
||||||
|
|
||||||
|
import { ProjectRelevancyVO } from '@/api/project/projectRelevancy/types';
|
||||||
|
import ShuttleFrame from '../../personnelManagement/project/projectRelevancy/component/ShuttleFrame.vue';
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
const { sys_normal_disable, sys_user_sex } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_user_sex'));
|
const { sys_normal_disable, sys_user_sex } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_user_sex'));
|
||||||
@ -450,7 +464,7 @@ const getDeptTree = async () => {
|
|||||||
|
|
||||||
/** 过滤禁用的部门 */
|
/** 过滤禁用的部门 */
|
||||||
const filterDisabledDept = (deptList: DeptTreeVO[]) => {
|
const filterDisabledDept = (deptList: DeptTreeVO[]) => {
|
||||||
return deptList.filter(dept => {
|
return deptList.filter((dept) => {
|
||||||
if (dept.disabled) {
|
if (dept.disabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -659,6 +673,15 @@ async function handleDeptChange(value: number | string) {
|
|||||||
postOptions.value = response.data;
|
postOptions.value = response.data;
|
||||||
form.value.postIds = [];
|
form.value.postIds = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const shuttleVisible = ref(false);
|
||||||
|
const selectedUserId = ref<number>();
|
||||||
|
const handleUpdateProject = (row) => {
|
||||||
|
if (row) {
|
||||||
|
selectedUserId.value = row.userId;
|
||||||
|
shuttleVisible.value = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
Reference in New Issue
Block a user