|
@@ -721,6 +721,7 @@ let draggedEmployee = null;
|
|
|
// 开始拖拽
|
|
// 开始拖拽
|
|
|
const onDragStart = (event, employee) => {
|
|
const onDragStart = (event, employee) => {
|
|
|
draggedEmployee = employee;
|
|
draggedEmployee = employee;
|
|
|
|
|
+ console.log('拖拽的员工:', employee);
|
|
|
event.dataTransfer.effectAllowed = 'copy';
|
|
event.dataTransfer.effectAllowed = 'copy';
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -738,15 +739,18 @@ const onDrop = (event, partIndex, processIndex, staffIndex = null) => {
|
|
|
if (staffIndex !== null && reportingDataItem.staffList) {
|
|
if (staffIndex !== null && reportingDataItem.staffList) {
|
|
|
// 拖拽到已有人员列表中的某个位置
|
|
// 拖拽到已有人员列表中的某个位置
|
|
|
reportingDataItem.staffList[staffIndex].staff_name = draggedEmployee.员工姓名;
|
|
reportingDataItem.staffList[staffIndex].staff_name = draggedEmployee.员工姓名;
|
|
|
|
|
+ reportingDataItem.staffList[staffIndex].staff_no = draggedEmployee.员工编号;
|
|
|
} else if (reportingDataItem.staffList) {
|
|
} else if (reportingDataItem.staffList) {
|
|
|
// 拖拽到人员列表区域,添加新人员
|
|
// 拖拽到人员列表区域,添加新人员
|
|
|
reportingDataItem.staffList.push({
|
|
reportingDataItem.staffList.push({
|
|
|
staff_name: draggedEmployee.员工姓名,
|
|
staff_name: draggedEmployee.员工姓名,
|
|
|
|
|
+ staff_no: draggedEmployee.员工编号,
|
|
|
number: ''
|
|
number: ''
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
// 拖拽到单个人员输入框
|
|
// 拖拽到单个人员输入框
|
|
|
reportingDataItem.staff_name = draggedEmployee.员工姓名;
|
|
reportingDataItem.staff_name = draggedEmployee.员工姓名;
|
|
|
|
|
+ reportingDataItem.staff_no = draggedEmployee.员工编号;
|
|
|
}
|
|
}
|
|
|
draggedEmployee = null;
|
|
draggedEmployee = null;
|
|
|
}
|
|
}
|
|
@@ -762,6 +766,7 @@ const addPerson = (partIndex, processIndex) => {
|
|
|
if (reportingDataItem.staff_name) {
|
|
if (reportingDataItem.staff_name) {
|
|
|
reportingDataItem.staffList.push({
|
|
reportingDataItem.staffList.push({
|
|
|
staff_name: reportingDataItem.staff_name,
|
|
staff_name: reportingDataItem.staff_name,
|
|
|
|
|
+ staff_no: reportingDataItem.staff_no,
|
|
|
number: reportingDataItem.number || ''
|
|
number: reportingDataItem.number || ''
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -769,6 +774,7 @@ const addPerson = (partIndex, processIndex) => {
|
|
|
// 添加新的人员输入框
|
|
// 添加新的人员输入框
|
|
|
reportingDataItem.staffList.push({
|
|
reportingDataItem.staffList.push({
|
|
|
staff_name: '',
|
|
staff_name: '',
|
|
|
|
|
+ staff_no: '',
|
|
|
number: ''
|
|
number: ''
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
@@ -791,6 +797,7 @@ const submitWorkScore = async () => {
|
|
|
|
|
|
|
|
// 构建上报数据
|
|
// 构建上报数据
|
|
|
const reportData = [];
|
|
const reportData = [];
|
|
|
|
|
+ console.log('员工列表:', employees.value);
|
|
|
|
|
|
|
|
// 检查是否是车缝工序
|
|
// 检查是否是车缝工序
|
|
|
if (add_formData['工序'] === '车缝') {
|
|
if (add_formData['工序'] === '车缝') {
|
|
@@ -806,8 +813,13 @@ const submitWorkScore = async () => {
|
|
|
// 多个人员的情况
|
|
// 多个人员的情况
|
|
|
for (const staff of reportItem.staffList) {
|
|
for (const staff of reportItem.staffList) {
|
|
|
if (staff.number) {
|
|
if (staff.number) {
|
|
|
|
|
+ console.log('处理员工:', staff);
|
|
|
|
|
+ const foundEmp = employees.value.find(emp => emp['员工姓名'] === staff.staff_name);
|
|
|
|
|
+ console.log('查找员工:', foundEmp);
|
|
|
|
|
+ const staffNo = staff.staff_no || foundEmp?.['员工编号'] || selectedEmp['员工编号'];
|
|
|
|
|
+ console.log('员工编号:', staffNo);
|
|
|
reportData.push({
|
|
reportData.push({
|
|
|
- staff_no: employees.value.find(emp => emp['员工姓名'] === staff.staff_name)?.['员工编号'] || selectedEmp['员工编号'],
|
|
|
|
|
|
|
+ staff_no: staffNo,
|
|
|
staff_name: staff.staff_name || selectedEmp['员工姓名'],
|
|
staff_name: staff.staff_name || selectedEmp['员工姓名'],
|
|
|
work_order: add_searchInfo.value,
|
|
work_order: add_searchInfo.value,
|
|
|
majorprocess: add_formData['工序'],
|
|
majorprocess: add_formData['工序'],
|
|
@@ -827,7 +839,7 @@ const submitWorkScore = async () => {
|
|
|
} else if (reportItem.number) {
|
|
} else if (reportItem.number) {
|
|
|
// 单个人员的情况
|
|
// 单个人员的情况
|
|
|
reportData.push({
|
|
reportData.push({
|
|
|
- staff_no: selectedEmp['员工编号'],
|
|
|
|
|
|
|
+ staff_no: reportItem.staff_no || selectedEmp['员工编号'],
|
|
|
staff_name: reportItem.staff_name || selectedEmp['员工姓名'],
|
|
staff_name: reportItem.staff_name || selectedEmp['员工姓名'],
|
|
|
work_order: add_searchInfo.value,
|
|
work_order: add_searchInfo.value,
|
|
|
majorprocess: add_formData['工序'],
|
|
majorprocess: add_formData['工序'],
|
|
@@ -858,7 +870,7 @@ const submitWorkScore = async () => {
|
|
|
for (const staff of reportItem.staffList) {
|
|
for (const staff of reportItem.staffList) {
|
|
|
if (staff.number) {
|
|
if (staff.number) {
|
|
|
reportData.push({
|
|
reportData.push({
|
|
|
- staff_no: employees.value.find(emp => emp['员工姓名'] === staff.staff_name)?.['员工编号'] || selectedEmp['员工编号'],
|
|
|
|
|
|
|
+ staff_no: staff.staff_no || employees.value.find(emp => emp['员工姓名'] === staff.staff_name)?.['员工编号'] || selectedEmp['员工编号'],
|
|
|
staff_name: staff.staff_name || selectedEmp['员工姓名'],
|
|
staff_name: staff.staff_name || selectedEmp['员工姓名'],
|
|
|
work_order: add_searchInfo.value,
|
|
work_order: add_searchInfo.value,
|
|
|
majorprocess: add_formData['工序'],
|
|
majorprocess: add_formData['工序'],
|
|
@@ -878,7 +890,7 @@ const submitWorkScore = async () => {
|
|
|
} else if (reportItem.number) {
|
|
} else if (reportItem.number) {
|
|
|
// 单个人员的情况
|
|
// 单个人员的情况
|
|
|
reportData.push({
|
|
reportData.push({
|
|
|
- staff_no: selectedEmp['员工编号'],
|
|
|
|
|
|
|
+ staff_no: reportItem.staff_no || selectedEmp['员工编号'],
|
|
|
staff_name: reportItem.staff_name || selectedEmp['员工姓名'],
|
|
staff_name: reportItem.staff_name || selectedEmp['员工姓名'],
|
|
|
work_order: add_searchInfo.value,
|
|
work_order: add_searchInfo.value,
|
|
|
majorprocess: add_formData['工序'],
|
|
majorprocess: add_formData['工序'],
|