Commit 864abd8d155e4171f5a20eb17db95970c8e875d9

Authored by gesilong
2 parents f635b0d5 9f4f6b65

Merge branch 'cjerp-3.0-fix' into publish_cjerp

@@ -64,7 +64,8 @@ export function assayApplyBreedOptionsApi(params) { @@ -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 export function assayApplyCreateApi(data) { 70 export function assayApplyCreateApi(data) {
70 return request({ 71 return request({
@@ -88,7 +89,8 @@ export function assayApplyDetailApi(params) { @@ -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 export function assayApplyUpdateApi(data) { 95 export function assayApplyUpdateApi(data) {
94 return request({ 96 return request({
@@ -68,7 +68,7 @@ export function assayReportApplyOptionsApi(params) { @@ -68,7 +68,7 @@ export function assayReportApplyOptionsApi(params) {
68 /** 68 /**
69 * 新增化验报告单 69 * 新增化验报告单
70 * data: { weighingTicketId, reportDate, procurementPlanId, productId, 70 * data: { weighingTicketId, reportDate, procurementPlanId, productId,
71 - * lines: [{ assayApplyId, cu, zn, pb, fe, p, sn, ni, al, cd, cr6, hg, bi }] } 71 + * lines: [{ assayApplyId, assayApplyLineId, cu, zn, pb, fe, p, sn, ni, al, cd, cr6, hg, bi }] }
72 */ 72 */
73 export function assayReportCreateApi(data) { 73 export function assayReportCreateApi(data) {
74 return request({ 74 return request({
@@ -92,7 +92,8 @@ export function assayReportDetailApi(params) { @@ -92,7 +92,8 @@ export function assayReportDetailApi(params) {
92 92
93 /** 93 /**
94 * 修改化验报告单 94 * 修改化验报告单
95 - * data: { id, weighingTicketId, reportDate, procurementPlanId, productId, lines } 95 + * data: { id, weighingTicketId, reportDate, procurementPlanId, productId,
  96 + * lines: [{ assayApplyId, assayApplyLineId, cu, zn, pb, fe, p, sn, ni, al, cd, cr6, hg, bi }] }
96 */ 97 */
97 export function assayReportUpdateApi(data) { 98 export function assayReportUpdateApi(data) {
98 return request({ 99 return request({
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 </view> 8 </view>
9 <view class="body"> 9 <view class="body">
10 <view v-if="tab === 'base'"> 10 <view v-if="tab === 'base'">
11 - <component :is="componentName" :id="auditCtx.businessId" :node-code="nodeCode" ref="basicRef" /> 11 + <component :is="componentName" :id="auditCtx.businessId" :node-code="nodeCode" mode="audit" ref="basicRef" />
12 </view> 12 </view>
13 <view v-else> 13 <view v-else>
14 <FlowTimeline :nodeList="nodeList" :isEnd="isEnd" /> 14 <FlowTimeline :nodeList="nodeList" :isEnd="isEnd" />
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 </view> 8 </view>
9 <view class="body"> 9 <view class="body">
10 <view v-if="tab === 'base'"> 10 <view v-if="tab === 'base'">
11 - <component :is="componentName" :id="auditCtx.businessId" ref="basicRef" /> 11 + <component :is="componentName" :id="auditCtx.businessId" mode="detail" ref="basicRef" />
12 </view> 12 </view>
13 <view v-else> 13 <view v-else>
14 <FlowTimeline :nodeList="nodeList" :isEnd="isEnd" /> 14 <FlowTimeline :nodeList="nodeList" :isEnd="isEnd" />
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 <uni-easyinput :value="item.category" :inputBorder="false" disabled /> 46 <uni-easyinput :value="item.category" :inputBorder="false" disabled />
47 </template> 47 </template>
48 </uni-list-item> 48 </uni-list-item>
49 - <uni-list-item title="数量"> 49 + <uni-list-item title="数量(kg)">
50 <template v-slot:footer> 50 <template v-slot:footer>
51 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> 51 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
52 </template> 52 </template>
@@ -133,7 +133,7 @@ @@ -133,7 +133,7 @@
133 </template> 133 </template>
134 </uni-list-item> 134 </uni-list-item>
135 135
136 - <uni-list-item title="过磅数"> 136 + <uni-list-item title="过磅数(kg)">
137 <template v-slot:footer> 137 <template v-slot:footer>
138 <uni-easyinput :value="item.weighQuantity" :inputBorder="false" disabled /> 138 <uni-easyinput :value="item.weighQuantity" :inputBorder="false" disabled />
139 </template> 139 </template>
@@ -143,17 +143,17 @@ @@ -143,17 +143,17 @@
143 <uni-easyinput v-model="item.impurityRate" type="digit" :inputBorder="false" placeholder="请输入杂率" /> 143 <uni-easyinput v-model="item.impurityRate" type="digit" :inputBorder="false" placeholder="请输入杂率" />
144 </template> 144 </template>
145 </uni-list-item> 145 </uni-list-item>
146 - <uni-list-item title="折斤"> 146 + <uni-list-item title="折斤(kg)">
147 <template v-slot:footer> 147 <template v-slot:footer>
148 <uni-easyinput v-model="item.foldWeight" type="digit" :inputBorder="false" placeholder="请输入折斤" /> 148 <uni-easyinput v-model="item.foldWeight" type="digit" :inputBorder="false" placeholder="请输入折斤" />
149 </template> 149 </template>
150 </uni-list-item> 150 </uni-list-item>
151 - <uni-list-item title="退料"> 151 + <uni-list-item title="退料(kg)">
152 <template v-slot:footer> 152 <template v-slot:footer>
153 <uni-easyinput v-model="item.returnWeight" type="digit" :inputBorder="false" placeholder="请输入退料" /> 153 <uni-easyinput v-model="item.returnWeight" type="digit" :inputBorder="false" placeholder="请输入退料" />
154 </template> 154 </template>
155 </uni-list-item> 155 </uni-list-item>
156 - <uni-list-item title="入库净重"> 156 + <uni-list-item title="入库净重(kg)">
157 <template v-slot:footer> 157 <template v-slot:footer>
158 <uni-easyinput v-model="item.netWeight" type="digit" :inputBorder="false" placeholder="请输入入库净重" /> 158 <uni-easyinput v-model="item.netWeight" type="digit" :inputBorder="false" placeholder="请输入入库净重" />
159 </template> 159 </template>
@@ -181,19 +181,19 @@ @@ -181,19 +181,19 @@
181 <view class="total-title">合计</view> 181 <view class="total-title">合计</view>
182 <view class="total-body"> 182 <view class="total-body">
183 <view class="total-item"> 183 <view class="total-item">
184 - <text class="total-label">过磅数</text> 184 + <text class="total-label">过磅数(kg)</text>
185 <text class="total-value">{{ totalSummary.totalWeighQuantity || '-' }}</text> 185 <text class="total-value">{{ totalSummary.totalWeighQuantity || '-' }}</text>
186 </view> 186 </view>
187 <view class="total-item"> 187 <view class="total-item">
188 - <text class="total-label">折斤</text> 188 + <text class="total-label">折斤(kg)</text>
189 <text class="total-value">{{ totalSummary.totalFoldWeight || '-' }}</text> 189 <text class="total-value">{{ totalSummary.totalFoldWeight || '-' }}</text>
190 </view> 190 </view>
191 <view class="total-item"> 191 <view class="total-item">
192 - <text class="total-label">退料</text> 192 + <text class="total-label">退料(kg)</text>
193 <text class="total-value">{{ totalSummary.totalReturnWeight || '-' }}</text> 193 <text class="total-value">{{ totalSummary.totalReturnWeight || '-' }}</text>
194 </view> 194 </view>
195 <view class="total-item"> 195 <view class="total-item">
196 - <text class="total-label">入库净重</text> 196 + <text class="total-label">入库净重(kg)</text>
197 <text class="total-value">{{ totalSummary.totalNetWeight || '-' }}</text> 197 <text class="total-value">{{ totalSummary.totalNetWeight || '-' }}</text>
198 </view> 198 </view>
199 </view> 199 </view>
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> 26 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card">
27 <view class="card-index">第 {{ idx + 1 }} 行</view> 27 <view class="card-index">第 {{ idx + 1 }} 行</view>
28 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view> 28 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view>
29 - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 29 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
30 </view> 30 </view>
31 </view> 31 </view>
32 </view> 32 </view>
@@ -49,11 +49,11 @@ @@ -49,11 +49,11 @@
49 <view class="row"><text class="label">品种</text><text class="value">{{ safeText(item.productName) }}</text></view> 49 <view class="row"><text class="label">品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
50 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view> 50 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view>
51 <view class="row"><text class="label">名称</text><text class="value">{{ safeText(item.name) }}</text></view> 51 <view class="row"><text class="label">名称</text><text class="value">{{ safeText(item.name) }}</text></view>
52 - <view class="row"><text class="label">过磅数</text><text class="value">{{ formatNumber(item.weighQuantity) }}</text></view> 52 + <view class="row"><text class="label">过磅数(kg)</text><text class="value">{{ formatNumber(item.weighQuantity) }}</text></view>
53 <view class="row"><text class="label">杂率(%)</text><text class="value">{{ formatNumber(item.impurityRate) }}</text></view> 53 <view class="row"><text class="label">杂率(%)</text><text class="value">{{ formatNumber(item.impurityRate) }}</text></view>
54 - <view class="row"><text class="label">折斤</text><text class="value">{{ formatNumber(item.foldWeight) }}</text></view>  
55 - <view class="row"><text class="label">退料</text><text class="value">{{ formatNumber(item.returnWeight) }}</text></view>  
56 - <view class="row"><text class="label">入库净重</text><text class="value">{{ formatNumber(item.netWeight) }}</text></view> 54 + <view class="row"><text class="label">折斤(kg)</text><text class="value">{{ formatNumber(item.foldWeight) }}</text></view>
  55 + <view class="row"><text class="label">退料(kg)</text><text class="value">{{ formatNumber(item.returnWeight) }}</text></view>
  56 + <view class="row"><text class="label">入库净重(kg)</text><text class="value">{{ formatNumber(item.netWeight) }}</text></view>
57 <view class="row"><text class="label">备注</text><text class="value">{{ safeText(item.remark) }}</text></view> 57 <view class="row"><text class="label">备注</text><text class="value">{{ safeText(item.remark) }}</text></view>
58 </view> 58 </view>
59 </view> 59 </view>
@@ -68,19 +68,19 @@ @@ -68,19 +68,19 @@
68 <view class="total-title">合计</view> 68 <view class="total-title">合计</view>
69 <view class="total-body"> 69 <view class="total-body">
70 <view class="total-item"> 70 <view class="total-item">
71 - <text class="total-label">过磅数</text> 71 + <text class="total-label">过磅数(kg)</text>
72 <text class="total-value">{{ formatNumber(form.totalWeighQuantity) }}</text> 72 <text class="total-value">{{ formatNumber(form.totalWeighQuantity) }}</text>
73 </view> 73 </view>
74 <view class="total-item"> 74 <view class="total-item">
75 - <text class="total-label">折斤</text> 75 + <text class="total-label">折斤(kg)</text>
76 <text class="total-value">{{ formatNumber(form.totalFoldWeight) }}</text> 76 <text class="total-value">{{ formatNumber(form.totalFoldWeight) }}</text>
77 </view> 77 </view>
78 <view class="total-item"> 78 <view class="total-item">
79 - <text class="total-label">退料</text> 79 + <text class="total-label">退料(kg)</text>
80 <text class="total-value">{{ formatNumber(form.totalReturnWeight) }}</text> 80 <text class="total-value">{{ formatNumber(form.totalReturnWeight) }}</text>
81 </view> 81 </view>
82 <view class="total-item"> 82 <view class="total-item">
83 - <text class="total-label">入库净重</text> 83 + <text class="total-label">入库净重(kg)</text>
84 <text class="total-value">{{ formatNumber(form.totalNetWeight) }}</text> 84 <text class="total-value">{{ formatNumber(form.totalNetWeight) }}</text>
85 </view> 85 </view>
86 </view> 86 </view>
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> 21 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card">
22 <view class="card-index">第 {{ idx + 1 }} 行</view> 22 <view class="card-index">第 {{ idx + 1 }} 行</view>
23 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view> 23 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view>
24 - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 24 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
25 </view> 25 </view>
26 </view> 26 </view>
27 </view> 27 </view>
@@ -40,11 +40,11 @@ @@ -40,11 +40,11 @@
40 <view class="row"><text class="label">品种</text><text class="value">{{ safeText(item.productName) }}</text></view> 40 <view class="row"><text class="label">品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
41 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view> 41 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view>
42 <view class="row"><text class="label">名称</text><text class="value">{{ safeText(item.name) }}</text></view> 42 <view class="row"><text class="label">名称</text><text class="value">{{ safeText(item.name) }}</text></view>
43 - <view class="row"><text class="label">过磅数</text><text class="value">{{ formatNumber(item.weighQuantity) }}</text></view> 43 + <view class="row"><text class="label">过磅数(kg)</text><text class="value">{{ formatNumber(item.weighQuantity) }}</text></view>
44 <view class="row"><text class="label">杂率(%)</text><text class="value">{{ formatNumber(item.impurityRate) }}</text></view> 44 <view class="row"><text class="label">杂率(%)</text><text class="value">{{ formatNumber(item.impurityRate) }}</text></view>
45 - <view class="row"><text class="label">折斤</text><text class="value">{{ formatNumber(item.foldWeight) }}</text></view>  
46 - <view class="row"><text class="label">退料</text><text class="value">{{ formatNumber(item.returnWeight) }}</text></view>  
47 - <view class="row"><text class="label">入库净重</text><text class="value">{{ formatNumber(item.netWeight) }}</text></view> 45 + <view class="row"><text class="label">折斤(kg)</text><text class="value">{{ formatNumber(item.foldWeight) }}</text></view>
  46 + <view class="row"><text class="label">退料(kg)</text><text class="value">{{ formatNumber(item.returnWeight) }}</text></view>
  47 + <view class="row"><text class="label">入库净重(kg)</text><text class="value">{{ formatNumber(item.netWeight) }}</text></view>
48 <view class="row"><text class="label">备注</text><text class="value">{{ safeText(item.remark) }}</text></view> 48 <view class="row"><text class="label">备注</text><text class="value">{{ safeText(item.remark) }}</text></view>
49 </view> 49 </view>
50 </view> 50 </view>
@@ -59,19 +59,19 @@ @@ -59,19 +59,19 @@
59 <view class="total-title">合计</view> 59 <view class="total-title">合计</view>
60 <view class="total-body"> 60 <view class="total-body">
61 <view class="total-item"> 61 <view class="total-item">
62 - <text class="total-label">过磅数</text> 62 + <text class="total-label">过磅数(kg)</text>
63 <text class="total-value">{{ formatNumber(form.totalWeighQuantity) }}</text> 63 <text class="total-value">{{ formatNumber(form.totalWeighQuantity) }}</text>
64 </view> 64 </view>
65 <view class="total-item"> 65 <view class="total-item">
66 - <text class="total-label">折斤</text> 66 + <text class="total-label">折斤(kg)</text>
67 <text class="total-value">{{ formatNumber(form.totalFoldWeight) }}</text> 67 <text class="total-value">{{ formatNumber(form.totalFoldWeight) }}</text>
68 </view> 68 </view>
69 <view class="total-item"> 69 <view class="total-item">
70 - <text class="total-label">退料</text> 70 + <text class="total-label">退料(kg)</text>
71 <text class="total-value">{{ formatNumber(form.totalReturnWeight) }}</text> 71 <text class="total-value">{{ formatNumber(form.totalReturnWeight) }}</text>
72 </view> 72 </view>
73 <view class="total-item"> 73 <view class="total-item">
74 - <text class="total-label">入库净重</text> 74 + <text class="total-label">入库净重(kg)</text>
75 <text class="total-value">{{ formatNumber(form.totalNetWeight) }}</text> 75 <text class="total-value">{{ formatNumber(form.totalNetWeight) }}</text>
76 </view> 76 </view>
77 </view> 77 </view>
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 <uni-easyinput :value="item.category" :inputBorder="false" disabled /> 45 <uni-easyinput :value="item.category" :inputBorder="false" disabled />
46 </template> 46 </template>
47 </uni-list-item> 47 </uni-list-item>
48 - <uni-list-item title="数量"> 48 + <uni-list-item title="数量(kg)">
49 <template v-slot:footer> 49 <template v-slot:footer>
50 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> 50 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
51 </template> 51 </template>
@@ -132,7 +132,7 @@ @@ -132,7 +132,7 @@
132 </template> 132 </template>
133 </uni-list-item> 133 </uni-list-item>
134 134
135 - <uni-list-item title="过磅数"> 135 + <uni-list-item title="过磅数(kg)">
136 <template v-slot:footer> 136 <template v-slot:footer>
137 <uni-easyinput :value="item.weighQuantity" :inputBorder="false" disabled /> 137 <uni-easyinput :value="item.weighQuantity" :inputBorder="false" disabled />
138 </template> 138 </template>
@@ -142,17 +142,17 @@ @@ -142,17 +142,17 @@
142 <uni-easyinput v-model="item.impurityRate" type="digit" :inputBorder="false" placeholder="请输入杂率" /> 142 <uni-easyinput v-model="item.impurityRate" type="digit" :inputBorder="false" placeholder="请输入杂率" />
143 </template> 143 </template>
144 </uni-list-item> 144 </uni-list-item>
145 - <uni-list-item title="折斤"> 145 + <uni-list-item title="折斤(kg)">
146 <template v-slot:footer> 146 <template v-slot:footer>
147 <uni-easyinput v-model="item.foldWeight" type="digit" :inputBorder="false" placeholder="请输入折斤" /> 147 <uni-easyinput v-model="item.foldWeight" type="digit" :inputBorder="false" placeholder="请输入折斤" />
148 </template> 148 </template>
149 </uni-list-item> 149 </uni-list-item>
150 - <uni-list-item title="退料"> 150 + <uni-list-item title="退料(kg)">
151 <template v-slot:footer> 151 <template v-slot:footer>
152 <uni-easyinput v-model="item.returnWeight" type="digit" :inputBorder="false" placeholder="请输入退料" /> 152 <uni-easyinput v-model="item.returnWeight" type="digit" :inputBorder="false" placeholder="请输入退料" />
153 </template> 153 </template>
154 </uni-list-item> 154 </uni-list-item>
155 - <uni-list-item title="入库净重"> 155 + <uni-list-item title="入库净重(kg)">
156 <template v-slot:footer> 156 <template v-slot:footer>
157 <uni-easyinput v-model="item.netWeight" type="digit" :inputBorder="false" placeholder="请输入入库净重" /> 157 <uni-easyinput v-model="item.netWeight" type="digit" :inputBorder="false" placeholder="请输入入库净重" />
158 </template> 158 </template>
@@ -262,7 +262,9 @@ export default { @@ -262,7 +262,9 @@ export default {
262 const list = (res && res.data) || [] 262 const list = (res && res.data) || []
263 this.applyDetailOptions = (list || []).map(item => ({ 263 this.applyDetailOptions = (list || []).map(item => ({
264 assayApplyId: item.assayApplyId || item.id || '', 264 assayApplyId: item.assayApplyId || item.id || '',
  265 + assayApplyLineId: item.assayApplyLineId || '',
265 assayApplyCode: item.assayApplyCode || '', 266 assayApplyCode: item.assayApplyCode || '',
  267 + sampleCode: item.sampleCode || '',
266 productName: item.productName || '', 268 productName: item.productName || '',
267 category: item.category || '', 269 category: item.category || '',
268 productId: item.productId || '', 270 productId: item.productId || '',
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
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 15
16 - <view class="row"> 16 + <!-- <view class="row">
17 <text class="label">送样编号</text> 17 <text class="label">送样编号</text>
18 <picker 18 <picker
19 class="picker-box" 19 class="picker-box"
@@ -25,13 +25,27 @@ @@ -25,13 +25,27 @@
25 {{ row.assayApplyCode || '请选择送样编号' }} 25 {{ row.assayApplyCode || '请选择送样编号' }}
26 </view> 26 </view>
27 </picker> 27 </picker>
  28 + </view> -->
  29 + <!-- 取样编号:下拉选择(数据源与送样编号一致,按 sampleCode 字段展示/取值) -->
  30 + <view class="row">
  31 + <text class="label">取样编号</text>
  32 + <picker
  33 + class="picker-box"
  34 + mode="selector"
  35 + :range="getRowSampleLabels(row)"
  36 + @change="onSampleCodeChange($event, idx)"
  37 + >
  38 + <view class="picker-value" :class="{ placeholder: !row.sampleCode }">
  39 + {{ row.sampleCode || '请选择取样编号' }}
  40 + </view>
  41 + </picker>
28 </view> 42 </view>
29 <view class="row"> 43 <view class="row">
30 <text class="label">样品</text> 44 <text class="label">样品</text>
31 <text class="value">{{ row.category || '-' }}</text> 45 <text class="value">{{ row.category || '-' }}</text>
32 </view> 46 </view>
33 <view class="row"> 47 <view class="row">
34 - <text class="label">数量</text> 48 + <text class="label">数量(kg)</text>
35 <text class="value">{{ row.quantity === null || row.quantity === undefined || row.quantity === '' ? '-' : row.quantity }}</text> 49 <text class="value">{{ row.quantity === null || row.quantity === undefined || row.quantity === '' ? '-' : row.quantity }}</text>
36 </view> 50 </view>
37 51
@@ -101,7 +115,9 @@ export default { @@ -101,7 +115,9 @@ export default {
101 quantity: item ? item.quantity : '', 115 quantity: item ? item.quantity : '',
102 testCode: String(index + 1), 116 testCode: String(index + 1),
103 assayApplyCode: (item && item.assayApplyCode) || '', 117 assayApplyCode: (item && item.assayApplyCode) || '',
104 - assayApplyId: (item && item.assayApplyId) || '' 118 + assayApplyId: (item && item.assayApplyId) || '',
  119 + assayApplyLineId: (item && item.assayApplyLineId) || '',
  120 + sampleCode: (item && item.sampleCode) || ''
105 } 121 }
106 ALL_COMPONENT_KEYS.forEach(key => { 122 ALL_COMPONENT_KEYS.forEach(key => {
107 row[key] = (item && item[key] !== undefined && item[key] !== null) ? item[key] : null 123 row[key] = (item && item[key] !== undefined && item[key] !== null) ? item[key] : null
@@ -116,12 +132,15 @@ export default { @@ -116,12 +132,15 @@ export default {
116 setRows(list) { 132 setRows(list) {
117 this.rows = (list || []).map((item, index) => this.buildRow(item, index)) 133 this.rows = (list || []).map((item, index) => this.buildRow(item, index))
118 }, 134 },
119 - // 获取提交用明细行(含各行成分值,未填/分厂未包含的成分为 null) 135 + // 获取提交用明细行(含行ID与各行成分值,未填/分厂未包含的成分为 null)
120 getLines() { 136 getLines() {
121 return (this.rows || []) 137 return (this.rows || [])
122 .filter(row => row.assayApplyId) 138 .filter(row => row.assayApplyId)
123 .map(row => { 139 .map(row => {
124 - const line = { assayApplyId: row.assayApplyId } 140 + const line = {
  141 + assayApplyId: row.assayApplyId,
  142 + assayApplyLineId: row.assayApplyLineId || ''
  143 + }
125 ALL_COMPONENT_KEYS.forEach(key => { 144 ALL_COMPONENT_KEYS.forEach(key => {
126 const val = row[key] 145 const val = row[key]
127 line[key] = (val === undefined || val === null || val === '') ? null : Number(val) 146 line[key] = (val === undefined || val === null || val === '') ? null : Number(val)
@@ -151,8 +170,37 @@ export default { @@ -151,8 +170,37 @@ export default {
151 row.productId = item.productId || '' 170 row.productId = item.productId || ''
152 row.assayApplyCode = item.assayApplyCode || '' 171 row.assayApplyCode = item.assayApplyCode || ''
153 row.assayApplyId = item.assayApplyId || '' 172 row.assayApplyId = item.assayApplyId || ''
  173 + row.assayApplyLineId = item.assayApplyLineId || ''
  174 + row.category = item.category || ''
  175 + row.quantity = item.quantity !== undefined && item.quantity !== null ? item.quantity : ''
  176 + row.sampleCode = item.sampleCode || ''
  177 + },
  178 + // 取样编号下拉标签(数据源与送样编号一致,按 sampleCode 展示,排除已被其他行选中的)
  179 + getRowSampleLabels(row) {
  180 + return this.getRowSampleOptions(row).map(it => it.label)
  181 + },
  182 + getRowSampleOptions(row) {
  183 + const selectedSamples = (this.rows || [])
  184 + .filter(r => r !== row && r.sampleCode)
  185 + .map(r => r.sampleCode)
  186 + return (this.options || [])
  187 + .filter(item => item.sampleCode && !selectedSamples.includes(item.sampleCode))
  188 + .map(item => ({ label: item.sampleCode, value: item.sampleCode }))
  189 + },
  190 + // 取样编号下拉变化:与送样编号选择一致,按 sampleCode 找到对应数据带出
  191 + onSampleCodeChange(e, index) {
  192 + const row = this.rows[index]
  193 + if (!row) return
  194 + const opt = this.getRowSampleOptions(row)[Number(e.detail.value)]
  195 + if (!opt) return
  196 + const item = (this.options || []).find(i => i.sampleCode === opt.value) || {}
  197 + row.productId = item.productId || ''
  198 + row.assayApplyCode = item.assayApplyCode || ''
  199 + row.assayApplyId = item.assayApplyId || ''
  200 + row.assayApplyLineId = item.assayApplyLineId || ''
154 row.category = item.category || '' 201 row.category = item.category || ''
155 row.quantity = item.quantity !== undefined && item.quantity !== null ? item.quantity : '' 202 row.quantity = item.quantity !== undefined && item.quantity !== null ? item.quantity : ''
  203 + row.sampleCode = item.sampleCode || opt.value || ''
156 }, 204 },
157 // 成份值输入:仅允许数字与小数点,空值重置为 null 205 // 成份值输入:仅允许数字与小数点,空值重置为 null
158 onComponentInput(e, index, key) { 206 onComponentInput(e, index, key) {
@@ -31,9 +31,10 @@ @@ -31,9 +31,10 @@
31 <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card"> 31 <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card">
32 <view class="card-index">第 {{ idx + 1 }} 行</view> 32 <view class="card-index">第 {{ idx + 1 }} 行</view>
33 <view class="row"><text class="label">样品</text><text class="value">{{ safeText(item.productName) }}</text></view> 33 <view class="row"><text class="label">样品</text><text class="value">{{ safeText(item.productName) }}</text></view>
34 - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 34 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
35 <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view> 35 <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view>
36 - <view class="row"><text class="label">送样编号</text><text class="value">{{ safeText(item.assayApplyCode) }}</text></view> 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 <view v-for="key in componentKeys" :key="key" class="row"> 38 <view v-for="key in componentKeys" :key="key" class="row">
38 <text class="label">{{ componentLabels[key] || key }}</text> 39 <text class="label">{{ componentLabels[key] || key }}</text>
39 <text class="value">{{ formatNumber(item[key]) }}</text> 40 <text class="value">{{ formatNumber(item[key]) }}</text>
@@ -26,9 +26,10 @@ @@ -26,9 +26,10 @@
26 <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card"> 26 <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card">
27 <view class="card-index">第 {{ idx + 1 }} 行</view> 27 <view class="card-index">第 {{ idx + 1 }} 行</view>
28 <view class="row"><text class="label">样品</text><text class="value">{{ safeText(item.productName) }}</text></view> 28 <view class="row"><text class="label">样品</text><text class="value">{{ safeText(item.productName) }}</text></view>
29 - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 29 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
30 <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view> 30 <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view>
31 - <view class="row"><text class="label">送样编号</text><text class="value">{{ safeText(item.assayApplyCode) }}</text></view> 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 <view v-for="key in componentKeys" :key="key" class="row"> 33 <view v-for="key in componentKeys" :key="key" class="row">
33 <text class="label">{{ componentLabels[key] || key }}</text> 34 <text class="label">{{ componentLabels[key] || key }}</text>
34 <text class="value">{{ formatNumber(item[key]) }}</text> 35 <text class="value">{{ formatNumber(item[key]) }}</text>
@@ -49,6 +50,20 @@ @@ -49,6 +50,20 @@
49 </view> 50 </view>
50 </template> 51 </template>
51 52
  53 + <!-- 审核意见(仅审核时展示,按流程顺序) -->
  54 + <template v-if="isAudit && opinionRows.length">
  55 + <view class="title-header">
  56 + <image class="title-header_icon" src="/static/images/title.png" />
  57 + <span>审核意见</span>
  58 + </view>
  59 + <view class="section opinion-section">
  60 + <view v-for="item in opinionRows" :key="item.key" class="opinion-item">
  61 + <view class="opinion-label">{{ item.label }}</view>
  62 + <textarea class="opinion-textarea" :value="item.opinion || '-'" disabled />
  63 + </view>
  64 + </view>
  65 + </template>
  66 +
52 <!-- 是否继续审批(assay_report_yfcckzg 节点必填) --> 67 <!-- 是否继续审批(assay_report_yfcckzg 节点必填) -->
53 <view v-if="showContinueApproval" class="section"> 68 <view v-if="showContinueApproval" class="section">
54 <view class="field-row"> 69 <view class="field-row">
@@ -77,7 +92,9 @@ export default { @@ -77,7 +92,9 @@ export default {
77 props: { 92 props: {
78 id: { type: [String, Number], default: '' }, 93 id: { type: [String, Number], default: '' },
79 // 当前审核节点编码(flow/audit 透传,flow/instance/getByBusinessId 返回) 94 // 当前审核节点编码(flow/audit 透传,flow/instance/getByBusinessId 返回)
80 - nodeCode: { type: String, default: '' } 95 + nodeCode: { type: String, default: '' },
  96 + // 页面模式:audit-审核;detail-审核详情
  97 + mode: { type: String, default: 'detail' }
81 }, 98 },
82 data() { 99 data() {
83 return { 100 return {
@@ -97,9 +114,13 @@ export default { @@ -97,9 +114,13 @@ export default {
97 } 114 }
98 }, 115 },
99 computed: { 116 computed: {
100 - // assay_report_gyglkzg2 节点需填写 是否继续审批 117 + // 是否审核页面
  118 + isAudit() {
  119 + return this.mode === 'audit'
  120 + },
  121 + // assay_report_gyglkzg2 节点需填写 是否继续审批(仅审核时展示)
101 showContinueApproval() { 122 showContinueApproval() {
102 - return this.nodeCode === 'assay_report_gyglkzg2' 123 + return this.isAudit && this.nodeCode === 'assay_report_gyglkzg2'
103 }, 124 },
104 componentKeys() { 125 componentKeys() {
105 // 按 workshopCode 匹配成分项,名称兜底 126 // 按 workshopCode 匹配成分项,名称兜底
@@ -117,6 +138,27 @@ export default { @@ -117,6 +138,27 @@ export default {
117 const v = this.form.hasQualityProblem 138 const v = this.form.hasQualityProblem
118 return v === true || v === 1 || v === '1' 139 return v === true || v === 1 || v === '1'
119 }, 140 },
  141 + // 审核意见:按流程顺序(仓库主管 → 供应管理科主管 → 供应部主管 → 分厂主管)展示,缺失的节点不展示
  142 + opinionRows() {
  143 + const defs = [
  144 + { key: 'ckzg', label: '仓库主管', name: 'ckzgName', opinion: 'ckzgOpinion' },
  145 + { key: 'gyglkzg', label: '供应管理科主管', name: 'gyglkzgName', opinion: 'gyglkzgOpinion' },
  146 + { key: 'gybzg', label: '供应部主管', name: 'gybzgName', opinion: 'gybzgOpinion' },
  147 + { key: 'fczg', label: '分厂主管', name: 'fczgName', opinion: 'fczgOpinion' }
  148 + ]
  149 + return defs
  150 + .map(it => {
  151 + const person = this.form[it.name] == null ? '' : String(this.form[it.name]).trim()
  152 + const opinion = this.form[it.opinion] == null ? '' : String(this.form[it.opinion]).trim()
  153 + return {
  154 + key: it.key,
  155 + label: person ? `${it.label}:${person}` : it.label,
  156 + opinion,
  157 + visible: !!(person || opinion)
  158 + }
  159 + })
  160 + .filter(it => it.visible)
  161 + },
120 approvalStatusName() { 162 approvalStatusName() {
121 const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus) 163 const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus)
122 if (!v) return '-' 164 if (!v) return '-'
@@ -255,11 +297,40 @@ export default { @@ -255,11 +297,40 @@ export default {
255 } 297 }
256 } 298 }
257 299
  300 +.opinion-section {
  301 + padding: 24rpx 32rpx;
  302 +
  303 + .opinion-item {
  304 + margin-bottom: 24rpx;
  305 +
  306 + &:last-child { margin-bottom: 0; }
  307 +
  308 + .opinion-label {
  309 + font-size: 28rpx;
  310 + color: rgba(0, 0, 0, 0.9);
  311 + line-height: 40rpx;
  312 + margin-bottom: 12rpx;
  313 + }
  314 +
  315 + .opinion-textarea {
  316 + width: 100%;
  317 + box-sizing: border-box;
  318 + height: 140rpx;
  319 + padding: 16rpx 20rpx;
  320 + background: #fafafa;
  321 + border: 1rpx solid #eee;
  322 + border-radius: 8rpx;
  323 + font-size: 28rpx;
  324 + line-height: 40rpx;
  325 + color: rgba(0, 0, 0, 0.9);
  326 + }
  327 + }
  328 +}
  329 +
258 .field-row { 330 .field-row {
259 display: flex; 331 display: flex;
260 align-items: center; 332 align-items: center;
261 justify-content: space-between; 333 justify-content: space-between;
262 -  
263 .field-label { 334 .field-label {
264 flex: none; 335 flex: none;
265 font-size: 32rpx; 336 font-size: 32rpx;
@@ -254,7 +254,9 @@ export default { @@ -254,7 +254,9 @@ export default {
254 .then(res => { 254 .then(res => {
255 const list = ((res && res.data) || []).map(item => ({ 255 const list = ((res && res.data) || []).map(item => ({
256 assayApplyId: item.assayApplyId || item.id || '', 256 assayApplyId: item.assayApplyId || item.id || '',
  257 + assayApplyLineId: item.assayApplyLineId || '',
257 assayApplyCode: item.assayApplyCode || '', 258 assayApplyCode: item.assayApplyCode || '',
  259 + sampleCode: item.sampleCode || '',
258 productName: item.productName || '', 260 productName: item.productName || '',
259 category: item.category || '', 261 category: item.category || '',
260 productId: item.productId || '', 262 productId: item.productId || '',
@@ -265,6 +267,14 @@ export default { @@ -265,6 +267,14 @@ export default {
265 line.assayApplyId && !list.some(item => item.assayApplyId === line.assayApplyId) 267 line.assayApplyId && !list.some(item => item.assayApplyId === line.assayApplyId)
266 ) 268 )
267 this.applyDetailOptions = list.concat(extra) 269 this.applyDetailOptions = list.concat(extra)
  270 + // 用数据源补全回显行的样品/数量等固定字段(详情接口明细行不含 category),并刷新表格
  271 + const merged = (detailLines || []).map(line => {
  272 + const opt = list.find(o => o.assayApplyId === line.assayApplyId) ||
  273 + extra.find(o => o.assayApplyId === line.assayApplyId) || {}
  274 + return { ...opt, ...line }
  275 + })
  276 + const detailTable = this.$refs.detailTable
  277 + detailTable && detailTable.setRows && detailTable.setRows(merged)
268 }) 278 })
269 .catch(() => { 279 .catch(() => {
270 this.applyDetailOptions = (detailLines || []).map(item => ({ ...item })) 280 this.applyDetailOptions = (detailLines || []).map(item => ({ ...item }))
@@ -356,7 +366,9 @@ export default { @@ -356,7 +366,9 @@ export default {
356 .then(res => { 366 .then(res => {
357 const list = ((res && res.data) || []).map(item => ({ 367 const list = ((res && res.data) || []).map(item => ({
358 assayApplyId: item.assayApplyId || item.id || '', 368 assayApplyId: item.assayApplyId || item.id || '',
  369 + assayApplyLineId: item.assayApplyLineId || '',
359 assayApplyCode: item.assayApplyCode || '', 370 assayApplyCode: item.assayApplyCode || '',
  371 + sampleCode: item.sampleCode || '',
360 productName: item.productName || '', 372 productName: item.productName || '',
361 category: item.category || '', 373 category: item.category || '',
362 productId: item.productId || '', 374 productId: item.productId || '',
@@ -27,9 +27,10 @@ @@ -27,9 +27,10 @@
27 <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card"> 27 <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card">
28 <view class="card-index">第 {{ idx + 1 }} 行</view> 28 <view class="card-index">第 {{ idx + 1 }} 行</view>
29 <view class="row"><text class="label">样品</text><text class="value">{{ safeText(item.productName) }}</text></view> 29 <view class="row"><text class="label">样品</text><text class="value">{{ safeText(item.productName) }}</text></view>
30 - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 30 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
31 <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view> 31 <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view>
32 - <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.assayApplyCode) }}</text></view> -->
  33 + <view class="row"><text class="label">取样编号</text><text class="value">{{ safeText(item.sampleCode) }}</text></view>
33 <view v-for="key in componentKeys" :key="key" class="row"> 34 <view v-for="key in componentKeys" :key="key" class="row">
34 <text class="label">{{ componentLabels[key] || key }}</text> 35 <text class="label">{{ componentLabels[key] || key }}</text>
35 <text class="value">{{ formatNumber(item[key]) }}</text> 36 <text class="value">{{ formatNumber(item[key]) }}</text>
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> 46 <uni-easyinput :value="item.productName" :inputBorder="false" disabled />
47 </template> 47 </template>
48 </uni-list-item> 48 </uni-list-item>
49 - <uni-list-item title="买断数量"> 49 + <uni-list-item title="买断数量(kg)">
50 <template v-slot:footer> 50 <template v-slot:footer>
51 <uni-easyinput :value="item.buyoutQuantity" :inputBorder="false" disabled /> 51 <uni-easyinput :value="item.buyoutQuantity" :inputBorder="false" disabled />
52 </template> 52 </template>
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 </uni-list-item> 63 </uni-list-item>
64 <uni-list-item> 64 <uni-list-item>
65 <template v-slot:body> 65 <template v-slot:body>
66 - <view class="item-title"><text class="required">*</text><text>入库数量</text></view> 66 + <view class="item-title"><text class="required">*</text><text>入库数量(kg)</text></view>
67 </template> 67 </template>
68 <template v-slot:footer> 68 <template v-slot:footer>
69 <uni-easyinput v-model="item.instockQuantity" type="digit" :inputBorder="false" placeholder="请输入入库数量" @input="recalcDiffAmount(item)" /> 69 <uni-easyinput v-model="item.instockQuantity" type="digit" :inputBorder="false" placeholder="请输入入库数量" @input="recalcDiffAmount(item)" />
@@ -118,7 +118,7 @@ @@ -118,7 +118,7 @@
118 <view class="total-title">合计</view> 118 <view class="total-title">合计</view>
119 <view class="total-body"> 119 <view class="total-body">
120 <view class="total-item"> 120 <view class="total-item">
121 - <text class="total-label">买断数量</text> 121 + <text class="total-label">买断数量(kg)</text>
122 <text class="total-value">{{ totalSummary.totalBuyoutQuantity || '-' }}</text> 122 <text class="total-value">{{ totalSummary.totalBuyoutQuantity || '-' }}</text>
123 </view> 123 </view>
124 <view class="total-item"> 124 <view class="total-item">
@@ -126,7 +126,7 @@ @@ -126,7 +126,7 @@
126 <text class="total-value">{{ totalSummary.totalBuyoutAmount || '-' }}</text> 126 <text class="total-value">{{ totalSummary.totalBuyoutAmount || '-' }}</text>
127 </view> 127 </view>
128 <view class="total-item"> 128 <view class="total-item">
129 - <text class="total-label">入库数量</text> 129 + <text class="total-label">入库数量(kg)</text>
130 <text class="total-value">{{ totalSummary.totalInstockQuantity || '-' }}</text> 130 <text class="total-value">{{ totalSummary.totalInstockQuantity || '-' }}</text>
131 </view> 131 </view>
132 <view class="total-item"> 132 <view class="total-item">
@@ -26,10 +26,10 @@ @@ -26,10 +26,10 @@
26 <view v-for="(item, idx) in lineList" :key="'l-' + (item.id || idx)" class="card"> 26 <view v-for="(item, idx) in lineList" :key="'l-' + (item.id || idx)" class="card">
27 <view class="card-index">第 {{ idx + 1 }} 行</view> 27 <view class="card-index">第 {{ idx + 1 }} 行</view>
28 <view class="row"><text class="label">买断品种</text><text class="value">{{ safeText(item.productName) }}</text></view> 28 <view class="row"><text class="label">买断品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
29 - <view class="row"><text class="label">买断数量</text><text class="value">{{ formatNumber(item.buyoutQuantity) }}</text></view> 29 + <view class="row"><text class="label">买断数量(kg)</text><text class="value">{{ formatNumber(item.buyoutQuantity) }}</text></view>
30 <view class="row"><text class="label">买断单价</text><text class="value">{{ formatNumber(item.buyoutPrice) }}</text></view> 30 <view class="row"><text class="label">买断单价</text><text class="value">{{ formatNumber(item.buyoutPrice) }}</text></view>
31 <view class="row"><text class="label">买断金额</text><text class="value">{{ formatNumber(item.buyoutAmount) }}</text></view> 31 <view class="row"><text class="label">买断金额</text><text class="value">{{ formatNumber(item.buyoutAmount) }}</text></view>
32 - <view class="row"><text class="label">入库数量</text><text class="value">{{ formatNumber(item.instockQuantity) }}</text></view> 32 + <view class="row"><text class="label">入库数量(kg)</text><text class="value">{{ formatNumber(item.instockQuantity) }}</text></view>
33 <view class="row"><text class="label">入库单价</text><text class="value">{{ formatNumber(item.instockPrice) }}</text></view> 33 <view class="row"><text class="label">入库单价</text><text class="value">{{ formatNumber(item.instockPrice) }}</text></view>
34 <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(item.instockAmount) }}</text></view> 34 <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(item.instockAmount) }}</text></view>
35 <view class="row"><text class="label">预计吨损耗(元/吨)</text><text class="value">{{ formatNumber(item.expectTonLoss) }}</text></view> 35 <view class="row"><text class="label">预计吨损耗(元/吨)</text><text class="value">{{ formatNumber(item.expectTonLoss) }}</text></view>
@@ -46,9 +46,9 @@ @@ -46,9 +46,9 @@
46 <span>合计</span> 46 <span>合计</span>
47 </view> 47 </view>
48 <view class="section"> 48 <view class="section">
49 - <view class="row"><text class="label">买断数量</text><text class="value">{{ formatNumber(form.totalBuyoutQuantity) }}</text></view> 49 + <view class="row"><text class="label">买断数量(kg)</text><text class="value">{{ formatNumber(form.totalBuyoutQuantity) }}</text></view>
50 <view class="row"><text class="label">买断金额</text><text class="value">{{ formatNumber(form.totalBuyoutAmount) }}</text></view> 50 <view class="row"><text class="label">买断金额</text><text class="value">{{ formatNumber(form.totalBuyoutAmount) }}</text></view>
51 - <view class="row"><text class="label">入库数量</text><text class="value">{{ formatNumber(form.totalInstockQuantity) }}</text></view> 51 + <view class="row"><text class="label">入库数量(kg)</text><text class="value">{{ formatNumber(form.totalInstockQuantity) }}</text></view>
52 <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(form.totalInstockAmount) }}</text></view> 52 <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(form.totalInstockAmount) }}</text></view>
53 <view class="row"><text class="label">差异金额</text><text class="value">{{ formatNumber(form.totalDiffAmount) }}</text></view> 53 <view class="row"><text class="label">差异金额</text><text class="value">{{ formatNumber(form.totalDiffAmount) }}</text></view>
54 </view> 54 </view>
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> 45 <uni-easyinput :value="item.productName" :inputBorder="false" disabled />
46 </template> 46 </template>
47 </uni-list-item> 47 </uni-list-item>
48 - <uni-list-item title="买断数量"> 48 + <uni-list-item title="买断数量(kg)">
49 <template v-slot:footer> 49 <template v-slot:footer>
50 <uni-easyinput :value="item.buyoutQuantity" :inputBorder="false" disabled /> 50 <uni-easyinput :value="item.buyoutQuantity" :inputBorder="false" disabled />
51 </template> 51 </template>
@@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
62 </uni-list-item> 62 </uni-list-item>
63 <uni-list-item> 63 <uni-list-item>
64 <template v-slot:body> 64 <template v-slot:body>
65 - <view class="item-title"><text class="required">*</text><text>入库数量</text></view> 65 + <view class="item-title"><text class="required">*</text><text>入库数量(kg)</text></view>
66 </template> 66 </template>
67 <template v-slot:footer> 67 <template v-slot:footer>
68 <uni-easyinput v-model="item.instockQuantity" type="digit" :inputBorder="false" placeholder="请输入入库数量" @input="recalcDiffAmount(item)" /> 68 <uni-easyinput v-model="item.instockQuantity" type="digit" :inputBorder="false" placeholder="请输入入库数量" @input="recalcDiffAmount(item)" />
@@ -117,7 +117,7 @@ @@ -117,7 +117,7 @@
117 <view class="total-title">合计</view> 117 <view class="total-title">合计</view>
118 <view class="total-body"> 118 <view class="total-body">
119 <view class="total-item"> 119 <view class="total-item">
120 - <text class="total-label">买断数量</text> 120 + <text class="total-label">买断数量(kg)</text>
121 <text class="total-value">{{ totalSummary.totalBuyoutQuantity || '-' }}</text> 121 <text class="total-value">{{ totalSummary.totalBuyoutQuantity || '-' }}</text>
122 </view> 122 </view>
123 <view class="total-item"> 123 <view class="total-item">
@@ -125,7 +125,7 @@ @@ -125,7 +125,7 @@
125 <text class="total-value">{{ totalSummary.totalBuyoutAmount || '-' }}</text> 125 <text class="total-value">{{ totalSummary.totalBuyoutAmount || '-' }}</text>
126 </view> 126 </view>
127 <view class="total-item"> 127 <view class="total-item">
128 - <text class="total-label">入库数量</text> 128 + <text class="total-label">入库数量(kg)</text>
129 <text class="total-value">{{ totalSummary.totalInstockQuantity || '-' }}</text> 129 <text class="total-value">{{ totalSummary.totalInstockQuantity || '-' }}</text>
130 </view> 130 </view>
131 <view class="total-item"> 131 <view class="total-item">
@@ -21,10 +21,10 @@ @@ -21,10 +21,10 @@
21 <view v-for="(item, idx) in lineList" :key="'l-' + (item.id || idx)" class="card"> 21 <view v-for="(item, idx) in lineList" :key="'l-' + (item.id || idx)" class="card">
22 <view class="card-index">第 {{ idx + 1 }} 行</view> 22 <view class="card-index">第 {{ idx + 1 }} 行</view>
23 <view class="row"><text class="label">买断品种</text><text class="value">{{ safeText(item.productName) }}</text></view> 23 <view class="row"><text class="label">买断品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
24 - <view class="row"><text class="label">买断数量</text><text class="value">{{ formatNumber(item.buyoutQuantity) }}</text></view> 24 + <view class="row"><text class="label">买断数量(kg)</text><text class="value">{{ formatNumber(item.buyoutQuantity) }}</text></view>
25 <view class="row"><text class="label">买断单价</text><text class="value">{{ formatNumber(item.buyoutPrice) }}</text></view> 25 <view class="row"><text class="label">买断单价</text><text class="value">{{ formatNumber(item.buyoutPrice) }}</text></view>
26 <view class="row"><text class="label">买断金额</text><text class="value">{{ formatNumber(item.buyoutAmount) }}</text></view> 26 <view class="row"><text class="label">买断金额</text><text class="value">{{ formatNumber(item.buyoutAmount) }}</text></view>
27 - <view class="row"><text class="label">入库数量</text><text class="value">{{ formatNumber(item.instockQuantity) }}</text></view> 27 + <view class="row"><text class="label">入库数量(kg)</text><text class="value">{{ formatNumber(item.instockQuantity) }}</text></view>
28 <view class="row"><text class="label">入库单价</text><text class="value">{{ formatNumber(item.instockPrice) }}</text></view> 28 <view class="row"><text class="label">入库单价</text><text class="value">{{ formatNumber(item.instockPrice) }}</text></view>
29 <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(item.instockAmount) }}</text></view> 29 <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(item.instockAmount) }}</text></view>
30 <view class="row"><text class="label">预计吨损耗(元/吨)</text><text class="value">{{ formatNumber(item.expectTonLoss) }}</text></view> 30 <view class="row"><text class="label">预计吨损耗(元/吨)</text><text class="value">{{ formatNumber(item.expectTonLoss) }}</text></view>
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 <view class="total-title">合计</view> 44 <view class="total-title">合计</view>
45 <view class="total-body"> 45 <view class="total-body">
46 <view class="total-item"> 46 <view class="total-item">
47 - <text class="total-label">买断数量</text> 47 + <text class="total-label">买断数量(kg)</text>
48 <text class="total-value">{{ formatNumber(form.totalBuyoutQuantity) }}</text> 48 <text class="total-value">{{ formatNumber(form.totalBuyoutQuantity) }}</text>
49 </view> 49 </view>
50 <view class="total-item"> 50 <view class="total-item">
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 <text class="total-value">{{ formatNumber(form.totalBuyoutAmount) }}</text> 52 <text class="total-value">{{ formatNumber(form.totalBuyoutAmount) }}</text>
53 </view> 53 </view>
54 <view class="total-item"> 54 <view class="total-item">
55 - <text class="total-label">入库数量</text> 55 + <text class="total-label">入库数量(kg)</text>
56 <text class="total-value">{{ formatNumber(form.totalInstockQuantity) }}</text> 56 <text class="total-value">{{ formatNumber(form.totalInstockQuantity) }}</text>
57 </view> 57 </view>
58 <view class="total-item"> 58 <view class="total-item">
@@ -66,6 +66,39 @@ @@ -66,6 +66,39 @@
66 </uni-list-item> 66 </uni-list-item>
67 </uni-list> 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 <view class="footer"> 102 <view class="footer">
70 <button class="btn submit" type="primary" @click="onSubmit">保存</button> 103 <button class="btn submit" type="primary" @click="onSubmit">保存</button>
71 </view> 104 </view>
@@ -101,6 +134,8 @@ export default { @@ -101,6 +134,8 @@ export default {
101 productId: '', 134 productId: '',
102 department: '' 135 department: ''
103 }, 136 },
  137 + // 取样明细(可编辑)
  138 + sampleLines: [],
104 dicOptions: { DEPARTMENT: [] }, 139 dicOptions: { DEPARTMENT: [] },
105 // 计划编号下拉选项(所选码单下的计划) 140 // 计划编号下拉选项(所选码单下的计划)
106 planOptions: [], 141 planOptions: [],
@@ -130,6 +165,12 @@ export default { @@ -130,6 +165,12 @@ export default {
130 return (this.dicOptions.DEPARTMENT || []).map(it => it.name) 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 created() { 174 created() {
134 this.ticketSheet.fetchFn = this.fetchTickets.bind(this) 175 this.ticketSheet.fetchFn = this.fetchTickets.bind(this)
135 this.loadDicData() 176 this.loadDicData()
@@ -247,6 +288,31 @@ export default { @@ -247,6 +288,31 @@ export default {
247 if (!opt) return 288 if (!opt) return
248 this.form.department = opt.code != null ? String(opt.code) : '' 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 validate() { 316 validate() {
251 const f = this.form 317 const f = this.form
252 if (!f.code) return this.tip('请生成送样编号') 318 if (!f.code) return this.tip('请生成送样编号')
@@ -254,6 +320,8 @@ export default { @@ -254,6 +320,8 @@ export default {
254 if (!f.procurementPlanId) return this.tip('请选择计划编号') 320 if (!f.procurementPlanId) return this.tip('请选择计划编号')
255 if (!f.productId) return this.tip('请选择品种') 321 if (!f.productId) return this.tip('请选择品种')
256 if (!f.department) return this.tip('请选择科室') 322 if (!f.department) return this.tip('请选择科室')
  323 + // 取样明细必填:至少添加一行
  324 + if (!this.sampleLines.length) return this.tip('请至少添加一行取样明细')
257 return true 325 return true
258 }, 326 },
259 tip(msg) { 327 tip(msg) {
@@ -272,7 +340,12 @@ export default { @@ -272,7 +340,12 @@ export default {
272 weighingTicketId: this.form.weighingTicketId, 340 weighingTicketId: this.form.weighingTicketId,
273 procurementPlanId: this.form.procurementPlanId, 341 procurementPlanId: this.form.procurementPlanId,
274 productId: this.form.productId, 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 .then(() => { 350 .then(() => {
278 uni.hideLoading() 351 uni.hideLoading()
@@ -287,6 +360,11 @@ export default { @@ -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 </script> 368 </script>
291 369
292 <style lang="scss" scoped> 370 <style lang="scss" scoped>
@@ -357,6 +435,29 @@ export default { @@ -357,6 +435,29 @@ export default {
357 &__container { 435 &__container {
358 padding: 32rpx; 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 .item-title, 461 .item-title,
361 .uni-list-item__content { 462 .uni-list-item__content {
362 flex: none; 463 flex: none;
@@ -435,4 +536,81 @@ export default { @@ -435,4 +536,81 @@ export default {
435 color: rgba(0, 0, 0, 0.4); 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 </style> 616 </style>
@@ -13,6 +13,26 @@ @@ -13,6 +13,26 @@
13 <view class="row"><text class="label">创建人</text><text class="value">{{ safeText(form.createBy) }}</text></view> 13 <view class="row"><text class="label">创建人</text><text class="value">{{ safeText(form.createBy) }}</text></view>
14 <view class="row"><text class="label">创建时间</text><text class="value">{{ safeText(form.createTime) }}</text></view> 14 <view class="row"><text class="label">创建时间</text><text class="value">{{ safeText(form.createTime) }}</text></view>
15 </view> 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 </view> 36 </view>
17 </scroll-view> 37 </scroll-view>
18 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> 38 <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
@@ -36,6 +56,9 @@ export default { @@ -36,6 +56,9 @@ export default {
36 return { 56 return {
37 id: '', 57 id: '',
38 form: {}, 58 form: {},
  59 + // 取样明细
  60 + sampleLines: [],
  61 + collapse: { sample: false },
39 currentUserId: '', 62 currentUserId: '',
40 dicOptions: { 63 dicOptions: {
41 DEPARTMENT: [], 64 DEPARTMENT: [],
@@ -107,6 +130,9 @@ export default { @@ -107,6 +130,9 @@ export default {
107 this.loadDetail() 130 this.loadDetail()
108 }, 131 },
109 methods: { 132 methods: {
  133 + toggle(key) {
  134 + this.collapse = { ...this.collapse, [key]: !this.collapse[key] }
  135 + },
110 async loadDicData() { 136 async loadDicData() {
111 try { 137 try {
112 const results = await getDicByCodes(['DEPARTMENT', 'AUDIT_STATUS']) 138 const results = await getDicByCodes(['DEPARTMENT', 'AUDIT_STATUS'])
@@ -134,6 +160,8 @@ export default { @@ -134,6 +160,8 @@ export default {
134 .then(res => { 160 .then(res => {
135 const data = res && res.data ? res.data : {} 161 const data = res && res.data ? res.data : {}
136 this.form = Object.assign({}, data) 162 this.form = Object.assign({}, data)
  163 + // 取样明细回显
  164 + this.sampleLines = Array.isArray(data.lines) ? data.lines.map(x => ({ ...x })) : []
137 }) 165 })
138 .catch(() => { 166 .catch(() => {
139 uni.showToast({ title: '详情加载失败', icon: 'none' }) 167 uni.showToast({ title: '详情加载失败', icon: 'none' })
@@ -280,4 +308,80 @@ export default { @@ -280,4 +308,80 @@ export default {
280 word-break: break-all; 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 </style> 387 </style>
@@ -63,6 +63,39 @@ @@ -63,6 +63,39 @@
63 </uni-list-item> 63 </uni-list-item>
64 </uni-list> 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 <view class="footer"> 99 <view class="footer">
67 <button class="btn submit" type="primary" @click="onSubmit">保存</button> 100 <button class="btn submit" type="primary" @click="onSubmit">保存</button>
68 </view> 101 </view>
@@ -99,6 +132,8 @@ export default { @@ -99,6 +132,8 @@ export default {
99 productId: '', 132 productId: '',
100 department: '' 133 department: ''
101 }, 134 },
  135 + // 取样明细(可编辑)
  136 + sampleLines: [],
102 dicOptions: { DEPARTMENT: [] }, 137 dicOptions: { DEPARTMENT: [] },
103 // 计划编号下拉选项(所选码单下的计划) 138 // 计划编号下拉选项(所选码单下的计划)
104 planOptions: [], 139 planOptions: [],
@@ -128,6 +163,12 @@ export default { @@ -128,6 +163,12 @@ export default {
128 return (this.dicOptions.DEPARTMENT || []).map(it => it.name) 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 created() { 172 created() {
132 this.ticketSheet.fetchFn = this.fetchTickets.bind(this) 173 this.ticketSheet.fetchFn = this.fetchTickets.bind(this)
133 this.loadDicData() 174 this.loadDicData()
@@ -169,6 +210,8 @@ export default { @@ -169,6 +210,8 @@ export default {
169 this.productOptions = this.form.productId 210 this.productOptions = this.form.productId
170 ? [{ label: data.productName || '', value: this.form.productId }] 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 if (this.form.weighingTicketId) { 215 if (this.form.weighingTicketId) {
173 this.loadPlanOptions(this.form.weighingTicketId) 216 this.loadPlanOptions(this.form.weighingTicketId)
174 } 217 }
@@ -301,12 +344,39 @@ export default { @@ -301,12 +344,39 @@ export default {
301 if (!opt) return 344 if (!opt) return
302 this.form.department = opt.code != null ? String(opt.code) : '' 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 validate() { 372 validate() {
305 const f = this.form 373 const f = this.form
306 if (!f.weighingTicketId) return this.tip('请选择码单编号') 374 if (!f.weighingTicketId) return this.tip('请选择码单编号')
307 if (!f.procurementPlanId) return this.tip('请选择计划编号') 375 if (!f.procurementPlanId) return this.tip('请选择计划编号')
308 if (!f.productId) return this.tip('请选择品种') 376 if (!f.productId) return this.tip('请选择品种')
309 if (!f.department) return this.tip('请选择科室') 377 if (!f.department) return this.tip('请选择科室')
  378 + // 取样明细必填:至少添加一行
  379 + if (!this.sampleLines.length) return this.tip('请至少添加一行取样明细')
310 return true 380 return true
311 }, 381 },
312 tip(msg) { 382 tip(msg) {
@@ -326,7 +396,12 @@ export default { @@ -326,7 +396,12 @@ export default {
326 weighingTicketId: this.form.weighingTicketId, 396 weighingTicketId: this.form.weighingTicketId,
327 procurementPlanId: this.form.procurementPlanId, 397 procurementPlanId: this.form.procurementPlanId,
328 productId: this.form.productId, 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 .then(() => { 406 .then(() => {
332 uni.hideLoading() 407 uni.hideLoading()
@@ -344,6 +419,11 @@ export default { @@ -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 </script> 427 </script>
348 428
349 <style lang="scss" scoped> 429 <style lang="scss" scoped>
@@ -414,6 +494,29 @@ export default { @@ -414,6 +494,29 @@ export default {
414 &__container { 494 &__container {
415 padding: 32rpx; 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 .item-title, 520 .item-title,
418 .uni-list-item__content { 521 .uni-list-item__content {
419 flex: none; 522 flex: none;
@@ -476,4 +579,81 @@ export default { @@ -476,4 +579,81 @@ export default {
476 color: rgba(0, 0, 0, 0.4); 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 </style> 659 </style>
@@ -12,6 +12,22 @@ @@ -12,6 +12,22 @@
12 <view class="row"><text class="label">创建人</text><text class="value">{{ safeText(form.createBy) }}</text></view> 12 <view class="row"><text class="label">创建人</text><text class="value">{{ safeText(form.createBy) }}</text></view>
13 <view class="row"><text class="label">创建时间</text><text class="value">{{ safeText(form.createTime) }}</text></view> 13 <view class="row"><text class="label">创建时间</text><text class="value">{{ safeText(form.createTime) }}</text></view>
14 </view> 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 </scroll-view> 31 </scroll-view>
16 </view> 32 </view>
17 </template> 33 </template>
@@ -26,6 +42,8 @@ export default { @@ -26,6 +42,8 @@ export default {
26 data() { 42 data() {
27 return { 43 return {
28 form: {}, 44 form: {},
  45 + // 取样明细
  46 + sampleLines: [],
29 dicOptions: { 47 dicOptions: {
30 DEPARTMENT: [], 48 DEPARTMENT: [],
31 AUDIT_STATUS: [] 49 AUDIT_STATUS: []
@@ -71,6 +89,8 @@ export default { @@ -71,6 +89,8 @@ export default {
71 .then(res => { 89 .then(res => {
72 const data = res && res.data ? res.data : {} 90 const data = res && res.data ? res.data : {}
73 this.form = Object.assign({}, data) 91 this.form = Object.assign({}, data)
  92 + // 取样明细回显
  93 + this.sampleLines = Array.isArray(data.lines) ? data.lines.map(x => ({ ...x })) : []
74 }) 94 })
75 .catch(() => { 95 .catch(() => {
76 uni.showToast({ title: '详情加载失败', icon: 'none' }) 96 uni.showToast({ title: '详情加载失败', icon: 'none' })
@@ -138,4 +158,95 @@ export default { @@ -138,4 +158,95 @@ export default {
138 word-break: break-all; 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 </style> 252 </style>
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 </uni-list-item> 63 </uni-list-item>
64 <uni-list-item> 64 <uni-list-item>
65 <template v-slot:body> 65 <template v-slot:body>
66 - <view class="item-title"><text class="required">*</text><text>数量(采购数)</text></view> 66 + <view class="item-title"><text class="required">*</text><text>数量(采购数kg)</text></view>
67 </template> 67 </template>
68 <template v-slot:footer> 68 <template v-slot:footer>
69 <uni-easyinput v-model="item.purchaseQuantity" type="digit" :inputBorder="false" placeholder="请输入采购数" @input="recalcTaxAmount(item)" /> 69 <uni-easyinput v-model="item.purchaseQuantity" type="digit" :inputBorder="false" placeholder="请输入采购数" @input="recalcTaxAmount(item)" />
@@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
71 </uni-list-item> 71 </uni-list-item>
72 <uni-list-item> 72 <uni-list-item>
73 <template v-slot:body> 73 <template v-slot:body>
74 - <view class="item-title"><text class="required">*</text><text>数量(实收数)</text></view> 74 + <view class="item-title"><text class="required">*</text><text>数量(实收数kg)</text></view>
75 </template> 75 </template>
76 <template v-slot:footer> 76 <template v-slot:footer>
77 <uni-easyinput v-model="item.actualQuantity" type="digit" :inputBorder="false" placeholder="请输入实收数" /> 77 <uni-easyinput v-model="item.actualQuantity" type="digit" :inputBorder="false" placeholder="请输入实收数" />
@@ -115,11 +115,11 @@ @@ -115,11 +115,11 @@
115 <view class="total-title">合计</view> 115 <view class="total-title">合计</view>
116 <view class="total-body"> 116 <view class="total-body">
117 <view class="total-item"> 117 <view class="total-item">
118 - <text class="total-label">采购数</text> 118 + <text class="total-label">采购数(kg)</text>
119 <text class="total-value">{{ purchaseQuantityCap }}</text> 119 <text class="total-value">{{ purchaseQuantityCap }}</text>
120 </view> 120 </view>
121 <view class="total-item"> 121 <view class="total-item">
122 - <text class="total-label">实收数</text> 122 + <text class="total-label">实收数(kg)</text>
123 <text class="total-value">{{ totalActualQuantity || '-' }}</text> 123 <text class="total-value">{{ totalActualQuantity || '-' }}</text>
124 </view> 124 </view>
125 <view class="total-item"> 125 <view class="total-item">
@@ -143,9 +143,9 @@ @@ -143,9 +143,9 @@
143 143
144 <!-- 附件 --> 144 <!-- 附件 -->
145 <view class="form-group"> 145 <view class="form-group">
146 - <view class="item-title"><text class="required">*</text><text>附件</text></view> 146 + <view class="item-title"><text>附件</text></view>
147 <view class="upload-btn" @click="selectFile">上传文件</view> 147 <view class="upload-btn" @click="selectFile">上传文件</view>
148 - <view v-if="!fileList.length" class="empty-tip">请上传附件</view> 148 + <view v-if="!fileList.length" class="empty-tip">暂无附件</view>
149 <view v-for="(file, idx) in fileList" :key="file.fileId || idx" class="file-item"> 149 <view v-for="(file, idx) in fileList" :key="file.fileId || idx" class="file-item">
150 <text class="file-name">{{ file.fileName || '未命名文件' }}</text> 150 <text class="file-name">{{ file.fileName || '未命名文件' }}</text>
151 <text class="file-del" @click="removeFile(idx)">删除</text> 151 <text class="file-del" @click="removeFile(idx)">删除</text>
@@ -442,7 +442,6 @@ export default { @@ -442,7 +442,6 @@ export default {
442 if (row.actualQuantity === '' || row.actualQuantity == null) return this.tip(`明细第${i + 1}行:请输入实收数`) 442 if (row.actualQuantity === '' || row.actualQuantity == null) return this.tip(`明细第${i + 1}行:请输入实收数`)
443 if (row.taxPrice === '' || row.taxPrice == null) return this.tip(`明细第${i + 1}行:请输入含税单价`) 443 if (row.taxPrice === '' || row.taxPrice == null) return this.tip(`明细第${i + 1}行:请输入含税单价`)
444 } 444 }
445 - if (!this.fileList.length) return this.tip('请上传附件')  
446 return true 445 return true
447 }, 446 },
448 tip(msg) { 447 tip(msg) {
@@ -29,8 +29,8 @@ @@ -29,8 +29,8 @@
29 <view class="row"><text class="label">材料名称</text><text class="value">{{ safeText(item.name) }}</text></view> 29 <view class="row"><text class="label">材料名称</text><text class="value">{{ safeText(item.name) }}</text></view>
30 <view class="row"><text class="label">规格型号</text><text class="value">{{ safeText(item.specModel) }}</text></view> 30 <view class="row"><text class="label">规格型号</text><text class="value">{{ safeText(item.specModel) }}</text></view>
31 <view class="row"><text class="label">单位</text><text class="value">{{ safeText(item.unit) }}</text></view> 31 <view class="row"><text class="label">单位</text><text class="value">{{ safeText(item.unit) }}</text></view>
32 - <view class="row"><text class="label">数量(采购数)</text><text class="value">{{ formatNumber(item.purchaseQuantity) }}</text></view>  
33 - <view class="row"><text class="label">数量(实收数)</text><text class="value">{{ formatNumber(item.actualQuantity) }}</text></view> 32 + <view class="row"><text class="label">数量(采购数kg)</text><text class="value">{{ formatNumber(item.purchaseQuantity) }}</text></view>
  33 + <view class="row"><text class="label">数量(实收数kg)</text><text class="value">{{ formatNumber(item.actualQuantity) }}</text></view>
34 <view class="row"><text class="label">含税价格(单价)</text><text class="value">{{ formatNumber(item.taxPrice) }}</text></view> 34 <view class="row"><text class="label">含税价格(单价)</text><text class="value">{{ formatNumber(item.taxPrice) }}</text></view>
35 <view class="row"><text class="label">含税价格(金额)</text><text class="value">{{ formatNumber(item.taxAmount) }}</text></view> 35 <view class="row"><text class="label">含税价格(金额)</text><text class="value">{{ formatNumber(item.taxAmount) }}</text></view>
36 <view class="row"><text class="label">不含税价格(单价)</text><text class="value">{{ formatNumber(item.noTaxPrice) }}</text></view> 36 <view class="row"><text class="label">不含税价格(单价)</text><text class="value">{{ formatNumber(item.noTaxPrice) }}</text></view>
@@ -44,11 +44,11 @@ @@ -44,11 +44,11 @@
44 <view class="total-title">合计</view> 44 <view class="total-title">合计</view>
45 <view class="total-body"> 45 <view class="total-body">
46 <view class="total-item"> 46 <view class="total-item">
47 - <text class="total-label">采购数</text> 47 + <text class="total-label">采购数(kg)</text>
48 <text class="total-value">{{ purchaseQuantityCap }}</text> 48 <text class="total-value">{{ purchaseQuantityCap }}</text>
49 </view> 49 </view>
50 <view class="total-item"> 50 <view class="total-item">
51 - <text class="total-label">实收数</text> 51 + <text class="total-label">实收数(kg)</text>
52 <text class="total-value">{{ formatNumber(form.totalActualQuantity) }}</text> 52 <text class="total-value">{{ formatNumber(form.totalActualQuantity) }}</text>
53 </view> 53 </view>
54 <view class="total-item"> 54 <view class="total-item">
@@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
62 </uni-list-item> 62 </uni-list-item>
63 <uni-list-item> 63 <uni-list-item>
64 <template v-slot:body> 64 <template v-slot:body>
65 - <view class="item-title"><text class="required">*</text><text>数量(采购数)</text></view> 65 + <view class="item-title"><text class="required">*</text><text>数量(采购数kg)</text></view>
66 </template> 66 </template>
67 <template v-slot:footer> 67 <template v-slot:footer>
68 <uni-easyinput v-model="item.purchaseQuantity" type="digit" :inputBorder="false" placeholder="请输入采购数" @input="recalcTaxAmount(item)" /> 68 <uni-easyinput v-model="item.purchaseQuantity" type="digit" :inputBorder="false" placeholder="请输入采购数" @input="recalcTaxAmount(item)" />
@@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
70 </uni-list-item> 70 </uni-list-item>
71 <uni-list-item> 71 <uni-list-item>
72 <template v-slot:body> 72 <template v-slot:body>
73 - <view class="item-title"><text class="required">*</text><text>数量(实收数)</text></view> 73 + <view class="item-title"><text class="required">*</text><text>数量(实收数kg)</text></view>
74 </template> 74 </template>
75 <template v-slot:footer> 75 <template v-slot:footer>
76 <uni-easyinput v-model="item.actualQuantity" type="digit" :inputBorder="false" placeholder="请输入实收数" /> 76 <uni-easyinput v-model="item.actualQuantity" type="digit" :inputBorder="false" placeholder="请输入实收数" />
@@ -114,11 +114,11 @@ @@ -114,11 +114,11 @@
114 <view class="total-title">合计</view> 114 <view class="total-title">合计</view>
115 <view class="total-body"> 115 <view class="total-body">
116 <view class="total-item"> 116 <view class="total-item">
117 - <text class="total-label">采购数</text> 117 + <text class="total-label">采购数(kg)</text>
118 <text class="total-value">{{ purchaseQuantityCap }}</text> 118 <text class="total-value">{{ purchaseQuantityCap }}</text>
119 </view> 119 </view>
120 <view class="total-item"> 120 <view class="total-item">
121 - <text class="total-label">实收数</text> 121 + <text class="total-label">实收数(kg)</text>
122 <text class="total-value">{{ totalActualQuantity || '-' }}</text> 122 <text class="total-value">{{ totalActualQuantity || '-' }}</text>
123 </view> 123 </view>
124 <view class="total-item"> 124 <view class="total-item">
@@ -142,9 +142,9 @@ @@ -142,9 +142,9 @@
142 142
143 <!-- 附件 --> 143 <!-- 附件 -->
144 <view class="form-group"> 144 <view class="form-group">
145 - <view class="item-title"><text class="required">*</text><text>附件</text></view> 145 + <view class="item-title"><text>附件</text></view>
146 <view class="upload-btn" @click="selectFile">上传文件</view> 146 <view class="upload-btn" @click="selectFile">上传文件</view>
147 - <view v-if="!fileList.length" class="empty-tip">请上传附件</view> 147 + <view v-if="!fileList.length" class="empty-tip">暂无附件</view>
148 <view v-for="(file, idx) in fileList" :key="file.fileId || idx" class="file-item"> 148 <view v-for="(file, idx) in fileList" :key="file.fileId || idx" class="file-item">
149 <text class="file-name">{{ file.fileName || '未命名文件' }}</text> 149 <text class="file-name">{{ file.fileName || '未命名文件' }}</text>
150 <text class="file-del" @click="removeFile(idx)">删除</text> 150 <text class="file-del" @click="removeFile(idx)">删除</text>
@@ -369,7 +369,6 @@ export default { @@ -369,7 +369,6 @@ export default {
369 if (row.actualQuantity === '' || row.actualQuantity == null) return this.tip(`明细第${i + 1}行:请输入实收数`) 369 if (row.actualQuantity === '' || row.actualQuantity == null) return this.tip(`明细第${i + 1}行:请输入实收数`)
370 if (row.taxPrice === '' || row.taxPrice == null) return this.tip(`明细第${i + 1}行:请输入含税单价`) 370 if (row.taxPrice === '' || row.taxPrice == null) return this.tip(`明细第${i + 1}行:请输入含税单价`)
371 } 371 }
372 - if (!this.fileList.length) return this.tip('请上传附件')  
373 return true 372 return true
374 }, 373 },
375 tip(msg) { 374 tip(msg) {
@@ -24,9 +24,9 @@ @@ -24,9 +24,9 @@
24 <view class="row"><text class="label">材料名称</text><text class="value">{{ safeText(item.name) }}</text></view> 24 <view class="row"><text class="label">材料名称</text><text class="value">{{ safeText(item.name) }}</text></view>
25 <view class="row"><text class="label">规格型号</text><text class="value">{{ safeText(item.specModel) }}</text></view> 25 <view class="row"><text class="label">规格型号</text><text class="value">{{ safeText(item.specModel) }}</text></view>
26 <view class="row"><text class="label">单位</text><text class="value">{{ safeText(item.unit) }}</text></view> 26 <view class="row"><text class="label">单位</text><text class="value">{{ safeText(item.unit) }}</text></view>
27 - <view class="row"><text class="label">数量(采购数)</text><text class="value">{{ formatNumber(item.purchaseQuantity) }}</text></view> 27 + <view class="row"><text class="label">数量(采购数kg)</text><text class="value">{{ formatNumber(item.purchaseQuantity) }}</text></view>
28 <view class="row actual-row"> 28 <view class="row actual-row">
29 - <view class="label"><text v-if="canEditActualQuantity" class="required">*</text><text>数量(实收数)</text></view> 29 + <view class="label"><text v-if="canEditActualQuantity" class="required">*</text><text>数量(实收数kg)</text></view>
30 <view class="actual-value"> 30 <view class="actual-value">
31 <uni-easyinput v-if="canEditActualQuantity" v-model="item.actualQuantity" type="digit" 31 <uni-easyinput v-if="canEditActualQuantity" v-model="item.actualQuantity" type="digit"
32 :inputBorder="false" placeholder="请输入实收数" /> 32 :inputBorder="false" placeholder="请输入实收数" />
@@ -50,11 +50,11 @@ @@ -50,11 +50,11 @@
50 <view class="total-title">合计</view> 50 <view class="total-title">合计</view>
51 <view class="total-body"> 51 <view class="total-body">
52 <view class="total-item"> 52 <view class="total-item">
53 - <text class="total-label">采购数</text> 53 + <text class="total-label">采购数(kg)</text>
54 <text class="total-value">{{ purchaseQuantityCap }}</text> 54 <text class="total-value">{{ purchaseQuantityCap }}</text>
55 </view> 55 </view>
56 <view class="total-item"> 56 <view class="total-item">
57 - <text class="total-label">实收数</text> 57 + <text class="total-label">实收数(kg)</text>
58 <text class="total-value">{{ formatNumber(form.totalActualQuantity) }}</text> 58 <text class="total-value">{{ formatNumber(form.totalActualQuantity) }}</text>
59 </view> 59 </view>
60 <view class="total-item"> 60 <view class="total-item">
@@ -79,7 +79,7 @@ @@ -79,7 +79,7 @@
79 <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> 79 <uni-easyinput :value="item.productName" :inputBorder="false" disabled />
80 </template> 80 </template>
81 </uni-list-item> 81 </uni-list-item>
82 - <uni-list-item title="计划数量"> 82 + <uni-list-item title="计划数量(kg)">
83 <template v-slot:footer> 83 <template v-slot:footer>
84 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> 84 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
85 </template> 85 </template>
@@ -135,7 +135,7 @@ @@ -135,7 +135,7 @@
135 </uni-list-item> 135 </uni-list-item>
136 <uni-list-item title="过磅数量"> 136 <uni-list-item title="过磅数量">
137 <template v-slot:body> 137 <template v-slot:body>
138 - <view class="item-title"><text class="required">*</text><text>过磅数量</text></view> 138 + <view class="item-title"><text class="required">*</text><text>过磅数量(kg)</text></view>
139 </template> 139 </template>
140 <template v-slot:footer> 140 <template v-slot:footer>
141 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" /> 141 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" />
@@ -179,7 +179,7 @@ @@ -179,7 +179,7 @@
179 </uni-list-item> 179 </uni-list-item>
180 <uni-list-item title="数量"> 180 <uni-list-item title="数量">
181 <template v-slot:body> 181 <template v-slot:body>
182 - <view class="item-title"><text class="required">*</text><text>数量</text></view> 182 + <view class="item-title"><text class="required">*</text><text>数量(kg)</text></view>
183 </template> 183 </template>
184 <template v-slot:footer> 184 <template v-slot:footer>
185 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" /> 185 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" />
@@ -210,7 +210,7 @@ @@ -210,7 +210,7 @@
210 </uni-list-item> 210 </uni-list-item>
211 <uni-list-item> 211 <uni-list-item>
212 <template v-slot:body> 212 <template v-slot:body>
213 - <view class="item-title"><text class="required">*</text><text>过磅总重</text></view> 213 + <view class="item-title"><text class="required">*</text><text>过磅总重(kg)</text></view>
214 </template> 214 </template>
215 <template v-slot:footer> 215 <template v-slot:footer>
216 <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" /> 216 <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" />
@@ -218,13 +218,13 @@ @@ -218,13 +218,13 @@
218 </uni-list-item> 218 </uni-list-item>
219 <uni-list-item> 219 <uni-list-item>
220 <template v-slot:body> 220 <template v-slot:body>
221 - <view class="item-title"><text class="required">*</text><text>实际伙重</text></view> 221 + <view class="item-title"><text class="required">*</text><text>实际伙重(kg)</text></view>
222 </template> 222 </template>
223 <template v-slot:footer> 223 <template v-slot:footer>
224 <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" /> 224 <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" />
225 </template> 225 </template>
226 </uni-list-item> 226 </uni-list-item>
227 - <uni-list-item title="货物净重"> 227 + <uni-list-item title="货物净重(kg)">
228 <template v-slot:footer> 228 <template v-slot:footer>
229 <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled /> 229 <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled />
230 </template> 230 </template>
@@ -251,7 +251,16 @@ @@ -251,7 +251,16 @@
251 <uni-list> 251 <uni-list>
252 <uni-list-item> 252 <uni-list-item>
253 <template v-slot:body> 253 <template v-slot:body>
254 - <view class="item-title"><text class="required">*</text><text>供应存欠料</text></view> 254 + <view class="item-title"><text>来料类型备注</text></view>
  255 + </template>
  256 + <template v-slot:footer>
  257 + <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypesRemarks"
  258 + type="textarea" :inputBorder="false" placeholder="请输入来料类型备注" autoHeight />
  259 + </template>
  260 + </uni-list-item>
  261 + <uni-list-item>
  262 + <template v-slot:body>
  263 + <view class="item-title"><text>供应存欠料</text></view>
255 </template> 264 </template>
256 <template v-slot:footer> 265 <template v-slot:footer>
257 <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" /> 266 <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" />
@@ -259,7 +268,7 @@ @@ -259,7 +268,7 @@
259 </uni-list-item> 268 </uni-list-item>
260 <uni-list-item> 269 <uni-list-item>
261 <template v-slot:body> 270 <template v-slot:body>
262 - <view class="item-title"><text class="required">*</text><text>物流存欠料</text></view> 271 + <view class="item-title"><text>物流存欠料</text></view>
263 </template> 272 </template>
264 <template v-slot:footer> 273 <template v-slot:footer>
265 <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" /> 274 <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" />
@@ -319,7 +328,7 @@ import { @@ -319,7 +328,7 @@ import {
319 weighTicketCreateApi 328 weighTicketCreateApi
320 } from '@/api/procure-manage/weighTicket.js' 329 } from '@/api/procure-manage/weighTicket.js'
321 import { breedRelationshipQueryApi } from '@/api/procure-manage/salesmanQuotation.js' 330 import { breedRelationshipQueryApi } from '@/api/procure-manage/salesmanQuotation.js'
322 -import { getDicByCodes, getDicName } from '@/utils/dic.js' 331 +import { getDicByCodes } from '@/utils/dic.js'
323 332
324 export default { 333 export default {
325 name: 'AddWeightTicket', 334 name: 'AddWeightTicket',
@@ -336,6 +345,7 @@ export default { @@ -336,6 +345,7 @@ export default {
336 totalGrossWeight: '', 345 totalGrossWeight: '',
337 actualImpurityWeight: '', 346 actualImpurityWeight: '',
338 deductionTypes: [], 347 deductionTypes: [],
  348 + deductionTypesRemarks: '',
339 supplierStockMaterial: '', 349 supplierStockMaterial: '',
340 logisticsStockMaterial: '', 350 logisticsStockMaterial: '',
341 plateNumber: '', 351 plateNumber: '',
@@ -420,6 +430,14 @@ export default { @@ -420,6 +430,14 @@ export default {
420 if (net === '' || net === null || net === undefined) return '' 430 if (net === '' || net === null || net === undefined) return ''
421 return numberToChineseUpper(net) 431 return numberToChineseUpper(net)
422 }, 432 },
  433 + // 过磅数量合计
  434 + weightQuantityTotal() {
  435 + const total = (this.weighList || []).reduce((sum, item) => {
  436 + const qty = Number(item.quantity)
  437 + return sum + (isNaN(qty) ? 0 : qty)
  438 + }, 0)
  439 + return Math.round(total * 100) / 100
  440 + },
423 // 业务摘要 441 // 业务摘要
424 computedBusinessSummary() { 442 computedBusinessSummary() {
425 const parts = [] 443 const parts = []
@@ -432,10 +450,9 @@ export default { @@ -432,10 +450,9 @@ export default {
432 }) 450 })
433 .filter(text => !!text) 451 .filter(text => !!text)
434 if (weightItems.length) parts.push(weightItems.join('、')) 452 if (weightItems.length) parts.push(weightItems.join('、'))
435 - const deductionNames = (this.form.deductionTypes || [])  
436 - .map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE))  
437 - .filter(name => !!name)  
438 - if (deductionNames.length) parts.push(deductionNames.join('、')) 453 + // 来料扣杂类型段落以「来料类型备注」文本为准(用户可自由修改)
  454 + const deductionSegment = (this.form.deductionTypesRemarks || '').trim()
  455 + if (deductionSegment) parts.push(deductionSegment)
439 if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) 456 if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`)
440 if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) 457 if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`)
441 if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`) 458 if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`)
@@ -448,6 +465,15 @@ export default { @@ -448,6 +465,15 @@ export default {
448 return [summary, note].filter(text => !!text).join('\n') 465 return [summary, note].filter(text => !!text).join('\n')
449 } 466 }
450 }, 467 },
  468 + watch: {
  469 + // 来料扣杂类型增减时,同步维护「来料类型备注」文本(保留用户已填写的数字等内容)
  470 + 'form.deductionTypes': {
  471 + deep: true,
  472 + handler(list) {
  473 + this.syncDeductionRemark(list)
  474 + }
  475 + }
  476 + },
451 created() { 477 created() {
452 this.planSheet.fetchFn = this.fetchPlans.bind(this) 478 this.planSheet.fetchFn = this.fetchPlans.bind(this)
453 this.loadDicData() 479 this.loadDicData()
@@ -494,6 +520,31 @@ export default { @@ -494,6 +520,31 @@ export default {
494 }) 520 })
495 .catch(() => {}) 521 .catch(() => {})
496 }, 522 },
  523 + // 按所选扣杂类型同步备注文本:移除已取消的类型、补充新增的类型,保留用户已填写的后缀内容
  524 + syncDeductionRemark(list) {
  525 + const selected = (list || []).map(code => String(code))
  526 + const names = this.deductionTypeOptions
  527 + .filter(it => selected.includes(it.value))
  528 + .map(it => it.text)
  529 + .filter(name => !!name)
  530 + const segments = (this.form.deductionTypesRemarks || '')
  531 + .split('、')
  532 + .map(text => text.trim())
  533 + .filter(text => !!text)
  534 + // 名称按长度倒序匹配,避免「水」误匹配「水杂」这类前缀相同的情况
  535 + const sortedNames = names.slice().sort((a, b) => b.length - a.length)
  536 + const matched = []
  537 + segments.forEach(text => {
  538 + const name = sortedNames.find(item => text.startsWith(item))
  539 + if (!name) return
  540 + if (!matched.some(item => item.name === name)) matched.push({ name, text })
  541 + })
  542 + const result = names.map(name => {
  543 + const found = matched.find(item => item.name === name)
  544 + return found ? found.text : name
  545 + })
  546 + this.form.deductionTypesRemarks = result.join('、')
  547 + },
497 // 计划选择弹窗数据源 548 // 计划选择弹窗数据源
498 fetchPlans({ pageIndex, pageSize, extra }) { 549 fetchPlans({ pageIndex, pageSize, extra }) {
499 const keyword = (extra && extra.keyword) || '' 550 const keyword = (extra && extra.keyword) || ''
@@ -563,11 +614,16 @@ export default { @@ -563,11 +614,16 @@ export default {
563 row.productName = '' 614 row.productName = ''
564 row.invoiceProductName = '' 615 row.invoiceProductName = ''
565 }, 616 },
  617 + // 当前行可选的品种(同一计划下已被其他行选中的品种不再展示)
  618 + getWeightProductOptions(item) {
  619 + const used = (this.weighList || [])
  620 + .filter(row => row !== item && row.planCode === item.planCode && row.productId && row.productId !== item.productId)
  621 + .map(row => row.productId)
  622 + return (this.planList || []).filter(it => it.planCode === item.planCode && !used.includes(it.productId))
  623 + },
566 // 当前计划编号下的品种选项 624 // 当前计划编号下的品种选项
567 getWeightProductLabels(item) { 625 getWeightProductLabels(item) {
568 - return (this.planList || [])  
569 - .filter(it => it.planCode === item.planCode)  
570 - .map(it => it.productName || '') 626 + return this.getWeightProductOptions(item).map(it => it.productName || '')
571 }, 627 },
572 getWeightProductLabel(item) { 628 getWeightProductLabel(item) {
573 if (!item.productId) return '' 629 if (!item.productId) return ''
@@ -577,7 +633,7 @@ export default { @@ -577,7 +633,7 @@ export default {
577 // 过磅品种改选:整行替换为对应计划明细数据(保留行id与计划编号) 633 // 过磅品种改选:整行替换为对应计划明细数据(保留行id与计划编号)
578 handleWeightProductChange(idx, optIdx) { 634 handleWeightProductChange(idx, optIdx) {
579 const row = this.weighList[idx] 635 const row = this.weighList[idx]
580 - const options = (this.planList || []).filter(it => it.planCode === row.planCode) 636 + const options = this.getWeightProductOptions(row)
581 const raw = options[optIdx] 637 const raw = options[optIdx]
582 if (!raw) return 638 if (!raw) return
583 this.weighList.splice(idx, 1, { 639 this.weighList.splice(idx, 1, {
@@ -629,8 +685,8 @@ export default { @@ -629,8 +685,8 @@ export default {
629 if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重') 685 if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重')
630 if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重') 686 if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重')
631 if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型') 687 if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型')
632 - if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')  
633 - if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料') 688 + // if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')
  689 + // if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料')
634 if (!f.plateNumber) return this.tip('请输入车牌号') 690 if (!f.plateNumber) return this.tip('请输入车牌号')
635 // 过磅明细:计划编号、品种、数量必填 691 // 过磅明细:计划编号、品种、数量必填
636 const weightList = this.weighList || [] 692 const weightList = this.weighList || []
@@ -681,6 +737,7 @@ export default { @@ -681,6 +737,7 @@ export default {
681 netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), 737 netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight),
682 netWeightUpper: this.computedNetWeightUpper || null, 738 netWeightUpper: this.computedNetWeightUpper || null,
683 deductionTypes: (this.form.deductionTypes || []).join(',') || null, 739 deductionTypes: (this.form.deductionTypes || []).join(',') || null,
  740 + deductionTypesRemarks: this.form.deductionTypesRemarks || null,
684 supplierStockMaterial: this.form.supplierStockMaterial || null, 741 supplierStockMaterial: this.form.supplierStockMaterial || null,
685 logisticsStockMaterial: this.form.logisticsStockMaterial || null, 742 logisticsStockMaterial: this.form.logisticsStockMaterial || null,
686 plateNumber: this.form.plateNumber || null, 743 plateNumber: this.form.plateNumber || null,
@@ -689,12 +746,24 @@ export default { @@ -689,12 +746,24 @@ export default {
689 documentRemark: this.computedDocumentRemark || null 746 documentRemark: this.computedDocumentRemark || null
690 } 747 }
691 }, 748 },
  749 + // 过磅数量合计与货物净重不一致时二次确认
  750 + async confirmQuantityMismatch() {
  751 + const net = this.computedNetWeight
  752 + if (net === '' || net === null || net === undefined) return true
  753 + const netNum = Math.round(Number(net) * 100) / 100
  754 + if (this.weightQuantityTotal === netNum) return true
  755 + const res = await new Promise(resolve => {
  756 + uni.showModal({ title: '提示', content: '过磅数量总和货物净重不一致,确定保存吗?', confirmText: '确定', cancelText: '取消', success: resolve })
  757 + })
  758 + return !!(res && res.confirm)
  759 + },
692 async onSubmit() { 760 async onSubmit() {
693 if (!this.validate()) return 761 if (!this.validate()) return
694 const confirmRes = await new Promise(resolve => { 762 const confirmRes = await new Promise(resolve => {
695 uni.showModal({ title: '提示', content: '确定保存过磅单吗?', confirmText: '确定', cancelText: '取消', success: resolve }) 763 uni.showModal({ title: '提示', content: '确定保存过磅单吗?', confirmText: '确定', cancelText: '取消', success: resolve })
696 }) 764 })
697 if (!(confirmRes && confirmRes.confirm)) return 765 if (!(confirmRes && confirmRes.confirm)) return
  766 + if (!(await this.confirmQuantityMismatch())) return
698 uni.showLoading({ title: '提交中...', mask: true }) 767 uni.showLoading({ title: '提交中...', mask: true })
699 weighTicketCreateApi(this.buildSubmitData()) 768 weighTicketCreateApi(this.buildSubmitData())
700 .then(() => { 769 .then(() => {
@@ -1050,6 +1119,12 @@ function numberToChineseUpper(num) { @@ -1050,6 +1119,12 @@ function numberToChineseUpper(num) {
1050 } 1119 }
1051 } 1120 }
1052 1121
  1122 +// 来料类型备注:textarea 占满剩余宽度
  1123 +.deduction-remark-input {
  1124 + flex: 1;
  1125 + width: 100%;
  1126 +}
  1127 +
1053 .remark-group { 1128 .remark-group {
1054 margin-bottom: 32rpx; 1129 margin-bottom: 32rpx;
1055 1130
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 <view class="card-index">第 {{ idx + 1 }} 行</view> 29 <view class="card-index">第 {{ idx + 1 }} 行</view>
30 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> 30 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view>
31 <view class="row"><text class="label">计划品种</text><text class="value">{{ safeText(item.productName) }}</text></view> 31 <view class="row"><text class="label">计划品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
32 - <view class="row"><text class="label">计划数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 32 + <view class="row"><text class="label">计划数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
33 </view> 33 </view>
34 </view> 34 </view>
35 </view> 35 </view>
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> 51 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view>
52 <view class="row"><text class="label">过磅品种</text><text class="value">{{ safeText(item.productName) }}</text></view> 52 <view class="row"><text class="label">过磅品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
53 <view class="row"><text class="label">开票品名</text><text class="value">{{ safeText(item.invoiceProductName) }}</text></view> 53 <view class="row"><text class="label">开票品名</text><text class="value">{{ safeText(item.invoiceProductName) }}</text></view>
54 - <view class="row"><text class="label">过磅数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 54 + <view class="row"><text class="label">过磅数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
55 </view> 55 </view>
56 </view> 56 </view>
57 </view> 57 </view>
@@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
71 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> 71 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card">
72 <view class="card-index">第 {{ idx + 1 }} 行</view> 72 <view class="card-index">第 {{ idx + 1 }} 行</view>
73 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view> 73 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view>
74 - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 74 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
75 </view> 75 </view>
76 </view> 76 </view>
77 </view> 77 </view>
@@ -83,11 +83,12 @@ @@ -83,11 +83,12 @@
83 </view> 83 </view>
84 <view class="section"> 84 <view class="section">
85 <view class="row"><text class="label">物料名称</text><text class="value">{{ safeText(form.materialName) }}</text></view> 85 <view class="row"><text class="label">物料名称</text><text class="value">{{ safeText(form.materialName) }}</text></view>
86 - <view class="row"><text class="label">过磅总重</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view>  
87 - <view class="row"><text class="label">实际伙重</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view>  
88 - <view class="row"><text class="label">货物净重</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view> 86 + <view class="row"><text class="label">过磅总重(kg)</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view>
  87 + <view class="row"><text class="label">实际伙重(kg)</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view>
  88 + <view class="row"><text class="label">货物净重(kg)</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view>
89 <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view> 89 <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view>
90 <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> 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 <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view> 92 <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view>
92 <view class="row"><text class="label">物流存欠料</text><text class="value">{{ safeText(form.logisticsStockMaterial) }}</text></view> 93 <view class="row"><text class="label">物流存欠料</text><text class="value">{{ safeText(form.logisticsStockMaterial) }}</text></view>
93 <view class="row"><text class="label">车牌号</text><text class="value">{{ safeText(form.plateNumber) }}</text></view> 94 <view class="row"><text class="label">车牌号</text><text class="value">{{ safeText(form.plateNumber) }}</text></view>
@@ -72,7 +72,7 @@ @@ -72,7 +72,7 @@
72 <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> 72 <uni-easyinput :value="item.productName" :inputBorder="false" disabled />
73 </template> 73 </template>
74 </uni-list-item> 74 </uni-list-item>
75 - <uni-list-item title="计划数量"> 75 + <uni-list-item title="计划数量(kg)">
76 <template v-slot:footer> 76 <template v-slot:footer>
77 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> 77 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
78 </template> 78 </template>
@@ -133,9 +133,9 @@ @@ -133,9 +133,9 @@
133 <uni-easyinput v-model="item.invoiceProductName" :inputBorder="false" disabled /> 133 <uni-easyinput v-model="item.invoiceProductName" :inputBorder="false" disabled />
134 </template> 134 </template>
135 </uni-list-item> 135 </uni-list-item>
136 - <uni-list-item title="过磅数量"> 136 + <uni-list-item title="过磅数量(kg)">
137 <template v-slot:body> 137 <template v-slot:body>
138 - <view class="item-title"><text class="required">*</text><text>过磅数量</text></view> 138 + <view class="item-title"><text class="required">*</text><text>过磅数量(kg)</text></view>
139 </template> 139 </template>
140 <template v-slot:footer> 140 <template v-slot:footer>
141 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" /> 141 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" />
@@ -180,7 +180,7 @@ @@ -180,7 +180,7 @@
180 </uni-list-item> 180 </uni-list-item>
181 <uni-list-item title="数量"> 181 <uni-list-item title="数量">
182 <template v-slot:body> 182 <template v-slot:body>
183 - <view class="item-title"><text class="required">*</text><text>数量</text></view> 183 + <view class="item-title"><text class="required">*</text><text>数量(kg)</text></view>
184 </template> 184 </template>
185 <template v-slot:footer> 185 <template v-slot:footer>
186 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" :disabled="isReweigh" /> 186 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" :disabled="isReweigh" />
@@ -211,7 +211,7 @@ @@ -211,7 +211,7 @@
211 </uni-list-item> 211 </uni-list-item>
212 <uni-list-item> 212 <uni-list-item>
213 <template v-slot:body> 213 <template v-slot:body>
214 - <view class="item-title"><text class="required">*</text><text>过磅总重</text></view> 214 + <view class="item-title"><text class="required">*</text><text>过磅总重(kg)</text></view>
215 </template> 215 </template>
216 <template v-slot:footer> 216 <template v-slot:footer>
217 <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" /> 217 <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" />
@@ -219,13 +219,13 @@ @@ -219,13 +219,13 @@
219 </uni-list-item> 219 </uni-list-item>
220 <uni-list-item> 220 <uni-list-item>
221 <template v-slot:body> 221 <template v-slot:body>
222 - <view class="item-title"><text class="required">*</text><text>实际伙重</text></view> 222 + <view class="item-title"><text class="required">*</text><text>实际伙重(kg)</text></view>
223 </template> 223 </template>
224 <template v-slot:footer> 224 <template v-slot:footer>
225 <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" /> 225 <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" />
226 </template> 226 </template>
227 </uni-list-item> 227 </uni-list-item>
228 - <uni-list-item title="货物净重"> 228 + <uni-list-item title="货物净重(kg)">
229 <template v-slot:footer> 229 <template v-slot:footer>
230 <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled /> 230 <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled />
231 </template> 231 </template>
@@ -252,7 +252,16 @@ @@ -252,7 +252,16 @@
252 <uni-list> 252 <uni-list>
253 <uni-list-item> 253 <uni-list-item>
254 <template v-slot:body> 254 <template v-slot:body>
255 - <view class="item-title"><text class="required">*</text><text>供应存欠料</text></view> 255 + <view class="item-title"><text>来料类型备注</text></view>
  256 + </template>
  257 + <template v-slot:footer>
  258 + <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypesRemarks"
  259 + type="textarea" :inputBorder="false" placeholder="请输入来料类型备注" autoHeight />
  260 + </template>
  261 + </uni-list-item>
  262 + <uni-list-item>
  263 + <template v-slot:body>
  264 + <view class="item-title"><text>供应存欠料</text></view>
256 </template> 265 </template>
257 <template v-slot:footer> 266 <template v-slot:footer>
258 <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" /> 267 <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" />
@@ -260,7 +269,7 @@ @@ -260,7 +269,7 @@
260 </uni-list-item> 269 </uni-list-item>
261 <uni-list-item> 270 <uni-list-item>
262 <template v-slot:body> 271 <template v-slot:body>
263 - <view class="item-title"><text class="required">*</text><text>物流存欠料</text></view> 272 + <view class="item-title"><text>物流存欠料</text></view>
264 </template> 273 </template>
265 <template v-slot:footer> 274 <template v-slot:footer>
266 <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" /> 275 <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" />
@@ -320,7 +329,7 @@ import { @@ -320,7 +329,7 @@ import {
320 weighTicketUpdateApi 329 weighTicketUpdateApi
321 } from '@/api/procure-manage/weighTicket.js' 330 } from '@/api/procure-manage/weighTicket.js'
322 import { breedRelationshipQueryApi } from '@/api/procure-manage/salesmanQuotation.js' 331 import { breedRelationshipQueryApi } from '@/api/procure-manage/salesmanQuotation.js'
323 -import { getDicByCodes, getDicName } from '@/utils/dic.js' 332 +import { getDicByCodes } from '@/utils/dic.js'
324 333
325 export default { 334 export default {
326 name: 'ModifyWeightTicket', 335 name: 'ModifyWeightTicket',
@@ -338,6 +347,7 @@ export default { @@ -338,6 +347,7 @@ export default {
338 totalGrossWeight: '', 347 totalGrossWeight: '',
339 actualImpurityWeight: '', 348 actualImpurityWeight: '',
340 deductionTypes: [], 349 deductionTypes: [],
  350 + deductionTypesRemarks: '',
341 supplierStockMaterial: '', 351 supplierStockMaterial: '',
342 logisticsStockMaterial: '', 352 logisticsStockMaterial: '',
343 plateNumber: '', 353 plateNumber: '',
@@ -426,6 +436,14 @@ export default { @@ -426,6 +436,14 @@ export default {
426 if (net === '' || net === null || net === undefined) return '' 436 if (net === '' || net === null || net === undefined) return ''
427 return numberToChineseUpper(net) 437 return numberToChineseUpper(net)
428 }, 438 },
  439 + // 过磅数量合计
  440 + weightQuantityTotal() {
  441 + const total = (this.weighList || []).reduce((sum, item) => {
  442 + const qty = Number(item.quantity)
  443 + return sum + (isNaN(qty) ? 0 : qty)
  444 + }, 0)
  445 + return Math.round(total * 100) / 100
  446 + },
429 // 业务摘要 447 // 业务摘要
430 computedBusinessSummary() { 448 computedBusinessSummary() {
431 const parts = [] 449 const parts = []
@@ -438,10 +456,9 @@ export default { @@ -438,10 +456,9 @@ export default {
438 }) 456 })
439 .filter(text => !!text) 457 .filter(text => !!text)
440 if (weightItems.length) parts.push(weightItems.join('、')) 458 if (weightItems.length) parts.push(weightItems.join('、'))
441 - const deductionNames = (this.form.deductionTypes || [])  
442 - .map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE))  
443 - .filter(name => !!name)  
444 - if (deductionNames.length) parts.push(deductionNames.join('、')) 459 + // 来料扣杂类型段落以「来料类型备注」文本为准(用户可自由修改)
  460 + const deductionSegment = (this.form.deductionTypesRemarks || '').trim()
  461 + if (deductionSegment) parts.push(deductionSegment)
445 if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) 462 if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`)
446 if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) 463 if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`)
447 if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`) 464 if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`)
@@ -454,14 +471,23 @@ export default { @@ -454,14 +471,23 @@ export default {
454 return [summary, note].filter(text => !!text).join('\n') 471 return [summary, note].filter(text => !!text).join('\n')
455 } 472 }
456 }, 473 },
  474 + watch: {
  475 + // 来料扣杂类型增减时,同步维护「来料类型备注」文本(保留用户已填写的数字等内容)
  476 + 'form.deductionTypes': {
  477 + deep: true,
  478 + handler(list) {
  479 + this.syncDeductionRemark(list)
  480 + }
  481 + }
  482 + },
457 onLoad(query) { 483 onLoad(query) {
458 this.id = (query && query.id) || '' 484 this.id = (query && query.id) || ''
459 }, 485 },
460 created() { 486 created() {
461 this.planSheet.fetchFn = this.fetchPlans.bind(this) 487 this.planSheet.fetchFn = this.fetchPlans.bind(this)
462 - this.loadDicData()  
463 this.loadVarietyOptions() 488 this.loadVarietyOptions()
464 - this.loadDetail() 489 + // 先加载字典,再回显详情,保证来料类型备注能正确解析
  490 + this.loadDicData().finally(() => this.loadDetail())
465 }, 491 },
466 methods: { 492 methods: {
467 async loadDicData() { 493 async loadDicData() {
@@ -482,6 +508,53 @@ export default { @@ -482,6 +508,53 @@ export default {
482 this.varietyOptions = [] 508 this.varietyOptions = []
483 } 509 }
484 }, 510 },
  511 + // 当前已选扣杂类型的名称
  512 + getSelectedDeductionNames() {
  513 + const selected = (this.form.deductionTypes || []).map(code => String(code))
  514 + return this.deductionTypeOptions
  515 + .filter(it => selected.includes(it.value))
  516 + .map(it => it.text)
  517 + .filter(name => !!name)
  518 + },
  519 + // 按所选扣杂类型同步备注文本:移除已取消的类型、补充新增的类型,保留用户已填写的后缀内容
  520 + syncDeductionRemark(list) {
  521 + const selected = (list || []).map(code => String(code))
  522 + const names = this.deductionTypeOptions
  523 + .filter(it => selected.includes(it.value))
  524 + .map(it => it.text)
  525 + .filter(name => !!name)
  526 + const segments = (this.form.deductionTypesRemarks || '')
  527 + .split('、')
  528 + .map(text => text.trim())
  529 + .filter(text => !!text)
  530 + // 名称按长度倒序匹配,避免「水」误匹配「水杂」这类前缀相同的情况
  531 + const sortedNames = names.slice().sort((a, b) => b.length - a.length)
  532 + const matched = []
  533 + segments.forEach(text => {
  534 + const name = sortedNames.find(item => text.startsWith(item))
  535 + if (!name) return
  536 + if (!matched.some(item => item.name === name)) matched.push({ name, text })
  537 + })
  538 + const result = names.map(name => {
  539 + const found = matched.find(item => item.name === name)
  540 + return found ? found.text : name
  541 + })
  542 + this.form.deductionTypesRemarks = result.join('、')
  543 + },
  544 + // 从已保存的业务摘要中解析来料扣杂类型段落,用于回显来料类型备注
  545 + extractDeductionRemark(businessSummary) {
  546 + const names = this.getSelectedDeductionNames()
  547 + const parts = String(businessSummary || '')
  548 + .split(',')
  549 + .map(text => text.trim())
  550 + .filter(text => !!text)
  551 + const found = parts.find(part => {
  552 + if (part.includes('公斤') || part.includes(':')) return false
  553 + const items = part.split('、').map(text => text.trim()).filter(text => !!text)
  554 + return items.length > 0 && items.every(text => names.some(name => text.startsWith(name)))
  555 + })
  556 + return found || names.join('、')
  557 + },
485 loadDetail() { 558 loadDetail() {
486 if (!this.id) { 559 if (!this.id) {
487 uni.showToast({ title: '缺少单据ID', icon: 'none' }) 560 uni.showToast({ title: '缺少单据ID', icon: 'none' })
@@ -505,11 +578,14 @@ export default { @@ -505,11 +578,14 @@ export default {
505 totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight), 578 totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight),
506 actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight), 579 actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight),
507 deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [], 580 deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [],
  581 + deductionTypesRemarks: '',
508 supplierStockMaterial: data.supplierStockMaterial || '', 582 supplierStockMaterial: data.supplierStockMaterial || '',
509 logisticsStockMaterial: data.logisticsStockMaterial || '', 583 logisticsStockMaterial: data.logisticsStockMaterial || '',
510 plateNumber: data.plateNumber || '', 584 plateNumber: data.plateNumber || '',
511 specialNote: data.specialNote || '' 585 specialNote: data.specialNote || ''
512 } 586 }
  587 + // 回显来料类型备注:优先取独立字段,历史数据从业务摘要解析
  588 + this.form.deductionTypesRemarks = this.extractDeductionRemark(data.deductionTypesRemarks || data.businessSummary)
513 // 计划选择回显:行对象缓存供提交 planIds 使用(id 取计划明细行上的计划 id) 589 // 计划选择回显:行对象缓存供提交 planIds 使用(id 取计划明细行上的计划 id)
514 this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it })) 590 this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it }))
515 this.selectedPlanRows = this.planList.map(item => ({ 591 this.selectedPlanRows = this.planList.map(item => ({
@@ -610,11 +686,16 @@ export default { @@ -610,11 +686,16 @@ export default {
610 row.productName = '' 686 row.productName = ''
611 row.invoiceProductName = '' 687 row.invoiceProductName = ''
612 }, 688 },
  689 + // 当前行可选的品种(同一计划下已被其他行选中的品种不再展示)
  690 + getWeightProductOptions(item) {
  691 + const used = (this.weighList || [])
  692 + .filter(row => row !== item && row.planCode === item.planCode && row.productId && row.productId !== item.productId)
  693 + .map(row => row.productId)
  694 + return (this.planList || []).filter(it => it.planCode === item.planCode && !used.includes(it.productId))
  695 + },
613 // 当前计划编号下的品种选项 696 // 当前计划编号下的品种选项
614 getWeightProductLabels(item) { 697 getWeightProductLabels(item) {
615 - return (this.planList || [])  
616 - .filter(it => it.planCode === item.planCode)  
617 - .map(it => it.productName || '') 698 + return this.getWeightProductOptions(item).map(it => it.productName || '')
618 }, 699 },
619 getWeightProductLabel(item) { 700 getWeightProductLabel(item) {
620 if (!item.productId) return '' 701 if (!item.productId) return ''
@@ -624,7 +705,7 @@ export default { @@ -624,7 +705,7 @@ export default {
624 // 过磅品种改选:整行替换为对应计划明细数据(保留行id与计划编号) 705 // 过磅品种改选:整行替换为对应计划明细数据(保留行id与计划编号)
625 handleWeightProductChange(idx, optIdx) { 706 handleWeightProductChange(idx, optIdx) {
626 const row = this.weighList[idx] 707 const row = this.weighList[idx]
627 - const options = (this.planList || []).filter(it => it.planCode === row.planCode) 708 + const options = this.getWeightProductOptions(row)
628 const raw = options[optIdx] 709 const raw = options[optIdx]
629 if (!raw) return 710 if (!raw) return
630 this.weighList.splice(idx, 1, { 711 this.weighList.splice(idx, 1, {
@@ -676,8 +757,8 @@ export default { @@ -676,8 +757,8 @@ export default {
676 if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重') 757 if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重')
677 if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重') 758 if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重')
678 if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型') 759 if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型')
679 - if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')  
680 - if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料') 760 + // if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')
  761 + // if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料')
681 if (!f.plateNumber) return this.tip('请输入车牌号') 762 if (!f.plateNumber) return this.tip('请输入车牌号')
682 // 过磅明细:计划编号、品种、数量必填 763 // 过磅明细:计划编号、品种、数量必填
683 const weightList = this.weighList || [] 764 const weightList = this.weighList || []
@@ -729,6 +810,7 @@ export default { @@ -729,6 +810,7 @@ export default {
729 netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), 810 netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight),
730 netWeightUpper: this.computedNetWeightUpper || null, 811 netWeightUpper: this.computedNetWeightUpper || null,
731 deductionTypes: (this.form.deductionTypes || []).join(',') || null, 812 deductionTypes: (this.form.deductionTypes || []).join(',') || null,
  813 + deductionTypesRemarks: this.form.deductionTypesRemarks || null,
732 supplierStockMaterial: this.form.supplierStockMaterial || null, 814 supplierStockMaterial: this.form.supplierStockMaterial || null,
733 logisticsStockMaterial: this.form.logisticsStockMaterial || null, 815 logisticsStockMaterial: this.form.logisticsStockMaterial || null,
734 plateNumber: this.form.plateNumber || null, 816 plateNumber: this.form.plateNumber || null,
@@ -737,12 +819,24 @@ export default { @@ -737,12 +819,24 @@ export default {
737 documentRemark: this.computedDocumentRemark || null 819 documentRemark: this.computedDocumentRemark || null
738 } 820 }
739 }, 821 },
  822 + // 过磅数量合计与货物净重不一致时二次确认
  823 + async confirmQuantityMismatch() {
  824 + const net = this.computedNetWeight
  825 + if (net === '' || net === null || net === undefined) return true
  826 + const netNum = Math.round(Number(net) * 100) / 100
  827 + if (this.weightQuantityTotal === netNum) return true
  828 + const res = await new Promise(resolve => {
  829 + uni.showModal({ title: '提示', content: '过磅数量总和货物净重不一致,确定保存吗?', confirmText: '确定', cancelText: '取消', success: resolve })
  830 + })
  831 + return !!(res && res.confirm)
  832 + },
740 async onSubmit() { 833 async onSubmit() {
741 if (!this.validate()) return 834 if (!this.validate()) return
742 const confirmRes = await new Promise(resolve => { 835 const confirmRes = await new Promise(resolve => {
743 uni.showModal({ title: '提示', content: '确定保存修改吗?', confirmText: '确定', cancelText: '取消', success: resolve }) 836 uni.showModal({ title: '提示', content: '确定保存修改吗?', confirmText: '确定', cancelText: '取消', success: resolve })
744 }) 837 })
745 if (!(confirmRes && confirmRes.confirm)) return 838 if (!(confirmRes && confirmRes.confirm)) return
  839 + if (!(await this.confirmQuantityMismatch())) return
746 uni.showLoading({ title: '保存中...', mask: true }) 840 uni.showLoading({ title: '保存中...', mask: true })
747 weighTicketUpdateApi(this.buildSubmitData()) 841 weighTicketUpdateApi(this.buildSubmitData())
748 .then(() => { 842 .then(() => {
@@ -1101,6 +1195,12 @@ function numberToChineseUpper(num) { @@ -1101,6 +1195,12 @@ function numberToChineseUpper(num) {
1101 } 1195 }
1102 } 1196 }
1103 1197
  1198 +// 来料类型备注:textarea 占满剩余宽度
  1199 +.deduction-remark-input {
  1200 + flex: 1;
  1201 + width: 100%;
  1202 +}
  1203 +
1104 .remark-group { 1204 .remark-group {
1105 margin-bottom: 32rpx; 1205 margin-bottom: 32rpx;
1106 1206
@@ -68,7 +68,7 @@ @@ -68,7 +68,7 @@
68 <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> 68 <uni-easyinput :value="item.productName" :inputBorder="false" disabled />
69 </template> 69 </template>
70 </uni-list-item> 70 </uni-list-item>
71 - <uni-list-item title="计划数量"> 71 + <uni-list-item title="计划数量(kg)">
72 <template v-slot:footer> 72 <template v-slot:footer>
73 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> 73 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
74 </template> 74 </template>
@@ -105,7 +105,7 @@ @@ -105,7 +105,7 @@
105 </uni-list-item> 105 </uni-list-item>
106 <uni-list-item title="过磅数量"> 106 <uni-list-item title="过磅数量">
107 <template v-slot:body> 107 <template v-slot:body>
108 - <view class="item-title"><text class="required">*</text><text>过磅数量</text></view> 108 + <view class="item-title"><text class="required">*</text><text>过磅数量(kg)</text></view>
109 </template> 109 </template>
110 <template v-slot:footer> 110 <template v-slot:footer>
111 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" /> 111 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" />
@@ -131,7 +131,7 @@ @@ -131,7 +131,7 @@
131 <uni-easyinput :value="item.category" :inputBorder="false" disabled /> 131 <uni-easyinput :value="item.category" :inputBorder="false" disabled />
132 </template> 132 </template>
133 </uni-list-item> 133 </uni-list-item>
134 - <uni-list-item title="数量"> 134 + <uni-list-item title="数量(kg)">
135 <template v-slot:footer> 135 <template v-slot:footer>
136 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> 136 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
137 </template> 137 </template>
@@ -156,7 +156,7 @@ @@ -156,7 +156,7 @@
156 </uni-list-item> 156 </uni-list-item>
157 <uni-list-item> 157 <uni-list-item>
158 <template v-slot:body> 158 <template v-slot:body>
159 - <view class="item-title"><text class="required">*</text><text>过磅总重</text></view> 159 + <view class="item-title"><text class="required">*</text><text>过磅总重(kg)</text></view>
160 </template> 160 </template>
161 <template v-slot:footer> 161 <template v-slot:footer>
162 <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" /> 162 <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" />
@@ -164,13 +164,13 @@ @@ -164,13 +164,13 @@
164 </uni-list-item> 164 </uni-list-item>
165 <uni-list-item> 165 <uni-list-item>
166 <template v-slot:body> 166 <template v-slot:body>
167 - <view class="item-title"><text class="required">*</text><text>实际伙重</text></view> 167 + <view class="item-title"><text class="required">*</text><text>实际伙重(kg)</text></view>
168 </template> 168 </template>
169 <template v-slot:footer> 169 <template v-slot:footer>
170 <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" /> 170 <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" />
171 </template> 171 </template>
172 </uni-list-item> 172 </uni-list-item>
173 - <uni-list-item title="货物净重"> 173 + <uni-list-item title="货物净重(kg)">
174 <template v-slot:footer> 174 <template v-slot:footer>
175 <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled /> 175 <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled />
176 </template> 176 </template>
@@ -197,7 +197,16 @@ @@ -197,7 +197,16 @@
197 <uni-list> 197 <uni-list>
198 <uni-list-item> 198 <uni-list-item>
199 <template v-slot:body> 199 <template v-slot:body>
200 - <view class="item-title"><text class="required">*</text><text>供应存欠料</text></view> 200 + <view class="item-title"><text>来料类型备注</text></view>
  201 + </template>
  202 + <template v-slot:footer>
  203 + <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypesRemarks"
  204 + type="textarea" :inputBorder="false" placeholder="请输入来料类型备注" autoHeight />
  205 + </template>
  206 + </uni-list-item>
  207 + <uni-list-item>
  208 + <template v-slot:body>
  209 + <view class="item-title"><text>供应存欠料</text></view>
201 </template> 210 </template>
202 <template v-slot:footer> 211 <template v-slot:footer>
203 <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" /> 212 <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" />
@@ -205,7 +214,7 @@ @@ -205,7 +214,7 @@
205 </uni-list-item> 214 </uni-list-item>
206 <uni-list-item> 215 <uni-list-item>
207 <template v-slot:body> 216 <template v-slot:body>
208 - <view class="item-title"><text class="required">*</text><text>物流存欠料</text></view> 217 + <view class="item-title"><text>物流存欠料</text></view>
209 </template> 218 </template>
210 <template v-slot:footer> 219 <template v-slot:footer>
211 <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" /> 220 <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" />
@@ -272,7 +281,7 @@ @@ -272,7 +281,7 @@
272 281
273 <script> 282 <script>
274 import { weighTicketDetailApi, weighTicketCreateApi } from '@/api/procure-manage/weighTicket.js' 283 import { weighTicketDetailApi, weighTicketCreateApi } from '@/api/procure-manage/weighTicket.js'
275 -import { getDicByCodes, getDicName } from '@/utils/dic.js' 284 +import { getDicByCodes } from '@/utils/dic.js'
276 import upload from '@/utils/upload' 285 import upload from '@/utils/upload'
277 import { uploadFileApi } from '@/api/base.js' 286 import { uploadFileApi } from '@/api/base.js'
278 287
@@ -292,6 +301,7 @@ export default { @@ -292,6 +301,7 @@ export default {
292 totalGrossWeight: '', 301 totalGrossWeight: '',
293 actualImpurityWeight: '', 302 actualImpurityWeight: '',
294 deductionTypes: [], 303 deductionTypes: [],
  304 + deductionTypesRemarks: '',
295 supplierStockMaterial: '', 305 supplierStockMaterial: '',
296 logisticsStockMaterial: '', 306 logisticsStockMaterial: '',
297 plateNumber: '', 307 plateNumber: '',
@@ -345,6 +355,14 @@ export default { @@ -345,6 +355,14 @@ export default {
345 if (net === '' || net === null || net === undefined) return '' 355 if (net === '' || net === null || net === undefined) return ''
346 return numberToChineseUpper(net) 356 return numberToChineseUpper(net)
347 }, 357 },
  358 + // 过磅数量合计
  359 + weightQuantityTotal() {
  360 + const total = (this.weighList || []).reduce((sum, item) => {
  361 + const qty = Number(item.quantity)
  362 + return sum + (isNaN(qty) ? 0 : qty)
  363 + }, 0)
  364 + return Math.round(total * 100) / 100
  365 + },
348 // 业务摘要 366 // 业务摘要
349 computedBusinessSummary() { 367 computedBusinessSummary() {
350 const parts = [] 368 const parts = []
@@ -357,10 +375,9 @@ export default { @@ -357,10 +375,9 @@ export default {
357 }) 375 })
358 .filter(text => !!text) 376 .filter(text => !!text)
359 if (weightItems.length) parts.push(weightItems.join('、')) 377 if (weightItems.length) parts.push(weightItems.join('、'))
360 - const deductionNames = (this.form.deductionTypes || [])  
361 - .map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE))  
362 - .filter(name => !!name)  
363 - if (deductionNames.length) parts.push(deductionNames.join('、')) 378 + // 来料扣杂类型段落以「来料类型备注」文本为准(用户可自由修改)
  379 + const deductionSegment = (this.form.deductionTypesRemarks || '').trim()
  380 + if (deductionSegment) parts.push(deductionSegment)
364 if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) 381 if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`)
365 if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) 382 if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`)
366 if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`) 383 if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`)
@@ -373,12 +390,21 @@ export default { @@ -373,12 +390,21 @@ export default {
373 return [summary, note].filter(text => !!text).join('\n') 390 return [summary, note].filter(text => !!text).join('\n')
374 } 391 }
375 }, 392 },
  393 + watch: {
  394 + // 来料扣杂类型增减时,同步维护「来料类型备注」文本(保留用户已填写的数字等内容)
  395 + 'form.deductionTypes': {
  396 + deep: true,
  397 + handler(list) {
  398 + this.syncDeductionRemark(list)
  399 + }
  400 + }
  401 + },
376 onLoad(query) { 402 onLoad(query) {
377 this.id = (query && query.id) || '' 403 this.id = (query && query.id) || ''
378 }, 404 },
379 created() { 405 created() {
380 - this.loadDicData()  
381 - this.loadDetail() 406 + // 先加载字典,再回显详情,保证来料类型备注能正确解析
  407 + this.loadDicData().finally(() => this.loadDetail())
382 }, 408 },
383 methods: { 409 methods: {
384 async loadDicData() { 410 async loadDicData() {
@@ -394,6 +420,53 @@ export default { @@ -394,6 +420,53 @@ export default {
394 const found = (this.dicOptions.TYPE || []).find(it => String(it.code) === String(this.form.type)) 420 const found = (this.dicOptions.TYPE || []).find(it => String(it.code) === String(this.form.type))
395 return found ? found.name : '' 421 return found ? found.name : ''
396 }, 422 },
  423 + // 当前已选扣杂类型的名称
  424 + getSelectedDeductionNames() {
  425 + const selected = (this.form.deductionTypes || []).map(code => String(code))
  426 + return this.deductionTypeOptions
  427 + .filter(it => selected.includes(it.value))
  428 + .map(it => it.text)
  429 + .filter(name => !!name)
  430 + },
  431 + // 按所选扣杂类型同步备注文本:移除已取消的类型、补充新增的类型,保留用户已填写的后缀内容
  432 + syncDeductionRemark(list) {
  433 + const selected = (list || []).map(code => String(code))
  434 + const names = this.deductionTypeOptions
  435 + .filter(it => selected.includes(it.value))
  436 + .map(it => it.text)
  437 + .filter(name => !!name)
  438 + const segments = (this.form.deductionTypesRemarks || '')
  439 + .split('、')
  440 + .map(text => text.trim())
  441 + .filter(text => !!text)
  442 + // 名称按长度倒序匹配,避免「水」误匹配「水杂」这类前缀相同的情况
  443 + const sortedNames = names.slice().sort((a, b) => b.length - a.length)
  444 + const matched = []
  445 + segments.forEach(text => {
  446 + const name = sortedNames.find(item => text.startsWith(item))
  447 + if (!name) return
  448 + if (!matched.some(item => item.name === name)) matched.push({ name, text })
  449 + })
  450 + const result = names.map(name => {
  451 + const found = matched.find(item => item.name === name)
  452 + return found ? found.text : name
  453 + })
  454 + this.form.deductionTypesRemarks = result.join('、')
  455 + },
  456 + // 从已保存的业务摘要中解析来料扣杂类型段落,用于回显来料类型备注
  457 + extractDeductionRemark(businessSummary) {
  458 + const names = this.getSelectedDeductionNames()
  459 + const parts = String(businessSummary || '')
  460 + .split(',')
  461 + .map(text => text.trim())
  462 + .filter(text => !!text)
  463 + const found = parts.find(part => {
  464 + if (part.includes('公斤') || part.includes(':')) return false
  465 + const items = part.split('、').map(text => text.trim()).filter(text => !!text)
  466 + return items.length > 0 && items.every(text => names.some(name => text.startsWith(name)))
  467 + })
  468 + return found || names.join('、')
  469 + },
397 loadDetail() { 470 loadDetail() {
398 if (!this.id) { 471 if (!this.id) {
399 uni.showToast({ title: '缺少单据ID', icon: 'none' }) 472 uni.showToast({ title: '缺少单据ID', icon: 'none' })
@@ -415,11 +488,14 @@ export default { @@ -415,11 +488,14 @@ export default {
415 totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight), 488 totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight),
416 actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight), 489 actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight),
417 deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [], 490 deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [],
  491 + deductionTypesRemarks: '',
418 supplierStockMaterial: data.supplierStockMaterial || '', 492 supplierStockMaterial: data.supplierStockMaterial || '',
419 logisticsStockMaterial: data.logisticsStockMaterial || '', 493 logisticsStockMaterial: data.logisticsStockMaterial || '',
420 plateNumber: data.plateNumber || '', 494 plateNumber: data.plateNumber || '',
421 specialNote: data.specialNote || '' 495 specialNote: data.specialNote || ''
422 } 496 }
  497 + // 回显来料类型备注:优先取独立字段,历史数据从业务摘要解析
  498 + this.form.deductionTypesRemarks = this.extractDeductionRemark(data.deductionTypesRemarks || data.businessSummary)
423 this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it })) 499 this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it }))
424 // 选中计划行对象(buyout 供 isBuyout 判断,id 供 planIds 提交使用) 500 // 选中计划行对象(buyout 供 isBuyout 判断,id 供 planIds 提交使用)
425 this.selectedPlanRows = this.planList.map(item => ({ 501 this.selectedPlanRows = this.planList.map(item => ({
@@ -519,8 +595,8 @@ export default { @@ -519,8 +595,8 @@ export default {
519 if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重') 595 if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重')
520 if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重') 596 if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重')
521 if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型') 597 if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型')
522 - if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')  
523 - if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料') 598 + // if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')
  599 + // if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料')
524 if (!f.plateNumber) return this.tip('请输入车牌号') 600 if (!f.plateNumber) return this.tip('请输入车牌号')
525 // 过磅明细:过磅数量必填 601 // 过磅明细:过磅数量必填
526 const weightList = this.weighList || [] 602 const weightList = this.weighList || []
@@ -536,12 +612,24 @@ export default { @@ -536,12 +612,24 @@ export default {
536 uni.showToast({ title: msg, icon: 'none' }) 612 uni.showToast({ title: msg, icon: 'none' })
537 return false 613 return false
538 }, 614 },
  615 + // 过磅数量合计与货物净重不一致时二次确认
  616 + async confirmQuantityMismatch() {
  617 + const net = this.computedNetWeight
  618 + if (net === '' || net === null || net === undefined) return true
  619 + const netNum = Math.round(Number(net) * 100) / 100
  620 + if (this.weightQuantityTotal === netNum) return true
  621 + const res = await new Promise(resolve => {
  622 + uni.showModal({ title: '提示', content: '过磅数量总和货物净重不一致,确定保存吗?', confirmText: '确定', cancelText: '取消', success: resolve })
  623 + })
  624 + return !!(res && res.confirm)
  625 + },
539 async onSubmit() { 626 async onSubmit() {
540 if (!this.validate()) return 627 if (!this.validate()) return
541 const confirmRes = await new Promise(resolve => { 628 const confirmRes = await new Promise(resolve => {
542 uni.showModal({ title: '提示', content: '确定保存复磅单吗?', confirmText: '确定', cancelText: '取消', success: resolve }) 629 uni.showModal({ title: '提示', content: '确定保存复磅单吗?', confirmText: '确定', cancelText: '取消', success: resolve })
543 }) 630 })
544 if (!(confirmRes && confirmRes.confirm)) return 631 if (!(confirmRes && confirmRes.confirm)) return
  632 + if (!(await this.confirmQuantityMismatch())) return
545 const ids = this.fileList.map(it => it.id).filter(Boolean) 633 const ids = this.fileList.map(it => it.id).filter(Boolean)
546 const names = this.fileList.map(it => it.name).filter(Boolean) 634 const names = this.fileList.map(it => it.name).filter(Boolean)
547 const payload = { 635 const payload = {
@@ -570,6 +658,7 @@ export default { @@ -570,6 +658,7 @@ export default {
570 netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), 658 netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight),
571 netWeightUpper: this.computedNetWeightUpper || null, 659 netWeightUpper: this.computedNetWeightUpper || null,
572 deductionTypes: (this.form.deductionTypes || []).join(',') || null, 660 deductionTypes: (this.form.deductionTypes || []).join(',') || null,
  661 + deductionTypesRemarks: this.form.deductionTypesRemarks || null,
573 supplierStockMaterial: this.form.supplierStockMaterial || null, 662 supplierStockMaterial: this.form.supplierStockMaterial || null,
574 logisticsStockMaterial: this.form.logisticsStockMaterial || null, 663 logisticsStockMaterial: this.form.logisticsStockMaterial || null,
575 plateNumber: this.form.plateNumber || null, 664 plateNumber: this.form.plateNumber || null,
@@ -904,6 +993,12 @@ function numberToChineseUpper(num) { @@ -904,6 +993,12 @@ function numberToChineseUpper(num) {
904 } 993 }
905 } 994 }
906 995
  996 +// 来料类型备注:textarea 占满剩余宽度
  997 +.deduction-remark-input {
  998 + flex: 1;
  999 + width: 100%;
  1000 +}
  1001 +
907 .remark-group { 1002 .remark-group {
908 margin-bottom: 32rpx; 1003 margin-bottom: 32rpx;
909 1004
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <view class="card-index">第 {{ idx + 1 }} 行</view> 24 <view class="card-index">第 {{ idx + 1 }} 行</view>
25 <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view> 25 <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view>
26 <view class="row"><text class="label">计划品种</text><text class="value">{{ item.productName || '-' }}</text></view> 26 <view class="row"><text class="label">计划品种</text><text class="value">{{ item.productName || '-' }}</text></view>
27 - <view class="row"><text class="label">计划数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 27 + <view class="row"><text class="label">计划数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
28 </view> 28 </view>
29 </view> 29 </view>
30 </view> 30 </view>
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view> 42 <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view>
43 <view class="row"><text class="label">过磅品种</text><text class="value">{{ item.productName || '-' }}</text></view> 43 <view class="row"><text class="label">过磅品种</text><text class="value">{{ item.productName || '-' }}</text></view>
44 <view class="row"><text class="label">开票品名</text><text class="value">{{ item.invoiceProductName || '-' }}</text></view> 44 <view class="row"><text class="label">开票品名</text><text class="value">{{ item.invoiceProductName || '-' }}</text></view>
45 - <view class="row"><text class="label">过磅数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 45 + <view class="row"><text class="label">过磅数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
46 </view> 46 </view>
47 </view> 47 </view>
48 </view> 48 </view>
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> 58 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card">
59 <view class="card-index">第 {{ idx + 1 }} 行</view> 59 <view class="card-index">第 {{ idx + 1 }} 行</view>
60 <view class="row"><text class="label">类别</text><text class="value">{{ item.category || '-' }}</text></view> 60 <view class="row"><text class="label">类别</text><text class="value">{{ item.category || '-' }}</text></view>
61 - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 61 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
62 </view> 62 </view>
63 </view> 63 </view>
64 </view> 64 </view>
@@ -70,11 +70,12 @@ @@ -70,11 +70,12 @@
70 </view> 70 </view>
71 <view class="section"> 71 <view class="section">
72 <view class="row"><text class="label">物料名称</text><text class="value">{{ form.materialName || '-' }}</text></view> 72 <view class="row"><text class="label">物料名称</text><text class="value">{{ form.materialName || '-' }}</text></view>
73 - <view class="row"><text class="label">过磅总重</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view>  
74 - <view class="row"><text class="label">实际伙重</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view>  
75 - <view class="row"><text class="label">货物净重</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view> 73 + <view class="row"><text class="label">过磅总重(kg)</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view>
  74 + <view class="row"><text class="label">实际伙重(kg)</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view>
  75 + <view class="row"><text class="label">货物净重(kg)</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view>
76 <view class="row"><text class="label">净重大写</text><text class="value">{{ form.netWeightUpper || '-' }}</text></view> 76 <view class="row"><text class="label">净重大写</text><text class="value">{{ form.netWeightUpper || '-' }}</text></view>
77 <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> 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 <view class="row"><text class="label">供应存欠料</text><text class="value">{{ form.supplierStockMaterial || '-' }}</text></view> 79 <view class="row"><text class="label">供应存欠料</text><text class="value">{{ form.supplierStockMaterial || '-' }}</text></view>
79 <view class="row"><text class="label">物流存欠料</text><text class="value">{{ form.logisticsStockMaterial || '-' }}</text></view> 80 <view class="row"><text class="label">物流存欠料</text><text class="value">{{ form.logisticsStockMaterial || '-' }}</text></view>
80 <view class="row"><text class="label">车牌号</text><text class="value">{{ form.plateNumber || '-' }}</text></view> 81 <view class="row"><text class="label">车牌号</text><text class="value">{{ form.plateNumber || '-' }}</text></view>
@@ -168,6 +169,7 @@ export default { @@ -168,6 +169,7 @@ export default {
168 netWeight: '', 169 netWeight: '',
169 netWeightUpper: '', 170 netWeightUpper: '',
170 deductionTypes: '', 171 deductionTypes: '',
  172 + deductionTypesRemarks: '',
171 supplierStockMaterial: '', 173 supplierStockMaterial: '',
172 logisticsStockMaterial: '', 174 logisticsStockMaterial: '',
173 plateNumber: '', 175 plateNumber: '',
@@ -247,6 +249,7 @@ export default { @@ -247,6 +249,7 @@ export default {
247 netWeight: data.netWeight == null ? '' : String(data.netWeight), 249 netWeight: data.netWeight == null ? '' : String(data.netWeight),
248 netWeightUpper: data.netWeightUpper || '', 250 netWeightUpper: data.netWeightUpper || '',
249 deductionTypes: data.deductionTypes || '', 251 deductionTypes: data.deductionTypes || '',
  252 + deductionTypesRemarks: data.deductionTypesRemarks || '',
250 supplierStockMaterial: data.supplierStockMaterial || '', 253 supplierStockMaterial: data.supplierStockMaterial || '',
251 logisticsStockMaterial: data.logisticsStockMaterial || '', 254 logisticsStockMaterial: data.logisticsStockMaterial || '',
252 plateNumber: data.plateNumber || '', 255 plateNumber: data.plateNumber || '',
@@ -260,10 +263,10 @@ export default { @@ -260,10 +263,10 @@ export default {
260 this.planList = Array.isArray(data.planLines) ? data.planLines.map(x => ({ ...x })) : [] 263 this.planList = Array.isArray(data.planLines) ? data.planLines.map(x => ({ ...x })) : []
261 this.weighList = Array.isArray(data.weighLines) ? data.weighLines.map(x => ({ ...x })) : [] 264 this.weighList = Array.isArray(data.weighLines) ? data.weighLines.map(x => ({ ...x })) : []
262 this.applyList = Array.isArray(data.applyLines) ? data.applyLines.map(x => ({ ...x })) : [] 265 this.applyList = Array.isArray(data.applyLines) ? data.applyLines.map(x => ({ ...x })) : []
263 - // 已传附件回显(多文件逗号分隔)  
264 - const key = this.mode === 'delay' ? 'delayFile' : 'signFile'  
265 - const ids = String(data[key + 'Id'] || '').split(',').filter(Boolean)  
266 - const names = String(data[key + 'Name'] || '').split(',').filter(Boolean) 266 + // 已传附件回显(多文件逗号分隔,与详情接口字段一致)
  267 + const key = this.mode === 'delay' ? 'delayAttachmentFile' : 'signAttachmentFile'
  268 + const ids = String(data[key + 'Ids'] || '').split(',').map(x => x.trim()).filter(Boolean)
  269 + const names = String(data[key + 'Names'] || '').split(',').map(x => x.trim())
267 this.fileList = ids.map((id, i) => ({ id, name: names[i] || '' })) 270 this.fileList = ids.map((id, i) => ({ id, name: names[i] || '' }))
268 }) 271 })
269 .catch(() => { 272 .catch(() => {
@@ -273,8 +276,46 @@ export default { @@ -273,8 +276,46 @@ export default {
273 uni.hideLoading() 276 uni.hideLoading()
274 }) 277 })
275 }, 278 },
276 - // 选择并上传文件(多文件逐个追加) 279 + // 选择上传方式:拍照 / 相册 / 文件
277 selectFile() { 280 selectFile() {
  281 + uni.showActionSheet({
  282 + itemList: ['拍照上传', '从相册选择', '选择文件'],
  283 + success: res => {
  284 + if (res.tapIndex === 0) this.chooseImage(['camera'])
  285 + else if (res.tapIndex === 1) this.chooseImage(['album'])
  286 + else this.chooseFile()
  287 + }
  288 + })
  289 + },
  290 + // 拍照 / 相册上传图片(多张逐个追加)
  291 + chooseImage(sourceType) {
  292 + uni.chooseImage({
  293 + count: 9,
  294 + sizeType: ['original', 'compressed'],
  295 + sourceType,
  296 + success: async res => {
  297 + const paths = (res && res.tempFilePaths) || []
  298 + if (!paths.length) return
  299 + uni.showLoading({ title: '上传中...', mask: true })
  300 + try {
  301 + for (let i = 0; i < paths.length; i++) {
  302 + const path = paths[i]
  303 + const ext = (/\.(\w+)$/.exec(path) || [])[1] || 'jpg'
  304 + const name = `照片_${Date.now()}_${i + 1}.${ext}`
  305 + const r = await upload({ url: '/sw/filebox/uploadFile', filePath: path, name: 'file' })
  306 + const id = getUploadedFileId(r)
  307 + if (id) this.fileList.push({ id, name })
  308 + }
  309 + } catch (e) {
  310 + uni.showToast({ title: '上传失败', icon: 'none' })
  311 + } finally {
  312 + uni.hideLoading()
  313 + }
  314 + }
  315 + })
  316 + },
  317 + // 选择并上传文件(多文件逐个追加)
  318 + chooseFile() {
278 if (typeof uni !== 'undefined' && typeof uni.chooseMessageFile === 'function') { 319 if (typeof uni !== 'undefined' && typeof uni.chooseMessageFile === 'function') {
279 uni.chooseMessageFile({ 320 uni.chooseMessageFile({
280 count: 9, 321 count: 9,
@@ -287,10 +328,7 @@ export default { @@ -287,10 +328,7 @@ export default {
287 for (const f of files) { 328 for (const f of files) {
288 const name = f.name || 'file' 329 const name = f.name || 'file'
289 const r = await upload({ url: '/sw/filebox/uploadFile', filePath: f.path, name: 'file' }) 330 const r = await upload({ url: '/sw/filebox/uploadFile', filePath: f.path, name: 'file' })
290 - const d = r && r.data ? r.data : r  
291 - const id = (d && (d.id || d.fileId || (d.data && (d.data.id || d.data.fileId))))  
292 - ? String(d.id || d.fileId || d.data.id || d.data.fileId)  
293 - : '' 331 + const id = getUploadedFileId(r)
294 if (id) this.fileList.push({ id, name }) 332 if (id) this.fileList.push({ id, name })
295 } 333 }
296 } catch (e) { 334 } catch (e) {
@@ -331,10 +369,7 @@ export default { @@ -331,10 +369,7 @@ export default {
331 const fd = new FormData() 369 const fd = new FormData()
332 fd.append('file', file, name) 370 fd.append('file', file, name)
333 const d = await uploadFileApi(fd) 371 const d = await uploadFileApi(fd)
334 - const data = d && d.data ? d.data : d  
335 - const id = (data && (data.id || data.fileId || (data.data && (data.data.id || data.data.fileId))))  
336 - ? String(data.id || data.fileId || data.data.id || data.data.fileId)  
337 - : '' 372 + const id = getUploadedFileId(d)
338 if (id) this.fileList.push({ id, name }) 373 if (id) this.fileList.push({ id, name })
339 } 374 }
340 } catch (e2) { 375 } catch (e2) {
@@ -397,6 +432,14 @@ export default { @@ -397,6 +432,14 @@ export default {
397 } 432 }
398 } 433 }
399 } 434 }
  435 +
  436 +// 解析上传接口返回的文件ID
  437 +function getUploadedFileId(res) {
  438 + const d = res && res.data ? res.data : res
  439 + if (!d) return ''
  440 + const id = d.id || d.fileId || (d.data && (d.data.id || d.data.fileId))
  441 + return id ? String(id) : ''
  442 +}
400 </script> 443 </script>
401 444
402 <style lang="scss" scoped> 445 <style lang="scss" scoped>
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <view v-for="(item, idx) in planList" :key="'p-' + (item.id || idx)" class="card"> 23 <view v-for="(item, idx) in planList" :key="'p-' + (item.id || idx)" class="card">
24 <view class="card-index">第 {{ idx + 1 }} 行</view> 24 <view class="card-index">第 {{ idx + 1 }} 行</view>
25 <view class="row"><text class="label">计划品种</text><text class="value">{{ safeText(item.productName) }}</text></view> 25 <view class="row"><text class="label">计划品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
26 - <view class="row"><text class="label">计划数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 26 + <view class="row"><text class="label">计划数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
27 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> 27 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view>
28 </view> 28 </view>
29 </view> 29 </view>
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 <view class="card-index">第 {{ idx + 1 }} 行</view> 41 <view class="card-index">第 {{ idx + 1 }} 行</view>
42 <view class="row"><text class="label">过磅品种</text><text class="value">{{ safeText(item.productName) }}</text></view> 42 <view class="row"><text class="label">过磅品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
43 <view class="row"><text class="label">开票品名</text><text class="value">{{ safeText(item.invoiceProductName) }}</text></view> 43 <view class="row"><text class="label">开票品名</text><text class="value">{{ safeText(item.invoiceProductName) }}</text></view>
44 - <view class="row"><text class="label">过磅数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 44 + <view class="row"><text class="label">过磅数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
45 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> 45 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view>
46 </view> 46 </view>
47 </view> 47 </view>
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> 58 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card">
59 <view class="card-index">第 {{ idx + 1 }} 行</view> 59 <view class="card-index">第 {{ idx + 1 }} 行</view>
60 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view> 60 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view>
61 - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> 61 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
62 </view> 62 </view>
63 </view> 63 </view>
64 </view> 64 </view>
@@ -70,11 +70,12 @@ @@ -70,11 +70,12 @@
70 </view> 70 </view>
71 <view class="section"> 71 <view class="section">
72 <view class="row"><text class="label">物料名称</text><text class="value">{{ safeText(form.materialName) }}</text></view> 72 <view class="row"><text class="label">物料名称</text><text class="value">{{ safeText(form.materialName) }}</text></view>
73 - <view class="row"><text class="label">过磅总重</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view>  
74 - <view class="row"><text class="label">实际伙重</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view>  
75 - <view class="row"><text class="label">货物净重</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view> 73 + <view class="row"><text class="label">过磅总重(kg)</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view>
  74 + <view class="row"><text class="label">实际伙重(kg)</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view>
  75 + <view class="row"><text class="label">货物净重(kg)</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view>
76 <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view> 76 <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view>
77 <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> 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 <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view> 79 <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view>
79 <view class="row"><text class="label">物流存欠料</text><text class="value">{{ safeText(form.logisticsStockMaterial) }}</text></view> 80 <view class="row"><text class="label">物流存欠料</text><text class="value">{{ safeText(form.logisticsStockMaterial) }}</text></view>
80 <view class="row"><text class="label">车牌号</text><text class="value">{{ safeText(form.plateNumber) }}</text></view> 81 <view class="row"><text class="label">车牌号</text><text class="value">{{ safeText(form.plateNumber) }}</text></view>