| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /productionProductMain/startWork | 开始报工 |
请求参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| productionOperationTaskId | Long | 是 | 生产工单ID |
| userId | Long | 是 | 报工人员ID |
响应: { "code": 200, "msg": "操作成功", "data": true }
POST /productionProductMain/addProductMain(结束报工):
入参增加:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | Long | 是 | 开始报工返回的 ProductionProductMain ID |
GET /productionOperationTask/page、/productionOperationTask/list:
新增查询参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| filterMine | Boolean | 否 | 为 true 时仅返回当前用户被指派的工单 |
GET /productionProductMain/listPage、/page、/{id}:
新增响应字段:
| 参数 | 类型 | 说明 |
|---|---|---|
| actualStartTime | String | 实际开始时间 (yyyy-MM-dd HH:mm:ss) |
| actualEndTime | String | 实际结束时间 (yyyy-MM-dd HH:mm:ss) |
开始报工按钮:
<el-button type="primary" @click="handleStartWork">开始报工</el-button>
handleStartWork() {
this.$confirm('确认开始报工?', '提示', { type: 'info' }).then(() => {
startWork({
productionOperationTaskId: this.taskId,
userId: this.selectedUserId
}).then(res => {
this.startRecordId = res.data; // 保存返回的报工记录ID,供结束报工使用
this.$message.success('开始报工成功');
this.refreshTaskStatus();
});
});
}
结束报工按钮(原报工提交按钮改造):
<el-button type="success" @click="handleFinishWork" :disabled="!startRecordId">结束报工</el-button>
handleFinishWork() {
this.$refs.form.validate(valid => {
if (valid) {
addProductMain({
id: this.startRecordId, // 必须传入开始报工记录ID
quantity: this.form.quantity,
scrapQty: this.form.scrapQty,
userId: this.selectedUserId,
productionOperationParamList: this.paramList
}).then(() => {
this.$message.success('结束报工成功');
this.resetForm();
});
}
});
}
增加"仅看我的"筛选开关:
<el-switch v-model="filterMine" active-text="仅看我的" @change="handleFilterChange" />
data() {
return {
filterMine: false,
}
},
methods: {
handleFilterChange(val) {
this.loadTaskList();
},
loadTaskList() {
const params = { ...this.queryParams };
if (this.filterMine) {
params.filterMine = true;
}
listTask(params).then(res => {
this.taskList = res.rows;
});
}
}
台账中的 workHour 字段现在基于实际开始/结束时间自动计算(以小时为单位),前端直接展示即可,无需额外处理。
/startWork 开始,再调用 /addProductMain(传入开始报工返回的 id)结束[])时所有工人可操作;已指派时仅被指派人可操作startRecordId(开始报工返回的 ID),结束报工时传入status=0 的进行中报工记录来恢复 startRecordId