From f87e4eca384ed8c000f0edbdc3584059f6c9c6e2 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 26 五月 2025 16:42:46 +0800
Subject: [PATCH] 1后端url调整
---
src/views/procurementManagement/procurementLedger/index.vue | 94 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 82 insertions(+), 12 deletions(-)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 887f786..b836cde 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -183,18 +183,24 @@
<el-form :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="productCategory">
- <el-select v-model="productForm.productCategory" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
- </el-select>
+ <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%"
+ />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="24">
- <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="specificationModel">
- <el-select v-model="productForm.specificationModel" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
+ <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productModelId">
+ <el-select v-model="productForm.productModelId" placeholder="璇烽�夋嫨" clearable @change="getProductModel">
+ <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
@@ -230,12 +236,12 @@
<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%"/>
+ <el-input-number v-model="productForm.taxInclusiveTotalPrice" :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="taxExclusiveTotalPrice">
- <el-input-number v-model="productForm.taxExclusiveTotalPrice" :precision="2" :step="0.1" clearable style="width: 100%"/>
+ <el-input v-model="productForm.taxExclusiveTotalPrice" disabled/>
</el-form-item>
</el-col>
</el-row>
@@ -282,7 +288,9 @@
const productData = ref([])
const selectedRows = ref([])
const productSelectedRows = ref([])
+const modelOptions = ref([])
const userList = ref([])
+const productOptions = ref([])
const salesContractList = ref([])
const supplierList = ref([])
const tableLoading = ref(false)
@@ -293,6 +301,7 @@
const total = ref(0)
const fileList = ref([])
import useUserStore from "@/store/modules/user"
+import {modelList, productTreeList} from "@/api/basicData/product.js";
const userStore = useUserStore()
@@ -328,7 +337,9 @@
const currentId = ref('')
const productFormData = reactive({
productForm: {
+ productId: '',
productCategory: '',
+ productModelId: '',
specificationModel: '',
unit: '',
quantity: '',
@@ -339,8 +350,8 @@
invoiceType: '',
},
productRules: {
- productCategory: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- specificationModel: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ productId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ productModelId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
taxInclusiveUnitPrice: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -367,6 +378,13 @@
page.current = 1
getList()
}
+// 瀛愯〃鍚堣鏂规硶
+const summarizeChildrenTable = (param) => {
+ return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice', 'ticketsNum', 'ticketsAmount', 'futureTickets', 'futureTicketsAmount'], {
+ ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ });
+};
const paginationChange = ({ current, limit }) => {
page.current = current;
page.size = limit;
@@ -402,7 +420,7 @@
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.rows;
+ tableData.value[index].children = res;
}
expandedRowKeys.value.push(row.id)
})
@@ -528,6 +546,54 @@
productForm.value = {...row}
}
productFormVisible.value = true
+ getProductOptions()
+}
+const getProductOptions = () => {
+ productTreeList().then(res => {
+ productOptions.value = convertIdToValue(res)
+ })
+}
+const getModels =(value) => {
+ productForm.value.productCategory = findNodeById(productOptions.value, value)
+ modelList({id: value}).then(res => {
+ modelOptions.value = res
+ })
+}
+const getProductModel =(value) => {
+ const index = modelOptions.value.findIndex(item => item.id === value);
+ if (index !== -1) {
+ productForm.value.specificationModel = modelOptions.value[index].model;
+ } else {
+ productForm.value.specificationModel = null;
+ }
+}
+const findNodeById = (nodes, productId) => {
+ for (let i = 0; i < nodes.length; i++) {
+ if (nodes[i].value === productId) {
+ return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+ }
+ if (nodes[i].children && nodes[i].children.length > 0) {
+ const foundNode = findNodeById(nodes[i].children, productId);
+ if (foundNode) {
+ return foundNode.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ }
+ }
+ }
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+};
+function convertIdToValue(data) {
+ return data.map(item => {
+ const { id, children, ...rest } = item;
+ const newItem = {
+ ...rest,
+ value: id // 灏� id 鏀逛负 value
+ };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
+ }
+
+ return newItem;
+ });
}
// 鎻愪氦浜у搧琛ㄥ崟
const submitProduct = () => {
@@ -538,6 +604,7 @@
} else {
if (productOperationType.value === 'add') {
productData.value.push({...productForm.value})
+ console.log('productData.value---', productData.value)
} else {
productData.value[productOperationIndex.value] = {...productForm.value}
}
@@ -649,6 +716,9 @@
const day = String(today.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
+const mathNum = (val) => {
+ productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(val, productForm.value.taxRate)
+}
getList()
</script>
--
Gitblit v1.9.3