From 1594be1c2fcfbcd4d75627da70bdc2a843c9e4e6 Mon Sep 17 00:00:00 2001 From: 刘淇 <290219706@qq.com> Date: Sat, 24 Oct 2026 15:55:08 +0800 Subject: [PATCH] type==1 改为数字加减器 --- pages-sub/daily/maintain-manage/add-record.vue | 39 +++++++++++++++++++++++++++++++-------- pages-sub/daily/maintain-manage/index.vue | 6 ++++-- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/pages-sub/daily/maintain-manage/add-record.vue b/pages-sub/daily/maintain-manage/add-record.vue index 847127c..78383f6 100644 --- a/pages-sub/daily/maintain-manage/add-record.vue +++ b/pages-sub/daily/maintain-manage/add-record.vue @@ -14,12 +14,8 @@ - - - + + {{ item.unit }} {{ item.unit }} @@ -448,6 +444,10 @@ export default { } else { this.inspectForm[field.fieldCode] = '' } + if(field.fieldType === 1){ + // 数值步进器默认0 + this.qtyMap[field.fieldCode] = 0 +} // 初始化展示label为空 this.labelMap[field.fieldCode] = '' // 7图片/8附件的文件列表(驱动 up-upload 与自绘文件列表展示) @@ -661,6 +661,24 @@ export default { */ buildRequiredRule(field: any) { const type = field.fieldType +// ========= 新增:数值类型单独校验 ========= +if (type === 1) { + return { + required: true, + trigger: ['change'], + validator: (rule, value, callback) => { + // 注意:type1现在模型在 qtyMap,value 不是表单模型!这里拿不到真实值 + const realVal = this.qtyMap[rule.field] + if (realVal === null || realVal === undefined) { + callback(new Error(`请填写${rule.fieldName}`)) + } else { + callback() + } + } + } +} + + if (type === 6 || type === 7 || type === 8) { const action = type === 6 ? '请选择' : '请上传' return { @@ -881,7 +899,8 @@ export default { } if (type === 1) { - fields.push({ fieldCode: code, valueNumber: Number(value) }) + const numVal = this.qtyMap[code] + fields.push({ fieldCode: code, valueNumber: Number(numVal) }) } else if (type === 3 && item.optionSource === 3) { // 物料:value_text 存物料ID;数量>0 才落物料三列(0 表示本次不领用) const qty = Number(this.qtyMap[code] || 0) @@ -1182,7 +1201,9 @@ export default { display: flex; align-items: center; gap: 16rpx; - +:deep(.u-number-box__input) { + width: 80px!important; + } // 输入框占满剩余宽度(原 u-number-box 自带固定宽度,换成 up-input 后需显式撑开) .number-input-wrap { flex: 1; @@ -1323,4 +1344,6 @@ export default { font-weight: 500; } } + + diff --git a/pages-sub/daily/maintain-manage/index.vue b/pages-sub/daily/maintain-manage/index.vue index ecd722b..253a528 100644 --- a/pages-sub/daily/maintain-manage/index.vue +++ b/pages-sub/daily/maintain-manage/index.vue @@ -43,9 +43,10 @@ box-shadow="0 4rpx 16rpx rgba(17, 24, 39, 0.06)" v-for="(item,index) in currentList" :key="`${item.planNo}_${index}`" + @click="goToDetail(item)" > -