Commit 8c45dad69394850ddf66dd293b070c17ae051ae7

Authored by gesilong
2 parents 0178a22f 7684cdd5

Merge branch 'cjerp-3.0' into test_cjerp

@@ -380,7 +380,9 @@ export default { @@ -380,7 +380,9 @@ export default {
380 this.form.weighingTicketId = row.id || '' 380 this.form.weighingTicketId = row.id || ''
381 this.form.weighingTicketCode = row.code || '' 381 this.form.weighingTicketCode = row.code || ''
382 this.form.completeTime = row.completeTime || '' 382 this.form.completeTime = row.completeTime || ''
383 - this.form.code = row.code || '' 383 + // 计划编号:取码单过磅明细各行 planCode 去重后逗号拼接
  384 + const planCodes = Array.from(new Set((row.weighLines || []).map(it => it.planCode).filter(Boolean)))
  385 + this.form.code = planCodes.join(',')
384 this.form.supplierName = row.supplierName || '' 386 this.form.supplierName = row.supplierName || ''
385 this.form.workshopName = row.workshopName || '' 387 this.form.workshopName = row.workshopName || ''
386 this.form.settleType = row.settleType || '' 388 this.form.settleType = row.settleType || ''
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
65 </uni-list> 65 </uni-list>
66 66
67 <!-- 化验明细:样品/数量/样号/送样编号 + 成份%(成分项按码单分厂区分) --> 67 <!-- 化验明细:样品/数量/样号/送样编号 + 成份%(成分项按码单分厂区分) -->
68 - <AssayDetailTable ref="detailTable" :options="applyDetailOptions" :workshop-name="ticketWorkshopName" /> 68 + <AssayDetailTable ref="detailTable" :options="applyDetailOptions" :workshop-code="ticketWorkshopCode" :workshop-name="ticketWorkshopName" />
69 </scroll-view> 69 </scroll-view>
70 70
71 <view class="footer"> 71 <view class="footer">
@@ -125,7 +125,10 @@ export default { @@ -125,7 +125,10 @@ export default {
125 } 125 }
126 }, 126 },
127 computed: { 127 computed: {
128 - // 码单分厂名称,决定化验明细成分项集合 128 + // 码单分厂编码/名称,决定化验明细成份项集合
  129 + ticketWorkshopCode() {
  130 + return (this.selectedTicketRow && this.selectedTicketRow.workshopCode) || ''
  131 + },
129 ticketWorkshopName() { 132 ticketWorkshopName() {
130 return (this.selectedTicketRow && this.selectedTicketRow.workshopName) || '' 133 return (this.selectedTicketRow && this.selectedTicketRow.workshopName) || ''
131 }, 134 },
@@ -261,6 +264,7 @@ export default { @@ -261,6 +264,7 @@ export default {
261 assayApplyId: item.assayApplyId || item.id || '', 264 assayApplyId: item.assayApplyId || item.id || '',
262 assayApplyCode: item.assayApplyCode || '', 265 assayApplyCode: item.assayApplyCode || '',
263 productName: item.productName || '', 266 productName: item.productName || '',
  267 + category: item.category || '',
264 productId: item.productId || '', 268 productId: item.productId || '',
265 quantity: item.quantity 269 quantity: item.quantity
266 })) 270 }))
@@ -12,7 +12,6 @@ @@ -12,7 +12,6 @@
12 <view v-if="!rows.length" class="empty-tip">暂无明细,请选择过磅品种后加载</view> 12 <view v-if="!rows.length" class="empty-tip">暂无明细,请选择过磅品种后加载</view>
13 <view v-for="(row, idx) in rows" :key="'line-' + idx" class="card"> 13 <view v-for="(row, idx) in rows" :key="'line-' + idx" class="card">
14 <view class="card-index">第 {{ idx + 1 }} 行</view> 14 <view class="card-index">第 {{ idx + 1 }} 行</view>
15 - <view class="card-delete" @click="delRow(idx)"><text>删除</text></view>  
16 15
17 <view class="row"> 16 <view class="row">
18 <text class="label">送样编号</text> 17 <text class="label">送样编号</text>
@@ -29,7 +28,7 @@ @@ -29,7 +28,7 @@
29 </view> 28 </view>
30 <view class="row"> 29 <view class="row">
31 <text class="label">样品</text> 30 <text class="label">样品</text>
32 - <text class="value">{{ row.productName || '-' }}</text> 31 + <text class="value">{{ row.category || '-' }}</text>
33 </view> 32 </view>
34 <view class="row"> 33 <view class="row">
35 <text class="label">数量</text> 34 <text class="label">数量</text>
@@ -51,6 +50,8 @@ @@ -51,6 +50,8 @@
51 /> 50 />
52 </view> 51 </view>
53 </view> 52 </view>
  53 +
  54 + <view class="card-delete-btn" @click="delRow(idx)"><text>删除该行</text></view>
