From 94152361e48cf51597fc1760a03f9610f9664340 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期五, 13 六月 2025 13:55:58 +0800
Subject: [PATCH] 优化生产对话框及接口配置
---
src/views/production/components/ProductionDialog.vue | 69 +++++++++++++++-------------------
1 files changed, 30 insertions(+), 39 deletions(-)
diff --git a/src/views/production/components/ProductionDialog.vue b/src/views/production/components/ProductionDialog.vue
index 035d75a..226b70e 100644
--- a/src/views/production/components/ProductionDialog.vue
+++ b/src/views/production/components/ProductionDialog.vue
@@ -7,8 +7,7 @@
@close="handleClose"
>
<el-button type="primary" @click="handlData">閫夋嫨鏁版嵁</el-button>
- <ETable
- v-if="tableData.length > 0"
+ <ETableModify
:columns="columns"
height="200"
@cell-edit="handleCellEdit"
@@ -19,7 +18,7 @@
/>
<div class="empty-table">
<h1>鐢熶骇鏄庣粏</h1>
- <el-row :gutter="10" v-if="tableData.length > 0">
+ <el-row :gutter="10">
<el-col :span="2">
<el-button type="primary" @click="addNewRow">
<el-icon>
@@ -45,7 +44,6 @@
</el-col> -->
</el-row>
<ProductionDetailsTable
- v-if="tableData.length > 0"
v-model="detailsTableData"
:border="false"
:show-operations="true"
@@ -53,7 +51,6 @@
@input-change="handleDetailsChange"
@delete-row="handleDeleteRow"
/>
- <div style="margin-top: 20px;" v-else>鏆傛棤鏁版嵁锛岃閫夋嫨閰嶇疆鏁版嵁</div>
</div>
@@ -70,12 +67,13 @@
v-model="innerVisible"
width="1000"
title="閫夋嫨閰嶇疆鏁版嵁"
+ center
append-to-body
>
<ETable
@selection-change="handleSelectionChange"
:showOperations="false"
- :columns="formalDatabaseDataColumns"
+ :columns="formalDatabaseColumns"
:tableData="formalDatabaseData"
height="400"
@cell-edit="handleCellEdit"
@@ -91,10 +89,12 @@
<script setup>
import { ref, reactive, watch } from "vue";
-import ETable from "@/components/Table/EtableModify.vue";
+import ETable from "@/components/Table/ETable.vue";
+import ETableModify from "@/components/Table/EtableModify.vue";
import ProductionDetailsTable from "./ProductionDetailsTable.vue";
import { ElMessage } from "element-plus";
import { Delete, Warning, Plus } from "@element-plus/icons-vue";
+import { getOfficialAll } from "@/api/production/index.js";
const props = defineProps({
visible: {
@@ -123,37 +123,24 @@
const tableData = ref([]);
const currentRow = ref(null);
const columns = [
- { label: "鐓ょ", prop: "category" },
- { label: "鐑��", prop: "Calorific" },
- { label: "搴撳瓨鏁伴噺", prop: "stock" },
- { label: "鏈浣跨敤鏁伴噺", prop: "used" },
+ { label: "渚涘簲鍟嗗悕绉�", prop: "supplierName" },
+ { label: "鐓ょ", prop: "coal" },
];
const detailsTableData = ref([
- {
- coalType: "",
- calorificValue: "",
- productionQuantity: "",
- laborCost: "",
- energyCost: "",
- equipmentDepreciation: "",
- purchasePrice: "",
- totalCost: "",
- },
+
]);
const handleRowClick = (row) => {
currentRow.value = row;
};
-const formalDatabaseDataColumns = ref([
- { prop: "name", label: "渚涘簲鍟嗗悕绉�", width: 150 },
- { prop: "type", label: "鐓ょ绫诲瀷", width: 120 },
+const formalDatabaseColumns = ref([
+ { prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", width: 150 },
+ { prop: "coal", label: "鐓ょ绫诲瀷", width: 120 },
{ prop: "unit", label: "鍗曚綅", width: 100 },
- { prop: "number", label: "閲囪喘鏁伴噺", width: 100 },
- { prop: "money", label: "鍗曚环锛堝惈绋庯級", width: 120 },
- { prop: "money1", label: "鎬讳环锛堝惈绋庯級", width: 120 },
- { prop: "money2", label: "绋庣巼", width: 80 },
- { prop: "money3", label: "涓嶅惈绋庡崟浠�", width: 120 },
- { prop: "createUser", label: "鐧昏浜�", width: 100 },
- { prop: "createTime", label: "鐧昏鏃ユ湡", width: 150 },
+ { prop: "inventoryQuantity", label: "搴撳瓨鏁伴噺", width: 100 },
+ { prop: "priceIncludingTax", label: "鍗曚环锛堝惈绋庯級", width: 120 },
+ { prop: "totalPriceIncludingTax", label: "鎬讳环锛堝惈绋庯級", width: 120 },
+ { prop: "priceExcludingTax", label: "鍗曚环(涓嶅惈绋�)", width: 120 },
+ { prop: "totalPriceExcludingTax", label: "鎬讳环(涓嶅惈绋�)", width: 120 },
]);
// 琛ㄥ崟鏁版嵁
const formData = reactive({
@@ -169,8 +156,15 @@
reviewer: "",
date: "",
});
-const handlData = () => {
+const handlData =async () => {
innerVisible.value = true;
+ let res = await getOfficialAll();
+ console.log("鑾峰彇閰嶇疆鏁版嵁", res);
+ if (res.code === 200) {
+ formalDatabaseData.value = res.data;
+ } else {
+ ElMessage.error("鑾峰彇閰嶇疆鏁版嵁澶辫触");
+ }
};
const formalDatabaseData = ref([]);
const formalDatabaseSelectedData = ref([]);
@@ -344,16 +338,13 @@
(row) => row.id === item.id
);
if (!existingItem) {
- tableData.value.push({
- id: item.id,
- category: item.type,
- Calorific: item.money4,
- stock: item.number,
- used: 0, // 鍒濆浣跨敤鏁伴噺涓�0
- });
+ tableData.value.push([item, {
+ used: 0, // 娣诲姞榛樿鐨勪娇鐢ㄦ暟閲�
+ }]);
}
});
innerVisible.value = false;
+ console.log("閫変腑鐨勬暟鎹�:", tableData.value);
};
const handleSelectionChange = (selection) => {
formalDatabaseSelectedData.value = selection;
--
Gitblit v1.9.3