| | |
| | | <el-table-column label="录入人" prop="entryPersonName" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="录入日期" prop="entryDate" width="120" show-overflow-tooltip /> |
| | | <el-table-column label="签订日期" prop="executionDate" width="120" show-overflow-tooltip /> |
| | | <el-table-column label="生产订单号" min-width="180" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <template v-if="scope.row.productionOrders && scope.row.productionOrders.length > 0"> |
| | | <el-tag v-for="order in scope.row.productionOrders" :key="order.id" size="small" style="margin: 2px;">{{ order.npsNo }}</el-tag> |
| | | </template> |
| | | <span v-else>-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="操作" min-width="140" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="openForm('edit', scope.row)" :disabled="!scope.row.isEdit || scope.row.hasProductionRecord">编辑</el-button> |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="付款方式"> |
| | | <el-input v-model="form.paymentMethod" placeholder="请输入" clearable :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="生产订单:"> |
| | | <el-select |
| | | v-model="form.productionOrderIds" |
| | | multiple |
| | | filterable |
| | | remote |
| | | :remote-method="getProductOrderOptions" |
| | | :loading="productOrderLoading" |
| | | placeholder="请选择生产订单" |
| | | clearable |
| | | collapse-tags |
| | | collapse-tags-tooltip |
| | | :disabled="operationType === 'view'" |
| | | > |
| | | <el-option |
| | | v-for="item in productOrderOptions" |
| | | :key="item.id" |
| | | :label="item.npsNo + (item.productCategory ? ' - ' + item.productCategory : '') + (item.specificationModel ? ' - ' + item.specificationModel : '')" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { getQuotationDetail } from "@/api/salesManagement/salesQuotation.js"; |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import { productOrderListPage, listByProductModelId } from "@/api/productionManagement/productionOrder.js"; |
| | | import useFormData from "@/hooks/useFormData.js"; |
| | | import dayjs from "dayjs"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | |
| | | const customerOption = ref([]); |
| | | const productOptions = ref([]); |
| | | const modelOptions = ref([]); |
| | | const productOrderOptions = ref([]); |
| | | const productOrderLoading = ref(false); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | |
| | | productData: [], |
| | | executionDate: "", |
| | | paymentMethod: "", |
| | | productionOrderIds: [], |
| | | }, |
| | | rules: { |
| | | salesman: [{ required: true, message: "请选择", trigger: "change" }], |
| | |
| | | productOptions.value = convertIdToValue(list); |
| | | return productOptions.value; |
| | | }); |
| | | }; |
| | | // 获取生产订单列表 |
| | | const getProductOrderOptions = (query) => { |
| | | productOrderLoading.value = true; |
| | | const productModelIds = productData.value |
| | | .map(item => item.productModelId) |
| | | .filter(id => id != null); |
| | | if (productModelIds.length > 0) { |
| | | listByProductModelId(productModelIds) |
| | | .then((res) => { |
| | | productOrderOptions.value = res?.data?.records || res?.data || res || []; |
| | | }) |
| | | .finally(() => { |
| | | productOrderLoading.value = false; |
| | | }); |
| | | return; |
| | | } |
| | | productOrderLoading.value = false; |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | |
| | | // 新增时重置审批人节点 |
| | | approverNodes.value = [{ id: 1, userId: null }]; |
| | | nextApproverId = 2; |
| | | form.value.productionOrderIds = []; |
| | | // 新增时直接加载生产订单列表 |
| | | getProductOrderOptions(); |
| | | } else { |
| | | currentId.value = row.id; |
| | | getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => { |
| | |
| | | form.value.entryPerson = Number(res.entryPerson); |
| | | productData.value = form.value.productData; |
| | | fileList.value = form.value.salesLedgerFiles; |
| | | // 回显生产订单 |
| | | if (res.productionOrders && res.productionOrders.length > 0) { |
| | | form.value.productionOrderIds = res.productionOrders.map(order => order.id); |
| | | productOrderOptions.value = res.productionOrders; |
| | | } else if (res.productOrderIds) { |
| | | if (Array.isArray(res.productOrderIds)) { |
| | | form.value.productionOrderIds = res.productOrderIds.map(id => Number(id)); |
| | | } else if (typeof res.productOrderIds === "string") { |
| | | form.value.productionOrderIds = res.productOrderIds.split(",").filter(id => id).map(id => Number(id)); |
| | | } else { |
| | | form.value.productionOrderIds = []; |
| | | } |
| | | } else { |
| | | form.value.productionOrderIds = []; |
| | | } |
| | | // 编辑时根据产品型号ID加载生产订单列表 |
| | | getProductOrderOptions(); |
| | | // 回显审批人节点 |
| | | if (res.approveUserIds) { |
| | | const userIds = res.approveUserIds.split(",").filter(id => id); |
| | |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | productOrderOptions.value = []; |
| | | // 重置审批人节点 |
| | | approverNodes.value = [{ id: 1, userId: null }]; |
| | | nextApproverId = 2; |