From a563ea879ef5fb6897e76d2df661e465dce2ab9b Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期一, 01 六月 2026 15:02:27 +0800
Subject: [PATCH] Merge branch 'dev_新疆_大罗素马铃薯new' of http://114.132.189.42:9002/r/product-inventory-management into dev_新疆_大罗素马铃薯new
---
src/views/procurementManagement/procurementLedger/index.vue | 379 ++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 322 insertions(+), 57 deletions(-)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index dad6a26..15339b5 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -66,6 +66,9 @@
</div>
<div class="table_list">
<div style="display: flex;justify-content: flex-end;margin-bottom: 20px;">
+<!-- <el-button type="success"-->
+<!-- plain-->
+<!-- @click="handleBatchGenerate">鎵归噺鐢熸垚鏁版嵁</el-button>-->
<el-button type="primary"
@click="openForm('add')">鏂板鍙拌处</el-button>
<el-button type="primary"
@@ -100,13 +103,34 @@
label="搴忓彿"
type="index"
width="60" />
+ <el-table-column label="绫诲瀷"
+ prop="productType"
+ width="100">
+ <template #default="scope">
+ <el-tag :type="scope.row.productType === 2 ? 'warning' : 'success'" size="small">
+ {{ scope.row.productType === 2 ? '璁惧澶囦欢' : '浜у搧' }}
+ </el-tag>
+ </template>
+ </el-table-column>
<el-table-column label="浜у搧澶х被"
prop="productCategory" />
<el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel" />
+ prop="specificationModel"
+ width="120">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">/</span>
+ <span v-else>{{ scope.row.specificationModel || '--' }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="鍗曚綅"
- prop="unit" />
- <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
+ prop="unit"
+ width="100">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ scope.row.unit || '--' }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
prop="stockInApprovalStatus"
width="120">
<template #default="scope">
@@ -117,22 +141,59 @@
</template>
</el-table-column>
<el-table-column label="鏁伴噺"
- prop="quantity" />
+ prop="quantity"
+ width="100" />
<el-table-column label="鍙敤鏁伴噺"
- prop="availableQuality" />
+ prop="availableQuality"
+ width="100">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ scope.row.availableQuality }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="閫�璐ф暟閲�"
- prop="returnQuality" />
+ prop="returnQuality"
+ width="100">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ scope.row.returnQuality }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="绋庣巼(%)"
- prop="taxRate" />
+ prop="taxRate"
+ width="100">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ scope.row.taxRate }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="鍚◣鍗曚环(鍏�)"
prop="taxInclusiveUnitPrice"
- :formatter="formattedNumber" />
+ :formatter="formattedNumber"
+ width="130">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ formattedNumber(null, null, scope.row.taxInclusiveUnitPrice) }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="鍚◣鎬讳环(鍏�)"
prop="taxInclusiveTotalPrice"
- :formatter="formattedNumber" />
+ :formatter="formattedNumber"
+ width="130">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ formattedNumber(null, null, scope.row.taxInclusiveTotalPrice) }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="涓嶅惈绋庢�讳环(鍏�)"
prop="taxExclusiveTotalPrice"
- :formatter="formattedNumber" />
+ :formatter="formattedNumber"
+ width="140">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ formattedNumber(null, null, scope.row.taxExclusiveTotalPrice) }}</span>
+ </template>
+ </el-table-column>
</el-table>
</template>
</el-table-column>
@@ -210,8 +271,7 @@
<template #default="scope">
<el-button link
type="primary"
- @click="openForm('edit', scope.row)"
- :disabled="scope.row.stockInStatus === '瀹屽叏鍏ュ簱'">缂栬緫
+ @click="openForm('edit', scope.row)">缂栬緫
</el-button>
<el-button link
type="primary"
@@ -400,40 +460,86 @@
label="搴忓彿"
type="index"
width="60" />
+ <el-table-column label="绫诲瀷"
+ prop="productType"
+ width="100">
+ <template #default="scope">
+ <el-tag :type="scope.row.productType === 2 ? 'warning' : 'success'" size="small">
+ {{ scope.row.productType === 2 ? '璁惧澶囦欢' : '浜у搧' }}
+ </el-tag>
+ </template>
+ </el-table-column>
<el-table-column label="浜у搧澶х被"
prop="productCategory" />
<el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel" />
+ prop="specificationModel"
+ width="120">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">/</span>
+ <span v-else>{{ scope.row.specificationModel || '--' }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="鍗曚綅"
prop="unit"
- width="70" />
+ width="70">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ scope.row.unit || '--' }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="鏁伴噺"
prop="quantity"
width="70" />
<el-table-column label="搴撳瓨棰勮鏁伴噺"
prop="warnNum"
width="120"
- show-overflow-tooltip />
+ show-overflow-tooltip>
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ scope.row.warnNum }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="绋庣巼(%)"
prop="taxRate"
- width="80" />
+ width="80">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ scope.row.taxRate }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="鍚◣鍗曚环(鍏�)"
prop="taxInclusiveUnitPrice"
:formatter="formattedNumber"
- width="150" />
+ width="130">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ formattedNumber(null, null, scope.row.taxInclusiveUnitPrice) }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="鍚◣鎬讳环(鍏�)"
prop="taxInclusiveTotalPrice"
:formatter="formattedNumber"
- width="150" />
+ width="130">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ formattedNumber(null, null, scope.row.taxInclusiveTotalPrice) }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="涓嶅惈绋庢�讳环(鍏�)"
prop="taxExclusiveTotalPrice"
:formatter="formattedNumber"
- width="150" />
+ width="140">
+ <template #default="scope">
+ <span v-if="scope.row.productType === 2">--</span>
+ <span v-else>{{ formattedNumber(null, null, scope.row.taxExclusiveTotalPrice) }}</span>
+ </template>
+ </el-table-column>
<el-table-column label="鏄惁璐ㄦ"
prop="isChecked"
- width="150">
+ width="100">
<template #default="scope">
- <el-tag :type="scope.row.isChecked ? 'success' : 'info'">
+ <span v-if="scope.row.productType === 2">--</span>
+ <el-tag v-else :type="scope.row.isChecked ? 'success' : 'info'">
{{ scope.row.isChecked ? '鏄�' : '鍚�' }}
</el-tag>
</template>
@@ -530,9 +636,21 @@
ref="productFormRef">
<el-row :gutter="30">
<el-col :span="24">
+ <el-form-item label="绫诲瀷锛�"
+ prop="productType">
+ <el-radio-group v-model="productForm.productType" @change="handleProductTypeChange">
+ <el-radio :label="1">浜у搧</el-radio>
+ <el-radio :label="2">璁惧澶囦欢</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="24">
<el-form-item label="浜у搧澶х被锛�"
prop="productId">
- <el-tree-select v-model="productForm.productId"
+ <el-tree-select v-if="productForm.productType !== 2"
+ v-model="productForm.productId"
placeholder="璇烽�夋嫨"
clearable
filterable
@@ -541,10 +659,22 @@
:data="productOptions"
:render-after-expand="false"
style="width: 100%" />
+ <el-select v-else
+ v-model="productForm.productId"
+ placeholder="璇烽�夋嫨璁惧澶囦欢"
+ filterable
+ clearable
+ @change="handleSparePartsChange"
+ style="width: 100%">
+ <el-option v-for="item in sparePartsOptions"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id" />
+ </el-select>
</el-form-item>
</el-col>
</el-row>
- <el-row :gutter="30">
+ <el-row :gutter="30" v-if="productForm.productType !== 2">
<el-col :span="24">
<el-form-item label="瑙勬牸鍨嬪彿锛�"
prop="productModelId">
@@ -561,7 +691,7 @@
</el-form-item>
</el-col>
</el-row>
- <el-row :gutter="30">
+ <el-row :gutter="30" v-if="productForm.productType !== 2">
<el-col :span="12">
<el-form-item label="鍗曚綅锛�"
prop="unit">
@@ -585,7 +715,7 @@
</el-form-item>
</el-col>
</el-row>
- <el-row :gutter="30">
+ <el-row :gutter="30" v-if="productForm.productType !== 2">
<el-col :span="12">
<el-form-item label="鍚◣鍗曚环(鍏�)锛�"
prop="taxInclusiveUnitPrice">
@@ -612,7 +742,21 @@
</el-form-item>
</el-col>
</el-row>
- <el-row :gutter="30">
+ <el-row :gutter="30" v-if="productForm.productType === 2">
+ <el-col :span="24">
+ <el-form-item label="鏁伴噺锛�"
+ prop="quantity">
+ <el-input-number :step="0.1"
+ clearable
+ :precision="2"
+ :min="0"
+ style="width: 100%"
+ v-model="productForm.quantity"
+ placeholder="璇疯緭鍏�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30" v-if="productForm.productType !== 2">
<el-col :span="12">
<el-form-item label="鍚◣鎬讳环(鍏�)锛�"
prop="taxInclusiveTotalPrice">
@@ -652,7 +796,7 @@
</el-select>
</el-form-item>
</el-col>
- <el-col :span="12">
+ <el-col :span="12" v-if="productForm.productType !== 2">
<el-form-item label="搴撳瓨棰勮鏁伴噺锛�"
prop="warnNum">
<el-input-number v-model="productForm.warnNum"
@@ -664,7 +808,7 @@
</el-form-item>
</el-col>
</el-row>
- <el-row :gutter="30">
+ <el-row :gutter="30" v-if="productForm.productType !== 2">
<el-col :span="12">
<el-form-item label="鏄惁璐ㄦ锛�"
prop="isChecked">
@@ -721,6 +865,7 @@
getOptions,
getPurchaseTemplateList,
delPurchaseTemplate,
+ batchGeneratePurchaseInboundSteps,
} from "@/api/procurementManagement/procurementLedger.js";
import useFormData from "@/hooks/useFormData.js";
const FileList = defineAsyncComponent(() =>
@@ -736,6 +881,7 @@
const modelOptions = ref([]);
const userList = ref([]);
const productOptions = ref([]);
+ const sparePartsOptions = ref([]);
const salesContractList = ref([]);
const supplierList = ref([]);
const tableLoading = ref(false);
@@ -749,6 +895,7 @@
const fileList = ref([]);
import useUserStore from "@/store/modules/user";
import { modelList, productTreeList } from "@/api/basicData/product.js";
+ import { getSparePartsList } from "@/api/equipmentManagement/spareParts.js";
import dayjs from "dayjs";
import FileUpload from "@/components/AttachmentUpload/file/index.vue";
@@ -776,9 +923,9 @@
// 鑾峰彇鍏ュ簱鐘舵�佹爣绛剧被鍨�
const getStockInStatusType = status => {
const typeMap = {
- "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
- "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
- "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+ 寰呭叆搴�: "info", // 寰呭叆搴� - 鐏拌壊
+ 鍏ュ簱涓�: "warning", // 鍏ュ簱涓� - 姗欒壊
+ 瀹屽叏鍏ュ簱: "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
};
return typeMap[status] || "";
};
@@ -786,9 +933,9 @@
// 鑾峰彇鍏ュ簱瀹℃牳鐘舵�佹爣绛剧被鍨�
const getStockInApprovalStatusType = status => {
const typeMap = {
- "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
- "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
- "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+ 寰呭叆搴�: "info", // 寰呭叆搴� - 鐏拌壊
+ 鍏ュ簱涓�: "warning", // 鍏ュ簱涓� - 姗欒壊
+ 瀹屽叏鍏ュ簱: "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
};
return typeMap[status] || "";
};
@@ -923,7 +1070,7 @@
},
rules: {
purchaseContractNumber: [
- { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ { required: false, message: "璇疯緭鍏�", trigger: "blur" },
],
projectName: [
{ required: true, message: "璇疯緭鍏ラ」鐩悕绉�", trigger: "blur" },
@@ -952,6 +1099,7 @@
const currentId = ref("");
const productFormData = reactive({
productForm: {
+ productType: 1,
productId: "",
productCategory: "",
productModelId: "",
@@ -983,10 +1131,27 @@
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
],
invoiceType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- isChecked: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ // isChecked 榛樿浼犲惁锛屼笉闇�瑕侀獙璇�
},
});
- const { productForm, productRules } = toRefs(productFormData);
+ const { productForm } = toRefs(productFormData);
+
+ // 鍔ㄦ�佽绠楅獙璇佽鍒�
+ const productRules = computed(() => {
+ const isSpareParts = productForm.value.productType === 2;
+ return {
+ productId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ productModelId: isSpareParts ? [] : [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ unit: isSpareParts ? [] : [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ taxInclusiveUnitPrice: isSpareParts ? [] : [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ taxRate: isSpareParts ? [] : [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ warnNum: isSpareParts ? [] : [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ taxInclusiveTotalPrice: isSpareParts ? [] : [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ taxExclusiveTotalPrice: isSpareParts ? [] : [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ invoiceType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ };
+ });
const upload = reactive({
// 涓婁紶鐨勫湴鍧�
url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
@@ -1274,7 +1439,7 @@
const openForm = async (type, row) => {
// 缂栬緫鏃舵鏌ュ叆搴撶姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
if (type === "edit" && row) {
- if (row.stockInStatus === '瀹屽叏鍏ュ簱') {
+ if (row.stockInStatus === "瀹屽叏鍏ュ簱") {
proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑璁板綍涓嶈兘缂栬緫");
return;
}
@@ -1306,18 +1471,7 @@
form.value.entryDate = getCurrentDate();
- if (type === "add") {
- // 鏂板鏃剁敓鎴愰噰璐悎鍚屽彿
- try {
- const purchaseNoRes = await createPurchaseNo();
- if (purchaseNoRes?.data) {
- form.value.purchaseContractNumber = purchaseNoRes.data;
- }
- } catch (error) {
- console.error("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:", error);
- proxy.$modal.msgWarning("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�");
- }
- } else if (type === "edit" && row?.id) {
+ if (type === "edit" && row?.id) {
// 缂栬緫鏃跺姞杞芥暟鎹�
currentId.value = row.id;
try {
@@ -1325,7 +1479,10 @@
form.value = { ...purchaseRes, stockInStatus: row.stockInStatus };
fileList.value = purchaseRes.storageBlobVOS || [];
// 浣跨敤 productList 鎺ュ彛鑾峰彇浜у搧鍒楄〃锛屼互鑾峰彇鍏ュ簱瀹℃牳鐘舵��
- const productRes = await productList({ salesLedgerId: row.id, type: 2 });
+ const productRes = await productList({
+ salesLedgerId: row.id,
+ type: 2,
+ });
productData.value = productRes.data || [];
} catch (error) {
console.error("鍔犺浇閲囪喘鍙拌处鏁版嵁澶辫触:", error);
@@ -1398,7 +1555,7 @@
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
- proxy.$refs["formRef"].validate(valid => {
+ proxy.$refs["formRef"].validate(async valid => {
if (valid) {
if (productData.value.length > 0) {
// 鏂板鏃讹紝闇�瑕佷粠姣忎釜浜у搧瀵硅薄涓垹闄� id 瀛楁
@@ -1428,6 +1585,20 @@
delete submitData.id;
}
+ // 濡傛灉閲囪喘鍚堝悓鍙蜂负绌猴紝鍒欐牴鎹綍鍏ユ棩鏈熻嚜鍔ㄧ敓鎴�
+ if (!submitData.purchaseContractNumber) {
+ try {
+ const purchaseNoRes = await createPurchaseNo(submitData.entryDate);
+ if (purchaseNoRes?.data) {
+ submitData.purchaseContractNumber = purchaseNoRes.data;
+ }
+ } catch (error) {
+ console.error("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:", error);
+ proxy.$modal.msgWarning("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�");
+ return;
+ }
+ }
+
addOrEditPurchase(submitData).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
@@ -1444,7 +1615,7 @@
// 鎵撳紑浜у搧寮规
const openProductForm = async (type, row, index) => {
// 缂栬緫鏃舵鏌ヤ骇鍝佸叆搴撳鏍哥姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
- if (type === "edit" && row && row.stockInApprovalStatus === '瀹屽叏鍏ュ簱') {
+ if (type === "edit" && row && row.stockInApprovalStatus === "瀹屽叏鍏ュ簱") {
proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑浜у搧涓嶈兘缂栬緫");
return;
}
@@ -1462,16 +1633,27 @@
await nextTick();
if (type === "add") {
- productForm.value.isChecked = false;
+ productForm.value.isChecked = false; // 鏄惁璐ㄦ榛樿浼犲惁
+ productForm.value.productType = "product";
}
if (type === "edit") {
// 澶嶅埗琛屾暟鎹�
productForm.value = { ...row };
+ // 濡傛灉娌℃湁 productType锛岄粯璁や负 product (1)
+ if (!productForm.value.productType) {
+ productForm.value.productType = 1;
+ }
+
+ // 濡傛灉鏄澶囧浠剁被鍨嬶紝鍔犺浇璁惧澶囦欢鍒楄〃
+ if (productForm.value.productType === 2) {
+ await getSparePartsOptions();
+ }
+
// 濡傛灉鏄粠妯℃澘鍔犺浇鐨勬暟鎹紝鍙兘娌℃湁 productId 鍜� productModelId
// 闇�瑕佹牴鎹� productCategory 鍜� specificationModel 鏉ユ煡鎵惧搴旂殑 ID
- if (!productForm.value.productId && productForm.value.productCategory) {
+ if (!productForm.value.productId && productForm.value.productCategory && productForm.value.productType !== 2) {
// 鏍规嵁 productCategory 鏌ユ壘 productId
const findProductIdByCategory = (nodes, categoryName) => {
for (let i = 0; i < nodes.length; i++) {
@@ -1539,6 +1721,45 @@
return res;
});
};
+
+ // 鑾峰彇璁惧澶囦欢鍒楄〃
+ const getSparePartsOptions = () => {
+ return getSparePartsList({ current: -1, size: -1 }).then(res => {
+ if (res.data && Array.isArray(res.data.rows)) {
+ sparePartsOptions.value = res.data.rows;
+ } else if (res.data && Array.isArray(res.data.records)) {
+ sparePartsOptions.value = res.data.records;
+ } else {
+ sparePartsOptions.value = [];
+ }
+ return res;
+ });
+ };
+
+ // 澶勭悊绫诲瀷鍙樺寲
+ const handleProductTypeChange = (type) => {
+ productForm.value.productId = "";
+ productForm.value.productCategory = "";
+ productForm.value.productModelId = "";
+ productForm.value.specificationModel = "";
+ modelOptions.value = [];
+
+ if (type === 2) {
+ getSparePartsOptions();
+ }
+ };
+
+ // 澶勭悊璁惧澶囦欢閫夋嫨
+ const handleSparePartsChange = (value) => {
+ const selectedSparePart = sparePartsOptions.value.find(item => item.id === value);
+ if (selectedSparePart) {
+ productForm.value.productCategory = selectedSparePart.name;
+ productForm.value.specificationModel = "/";
+ } else {
+ productForm.value.productCategory = "";
+ productForm.value.specificationModel = "";
+ }
+ };
const getModels = value => {
if (value) {
productForm.value.productCategory =
@@ -1595,6 +1816,19 @@
// 鎻愪氦浜у搧琛ㄥ崟
const submitProduct = () => {
+ // 濡傛灉鏄澶囧浠讹紝鍏堣缃粯璁ゅ�硷紝鍐嶉獙璇�
+ if (productForm.value.productType === 2) {
+ productForm.value.specificationModel = "/";
+ productForm.value.productModelId = null;
+ productForm.value.unit = "";
+ productForm.value.taxRate = "";
+ productForm.value.taxInclusiveUnitPrice = 0;
+ productForm.value.taxInclusiveTotalPrice = 0;
+ productForm.value.taxExclusiveTotalPrice = 0;
+ productForm.value.warnNum = 0;
+ productForm.value.isChecked = false; // 鏄惁璐ㄦ榛樿浼犲惁
+ }
+
proxy.$refs["productFormRef"].validate(valid => {
if (valid) {
if (operationType.value === "edit") {
@@ -1633,7 +1867,7 @@
}
// 妫�鏌ラ�変腑鐨勪骇鍝佷腑鏄惁鏈夊畬鍏ㄥ叆搴撶殑
const hasFullyStocked = productSelectedRows.value.some(
- row => row.stockInApprovalStatus === '瀹屽叏鍏ュ簱'
+ row => row.stockInApprovalStatus === "瀹屽叏鍏ュ簱"
);
if (hasFullyStocked) {
proxy.$modal.msgWarning("閫変腑鐨勪骇鍝佷腑鍖呭惈瀹屽叏鍏ュ簱鐨勪骇鍝侊紝鏃犳硶鍒犻櫎");
@@ -1709,6 +1943,37 @@
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
});
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ const handleBatchGenerate = async () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const ids = selectedRows.value.map((item) => item.id);
+
+ ElMessageBox.confirm("纭鎵归噺鐢熸垚鏁版嵁锛�", "鎵归噺鐢熸垚", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "info",
+ })
+ .then(() => {
+ proxy.$modal.loading("姝e湪鎵归噺鐢熸垚鏁版嵁锛岃绋嶅��...");
+ batchGeneratePurchaseInboundSteps({ ids })
+ .then((res) => {
+ proxy.$modal.msgSuccess("鎵归噺鐢熸垚鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ proxy.$modal.msgError("鎵归噺鐢熸垚澶辫触");
+ })
+ .finally(() => {
+ proxy.$modal.closeLoading();
+ });
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
@@ -1852,7 +2117,7 @@
contractNo: form.value.salesLedgerId,
});
if (code == 200) {
- productData.value = data;
+ productData.value = data || [];
}
};
--
Gitblit v1.9.3