| | |
| | | </div> |
| | | <ProcessFlowConfigSelectDialog v-model:visible="processFlowSelectDialogVisible" |
| | | :default-route-id="processFlowSelectDefaultRouteId" |
| | | :default-record-list="processFlowSelectDefaultRecordList" |
| | | :bound-route-name="processFlowSelectBoundRouteName" |
| | | @confirm="handleProcessFlowSelectConfirm" /> |
| | | <div class="sales-ledger-toolbar-actions"> |
| | |
| | | <el-button type="primary" |
| | | @click="handleBulkDelivery" |
| | | :disabled="isBatchButtonDisabled('delivery')">发货</el-button> |
| | | <el-date-picker v-model="processRouteExportDateRange" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | clearable |
| | | style="width: 340px;" /> |
| | | <el-button @click="handleExportProcessRoute" |
| | | :disabled="isBatchButtonDisabled('export')">导出工艺路线</el-button> |
| | | </el-space> |
| | | <el-space v-else-if="activeStatusTab === 'stocked'" |
| | | wrap |
| | |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | const processRouteExportDateRange = ref([]); |
| | | |
| | | // 工艺路线配置选择弹窗(绑定到台账产品) |
| | | const processFlowSelectDialogVisible = ref(false); |
| | | const processFlowSelectLedgerRow = ref(null); |
| | | const processFlowSelectDefaultRouteId = ref(null); |
| | | const processFlowSelectDefaultRecordList = ref([]); |
| | | const processFlowSelectBoundRouteId = ref(null); |
| | | const processFlowSelectBoundRouteName = ref(""); |
| | | |
| | |
| | | |
| | | processFlowSelectLedgerRow.value = ledgerRow; |
| | | processFlowSelectDefaultRouteId.value = null; |
| | | processFlowSelectDefaultRecordList.value = []; |
| | | processFlowSelectBoundRouteId.value = null; |
| | | processFlowSelectBoundRouteName.value = ""; |
| | | |
| | |
| | | const boundId = info?.processRouteId ?? info?.routeId ?? info?.id ?? null; |
| | | const boundName = |
| | | info?.processRouteName ?? info?.routeName ?? info?.name ?? ""; |
| | | const recordList = Array.isArray(info?.recordList) ? info.recordList : []; |
| | | processFlowSelectBoundRouteId.value = boundId; |
| | | processFlowSelectBoundRouteName.value = boundName; |
| | | processFlowSelectDefaultRouteId.value = boundId; |
| | | processFlowSelectDefaultRecordList.value = recordList; |
| | | } catch (e) { |
| | | // 查询失败时按未绑定处理,不阻塞弹窗 |
| | | processFlowSelectBoundRouteId.value = null; |
| | | processFlowSelectBoundRouteName.value = ""; |
| | | processFlowSelectDefaultRouteId.value = null; |
| | | processFlowSelectDefaultRecordList.value = []; |
| | | } |
| | | |
| | | processFlowSelectDialogVisible.value = true; |
| | | }; |
| | | |
| | | // 绑定工艺路线到当前台账数据 |
| | | const handleProcessFlowSelectConfirm = async routeId => { |
| | | const handleProcessFlowSelectConfirm = async payload => { |
| | | const ledgerRow = processFlowSelectLedgerRow.value; |
| | | if (!ledgerRow?.id) return; |
| | | |
| | | const finalRouteId = routeId ?? null; |
| | | const finalRouteId = payload?.routeId ?? payload ?? null; |
| | | const recordList = Array.isArray(payload?.recordList) ? payload.recordList : []; |
| | | if (!finalRouteId) return; |
| | | |
| | | const oldRouteId = processFlowSelectBoundRouteId.value; |
| | |
| | | await saleProcessBind({ |
| | | salesLedgerId: ledgerRow.id, |
| | | processRouteId: finalRouteId, |
| | | recordList, |
| | | }); |
| | | |
| | | proxy?.$modal?.msgSuccess?.("工艺路线绑定成功"); |
| | |
| | | |
| | | proxy.download("/sales/ledger/exportWithProducts", params, "销售台账.xlsx"); |
| | | }; |
| | | |
| | | const handleExportProcessRoute = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | proxy?.$modal?.msgWarning?.("请选择要导出的销售台账"); |
| | | return; |
| | | } |
| | | const salesLedgerIds = selectedRows.value |
| | | .map(item => item.id) |
| | | .filter(id => id !== null && id !== undefined && id !== ""); |
| | | if (salesLedgerIds.length === 0) { |
| | | proxy?.$modal?.msgWarning?.("请选择要导出的销售台账"); |
| | | return; |
| | | } |
| | | |
| | | const params = { |
| | | salesLedgerIds: salesLedgerIds.join(","), |
| | | }; |
| | | if ( |
| | | Array.isArray(processRouteExportDateRange.value) && |
| | | processRouteExportDateRange.value.length === 2 |
| | | ) { |
| | | params.completedTimeStart = processRouteExportDateRange.value[0]; |
| | | params.completedTimeEnd = processRouteExportDateRange.value[1]; |
| | | } |
| | | |
| | | proxy.download( |
| | | "/sales/ledger/exportProcessRoute", |
| | | params, |
| | | "销售台账工艺路线导出.xlsx" |
| | | ); |
| | | }; |
| | | /** 判断单个产品是否已发货(根据shippingStatus判断,已发货或审核通过不可编辑和删除) */ |
| | | const isProductShipped = product => { |
| | | if (!product) return false; |