From d16397e58995f4acbd5e8a715ff9186a59258bd7 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 21 一月 2026 10:03:13 +0800
Subject: [PATCH] 湟水峡 1.仓储物流逻辑修改 2.生产订单组件调整
---
src/assets/styles/index.scss | 1
src/views/inventoryManagement/stockManagement/components/FormDiaPurchase.vue | 147 +++
src/views/inventoryManagement/issueManagement/index.vue | 817 +++++++++++-----
src/api/productionManagement/productionOrder.js | 17
src/views/inventoryManagement/stockWarning/index.vue | 3
src/views/salesManagement/salesLedger/index.vue | 53
src/components/PageHeader/index.vue | 53 +
src/views/productionManagement/productStructure/Detail/index.vue | 2
src/views/login.vue | 21
src/main.js | 3
src/views/productionManagement/productionOrder/index.vue | 222 ++++
src/views/inventoryManagement/stockManagement/index.vue | 950 +++++++++++-------
src/views/salesManagement/salesLedger/fileList.vue | 2
src/views/inventoryManagement/dispatchLog/index.vue | 497 ++++++---
src/views/inventoryManagement/stockManagement/components/FormDiaProduction.vue | 147 +++
15 files changed, 2,029 insertions(+), 906 deletions(-)
diff --git a/src/api/productionManagement/productionOrder.js b/src/api/productionManagement/productionOrder.js
index 9f110a7..eeb1470 100644
--- a/src/api/productionManagement/productionOrder.js
+++ b/src/api/productionManagement/productionOrder.js
@@ -113,4 +113,21 @@
method: "post",
data: data,
});
+}
+// 鎵嬪姩鏂板鐢熶骇璁㈠崟
+export function addProductOrder(data) {
+ return request({
+ url: "/productOrder/add",
+ method: "post",
+ data: data,
+ });
+}
+
+// 鐢熶骇璁㈠崟-鎵归噺鍒犻櫎锛堜紶 id 鏁扮粍锛�
+export function deleteProductOrder(ids) {
+ return request({
+ url: "/productOrder/delete",
+ method: "delete",
+ data: ids,
+ });
}
\ No newline at end of file
diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss
index 13d26ee..86ba8dd 100644
--- a/src/assets/styles/index.scss
+++ b/src/assets/styles/index.scss
@@ -137,7 +137,6 @@
}
.table_list {
height: calc(100vh - 11em);
- margin-top: 20px;
background: #fff;
padding: 18px
}
diff --git a/src/components/PageHeader/index.vue b/src/components/PageHeader/index.vue
new file mode 100644
index 0000000..d8fc6fa
--- /dev/null
+++ b/src/components/PageHeader/index.vue
@@ -0,0 +1,53 @@
+<template>
+ <div class="page-header-wrapper">
+ <el-page-header @back="handleBack" :content="content">
+ <template #icon v-if="$slots.icon">
+ <slot name="icon"></slot>
+ </template>
+ <template #title v-if="$slots.title">
+ <slot name="title"></slot>
+ </template>
+ <template #content v-if="$slots.content">
+ <slot name="content"></slot>
+ </template>
+ <template #extra>
+ <slot name="extra">
+ <slot name="right-button"></slot>
+ </slot>
+ </template>
+ </el-page-header>
+ </div>
+</template>
+
+<script setup>
+import { useRouter } from 'vue-router'
+
+const props = defineProps({
+ content: {
+ type: String,
+ default: ''
+ }
+})
+
+const emit = defineEmits(['back'])
+
+const router = useRouter()
+
+const handleBack = () => {
+ emit('back')
+ // 榛樿杩斿洖鍒颁笂涓�绾�
+ router.back()
+}
+</script>
+
+<style scoped>
+.page-header-wrapper {
+ margin-bottom: 16px;
+}
+
+.page-header-wrapper :deep(.el-page-header__extra) {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+</style>
diff --git a/src/main.js b/src/main.js
index abaac2e..0b3f714 100644
--- a/src/main.js
+++ b/src/main.js
@@ -52,6 +52,8 @@
import DictTag from "@/components/DictTag";
// 琛ㄦ牸缁勪欢
import PIMTable from "@/components/PIMTable/PIMTable.vue";
+// 椤甸潰澶撮儴缁勪欢
+import PageHeader from "@/components/PageHeader/index.vue";
import { getToken } from "@/utils/auth";
import {
@@ -93,6 +95,7 @@
app.component("RightToolbar", RightToolbar);
app.component("Editor", Editor);
app.component("PIMTable", PIMTable);
+app.component("PageHeader", PageHeader);
app.use(router);
app.use(store);
diff --git a/src/views/inventoryManagement/dispatchLog/index.vue b/src/views/inventoryManagement/dispatchLog/index.vue
index b485aa7..12e6fcf 100644
--- a/src/views/inventoryManagement/dispatchLog/index.vue
+++ b/src/views/inventoryManagement/dispatchLog/index.vue
@@ -1,145 +1,196 @@
<template>
<div class="app-container">
- <div class="search_form">
- <div>
- <span class="search_title">渚涘簲鍟嗗悕绉帮細</span>
- <el-input
- v-model="searchForm.supplierName"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- @change="handleQuery"
- clearable
- prefix-icon="Search"
- />
- <span class="search_title ml10">鍑哄簱鏃ユ湡锛�</span>
- <el-date-picker
- v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery"
- />
- <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
- >鎼滅储</el-button
- >
- </div>
- <div>
- <!-- <el-button type="primary" @click="openForm('add')">鏂板</el-button> -->
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
- <el-button type="primary" plain @click="handlePrint">鎵撳嵃</el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table
- :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="(row) => row.id"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)"
- >
- <el-table-column align="center" type="selection" width="55" />
- <el-table-column align="center" label="搴忓彿" type="index" width="60" />
- <el-table-column
- label="鍑哄簱鏃ユ湡"
- prop="createTime"
- min-width="250"
- show-overflow-tooltip
- />
- <el-table-column
- label="渚涘簲鍟嗗悕绉�"
- prop="supplierName"
- width="250"
- show-overflow-tooltip
- />
- <el-table-column
- label="浜у搧澶х被"
- prop="productCategory"
- width="100"
- show-overflow-tooltip
- />
- <el-table-column
- label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
- width="100"
- show-overflow-tooltip
- />
- <el-table-column
- label="鍗曚綅"
- prop="unit"
- width="80"
- show-overflow-tooltip
- />
- <el-table-column
- label="鍑哄簱鏁伴噺"
- prop="inboundNum"
- width="100"
- show-overflow-tooltip
- />
- <el-table-column
- label="鍚◣鍗曚环(鍏�)"
- prop="taxInclusiveUnitPrice"
- width="100"
- show-overflow-tooltip
- />
- <el-table-column
- label="鍚◣鎬讳环(鍏�)"
- prop="taxInclusiveTotalPrice"
- width="100"
- show-overflow-tooltip
- />
- <el-table-column
- label="绋庣巼(%)"
- prop="taxRate"
- width="100"
- show-overflow-tooltip
- />
- <el-table-column
- label="涓嶅惈绋庢�讳环(鍏�)"
- prop="taxExclusiveTotalPrice"
- width="180"
- show-overflow-tooltip
- />
- <el-table-column
- label="鍑哄簱浜�"
- prop="createBy"
- width="80"
- show-overflow-tooltip
- />
- <!-- <el-table-column
- fixed="right"
- label="鎿嶄綔"
- min-width="60"
- align="center"
- >
- <template #default="scope">
- <el-button
- link
- type="primary"
- size="small"
- @click="openForm('edit', 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"
- />
- </div>
-
+ <el-tabs v-model="activeTab" @tab-change="handleTabChange">
+ <el-tab-pane label="鎴愬搧鍑哄簱" name="production">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">鍑哄簱鏃ユ湡锛�</span>
+ <el-date-picker
+ v-model="searchForm.timeStr"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ @change="handleQuery"
+ />
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input
+ v-model="searchForm.productCategory"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable
+ />
+ <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ <el-button type="primary" plain @click="handlePrint">鎵撳嵃</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table
+ :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="(row) => row.id"
+ show-summary
+ style="width: 100%"
+ :summary-method="summarizeMainTable"
+ height="calc(100vh - 18.5em)"
+ >
+ <el-table-column align="center" type="selection" width="55" />
+ <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table-column label="鍑哄簱鏃ユ湡" prop="createTime" width="120" show-overflow-tooltip />
+ <el-table-column label="閿�鍞悎鍚屽彿" prop="salesContractNo" width="180" show-overflow-tooltip />
+ <el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
+ <el-table-column label="鍗曚綅" prop="unit" width="80" show-overflow-tooltip />
+ <el-table-column label="鍑哄簱鏁伴噺" prop="inboundNum" width="100" show-overflow-tooltip />
+ <el-table-column label="鍗曚环(鍏�)" prop="unitPrice" width="150"></el-table-column>
+ <el-table-column label="鎬讳环(鍏�)" prop="totalPrice" width="150"></el-table-column>
+ <el-table-column label="鍑哄簱浜�" prop="createBy" width="80" show-overflow-tooltip />
+ </el-table>
+ <pagination
+ v-show="total > 0"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current"
+ :limit="page.size"
+ @pagination="paginationChange"
+ />
+ </div>
+ </el-tab-pane>
+
+ <el-tab-pane label="鍘熸枡鍑哄簱" name="purchase">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">鍑哄簱鏃ユ湡锛�</span>
+ <el-date-picker
+ v-model="searchForm.timeStr"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ @change="handleQuery"
+ />
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input
+ v-model="searchForm.productCategory"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable
+ />
+ <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ <el-button type="primary" plain @click="handlePrint">鎵撳嵃</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table
+ :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="(row) => row.id"
+ show-summary
+ style="width: 100%"
+ :summary-method="summarizeMainTable"
+ height="calc(100vh - 18.5em)"
+ >
+ <el-table-column align="center" type="selection" width="55" />
+ <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table-column label="鍑哄簱鏃ユ湡" prop="createTime" width="120" show-overflow-tooltip />
+ <el-table-column label="閲囪喘鍚堝悓鍙�" prop="purchaseContractNumber" width="180" show-overflow-tooltip />
+ <el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
+ <el-table-column label="鍗曚綅" prop="unit" width="80" show-overflow-tooltip />
+ <el-table-column label="鍑哄簱鏁伴噺" prop="inboundNum" width="100" show-overflow-tooltip />
+ <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" width="150"></el-table-column>
+ <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" width="150"></el-table-column>
+ <el-table-column label="鍑哄簱浜�" prop="createBy" width="80" show-overflow-tooltip />
+ </el-table>
+ <pagination
+ v-show="total > 0"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current"
+ :limit="page.size"
+ @pagination="paginationChange"
+ />
+ </div>
+ </el-tab-pane>
+
+ <el-tab-pane label="鐢熶骇鍑哄簱" name="semiProduct">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">鍑哄簱鏃ユ湡锛�</span>
+ <el-date-picker
+ v-model="searchForm.timeStr"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ @change="handleQuery"
+ />
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input
+ v-model="searchForm.productCategory"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable
+ />
+ <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ <el-button type="primary" plain @click="handlePrint">鎵撳嵃</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table
+ :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="(row) => row.id"
+ show-summary
+ style="width: 100%"
+ :summary-method="summarizeMainTable"
+ height="calc(100vh - 18.5em)"
+ >
+ <el-table-column align="center" type="selection" width="55" />
+ <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table-column label="鍑哄簱鏃ユ湡" prop="createTime" width="220" show-overflow-tooltip />
+ <el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
+ <el-table-column label="鍗曚綅" prop="unit" width="100" show-overflow-tooltip />
+ <el-table-column label="鍑哄簱鏁伴噺" prop="inboundNum" width="220" show-overflow-tooltip />
+ <el-table-column label="鍑哄簱浜�" prop="createBy" width="220" show-overflow-tooltip />
+ </el-table>
+ <pagination
+ v-show="total > 0"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current"
+ :limit="page.size"
+ @pagination="paginationSemiProductChange"
+ />
+ </div>
+ </el-tab-pane>
+ </el-tabs>
+
<!-- 鎵撳嵃棰勮寮圭獥 -->
<el-dialog
v-model="printPreviewVisible"
@@ -163,10 +214,10 @@
<div v-for="(item, index) in printData" :key="index" class="print-page">
<div class="delivery-note">
<div class="header">
- <div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
+ <div class="company-name">鍐涙嘲浼熶笟锛堝ぉ娲ワ級鏈夐檺鍏徃</div>
<div class="document-title">闆跺敭鍙戣揣鍗�</div>
</div>
-
+
<div class="info-section">
<div class="info-row">
<div>
@@ -174,7 +225,7 @@
<span class="value">{{ formatDate(item.createTime) }}</span>
</div>
<div>
-
+
<span class="label">瀹㈡埛鍚嶇О锛�</span>
<span class="value">{{ item.supplierName || '寮犵埍鏈�' }}</span>
</div>
@@ -184,7 +235,7 @@
<span class="value">{{ item.code }}</span>
</div>
</div>
-
+
<div class="table-section">
<table class="product-table">
<thead>
@@ -219,7 +270,7 @@
</tfoot>
</table>
</div>
-
+
<div class="footer-section">
<div class="footer-row">
<div class="footer-item">
@@ -251,25 +302,29 @@
</div>
</div>
</el-dialog>
-
-
+
+
</div>
</template>
<script setup>
import pagination from "@/components/PIMTable/Pagination.vue";
-import { ref } from "vue";
+import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
import { ElMessageBox } from "element-plus";
import useUserStore from "@/store/modules/user";
-import { getCurrentDate } from "@/utils/index.js";
import {
getStockOutPage,
delStockOut,
+ getStockOutSemiProductPage,
} from "@/api/inventoryManagement/stockOut.js";
+import {
+ getStockInPageByProduct,
+} from "@/api/inventoryManagement/stockIn.js";
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
const tableData = ref([]);
+const activeTab = ref('production');
const selectedRows = ref([]);
const tableLoading = ref(false);
const page = reactive({
@@ -286,7 +341,9 @@
const data = reactive({
searchForm: {
supplierName: "",
- timeStr: "",
+ customerName: "",
+ productCategory:'',
+ timeStr: '',
},
form: {
supplierId: null,
@@ -321,20 +378,71 @@
page.size = obj.limit;
getList();
};
+const paginationSemiProductChange = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+};
const getList = () => {
tableLoading.value = true;
- getStockOutPage({ ...searchForm.value, ...page })
- .then((res) => {
- tableLoading.value = false;
- tableData.value = res.data.records;
- tableData.value.map((item) => {
- item.children = [];
- });
- total.value = res.data.total;
- })
- .catch(() => {
- tableLoading.value = false;
- });
+ const params = { ...page }
+ if (activeTab.value === 'production') {
+ params.customerName = searchForm.value.customerName
+ params.timeStr = searchForm.value.timeStr
+ } else {
+ params.supplierName = searchForm.value.supplierName
+ params.timeStr = searchForm.value.timeStr
+ }
+ params.productCategory = searchForm.value.productCategory
+
+ // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勬帴鍙
+ if (activeTab.value === 'semiProduct') {
+ const apiCall = getStockOutSemiProductPage(params)
+ apiCall
+ .then((res) => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ })
+ }else {
+ const apiCall = activeTab.value === 'production'
+ ? getStockInPageByProduct(params)
+ : getStockOutPage(params)
+
+ apiCall
+ .then((res) => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ tableData.value.map((item) => {
+ item.children = [];
+ // 鍓嶇璁$畻鎬讳环
+ const inboundNum = Number(item.inboundNum) || 0;
+ if (activeTab.value === 'production') {
+ // 鎴愬搧鍑哄簱锛氭�讳环 = unitPrice 脳 inboundNum
+ const unitPrice = Number(item.unitPrice) || 0;
+ item.totalPrice = (unitPrice * inboundNum).toFixed(2);
+ } else {
+ // 鍘熸枡鍑哄簱锛氭�讳环 = taxInclusiveUnitPrice 脳 inboundNum
+ const taxInclusiveUnitPrice = Number(item.taxInclusiveUnitPrice) || 0;
+ item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * inboundNum).toFixed(2);
+ }
+ });
+ total.value = res.data.total;
+ })
+ .catch(() => {
+ tableLoading.value = false;
+ });
+ }
+
+};
+
+const handleTabChange = () => {
+ page.current = 1
+ searchForm.value.supplierName = ''
+ searchForm.value.customerName = ''
+ searchForm.value.timeStr = ''
+ selectedRows.value = []
+ searchForm.value.productCategory = ''
+ getList()
};
// 琛ㄦ牸閫夋嫨鏁版嵁
@@ -362,7 +470,12 @@
type: "warning",
})
.then(() => {
- proxy.download("/stockmanagement/export", {}, "鍑哄簱鍙拌处.xlsx");
+ // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
+ let exportUrl = "/stockmanagement/export"
+ if (activeTab.value === 'production') {
+ exportUrl = "/stockmanagement/exportone"
+ }
+ proxy.download(exportUrl, {}, "鍑哄簱鍙拌处.xlsx");
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
@@ -409,10 +522,10 @@
const executePrint = () => {
console.log('寮�濮嬫墽琛屾墦鍗帮紝鏁版嵁鏉℃暟:', printData.value.length);
console.log('鎵撳嵃鏁版嵁:', printData.value);
-
+
// 鍒涘缓涓�涓柊鐨勬墦鍗扮獥鍙�
const printWindow = window.open('', '_blank', 'width=800,height=600');
-
+
// 鏋勫缓鎵撳嵃鍐呭
let printContent = `
<!DOCTYPE html>
@@ -548,14 +661,14 @@
</head>
<body>
`;
-
+
// 涓烘瘡鏉℃暟鎹敓鎴愭墦鍗伴〉闈�
printData.value.forEach((item, index) => {
printContent += `
<div class="print-page">
<div class="delivery-note">
<div class="header">
- <div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
+ <div class="company-name">鍐涙嘲浼熶笟锛堝ぉ娲ワ級鏈夐檺鍏徃</div>
<div class="document-title">闆跺敭鍙戣揣鍗�</div>
</div>
@@ -641,16 +754,16 @@
</div>
`;
});
-
+
printContent += `
</body>
</html>
`;
-
+
// 鍐欏叆鍐呭鍒版柊绐楀彛
printWindow.document.write(printContent);
printWindow.document.close();
-
+
// 绛夊緟鍐呭鍔犺浇瀹屾垚鍚庢墦鍗�
printWindow.onload = () => {
setTimeout(() => {
@@ -683,6 +796,14 @@
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
};
+// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
+function getCurrentDate() {
+ 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}`;
+}
onMounted(() => {
getList();
});
@@ -702,12 +823,12 @@
padding: 15px;
border-bottom: 1px solid #e4e7ed;
text-align: center;
-
+
.el-button {
margin: 0 10px;
}
}
-
+
.print-preview-content {
padding: 20px;
background-color: #f5f5f5;
@@ -739,13 +860,13 @@
.header {
text-align: center;
margin-bottom: 8px;
-
+
.company-name {
font-size: 18px;
font-weight: bold;
margin-bottom: 4px;
}
-
+
.document-title {
font-size: 16px;
font-weight: bold;
@@ -757,16 +878,16 @@
display: flex;
justify-content: space-between;
align-items: center;
-
+
.info-row {
line-height: 20px;
-
+
.label {
font-weight: bold;
width: 60px;
font-size: 14px;
}
-
+
.value {
margin-right: 20px;
min-width: 80px;
@@ -778,12 +899,12 @@
.table-section {
margin-bottom: 4px;
flex: 1;
-
+
.product-table {
width: 100%;
border-collapse: collapse;
border: 1px solid #000;
-
+
th, td {
border: 1px solid #000;
padding: 6px;
@@ -791,16 +912,16 @@
font-size: 14px;
line-height: 1.4;
}
-
+
th {
font-weight: bold;
}
-
+
.total-label {
text-align: right;
font-weight: bold;
}
-
+
.total-value {
font-weight: bold;
}
@@ -813,22 +934,22 @@
margin-bottom: 3px;
line-height: 20px;
justify-content: space-between;
-
+
.footer-item {
display: flex;
margin-right: 20px;
-
+
.label {
font-weight: bold;
width: 80px;
font-size: 14px;
}
-
+
.value {
min-width: 80px;
font-size: 14px;
}
-
+
&.address-item {
.address-value {
min-width: 200px;
@@ -842,7 +963,7 @@
.app-container {
display: none;
}
-
+
.print-page {
box-shadow: none;
margin: 0;
@@ -856,3 +977,5 @@
}
}
</style>
+
+
diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue
index f5d2ea9..6f82adc 100644
--- a/src/views/inventoryManagement/issueManagement/index.vue
+++ b/src/views/inventoryManagement/issueManagement/index.vue
@@ -1,74 +1,276 @@
<template>
<div class="app-container">
- <div class="search_form">
- <div>
- <span class="search_title">渚涘簲鍟嗗悕绉帮細</span>
- <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="璇疯緭鍏�" @change="handleQuery"
- clearable prefix-icon="Search" />
- <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
- <el-date-picker
- v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery"
- />
- <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
- </div>
- <div>
- <!-- <el-button type="primary" @click="openForm('add')">鏂板鍑哄簱</el-button> -->
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> -->
- </div>
- </div>
- <div class="table_list">
- <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary style="width: 100%"
- :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)">
- <el-table-column align="center" type="selection" width="55" />
- <el-table-column align="center" label="搴忓彿" type="index" width="60" />
- <el-table-column label="鍏ュ簱鏃堕棿" prop="createTime" width="100" show-overflow-tooltip />
- <el-table-column label="鍏ュ簱鎵规" prop="inboundBatches" width="160" show-overflow-tooltip />
- <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被" prop="productCategory" width="100" show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="200" show-overflow-tooltip />
- <el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip />
- <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundNum" width="90" show-overflow-tooltip />
- <el-table-column label="搴撳瓨鏁伴噺" prop="inboundNum0" width="90" show-overflow-tooltip />
- <el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />
- <el-table-column label="鍚◣鎬讳环" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />
- <el-table-column label="绋庣巼(%)" prop="taxRate" width="80" show-overflow-tooltip />
- <el-table-column label="涓嶅惈绋庢�讳环" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip />
- <el-table-column label="鍏ュ簱浜�" prop="createBy" width="80" show-overflow-tooltip />
- <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center">
- <template #default="scope">
- <el-button link type="primary" size="small" @click="openForm(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" />
- </div>
- <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-number :step="0.01" :min="0" style="width: 100%" v-model="form.inboundQuantity" placeholder="璇疯緭鍏�" clearable />
+ <el-tabs v-model="activeTab"
+ @tab-change="handleTabChange">
+ <el-tab-pane label="鎴愬搧鍑哄簱"
+ name="production">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input v-model="searchForm.productCategory"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table :data="tableData"
+ border
+ v-loading="tableLoading"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="row => row.id"
+ show-summary
+ style="width: 100%"
+ :summary-method="summarizeMainTable"
+ height="calc(100vh - 18.5em)">
+ <el-table-column align="center"
+ label="搴忓彿"
+ type="index"
+ width="60" />
+ <el-table-column label="閿�鍞悎鍚屽彿"
+ prop="salesContractNo"
+ width="180"
+ show-overflow-tooltip />
+ <el-table-column label="浜у搧澶х被"
+ prop="productCategory"
+ show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿"
+ prop="specificationModel"
+ show-overflow-tooltip />
+ <el-table-column label="鍗曚綅"
+ prop="unit"
+ width="70"
+ show-overflow-tooltip />
+ <el-table-column label="鍓╀綑搴撳瓨"
+ prop="inboundNum0"
+ width="90"
+ show-overflow-tooltip />
+ <el-table-column fixed="right"
+ label="鎿嶄綔"
+ min-width="60"
+ align="center">
+ <template #default="scope">
+ <el-button :disabled="scope.row.inboundNum0 <= 0"
+ link
+ type="primary"
+ size="small"
+ @click="openForm(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" />
+ </div>
+ </el-tab-pane>
+ <el-tab-pane label="鍘熸枡鍑哄簱"
+ name="purchase">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input v-model="searchForm.productCategory"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="row => row.id"
+ show-summary
+ style="width: 100%"
+ :summary-method="summarizeMainTable"
+ height="calc(100vh - 18.5em)">
+ <el-table-column align="center"
+ type="selection"
+ width="55" />
+ <el-table-column align="center"
+ label="搴忓彿"
+ type="index"
+ width="60" />
+ <el-table-column label="閲囪喘鍚堝悓鍙�"
+ prop="purchaseContractNumber"
+ width="180"
+ show-overflow-tooltip />
+ <el-table-column label="浜у搧澶х被"
+ prop="productCategory"
+ show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿"
+ prop="specificationModel"
+ show-overflow-tooltip />
+ <el-table-column label="鍗曚綅"
+ prop="unit"
+ width="70"
+ show-overflow-tooltip />
+ <el-table-column label="鍓╀綑搴撳瓨"
+ prop="inboundNum0"
+ width="90"
+ show-overflow-tooltip />
+ <el-table-column label="鍚◣鍗曚环(鍏�)"
+ prop="taxInclusiveUnitPrice"
+ width="150"></el-table-column>
+ <el-table-column label="鍚◣鎬讳环(鍏�)"
+ prop="taxInclusiveTotalPrice"
+ width="150"></el-table-column>
+ <el-table-column fixed="right"
+ label="鎿嶄綔"
+ min-width="60"
+ align="center">
+ <template #default="scope">
+ <el-button link
+ :disabled="scope.row.inboundNum0 <= 0"
+ type="primary"
+ size="small"
+ @click="openForm(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" />
+ </div>
+ </el-tab-pane>
+ <el-tab-pane label="鐢熶骇鍑哄簱"
+ name="product">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input v-model="searchForm.productCategory"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="row => row.id"
+ show-summary
+ style="width: 100%"
+ :summary-method="summarizeMainTable"
+ height="calc(100vh - 18.5em)">
+ <el-table-column align="center"
+ type="selection"
+ width="55" />
+ <el-table-column align="center"
+ label="搴忓彿"
+ type="index"
+ width="60" />
+ <el-table-column label="浜у搧澶х被"
+ prop="productCategory"
+ show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿"
+ prop="specificationModel"
+ show-overflow-tooltip />
+ <el-table-column label="鍗曚綅"
+ prop="unit"
+ width="70"
+ show-overflow-tooltip />
+ <el-table-column label="鍓╀綑搴撳瓨"
+ prop="inboundNum0"
+ width="90"
+ show-overflow-tooltip />
+ <el-table-column fixed="right"
+ label="鎿嶄綔"
+ min-width="60"
+ align="center">
+ <template #default="scope">
+ <el-button link
+ :disabled="scope.row.inboundNum0 <= 0"
+ type="primary"
+ size="small"
+ @click="openForm(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" />
+ </div>
+ </el-tab-pane>
+ </el-tabs>
+ <el-dialog v-model="dialogFormVisible"
+ :title="getDialogTitle()"
+ width="40%"
+ @close="closeDia">
+ <el-form :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef">
+ <div>{{getAvailableQuantityText()}}:{{currentRowNum}}</div>
+ <el-form-item :label="getQuantityLabel()"
+ prop="salesContractNo">
+ <el-input-number :step="0.01"
+ :min="0"
+ style="width: 100%"
+ v-model="form.inboundQuantity"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
- <el-form-item label="鍑哄簱鏃ユ湡锛�" prop="projectName">
- <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 :label="getDateLabel()"
+ prop="projectName">
+ <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.nickName" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
+ <el-form-item :label="getPersonLabel()"
+ prop="entryPerson">
+ <el-select v-model="form.nickName"
+ filterable
+ default-first-option
+ :reserve-keyword="false"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId" />
</el-select>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
+ <el-button type="primary"
+ @click="submitForm">纭</el-button>
<el-button @click="closeDia">鍙栨秷</el-button>
</div>
</template>
@@ -77,209 +279,314 @@
</template>
<script setup>
-import pagination from '@/components/PIMTable/Pagination.vue'
-import { ref } from 'vue'
-import { ElMessageBox } from "element-plus";
-import useUserStore from '@/store/modules/user'
-import { userListNoPageByTenantId } from "@/api/system/user.js";
-import {
- getStockInPage
-} from "@/api/inventoryManagement/stockIn.js";
-import {
- getStockManagePage,
+ import pagination from "@/components/PIMTable/Pagination.vue";
+ import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
+ import { ElMessageBox } from "element-plus";
+ import useUserStore from "@/store/modules/user";
+ import { userListNoPageByTenantId } from "@/api/system/user.js";
+ import {
+ getStockInPage,
+ getStockInPageByProduction,
+ getStockInPageByProductProduction,
+ } from "@/api/inventoryManagement/stockIn.js";
+ import {
+ getStockManagePage,
delStockManage,
stockOut,
-} from "@/api/inventoryManagement/stockManage.js";
+ } from "@/api/inventoryManagement/stockManage.js";
-const userStore = useUserStore()
-const { proxy } = getCurrentInstance()
-const tableData = ref([])
-const selectedRows = ref([])
-const userList = ref([])
-const tableLoading = ref(false)
-const page = reactive({
- current: 1,
- size: 100,
-})
-const total = ref(0)
-const fileList = ref([])
+ const userStore = useUserStore();
+ const { proxy } = getCurrentInstance();
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const userList = ref([]);
+ const tableLoading = ref(false);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ });
+ const total = ref(0);
+ const fileList = ref([]);
-// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
-const dialogFormVisible = ref(false)
-const data = reactive({
- searchForm: {
- supplierName: '',
- inboundQuantity:'',
- inboundTime:'',
- nickName: '',
- userId: '',
- timeStr: '',
- },
- form: {
- productrecordId: '',
- },
- rules: {
- inboundTime: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- inboundQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- nickname: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
- }
-})
-const { searchForm, form, rules } = toRefs(data)
+ // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
+ const dialogFormVisible = ref(false);
+ const activeTab = ref("production");
+ const data = reactive({
+ searchForm: {
+ supplierName: "",
+ customerName: "",
+ inboundQuantity: "",
+ inboundTime: "",
+ nickName: "",
+ userId: "",
+ productCategory: "",
+ timeStr: "",
+ },
+ form: {
+ productrecordId: "",
+ },
+ rules: {
+ inboundTime: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ inboundQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ nickname: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ },
+ });
+ const { searchForm, form, rules } = toRefs(data);
-// 鏌ヨ鍒楄〃
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-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
- total.value = res.data.total
- console.log('res', res.data.records)
- }).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; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const handleQuery = () => {
+ page.current = 1;
+ getList();
+ };
+ const paginationChange = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const getList = () => {
+ tableLoading.value = true;
+ const params = { ...page };
+ if (activeTab.value === "production") {
+ params.customerName = searchForm.value.customerName;
+ params.timeStr = searchForm.value.timeStr;
+ } else {
+ params.supplierName = searchForm.value.supplierName;
+ params.timeStr = searchForm.value.timeStr;
}
- if (nodes[i].children && nodes[i].children.length > 0) {
- const foundNode = findNodeById(nodes[i].children, productId);
- if (foundNode) {
- return foundNode.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
- }
+ params.productCategory = searchForm.value.productCategory;
+ let apiCall;
+ if (activeTab.value === "production") {
+ apiCall = getStockInPageByProduction(params);
+ } else if (activeTab.value === "product") {
+ apiCall = getStockInPageByProductProduction(params);
+ }else {
+ apiCall = getStockInPage(params);
}
- }
- return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
-};
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
- // 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter(item => item.id);
- console.log('selection', selectedRows.value)
-}
-const expandedRowKeys = ref([])
-
-// 涓昏〃鍚堣鏂规硶
-const summarizeMainTable = (param) => {
- return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']);
-};
-const currentRowId = ref(null) // 鏂板锛氬瓨鍌ㄥ綋鍓嶆搷浣滅殑琛孖D
-
-const currentRowNum = ref(0)
-const salesLedgerProductId = ref(null);
-
-// 鎵撳紑寮规
-const openForm = async (row) => {
- dialogFormVisible.value = true
- currentRowId.value = row.id
- currentRowNum.value = row.inboundNum0
- salesLedgerProductId.value = row.salesLedgerProductId
- form.value = {}
- // 鍒濆鍖栬〃鍗曟暟鎹�
- form.value = {
- productrecordId: '',
- inboundQuantity: '', // 鍑哄簱鏁伴噺娓呯┖
- inboundTime: getCurrentDate(), // 榛樿褰撳墠鏃ユ湡
- nickName: '', // 榛樿褰撳墠鐢ㄦ埛
- }
- console.log('form',form.value)
- // 鍔犺浇鐢ㄦ埛鍒楄〃
- try {
- const userLists = await userListNoPageByTenantId()
- userList.value = userLists.data
- } catch (error) {
- console.error('鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:', error)
- }
-}
-
-// 鎻愪氦琛ㄥ崟
-const submitForm = () => {
- let num = Number(form.value.inboundQuantity)
- if(num <= 0 || num > currentRowNum.value){
- return proxy.$modal.msgWarning("璇峰~鍏ユ湁鏁堟暟瀛�")
- }
- proxy.$refs["formRef"].validate(valid => {
- if (valid && currentRowId.value) {
- const outData = {
- id: currentRowId.value, // 鍘熷璁板綍ID
- salesLedgerProductId: salesLedgerProductId.value,
- quantity: form.value.inboundQuantity, // 鍑哄簱鏁伴噺
- time: form.value.inboundTime, // 鍑哄簱鏃堕棿
- userId: form.value.nickName // 鎿嶄綔浜�
- }
- console.log(outData)
-
- stockOut(outData).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛")
- closeDia()
- getList()
- }).catch(err => {
- proxy.$modal.msgError("鍑哄簱澶辫触")
+ apiCall
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ total.value = res.data.total;
})
- }
- })
-}
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef")
- dialogFormVisible.value = false
-}
+ .catch(() => {
+ tableLoading.value = false;
+ });
+ };
-// 瀵煎嚭
-const handleOut = () => {
- ElMessageBox.confirm(
- '鏄惁纭瀵煎嚭锛�',
- '瀵煎嚭', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- ).then(() => {
- proxy.download("/stockin/export", {}, '鍏ュ簱鍙拌处.xlsx')
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�")
- })
-}
-// 鍒犻櫎
-const handleDelete = () => {
- let ids = []
- if (selectedRows.value.length > 0) {
- ids = selectedRows.value.map(item => item.id);
- } else {
- proxy.$modal.msgWarning('璇烽�夋嫨鏁版嵁')
- return
- }
- ElMessageBox.confirm(
- '閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�',
- '瀵煎嚭', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- ).then(() => {
- delStockManage(ids).then(res => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
- getList()
+ const handleTabChange = () => {
+ page.current = 1;
+ searchForm.value.supplierName = "";
+ searchForm.value.customerName = "";
+ searchForm.value.timeStr = "";
+ selectedRows.value = [];
+ searchForm.value.productCategory = "";
+ getList();
+ };
+
+ 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.id);
+ console.log("selection", selectedRows.value);
+ };
+ const expandedRowKeys = ref([]);
+
+ // 涓昏〃鍚堣鏂规硶
+ const summarizeMainTable = param => {
+ return proxy.summarizeTable(param, [
+ "contractAmount",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ ]);
+ };
+ const currentRowId = ref(null); // 鏂板锛氬瓨鍌ㄥ綋鍓嶆搷浣滅殑琛孖D
+
+ const currentRowNum = ref(0);
+ const salesLedgerProductId = ref(null);
+const productModelId = ref(null);
+ // 鎵撳紑寮规
+ const openForm = async row => {
+ dialogFormVisible.value = true;
+ currentRowId.value = row.id;
+ currentRowNum.value = row.inboundNum0;
+ salesLedgerProductId.value = row.salesLedgerProductId;
+ productModelId.value = row.productModelId;
+ form.value = {};
+ // 鍒濆鍖栬〃鍗曟暟鎹�
+ form.value = {
+ productrecordId: "",
+ inboundQuantity: "", // 鍑哄簱鏁伴噺娓呯┖
+ inboundTime: getCurrentDate(), // 榛樿褰撳墠鏃ユ湡
+ nickName: "", // 榛樿褰撳墠鐢ㄦ埛
+ };
+ console.log("form", form.value);
+ // 鍔犺浇鐢ㄦ埛鍒楄〃
+ try {
+ const userLists = await userListNoPageByTenantId();
+ userList.value = userLists.data;
+ } catch (error) {
+ console.error("鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:", error);
+ }
+ };
+
+ // 鎻愪氦琛ㄥ崟
+ const submitForm = () => {
+ let num = Number(form.value.inboundQuantity);
+ if (num <= 0 || num > currentRowNum.value) {
+ return proxy.$modal.msgWarning("璇峰~鍏ユ湁鏁堟暟瀛�");
+ }
+ if (!form.value.nickName) {
+ return proxy.$modal.msgWarning("璇烽�夋嫨鎿嶄綔浜�");
+ }
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid && currentRowId.value) {
+ const typeMap = { production: 2, purchase: 1, product: 4 };
+ const outData = {
+ id: currentRowId.value, // 鍘熷璁板綍ID
+ salesLedgerProductId: salesLedgerProductId.value,
+ quantity: form.value.inboundQuantity, // 鍑哄簱鏁伴噺
+ time: form.value.inboundTime, // 鍑哄簱鏃堕棿
+ userId: form.value.nickName, // 鎿嶄綔浜�
+ type: typeMap[activeTab.value], // 鍑哄簱绫诲瀷锛氶噰璐�1锛岀敓浜�2
+ productModelId: productModelId.value,
+ };
+ console.log(outData);
+
+ stockOut(outData)
+ .then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ })
+ .catch(err => {
+ proxy.$modal.msgError("鍑哄簱澶辫触");
+ });
+ }
+ });
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ };
+
+ // 瀵煎嚭
+ const handleOut = () => {
+ ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
})
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�")
- })
-}
-onMounted(() => {
- getList()
-})
+ .then(() => {
+ // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
+ let exportUrl = "/stockin/export";
+ if (activeTab.value === "production") {
+ exportUrl = "/stockin/exportOne";
+ }
+ proxy.download(exportUrl, {}, "鍏ュ簱鍙拌处.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+ // 鍒犻櫎
+ const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map(item => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ delStockManage(ids).then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+ // 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
+ function getCurrentDate() {
+ 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}`;
+ }
+
+ // 鏍规嵁tab绫诲瀷鑾峰彇寮规鏍囬
+ const getDialogTitle = () => {
+ const titleMap = {
+ production: "鏂板鍙戣揣",
+ purchase: "鏂板棰嗙敤",
+ };
+ return titleMap[activeTab.value] || "鏂板鍑哄簱";
+ };
+
+ // 鏍规嵁tab绫诲瀷鑾峰彇鍙嚭搴撴暟閲忔枃鏈�
+ const getAvailableQuantityText = () => {
+ const textMap = {
+ production: "鍙彂璐ф暟閲�",
+ purchase: "鍙鐢ㄦ暟閲�",
+ };
+ return textMap[activeTab.value] || "鍙嚭搴撴暟閲�";
+ };
+
+ // 鏍规嵁tab绫诲瀷鑾峰彇鏁伴噺瀛楁鏍囩
+ const getQuantityLabel = () => {
+ const labelMap = {
+ production: "鍙戣揣鏁伴噺锛�",
+ purchase: "棰嗙敤鏁伴噺锛�",
+ };
+ return labelMap[activeTab.value] || "鍑哄簱鏁伴噺锛�";
+ };
+
+ // 鏍规嵁tab绫诲瀷鑾峰彇鏃ユ湡瀛楁鏍囩
+ const getDateLabel = () => {
+ const labelMap = {
+ production: "鍙戣揣鏃ユ湡锛�",
+ purchase: "棰嗙敤鏃ユ湡锛�",
+ };
+ return labelMap[activeTab.value] || "鍑哄簱鏃ユ湡锛�";
+ };
+
+ // 鏍规嵁tab绫诲瀷鑾峰彇浜哄憳瀛楁鏍囩
+ const getPersonLabel = () => {
+ const labelMap = {
+ production: "鍙戣揣浜猴細",
+ purchase: "棰嗙敤浜猴細",
+ };
+ return labelMap[activeTab.value] || "鍑哄簱浜猴細";
+ };
+
+ onMounted(() => {
+ getList();
+ });
</script>
<style scoped lang="scss"></style>
+
+
diff --git a/src/views/inventoryManagement/stockManagement/components/FormDiaProduction.vue b/src/views/inventoryManagement/stockManagement/components/FormDiaProduction.vue
new file mode 100644
index 0000000..1653307
--- /dev/null
+++ b/src/views/inventoryManagement/stockManagement/components/FormDiaProduction.vue
@@ -0,0 +1,147 @@
+<template>
+ <el-dialog :model-value="dialogFormVisible" :title="operationType === 'add' ? '鏂板鎴愬搧搴撳瓨' : '缂栬緫鎴愬搧搴撳瓨'" width="70%"
+ @update:model-value="$emit('update:dialogFormVisible', $event)" @close="closeDia">
+ <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="productCategory">
+ <el-input disabled v-model="form.productCategory" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="specificationModel">
+ <el-input disabled v-model="form.specificationModel" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="鍗曚綅锛�" prop="unit">
+ <el-input disabled v-model="form.unit" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍏ュ簱鏃堕棿锛�" prop="createTime">
+ <el-date-picker style="width: 100%" v-model="form.createTime" 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="inboundNum">
+ <el-input v-model="form.inboundNum" placeholder="璇疯緭鍏�" clearable @input="calculateTotalPrice" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="宸插嚭搴撴暟閲忥細" prop="totalInboundNum">
+ <el-input disabled v-model="form.totalInboundNum" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="寰呭嚭搴撴暟閲忥細" prop="inboundNum0">
+ <el-input disabled v-model="form.inboundNum0" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍗曚环(鍏�)锛�" prop="unitPrice">
+ <el-input v-model="form.unitPrice" placeholder="璇疯緭鍏�" clearable @input="calculateTotalPrice" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="鎬讳环(鍏�)锛�" prop="totalPrice">
+ <el-input disabled v-model="form.totalPrice" placeholder="鑷姩璁$畻" clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary" @click="submitForm">纭</el-button>
+ <el-button @click="closeDia">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+</template>
+
+<script setup>
+import { ref, reactive, toRefs, watch } from 'vue'
+
+const props = defineProps({
+ dialogFormVisible: Boolean,
+ operationType: String,
+ formData: Object
+})
+
+const emit = defineEmits(['update:dialogFormVisible', 'submit', 'close'])
+
+const formRef = ref()
+
+const data = reactive({
+ form: {
+ productCategory: '',
+ specificationModel: '',
+ unit: '',
+ createTime: '',
+ inboundNum: '',
+ totalInboundNum: '',
+ inboundNum0: '',
+ unitPrice: '',
+ totalPrice: ''
+ },
+ rules: {
+ productCategory: [{ required: true, message: '璇疯緭鍏ヤ骇鍝佸ぇ绫�', trigger: 'blur' }],
+ specificationModel: [{ required: true, message: '璇疯緭鍏ヨ鏍煎瀷鍙�', trigger: 'blur' }],
+ unit: [{ required: true, message: '璇疯緭鍏ュ崟浣�', trigger: 'blur' }],
+ createTime: [{ required: true, message: '璇烽�夋嫨鍏ュ簱鏃堕棿', trigger: 'change' }],
+ inboundNum: [{ required: true, message: '璇疯緭鍏ュ簱瀛樻暟閲�', trigger: 'blur' }],
+ unitPrice: [{ required: true, message: '璇疯緭鍏ュ崟浠�', trigger: 'blur' }]
+ }
+})
+
+const { form, rules } = toRefs(data)
+
+// 璁$畻鎬讳环锛氭�讳环 = 鍗曚环 脳 鍓╀綑搴撳瓨
+const calculateTotalPrice = () => {
+ const unitPrice = parseFloat(form.value.unitPrice) || 0
+ const stockQuantity = parseFloat(form.value.inboundNum) || 0 // 搴撳瓨鏁伴噺
+ const outboundQuantity = parseFloat(form.value.totalInboundNum) || 0 // 宸插嚭搴撴暟閲�
+ const remainingStock = stockQuantity - outboundQuantity // 鍓╀綑搴撳瓨
+ form.value.totalPrice = (unitPrice * remainingStock).toFixed(2)
+}
+
+// 鐩戝惉formData鍙樺寲
+watch(() => props.formData, (newVal) => {
+ if (newVal) {
+ form.value = { ...newVal }
+ // 鏁版嵁鍙樺寲鍚庨噸鏂拌绠楁�讳环
+ calculateTotalPrice()
+ }
+}, { immediate: true })
+
+// 鎻愪氦琛ㄥ崟
+const submitForm = () => {
+ formRef.value.validate(valid => {
+ if (valid) {
+ emit('submit', form.value)
+ }
+ })
+}
+
+// 鍏抽棴寮规
+const closeDia = () => {
+ emit('close')
+ emit('update:dialogFormVisible', false)
+}
+
+</script>
+
+<style scoped lang="scss">
+.dialog-footer {
+ text-align: center;
+}
+</style>
\ No newline at end of file
diff --git a/src/views/inventoryManagement/stockManagement/components/FormDiaPurchase.vue b/src/views/inventoryManagement/stockManagement/components/FormDiaPurchase.vue
new file mode 100644
index 0000000..5da2eee
--- /dev/null
+++ b/src/views/inventoryManagement/stockManagement/components/FormDiaPurchase.vue
@@ -0,0 +1,147 @@
+<template>
+ <el-dialog :model-value="dialogFormVisible" :title="operationType === 'add' ? '鏂板鍘熸枡搴撳瓨' : '缂栬緫鍘熸枡搴撳瓨'" width="70%"
+ @update:model-value="$emit('update:dialogFormVisible', $event)" @close="closeDia">
+ <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="productCategory">
+ <el-input disabled v-model="form.productCategory" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="specificationModel">
+ <el-input disabled v-model="form.specificationModel" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="鍗曚綅锛�" prop="unit">
+ <el-input disabled v-model="form.unit" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍏ュ簱鏃堕棿锛�" prop="createTime">
+ <el-date-picker style="width: 100%" v-model="form.createTime" 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="inboundNum">
+ <el-input v-model="form.inboundNum" placeholder="璇疯緭鍏�" clearable @input="calculateTotalPrice" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="宸插嚭搴撴暟閲忥細" prop="totalInboundNum">
+ <el-input disabled v-model="form.totalInboundNum" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="寰呭嚭搴撴暟閲忥細" prop="inboundNum0">
+ <el-input disabled v-model="form.inboundNum0" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍚◣鍗曚环(鍏�)锛�" prop="taxInclusiveUnitPrice">
+ <el-input v-model="form.taxInclusiveUnitPrice" placeholder="璇疯緭鍏�" clearable @input="calculateTotalPrice" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="鍚◣鎬讳环(鍏�)锛�" prop="taxInclusiveTotalPrice">
+ <el-input disabled v-model="form.taxInclusiveTotalPrice" placeholder="鑷姩璁$畻" clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary" @click="submitForm">纭</el-button>
+ <el-button @click="closeDia">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+</template>
+
+<script setup>
+import { ref, reactive, toRefs, watch } from 'vue'
+
+const props = defineProps({
+ dialogFormVisible: Boolean,
+ operationType: String,
+ formData: Object
+})
+
+const emit = defineEmits(['update:dialogFormVisible', 'submit', 'close'])
+
+const formRef = ref()
+
+const data = reactive({
+ form: {
+ productCategory: '',
+ specificationModel: '',
+ unit: '',
+ createTime: '',
+ inboundNum: '',
+ totalInboundNum: '',
+ inboundNum0: '',
+ taxInclusiveUnitPrice: '',
+ taxInclusiveTotalPrice: ''
+ },
+ rules: {
+ productCategory: [{ required: true, message: '璇疯緭鍏ヤ骇鍝佸ぇ绫�', trigger: 'blur' }],
+ specificationModel: [{ required: true, message: '璇疯緭鍏ヨ鏍煎瀷鍙�', trigger: 'blur' }],
+ unit: [{ required: true, message: '璇疯緭鍏ュ崟浣�', trigger: 'blur' }],
+ createTime: [{ required: true, message: '璇烽�夋嫨鍏ュ簱鏃堕棿', trigger: 'change' }],
+ inboundNum: [{ required: true, message: '璇疯緭鍏ュ簱瀛樻暟閲�', trigger: 'blur' }],
+ taxInclusiveUnitPrice: [{ required: true, message: '璇疯緭鍏ュ惈绋庡崟浠�', trigger: 'blur' }]
+ }
+})
+
+const { form, rules } = toRefs(data)
+
+// 璁$畻鎬讳环锛氬惈绋庢�讳环 = 鍚◣鍗曚环 脳 鍓╀綑搴撳瓨
+const calculateTotalPrice = () => {
+ const unitPrice = parseFloat(form.value.taxInclusiveUnitPrice) || 0
+ const stockQuantity = parseFloat(form.value.inboundNum) || 0 // 搴撳瓨鏁伴噺
+ const outboundQuantity = parseFloat(form.value.totalInboundNum) || 0 // 宸插嚭搴撴暟閲�
+ const remainingStock = stockQuantity - outboundQuantity // 鍓╀綑搴撳瓨
+ form.value.taxInclusiveTotalPrice = (unitPrice * remainingStock).toFixed(2)
+}
+
+// 鐩戝惉formData鍙樺寲
+watch(() => props.formData, (newVal) => {
+ if (newVal) {
+ form.value = { ...newVal }
+ // 鏁版嵁鍙樺寲鍚庨噸鏂拌绠楁�讳环
+ calculateTotalPrice()
+ }
+}, { immediate: true })
+
+// 鎻愪氦琛ㄥ崟
+const submitForm = () => {
+ formRef.value.validate(valid => {
+ if (valid) {
+ emit('submit', form.value)
+ }
+ })
+}
+
+// 鍏抽棴寮规
+const closeDia = () => {
+ emit('close')
+ emit('update:dialogFormVisible', false)
+}
+
+</script>
+
+<style scoped lang="scss">
+.dialog-footer {
+ text-align: center;
+}
+</style>
\ No newline at end of file
diff --git a/src/views/inventoryManagement/stockManagement/index.vue b/src/views/inventoryManagement/stockManagement/index.vue
index 52b0184..88ca4ff 100644
--- a/src/views/inventoryManagement/stockManagement/index.vue
+++ b/src/views/inventoryManagement/stockManagement/index.vue
@@ -1,419 +1,591 @@
<template>
<div class="app-container">
- <div class="search_form">
- <div>
- <span class="search_title">渚涘簲鍟嗗悕绉帮細</span>
- <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="璇疯緭鍏�" @change="handleQuery"
- clearable prefix-icon="Search" />
- <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
- <el-date-picker
- v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery"
- />
- <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
- </div>
- <div>
- <!-- <el-button type="primary" @click="openForm('add')">鏂板</el-button> -->
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary style="width: 100%"
- :row-class-name="tableRowClassName"
- :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)">
- <el-table-column align="center" type="selection" width="55" />
- <el-table-column align="center" label="搴忓彿" type="index" width="60" />
- <el-table-column label="鍏ュ簱鏃ユ湡" prop="createTime" width="100" show-overflow-tooltip />
- <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被" prop="productCategory" width="100" show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="200" show-overflow-tooltip />
- <el-table-column label="鍗曚綅" prop="unit" width="80" show-overflow-tooltip />
- <el-table-column label="搴撳瓨鏁伴噺" prop="inboundNum0" width="100" show-overflow-tooltip />
- <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" width="130" show-overflow-tooltip />
- <el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />
- <el-table-column label="鍚◣鎬讳环" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />
- <el-table-column label="绋庣巼(%)" prop="taxRate" width="100" show-overflow-tooltip />
- <el-table-column label="涓嶅惈绋庢�讳环" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip />
- <el-table-column label="鍏ュ簱浜�" prop="createBy" width="80" show-overflow-tooltip />
- <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center">
- <template #default="scope">
- <el-button link type="primary" size="small" @click="openForm('edit', 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" />
- </div>
- <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? '鏂板搴撳瓨' : '缂栬緫搴撳瓨'" width="70%"
- @close="closeDia">
- <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="supplierName">
- <el-input disabled v-model="form.supplierName" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="浜у搧澶х被锛�" prop="productId">
- <el-select disabled v-model="form.productCategory" placeholder="璇烽�夋嫨" clearable filterable>
- <el-option v-for="item in productList" :key="item.id" :label="item.productName"
- :value="item.productName" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productManageId">
- <el-select disabled v-model="form.specificationModel" placeholder="璇峰厛閫夋嫨浜у搧澶х被" clearable filterable :disabled="!form.productCategory">
- <el-option v-for="item in productModelList" :key="item.id" :label="item.model"
- :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鍗曚綅锛�" prop="customerId">
- <el-input disabled 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.updateTime" 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="projectName">
- <el-date-picker style="width: 100%" v-model="form.createTime" 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="customerId">
- <el-input disabled v-model="form.taxInclusiveUnitPrice" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鍚◣鎬讳环锛�" prop="customerContractNo">
- <el-input disabled v-model="form.taxInclusiveTotalPrice" 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 disabled v-model="form.taxRate" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="涓嶅惈绋庢�讳环锛�" prop="entryDate">
- <el-input disabled v-model="form.taxExclusiveTotalPrice" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鍑哄簱浜猴細" prop="entryPerson">
- <el-select v-model="form.createUser" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
- </el-select>
- </el-form-item>
- </el-col>
-<!-- <el-col :span="12">-->
-<!-- <el-form-item label="搴撳瓨棰勮鏁伴噺锛�" prop="warnNum">-->
-<!-- <el-input v-model="form.warnNum" placeholder="璇疯緭鍏ユ渶浣庡簱瀛�" clearable />-->
-<!-- </el-form-item>-->
-<!-- </el-col>-->
- </el-row>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
- <el-button @click="closeDia">鍙栨秷</el-button>
+ <el-tabs v-model="activeTab"
+ @tab-change="handleTabChange">
+ <el-tab-pane label="鎴愬搧搴撳瓨"
+ name="production">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
+ <el-date-picker v-model="searchForm.timeStr"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ @change="handleQuery" />
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input v-model="searchForm.productCategory"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>-->
+ </div>
</div>
- </template>
- </el-dialog>
+ <div class="table_list">
+ <el-table :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="row => row.id"
+ show-summary
+ style="width: 100%"
+ :row-class-name="tableRowClassName"
+ :summary-method="summarizeMainTable"
+ height="calc(100vh - 18.5em)">
+ <el-table-column align="center"
+ type="selection"
+ width="55" />
+ <el-table-column align="center"
+ label="搴忓彿"
+ type="index"
+ width="60" />
+ <el-table-column label="鍏ュ簱鏃ユ湡"
+ prop="createTime"
+ width="120">
+ <template #default="scope">
+ {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column label="浜у搧鍚嶇О"
+ prop="productName"
+ width="180"
+ show-overflow-tooltip />
+ <el-table-column label="浜у搧瑙勬牸"
+ prop="model"
+ show-overflow-tooltip />
+ <el-table-column label="鍗曚綅"
+ prop="unit"
+ width="80"
+ show-overflow-tooltip />
+ <el-table-column label="宸插嚭搴撴暟閲�"
+ prop="outboundNum"
+ show-overflow-tooltip />
+ <el-table-column label="鍓╀綑搴撳瓨"
+ prop="stockQuantity"
+ show-overflow-tooltip />
+ <!-- <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center">
+ <template #default="scope">
+ <el-button link type="primary" size="small" @click="openForm('edit', 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" />
+ </div>
+ </el-tab-pane>
+ <el-tab-pane label="鍘熸枡搴撳瓨"
+ name="purchase">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
+ <el-date-picker v-model="searchForm.timeStr"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ @change="handleQuery" />
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input v-model="searchForm.productCategory"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>-->
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="row => row.id"
+ show-summary
+ style="width: 100%"
+ :row-class-name="tableRowClassName"
+ :summary-method="summarizeMainTable"
+ height="calc(100vh - 18.5em)">
+ <el-table-column align="center"
+ type="selection"
+ width="55" />
+ <el-table-column align="center"
+ label="搴忓彿"
+ type="index"
+ width="60" />
+ <el-table-column label="鍏ュ簱鏃ユ湡"
+ prop="createTime"
+ width="120"
+ show-overflow-tooltip>
+ <template #default="scope">
+ {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column label="閲囪喘鍚堝悓鍙�"
+ prop="purchaseContractNumber"
+ width="180"
+ show-overflow-tooltip />
+ <el-table-column label="浜у搧澶х被"
+ prop="productCategory"
+ show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿"
+ prop="specificationModel"
+ show-overflow-tooltip />
+ <el-table-column label="鍗曚綅"
+ prop="unit"
+ width="80"
+ show-overflow-tooltip />
+ <el-table-column label="宸插嚭搴撴暟閲�"
+ prop="totalInboundNum"
+ show-overflow-tooltip />
+ <el-table-column label="鍓╀綑搴撳瓨"
+ prop="inboundNum0"
+ show-overflow-tooltip />
+ <el-table-column label="鍚◣鍗曚环(鍏�)"
+ prop="taxInclusiveUnitPrice"
+ width="150"></el-table-column>
+ <el-table-column label="鍚◣鎬讳环(鍏�)"
+ prop="taxInclusiveTotalPrice"
+ width="150"></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" />
+ </div>
+ </el-tab-pane>
+ </el-tabs>
+ <!-- 鎴愬搧搴撳瓨寮规 -->
+ <FormDiaProduction v-model:dialogFormVisible="productionDialogVisible"
+ :operationType="operationType"
+ :formData="form"
+ @submit="submitForm"
+ @close="closeDia" />
+ <!-- 鍘熸枡搴撳瓨寮规 -->
+ <FormDiaPurchase v-model:dialogFormVisible="purchaseDialogVisible"
+ :operationType="operationType"
+ :formData="form"
+ @submit="submitForm"
+ @close="closeDia" />
</div>
</template>
<script setup>
-import pagination from '@/components/PIMTable/Pagination.vue'
-import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
-import { ElMessageBox } from "element-plus";
-import useUserStore from '@/store/modules/user'
-import { userListNoPageByTenantId } from "@/api/system/user.js";
-import { productTreeList,modelList } from "@/api/basicData/product.js"
-import { getCurrentDate } from "@/utils/index.js";
-import {
- getStockManagePage,
- delStockManage,
-} from "@/api/inventoryManagement/stockManage.js";
-import {
- updateManagement,updateStockIn
-} from "@/api/inventoryManagement/stockIn.js";
+ import pagination from "@/components/PIMTable/Pagination.vue";
+ import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
+ import { ElMessageBox } from "element-plus";
+ import useUserStore from "@/store/modules/user";
+ import { userListNoPageByTenantId } from "@/api/system/user.js";
+ import { productTreeList, modelList } from "@/api/basicData/product.js";
+ import {
+ getStockManagePage,
+ getStockManagePageByProduction,
+ delStockManage, getStockManageProduction,
+ } from "@/api/inventoryManagement/stockManage.js";
+ import {
+ updateManagement,
+ updateManagementByCustom,
+ updateStockIn,
+ } from "@/api/inventoryManagement/stockIn.js";
+ // 瀵煎叆涓や釜鐙珛鐨勫脊妗嗙粍浠�
+ import FormDiaProduction from "./components/FormDiaProduction.vue";
+ import FormDiaPurchase from "./components/FormDiaPurchase.vue";
+ const userStore = useUserStore();
+ const { proxy } = getCurrentInstance();
+ const tableData = ref([]);
+ const productData = ref([]);
+ const selectedRows = ref([]);
+ const userList = ref([]);
+ const productList = ref([]);
+ const productModelList = ref([]);
+ // const customerOption = ref([])
+ const tableLoading = ref(false);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ });
+ const total = ref(0);
+ const fileList = ref([]);
+ const loading = ref(false);
+ // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
+ const operationType = ref("");
+ const activeTab = ref("production");
-const userStore = useUserStore()
-const { proxy } = getCurrentInstance()
-const tableData = ref([])
-const productData = ref([])
-const selectedRows = ref([])
-const userList = ref([])
-const productList = ref([])
-const productModelList = ref([])
-// const customerOption = ref([])
-const tableLoading = ref(false)
-const page = reactive({
- current: 1,
- size: 100,
-})
-const total = ref(0)
-const fileList = ref([])
-const loading = ref(false);
-// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
-const operationType = ref('')
-const dialogFormVisible = ref(false)
-const data = reactive({
- searchForm: {
- supplierName: '',
- timeStr: '',
- },
- form: {
- supplierId: null,
- supplierName: '',
- productId: null,
- productName: '',
- userId: userStore.userId,
- nickName: '',
- productModelId: null,
- model: '',
- unit: '',
- productrecordId: null,
- taxInclusiveUnitPrice: '',
- taxInclusiveTotalPrice: '',
- taxRate: '',
- taxExclusiveTotalPrice: '',
- inboundTime: '',
- inboundBatch: '',
- stockQuantity: '',
- boundTime: '',
- warnNum: '', // 鏂板鏈�浣庡簱瀛樺瓧娈�
- salesLedgerProductId: null,
- },
- rules: {
- 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' }],
- warnNum: [{ required: true, message: '璇疯緭鍏ユ渶浣庡簱瀛�', trigger: 'blur' }],
- }
-})
-const { searchForm, form, rules } = toRefs(data)
+ // 寮规鏄剧ず鐘舵��
+ const productionDialogVisible = ref(false);
+ const purchaseDialogVisible = ref(false);
-// 鏌ヨ鍒楄〃
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-const handleQuery = () => {
- page.current = 1
- getList()
-}
-const paginationChange = (obj) => {
- page.current = obj.page;
- page.size = obj.limit;
- getList()
-}
-const getList = () => {
- tableLoading.value = true
- getStockManagePage({ ...searchForm.value, ...page }).then(res => {
- tableLoading.value = false
- tableData.value = res.data.records
- total.value = res.data.total
- // 鏁版嵁鍔犺浇瀹屾垚鍚庢鏌ュ簱瀛�
- // checkStockAndCreatePurchase();
- }).catch(() => {
- tableLoading.value = false
- })
-}
+ const data = reactive({
+ searchForm: {
+ // supplierName: '',
+ productCategory: "",
+ customerName: "",
+ timeStr: "",
+ },
+ form: {
+ supplierId: null,
+ // supplierName: '',
+ productId: null,
+ productName: "",
+ userId: userStore.userId,
+ nickName: "",
+ productModelId: null,
+ model: "",
+ unit: "",
+ productrecordId: null,
+ unitPrice: "", // 娣诲姞鎴愬搧搴撳瓨鐨勫崟浠峰瓧娈�
+ taxInclusiveUnitPrice: "",
+ taxInclusiveTotalPrice: "",
+ taxRate: "",
+ taxExclusiveTotalPrice: "",
+ inboundTime: "",
+ inboundBatch: "",
+ stockQuantity: "",
+ boundTime: "",
+ warnNum: "", // 鏂板鏈�浣庡簱瀛樺瓧娈�
+ salesLedgerProductId: null,
+ },
+ rules: {
+ // 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" },
+ ],
+ unitPrice: [{ 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" },
+ ],
+ warnNum: [{ required: true, message: "璇疯緭鍏ユ渶浣庡簱瀛�", trigger: "blur" }],
+ },
+ });
+ const { searchForm, form, rules } = toRefs(data);
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const handleQuery = () => {
+ page.current = 1;
+ getList();
+ };
+ const paginationChange = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const buildQueryParams = () => {
+ const params = {
+ ...page,
+ timeStr: searchForm.value.timeStr,
+ };
+ params.productCategory = searchForm.value.productCategory;
+ if (activeTab.value === "production") {
+ params.customerName = searchForm.value.customerName;
+ } else {
+ // params.supplierName = searchForm.value.supplierName
+ }
+ return params;
+ };
- // 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter(item => item.id);
- console.log('selection', selectedRows.value)
-}
-const expandedRowKeys = ref([])
+ const getList = () => {
+ tableLoading.value = true;
+ const params = buildQueryParams();
+ const apiCall =
+ activeTab.value === "production"
+ ? getStockManageProduction(params)
+ : getStockManagePage(params);
+ apiCall
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
-// 涓昏〃鍚堣鏂规硶
-const summarizeMainTable = (param) => {
- return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']);
-};
+ // 涓鸿〃鏍兼暟鎹嚜鍔ㄨ绠楁�讳环
+ // tableData.value = tableData.value.map(item => {
+ // // 璁$畻鍓╀綑搴撳瓨
+ // const stockQuantity = parseFloat(item.inboundNum) || 0;
+ // const outboundQuantity = parseFloat(item.totalInboundNum) || 0;
+ // const remainingStock = Math.max(stockQuantity - outboundQuantity, 0);
+ //
+ // // 鏍规嵁鏍囩椤电被鍨嬭绠楁�讳环
+ // if (activeTab.value === "production") {
+ // // 鎴愬搧搴撳瓨锛氭�讳环 = 鍗曚环 脳 鍓╀綑搴撳瓨
+ // const unitPrice = parseFloat(item.unitPrice) || 0;
+ // item.totalPrice = (unitPrice * remainingStock).toFixed(2);
+ // } else if (activeTab.value === "purchase") {
+ // // 鍘熸枡搴撳瓨锛氬惈绋庢�讳环 = 鍚◣鍗曚环 脳 鍓╀綑搴撳瓨
+ // const taxInclusiveUnitPrice =
+ // parseFloat(item.taxInclusiveUnitPrice) || 0;
+ // item.taxInclusiveTotalPrice = (
+ // taxInclusiveUnitPrice * remainingStock
+ // ).toFixed(2);
+ // }
+ //
+ // return item;
+ // });
-// 琛ㄦ牸琛岀被鍚�
-const tableRowClassName = ({ row }) => {
- const stock = Number(row?.inboundNum0 ?? 0);
- const warn = Number(row?.warnNum ?? 0);
- if (!Number.isFinite(stock) || !Number.isFinite(warn)) {
- return '';
- }
- return stock < warn ? 'row-low-stock' : '';
-};
-
-// 鎵撳紑寮规
-const openForm = async (type, row) => {
- operationType.value = type
- form.value = {}
- productData.value = []
- let userLists = await userListNoPageByTenantId()
- userList.value = userLists.data
- if (type === 'edit') {
- form.value = { ...row }
- productTreeList().then(res =>{
- productList.value = res
- productList.value.forEach(i =>{
- if (i.label === row.productCategory) {
- modelList({ id: i.id }).then((res) => {
- productModelList.value = res;
- });
- }
+ total.value = res.data.total;
+ // 鏁版嵁鍔犺浇瀹屾垚鍚庢鏌ュ簱瀛�
+ // checkStockAndCreatePurchase();
})
- })
- }
- form.value.entryDate = getCurrentDate() // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈�
- dialogFormVisible.value = true
-}
+ .catch(() => {
+ tableLoading.value = false;
+ });
+ };
-// 鎻愪氦琛ㄥ崟
-const submitForm = () => {
- console.log(form.value)
- proxy.$refs["formRef"].validate(valid => {
- if (valid) {
+ // 鍒囨崲 tab
+ const handleTabChange = () => {
+ page.current = 1;
+ // searchForm.value.supplierName = ''
+ searchForm.value.customerName = "";
+ searchForm.value.timeStr = "";
+ selectedRows.value = [];
+ searchForm.value.productCategory = "";
+ getList();
+ };
- updateManagement(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛")
- closeDia()
- getList()
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ // 杩囨护鎺夊瓙鏁版嵁
+ selectedRows.value = selection.filter(item => item.id);
+ console.log("selection", selectedRows.value);
+ };
+ const expandedRowKeys = ref([]);
+
+ // 涓昏〃鍚堣鏂规硶
+ const summarizeMainTable = param => {
+ return proxy.summarizeTable(param, [
+ "contractAmount",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ ]);
+ };
+
+ // 琛ㄦ牸琛岀被鍚�
+ const tableRowClassName = ({ row }) => {
+ const stock = Number(row?.inboundNum0 ?? 0);
+ const warn = Number(row?.warnNum ?? 0);
+ if (!Number.isFinite(stock) || !Number.isFinite(warn)) {
+ return "";
+ }
+ return stock < warn ? "row-low-stock" : "";
+ };
+
+ // 鎵撳紑寮规
+ const openForm = async (type, row) => {
+ operationType.value = type;
+ form.value = {};
+ productData.value = [];
+ let userLists = await userListNoPageByTenantId();
+ userList.value = userLists.data;
+ if (type === "edit") {
+ form.value = { ...row };
+ productTreeList().then(res => {
+ productList.value = res;
+ productList.value.forEach(i => {
+ if (i.label === row.productCategory) {
+ modelList({ id: i.id }).then(res => {
+ productModelList.value = res;
+ });
+ }
+ });
+ });
+ }
+ form.value.entryDate = getCurrentDate(); // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈�
+
+ // 鏍规嵁褰撳墠鏍囩椤垫樉绀哄搴旂殑寮规
+ if (activeTab.value === "production") {
+ productionDialogVisible.value = true;
+ } else if (activeTab.value === "purchase") {
+ purchaseDialogVisible.value = true;
+ }
+ };
+
+ // 鎻愪氦琛ㄥ崟
+ const submitForm = submittedData => {
+ console.log("瀛愮粍浠舵彁浜ょ殑鏁版嵁:", submittedData);
+
+ // 浣跨敤瀛愮粍浠舵彁浜ょ殑鏁版嵁锛岃�屼笉鏄埗缁勪欢鐨刦orm瀵硅薄
+ const submitData = { ...submittedData };
+
+ // 鏍规嵁褰撳墠鏍囩椤电Щ闄ゅ搴旂殑鎬讳环瀛楁
+ if (activeTab.value === "production") {
+ // 鎴愬搧搴撳瓨锛氱Щ闄ゆ�讳环瀛楁
+ delete submitData.totalPrice;
+ } else if (activeTab.value === "purchase") {
+ // 鍘熸枡搴撳瓨锛氱Щ闄ゅ惈绋庢�讳环瀛楁
+ delete submitData.taxInclusiveTotalPrice;
+ }
+
+ // 绉婚櫎鍏朵粬鍙兘鐨勬�讳环瀛楁
+ delete submitData.taxExclusiveTotalPrice;
+
+ console.log("鎻愪氦缁欏悗绔殑鏁版嵁锛堝凡绉婚櫎鎬讳环瀛楁锛�:", submitData);
+
+ // 鏍规嵁褰撳墠鏍囩椤佃皟鐢ㄤ笉鍚岀殑鎻愪氦鎺ュ彛
+ let apiCall;
+ if (activeTab.value === "production") {
+ // 鎴愬搧搴撳瓨浣跨敤 updateManagement 鎺ュ彛
+ apiCall = updateManagement(submitData);
+ } else {
+ // 鍘熸枡搴撳瓨浣跨敤 updateManagementByCustom 鎺ュ彛
+ apiCall = updateManagementByCustom(submitData);
+ }
+
+ apiCall
+ .then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
// 鎻愪氦鍚庢鏌ュ簱瀛樺苟灏濊瘯鍒涘缓璇疯喘鍗�
// checkStockAndCreatePurchase();
})
- }
- })
-}
-// 妫�鏌ュ簱瀛樺苟鍒涘缓璇疯喘鍗�
-// const checkStockAndCreatePurchase = async () => {
-// const stockList = tableData.value;
-// // handList()
-// for (const item of stockList) {
-// if (item.inboundNum0 < item.warnNum) {
-// try {
-// const stockInData = {
-// id: item.id,
-// quantityStock: item.warnNum + item.totalInboundNum,// 浣跨敤鏂版牸寮忓寲鍑芥暟
-// };
-// loading.value = true
-// await updateStockIn(stockInData)
-// proxy.$modal.msgSuccess(`浜у搧 ${item.productCategory} 淇敼鍏ュ簱鎴愬姛`)
-// loading.value = false
-// } catch (error) {
-// proxy.$modal.msgError(`浜у搧 ${item.productCategory} 鐢熸垚璇疯喘鍗曞け璐ワ紝璇锋墜鍔ㄥ鐞哷);
-//
-// }
-// }
-// }
-// };
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef")
- dialogFormVisible.value = false
-}
+ .catch(error => {
+ console.error("鎻愪氦澶辫触:", error);
+ proxy.$modal.msgError("鎻愪氦澶辫触锛岃閲嶈瘯");
+ });
+ };
+ // 妫�鏌ュ簱瀛樺苟鍒涘缓璇疯喘鍗�
+ // const checkStockAndCreatePurchase = async () => {
+ // const stockList = tableData.value;
+ // // handList()
+ // for (const item of stockList) {
+ // if (item.inboundNum0 < item.warnNum) {
+ // try {
+ // const stockInData = {
+ // id: item.id,
+ // quantityStock: item.warnNum + item.totalInboundNum,// 浣跨敤鏂版牸寮忓寲鍑芥暟
+ // };
+ // loading.value = true
+ // await updateStockIn(stockInData)
+ // proxy.$modal.msgSuccess(`浜у搧 ${item.productCategory} 淇敼鍏ュ簱鎴愬姛`)
+ // loading.value = false
+ // } catch (error) {
+ // proxy.$modal.msgError(`浜у搧 ${item.productCategory} 鐢熸垚璇疯喘鍗曞け璐ワ紝璇锋墜鍔ㄥ鐞哷);
+ //
+ // }
+ // }
+ // }
+ // };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ productionDialogVisible.value = false;
+ purchaseDialogVisible.value = false;
+ };
-// 瀵煎嚭
-const handleOut = () => {
- ElMessageBox.confirm(
- '鏄惁纭瀵煎嚭锛�',
- '瀵煎嚭', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- ).then(() => {
- proxy.download("/stockin/exportCopy", {}, '搴撳瓨淇℃伅.xlsx')
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�")
- })
-}
-// 鍒犻櫎
-const handleDelete = () => {
- let ids = []
- if (selectedRows.value.length > 0) {
- // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
- const unauthorizedData = selectedRows.value.filter(item => item.createUser !== userStore.id);
- if (unauthorizedData.length > 0) {
- proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
- return;
- }
- ids = selectedRows.value.map(item => item.id);
- } else {
- proxy.$modal.msgWarning('璇烽�夋嫨鏁版嵁')
- return
- }
- ElMessageBox.confirm(
- '閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�',
- '瀵煎嚭', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- ).then(() => {
- delStockManage({ids:ids}).then(res => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
- getList()
+ // 瀵煎嚭
+ const handleOut = () => {
+ ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
})
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�")
- })
-}
-onMounted(() => {
- getList()
- // checkStockAndCreatePurchase();
+ .then(() => {
+ const exportParams = buildQueryParams();
+ // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
+ let exportUrl = "/stockin/exportCopy";
+ if (activeTab.value === "production") {
+ exportUrl = "/stockin/exportCopyOne";
+ }
+ proxy.download(exportUrl, exportParams, "搴撳瓨淇℃伅.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+ // 鍒犻櫎
+ const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map(item => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ delStockManage({ ids: ids }).then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+ // 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
+ function getCurrentDate() {
+ 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}`;
+ }
+ onMounted(() => {
+ getList();
+ // checkStockAndCreatePurchase();
// 姣忓皬鏃舵鏌ヤ竴娆″簱瀛�
// const intervalId = setInterval(checkStockAndCreatePurchase, 60 * 60 * 1000);
-// onUnmounted(() => {
-// // 缁勪欢鍗歌浇鏃舵竻闄ゅ畾鏃跺櫒
-// clearInterval(intervalId);
-// });
-})
+ // onUnmounted(() => {
+ // // 缁勪欢鍗歌浇鏃舵竻闄ゅ畾鏃跺櫒
+ // clearInterval(intervalId);
+ // });
+ });
</script>
<style scoped lang="scss">
-:deep(.row-low-stock td) {
- background-color: #fde2e2;
- color: #c45656;
-}
+ :deep(.row-low-stock td) {
+ background-color: #fde2e2;
+ color: #c45656;
+ }
-:deep(.row-low-stock:hover > td) {
- background-color: #fcd4d4;
-}
-</style>
+ :deep(.row-low-stock:hover > td) {
+ background-color: #fcd4d4;
+ }
+</style>
\ No newline at end of file
diff --git a/src/views/inventoryManagement/stockWarning/index.vue b/src/views/inventoryManagement/stockWarning/index.vue
index d0d5834..8d3df17 100644
--- a/src/views/inventoryManagement/stockWarning/index.vue
+++ b/src/views/inventoryManagement/stockWarning/index.vue
@@ -306,8 +306,9 @@
<template #footer>
<div class="dialog-footer">
- <el-button @click="closeDialog">鍙栨秷</el-button>
<el-button type="primary" @click="submitForm">纭</el-button>
+ <el-button @click="closeDialog">鍙栨秷</el-button>
+
</div>
</template>
</el-dialog>
diff --git a/src/views/login.vue b/src/views/login.vue
index 43c9e4a..6217877 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -10,7 +10,6 @@
size="large"
auto-complete="off"
placeholder="璐﹀彿"
- @input="getUserLoginFacotryList"
>
<template #prefix><el-icon><User /></el-icon></template>
</el-input>
@@ -28,11 +27,6 @@
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
</el-input>
</el-form-item>
-<!-- <el-form-item prop="currentFatoryId">-->
-<!-- <el-select v-model="loginForm.currentFatoryId" placeholder="璇烽�夋嫨鍏徃" filterable>-->
-<!-- <el-option v-for="item in factoryList" :key="item.deptId" :label="item.deptName" :value="item.deptId" />-->
-<!-- </el-select>-->
-<!-- </el-form-item>-->
<!-- <el-form-item prop="code" v-if="captchaEnabled">-->
<!-- <el-input-->
<!-- v-model="loginForm.code"-->
@@ -77,7 +71,6 @@
import Cookies from "js-cookie"
import { encrypt, decrypt } from "@/utils/jsencrypt"
import useUserStore from '@/store/modules/user'
-import {userLoginFacotryList} from "@/api/system/user.js"
const title = import.meta.env.VITE_APP_TITLE
const userStore = useUserStore()
@@ -104,8 +97,6 @@
// 娉ㄥ唽寮�鍏�
const register = ref(false)
const redirect = ref(undefined)
-
-const factoryList = ref([])
watch(route, (newRoute) => {
redirect.value = newRoute.query && newRoute.query.redirect
@@ -160,20 +151,8 @@
}
}
-function getUserLoginFacotryList() {
- if(loginForm.value.username){
- userLoginFacotryList({userName:loginForm.value.username}).then(res => {
- console.log('res', res)
- factoryList.value = res.data
- })
- }else {
- factoryList.value = []
- }
-}
-
getCode()
getCookie()
-getUserLoginFacotryList()
</script>
<style lang='scss' scoped>
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index 20a472b..641dbaa 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -1,4 +1,4 @@
-<template>
+<template xmlns="">
<div class="app-container">
<PageHeader content="浜у搧缁撴瀯璇︽儏">
<template #right-button>
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 51b42ac..c6a3d13 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -41,7 +41,9 @@
</el-form-item>
</el-form>
<div>
+ <el-button type="primary" @click="openCreateOrder">鏂板璁㈠崟</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="danger" plain :disabled="selectedRows.length === 0" @click="handleBatchDelete">鎵归噺鍒犻櫎</el-button>
</div>
</div>
<div class="table_list">
@@ -50,6 +52,8 @@
:tableData="tableData"
:page="page"
:tableLoading="tableLoading"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
@pagination="pagination">
<template #completionStatus="{ row }">
<el-progress
@@ -85,20 +89,79 @@
</span>
</template>
</el-dialog>
+ <el-dialog v-model="orderFormVisible"
+ title="鏂板鐢熶骇璁㈠崟"
+ width="520px"
+ @close="() => proxy?.resetForm?.('orderFormRef')">
+ <el-form ref="orderFormRef"
+ :model="orderForm"
+ :rules="orderRules"
+ label-width="120px"
+ label-position="top">
+ <el-form-item label="浜у搧澶х被" prop="productId">
+ <el-tree-select v-model="orderForm.productId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ check-strictly
+ :data="productOptions"
+ :render-after-expand="false"
+ style="width: 100%"
+ @change="getModels" />
+ </el-form-item>
+ <el-form-item label="瑙勬牸鍨嬪彿" prop="productModelId">
+ <el-select v-model="orderForm.productModelId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ style="width: 100%"
+ @change="getProductModel">
+ <el-option v-for="item in modelOptions"
+ :key="item.id"
+ :label="item.model"
+ :value="item.id" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鍗曚綅" prop="unit">
+ <el-input v-model="orderForm.unit"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ <el-row :gutter="12">
+ <el-col :span="12">
+ <el-form-item label="鏁伴噺" prop="quantity">
+ <el-input-number v-model="orderForm.quantity"
+ :step="0.1"
+ :min="0"
+ :precision="2"
+ placeholder="璇疯緭鍏�"
+ style="width: 100%"
+ @change="calculateFromQuantity" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button type="primary" @click="submitCreateOrder">纭� 璁�</el-button>
+ <el-button @click="orderFormVisible = false">鍙� 娑�</el-button>
+ </span>
+ </template>
+ </el-dialog>
</div>
</template>
<script setup>
- import { onMounted, ref } from "vue";
+ import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue";
import { ElMessageBox } from "element-plus";
import dayjs from "dayjs";
import { useRouter } from "vue-router";
import {
productOrderListPage,
+ addProductOrder,
listProcessRoute,
bindingRoute,
- listProcessBom,
+ deleteProductOrder,
} from "@/api/productionManagement/productionOrder.js";
+ import { productTreeList, modelList } from "@/api/basicData/product.js";
import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js";
const { proxy } = getCurrentInstance();
@@ -111,22 +174,12 @@
width: '120px',
},
{
- label: "閿�鍞悎鍚屽彿",
- prop: "salesContractNo",
- width: '150px',
- },
- {
- label: "瀹㈡埛鍚嶇О",
- prop: "customerName",
- width: '200px',
- },
- {
- label: "浜у搧鍚嶇О",
+ label: "浜у搧澶х被",
prop: "productCategory",
width: '120px',
},
{
- label: "瑙勬牸",
+ label: "瑙勬牸鍨嬪彿",
prop: "specificationModel",
width: '120px',
},
@@ -196,6 +249,7 @@
]);
const tableData = ref([]);
const tableLoading = ref(false);
+ const selectedRows = ref([]);
const page = reactive({
current: 1,
size: 100,
@@ -212,6 +266,30 @@
},
});
const { searchForm } = toRefs(data);
+
+ // 鏂板璁㈠崟寮规鏁版嵁
+ const orderFormVisible = ref(false);
+ const orderFormRef = ref(null);
+ const orderFormState = reactive({
+ orderForm: {
+ productId: null,
+ productCategory: "",
+ productModelId: "",
+ specificationModel: "",
+ unit: "",
+ quantity: null,
+ },
+ orderRules: {
+ productId: [{ required: true, message: "璇烽�夋嫨浜у搧澶х被", trigger: "change" }],
+ productModelId: [{ required: true, message: "璇烽�夋嫨瑙勬牸鍨嬪彿", trigger: "change" }],
+ specificationModel: [{ required: true, message: "璇烽�夋嫨瑙勬牸鍨嬪彿", trigger: "change" }],
+ unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }],
+ quantity: [{ required: true, message: "璇疯緭鍏ユ暟閲�", trigger: "blur" }],
+ },
+ });
+ const { orderForm, orderRules } = toRefs(orderFormState);
+ const productOptions = ref([]);
+ const modelOptions = ref([]);
const toProgressPercentage = val => {
const n = Number(val);
@@ -378,8 +456,124 @@
});
};
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = (selection) => {
+ selectedRows.value = selection || [];
+ };
+
+ // 鎵归噺鍒犻櫎
+ const handleBatchDelete = async () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
+ return;
+ }
+ const ids = selectedRows.value.map(item => item.productModelId).filter(Boolean);
+ if (ids.length === 0) {
+ proxy.$modal.msgWarning("閫変腑鏁版嵁缂哄皯ID锛屾棤娉曞垹闄�");
+ return;
+ }
+ try {
+ await ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ });
+ await deleteProductOrder(ids);
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ selectedRows.value = [];
+ getList();
+ } catch (e) {
+ // 鍙栨秷鎴栧け璐�
+ if (e !== 'cancel' && e !== 'close') {
+ console.error("鎵归噺鍒犻櫎澶辫触锛�", e);
+ proxy.$modal.msgError("鍒犻櫎澶辫触锛岃閲嶈瘯");
+ }
+ }
+ };
+
const handleConfirmRoute = () => {};
+ const openCreateOrder = async () => {
+ orderForm.value = {
+ productId: null,
+ productCategory: "",
+ productModelId: "",
+ specificationModel: "",
+ unit: "",
+ quantity: null,
+ };
+ await loadProductOptions();
+ orderFormVisible.value = true;
+ };
+
+ const loadProductOptions = async () => {
+ const tree = await productTreeList();
+ productOptions.value = Array.isArray(tree?.data) ? convertIdToValue(tree.data) : convertIdToValue(tree || []);
+ };
+
+ const convertIdToValue = data => {
+ return (data || []).map(item => {
+ const { id, children, ...rest } = item;
+ const newItem = { ...rest, value: id };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
+ }
+ return newItem;
+ });
+ };
+
+ const 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;
+ }
+ }
+ }
+ return null;
+ };
+
+ const getModels = async value => {
+ orderForm.value.productId = value;
+ orderForm.value.productCategory = findNodeById(productOptions.value, value);
+ const res = await modelList({ id: value });
+ modelOptions.value = res || [];
+ };
+
+ const getProductModel = value => {
+ const index = modelOptions.value.findIndex(item => item.id === value);
+ if (index !== -1) {
+ orderForm.value.specificationModel = modelOptions.value[index].model;
+ orderForm.value.unit = modelOptions.value[index].unit;
+ } else {
+ orderForm.value.specificationModel = null;
+ orderForm.value.unit = null;
+ }
+ };
+
+ const calculateFromQuantity = () => {
+ // 鍗犱綅锛氭暟閲忓彉鏇存椂鍙湪姝ゆ墿灞曢�昏緫
+ };
+
+ const submitCreateOrder = async () => {
+ proxy.$refs["orderFormRef"]?.validate(async valid => {
+ if (!valid) return;
+ try {
+ await addProductOrder(orderForm.value);
+ proxy.$modal.msgSuccess("鏂板鎴愬姛");
+ orderFormVisible.value = false;
+ getList();
+ } catch (e) {
+ console.error("鏂板鐢熶骇璁㈠崟澶辫触", e);
+ proxy.$modal.msgError("鏂板澶辫触锛岃绋嶅悗閲嶈瘯");
+ }
+ });
+ };
+
onMounted(() => {
getList();
});
diff --git a/src/views/salesManagement/salesLedger/fileList.vue b/src/views/salesManagement/salesLedger/fileList.vue
index da37db2..bed2a76 100644
--- a/src/views/salesManagement/salesLedger/fileList.vue
+++ b/src/views/salesManagement/salesLedger/fileList.vue
@@ -14,7 +14,7 @@
</template>
<script setup>
-import { ref } from 'vue'
+import { ref, getCurrentInstance } from 'vue'
import filePreview from '@/components/filePreview/index.vue'
const dialogVisible = ref(false)
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index aedfb98..637d528 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -55,33 +55,11 @@
<el-tag v-if="scope.row.approveStatus === 4" type="danger">瀹℃牳澶辫触</el-tag>
</template>
</el-table-column>
- <el-table-column label="鍙戣揣杞︾墝" minWidth="100px" align="center">
- <template #default="scope">
- <div>
- <el-tag type="success" v-if="scope.row.shippingCarNumber">{{ scope.row.shippingCarNumber }}</el-tag>
- <el-tag v-else type="info">鏈彂璐�</el-tag>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="鍙戣揣鏃ユ湡" minWidth="100px" align="center">
- <template #default="scope">
- <div>
- <div v-if="scope.row.shippingDate">{{ scope.row.shippingDate }}</div>
- <el-tag v-else type="info">鏈彂璐�</el-tag>
- </div>
- </template>
- </el-table-column>
<el-table-column label="鏁伴噺" prop="quantity" />
<el-table-column label="绋庣巼(%)" prop="taxRate" />
<el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" />
<el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" />
<el-table-column label="涓嶅惈绋庢�讳环(鍏�)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" />
- <!--鎿嶄綔-->
- <el-table-column Width="60px" label="鎿嶄綔" align="center">
- <template #default="scope">
- <el-button :disabled="scope.row.approveStatus!==2 || scope.row.approveStatus!==5" link type="primary" size="small" @click="openDeliveryForm(scope.row)">鍙戣揣</el-button>
- </template>
- </el-table-column>
</el-table>
</template>
</el-table-column>
@@ -95,12 +73,13 @@
<el-table-column label="褰曞叆浜�" prop="entryPersonName" width="100" show-overflow-tooltip />
<el-table-column label="褰曞叆鏃ユ湡" prop="entryDate" width="120" show-overflow-tooltip />
<el-table-column label="绛捐鏃ユ湡" prop="executionDate" width="120" show-overflow-tooltip />
- <el-table-column fixed="right" label="鎿嶄綔" min-width="100" align="center">
+ <el-table-column label="鍙戣揣杞︾墝" prop="shippingCarNumber" width="140" align="center" show-overflow-tooltip />
+ <el-table-column label="鍙戣揣鏃ユ湡" prop="shippingDate" width="140" align="center" show-overflow-tooltip />
+ <el-table-column fixed="right" label="鎿嶄綔" min-width="140" align="center">
<template #default="scope">
<el-button link type="primary" size="small" @click="openForm('edit', scope.row)">缂栬緫</el-button>
-<!-- <el-button link type="primary" size="small" @click="openForm('view', scope.row)">璇︽儏</el-button>-->
<el-button link type="primary" size="small" @click="downLoadFile(scope.row)">闄勪欢</el-button>
-<!-- <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">鍙戣揣</el-button>-->
+ <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">鍙戣揣</el-button>
</template>
</el-table-column>
</el-table>
@@ -492,7 +471,7 @@
import { UploadFilled } from "@element-plus/icons-vue";
import useUserStore from "@/store/modules/user";
import { userListNoPage } from "@/api/system/user.js";
-import FileListDialog from '@/components/Dialog/FileListDialog.vue';
+import FileList from '@/views/salesManagement/salesLedger/fileList.vue';
import FormDialog from '@/components/Dialog/FormDialog.vue';
import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
import {
@@ -1622,16 +1601,18 @@
// 鎵撳紑鍙戣揣寮规
const openDeliveryForm = (row) => {
- getProductInventory({ salesLedgerId: row.id, type:1 }).then((res) => {
- currentDeliveryRow.value = row;
- deliveryForm.value = {
- shippingDate: getCurrentDate(),
- shippingCarNumber: "",
- };
- deliveryFormVisible.value = true;
- }).catch(err => {
- ElMessage.error(err.msg);
- });
+ // getProductInventory({ salesLedgerId: row.id, type:1 }).then((res) => {
+ // currentDeliveryRow.value = row;
+ // deliveryForm.value = {
+ // shippingDate: getCurrentDate(),
+ // shippingCarNumber: "",
+ // };
+ // deliveryFormVisible.value = true;
+ // }).catch(err => {
+ // ElMessage.error(err.msg);
+ // });
+ currentDeliveryRow.value = row;
+ deliveryFormVisible.value = true;
};
// 鎻愪氦鍙戣揣琛ㄥ崟
--
Gitblit v1.9.3