Browse Source

2025-10-17

过站采集报工增加上下岗操作
master
fengyuan_yang 6 months ago
parent
commit
0a0c323f7e
  1. 5
      src/views/modules/yieldReport/com_finish_roll.vue
  2. 151
      src/views/modules/yieldReport/com_switch_operator.vue

5
src/views/modules/yieldReport/com_finish_roll.vue

@ -25,9 +25,8 @@
<el-button class="customer-bun-min" type="primary" @click="closeDialog" style="margin-left: 10px; margin-bottom: 5px;"> <el-button class="customer-bun-min" type="primary" @click="closeDialog" style="margin-left: 10px; margin-bottom: 5px;">
{{buttons.closeButton}}</el-button> {{buttons.closeButton}}</el-button>
</el-form-item> </el-form-item>
<el-form-item class="customer-button">
<el-button class="customer-bun-min" type="primary" @click="openAttendanceModal" style="margin-left: 10px; margin-bottom: 5px;">
考勤修改</el-button>
<el-form-item label=" ">
<el-button type="primary" @click="openAttendanceModal" style="margin-left: 10px">考勤修改</el-button>
</el-form-item> </el-form-item>
<!-- <el-button v-if="showDefault" @click="saveMultiLanguage()" type="primary">多语言设置</el-button>--> <!-- <el-button v-if="showDefault" @click="saveMultiLanguage()" type="primary">多语言设置</el-button>-->
</el-col> </el-col>

151
src/views/modules/yieldReport/com_switch_operator.vue

