feat: 更新版本号至1.3.23并新增真实库区选择器组件
refactor(warehouse-picker): 重构逻辑库区选择器组件 feat(actual-warehouse-picker): 新增真实库区选择器组件 fix(easycode.vue): 调整钢卷质量状态校验逻辑 style(search.vue): 优化表单样式和字段显示
This commit is contained in:
@@ -7,7 +7,9 @@
|
||||
<text class="picker-text" :class="{ 'picker-placeholder': !itemType }">
|
||||
{{ itemType === 'product' ? '成品' : itemType === 'raw_material' ? '原料' : '请选择物品类型' }}
|
||||
</text>
|
||||
<text class="picker-arrow" v-if="!disabled">▼</text>
|
||||
<!-- ✅ 互斥显示:选中类型=清除按钮 未选中=下拉箭头 -->
|
||||
<!-- <text class="picker-clear" v-if="itemType && !disabled" @click.stop.prevent="handleClearItemType">✕</text> -->
|
||||
<text class="picker-arrow">▼</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -18,7 +20,9 @@
|
||||
<text class="picker-text" :class="{ 'picker-placeholder': !selectedName }">
|
||||
{{ loadingProducts ? '加载中...' : selectedName || '请选择产品' }}
|
||||
</text>
|
||||
<text class="picker-arrow" v-if="!disabled && !loadingProducts">▼</text>
|
||||
<!-- ✅ 互斥显示:选中产品=清除按钮 未选中/加载中=下拉箭头 -->
|
||||
<text class="picker-clear" v-if="selectedName && !disabled && !loadingProducts" @click.stop.prevent="handleClearProduct">✕</text>
|
||||
<text class="picker-arrow" v-else-if="!disabled && !loadingProducts">▼</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -29,7 +33,9 @@
|
||||
<text class="picker-text" :class="{ 'picker-placeholder': !selectedName }">
|
||||
{{ loadingRawMaterials ? '加载中...' : selectedName || '请选择原材料' }}
|
||||
</text>
|
||||
<text class="picker-arrow" v-if="!disabled && !loadingRawMaterials">▼</text>
|
||||
<!-- ✅ 互斥显示:选中原料=清除按钮 未选中/加载中=下拉箭头 -->
|
||||
<text class="picker-clear" v-if="selectedName && !disabled && !loadingRawMaterials" @click.stop.prevent="handleClearRawMaterial">✕</text>
|
||||
<text class="picker-arrow" v-else-if="!disabled && !loadingRawMaterials">▼</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -259,7 +265,6 @@
|
||||
const keyword = this.rawMaterialSearchKeyword.trim().toLowerCase();
|
||||
this.filteredRawMaterials = keyword
|
||||
? this.rawMaterials.filter(m => {
|
||||
console.log(m.specification)
|
||||
// 只基于原材料名称过滤,且确保是原材料数据
|
||||
return (m.rawMaterialName && m.rawMaterialName.toLowerCase().includes(keyword))
|
||||
|| m?.specification?.toLowerCase()?.includes(keyword)
|
||||
@@ -324,13 +329,36 @@
|
||||
},
|
||||
closeRawMaterialPicker() {
|
||||
this.$refs.rawMaterialPopup.close();
|
||||
},
|
||||
|
||||
// ✅ 新增核心清除方法1:清空物品类型 + 所有关联数据(完全重置)
|
||||
handleClearItemType() {
|
||||
this.$emit('update:itemType', '');
|
||||
this.$emit('update:itemId', undefined);
|
||||
this.$emit('update:materialType', undefined);
|
||||
this.selectedName = '';
|
||||
uni.showToast({ title: '已清空物品类型', icon: 'none' });
|
||||
},
|
||||
|
||||
// ✅ 新增核心清除方法2:仅清空选中的产品,保留物品类型为成品
|
||||
handleClearProduct() {
|
||||
this.$emit('update:itemId', undefined);
|
||||
this.selectedName = '';
|
||||
uni.showToast({ title: '已清空产品选择', icon: 'none' });
|
||||
},
|
||||
|
||||
// ✅ 新增核心清除方法3:仅清空选中的原材料,保留物品类型为原料
|
||||
handleClearRawMaterial() {
|
||||
this.$emit('update:itemId', undefined);
|
||||
this.selectedName = '';
|
||||
uni.showToast({ title: '已清空原材料选择', icon: 'none' });
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 样式保持不变 */
|
||||
/* 样式保持不变 + 新增清除按钮样式 */
|
||||
.form-item-optional {
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
@@ -347,6 +375,7 @@
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
padding: 0 24rpx;
|
||||
padding-right: 60rpx; // ✅ 新增:给清除按钮/箭头预留空间,防止文本遮挡
|
||||
background: #f8f9fa;
|
||||
border: 2rpx solid #e8e8e8;
|
||||
border-radius: 12rpx;
|
||||
@@ -382,6 +411,23 @@
|
||||
color: #999;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
// ✅ 新增:清除按钮样式,与箭头风格统一,点击有按压反馈
|
||||
.picker-clear {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 8rpx;
|
||||
border-radius: 50%;
|
||||
&:active {
|
||||
background-color: #e8e8e8;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.warehouse-popup {
|
||||
|
||||
Reference in New Issue
Block a user