From 9cbf54543334ff0166656a971899c45807c08275 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 01 七月 2025 14:05:47 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- src/views/calculator/index.vue | 42 ++++++++++++++++++++++++++++++++++-------- 1 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/views/calculator/index.vue b/src/views/calculator/index.vue index 9e6fe8c..1080232 100644 --- a/src/views/calculator/index.vue +++ b/src/views/calculator/index.vue @@ -68,7 +68,8 @@ style="margin-bottom: 15px" > <el-row :gutter="16"> - <el-col :span="6"> <el-form-item label="鐓ょ绫诲瀷"> + <el-col :span="6"> + <el-form-item label="鐓ょ绫诲瀷"> <el-select v-model="item.type" placeholder="璇烽�夋嫨" @@ -79,7 +80,8 @@ <el-option label="鏈煡鐓�" value="鏈煡鐓�" /> </el-select> </el-form-item> - </el-col> <el-col :span="6"> + </el-col> + <el-col :span="6"> <el-form-item :label="'鐓ょ' + (index + 1)"> <div class="input-wrapper"> <el-input @@ -88,14 +90,20 @@ placeholder="璇疯緭鍏�" style="width: 100%" /> + <el-select v-model="item.name" v-show="item.type === '宸叉湁鐓�'" placeholder="璇烽�夋嫨" style="width: 100%" > - <el-option label="宸叉湁鐓�" value="宸叉湁鐓�" /> - <el-option label="鏈煡鐓�" value="鏈煡鐓�" /> + <el-option + v-for="ele in coalInfoList" + :key="ele.key" + :label="ele.value" + :value="ele.key" + >{{ ele.value }} + </el-option> </el-select> </div> </el-form-item> @@ -397,8 +405,9 @@ </template> <script setup> -import { reactive, toRefs, nextTick } from "vue"; +import { reactive, toRefs, nextTick, onMounted } from "vue"; import { ElMessage, ElMessageBox } from "element-plus"; +import { getCoalInfoList } from "@/api/procureMent"; // 鍋囪鏈変竴涓狝PI鑾峰彇鐓ょ淇℃伅 const data = reactive({ formInline: { @@ -450,7 +459,22 @@ error: null, }, }); - +const coalInfoList = ref([]); +// onMounted +onMounted(async () => { + let result = await getCoalInfoList(); + if (result.code === 200) { + result.data.forEach((item) => { + let obj = { + value: item.coal, + key: item.id, + }; + coalInfoList.value.push(obj); + }); + } else { + ElMessage.error("鑾峰彇鐓ょ淇℃伅澶辫触锛岃绋嶅悗閲嶈瘯"); + } +}); // 绾挎�ц鍒掓眰瑙e嚱鏁� const solveBlend = (coals, constraints) => { // 鏁版嵁楠岃瘉 @@ -594,6 +618,7 @@ }; const submitForm = () => { + console.log(coalForms.value) // 鏁版嵁楠岃瘉 let validCoals = coalForms.value.filter( (coal) => coal.name && coal.cv && coal.price @@ -724,13 +749,14 @@ sulfur: "", ash: "", moisture: "", - }); } + }); + } }; // 澶勭悊鐓ょ绫诲瀷鍙樺寲 const handleCoalTypeChange = (index) => { // 褰撶叅绉嶇被鍨嬫敼鍙樻椂锛屾竻绌虹叅绉嶅悕绉帮紝閬垮厤鏁版嵁娣蜂贡 - coalForms.value[index].name = ''; + coalForms.value[index].name = ""; }; </script> -- Gitblit v1.9.3