@ -327,7 +327,7 @@ export default {
this.titleCon = isAttendanceMode ? '考勤修改' : this.labels.componentTitle;// this.titleCon = isAttendanceMode ? '考勤修改' : this.labels.componentTitle;//
}, },
//
// is_on_duty = 'Y'
loadOperatorList() { loadOperatorList() {
if (!this.currentSchedule.orderNo || !this.currentSchedule.seqNo) { if (!this.currentSchedule.orderNo || !this.currentSchedule.seqNo) {
return; return;
@ -337,7 +337,7 @@ export default {
orderNo: this.currentSchedule.orderNo, orderNo: this.currentSchedule.orderNo,
itemNo: this.currentSchedule.itemNo, itemNo: this.currentSchedule.itemNo,
seqNo: this.currentSchedule.seqNo, seqNo: this.currentSchedule.seqNo,
isOnDuty: 'Y'
isOnDuty: 'Y' //
}; };
getOperatorList2(params).then(({ data }) => { getOperatorList2(params).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
@ -408,20 +408,30 @@ export default {
}); });
}, },
// ()
//
updateOperatorTime(row) { updateOperatorTime(row) {
//
const validateResult = this.validateOperatorTime(row);
if (!validateResult.valid) {
this.$message.error(validateResult.message);
return;
}
this.$confirm('确定更新该操作员的上下岗时间吗?', '提示', {
this.$confirm('确定让该操作员下岗吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// 使
let offDutyTime = row.offDutyTime;
if (!offDutyTime) {
const now = new Date();
offDutyTime = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`;
}
//
if (row.onDutyTime && offDutyTime) {
const onDuty = new Date(row.onDutyTime);
const offDuty = new Date(offDutyTime);
if (offDuty < onDuty) {
this.$message.error('下岗时间不能早于上岗时间!');
return;
}
}
const params = { const params = {
id: row.id, id: row.id,
site: this.$store.state.user.site, site: this.$store.state.user.site,
@ -429,20 +439,19 @@ export default {
itemNo: this.currentSchedule.itemNo, itemNo: this.currentSchedule.itemNo,
seqNo: this.currentSchedule.seqNo, seqNo: this.currentSchedule.seqNo,
operator: row.operator, operator: row.operator,
onDutyTime: row.onDutyTime,
offDutyTime: row.offDutyTime
offDutyTime: offDutyTime
}; };
updateOperatorTime(params).then(({ data }) => {
removeOperatorOnDuty(params).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message.success('操作员时间更新成功!');
this.$message.success('操作员下岗成功!');
// //
this.loadOperatorList(); this.loadOperatorList();
} else { } else {
this.$message.error(data.msg || '操作员时间更新失败!');
this.$message.error(data.msg || '操作员下岗失败!');
} }
}).catch(() => { }).catch(() => {
this.$message.error('操作员时间更新失败!');
this.$message.error('操作员下岗失败!');
}); });
}).catch(() => { }).catch(() => {
// //
@ -451,9 +460,9 @@ export default {
// //
validateOperatorTime(row) { validateOperatorTime(row) {
//
//
if (!row.onDutyTime) { if (!row.onDutyTime) {
return { valid: true };
return { valid: false, message: '上岗时间不能为空!' };
} }
const now = new Date(); const now = new Date();
@ -533,54 +542,82 @@ export default {
// Promise // Promise
batchUpdateOperatorTimeSync() { batchUpdateOperatorTimeSync() {
return new Promise((resolve, reject) => {
return new Promise(async (resolve, reject) => {
// //
if (!this.operatorList || this.operatorList.length === 0) { if (!this.operatorList || this.operatorList.length === 0) {
resolve(); resolve();
return; return;
} }
//
for (let i = 0; i < this.operatorList.length; i++) {
const row = this.operatorList[i];
const validateResult = this.validateOperatorTime(row);
if (!validateResult.valid) {
this.$message.error(`${i + 1} 行:${validateResult.message}`);
reject();
return;
try {
//
const offDutyList = []; //
const updateOnDutyList = []; //
for (let i = 0; i < this.operatorList.length; i++) {
const row = this.operatorList[i];
//
if (!row.onDutyTime) {
this.$message.error(`${i + 1} 行:上岗时间不能为空!`);
reject();
return;
}
if (row.offDutyTime) {
//
const onDuty = new Date(row.onDutyTime);
const offDuty = new Date(row.offDutyTime);
if (offDuty < onDuty) {
this.$message.error(`${i + 1} 行:下岗时间不能早于上岗时间!`);
reject();
return;
}
offDutyList.push({
id: row.id,
operator: row.operator,
offDutyTime: row.offDutyTime
});
} else {
//
updateOnDutyList.push({
id: row.id,
operator: row.operator,
onDutyTime: row.onDutyTime
});
}
} }
}
//
const operatorListData = this.operatorList.map(row => ({
id: row.id,
operator: row.operator,
onDutyTime: row.onDutyTime,
offDutyTime: row.offDutyTime
}));
const params = {
site: this.$store.state.user.site,
orderNo: this.currentSchedule.orderNo,
itemNo: this.currentSchedule.itemNo,
seqNo: this.currentSchedule.seqNo,
operatorList: operatorListData
};
//
const params = {
site: this.$store.state.user.site,
orderNo: this.currentSchedule.orderNo,
itemNo: this.currentSchedule.itemNo,
seqNo: this.currentSchedule.seqNo,
offDutyList: offDutyList,
updateOnDutyList: updateOnDutyList
};
batchUpdateOperatorTime(params).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('考勤信息批量更新成功!');
//
this.loadOperatorList();
resolve();
} else {
this.$message.error(data.msg || '考勤信息批量更新失败!');
batchUpdateOperatorTime(params).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('考勤信息批量更新成功!');
//
this.loadOperatorList();
resolve();
} else {
this.$message.error(data.msg || '考勤信息批量更新失败!');
reject();
}
}).catch(() => {
this.$message.error('考勤信息批量更新失败!');
reject(); reject();
}
}).catch(() => {
this.$message.error('考勤信息批量更新失败!');
reject();
});
});
} catch (error) {
this.$message.error('批量更新操作员时间失败!');
reject(error);
}
}); });
}, },

Loading…
Cancel
Save