54 </view> 55 </view>
55 </view> 56 </view>
56 </view> 57 </view>
@@ -67,7 +68,12 @@ export default { @@ -67,7 +68,12 @@ export default {
67 type: Array, 68 type: Array,
68 default: () => [] 69 default: () => []
69 }, 70 },
70 - // 码单分厂名称,决定成份%项集合 71 + // 码单分厂编码(ticketPage 返回 workshopCode),决定成份%项集合
  72 + workshopCode: {
  73 + type: String,
  74 + default: ''
  75 + },
  76 + // 码单分厂名称(workshopCode 缺失时兜底匹配)
71 workshopName: { 77 workshopName: {
72 type: String, 78 type: String,
73 default: '' 79 default: ''
@@ -81,16 +87,16 @@ export default { @@ -81,16 +87,16 @@ export default {
81 } 87 }
82 }, 88 },
83 computed: { 89 computed: {
84 - // 当前分厂对应的成分项 key 列表 90 + // 当前分厂对应的成分项 key 列表(按 workshopCode 匹配,名称兜底)
85 componentKeys() { 91 componentKeys() {
86 - return getComponentKeys(this.workshopName) 92 + return getComponentKeys(this.workshopCode, this.workshopName)
87 } 93 }
88 }, 94 },
89 methods: { 95 methods: {
90 - // 构造行对象(初始化全部成分字段,保证响应式) 96 + // 构造行对象(初始化全部成分字段,保证响应式;样品取 category,对齐 PC 端 buildRow)
91 buildRow(item, index) { 97 buildRow(item, index) {
92 const row = { 98 const row = {
93 - productName: (item && item.productName) || '', 99 + category: (item && item.category) || '',
94 productId: (item && item.productId) || '', 100 productId: (item && item.productId) || '',
95 quantity: item ? item.quantity : '', 101 quantity: item ? item.quantity : '',
96 testCode: String(index + 1), 102 testCode: String(index + 1),
@@ -145,7 +151,7 @@ export default { @@ -145,7 +151,7 @@ export default {
145 row.productId = item.productId || '' 151 row.productId = item.productId || ''
146 row.assayApplyCode = item.assayApplyCode || '' 152 row.assayApplyCode = item.assayApplyCode || ''
147 row.assayApplyId = item.assayApplyId || '' 153 row.assayApplyId = item.assayApplyId || ''
148 - row.productName = item.productName || '' 154 + row.category = item.category || ''
149 row.quantity = item.quantity !== undefined && item.quantity !== null ? item.quantity : '' 155 row.quantity = item.quantity !== undefined && item.quantity !== null ? item.quantity : ''
150 }, 156 },
151 // 成份值输入:仅允许数字与小数点,空值重置为 null 157 // 成份值输入:仅允许数字与小数点,空值重置为 null
@@ -223,12 +229,16 @@ export default { @@ -223,12 +229,16 @@ export default {
223 border-bottom-left-radius: 12rpx; 229 border-bottom-left-radius: 12rpx;
224 border-top-right-radius: 12rpx; 230 border-top-right-radius: 12rpx;
225 } 231 }
226 - .card-delete {  
227 - position: absolute;  
228 - top: 8rpx;  
229 - left: 12rpx;  
230 - padding: 4rpx 12rpx;  
231 - text { font-size: 24rpx; color: #d54941; } 232 + .card-delete-btn {
  233 + margin-top: 20rpx;
  234 + height: 64rpx;
  235 + display: flex;
  236 + align-items: center;
  237 + justify-content: center;
  238 + border-radius: 8rpx;
  239 + background: rgba(213, 73, 65, 0.06);
  240 + border: 1rpx solid rgba(213, 73, 65, 0.45);
  241 + text { font-size: 26rpx; color: #d54941; }
232 } 242 }
233 .row { 243 .row {
234 display: flex; 244 display: flex;
@@ -19,19 +19,35 @@ export const COMPONENT_LABELS = { @@ -19,19 +19,35 @@ export const COMPONENT_LABELS = {
19 // 提交接口要求的全部成分字段(分厂未包含的成分提交 null) 19 // 提交接口要求的全部成分字段(分厂未包含的成分提交 null)
20 export const ALL_COMPONENT_KEYS = ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'al', 'cd', 'cr6', 'hg', 'bi'] 20 export const ALL_COMPONENT_KEYS = ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'al', 'cd', 'cr6', 'hg', 'bi']
21 21
22 -// 各分厂成分配置(按码单分厂名匹配,紫铜优先) 22 +// 各分厂成分配置(按 workshopCode 匹配:yfc-一分厂 efc-二分厂 sfc-三分厂 ztfc-紫铜分厂,紫铜优先)
23 const WORKSHOP_COMPONENTS = [ 23 const WORKSHOP_COMPONENTS = [
  24 + { match: 'ztfc', keys: ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'bi'] },
  25 + { match: 'efc', keys: ['cu', 'pb', 'fe', 'p', 'sn', 'ni', 'al', 'cd', 'cr6', 'hg'] },
  26 + { match: 'sfc', keys: ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'al'] },
  27 + { match: 'yfc', keys: ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'al'] }
  28 +]
  29 +
  30 +// 名称兜底配置(详情接口未返回 workshopCode 时按分厂名匹配)
  31 +const WORKSHOP_NAME_FALLBACK = [
24 { match: '紫铜', keys: ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'bi'] }, 32 { match: '紫铜', keys: ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'bi'] },
25 { match: '二', keys: ['cu', 'pb', 'fe', 'p', 'sn', 'ni', 'al', 'cd', 'cr6', 'hg'] }, 33 { match: '二', keys: ['cu', 'pb', 'fe', 'p', 'sn', 'ni', 'al', 'cd', 'cr6', 'hg'] },
26 - { match: '三', keys: ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'al'] } 34 + { match: '三', keys: ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'al'] },
  35 + { match: '一', keys: ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'al'] }
27 ] 36 ]
28 37
29 // 默认成分(一分厂/未匹配到分厂时) 38 // 默认成分(一分厂/未匹配到分厂时)
30 const DEFAULT_COMPONENT_KEYS = ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'al'] 39 const DEFAULT_COMPONENT_KEYS = ['cu', 'zn', 'pb', 'fe', 'p', 'sn', 'ni', 'al']
31 40
32 -// 按分厂名获取成分 key 列表  
33 -export function getComponentKeys(workshopName) { 41 +// 按 workshopCode 获取成分 key 列表;code 缺失或未匹配时按分厂名兜底
  42 +export function getComponentKeys(workshopCode, workshopName) {
  43 + const code = String(workshopCode || '')
  44 + if (code) {
  45 + const config = WORKSHOP_COMPONENTS.find(item => code.includes(item.match))
  46 + if (config) {
  47 + return config.keys
  48 + }
  49 + }
34 const name = String(workshopName || '') 50 const name = String(workshopName || '')
35 - const config = WORKSHOP_COMPONENTS.find(item => name.includes(item.match))  
36 - return config ? config.keys : DEFAULT_COMPONENT_KEYS 51 + const fallback = WORKSHOP_NAME_FALLBACK.find(item => name.includes(item.match))
  52 + return fallback ? fallback.keys : DEFAULT_COMPONENT_KEYS
37 } 53 }
@@ -101,7 +101,8 @@ export default { @@ -101,7 +101,8 @@ export default {
101 }, 101 },
102 computed: { 102 computed: {
103 componentKeys() { 103 componentKeys() {
104 - return getComponentKeys(this.form.workshopName) 104 + // 按 workshopCode 匹配成分项,名称兜底
  105 + return getComponentKeys(this.form.workshopCode, this.form.workshopName)
105 }, 106 },
106 // 是否有质量问题名称(兼容 1/0、true/false、'1'/'0' 返回,无值返回空不展示) 107 // 是否有质量问题名称(兼容 1/0、true/false、'1'/'0' 返回,无值返回空不展示)
107 hasQualityProblemName() { 108 hasQualityProblemName() {
@@ -102,7 +102,8 @@ export default { @@ -102,7 +102,8 @@ export default {
102 return this.nodeCode === 'assay_report_gyglkzg2' 102 return this.nodeCode === 'assay_report_gyglkzg2'
103 }, 103 },
104 componentKeys() { 104 componentKeys() {
105 - return getComponentKeys(this.form.workshopName) 105 + // 按 workshopCode 匹配成分项,名称兜底
  106 + return getComponentKeys(this.form.workshopCode, this.form.workshopName)
106 }, 107 },
107 // 是否有质量问题名称(兼容 1/0、true/false、'1'/'0' 返回,无值返回空不展示) 108 // 是否有质量问题名称(兼容 1/0、true/false、'1'/'0' 返回,无值返回空不展示)
108 hasQualityProblemName() { 109 hasQualityProblemName() {
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
65 </uni-list> 65 </uni-list>
66 66
67 <!-- 化验明细:样品/数量/样号/送样编号 + 成份%(成分项按码单分厂区分) --> 67 <!-- 化验明细:样品/数量/样号/送样编号 + 成份%(成分项按码单分厂区分) -->
68 - <AssayDetailTable ref="detailTable" :options="applyDetailOptions" :workshop-name="ticketWorkshopName" /> 68 + <AssayDetailTable ref="detailTable" :options="applyDetailOptions" :workshop-code="ticketWorkshopCode" :workshop-name="ticketWorkshopName" />
69 </scroll-view> 69 </scroll-view>
70 70
71 <view class="footer"> 71 <view class="footer">
@@ -127,7 +127,10 @@ export default { @@ -127,7 +127,10 @@ export default {
127 } 127 }
128 }, 128 },
129 computed: { 129 computed: {
130 - // 码单分厂名称,决定化验明细成分项集合 130 + // 码单分厂编码/名称,决定化验明细成份项集合
  131 + ticketWorkshopCode() {
  132 + return (this.selectedTicketRow && this.selectedTicketRow.workshopCode) || ''
  133 + },
131 ticketWorkshopName() { 134 ticketWorkshopName() {
132 return (this.selectedTicketRow && this.selectedTicketRow.workshopName) || '' 135 return (this.selectedTicketRow && this.selectedTicketRow.workshopName) || ''
133 }, 136 },
@@ -166,7 +169,12 @@ export default { @@ -166,7 +169,12 @@ export default {
166 } 169 }
167 // 码单编号回显:用详情返回的码单ID/编号构造已选行,供分厂成分联动使用 170 // 码单编号回显:用详情返回的码单ID/编号构造已选行,供分厂成分联动使用
168 this.selectedTicketRow = data.weighingTicketId 171 this.selectedTicketRow = data.weighingTicketId
169 - ? { id: data.weighingTicketId, code: data.weighingTicketCode || '', workshopName: data.workshopName || '' } 172 + ? {
  173 + id: data.weighingTicketId,
  174 + code: data.weighingTicketCode || '',
  175 + workshopCode: data.workshopCode || '',
  176 + workshopName: data.workshopName || ''
  177 + }
170 : null 178 : null
171 // 计划编号/品种下拉:先用详情数据兜底,再异步刷新真实选项 179 // 计划编号/品种下拉:先用详情数据兜底,再异步刷新真实选项
172 this.planOptions = data.procurementPlanId 180 this.planOptions = data.procurementPlanId
@@ -248,6 +256,7 @@ export default { @@ -248,6 +256,7 @@ export default {
248 assayApplyId: item.assayApplyId || item.id || '', 256 assayApplyId: item.assayApplyId || item.id || '',
249 assayApplyCode: item.assayApplyCode || '', 257 assayApplyCode: item.assayApplyCode || '',
250 productName: item.productName || '', 258 productName: item.productName || '',
  259 + category: item.category || '',
251 productId: item.productId || '', 260 productId: item.productId || '',
252 quantity: item.quantity 261 quantity: item.quantity
253 })) 262 }))
@@ -349,6 +358,7 @@ export default { @@ -349,6 +358,7 @@ export default {
349 assayApplyId: item.assayApplyId || item.id || '', 358 assayApplyId: item.assayApplyId || item.id || '',
350 assayApplyCode: item.assayApplyCode || '', 359 assayApplyCode: item.assayApplyCode || '',
351 productName: item.productName || '', 360 productName: item.productName || '',
  361 + category: item.category || '',
352 productId: item.productId || '', 362 productId: item.productId || '',
353 quantity: item.quantity 363 quantity: item.quantity
354 })) 364 }))
@@ -106,7 +106,8 @@ export default { @@ -106,7 +106,8 @@ export default {
106 }, 106 },
107 computed: { 107 computed: {
108 componentKeys() { 108 componentKeys() {
109 - return getComponentKeys(this.form.workshopName) 109 + // 按 workshopCode 匹配成分项,名称兜底
  110 + return getComponentKeys(this.form.workshopCode, this.form.workshopName)
110 }, 111 },
111 approvalStatusName() { 112 approvalStatusName() {
112 const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus) 113 const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus)
@@ -468,6 +468,7 @@ export default { @@ -468,6 +468,7 @@ export default {
468 emitChange() { 468 emitChange() {
469 if (!this._initialized) return 469 if (!this._initialized) return
470 if (this._emitSuppressed) return 470 if (this._emitSuppressed) return
  471 + var self = this
471 var list = (this.items || []).map(function (it) { 472 var list = (this.items || []).map(function (it) {
472 var c = Object.assign({}, it) 473 var c = Object.assign({}, it)
473 var key = c._key 474 var key = c._key
@@ -476,7 +477,7 @@ export default { @@ -476,7 +477,7 @@ export default {
476 delete c._selected 477 delete c._selected
477 delete c.fixedLossRate 478 delete c.fixedLossRate
478 if (!c.itemId) c.itemId = key 479 if (!c.itemId) c.itemId = key
479 - if (!this.isAnyBuyout) c.estimatedLoss = null 480 + if (!self.isAnyBuyout) c.estimatedLoss = null
480 return c 481 return c
481 }) 482 })
482 this.$emit('change', list) 483 this.$emit('change', list)
@@ -409,7 +409,7 @@ export default { @@ -409,7 +409,7 @@ export default {
409 } 409 }
410 var m = Math.pow(10, digits) 410 var m = Math.pow(10, digits)
411 var rounded = Math.round(val * m) / m 411 var rounded = Math.round(val * m) / m
412 - it[field] = rounded 412 + it[field] = String(rounded)
413 this.$set(this.items, idx, it) 413 this.$set(this.items, idx, it)
414 }, 414 },
415 getProductOption(productId) { 415 getProductOption(productId) {
@@ -623,7 +623,7 @@ export default { @@ -623,7 +623,7 @@ export default {
623 delete c._selected 623 delete c._selected
624 delete c.fixedLossRate 624 delete c.fixedLossRate
625 if (!c.itemId) c.itemId = key 625 if (!c.itemId) c.itemId = key
626 - if (!this.isAnyBuyout) c.estimatedLoss = null 626 + if (!self.isAnyBuyout) c.estimatedLoss = null
627 return c 627 return c
628 }) 628 })
629 var sig = list.length + '|' + list.map(function (r) { 629 var sig = list.length + '|' + list.map(function (r) {
@@ -147,6 +147,7 @@ export const getSysFlowComponentPath = (bizFlag) => { @@ -147,6 +147,7 @@ export const getSysFlowComponentPath = (bizFlag) => {
147 break; 147 break;
148 case 'PLAN_REPLENISH_EDIT': // 补库计划 148 case 'PLAN_REPLENISH_EDIT': // 补库计划
149 componentPath = 'SupplePlanViewer'; // 补库计划-审批 149 componentPath = 'SupplePlanViewer'; // 补库计划-审批
  150 + break;
150 case 'PROCUREMENT_CONTRACT': // 内贸协议 151 case 'PROCUREMENT_CONTRACT': // 内贸协议
151 componentPath = 'DomesticAgreementViewer'; // 内贸协议-审批详情 152 componentPath = 'DomesticAgreementViewer'; // 内贸协议-审批详情
152 break; 153 break;