Commit dda9b7c53724a8265cc5ca885c5aca7979791097
Merge remote-tracking branch 'origin/cjerp-1.0_20260116' into publish_cjerp
Showing
9 changed files
with
244 additions
and
19 deletions
| ... | ... | @@ -216,7 +216,10 @@ export default { |
| 216 | 216 | const m = res.data || {} |
| 217 | 217 | const next = { ...this.form, ...m } |
| 218 | 218 | next.id = m.id || m.code || id |
| 219 | - next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({ ...x })) : [] | |
| 219 | + next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({ | |
| 220 | + ...x, | |
| 221 | + assessmentExceedsAgreement: Number(x.assessmentExceedsAgreement || 0).toFixed(2) || 0.00, | |
| 222 | + })) : [] | |
| 220 | 223 | this.form = next; |
| 221 | 224 | this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; |
| 222 | 225 | this.refreshStandardName() | ... | ... |
| ... | ... | @@ -212,7 +212,10 @@ export default { |
| 212 | 212 | const next = { ...this.form, ...m } |
| 213 | 213 | next.id = m.id || m.code || id; |
| 214 | 214 | next.purchaseOrderId = m.orderId || ''; |
| 215 | - next.purchaseOrderLineList = Array.isArray(m.afterChangeSpecList) ? m.afterChangeSpecList.map(x => ({ ...x })) : [] | |
| 215 | + next.purchaseOrderLineList = Array.isArray(m.afterChangeSpecList) ? m.afterChangeSpecList.map(x => ({ | |
| 216 | + ...x, | |
| 217 | + assessmentExceedsAgreement: Number(x.assessmentExceedsAgreement || 0).toFixed(2) || 0.00, | |
| 218 | + })) : [] | |
| 216 | 219 | this.form = next; |
| 217 | 220 | this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; |
| 218 | 221 | this.refreshStandardName() | ... | ... |
| ... | ... | @@ -148,8 +148,9 @@ |
| 148 | 148 | </uni-list-item> |
| 149 | 149 | <uni-list-item title="考核超协"> |
| 150 | 150 | <template v-slot:footer> |
| 151 | - <uni-easyinput v-model="item.assessmentExceedsAgreement" placeholder="请输入考核超协" | |
| 152 | - :inputBorder="false" /> | |
| 151 | + <uni-easyinput type="digit" v-model="item.assessmentExceedsAgreement" | |
| 152 | + placeholder="请输入考核超协" :inputBorder="false" | |
| 153 | + @input="onAssessmentInput($event, idx)" @blur="onAssessmentBlur($event, idx)" /> | |
| 153 | 154 | </template> |
| 154 | 155 | </uni-list-item> |
| 155 | 156 | </view> |
| ... | ... | @@ -330,6 +331,49 @@ export default { |
| 330 | 331 | } |
| 331 | 332 | }) |
| 332 | 333 | }, |
| 334 | + onAssessmentInput(val, idx) { | |
| 335 | + const it = this.items[idx] | |
| 336 | + if (!it) return | |
| 337 | + // 允许负号、数字、小数点 | |
| 338 | + let v = String(val).replace(/[^0-9.-]/g, '') | |
| 339 | + // 处理多个小数点 | |
| 340 | + const parts = v.split('.') | |
| 341 | + if (parts.length > 2) { | |
| 342 | + v = parts[0] + '.' + parts.slice(1).join('') | |
| 343 | + } | |
| 344 | + // 处理多个负号(仅允许出现在开头) | |
| 345 | + if (v.indexOf('-') > 0) { | |
| 346 | + v = v.replace(/-/g, '') | |
| 347 | + } | |
| 348 | + if (v.startsWith('-') && (v.match(/-/g) || []).length > 1) { | |
| 349 | + v = '-' + v.replace(/-/g, '') | |
| 350 | + } | |
| 351 | + // 限制两位小数 | |
| 352 | + if (v.includes('.')) { | |
| 353 | + const [int, dec] = v.split('.') | |
| 354 | + v = int + '.' + dec.slice(0, 2) | |
| 355 | + } | |
| 356 | + this.$set(this.items[idx], 'assessmentExceedsAgreement', v) | |
| 357 | + this.emitChange() | |
| 358 | + }, | |
| 359 | + onAssessmentBlur(val, idx) { | |
| 360 | + const it = this.items[idx] | |
| 361 | + if (!it) return | |
| 362 | + let v = it.assessmentExceedsAgreement | |
| 363 | + if (!v || v === '-') { | |
| 364 | + v = '' | |
| 365 | + } else { | |
| 366 | + // 尝试转数字并保留两位小数 | |
| 367 | + const n = parseFloat(v) | |
| 368 | + if (!isNaN(n)) { | |
| 369 | + v = n.toFixed(2) | |
| 370 | + } else { | |
| 371 | + v = '' | |
| 372 | + } | |
| 373 | + } | |
| 374 | + this.$set(this.items[idx], 'assessmentExceedsAgreement', v) | |
| 375 | + this.emitChange() | |
| 376 | + }, | |
| 333 | 377 | toggleItem(idx) { |
| 334 | 378 | const it = this.items[idx] |
| 335 | 379 | if (!it) return | ... | ... |
| ... | ... | @@ -5,12 +5,14 @@ |
| 5 | 5 | <view class="section"> |
| 6 | 6 | <text class="row company">{{ form.customerName }}</text> |
| 7 | 7 | <view :class="['status', `status_${form.status}`]" /> |
| 8 | - <view class="row"><text class="label">发货日期</text><text class="value">{{ form.shipmentsDate }}</text></view> | |
| 8 | + <view class="row"><text class="label">原发货日期</text><text class="value">{{ form.shipmentsDate }}</text></view> | |
| 9 | + <view class="row"><text class="label">实际发货日期</text><text class="value">{{ form.newShipmentDate }}</text></view> | |
| 9 | 10 | <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshopName }}</text></view> |
| 10 | 11 | <view class="row"><text class="label">办事处</text><text class="value">{{ form.deptName }}</text></view> |
| 11 | 12 | <view class="row"><text class="label">区域</text><text class="value">{{ form.regionName }}</text></view> |
| 12 | 13 | <view class="row"><text class="label">交货方式</text><text class="value">{{ form.deliveryType }}</text></view> |
| 13 | 14 | <view class="row"><text class="label">目的地</text><text class="value">{{ form.destination }}</text></view> |
| 15 | + <view class="row"><text class="label">是否当日发货</text><text class="value">{{ form.onTimeShipment === true ? '是' : (form.onTimeShipment === false ? '否' : '') }}</text></view> | |
| 14 | 16 | </view> |
| 15 | 17 | |
| 16 | 18 | <!-- 产品 --> |
| ... | ... | @@ -41,6 +43,36 @@ |
| 41 | 43 | </view> |
| 42 | 44 | </view> |
| 43 | 45 | </uni-popup> |
| 46 | + <!-- 填写日期 --> | |
| 47 | + <uni-popup ref="fillDatePopup" type="bottom" :mask-click="false"> | |
| 48 | + <view class="dialog"> | |
| 49 | + <view class="dialog_header"> | |
| 50 | + <text>填写日期</text> | |
| 51 | + <view class="dialog_close" @click="closeFillDateInfo"></view> | |
| 52 | + </view> | |
| 53 | + <view class="dialog_body fill-data_body"> | |
| 54 | + <uni-list> | |
| 55 | + <uni-list-item title="原发货日期"> | |
| 56 | + <template v-slot:footer> | |
| 57 | + <view class="value">{{ fillDateForm.shipmentsDate }}</view> | |
| 58 | + </template> | |
| 59 | + </uni-list-item> | |
| 60 | + <uni-list-item> | |
| 61 | + <template v-slot:body> | |
| 62 | + <view class="item-title"><text class="required">*</text><text>实际发货日期</text></view> | |
| 63 | + </template> | |
| 64 | + <template v-slot:footer> | |
| 65 | + <uni-datetime-picker type="date" :start="todayDate" | |
| 66 | + v-model="fillDateForm.newShipmentDate" /> | |
| 67 | + </template> | |
| 68 | + </uni-list-item> | |
| 69 | + </uni-list> | |
| 70 | + </view> | |
| 71 | + <view class="dialog_footer"> | |
| 72 | + <button class="btn confirm" type="primary" @click="onFillDateSave">保存</button> | |
| 73 | + </view> | |
| 74 | + </view> | |
| 75 | + </uni-popup> | |
| 44 | 76 | <!-- 申请延期 --> |
| 45 | 77 | <uni-popup ref="applyDelayPopup" type="bottom" :mask-click="false"> |
| 46 | 78 | <view class="dialog"> |
| ... | ... | @@ -136,7 +168,7 @@ |
| 136 | 168 | </template> |
| 137 | 169 | |
| 138 | 170 | <script> |
| 139 | -import { getDetailApi, saveSignInTicket, checkApi, splitDataApi } from '@/api/invoice.js' | |
| 171 | +import { getDetailApi, saveSignInTicket, checkApi, splitDataApi, updateApi } from '@/api/invoice.js' | |
| 140 | 172 | import Product from './product.vue' |
| 141 | 173 | import DetailButtons from '@/components/detail-buttons/index.vue' |
| 142 | 174 | import FileUpload from '@/components/file-upload/index.vue' |
| ... | ... | @@ -154,12 +186,18 @@ export default { |
| 154 | 186 | // { text: '编辑', visible: true, variant: 'outline', event: 'edit' }, |
| 155 | 187 | { text: '填写实发数', visible: true, variant: 'outline', event: 'fill' }, |
| 156 | 188 | { text: '上传签收单据', visible: true, variant: 'primary', event: 'upload' }, |
| 189 | + { text: '填写日期', visible: true, variant: 'primary', event: 'fillDate' }, | |
| 157 | 190 | ], |
| 158 | 191 | uploadFile: { id: '', name: '' }, |
| 159 | 192 | applyDelayForm: {}, |
| 160 | 193 | splitForm: { |
| 161 | 194 | initItem: {}, |
| 162 | 195 | }, |
| 196 | + fillDateForm: { | |
| 197 | + id: '', | |
| 198 | + shipmentsDate: '', | |
| 199 | + newShipmentDate: '', | |
| 200 | + }, | |
| 163 | 201 | } |
| 164 | 202 | }, |
| 165 | 203 | computed: { |
| ... | ... | @@ -168,8 +206,10 @@ export default { |
| 168 | 206 | const e = String(m.status || '') |
| 169 | 207 | return { |
| 170 | 208 | canEdit: e === 'UN_SHIPMENTS', |
| 171 | - canFill: e === 'UN_SHIPMENTS', | |
| 209 | + // onTimeShipment 有值(true || false), 填写实发数按钮不显示 | |
| 210 | + canFill: e === 'UN_SHIPMENTS' && (m.onTimeShipment !== false && m.onTimeShipment !== true), | |
| 172 | 211 | canUpload: e === 'SHIPMENTS', |
| 212 | + canFillDate: e === 'UN_SHIPMENTS' && m.onTimeShipment === false && !m.newShipmentDate, | |
| 173 | 213 | } |
| 174 | 214 | }, |
| 175 | 215 | displayButtons() { |
| ... | ... | @@ -178,7 +218,15 @@ export default { |
| 178 | 218 | // { ...this.buttons[0], visible: f.canEdit && this.$auth.hasPermi('shipping-plan-manage:invoice:modify') }, |
| 179 | 219 | { ...this.buttons[0], visible: f.canFill && this.$auth.hasPermi('shipping-plan-manage:invoice:fill') }, |
| 180 | 220 | { ...this.buttons[1], visible: f.canUpload && this.$auth.hasPermi('shipping-plan-manage:invoice:upload') }, |
| 221 | + { ...this.buttons[2], visible: f.canFillDate && this.$auth.hasPermi('shipping-plan-manage:invoice:fill-date') }, | |
| 181 | 222 | ] |
| 223 | + }, | |
| 224 | + todayDate() { | |
| 225 | + const now = new Date() | |
| 226 | + const y = now.getFullYear() | |
| 227 | + const m = String(now.getMonth() + 1).padStart(2, '0') | |
| 228 | + const d = String(now.getDate()).padStart(2, '0') | |
| 229 | + return `${y}-${m}-${d}` | |
| 182 | 230 | } |
| 183 | 231 | }, |
| 184 | 232 | onLoad(query) { |
| ... | ... | @@ -200,6 +248,7 @@ export default { |
| 200 | 248 | // edit: () => this.onEdit(), |
| 201 | 249 | fill: () => this.onFill(), |
| 202 | 250 | upload: () => this.onUpload(), |
| 251 | + fillDate: () => this.onFillDate(), | |
| 203 | 252 | } |
| 204 | 253 | const fn = map[btn.event] |
| 205 | 254 | if (typeof fn === 'function') fn() |
| ... | ... | @@ -221,6 +270,11 @@ export default { |
| 221 | 270 | onUpload() { |
| 222 | 271 | this.$refs.uploadPopup && this.$refs.uploadPopup.open() |
| 223 | 272 | }, |
| 273 | + onFillDate() { | |
| 274 | + this.fillDateForm.id = this.form.id; | |
| 275 | + this.fillDateForm.shipmentsDate = this.form.shipmentsDate; | |
| 276 | + this.$refs.fillDatePopup && this.$refs.fillDatePopup.open() | |
| 277 | + }, | |
| 224 | 278 | downloadFile, |
| 225 | 279 | closeUploadInfo() { |
| 226 | 280 | this.uploadFile = { id: '', name: '' }; |
| ... | ... | @@ -248,6 +302,31 @@ export default { |
| 248 | 302 | uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' }) |
| 249 | 303 | } |
| 250 | 304 | }, |
| 305 | + closeFillDateInfo() { | |
| 306 | + this.uploadFile = { id: '', name: '' }; | |
| 307 | + this.$refs.fillDatePopup && this.$refs.fillDatePopup.close() | |
| 308 | + }, | |
| 309 | + async onFillDateSave() { | |
| 310 | + console.log('onFillDateSave__this.fillDateForm', this.fillDateForm) | |
| 311 | + if (!this.fillDateForm.newShipmentDate) { | |
| 312 | + uni.showToast({ | |
| 313 | + title: '请选择实际发货日期', | |
| 314 | + icon: 'none' | |
| 315 | + }) | |
| 316 | + return | |
| 317 | + } | |
| 318 | + const params = { | |
| 319 | + id: this.fillDateForm.id, | |
| 320 | + newShipmentDate: this.fillDateForm.newShipmentDate, | |
| 321 | + } | |
| 322 | + try { | |
| 323 | + await updateApi(params) | |
| 324 | + uni.showToast({ title: '保存成功', icon: 'success' }) | |
| 325 | + setTimeout(() => { uni.redirectTo({ url: '/pages/invoice/index' }) }, 300) | |
| 326 | + } catch (e) { | |
| 327 | + uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' }) | |
| 328 | + } | |
| 329 | + }, | |
| 251 | 330 | // 申请延期 |
| 252 | 331 | applyDelayFun(id) { |
| 253 | 332 | getShipmentPlanDetailApi(id).then(res => { |
| ... | ... | @@ -501,6 +580,7 @@ export default { |
| 501 | 580 | padding: 12rpx 4rpx 24rpx; |
| 502 | 581 | max-height: 70vh; |
| 503 | 582 | overflow-y: auto; |
| 583 | + | |
| 504 | 584 | } |
| 505 | 585 | |
| 506 | 586 | .split_body { |
| ... | ... | @@ -740,4 +820,11 @@ export default { |
| 740 | 820 | } |
| 741 | 821 | } |
| 742 | 822 | } |
| 823 | +.fill-data_body { | |
| 824 | + ::v-deep .uni-list-item { | |
| 825 | + &__container { | |
| 826 | + align-items: center; | |
| 827 | + } | |
| 828 | + } | |
| 829 | +} | |
| 743 | 830 | </style> | ... | ... |
| ... | ... | @@ -2,6 +2,14 @@ |
| 2 | 2 | <view class="page"> |
| 3 | 3 | <scroll-view class="scroll" scroll-y> |
| 4 | 4 | <uni-list> |
| 5 | + <view class="section"> | |
| 6 | + <uni-list-item class="select-item" :class="form.onTimeShipment != null ? 'is-filled' : 'is-empty'" clickable | |
| 7 | + @click="openShipmentSheet" :rightText="onTimeShipmentText" showArrow> | |
| 8 | + <template v-slot:body> | |
| 9 | + <view class="item-title"><text>是否当日发货</text></view> | |
| 10 | + </template> | |
| 11 | + </uni-list-item> | |
| 12 | + </view> | |
| 5 | 13 | <!-- 产品 --> |
| 6 | 14 | <view class="section2"> |
| 7 | 15 | <!-- mode="add" 允许编辑 --> |
| ... | ... | @@ -24,24 +32,36 @@ |
| 24 | 32 | </view> |
| 25 | 33 | </view> |
| 26 | 34 | </uni-popup> |
| 35 | + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" | |
| 36 | + @confirm="onSheetConfirm" /> | |
| 27 | 37 | </view> |
| 28 | 38 | </template> |
| 29 | 39 | |
| 30 | 40 | <script> |
| 31 | 41 | import { listByShipmentOrderId, dataReplenishInput } from '@/api/invoice.js' |
| 32 | 42 | import Product from './product.vue' |
| 43 | +import SingleSelectSheet from '@/components/single-select/index.vue' | |
| 33 | 44 | |
| 34 | 45 | export default { |
| 35 | 46 | name: 'InvoiceFill', |
| 36 | - components: { Product }, | |
| 47 | + components: { Product, SingleSelectSheet }, | |
| 37 | 48 | data() { |
| 38 | 49 | return { |
| 39 | 50 | form: { |
| 40 | 51 | id: '', |
| 41 | - detailList: [] | |
| 52 | + detailList: [], | |
| 53 | + onTimeShipment: true | |
| 42 | 54 | }, |
| 43 | 55 | initDetailList: [], |
| 44 | - customerName: '' | |
| 56 | + customerName: '', | |
| 57 | + sheet: { visible: false, title: '请选择', options: [], value: '' } | |
| 58 | + } | |
| 59 | + }, | |
| 60 | + computed: { | |
| 61 | + onTimeShipmentText() { | |
| 62 | + if (this.form.onTimeShipment === true) return '是' | |
| 63 | + if (this.form.onTimeShipment === false) return '否' | |
| 64 | + return '请选择' | |
| 45 | 65 | } |
| 46 | 66 | }, |
| 47 | 67 | onLoad(query) { |
| ... | ... | @@ -109,6 +129,17 @@ export default { |
| 109 | 129 | this.$refs.confirmPopup && this.$refs.confirmPopup.close(); |
| 110 | 130 | this.submitData(type); |
| 111 | 131 | }, |
| 132 | + openShipmentSheet() { | |
| 133 | + this.sheet = { | |
| 134 | + visible: true, | |
| 135 | + title: '是否当日发货', | |
| 136 | + options: [{ label: '是', value: true }, { label: '否', value: false }], | |
| 137 | + value: this.form.onTimeShipment | |
| 138 | + } | |
| 139 | + }, | |
| 140 | + onSheetConfirm({ value }) { | |
| 141 | + this.form.onTimeShipment = value | |
| 142 | + }, | |
| 112 | 143 | async submitData(type) { |
| 113 | 144 | this.loading = true; |
| 114 | 145 | const params = {}; |
| ... | ... | @@ -126,6 +157,7 @@ export default { |
| 126 | 157 | params.id = this.form.id || ''; |
| 127 | 158 | params.detailList = detailList; |
| 128 | 159 | params.type = type || ''; |
| 160 | + params.onTimeShipment = this.form.onTimeShipment; | |
| 129 | 161 | console.log(params); |
| 130 | 162 | |
| 131 | 163 | try { | ... | ... |
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | <view class="page"> |
| 3 | 3 | <view class="dev-list-fixed"> |
| 4 | 4 | <view class="search-row"> |
| 5 | - <uni-search-bar v-model="searchKeyword" radius="6" placeholder="请输入购货单位" clearButton="auto" | |
| 5 | + <uni-search-bar v-model="searchKeyword" radius="6" placeholder="请输入购货单位或者发货单编号" clearButton="auto" | |
| 6 | 6 | cancelButton="none" bgColor="#F3F3F3" textColor="rgba(0,0,0,0.4)" @confirm="search" |
| 7 | 7 | @input="onSearchInput" /> |
| 8 | 8 | <view class="tool-icons"> |
| ... | ... | @@ -26,6 +26,9 @@ |
| 26 | 26 | </view> |
| 27 | 27 | </view> |
| 28 | 28 | <view class="info-row"> |
| 29 | + <text>发货单编号</text><text>{{ item.code || '-' }}</text> | |
| 30 | + </view> | |
| 31 | + <view class="info-row"> | |
| 29 | 32 | <text>生产厂</text><text>{{ item.workshopName || '-' }}</text> |
| 30 | 33 | </view> |
| 31 | 34 | <view class="info-row"> |
| ... | ... | @@ -35,7 +38,10 @@ |
| 35 | 38 | <text>交货方式</text><text>{{ item.deliveryType || '-' }}</text> |
| 36 | 39 | </view> |
| 37 | 40 | <view class="info-row"> |
| 38 | - <text>发货日期</text><text>{{ item.shipmentsDate || '-' }}</text> | |
| 41 | + <text>是否当日发货</text><text>{{ item.onTimeShipment === true ? '是' : (item.onTimeShipment === false ? '否' : '-') || '-' }}</text> | |
| 42 | + </view> | |
| 43 | + <view class="info-row"> | |
| 44 | + <text>原发货日期</text><text>{{ item.shipmentsDate || '-' }}</text> | |
| 39 | 45 | </view> |
| 40 | 46 | </view> |
| 41 | 47 | </template> |
| ... | ... | @@ -68,7 +74,7 @@ |
| 68 | 74 | </view> |
| 69 | 75 | |
| 70 | 76 | <view class="form-item"> |
| 71 | - <view class="label">订货日期</view> | |
| 77 | + <view class="label">原发货日期</view> | |
| 72 | 78 | <uni-datetime-picker type="daterange" v-model="model.dateRange" start="2023-01-01" @change="onDateChange($event, model)"/> |
| 73 | 79 | </view> |
| 74 | 80 | </view> |
| ... | ... | @@ -132,7 +138,7 @@ export default { |
| 132 | 138 | computed: { |
| 133 | 139 | extraCombined() { |
| 134 | 140 | return { |
| 135 | - customerName: this.searchKeywordDebounced || undefined | |
| 141 | + searchKey: this.searchKeywordDebounced || undefined | |
| 136 | 142 | } |
| 137 | 143 | } |
| 138 | 144 | }, |
| ... | ... | @@ -253,7 +259,7 @@ export default { |
| 253 | 259 | delete params.dateRange |
| 254 | 260 | } |
| 255 | 261 | if (this.searchKeywordDebounced) { |
| 256 | - params.customerName = this.searchKeywordDebounced | |
| 262 | + params.searchKey = this.searchKeywordDebounced | |
| 257 | 263 | } |
| 258 | 264 | return queryApi(params) |
| 259 | 265 | .then(res => { | ... | ... |
| ... | ... | @@ -316,7 +316,10 @@ export default { |
| 316 | 316 | const m = res.data || {} |
| 317 | 317 | const next = { ...this.form, ...m } |
| 318 | 318 | next.id = m.id || m.code || id |
| 319 | - next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({ ...x })) : [] | |
| 319 | + next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({ | |
| 320 | + ...x, | |
| 321 | + assessmentExceedsAgreement: Number(x.assessmentExceedsAgreement || 0).toFixed(2) || 0.00, | |
| 322 | + })) : [] | |
| 320 | 323 | this.form = next; |
| 321 | 324 | this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; |
| 322 | 325 | this.refreshStandardName() | ... | ... |
| ... | ... | @@ -225,7 +225,10 @@ export default { |
| 225 | 225 | const m = res.data || {} |
| 226 | 226 | const next = { ...this.form, ...m } |
| 227 | 227 | next.id = m.id || m.code || id |
| 228 | - next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({ ...x })) : [] | |
| 228 | + next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({ | |
| 229 | + ...x, | |
| 230 | + assessmentExceedsAgreement: Number(x.assessmentExceedsAgreement || 0).toFixed(2) || 0.00, | |
| 231 | + })) : [] | |
| 229 | 232 | this.form = next; |
| 230 | 233 | this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; |
| 231 | 234 | this.refreshStandardName() | ... | ... |
| ... | ... | @@ -75,9 +75,10 @@ |
| 75 | 75 | </uni-list-item> |
| 76 | 76 | <uni-list-item title="考核超协"> |
| 77 | 77 | <template v-slot:footer> |
| 78 | - <uni-easyinput :disabled="pageType === 'modify'" | |
| 78 | + <uni-easyinput type="digit" :disabled="pageType === 'modify'" | |
| 79 | 79 | v-model="item.assessmentExceedsAgreement" |
| 80 | - :placeholder="pageType === 'modify' ? '' : '请输入考核超协'" :inputBorder="false" /> | |
| 80 | + :placeholder="pageType === 'modify' ? '' : '请输入考核超协'" :inputBorder="false" | |
| 81 | + @input="onAssessmentInput($event, idx)" @blur="onAssessmentBlur($event, idx)" /> | |
| 81 | 82 | </template> |
| 82 | 83 | </uni-list-item> |
| 83 | 84 | </uni-list> |
| ... | ... | @@ -223,6 +224,49 @@ export default { |
| 223 | 224 | toggleViewCollapse() { |
| 224 | 225 | this.collapsedView = !this.collapsedView |
| 225 | 226 | }, |
| 227 | + onAssessmentInput(val, idx) { | |
| 228 | + const it = this.items[idx] | |
| 229 | + if (!it) return | |
| 230 | + // 允许负号、数字、小数点 | |
| 231 | + let v = String(val).replace(/[^0-9.-]/g, '') | |
| 232 | + // 处理多个小数点 | |
| 233 | + const parts = v.split('.') | |
| 234 | + if (parts.length > 2) { | |
| 235 | + v = parts[0] + '.' + parts.slice(1).join('') | |
| 236 | + } | |
| 237 | + // 处理多个负号(仅允许出现在开头) | |
| 238 | + if (v.indexOf('-') > 0) { | |
| 239 | + v = v.replace(/-/g, '') | |
| 240 | + } | |
| 241 | + if (v.startsWith('-') && (v.match(/-/g) || []).length > 1) { | |
| 242 | + v = '-' + v.replace(/-/g, '') | |
| 243 | + } | |
| 244 | + // 限制两位小数 | |
| 245 | + if (v.includes('.')) { | |
| 246 | + const [int, dec] = v.split('.') | |
| 247 | + v = int + '.' + dec.slice(0, 2) | |
| 248 | + } | |
| 249 | + this.$set(this.items[idx], 'assessmentExceedsAgreement', v) | |
| 250 | + this.emitChange() | |
| 251 | + }, | |
| 252 | + onAssessmentBlur(val, idx) { | |
| 253 | + const it = this.items[idx] | |
| 254 | + if (!it) return | |
| 255 | + let v = it.assessmentExceedsAgreement | |
| 256 | + if (!v || v === '-') { | |
| 257 | + v = '' | |
| 258 | + } else { | |
| 259 | + // 尝试转数字并保留两位小数 | |
| 260 | + const n = parseFloat(v) | |
| 261 | + if (!isNaN(n)) { | |
| 262 | + v = n.toFixed(2) | |
| 263 | + } else { | |
| 264 | + v = '' | |
| 265 | + } | |
| 266 | + } | |
| 267 | + this.$set(this.items[idx], 'assessmentExceedsAgreement', v) | |
| 268 | + this.emitChange() | |
| 269 | + }, | |
| 226 | 270 | onDeliveryChange(e, item, idx) { |
| 227 | 271 | const getStr = (x) => { |
| 228 | 272 | if (x && x.detail && x.detail.value !== undefined) return x.detail.value | ... | ... |