huminmin
10 小时以前 33d9e4e1a653f0fb460826eb20bf58457045ff8e
Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New
已修改7个文件
458 ■■■■■ 文件已修改
src/api/customerService/index.js 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/afterSalesHandling/components/formDia.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/afterSalesHandling/index.vue 199 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/expiryAfterSales/components/formDia.vue 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/expiryAfterSales/index.vue 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionProcess/New.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrder/index.vue 106 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/customerService/index.js
@@ -59,27 +59,17 @@
  })
}
// 售后处理-附件删除
export function afterSalesServiceFileDel(ids) {
export function afterSalesServiceFileDel(id) {
  return request({
    url: '/afterSalesService/file/del',
    url: `/afterSalesService/file/del/${id}`,
    method: 'delete',
    data: ids,
  })
}
// 售后处理-维修记录列表
export function afterSalesServiceRepairListPage(query) {
  return request({
    url: '/afterSalesService/repair/listPage',
    method: 'get',
    params: query,
  })
}
// 临期售后管理-分页查询
export function expiryAfterSalesListPage(query) {
  return request({
    url: '/expiryAfterSales/listPage',
    url: '/afterSalesNearExpiryService/listPage',
    method: 'get',
    params: query,
  })
@@ -88,7 +78,7 @@
// 临期售后管理-新增
export function expiryAfterSalesAdd(query) {
  return request({
    url: '/expiryAfterSales/add',
    url: '/afterSalesNearExpiryService/add',
    method: 'post',
    data: query,
  })
@@ -97,17 +87,16 @@
// 临期售后管理-更新
export function expiryAfterSalesUpdate(query) {
  return request({
    url: '/expiryAfterSales/update',
    url: '/afterSalesNearExpiryService/update',
    method: 'post',
    data: query,
  })
}
// 临期售后管理-删除
export function expiryAfterSalesDelete(query) {
export function expiryAfterSalesDelete(ids) {
  return request({
    url: '/expiryAfterSales/delete',
    url: '/afterSalesNearExpiryService/delete?ids=' + ids,
    method: 'delete',
    data: query,
  })
}
src/views/customerService/afterSalesHandling/components/formDia.vue
@@ -169,8 +169,14 @@
        userList.value = res.data;
    });
    form.value = {...row}
    form.value.disposeUserId = userStore.id;
    form.value.disDate = getCurrentDate();
    if (type === 'approve') {
        if (!form.value.disposeUserId) {
            form.value.disposeUserId = userStore.id;
        }
        if (!form.value.disDate) {
            form.value.disDate = getCurrentDate();
        }
    }
}
// const setName = (code) => {
//     const index = userList.value.findIndex(item => item.deviceModel === code);
src/views/customerService/afterSalesHandling/index.vue
@@ -55,41 +55,10 @@
            :upload-method="handleFileUpload"
            :delete-method="handleFileDelete"
        />
        <el-dialog
            v-model="repairDialogVisible"
            title="维修记录"
            width="700px"
            destroy-on-close
            @close="repairRecordList = []"
        >
            <el-table
                :data="repairRecordList"
                border
                v-loading="repairRecordLoading"
                max-height="400"
            >
                <el-table-column type="index" label="序号" width="55" align="center" />
                <el-table-column label="维修日期" prop="maintenanceTime" min-width="120" show-overflow-tooltip>
                    <template #default="{ row }">
                        {{ row.maintenanceTime || row.repairTime || '-' }}
                    </template>
                </el-table-column>
                <el-table-column label="维修人" prop="maintenanceName" min-width="100" show-overflow-tooltip>
                    <template #default="{ row }">
                        {{ row.maintenanceName || row.repairName || '-' }}
                    </template>
                </el-table-column>
                <el-table-column label="维修结果" prop="maintenanceResult" min-width="180" show-overflow-tooltip />
            </el-table>
            <template #footer>
                <el-button @click="repairDialogVisible = false">关闭</el-button>
            </template>
        </el-dialog>
    </div>
</template>
<script setup>
import {Search} from "@element-plus/icons-vue";
import { onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue";
import FormDia from "@/views/customerService/afterSalesHandling/components/formDia.vue";
import FileListDialog from "@/components/Dialog/FileListDialog.vue";
@@ -97,12 +66,9 @@
import request from "@/utils/request";
import { getToken } from "@/utils/auth";
import {
    afterSalesServiceDelete,
    afterSalesServiceListPage,
    afterSalesServiceFileListPage,
    afterSalesServiceFileAdd,
    afterSalesServiceFileDel,
    afterSalesServiceRepairListPage,
} from "@/api/customerService/index.js";
import useUserStore from "@/store/modules/user.js";
const { proxy } = getCurrentInstance();
@@ -210,14 +176,6 @@
                    openFilesFormDia(row);
                },
            },
            // TODO 为写报告添加的
            {
                name: "维修记录",
                type: "text",
                clickFun: (row) => {
                    openRepairDialog(row);
                },
            },
        ],
    },
]);
@@ -238,32 +196,9 @@
const fileListRef = ref(null)
const fileListDialogVisible = ref(false)
const currentFileRow = ref(null)
const repairDialogVisible = ref(false)
const repairRecordList = ref([])
const repairRecordLoading = ref(false)
// 打开维修记录弹框
const openRepairDialog = async (row) => {
    repairDialogVisible.value = true
    repairRecordLoading.value = true
    repairRecordList.value = []
    try {
        const res = await afterSalesServiceRepairListPage({
            afterSalesServiceId: row.id,
            current: 1,
            size: 100,
        })
        if (res.code === 200 && res.data?.records) {
            repairRecordList.value = res.data.records
        }
    } catch (error) {
        proxy.$modal.msgError("获取维修记录失败")
    } finally {
        repairRecordLoading.value = false
    }
}
// 打开附件弹框-----  TODO:接口是没有对接的,需要新增接口,为写报告添加的
// 打开附件弹框
const openFilesFormDia = async (row) => {
    currentFileRow.value = row
    try {
@@ -311,8 +246,9 @@
            try {
                const formData = new FormData()
                formData.append("file", file)
                formData.append("id", currentFileRow.value.id)
                const uploadRes = await request({
                    url: "/file/upload",
                    url: "/afterSalesService/file/upload",
                    method: "post",
                    data: formData,
                    headers: {
@@ -321,33 +257,23 @@
                    },
                })
                if (uploadRes.code === 200) {
                    const fileData = {
                    proxy.$modal.msgSuccess("文件上传成功")
                    // 重新获取文件列表
                    const listRes = await afterSalesServiceFileListPage({
                        afterSalesServiceId: currentFileRow.value.id,
                        name: uploadRes.data?.originalName || file.name,
                        url: uploadRes.data?.tempPath || uploadRes.data?.url,
                        current: 1,
                        size: 100,
                    })
                    if (listRes.code === 200 && fileListRef.value) {
                        const fileList = (listRes.data?.records || []).map((item) => ({
                            name: item.fileName,
                            url: item.fileUrl,
                            id: item.id,
                            ...item,
                        }))
                        fileListRef.value.setList(fileList)
                    }
                    const saveRes = await afterSalesServiceFileAdd(fileData)
                    if (saveRes.code === 200) {
                        proxy.$modal.msgSuccess("文件上传成功")
                        const listRes = await afterSalesServiceFileListPage({
                            afterSalesServiceId: currentFileRow.value.id,
                            current: 1,
                            size: 100,
                        })
                        if (listRes.code === 200 && fileListRef.value) {
                            const fileList = (listRes.data?.records || []).map((item) => ({
                                name: item.name || item.fileName,
                                url: item.url || item.fileUrl,
                                id: item.id,
                                ...item,
                            }))
                            fileListRef.value.setList(fileList)
                        }
                        resolve({ name: fileData.name, url: fileData.url, id: saveRes.data?.id })
                    } else {
                        proxy.$modal.msgError(saveRes.msg || "文件保存失败")
                        resolve(null)
                    }
                    resolve({ name: file.name, url: "", id: null })
                } else {
                    proxy.$modal.msgError(uploadRes.msg || "文件上传失败")
                    resolve(null)
@@ -367,31 +293,47 @@
// 删除附件
const handleFileDelete = async (row) => {
    try {
        const res = await afterSalesServiceFileDel([row.id])
        if (res.code === 200) {
            proxy.$modal.msgSuccess("删除成功")
            if (currentFileRow.value && fileListRef.value) {
                const listRes = await afterSalesServiceFileListPage({
                    afterSalesServiceId: currentFileRow.value.id,
                    current: 1,
                    size: 100,
                })
                if (listRes.code === 200) {
                    const fileList = (listRes.data?.records || []).map((item) => ({
                        name: item.name || item.fileName,
                        url: item.url || item.fileUrl,
                        id: item.id,
                        ...item,
                    }))
                    fileListRef.value.setList(fileList)
                }
        // 添加确认对话框
        const confirmResult = await ElMessageBox.confirm(
            '确定要删除这个附件吗?',
            '删除确认',
            {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }
        } else {
            proxy.$modal.msgError(res.msg || "删除失败")
            return false
        )
        if (confirmResult === 'confirm') {
            const res = await afterSalesServiceFileDel(row.id)
            if (res.code === 200) {
                proxy.$modal.msgSuccess("删除成功")
                if (currentFileRow.value && fileListRef.value) {
                    const listRes = await afterSalesServiceFileListPage({
                        afterSalesServiceId: currentFileRow.value.id,
                        current: 1,
                        size: 100,
                    })
                    if (listRes.code === 200) {
                        const fileList = (listRes.data?.records || []).map((item) => ({
                            name: item.fileName,
                            url: item.fileUrl,
                            id: item.id,
                            ...item,
                        }))
                        fileListRef.value.setList(fileList)
                    }
                }
            } else {
                proxy.$modal.msgError(res.msg || "删除失败")
                return false
            }
        }
    } catch (error) {
        proxy.$modal.msgError("删除失败")
        // 如果用户取消删除,不显示错误信息
        if (error !== 'cancel') {
            proxy.$modal.msgError("删除失败")
        }
        return false
    }
}
@@ -421,35 +363,6 @@
    nextTick(() => {
        formDia.value?.openDialog(type, row)
    })
};
const handleDelete = () => {
    let ids = [];
    if (selectedRows.value.length > 0) {
        ids = selectedRows.value.map((item) => item.id);
    } else {
        proxy.$modal.msgWarning("请选择数据");
        return;
    }
    ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
    })
        .then(() => {
            tableLoading.value = true;
            afterSalesServiceDelete(ids)
                .then((res) => {
                    proxy.$modal.msgSuccess("删除成功");
                    getList();
                })
                .finally(() => {
                    tableLoading.value = false;
                });
        })
        .catch(() => {
            proxy.$modal.msg("已取消");
        });
};
// 导出
src/views/customerService/expiryAfterSales/components/formDia.vue
@@ -161,8 +161,8 @@
import {ref, computed} from "vue";
import useUserStore from "@/store/modules/user.js";
import { getCurrentDate } from "@/utils/index.js";
// import {userListNoPageByTenantId} from "@/api/system/user.js"; // 暂时注释掉,使用假数据
// import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js"; // 暂时注释掉,使用假数据
import {userListNoPageByTenantId} from "@/api/system/user.js";
import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
const dialogFormVisible = ref(false);
@@ -218,14 +218,10 @@
  operationType.value = type;
  dialogFormVisible.value = true;
    
    // 模拟获取用户列表
    userList.value = [
        { userId: 1, nickName: "张三" },
        { userId: 2, nickName: "李四" },
        { userId: 3, nickName: "王五" },
        { userId: 4, nickName: "赵六" },
        { userId: 5, nickName: "孙八" }
    ];
    // 获取用户列表
    userListNoPageByTenantId().then(res => {
        userList.value = res.data;
    });
    if (type === 'add') {
        // 新增时重置表单
@@ -256,12 +252,30 @@
const submitForm = () => {
    proxy.$refs["formRef"].validate(valid => {
        if (valid) {
            // 模拟提交操作
            setTimeout(() => {
                console.log("模拟提交的数据:", form.value);
            const submitData = {
                id: form.value.id,
                productName: form.value.productName,
                batchNumber: form.value.batchNumber,
                expireDate: form.value.expiryDate,
                stockQuantity: form.value.stockQuantity,
                customerName: form.value.customerName,
                contactPhone: form.value.contactPhone,
                disRes: form.value.problemDesc,
                status: form.value.status,
                disposeUserId: form.value.handlerId,
                disposeNickName: userList.value.find(item => item.userId === form.value.handlerId)?.nickName,
                disposeResult: form.value.handleResult,
                disDate: form.value.handleDate
            };
            const apiCall = operationType.value === 'add' ? expiryAfterSalesAdd : expiryAfterSalesUpdate;
            apiCall(submitData).then(() => {
                proxy.$modal.msgSuccess(operationType.value === 'add' ? "新增成功" : "更新成功");
                closeDia();
            }, 300);
            }).catch(error => {
                console.error('提交数据失败:', error);
                proxy.$modal.msgError('提交数据失败,请稍后重试');
            });
        }
    });
}
src/views/customerService/expiryAfterSales/index.vue
@@ -72,7 +72,7 @@
import {onMounted, ref} from "vue";
import FormDia from "@/views/customerService/expiryAfterSales/components/formDia.vue";
import {ElMessageBox} from "element-plus";
// import {expiryAfterSalesDelete, expiryAfterSalesListPage} from "@/api/customerService/index.js"; // 暂时注释掉,使用假数据
import {expiryAfterSalesDelete, expiryAfterSalesListPage} from "@/api/customerService/index.js";
import useUserStore from "@/store/modules/user.js";
const { proxy } = getCurrentInstance();
const userStore = useUserStore()
@@ -127,7 +127,8 @@
            label: "处理状态",
            prop: "status",
            width: "",
            slot: true,
            dataType: "slot",
            slot: "status",
        },
        {
            label: "处理人",
@@ -142,7 +143,8 @@
        {
            label: "操作",
            prop: "operation",
            slot: true,
            dataType: "slot",
            slot: "operation",
            width: "200",
        },
    ],
@@ -190,21 +192,39 @@
// 获取列表数据
const getList = () => {
    tableLoading.value = true;
    // 取消注释并使用真实API
    // expiryAfterSalesListPage({
    //     ...searchForm.value,
    //     current: page.value.current,
    //     size: page.value.size
    // }).then(res => {
    //     tableData.value = res.data.records;
    //     page.value.total = res.data.total;
    //     tableLoading.value = false;
    // });
    // 构造查询参数,映射前端字段到后端字段
    const queryParams = {
        expireDate: searchForm.value.expiryDate,
        disDate: searchForm.value.handleDate,
        status: searchForm.value.status,
        current: page.value.current,
        size: page.value.size
    };
    
    // 暂时返回空数据
    tableData.value = [];
    page.value.total = 0;
    tableLoading.value = false;
    expiryAfterSalesListPage(queryParams).then(res => {
        // 映射后端返回数据到前端表格
        tableData.value = res.data.records.map(item => ({
            id: item.id,
            productName: item.productName,
            batchNumber: item.batchNumber,
            expiryDate: item.expireDate,
            stockQuantity: item.stockQuantity,
            customerName: item.customerName,
            contactPhone: item.contactPhone,
            problemDesc: item.disRes,
            status: item.status,
            handlerId: item.disposeUserId,
            handlerName: item.disposeNickName,
            handleResult: item.disposeResult,
            handleDate: item.disDate
        }));
        page.value.total = res.data.total;
        tableLoading.value = false;
    }).catch(error => {
        console.error('获取列表数据失败:', error);
        tableLoading.value = false;
        proxy.$modal.msgError('获取数据失败,请稍后重试');
    });
};
// 打开弹框
@@ -230,18 +250,12 @@
    })
        .then(() => {
            tableLoading.value = true;
            // 取消注释并使用真实API
            // expiryAfterSalesDelete(ids).then(() => {
            //     proxy.$modal.msgSuccess("删除成功");
            //     getList();
            // }).finally(() => {
            //     tableLoading.value = false;
            // });
            // 暂时模拟删除成功
            tableLoading.value = false;
            proxy.$modal.msgSuccess("删除成功");
            getList();
            expiryAfterSalesDelete(ids).then(() => {
                proxy.$modal.msgSuccess("删除成功");
                getList();
            }).finally(() => {
                tableLoading.value = false;
            });
        })
        .catch(() => {
            proxy.$modal.msg("已取消");
src/views/productionManagement/productionProcess/New.vue
@@ -26,7 +26,9 @@
          <el-input v-model="formState.no"  />
        </el-form-item>
        <el-form-item label="工资定额" prop="salaryQuota">
          <el-input v-model="formState.salaryQuota" type="number" :step="0.001" />
          <el-input v-model="formState.salaryQuota" type="number" :step="0.001">
            <template #append>元</template>
          </el-input>
        </el-form-item>
        <el-form-item label="是否质检" prop="isQuality">
          <el-switch v-model="formState.isQuality" :active-value="true" inactive-value="false"/>
src/views/productionManagement/workOrder/index.vue
@@ -24,10 +24,12 @@
                :page="page"
                :tableLoading="tableLoading"
                @pagination="pagination">
                <template #completionStatus="{ row }">
                  <el-progress :percentage="toProgressPercentage(row?.completionStatus)" :color="progressColor(toProgressPercentage(row?.completionStatus))" :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" />
                </template>
              </PIMTable>
        <template #completionStatus="{ row }">
          <el-progress :percentage="toProgressPercentage(row?.completionStatus)"
                       :color="progressColor(toProgressPercentage(row?.completionStatus))"
                       :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" />
        </template>
      </PIMTable>
    </div>
    <el-dialog v-model="editDialogVisible"
               title="编辑时间"
@@ -104,7 +106,6 @@
                transferCardRowData.status 
              }}</span>
            </div> -->
            <div class="info-item">
              <span class="info-label">计划开始时间</span>
              <span class="info-value">{{ transferCardRowData.planStartTime }}</span>
@@ -175,7 +176,8 @@
                    readonly
                    style="width: 300px" />
        </el-form-item>
        <el-form-item label="本次生产数量" prop="quantity">
        <el-form-item label="本次生产数量"
                      prop="quantity">
          <el-input v-model.number="reportForm.quantity"
                    type="number"
                    min="1"
@@ -184,7 +186,8 @@
                    placeholder="请输入本次生产数量"
                    @input="handleQuantityInput" />
        </el-form-item>
        <el-form-item label="报废数量" prop="scrapQty">
        <el-form-item label="报废数量"
                      prop="scrapQty">
          <el-input v-model.number="reportForm.scrapQty"
                    type="number"
                    min="0"
@@ -202,7 +205,7 @@
                     @change="handleUserChange">
            <el-option v-for="user in userOptions"
                       :key="user.userId"
                       :label="user.userName"
                       :label="user.nickName"
                       :value="user.userId" />
          </el-select>
        </el-form-item>
@@ -364,50 +367,46 @@
    userId: "",
    productMainId: null,
  });
  // 本次生产数量验证规则
  const validateQuantity = (rule, value, callback) => {
    if (value === null || value === undefined || value === '') {
      callback(new Error('请输入本次生产数量'));
    if (value === null || value === undefined || value === "") {
      callback(new Error("请输入本次生产数量"));
      return;
    }
    const num = Number(value);
    // 整数且大于等于1
    if (isNaN(num) || !Number.isInteger(num) || num < 1) {
      callback(new Error('本次生产数量必须大于等于1'));
      callback(new Error("本次生产数量必须大于等于1"));
      return;
    }
    callback();
  };
  // 报废数量验证规则
  const validateScrapQty = (rule, value, callback) => {
    if (value === null || value === undefined || value === '') {
    if (value === null || value === undefined || value === "") {
      callback();
      return;
    }
    const num = Number(value);
    // 整数且大于等于0
    if (isNaN(num) || !Number.isInteger(num) || num < 0) {
      callback(new Error('报废数量必须大于等于0'));
      callback(new Error("报废数量必须大于等于0"));
      return;
    }
    callback();
  };
  // 验证规则
  const reportFormRules = {
    quantity: [
      { required: true, validator: validateQuantity, trigger: 'blur' }
    ],
    scrapQty: [
      { validator: validateScrapQty, trigger: 'blur' }
    ]
    quantity: [{ required: true, validator: validateQuantity, trigger: "blur" }],
    scrapQty: [{ validator: validateScrapQty, trigger: "blur" }],
  };
  // 处理本次生产数量输入,限制必须大于等于1
  const handleQuantityInput = (value) => {
    if (value === '' || value === null || value === undefined) {
  const handleQuantityInput = value => {
    if (value === "" || value === null || value === undefined) {
      reportForm.quantity = null;
      return;
    }
@@ -433,10 +432,10 @@
    }
    reportForm.quantity = num;
  };
  // 处理报废数量
  const handleScrapQtyInput = (value) => {
    if (value === '' || value === null || value === undefined) {
  const handleScrapQtyInput = value => {
    if (value === "" || value === null || value === undefined) {
      reportForm.scrapQty = null;
      return;
    }
@@ -532,7 +531,9 @@
      // 创建 Blob URL
      const fileBlob =
        blob instanceof Blob ? blob : new Blob([blob], { type: blob.type || "application/octet-stream" });
        blob instanceof Blob
          ? blob
          : new Blob([blob], { type: blob.type || "application/octet-stream" });
      const url = window.URL.createObjectURL(fileBlob);
      // 创建隐藏 iframe,用于触发浏览器打印
@@ -596,12 +597,14 @@
  const showReportDialog = row => {
    currentReportRowData.value = row;
    reportForm.planQuantity = row.planQuantity;
    reportForm.quantity = row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
    reportForm.quantity =
      row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
    reportForm.productProcessRouteItemId = row.productProcessRouteItemId;
    reportForm.workOrderId = row.id;
    reportForm.reportWork = row.reportWork;
    reportForm.productMainId = row.productMainId;
    reportForm.scrapQty = row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null;
    reportForm.scrapQty =
      row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null;
    nextTick(() => {
      reportFormRef.value?.clearValidate();
    });
@@ -610,7 +613,7 @@
      .then(res => {
        if (res.code === 200) {
          reportForm.userId = res.data.userId;
          reportForm.userName = res.data.userName;
          reportForm.userName = res.data.nickName;
        }
      })
      .catch(err => {
@@ -625,31 +628,38 @@
  };
  const handleReport = () => {
    reportFormRef.value?.validate((valid) => {
    reportFormRef.value?.validate(valid => {
      if (!valid) {
        return false;
      }
      if (reportForm.planQuantity <= 0) {
        ElMessageBox.alert("待生产数量为0,无法报工", "提示", {
          confirmButtonText: "确定",
        });
        return;
      }
      // 验证本次生产数量
      if (reportForm.quantity === null || reportForm.quantity === undefined || reportForm.quantity === '') {
      if (
        reportForm.quantity === null ||
        reportForm.quantity === undefined ||
        reportForm.quantity === ""
      ) {
        ElMessageBox.alert("请输入本次生产数量", "提示", {
          confirmButtonText: "确定",
        });
        return;
      }
      const quantity = Number(reportForm.quantity);
      const scrapQty = reportForm.scrapQty === null || reportForm.scrapQty === undefined || reportForm.scrapQty === ''
        ? 0
        : Number(reportForm.scrapQty);
      const scrapQty =
        reportForm.scrapQty === null ||
        reportForm.scrapQty === undefined ||
        reportForm.scrapQty === ""
          ? 0
          : Number(reportForm.scrapQty);
      // 本次生产数量
      if (isNaN(quantity) || !Number.isInteger(quantity) || quantity < 1) {
        ElMessageBox.alert("本次生产数量必须大于等于1", "提示", {
@@ -657,7 +667,7 @@
        });
        return;
      }
      // 报废数量必须是整数且大于等于0
      if (isNaN(scrapQty) || !Number.isInteger(scrapQty) || scrapQty < 0) {
        ElMessageBox.alert("报废数量必须大于等于0", "提示", {
@@ -665,20 +675,20 @@
        });
        return;
      }
      if (quantity > reportForm.planQuantity) {
        ElMessageBox.alert("本次生产数量不能超过待生产数量", "提示", {
          confirmButtonText: "确定",
        });
        return;
      }
      const submitData = {
        ...reportForm,
        quantity: quantity,
        scrapQty: scrapQty
        scrapQty: scrapQty,
      };
      // console.log(submitData);
      addProductMain(submitData).then(res => {
        if (res.code === 200) {
@@ -708,11 +718,11 @@
  };
  // 用户选择变化时更新 userName
  const handleUserChange = (userId) => {
  const handleUserChange = userId => {
    if (userId) {
      const selectedUser = userOptions.value.find(user => user.userId === userId);
      if (selectedUser) {
        reportForm.userName = selectedUser.userName;
        reportForm.userName = selectedUser.nickName;
      }
    } else {
      reportForm.userName = "";