工具器和物料
This commit is contained in:
@ -0,0 +1,63 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { ContractorMaterialRecordVO, ContractorMaterialRecordForm, ContractorMaterialRecordQuery } from '@/api/contractor/contractorMaterialRecord/types';
|
||||
|
||||
/**
|
||||
* 查询分包方物料记录列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listContractorMaterialRecord = (query?: ContractorMaterialRecordQuery): AxiosPromise<ContractorMaterialRecordVO[]> => {
|
||||
return request({
|
||||
url: '/contractor/contractorMaterialRecord/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询分包方物料记录详细
|
||||
* @param id
|
||||
*/
|
||||
export const getContractorMaterialRecord = (id: string | number): AxiosPromise<ContractorMaterialRecordVO> => {
|
||||
return request({
|
||||
url: '/contractor/contractorMaterialRecord/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增分包方物料记录
|
||||
* @param data
|
||||
*/
|
||||
export const addContractorMaterialRecord = (data: ContractorMaterialRecordForm) => {
|
||||
return request({
|
||||
url: '/contractor/contractorMaterialRecord',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改分包方物料记录
|
||||
* @param data
|
||||
*/
|
||||
export const updateContractorMaterialRecord = (data: ContractorMaterialRecordForm) => {
|
||||
return request({
|
||||
url: '/contractor/contractorMaterialRecord',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除分包方物料记录
|
||||
* @param id
|
||||
*/
|
||||
export const delContractorMaterialRecord = (id: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/contractor/contractorMaterialRecord/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
@ -0,0 +1,141 @@
|
||||
export interface ContractorMaterialRecordVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId: string | number;
|
||||
|
||||
/**
|
||||
* 分包方id
|
||||
*/
|
||||
contractorId: string | number;
|
||||
|
||||
/**
|
||||
* 物料id
|
||||
*/
|
||||
contractorMaterialId: string | number;
|
||||
|
||||
/**
|
||||
* 记录类型(1到货计划 2使用情况)
|
||||
*/
|
||||
recordType: string;
|
||||
|
||||
/**
|
||||
* 记录时间
|
||||
*/
|
||||
recordTime: string;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
recordNumber: number;
|
||||
|
||||
/**
|
||||
* 剩余数量(到货 使用)
|
||||
*/
|
||||
remainingNumber: number;
|
||||
|
||||
/**
|
||||
* 使用位置或构件部位(使用情况)
|
||||
*/
|
||||
usedPosition: string;
|
||||
|
||||
/**
|
||||
* 相关附件
|
||||
*/
|
||||
file: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ContractorMaterialRecordForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 物料id
|
||||
*/
|
||||
contractorMaterialId?: string | number;
|
||||
|
||||
/**
|
||||
* 记录类型(1到货计划 2使用情况)
|
||||
*/
|
||||
recordType?: string;
|
||||
|
||||
/**
|
||||
* 记录时间
|
||||
*/
|
||||
recordTime?: string;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
recordNumber?: number;
|
||||
|
||||
/**
|
||||
* 剩余数量(到货 使用)
|
||||
*/
|
||||
remainingNumber?: number;
|
||||
|
||||
/**
|
||||
* 使用位置或构件部位(使用情况)
|
||||
*/
|
||||
usedPosition?: string;
|
||||
|
||||
/**
|
||||
* 相关附件
|
||||
*/
|
||||
file?: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ContractorMaterialRecordQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId?: string | number;
|
||||
|
||||
/**
|
||||
* 分包方id
|
||||
*/
|
||||
contractorId?: string | number;
|
||||
|
||||
/**
|
||||
* 物料id
|
||||
*/
|
||||
contractorMaterialId?: string | number;
|
||||
|
||||
/**
|
||||
* 记录类型(1到货计划 2使用情况)
|
||||
*/
|
||||
recordType?: string;
|
||||
|
||||
/**
|
||||
* 使用位置或构件部位(使用情况)
|
||||
*/
|
||||
usedPosition?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
|
||||
|
63
src/api/project/contractorMaterial/index.ts
Normal file
63
src/api/project/contractorMaterial/index.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { ContractorMaterialVO, ContractorMaterialForm, ContractorMaterialQuery } from '@/api/contractor/contractorMaterial/types';
|
||||
|
||||
/**
|
||||
* 查询分包方物料列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listContractorMaterial = (query?: ContractorMaterialQuery): AxiosPromise<ContractorMaterialVO[]> => {
|
||||
return request({
|
||||
url: '/contractor/contractorMaterial/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询分包方物料详细
|
||||
* @param id
|
||||
*/
|
||||
export const getContractorMaterial = (id: string | number): AxiosPromise<ContractorMaterialVO> => {
|
||||
return request({
|
||||
url: '/contractor/contractorMaterial/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增分包方物料
|
||||
* @param data
|
||||
*/
|
||||
export const addContractorMaterial = (data: ContractorMaterialForm) => {
|
||||
return request({
|
||||
url: '/contractor/contractorMaterial',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改分包方物料
|
||||
* @param data
|
||||
*/
|
||||
export const updateContractorMaterial = (data: ContractorMaterialForm) => {
|
||||
return request({
|
||||
url: '/contractor/contractorMaterial',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除分包方物料
|
||||
* @param id
|
||||
*/
|
||||
export const delContractorMaterial = (id: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/contractor/contractorMaterial/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
126
src/api/project/contractorMaterial/types.ts
Normal file
126
src/api/project/contractorMaterial/types.ts
Normal file
@ -0,0 +1,126 @@
|
||||
export interface ContractorMaterialVO {
|
||||
/**
|
||||
* 分包方id
|
||||
*/
|
||||
contractorId: string | number;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
materialName: string;
|
||||
|
||||
/**
|
||||
* 物料类型
|
||||
*/
|
||||
materialType: string;
|
||||
|
||||
/**
|
||||
* 物料型号
|
||||
*/
|
||||
materialModel: string;
|
||||
|
||||
/**
|
||||
* 物料数量
|
||||
*/
|
||||
materialNumber: number;
|
||||
|
||||
/**
|
||||
* 物料单位
|
||||
*/
|
||||
materialUnit: string;
|
||||
|
||||
/**
|
||||
* 文件
|
||||
*/
|
||||
file: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ContractorMaterialForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId?: string | number;
|
||||
|
||||
/**
|
||||
* 分包方id
|
||||
*/
|
||||
contractorId?: string | number;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
materialName?: string;
|
||||
|
||||
/**
|
||||
* 物料类型
|
||||
*/
|
||||
materialType?: string;
|
||||
|
||||
/**
|
||||
* 物料型号
|
||||
*/
|
||||
materialModel?: string;
|
||||
|
||||
/**
|
||||
* 物料单位
|
||||
*/
|
||||
materialUnit?: string;
|
||||
|
||||
/**
|
||||
* 文件
|
||||
*/
|
||||
file?: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ContractorMaterialQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId?: string | number;
|
||||
|
||||
/**
|
||||
* 分包方id
|
||||
*/
|
||||
contractorId?: string | number;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
materialName?: string;
|
||||
|
||||
/**
|
||||
* 物料类型
|
||||
*/
|
||||
materialType?: string;
|
||||
|
||||
/**
|
||||
* 物料型号
|
||||
*/
|
||||
materialModel?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
|
||||
|
63
src/api/project/contractorTool/contractorToolEntry/index.ts
Normal file
63
src/api/project/contractorTool/contractorToolEntry/index.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { ContractorToolEntryVO, ContractorToolEntryForm, ContractorToolEntryQuery } from '@/api/contractor/contractorToolEntry/types';
|
||||
|
||||
/**
|
||||
* 查询分包方工器具进场列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listContractorToolEntry = (query?: ContractorToolEntryQuery): AxiosPromise<ContractorToolEntryVO[]> => {
|
||||
return request({
|
||||
url: '/contractor/contractorToolRecord/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询分包方工器具进场详细
|
||||
* @param id
|
||||
*/
|
||||
export const getContractorToolEntry = (id: string | number): AxiosPromise<ContractorToolEntryVO> => {
|
||||
return request({
|
||||
url: '/contractor/contractorToolRecord/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增分包方工器具进场
|
||||
* @param data
|
||||
*/
|
||||
export const addContractorToolEntry = (data: ContractorToolEntryForm) => {
|
||||
return request({
|
||||
url: '/contractor/contractorToolRecord',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改分包方工器具进场
|
||||
* @param data
|
||||
*/
|
||||
export const updateContractorToolEntry = (data: ContractorToolEntryForm) => {
|
||||
return request({
|
||||
url: '/contractor/contractorToolRecord',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除分包方工器具进场
|
||||
* @param id
|
||||
*/
|
||||
export const delContractorToolEntry = (id: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/contractor/contractorToolRecord/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
156
src/api/project/contractorTool/contractorToolEntry/types.ts
Normal file
156
src/api/project/contractorTool/contractorToolEntry/types.ts
Normal file
@ -0,0 +1,156 @@
|
||||
export interface ContractorToolEntryVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId: string | number;
|
||||
|
||||
/**
|
||||
* 分包方id
|
||||
*/
|
||||
contractorId: string | number;
|
||||
|
||||
/**
|
||||
* 分包方工器具id
|
||||
*/
|
||||
contractorToolId: string | number;
|
||||
|
||||
/**
|
||||
* 进场工器具数量
|
||||
*/
|
||||
toolNumber: string;
|
||||
|
||||
/**
|
||||
* 检测编号
|
||||
*/
|
||||
checkNum: string;
|
||||
|
||||
/**
|
||||
* 检测部门
|
||||
*/
|
||||
checkDept: string;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
checkTime: string;
|
||||
|
||||
/**
|
||||
* 合格证
|
||||
*/
|
||||
certificate: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark: string;
|
||||
|
||||
/**
|
||||
* 进场时间
|
||||
*/
|
||||
entryTime: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ContractorToolEntryForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 分包方工器具id
|
||||
*/
|
||||
contractorToolId?: string | number;
|
||||
|
||||
/**
|
||||
* 进场工器具数量
|
||||
*/
|
||||
toolNumber?: string;
|
||||
|
||||
/**
|
||||
* 检测编号
|
||||
*/
|
||||
checkNum?: string;
|
||||
|
||||
/**
|
||||
* 检测部门
|
||||
*/
|
||||
checkDept?: string;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
checkTime?: string;
|
||||
|
||||
/**
|
||||
* 合格证
|
||||
*/
|
||||
certificate?: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
|
||||
/**
|
||||
* 进场时间
|
||||
*/
|
||||
entryTime?: string;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
recordType?: string;
|
||||
/**
|
||||
* 工器具数量
|
||||
*/
|
||||
recordNumber?: number;
|
||||
}
|
||||
|
||||
export interface ContractorToolEntryQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId?: string | number;
|
||||
|
||||
/**
|
||||
* 分包方id
|
||||
*/
|
||||
contractorId?: string | number;
|
||||
|
||||
/**
|
||||
* 分包方工器具id
|
||||
*/
|
||||
contractorToolId?: string | number;
|
||||
|
||||
/**
|
||||
* 进场工器具数量
|
||||
*/
|
||||
toolNumber?: string;
|
||||
|
||||
/**
|
||||
* 检测编号
|
||||
*/
|
||||
checkNum?: string;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
recordType?: string;
|
||||
/**
|
||||
* 检测部门
|
||||
*/
|
||||
checkDept?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
|
||||
|
63
src/api/project/contractorTool/index.ts
Normal file
63
src/api/project/contractorTool/index.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { ContractorToolVO, ContractorToolForm, ContractorToolQuery } from '@/api/project/contractorTool/types';
|
||||
|
||||
/**
|
||||
* 查询分包方工器具列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listContractorTool = (query?: ContractorToolQuery): AxiosPromise<ContractorToolVO[]> => {
|
||||
return request({
|
||||
url: '/project/contractorTool/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询分包方工器具详细
|
||||
* @param id
|
||||
*/
|
||||
export const getContractorTool = (id: string | number): AxiosPromise<ContractorToolVO> => {
|
||||
return request({
|
||||
url: '/project/contractorTool/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增分包方工器具
|
||||
* @param data
|
||||
*/
|
||||
export const addContractorTool = (data: ContractorToolForm) => {
|
||||
return request({
|
||||
url: '/project/contractorTool',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改分包方工器具
|
||||
* @param data
|
||||
*/
|
||||
export const updateContractorTool = (data: ContractorToolForm) => {
|
||||
return request({
|
||||
url: '/project/contractorTool',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除分包方工器具
|
||||
* @param id
|
||||
*/
|
||||
export const delContractorTool = (id: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/project/contractorTool/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
136
src/api/project/contractorTool/types.ts
Normal file
136
src/api/project/contractorTool/types.ts
Normal file
@ -0,0 +1,136 @@
|
||||
export interface ContractorToolVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId: string | number;
|
||||
|
||||
/**
|
||||
* 分包方id
|
||||
*/
|
||||
contractorId: string | number;
|
||||
|
||||
/**
|
||||
* 工具名称
|
||||
*/
|
||||
toolName: string;
|
||||
|
||||
/**
|
||||
* 工具类型
|
||||
*/
|
||||
toolType: string;
|
||||
|
||||
/**
|
||||
* 工具型号
|
||||
*/
|
||||
toolModel: string;
|
||||
|
||||
/**
|
||||
* 工具数量
|
||||
*/
|
||||
toolNumber: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark: string;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
createTime: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ContractorToolForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId?: string | number;
|
||||
|
||||
/**
|
||||
* 分包方id
|
||||
*/
|
||||
contractorId?: string | number;
|
||||
|
||||
/**
|
||||
* 工具名称
|
||||
*/
|
||||
toolName?: string;
|
||||
|
||||
/**
|
||||
* 工具类型
|
||||
*/
|
||||
toolType?: string;
|
||||
|
||||
/**
|
||||
* 工具型号
|
||||
*/
|
||||
toolModel?: string;
|
||||
|
||||
/**
|
||||
* 工具数量
|
||||
*/
|
||||
toolNumber?: string;
|
||||
|
||||
/**
|
||||
* 文件
|
||||
*/
|
||||
file?: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ContractorToolQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId?: string | number;
|
||||
|
||||
/**
|
||||
* 分包方id
|
||||
*/
|
||||
contractorId?: string | number;
|
||||
|
||||
/**
|
||||
* 工具名称
|
||||
*/
|
||||
toolName?: string;
|
||||
|
||||
/**
|
||||
* 工具类型
|
||||
*/
|
||||
toolType?: string;
|
||||
|
||||
/**
|
||||
* 工具型号
|
||||
*/
|
||||
toolModel?: string;
|
||||
|
||||
/**
|
||||
* 工具数量
|
||||
*/
|
||||
toolNumber?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,7 +163,7 @@ aside {
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
margin-top: 30px;
|
||||
// margin-top: 30px;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
|
@ -0,0 +1,343 @@
|
||||
<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="never">
|
||||
<el-descriptions border :column="2">
|
||||
<el-descriptions-item label="分包方">{{ info.contractorName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="物料名称">{{ info.materialName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="物料数量">{{ info.materialNumber }}</el-descriptions-item>
|
||||
</el-descriptions></el-card
|
||||
>
|
||||
<el-card shadow="hover" style="margin-top: 10px">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="使用情况" prop="usedPosition">
|
||||
<el-input v-model="queryParams.usedPosition" 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('1')">到货</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Minus" @click="handleAdd('2')">使用</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['contractor:contractorMaterialRecord:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-tabs v-model="activeName" type="border-card" class="demo-tabs" @tab-click="handleClick">
|
||||
<el-tab-pane label="到货" name="1">
|
||||
<el-table v-loading="loading" :data="contractorMaterialRecordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="分包方" align="center" prop="contractorName" />
|
||||
<el-table-column label="物料名称" align="center" prop="contractorMaterialName" />
|
||||
<!-- <el-table-column label="记录类型" align="center" prop="recordType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="contractor_material_record_type" :value="scope.row.recordType" />
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="记录时间" align="center" prop="recordTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.recordTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" align="center" prop="recordNumber" />
|
||||
<el-table-column label="使用情况" align="center" prop="usedPosition" />
|
||||
<el-table-column label="相关附件" align="center" prop="file" />
|
||||
<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="['contractor:contractorMaterialRecord:edit']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['contractor:contractorMaterialRecord: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-tab-pane>
|
||||
<el-tab-pane label="使用" name="2">
|
||||
<el-table v-loading="loading" :data="contractorMaterialRecordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="分包方" align="center" prop="contractorName" />
|
||||
<el-table-column label="物料名称" align="center" prop="contractorMaterialName" />
|
||||
<!-- <el-table-column label="记录类型" align="center" prop="recordType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="contractor_material_record_type" :value="scope.row.recordType" />
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="记录时间" align="center" prop="recordTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.recordTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" align="center" prop="recordNumber" />
|
||||
<el-table-column label="使用情况" align="center" prop="usedPosition" />
|
||||
<el-table-column label="相关附件" align="center" prop="file" />
|
||||
<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="['contractor:contractorMaterialRecord:edit']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['contractor:contractorMaterialRecord: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-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
</el-card>
|
||||
<!-- 添加或修改分包方物料记录对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="contractorMaterialRecordFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="记录时间" prop="recordTime">
|
||||
<el-date-picker clearable v-model="form.recordTime" type="date" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择记录时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="recordNumber">
|
||||
<el-input v-model="form.recordNumber" type="number" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="使用情况" prop="usedPosition">
|
||||
<el-input v-model="form.usedPosition" placeholder="请输入使用情况" />
|
||||
</el-form-item>
|
||||
<el-form-item label="相关附件" prop="file">
|
||||
<file-upload v-model="form.file" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" 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="ContractorMaterialRecord" lang="ts">
|
||||
import {
|
||||
listContractorMaterialRecord,
|
||||
getContractorMaterialRecord,
|
||||
delContractorMaterialRecord,
|
||||
addContractorMaterialRecord,
|
||||
updateContractorMaterialRecord
|
||||
} from '@/api/project/contractorMaterial/contractorMaterialRecord';
|
||||
import {
|
||||
ContractorMaterialRecordVO,
|
||||
ContractorMaterialRecordQuery,
|
||||
ContractorMaterialRecordForm
|
||||
} from '@/api/project/contractorMaterial/contractorMaterialRecord/types';
|
||||
import { getContractorMaterial } from '@/api/project/contractorMaterial';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { contractor_material_record_type } = toRefs<any>(proxy?.useDict('contractor_material_record_type'));
|
||||
|
||||
const contractorMaterialRecordList = ref<ContractorMaterialRecordVO[]>([]);
|
||||
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 contractorMaterialRecordFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: ContractorMaterialRecordForm = {
|
||||
id: undefined,
|
||||
contractorMaterialId: undefined,
|
||||
recordType: undefined,
|
||||
recordTime: undefined,
|
||||
recordNumber: undefined,
|
||||
remainingNumber: undefined,
|
||||
usedPosition: undefined,
|
||||
file: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
const info = ref({});
|
||||
const activeName = '1';
|
||||
const data = reactive<PageData<ContractorMaterialRecordForm, ContractorMaterialRecordQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: undefined,
|
||||
contractorId: undefined,
|
||||
contractorMaterialId: undefined,
|
||||
recordType: undefined,
|
||||
usedPosition: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
contractorMaterialId: [{ required: true, message: '物料id不能为空', trigger: 'blur' }],
|
||||
recordType: [{ required: true, message: '记录类型不能为空', trigger: 'change' }],
|
||||
recordTime: [{ required: true, message: '记录时间不能为空', trigger: 'blur' }],
|
||||
recordNumber: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询分包方物料记录列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listContractorMaterialRecord(queryParams.value);
|
||||
contractorMaterialRecordList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
contractorMaterialRecordFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ContractorMaterialRecordVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = (type) => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
form.value.recordType = type;
|
||||
dialog.title = '物料' + (type == 1 ? '到货' : '使用');
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: ContractorMaterialRecordVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getContractorMaterialRecord(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改物料记录';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
contractorMaterialRecordFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateContractorMaterialRecord(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addContractorMaterialRecord(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
getDetail(data.form.contractorMaterialId);
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ContractorMaterialRecordVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除分包方物料记录编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delContractorMaterialRecord(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
getDetail(data.form.contractorMaterialId);
|
||||
await getList();
|
||||
};
|
||||
const handleClick = (val) => {
|
||||
queryParams.value.pageNum = 1;
|
||||
queryParams.value.recordType = val.props.name;
|
||||
handleQuery();
|
||||
};
|
||||
const getDetail = async (_id) => {
|
||||
const res = await getContractorMaterial(_id);
|
||||
info.value = res.data;
|
||||
};
|
||||
const getAll = (obj) => {
|
||||
info.value = obj;
|
||||
initFormData.contractorMaterialId = obj.id;
|
||||
data.form.contractorMaterialId = obj.id;
|
||||
data.queryParams.contractorMaterialId = obj.id;
|
||||
getDetail(obj.id);
|
||||
getList();
|
||||
};
|
||||
defineExpose({
|
||||
getAll
|
||||
});
|
||||
</script>
|
330
src/views/project/contractorMaterial/index.vue
Normal file
330
src/views/project/contractorMaterial/index.vue
Normal file
@ -0,0 +1,330 @@
|
||||
<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="contractorId">
|
||||
<el-select v-model="queryParams.contractorId" filterable placeholder="请选择分包方">
|
||||
<el-option v-for="(item, i) of contractorList" :key="i" :label="item.name" :value="item.id"> </el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input v-model="queryParams.materialName" placeholder="请输入物料名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料类型" prop="materialType">
|
||||
<el-select v-model="queryParams.materialType" placeholder="请选择物料类型" clearable>
|
||||
<el-option v-for="dict in contractor_material_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料型号" prop="materialModel">
|
||||
<el-input v-model="queryParams.materialModel" 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="['contractor:contractorMaterial:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['contractor:contractorMaterial:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['contractor:contractorMaterial:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="contractorMaterialList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="分包方" align="center" prop="contractorName" />
|
||||
<el-table-column label="物料名称" align="center" prop="materialName" />
|
||||
<el-table-column label="物料类型" align="center" prop="materialType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="contractor_material_type" :value="scope.row.materialType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料型号" align="center" prop="materialModel" />
|
||||
<el-table-column label="物料数量" align="center" prop="materialNumber" />
|
||||
<el-table-column label="物料单位" align="center" prop="materialUnit" />
|
||||
<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="['contractor:contractorMaterial:edit']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['contractor:contractorMaterial:remove']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="出入库" placement="top">
|
||||
<el-button link type="primary" icon="view" @click="handleView(scope.row)" ></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 draggable :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="contractorMaterialFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="分包方" prop="contractorId">
|
||||
<el-select v-model="form.contractorId" filterable placeholder="请选择分包方">
|
||||
<el-option v-for="(item, i) of contractorList" :key="i" :label="item.name" :value="item.id"> </el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input v-model="form.materialName" placeholder="请输入物料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料类型" prop="materialType">
|
||||
<el-select v-model="form.materialType" placeholder="请选择物料类型">
|
||||
<el-option v-for="dict in contractor_material_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料型号" prop="materialModel">
|
||||
<el-input v-model="form.materialModel" placeholder="请输入物料型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料单位" prop="materialUnit">
|
||||
<el-input v-model="form.materialUnit" placeholder="请输入物料单位" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="文件" prop="file">
|
||||
<file-upload v-model="form.file" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" 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>
|
||||
<el-dialog draggable :title="dialogRecord.title" v-model="dialogRecord.visible" width="1500px" append-to-body>
|
||||
<div>
|
||||
<contractorMaterialRecord ref="contractorMaterialRecordRef" ></contractorMaterialRecord>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="ContractorMaterial" lang="ts">
|
||||
import {
|
||||
listContractorMaterial,
|
||||
getContractorMaterial,
|
||||
delContractorMaterial,
|
||||
addContractorMaterial,
|
||||
updateContractorMaterial
|
||||
} from '@/api/project/contractorMaterial';
|
||||
import contractorMaterialRecord from '@/views/project/contractorMaterial/component/contractorMaterialRecord.vue';
|
||||
import { ContractorMaterialVO, ContractorMaterialQuery, ContractorMaterialForm } from '@/api/project/contractorMaterial/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import { listContractor } from '@/api/project/contractor';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { contractor_material_type } = toRefs<any>(proxy?.useDict('contractor_material_type'));
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const contractorMaterialList = ref<ContractorMaterialVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const contractorMaterialRecordRef=ref(null)
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const contractorList = ref([]); //分包列表
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const contractorMaterialFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
// 出入库
|
||||
const dialogRecord = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: ContractorMaterialForm = {
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
contractorId: undefined,
|
||||
materialName: undefined,
|
||||
materialType: undefined,
|
||||
materialModel: undefined,
|
||||
materialUnit: undefined,
|
||||
file: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<ContractorMaterialForm, ContractorMaterialQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: currentProject.value.id,
|
||||
contractorId: undefined,
|
||||
materialName: undefined,
|
||||
materialType: undefined,
|
||||
materialModel: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
contractorId: [{ required: true, message: '分包方不能为空', trigger: 'blur' }],
|
||||
materialName: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }],
|
||||
materialUnit: [{ required: true, message: '物料单位不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询分包单位列表 */
|
||||
const getSubList = async () => {
|
||||
const res = await listContractor({
|
||||
pageNum: 1,
|
||||
pageSize: 10000,
|
||||
projectId: currentProject.value.id
|
||||
});
|
||||
contractorList.value = res.rows;
|
||||
};
|
||||
|
||||
/** 查询分包方物料列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listContractorMaterial(queryParams.value);
|
||||
contractorMaterialList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
contractorMaterialFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ContractorMaterialVO[]) => {
|
||||
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?: ContractorMaterialVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getContractorMaterial(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改分包方物料';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
contractorMaterialFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateContractorMaterial(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addContractorMaterial(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ContractorMaterialVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除分包方物料编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delContractorMaterial(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
form.value.projectId = nid;
|
||||
getSubList();
|
||||
getList();
|
||||
}
|
||||
);
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
const handleView = async (row: ContractorToolVO) => {
|
||||
// 打开弹框
|
||||
dialogRecord.visible=true;
|
||||
dialogRecord.title=row.materialName+"-物料出入库";
|
||||
await nextTick();
|
||||
contractorMaterialRecordRef.value.getAll(row);
|
||||
};
|
||||
onMounted(() => {
|
||||
getSubList();
|
||||
getList();
|
||||
});
|
||||
</script>
|
370
src/views/project/contractorTool/component/LevanAutbound.vue
Normal file
370
src/views/project/contractorTool/component/LevanAutbound.vue
Normal file
@ -0,0 +1,370 @@
|
||||
<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="never">
|
||||
<el-descriptions border :column="2">
|
||||
<el-descriptions-item label="分包方">{{ info.contractorName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工具名称">{{ info.toolName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工具型号">{{ info.toolModel }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工具数量">{{ info.toolNumber }}</el-descriptions-item>
|
||||
</el-descriptions></el-card
|
||||
>
|
||||
<el-card shadow="never" style="margin-top: 10px">
|
||||
<el-form ref="queryFormRef" label-width="110px" :model="queryParams" :inline="true">
|
||||
<el-form-item label="检测编号" prop="checkNum">
|
||||
<el-input v-model="queryParams.checkNum" placeholder="请输入检测编号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="检测部门" prop="checkDept">
|
||||
<el-input v-model="queryParams.checkDept" 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('1', '进场时间')" v-hasPermi="['contractor:contractorToolEntry:add']"
|
||||
>进场</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Minus" @click="handleAdd('2', '出场时间')" v-hasPermi="['contractor:contractorToolEntry:add']"
|
||||
>出场</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['contractor:contractorToolEntry:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-tabs v-model="activeName" type="border-card" class="demo-tabs" @tab-click="handleClick">
|
||||
<el-tab-pane label="进场" name="1">
|
||||
<el-table v-loading="loading" height="30vh" :data="contractorToolEntryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="分包方" align="center" prop="contractorName" />
|
||||
<el-table-column label="工器具数量" align="center" prop="recordNumber" />
|
||||
<el-table-column label="检测编号" align="center" prop="checkNum" />
|
||||
<el-table-column label="检测部门" align="center" prop="checkDept" />
|
||||
<el-table-column label="检测时间" align="center" prop="checkTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.checkTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合格证" align="center" prop="certificate" />
|
||||
|
||||
<el-table-column label="进场时间" align="center" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.recordTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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="['contractor:contractorToolEntry:edit']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['contractor:contractorToolEntry: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-tab-pane>
|
||||
<el-tab-pane label="出场" name="2">
|
||||
<el-table v-loading="loading" height="50vh" :data="contractorToolEntryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="分包方" align="center" prop="contractorName" />
|
||||
<el-table-column label="工器具数量" align="center" prop="recordNumber" />
|
||||
<el-table-column label="检测编号" align="center" prop="checkNum" />
|
||||
<el-table-column label="检测部门" align="center" prop="checkDept" />
|
||||
<el-table-column label="检测时间" align="center" prop="checkTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.checkTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="合格证" align="center" prop="certificate" /> -->
|
||||
<el-table-column label="出场时间" align="center" prop="recordTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.recordTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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="['contractor:contractorToolEntry:edit']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['contractor:contractorToolEntry: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-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="contractorToolEntryFormRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="工器具数量" prop="recordNumber">
|
||||
<el-input v-model="form.recordNumber" type="number" placeholder="请输入进场工器具数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="检测编号" prop="checkNum">
|
||||
<el-input v-model="form.checkNum" placeholder="请输入检测编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="检测部门" prop="checkDept">
|
||||
<el-input v-model="form.checkDept" placeholder="请输入检测部门" />
|
||||
</el-form-item>
|
||||
<el-form-item label="检测时间" prop="checkTime">
|
||||
<el-date-picker clearable v-model="form.checkTime" type="date" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择检测时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item :label="titleLable" prop="entryTime">
|
||||
<el-date-picker clearable v-model="form.entryTime" type="date" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择进场时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="合格证" prop="certificate">
|
||||
<file-upload v-model="form.certificate" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" 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="ContractorToolEntry" lang="ts">
|
||||
import {
|
||||
listContractorToolEntry,
|
||||
getContractorToolEntry,
|
||||
delContractorToolEntry,
|
||||
addContractorToolEntry,
|
||||
updateContractorToolEntry
|
||||
} from '@/api/project/contractorTool/contractorToolEntry';
|
||||
import { ContractorToolEntryVO, ContractorToolEntryQuery, ContractorToolEntryForm } from '@/api/project/contractorTool/contractorToolEntry/types';
|
||||
import { getContractorTool } from '@/api/project/contractorTool';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const contractorToolEntryList = ref<ContractorToolEntryVO[]>([]);
|
||||
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 contractorToolEntryFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
const titleLable = ref('进场时间');
|
||||
const initFormData: ContractorToolEntryForm = {
|
||||
id: undefined,
|
||||
contractorToolId: undefined,
|
||||
toolNumber: undefined,
|
||||
checkNum: undefined,
|
||||
checkDept: undefined,
|
||||
checkTime: undefined,
|
||||
certificate: undefined,
|
||||
remark: undefined,
|
||||
entryTime: undefined,
|
||||
recordType: undefined,
|
||||
recordNumber: undefined
|
||||
};
|
||||
const info = ref({});
|
||||
const data = reactive<PageData<ContractorToolEntryForm, ContractorToolEntryQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: currentProject.value.id,
|
||||
contractorId: undefined,
|
||||
contractorToolId: undefined,
|
||||
toolNumber: undefined,
|
||||
checkNum: undefined,
|
||||
checkDept: undefined,
|
||||
recordType: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
contractorToolId: [{ required: true, message: '分包方工器具不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const activeName = '1';
|
||||
/** 查询分包方工器具进场列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listContractorToolEntry(queryParams.value);
|
||||
contractorToolEntryList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
const getDetail = async (_id) => {
|
||||
const res = await getContractorTool(_id);
|
||||
info.value = res.data;
|
||||
};
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
contractorToolEntryFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ContractorToolEntryVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = (type, label) => {
|
||||
reset();
|
||||
titleLable.value = label;
|
||||
dialog.visible = true;
|
||||
form.value.recordType = type;
|
||||
dialog.title = '工器具'+(type==1?'进场':'出场');
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: ContractorToolEntryVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getContractorToolEntry(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改工器具';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
contractorToolEntryFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateContractorToolEntry(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addContractorToolEntry(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
getDetail(data.form.contractorToolId);
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ContractorToolEntryVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除分包方工器具进场编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delContractorToolEntry(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
getDetail(data.form.contractorToolId);
|
||||
await getList();
|
||||
};
|
||||
const handleClick = (val) => {
|
||||
queryParams.value.pageNum = 1;
|
||||
queryParams.value.recordType = val.props.name;
|
||||
handleQuery();
|
||||
};
|
||||
const getAll = (obj) => {
|
||||
info.value = obj;
|
||||
initFormData.contractorToolId = obj.id;
|
||||
data.form.contractorToolId = obj.id;
|
||||
data.queryParams.contractorToolId = obj.id;
|
||||
getDetail( obj.id);
|
||||
getList();
|
||||
};
|
||||
defineExpose({
|
||||
getAll
|
||||
});
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
</script>
|
329
src/views/project/contractorTool/index.vue
Normal file
329
src/views/project/contractorTool/index.vue
Normal file
@ -0,0 +1,329 @@
|
||||
<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="contractorId">
|
||||
<el-select v-model="queryParams.contractorId" filterable placeholder="请选择分包方">
|
||||
<el-option v-for="(item, i) of contractorList" :key="i" :label="item.name" :value="item.id"> </el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工具名称" prop="toolName">
|
||||
<el-input v-model="queryParams.toolName" placeholder="请输入工具名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工具类型" prop="toolType">
|
||||
<el-select v-model="queryParams.toolType" placeholder="请选择工具类型" clearable >
|
||||
<el-option v-for="dict in contractor_tool_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工具型号" prop="toolModel">
|
||||
<el-input v-model="queryParams.toolModel" placeholder="请输入工具型号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工具数量" prop="toolNumber">
|
||||
<el-input v-model="queryParams.toolNumber" 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="['project:contractorTool:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['project:contractorTool:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['project:contractorTool:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-table v-loading="loading" :data="contractorToolList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="分包方" align="center" prop="contractorName" />
|
||||
<el-table-column label="工具名称" align="center" prop="toolName" />
|
||||
<el-table-column label="工具类型" align="center" prop="toolType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="contractor_tool_type" :value="scope.row.toolType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工具型号" align="center" prop="toolModel" />
|
||||
<el-table-column label="工具数量" align="center" prop="toolNumber" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</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="['project:contractorTool:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:contractorTool:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="出入库" placement="top">
|
||||
<el-button link type="primary" icon="view" @click="handleView(scope.row)" ></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 draggable :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="contractorToolFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="分包方" prop="contractorId">
|
||||
<el-select v-model="form.contractorId" filterable placeholder="请选择分包方">
|
||||
<el-option v-for="(item, i) of contractorList" :key="i" :label="item.name" :value="item.id"> </el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工具名称" prop="toolName">
|
||||
<el-input v-model="form.toolName" placeholder="请输入工具名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工具类型" prop="toolType">
|
||||
<el-select v-model="form.toolType" placeholder="请选择工具类型">
|
||||
<el-option
|
||||
v-for="dict in contractor_tool_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工具型号" prop="toolModel">
|
||||
<el-input v-model="form.toolModel" placeholder="请输入工具型号" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="文件" prop="file">
|
||||
<file-upload v-model="form.file"/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" 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>
|
||||
<el-dialog draggable :title="dialogLevan.title" v-model="dialogLevan.visible" width="1500px" append-to-body>
|
||||
<div>
|
||||
<LevanAutbound ref="LevanAutboundRef" ></LevanAutbound>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="ContractorTool" lang="ts">
|
||||
import { listContractorTool, getContractorTool, delContractorTool, addContractorTool, updateContractorTool } from '@/api/project/contractorTool';
|
||||
import { ContractorToolVO, ContractorToolQuery, ContractorToolForm } from '@/api/project/contractorTool/types';
|
||||
import { listContractor, } from '@/api/project/contractor';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import LevanAutbound from '@/views/project/contractorTool/component/LevanAutbound.vue';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const { contractor_tool_type } = toRefs<any>(proxy?.useDict('contractor_tool_type'));
|
||||
|
||||
const contractorToolList = ref<ContractorToolVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const LevanAutboundRef=ref(null)
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const contractorList=ref([]);//分包列表
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const contractorToolFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
// 出入库
|
||||
const dialogLevan = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: ContractorToolForm = {
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
contractorId: undefined,
|
||||
toolName: undefined,
|
||||
toolType: undefined,
|
||||
toolModel: undefined,
|
||||
toolNumber: undefined,
|
||||
file: undefined,
|
||||
remark: undefined,
|
||||
}
|
||||
const data = reactive<PageData<ContractorToolForm, ContractorToolQuery>>({
|
||||
form: {...initFormData},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: currentProject.value.id,
|
||||
contractorId: undefined,
|
||||
toolName: undefined,
|
||||
toolType: undefined,
|
||||
toolModel: undefined,
|
||||
toolNumber: undefined,
|
||||
params: {
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
contractorId: [
|
||||
{ required: true, message: "分包方不能为空", trigger: "blur" },
|
||||
|
||||
],
|
||||
toolName: [
|
||||
{ required: true, message: "工具名称不能为空", trigger: "blur" },
|
||||
|
||||
],
|
||||
toolType: [
|
||||
{ required: true, message: "工具类型不能为空", trigger: "blur" },
|
||||
|
||||
],
|
||||
toolModel: [
|
||||
{ required: true, message: "工具数量不能为空", trigger: "blur" },
|
||||
|
||||
],
|
||||
toolNumber: [
|
||||
{ required: true, message: "分包方不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
});
|
||||
const { contractor_tool_record_type } = toRefs<any>(proxy?.useDict('contractor_tool_record_type'));
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询分包单位列表 */
|
||||
const getSubList = async () => {
|
||||
const res = await listContractor({
|
||||
pageNum: 1,
|
||||
pageSize: 10000,
|
||||
projectId: currentProject.value.id,
|
||||
});
|
||||
contractorList.value = res.rows;
|
||||
};
|
||||
|
||||
/** 查询分包方工器具列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listContractorTool(queryParams.value);
|
||||
contractorToolList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {...initFormData};
|
||||
contractorToolFormRef.value?.resetFields();
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ContractorToolVO[]) => {
|
||||
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?: ContractorToolVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const res = await getContractorTool(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改工器具";
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
contractorToolFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateContractorTool(form.value).finally(() => buttonLoading.value = false);
|
||||
} else {
|
||||
await addContractorTool(form.value).finally(() => buttonLoading.value = false);
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ContractorToolVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除分包方工器具编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await delContractorTool(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
await getList();
|
||||
}
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
form.value.projectId = nid;
|
||||
getSubList()
|
||||
getList();
|
||||
}
|
||||
);
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
const handleView = async (row: ContractorToolVO) => {
|
||||
// 打开弹框
|
||||
dialogLevan.visible=true;
|
||||
dialogLevan.title=row.toolName+"-工器具出入库";
|
||||
await nextTick();
|
||||
LevanAutboundRef.value.getAll(row);
|
||||
};
|
||||
onMounted(() => {
|
||||
getSubList();
|
||||
getList();
|
||||
});
|
||||
</script>
|
@ -131,8 +131,8 @@ import { useUserStoreHook } from '@/store/modules/user';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
const { subcontract_type } = toRefs<any>(proxy?.useDict('subcontract_type'));
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const { subcontract_type } = toRefs<any>(proxy?.useDict('subcontract_type'));
|
||||
const subcontractList = ref<SubcontractVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
|
Reference in New Issue
Block a user