| | |
| | | <text class="form-label required">车牌号</text> |
| | | <up-input v-model="editForm.licensePlateNo" placeholder="请输入车牌号" /> |
| | | </view> |
| | | |
| | | <view class="form-row"> |
| | | <text class="form-label required">毛重(吨)</text> |
| | | <text class="form-label">单位</text> |
| | | <up-radio-group v-model="editForm.unit" class="unit-radio-group"> |
| | | <up-radio |
| | | v-for="opt in unitOptions" |
| | | :key="opt.value" |
| | | :label="opt.label" |
| | | :name="opt.value" |
| | | ></up-radio> |
| | | </up-radio-group> |
| | | </view> |
| | | |
| | | <view class="form-row"> |
| | | <text class="form-label required">毛重</text> |
| | | <up-input v-model="editForm.grossWeight" type="digit" placeholder="请输入毛重" @blur="computeNetWeightEdit" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label required">皮重(吨)</text> |
| | | <text class="form-label required">皮重</text> |
| | | <up-input v-model="editForm.tareWeight" type="digit" placeholder="请输入皮重" @blur="computeNetWeightEdit" /> |
| | | </view> |
| | | <view class="form-row"> |
| | | <text class="form-label required">净重(吨)</text> |
| | | <text class="form-label required">净重</text> |
| | | <up-input v-model="editForm.netWeight" type="digit" placeholder="自动计算" disabled /> |
| | | </view> |
| | | <view class="form-row"> |
| | |
| | | const editForm = reactive({ |
| | | id: null, |
| | | licensePlateNo: '', |
| | | unit: '吨', |
| | | grossWeight: '', |
| | | tareWeight: '', |
| | | netWeight: '', |
| | |
| | | weighingOperator: '', |
| | | remark: '' |
| | | }) |
| | | |
| | | const unitOptions = [ |
| | | { label: '吨', value: '吨' }, |
| | | { label: '公斤', value: '公斤' } |
| | | ] |
| | | |
| | | const normalizeUnit = (u) => { |
| | | if (!u) return '吨' |
| | | const s = String(u).trim() |
| | | if (s === '吨' || s === 't' || s === 'ton' || s === 'tonne') return '吨' |
| | | if ( |
| | | s === '公斤' || |
| | | s === 'kg' || |
| | | s === 'kilogram' || |
| | | s === '千克' || |
| | | s === 'kilograms' |
| | | ) |
| | | return '公斤' |
| | | return '吨' |
| | | } |
| | | |
| | | const computeNetWeightEdit = () => { |
| | | const gross = Number(editForm.grossWeight) |
| | |
| | | |
| | | const handleEdit = (row) => { |
| | | Object.assign(editForm, row || {}) |
| | | editForm.unit = normalizeUnit(editForm.unit) |
| | | computeNetWeightEdit() |
| | | showEditModal.value = true |
| | | } |
| | |
| | | color: #f56c6c; |
| | | margin-right: 6rpx; |
| | | } |
| | | .unit-radio-group { |
| | | display: flex; |
| | | gap: 24rpx; |
| | | align-items: center; |
| | | flex-wrap: wrap; |
| | | } |
| | | .selector-trigger { |
| | | display: flex; |
| | | align-items: center; |