From 7ffa19f1fe3b37519e83ed1f86715154b13c00f3 Mon Sep 17 00:00:00 2001 From: maven <2163098428@qq.com> Date: 星期二, 26 八月 2025 15:16:10 +0800 Subject: [PATCH] yys 生产管控(完成基础逻辑) --- src/views/production/components/ProductionDetailsTable.vue | 41 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 1 deletions(-) diff --git a/src/views/production/components/ProductionDetailsTable.vue b/src/views/production/components/ProductionDetailsTable.vue index dd89b4b..43be265 100644 --- a/src/views/production/components/ProductionDetailsTable.vue +++ b/src/views/production/components/ProductionDetailsTable.vue @@ -1,5 +1,24 @@ <template> <el-table :data="tableData" :border="border" style="width: 100%"> + <el-table-column label="鐓ゆ枡绫诲瀷" min-width="120"> + <template #default="{ row, $index }"> + <el-select + clearable + v-model="row.type" + placeholder="璇烽�夋嫨鐓ゆ枡绫诲瀷" + filterable + :key="`coalId-select-${$index}-${typeList.length}`" + :disabled="isViewMode" + > + <el-option + v-for="(item, index) of typeList" + :key="`option-${index}-${item.value}`" + :label="item.label" + :value="item.value" + /> + </el-select> + </template> + </el-table-column> <el-table-column label="鐓ょ" min-width="120"> <template #default="{ row, $index }"> <el-select @@ -50,10 +69,13 @@ <el-table-column label="鑳借�楁垚鏈�" min-width="120"> <template #default="{ row, $index }"> + <!-- 涓嶈兘涓鸿礋鏁� --> <el-input v-model="row.energyConsumptionCost" placeholder="璇疯緭鍏ヨ兘鑰楁垚鏈�" type="number" + min="0" + step="0.01" @input="handleInput('energyConsumptionCost', $index, $event)" :disabled="isViewMode" > @@ -156,10 +178,21 @@ <script setup name="ProductionDetailsTable"> import {ref, computed, watch, onMounted, nextTick} from "vue"; import {Delete} from "@element-plus/icons-vue"; +import {ElMessage} from "element-plus"; import {getCoalFieldList} from "@/api/basicInformation/coalQualityMaintenance"; import {getCoalInfoList} from "@/api/production"; import {userListAll} from "@/api/publicApi"; +const typeList = [ + { + label: "鎴愬搧", + value: 1, + }, + { + label: "鍘熸枡", + value: 2, + } + ] const props = defineProps({ modelValue: { type: Array, @@ -197,6 +230,11 @@ // 澶勭悊杈撳叆鍙樺寲 const handleInput = (field, index, value) => { + // 纭繚杈撳叆鍊兼槸鏁板瓧鎴栫┖瀛楃涓茶�屼笖闈炶礋鏁� + if (!/^\d*\.?\d*$/.test(value) && value !== "") { + ElMessage.error("璇疯緭鍏ユ湁鏁堢殑鏁板瓧"); + return; + } const newData = [...tableData.value]; newData[index][field] = value; @@ -220,7 +258,7 @@ // 璁$畻鎬绘垚鏈� const calculateTotalCost = (row) => { const laborCost = parseFloat(row.laborCost) || 0; - const energyCost = parseFloat(row.energyCost) || 0; + const energyCost = parseFloat(row.energyConsumptionCost) || 0; const equipmentDepreciation = parseFloat(row.equipmentDepreciation) || 0; const purchasePrice = parseFloat(row.purchasePrice) || 0; @@ -378,6 +416,7 @@ purchasePrice: "", totalCost: "", producerId: "", + type: 1, ...rowData, }; tableData.value = [...tableData.value, defaultRow]; -- Gitblit v1.9.3