Showing
17 changed files
with
622 additions
and
26 deletions
| ... | ... | @@ -64,7 +64,8 @@ export function assayApplyBreedOptionsApi(params) { |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * 新增化验送样单 |
| 67 | - * data: { weighingTicketId, procurementPlanId, productId, department } | |
| 67 | + * data: { code, weighingTicketId, procurementPlanId, productId, department, | |
| 68 | + * lines: [{ sampleNo, sampleCode }] } | |
| 68 | 69 | */ |
| 69 | 70 | export function assayApplyCreateApi(data) { |
| 70 | 71 | return request({ |
| ... | ... | @@ -88,7 +89,8 @@ export function assayApplyDetailApi(params) { |
| 88 | 89 | |
| 89 | 90 | /** |
| 90 | 91 | * 修改化验送样单 |
| 91 | - * data: { id, weighingTicketId, procurementPlanId, productId, department } | |
| 92 | + * data: { id, code, weighingTicketId, procurementPlanId, productId, department, | |
| 93 | + * lines: [{ sampleNo, sampleCode }] } | |
| 92 | 94 | */ |
| 93 | 95 | export function assayApplyUpdateApi(data) { |
| 94 | 96 | return request({ | ... | ... |
| ... | ... | @@ -263,6 +263,7 @@ export default { |
| 263 | 263 | this.applyDetailOptions = (list || []).map(item => ({ |
| 264 | 264 | assayApplyId: item.assayApplyId || item.id || '', |
| 265 | 265 | assayApplyCode: item.assayApplyCode || '', |
| 266 | + sampleCode: item.sampleCode || '', | |
| 266 | 267 | productName: item.productName || '', |
| 267 | 268 | category: item.category || '', |
| 268 | 269 | productId: item.productId || '', | ... | ... |
| ... | ... | @@ -26,6 +26,11 @@ |
| 26 | 26 | </view> |
| 27 | 27 | </picker> |
| 28 | 28 | </view> |
| 29 | + <!-- 取样编号:随送样编号带出,固定展示 --> | |
| 30 | + <view class="row"> | |
| 31 | + <text class="label">取样编号</text> | |
| 32 | + <text class="value">{{ row.sampleCode || '-' }}</text> | |
| 33 | + </view> | |
| 29 | 34 | <view class="row"> |
| 30 | 35 | <text class="label">样品</text> |
| 31 | 36 | <text class="value">{{ row.category || '-' }}</text> |
| ... | ... | @@ -101,7 +106,8 @@ export default { |
| 101 | 106 | quantity: item ? item.quantity : '', |
| 102 | 107 | testCode: String(index + 1), |
| 103 | 108 | assayApplyCode: (item && item.assayApplyCode) || '', |
| 104 | - assayApplyId: (item && item.assayApplyId) || '' | |
| 109 | + assayApplyId: (item && item.assayApplyId) || '', | |
| 110 | + sampleCode: (item && item.sampleCode) || '' | |
| 105 | 111 | } |
| 106 | 112 | ALL_COMPONENT_KEYS.forEach(key => { |
| 107 | 113 | row[key] = (item && item[key] !== undefined && item[key] !== null) ? item[key] : null |
| ... | ... | @@ -153,6 +159,7 @@ export default { |
| 153 | 159 | row.assayApplyId = item.assayApplyId || '' |
| 154 | 160 | row.category = item.category || '' |
| 155 | 161 | row.quantity = item.quantity !== undefined && item.quantity !== null ? item.quantity : '' |
| 162 | + row.sampleCode = item.sampleCode || '' | |
| 156 | 163 | }, |
| 157 | 164 | // 成份值输入:仅允许数字与小数点,空值重置为 null |
| 158 | 165 | onComponentInput(e, index, key) { | ... | ... |
| ... | ... | @@ -34,6 +34,7 @@ |
| 34 | 34 | <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> |
| 35 | 35 | <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view> |
| 36 | 36 | <view class="row"><text class="label">送样编号</text><text class="value">{{ safeText(item.assayApplyCode) }}</text></view> |
| 37 | + <view class="row"><text class="label">取样编号</text><text class="value">{{ safeText(item.sampleCode) }}</text></view> | |
| 37 | 38 | <view v-for="key in componentKeys" :key="key" class="row"> |
| 38 | 39 | <text class="label">{{ componentLabels[key] || key }}</text> |
| 39 | 40 | <text class="value">{{ formatNumber(item[key]) }}</text> | ... | ... |
| ... | ... | @@ -29,6 +29,7 @@ |
| 29 | 29 | <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> |
| 30 | 30 | <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view> |
| 31 | 31 | <view class="row"><text class="label">送样编号</text><text class="value">{{ safeText(item.assayApplyCode) }}</text></view> |
| 32 | + <view class="row"><text class="label">取样编号</text><text class="value">{{ safeText(item.sampleCode) }}</text></view> | |
| 32 | 33 | <view v-for="key in componentKeys" :key="key" class="row"> |
| 33 | 34 | <text class="label">{{ componentLabels[key] || key }}</text> |
| 34 | 35 | <text class="value">{{ formatNumber(item[key]) }}</text> | ... | ... |
| ... | ... | @@ -255,6 +255,7 @@ export default { |
| 255 | 255 | const list = ((res && res.data) || []).map(item => ({ |
| 256 | 256 | assayApplyId: item.assayApplyId || item.id || '', |
| 257 | 257 | assayApplyCode: item.assayApplyCode || '', |
| 258 | + sampleCode: item.sampleCode || '', | |
| 258 | 259 | productName: item.productName || '', |
| 259 | 260 | category: item.category || '', |
| 260 | 261 | productId: item.productId || '', |
| ... | ... | @@ -357,6 +358,7 @@ export default { |
| 357 | 358 | const list = ((res && res.data) || []).map(item => ({ |
| 358 | 359 | assayApplyId: item.assayApplyId || item.id || '', |
| 359 | 360 | assayApplyCode: item.assayApplyCode || '', |
| 361 | + sampleCode: item.sampleCode || '', | |
| 360 | 362 | productName: item.productName || '', |
| 361 | 363 | category: item.category || '', |
| 362 | 364 | productId: item.productId || '', | ... | ... |
| ... | ... | @@ -30,6 +30,7 @@ |
| 30 | 30 | <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> |
| 31 | 31 | <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view> |
| 32 | 32 | <view class="row"><text class="label">送样编号</text><text class="value">{{ safeText(item.assayApplyCode) }}</text></view> |
| 33 | + <view class="row"><text class="label">取样编号</text><text class="value">{{ safeText(item.sampleCode) }}</text></view> | |
| 33 | 34 | <view v-for="key in componentKeys" :key="key" class="row"> |
| 34 | 35 | <text class="label">{{ componentLabels[key] || key }}</text> |
| 35 | 36 | <text class="value">{{ formatNumber(item[key]) }}</text> | ... | ... |
| ... | ... | @@ -66,6 +66,39 @@ |
| 66 | 66 | </uni-list-item> |
| 67 | 67 | </uni-list> |
| 68 | 68 | |
| 69 | + <!-- 取样明细(可编辑) --> | |
| 70 | + <view class="sub-table"> | |
| 71 | + <view class="header"> | |
| 72 | + <image class="opCollapse" src="/static/images/title.png" /> | |
| 73 | + <text class="title">取样明细</text> | |
| 74 | + <view class="ops"> | |
| 75 | + <image class="opAdd" @click="addSampleLine" src="/static/images/plus.png" /> | |
| 76 | + </view> | |
| 77 | + </view> | |
| 78 | + <view class="add-list"> | |
| 79 | + <view v-if="!sampleLines.length" class="empty-tip">暂无明细,请添加</view> | |
| 80 | + <view v-for="(item, idx) in sampleLines" :key="'s-' + (item.id || idx)" class="block"> | |
| 81 | + <uni-list> | |
| 82 | + <uni-list-item title="取样次序"> | |
| 83 | + <template v-slot:footer> | |
| 84 | + <uni-easyinput :value="item.sampleNo" :inputBorder="false" disabled /> | |
| 85 | + </template> | |
| 86 | + </uni-list-item> | |
| 87 | + <uni-list-item title="取样编号"> | |
| 88 | + <template v-slot:footer> | |
| 89 | + <uni-easyinput :value="item.sampleCode" :inputBorder="false" disabled /> | |
| 90 | + </template> | |
| 91 | + </uni-list-item> | |
| 92 | + </uni-list> | |
| 93 | + <view class="block-ops"> | |
| 94 | + <div class="del" @click="removeSampleLine(idx)"> | |
| 95 | + <image src="/static/images/delete.png" class="icon" />删除 | |
| 96 | + </div> | |
| 97 | + </view> | |
| 98 | + </view> | |
| 99 | + </view> | |
| 100 | + </view> | |
| 101 | + | |
| 69 | 102 | <view class="footer"> |
| 70 | 103 | <button class="btn submit" type="primary" @click="onSubmit">保存</button> |
| 71 | 104 | </view> |
| ... | ... | @@ -101,6 +134,8 @@ export default { |
| 101 | 134 | productId: '', |
| 102 | 135 | department: '' |
| 103 | 136 | }, |
| 137 | + // 取样明细(可编辑) | |
| 138 | + sampleLines: [], | |
| 104 | 139 | dicOptions: { DEPARTMENT: [] }, |
| 105 | 140 | // 计划编号下拉选项(所选码单下的计划) |
| 106 | 141 | planOptions: [], |
| ... | ... | @@ -130,6 +165,12 @@ export default { |
| 130 | 165 | return (this.dicOptions.DEPARTMENT || []).map(it => it.name) |
| 131 | 166 | } |
| 132 | 167 | }, |
| 168 | + watch: { | |
| 169 | + // 送样编号生成/变更后同步刷新取样编号 | |
| 170 | + 'form.code'() { | |
| 171 | + this.syncSampleCode() | |
| 172 | + } | |
| 173 | + }, | |
| 133 | 174 | created() { |
| 134 | 175 | this.ticketSheet.fetchFn = this.fetchTickets.bind(this) |
| 135 | 176 | this.loadDicData() |
| ... | ... | @@ -247,6 +288,31 @@ export default { |
| 247 | 288 | if (!opt) return |
| 248 | 289 | this.form.department = opt.code != null ? String(opt.code) : '' |
| 249 | 290 | }, |
| 291 | + // 取样明细-新增一行(取样次序从1开始递增,取样编号=送样编号_次序) | |
| 292 | + addSampleLine() { | |
| 293 | + const lines = this.sampleLines || [] | |
| 294 | + const sampleNo = String(lines.length + 1) | |
| 295 | + lines.push({ | |
| 296 | + id: genRowId(), | |
| 297 | + sampleNo, | |
| 298 | + sampleCode: `${this.form.code || ''}_${sampleNo}` | |
| 299 | + }) | |
| 300 | + this.sampleLines = lines | |
| 301 | + }, | |
| 302 | + // 取样明细-删除行并按当前顺序重新连续编号 | |
| 303 | + removeSampleLine(idx) { | |
| 304 | + this.sampleLines.splice(idx, 1) | |
| 305 | + this.syncSampleCode() | |
| 306 | + }, | |
| 307 | + // 按当前顺序重新生成取样次序与取样编号 | |
| 308 | + syncSampleCode() { | |
| 309 | + const code = this.form.code || '' | |
| 310 | + ;(this.sampleLines || []).forEach((item, index) => { | |
| 311 | + const sampleNo = String(index + 1) | |
| 312 | + item.sampleNo = sampleNo | |
| 313 | + item.sampleCode = `${code}_${sampleNo}` | |
| 314 | + }) | |
| 315 | + }, | |
| 250 | 316 | validate() { |
| 251 | 317 | const f = this.form |
| 252 | 318 | if (!f.code) return this.tip('请生成送样编号') |
| ... | ... | @@ -254,6 +320,8 @@ export default { |
| 254 | 320 | if (!f.procurementPlanId) return this.tip('请选择计划编号') |
| 255 | 321 | if (!f.productId) return this.tip('请选择品种') |
| 256 | 322 | if (!f.department) return this.tip('请选择科室') |
| 323 | + // 取样明细必填:至少添加一行 | |
| 324 | + if (!this.sampleLines.length) return this.tip('请至少添加一行取样明细') | |
| 257 | 325 | return true |
| 258 | 326 | }, |
| 259 | 327 | tip(msg) { |
| ... | ... | @@ -272,7 +340,12 @@ export default { |
| 272 | 340 | weighingTicketId: this.form.weighingTicketId, |
| 273 | 341 | procurementPlanId: this.form.procurementPlanId, |
| 274 | 342 | productId: this.form.productId, |
| 275 | - department: this.form.department | |
| 343 | + department: this.form.department, | |
| 344 | + // 取样明细(仅提交业务字段) | |
| 345 | + lines: (this.sampleLines || []).map(it => ({ | |
| 346 | + sampleNo: it.sampleNo, | |
| 347 | + sampleCode: it.sampleCode | |
| 348 | + })) | |
| 276 | 349 | }) |
| 277 | 350 | .then(() => { |
| 278 | 351 | uni.hideLoading() |
| ... | ... | @@ -287,6 +360,11 @@ export default { |
| 287 | 360 | } |
| 288 | 361 | } |
| 289 | 362 | } |
| 363 | + | |
| 364 | +// 生成前端临时行 id | |
| 365 | +function genRowId() { | |
| 366 | + return 'row_' + Date.now().toString(36) + '_' + Math.random().toString(36).slice(2, 8) | |
| 367 | +} | |
| 290 | 368 | </script> |
| 291 | 369 | |
| 292 | 370 | <style lang="scss" scoped> |
| ... | ... | @@ -357,6 +435,29 @@ export default { |
| 357 | 435 | &__container { |
| 358 | 436 | padding: 32rpx; |
| 359 | 437 | |
| 438 | + .uni-easyinput { | |
| 439 | + &__placeholder-class { | |
| 440 | + font-size: 32rpx; | |
| 441 | + color: rgba(0, 0, 0, 0.4); | |
| 442 | + } | |
| 443 | + | |
| 444 | + &__content { | |
| 445 | + border: none; | |
| 446 | + background-color: #ffffff !important; | |
| 447 | + | |
| 448 | + &-input { | |
| 449 | + padding-left: 0 !important; | |
| 450 | + height: 48rpx; | |
| 451 | + line-height: 48rpx; | |
| 452 | + font-size: 32rpx; | |
| 453 | + } | |
| 454 | + | |
| 455 | + .content-clear-icon { | |
| 456 | + font-size: 44rpx !important; | |
| 457 | + } | |
| 458 | + } | |
| 459 | + } | |
| 460 | + | |
| 360 | 461 | .item-title, |
| 361 | 462 | .uni-list-item__content { |
| 362 | 463 | flex: none; |
| ... | ... | @@ -435,4 +536,81 @@ export default { |
| 435 | 536 | color: rgba(0, 0, 0, 0.4); |
| 436 | 537 | } |
| 437 | 538 | } |
| 539 | + | |
| 540 | +.sub-table { | |
| 541 | + margin-top: 20rpx; | |
| 542 | + background: #fff; | |
| 543 | +} | |
| 544 | + | |
| 545 | +.header { | |
| 546 | + display: flex; | |
| 547 | + align-items: center; | |
| 548 | + padding: 24rpx 32rpx; | |
| 549 | + border-bottom: 1rpx solid #f0f0f0; | |
| 550 | + | |
| 551 | + .opCollapse { | |
| 552 | + width: 32rpx; | |
| 553 | + height: 28rpx; | |
| 554 | + margin-right: 16rpx; | |
| 555 | + margin-top: 8rpx; | |
| 556 | + } | |
| 557 | + | |
| 558 | + .title { | |
| 559 | + font-size: 32rpx; | |
| 560 | + color: rgba(0, 0, 0, 0.9); | |
| 561 | + font-weight: 600; | |
| 562 | + flex: 1; | |
| 563 | + } | |
| 564 | + | |
| 565 | + .ops { | |
| 566 | + display: flex; | |
| 567 | + align-items: center; | |
| 568 | + | |
| 569 | + .opAdd { | |
| 570 | + width: 40rpx; | |
| 571 | + height: 40rpx; | |
| 572 | + } | |
| 573 | + } | |
| 574 | +} | |
| 575 | + | |
| 576 | +.add-list { | |
| 577 | + padding: 0 0 16rpx; | |
| 578 | + | |
| 579 | + .empty-tip { | |
| 580 | + text-align: center; | |
| 581 | + padding: 60rpx 0; | |
| 582 | + color: rgba(0, 0, 0, 0.4); | |
| 583 | + font-size: 28rpx; | |
| 584 | + } | |
| 585 | + | |
| 586 | + .block { | |
| 587 | + border-bottom: 1rpx solid #f0f0f0; | |
| 588 | + | |
| 589 | + &:last-child { | |
| 590 | + border-bottom: none; | |
| 591 | + } | |
| 592 | + | |
| 593 | + .block-ops { | |
| 594 | + display: flex; | |
| 595 | + align-items: center; | |
| 596 | + justify-content: flex-end; | |
| 597 | + gap: 48rpx; | |
| 598 | + padding: 20rpx 32rpx; | |
| 599 | + background: #f8f8f8; | |
| 600 | + | |
| 601 | + .del { | |
| 602 | + display: flex; | |
| 603 | + align-items: center; | |
| 604 | + font-size: 28rpx; | |
| 605 | + color: #d54941; | |
| 606 | + | |
| 607 | + .icon { | |
| 608 | + width: 32rpx; | |
| 609 | + height: 32rpx; | |
| 610 | + margin-right: 8rpx; | |
| 611 | + } | |
| 612 | + } | |
| 613 | + } | |
| 614 | + } | |
| 615 | +} | |
| 438 | 616 | </style> | ... | ... |
| ... | ... | @@ -13,6 +13,26 @@ |
| 13 | 13 | <view class="row"><text class="label">创建人</text><text class="value">{{ safeText(form.createBy) }}</text></view> |
| 14 | 14 | <view class="row"><text class="label">创建时间</text><text class="value">{{ safeText(form.createTime) }}</text></view> |
| 15 | 15 | </view> |
| 16 | + | |
| 17 | + <!-- 取样明细 --> | |
| 18 | + <view class="sub-table"> | |
| 19 | + <view class="sub-header"> | |
| 20 | + <image class="sub-bar" src="/static/images/title.png" /> | |
| 21 | + <text class="sub-title">取样明细</text> | |
| 22 | + <view class="sub-toggle" @click="toggle('sample')"> | |
| 23 | + <image class="sub-toggle_icon" :src="collapse.sample ? '/static/images/down.png' : '/static/images/up.png'" /> | |
| 24 | + <text class="sub-toggle_text">{{ collapse.sample ? '展开' : '收起' }}</text> | |
| 25 | + </view> | |
| 26 | + </view> | |
| 27 | + <view v-if="!collapse.sample" class="sub-body"> | |
| 28 | + <view v-if="!sampleLines.length" class="empty-tip">暂无明细</view> | |
| 29 | + <view v-for="(item, idx) in sampleLines" :key="'s-' + idx" class="card"> | |
| 30 | + <view class="card-index">第 {{ idx + 1 }} 行</view> | |
| 31 | + <view class="row"><text class="label">取样次序</text><text class="value">{{ safeText(item.sampleNo) }}</text></view> | |
| 32 | + <view class="row"><text class="label">取样编号</text><text class="value">{{ safeText(item.sampleCode) }}</text></view> | |
| 33 | + </view> | |
| 34 | + </view> | |
| 35 | + </view> | |
| 16 | 36 | </view> |
| 17 | 37 | </scroll-view> |
| 18 | 38 | <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> |
| ... | ... | @@ -36,6 +56,9 @@ export default { |
| 36 | 56 | return { |
| 37 | 57 | id: '', |
| 38 | 58 | form: {}, |
| 59 | + // 取样明细 | |
| 60 | + sampleLines: [], | |
| 61 | + collapse: { sample: false }, | |
| 39 | 62 | currentUserId: '', |
| 40 | 63 | dicOptions: { |
| 41 | 64 | DEPARTMENT: [], |
| ... | ... | @@ -107,6 +130,9 @@ export default { |
| 107 | 130 | this.loadDetail() |
| 108 | 131 | }, |
| 109 | 132 | methods: { |
| 133 | + toggle(key) { | |
| 134 | + this.collapse = { ...this.collapse, [key]: !this.collapse[key] } | |
| 135 | + }, | |
| 110 | 136 | async loadDicData() { |
| 111 | 137 | try { |
| 112 | 138 | const results = await getDicByCodes(['DEPARTMENT', 'AUDIT_STATUS']) |
| ... | ... | @@ -134,6 +160,8 @@ export default { |
| 134 | 160 | .then(res => { |
| 135 | 161 | const data = res && res.data ? res.data : {} |
| 136 | 162 | this.form = Object.assign({}, data) |
| 163 | + // 取样明细回显 | |
| 164 | + this.sampleLines = Array.isArray(data.lines) ? data.lines.map(x => ({ ...x })) : [] | |
| 137 | 165 | }) |
| 138 | 166 | .catch(() => { |
| 139 | 167 | uni.showToast({ title: '详情加载失败', icon: 'none' }) |
| ... | ... | @@ -280,4 +308,80 @@ export default { |
| 280 | 308 | word-break: break-all; |
| 281 | 309 | } |
| 282 | 310 | } |
| 311 | + | |
| 312 | +.sub-table { | |
| 313 | + background: #fff; | |
| 314 | + margin-bottom: 20rpx; | |
| 315 | +} | |
| 316 | +.sub-header { | |
| 317 | + display: flex; | |
| 318 | + align-items: center; | |
| 319 | + padding: 16rpx 0 16rpx 32rpx; | |
| 320 | + .sub-bar { width: 6rpx; height: 32rpx; margin-right: 14rpx; } | |
| 321 | + .sub-title { font-size: 30rpx; font-weight: 600; color: rgba(0, 0, 0, 0.9); flex: 1; line-height: 42rpx; } | |
| 322 | + .sub-toggle { | |
| 323 | + display: flex; | |
| 324 | + align-items: center; | |
| 325 | + padding: 0 12rpx; | |
| 326 | + height: 56rpx; | |
| 327 | + .sub-toggle_icon { width: 24rpx; height: 24rpx; margin-right: 8rpx; } | |
| 328 | + .sub-toggle_text { font-size: 26rpx; color: rgba(0, 0, 0, 0.6); } | |
| 329 | + } | |
| 330 | +} | |
| 331 | +.sub-body { | |
| 332 | + padding: 0 32rpx 24rpx; | |
| 333 | + .empty-tip { | |
| 334 | + text-align: center; | |
| 335 | + padding: 60rpx 0; | |
| 336 | + color: rgba(0, 0, 0, 0.4); | |
| 337 | + font-size: 28rpx; | |
| 338 | + } | |
| 339 | + .card { | |
| 340 | + position: relative; | |
| 341 | + background: #fafafa; | |
| 342 | + border-radius: 12rpx; | |
| 343 | + padding: 32rpx 28rpx 20rpx; | |
| 344 | + margin-bottom: 24rpx; | |
| 345 | + &:last-child { margin-bottom: 0; } | |
| 346 | + .card-index { | |
| 347 | + position: absolute; | |
| 348 | + top: 0; | |
| 349 | + right: 0; | |
| 350 | + background: rgba(24, 144, 255, 0.08); | |
| 351 | + color: $theme-primary; | |
| 352 | + font-size: 22rpx; | |
| 353 | + line-height: 36rpx; | |
| 354 | + padding: 0 16rpx; | |
| 355 | + border-bottom-left-radius: 12rpx; | |
| 356 | + border-top-right-radius: 12rpx; | |
| 357 | + } | |
| 358 | + .row { | |
| 359 | + align-items: center; | |
| 360 | + justify-content: space-between; | |
| 361 | + padding: 14rpx 0; | |
| 362 | + margin-bottom: 0; | |
| 363 | + border-bottom: 1rpx dashed #f2f2f2; | |
| 364 | + &:last-child { border-bottom: none; } | |
| 365 | + .label { | |
| 366 | + flex-shrink: 0; | |
| 367 | + width: 220rpx; | |
| 368 | + max-width: none; | |
| 369 | + margin-right: 0; | |
| 370 | + font-size: 28rpx; | |
| 371 | + color: rgba(0, 0, 0, 0.6); | |
| 372 | + line-height: 40rpx; | |
| 373 | + } | |
| 374 | + .value { | |
| 375 | + flex: 1; | |
| 376 | + text-align: right; | |
| 377 | + font-size: 28rpx; | |
| 378 | + color: rgba(0, 0, 0, 0.9); | |
| 379 | + line-height: 40rpx; | |
| 380 | + overflow: hidden; | |
| 381 | + text-overflow: ellipsis; | |
| 382 | + white-space: nowrap; | |
| 383 | + } | |
| 384 | + } | |
| 385 | + } | |
| 386 | +} | |
| 283 | 387 | </style> | ... | ... |
| ... | ... | @@ -63,6 +63,39 @@ |
| 63 | 63 | </uni-list-item> |
| 64 | 64 | </uni-list> |
| 65 | 65 | |
| 66 | + <!-- 取样明细(可编辑) --> | |
| 67 | + <view class="sub-table"> | |
| 68 | + <view class="header"> | |
| 69 | + <image class="opCollapse" src="/static/images/title.png" /> | |
| 70 | + <text class="title">取样明细</text> | |
| 71 | + <view class="ops"> | |
| 72 | + <image class="opAdd" @click="addSampleLine" src="/static/images/plus.png" /> | |
| 73 | + </view> | |
| 74 | + </view> | |
| 75 | + <view class="add-list"> | |
| 76 | + <view v-if="!sampleLines.length" class="empty-tip">暂无明细,请添加</view> | |
| 77 | + <view v-for="(item, idx) in sampleLines" :key="'s-' + (item.id || idx)" class="block"> | |
| 78 | + <uni-list> | |
| 79 | + <uni-list-item title="取样次序"> | |
| 80 | + <template v-slot:footer> | |
| 81 | + <uni-easyinput :value="item.sampleNo" :inputBorder="false" disabled /> | |
| 82 | + </template> | |
| 83 | + </uni-list-item> | |
| 84 | + <uni-list-item title="取样编号"> | |
| 85 | + <template v-slot:footer> | |
| 86 | + <uni-easyinput :value="item.sampleCode" :inputBorder="false" disabled /> | |
| 87 | + </template> | |
| 88 | + </uni-list-item> | |
| 89 | + </uni-list> | |
| 90 | + <view class="block-ops"> | |
| 91 | + <div class="del" @click="removeSampleLine(idx)"> | |
| 92 | + <image src="/static/images/delete.png" class="icon" />删除 | |
| 93 | + </div> | |
| 94 | + </view> | |
| 95 | + </view> | |
| 96 | + </view> | |
| 97 | + </view> | |
| 98 | + | |
| 66 | 99 | <view class="footer"> |
| 67 | 100 | <button class="btn submit" type="primary" @click="onSubmit">保存</button> |
| 68 | 101 | </view> |
| ... | ... | @@ -99,6 +132,8 @@ export default { |
| 99 | 132 | productId: '', |
| 100 | 133 | department: '' |
| 101 | 134 | }, |
| 135 | + // 取样明细(可编辑) | |
| 136 | + sampleLines: [], | |
| 102 | 137 | dicOptions: { DEPARTMENT: [] }, |
| 103 | 138 | // 计划编号下拉选项(所选码单下的计划) |
| 104 | 139 | planOptions: [], |
| ... | ... | @@ -128,6 +163,12 @@ export default { |
| 128 | 163 | return (this.dicOptions.DEPARTMENT || []).map(it => it.name) |
| 129 | 164 | } |
| 130 | 165 | }, |
| 166 | + watch: { | |
| 167 | + // 送样编号变更后同步刷新取样编号 | |
| 168 | + 'form.code'() { | |
| 169 | + this.syncSampleCode() | |
| 170 | + } | |
| 171 | + }, | |
| 131 | 172 | created() { |
| 132 | 173 | this.ticketSheet.fetchFn = this.fetchTickets.bind(this) |
| 133 | 174 | this.loadDicData() |
| ... | ... | @@ -169,6 +210,8 @@ export default { |
| 169 | 210 | this.productOptions = this.form.productId |
| 170 | 211 | ? [{ label: data.productName || '', value: this.form.productId }] |
| 171 | 212 | : [] |
| 213 | + // 取样明细回显 | |
| 214 | + this.sampleLines = (Array.isArray(data.lines) ? data.lines : []).map(it => ({ ...it, id: it.id || genRowId() })) | |
| 172 | 215 | if (this.form.weighingTicketId) { |
| 173 | 216 | this.loadPlanOptions(this.form.weighingTicketId) |
| 174 | 217 | } |
| ... | ... | @@ -301,12 +344,39 @@ export default { |
| 301 | 344 | if (!opt) return |
| 302 | 345 | this.form.department = opt.code != null ? String(opt.code) : '' |
| 303 | 346 | }, |
| 347 | + // 取样明细-新增一行(取样次序从1开始递增,取样编号=送样编号_次序) | |
| 348 | + addSampleLine() { | |
| 349 | + const lines = this.sampleLines || [] | |
| 350 | + const sampleNo = String(lines.length + 1) | |
| 351 | + lines.push({ | |
| 352 | + id: genRowId(), | |
| 353 | + sampleNo, | |
| 354 | + sampleCode: `${this.form.code || ''}_${sampleNo}` | |
| 355 | + }) | |
| 356 | + this.sampleLines = lines | |
| 357 | + }, | |
| 358 | + // 取样明细-删除行并按当前顺序重新连续编号 | |
| 359 | + removeSampleLine(idx) { | |
| 360 | + this.sampleLines.splice(idx, 1) | |
| 361 | + this.syncSampleCode() | |
| 362 | + }, | |
| 363 | + // 按当前顺序重新生成取样次序与取样编号 | |
| 364 | + syncSampleCode() { | |
| 365 | + const code = this.form.code || '' | |
| 366 | + ;(this.sampleLines || []).forEach((item, index) => { | |
| 367 | + const sampleNo = String(index + 1) | |
| 368 | + item.sampleNo = sampleNo | |
| 369 | + item.sampleCode = `${code}_${sampleNo}` | |
| 370 | + }) | |
| 371 | + }, | |
| 304 | 372 | validate() { |
| 305 | 373 | const f = this.form |
| 306 | 374 | if (!f.weighingTicketId) return this.tip('请选择码单编号') |
| 307 | 375 | if (!f.procurementPlanId) return this.tip('请选择计划编号') |
| 308 | 376 | if (!f.productId) return this.tip('请选择品种') |
| 309 | 377 | if (!f.department) return this.tip('请选择科室') |
| 378 | + // 取样明细必填:至少添加一行 | |
| 379 | + if (!this.sampleLines.length) return this.tip('请至少添加一行取样明细') | |
| 310 | 380 | return true |
| 311 | 381 | }, |
| 312 | 382 | tip(msg) { |
| ... | ... | @@ -326,7 +396,12 @@ export default { |
| 326 | 396 | weighingTicketId: this.form.weighingTicketId, |
| 327 | 397 | procurementPlanId: this.form.procurementPlanId, |
| 328 | 398 | productId: this.form.productId, |
| 329 | - department: this.form.department | |
| 399 | + department: this.form.department, | |
| 400 | + // 取样明细(仅提交业务字段) | |
| 401 | + lines: (this.sampleLines || []).map(it => ({ | |
| 402 | + sampleNo: it.sampleNo, | |
| 403 | + sampleCode: it.sampleCode | |
| 404 | + })) | |
| 330 | 405 | }) |
| 331 | 406 | .then(() => { |
| 332 | 407 | uni.hideLoading() |
| ... | ... | @@ -344,6 +419,11 @@ export default { |
| 344 | 419 | } |
| 345 | 420 | } |
| 346 | 421 | } |
| 422 | + | |
| 423 | +// 生成前端临时行 id | |
| 424 | +function genRowId() { | |
| 425 | + return 'row_' + Date.now().toString(36) + '_' + Math.random().toString(36).slice(2, 8) | |
| 426 | +} | |
| 347 | 427 | </script> |
| 348 | 428 | |
| 349 | 429 | <style lang="scss" scoped> |
| ... | ... | @@ -414,6 +494,29 @@ export default { |
| 414 | 494 | &__container { |
| 415 | 495 | padding: 32rpx; |
| 416 | 496 | |
| 497 | + .uni-easyinput { | |
| 498 | + &__placeholder-class { | |
| 499 | + font-size: 32rpx; | |
| 500 | + color: rgba(0, 0, 0, 0.4); | |
| 501 | + } | |
| 502 | + | |
| 503 | + &__content { | |
| 504 | + border: none; | |
| 505 | + background-color: #ffffff !important; | |
| 506 | + | |
| 507 | + &-input { | |
| 508 | + padding-left: 0 !important; | |
| 509 | + height: 48rpx; | |
| 510 | + line-height: 48rpx; | |
| 511 | + font-size: 32rpx; | |
| 512 | + } | |
| 513 | + | |
| 514 | + .content-clear-icon { | |
| 515 | + font-size: 44rpx !important; | |
| 516 | + } | |
| 517 | + } | |
| 518 | + } | |
| 519 | + | |
| 417 | 520 | .item-title, |
| 418 | 521 | .uni-list-item__content { |
| 419 | 522 | flex: none; |
| ... | ... | @@ -476,4 +579,81 @@ export default { |
| 476 | 579 | color: rgba(0, 0, 0, 0.4); |
| 477 | 580 | } |
| 478 | 581 | } |
| 582 | + | |
| 583 | +.sub-table { | |
| 584 | + margin-top: 20rpx; | |
| 585 | + background: #fff; | |
| 586 | +} | |
| 587 | + | |
| 588 | +.header { | |
| 589 | + display: flex; | |
| 590 | + align-items: center; | |
| 591 | + padding: 24rpx 32rpx; | |
| 592 | + border-bottom: 1rpx solid #f0f0f0; | |
| 593 | + | |
| 594 | + .opCollapse { | |
| 595 | + width: 32rpx; | |
| 596 | + height: 28rpx; | |
| 597 | + margin-right: 16rpx; | |
| 598 | + margin-top: 8rpx; | |
| 599 | + } | |
| 600 | + | |
| 601 | + .title { | |
| 602 | + font-size: 32rpx; | |
| 603 | + color: rgba(0, 0, 0, 0.9); | |
| 604 | + font-weight: 600; | |
| 605 | + flex: 1; | |
| 606 | + } | |
| 607 | + | |
| 608 | + .ops { | |
| 609 | + display: flex; | |
| 610 | + align-items: center; | |
| 611 | + | |
| 612 | + .opAdd { | |
| 613 | + width: 40rpx; | |
| 614 | + height: 40rpx; | |
| 615 | + } | |
| 616 | + } | |
| 617 | +} | |
| 618 | + | |
| 619 | +.add-list { | |
| 620 | + padding: 0 0 16rpx; | |
| 621 | + | |
| 622 | + .empty-tip { | |
| 623 | + text-align: center; | |
| 624 | + padding: 60rpx 0; | |
| 625 | + color: rgba(0, 0, 0, 0.4); | |
| 626 | + font-size: 28rpx; | |
| 627 | + } | |
| 628 | + | |
| 629 | + .block { | |
| 630 | + border-bottom: 1rpx solid #f0f0f0; | |
| 631 | + | |
| 632 | + &:last-child { | |
| 633 | + border-bottom: none; | |
| 634 | + } | |
| 635 | + | |
| 636 | + .block-ops { | |
| 637 | + display: flex; | |
| 638 | + align-items: center; | |
| 639 | + justify-content: flex-end; | |
| 640 | + gap: 48rpx; | |
| 641 | + padding: 20rpx 32rpx; | |
| 642 | + background: #f8f8f8; | |
| 643 | + | |
| 644 | + .del { | |
| 645 | + display: flex; | |
| 646 | + align-items: center; | |
| 647 | + font-size: 28rpx; | |
| 648 | + color: #d54941; | |
| 649 | + | |
| 650 | + .icon { | |
| 651 | + width: 32rpx; | |
| 652 | + height: 32rpx; | |
| 653 | + margin-right: 8rpx; | |
| 654 | + } | |
| 655 | + } | |
| 656 | + } | |
| 657 | + } | |
| 658 | +} | |
| 479 | 659 | </style> | ... | ... |
| ... | ... | @@ -12,6 +12,22 @@ |
| 12 | 12 | <view class="row"><text class="label">创建人</text><text class="value">{{ safeText(form.createBy) }}</text></view> |
| 13 | 13 | <view class="row"><text class="label">创建时间</text><text class="value">{{ safeText(form.createTime) }}</text></view> |
| 14 | 14 | </view> |
| 15 | + | |
| 16 | + <!-- 取样明细 --> | |
| 17 | + <view class="sub-table"> | |
| 18 | + <view class="sub-header"> | |
| 19 | + <image class="sub-bar" src="/static/images/title.png" /> | |
| 20 | + <text class="sub-title">取样明细</text> | |
| 21 | + </view> | |
| 22 | + <view class="sub-body"> | |
| 23 | + <view v-if="!sampleLines.length" class="empty-tip">暂无明细</view> | |
| 24 | + <view v-for="(item, idx) in sampleLines" :key="'s-' + idx" class="card"> | |
| 25 | + <view class="card-index">第 {{ idx + 1 }} 行</view> | |
| 26 | + <view class="row"><text class="label">取样次序</text><text class="value">{{ safeText(item.sampleNo) }}</text></view> | |
| 27 | + <view class="row"><text class="label">取样编号</text><text class="value">{{ safeText(item.sampleCode) }}</text></view> | |
| 28 | + </view> | |
| 29 | + </view> | |
| 30 | + </view> | |
| 15 | 31 | </scroll-view> |
| 16 | 32 | </view> |
| 17 | 33 | </template> |
| ... | ... | @@ -26,6 +42,8 @@ export default { |
| 26 | 42 | data() { |
| 27 | 43 | return { |
| 28 | 44 | form: {}, |
| 45 | + // 取样明细 | |
| 46 | + sampleLines: [], | |
| 29 | 47 | dicOptions: { |
| 30 | 48 | DEPARTMENT: [], |
| 31 | 49 | AUDIT_STATUS: [] |
| ... | ... | @@ -71,6 +89,8 @@ export default { |
| 71 | 89 | .then(res => { |
| 72 | 90 | const data = res && res.data ? res.data : {} |
| 73 | 91 | this.form = Object.assign({}, data) |
| 92 | + // 取样明细回显 | |
| 93 | + this.sampleLines = Array.isArray(data.lines) ? data.lines.map(x => ({ ...x })) : [] | |
| 74 | 94 | }) |
| 75 | 95 | .catch(() => { |
| 76 | 96 | uni.showToast({ title: '详情加载失败', icon: 'none' }) |
| ... | ... | @@ -138,4 +158,95 @@ export default { |
| 138 | 158 | word-break: break-all; |
| 139 | 159 | } |
| 140 | 160 | } |
| 161 | +.sub-table { | |
| 162 | + background: #fff; | |
| 163 | + margin-bottom: 20rpx; | |
| 164 | +} | |
| 165 | +.sub-header { | |
| 166 | + display: flex; | |
| 167 | + align-items: center; | |
| 168 | + padding: 16rpx 0 16rpx 32rpx; | |
| 169 | + | |
| 170 | + .sub-bar { | |
| 171 | + width: 6rpx; | |
| 172 | + height: 32rpx; | |
| 173 | + margin-right: 14rpx; | |
| 174 | + } | |
| 175 | + | |
| 176 | + .sub-title { | |
| 177 | + font-size: 30rpx; | |
| 178 | + font-weight: 600; | |
| 179 | + color: rgba(0, 0, 0, 0.9); | |
| 180 | + flex: 1; | |
| 181 | + line-height: 42rpx; | |
| 182 | + } | |
| 183 | +} | |
| 184 | +.sub-body { | |
| 185 | + padding: 0 32rpx 24rpx; | |
| 186 | + | |
| 187 | + .empty-tip { | |
| 188 | + text-align: center; | |
| 189 | + padding: 60rpx 0; | |
| 190 | + color: rgba(0, 0, 0, 0.4); | |
| 191 | + font-size: 28rpx; | |
| 192 | + } | |
| 193 | + | |
| 194 | + .card { | |
| 195 | + position: relative; | |
| 196 | + background: #fafafa; | |
| 197 | + border-radius: 12rpx; | |
| 198 | + padding: 32rpx 28rpx 20rpx; | |
| 199 | + margin-bottom: 24rpx; | |
| 200 | + | |
| 201 | + &:last-child { | |
| 202 | + margin-bottom: 0; | |
| 203 | + } | |
| 204 | + | |
| 205 | + .card-index { | |
| 206 | + position: absolute; | |
| 207 | + top: 0; | |
| 208 | + right: 0; | |
| 209 | + background: rgba(24, 144, 255, 0.08); | |
| 210 | + color: $theme-primary; | |
| 211 | + font-size: 22rpx; | |
| 212 | + line-height: 36rpx; | |
| 213 | + padding: 0 16rpx; | |
| 214 | + border-bottom-left-radius: 12rpx; | |
| 215 | + border-top-right-radius: 12rpx; | |
| 216 | + } | |
| 217 | + | |
| 218 | + .row { | |
| 219 | + align-items: center; | |
| 220 | + justify-content: space-between; | |
| 221 | + padding: 14rpx 0; | |
| 222 | + margin-bottom: 0; | |
| 223 | + border-bottom: 1rpx dashed #f2f2f2; | |
| 224 | + | |
| 225 | + &:last-child { | |
| 226 | + border-bottom: none; | |
| 227 | + } | |
| 228 | + | |
| 229 | + .label { | |
| 230 | + flex-shrink: 0; | |
| 231 | + width: 220rpx; | |
| 232 | + max-width: none; | |
| 233 | + margin-right: 0; | |
| 234 | + font-size: 28rpx; | |
| 235 | + color: rgba(0, 0, 0, 0.6); | |
| 236 | + line-height: 40rpx; | |
| 237 | + } | |
| 238 | + | |
| 239 | + .value { | |
| 240 | + flex: 1; | |
| 241 | + text-align: right; | |
| 242 | + font-size: 28rpx; | |
| 243 | + color: rgba(0, 0, 0, 0.9); | |
| 244 | + line-height: 40rpx; | |
| 245 | + overflow: hidden; | |
| 246 | + text-overflow: ellipsis; | |
| 247 | + white-space: nowrap; | |
| 248 | + } | |
| 249 | + } | |
| 250 | + } | |
| 251 | +} | |
| 141 | 252 | </style> | ... | ... |
| ... | ... | @@ -254,7 +254,7 @@ |
| 254 | 254 | <view class="item-title"><text>来料类型备注</text></view> |
| 255 | 255 | </template> |
| 256 | 256 | <template v-slot:footer> |
| 257 | - <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypeRemark" | |
| 257 | + <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypesRemarks" | |
| 258 | 258 | type="textarea" :inputBorder="false" placeholder="请输入来料类型备注" autoHeight /> |
| 259 | 259 | </template> |
| 260 | 260 | </uni-list-item> |
| ... | ... | @@ -345,7 +345,7 @@ export default { |
| 345 | 345 | totalGrossWeight: '', |
| 346 | 346 | actualImpurityWeight: '', |
| 347 | 347 | deductionTypes: [], |
| 348 | - deductionTypeRemark: '', | |
| 348 | + deductionTypesRemarks: '', | |
| 349 | 349 | supplierStockMaterial: '', |
| 350 | 350 | logisticsStockMaterial: '', |
| 351 | 351 | plateNumber: '', |
| ... | ... | @@ -451,7 +451,7 @@ export default { |
| 451 | 451 | .filter(text => !!text) |
| 452 | 452 | if (weightItems.length) parts.push(weightItems.join('、')) |
| 453 | 453 | // 来料扣杂类型段落以「来料类型备注」文本为准(用户可自由修改) |
| 454 | - const deductionSegment = (this.form.deductionTypeRemark || '').trim() | |
| 454 | + const deductionSegment = (this.form.deductionTypesRemarks || '').trim() | |
| 455 | 455 | if (deductionSegment) parts.push(deductionSegment) |
| 456 | 456 | if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) |
| 457 | 457 | if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) |
| ... | ... | @@ -527,7 +527,7 @@ export default { |
| 527 | 527 | .filter(it => selected.includes(it.value)) |
| 528 | 528 | .map(it => it.text) |
| 529 | 529 | .filter(name => !!name) |
| 530 | - const segments = (this.form.deductionTypeRemark || '') | |
| 530 | + const segments = (this.form.deductionTypesRemarks || '') | |
| 531 | 531 | .split('、') |
| 532 | 532 | .map(text => text.trim()) |
| 533 | 533 | .filter(text => !!text) |
| ... | ... | @@ -543,7 +543,7 @@ export default { |
| 543 | 543 | const found = matched.find(item => item.name === name) |
| 544 | 544 | return found ? found.text : name |
| 545 | 545 | }) |
| 546 | - this.form.deductionTypeRemark = result.join('、') | |
| 546 | + this.form.deductionTypesRemarks = result.join('、') | |
| 547 | 547 | }, |
| 548 | 548 | // 计划选择弹窗数据源 |
| 549 | 549 | fetchPlans({ pageIndex, pageSize, extra }) { |
| ... | ... | @@ -737,6 +737,7 @@ export default { |
| 737 | 737 | netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), |
| 738 | 738 | netWeightUpper: this.computedNetWeightUpper || null, |
| 739 | 739 | deductionTypes: (this.form.deductionTypes || []).join(',') || null, |
| 740 | + deductionTypesRemarks: this.form.deductionTypesRemarks || null, | |
| 740 | 741 | supplierStockMaterial: this.form.supplierStockMaterial || null, |
| 741 | 742 | logisticsStockMaterial: this.form.logisticsStockMaterial || null, |
| 742 | 743 | plateNumber: this.form.plateNumber || null, | ... | ... |
| ... | ... | @@ -88,6 +88,7 @@ |
| 88 | 88 | <view class="row"><text class="label">货物净重(kg)</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view> |
| 89 | 89 | <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view> |
| 90 | 90 | <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> |
| 91 | + <view class="row"><text class="label">来料类型备注</text><text class="value">{{ safeText(form.deductionTypesRemarks) }}</text></view> | |
| 91 | 92 | <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view> |
| 92 | 93 | <view class="row"><text class="label">物流存欠料</text><text class="value">{{ safeText(form.logisticsStockMaterial) }}</text></view> |
| 93 | 94 | <view class="row"><text class="label">车牌号</text><text class="value">{{ safeText(form.plateNumber) }}</text></view> | ... | ... |
| ... | ... | @@ -255,7 +255,7 @@ |
| 255 | 255 | <view class="item-title"><text>来料类型备注</text></view> |
| 256 | 256 | </template> |
| 257 | 257 | <template v-slot:footer> |
| 258 | - <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypeRemark" | |
| 258 | + <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypesRemarks" | |
| 259 | 259 | type="textarea" :inputBorder="false" placeholder="请输入来料类型备注" autoHeight /> |
| 260 | 260 | </template> |
| 261 | 261 | </uni-list-item> |
| ... | ... | @@ -347,7 +347,7 @@ export default { |
| 347 | 347 | totalGrossWeight: '', |
| 348 | 348 | actualImpurityWeight: '', |
| 349 | 349 | deductionTypes: [], |
| 350 | - deductionTypeRemark: '', | |
| 350 | + deductionTypesRemarks: '', | |
| 351 | 351 | supplierStockMaterial: '', |
| 352 | 352 | logisticsStockMaterial: '', |
| 353 | 353 | plateNumber: '', |
| ... | ... | @@ -457,7 +457,7 @@ export default { |
| 457 | 457 | .filter(text => !!text) |
| 458 | 458 | if (weightItems.length) parts.push(weightItems.join('、')) |
| 459 | 459 | // 来料扣杂类型段落以「来料类型备注」文本为准(用户可自由修改) |
| 460 | - const deductionSegment = (this.form.deductionTypeRemark || '').trim() | |
| 460 | + const deductionSegment = (this.form.deductionTypesRemarks || '').trim() | |
| 461 | 461 | if (deductionSegment) parts.push(deductionSegment) |
| 462 | 462 | if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) |
| 463 | 463 | if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) |
| ... | ... | @@ -523,7 +523,7 @@ export default { |
| 523 | 523 | .filter(it => selected.includes(it.value)) |
| 524 | 524 | .map(it => it.text) |
| 525 | 525 | .filter(name => !!name) |
| 526 | - const segments = (this.form.deductionTypeRemark || '') | |
| 526 | + const segments = (this.form.deductionTypesRemarks || '') | |
| 527 | 527 | .split('、') |
| 528 | 528 | .map(text => text.trim()) |
| 529 | 529 | .filter(text => !!text) |
| ... | ... | @@ -539,7 +539,7 @@ export default { |
| 539 | 539 | const found = matched.find(item => item.name === name) |
| 540 | 540 | return found ? found.text : name |
| 541 | 541 | }) |
| 542 | - this.form.deductionTypeRemark = result.join('、') | |
| 542 | + this.form.deductionTypesRemarks = result.join('、') | |
| 543 | 543 | }, |
| 544 | 544 | // 从已保存的业务摘要中解析来料扣杂类型段落,用于回显来料类型备注 |
| 545 | 545 | extractDeductionRemark(businessSummary) { |
| ... | ... | @@ -578,14 +578,14 @@ export default { |
| 578 | 578 | totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight), |
| 579 | 579 | actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight), |
| 580 | 580 | deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [], |
| 581 | - deductionTypeRemark: '', | |
| 581 | + deductionTypesRemarks: '', | |
| 582 | 582 | supplierStockMaterial: data.supplierStockMaterial || '', |
| 583 | 583 | logisticsStockMaterial: data.logisticsStockMaterial || '', |
| 584 | 584 | plateNumber: data.plateNumber || '', |
| 585 | 585 | specialNote: data.specialNote || '' |
| 586 | 586 | } |
| 587 | - // 回显来料类型备注:优先取已保存业务摘要中的扣杂段落 | |
| 588 | - this.form.deductionTypeRemark = this.extractDeductionRemark(data.businessSummary) | |
| 587 | + // 回显来料类型备注:优先取独立字段,历史数据从业务摘要解析 | |
| 588 | + this.form.deductionTypesRemarks = this.extractDeductionRemark(data.deductionTypesRemarks || data.businessSummary) | |
| 589 | 589 | // 计划选择回显:行对象缓存供提交 planIds 使用(id 取计划明细行上的计划 id) |
| 590 | 590 | this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it })) |
| 591 | 591 | this.selectedPlanRows = this.planList.map(item => ({ |
| ... | ... | @@ -810,6 +810,7 @@ export default { |
| 810 | 810 | netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), |
| 811 | 811 | netWeightUpper: this.computedNetWeightUpper || null, |
| 812 | 812 | deductionTypes: (this.form.deductionTypes || []).join(',') || null, |
| 813 | + deductionTypesRemarks: this.form.deductionTypesRemarks || null, | |
| 813 | 814 | supplierStockMaterial: this.form.supplierStockMaterial || null, |
| 814 | 815 | logisticsStockMaterial: this.form.logisticsStockMaterial || null, |
| 815 | 816 | plateNumber: this.form.plateNumber || null, | ... | ... |
| ... | ... | @@ -200,7 +200,7 @@ |
| 200 | 200 | <view class="item-title"><text>来料类型备注</text></view> |
| 201 | 201 | </template> |
| 202 | 202 | <template v-slot:footer> |
| 203 | - <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypeRemark" | |
| 203 | + <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypesRemarks" | |
| 204 | 204 | type="textarea" :inputBorder="false" placeholder="请输入来料类型备注" autoHeight /> |
| 205 | 205 | </template> |
| 206 | 206 | </uni-list-item> |
| ... | ... | @@ -301,7 +301,7 @@ export default { |
| 301 | 301 | totalGrossWeight: '', |
| 302 | 302 | actualImpurityWeight: '', |
| 303 | 303 | deductionTypes: [], |
| 304 | - deductionTypeRemark: '', | |
| 304 | + deductionTypesRemarks: '', | |
| 305 | 305 | supplierStockMaterial: '', |
| 306 | 306 | logisticsStockMaterial: '', |
| 307 | 307 | plateNumber: '', |
| ... | ... | @@ -376,7 +376,7 @@ export default { |
| 376 | 376 | .filter(text => !!text) |
| 377 | 377 | if (weightItems.length) parts.push(weightItems.join('、')) |
| 378 | 378 | // 来料扣杂类型段落以「来料类型备注」文本为准(用户可自由修改) |
| 379 | - const deductionSegment = (this.form.deductionTypeRemark || '').trim() | |
| 379 | + const deductionSegment = (this.form.deductionTypesRemarks || '').trim() | |
| 380 | 380 | if (deductionSegment) parts.push(deductionSegment) |
| 381 | 381 | if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) |
| 382 | 382 | if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) |
| ... | ... | @@ -435,7 +435,7 @@ export default { |
| 435 | 435 | .filter(it => selected.includes(it.value)) |
| 436 | 436 | .map(it => it.text) |
| 437 | 437 | .filter(name => !!name) |
| 438 | - const segments = (this.form.deductionTypeRemark || '') | |
| 438 | + const segments = (this.form.deductionTypesRemarks || '') | |
| 439 | 439 | .split('、') |
| 440 | 440 | .map(text => text.trim()) |
| 441 | 441 | .filter(text => !!text) |
| ... | ... | @@ -451,7 +451,7 @@ export default { |
| 451 | 451 | const found = matched.find(item => item.name === name) |
| 452 | 452 | return found ? found.text : name |
| 453 | 453 | }) |
| 454 | - this.form.deductionTypeRemark = result.join('、') | |
| 454 | + this.form.deductionTypesRemarks = result.join('、') | |
| 455 | 455 | }, |
| 456 | 456 | // 从已保存的业务摘要中解析来料扣杂类型段落,用于回显来料类型备注 |
| 457 | 457 | extractDeductionRemark(businessSummary) { |
| ... | ... | @@ -488,14 +488,14 @@ export default { |
| 488 | 488 | totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight), |
| 489 | 489 | actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight), |
| 490 | 490 | deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [], |
| 491 | - deductionTypeRemark: '', | |
| 491 | + deductionTypesRemarks: '', | |
| 492 | 492 | supplierStockMaterial: data.supplierStockMaterial || '', |
| 493 | 493 | logisticsStockMaterial: data.logisticsStockMaterial || '', |
| 494 | 494 | plateNumber: data.plateNumber || '', |
| 495 | 495 | specialNote: data.specialNote || '' |
| 496 | 496 | } |
| 497 | - // 回显来料类型备注:优先取已保存业务摘要中的扣杂段落 | |
| 498 | - this.form.deductionTypeRemark = this.extractDeductionRemark(data.businessSummary) | |
| 497 | + // 回显来料类型备注:优先取独立字段,历史数据从业务摘要解析 | |
| 498 | + this.form.deductionTypesRemarks = this.extractDeductionRemark(data.deductionTypesRemarks || data.businessSummary) | |
| 499 | 499 | this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it })) |
| 500 | 500 | // 选中计划行对象(buyout 供 isBuyout 判断,id 供 planIds 提交使用) |
| 501 | 501 | this.selectedPlanRows = this.planList.map(item => ({ |
| ... | ... | @@ -658,6 +658,7 @@ export default { |
| 658 | 658 | netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), |
| 659 | 659 | netWeightUpper: this.computedNetWeightUpper || null, |
| 660 | 660 | deductionTypes: (this.form.deductionTypes || []).join(',') || null, |
| 661 | + deductionTypesRemarks: this.form.deductionTypesRemarks || null, | |
| 661 | 662 | supplierStockMaterial: this.form.supplierStockMaterial || null, |
| 662 | 663 | logisticsStockMaterial: this.form.logisticsStockMaterial || null, |
| 663 | 664 | plateNumber: this.form.plateNumber || null, | ... | ... |
| ... | ... | @@ -75,6 +75,7 @@ |
| 75 | 75 | <view class="row"><text class="label">货物净重(kg)</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view> |
| 76 | 76 | <view class="row"><text class="label">净重大写</text><text class="value">{{ form.netWeightUpper || '-' }}</text></view> |
| 77 | 77 | <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> |
| 78 | + <view class="row"><text class="label">来料类型备注</text><text class="value">{{ form.deductionTypesRemarks || '-' }}</text></view> | |
| 78 | 79 | <view class="row"><text class="label">供应存欠料</text><text class="value">{{ form.supplierStockMaterial || '-' }}</text></view> |
| 79 | 80 | <view class="row"><text class="label">物流存欠料</text><text class="value">{{ form.logisticsStockMaterial || '-' }}</text></view> |
| 80 | 81 | <view class="row"><text class="label">车牌号</text><text class="value">{{ form.plateNumber || '-' }}</text></view> |
| ... | ... | @@ -168,6 +169,7 @@ export default { |
| 168 | 169 | netWeight: '', |
| 169 | 170 | netWeightUpper: '', |
| 170 | 171 | deductionTypes: '', |
| 172 | + deductionTypesRemarks: '', | |
| 171 | 173 | supplierStockMaterial: '', |
| 172 | 174 | logisticsStockMaterial: '', |
| 173 | 175 | plateNumber: '', |
| ... | ... | @@ -247,6 +249,7 @@ export default { |
| 247 | 249 | netWeight: data.netWeight == null ? '' : String(data.netWeight), |
| 248 | 250 | netWeightUpper: data.netWeightUpper || '', |
| 249 | 251 | deductionTypes: data.deductionTypes || '', |
| 252 | + deductionTypesRemarks: data.deductionTypesRemarks || '', | |
| 250 | 253 | supplierStockMaterial: data.supplierStockMaterial || '', |
| 251 | 254 | logisticsStockMaterial: data.logisticsStockMaterial || '', |
| 252 | 255 | plateNumber: data.plateNumber || '', | ... | ... |
| ... | ... | @@ -75,6 +75,7 @@ |
| 75 | 75 | <view class="row"><text class="label">货物净重(kg)</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view> |
| 76 | 76 | <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view> |
| 77 | 77 | <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> |
| 78 | + <view class="row"><text class="label">来料类型备注</text><text class="value">{{ safeText(form.deductionTypesRemarks) }}</text></view> | |
| 78 | 79 | <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view> |
| 79 | 80 | <view class="row"><text class="label">物流存欠料</text><text class="value">{{ safeText(form.logisticsStockMaterial) }}</text></view> |
| 80 | 81 | <view class="row"><text class="label">车牌号</text><text class="value">{{ safeText(form.plateNumber) }}</text></view> | ... | ... |