下料报工代码
This commit is contained in:
parent
e1f3685791
commit
b004bb5a9a
@ -53,6 +53,14 @@ public class TaskInReportController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 返工
|
||||||
|
@PostMapping("/rework")
|
||||||
|
@Operation(summary = "返工")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:task-in-report:update')")
|
||||||
|
public CommonResult<Boolean> rework(@Valid @RequestBody TaskReworkReqVO reworkReqVO) {
|
||||||
|
taskInReportService.rework(reworkReqVO.getId(), reworkReqVO.getRemark());
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除下料报工")
|
@Operation(summary = "删除下料报工")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public class TaskInReportSaveReqVO {
|
|||||||
@Schema(description = "报工日期")
|
@Schema(description = "报工日期")
|
||||||
private LocalDateTime reportTime;
|
private LocalDateTime reportTime;
|
||||||
|
|
||||||
@Schema(description = "长度(半径)")
|
@Schema(description = "长度(直径)")
|
||||||
private BigDecimal length;
|
private BigDecimal length;
|
||||||
|
|
||||||
@Schema(description = "是否已报工 0 默认否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "是否已报工 0 默认否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.controller.admin.taskinreport.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TaskReworkReqVO {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@ -104,6 +104,10 @@ public class TaskDispatchDetailDO extends BaseDO {
|
|||||||
private Long projectMaterialPlanDetailId;
|
private Long projectMaterialPlanDetailId;
|
||||||
private Integer planStatus;
|
private Integer planStatus;
|
||||||
private Integer isReport;
|
private Integer isReport;
|
||||||
|
|
||||||
|
private Integer inReportProcess;
|
||||||
|
private String returnRemark;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工序状态 默认 已提交 已完成 0 1 2
|
* 工序状态 默认 已提交 已完成 0 1 2
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -29,6 +29,13 @@ public interface TaskInReportService {
|
|||||||
*/
|
*/
|
||||||
void updateTaskInReport(@Valid TaskInReportSaveReqVO updateReqVO);
|
void updateTaskInReport(@Valid TaskInReportSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返工
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void rework(Long id, String remark);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除下料报工
|
* 删除下料报工
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
package com.chanko.yunxi.mes.module.heli.service.taskinreport;
|
package com.chanko.yunxi.mes.module.heli.service.taskinreport;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDetailDO;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.mysql.taskdispatch.TaskDispatchDetailMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import com.chanko.yunxi.mes.module.heli.controller.admin.taskinreport.vo.*;
|
import com.chanko.yunxi.mes.module.heli.controller.admin.taskinreport.vo.*;
|
||||||
@ -11,6 +16,8 @@ import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
|||||||
|
|
||||||
import com.chanko.yunxi.mes.module.heli.dal.mysql.taskinreport.TaskInReportMapper;
|
import com.chanko.yunxi.mes.module.heli.dal.mysql.taskinreport.TaskInReportMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
|
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
@ -26,6 +33,9 @@ public class TaskInReportServiceImpl implements TaskInReportService {
|
|||||||
@Resource
|
@Resource
|
||||||
private TaskInReportMapper taskInReportMapper;
|
private TaskInReportMapper taskInReportMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TaskDispatchDetailMapper taskDispatchDetailMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createTaskInReport(TaskInReportSaveReqVO createReqVO) {
|
public Long createTaskInReport(TaskInReportSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@ -45,9 +55,32 @@ public class TaskInReportServiceImpl implements TaskInReportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public void rework(Long id, String remark) {
|
||||||
|
TaskInReportDO taskInReportDO = taskInReportMapper.selectById(id);
|
||||||
|
TaskDispatchDetailDO taskDispatchDetailDO = taskDispatchDetailMapper.selectById(taskInReportDO.getDispatchDetailId());
|
||||||
|
if (taskDispatchDetailDO != null) {
|
||||||
|
if (taskDispatchDetailDO.getInReportProcess() != 2) {
|
||||||
|
throw new RuntimeException("当前报工状态不允许重新报工");
|
||||||
|
}
|
||||||
|
taskDispatchDetailDO.setInReportProcess(1);
|
||||||
|
taskDispatchDetailDO.setReturnRemark(remark);
|
||||||
|
taskDispatchDetailMapper.updateById(taskDispatchDetailDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
public void deleteTaskInReport(Long id) {
|
public void deleteTaskInReport(Long id) {
|
||||||
// 校验存在
|
TaskInReportDO taskInReportDO = taskInReportMapper.selectById(id);
|
||||||
validateTaskInReportExists(id);
|
TaskDispatchDetailDO taskDispatchDetailDO = taskDispatchDetailMapper.selectById(taskInReportDO.getDispatchDetailId());
|
||||||
|
if (taskDispatchDetailDO != null) {
|
||||||
|
if (taskDispatchDetailDO.getInReportProcess() != 2) {
|
||||||
|
throw new RuntimeException("当前报工状态不允许删除");
|
||||||
|
} else {
|
||||||
|
taskDispatchDetailDO.setInReportProcess(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 删除
|
// 删除
|
||||||
taskInReportMapper.deleteById(id);
|
taskInReportMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
@ -60,7 +93,9 @@ public class TaskInReportServiceImpl implements TaskInReportService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaskInReportDO getTaskInReport(Long id) {
|
public TaskInReportDO getTaskInReport(Long id) {
|
||||||
return taskInReportMapper.selectById(id);
|
TaskInReportDO taskInReportDO = taskInReportMapper.selectById(id);
|
||||||
|
|
||||||
|
return taskInReportDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
104
mes-ui/mes-ui-admin-vue3/src/api/heli/taskinreport/index.ts
Normal file
104
mes-ui/mes-ui-admin-vue3/src/api/heli/taskinreport/index.ts
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export interface TaskInReportVO {
|
||||||
|
id: number
|
||||||
|
dispatchDetailId: number
|
||||||
|
owner: number
|
||||||
|
amount: number
|
||||||
|
reportTime: Date
|
||||||
|
length: number
|
||||||
|
hasReport: boolean
|
||||||
|
status: boolean
|
||||||
|
workType: string
|
||||||
|
remark: string
|
||||||
|
widht: number
|
||||||
|
hight: number
|
||||||
|
density: number
|
||||||
|
weight: number
|
||||||
|
price: number
|
||||||
|
reportPrice: number
|
||||||
|
matType: string
|
||||||
|
formalId: number
|
||||||
|
calFormal: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询下料报工分页
|
||||||
|
export const getTaskInReportPage = async (params) => {
|
||||||
|
return await request.get({ url: `/heli/task-in-report/page`, params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询下料报工详情
|
||||||
|
export const getTaskInReport = async (id: number) => {
|
||||||
|
return await request.get({ url: `/heli/task-in-report/get?id=` + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增下料报工
|
||||||
|
export const createTaskInReport = async (data: TaskInReportVO) => {
|
||||||
|
return await request.post({ url: `/heli/task-in-report/create`, data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改下料报工
|
||||||
|
export const updateTaskInReport = async (data: TaskInReportVO) => {
|
||||||
|
return await request.put({ url: `/heli/task-in-report/update`, data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返工
|
||||||
|
export const rework = async (data: TaskInReportVO) => {
|
||||||
|
return await request.post({url: `/heli/task-in-report/rework`, data})
|
||||||
|
}
|
||||||
|
// 删除下料报工
|
||||||
|
export const deleteTaskInReport = async (id: number) => {
|
||||||
|
return await request.delete({ url: `/heli/task-in-report/delete?id=` + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出下料报工 Excel
|
||||||
|
export const exportTaskInReport = async (params) => {
|
||||||
|
return await request.download({ url: `/heli/task-in-report/export-excel`, params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 物料类型选项
|
||||||
|
export const matTypeOptions = [
|
||||||
|
{value: "1", label: "块料"},
|
||||||
|
{value: "2", label: "棒料"},
|
||||||
|
{value: "3", label: "方料"}
|
||||||
|
];
|
||||||
|
|
||||||
|
/** 获取下料类型 */
|
||||||
|
export const getMatType = ({value}: { value: any }) => {
|
||||||
|
// 从选项数组中查找对应的标签
|
||||||
|
const option = matTypeOptions.find(item => item.value === value);
|
||||||
|
return option ? option.label : "未知类型";
|
||||||
|
};
|
||||||
|
|
||||||
|
// 报工状态配置
|
||||||
|
const reportStatusConfig = {
|
||||||
|
0: { label: "未报工", color: "#909399" },
|
||||||
|
1: { label: "已报工", color: "#E6A23C" },
|
||||||
|
2: { label: "报工完成", color: "#67C23A" }
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取报工状态 */
|
||||||
|
export const getReportStatus = ({value}: { value: any }) => {
|
||||||
|
// 处理各种可能的数据类型和空值情况
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return "未知状态";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为数字进行比较
|
||||||
|
const numValue = Number(value);
|
||||||
|
const status = reportStatusConfig[numValue];
|
||||||
|
|
||||||
|
return status ? status.label : `未知状态(${value})`;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取报工状态颜色 */
|
||||||
|
export const getReportStatusColor = (value: any) => {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return '#909399'; // 灰色
|
||||||
|
}
|
||||||
|
|
||||||
|
const numValue = Number(value);
|
||||||
|
const status = reportStatusConfig[numValue];
|
||||||
|
|
||||||
|
return status ? status.color : '#909399';
|
||||||
|
};
|
||||||
@ -7,14 +7,14 @@ export const fenToYuanFormat = (_, __, cellValue: any, ___) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 数字格式化为两位小数 */
|
/** 数字格式化为两位小数 */
|
||||||
const formatNumber = (row: any, column: any, cellValue: any) => {
|
// 格式化金额:保留两位小数,加千分位逗号
|
||||||
if (cellValue === null || cellValue === undefined) {
|
export const formatAmount = (row, column, cellValue) => {
|
||||||
return '-'
|
if (cellValue == null || cellValue === '') return ''
|
||||||
}
|
|
||||||
// 确保是数字类型后再格式化
|
// 转为数字
|
||||||
const num = Number(cellValue)
|
const num = Number(cellValue)
|
||||||
if (isNaN(num)) {
|
if (isNaN(num)) return cellValue
|
||||||
return cellValue
|
|
||||||
}
|
// 使用 toFixed(2) 保证两位小数,再用 toLocaleString 加千分位
|
||||||
return num.toFixed(2)
|
return num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,14 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="物料类型" prop="matType">
|
<el-form-item label="物料类型" prop="matType">
|
||||||
<el-select v-model="formData.matType" class="!w-260px" disabled/>
|
<el-select v-model="formData.matType" class="!w-260px" disabled>
|
||||||
|
<el-option
|
||||||
|
v-for="item in TaskInReportApi.matTypeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
@ -34,25 +41,40 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="长(直径)(mm)" prop="length">
|
<el-form-item label="长(直径)(mm)" prop="length">
|
||||||
<el-input-number v-model="formData.length" min="0" :precision="2"
|
<el-input-number v-model="formData.length" min="0.01" :precision="2"
|
||||||
placeholder="请输入密度"
|
placeholder="请输入密度"
|
||||||
@change="handleDimensionChange"
|
@change="handleChange"
|
||||||
class="!w-260px"/>
|
class="!w-260px"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="高度(mm)" prop="hight">
|
<el-form-item label="高度(mm)" prop="hight">
|
||||||
<el-input-number v-model="formData.hight" min="0" :precision="2"
|
<el-input-number v-model="formData.hight" min="0.01" :precision="2"
|
||||||
placeholder="请输入高度"
|
placeholder="请输入高度"
|
||||||
@change="handleDimensionChange"
|
@change="handleChange"
|
||||||
class="!w-260px"/>
|
class="!w-260px"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="宽度(mm)" prop="widht">
|
<el-form-item
|
||||||
<el-input-number v-model="formData.widht" min="0" :precision="2"
|
:label="formData.matType === '1' || formData.matType === '3' ? '宽度(mm)*' : '宽度(mm)'"
|
||||||
placeholder="请输入单价"
|
prop="widht"
|
||||||
@change="handleDimensionChange"
|
:required="formData.matType === '1' || formData.matType === '3'"
|
||||||
|
>
|
||||||
|
<el-input-number
|
||||||
|
v-if="formData.matType === '1' || formData.matType === '3'"
|
||||||
|
v-model="formData.widht"
|
||||||
|
min="0"
|
||||||
|
:precision="2"
|
||||||
|
placeholder="请输入宽度"
|
||||||
|
@change="handleChange"
|
||||||
|
class="!w-260px"/>
|
||||||
|
<el-input-number
|
||||||
|
v-else
|
||||||
|
v-model="formData.widht"
|
||||||
|
:disabled="true"
|
||||||
|
min="0"
|
||||||
|
:precision="2"
|
||||||
class="!w-260px"/>
|
class="!w-260px"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -103,6 +125,7 @@ import * as TaskInReportApi from '@/api/heli/taskinreport'
|
|||||||
|
|
||||||
const {t} = useI18n() // 国际化
|
const {t} = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
import {formatAmount} from '@/utils/formatter'
|
||||||
|
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
@ -132,7 +155,6 @@ const formData = ref({
|
|||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
length: [{required: true, message: '长(直径)不能为空', trigger: 'blur'}],
|
length: [{required: true, message: '长(直径)不能为空', trigger: 'blur'}],
|
||||||
hight: [{required: true, message: '高度不能为空', trigger: 'blur'}],
|
hight: [{required: true, message: '高度不能为空', trigger: 'blur'}],
|
||||||
widht: [{required: true, message: '宽度是不能为空', trigger: 'blur'}],
|
|
||||||
weight: [{required: true, message: '重量不能为空', trigger: 'blur'}],
|
weight: [{required: true, message: '重量不能为空', trigger: 'blur'}],
|
||||||
reportPrice: [{required: true, message: '总价不能为空', trigger: 'blur'}],
|
reportPrice: [{required: true, message: '总价不能为空', trigger: 'blur'}],
|
||||||
})
|
})
|
||||||
@ -161,6 +183,16 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
|
|||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
// 校验表单
|
// 校验表单
|
||||||
await formRef.value.validate()
|
await formRef.value.validate()
|
||||||
|
if (formData.value.matType === '1' || formData.value.matType === '3') {
|
||||||
|
if (formData.value.widht == 0) {
|
||||||
|
message.error('宽度不能为0');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (formData.value.reportPrice === 0) {
|
||||||
|
//弹出提示,本次下料总价为0,是否继续
|
||||||
|
await message.confirm('本次下料总价为0,是否继续?')
|
||||||
|
}
|
||||||
// 提交请求
|
// 提交请求
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
@ -180,6 +212,11 @@ const submitForm = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleChange = () => {
|
||||||
|
handleDimensionChange();
|
||||||
|
handleReportPriceChange();
|
||||||
|
};
|
||||||
|
|
||||||
const handleReportPriceChange = () => {
|
const handleReportPriceChange = () => {
|
||||||
if (formData.value.weight) {
|
if (formData.value.weight) {
|
||||||
formData.value.reportPrice = Number((formData.value.weight * formData.value.price).toFixed(2));
|
formData.value.reportPrice = Number((formData.value.weight * formData.value.price).toFixed(2));
|
||||||
@ -200,11 +237,12 @@ const handleDimensionChange = () => {
|
|||||||
let totalWeight = 0;
|
let totalWeight = 0;
|
||||||
if (formData.value.matType === "1" || formData.value.matType === "3") {
|
if (formData.value.matType === "1" || formData.value.matType === "3") {
|
||||||
if (!validateNumericValue(formData.value.widht)) {
|
if (!validateNumericValue(formData.value.widht)) {
|
||||||
|
message.error('宽度不能为0');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
totalWeight = Number(
|
totalWeight = Number(
|
||||||
(formData.value.length * formData.value.widht * formData.value.hight * formData.value.density) /
|
(formData.value.length * formData.value.widht * formData.value.hight * formData.value.density) /
|
||||||
1000000 * 100
|
1000000
|
||||||
).toFixed(2);
|
).toFixed(2);
|
||||||
}
|
}
|
||||||
if (formData.value.matType === "2") {
|
if (formData.value.matType === "2") {
|
||||||
@ -215,14 +253,7 @@ const handleDimensionChange = () => {
|
|||||||
}
|
}
|
||||||
return totalWeight;
|
return totalWeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
formData.value.weight = calculateWeight();
|
formData.value.weight = calculateWeight();
|
||||||
|
|
||||||
if (validateNumericValue(formData.value.weight) && validateNumericValue(formData.value.price)) {
|
|
||||||
formData.value.reportPrice = Number(formData.value.weight * formData.value.price).toFixed(2);
|
|
||||||
} else {
|
|
||||||
formData.value.reportPrice = 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
364
mes-ui/mes-ui-admin-vue3/src/views/heli/taskinreport/index.vue
Normal file
364
mes-ui/mes-ui-admin-vue3/src/views/heli/taskinreport/index.vue
Normal file
@ -0,0 +1,364 @@
|
|||||||
|
<template>
|
||||||
|
<el-card class="hl-card">
|
||||||
|
<template #header>
|
||||||
|
<span>下料报工记录</span>
|
||||||
|
</template>
|
||||||
|
<ContentWrap class="fixed-search">
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="110px"
|
||||||
|
>
|
||||||
|
<el-form-item label="报工日期" prop="endTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.endTime"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
class="!w-280px"
|
||||||
|
:clearable="false"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目编号" prop="projectCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.projectCode"
|
||||||
|
placeholder="请输入项目编号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-280px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目名称" prop="projectName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.projectName"
|
||||||
|
placeholder="请输入项目名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-280px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="子项目名称" prop="projectSubName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.projectSubName"
|
||||||
|
placeholder="请输入子项目名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-280px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="零件名称" prop="materialName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.materialName"
|
||||||
|
placeholder="请输入零件名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-280px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="报工人" prop="OwnerName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.ownerName"
|
||||||
|
placeholder="请输入报工人名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-280px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item style="margin-left: 20px">
|
||||||
|
<el-button @click="handleQuery" type="primary">
|
||||||
|
<Icon icon="ep:search" class="mr-5px"/>
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="resetQuery">
|
||||||
|
<Icon icon="ep:refresh" class="mr-5px"/>
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="handleExport"
|
||||||
|
:loading="exportLoading"
|
||||||
|
v-hasPermi="['heli:project-order:export']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px"/>
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<ContentWrap class="table-container">
|
||||||
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" class="hl-table"
|
||||||
|
height="500px">
|
||||||
|
<el-table-column fixed type="index" width="100" label="序号" align="center"/>
|
||||||
|
<el-table-column fixed label="项目编号" align="center" prop="projectCode" width="200"/>
|
||||||
|
<el-table-column fixed label="项目名称" align="center" prop="projectName" width="160"/>
|
||||||
|
<el-table-column fixed label="子项目名称" align="center" prop="projectSubName" width="160"/>
|
||||||
|
<!-- <el-table-column label="子项目编号" align="center" prop="projectSubCode" width="260" />-->
|
||||||
|
<!-- <el-table-column label="派工单号" align="center" prop="dispatchCode" width="180" />-->
|
||||||
|
<el-table-column label="零件名称" align="center" prop="materialName" width="180"/>
|
||||||
|
<!-- <el-table-column label="规格型号" align="center" prop="spec" width="160" />-->
|
||||||
|
<el-table-column label="报工人" align="center" prop="ownerName" width="100"/>
|
||||||
|
<el-table-column label="报工状态" align="center" prop="reportProcess" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<span :style="{
|
||||||
|
color: getReportStatusColor(scope.row.reportProcess),
|
||||||
|
fontWeight: 'bold'
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
{{ getReportStatus({value: scope.row.reportProcess}) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="报工工序" align="center" prop="procedureName" width="160"/>
|
||||||
|
<el-table-column label="下料类型" align="center" prop="matType" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ getMatType({value: scope.row.matType}) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="长(直径)(mm)" align="center" prop="length" :formatter="formatAmount" width="220"/>
|
||||||
|
<el-table-column label="宽(mm)" align="center" prop="widht" :formatter="formatAmount" width="160"/>
|
||||||
|
<el-table-column label="高(mm)" align="center" prop="hight" :formatter="formatAmount" width="160"/>
|
||||||
|
<el-table-column label="密度(mm)" align="center" prop="density" :formatter="formatAmount" width="160"/>
|
||||||
|
<el-table-column label="总价(元)" align="center" prop="reportPrice" :formatter="formatAmount" width="160"/>
|
||||||
|
<el-table-column label="报工日期" align="center" prop="reportTime" :formatter="dateFormatter2" width="120"/>
|
||||||
|
<el-table-column label="修改人" align="center" prop="updaterName" width="160"/>
|
||||||
|
<el-table-column label="修改时间" align="center" prop="updateTime" :formatter="dateFormatter2" width="120"/>
|
||||||
|
<el-table-column label="修改原因" align="center" prop="remark" width="160"/>
|
||||||
|
<el-table-column fixed="right" label="操作" align="center" width="140">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
v-hasPermi="['heli:task-in-report:update']"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.reportProcess == 2"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="handleRework(scope.row.id, scope.row.reportProcess)"
|
||||||
|
>
|
||||||
|
返工
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
<TaskInReportForm ref="formRef" @success="getList"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {getIntDictOptions, DICT_TYPE} from '@/utils/dict'
|
||||||
|
import {dateFormatter2} from '@/utils/formatTime'
|
||||||
|
import {formatAmount} from '@/utils/formatter'
|
||||||
|
import download from '@/utils/download'
|
||||||
|
import * as TaskInReportApi from '@/api/heli/taskinreport'
|
||||||
|
import TaskInReportForm from './TaskInReportForm.vue'
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
|
import {Setting} from "@element-plus/icons-vue";
|
||||||
|
import ElTooltip from "element-plus/es/components/tooltip";
|
||||||
|
import {method} from "lodash-es";
|
||||||
|
|
||||||
|
defineOptions({name: 'TaskReport'})
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const {t} = useI18n() // 国际化
|
||||||
|
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const list = ref([]) // 列表的数据
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
projectCode: undefined,
|
||||||
|
projectName: undefined,
|
||||||
|
projectSubName: undefined,
|
||||||
|
materialName: undefined,
|
||||||
|
dispatchDetailId: undefined,
|
||||||
|
owner: undefined,
|
||||||
|
amount: undefined,
|
||||||
|
startTime: [],
|
||||||
|
endTime: [],
|
||||||
|
reportTime: [],
|
||||||
|
hasReport: undefined,
|
||||||
|
status: undefined,
|
||||||
|
createTime: [],
|
||||||
|
ownerName: undefined,
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
dispatchDetailId: undefined,
|
||||||
|
owner: undefined,
|
||||||
|
amount: undefined,
|
||||||
|
reportTime: undefined,
|
||||||
|
length: undefined,
|
||||||
|
hasReport: undefined,
|
||||||
|
status: undefined,
|
||||||
|
workType: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
widht: undefined as number | undefined,
|
||||||
|
hight: undefined as number | undefined,
|
||||||
|
density: undefined as number | undefined,
|
||||||
|
weight: undefined as number | undefined,
|
||||||
|
price: undefined as number | undefined,
|
||||||
|
reportPrice: undefined as number | undefined,
|
||||||
|
matType: undefined,
|
||||||
|
formalId: undefined,
|
||||||
|
calFormal: undefined,
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 查询列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await TaskInReportApi.getTaskInReportPage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
setDefaultDate();
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const formRef = ref()
|
||||||
|
const openForm = (type: string, id?: number) => {
|
||||||
|
formRef.value.open(type, id)
|
||||||
|
}
|
||||||
|
// 返工
|
||||||
|
|
||||||
|
const handleRework = async (id: number, status?: number) => {
|
||||||
|
if (status != "2") {
|
||||||
|
message.error('该报工没有完成,不允许返工');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const {value} = await message.prompt('请输入返工原因');
|
||||||
|
|
||||||
|
// 构建更新数据
|
||||||
|
const updateData = {
|
||||||
|
id: id,
|
||||||
|
remark: value,
|
||||||
|
} as TaskInReportApi.TaskInReportVO;
|
||||||
|
|
||||||
|
// 执行更新
|
||||||
|
await TaskInReportApi.rework(updateData);
|
||||||
|
message.success('返工操作成功');
|
||||||
|
|
||||||
|
// 刷新列表
|
||||||
|
await getList();
|
||||||
|
} catch (error) {
|
||||||
|
// 只在非取消操作时显示错误
|
||||||
|
if (error !== 'cancel' && error !== 'closed') {
|
||||||
|
console.error('返工操作失败:', error);
|
||||||
|
message.error('返工操作失败,请重试');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await TaskInReportApi.deleteTaskInReport(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 设置默认时间为当天
|
||||||
|
const setDefaultDate = () => {
|
||||||
|
queryParams.endTime = [
|
||||||
|
dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
]
|
||||||
|
}
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
if (!list.value || list.value.length == 0) {
|
||||||
|
message.warning(t('common.selectText'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let idList = [];
|
||||||
|
list.value.forEach(p => {
|
||||||
|
idList.push(p.id)
|
||||||
|
})
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await TaskInReportApi.exportTaskInReport({"idList": idList})
|
||||||
|
download.excel(data, '每日报工记录.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
setDefaultDate()
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
/* 固定搜索栏样式 */
|
||||||
|
.fixed-search {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
background: white;
|
||||||
|
padding: 16px;
|
||||||
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表格容器预留顶部空间 */
|
||||||
|
.table-container {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 可选:调整搜索表单间距 */
|
||||||
|
.el-form-item {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user