From 0f4dc4ea8a7de1ffdf34a640c79c29d55b79321c Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期五, 13 六月 2025 17:53:27 +0800
Subject: [PATCH] 添加生产管理接口及优化表格字段
---
src/views/production/components/ProductionDialog.vue | 244 ++++++++++--------------------------------------
1 files changed, 54 insertions(+), 190 deletions(-)
diff --git a/src/views/production/components/ProductionDialog.vue b/src/views/production/components/ProductionDialog.vue
index 7ce8482..b75a3e2 100644
--- a/src/views/production/components/ProductionDialog.vue
+++ b/src/views/production/components/ProductionDialog.vue
@@ -1,4 +1,4 @@
-<template>
+div<template>
<el-dialog
v-model="dialogVisible"
:title="dialogType === 'add' ? '鏂板鐢熶骇鍔犲伐' : '缂栬緫鐢熶骇鍔犲伐'"
@@ -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"
@@ -17,7 +16,7 @@
@row-click="handleRowClick"
:editableColumns="['used']"
/>
- <div v-if="tableData.length > 0" class="empty-table">
+ <div class="empty-table">
<h1>鐢熶骇鏄庣粏</h1>
<el-row :gutter="10">
<el-col :span="2">
@@ -52,8 +51,8 @@
@input-change="handleDetailsChange"
@delete-row="handleDeleteRow"
/>
+
</div>
- <div style="margin-top: 20px;" v-else>鏆傛棤鏁版嵁锛岃閫夋嫨閰嶇疆鏁版嵁</div>
<template #footer>
<div class="dialog-footer">
@@ -68,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"
@@ -89,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: {
@@ -121,37 +123,32 @@
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" },
+ { label: "鍗曚环(涓嶅惈绋�)", prop: "priceExcludingTax" },
+ { label: "搴撳瓨鏁伴噺", prop: "inventoryQuantity" },
+ {
+ label: "浣跨敤鏁伴噺",
+ prop: "used",
+ editable: true,
+ width: 120,
+ editType: "number",
+ },
+
];
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 },
- { 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 },
+const formalDatabaseColumns = ref([
+ { prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", minwidth: 150 },
+ { prop: "coal", label: "鐓ょ绫诲瀷", minwidth: 60 },
+ { prop: "inventoryQuantity", label: "搴撳瓨鏁伴噺", minwidth: 80 },
+ { prop: "unit", label: "鍗曚綅", minwidth: 100 },
+ { prop: "priceExcludingTax", label: "鍗曚环锛堜笉鍚◣锛�", minwidth: 80 },
+ { prop: "createTime", label: "鐧昏鏃ユ湡", minwidth: 400 },
]);
// 琛ㄥ崟鏁版嵁
const formData = reactive({
@@ -167,162 +164,22 @@
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([]);
formalDatabaseData.value = [
- {
- id: 1,
- name: "渚涘簲鍟咥",
- type: "鍔ㄥ姏鐓�",
- unit: "鍚�",
- number: 120,
- money: 500,
- money1: 200,
- money2: 200,
- money3: 300,
- money4: "楂樹綅",
- createUser: "admin",
- createTime: "2025-06-01",
- },
- {
- id: 2,
- name: "渚涘簲鍟咥",
- type: "鍔ㄥ姏鐓�",
- unit: "鍚�",
- number: 100,
- money: 600,
- money1: 300,
- money2: 300,
- money3: 300,
- money4: "浣庝綅",
- createUser: "admin",
- createTime: "2025-06-01",
- },
- {
- id: 3,
- name: "渚涘簲鍟咮",
- type: "鐒︾叅",
- unit: "鍚�",
- number: 300,
- money: 789,
- money1: 400,
- money2: 400,
- money3: 400,
- money4: "楂樹綅",
- createUser: "admin",
- createTime: "2025-06-01",
- },
- {
- id: 4,
- name: "渚涘簲鍟咮",
- type: "鐒︾叅",
- unit: "鍚�",
- number: 256,
- money: 800,
- money1: 420,
- money2: 420,
- money3: 420,
- money4: "浣庝綅",
- createUser: "admin",
- createTime: "2025-06-01",
- },
- {
- id: 5,
- name: "渚涘簲鍟咰",
- type: "鏃犵儫鐓�",
- unit: "鍚�",
- number: 256,
- money: 700,
- money1: 300,
- money2: 300,
- money3: 300,
- money4: "楂樹綅",
- createUser: "admin",
- createTime: "2025-06-01",
- },
- {
- id: 6,
- name: "渚涘簲鍟咥",
- type: "鍔ㄥ姏鐓�",
- unit: "鍚�",
- number: 120,
- money: 500,
- money1: 200,
- money2: 200,
- money3: 300,
- money4: "楂樹綅",
- createUser: "admin",
- createTime: "2025-06-01",
- },
- {
- id: 7,
- name: "渚涘簲鍟咥",
- type: "鍔ㄥ姏鐓�",
- unit: "鍚�",
- number: 100,
- money: 600,
- money1: 300,
- money2: 300,
- money3: 300,
- money4: "浣庝綅",
- createUser: "admin",
- createTime: "2025-06-01",
- },
- {
- id: 8,
- name: "渚涘簲鍟咮",
- type: "鐒︾叅",
- unit: "鍚�",
- number: 300,
- money: 789,
- money1: 400,
- money2: 400,
- money3: 400,
- money4: "楂樹綅",
- createUser: "admin",
- createTime: "2025-06-01",
- },
- {
- id: 9,
- name: "渚涘簲鍟咮",
- type: "鐒︾叅",
- unit: "鍚�",
- number: 256,
- money: 800,
- money1: 420,
- money2: 420,
- money3: 420,
- money4: "浣庝綅",
- createUser: "admin",
- createTime: "2025-06-01",
- },
- {
- id: 10,
- name: "渚涘簲鍟咰",
- type: "鏃犵儫鐓�",
- unit: "鍚�",
- number: 256,
- money: 700,
- money1: 300,
- money2: 300,
- money3: 300,
- money4: "楂樹綅",
- createUser: "admin",
- createTime: "2025-06-01",
- },
];
-
-// 琛ㄥ崟楠岃瘉瑙勫垯
-const rules = {
- category: [{ required: true, message: "璇烽�夋嫨鐓ょ", trigger: "change" }],
-};
-
// 鍒濆鍖�
const Initialization = () => {
- console.log("鍒濆鍖栨暟鎹�");
tableData.value = [];
};
defineExpose({
@@ -342,13 +199,11 @@
(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(
+ Object.assign({}, item, {
+ used: 0, // 鍒濆浣跨敤鏁伴噺涓�0
+ })
+ );
}
});
innerVisible.value = false;
@@ -365,7 +220,13 @@
// 鎻愪氦琛ㄥ崟
const handleSubmit = async () => {
+ console.log("鎻愪氦琛ㄥ崟鏁版嵁:", tableData.value);
console.log(detailsTableData.value);
+ let data = {
+ productionList: detailsTableData.value,
+ productionInventoryList: tableData.value,
+ };
+ console.log("鎻愪氦鏁版嵁", data);
// dialogVisible.value = false;
};
@@ -400,13 +261,13 @@
const addNewRow = () => {
detailsTableData.value.push({
coalType: "",
- calorificValue: "",
productionQuantity: "",
laborCost: "",
- energyCost: "",
+ energyConsumptionCost: "",
equipmentDepreciation: "",
purchasePrice: "",
- totalCost: "",
+ autoCalculate: "0.00",
+ producer:"",
});
};
@@ -452,4 +313,7 @@
.el-row > .el-col > h1 {
font-weight: bolder;
}
+.empty-table > .el-row{
+ margin-bottom: 12px;
+}
</style>
--
Gitblit v1.9.3