| | |
| | | prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="产品宽(mm):"> |
| | | <el-input v-model="searchForm.width" |
| | | placeholder="请输入" |
| | | clearable |
| | | prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="产品高(mm):"> |
| | | <el-input v-model="searchForm.height" |
| | | placeholder="请输入" |
| | | clearable |
| | | prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="录入日期:"> |
| | | <el-date-picker v-model="searchForm.entryDate" |
| | | value-format="YYYY-MM-DD" |
| | |
| | | :value="1" /> |
| | | <el-option label="审批中" |
| | | :value="2" /> |
| | | <el-option label="审批失败" |
| | | <el-option label="审批不通过" |
| | | :value="3" /> |
| | | <el-option label="已发货" |
| | | <el-option label="审批通过" |
| | | :value="4" /> |
| | | <el-option label="已发货" |
| | | :value="5" /> |
| | | <el-option label="部分发货" |
| | | :value="6" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="入库状态:"> |
| | |
| | | style="width: 140px"> |
| | | <el-option label="未入库" |
| | | :value="0" /> |
| | | <el-option label="部分入库" |
| | | :value="1" /> |
| | | <el-option label="已入库" |
| | | :value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="订单状态:"> |
| | | <el-select v-model="searchForm.orderStatus" |
| | | placeholder="请选择" |
| | | clearable |
| | | style="width: 140px"> |
| | | <el-option label="进行中" |
| | | :value="0" /> |
| | | <el-option label="已完成" |
| | | :value="1" /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | @confirm="handleProcessFlowSelectConfirm" /> |
| | | <el-space wrap> |
| | | <el-button type="primary" |
| | | @click="handleSalesStock">入库</el-button> |
| | | @click="handleAudit" |
| | | :disabled="isBatchButtonDisabled('audit')">审核</el-button> |
| | | <el-button type="primary" |
| | | @click="handleReverseAudit" |
| | | :disabled="isBatchButtonDisabled('reverseAudit')">反审</el-button> |
| | | <el-button type="warning" |
| | | @click="handleMarkCompleted" |
| | | :disabled="isBatchButtonDisabled('markCompleted')">标记完成</el-button> |
| | | <el-button type="primary" |
| | | @click="handleSalesStock" |
| | | :disabled="isBatchButtonDisabled('stock')">入库</el-button> |
| | | <el-button type="primary" |
| | | @click="openForm('add')">新增台账</el-button> |
| | | <el-button type="primary" |
| | | @click="handleBulkDelivery">发货</el-button> |
| | | @click="handleBulkDelivery" |
| | | :disabled="isBatchButtonDisabled('delivery')">发货</el-button> |
| | | <el-button type="primary" |
| | | plain |
| | | @click="handleImport">导入</el-button> |
| | | <el-dropdown @command="handleHistoryImportCommand"> |
| | | <el-button type="primary" |
| | | plain> |
| | | 历史迁移<el-icon class="el-icon--right"> |
| | | <ArrowDown /> |
| | | </el-icon> |
| | | </el-button> |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <el-dropdown-item command="notShipped">未出库</el-dropdown-item> |
| | | <el-dropdown-item command="shipped">已出库</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </template> |
| | | </el-dropdown> |
| | | <el-button @click="handleOut">导出</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | @click="handleDelete">删除</el-button> |
| | | @click="handleDelete" |
| | | :disabled="isBatchButtonDisabled('delete')">删除</el-button> |
| | | <el-dropdown @command="handlePrintCommand"> |
| | | <el-button type="primary" |
| | | plain> |
| | | plain |
| | | :disabled="isBatchButtonDisabled('print')"> |
| | | 打印单据<el-icon class="el-icon--right"> |
| | | <ArrowDown /> |
| | | </el-icon> |
| | |
| | | </el-dropdown> |
| | | <el-button type="primary" |
| | | plain |
| | | @click="handlePrintLabel">打印标签</el-button> |
| | | @click="handlePrintLabel" |
| | | :disabled="isBatchButtonDisabled('print')">打印标签</el-button> |
| | | </el-space> |
| | | </div> |
| | | <el-table :data="tableData" |
| | |
| | | style="width: 100%" |
| | | :summary-method="summarizeMainTable" |
| | | @expand-change="expandChange" |
| | | height="calc(100vh - 18.5em)"> |
| | | height="calc(100vh - 22em)"> |
| | | <el-table-column align="center" |
| | | type="selection" |
| | | width="55" |
| | |
| | | <template #default="scope"> |
| | | <el-tag v-if="scope.row.approveStatus === 1 && (!scope.row.shippingDate || !scope.row.shippingCarNumber)" |
| | | type="success">充足</el-tag> |
| | | <el-tag v-else-if="scope.row.approveStatus === 1 && scope.row.shippingDate && scope.row.shippingCarNumber" |
| | | type="success">已出库</el-tag> |
| | | <el-tag v-else-if="scope.row.approveStatus === 0 && (scope.row.shippingDate || scope.row.shippingCarNumber)" |
| | | type="success">已出库</el-tag> |
| | | <el-tag v-else |
| | | type="danger">不足</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="入库状态" |
| | | width="100px" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-tag v-if="scope.row.productStockStatus == 1" |
| | | type="warning">部分入库</el-tag> |
| | | <el-tag v-else-if="scope.row.productStockStatus == 2" |
| | | type="success">已入库</el-tag> |
| | | <el-tag v-else-if="scope.row.productStockStatus == 0" |
| | | type="info">未入库</el-tag> |
| | | <el-tag v-else |
| | | type="danger">未入库</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="发货状态" width="140" align="center"> |
| | |
| | | width="220" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" /> |
| | | <el-table-column label="面积" |
| | | prop="productTotalArea" |
| | | width="120" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="数量" |
| | | prop="productTotalQuantity" |
| | | width="120" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="发货状态" |
| | | width="140" |
| | | align="center"> |
| | |
| | | type="primary">审批通过</el-tag> |
| | | <el-tag v-else-if="Number(scope.row.deliveryStatus) === 5" |
| | | type="success">已发货</el-tag> |
| | | <el-tag v-else-if="Number(scope.row.deliveryStatus) === 6" |
| | | type="warning">部分发货</el-tag> |
| | | <el-tag v-else |
| | | type="info">-</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="审核状态" |
| | | width="120" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-tag v-if="Number(scope.row.reviewStatus) === 0" |
| | | type="warning">待审核</el-tag> |
| | | <el-tag v-else-if="Number(scope.row.reviewStatus) === 1" |
| | | type="success">已审核</el-tag> |
| | | <el-tag v-else |
| | | type="info">待审核</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="入库状态" |
| | |
| | | <el-tag v-if="Number(scope.row.stockStatus) === 0" |
| | | type="info">未入库</el-tag> |
| | | <el-tag v-else-if="Number(scope.row.stockStatus) === 1" |
| | | type="success">部分入库</el-tag> |
| | | <el-tag v-else-if="Number(scope.row.stockStatus) === 2" |
| | | type="success">已入库</el-tag> |
| | | <el-tag v-else-if="Number(scope.row.stockStatus) === 3" |
| | | type="warning">审批中</el-tag> |
| | | <el-tag v-else |
| | | type="info">-</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="订单状态" |
| | | width="120" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-tag v-if="Number(scope.row.orderStatus) === 1" |
| | | type="success">已完成</el-tag> |
| | | <el-tag v-else |
| | | type="info">进行中</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="标签打印" |
| | | width="90" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <span>{{ scope.row.labelPrintCount ?? 0 }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="单据打印" |
| | | width="90" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <span>{{ scope.row.documentPrintCount ?? 0 }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="录入人" |
| | |
| | | show-overflow-tooltip /> |
| | | <el-table-column fixed="right" |
| | | label="操作" |
| | | width="200" |
| | | width="280" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-button link |
| | | type="primary" |
| | | @click="openForm('edit', scope.row)" |
| | | :disabled="!scope.row.isEdit">编辑</el-button> |
| | | :disabled="Number(scope.row.orderStatus) === 1">编辑</el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="openProcessFlowSelect(scope.row)" |
| | | :disabled="!scope.row.isEdit">工艺路线</el-button> |
| | | :disabled="Number(scope.row.reviewStatus) !== 1 || Number(scope.row.orderStatus) === 1">工艺路线</el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="downLoadFile(scope.row)">附件</el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="openLedgerQrDialog(scope.row)" |
| | | :disabled="Number(scope.row.orderStatus) === 1">二维码</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | @pagination="paginationChange" /> |
| | | </div> |
| | | <FormDialog v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? '新增销售台账页面' : '编辑销售台账页面'" |
| | | :title="isCompletedOrder ? '查看销售台账页面(已完成)' : operationType === 'add' ? '新增销售台账页面' : '编辑销售台账页面'" |
| | | :width="'70%'" |
| | | :operation-type="operationType" |
| | | :operation-type="isCompletedOrder ? 'detail' : operationType" |
| | | @close="closeDia" |
| | | @confirm="submitForm" |
| | | @cancel="closeDia"> |
| | |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | @keydown.capture="handleTabScrollFollow" |
| | | ref="formRef"> |
| | | <!-- 报价单导入入口:放在表单顶部,选择后反显客户/业务员等 --> |
| | | <el-row v-if="operationType === 'add'" |
| | |
| | | <el-select v-model="form.salesman" |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="operationType === 'view'"> |
| | | :disabled="operationType === 'view' || isReviewedEdit"> |
| | | <el-option v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | |
| | | filterable |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="operationType === 'view'"> |
| | | :disabled="operationType === 'view' || isReviewedEdit"> |
| | | <el-option v-for="item in customerOption" |
| | | :key="item.id" |
| | | :label="item.customerName" |
| | | :value="item.id"> |
| | | {{ |
| | | item.customerName + "——" + item.taxpayerIdentificationNumber |
| | | }} |
| | | {{ item.customerName + (item.taxpayerIdentificationNumber ? "——" + item.taxpayerIdentificationNumber : "") }} |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <el-input v-model="form.projectName" |
| | | placeholder="请输入" |
| | | clearable |
| | | :disabled="operationType === 'view'" /> |
| | | :disabled="operationType === 'view' || isReviewedEdit" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="operationType === 'view'" /> |
| | | :disabled="operationType === 'view' || isReviewedEdit" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable /> |
| | | clearable |
| | | :disabled="operationType === 'view' || isReviewedEdit" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | :reserve-keyword="false" |
| | | placeholder="请选择" |
| | | clearable |
| | | @change="changs"> |
| | | @change="changs" |
| | | :disabled="operationType === 'view' || isReviewedEdit"> |
| | | <el-option v-for="item in userList" |
| | | :key="item.userId" |
| | | :label="item.nickName" |
| | |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable /> |
| | | clearable |
| | | :disabled="operationType === 'view' || isReviewedEdit" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | prop="entryDate"> |
| | | <el-button v-if="operationType !== 'view'" |
| | | type="primary" |
| | | :disabled="hasEditingProductRow()" |
| | | :disabled="hasEditingProductRow() || isReviewedEdit" |
| | | @click="addProductInline"> |
| | | 添加 |
| | | </el-button> |
| | | <el-button v-if="operationType !== 'view'" |
| | | plain |
| | | type="danger" |
| | | :disabled="isReviewedEdit" |
| | | @click="deleteProduct">删除</el-button> |
| | | </el-form-item> |
| | | </el-row> |
| | |
| | | :render-after-expand="false" |
| | | style="width: 100%" |
| | | :filter-node-method="filterProductCategoryNode" |
| | | @change="(val) => handleInlineProductCategoryChange(scope.row, val)" /> |
| | | @change="(val) => handleInlineProductCategoryChange(scope.row, val)" |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.productCategory ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="规格型号" |
| | | prop="specificationModel" |
| | | min-width="160"> |
| | | min-width="200"> |
| | | <template #default="scope"> |
| | | <el-select v-if="scope.row.__editing" |
| | | v-model="scope.row.productModelId" |
| | |
| | | clearable |
| | | filterable |
| | | style="width: 100%" |
| | | @change="(val) => handleInlineProductModelChange(scope.row, val)"> |
| | | @change="(val) => handleInlineProductModelChange(scope.row, val)" |
| | | :disabled="isReviewedEdit"> |
| | | <el-option v-for="item in modelOptions" |
| | | :key="item.id" |
| | | :label="item.model" |
| | |
| | | min-width="160"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | controls-position="right" |
| | | v-model="scope.row.thickness" |
| | | :min="0" |
| | | :step="0.000000000000001" |
| | | :precision="15" |
| | | :step="1" |
| | | :precision="2" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | clearable |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.thickness ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="宽(mm)" |
| | | prop="width" |
| | | min-width="160"> |
| | | <el-table-column label="楼层编号" |
| | | prop="floorCode" |
| | | min-width="250" |
| | | show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | v-model="scope.row.width" |
| | | :min="0" |
| | | :step="1" |
| | | :precision="2" |
| | | style="width:100%" |
| | | placeholder="请输入" |
| | | clearable |
| | | @change="() => handleInlineSizeChange(scope.row)" |
| | | @input="() => handleInlineSizeChange(scope.row)" /> |
| | | <span v-else>{{ scope.row.width ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="高(mm)" |
| | | prop="height" |
| | | min-width="160"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | v-model="scope.row.height" |
| | | :min="0" |
| | | :step="1" |
| | | :precision="2" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable |
| | | @change="() => handleInlineSizeChange(scope.row)" |
| | | @input="() => handleInlineSizeChange(scope.row)" /> |
| | | <span v-else>{{ scope.row.height ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="结算单片面积(㎡)" |
| | | prop="settlePieceArea" |
| | | min-width="160"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | v-model="scope.row.settlePieceArea" |
| | | :min="0" |
| | | :step="0.00001" |
| | | :precision="5" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable |
| | | @change="() => handleInlineSettleAreaChange(scope.row)" /> |
| | | <span v-else>{{ scope.row.settlePieceArea ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="数量" |
| | | prop="quantity" |
| | | min-width="150"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | v-model="scope.row.quantity" |
| | | :step="0.1" |
| | | :min="0" |
| | | :precision="2" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable |
| | | @change="() => handleInlineQuantityChange(scope.row)" |
| | | @input="() => handleInlineQuantityChange(scope.row)" /> |
| | | <span v-else>{{ scope.row.quantity ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="面积(m²)" |
| | | prop="actualTotalArea" |
| | | min-width="160"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | v-model="scope.row.actualTotalArea" |
| | | :min="0" |
| | | :step="0.00001" |
| | | :precision="5" |
| | | style="width: 100%" |
| | | placeholder="自动计算" /> |
| | | <span v-else>{{ scope.row.actualTotalArea ?? "" }}</span> |
| | | <el-input v-if="scope.row.__editing" |
| | | v-model="scope.row.floorCode" |
| | | placeholder="请输入" |
| | | clearable |
| | | style="width: 100%" |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.floorCode ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="含税单价(元)" |
| | | prop="taxInclusiveUnitPrice" |
| | | min-width="140"> |
| | | min-width="160"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | :step="0.01" |
| | |
| | | clearable |
| | | @change="() => handleInlineUnitPriceChange(scope.row)" |
| | | @input="() => handleInlineUnitPriceChange(scope.row)" /> |
| | | <span v-else>{{ formattedNumber(null, null, scope.row.taxInclusiveUnitPrice ?? 0) }}</span> |
| | | <span v-else>{{ formattedNumber(null, null, scope.row.taxInclusiveUnitPrice) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="宽(mm)" |
| | | prop="width" |
| | | min-width="160"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | controls-position="right" |
| | | v-model="scope.row.width" |
| | | :min="0" |
| | | :step="1" |
| | | :precision="2" |
| | | style="width:100%" |
| | | placeholder="请输入" |
| | | clearable |
| | | @change="() => handleInlineSizeChange(scope.row)" |
| | | @input="() => handleInlineSizeChange(scope.row)" |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.width ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="高(mm)" |
| | | prop="height" |
| | | min-width="160"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | controls-position="right" |
| | | v-model="scope.row.height" |
| | | :min="0" |
| | | :step="1" |
| | | :precision="2" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable |
| | | @change="() => handleInlineSizeChange(scope.row)" |
| | | @input="() => handleInlineSizeChange(scope.row)" |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.height ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="数量" |
| | | prop="quantity" |
| | | min-width="150"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | controls-position="right" |
| | | v-model="scope.row.quantity" |
| | | :step="1" |
| | | :min="0" |
| | | :precision="0" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable |
| | | @change="() => handleInlineQuantityChange(scope.row)" |
| | | @input="() => handleInlineQuantityChange(scope.row)" |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.quantity ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="结算单片面积(㎡)" |
| | | prop="settlePieceArea" |
| | | min-width="200"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | controls-position="right" |
| | | v-model="scope.row.settlePieceArea" |
| | | :min="0" |
| | | :step="1" |
| | | :precision="4" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable |
| | | @change="() => handleInlineSettleAreaChange(scope.row)" |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.settlePieceArea ? Number(scope.row.settlePieceArea).toFixed(4) : "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="面积(m²)" |
| | | prop="actualTotalArea" |
| | | min-width="200"> |
| | | <template #default="scope"> |
| | | <el-input-number v-if="scope.row.__editing" |
| | | controls-position="right" |
| | | v-model="scope.row.actualTotalArea" |
| | | :min="0" |
| | | :step="1" |
| | | :precision="4" |
| | | style="width: 100%" |
| | | placeholder="自动计算" |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.actualTotalArea ? Number(scope.row.actualTotalArea).toFixed(4) : "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="税率(%)" |
| | |
| | | placeholder="请选择" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="() => handleInlineTaxRateChange(scope.row)"> |
| | | @change="() => handleInlineTaxRateChange(scope.row)" |
| | | :disabled="isReviewedEdit"> |
| | | <el-option label="1" |
| | | value="1" /> |
| | | <el-option label="3" |
| | |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | min-width="120" /> |
| | | <el-table-column label="发票类型" |
| | | prop="invoiceType" |
| | | min-width="120"> |
| | | <template #default="scope"> |
| | | <el-select v-if="scope.row.__editing" |
| | | v-model="scope.row.invoiceType" |
| | | placeholder="请选择" |
| | | clearable |
| | | style="width: 100%"> |
| | | <el-option label="增普票" |
| | | value="增普票" /> |
| | | <el-option label="增专票" |
| | | value="增专票" /> |
| | | </el-select> |
| | | <span v-else>{{ scope.row.invoiceType ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="加工要求" |
| | | prop="processRequirement" |
| | | min-width="160" |
| | |
| | | v-model="scope.row.processRequirement" |
| | | placeholder="请输入" |
| | | clearable |
| | | style="width: 100%" /> |
| | | style="width: 100%" |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.processRequirement ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="发票类型" |
| | | prop="invoiceType" |
| | | min-width="120"> |
| | | <template #default="scope"> |
| | | <el-select v-if="scope.row.__editing" |
| | | v-model="scope.row.invoiceType" |
| | | placeholder="请选择" |
| | | clearable |
| | | style="width: 100%" |
| | | :disabled="isReviewedEdit"> |
| | | <el-option label="增普票" |
| | | value="增普票" /> |
| | | <el-option label="增专票" |
| | | value="增专票" /> |
| | | </el-select> |
| | | <span v-else>{{ scope.row.invoiceType ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="备注" |
| | |
| | | v-model="scope.row.remark" |
| | | placeholder="请输入" |
| | | clearable |
| | | style="width: 100%" /> |
| | | style="width: 100%" |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.remark ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="楼层编号" |
| | | prop="floorCode" |
| | | min-width="140" |
| | | show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <el-input v-if="scope.row.__editing" |
| | | v-model="scope.row.floorCode" |
| | | placeholder="请输入" |
| | | clearable |
| | | style="width: 100%" /> |
| | | <span v-else>{{ scope.row.floorCode ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="重箱" |
| | |
| | | v-model="scope.row.heavyBox" |
| | | placeholder="请输入" |
| | | clearable |
| | | style="width: 100%" /> |
| | | style="width: 100%" |
| | | :disabled="isReviewedEdit" /> |
| | | <span v-else>{{ scope.row.heavyBox ?? "" }}</span> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </el-popover> |
| | | </template> |
| | | <template v-else> |
| | | <el-button link |
| | | <!-- 已审核模式:只能修改单价 --> |
| | | <el-button v-if="isReviewedEdit" |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | :disabled="isProductShipped(scope.row)" |
| | | @click="editProductInline(scope.row, scope.$index)"> |
| | | 编辑 |
| | | @click="editPriceOnly(scope.row)"> |
| | | 修改单价 |
| | | </el-button> |
| | | <!-- 未审核模式:完整编辑 --> |
| | | <template v-if="!isReviewedEdit"> |
| | | <el-button link |
| | | type="primary" |
| | | size="small" |
| | | :disabled="isProductShipped(scope.row)" |
| | | @click="editProductInline(scope.row, scope.$index)"> |
| | | 编辑 |
| | | </el-button> |
| | | <el-button link |
| | | type="primary" |
| | | size="small" |
| | | :disabled="isProductShipped(scope.row)" |
| | | @click="copyProductInline(scope.row, scope.$index)"> |
| | | 复制新建 |
| | | </el-button> |
| | | </template> |
| | | <el-popover :width="560" |
| | | trigger="click" |
| | | :hide-after="0" |
| | |
| | | <el-button type="primary" |
| | | plain |
| | | size="small" |
| | | :disabled="isProductShipped(scope.row)" |
| | | :disabled="isProductShipped(scope.row) || isReviewedEdit" |
| | | @click="startAddOtherAmountForRow(scope.row)"> |
| | | 新增 |
| | | </el-button> |
| | |
| | | clearable |
| | | placeholder="请选择额外加工项目" |
| | | style="width: 100%;" |
| | | :disabled="isProductShipped(scope.row)"> |
| | | :disabled="isProductShipped(scope.row) || isReviewedEdit"> |
| | | <el-option v-for="item in otherAmountSelectOptions" |
| | | :key="item.id" |
| | | :label="item.processName" |
| | |
| | | </el-select> |
| | | <div style="display:flex; justify-content:flex-end; gap: 8px;"> |
| | | <el-button size="small" |
| | | :disabled="isProductShipped(scope.row)" |
| | | :disabled="isProductShipped(scope.row) || isReviewedEdit" |
| | | @click="scope.row.__inlineOtherAmountAdding = false; scope.row.__inlineOtherAmountAddId = null"> |
| | | 取消 |
| | | </el-button> |
| | | <el-button type="primary" |
| | | size="small" |
| | | :disabled="isProductShipped(scope.row) || scope.row.__inlineOtherAmountAddId === null || scope.row.__inlineOtherAmountAddId === undefined || scope.row.__inlineOtherAmountAddId === ''" |
| | | :disabled="isProductShipped(scope.row) || isReviewedEdit || scope.row.__inlineOtherAmountAddId === null || scope.row.__inlineOtherAmountAddId === undefined || scope.row.__inlineOtherAmountAddId === ''" |
| | | @click="confirmAddOtherAmountForRow(scope.row)"> |
| | | 确认添加 |
| | | </el-button> |
| | |
| | | :precision="0" |
| | | style="width: 120px;" |
| | | placeholder="数量" |
| | | :disabled="operationType === 'view' || isProductShipped(scope.row)" |
| | | :disabled="operationType === 'view' || isProductShipped(scope.row) || isReviewedEdit" |
| | | @change="handleOtherAmountQuantityChange(scope.row)" /> |
| | | <el-button type="danger" |
| | | link |
| | | size="small" |
| | | :disabled="isProductShipped(scope.row)" |
| | | :disabled="isProductShipped(scope.row) || isReviewedEdit" |
| | | @click="removeOtherAmountAtForRow(scope.row, idx)"> |
| | | 删除 |
| | | </el-button> |
| | |
| | | clearable |
| | | type="textarea" |
| | | :rows="2" |
| | | :disabled="operationType === 'view'" /> |
| | | :disabled="operationType === 'view' || isReviewedEdit" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | clearable |
| | | type="textarea" |
| | | :rows="2" |
| | | :disabled="operationType === 'view'" /> |
| | | :disabled="operationType === 'view' || isReviewedEdit" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | :on-success="handleUploadSuccess" |
| | | :on-remove="handleRemove"> |
| | | <el-button type="primary" |
| | | v-if="operationType !== 'view'">上传</el-button> |
| | | v-if="operationType !== 'view' || isCompletedOrder">上传</el-button> |
| | | <template #tip |
| | | v-if="operationType !== 'view'"> |
| | | v-if="operationType !== 'view' || isCompletedOrder"> |
| | | <div class="el-upload__tip"> |
| | | 文件格式支持 |
| | | doc,docx,xls,xlsx,ppt,pptx,pdf,txt,xml,jpg,jpeg,png,gif,bmp,rar,zip,7z |
| | |
| | | prop="actualPieceArea"> |
| | | <el-input-number v-model="productForm.actualPieceArea" |
| | | :min="0" |
| | | :step="0.00001" |
| | | :precision="5" |
| | | :step="0.0001" |
| | | :precision="4" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable |
| | |
| | | prop="actualTotalArea"> |
| | | <el-input-number v-model="productForm.actualTotalArea" |
| | | :min="0" |
| | | :step="0.00001" |
| | | :precision="5" |
| | | :step="0.0001" |
| | | :precision="4" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable /> |
| | |
| | | prop="settlePieceArea"> |
| | | <el-input-number v-model="productForm.settlePieceArea" |
| | | :min="0" |
| | | :step="0.00001" |
| | | :precision="5" |
| | | :step="0.0001" |
| | | :precision="4" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable |
| | |
| | | prop="settleTotalArea"> |
| | | <el-input-number v-model="productForm.settleTotalArea" |
| | | :min="0" |
| | | :step="0.00001" |
| | | :precision="5" |
| | | :step="0.0001" |
| | | :precision="4" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable /> |
| | |
| | | prop="settleTotalArea"> |
| | | <el-input-number v-model="productForm.settleTotalArea" |
| | | :min="0" |
| | | :step="0.00001" |
| | | :precision="5" |
| | | :step="0.0001" |
| | | :precision="4" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | clearable /> |
| | |
| | | <FormDialog v-model="importUpload.open" |
| | | :title="importUpload.title" |
| | | :width="'600px'" |
| | | @close="importUpload.open = false" |
| | | :loading="importUpload.isUploading" |
| | | @close="onClose" |
| | | @confirm="submitImportFile" |
| | | @cancel="importUpload.open = false"> |
| | | @cancel="onClose"> |
| | | <el-upload ref="importUploadRef" |
| | | :limit="1" |
| | | accept=".xlsx,.xls" |
| | |
| | | :on-error="importUpload.onError" |
| | | :on-progress="importUpload.onProgress" |
| | | :on-change="importUpload.onChange" |
| | | :on-exceed="importUpload.onExceed" |
| | | :auto-upload="false" |
| | | drag> |
| | | <i class="el-icon-upload"></i> |
| | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- 入库产品选择弹窗 --> |
| | | <el-dialog v-model="stockDialogVisible" |
| | | title="选择入库产品" |
| | | width="60%" |
| | | :close-on-click-modal="false"> |
| | | <div style="margin-bottom: 12px;"> |
| | | <el-form> |
| | | <el-form-item required> |
| | | <template #label> |
| | | <div style="display: flex; align-items: center; justify-content: space-between; width: 100%;"> |
| | | <span>审批人选择:</span> |
| | | <el-button type="primary" |
| | | size="small" |
| | | @click="addStockApproverNode" |
| | | icon="Plus">新增节点</el-button> |
| | | </div> |
| | | </template> |
| | | <div class="approver-nodes-container"> |
| | | <div v-for="(node, index) in stockApproverNodes" |
| | | :key="node.id" |
| | | class="approver-node-item"> |
| | | <div class="approver-node-header"> |
| | | <span class="approver-node-label">审批节点 {{ index + 1 }}</span> |
| | | <el-button v-if="stockApproverNodes.length > 1" |
| | | type="danger" |
| | | size="small" |
| | | text |
| | | @click="removeStockApproverNode(index)" |
| | | icon="Delete">删除</el-button> |
| | | </div> |
| | | <el-select v-model="node.userId" |
| | | placeholder="请选择审批人" |
| | | filterable |
| | | clearable |
| | | style="width: 100%;"> |
| | | <el-option v-for="item in stockApproverOptions" |
| | | :key="item.userId" |
| | | :label="item.userName" |
| | | :value="item.userId" /> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-table :data="stockProductList" |
| | | border |
| | | stripe |
| | | v-loading="stockLoading" |
| | | height="400px" |
| | | @selection-change="val => selectedStockProductIds = val.map(item => item.id)"> |
| | | <el-table-column type="selection" |
| | | width="55" |
| | | align="center" /> |
| | | <el-table-column align="center" |
| | | label="序号" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column prop="productCategory" |
| | | label="产品大类" |
| | | show-overflow-tooltip /> |
| | | <el-table-column prop="specificationModel" |
| | | label="规格型号" |
| | | show-overflow-tooltip /> |
| | | <el-table-column prop="quantity" |
| | | label="数量" |
| | | width="100" /> |
| | | <el-table-column prop="stockedQuantity" |
| | | label="已入库数量" |
| | | width="120" |
| | | align="center" |
| | | show-overflow-tooltip /> |
| | | <el-table-column prop="floorCode" |
| | | label="楼层编号" |
| | | show-overflow-tooltip /> |
| | | </el-table> |
| | | <template #footer> |
| | | <el-button @click="stockDialogVisible = false">取消</el-button> |
| | | <el-button type="primary" |
| | | @click="submitStock" |
| | | :disabled="selectedStockProductIds.length === 0"> |
| | | 确认入库 |
| | | </el-button> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog v-model="ledgerQrDialogVisible" |
| | | title="销售订单二维码" |
| | | width="360px" |
| | | draggable |
| | | :close-on-click-modal="false"> |
| | | <div class="ledger-qr-dialog"> |
| | | <img v-if="ledgerQrCompositeUrl" |
| | | :src="ledgerQrCompositeUrl" |
| | | alt="销售订单二维码" |
| | | class="ledger-qr-composite-img" /> |
| | | <el-button type="primary" |
| | | class="ledger-qr-save-btn" |
| | | :disabled="!ledgerQrCompositeUrl" |
| | | @click="downloadLedgerQrCode"> |
| | | 保存图片 |
| | | </el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!-- 反审核弹窗 --> |
| | | <el-dialog v-model="reverseAuditDialogVisible" |
| | | title="反审核确认" |
| | | width="500px" |
| | | :close-on-click-modal="false" |
| | | class="reverse-audit-dialog"> |
| | | <el-form label-width="110px" |
| | | label-position="left"> |
| | | <el-form-item label="反审核类型"> |
| | | <el-radio-group v-model="reverseAuditForm.counterReviewType"> |
| | | <el-radio :label="1"> |
| | | <span>作废订单</span> |
| | | <span style="color: #909399; font-size: 12px; margin-left: 4px;">(不生成新订单)</span> |
| | | </el-radio> |
| | | <el-radio :label="2"> |
| | | <span>重新生成</span> |
| | | <span style="color: #909399; font-size: 12px; margin-left: 4px;">(跳转到新增页面编辑)</span> |
| | | </el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="反审核原因"> |
| | | <el-input v-model="reverseAuditForm.counterReviewDesc" |
| | | type="textarea" |
| | | :rows="4" |
| | | placeholder="请输入反审核原因" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="reverse-audit-warning"> |
| | | <el-icon style="color: #E6A23C; margin-right: 4px;"><WarningFilled /></el-icon> |
| | | 注意:反审核将自动作废该订单对应的所有入库、出库、发货单据 |
| | | </div> |
| | | <template #footer> |
| | | <el-button @click="reverseAuditDialogVisible = false">取消</el-button> |
| | | <el-button type="danger" |
| | | @click="confirmReverseAudit" |
| | | :disabled="!reverseAuditForm.counterReviewType || !reverseAuditForm.counterReviewDesc.trim()">确认反审核</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { getToken } from "@/utils/auth"; |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { onMounted, ref, getCurrentInstance, watch, nextTick } from "vue"; |
| | | import { onMounted, ref, reactive, getCurrentInstance, watch, nextTick } from "vue"; |
| | | import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import { ArrowDown } from "@element-plus/icons-vue"; |
| | | import { ArrowDown, WarningFilled } from "@element-plus/icons-vue"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { approveUserList } from "@/api/collaborativeApproval/approvalProcess.js"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | |
| | | getSalesInvoices, |
| | | getSalesLabel, |
| | | salesStock, |
| | | counterReview, |
| | | markOrderCompleted, |
| | | incrementPrintCount, |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import useFormData from "@/hooks/useFormData.js"; |
| | |
| | | import { printSalesOrder } from "./components/salesOrderPrint.js"; |
| | | import { printSalesDeliveryNote } from "./components/salesDeliveryPrint.js"; |
| | | import { printSalesLabel } from "./components/salesLabelPrint.js"; |
| | | import QRCode from "qrcode"; |
| | | // import { salesLedgerProductSetProcessFlowConfig } from "@/api/salesManagement/salesProcessFlowConfig.js"; |
| | | |
| | | const userStore = useUserStore(); |
| | |
| | | const processFlowSelectBoundRouteId = ref(null); |
| | | const processFlowSelectBoundRouteName = ref(""); |
| | | |
| | | // 入库弹窗相关 |
| | | const stockDialogVisible = ref(false); |
| | | const stockProductList = ref([]); |
| | | const selectedStockProductIds = ref([]); |
| | | const stockLoading = ref(false); |
| | | const currentStockLedgerId = ref(null); |
| | | const stockApproverOptions = ref([]); |
| | | const stockApproverNodes = ref([{ id: 1, userId: null }]); |
| | | let nextStockApproverId = 2; |
| | | const addStockApproverNode = () => { |
| | | stockApproverNodes.value.push({ id: nextStockApproverId++, userId: null }); |
| | | }; |
| | | const removeStockApproverNode = index => { |
| | | stockApproverNodes.value.splice(index, 1); |
| | | }; |
| | | |
| | | const ledgerQrDialogVisible = ref(false); |
| | | const ledgerQrCompositeUrl = ref(""); |
| | | const ledgerQrDownloadBaseName = ref(""); |
| | | |
| | | const sanitizeLedgerQrFilename = s => |
| | | String(s) |
| | | .replace(/[\\/:*?"<>|]/g, "_") |
| | | .trim() |
| | | .slice(0, 80) || "ledger"; |
| | | |
| | | const wrapLedgerQrTextLines = (ctx, text, maxWidth) => { |
| | | const chars = [...text]; |
| | | const lines = []; |
| | | let line = ""; |
| | | for (const ch of chars) { |
| | | const test = line + ch; |
| | | if (ctx.measureText(test).width > maxWidth && line.length) { |
| | | lines.push(line); |
| | | line = ch; |
| | | } else { |
| | | line = test; |
| | | } |
| | | } |
| | | if (line) lines.push(line); |
| | | return lines; |
| | | }; |
| | | |
| | | const buildLedgerQrCompositeDataUrl = row => |
| | | new Promise((resolve, reject) => { |
| | | const payload = JSON.stringify({ |
| | | id: row.id, |
| | | salesContractNo: (row.salesContractNo ?? "").trim(), |
| | | type: "XS", |
| | | }); |
| | | QRCode.toDataURL(payload, { width: 220, margin: 2 }) |
| | | .then(qrDataUrl => { |
| | | const contract = (row.salesContractNo ?? "").trim() || "—"; |
| | | const img = new Image(); |
| | | img.onload = () => { |
| | | const QR_SIZE = 220; |
| | | const padTop = 16; |
| | | const gapAfterQr = 14; |
| | | const bottomPad = 48; |
| | | const horizontalPad = 20; |
| | | const lineHeight = 20; |
| | | const fontSize = 14; |
| | | const label = `销售合同号:${contract}`; |
| | | |
| | | const canvas = document.createElement("canvas"); |
| | | const ctx = canvas.getContext("2d"); |
| | | canvas.width = Math.max(QR_SIZE + horizontalPad * 2, 280); |
| | | ctx.font = `${fontSize}px "Microsoft YaHei", "PingFang SC", sans-serif`; |
| | | const lines = wrapLedgerQrTextLines( |
| | | ctx, |
| | | label, |
| | | canvas.width - horizontalPad * 2 |
| | | ); |
| | | const textBlockHeight = lines.length * lineHeight; |
| | | canvas.height = |
| | | padTop + QR_SIZE + gapAfterQr + textBlockHeight + bottomPad; |
| | | |
| | | ctx.fillStyle = "#ffffff"; |
| | | ctx.fillRect(0, 0, canvas.width, canvas.height); |
| | | |
| | | const qrX = (canvas.width - QR_SIZE) / 2; |
| | | ctx.drawImage(img, qrX, padTop, QR_SIZE, QR_SIZE); |
| | | |
| | | ctx.fillStyle = "#606266"; |
| | | ctx.font = `${fontSize}px "Microsoft YaHei", "PingFang SC", sans-serif`; |
| | | ctx.textAlign = "center"; |
| | | ctx.textBaseline = "top"; |
| | | const textY0 = padTop + QR_SIZE + gapAfterQr; |
| | | lines.forEach((ln, i) => { |
| | | ctx.fillText(ln, canvas.width / 2, textY0 + i * lineHeight); |
| | | }); |
| | | |
| | | const baseName = sanitizeLedgerQrFilename( |
| | | contract !== "—" ? contract : String(row.id) |
| | | ); |
| | | resolve({ dataUrl: canvas.toDataURL("image/png"), baseName }); |
| | | }; |
| | | img.onerror = () => reject(new Error("二维码图片加载失败")); |
| | | img.src = qrDataUrl; |
| | | }) |
| | | .catch(reject); |
| | | }); |
| | | |
| | | const openLedgerQrDialog = async row => { |
| | | if (row?.id === undefined || row?.id === null || row?.id === "") { |
| | | ElMessage.warning("无法生成二维码:缺少台账 ID"); |
| | | return; |
| | | } |
| | | ledgerQrCompositeUrl.value = ""; |
| | | ledgerQrDownloadBaseName.value = ""; |
| | | try { |
| | | const { dataUrl, baseName } = await buildLedgerQrCompositeDataUrl(row); |
| | | ledgerQrCompositeUrl.value = dataUrl; |
| | | ledgerQrDownloadBaseName.value = baseName; |
| | | ledgerQrDialogVisible.value = true; |
| | | } catch { |
| | | ElMessage.error("二维码生成失败"); |
| | | } |
| | | }; |
| | | |
| | | const downloadLedgerQrCode = () => { |
| | | if (!ledgerQrCompositeUrl.value) return; |
| | | const a = document.createElement("a"); |
| | | a.href = ledgerQrCompositeUrl.value; |
| | | a.download = `销售台账二维码-${ledgerQrDownloadBaseName.value}.png`; |
| | | a.click(); |
| | | }; |
| | | |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | // 已完成订单标记:view 模式但附件上传仍可用 |
| | | const isCompletedOrder = ref(false); |
| | | // 已审核订单编辑模式:只能修改单价,其他字段禁用 |
| | | const isReviewedEdit = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | customerName: "", // 客户名称 |
| | | customerId: "", // 客户ID(查询下拉) |
| | | salesContractNo: "", // 销售合同编号 |
| | | width: undefined, // 产品宽(mm) |
| | | height: undefined, // 产品高(mm) |
| | | entryDate: null, // 录入日期 |
| | | entryDateStart: undefined, |
| | | entryDateEnd: undefined, |
| | | deliveryStatus: undefined, // 发货状态:1未发货 2审批中 3审批失败 4已发货 |
| | | stockStatus: undefined, // 入库状态:0未入库 1已入库 |
| | | deliveryStatus: undefined, // 发货状态:1未发货 2审批中 3审批不通过 4审批通过 5已发货 6部分发货 |
| | | stockStatus: undefined, // 入库状态:0未入库 1部分入库 2已入库 |
| | | reviewStatus: undefined, // 审核状态:0待审核 1已审核 2已反审 |
| | | orderStatus: undefined, // 订单状态:0进行中 1已完成 |
| | | }, |
| | | form: { |
| | | salesContractNo: "", |
| | |
| | | maintenanceTime: "", |
| | | productData: [], |
| | | executionDate: "", |
| | | reviewStatus: undefined, |
| | | stockStatus: undefined, |
| | | }, |
| | | rules: { |
| | | salesman: [{ required: true, message: "请选择", trigger: "change" }], |
| | |
| | | return (productData.value || []).some(r => r && r.__editing); |
| | | }; |
| | | |
| | | const buildEmptyInlineProductRow = () => ({ |
| | | id: null, |
| | | __tempKey: `__temp_${Date.now()}_${Math.random().toString(16).slice(2)}`, |
| | | __editing: true, |
| | | __isNew: true, |
| | | __productCategoryId: null, |
| | | productCategory: "", |
| | | productModelId: null, |
| | | specificationModel: "", |
| | | thickness: null, |
| | | quantity: null, |
| | | taxInclusiveUnitPrice: null, |
| | | taxRate: "", |
| | | taxInclusiveTotalPrice: null, |
| | | taxExclusiveTotalPrice: null, |
| | | invoiceType: "", |
| | | width: null, |
| | | height: null, |
| | | perimeter: null, |
| | | actualPieceArea: null, |
| | | actualTotalArea: null, |
| | | settlePieceArea: null, |
| | | settleTotalArea: null, |
| | | processRequirement: "", |
| | | remark: "", |
| | | salesProductProcessList: [], |
| | | processFlowConfigId: null, |
| | | floorCode: "", |
| | | heavyBox: "", |
| | | }); |
| | | |
| | | const addProductInline = async () => { |
| | | if (operationType.value === "view") return; |
| | | if (hasEditingProductRow()) { |
| | |
| | | } |
| | | await getProductOptions(); |
| | | await fetchOtherAmountSelectOptions(true); |
| | | const row = { |
| | | id: null, |
| | | __tempKey: `__temp_${Date.now()}_${Math.random().toString(16).slice(2)}`, |
| | | __editing: true, |
| | | __isNew: true, |
| | | __productCategoryId: null, |
| | | productCategory: "", |
| | | productModelId: null, |
| | | specificationModel: "", |
| | | thickness: null, |
| | | quantity: 0, |
| | | taxInclusiveUnitPrice: 0, |
| | | taxRate: "", |
| | | taxInclusiveTotalPrice: 0, |
| | | taxExclusiveTotalPrice: 0, |
| | | invoiceType: "", |
| | | width: 0, |
| | | height: 0, |
| | | perimeter: 0, |
| | | actualPieceArea: 0, |
| | | actualTotalArea: 0, |
| | | settlePieceArea: 0, |
| | | settleTotalArea: 0, |
| | | processRequirement: "", |
| | | remark: "", |
| | | salesProductProcessList: [], |
| | | processFlowConfigId: null, |
| | | floorCode: "", |
| | | heavyBox: "", |
| | | }; |
| | | const row = buildEmptyInlineProductRow(); |
| | | productData.value.push(row); |
| | | editingProductRow.value = row; |
| | | // 让现有的计算/其他金额逻辑复用当前行 |
| | | productForm.value = row; |
| | | }; |
| | | |
| | | const copyProductInline = async row => { |
| | | if (operationType.value === "view") return; |
| | | if (!row) return; |
| | | if (isProductShipped(row)) { |
| | | proxy.$modal.msgWarning("已发货或审核通过的产品不能复制"); |
| | | return; |
| | | } |
| | | if (hasEditingProductRow()) { |
| | | proxy.$modal.msgWarning("请先保存或取消当前编辑行"); |
| | | return; |
| | | } |
| | | await getProductOptions(); |
| | | await fetchOtherAmountSelectOptions(true); |
| | | |
| | | const copied = buildEmptyInlineProductRow(); |
| | | copied.__productCategoryId = |
| | | row.__productCategoryId ?? |
| | | findNodeIdByLabel(productOptions.value, row.productCategory) ?? |
| | | null; |
| | | copied.productCategory = row.productCategory ?? ""; |
| | | copied.productModelId = row.productModelId ?? null; |
| | | copied.specificationModel = row.specificationModel ?? ""; |
| | | copied.thickness = |
| | | row.thickness !== null && |
| | | row.thickness !== undefined && |
| | | row.thickness !== "" |
| | | ? Number(row.thickness) |
| | | : null; |
| | | copied.floorCode = row?.floorCode ?? row?.floor_code ?? ""; |
| | | |
| | | const srcUnit = row?.taxInclusiveUnitPrice; |
| | | const unitNum = |
| | | srcUnit !== null && srcUnit !== undefined && srcUnit !== "" |
| | | ? Number(srcUnit) |
| | | : NaN; |
| | | copied.taxInclusiveUnitPrice = Number.isFinite(unitNum) ? unitNum : null; |
| | | |
| | | // 复制新建带出:产品大类、规格型号、厚度、楼层编号、单价;其余数量/面积/总价等留空,避免出现 0.00 |
| | | copied.quantity = null; |
| | | copied.taxInclusiveTotalPrice = null; |
| | | copied.taxExclusiveTotalPrice = null; |
| | | copied.width = null; |
| | | copied.height = null; |
| | | copied.perimeter = null; |
| | | copied.actualPieceArea = null; |
| | | copied.actualTotalArea = null; |
| | | copied.settlePieceArea = null; |
| | | copied.settleTotalArea = null; |
| | | |
| | | // 复制时按“产品大类 + 规格型号名称”反查型号 id,确保下拉能正确回显 |
| | | try { |
| | | if (copied.__productCategoryId) { |
| | | const models = await modelList({ id: copied.__productCategoryId }); |
| | | modelOptions.value = models || []; |
| | | const matchedModel = (modelOptions.value || []).find( |
| | | m => m.model === copied.specificationModel |
| | | ); |
| | | copied.productModelId = matchedModel?.id ?? copied.productModelId ?? null; |
| | | } |
| | | } catch (e) { |
| | | console.error("复制时加载产品规格型号失败", e); |
| | | } |
| | | |
| | | productData.value.push(copied); |
| | | editingProductRow.value = copied; |
| | | productForm.value = copied; |
| | | }; |
| | | |
| | | /** 已审核订单:仅修改含税单价 */ |
| | | const editPriceOnly = (row) => { |
| | | if (operationType.value === "view") return; |
| | | if (!row) return; |
| | | stopOtherEditingRows(); |
| | | row.__editing = true; |
| | | row.__priceOnly = true; // 标记只修改单价 |
| | | }; |
| | | |
| | | const editProductInline = async (row, index) => { |
| | |
| | | } |
| | | if (row.actualTotalArea <= 0) { |
| | | proxy.$modal.msgWarning("面积必须大于0"); |
| | | return false; |
| | | } |
| | | if (row.taxInclusiveUnitPrice <= 0) { |
| | | proxy.$modal.msgWarning("含税单价必须大于0"); |
| | | return false; |
| | | } |
| | | if (!row.productModelId) { |
| | |
| | | onChange: (file, fileList) => { |
| | | console.log("文件状态改变", file, fileList); |
| | | }, |
| | | onExceed: (files, fileList) => { |
| | | if (importUploadRef.value) { |
| | | importUploadRef.value.clearFiles(); |
| | | const file = files[0]; |
| | | importUploadRef.value.handleStart(file); |
| | | } |
| | | }, |
| | | onProgress: (event, file, fileList) => { |
| | | console.log("上传中...", event.percent); |
| | | }, |
| | |
| | | proxy.$modal.msgError("导入失败,请重试"); |
| | | }, |
| | | }); |
| | | |
| | | const HISTORY_IMPORT_URL_MAP = { |
| | | notShipped: "/sales/ledger/salesHistory/notShippingImport", |
| | | shipped: "/sales/ledger/salesHistory/shippingImport", |
| | | }; |
| | | const HISTORY_IMPORT_TEMPLATE_URL_MAP = { |
| | | notShipped: "/sales/ledger/salesHistory/notShippingImportTemplate", |
| | | shipped: "/sales/ledger/salesHistory/shippingImportTemplate", |
| | | }; |
| | | const HISTORY_IMPORT_TEMPLATE_FILE_NAME_MAP = { |
| | | notShipped: "销售发货历史数据导入模板-未发货.xlsx", |
| | | shipped: "销售发货历史数据导入模板-已发货.xlsx", |
| | | }; |
| | | const currentImportCommand = ref("default"); |
| | | const changeDaterange = value => { |
| | | if (value) { |
| | | searchForm.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD"); |
| | |
| | | searchForm.entryDateEnd = undefined; |
| | | } |
| | | handleQuery(); |
| | | }; |
| | | |
| | | /** 批量按钮禁用判断:根据选中行的审核状态和订单状态控制按钮可用性 |
| | | * 未审核(0):只能审核、删除、编辑 |
| | | * 已审核(1):可以反审、入库、发货、导出、打印、工艺路线 |
| | | * 已完成(orderStatus=1):所有操作按钮禁用 |
| | | * 未选中任何行时所有批量按钮禁用 |
| | | */ |
| | | const isBatchButtonDisabled = (action) => { |
| | | if (selectedRows.value.length === 0) return true; |
| | | const hasCompleted = selectedRows.value.some(r => Number(r.orderStatus) === 1); |
| | | // 已完成订单:所有操作按钮禁用 |
| | | if (hasCompleted && action !== 'markCompleted') return true; |
| | | const statuses = selectedRows.value.map(r => Number(r.reviewStatus)); |
| | | const allUnreviewed = statuses.every(s => s === 0); |
| | | const allReviewed = statuses.every(s => s === 1); |
| | | switch (action) { |
| | | case 'audit': |
| | | return !allUnreviewed; |
| | | case 'reverseAudit': |
| | | return !allReviewed; |
| | | case 'stock': |
| | | return !allReviewed; |
| | | case 'delivery': |
| | | return !allReviewed; |
| | | case 'export': |
| | | return !allReviewed; |
| | | case 'delete': |
| | | return !allUnreviewed; |
| | | case 'print': |
| | | return !allReviewed; |
| | | case 'markCompleted': |
| | | // 只有已审核且未完成的订单才能标记完成 |
| | | return !allReviewed || hasCompleted; |
| | | default: |
| | | return false; |
| | | } |
| | | }; |
| | | |
| | | // 查询列表 |
| | |
| | | expandedRowKeys.value = []; |
| | | getList(); |
| | | }; |
| | | |
| | | /** 审核按钮操作 */ |
| | | const handleAudit = async () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("请选择要审核的数据"); |
| | | return; |
| | | } |
| | | const canNotAudit = selectedRows.value.filter( |
| | | row => Number(row.reviewStatus) !== 0 |
| | | ); |
| | | if (canNotAudit.length > 0) { |
| | | proxy.$modal.msgWarning("选中的数据中包含非待审核项,请重新选择"); |
| | | return; |
| | | } |
| | | |
| | | // 录入人不能审核该条数据 |
| | | const isEntryPerson = selectedRows.value.some( |
| | | row => String(row.entryPerson) === String(userStore.id) |
| | | ); |
| | | if (isEntryPerson) { |
| | | proxy.$modal.msgWarning("录入人不能审核自己提交的数据"); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | await ElMessageBox.confirm("是否确认审核选中的销售台账?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }); |
| | | for (const row of selectedRows.value) { |
| | | await addOrUpdateSalesLedger({ ...row, reviewStatus: 1 }); |
| | | } |
| | | proxy.$modal.msgSuccess("审核成功"); |
| | | getList(); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
| | | }; |
| | | |
| | | /** 反审核弹窗状态 */ |
| | | const reverseAuditDialogVisible = ref(false); |
| | | const reverseAuditForm = reactive({ |
| | | counterReviewType: null, |
| | | counterReviewDesc: "", |
| | | }); |
| | | |
| | | /** 反审按钮操作 — 打开弹窗 */ |
| | | const handleReverseAudit = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("请选择要反审核的数据"); |
| | | return; |
| | | } |
| | | const canNotReverse = selectedRows.value.filter( |
| | | row => Number(row.reviewStatus) !== 1 |
| | | ); |
| | | if (canNotReverse.length > 0) { |
| | | proxy.$modal.msgWarning("选中的数据中包含非已审核项,请重新选择"); |
| | | return; |
| | | } |
| | | // 重置弹窗表单 |
| | | reverseAuditForm.counterReviewType = null; |
| | | reverseAuditForm.counterReviewDesc = ""; |
| | | reverseAuditDialogVisible.value = true; |
| | | }; |
| | | |
| | | /** 反审核确认操作 */ |
| | | const confirmReverseAudit = async () => { |
| | | if (!reverseAuditForm.counterReviewType) { |
| | | proxy.$modal.msgWarning("请选择反审核类型"); |
| | | return; |
| | | } |
| | | if (!reverseAuditForm.counterReviewDesc.trim()) { |
| | | proxy.$modal.msgWarning("请输入反审核原因"); |
| | | return; |
| | | } |
| | | try { |
| | | const ids = selectedRows.value.map(row => row.id); |
| | | const res = await counterReview({ |
| | | ids, |
| | | counterReviewType: reverseAuditForm.counterReviewType, |
| | | counterReviewDesc: reverseAuditForm.counterReviewDesc, |
| | | }); |
| | | reverseAuditDialogVisible.value = false; |
| | | proxy.$modal.msgSuccess("反审核成功"); |
| | | |
| | | // 重新生成类型:跳转到新增台账页面(预填数据) |
| | | if (reverseAuditForm.counterReviewType === 2 && res.newLedgerIds && res.newLedgerIds.length > 0) { |
| | | // 单条反审时跳转到新增页面编辑新台账 |
| | | if (res.newLedgerIds.length === 1) { |
| | | const newId = res.newLedgerIds[0]; |
| | | getSalesLedgerWithProducts({ id: newId, type: 1 }).then(detail => { |
| | | openFormWithPreFill(detail); |
| | | }); |
| | | } |
| | | } |
| | | getList(); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
| | | }; |
| | | |
| | | /** 标记完成操作 */ |
| | | const handleMarkCompleted = async () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("请选择要标记完成的数据"); |
| | | return; |
| | | } |
| | | const cannotComplete = selectedRows.value.filter( |
| | | row => Number(row.reviewStatus) !== 1 || Number(row.orderStatus) === 1 |
| | | ); |
| | | if (cannotComplete.length > 0) { |
| | | proxy.$modal.msgWarning("选中的数据中包含非已审核或已完成的项,请重新选择"); |
| | | return; |
| | | } |
| | | try { |
| | | await ElMessageBox.confirm( |
| | | "标记完成后订单将变为只读,只能查看和上传下载附件,不可撤销。是否确认?", |
| | | "提示", |
| | | { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" } |
| | | ); |
| | | const ids = selectedRows.value.map(row => row.id); |
| | | await markOrderCompleted({ ids }); |
| | | proxy.$modal.msgSuccess("标记完成成功"); |
| | | getList(); |
| | | } catch { |
| | | // 用户取消 |
| | | } |
| | | }; |
| | | |
| | | /** 用预填数据打开新增台账页面(重新生成场景) */ |
| | | const openFormWithPreFill = async (detail) => { |
| | | operationType.value = "add"; |
| | | form.value = {}; |
| | | productData.value = []; |
| | | selectedQuotation.value = null; |
| | | let userLists = await userListNoPage(); |
| | | userList.value = userLists.data; |
| | | customerList().then(res => { |
| | | customerOption.value = res; |
| | | }); |
| | | // 预填原台账数据到新增表单 |
| | | form.value.customerId = detail.customerId; |
| | | form.value.customerName = detail.customerName; |
| | | form.value.projectName = detail.projectName; |
| | | form.value.salesman = detail.salesman; |
| | | form.value.entryPerson = Number(userStore.id); |
| | | form.value.entryDate = getCurrentDate(); |
| | | form.value.executionDate = detail.executionDate || getCurrentDate(); |
| | | form.value.deliveryDate = detail.deliveryDate; |
| | | form.value.paymentMethod = detail.paymentMethod; |
| | | form.value.contractAmount = detail.contractAmount; |
| | | form.value.remarks = detail.remarks; |
| | | form.value.customerRemarks = detail.customerRemarks ?? detail.customer_remarks ?? ""; |
| | | productData.value = detail.productData || []; |
| | | form.value.deliveryDate = dayjs(form.value.entryDate).add(7, "day").format("YYYY-MM-DD"); |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | |
| | | const paginationChange = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | |
| | | tableLoading.value = true; |
| | | const { entryDate, ...rest } = searchForm; |
| | | // 将范围日期字段传递给后端 |
| | | const params = { ...rest, ...page }; |
| | | const params = { ...rest, ...page, reviewStatusList: [0, 1] }; |
| | | // 移除录入日期的默认值设置,只保留范围日期字段 |
| | | delete params.entryDate; |
| | | // 查询客户名称与新增保持一致:先选 customerId,再映射为 customerName 查询 |
| | |
| | | delete params.customerName; |
| | | } |
| | | } |
| | | const widthValue = params.width != null ? String(params.width).trim() : ""; |
| | | if (widthValue) { |
| | | params.width = widthValue; |
| | | } else { |
| | | delete params.width; |
| | | } |
| | | const heightValue = params.height != null ? String(params.height).trim() : ""; |
| | | if (heightValue) { |
| | | params.height = heightValue; |
| | | } else { |
| | | delete params.height; |
| | | } |
| | | const shouldAutoExpandBySize = Boolean(params.width || params.height); |
| | | delete params.customerId; |
| | | return ledgerListPage(params) |
| | | .then(res => { |
| | | .then(async res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | tableData.value.map(item => { |
| | | item.children = []; |
| | | }); |
| | | if (shouldAutoExpandBySize && tableData.value.length > 0) { |
| | | const loadChildrenTasks = tableData.value.map(item => |
| | | productList({ salesLedgerId: item.id, type: 1 }) |
| | | .then(productRes => { |
| | | item.children = Array.isArray(productRes?.data) |
| | | ? productRes.data |
| | | : []; |
| | | }) |
| | | .catch(() => { |
| | | item.children = []; |
| | | }) |
| | | ); |
| | | await Promise.all(loadChildrenTasks); |
| | | expandedRowKeys.value = tableData.value.map(item => item.id); |
| | | } |
| | | total.value = res.total; |
| | | return res; |
| | | }) |
| | |
| | | return; |
| | | } |
| | | const row = selectedRows.value[0] || {}; |
| | | if (Number(row.reviewStatus) !== 1) { |
| | | ElMessage.warning("只有已审核的台账才能进行入库操作"); |
| | | return; |
| | | } |
| | | const id = row?.id; |
| | | if (!id) { |
| | | ElMessage.warning("所选数据缺少id,无法入库"); |
| | | return; |
| | | } |
| | | if (Number(row.stockStatus) === 1) { |
| | | ElMessage.info("该台账已入库,无需重复操作"); |
| | | if (Number(row.stockStatus) === 2) { |
| | | ElMessage.info("该台账已全部入库,无需重复操作"); |
| | | return; |
| | | } |
| | | |
| | | currentStockLedgerId.value = id; |
| | | selectedStockProductIds.value = []; |
| | | stockProductList.value = []; |
| | | stockApproverNodes.value = [{ id: 1, userId: null }]; |
| | | nextStockApproverId = 2; |
| | | stockDialogVisible.value = true; |
| | | stockLoading.value = true; |
| | | |
| | | try { |
| | | await ElMessageBox.confirm("确认对所选台账执行入库?", "提示", { |
| | | const approverRes = await approveUserList({ approveType: 9 }); |
| | | stockApproverOptions.value = Array.isArray(approverRes?.data) |
| | | ? approverRes.data.map(item => ({ |
| | | userId: item.userId, |
| | | userName: item.userName, |
| | | })) |
| | | : []; |
| | | const res = await productList({ salesLedgerId: id, type: 1 }); |
| | | stockProductList.value = []; |
| | | stockProductList.value = |
| | | res.data.filter( |
| | | item => item.productStockStatus == 0 || item.productStockStatus == 1 |
| | | ) || []; |
| | | } catch (e) { |
| | | proxy?.$modal?.msgError?.("获取产品或审批人失败"); |
| | | } finally { |
| | | stockLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | const submitStock = async () => { |
| | | const hasEmptyApprover = stockApproverNodes.value.some(node => !node.userId); |
| | | if (hasEmptyApprover) { |
| | | ElMessage.warning("请为所有审批节点选择审批人"); |
| | | return; |
| | | } |
| | | if (selectedStockProductIds.value.length === 0) { |
| | | ElMessage.warning("请选择至少一个产品进行入库"); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | await ElMessageBox.confirm("确认对所选产品执行入库?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | |
| | | } catch { |
| | | return; |
| | | } |
| | | |
| | | proxy?.$modal?.loading?.("正在入库,请稍候..."); |
| | | try { |
| | | await salesStock({ id }); |
| | | const approveUserIds = stockApproverNodes.value |
| | | .map(node => node.userId) |
| | | .join(","); |
| | | const approveUserName = stockApproverNodes.value |
| | | .map( |
| | | node => |
| | | stockApproverOptions.value.find( |
| | | item => String(item.userId) === String(node.userId) |
| | | )?.userName |
| | | ) |
| | | .filter(Boolean) |
| | | .join(","); |
| | | await salesStock({ |
| | | salesLedgerId: currentStockLedgerId.value, |
| | | salesLedgerProducts: selectedStockProductIds.value, |
| | | approveUserIds, |
| | | approveUserName, |
| | | }); |
| | | proxy?.$modal?.msgSuccess?.("入库成功"); |
| | | stockDialogVisible.value = false; |
| | | await getList(); |
| | | } catch (e) { |
| | | proxy?.$modal?.msgError?.("入库失败,请稍后重试"); |
| | |
| | | // 打开“工艺路线配置”选择弹窗(必须显式选择) |
| | | const openProcessFlowSelect = async ledgerRow => { |
| | | if (!ledgerRow) return; |
| | | if (!ledgerRow.isEdit) return; |
| | | if (Number(ledgerRow.reviewStatus) !== 1) { |
| | | proxy.$modal.msgWarning("只有已审核的台账才能选择工艺路线"); |
| | | return; |
| | | } |
| | | // if (!ledgerRow.isEdit) return; |
| | | |
| | | processFlowSelectLedgerRow.value = ledgerRow; |
| | | processFlowSelectDefaultRouteId.value = null; |
| | |
| | | }); |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | if (cellValue === null || cellValue === undefined || cellValue === "") { |
| | | return ""; |
| | | } |
| | | const num = Number(cellValue); |
| | | return Number.isFinite(num) ? num.toFixed(2) : ""; |
| | | }; |
| | | |
| | | const scrollElementIntoVisibleArea = target => { |
| | | if (!target || !(target instanceof HTMLElement)) return; |
| | | let parent = target.parentElement; |
| | | while (parent && parent !== document.body) { |
| | | const style = window.getComputedStyle(parent); |
| | | const canScrollX = |
| | | (style.overflowX === "auto" || |
| | | style.overflowX === "scroll" || |
| | | style.overflowX === "overlay") && |
| | | parent.scrollWidth > parent.clientWidth; |
| | | const canScrollY = |
| | | (style.overflowY === "auto" || |
| | | style.overflowY === "scroll" || |
| | | style.overflowY === "overlay") && |
| | | parent.scrollHeight > parent.clientHeight; |
| | | |
| | | if (canScrollX || canScrollY) { |
| | | const parentRect = parent.getBoundingClientRect(); |
| | | const targetRect = target.getBoundingClientRect(); |
| | | if (canScrollX) { |
| | | const targetCenterX = targetRect.left + targetRect.width / 2; |
| | | const parentCenterX = parentRect.left + parentRect.width / 2; |
| | | const deltaX = targetCenterX - parentCenterX; |
| | | if (Math.abs(deltaX) > 2) { |
| | | parent.scrollLeft += deltaX; |
| | | } |
| | | } |
| | | |
| | | if (canScrollY) { |
| | | const targetCenterY = targetRect.top + targetRect.height / 2; |
| | | const parentCenterY = parentRect.top + parentRect.height / 2; |
| | | const deltaY = targetCenterY - parentCenterY; |
| | | if (Math.abs(deltaY) > 2) { |
| | | parent.scrollTop += deltaY; |
| | | } |
| | | } |
| | | } |
| | | |
| | | parent = parent.parentElement; |
| | | } |
| | | }; |
| | | |
| | | const handleTabScrollFollow = e => { |
| | | if (!e || e.key !== "Tab") return; |
| | | requestAnimationFrame(() => { |
| | | const active = document.activeElement; |
| | | if (active instanceof HTMLElement) { |
| | | scrollElementIntoVisibleArea(active); |
| | | } |
| | | }); |
| | | }; |
| | | // 获取tree子数据 |
| | | const getModels = value => { |
| | |
| | | const summarizeMainTable = param => { |
| | | return proxy.summarizeTable(param, [ |
| | | "contractAmount", |
| | | "productTotalQuantity", |
| | | "productTotalArea", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ]); |
| | |
| | | }; |
| | | // 打开弹框 |
| | | const openForm = async (type, row) => { |
| | | operationType.value = type; |
| | | // 已完成订单强制为只读模式,但附件上传仍可用 |
| | | const isCompleted = Number(row?.orderStatus) === 1; |
| | | const effectiveType = isCompleted ? 'view' : type; |
| | | operationType.value = effectiveType; |
| | | isCompletedOrder.value = isCompleted; |
| | | form.value = {}; |
| | | productData.value = []; |
| | | selectedQuotation.value = null; |
| | | // 已审核订单编辑时,标记只能修改单价(已完成订单已强制view,此处不会再命中) |
| | | isReviewedEdit.value = effectiveType === "edit" && Number(row?.reviewStatus) === 1; |
| | | let userLists = await userListNoPage(); |
| | | userList.value = userLists.data; |
| | | customerList().then(res => { |
| | |
| | | } |
| | | form.value.tempFileIds = tempFileIds; |
| | | form.value.type = 1; |
| | | form.value.reviewStatus = form.value.reviewStatus ?? 0; // 默认审核状态为待审核 |
| | | form.value.stockStatus = 0; // 默认入库状态为未入库 |
| | | const submitPayload = { ...form.value }; |
| | | delete submitPayload.paymentMethod; |
| | | addOrUpdateSalesLedger(submitPayload).then(res => { |
| | |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | isCompletedOrder.value = false; |
| | | isReviewedEdit.value = false; |
| | | }; |
| | | |
| | | const productIndex = ref(0); |
| | |
| | | otherAmountAddDialogVisible.value = false; |
| | | otherAmountAddId.value = null; |
| | | }; |
| | | // 导入 |
| | | const handleImport = () => { |
| | | importUpload.title = "导入销售台账"; |
| | | const openImportDialog = (title, url) => { |
| | | importUpload.title = title; |
| | | importUpload.url = import.meta.env.VITE_APP_BASE_API + url; |
| | | importUpload.open = true; |
| | | importUpload.isUploading = false; |
| | | if (importUploadRef.value) { |
| | | importUploadRef.value.clearFiles(); |
| | | } |
| | | }; |
| | | // 导入 |
| | | const handleImport = () => { |
| | | currentImportCommand.value = "default"; |
| | | openImportDialog("导入销售台账", "/sales/ledger/import"); |
| | | }; |
| | | // 历史迁移 |
| | | const handleHistoryImportCommand = command => { |
| | | const url = HISTORY_IMPORT_URL_MAP[command]; |
| | | if (!url) return; |
| | | currentImportCommand.value = command; |
| | | const title = command === "shipped" ? "历史迁移-已出库" : "历史迁移-未出库"; |
| | | openImportDialog(title, url); |
| | | }; |
| | | |
| | | // 下载导入模板 |
| | | const downloadTemplate = () => { |
| | | const command = currentImportCommand.value; |
| | | if (command && command !== "default") { |
| | | const templateUrl = HISTORY_IMPORT_TEMPLATE_URL_MAP[command]; |
| | | const fileName = HISTORY_IMPORT_TEMPLATE_FILE_NAME_MAP[command]; |
| | | if (templateUrl) { |
| | | proxy.download( |
| | | templateUrl, |
| | | {}, |
| | | fileName || "销售发货历史数据导入模板.xlsx" |
| | | ); |
| | | return; |
| | | } |
| | | } |
| | | proxy.download("/sales/ledger/exportTemplate", {}, "销售台账导入模板.xlsx"); |
| | | }; |
| | | const onClose = () => { |
| | | importUpload.open = false; |
| | | if (importUploadRef.value) { |
| | | importUploadRef.value.clearFiles(); |
| | | } |
| | | }; |
| | | |
| | | // 提交导入文件 |
| | |
| | | proxy.$refs["importUploadRef"].submit(); |
| | | }; |
| | | |
| | | // 导出 |
| | | // 导出(按当前查询条件导出) |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/sales/ledger/export", {}, "销售台账.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | // 构建查询参数(与 getList 保持一致) |
| | | const { entryDate, ...rest } = searchForm; |
| | | const params = { ...rest }; |
| | | |
| | | // 处理录入日期范围 |
| | | if (entryDate && entryDate.length === 2) { |
| | | params.entryDateStart = entryDate[0]; |
| | | params.entryDateEnd = entryDate[1]; |
| | | } |
| | | |
| | | // 处理客户名称查询 |
| | | const selectedCustomer = (customerOption.value || []).find( |
| | | item => String(item?.id ?? "") === String(params.customerId ?? "") |
| | | ); |
| | | if (selectedCustomer?.customerName) { |
| | | params.customerName = String(selectedCustomer.customerName).trim(); |
| | | } |
| | | delete params.customerId; |
| | | |
| | | // 处理产品宽高查询参数 |
| | | const widthValue = params.width != null ? String(params.width).trim() : ""; |
| | | const heightValue = params.height != null ? String(params.height).trim() : ""; |
| | | if (!widthValue) delete params.width; |
| | | if (!heightValue) delete params.height; |
| | | |
| | | proxy.download("/sales/ledger/exportWithProducts", params, "销售台账.xlsx"); |
| | | }; |
| | | /** 判断单个产品是否已发货(根据shippingStatus判断,已发货或审核通过不可编辑和删除) */ |
| | | const isProductShipped = product => { |
| | |
| | | return; |
| | | } |
| | | const ids = selectedRows.value.map(item => item.id); |
| | | |
| | | // 检查是否有已审核的台账 |
| | | const audited = selectedRows.value.filter( |
| | | row => Number(row.reviewStatus) === 1 |
| | | ); |
| | | if (audited.length > 0) { |
| | | proxy.$modal.msgWarning("选中的数据中包含已审核项,不能删除"); |
| | | return; |
| | | } |
| | | |
| | | // 检查是否有已进行发货或发货完成的销售订单,若有则不允许删除 |
| | | const cannotDeleteNames = []; |
| | |
| | | command !== "salesDeliveryNote" |
| | | ) |
| | | return; |
| | | |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("请至少选择一条销售台账数据进行打印"); |
| | | return; |
| | | } |
| | | const hasUnapproved = selectedRows.value.some( |
| | | row => Number(row.reviewStatus) !== 1 |
| | | ); |
| | | if (hasUnapproved) { |
| | | proxy.$modal.msgWarning("选中的数据中包含未审核项,无法打印"); |
| | | return; |
| | | } |
| | | |
| | | if (command === "salesDeliveryNote") { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("请至少选择一条销售台账数据进行打印"); |
| | | return; |
| | | } |
| | | const customerNames = Array.from( |
| | | new Set( |
| | | selectedRows.value.map(item => String(item?.customerName ?? "").trim()) |
| | |
| | | try { |
| | | const res = await getSalesInvoices(selectedIds); |
| | | const salesInvoiceData = res?.data ?? {}; |
| | | printSalesDeliveryNote(salesInvoiceData, selectedRow); |
| | | await printSalesDeliveryNote(salesInvoiceData, selectedRow, selectedIds); |
| | | // 打印成功后递增单据打印次数 |
| | | selectedIds.forEach(id => { |
| | | incrementPrintCount({ id, printType: 'document' }).catch(() => {}); |
| | | }); |
| | | } catch (error) { |
| | | console.error("打印销售发货单失败:", error); |
| | | proxy.$modal.msgError("打印失败,请稍后重试"); |
| | |
| | | const res = await getSalesOrder(selectedId); |
| | | const salesOrderData = res?.data ?? {}; |
| | | printSalesOrder(salesOrderData); |
| | | // 打印成功后递增单据打印次数 |
| | | incrementPrintCount({ id: selectedId, printType: 'document' }).catch(() => {}); |
| | | } else { |
| | | const res = await getProcessCard(selectedId); |
| | | const processCardData = res?.data ?? {}; |
| | | printFinishedProcessCard(processCardData); |
| | | // 补齐二维码所需的台账标识(后端数据有时不带 id) |
| | | if (processCardData && typeof processCardData === "object") { |
| | | processCardData.salesLedgerId = |
| | | processCardData.salesLedgerId ?? selectedId; |
| | | processCardData.salesContractNo = |
| | | (processCardData.salesContractNo ?? "").trim() || |
| | | String(selectedRow?.salesContractNo ?? "").trim(); |
| | | } |
| | | const routeNodes = processCardData?.routeNodes; |
| | | const isProcessRouteEmpty = |
| | | !Array.isArray(routeNodes) || routeNodes.length === 0; |
| | | if (isProcessRouteEmpty) { |
| | | proxy.$modal.closeLoading(); |
| | | try { |
| | | await ElMessageBox.confirm( |
| | | "当前订单未绑定工艺路线也没有设置默认的工艺路线,是否仍要打印?", |
| | | "提示", |
| | | { |
| | | confirmButtonText: "打印", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | } |
| | | ); |
| | | } catch { |
| | | return; |
| | | } |
| | | await printFinishedProcessCard(processCardData); |
| | | // 打印成功后递增单据打印次数 |
| | | incrementPrintCount({ id: selectedId, printType: 'document' }).catch(() => {}); |
| | | } else { |
| | | await printFinishedProcessCard(processCardData); |
| | | // 打印成功后递增单据打印次数 |
| | | incrementPrintCount({ id: selectedId, printType: 'document' }).catch(() => {}); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | console.error( |
| | |
| | | return; |
| | | } |
| | | |
| | | const selectedId = selectedRows.value[0]?.id; |
| | | const selectedRow = selectedRows.value[0]; |
| | | if (Number(selectedRow?.reviewStatus) !== 1) { |
| | | proxy.$modal.msgWarning("只有已审核的台账才能进行标签打印"); |
| | | return; |
| | | } |
| | | const selectedId = selectedRow?.id; |
| | | if (!selectedId) { |
| | | proxy.$modal.msgWarning("当前选择数据缺少ID,无法打印标签"); |
| | | return; |
| | |
| | | return; |
| | | } |
| | | printSalesLabel(labelList); |
| | | // 打印成功后递增标签打印次数 |
| | | incrementPrintCount({ id: selectedId, printType: 'label' }).catch(() => {}); |
| | | } catch (error) { |
| | | console.error("打印标签失败:", error); |
| | | proxy.$modal.msgError("打印标签失败,请稍后重试"); |
| | |
| | | return false; |
| | | } |
| | | |
| | | // 如果后端返回了台账级发货状态(deliveryStatus) |
| | | // 1=已发货,则禁止再次发货 |
| | | // 台账级发货状态(deliveryStatus):2审批中、5已发货 时不可再发起本行发货;6部分发货仍可按明细继续发 |
| | | const deliveryStatus = row.deliveryStatus; |
| | | if ( |
| | | deliveryStatus !== null && |
| | | deliveryStatus !== undefined && |
| | | String(deliveryStatus).trim() !== "" |
| | | ) { |
| | | if (Number(deliveryStatus) === 1) return false; |
| | | const ds = Number(deliveryStatus); |
| | | if (ds === 2 || ds === 5) return false; |
| | | } |
| | | |
| | | // 获取发货状态 |
| | |
| | | return statusStr === "待发货" || statusStr === "审核拒绝"; |
| | | }; |
| | | |
| | | const getLedgerDisplayName = ledger => |
| | | String(ledger?.salesContractNo || "").trim() || |
| | | String(ledger?.projectName || "").trim() || |
| | | `ID:${ledger?.id ?? "-"}`; |
| | | |
| | | const validateLedgersStockedBeforeDelivery = async ledgers => { |
| | | const invalidLedgers = []; |
| | | for (const ledger of ledgers || []) { |
| | | const ledgerId = ledger?.id; |
| | | const ledgerName = getLedgerDisplayName(ledger); |
| | | if (!ledgerId) { |
| | | invalidLedgers.push(`${ledgerName}(缺少台账ID)`); |
| | | continue; |
| | | } |
| | | let products = []; |
| | | try { |
| | | const res = await productList({ salesLedgerId: ledgerId, type: 1 }); |
| | | products = Array.isArray(res?.data) ? res.data : []; |
| | | } catch (e) { |
| | | invalidLedgers.push(`${ledgerName}(明细加载失败)`); |
| | | continue; |
| | | } |
| | | const unstockedProducts = products.filter( |
| | | item => Number(item?.productStockStatus) !== 2 |
| | | ); |
| | | if (unstockedProducts.length > 0) { |
| | | invalidLedgers.push( |
| | | `${ledgerName}(未全部入库${unstockedProducts.length}条)` |
| | | ); |
| | | } |
| | | } |
| | | return invalidLedgers; |
| | | }; |
| | | |
| | | const handleBulkDelivery = async () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("请选择数据"); |
| | | return; |
| | | } |
| | | |
| | | // 只允许【未发货/审批失败】进入发货流程 |
| | | const canDeliveryLedgers = selectedRows.value.filter(r => { |
| | | const status = Number(r.deliveryStatus); |
| | | return status === 1 || status === 3; |
| | | // 允许:1未发货、3审批不通过、4审批通过、6部分发货;不允许:2审批中、5已发货 |
| | | const statusItem = selectedRows.value[0].deliveryStatus; |
| | | const ledgerAllowsDelivery = s => [1, 3, 4, 6].includes(Number(s)); |
| | | let isTrue = true; |
| | | selectedRows.value.forEach(row => { |
| | | if (!ledgerAllowsDelivery(row.deliveryStatus)) { |
| | | proxy.$modal.msgWarning( |
| | | "仅未发货、审批不通过、审批通过或部分发货的台账可以发货" |
| | | ); |
| | | isTrue = false; |
| | | return; |
| | | } |
| | | if (row.deliveryStatus !== statusItem) { |
| | | proxy.$modal.msgWarning("请选择相同状态的销售台账"); |
| | | isTrue = false; |
| | | return; |
| | | } |
| | | }); |
| | | if (canDeliveryLedgers.length === 0) { |
| | | proxy.$modal.msgWarning("仅未发货或审批失败的台账可以发货"); |
| | | if (!isTrue) { |
| | | return; |
| | | } |
| | | |
| | | // 已发货台账:弹窗提醒,不能再次发货(4 视为已发货) |
| | | proxy.$modal.loading("正在校验明细入库状态,请稍候..."); |
| | | const invalidLedgers = await validateLedgersStockedBeforeDelivery( |
| | | selectedRows.value |
| | | ); |
| | | proxy.$modal.closeLoading(); |
| | | if (invalidLedgers.length > 0) { |
| | | try { |
| | | await ElMessageBox.alert( |
| | | `以下销售台账存在未全部入库的明细,暂不可发货:\n${invalidLedgers.join( |
| | | "\n" |
| | | )}`, |
| | | "提示", |
| | | { |
| | | type: "warning", |
| | | confirmButtonText: "知道了", |
| | | } |
| | | ); |
| | | } catch { |
| | | /* 关闭弹窗 */ |
| | | } |
| | | return; |
| | | } |
| | | |
| | | // 已全部发货(5)的台账:弹窗提醒,不能再次发货 |
| | | const shippedLedgers = selectedRows.value.filter( |
| | | r => Number(r.deliveryStatus) === 4 |
| | | r => Number(r.deliveryStatus) === 5 |
| | | ); |
| | | if (shippedLedgers.length === selectedRows.value.length) { |
| | | try { |
| | |
| | | try { |
| | | const targets = []; |
| | | for (const ledger of selectedRows.value) { |
| | | //如果已经是“审批中(2)”或“已发货(4)”,则跳过,不允许重复操作 |
| | | // 审批中(2)、已全部发货(5) 跳过;部分发货(6) 等仍收集可发明细 |
| | | const status = Number(ledger.deliveryStatus); |
| | | if (status === 2 || status === 4) { |
| | | if (status === 2 || status === 5) { |
| | | console.warn( |
| | | `台账编号 ${ledger.salesContractNo} 状态为 ${status},跳过发货` |
| | | ); |
| | |
| | | }; |
| | | |
| | | // 打开发货弹框(单条) |
| | | const openDeliveryForm = row => { |
| | | // 只允许【未发货/审批失败】发货;已发货/审批中不允许 |
| | | const openDeliveryForm = async row => { |
| | | const status = Number(row.deliveryStatus); |
| | | if (status !== 1 && status !== 3) { |
| | | proxy.$modal.msgWarning("只有发货状态为未发货或审批失败的记录才可以发货"); |
| | | if (![1, 3, 4, 6].includes(status)) { |
| | | proxy.$modal.msgWarning( |
| | | "只有发货状态为未发货、审批不通过、审批通过或部分发货的记录才可以发货" |
| | | ); |
| | | return; |
| | | } |
| | | |
| | | proxy.$modal.loading("正在校验明细入库状态,请稍候..."); |
| | | const invalidLedgers = await validateLedgersStockedBeforeDelivery([row]); |
| | | proxy.$modal.closeLoading(); |
| | | if (invalidLedgers.length > 0) { |
| | | try { |
| | | await ElMessageBox.alert( |
| | | `当前销售台账存在未全部入库的明细,暂不可发货:\n${invalidLedgers[0]}`, |
| | | "提示", |
| | | { |
| | | type: "warning", |
| | | confirmButtonText: "知道了", |
| | | } |
| | | ); |
| | | } catch { |
| | | /* 关闭弹窗 */ |
| | | } |
| | | return; |
| | | } |
| | | |
| | |
| | | const run = async () => { |
| | | for (const salesLedgerId of uniqueLedgerIds) { |
| | | await addShippingInfo({ |
| | | scanOutbound: false, |
| | | salesLedgerId, |
| | | type: deliveryForm.value.type, |
| | | approveUserIds, |
| | |
| | | justify-content: space-between; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .ledger-qr-dialog { |
| | | text-align: center; |
| | | padding-bottom: 8px; |
| | | } |
| | | |
| | | .ledger-qr-composite-img { |
| | | max-width: 100%; |
| | | height: auto; |
| | | display: block; |
| | | margin: 0 auto 28px; |
| | | } |
| | | |
| | | .ledger-qr-save-btn { |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .approver-nodes-container { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 16px; |
| | | padding: 16px; |
| | | background-color: #f8f9fa; |
| | | border-radius: 4px; |
| | | border: 1px solid #e4e7ed; |
| | | } |
| | | |
| | | .approver-node-item { |
| | | flex: 0 0 calc(33.333% - 12px); |
| | | min-width: 200px; |
| | | padding: 12px; |
| | | background-color: #fff; |
| | | border-radius: 4px; |
| | | border: 1px solid #dcdfe6; |
| | | transition: all 0.3s; |
| | | } |
| | | |
| | | .approver-node-item:hover { |
| | | border-color: #409eff; |
| | | box-shadow: 0 2px 8px rgba(64, 158, 255, 0.1); |
| | | } |
| | | |
| | | .approver-node-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 8px; |
| | | } |
| | | |
| | | .approver-node-label { |
| | | font-size: 13px; |
| | | font-weight: 500; |
| | | color: #606266; |
| | | } |
| | | |
| | | @media (max-width: 1200px) { |
| | | .approver-node-item { |
| | | flex: 0 0 calc(50% - 8px); |
| | | } |
| | | } |
| | | |
| | | @media (max-width: 768px) { |
| | | .approver-node-item { |
| | | flex: 0 0 100%; |
| | | } |
| | | } |
| | | |
| | | .reverse-audit-warning { |
| | | display: flex; |
| | | align-items: flex-start; |
| | | padding: 10px 12px; |
| | | margin-top: 8px; |
| | | background-color: #fdf6ec; |
| | | border: 1px solid #faecd8; |
| | | border-radius: 4px; |
| | | color: #e6a23c; |
| | | font-size: 13px; |
| | | line-height: 1.6; |
| | | } |
| | | |
| | | .reverse-audit-dialog .el-radio { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 36px; |
| | | margin-right: 0; |
| | | margin-bottom: 8px; |
| | | } |
| | | </style> |