From d50a93ffd0baa588ad4650b7584b608cdc761990 Mon Sep 17 00:00:00 2001
From: lishenao <3065849776@qq.com>
Date: 星期四, 03 七月 2025 09:45:42 +0800
Subject: [PATCH] 库存管理数据修改
---
src/api/inventoryManagement/stockManage.js | 9
src/views/inventoryManagement/receiptManagement/index.vue | 243 +++++++++++++----------
src/views/inventoryManagement/issueManagement/index.vue | 142 ++++++-------
src/views/inventoryManagement/stockManagement/index.vue | 83 ++++----
src/api/inventoryManagement/stockIn.js | 2
vite.config.js | 2
src/views/inventoryManagement/dispatchLog/index.vue | 94 ++++----
7 files changed, 309 insertions(+), 266 deletions(-)
diff --git a/src/api/inventoryManagement/stockIn.js b/src/api/inventoryManagement/stockIn.js
index d9924d4..90abb03 100644
--- a/src/api/inventoryManagement/stockIn.js
+++ b/src/api/inventoryManagement/stockIn.js
@@ -46,3 +46,5 @@
})
}
+//
+
diff --git a/src/api/inventoryManagement/stockManage.js b/src/api/inventoryManagement/stockManage.js
index 8ce46bb..9909ec7 100644
--- a/src/api/inventoryManagement/stockManage.js
+++ b/src/api/inventoryManagement/stockManage.js
@@ -35,4 +35,13 @@
params: query,
responseType: 'blob'
})
+}
+
+//鍑哄簱鎺ュ彛
+export const stockOut = (data) => {
+ return request({
+ url: '/stockmanagement/stockout',
+ method: 'post',
+ data: data
+ })
}
\ No newline at end of file
diff --git a/src/views/inventoryManagement/dispatchLog/index.vue b/src/views/inventoryManagement/dispatchLog/index.vue
index 7f8313a..aa30f73 100644
--- a/src/views/inventoryManagement/dispatchLog/index.vue
+++ b/src/views/inventoryManagement/dispatchLog/index.vue
@@ -284,24 +284,24 @@
import useUserStore from "@/store/modules/user";
import { userListNoPage } from "@/api/system/user.js";
import {
- ledgerListPage,
- customerList,
- addOrUpdateSalesLedger,
- getSalesLedgerWithProducts,
- delLedger,
-} from "@/api/salesManagement/salesLedger.js";
-import {
- getStockOutPage
+ getStockOutPage,
+ addStockOut,
+ updateStockOut,
+ delStockOut,
+ exportStockOut
} from "@/api/inventoryManagement/stockOut.js";
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
const tableData = ref([]);
-const productData = ref([]);
+// const productData = ref([]);
const selectedRows = ref([]);
const userList = ref([]);
-const customerOption = ref([]);
+// const customerOption = ref([]);
const tableLoading = ref(false);
+const supplierList = ref([])
+const productList = ref([])
+const productModelList = ref([])
const page = reactive({
current: 1,
size: 100,
@@ -314,30 +314,30 @@
const dialogFormVisible = ref(false);
const data = reactive({
searchForm: {
- customerName: "",
+ supplierName: "",
},
form: {
- salesContractNo: "",
- salesman: "",
- customerContractNo: "",
- customerId: "",
- projectName: "",
- entryPerson: "",
- entryDate: "",
- maintenanceTime: "",
- productData: [],
- executionDate: "",
+ supplierId: null,
+ supplierName: '',
+ productId: null,
+ productCategory: '',
+ specificationModel: '',
+ unit: '',
+ inboundTime: '',
+ inboundBatch: '',
+ inboundQuantity: 0,
+ taxInclusiveUnitPrice: 0,
+ taxInclusiveTotalPrice: 0,
+ taxRate: 0,
+ taxExclusiveTotalPrice: 0,
+ userId: null,
+ nickname: ''
},
rules: {
- salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- customerContractNo: [
- { required: true, message: "璇疯緭鍏�", trigger: "blur" },
- ],
- customerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- entryPerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ supplierId: [{ required: true, message: '璇烽�夋嫨渚涘簲鍟�', trigger: 'change' }],
+ productRecordid: [{ required: true, message: '璇烽�夋嫨浜у搧', trigger: 'change' }],
+ inboundTime: [{ required: true, message: '璇烽�夋嫨鍏ュ簱鏃堕棿', trigger: 'change' }],
+ inboundQuantity: [{ required: true, message: '璇疯緭鍏ュ叆搴撴暟閲�', trigger: 'blur' }]
},
});
const { searchForm, form, rules } = toRefs(data);
@@ -368,24 +368,24 @@
tableLoading.value = false;
});
};
-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
-};
+// 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
+// };
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = (selection) => {
// 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter((item) => item.children !== undefined);
+ selectedRows.value = selection.filter((item) => item.id);
console.log("selection", selectedRows.value);
};
const expandedRowKeys = ref([]);
@@ -468,7 +468,7 @@
type: "warning",
})
.then(() => {
- proxy.download("/sales/ledger/export", {}, "鍑哄簱鍙拌处.xlsx");
+ proxy.download("/stockmanagement/export", {}, "鍑哄簱鍙拌处.xlsx");
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
@@ -489,7 +489,7 @@
type: "warning",
})
.then(() => {
- delLedger(ids).then((res) => {
+ delStockOut(ids).then((res) => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
});
diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue
index 7e9039c..2a5bb51 100644
--- a/src/views/inventoryManagement/issueManagement/index.vue
+++ b/src/views/inventoryManagement/issueManagement/index.vue
@@ -22,8 +22,8 @@
<el-table-column label="鍏ュ簱鏃堕棿" prop="inboundTime" width="100" show-overflow-tooltip />
<el-table-column label="鍏ュ簱鎵规" prop="inboundBatch" width="160" show-overflow-tooltip />
<el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="160" show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被" prop="productCategory" width="100" show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="160" show-overflow-tooltip />
+ <el-table-column label="浜у搧澶х被" prop="productName" width="100" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="model" width="160" show-overflow-tooltip />
<el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip />
<el-table-column label="鍏ュ簱鏁伴噺" prop="inboundQuantity" width="90" show-overflow-tooltip />
<el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />
@@ -43,14 +43,14 @@
<el-dialog v-model="dialogFormVisible" :title="'鏂板鍑哄簱'" width="40%" @close="closeDia">
<el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
<el-form-item label="鍑哄簱鏁伴噺锛�" prop="salesContractNo">
- <el-input v-model="form.salesContractNo" placeholder="璇疯緭鍏�" clearable />
+ <el-input v-model="form.inboundQuantity" placeholder="璇疯緭鍏�" clearable />
</el-form-item>
<el-form-item label="鍑哄簱鏃ユ湡锛�" prop="projectName">
- <el-date-picker style="width: 100%" v-model="form.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
+ <el-date-picker style="width: 100%" v-model="form.inboundTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
type="date" placeholder="璇烽�夋嫨" clearable />
</el-form-item>
<el-form-item label="鍑哄簱浜猴細" prop="entryPerson">
- <el-select v-model="form.entryPerson" placeholder="璇烽�夋嫨" clearable>
+ <el-select v-model="form.nickName" placeholder="璇烽�夋嫨" clearable>
<el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
</el-select>
</el-form-item>
@@ -78,12 +78,11 @@
getSalesLedgerWithProducts, delLedger
} from "@/api/salesManagement/salesLedger.js";
import {
- getStockOutPage,
- addStockOut,
- updateStockOut,
- delStockOut,
- exportStockOut
-} from "@/api/inventoryManagement/stockOut.js";
+ getStockManagePage,
+ delStockManage,
+ stockOut
+} from "@/api/inventoryManagement/stockManage.js";
+
const userStore = useUserStore()
const { proxy } = getCurrentInstance()
const tableData = ref([])
@@ -106,25 +105,33 @@
supplierName: '',
},
form: {
- salesContractNo: '',
- salesman: '',
- customerContractNo: '',
- customerId: '',
- projectName: '',
- entryPerson: '',
- entryDate: '',
- maintenanceTime: '',
- productData: [],
- executionDate: ''
+ supplierId: null,
+ productId: null,
+ userId: null,
+ supplierName: '',
+ productName: '',
+ model: '',
+ unit: '',
+ inboundTime: '',
+ inboundBatch: '',
+ inboundQuantity: '',
+ taxInclusiveUnitPrice: '',
+ taxInclusiveTotalPrice: '',
+ taxRate: '',
+ taxExclusiveTotalPrice: '',
+ nickName: '',
},
rules: {
- salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- customerContractNo: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- customerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- entryPerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ supplierName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ productCategory: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ specificationModel: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ inboundTime: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ inboundBatch: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ inboundQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ taxInclusiveUnitPrice: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ taxRate: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ nickname: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
}
})
const { searchForm, form, rules } = toRefs(data)
@@ -142,13 +149,10 @@
}
const getList = () => {
tableLoading.value = true
- getStockOutPage({ ...searchForm.value, ...page }).then(res => {
+ getStockManagePage({ ...searchForm.value, ...page }).then(res => {
tableLoading.value = false
tableData.value = res.data.records
- tableData.value.map(item => {
- item.children = []
- })
- total.value = res.total
+ console.log('res', res.data.records)
}).catch(() => {
tableLoading.value = false
})
@@ -171,7 +175,7 @@
const handleSelectionChange = (selection) => {
// 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter(item => item.children !== undefined);
+ selectedRows.value = selection.filter(item => item.id);
console.log('selection', selectedRows.value)
}
const expandedRowKeys = ref([])
@@ -180,57 +184,47 @@
const summarizeMainTable = (param) => {
return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']);
};
+const currentRowId = ref(null) // 鏂板锛氬瓨鍌ㄥ綋鍓嶆搷浣滅殑琛孖D
// 鎵撳紑寮规
const openForm = async (row) => {
- // form.value = {}
- // productData.value = []
- // let userLists = await userListNoPage()
- // userList.value = userLists.data
- // customerList().then(res => {
- // customerOption.value = res
- // })
- // console.log('userStore.id', userStore.id)
- // form.value.entryPerson = userStore.id
- // if (type === 'edit') {
- // currentId.value = row.id;
- // getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
- // form.value = { ...res }
- // form.value.entryPerson = Number(res.entryPerson)
- // productData.value = form.value.productData
- // fileList.value = form.value.salesLedgerFiles
- // })
- // }
- // let userAll = await userStore.getInfo()
- // userList.value.forEach(element => {
- // if(userAll.user.nickName === element.nickName && userAll.user.userName === element.userName) {
- // form.value.entryPerson = userAll.user.userId // 璁剧疆榛樿涓氬姟鍛樹负褰撳墠鐢ㄦ埛
- // }
- // });
- // form.value.entryDate = getCurrentDate() // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈�
dialogFormVisible.value = true
+ currentRowId.value = row.id
+ form.value = {}
+ // 鍒濆鍖栬〃鍗曟暟鎹�
+ form.value = {
+ inboundQuantity: '', // 鍑哄簱鏁伴噺娓呯┖
+ inboundTime: getCurrentDate(), // 榛樿褰撳墠鏃ユ湡
+ nickName: '', // 榛樿褰撳墠鐢ㄦ埛
+ }
+ console.log('form',form.value)
+
+ // 鍔犺浇鐢ㄦ埛鍒楄〃
+ try {
+ const userLists = await userListNoPage()
+ userList.value = userLists.data
+ } catch (error) {
+ console.error('鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:', error)
+ }
}
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
proxy.$refs["formRef"].validate(valid => {
- if (valid) {
- if (productData.value.length > 0) {
- form.value.productData = proxy.HaveJson(productData.value)
- } else {
- proxy.$modal.msgWarning('璇锋坊鍔犱骇鍝佷俊鎭�')
- return
+ if (valid && currentRowId.value) {
+ const outData = {
+ id: currentRowId.value, // 鍘熷璁板綍ID
+ outQuantity: form.value.inboundQuantity, // 鍑哄簱鏁伴噺
+ outTime: form.value.inboundTime, // 鍑哄簱鏃堕棿
+ userId: form.value.userId // 鎿嶄綔浜�
}
- let tempFileIds = []
- if (fileList.value.length > 0) {
- tempFileIds = fileList.value.map(item => item.tempId)
- }
- form.value.tempFileIds = tempFileIds
- form.value.type = 1
- addOrUpdateSalesLedger(form.value).then(res => {
+
+ stockOut(outData).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛")
closeDia()
getList()
+ }).catch(err => {
+ proxy.$modal.msgError("鍑哄簱澶辫触")
})
}
})
@@ -251,7 +245,7 @@
type: 'warning',
}
).then(() => {
- proxy.download("/sales/ledger/export", {}, '鍏ュ簱鍙拌处.xlsx')
+ proxy.download("/stockmanagement/export", {}, '鍏ュ簱鍙拌处.xlsx')
}).catch(() => {
proxy.$modal.msg("宸插彇娑�")
})
@@ -273,7 +267,7 @@
type: 'warning',
}
).then(() => {
- delLedger(ids).then(res => {
+ delStockManage(ids).then(res => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
getList()
})
diff --git a/src/views/inventoryManagement/receiptManagement/index.vue b/src/views/inventoryManagement/receiptManagement/index.vue
index 07d0139..2691509 100644
--- a/src/views/inventoryManagement/receiptManagement/index.vue
+++ b/src/views/inventoryManagement/receiptManagement/index.vue
@@ -22,8 +22,8 @@
<el-table-column label="鍏ュ簱鏃堕棿" prop="inboundTime" width="100" show-overflow-tooltip />
<el-table-column label="鍏ュ簱鎵规" prop="inboundBatch" width="160" show-overflow-tooltip />
<el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="160" show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被" prop="productCategory" width="100" show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="160" show-overflow-tooltip />
+ <el-table-column label="浜у搧澶х被" prop="productName" width="100" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="model" width="160" show-overflow-tooltip />
<el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip />
<el-table-column label="鍏ュ簱鏁伴噺" prop="inboundQuantity" width="90" show-overflow-tooltip />
<el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />
@@ -45,77 +45,93 @@
<el-form :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="salesContractNo">
- <el-input v-model="form.salesContractNo" placeholder="璇疯緭鍏�" clearable />
+ <el-form-item label="浜у搧鍚嶇О锛�" prop="productId">
+ <el-select v-model="form.productId" placeholder="璇烽�夋嫨" clearable>
+ <el-option v-for="item in productList" :key="item.id" :label="item.productName"
+ :value="item.id" />
+ </el-select>
</el-form-item>
</el-col>
+
<el-col :span="12">
- <el-form-item label="浜у搧澶х被锛�" prop="salesman">
- <el-select v-model="form.salesman" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
- :value="item.nickName" />
+ <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productManageId">
+ <el-select v-model="form.productManageId" placeholder="璇烽�夋嫨" clearable>
+ <el-option v-for="item in productmodelList" :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="customerContractNo">
- <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable />
+ <el-form-item label="渚涘簲鍟嗗悕绉帮細" prop="salesContractNo">
+ <el-select v-model="form.supplierId" placeholder="璇烽�夋嫨" clearable>
+ <el-option v-for="item in supplierLists" :key="item.id" :label="item.supplierName"
+ :value="item.id" />
+ </el-select>
</el-form-item>
</el-col>
<el-col :span="12">
+ <el-form-item label="浜у搧澶х被锛�" prop="salesman">
+ <el-input v-model="form.productCategory" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+
+ <el-col :span="12">
<el-form-item label="鍗曚綅锛�" prop="customerId">
- <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable />
+ <el-input v-model="form.unit" placeholder="璇疯緭鍏�" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="鍏ュ簱鏃堕棿锛�" prop="projectName">
- <el-date-picker style="width: 100%" v-model="form.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
+ <el-date-picker style="width: 100%" v-model="form.inboundTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
type="date" placeholder="璇烽�夋嫨" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="鍏ュ簱鎵规锛�" prop="entryPerson">
- <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable />
+ <el-input v-model="form.inboundBatch" placeholder="璇疯緭鍏�" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="鍏ュ簱鏁伴噺锛�" prop="customerContractNo">
- <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable />
+ <el-input v-model="form.inboundQuantity" placeholder="璇疯緭鍏�" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="鍚◣鍗曚环锛�" prop="customerId">
- <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable />
+ <el-input v-model="form.taxInclusiveUnitPrice" placeholder="璇疯緭鍏�" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="鍚◣鎬讳环锛�" prop="customerContractNo">
- <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable />
+ <el-input v-model="form.taxInclusiveTotalPrice" placeholder="璇疯緭鍏�" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="绋庣巼锛�" prop="customerId">
- <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable />
+ <el-input v-model="form.taxRate" placeholder="璇疯緭鍏�" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="涓嶅惈绋庢�讳环锛�" prop="entryDate">
- <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable />
+ <el-input v-model="form.taxExclusiveTotalPrice" placeholder="璇疯緭鍏�" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="鍏ュ簱浜猴細" prop="entryPerson">
- <el-select v-model="form.entryPerson" placeholder="璇烽�夋嫨" clearable>
+ <el-select v-model="form.nickname" placeholder="璇烽�夋嫨" clearable>
<el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
</el-select>
</el-form-item>
@@ -139,32 +155,31 @@
import useUserStore from '@/store/modules/user'
import { userListNoPage } from "@/api/system/user.js";
import {
- ledgerListPage,
- customerList,
- addOrUpdateSalesLedger,
- getSalesLedgerWithProducts, delLedger
-} from "@/api/salesManagement/salesLedger.js";
-import {
getStockInPage,
updateStockIn,
addSutockIn,
delStockIn,
exportStockIn
} from "@/api/inventoryManagement/stockIn.js";
+import {listSupplier} from "@/api/basicData/supplierManageFile.js";
+import {modelListPage, productTreeList} from "@/api/basicData/product.js";
const userStore = useUserStore()
const { proxy } = getCurrentInstance()
const tableData = ref([])
-const productData = ref([])
const selectedRows = ref([])
const userList = ref([])
-const customerOption = ref([])
+const supplierLists = ref([])
+const productTree = ref([]); // 浜у搧鏍戞暟鎹�
+const modelList = ref([]); // 瑙勬牸鍨嬪彿鍒楄〃
+const currentProductId = ref(null); // 褰撳墠閫変腑鐨勪骇鍝両D
+const loading = ref(false);
const tableLoading = ref(false)
const page = reactive({
current: 1,
size: 100,
})
const total = ref(0)
-const fileList = ref([])
+// const fileList = ref([])
// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
const operationType = ref('')
@@ -174,72 +189,104 @@
supplierName: '',
},
form: {
- salesContractNo: '',
- salesman: '',
- customerContractNo: '',
- customerId: '',
- projectName: '',
- entryPerson: '',
- entryDate: '',
- maintenanceTime: '',
- productData: [],
- executionDate: ''
+ productManageId: null,
+ supplierId: null,
+ productId: null,
+ userId: null,
+ supplierName: '',
+ productName: '',
+ model: '',
+ unit: '',
+ inboundTime: '',
+ inboundBatch: '',
+ inboundQuantity: '',
+ taxInclusiveUnitPrice: '',
+ taxInclusiveTotalPrice: '',
+ taxRate: '',
+ taxExclusiveTotalPrice: '',
+ nickname: ''
},
rules: {
- salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- customerContractNo: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- customerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- entryPerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ supplierName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ productName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ model: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ inboundTime: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ inboundBatch: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ inboundQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ taxInclusiveUnitPrice: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ taxRate: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ nickname: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
}
})
const { searchForm, form, rules } = toRefs(data)
+// 3. 鑾峰彇浜у搧鏍戞柟娉�
+const getProductTree = async () => {
+ try {
+ loading.value = true;
+ const res = await productTreeList();
+ productTree.value = res.data; // 鏍规嵁瀹為檯API杩斿洖缁撴瀯璋冩暣
+ } finally {
+ loading.value = false;
+ }
+};
+// 4. 鑾峰彇瑙勬牸鍨嬪彿鏂规硶
+const getModelList = async (productId) => {
+ try {
+ loading.value = true;
+ const res = await modelListPage({
+ id: productId,
+ current: 1, // 椤电爜
+ size: 10 // 姣忛〉鏉℃暟
+ });
+ modelList.value = res.data.records; // 鏍规嵁瀹為檯API杩斿洖缁撴瀯璋冩暣
+ } finally {
+ loading.value = false;
+ }
+};
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
page.current = 1
getList()
}
+
const paginationChange = (obj) => {
page.current = obj.page;
page.size = obj.limit;
getList()
}
+
const getList = () => {
tableLoading.value = true
getStockInPage({ ...searchForm.value, ...page }).then(res => {
tableLoading.value = false
tableData.value = res.data.records
- tableData.value.map(item => {
- item.children = []
- })
- total.value = res.total
+ ttotal.value = res.data.total
}).catch(() => {
tableLoading.value = false
})
}
-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
+const getProductTreeList = () => {
+ treeLoad.value = true;
+ productTreeList()
+ .then((res) => {
+ list.value = res; // 灏嗚繑鍥炵殑鏁版嵁璧嬬粰list
+ list.value.forEach((a) => {
+ expandedKeys.value.push(a.label); // 榛樿灞曞紑鎵�鏈夎妭鐐�
+ });
+ treeLoad.value = false;
+ })
+ .catch((err) => {
+ treeLoad.value = false;
+ });
};
+
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = (selection) => {
-
// 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter(item => item.children !== undefined);
+ selectedRows.value = selection.filter(item => item.id);
console.log('selection', selectedRows.value)
}
const expandedRowKeys = ref([])
@@ -252,52 +299,40 @@
// 鎵撳紑寮规
const openForm = async (type, row) => {
operationType.value = type
- form.value = {}
- productData.value = []
+ dialogFormVisible.value = true
let userLists = await userListNoPage()
userList.value = userLists.data
- customerList().then(res => {
- customerOption.value = res
- })
- console.log('userStore.id', userStore.id)
- form.value.entryPerson = userStore.id
- if (type === 'edit') {
- currentId.value = row.id;
- getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
- form.value = { ...res }
- form.value.entryPerson = Number(res.entryPerson)
- productData.value = form.value.productData
- fileList.value = form.value.salesLedgerFiles
- })
+ console.log('userList', userList.value)
+
+ let supplierlists = await listSupplier()
+ supplierLists.value = supplierlists.data.records
+ console.log('supplierList', supplierLists.value)
+
+ await getProductTree();
+
+
+
+
+
+
+ if (type === 'add') {
+ // 鏂板鏃堕噸缃〃鍗�
+ form.value = {
+ nickname: userStore.userId // 璁剧疆榛樿鍏ュ簱浜轰负褰撳墠鐢ㄦ埛
+ }
+ } else {
+ // 缂栬緫鏃跺~鍏呰〃鍗曟暟鎹�
+ form.value = { ...row }
}
- // let userAll = await userStore.getInfo()
- // userList.value.forEach(element => {
- // if(userAll.user.nickName === element.nickName && userAll.user.userName === element.userName) {
- // form.value.entryPerson = userAll.user.userId // 璁剧疆榛樿涓氬姟鍛樹负褰撳墠鐢ㄦ埛
- // }
- // });
- form.value.entryDate = getCurrentDate() // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈�
- dialogFormVisible.value = true
-}
+ }
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
- 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 = 1
- addOrUpdateSalesLedger(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛")
+ const apiMethod = operationType.value === 'add' ? addSutockIn : updateStockIn
+ apiMethod(form.value).then(res => {
+ proxy.$modal.msgSuccess(operationType.value === 'add' ? "鏂板鎴愬姛" : "淇敼鎴愬姛")
closeDia()
getList()
})
@@ -320,7 +355,7 @@
type: 'warning',
}
).then(() => {
- proxy.download("/sales/ledger/export", {}, '鍏ュ簱鍙拌处.xlsx')
+ proxy.download("/stockin/export", {}, '鍏ュ簱鍙拌处.xlsx')
}).catch(() => {
proxy.$modal.msg("宸插彇娑�")
})
@@ -342,7 +377,7 @@
type: 'warning',
}
).then(() => {
- delLedger(ids).then(res => {
+ delStockIn(ids).then(res => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
getList()
})
diff --git a/src/views/inventoryManagement/stockManagement/index.vue b/src/views/inventoryManagement/stockManagement/index.vue
index e23fb15..777fe02 100644
--- a/src/views/inventoryManagement/stockManagement/index.vue
+++ b/src/views/inventoryManagement/stockManagement/index.vue
@@ -147,12 +147,6 @@
import useUserStore from '@/store/modules/user'
import { userListNoPage } from "@/api/system/user.js";
import {
- ledgerListPage,
- customerList,
- addOrUpdateSalesLedger,
- getSalesLedgerWithProducts, delLedger
-} from "@/api/salesManagement/salesLedger.js";
-import {
getStockManagePage ,
updateStockManage,
delStockManage,
@@ -164,7 +158,7 @@
const productData = ref([])
const selectedRows = ref([])
const userList = ref([])
-const customerOption = ref([])
+// const customerOption = ref([])
const tableLoading = ref(false)
const page = reactive({
current: 1,
@@ -193,16 +187,24 @@
customerId: '',
boundTime: '',
inboundTime: '',
+ inboundPerson: '',
userId: '',
+ supplierId: '',
+ productId: '',
},
rules: {
- salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- customerContractNo: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- customerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- entryPerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ supplierName: [{ required: true, message: '璇疯緭鍏ヤ緵搴斿晢鍚嶇О', trigger: 'blur' }],
+ productCategory: [{ required: true, message: '璇烽�夋嫨浜у搧澶х被', trigger: 'change' }],
+ specificationModel: [{ required: true, message: '璇疯緭鍏ヨ鏍煎瀷鍙�', trigger: 'blur' }],
+ unit: [{ required: true, message: '璇疯緭鍏ュ崟浣�', trigger: 'blur' }],
+ stockQuantity: [{ required: true, message: '璇疯緭鍏ュ嚭搴撴暟閲�', trigger: 'blur' }],
+ taxInclusiveUnitPrice: [{ required: true, message: '璇疯緭鍏ュ惈绋庡崟浠�', trigger: 'blur' }],
+ taxInclusiveTotalPrice: [{ required: true, message: '璇疯緭鍏ュ惈绋庢�讳环', trigger: 'blur' }],
+ taxRate: [{ required: true, message: '璇疯緭鍏ョ◣鐜�', trigger: 'blur' }],
+ taxExclusiveTotalPrice: [{ required: true, message: '璇疯緭鍏ヤ笉鍚◣鎬讳环', trigger: 'blur' }],
+ boundTime: [{ required: true, message: '璇烽�夋嫨搴撳瓨鏃堕棿', trigger: 'change' }],
+ inboundTime: [{ required: true, message: '璇烽�夋嫨鍑哄簱鏃堕棿', trigger: 'change' }],
+ inboundPerson: [{ required: true, message: '璇烽�夋嫨鍑哄簱浜�', trigger: 'change' }]
}
})
const { searchForm, form, rules } = toRefs(data)
@@ -224,33 +226,34 @@
tableLoading.value = false
tableData.value = res.data.records
console.log('res', res)
- tableData.value.map(item => {
- item.children = []
- })
- total.value = res.total
+ // tableData.value.map(item => {
+ // item.children = []
+ // })
+ // total.value = res.total
}).catch(() => {
tableLoading.value = false
})
}
-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
-};
+
+// 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
+// };
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = (selection) => {
// 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter(item => item.children !== undefined);
+ selectedRows.value = selection.filter(item => item.id);
console.log('selection', selectedRows.value)
}
const expandedRowKeys = ref([])
@@ -267,11 +270,11 @@
productData.value = []
let userLists = await userListNoPage()
userList.value = userLists.data
- customerList().then(res => {
- customerOption.value = res
- })
- console.log('userStore.id', userStore.id)
- form.value.entryPerson = userStore.id
+ // customerList().then(res => {
+ // customerOption.value = res
+ // })
+ // console.log('userStore.id', userStore.id)
+ // form.value.entryPerson = userStore.id
if (type === 'edit') {
currentId.value = row.id;
getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
@@ -331,7 +334,7 @@
type: 'warning',
}
).then(() => {
- proxy.download("/sales/ledger/export", {}, '鍑哄簱鍙拌处.xlsx')
+ proxy.download("/stockmanagement/export", {}, '搴撳瓨淇℃伅.xlsx')
}).catch(() => {
proxy.$modal.msg("宸插彇娑�")
})
@@ -353,7 +356,7 @@
type: 'warning',
}
).then(() => {
- delLedger(ids).then(res => {
+ delStockManage(ids).then(res => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
getList()
})
diff --git a/vite.config.js b/vite.config.js
index 0100f5c..2f9c048 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -8,7 +8,7 @@
const { VITE_APP_ENV } = env;
const baseUrl =
VITE_APP_ENV == "development"
- ? "http://192.168.10.2:7003" // 寮�鍙戠幆澧冨悗绔帴鍙�
+ ? "http://127.0.0.1:7005" // 寮�鍙戠幆澧冨悗绔帴鍙�
: "http://114.132.189.42:7003"; // 鐢熶骇鐜鍚庣鎺ュ彛
return {
--
Gitblit v1.9.3