From 5af665569d0cc093184f99b70ac38745ef53b911 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 21 九月 2026 20:39:04 +0800
Subject: [PATCH] 新疆-融邦环保 1.油品出库表单改「多台账分摊绑定」:各台账数量之和必须等于出库吨位,产品取各台账明细交集,代储不锁行可自由增删 2.新增到货记录模块:销售台账页入口,车辆随出库单联动,到货上限=该台账分摊量,附件走永久链接 3.发货台账改层级父行:油品出库为父行,children 为到货记录,来源列区分发货单/油品出库/到货 4.开票/收款候选按「出库单×客户」拆行,bindingId 与出库单 id 分两串回传,防重复开票/收款 5.销售台账下拉补产品/规格型号 6.代储入库绑定销售订单:油品入库表单加销售订单下拉,入库台账列表加「销售订单」列 7.采购申请补齐台账字段(油库、采购合同号、提货方式、物流方式、最佳到站日期、采购类别、付款方式、预警数量、附件等) 8.修复采购申请「转订单后跳转无反应」 9.采购台账删掉「销售合同号」的搜索条件、列表列和表单字段 10.公海客户新增「信托基金(元)」,代储金额合计超限标红提示
---
src/views/inventoryManagement/stockManagement/OilStockInDialog.vue | 252 +++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 215 insertions(+), 37 deletions(-)
diff --git a/src/views/inventoryManagement/stockManagement/OilStockInDialog.vue b/src/views/inventoryManagement/stockManagement/OilStockInDialog.vue
index 30b50e4..36468ce 100644
--- a/src/views/inventoryManagement/stockManagement/OilStockInDialog.vue
+++ b/src/views/inventoryManagement/stockManagement/OilStockInDialog.vue
@@ -9,31 +9,52 @@
label-position="top"
ref="formRef">
<el-row :gutter="30">
- <el-col :span="24">
- <el-form-item label="浜у搧鍚嶇О"
+ <el-col :span="12">
+ <el-form-item label="浜у搧澶х被"
+ prop="productId"
+ :rules="[
+ {
+ required: true,
+ message: '璇烽�夋嫨浜у搧澶х被',
+ trigger: 'change',
+ }
+ ]">
+ <el-tree-select v-model="formState.productId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ filterable
+ check-strictly
+ @change="handleProductCategoryChange"
+ :data="productOptions"
+ :render-after-expand="false"
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="瑙勬牸鍨嬪彿"
prop="productModelId"
:rules="[
{
required: true,
- message: '璇烽�夋嫨浜у搧',
+ message: '璇烽�夋嫨浜у搧瑙勬牸',
trigger: 'change',
}
]">
- <el-button type="primary"
- @click="showProductSelectDialog = true">
- {{ formState.productName ? formState.productName : '閫夋嫨浜у搧' }}
- </el-button>
+ <el-select v-model="formState.productModelId"
+ placeholder="璇烽�夋嫨"
+ filterable
+ clearable
+ style="width: 100%"
+ @change="handleProductModelChange">
+ <el-option v-for="item in modelOptions"
+ :key="item.id"
+ :label="item.model"
+ :value="item.id" />
+ </el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="瑙勬牸"
- prop="productModelName">
- <el-input v-model="formState.productModelName"
- disabled />
- </el-form-item>
- </el-col>
<el-col :span="12">
<el-form-item label="鍗曚綅"
prop="unit">
@@ -87,12 +108,46 @@
<el-select v-model="formState.inboundCategory"
placeholder="璇烽�夋嫨"
clearable
- style="width: 100%">
+ style="width: 100%"
+ @change="handleInboundCategoryChange">
<el-option label="鑷喘鍏ュ簱"
value="鑷喘鍏ュ簱" />
<el-option label="浠e偍鍏ュ簱"
value="浠e偍鍏ュ簱" />
</el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row v-if="isDepositInbound"
+ :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="閿�鍞鍗�"
+ prop="salesLedgerId"
+ :rules="[
+ {
+ required: true,
+ message: '璇烽�夋嫨閿�鍞鍗�',
+ trigger: 'change',
+ }
+ ]">
+ <el-select v-model="formState.salesLedgerId"
+ placeholder="璇疯緭鍏ュ悎鍚屽彿/瀹㈡埛鍚�/椤圭洰鍚嶆悳绱�"
+ clearable
+ filterable
+ remote
+ :remote-method="searchSalesLedger"
+ :loading="salesLedgerLoading"
+ style="width: 100%"
+ @change="handleSalesLedgerChange">
+ <el-option v-for="item in salesLedgerOptions"
+ :key="item.id"
+ :label="salesLedgerLabel(item)"
+ :value="item.id" />
+ </el-select>
+ <div v-if="boundLedgerRow"
+ class="bound-ledger-tip">
+ 宸茬粦瀹氾細{{ salesLedgerLabel(boundLedgerRow) }}锛涘鎴枫�佹补搴撱�佸偍缃愪粛浠ユ湰琛ㄥ崟濉啓鐨勪负鍑�
+ </div>
</el-form-item>
</el-col>
</el-row>
@@ -445,10 +500,6 @@
</el-col>
</el-row>
</el-form>
- <!-- 浜у搧閫夋嫨寮圭獥 -->
- <ProductSelectDialog v-model="showProductSelectDialog"
- @confirm="handleProductSelect"
- single />
<template #footer>
<div class="dialog-footer">
<el-button type="primary"
@@ -461,10 +512,11 @@
</template>
<script setup>
- import { ref, computed, getCurrentInstance, onMounted } from "vue";
- import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
+ import { ref, computed, watch, getCurrentInstance, onMounted } from "vue";
import ImageUpload from "@/components/AttachmentUpload/image/index.vue";
import { addStockInRecordOnly } from "@/api/inventoryManagement/stockInventory.js";
+ import { bindableSalesLedger } from "@/api/inventoryManagement/stockInRecord.js";
+ import { modelList, productTreeList } from "@/api/basicData/product.js";
import { allOilDepot } from "@/api/basicData/oilDepot.js";
import { allTankInfo } from "@/api/basicData/tankInfo.js";
import { allVehicle } from "@/api/basicData/vehicle.js";
@@ -487,6 +539,8 @@
unit: "",
oilDepotId: undefined,
inboundCategory: undefined,
+ // 浠e偍鍏ュ簱蹇呭~锛氱粦瀹氱殑閿�鍞彴璐︼紙閿�鍞鍗曪級id
+ salesLedgerId: undefined,
tankId: undefined,
inboundTime: "",
oilProduct: undefined,
@@ -516,6 +570,14 @@
const tankList = ref([]);
const customerList = ref([]);
const vehicleList = ref([]);
+
+ // 浠e偍鍏ュ簱鎵嶉渶瑕佺粦瀹氶攢鍞鍗曪紱鍚庣涓嬫媺鍙嚭 ledgerType='浠e偍' 鐨勫彴璐�
+ const isDepositInbound = computed(
+ () => formState.value.inboundCategory === "浠e偍鍏ュ簱"
+ );
+ const salesLedgerOptions = ref([]);
+ const salesLedgerLoading = ref(false);
+ const boundLedgerRow = ref(null);
const isShow = computed({
get() {
return props.visible;
@@ -553,13 +615,77 @@
return Number((netWeight.value * Number(d)).toFixed(2));
});
- const showProductSelectDialog = ref(false);
+ // 鍏ュ簱绫诲埆鏀瑰彉锛氬垏鍥炶嚜璐叆搴撴椂閿�鍞鍗曚綔搴燂紝閬垮厤鎶婂彴璐� id 甯﹁繘涓嶇粦瀹氱殑鍗曞瓙
+ const handleInboundCategoryChange = value => {
+ if (value !== "浠e偍鍏ュ簱") {
+ formState.value.salesLedgerId = undefined;
+ boundLedgerRow.value = null;
+ return;
+ }
+ fetchSalesLedgerOptions("");
+ };
+
+ const salesLedgerLabel = item =>
+ [item.salesContractNo, item.customerName, item.projectName]
+ .filter(Boolean)
+ .join(" / ");
+
+ // 鎼滅储妗嗗彧鏈変竴涓紝鑰屽悗绔笁涓弬鏁版槸 AND 鍏崇郴锛屾墍浠ヤ緷娆℃寜 鍚堝悓鍙� 鈫� 瀹㈡埛鍚� 鈫� 椤圭洰鍚� 璇曪紝鍛戒腑鍗虫
+ const LEDGER_SEARCH_FIELDS = ["salesContractNo", "customerName", "projectName"];
+
+ const queryLedger = params =>
+ bindableSalesLedger({ current: 1, size: 50, ...params }).then(
+ res => res.data?.records || []
+ );
+
+ const fetchSalesLedgerOptions = async keyword => {
+ salesLedgerLoading.value = true;
+ try {
+ let records = [];
+ if (keyword) {
+ for (const field of LEDGER_SEARCH_FIELDS) {
+ records = await queryLedger({ [field]: keyword });
+ if (records.length) {
+ break;
+ }
+ }
+ } else {
+ records = await queryLedger({});
+ }
+ // 鎼滅储鍚庡凡閫変腑鐨勫彴璐﹀彲鑳戒笉鍦ㄧ粨鏋滈噷锛岃ˉ涓婇伩鍏嶄笅鎷夋鍙樉绀轰竴涓� id
+ if (
+ boundLedgerRow.value &&
+ !records.some(item => item.id === boundLedgerRow.value.id)
+ ) {
+ records.unshift(boundLedgerRow.value);
+ }
+ salesLedgerOptions.value = records;
+ } catch (e) {
+ salesLedgerOptions.value = [];
+ } finally {
+ salesLedgerLoading.value = false;
+ }
+ };
+
+ const searchSalesLedger = keyword =>
+ fetchSalesLedgerOptions(String(keyword || "").trim());
+
+ const handleSalesLedgerChange = id => {
+ const row = salesLedgerOptions.value.find(item => item.id === id);
+ boundLedgerRow.value = row || null;
+ };
+
+ // 浜у搧閫夋嫨锛氫骇鍝佸ぇ绫绘爲 + 璇ュぇ绫讳笅鐨勮鏍煎瀷鍙凤紝涓庨攢鍞彴璐﹂�変骇鍝佺殑鏂瑰紡涓�鑷�
+ const productOptions = ref([]);
+ const modelOptions = ref([]);
let { proxy } = getCurrentInstance();
const closeModal = () => {
proxy.resetForm("formRef");
formState.value = buildEmptyForm();
+ boundLedgerRow.value = null;
+ salesLedgerOptions.value = [];
isShow.value = false;
};
@@ -597,22 +723,48 @@
}
};
- // 浜у搧閫夋嫨澶勭悊
- const handleProductSelect = async products => {
- if (products && products.length > 0) {
- const product = products[0];
- formState.value.productId = product.productId;
- formState.value.productName = product.productName;
- formState.value.productModelName = product.model;
- formState.value.productModelId = product.id;
- formState.value.unit = product.unit;
- // 鏈鎴枫�屾补鍝併�嶅氨鏄骇鍝佸悕绉帮紙搴撳瓨鏄庣粏/鍑哄簱鍙拌处鐨勬补鍝佸垪缁戠殑閮芥槸 productName锛夛紝
- // 鐩存帴鍙栨墍閫変骇鍝佸悕锛屼笉鍐嶅幓浜у搧鏍戦噷姣斿锛岄伩鍏嶆瘮瀵逛笉涓婃椂娌瑰搧鏍忕┖鐧�
- formState.value.oilProduct = product.productName || undefined;
- showProductSelectDialog.value = false;
- // 瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
- proxy.$refs["formRef"]?.validateField("productModelId");
+ const getProductOptions = () =>
+ productTreeList().then(res => {
+ productOptions.value = convertIdToValue(res || []);
+ return productOptions.value;
+ });
+
+ function convertIdToValue(data) {
+ return (data || []).map(item => {
+ const { id, children, ...rest } = item;
+ const newItem = { ...rest, value: id };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
+ }
+ return newItem;
+ });
+ }
+
+ // 浜у搧澶х被鏀瑰彉锛氳鏍煎�欓�夋崲涓�鎵癸紝宸查�夎鏍间綔搴�
+ const handleProductCategoryChange = value => {
+ formState.value.productModelId = undefined;
+ formState.value.productName = "";
+ formState.value.productModelName = "";
+ formState.value.unit = "";
+ formState.value.oilProduct = undefined;
+ modelOptions.value = [];
+ if (!value) {
+ return;
}
+ modelList({ id: value }).then(res => {
+ modelOptions.value = res || [];
+ });
+ };
+
+ // 瑙勬牸鍨嬪彿鏀瑰彉锛氫骇鍝佸悕绉�/瑙勬牸/鍗曚綅鐢辫鏍间富鏁版嵁甯﹀嚭锛屾补鍝佸彇浜у搧鍚嶇О
+ const handleProductModelChange = value => {
+ const item = modelOptions.value.find(row => row.id === value);
+ formState.value.productName = item?.productName || "";
+ formState.value.productModelName = item?.model || "";
+ formState.value.unit = item?.unit || "";
+ // 鏈鎴枫�屾补鍝併�嶅氨鏄骇鍝佸悕绉帮紙搴撳瓨鏄庣粏/鍑哄簱鍙拌处鐨勬补鍝佸垪缁戠殑閮芥槸 productName锛�
+ formState.value.oilProduct = item?.productName || undefined;
+ proxy.$refs["formRef"]?.validateField("productModelId");
};
const handleSubmit = () => {
@@ -621,6 +773,10 @@
if (!formState.value.productModelId) {
proxy.$modal.msgError("璇烽�夋嫨浜у搧");
return;
+ }
+ // 鑷喘鍏ュ簱涓嶇粦閿�鍞鍗曪紝瀛楁涓�骞朵紶鍚庣鐨勫仛娉曟槸涓㈠純锛岃繖閲岀洿鎺ヤ笉浼犳洿骞插噣
+ if (!isDepositInbound.value) {
+ delete formState.value.salesLedgerId;
}
// 璁$畻缁撴灉闅忚〃鍗曟彁浜わ細娌瑰搧鍏ュ簱鍥哄畾涓哄悎鏍煎簱瀛橈紝搴撳瓨鏁伴噺鍙栧噣閲�
formState.value.type = "qualified";
@@ -639,7 +795,18 @@
});
};
+ // 姣忔鎵撳紑閲嶆柊鎷変骇鍝佸ぇ绫伙紝閬垮厤棣栨鍔犺浇澶辫触鎴栧埆澶勬柊澧炰骇鍝佸悗鏈〉鐪嬩笉鍒板叏閲忔暟鎹�
+ watch(
+ () => props.visible,
+ visible => {
+ if (visible) {
+ getProductOptions();
+ }
+ }
+ );
+
onMounted(() => {
+ getProductOptions();
allOilDepot().then(res => {
oilDepotList.value = res?.data || [];
});
@@ -668,6 +835,17 @@
border-radius: 3px;
}
+ // 宸茬粦瀹氶攢鍞鍗曟彁绀烘潯
+ .bound-ledger-tip {
+ margin-top: 6px;
+ padding: 6px 14px;
+ font-size: 13px;
+ color: #303133;
+ background: rgba(64, 158, 255, 0.08);
+ border-left: 3px solid #409eff;
+ border-radius: 3px;
+ }
+
// 鍏ュ簱鍚嶇О涓嬫媺閫夐」锛氬皬鍗$墖鏍峰紡
.oil-depot-option {
padding: 8px 10px;
--
Gitblit v1.9.3