From c586e23d7f75fbfbff0a3114956c721c8b6ebb43 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期五, 11 七月 2025 09:31:42 +0800 Subject: [PATCH] 1.库存管理、销售出库-前端分页修改 2.销售出库,必填优化 --- src/views/calculator/index.vue | 74 ++++++++++++++++++++++++++++++++---- 1 files changed, 65 insertions(+), 9 deletions(-) diff --git a/src/views/calculator/index.vue b/src/views/calculator/index.vue index 1080232..af09bb5 100644 --- a/src/views/calculator/index.vue +++ b/src/views/calculator/index.vue @@ -90,7 +90,7 @@ placeholder="璇疯緭鍏�" style="width: 100%" /> - + <el-select v-model="item.name" v-show="item.type === '宸叉湁鐓�'" @@ -102,8 +102,8 @@ :key="ele.key" :label="ele.value" :value="ele.key" - >{{ ele.value }} - </el-option> + >{{ ele.value }} + </el-option> </el-select> </div> </el-form-item> @@ -255,8 +255,8 @@ </div> <div class="footer"> <el-button @click="cancel">閲嶇疆</el-button> - <el-button type="primary" @click="submitForm" plain> - 鏌ョ湅璁$畻缁撴灉 + <el-button type="primary" @click="addWarehoused" plain> + 娣诲姞鑷冲緟鍏ュ簱 </el-button> <el-button type="primary" @click="submitForm">璁$畻鏈�浼橀厤姣�</el-button> </div> @@ -339,6 +339,20 @@ <span class="prop-value cost" >{{ result.optimal.props.cost.toFixed(2) }} 鍏�/鍚�</span > + </div> + <div class="prop-item"> + <span class="prop-label">鐢熸垚:</span> + <el-autocomplete + v-model="result.optimal.props.createCoal" + :fetch-suggestions="querySearch" + clearable + size="small" + class="inline-input red-border" + style="width: 180px; min-height: 24px !important" + placeholder="璇疯緭鍏ョ敓鎴愮叅绉�" + @blur="handleSelect($event)" + @select="handleSelect($event)" + /> </div> </div> </div> @@ -461,7 +475,7 @@ }); const coalInfoList = ref([]); // onMounted -onMounted(async () => { +const getCoalInfo = async () => { let result = await getCoalInfoList(); if (result.code === 200) { result.data.forEach((item) => { @@ -474,6 +488,32 @@ } else { ElMessage.error("鑾峰彇鐓ょ淇℃伅澶辫触锛岃绋嶅悗閲嶈瘯"); } +}; +// 鏍规嵁 key 杩斿洖涓枃鍚嶏紝鍚﹀垯鍘熸牱杩斿洖 +const matchCoal = value => { + if (!value) return ""; + const found = coalInfoList.value.find(c => c.key === value); + return found ? found.value : value; +}; +// 鑷姩琛ュ叏鎼滅储 +const querySearch = (q, cb) => { + const res = q + ? coalInfoList.value.filter(c => c.value.includes(q)) + : coalInfoList.value; + cb(res); +}; +// 閫夋嫨/澶辩劍鏃讹紝浼樺厛瀛� key锛屾壘涓嶅埌鍒欏瓨鍘熷�� +const handleSelect = item => { + const val = item.value || (item.target && item.target.value) || ""; + const found = coalInfoList.value.find(c => c.value === val || c.key === val); + result.value.optimal.props.createCoal = found ? found.key : val; + let match = matchCoal(result.value.optimal.props.createCoal); + if (match && match !== result.value.optimal.props.createCoal) { + result.value.optimal.props.createCoal = match; + } +}; +onMounted(async () => { + getCoalInfo(); }); // 绾挎�ц鍒掓眰瑙e嚱鏁� const solveBlend = (coals, constraints) => { @@ -616,9 +656,18 @@ }; ElMessage.success("琛ㄥ崟宸查噸缃�"); }; - +const addWarehoused = () => { + if(!result.value){ + ElMessage.warning("璇峰厛璁$畻鏈�浼橀厤姣斿悗鍐嶆坊鍔犺嚦寰呭叆搴�"); + return; + } + if(result.value.optimal.props.createCoal === "") { + ElMessage.warning("璇峰厛閫夋嫨鐢熸垚鐓ょ"); + return; + } + console.log(result.value) +}; const submitForm = () => { - console.log(coalForms.value) // 鏁版嵁楠岃瘉 let validCoals = coalForms.value.filter( (coal) => coal.name && coal.cv && coal.price @@ -760,7 +809,7 @@ }; </script> -<style scoped> +<style scoped lang="scss"> .view { display: flex; gap: 10px; @@ -992,6 +1041,7 @@ background: #f5f7fa; border-radius: 4px; font-size: 13px; + align-items: center; } .prop-label { @@ -1150,4 +1200,10 @@ padding: 4px 8px; } } +:deep(.el-input__wrapper) { + min-height: 24px !important; +} +:deep(.el-input__inner) { + min-height: 24px !important; +} </style> -- Gitblit v1.9.3