From 4db45250f9e0e47b1df480eb4e325a931f40c9c6 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期六, 28 三月 2026 13:24:26 +0800
Subject: [PATCH] Merge branch 'dev_HXSJ' of http://114.132.189.42:9002/r/product-inventory-management into dev_HXSJ
---
src/views/procurementManagement/procurementLedger/index.vue | 1842 +++++++++++++++++++++++++++--------------------------------
1 files changed, 842 insertions(+), 1,000 deletions(-)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 99a392f..400f061 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -44,32 +44,31 @@
<el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
</div>
<el-table
- :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="(row) => row.id"
- show-summary
- :summary-method="summarizeMainTable"
- @expand-change="expandChange"
- height="calc(100vh - 18.5em)"
- :row-class-name="tableRowClassName"
+ :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="(row) => row.id"
+ show-summary
+ :summary-method="summarizeMainTable"
+ @expand-change="expandChange"
+ height="calc(100vh - 18.5em)"
>
<el-table-column align="center" type="selection" width="55" />
<el-table-column type="expand">
<template #default="props">
<el-table
- :data="props.row.children"
- border
- show-summary
- :summary-method="summarizeChildrenTable"
+ :data="props.row.children"
+ border
+ show-summary
+ :summary-method="summarizeChildrenTable"
>
<el-table-column
- align="center"
- label="搴忓彿"
- type="index"
- width="60"
+ align="center"
+ label="搴忓彿"
+ type="index"
+ width="60"
/>
<el-table-column label="浜у搧澶х被" prop="productCategory" />
<el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
@@ -77,163 +76,168 @@
<el-table-column label="鏁伴噺" prop="quantity" />
<el-table-column label="绋庣巼(%)" prop="taxRate" />
<el-table-column
- label="鍚◣鍗曚环(鍏�)"
- prop="taxInclusiveUnitPrice"
- :formatter="formattedNumber"
+ label="鍚◣鍗曚环(鍏�)"
+ prop="taxInclusiveUnitPrice"
+ :formatter="formattedNumber"
/>
<el-table-column
- label="鍚◣鎬讳环(鍏�)"
- prop="taxInclusiveTotalPrice"
- :formatter="formattedNumber"
+ label="鍚◣鎬讳环(鍏�)"
+ prop="taxInclusiveTotalPrice"
+ :formatter="formattedNumber"
/>
<el-table-column
- label="涓嶅惈绋庢�讳环(鍏�)"
- prop="taxExclusiveTotalPrice"
- :formatter="formattedNumber"
+ label="涓嶅惈绋庢�讳环(鍏�)"
+ prop="taxExclusiveTotalPrice"
+ :formatter="formattedNumber"
/>
</el-table>
</template>
</el-table-column>
<el-table-column align="center" label="搴忓彿" type="index" width="60" />
<el-table-column
- label="閲囪喘鍚堝悓鍙�"
- prop="purchaseContractNumber"
- width="200"
- show-overflow-tooltip
+ label="閲囪喘鍚堝悓鍙�"
+ prop="purchaseContractNumber"
+ width="200"
+ show-overflow-tooltip
/>
<el-table-column
- label="閿�鍞悎鍚屽彿"
- prop="salesContractNo"
- width="200"
- show-overflow-tooltip
+ label="閿�鍞悎鍚屽彿"
+ prop="salesContractNo"
+ width="200"
+ show-overflow-tooltip
/>
<el-table-column
- label="渚涘簲鍟嗗悕绉�"
- width="240"
- prop="supplierName"
- show-overflow-tooltip
- />
- <el-table-column label="璁㈠崟鐘舵��" width="100" align="center">
- <template #default="scope">
- <el-tag v-if="scope.row.isInvalid" type="danger" size="small">澶辨晥</el-tag>
- <el-tag v-else type="success" size="small">姝e父</el-tag>
- </template>
- </el-table-column>
- <el-table-column
- label="椤圭洰鍚嶇О"
- prop="projectName"
- width="420"
- show-overflow-tooltip
+ label="渚涘簲鍟嗗悕绉�"
+ width="240"
+ prop="supplierName"
+ show-overflow-tooltip
/>
<el-table-column
- label="瀹℃壒鐘舵��"
- prop="approvalStatus"
- width="200"
- show-overflow-tooltip
- >
+ label="椤圭洰鍚嶇О"
+ prop="projectName"
+ width="420"
+ show-overflow-tooltip
+ />
+ <el-table-column label="瀹℃壒鐘舵��" width="140">
<template #default="scope">
<el-tag
- size="small"
- >
- {{ approvalStatusText[scope.row.approvalStatus] || '鏈煡鐘舵��' }}
- </el-tag>
+ v-if="(scope.row.approveStatus ?? scope.row.approvalStatus ?? scope.row.auditStatus) == 0"
+ type="warning"
+ >寰呭鏍�</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus ?? scope.row.auditStatus) == 1"
+ type="primary"
+ >瀹℃牳涓�</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus ?? scope.row.auditStatus) == 2"
+ type="success"
+ >瀹℃牳瀹屾垚</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus ?? scope.row.auditStatus) == 3"
+ type="danger"
+ >瀹℃牳鏈�氳繃</el-tag>
+ <el-tag
+ v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus ?? scope.row.auditStatus) == 4"
+ type="info"
+ >宸查噸鏂版彁浜�</el-tag>
+ <el-tag v-else type="info">-</el-tag>
</template>
</el-table-column>
<el-table-column
- label="浠樻鏂瑰紡"
- width="100"
- prop="paymentMethod"
- show-overflow-tooltip
+ label="浠樻鏂瑰紡"
+ width="100"
+ prop="paymentMethod"
+ show-overflow-tooltip
/>
<el-table-column
- label="鍚堝悓閲戦(鍏�)"
- prop="contractAmount"
- width="200"
- show-overflow-tooltip
- :formatter="formattedNumber"
+ label="鍚堝悓閲戦(鍏�)"
+ prop="contractAmount"
+ width="200"
+ show-overflow-tooltip
+ :formatter="formattedNumber"
/>
<el-table-column
- label="褰曞叆浜�"
- prop="recorderName"
- width="100"
- show-overflow-tooltip
+ label="褰曞叆浜�"
+ prop="recorderName"
+ width="100"
+ show-overflow-tooltip
/>
<el-table-column
- label="褰曞叆鏃ユ湡"
- prop="entryDate"
- width="100"
- show-overflow-tooltip
+ label="褰曞叆鏃ユ湡"
+ prop="entryDate"
+ width="100"
+ show-overflow-tooltip
/>
<el-table-column
- fixed="right"
- label="鎿嶄綔"
- min-width="150"
- align="center"
+ fixed="right"
+ label="鎿嶄綔"
+ min-width="150"
+ align="center"
>
<template #default="scope">
<el-button
- link
- type="primary"
- size="small"
- @click="openForm('edit', scope.row)"
- >缂栬緫</el-button
+ link
+ type="primary"
+ size="small"
+ @click="openForm('edit', scope.row)"
+ >缂栬緫</el-button
>
<el-button
- link
- type="success"
- size="small"
- @click="showQRCode(scope.row)"
- >鐢熸垚浜岀淮鐮�</el-button
+ link
+ type="success"
+ size="small"
+ @click="showQRCode(scope.row)"
+ >鐢熸垚浜岀淮鐮�</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
- v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange"
+ v-show="total > 0"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current"
+ :limit="page.size"
+ @pagination="paginationChange"
/>
</div>
<el-dialog
- v-model="dialogFormVisible"
- :title="operationType === 'add' ? '鏂板閲囪喘鍙拌处椤甸潰' : '缂栬緫閲囪喘鍙拌处椤甸潰'"
- width="70%"
- @close="closeDia"
+ v-model="dialogFormVisible"
+ :title="operationType === 'add' ? '鏂板閲囪喘鍙拌处椤甸潰' : '缂栬緫閲囪喘鍙拌处椤甸潰'"
+ width="70%"
+ @close="closeDia"
>
<el-form
- :model="form"
- label-width="140px"
- label-position="top"
- :rules="rules"
- ref="formRef"
+ :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef"
>
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="閲囪喘鍚堝悓鍙凤細" prop="purchaseContractNumber">
<el-input
- v-model="form.purchaseContractNumber"
- placeholder="璇疯緭鍏�"
- clearable
+ v-model="form.purchaseContractNumber"
+ placeholder="璇疯緭鍏�"
+ clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesLedgerId">
<el-select
- v-model="form.salesLedgerId"
- placeholder="璇烽�夋嫨"
- clearable
- @change="salesLedgerChange"
+ v-model="form.salesLedgerId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ @change="salesLedgerChange"
>
<el-option
- v-for="item in salesContractList"
- :key="item.id"
- :label="item.salesContractNo"
- :value="item.id"
+ v-for="item in salesContractList"
+ :key="item.id"
+ :label="item.salesContractNo"
+ :value="item.id"
/>
</el-select>
</el-form-item>
@@ -243,17 +247,15 @@
<el-col :span="12">
<el-form-item label="渚涘簲鍟嗗悕绉帮細" prop="supplierId">
<el-select
- v-model="form.supplierId"
- placeholder="璇烽�夋嫨"
- clearable
- filterable
- allow-create
+ v-model="form.supplierId"
+ placeholder="璇烽�夋嫨"
+ clearable
>
<el-option
- v-for="item in supplierList"
- :key="item.id"
- :label="item.supplierName"
- :value="item.id"
+ v-for="item in supplierList"
+ :key="item.id"
+ :label="item.supplierName"
+ :value="item.id"
/>
</el-select>
</el-form-item>
@@ -261,65 +263,51 @@
<el-col :span="12">
<el-form-item label="椤圭洰鍚嶇О锛�" prop="projectName">
<el-input
- v-model="form.projectName"
- placeholder="璇疯緭鍏�"
- clearable
+ v-model="form.projectName"
+ placeholder="璇疯緭鍏�"
+ clearable
/>
</el-form-item>
</el-col>
</el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="浠樻鏂瑰紡">
+ <el-input
+ v-model="form.paymentMethod"
+ placeholder="璇疯緭鍏�"
+ clearable
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="绛捐鏃ユ湡锛�" prop="executionDate">
+ <el-date-picker
+ style="width: 100%"
+ v-model="form.executionDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="浠樻鏂瑰紡">
- <el-input
- v-model="form.paymentMethod"
- placeholder="璇疯緭鍏�"
- clearable
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="绛捐鏃ユ湡锛�" prop="executionDate">
- <el-date-picker
- style="width: 100%"
- v-model="form.executionDate"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="瀹℃壒浜猴細" prop="approverId">
+ <el-form-item label="褰曞叆浜猴細" prop="recorderId">
<el-select
- v-model="form.approverId"
- placeholder="璇烽�夋嫨瀹℃壒浜�"
- clearable
+ v-model="form.recorderId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ disabled
>
<el-option
- v-for="item in userList"
- :key="item.userId"
- :label="item.nickName"
- :value="item.userId"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="褰曞叆浜猴細" prop="recorderId" v-show="false">
- <el-select
- v-model="form.recorderId"
- placeholder="璇烽�夋嫨"
- clearable
- disabled
- >
- <el-option
- v-for="item in userList"
- :key="item.userId"
- :label="item.nickName"
- :value="item.userId"
+ v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId"
/>
</el-select>
</el-form-item>
@@ -327,109 +315,120 @@
<el-col :span="12">
<el-form-item label="褰曞叆鏃ユ湡锛�" prop="entryDate">
<el-date-picker
- style="width: 100%"
- v-model="form.entryDate"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable
+ style="width: 100%"
+ v-model="form.entryDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
/>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item>
+ <template #label>
+ <span>瀹℃壒浜洪�夋嫨锛�</span>
+ <el-button type="primary" @click="addApproverNode" style="margin-left: 8px;">鏂板鑺傜偣</el-button>
+ </template>
+ <div style="display: flex; align-items: flex-end; flex-wrap: wrap;">
+ <div
+ v-for="(node, index) in approverNodes"
+ :key="node.id"
+ style="margin-right: 30px; text-align: center; margin-bottom: 10px;"
+ >
+ <div>
+ <span>瀹℃壒浜�</span>
+ 鈫�
+ </div>
+ <el-select
+ v-model="node.userId"
+ placeholder="閫夋嫨浜哄憳"
+ style="width: 140px; margin-bottom: 8px;"
+ >
+ <el-option
+ v-for="user in userList"
+ :key="user.userId"
+ :label="user.nickName"
+ :value="user.userId"
+ />
+ </el-select>
+ <div>
+ <el-button
+ type="danger"
+ size="small"
+ @click="removeApproverNode(index)"
+ v-if="approverNodes.length > 1"
+ >鍒犻櫎</el-button>
+ </div>
+ </div>
+ </div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-form-item label="浜у搧淇℃伅锛�" prop="entryDate">
<el-button type="primary" @click="openProductForm('add')"
- >娣诲姞</el-button
+ >娣诲姞</el-button
>
<el-button plain type="danger" @click="deleteProduct"
- >鍒犻櫎</el-button
+ >鍒犻櫎</el-button
>
</el-form-item>
- <div class="select-button-group" style="width: 220px; margin: 20px 0;" v-if="operationType === 'add'">
- <el-select
- filterable
- allow-create
- :reserve-keyword="true"
- :default-first-option="false"
- v-model="templateName"
- :input-value="filterInputValue"
- @filter-change="onTemplateFilterChange"
- @change="onTemplateChange"
- style="width: 180px; border-right: none; border-radius: 4px 0 0 4px;"
- placeholder="璇烽�夋嫨"
- class="no-arrow-select"
- >
- <el-option
- v-for="item in templateList"
- :key="item.value"
- :label="item.templateName"
- :value="item.templateName"
- ></el-option>
- </el-select>
- <!-- 鎸夐挳锛氫笌 Select 楂樺害鍖归厤锛屽幓鎺夊乏渚ц竟妗嗭紝鏃犵紳琛旀帴 -->
- <el-button
- size="small"
- style="height: 32px; border-radius: 0 4px 4px 0; margin-left: -1px;"
- @click="handleButtonClick"
- :disabled="!templateName || templateName.trim() === '' || isTemplateNameDuplicate"
- >
- 淇濆瓨
- </el-button>
- </div>
</el-row>
<el-table
- :data="productData"
- border
- @selection-change="productSelected"
- show-summary
- :summary-method="summarizeProTable"
+ :data="productData"
+ border
+ @selection-change="productSelected"
+ show-summary
+ :summary-method="summarizeProTable"
>
<el-table-column align="center" type="selection" width="55" />
<el-table-column
- align="center"
- label="搴忓彿"
- type="index"
- width="60"
+ align="center"
+ label="搴忓彿"
+ type="index"
+ width="60"
/>
<el-table-column label="浜у搧澶х被" prop="productCategory" />
<el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
<el-table-column label="鍗曚綅" prop="unit" width="70" />
<el-table-column label="鏁伴噺" prop="quantity" width="70" />
- <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" width="120" show-overflow-tooltip />
+ <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" width="120" show-overflow-tooltip />
<el-table-column label="绋庣巼(%)" prop="taxRate" width="80" />
<el-table-column
- label="鍚◣鍗曚环(鍏�)"
- prop="taxInclusiveUnitPrice"
- :formatter="formattedNumber"
- width="150"
+ label="鍚◣鍗曚环(鍏�)"
+ prop="taxInclusiveUnitPrice"
+ :formatter="formattedNumber"
+ width="150"
/>
<el-table-column
- label="鍚◣鎬讳环(鍏�)"
- prop="taxInclusiveTotalPrice"
- :formatter="formattedNumber"
- width="150"
+ label="鍚◣鎬讳环(鍏�)"
+ prop="taxInclusiveTotalPrice"
+ :formatter="formattedNumber"
+ width="150"
/>
<el-table-column
- label="涓嶅惈绋庢�讳环(鍏�)"
- prop="taxExclusiveTotalPrice"
- :formatter="formattedNumber"
- width="150"
+ label="涓嶅惈绋庢�讳环(鍏�)"
+ prop="taxExclusiveTotalPrice"
+ :formatter="formattedNumber"
+ width="150"
/>
<el-table-column
- fixed="right"
- label="鎿嶄綔"
- min-width="60"
- align="center"
+ fixed="right"
+ label="鎿嶄綔"
+ min-width="60"
+ align="center"
>
<template #default="scope">
<el-button
- link
- type="primary"
- size="small"
- @click="openProductForm('edit', scope.row, scope.$index)"
- >缂栬緫</el-button
+ link
+ type="primary"
+ size="small"
+ @click="openProductForm('edit', scope.row, scope.$index)"
+ >缂栬緫</el-button
>
</template>
</el-table-column>
@@ -438,11 +437,11 @@
<el-col :span="24">
<el-form-item label="澶囨敞路锛�" prop="remark">
<el-input
- v-model="form.remark"
- placeholder="璇疯緭鍏�"
- clearable
- type="textarea"
- :rows="2"
+ v-model="form.remark"
+ placeholder="璇疯緭鍏�"
+ clearable
+ type="textarea"
+ :rows="2"
/>
</el-form-item>
</el-col>
@@ -451,16 +450,16 @@
<el-col :span="24">
<el-form-item label="闄勪欢鏉愭枡锛�" prop="remark">
<el-upload
- v-model:file-list="fileList"
- :action="upload.url"
- multiple
- ref="fileUpload"
- auto-upload
- :headers="upload.headers"
- :before-upload="handleBeforeUpload"
- :on-error="handleUploadError"
- :on-success="handleUploadSuccess"
- :on-remove="handleRemove"
+ v-model:file-list="fileList"
+ :action="upload.url"
+ multiple
+ ref="fileUpload"
+ auto-upload
+ :headers="upload.headers"
+ :before-upload="handleBeforeUpload"
+ :on-error="handleUploadError"
+ :on-success="handleUploadSuccess"
+ :on-remove="handleRemove"
>
<el-button type="primary">涓婁紶</el-button>
<template #tip>
@@ -482,30 +481,30 @@
</template>
</el-dialog>
<el-dialog
- v-model="productFormVisible"
- :title="productOperationType === 'add' ? '鏂板浜у搧' : '缂栬緫浜у搧'"
- width="40%"
- @close="closeProductDia"
+ v-model="productFormVisible"
+ :title="productOperationType === 'add' ? '鏂板浜у搧' : '缂栬緫浜у搧'"
+ width="40%"
+ @close="closeProductDia"
>
<el-form
- :model="productForm"
- label-width="140px"
- label-position="top"
- :rules="productRules"
- ref="productFormRef"
+ :model="productForm"
+ label-width="140px"
+ label-position="top"
+ :rules="productRules"
+ ref="productFormRef"
>
<el-row :gutter="30">
<el-col :span="24">
<el-form-item label="浜у搧澶х被锛�" prop="productId">
<el-tree-select
- v-model="productForm.productId"
- placeholder="璇烽�夋嫨"
- clearable
- check-strictly
- @change="getModels"
- :data="productOptions"
- :render-after-expand="false"
- style="width: 100%"
+ v-model="productForm.productId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ check-strictly
+ @change="getModels"
+ :data="productOptions"
+ :render-after-expand="false"
+ style="width: 100%"
/>
</el-form-item>
</el-col>
@@ -514,16 +513,16 @@
<el-col :span="24">
<el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productModelId">
<el-select
- v-model="productForm.productModelId"
- placeholder="璇烽�夋嫨"
- clearable
- @change="getProductModel"
+ v-model="productForm.productModelId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ @change="getProductModel"
>
<el-option
- v-for="item in modelOptions"
- :key="item.id"
- :label="item.model"
- :value="item.id"
+ v-for="item in modelOptions"
+ :key="item.id"
+ :label="item.model"
+ :value="item.id"
/>
</el-select>
</el-form-item>
@@ -533,24 +532,29 @@
<el-col :span="12">
<el-form-item label="鍗曚綅锛�" prop="unit">
<el-input
- v-model="productForm.unit"
- placeholder="璇疯緭鍏�"
- clearable
+ v-model="productForm.unit"
+ placeholder="璇疯緭鍏�"
+ clearable
/>
</el-form-item>
</el-col>
- <el-col :span="12">
- <el-form-item label="绋庣巼(%)锛�" prop="taxRate">
- <el-select
- v-model="productForm.taxRate"
- placeholder="璇烽�夋嫨"
- clearable
- @change="mathNum"
- >
- <el-option label="1" value="1" />
- <el-option label="6" value="6" />
- <el-option label="13" value="13" />
- </el-select>
+ <el-col :span="12">
+ <el-form-item label="绋庣巼(%)锛�" prop="taxRate">
+ <el-select
+ v-model="productForm.taxRate"
+ placeholder="璇烽�夋嫨"
+ clearable
+ @change="mathNum"
+ >
+ <el-option label="1" value="1" />
+ <el-option label="6" value="6" />
+ <el-option label="13" value="13" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label=" ">
+ <el-button type="warning" :disabled="!(productForm.productId && productForm.productModelId && productForm.taxRate)" @click="showPriceReference" icon="Search">鏌ョ湅鍘嗗彶閲囪喘浠锋牸鍙傝��</el-button>
</el-form-item>
</el-col>
</el-row>
@@ -558,50 +562,50 @@
<el-col :span="12">
<el-form-item label="鍚◣鍗曚环(鍏�)锛�" prop="taxInclusiveUnitPrice">
<el-input-number
- v-model="productForm.taxInclusiveUnitPrice"
- :precision="2"
- :step="0.1"
- clearable
- style="width: 100%"
- @change="mathNum"
+ v-model="productForm.taxInclusiveUnitPrice"
+ :precision="2"
+ :step="0.1"
+ clearable
+ style="width: 100%"
+ @change="mathNum"
/>
</el-form-item>
</el-col>
- <el-col :span="12">
- <el-form-item label="鏁伴噺锛�" prop="quantity">
- <el-input-number
- :step="0.1"
- clearable
- :precision="2"
- style="width: 100%"
- v-model="productForm.quantity"
- placeholder="璇疯緭鍏�"
- @change="mathNum"
- />
- </el-form-item>
- </el-col>
+ <el-col :span="12">
+ <el-form-item label="鏁伴噺锛�" prop="quantity">
+ <el-input-number
+ :step="0.1"
+ clearable
+ :precision="2"
+ style="width: 100%"
+ v-model="productForm.quantity"
+ placeholder="璇疯緭鍏�"
+ @change="mathNum"
+ />
+ </el-form-item>
+ </el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="鍚◣鎬讳环(鍏�)锛�" prop="taxInclusiveTotalPrice">
<el-input-number
- v-model="productForm.taxInclusiveTotalPrice"
- :precision="2"
- :step="0.1"
- clearable
- style="width: 100%"
- @change="reverseMathNum('taxInclusiveTotalPrice')"
+ v-model="productForm.taxInclusiveTotalPrice"
+ :precision="2"
+ :step="0.1"
+ clearable
+ style="width: 100%"
+ @change="reverseMathNum('taxInclusiveTotalPrice')"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
- label="涓嶅惈绋庢�讳环(鍏�)锛�"
- prop="taxExclusiveTotalPrice"
+ label="涓嶅惈绋庢�讳环(鍏�)锛�"
+ prop="taxExclusiveTotalPrice"
>
<el-input
- v-model="productForm.taxExclusiveTotalPrice"
- @change="reverseMathNum('taxExclusiveTotalPrice')"
+ v-model="productForm.taxExclusiveTotalPrice"
+ @change="reverseMathNum('taxExclusiveTotalPrice')"
/>
</el-form-item>
</el-col>
@@ -610,26 +614,26 @@
<el-col :span="12">
<el-form-item label="鍙戠エ绫诲瀷锛�" prop="invoiceType">
<el-select
- v-model="productForm.invoiceType"
- placeholder="璇烽�夋嫨"
- clearable
+ v-model="productForm.invoiceType"
+ placeholder="璇烽�夋嫨"
+ clearable
>
<el-option label="澧炴櫘绁�" value="澧炴櫘绁�" />
<el-option label="澧炰笓绁�" value="澧炰笓绁�" />
</el-select>
</el-form-item>
</el-col>
- <el-col :span="12">
- <el-form-item label="搴撳瓨棰勮鏁伴噺锛�" prop="warnNum">
- <el-input-number
- v-model="productForm.warnNum"
- :precision="2"
- :step="0.1"
- clearable
- style="width: 100%"
- />
- </el-form-item>
- </el-col>
+ <el-col :span="12">
+ <el-form-item label="搴撳瓨棰勮鏁伴噺锛�" prop="warnNum">
+ <el-input-number
+ v-model="productForm.warnNum"
+ :precision="2"
+ :step="0.1"
+ clearable
+ style="width: 100%"
+ />
+ </el-form-item>
+ </el-col>
</el-row>
</el-form>
<template #footer>
@@ -640,12 +644,68 @@
</template>
</el-dialog>
+ <!-- 鍘嗗彶閲囪喘浠锋牸鍙傝�冨脊绐� -->
+ <el-dialog
+ v-model="priceReferenceVisible"
+ title="鍘嗗彶閲囪喘浠锋牸鍙傝��"
+ width="1000px"
+ append-to-body
+ >
+ <el-table
+ v-loading="priceReferenceLoading"
+ :data="priceReferenceData"
+ border
+ style="width: 100%"
+ >
+ <el-table-column label="鍟嗗搧鍚嶇О" prop="productName" min-width="150" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specification" width="150" show-overflow-tooltip />
+ <el-table-column label="渚涘簲鍟�" prop="supplierName" width="200" show-overflow-tooltip />
+ <el-table-column label="鍩虹浠锋牸" width="120" align="right">
+ <template #default="{ row }">
+ <span style="color: #f56c6c; font-weight: bold;">楼{{ row.basePrice }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎶樻墸淇℃伅" width="120" align="center">
+ <template #default="{ row }">
+ <el-tag v-if="row.discountType === 'percentage'" type="success">
+ {{ row.discountValue }}%
+ </el-tag>
+ <el-tag v-else-if="row.discountType === 'fixed'" type="warning">
+ -楼{{ row.discountValue }}
+ </el-tag>
+ <span v-else>鏃犳姌鎵�</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鐢熸晥鏃堕棿" prop="effectiveTime" width="180" align="center" />
+ <el-table-column label="鎿嶄綔" width="100" align="center" fixed="right">
+ <template #default="{ row }">
+ <el-button type="primary" link @click="selectPriceReference(row)">閫夋嫨</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <div class="pagination-container" style="margin-top: 20px; display: flex; justify-content: flex-end;">
+ <el-pagination
+ v-model:current-page="priceReferencePagination.current"
+ v-model:page-size="priceReferencePagination.size"
+ :page-sizes="[10, 20, 50]"
+ :total="priceReferenceTotal"
+ layout="total, sizes, prev, pager, next"
+ @size-change="handlePriceReferenceSizeChange"
+ @current-change="handlePriceReferenceCurrentChange"
+ />
+ </div>
+ <template #footer>
+ <el-button @click="priceReferenceVisible = false">鍏抽棴</el-button>
+ </template>
+ </el-dialog>
+
<!-- 浜岀淮鐮佹樉绀哄璇濇 -->
<el-dialog
- v-model="qrCodeDialogVisible"
- title="閲囪喘鍚堝悓鍙蜂簩缁寸爜"
- width="400px"
- center
+ v-model="qrCodeDialogVisible"
+ title="閲囪喘鍚堝悓鍙蜂簩缁寸爜"
+ width="400px"
+ center
>
<div style="text-align: center;">
<img :src="qrCodeUrl" alt="浜岀淮鐮�" style="width:200px;height:200px;" />
@@ -657,27 +717,27 @@
<!-- 鎵爜鏂板瀵硅瘽妗� -->
<el-dialog
- v-model="scanAddDialogVisible"
- title="鎵爜鏂板閲囪喘鍙拌处"
- width="70%"
- @close="closeScanAddDialog"
+ v-model="scanAddDialogVisible"
+ title="鎵爜鏂板閲囪喘鍙拌处"
+ width="70%"
+ @close="closeScanAddDialog"
>
<el-form
- :model="scanAddForm"
- label-width="140px"
- label-position="top"
- :rules="scanAddRules"
- ref="scanAddFormRef"
+ :model="scanAddForm"
+ label-width="140px"
+ label-position="top"
+ :rules="scanAddRules"
+ ref="scanAddFormRef"
>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="鎵爜鍐呭锛�">
<el-input
- v-model="scanAddForm.scanContent"
- type="textarea"
- :rows="3"
- placeholder="璇锋壂鎻忎簩缁寸爜鎴栨墜鍔ㄨ緭鍏ラ噰璐悎鍚屼俊鎭�"
- @input="parseScanContent"
+ v-model="scanAddForm.scanContent"
+ type="textarea"
+ :rows="3"
+ placeholder="璇锋壂鎻忎簩缁寸爜鎴栨墜鍔ㄨ緭鍏ラ噰璐悎鍚屼俊鎭�"
+ @input="parseScanContent"
/>
</el-form-item>
</el-col>
@@ -686,18 +746,18 @@
<el-col :span="12">
<el-form-item label="閲囪喘鍚堝悓鍙凤細" prop="purchaseContractNumber">
<el-input
- v-model="scanAddForm.purchaseContractNumber"
- placeholder="璇疯緭鍏�"
- clearable
+ v-model="scanAddForm.purchaseContractNumber"
+ placeholder="璇疯緭鍏�"
+ clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="渚涘簲鍟嗗悕绉帮細" prop="supplierName">
<el-input
- v-model="scanAddForm.supplierName"
- placeholder="璇疯緭鍏�"
- clearable
+ v-model="scanAddForm.supplierName"
+ placeholder="璇疯緭鍏�"
+ clearable
/>
</el-form-item>
</el-col>
@@ -706,21 +766,21 @@
<el-col :span="12">
<el-form-item label="椤圭洰鍚嶇О锛�" prop="projectName">
<el-input
- v-model="scanAddForm.projectName"
- placeholder="璇疯緭鍏�"
- clearable
+ v-model="scanAddForm.projectName"
+ placeholder="璇疯緭鍏�"
+ clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="鍚堝悓閲戦(鍏�)锛�" prop="contractAmount">
<el-input-number
- v-model="scanAddForm.contractAmount"
- :precision="2"
- :step="0.1"
- clearable
- style="width: 100%"
- placeholder="璇疯緭鍏�"
+ v-model="scanAddForm.contractAmount"
+ :precision="2"
+ :step="0.1"
+ clearable
+ style="width: 100%"
+ placeholder="璇疯緭鍏�"
/>
</el-form-item>
</el-col>
@@ -729,9 +789,9 @@
<el-col :span="12">
<el-form-item label="浠樻鏂瑰紡锛�">
<el-input
- v-model="scanAddForm.paymentMethod"
- placeholder="璇疯緭鍏�"
- clearable
+ v-model="scanAddForm.paymentMethod"
+ placeholder="璇疯緭鍏�"
+ clearable
/>
</el-form-item>
</el-col>
@@ -745,11 +805,11 @@
<el-col :span="24">
<el-form-item label="澶囨敞锛�">
<el-input
- v-model="scanAddForm.remark"
- type="textarea"
- :rows="2"
- placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�"
- clearable
+ v-model="scanAddForm.remark"
+ type="textarea"
+ :rows="2"
+ placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�"
+ clearable
/>
</el-form-item>
</el-col>
@@ -765,17 +825,17 @@
<!-- 鎵爜鐧昏瀵硅瘽妗� -->
<el-dialog
- v-model="scanDialogVisible"
- title="鎵爜鐧昏"
- width="60%"
- @close="closeScanDialog"
+ v-model="scanDialogVisible"
+ title="鎵爜鐧昏"
+ width="60%"
+ @close="closeScanDialog"
>
<el-form
- :model="scanForm"
- label-width="120px"
- label-position="left"
- :rules="scanRules"
- ref="scanFormRef"
+ :model="scanForm"
+ label-width="120px"
+ label-position="left"
+ :rules="scanRules"
+ ref="scanFormRef"
>
<el-row :gutter="20">
<el-col :span="12">
@@ -819,10 +879,10 @@
<el-col :span="24">
<el-form-item label="鎵爜澶囨敞锛�">
<el-input
- v-model="scanForm.scanRemark"
- type="textarea"
- :rows="3"
- placeholder="璇疯緭鍏ユ壂鐮佸娉ㄤ俊鎭�"
+ v-model="scanForm.scanRemark"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ユ壂鐮佸娉ㄤ俊鎭�"
/>
</el-form-item>
</el-col>
@@ -854,42 +914,35 @@
</div>
</template>
</el-dialog>
-
</div>
</template>
<script setup>
-import {getToken} from "@/utils/auth";
+import { getToken } from "@/utils/auth";
import pagination from "@/components/PIMTable/Pagination.vue";
-import {getCurrentInstance, nextTick, onMounted, reactive, ref, toRefs} from "vue";
-import {Search} from "@element-plus/icons-vue";
-import {ElMessage, ElMessageBox} from "element-plus";
-import {userListNoPage} from "@/api/system/user.js";
+import { ref, onMounted, reactive, toRefs, getCurrentInstance, nextTick } from "vue";
+import { Search } from "@element-plus/icons-vue";
+import { ElMessageBox } from "element-plus";
+import { userListNoPage } from "@/api/system/user.js";
import {
- addOrUpdateSalesLedgerProduct,
- delLedgerFile,
- delProduct,
- getProductInfoByContractNo,
getSalesLedgerWithProducts,
+ addOrUpdateSalesLedgerProduct,
+ delProduct,
+ delLedgerFile,
+ getProductInfoByContractNo,
} from "@/api/salesManagement/salesLedger.js";
import {
addOrEditPurchase,
- addPurchaseTemplate,
- createPurchaseNo,
delPurchase,
- getOptions,
- getPurchaseById,
- getPurchaseTemplateList,
getSalesNo,
+ purchaseListPage,
productList,
- purchaseListPage
+ getPurchaseById,
+ getOptions,
+ createPurchaseNo,
} from "@/api/procurementManagement/procurementLedger.js";
import useFormData from "@/hooks/useFormData.js";
import QRCode from "qrcode";
-import useUserStore from "@/store/modules/user";
-import {modelList, productTreeList} from "@/api/basicData/product.js";
-import dayjs from "dayjs";
-
const { proxy } = getCurrentInstance();
const tableData = ref([]);
const productData = ref([]);
@@ -907,109 +960,18 @@
});
const total = ref(0);
const fileList = ref([]);
+const approverNodes = ref([{ id: 1, userId: null }]);
+let nextApproverId = 2;
+import useUserStore from "@/store/modules/user";
+import { modelList, productTreeList } from "@/api/basicData/product.js";
+import { listPage as listAdvancedPrice } from "@/api/procurementManagement/advancedPriceManagement.js";
+import dayjs from "dayjs";
const userStore = useUserStore();
// 浜岀淮鐮佺浉鍏冲彉閲�
const qrCodeDialogVisible = ref(false);
const qrCodeUrl = ref("");
-
-// 璁㈠崟瀹℃壒鐘舵�佹樉绀烘枃鏈�
-const approvalStatusText = {
- 0: '瀹℃壒涓�',
- 1: '瀹℃壒閫氳繃',
- 2: '瀹℃壒澶辫触'
-};
-
-
-const templateName = ref('');
-const filterInputValue = ref('');
-const templateList = ref([]);
-const isTemplateNameDuplicate = ref(false); // 鏍囪妯℃澘鍚嶇О鏄惁閲嶅
-
-// 妫�鏌ユā鏉垮悕绉版槸鍚﹂噸澶�
-const checkTemplateNameDuplicate = (name) => {
- if (!name || name.trim() === '') {
- isTemplateNameDuplicate.value = false;
- return false;
- }
- const isDuplicate = templateList.value.some(item => item.templateName === name.trim());
- isTemplateNameDuplicate.value = isDuplicate;
- return isDuplicate;
-};
-
-// 闃叉姈瀹氭椂鍣�
-let duplicateCheckTimer = null;
-const onTemplateFilterChange = (val) => {
- filterInputValue.value = val ?? '';
- // 娓呴櫎涔嬪墠鐨勫畾鏃跺櫒
- if (duplicateCheckTimer) {
- clearTimeout(duplicateCheckTimer);
- }
- // 瀹炴椂妫�鏌ユā鏉垮悕绉版槸鍚﹂噸澶嶏紙闃叉姈澶勭悊锛岄伩鍏嶉绻佹彁绀猴級
- if (val && val.trim()) {
- duplicateCheckTimer = setTimeout(() => {
- const isDuplicate = checkTemplateNameDuplicate(val);
- if (isDuplicate) {
- ElMessage({
- message: '妯℃澘鍚嶇О宸插瓨鍦紝璇锋洿鎹㈡ā鏉垮悕绉�',
- type: 'warning',
- duration: 2000
- });
- }
- }, 300); // 300ms 闃叉姈
- } else {
- isTemplateNameDuplicate.value = false;
- }
-};
-
-// allow-create 鏃讹紝杈撳叆涓嶅瓨鍦ㄧ殑鍐呭浼氫綔涓� string 鍊艰繑鍥烇紱杩欓噷鍚屾鍥炶緭鍏ユ浠ョ‘淇濇枃瀛椾笉涓�
-const onTemplateChange = async (val) => {
- if (typeof val === 'string') {
- filterInputValue.value = val;
- // 閫夋嫨鎴栬緭鍏ユ椂妫�鏌ラ噸澶�
- checkTemplateNameDuplicate(val);
- }
-
- // 杩囨护鏁版嵁锛屾煡鎵惧尮閰嶇殑妯℃澘
- const matchedTemplate = templateList.value.find(item => item.templateName === val);
-
- if (matchedTemplate?.id) {
- // 濡傛灉鎵惧埌妯℃澘锛屽姞杞芥ā鏉挎暟鎹�
- form.value = {
- ...form.value,
- ...matchedTemplate,
- };
- productData.value = matchedTemplate.productData || [];
- // 鐢熸垚鏂扮殑閲囪喘鍚堝悓鍙�
- try {
- const res = await createPurchaseNo();
- if (res?.data) {
- form.value.purchaseContractNumber = res.data;
- }
- } catch (error) {
- console.error('鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:', error);
- }
- } else {
- // 濡傛灉娌℃湁鎵惧埌妯℃澘锛岄噸缃〃鍗曪紙淇濇寔褰撳墠琛ㄥ崟鐘舵�侊級
- const currentFormData = { ...form.value };
- const currentProductData = [...productData.value];
-
- // 濡傛灉瀵硅瘽妗嗘湭鎵撳紑锛屽厛鎵撳紑
- if (!dialogFormVisible.value) {
- operationType.value = 'add';
- dialogFormVisible.value = true;
- }
-
- // 绛夊緟涓嬩竴涓� tick 鍚庢仮澶嶆暟鎹�
- await nextTick();
- form.value = {
- ...form.value,
- ...currentFormData,
- };
- productData.value = currentProductData;
- }
-};
// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
const operationType = ref("");
@@ -1034,7 +996,7 @@
supplierName: "",
supplierId: "",
paymentMethod: "",
- executionDate: "",
+ executionDate: "",
},
rules: {
purchaseContractNumber: [
@@ -1042,13 +1004,19 @@
],
projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
supplierId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- approverId:[{ required: true, message: "璇烽�夋嫨瀹℃壒浜�", trigger: "change" }],
- executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
},
});
const { form, rules } = toRefs(data);
const { form: searchForm } = useFormData(data.searchForm);
+
+const addApproverNode = () => {
+ approverNodes.value.push({ id: nextApproverId++, userId: null });
+};
+const removeApproverNode = (index) => {
+ approverNodes.value.splice(index, 1);
+};
// 浜у搧琛ㄥ崟寮规鏁版嵁
const productFormVisible = ref(false);
@@ -1068,7 +1036,7 @@
taxInclusiveTotalPrice: "",
taxExclusiveTotalPrice: "",
invoiceType: "",
- warnNum: "",
+ warnNum: "",
},
productRules: {
productId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -1079,7 +1047,7 @@
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
],
taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- warnNum: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
+ warnNum: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
taxInclusiveTotalPrice: [
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
],
@@ -1090,6 +1058,72 @@
},
});
const { productForm, productRules } = toRefs(productFormData);
+
+// 閲囪喘浠锋牸绠$悊鍙傝�冨脊绐�
+const priceReferenceVisible = ref(false);
+const priceReferenceLoading = ref(false);
+const priceReferenceData = ref([]);
+const priceReferenceTotal = ref(0);
+const priceReferencePagination = reactive({
+ current: 1,
+ size: 10
+});
+
+const showPriceReference = () => {
+ priceReferenceVisible.value = true;
+ handlePriceReferenceSearch();
+};
+
+const handlePriceReferenceSearch = () => {
+ priceReferenceLoading.value = true;
+ // 妯℃嫙鎼滅储鍙傛暟锛歱roductId 鏄犲皠涓� productName 鎴� ID锛岃繖閲屾牴鎹� advancedPriceManagement 鐨� API 纭畾鍙傛暟
+ // 鍋囪楂樼骇浠锋牸绠$悊鐨� listPage 鎺ユ敹 productId
+ const query = {
+ productId: productForm.value.productId,
+ specificationId: productForm.value.productModelId,
+ current: priceReferencePagination.current,
+ size: priceReferencePagination.size
+ };
+ listAdvancedPrice(query).then(res => {
+ priceReferenceData.value = res.data.records;
+ priceReferenceTotal.value = res.data.total;
+ priceReferenceLoading.value = false;
+ }).catch(() => {
+ priceReferenceLoading.value = false;
+ });
+};
+
+const handlePriceReferenceSizeChange = (size) => {
+ priceReferencePagination.size = size;
+ handlePriceReferenceSearch();
+};
+
+const handlePriceReferenceCurrentChange = (page) => {
+ priceReferencePagination.current = page;
+ handlePriceReferenceSearch();
+};
+
+const selectPriceReference = (row) => {
+ // 璁$畻瀹為檯浠锋牸锛氬熀纭�浠锋牸 - 鎶樻墸
+ let actualPrice = row.basePrice;
+ if (row.discountType === 'percentage') {
+ actualPrice = row.basePrice * (1 - row.discountValue / 100);
+ } else if (row.discountType === 'fixed') {
+ actualPrice = row.basePrice - row.discountValue;
+ }
+
+ // 濉厖鍚◣鍗曚环锛屼繚鐣欎袱浣嶅皬鏁�
+ productForm.value.taxInclusiveUnitPrice = Number(Math.max(actualPrice, 0)).toFixed(2);
+
+ // 濡傛灉宸茬粡杈撳叆浜嗘暟閲忥紝鍒欒嚜鍔ㄨ绠楁�讳环
+ if (productForm.value.quantity) {
+ mathNum();
+ }
+
+ priceReferenceVisible.value = false;
+ proxy.$modal.msgSuccess("宸插紩鐢ㄥ巻鍙蹭环鏍�");
+ };
+
const upload = reactive({
// 涓婁紶鐨勫湴鍧�
url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
@@ -1109,14 +1143,7 @@
};
const formattedNumber = (row, column, cellValue) => {
- if (cellValue === null || cellValue === undefined || cellValue === '') {
- return '0.00';
- }
- const num = parseFloat(cellValue);
- if (isNaN(num)) {
- return '0.00';
- }
- return num.toFixed(2);
+ return parseFloat(cellValue).toFixed(2);
};
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -1124,100 +1151,23 @@
page.current = 1;
getList();
};
-
-// 淇濆瓨妯℃澘
-const handleButtonClick = async () => {
- // 妫�鏌ユā鏉垮悕绉版槸鍚︿负绌�
- if (!templateName.value || templateName.value.trim() === '') {
- ElMessage({
- message: '璇疯緭鍏ユā鏉垮悕绉�',
- type: 'warning',
- });
- return;
- }
-
- // 妫�鏌ユā鏉垮悕绉版槸鍚﹂噸澶�
- const isDuplicate = checkTemplateNameDuplicate(templateName.value);
- if (isDuplicate) {
- ElMessage({
- message: '妯℃澘鍚嶇О宸插瓨鍦紝璇锋洿鎹㈡ā鏉垮悕绉�',
- type: 'warning',
- });
- return;
- }
-
- // 妫�鏌ヤ緵搴斿晢鏄惁閫夋嫨
- if (!form.value.supplierId) {
- ElMessage({
- message: '璇峰厛閫夋嫨渚涘簲鍟�',
- type: 'warning',
- });
- return;
- }
-
- // 妫�鏌ユ槸鍚︽湁浜у搧鏁版嵁
- // if (!productData.value || productData.value.length === 0) {
- // ElMessage({
- // message: '璇峰厛娣诲姞浜у搧淇℃伅',
- // type: 'warning',
- // });
- // return;
- // }
-
- try {
- let params = {
- productData: proxy.HaveJson(productData.value),
- supplierId: form.value.supplierId,
- paymentMethod: form.value.paymentMethod,
- recorderId: form.value.recorderId,
- approverId: form.value.approverId,
- templateName: templateName.value.trim()
- };
- console.log(params);
- let res = await addPurchaseTemplate(params);
-
- if (res && res.code === 200) {
- ElMessage({
- message: '妯℃澘淇濆瓨鎴愬姛',
- type: 'success',
- });
- // 淇濆瓨鎴愬姛鍚庨噸鏂拌幏鍙栨ā鏉垮垪琛�
- await getTemplateList();
- // 娓呯┖妯℃澘鍚嶇О杈撳叆
- templateName.value = '';
- filterInputValue.value = '';
- isTemplateNameDuplicate.value = false;
- } else {
- ElMessage({
- message: res?.msg || '妯℃澘淇濆瓨澶辫触',
- type: 'error',
- });
- }
- } catch (error) {
- console.error('淇濆瓨妯℃澘澶辫触:', error);
- ElMessage({
- message: '妯℃澘淇濆瓨澶辫触锛岃绋嶅悗閲嶈瘯',
- type: 'error',
- });
- }
-};
// 瀛愯〃鍚堣鏂规硶
const summarizeChildrenTable = (param) => {
return proxy.summarizeTable(
- param,
- [
- "taxInclusiveUnitPrice",
- "taxInclusiveTotalPrice",
- "taxExclusiveTotalPrice",
- "ticketsNum",
- "ticketsAmount",
- "futureTickets",
- "futureTicketsAmount",
- ],
- {
- ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
- futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
- }
+ param,
+ [
+ "taxInclusiveUnitPrice",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ "ticketsNum",
+ "ticketsAmount",
+ "futureTickets",
+ "futureTicketsAmount",
+ ],
+ {
+ ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ }
);
};
const paginationChange = (obj) => {
@@ -1229,24 +1179,18 @@
tableLoading.value = true;
const { entryDate, ...rest } = searchForm;
purchaseListPage({ ...rest, ...page })
- .then((res) => {
- tableLoading.value = false;
- // tableData.value = res.data.records;
- // 澶勭悊鏁版嵁锛屾坊鍔犲け鏁堢姸鎬佹爣璁�
- tableData.value = res.data.records.map(record => ({
- ...record,
- isInvalid: record.isWhite === 1
- }));
- // 鍒濆鍖栧瓙鏁版嵁鏁扮粍
- tableData.value.forEach((item) => {
- item.children = [];
- });
- total.value = res.data.total;
- expandedRowKeys.value = [];
- })
- .catch(() => {
- tableLoading.value = false;
+ .then((res) => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ tableData.value.map((item) => {
+ item.children = [];
});
+ total.value = res.data.total;
+ expandedRowKeys.value = [];
+ })
+ .catch(() => {
+ tableLoading.value = false;
+ });
};
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = (selection) => {
@@ -1257,24 +1201,19 @@
};
const expandedRowKeys = ref([]);
// 灞曞紑琛�
-const expandChange = async (row, expandedRows) => {
+const expandChange = (row, expandedRows) => {
if (expandedRows.length > 0) {
expandedRowKeys.value = [];
try {
- const res = await productList({ salesLedgerId: row.id, type: 2 });
- const index = tableData.value.findIndex((item) => item.id === row.id);
- if (index > -1) {
- tableData.value[index].children = res.data || [];
+ productList({ salesLedgerId: row.id, type: 2 }).then((res) => {
+ const index = tableData.value.findIndex((item) => item.id === row.id);
+ if (index > -1) {
+ tableData.value[index].children = res.data;
+ }
expandedRowKeys.value.push(row.id);
- }
+ });
} catch (error) {
- console.error('鍔犺浇浜у搧鍒楄〃澶辫触:', error);
- proxy.$modal.msgError('鍔犺浇浜у搧鍒楄〃澶辫触');
- // 灞曞紑澶辫触鏃讹紝绉婚櫎灞曞紑鐘舵��
- const index = expandedRows.findIndex(item => item.id === row.id);
- if (index > -1) {
- expandedRows.splice(index, 1);
- }
+ console.log(error);
}
} else {
expandedRowKeys.value = [];
@@ -1293,63 +1232,53 @@
]);
};
// 鎵撳紑寮规
-const openForm = async (type, row) => {
- await getTemplateList()
+const openForm = (type, row) => {
operationType.value = type;
form.value = {};
productData.value = [];
fileList.value = [];
- templateName.value = '';
- filterInputValue.value = '';
- isTemplateNameDuplicate.value = false;
- try {
- // 骞惰鍔犺浇鍩虹鏁版嵁
- const [userRes, salesRes, supplierRes] = await Promise.all([
- userListNoPage(),
- getSalesNo(),
- getOptions()
- ]);
-
- userList.value = userRes.data || [];
- salesContractList.value = salesRes || [];
- // 渚涘簲鍟嗚繃婊ゅ嚭isWhite=0 鐨勬暟鎹�
- supplierList.value = (supplierRes.data || []).filter((item) => item.isWhite === 0);
-
- // 璁剧疆榛樿鍊�
- form.value.recorderId = userStore.id;
- 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) {
- // 缂栬緫鏃跺姞杞芥暟鎹�
- currentId.value = row.id;
- try {
- const purchaseRes = await getPurchaseById({ id: row.id, type: 2 });
- form.value = { ...purchaseRes };
- productData.value = purchaseRes.productData || [];
- fileList.value = purchaseRes.salesLedgerFiles || [];
- } catch (error) {
- console.error('鍔犺浇閲囪喘鍙拌处鏁版嵁澶辫触:', error);
- proxy.$modal.msgError('鍔犺浇鏁版嵁澶辫触');
- return;
- }
- }
-
- dialogFormVisible.value = true;
- } catch (error) {
- console.error('鎵撳紑琛ㄥ崟澶辫触:', error);
- proxy.$modal.msgError('鍔犺浇鍩虹鏁版嵁澶辫触');
+ approverNodes.value = [{ id: 1, userId: null }];
+ nextApproverId = 2;
+ if (operationType.value == "add") {
+ createPurchaseNo().then((res) => {
+ form.value.purchaseContractNumber = res.data;
+ });
}
+ userListNoPage().then((res) => {
+ userList.value = res.data;
+ });
+ getSalesNo().then((res) => {
+ salesContractList.value = res;
+ });
+ getOptions().then((res) => {
+ supplierList.value = res.data;
+ });
+ form.value.recorderId = userStore.id;
+ form.value.entryDate = getCurrentDate();
+ if (type === "edit") {
+ currentId.value = row.id;
+ getPurchaseById({ id: row.id, type: 2 }).then((res) => {
+ form.value = { ...res };
+ productData.value = form.value.productData;
+ const approveUserIds = form.value.approveUserIds || form.value.approverIds;
+ if (approveUserIds) {
+ const ids = String(approveUserIds)
+ .split(",")
+ .map((id) => Number(id.trim()))
+ .filter((id) => !Number.isNaN(id));
+ if (ids.length > 0) {
+ approverNodes.value = ids.map((id, idx) => ({ id: idx + 1, userId: id }));
+ nextApproverId = ids.length + 1;
+ }
+ }
+ if (form.value.salesLedgerFiles) {
+ fileList.value = form.value.salesLedgerFiles;
+ } else {
+ fileList.value = [];
+ }
+ });
+ }
+ dialogFormVisible.value = true;
};
// 涓婁紶鍓嶆牎妫�
function handleBeforeUpload(file) {
@@ -1378,57 +1307,49 @@
}
}
// 绉婚櫎鏂囦欢
-async function handleRemove(file) {
- if (!file?.id) {
- return;
- }
-
+function handleRemove(file) {
+ console.log("handleRemove", file.id);
if (file.size > 1024 * 1024 * 10) {
// 浠呭墠绔竻鐞嗭紝涓嶈皟鐢ㄥ垹闄ゆ帴鍙e拰鎻愮ず
return;
}
-
- if (operationType.value === "edit" && file.id) {
- try {
- await delLedgerFile([file.id]);
+ if (operationType.value === "edit") {
+ let ids = [];
+ ids.push(file.id);
+ delLedgerFile(ids).then((res) => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- } catch (error) {
- console.error('鍒犻櫎鏂囦欢澶辫触:', error);
- proxy.$modal.msgError("鍒犻櫎鏂囦欢澶辫触");
- }
+ });
}
}
// 鎻愪氦琛ㄥ崟
-const submitForm = async () => {
- try {
- const valid = await proxy.$refs["formRef"].validate().catch(() => false);
- if (!valid) {
- return;
+const submitForm = () => {
+ proxy.$refs["formRef"].validate((valid) => {
+ if (valid) {
+ const hasEmptyApprover = approverNodes.value.some((node) => !node.userId);
+ if (hasEmptyApprover) {
+ proxy.$modal.msgWarning("璇蜂负鎵�鏈夊鎵硅妭鐐归�夋嫨瀹℃壒浜�");
+ return;
+ }
+ form.value.approveUserIds = approverNodes.value.map((node) => node.userId).join(",");
+ if (productData.value.length > 0) {
+ form.value.productData = proxy.HaveJson(productData.value);
+ } else {
+ proxy.$modal.msgWarning("璇锋坊鍔犱骇鍝佷俊鎭�");
+ return;
+ }
+ let tempFileIds = [];
+ if (fileList.value.length > 0) {
+ tempFileIds = fileList.value.map((item) => item.tempId);
+ }
+ form.value.tempFileIds = tempFileIds;
+ form.value.type = 2;
+ addOrEditPurchase(form.value).then((res) => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
}
-
- if (!productData.value || productData.value.length === 0) {
- proxy.$modal.msgWarning("璇锋坊鍔犱骇鍝佷俊鎭�");
- return;
- }
-
- form.value.productData = proxy.HaveJson(productData.value);
- form.value.tempFileIds = fileList.value
- .filter(item => item.tempId)
- .map((item) => item.tempId);
- form.value.type = 2;
-
- try {
- await addOrEditPurchase(form.value);
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- getList();
- } catch (error) {
- console.error('鎻愪氦琛ㄥ崟澶辫触:', error);
- proxy.$modal.msgError("鎻愪氦澶辫触锛岃绋嶅悗閲嶈瘯");
- }
- } catch (error) {
- console.error('琛ㄥ崟楠岃瘉澶辫触:', error);
- }
+ });
};
// 鍏抽棴寮规
const closeDia = () => {
@@ -1437,6 +1358,10 @@
};
// 鎵撳紑浜у搧寮规
const openProductForm = (type, row, index) => {
+ if(!form.value.supplierId){
+ proxy.$modal.msgWarning("璇烽�夋嫨渚涘簲鍟�");
+ return;
+ }
productOperationType.value = type;
productOperationIndex.value = index;
productForm.value = {};
@@ -1447,26 +1372,17 @@
productFormVisible.value = true;
getProductOptions();
};
-const getProductOptions = async () => {
- try {
- const res = await productTreeList();
+const getProductOptions = () => {
+ productTreeList().then((res) => {
productOptions.value = convertIdToValue(res);
- } catch (error) {
- console.error('鍔犺浇浜у搧閫夐」澶辫触:', error);
- proxy.$modal.msgError('鍔犺浇浜у搧閫夐」澶辫触');
- }
+ });
};
-const getModels = async (value) => {
+const getModels = (value) => {
if (value) {
productForm.value.productCategory = findNodeById(productOptions.value, value) || "";
- try {
- const res = await modelList({ id: value });
- modelOptions.value = res || [];
- } catch (error) {
- console.error('鍔犺浇瑙勬牸鍨嬪彿澶辫触:', error);
- proxy.$modal.msgError('鍔犺浇瑙勬牸鍨嬪彿澶辫触');
- modelOptions.value = [];
- }
+ modelList({ id: value }).then((res) => {
+ modelOptions.value = res;
+ });
} else {
productForm.value.productCategory = "";
modelOptions.value = [];
@@ -1511,103 +1427,75 @@
});
}
// 鎻愪氦浜у搧琛ㄥ崟
-const submitProduct = async () => {
- try {
- const valid = await proxy.$refs["productFormRef"].validate().catch(() => false);
- if (!valid) {
- return;
- }
-
- if (operationType.value === "edit") {
- await submitProductEdit();
- } else {
- if (productOperationType.value === "add") {
- productData.value.push({ ...productForm.value });
+const submitProduct = () => {
+ proxy.$refs["productFormRef"].validate((valid) => {
+ if (valid) {
+ if (operationType.value === "edit") {
+ submitProductEdit();
} else {
- productData.value[productOperationIndex.value] = {
- ...productForm.value,
- };
+ if (productOperationType.value === "add") {
+ productData.value.push({ ...productForm.value });
+ console.log("productData.value---", productData.value);
+ } else {
+ productData.value[productOperationIndex.value] = {
+ ...productForm.value,
+ };
+ }
+ closeProductDia();
}
- closeProductDia();
}
- } catch (error) {
- console.error('鎻愪氦浜у搧琛ㄥ崟澶辫触:', error);
- }
+ });
};
-
-const submitProductEdit = async () => {
- try {
- productForm.value.salesLedgerId = currentId.value;
- productForm.value.type = 2;
- await addOrUpdateSalesLedgerProduct(productForm.value);
+const submitProductEdit = () => {
+ productForm.value.salesLedgerId = currentId.value;
+ productForm.value.type = 2;
+ addOrUpdateSalesLedgerProduct(productForm.value).then((res) => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeProductDia();
-
- // 閲嶆柊鍔犺浇浜у搧鏁版嵁
- try {
- const res = await getPurchaseById({ id: currentId.value, type: 2 });
- productData.value = res.productData || [];
- } catch (error) {
- console.error('閲嶆柊鍔犺浇浜у搧鏁版嵁澶辫触:', error);
- }
- } catch (error) {
- console.error('鎻愪氦浜у搧缂栬緫澶辫触:', error);
- proxy.$modal.msgError("鎻愪氦澶辫触锛岃绋嶅悗閲嶈瘯");
- }
+ getPurchaseById({ id: currentId.value, type: 2 }).then((res) => {
+ productData.value = res.productData;
+ });
+ });
};
// 鍒犻櫎浜у搧
-const deleteProduct = async () => {
+const deleteProduct = () => {
if (productSelectedRows.value.length === 0) {
proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
return;
}
-
if (operationType.value === "add") {
- // 鏂板妯″紡涓嬶紝鐩存帴浠庡墠绔暟鎹腑鍒犻櫎
productSelectedRows.value.forEach((selectedRow) => {
const index = productData.value.findIndex(
- (product) => product.id === selectedRow.id
+ (product) => product.id === selectedRow.id
);
if (index !== -1) {
productData.value.splice(index, 1);
}
});
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
} else {
- // 缂栬緫妯″紡涓嬶紝闇�瑕佽皟鐢ㄦ帴鍙e垹闄�
- const ids = productSelectedRows.value
- .filter(item => item.id)
- .map((item) => item.id);
-
- if (ids.length === 0) {
- proxy.$modal.msgWarning("璇烽�夋嫨鏈夋晥鐨勬暟鎹�");
- return;
+ let ids = [];
+ if (productSelectedRows.value.length > 0) {
+ ids = productSelectedRows.value.map((item) => item.id);
}
-
- try {
- await ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎纭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ delProduct(ids).then((res) => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ closeProductDia();
+ getSalesLedgerWithProducts({ id: currentId.value, type: 2 }).then(
+ (res) => {
+ productData.value = res.productData;
+ }
+ );
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
});
-
- await delProduct(ids);
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- closeProductDia();
-
- // 閲嶆柊鍔犺浇浜у搧鏁版嵁
- try {
- const res = await getSalesLedgerWithProducts({ id: currentId.value, type: 2 });
- productData.value = res.productData || [];
- } catch (error) {
- console.error('閲嶆柊鍔犺浇浜у搧鏁版嵁澶辫触:', error);
- }
- } catch (error) {
- if (error !== 'cancel') {
- console.error('鍒犻櫎浜у搧澶辫触:', error);
- proxy.$modal.msgError("鍒犻櫎澶辫触锛岃绋嶅悗閲嶈瘯");
- }
- }
}
};
// 鍏抽棴浜у搧寮规
@@ -1616,71 +1504,62 @@
productFormVisible.value = false;
};
// 瀵煎嚭
-const handleOut = async () => {
- try {
- await ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭纭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
+const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/purchase/ledger/export", {}, "閲囪喘鍙拌处.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
});
- proxy.download("/purchase/ledger/export", {}, "閲囪喘鍙拌处.xlsx");
- } catch (error) {
- if (error !== 'cancel') {
- console.error('瀵煎嚭澶辫触:', error);
- proxy.$modal.msgError("瀵煎嚭澶辫触锛岃绋嶅悗閲嶈瘯");
- }
- }
};
-
// 鍒犻櫎
-const handleDelete = async () => {
- if (selectedRows.value.length === 0) {
+const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
+ const unauthorizedData = selectedRows.value.filter(item => item.recorderName !== userStore.nickName);
+ if (unauthorizedData.length > 0) {
+ proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
+ return;
+ }
+ ids = selectedRows.value.map((item) => item.id);
+ } else {
proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
return;
}
-
- // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
- const unauthorizedData = selectedRows.value.filter(item => item.recorderName !== userStore.nickName);
- if (unauthorizedData.length > 0) {
- proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
- return;
- }
-
- const ids = selectedRows.value
- .filter(item => item.id)
- .map((item) => item.id);
-
- if (ids.length === 0) {
- proxy.$modal.msgWarning("璇烽�夋嫨鏈夋晥鐨勬暟鎹�");
- return;
- }
-
- try {
- await ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎纭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ delPurchase(ids).then((res) => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
});
-
- await delPurchase(ids);
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
- } catch (error) {
- if (error !== 'cancel') {
- console.error('鍒犻櫎澶辫触:', error);
- proxy.$modal.msgError("鍒犻櫎澶辫触锛岃绋嶅悗閲嶈瘯");
- }
- }
};
// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
function getCurrentDate() {
- return dayjs().format("YYYY-MM-DD");
+ const today = new Date();
+ const year = today.getFullYear();
+ const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
+ const day = String(today.getDate()).padStart(2, "0");
+ return `${year}-${month}-${day}`;
}
const mathNum = () => {
- if (!productForm.value.taxRate) {
- proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
- return;
- }
+ if (!productForm.value.taxRate) {
+ proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+ return;
+ }
if (!productForm.value.taxInclusiveUnitPrice) {
return;
}
@@ -1689,59 +1568,61 @@
}
// 鍚◣鎬讳环璁$畻
productForm.value.taxInclusiveTotalPrice =
- proxy.calculateTaxIncludeTotalPrice(
- productForm.value.taxInclusiveUnitPrice,
- productForm.value.quantity
- );
+ proxy.calculateTaxIncludeTotalPrice(
+ productForm.value.taxInclusiveUnitPrice,
+ productForm.value.quantity
+ );
if (productForm.value.taxRate) {
// 涓嶅惈绋庢�讳环璁$畻
productForm.value.taxExclusiveTotalPrice =
- proxy.calculateTaxExclusiveTotalPrice(
- productForm.value.taxInclusiveTotalPrice,
- productForm.value.taxRate
- );
+ proxy.calculateTaxExclusiveTotalPrice(
+ productForm.value.taxInclusiveTotalPrice,
+ productForm.value.taxRate
+ );
}
};
const reverseMathNum = (field) => {
- if (!productForm.value.taxRate) {
- proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
- return;
- }
+ if (!productForm.value.taxRate) {
+ proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+ return;
+ }
const taxRate = Number(productForm.value.taxRate);
if (!taxRate) return;
if (field === 'taxInclusiveTotalPrice') {
// 宸茬煡鍚◣鎬讳环鍜屾暟閲忥紝鍙嶇畻鍚◣鍗曚环
if (productForm.value.quantity) {
productForm.value.taxInclusiveUnitPrice =
- (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
+ (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
}
// 宸茬煡鍚◣鎬讳环鍜屽惈绋庡崟浠凤紝鍙嶇畻鏁伴噺
else if (productForm.value.taxInclusiveUnitPrice) {
productForm.value.quantity =
- (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
+ (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
}
// 鍙嶇畻涓嶅惈绋庢�讳环
productForm.value.taxExclusiveTotalPrice =
- (Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRate / 100)).toFixed(2);
+ (Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRate / 100)).toFixed(2);
} else if (field === 'taxExclusiveTotalPrice') {
// 鍙嶇畻鍚◣鎬讳环
productForm.value.taxInclusiveTotalPrice =
- (Number(productForm.value.taxExclusiveTotalPrice) * (1 + taxRate / 100)).toFixed(2);
+ (Number(productForm.value.taxExclusiveTotalPrice) * (1 + taxRate / 100)).toFixed(2);
// 宸茬煡鏁伴噺锛屽弽绠楀惈绋庡崟浠�
if (productForm.value.quantity) {
productForm.value.taxInclusiveUnitPrice =
- (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
+ (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
}
// 宸茬煡鍚◣鍗曚环锛屽弽绠楁暟閲�
else if (productForm.value.taxInclusiveUnitPrice) {
productForm.value.quantity =
- (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
+ (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
}
}
};
// 閿�鍞悎鍚岄�夋嫨鏀瑰彉鏂规硶
const salesLedgerChange = async (row) => {
- const index = salesContractList.value.findIndex((item) => item.id === row);
+ console.log("row", row);
+ var index = salesContractList.value.findIndex((item) => item.id == row);
+ console.log("index", index);
if (index > -1) {
form.value.projectName = salesContractList.value[index].projectName;
await querygProductInfoByContractNo();
@@ -1789,18 +1670,13 @@
return;
}
- try {
- const a = document.createElement('a');
- a.href = qrCodeUrl.value;
- a.download = `閲囪喘鍚堝悓鍙蜂簩缁寸爜_${dayjs().format('YYYYMMDDHHmmss')}.png`;
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a);
- proxy.$modal.msgSuccess("涓嬭浇鎴愬姛");
- } catch (error) {
- console.error('涓嬭浇浜岀淮鐮佸け璐�:', error);
- proxy.$modal.msgError("涓嬭浇澶辫触锛岃绋嶅悗閲嶈瘯");
- }
+ const a = document.createElement('a');
+ a.href = qrCodeUrl.value;
+ a.download = `閲囪喘鍚堝悓鍙蜂簩缁寸爜_${new Date().getTime()}.png`;
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ proxy.$modal.msgSuccess("涓嬭浇鎴愬姛");
};
// 鎵爜鏂板瀵硅瘽妗嗙浉鍏冲彉閲�
@@ -1873,35 +1749,30 @@
};
// 鎻愪氦鎵爜鏂板
-const submitScanAdd = async () => {
- try {
- const valid = await proxy.$refs["scanAddFormRef"].validate().catch(() => false);
- if (!valid) {
- return;
- }
-
- // 鏋勫缓鏂板鏁版嵁
- const newData = {
- purchaseContractNumber: scanAddForm.purchaseContractNumber,
- supplierName: scanAddForm.supplierName,
- projectName: scanAddForm.projectName,
- contractAmount: scanAddForm.contractAmount,
- paymentMethod: scanAddForm.paymentMethod,
- recorderName: scanAddForm.recorderName,
- entryDate: getCurrentDate(),
- remark: scanAddForm.scanRemark,
- type: 2
- };
+const submitScanAdd = () => {
+ proxy.$refs["scanAddFormRef"].validate((valid) => {
+ if (valid) {
+ // 鏋勫缓鏂板鏁版嵁
+ const newData = {
+ purchaseContractNumber: scanAddForm.purchaseContractNumber,
+ supplierName: scanAddForm.supplierName,
+ projectName: scanAddForm.projectName,
+ contractAmount: scanAddForm.contractAmount,
+ paymentMethod: scanAddForm.paymentMethod,
+ recorderName: scanAddForm.recorderName,
+ entryDate: getCurrentDate(),
+ remark: scanAddForm.scanRemark,
+ type: 2
+ };
- // await addOrEditPurchase(newData);
-
- proxy.$modal.msgSuccess("鎵爜鏂板鎴愬姛锛�");
- closeScanAddDialog();
- getList(); // 鍒锋柊鍒楄〃
- } catch (error) {
- console.error('鎻愪氦鎵爜鏂板澶辫触:', error);
- proxy.$modal.msgError("鎻愪氦澶辫触锛岃绋嶅悗閲嶈瘯");
- }
+ // 妯℃嫙鏂板鎴愬姛
+ proxy.$modal.msgSuccess("鎵爜鏂板鎴愬姛锛�");
+ closeScanAddDialog();
+
+ // 鍙互閫夋嫨鏄惁鍒锋柊鍒楄〃
+ // getList();
+ }
+ });
};
// 鎵撳紑鎵爜鐧昏瀵硅瘽妗�
@@ -1924,69 +1795,40 @@
};
// 鎻愪氦鎵爜鐧昏
-const submitScan = async () => {
- try {
- const valid = await proxy.$refs["scanFormRef"].validate().catch(() => false);
- if (!valid) {
- return;
+const submitScan = () => {
+ proxy.$refs["scanFormRef"].validate((valid) => {
+ if (valid) {
+ // 娣诲姞鎵爜璁板綍
+ scanRecords.value.push({
+ ...scanForm,
+ id: Date.now(), // 妯℃嫙ID
+ scanTime: getCurrentDateTime(),
+ });
+ scanForm.scanStatus = "宸叉壂鐮�";
+ scanForm.scanRemark = scanForm.scanRemark || "鏃�";
+ proxy.$modal.msgSuccess("鎵爜鐧昏鎴愬姛锛�");
+ closeScanDialog();
}
-
- // 娣诲姞鎵爜璁板綍
- scanRecords.value.push({
- ...scanForm,
- id: Date.now(), // 妯℃嫙ID
- scanTime: getCurrentDateTime(),
- });
- scanForm.scanStatus = "宸叉壂鐮�";
- scanForm.scanRemark = scanForm.scanRemark || "鏃�";
- proxy.$modal.msgSuccess("鎵爜鐧昏鎴愬姛锛�");
- closeScanDialog();
- } catch (error) {
- console.error('鎻愪氦鎵爜鐧昏澶辫触:', error);
- proxy.$modal.msgError("鎻愪氦澶辫触锛岃绋嶅悗閲嶈瘯");
- }
+ });
};
// 鑾峰彇褰撳墠鏃ユ湡鏃堕棿
function getCurrentDateTime() {
- return dayjs().format("YYYY-MM-DD HH:mm:ss");
+ const now = new Date();
+ const year = now.getFullYear();
+ const month = String(now.getMonth() + 1).padStart(2, "0");
+ const day = String(now.getDate()).padStart(2, "0");
+ const hours = String(now.getHours()).padStart(2, "0");
+ const minutes = String(now.getMinutes()).padStart(2, "0");
+ const seconds = String(now.getSeconds()).padStart(2, "0");
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
-// 娣诲姞琛岀被鍚嶆柟娉�
-const tableRowClassName = ({ row }) => {
- return row.isInvalid ? 'invalid-row' : '';
-};
-// 鑾峰彇妯℃澘淇℃伅
-const getTemplateList =async ()=>{
- let res = await getPurchaseTemplateList()
- if(res && res.code===200 && Array.isArray(res.data)){
- templateList.value = res.data
- }
-}
onMounted(() => {
getList();
- getTemplateList();
-
});
</script>
-<style scoped lang="scss">
-.invalid-row {
- opacity: 0.6;
- background-color: #f5f7fa;
-}
-.el-row{
- justify-content: space-between;
- align-items: center
-}
-.no-arrow-select {
- --el-select-suffix-icon-color: transparent; /* 闅愯棌榛樿涓嬫媺绠ご */
-}
-.select-button-group {
- display: flex;
- align-items: center;
-}
-
-</style>
+<style scoped lang="scss"></style>
--
Gitblit v1.9.3