Showing
32 changed files
with
1206 additions
and
182 deletions
| ... | ... | @@ -64,7 +64,8 @@ export function assayApplyBreedOptionsApi(params) { |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * 新增化验送样单 |
| 67 | - * data: { weighingTicketId, procurementPlanId, productId, department } | |
| 67 | + * data: { code, weighingTicketId, procurementPlanId, productId, department, | |
| 68 | + * lines: [{ sampleNo, sampleCode }] } | |
| 68 | 69 | */ |
| 69 | 70 | export function assayApplyCreateApi(data) { |
| 70 | 71 | return request({ |
| ... | ... | @@ -88,7 +89,8 @@ export function assayApplyDetailApi(params) { |
| 88 | 89 | |
| 89 | 90 | /** |
| 90 | 91 | * 修改化验送样单 |
| 91 | - * data: { id, weighingTicketId, procurementPlanId, productId, department } | |
| 92 | + * data: { id, code, weighingTicketId, procurementPlanId, productId, department, | |
| 93 | + * lines: [{ sampleNo, sampleCode }] } | |
| 92 | 94 | */ |
| 93 | 95 | export function assayApplyUpdateApi(data) { |
| 94 | 96 | return request({ | ... | ... |
| ... | ... | @@ -68,7 +68,7 @@ export function assayReportApplyOptionsApi(params) { |
| 68 | 68 | /** |
| 69 | 69 | * 新增化验报告单 |
| 70 | 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 | 73 | export function assayReportCreateApi(data) { |
| 74 | 74 | return request({ |
| ... | ... | @@ -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 | 98 | export function assayReportUpdateApi(data) { |
| 98 | 99 | return request({ | ... | ... |
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | </view> |
| 9 | 9 | <view class="body"> |
| 10 | 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 | 12 | </view> |
| 13 | 13 | <view v-else> |
| 14 | 14 | <FlowTimeline :nodeList="nodeList" :isEnd="isEnd" /> | ... | ... |
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | </view> |
| 9 | 9 | <view class="body"> |
| 10 | 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 | 12 | </view> |
| 13 | 13 | <view v-else> |
| 14 | 14 | <FlowTimeline :nodeList="nodeList" :isEnd="isEnd" /> | ... | ... |
| ... | ... | @@ -46,7 +46,7 @@ |
| 46 | 46 | <uni-easyinput :value="item.category" :inputBorder="false" disabled /> |
| 47 | 47 | </template> |
| 48 | 48 | </uni-list-item> |
| 49 | - <uni-list-item title="数量"> | |
| 49 | + <uni-list-item title="数量(kg)"> | |
| 50 | 50 | <template v-slot:footer> |
| 51 | 51 | <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> |
| 52 | 52 | </template> |
| ... | ... | @@ -133,7 +133,7 @@ |
| 133 | 133 | </template> |
| 134 | 134 | </uni-list-item> |
| 135 | 135 | |
| 136 | - <uni-list-item title="过磅数"> | |
| 136 | + <uni-list-item title="过磅数(kg)"> | |
| 137 | 137 | <template v-slot:footer> |
| 138 | 138 | <uni-easyinput :value="item.weighQuantity" :inputBorder="false" disabled /> |
| 139 | 139 | </template> |
| ... | ... | @@ -143,17 +143,17 @@ |
| 143 | 143 | <uni-easyinput v-model="item.impurityRate" type="digit" :inputBorder="false" placeholder="请输入杂率" /> |
| 144 | 144 | </template> |
| 145 | 145 | </uni-list-item> |
| 146 | - <uni-list-item title="折斤"> | |
| 146 | + <uni-list-item title="折斤(kg)"> | |
| 147 | 147 | <template v-slot:footer> |
| 148 | 148 | <uni-easyinput v-model="item.foldWeight" type="digit" :inputBorder="false" placeholder="请输入折斤" /> |
| 149 | 149 | </template> |
| 150 | 150 | </uni-list-item> |
| 151 | - <uni-list-item title="退料"> | |
| 151 | + <uni-list-item title="退料(kg)"> | |
| 152 | 152 | <template v-slot:footer> |
| 153 | 153 | <uni-easyinput v-model="item.returnWeight" type="digit" :inputBorder="false" placeholder="请输入退料" /> |
| 154 | 154 | </template> |
| 155 | 155 | </uni-list-item> |
| 156 | - <uni-list-item title="入库净重"> | |
| 156 | + <uni-list-item title="入库净重(kg)"> | |
| 157 | 157 | <template v-slot:footer> |
| 158 | 158 | <uni-easyinput v-model="item.netWeight" type="digit" :inputBorder="false" placeholder="请输入入库净重" /> |
| 159 | 159 | </template> |
| ... | ... | @@ -181,19 +181,19 @@ |
| 181 | 181 | <view class="total-title">合计</view> |
| 182 | 182 | <view class="total-body"> |
| 183 | 183 | <view class="total-item"> |
| 184 | - <text class="total-label">过磅数</text> | |
| 184 | + <text class="total-label">过磅数(kg)</text> | |
| 185 | 185 | <text class="total-value">{{ totalSummary.totalWeighQuantity || '-' }}</text> |
| 186 | 186 | </view> |
| 187 | 187 | <view class="total-item"> |
| 188 | - <text class="total-label">折斤</text> | |
| 188 | + <text class="total-label">折斤(kg)</text> | |
| 189 | 189 | <text class="total-value">{{ totalSummary.totalFoldWeight || '-' }}</text> |
| 190 | 190 | </view> |
| 191 | 191 | <view class="total-item"> |
| 192 | - <text class="total-label">退料</text> | |
| 192 | + <text class="total-label">退料(kg)</text> | |
| 193 | 193 | <text class="total-value">{{ totalSummary.totalReturnWeight || '-' }}</text> |
| 194 | 194 | </view> |
| 195 | 195 | <view class="total-item"> |
| 196 | - <text class="total-label">入库净重</text> | |
| 196 | + <text class="total-label">入库净重(kg)</text> | |
| 197 | 197 | <text class="total-value">{{ totalSummary.totalNetWeight || '-' }}</text> |
| 198 | 198 | </view> |
| 199 | 199 | </view> | ... | ... |
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> |
| 27 | 27 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 28 | 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 | 30 | </view> |
| 31 | 31 | </view> |
| 32 | 32 | </view> |
| ... | ... | @@ -49,11 +49,11 @@ |
| 49 | 49 | <view class="row"><text class="label">品种</text><text class="value">{{ safeText(item.productName) }}</text></view> |
| 50 | 50 | <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view> |
| 51 | 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 | 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 | 57 | <view class="row"><text class="label">备注</text><text class="value">{{ safeText(item.remark) }}</text></view> |
| 58 | 58 | </view> |
| 59 | 59 | </view> |
| ... | ... | @@ -68,19 +68,19 @@ |
| 68 | 68 | <view class="total-title">合计</view> |
| 69 | 69 | <view class="total-body"> |
| 70 | 70 | <view class="total-item"> |
| 71 | - <text class="total-label">过磅数</text> | |
| 71 | + <text class="total-label">过磅数(kg)</text> | |
| 72 | 72 | <text class="total-value">{{ formatNumber(form.totalWeighQuantity) }}</text> |
| 73 | 73 | </view> |
| 74 | 74 | <view class="total-item"> |
| 75 | - <text class="total-label">折斤</text> | |
| 75 | + <text class="total-label">折斤(kg)</text> | |
| 76 | 76 | <text class="total-value">{{ formatNumber(form.totalFoldWeight) }}</text> |
| 77 | 77 | </view> |
| 78 | 78 | <view class="total-item"> |
| 79 | - <text class="total-label">退料</text> | |
| 79 | + <text class="total-label">退料(kg)</text> | |
| 80 | 80 | <text class="total-value">{{ formatNumber(form.totalReturnWeight) }}</text> |
| 81 | 81 | </view> |
| 82 | 82 | <view class="total-item"> |
| 83 | - <text class="total-label">入库净重</text> | |
| 83 | + <text class="total-label">入库净重(kg)</text> | |
| 84 | 84 | <text class="total-value">{{ formatNumber(form.totalNetWeight) }}</text> |
| 85 | 85 | </view> |
| 86 | 86 | </view> | ... | ... |
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> |
| 22 | 22 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 23 | 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 | 25 | </view> |
| 26 | 26 | </view> |
| 27 | 27 | </view> |
| ... | ... | @@ -40,11 +40,11 @@ |
| 40 | 40 | <view class="row"><text class="label">品种</text><text class="value">{{ safeText(item.productName) }}</text></view> |
| 41 | 41 | <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view> |
| 42 | 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 | 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 | 48 | <view class="row"><text class="label">备注</text><text class="value">{{ safeText(item.remark) }}</text></view> |
| 49 | 49 | </view> |
| 50 | 50 | </view> |
| ... | ... | @@ -59,19 +59,19 @@ |
| 59 | 59 | <view class="total-title">合计</view> |
| 60 | 60 | <view class="total-body"> |
| 61 | 61 | <view class="total-item"> |
| 62 | - <text class="total-label">过磅数</text> | |
| 62 | + <text class="total-label">过磅数(kg)</text> | |
| 63 | 63 | <text class="total-value">{{ formatNumber(form.totalWeighQuantity) }}</text> |
| 64 | 64 | </view> |
| 65 | 65 | <view class="total-item"> |
| 66 | - <text class="total-label">折斤</text> | |
| 66 | + <text class="total-label">折斤(kg)</text> | |
| 67 | 67 | <text class="total-value">{{ formatNumber(form.totalFoldWeight) }}</text> |
| 68 | 68 | </view> |
| 69 | 69 | <view class="total-item"> |
| 70 | - <text class="total-label">退料</text> | |
| 70 | + <text class="total-label">退料(kg)</text> | |
| 71 | 71 | <text class="total-value">{{ formatNumber(form.totalReturnWeight) }}</text> |
| 72 | 72 | </view> |
| 73 | 73 | <view class="total-item"> |
| 74 | - <text class="total-label">入库净重</text> | |
| 74 | + <text class="total-label">入库净重(kg)</text> | |
| 75 | 75 | <text class="total-value">{{ formatNumber(form.totalNetWeight) }}</text> |
| 76 | 76 | </view> |
| 77 | 77 | </view> | ... | ... |
| ... | ... | @@ -45,7 +45,7 @@ |
| 45 | 45 | <uni-easyinput :value="item.category" :inputBorder="false" disabled /> |
| 46 | 46 | </template> |
| 47 | 47 | </uni-list-item> |
| 48 | - <uni-list-item title="数量"> | |
| 48 | + <uni-list-item title="数量(kg)"> | |
| 49 | 49 | <template v-slot:footer> |
| 50 | 50 | <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> |
| 51 | 51 | </template> |
| ... | ... | @@ -132,7 +132,7 @@ |
| 132 | 132 | </template> |
| 133 | 133 | </uni-list-item> |
| 134 | 134 | |
| 135 | - <uni-list-item title="过磅数"> | |
| 135 | + <uni-list-item title="过磅数(kg)"> | |
| 136 | 136 | <template v-slot:footer> |
| 137 | 137 | <uni-easyinput :value="item.weighQuantity" :inputBorder="false" disabled /> |
| 138 | 138 | </template> |
| ... | ... | @@ -142,17 +142,17 @@ |
| 142 | 142 | <uni-easyinput v-model="item.impurityRate" type="digit" :inputBorder="false" placeholder="请输入杂率" /> |
| 143 | 143 | </template> |
| 144 | 144 | </uni-list-item> |
| 145 | - <uni-list-item title="折斤"> | |
| 145 | + <uni-list-item title="折斤(kg)"> | |
| 146 | 146 | <template v-slot:footer> |
| 147 | 147 | <uni-easyinput v-model="item.foldWeight" type="digit" :inputBorder="false" placeholder="请输入折斤" /> |
| 148 | 148 | </template> |
| 149 | 149 | </uni-list-item> |
| 150 | - <uni-list-item title="退料"> | |
| 150 | + <uni-list-item title="退料(kg)"> | |
| 151 | 151 | <template v-slot:footer> |
| 152 | 152 | <uni-easyinput v-model="item.returnWeight" type="digit" :inputBorder="false" placeholder="请输入退料" /> |
| 153 | 153 | </template> |
| 154 | 154 | </uni-list-item> |
| 155 | - <uni-list-item title="入库净重"> | |
| 155 | + <uni-list-item title="入库净重(kg)"> | |
| 156 | 156 | <template v-slot:footer> |
| 157 | 157 | <uni-easyinput v-model="item.netWeight" type="digit" :inputBorder="false" placeholder="请输入入库净重" /> |
| 158 | 158 | </template> | ... | ... |
| ... | ... | @@ -262,7 +262,9 @@ export default { |
| 262 | 262 | const list = (res && res.data) || [] |
| 263 | 263 | this.applyDetailOptions = (list || []).map(item => ({ |
| 264 | 264 | assayApplyId: item.assayApplyId || item.id || '', |
| 265 | + assayApplyLineId: item.assayApplyLineId || '', | |
| 265 | 266 | assayApplyCode: item.assayApplyCode || '', |
| 267 | + sampleCode: item.sampleCode || '', | |
| 266 | 268 | productName: item.productName || '', |
| 267 | 269 | category: item.category || '', |
| 268 | 270 | productId: item.productId || '', | ... | ... |
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | <view v-for="(row, idx) in rows" :key="'line-' + idx" class="card"> |
| 14 | 14 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 15 | 15 | |
| 16 | - <view class="row"> | |
| 16 | + <!-- <view class="row"> | |
| 17 | 17 | <text class="label">送样编号</text> |
| 18 | 18 | <picker |
| 19 | 19 | class="picker-box" |
| ... | ... | @@ -25,13 +25,27 @@ |
| 25 | 25 | {{ row.assayApplyCode || '请选择送样编号' }} |
| 26 | 26 | </view> |
| 27 | 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 | 42 | </view> |
| 29 | 43 | <view class="row"> |
| 30 | 44 | <text class="label">样品</text> |
| 31 | 45 | <text class="value">{{ row.category || '-' }}</text> |
| 32 | 46 | </view> |
| 33 | 47 | <view class="row"> |
| 34 | - <text class="label">数量</text> | |
| 48 | + <text class="label">数量(kg)</text> | |
| 35 | 49 | <text class="value">{{ row.quantity === null || row.quantity === undefined || row.quantity === '' ? '-' : row.quantity }}</text> |
| 36 | 50 | </view> |
| 37 | 51 | |
| ... | ... | @@ -101,7 +115,9 @@ export default { |
| 101 | 115 | quantity: item ? item.quantity : '', |
| 102 | 116 | testCode: String(index + 1), |
| 103 | 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 | 122 | ALL_COMPONENT_KEYS.forEach(key => { |
| 107 | 123 | row[key] = (item && item[key] !== undefined && item[key] !== null) ? item[key] : null |
| ... | ... | @@ -116,12 +132,15 @@ export default { |
| 116 | 132 | setRows(list) { |
| 117 | 133 | this.rows = (list || []).map((item, index) => this.buildRow(item, index)) |
| 118 | 134 | }, |
| 119 | - // 获取提交用明细行(含各行成分值,未填/分厂未包含的成分为 null) | |
| 135 | + // 获取提交用明细行(含行ID与各行成分值,未填/分厂未包含的成分为 null) | |
| 120 | 136 | getLines() { |
| 121 | 137 | return (this.rows || []) |
| 122 | 138 | .filter(row => row.assayApplyId) |
| 123 | 139 | .map(row => { |
| 124 | - const line = { assayApplyId: row.assayApplyId } | |
| 140 | + const line = { | |
| 141 | + assayApplyId: row.assayApplyId, | |
| 142 | + assayApplyLineId: row.assayApplyLineId || '' | |
| 143 | + } | |
| 125 | 144 | ALL_COMPONENT_KEYS.forEach(key => { |
| 126 | 145 | const val = row[key] |
| 127 | 146 | line[key] = (val === undefined || val === null || val === '') ? null : Number(val) |
| ... | ... | @@ -151,8 +170,37 @@ export default { |
| 151 | 170 | row.productId = item.productId || '' |
| 152 | 171 | row.assayApplyCode = item.assayApplyCode || '' |
| 153 | 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 | 201 | row.category = item.category || '' |
| 155 | 202 | row.quantity = item.quantity !== undefined && item.quantity !== null ? item.quantity : '' |
| 203 | + row.sampleCode = item.sampleCode || opt.value || '' | |
| 156 | 204 | }, |
| 157 | 205 | // 成份值输入:仅允许数字与小数点,空值重置为 null |
| 158 | 206 | onComponentInput(e, index, key) { | ... | ... |
| ... | ... | @@ -31,9 +31,10 @@ |
| 31 | 31 | <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card"> |
| 32 | 32 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 33 | 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 | 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 | 38 | <view v-for="key in componentKeys" :key="key" class="row"> |
| 38 | 39 | <text class="label">{{ componentLabels[key] || key }}</text> |
| 39 | 40 | <text class="value">{{ formatNumber(item[key]) }}</text> | ... | ... |
| ... | ... | @@ -26,9 +26,10 @@ |
| 26 | 26 | <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card"> |
| 27 | 27 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 28 | 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 | 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 | 33 | <view v-for="key in componentKeys" :key="key" class="row"> |
| 33 | 34 | <text class="label">{{ componentLabels[key] || key }}</text> |
| 34 | 35 | <text class="value">{{ formatNumber(item[key]) }}</text> |
| ... | ... | @@ -49,6 +50,20 @@ |
| 49 | 50 | </view> |
| 50 | 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 | 67 | <!-- 是否继续审批(assay_report_yfcckzg 节点必填) --> |
| 53 | 68 | <view v-if="showContinueApproval" class="section"> |
| 54 | 69 | <view class="field-row"> |
| ... | ... | @@ -77,7 +92,9 @@ export default { |
| 77 | 92 | props: { |
| 78 | 93 | id: { type: [String, Number], default: '' }, |
| 79 | 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 | 99 | data() { |
| 83 | 100 | return { |
| ... | ... | @@ -97,9 +114,13 @@ export default { |
| 97 | 114 | } |
| 98 | 115 | }, |
| 99 | 116 | computed: { |
| 100 | - // assay_report_gyglkzg2 节点需填写 是否继续审批 | |
| 117 | + // 是否审核页面 | |
| 118 | + isAudit() { | |
| 119 | + return this.mode === 'audit' | |
| 120 | + }, | |
| 121 | + // assay_report_gyglkzg2 节点需填写 是否继续审批(仅审核时展示) | |
| 101 | 122 | showContinueApproval() { |
| 102 | - return this.nodeCode === 'assay_report_gyglkzg2' | |
| 123 | + return this.isAudit && this.nodeCode === 'assay_report_gyglkzg2' | |
| 103 | 124 | }, |
| 104 | 125 | componentKeys() { |
| 105 | 126 | // 按 workshopCode 匹配成分项,名称兜底 |
| ... | ... | @@ -117,6 +138,27 @@ export default { |
| 117 | 138 | const v = this.form.hasQualityProblem |
| 118 | 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 | 162 | approvalStatusName() { |
| 121 | 163 | const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus) |
| 122 | 164 | if (!v) return '-' |
| ... | ... | @@ -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 | 330 | .field-row { |
| 259 | 331 | display: flex; |
| 260 | 332 | align-items: center; |
| 261 | 333 | justify-content: space-between; |
| 262 | - | |
| 263 | 334 | .field-label { |
| 264 | 335 | flex: none; |
| 265 | 336 | font-size: 32rpx; | ... | ... |
| ... | ... | @@ -254,7 +254,9 @@ export default { |
| 254 | 254 | .then(res => { |
| 255 | 255 | const list = ((res && res.data) || []).map(item => ({ |
| 256 | 256 | assayApplyId: item.assayApplyId || item.id || '', |
| 257 | + assayApplyLineId: item.assayApplyLineId || '', | |
| 257 | 258 | assayApplyCode: item.assayApplyCode || '', |
| 259 | + sampleCode: item.sampleCode || '', | |
| 258 | 260 | productName: item.productName || '', |
| 259 | 261 | category: item.category || '', |
| 260 | 262 | productId: item.productId || '', |
| ... | ... | @@ -265,6 +267,14 @@ export default { |
| 265 | 267 | line.assayApplyId && !list.some(item => item.assayApplyId === line.assayApplyId) |
| 266 | 268 | ) |
| 267 | 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 | 279 | .catch(() => { |
| 270 | 280 | this.applyDetailOptions = (detailLines || []).map(item => ({ ...item })) |
| ... | ... | @@ -356,7 +366,9 @@ export default { |
| 356 | 366 | .then(res => { |
| 357 | 367 | const list = ((res && res.data) || []).map(item => ({ |
| 358 | 368 | assayApplyId: item.assayApplyId || item.id || '', |
| 369 | + assayApplyLineId: item.assayApplyLineId || '', | |
| 359 | 370 | assayApplyCode: item.assayApplyCode || '', |
| 371 | + sampleCode: item.sampleCode || '', | |
| 360 | 372 | productName: item.productName || '', |
| 361 | 373 | category: item.category || '', |
| 362 | 374 | productId: item.productId || '', | ... | ... |
| ... | ... | @@ -27,9 +27,10 @@ |
| 27 | 27 | <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card"> |
| 28 | 28 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 29 | 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 | 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 | 34 | <view v-for="key in componentKeys" :key="key" class="row"> |
| 34 | 35 | <text class="label">{{ componentLabels[key] || key }}</text> |
| 35 | 36 | <text class="value">{{ formatNumber(item[key]) }}</text> | ... | ... |
| ... | ... | @@ -46,7 +46,7 @@ |
| 46 | 46 | <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> |
| 47 | 47 | </template> |
| 48 | 48 | </uni-list-item> |
| 49 | - <uni-list-item title="买断数量"> | |
| 49 | + <uni-list-item title="买断数量(kg)"> | |
| 50 | 50 | <template v-slot:footer> |
| 51 | 51 | <uni-easyinput :value="item.buyoutQuantity" :inputBorder="false" disabled /> |
| 52 | 52 | </template> |
| ... | ... | @@ -63,7 +63,7 @@ |
| 63 | 63 | </uni-list-item> |
| 64 | 64 | <uni-list-item> |
| 65 | 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 | 67 | </template> |
| 68 | 68 | <template v-slot:footer> |
| 69 | 69 | <uni-easyinput v-model="item.instockQuantity" type="digit" :inputBorder="false" placeholder="请输入入库数量" @input="recalcDiffAmount(item)" /> |
| ... | ... | @@ -118,7 +118,7 @@ |
| 118 | 118 | <view class="total-title">合计</view> |
| 119 | 119 | <view class="total-body"> |
| 120 | 120 | <view class="total-item"> |
| 121 | - <text class="total-label">买断数量</text> | |
| 121 | + <text class="total-label">买断数量(kg)</text> | |
| 122 | 122 | <text class="total-value">{{ totalSummary.totalBuyoutQuantity || '-' }}</text> |
| 123 | 123 | </view> |
| 124 | 124 | <view class="total-item"> |
| ... | ... | @@ -126,7 +126,7 @@ |
| 126 | 126 | <text class="total-value">{{ totalSummary.totalBuyoutAmount || '-' }}</text> |
| 127 | 127 | </view> |
| 128 | 128 | <view class="total-item"> |
| 129 | - <text class="total-label">入库数量</text> | |
| 129 | + <text class="total-label">入库数量(kg)</text> | |
| 130 | 130 | <text class="total-value">{{ totalSummary.totalInstockQuantity || '-' }}</text> |
| 131 | 131 | </view> |
| 132 | 132 | <view class="total-item"> | ... | ... |
| ... | ... | @@ -26,10 +26,10 @@ |
| 26 | 26 | <view v-for="(item, idx) in lineList" :key="'l-' + (item.id || idx)" class="card"> |
| 27 | 27 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 28 | 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 | 30 | <view class="row"><text class="label">买断单价</text><text class="value">{{ formatNumber(item.buyoutPrice) }}</text></view> |
| 31 | 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 | 33 | <view class="row"><text class="label">入库单价</text><text class="value">{{ formatNumber(item.instockPrice) }}</text></view> |
| 34 | 34 | <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(item.instockAmount) }}</text></view> |
| 35 | 35 | <view class="row"><text class="label">预计吨损耗(元/吨)</text><text class="value">{{ formatNumber(item.expectTonLoss) }}</text></view> |
| ... | ... | @@ -46,9 +46,9 @@ |
| 46 | 46 | <span>合计</span> |
| 47 | 47 | </view> |
| 48 | 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 | 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 | 52 | <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(form.totalInstockAmount) }}</text></view> |
| 53 | 53 | <view class="row"><text class="label">差异金额</text><text class="value">{{ formatNumber(form.totalDiffAmount) }}</text></view> |
| 54 | 54 | </view> | ... | ... |
| ... | ... | @@ -45,7 +45,7 @@ |
| 45 | 45 | <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> |
| 46 | 46 | </template> |
| 47 | 47 | </uni-list-item> |
| 48 | - <uni-list-item title="买断数量"> | |
| 48 | + <uni-list-item title="买断数量(kg)"> | |
| 49 | 49 | <template v-slot:footer> |
| 50 | 50 | <uni-easyinput :value="item.buyoutQuantity" :inputBorder="false" disabled /> |
| 51 | 51 | </template> |
| ... | ... | @@ -62,7 +62,7 @@ |
| 62 | 62 | </uni-list-item> |
| 63 | 63 | <uni-list-item> |
| 64 | 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 | 66 | </template> |
| 67 | 67 | <template v-slot:footer> |
| 68 | 68 | <uni-easyinput v-model="item.instockQuantity" type="digit" :inputBorder="false" placeholder="请输入入库数量" @input="recalcDiffAmount(item)" /> |
| ... | ... | @@ -117,7 +117,7 @@ |
| 117 | 117 | <view class="total-title">合计</view> |
| 118 | 118 | <view class="total-body"> |
| 119 | 119 | <view class="total-item"> |
| 120 | - <text class="total-label">买断数量</text> | |
| 120 | + <text class="total-label">买断数量(kg)</text> | |
| 121 | 121 | <text class="total-value">{{ totalSummary.totalBuyoutQuantity || '-' }}</text> |
| 122 | 122 | </view> |
| 123 | 123 | <view class="total-item"> |
| ... | ... | @@ -125,7 +125,7 @@ |
| 125 | 125 | <text class="total-value">{{ totalSummary.totalBuyoutAmount || '-' }}</text> |
| 126 | 126 | </view> |
| 127 | 127 | <view class="total-item"> |
| 128 | - <text class="total-label">入库数量</text> | |
| 128 | + <text class="total-label">入库数量(kg)</text> | |
| 129 | 129 | <text class="total-value">{{ totalSummary.totalInstockQuantity || '-' }}</text> |
| 130 | 130 | </view> |
| 131 | 131 | <view class="total-item"> | ... | ... |
| ... | ... | @@ -21,10 +21,10 @@ |
| 21 | 21 | <view v-for="(item, idx) in lineList" :key="'l-' + (item.id || idx)" class="card"> |
| 22 | 22 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 23 | 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 | 25 | <view class="row"><text class="label">买断单价</text><text class="value">{{ formatNumber(item.buyoutPrice) }}</text></view> |
| 26 | 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 | 28 | <view class="row"><text class="label">入库单价</text><text class="value">{{ formatNumber(item.instockPrice) }}</text></view> |
| 29 | 29 | <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(item.instockAmount) }}</text></view> |
| 30 | 30 | <view class="row"><text class="label">预计吨损耗(元/吨)</text><text class="value">{{ formatNumber(item.expectTonLoss) }}</text></view> |
| ... | ... | @@ -44,7 +44,7 @@ |
| 44 | 44 | <view class="total-title">合计</view> |
| 45 | 45 | <view class="total-body"> |
| 46 | 46 | <view class="total-item"> |
| 47 | - <text class="total-label">买断数量</text> | |
| 47 | + <text class="total-label">买断数量(kg)</text> | |
| 48 | 48 | <text class="total-value">{{ formatNumber(form.totalBuyoutQuantity) }}</text> |
| 49 | 49 | </view> |
| 50 | 50 | <view class="total-item"> |
| ... | ... | @@ -52,7 +52,7 @@ |
| 52 | 52 | <text class="total-value">{{ formatNumber(form.totalBuyoutAmount) }}</text> |
| 53 | 53 | </view> |
| 54 | 54 | <view class="total-item"> |
| 55 | - <text class="total-label">入库数量</text> | |
| 55 | + <text class="total-label">入库数量(kg)</text> | |
| 56 | 56 | <text class="total-value">{{ formatNumber(form.totalInstockQuantity) }}</text> |
| 57 | 57 | </view> |
| 58 | 58 | <view class="total-item"> | ... | ... |
| ... | ... | @@ -66,6 +66,39 @@ |
| 66 | 66 | </uni-list-item> |
| 67 | 67 | </uni-list> |
| 68 | 68 | |
| 69 | + <!-- 取样明细(可编辑) --> | |
| 70 | + <view class="sub-table"> | |
| 71 | + <view class="header"> | |
| 72 | + <image class="opCollapse" src="/static/images/title.png" /> | |
| 73 | + <text class="title">取样明细</text> | |
| 74 | + <view class="ops"> | |
| 75 | + <image class="opAdd" @click="addSampleLine" src="/static/images/plus.png" /> | |
| 76 | + </view> | |
| 77 | + </view> | |
| 78 | + <view class="add-list"> | |
| 79 | + <view v-if="!sampleLines.length" class="empty-tip">暂无明细,请添加</view> | |
| 80 | + <view v-for="(item, idx) in sampleLines" :key="'s-' + (item.id || idx)" class="block"> | |
| 81 | + <uni-list> | |
| 82 | + <uni-list-item title="取样次序"> | |
| 83 | + <template v-slot:footer> | |
| 84 | + <uni-easyinput :value="item.sampleNo" :inputBorder="false" disabled /> | |
| 85 | + </template> | |
| 86 | + </uni-list-item> | |
| 87 | + <uni-list-item title="取样编号"> | |
| 88 | + <template v-slot:footer> | |
| 89 | + <uni-easyinput :value="item.sampleCode" :inputBorder="false" disabled /> | |
| 90 | + </template> | |
| 91 | + </uni-list-item> | |
| 92 | + </uni-list> | |
| 93 | + <view class="block-ops"> | |
| 94 | + <div class="del" @click="removeSampleLine(idx)"> | |
| 95 | + <image src="/static/images/delete.png" class="icon" />删除 | |
| 96 | + </div> | |
| 97 | + </view> | |
| 98 | + </view> | |
| 99 | + </view> | |
| 100 | + </view> | |
| 101 | + | |
| 69 | 102 | <view class="footer"> |
| 70 | 103 | <button class="btn submit" type="primary" @click="onSubmit">保存</button> |
| 71 | 104 | </view> |
| ... | ... | @@ -101,6 +134,8 @@ export default { |
| 101 | 134 | productId: '', |
| 102 | 135 | department: '' |
| 103 | 136 | }, |
| 137 | + // 取样明细(可编辑) | |
| 138 | + sampleLines: [], | |
| 104 | 139 | dicOptions: { DEPARTMENT: [] }, |
| 105 | 140 | // 计划编号下拉选项(所选码单下的计划) |
| 106 | 141 | planOptions: [], |
| ... | ... | @@ -130,6 +165,12 @@ export default { |
| 130 | 165 | return (this.dicOptions.DEPARTMENT || []).map(it => it.name) |
| 131 | 166 | } |
| 132 | 167 | }, |
| 168 | + watch: { | |
| 169 | + // 送样编号生成/变更后同步刷新取样编号 | |
| 170 | + 'form.code'() { | |
| 171 | + this.syncSampleCode() | |
| 172 | + } | |
| 173 | + }, | |
| 133 | 174 | created() { |
| 134 | 175 | this.ticketSheet.fetchFn = this.fetchTickets.bind(this) |
| 135 | 176 | this.loadDicData() |
| ... | ... | @@ -247,6 +288,31 @@ export default { |
| 247 | 288 | if (!opt) return |
| 248 | 289 | this.form.department = opt.code != null ? String(opt.code) : '' |
| 249 | 290 | }, |
| 291 | + // 取样明细-新增一行(取样次序从1开始递增,取样编号=送样编号_次序) | |
| 292 | + addSampleLine() { | |
| 293 | + const lines = this.sampleLines || [] | |
| 294 | + const sampleNo = String(lines.length + 1) | |
| 295 | + lines.push({ | |
| 296 | + id: genRowId(), | |
| 297 | + sampleNo, | |
| 298 | + sampleCode: `${this.form.code || ''}_${sampleNo}` | |
| 299 | + }) | |
| 300 | + this.sampleLines = lines | |
| 301 | + }, | |
| 302 | + // 取样明细-删除行并按当前顺序重新连续编号 | |
| 303 | + removeSampleLine(idx) { | |
| 304 | + this.sampleLines.splice(idx, 1) | |
| 305 | + this.syncSampleCode() | |
| 306 | + }, | |
| 307 | + // 按当前顺序重新生成取样次序与取样编号 | |
| 308 | + syncSampleCode() { | |
| 309 | + const code = this.form.code || '' | |
| 310 | + ;(this.sampleLines || []).forEach((item, index) => { | |
| 311 | + const sampleNo = String(index + 1) | |
| 312 | + item.sampleNo = sampleNo | |
| 313 | + item.sampleCode = `${code}_${sampleNo}` | |
| 314 | + }) | |
| 315 | + }, | |
| 250 | 316 | validate() { |
| 251 | 317 | const f = this.form |
| 252 | 318 | if (!f.code) return this.tip('请生成送样编号') |
| ... | ... | @@ -254,6 +320,8 @@ export default { |
| 254 | 320 | if (!f.procurementPlanId) return this.tip('请选择计划编号') |
| 255 | 321 | if (!f.productId) return this.tip('请选择品种') |
| 256 | 322 | if (!f.department) return this.tip('请选择科室') |
| 323 | + // 取样明细必填:至少添加一行 | |
| 324 | + if (!this.sampleLines.length) return this.tip('请至少添加一行取样明细') | |
| 257 | 325 | return true |
| 258 | 326 | }, |
| 259 | 327 | tip(msg) { |
| ... | ... | @@ -272,7 +340,12 @@ export default { |
| 272 | 340 | weighingTicketId: this.form.weighingTicketId, |
| 273 | 341 | procurementPlanId: this.form.procurementPlanId, |
| 274 | 342 | productId: this.form.productId, |
| 275 | - department: this.form.department | |
| 343 | + department: this.form.department, | |
| 344 | + // 取样明细(仅提交业务字段) | |
| 345 | + lines: (this.sampleLines || []).map(it => ({ | |
| 346 | + sampleNo: it.sampleNo, | |
| 347 | + sampleCode: it.sampleCode | |
| 348 | + })) | |
| 276 | 349 | }) |
| 277 | 350 | .then(() => { |
| 278 | 351 | uni.hideLoading() |
| ... | ... | @@ -287,6 +360,11 @@ export default { |
| 287 | 360 | } |
| 288 | 361 | } |
| 289 | 362 | } |
| 363 | + | |
| 364 | +// 生成前端临时行 id | |
| 365 | +function genRowId() { | |
| 366 | + return 'row_' + Date.now().toString(36) + '_' + Math.random().toString(36).slice(2, 8) | |
| 367 | +} | |
| 290 | 368 | </script> |
| 291 | 369 | |
| 292 | 370 | <style lang="scss" scoped> |
| ... | ... | @@ -357,6 +435,29 @@ export default { |
| 357 | 435 | &__container { |
| 358 | 436 | padding: 32rpx; |
| 359 | 437 | |
| 438 | + .uni-easyinput { | |
| 439 | + &__placeholder-class { | |
| 440 | + font-size: 32rpx; | |
| 441 | + color: rgba(0, 0, 0, 0.4); | |
| 442 | + } | |
| 443 | + | |
| 444 | + &__content { | |
| 445 | + border: none; | |
| 446 | + background-color: #ffffff !important; | |
| 447 | + | |
| 448 | + &-input { | |
| 449 | + padding-left: 0 !important; | |
| 450 | + height: 48rpx; | |
| 451 | + line-height: 48rpx; | |
| 452 | + font-size: 32rpx; | |
| 453 | + } | |
| 454 | + | |
| 455 | + .content-clear-icon { | |
| 456 | + font-size: 44rpx !important; | |
| 457 | + } | |
| 458 | + } | |
| 459 | + } | |
| 460 | + | |
| 360 | 461 | .item-title, |
| 361 | 462 | .uni-list-item__content { |
| 362 | 463 | flex: none; |
| ... | ... | @@ -435,4 +536,81 @@ export default { |
| 435 | 536 | color: rgba(0, 0, 0, 0.4); |
| 436 | 537 | } |
| 437 | 538 | } |
| 539 | + | |
| 540 | +.sub-table { | |
| 541 | + margin-top: 20rpx; | |
| 542 | + background: #fff; | |
| 543 | +} | |
| 544 | + | |
| 545 | +.header { | |
| 546 | + display: flex; | |
| 547 | + align-items: center; | |
| 548 | + padding: 24rpx 32rpx; | |
| 549 | + border-bottom: 1rpx solid #f0f0f0; | |
| 550 | + | |
| 551 | + .opCollapse { | |
| 552 | + width: 32rpx; | |
| 553 | + height: 28rpx; | |
| 554 | + margin-right: 16rpx; | |
| 555 | + margin-top: 8rpx; | |
| 556 | + } | |
| 557 | + | |
| 558 | + .title { | |
| 559 | + font-size: 32rpx; | |
| 560 | + color: rgba(0, 0, 0, 0.9); | |
| 561 | + font-weight: 600; | |
| 562 | + flex: 1; | |
| 563 | + } | |
| 564 | + | |
| 565 | + .ops { | |
| 566 | + display: flex; | |
| 567 | + align-items: center; | |
| 568 | + | |
| 569 | + .opAdd { | |
| 570 | + width: 40rpx; | |
| 571 | + height: 40rpx; | |
| 572 | + } | |
| 573 | + } | |
| 574 | +} | |
| 575 | + | |
| 576 | +.add-list { | |
| 577 | + padding: 0 0 16rpx; | |
| 578 | + | |
| 579 | + .empty-tip { | |
| 580 | + text-align: center; | |
| 581 | + padding: 60rpx 0; | |
| 582 | + color: rgba(0, 0, 0, 0.4); | |
| 583 | + font-size: 28rpx; | |
| 584 | + } | |
| 585 | + | |
| 586 | + .block { | |
| 587 | + border-bottom: 1rpx solid #f0f0f0; | |
| 588 | + | |
| 589 | + &:last-child { | |
| 590 | + border-bottom: none; | |
| 591 | + } | |
| 592 | + | |
| 593 | + .block-ops { | |
| 594 | + display: flex; | |
| 595 | + align-items: center; | |
| 596 | + justify-content: flex-end; | |
| 597 | + gap: 48rpx; | |
| 598 | + padding: 20rpx 32rpx; | |
| 599 | + background: #f8f8f8; | |
| 600 | + | |
| 601 | + .del { | |
| 602 | + display: flex; | |
| 603 | + align-items: center; | |
| 604 | + font-size: 28rpx; | |
| 605 | + color: #d54941; | |
| 606 | + | |
| 607 | + .icon { | |
| 608 | + width: 32rpx; | |
| 609 | + height: 32rpx; | |
| 610 | + margin-right: 8rpx; | |
| 611 | + } | |
| 612 | + } | |
| 613 | + } | |
| 614 | + } | |
| 615 | +} | |
| 438 | 616 | </style> | ... | ... |
| ... | ... | @@ -13,6 +13,26 @@ |
| 13 | 13 | <view class="row"><text class="label">创建人</text><text class="value">{{ safeText(form.createBy) }}</text></view> |
| 14 | 14 | <view class="row"><text class="label">创建时间</text><text class="value">{{ safeText(form.createTime) }}</text></view> |
| 15 | 15 | </view> |
| 16 | + | |
| 17 | + <!-- 取样明细 --> | |
| 18 | + <view class="sub-table"> | |
| 19 | + <view class="sub-header"> | |
| 20 | + <image class="sub-bar" src="/static/images/title.png" /> | |
| 21 | + <text class="sub-title">取样明细</text> | |
| 22 | + <view class="sub-toggle" @click="toggle('sample')"> | |
| 23 | + <image class="sub-toggle_icon" :src="collapse.sample ? '/static/images/down.png' : '/static/images/up.png'" /> | |
| 24 | + <text class="sub-toggle_text">{{ collapse.sample ? '展开' : '收起' }}</text> | |
| 25 | + </view> | |
| 26 | + </view> | |
| 27 | + <view v-if="!collapse.sample" class="sub-body"> | |
| 28 | + <view v-if="!sampleLines.length" class="empty-tip">暂无明细</view> | |
| 29 | + <view v-for="(item, idx) in sampleLines" :key="'s-' + idx" class="card"> | |
| 30 | + <view class="card-index">第 {{ idx + 1 }} 行</view> | |
| 31 | + <view class="row"><text class="label">取样次序</text><text class="value">{{ safeText(item.sampleNo) }}</text></view> | |
| 32 | + <view class="row"><text class="label">取样编号</text><text class="value">{{ safeText(item.sampleCode) }}</text></view> | |
| 33 | + </view> | |
| 34 | + </view> | |
| 35 | + </view> | |
| 16 | 36 | </view> |
| 17 | 37 | </scroll-view> |
| 18 | 38 | <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> |
| ... | ... | @@ -36,6 +56,9 @@ export default { |
| 36 | 56 | return { |
| 37 | 57 | id: '', |
| 38 | 58 | form: {}, |
| 59 | + // 取样明细 | |
| 60 | + sampleLines: [], | |
| 61 | + collapse: { sample: false }, | |
| 39 | 62 | currentUserId: '', |
| 40 | 63 | dicOptions: { |
| 41 | 64 | DEPARTMENT: [], |
| ... | ... | @@ -107,6 +130,9 @@ export default { |
| 107 | 130 | this.loadDetail() |
| 108 | 131 | }, |
| 109 | 132 | methods: { |
| 133 | + toggle(key) { | |
| 134 | + this.collapse = { ...this.collapse, [key]: !this.collapse[key] } | |
| 135 | + }, | |
| 110 | 136 | async loadDicData() { |
| 111 | 137 | try { |
| 112 | 138 | const results = await getDicByCodes(['DEPARTMENT', 'AUDIT_STATUS']) |
| ... | ... | @@ -134,6 +160,8 @@ export default { |
| 134 | 160 | .then(res => { |
| 135 | 161 | const data = res && res.data ? res.data : {} |
| 136 | 162 | this.form = Object.assign({}, data) |
| 163 | + // 取样明细回显 | |
| 164 | + this.sampleLines = Array.isArray(data.lines) ? data.lines.map(x => ({ ...x })) : [] | |
| 137 | 165 | }) |
| 138 | 166 | .catch(() => { |
| 139 | 167 | uni.showToast({ title: '详情加载失败', icon: 'none' }) |
| ... | ... | @@ -280,4 +308,80 @@ export default { |
| 280 | 308 | word-break: break-all; |
| 281 | 309 | } |
| 282 | 310 | } |
| 311 | + | |
| 312 | +.sub-table { | |
| 313 | + background: #fff; | |
| 314 | + margin-bottom: 20rpx; | |
| 315 | +} | |
| 316 | +.sub-header { | |
| 317 | + display: flex; | |
| 318 | + align-items: center; | |
| 319 | + padding: 16rpx 0 16rpx 32rpx; | |
| 320 | + .sub-bar { width: 6rpx; height: 32rpx; margin-right: 14rpx; } | |
| 321 | + .sub-title { font-size: 30rpx; font-weight: 600; color: rgba(0, 0, 0, 0.9); flex: 1; line-height: 42rpx; } | |
| 322 | + .sub-toggle { | |
| 323 | + display: flex; | |
| 324 | + align-items: center; | |
| 325 | + padding: 0 12rpx; | |
| 326 | + height: 56rpx; | |
| 327 | + .sub-toggle_icon { width: 24rpx; height: 24rpx; margin-right: 8rpx; } | |
| 328 | + .sub-toggle_text { font-size: 26rpx; color: rgba(0, 0, 0, 0.6); } | |
| 329 | + } | |
| 330 | +} | |
| 331 | +.sub-body { | |
| 332 | + padding: 0 32rpx 24rpx; | |
| 333 | + .empty-tip { | |
| 334 | + text-align: center; | |
| 335 | + padding: 60rpx 0; | |
| 336 | + color: rgba(0, 0, 0, 0.4); | |
| 337 | + font-size: 28rpx; | |
| 338 | + } | |
| 339 | + .card { | |
| 340 | + position: relative; | |
| 341 | + background: #fafafa; | |
| 342 | + border-radius: 12rpx; | |
| 343 | + padding: 32rpx 28rpx 20rpx; | |
| 344 | + margin-bottom: 24rpx; | |
| 345 | + &:last-child { margin-bottom: 0; } | |
| 346 | + .card-index { | |
| 347 | + position: absolute; | |
| 348 | + top: 0; | |
| 349 | + right: 0; | |
| 350 | + background: rgba(24, 144, 255, 0.08); | |
| 351 | + color: $theme-primary; | |
| 352 | + font-size: 22rpx; | |
| 353 | + line-height: 36rpx; | |
| 354 | + padding: 0 16rpx; | |
| 355 | + border-bottom-left-radius: 12rpx; | |
| 356 | + border-top-right-radius: 12rpx; | |
| 357 | + } | |
| 358 | + .row { | |
| 359 | + align-items: center; | |
| 360 | + justify-content: space-between; | |
| 361 | + padding: 14rpx 0; | |
| 362 | + margin-bottom: 0; | |
| 363 | + border-bottom: 1rpx dashed #f2f2f2; | |
| 364 | + &:last-child { border-bottom: none; } | |
| 365 | + .label { | |
| 366 | + flex-shrink: 0; | |
| 367 | + width: 220rpx; | |
| 368 | + max-width: none; | |
| 369 | + margin-right: 0; | |
| 370 | + font-size: 28rpx; | |
| 371 | + color: rgba(0, 0, 0, 0.6); | |
| 372 | + line-height: 40rpx; | |
| 373 | + } | |
| 374 | + .value { | |
| 375 | + flex: 1; | |
| 376 | + text-align: right; | |
| 377 | + font-size: 28rpx; | |
| 378 | + color: rgba(0, 0, 0, 0.9); | |
| 379 | + line-height: 40rpx; | |
| 380 | + overflow: hidden; | |
| 381 | + text-overflow: ellipsis; | |
| 382 | + white-space: nowrap; | |
| 383 | + } | |
| 384 | + } | |
| 385 | + } | |
| 386 | +} | |
| 283 | 387 | </style> | ... | ... |
| ... | ... | @@ -63,6 +63,39 @@ |
| 63 | 63 | </uni-list-item> |
| 64 | 64 | </uni-list> |
| 65 | 65 | |
| 66 | + <!-- 取样明细(可编辑) --> | |
| 67 | + <view class="sub-table"> | |
| 68 | + <view class="header"> | |
| 69 | + <image class="opCollapse" src="/static/images/title.png" /> | |
| 70 | + <text class="title">取样明细</text> | |
| 71 | + <view class="ops"> | |
| 72 | + <image class="opAdd" @click="addSampleLine" src="/static/images/plus.png" /> | |
| 73 | + </view> | |
| 74 | + </view> | |
| 75 | + <view class="add-list"> | |
| 76 | + <view v-if="!sampleLines.length" class="empty-tip">暂无明细,请添加</view> | |
| 77 | + <view v-for="(item, idx) in sampleLines" :key="'s-' + (item.id || idx)" class="block"> | |
| 78 | + <uni-list> | |
| 79 | + <uni-list-item title="取样次序"> | |
| 80 | + <template v-slot:footer> | |
| 81 | + <uni-easyinput :value="item.sampleNo" :inputBorder="false" disabled /> | |
| 82 | + </template> | |
| 83 | + </uni-list-item> | |
| 84 | + <uni-list-item title="取样编号"> | |
| 85 | + <template v-slot:footer> | |
| 86 | + <uni-easyinput :value="item.sampleCode" :inputBorder="false" disabled /> | |
| 87 | + </template> | |
| 88 | + </uni-list-item> | |
| 89 | + </uni-list> | |
| 90 | + <view class="block-ops"> | |
| 91 | + <div class="del" @click="removeSampleLine(idx)"> | |
| 92 | + <image src="/static/images/delete.png" class="icon" />删除 | |
| 93 | + </div> | |
| 94 | + </view> | |
| 95 | + </view> | |
| 96 | + </view> | |
| 97 | + </view> | |
| 98 | + | |
| 66 | 99 | <view class="footer"> |
| 67 | 100 | <button class="btn submit" type="primary" @click="onSubmit">保存</button> |
| 68 | 101 | </view> |
| ... | ... | @@ -99,6 +132,8 @@ export default { |
| 99 | 132 | productId: '', |
| 100 | 133 | department: '' |
| 101 | 134 | }, |
| 135 | + // 取样明细(可编辑) | |
| 136 | + sampleLines: [], | |
| 102 | 137 | dicOptions: { DEPARTMENT: [] }, |
| 103 | 138 | // 计划编号下拉选项(所选码单下的计划) |
| 104 | 139 | planOptions: [], |
| ... | ... | @@ -128,6 +163,12 @@ export default { |
| 128 | 163 | return (this.dicOptions.DEPARTMENT || []).map(it => it.name) |
| 129 | 164 | } |
| 130 | 165 | }, |
| 166 | + watch: { | |
| 167 | + // 送样编号变更后同步刷新取样编号 | |
| 168 | + 'form.code'() { | |
| 169 | + this.syncSampleCode() | |
| 170 | + } | |
| 171 | + }, | |
| 131 | 172 | created() { |
| 132 | 173 | this.ticketSheet.fetchFn = this.fetchTickets.bind(this) |
| 133 | 174 | this.loadDicData() |
| ... | ... | @@ -169,6 +210,8 @@ export default { |
| 169 | 210 | this.productOptions = this.form.productId |
| 170 | 211 | ? [{ label: data.productName || '', value: this.form.productId }] |
| 171 | 212 | : [] |
| 213 | + // 取样明细回显 | |
| 214 | + this.sampleLines = (Array.isArray(data.lines) ? data.lines : []).map(it => ({ ...it, id: it.id || genRowId() })) | |
| 172 | 215 | if (this.form.weighingTicketId) { |
| 173 | 216 | this.loadPlanOptions(this.form.weighingTicketId) |
| 174 | 217 | } |
| ... | ... | @@ -301,12 +344,39 @@ export default { |
| 301 | 344 | if (!opt) return |
| 302 | 345 | this.form.department = opt.code != null ? String(opt.code) : '' |
| 303 | 346 | }, |
| 347 | + // 取样明细-新增一行(取样次序从1开始递增,取样编号=送样编号_次序) | |
| 348 | + addSampleLine() { | |
| 349 | + const lines = this.sampleLines || [] | |
| 350 | + const sampleNo = String(lines.length + 1) | |
| 351 | + lines.push({ | |
| 352 | + id: genRowId(), | |
| 353 | + sampleNo, | |
| 354 | + sampleCode: `${this.form.code || ''}_${sampleNo}` | |
| 355 | + }) | |
| 356 | + this.sampleLines = lines | |
| 357 | + }, | |
| 358 | + // 取样明细-删除行并按当前顺序重新连续编号 | |
| 359 | + removeSampleLine(idx) { | |
| 360 | + this.sampleLines.splice(idx, 1) | |
| 361 | + this.syncSampleCode() | |
| 362 | + }, | |
| 363 | + // 按当前顺序重新生成取样次序与取样编号 | |
| 364 | + syncSampleCode() { | |
| 365 | + const code = this.form.code || '' | |
| 366 | + ;(this.sampleLines || []).forEach((item, index) => { | |
| 367 | + const sampleNo = String(index + 1) | |
| 368 | + item.sampleNo = sampleNo | |
| 369 | + item.sampleCode = `${code}_${sampleNo}` | |
| 370 | + }) | |
| 371 | + }, | |
| 304 | 372 | validate() { |
| 305 | 373 | const f = this.form |
| 306 | 374 | if (!f.weighingTicketId) return this.tip('请选择码单编号') |
| 307 | 375 | if (!f.procurementPlanId) return this.tip('请选择计划编号') |
| 308 | 376 | if (!f.productId) return this.tip('请选择品种') |
| 309 | 377 | if (!f.department) return this.tip('请选择科室') |
| 378 | + // 取样明细必填:至少添加一行 | |
| 379 | + if (!this.sampleLines.length) return this.tip('请至少添加一行取样明细') | |
| 310 | 380 | return true |
| 311 | 381 | }, |
| 312 | 382 | tip(msg) { |
| ... | ... | @@ -326,7 +396,12 @@ export default { |
| 326 | 396 | weighingTicketId: this.form.weighingTicketId, |
| 327 | 397 | procurementPlanId: this.form.procurementPlanId, |
| 328 | 398 | productId: this.form.productId, |
| 329 | - department: this.form.department | |
| 399 | + department: this.form.department, | |
| 400 | + // 取样明细(仅提交业务字段) | |
| 401 | + lines: (this.sampleLines || []).map(it => ({ | |
| 402 | + sampleNo: it.sampleNo, | |
| 403 | + sampleCode: it.sampleCode | |
| 404 | + })) | |
| 330 | 405 | }) |
| 331 | 406 | .then(() => { |
| 332 | 407 | uni.hideLoading() |
| ... | ... | @@ -344,6 +419,11 @@ export default { |
| 344 | 419 | } |
| 345 | 420 | } |
| 346 | 421 | } |
| 422 | + | |
| 423 | +// 生成前端临时行 id | |
| 424 | +function genRowId() { | |
| 425 | + return 'row_' + Date.now().toString(36) + '_' + Math.random().toString(36).slice(2, 8) | |
| 426 | +} | |
| 347 | 427 | </script> |
| 348 | 428 | |
| 349 | 429 | <style lang="scss" scoped> |
| ... | ... | @@ -414,6 +494,29 @@ export default { |
| 414 | 494 | &__container { |
| 415 | 495 | padding: 32rpx; |
| 416 | 496 | |
| 497 | + .uni-easyinput { | |
| 498 | + &__placeholder-class { | |
| 499 | + font-size: 32rpx; | |
| 500 | + color: rgba(0, 0, 0, 0.4); | |
| 501 | + } | |
| 502 | + | |
| 503 | + &__content { | |
| 504 | + border: none; | |
| 505 | + background-color: #ffffff !important; | |
| 506 | + | |
| 507 | + &-input { | |
| 508 | + padding-left: 0 !important; | |
| 509 | + height: 48rpx; | |
| 510 | + line-height: 48rpx; | |
| 511 | + font-size: 32rpx; | |
| 512 | + } | |
| 513 | + | |
| 514 | + .content-clear-icon { | |
| 515 | + font-size: 44rpx !important; | |
| 516 | + } | |
| 517 | + } | |
| 518 | + } | |
| 519 | + | |
| 417 | 520 | .item-title, |
| 418 | 521 | .uni-list-item__content { |
| 419 | 522 | flex: none; |
| ... | ... | @@ -476,4 +579,81 @@ export default { |
| 476 | 579 | color: rgba(0, 0, 0, 0.4); |
| 477 | 580 | } |
| 478 | 581 | } |
| 582 | + | |
| 583 | +.sub-table { | |
| 584 | + margin-top: 20rpx; | |
| 585 | + background: #fff; | |
| 586 | +} | |
| 587 | + | |
| 588 | +.header { | |
| 589 | + display: flex; | |
| 590 | + align-items: center; | |
| 591 | + padding: 24rpx 32rpx; | |
| 592 | + border-bottom: 1rpx solid #f0f0f0; | |
| 593 | + | |
| 594 | + .opCollapse { | |
| 595 | + width: 32rpx; | |
| 596 | + height: 28rpx; | |
| 597 | + margin-right: 16rpx; | |
| 598 | + margin-top: 8rpx; | |
| 599 | + } | |
| 600 | + | |
| 601 | + .title { | |
| 602 | + font-size: 32rpx; | |
| 603 | + color: rgba(0, 0, 0, 0.9); | |
| 604 | + font-weight: 600; | |
| 605 | + flex: 1; | |
| 606 | + } | |
| 607 | + | |
| 608 | + .ops { | |
| 609 | + display: flex; | |
| 610 | + align-items: center; | |
| 611 | + | |
| 612 | + .opAdd { | |
| 613 | + width: 40rpx; | |
| 614 | + height: 40rpx; | |
| 615 | + } | |
| 616 | + } | |
| 617 | +} | |
| 618 | + | |
| 619 | +.add-list { | |
| 620 | + padding: 0 0 16rpx; | |
| 621 | + | |
| 622 | + .empty-tip { | |
| 623 | + text-align: center; | |
| 624 | + padding: 60rpx 0; | |
| 625 | + color: rgba(0, 0, 0, 0.4); | |
| 626 | + font-size: 28rpx; | |
| 627 | + } | |
| 628 | + | |
| 629 | + .block { | |
| 630 | + border-bottom: 1rpx solid #f0f0f0; | |
| 631 | + | |
| 632 | + &:last-child { | |
| 633 | + border-bottom: none; | |
| 634 | + } | |
| 635 | + | |
| 636 | + .block-ops { | |
| 637 | + display: flex; | |
| 638 | + align-items: center; | |
| 639 | + justify-content: flex-end; | |
| 640 | + gap: 48rpx; | |
| 641 | + padding: 20rpx 32rpx; | |
| 642 | + background: #f8f8f8; | |
| 643 | + | |
| 644 | + .del { | |
| 645 | + display: flex; | |
| 646 | + align-items: center; | |
| 647 | + font-size: 28rpx; | |
| 648 | + color: #d54941; | |
| 649 | + | |
| 650 | + .icon { | |
| 651 | + width: 32rpx; | |
| 652 | + height: 32rpx; | |
| 653 | + margin-right: 8rpx; | |
| 654 | + } | |
| 655 | + } | |
| 656 | + } | |
| 657 | + } | |
| 658 | +} | |
| 479 | 659 | </style> | ... | ... |
| ... | ... | @@ -12,6 +12,22 @@ |
| 12 | 12 | <view class="row"><text class="label">创建人</text><text class="value">{{ safeText(form.createBy) }}</text></view> |
| 13 | 13 | <view class="row"><text class="label">创建时间</text><text class="value">{{ safeText(form.createTime) }}</text></view> |
| 14 | 14 | </view> |
| 15 | + | |
| 16 | + <!-- 取样明细 --> | |
| 17 | + <view class="sub-table"> | |
| 18 | + <view class="sub-header"> | |
| 19 | + <image class="sub-bar" src="/static/images/title.png" /> | |
| 20 | + <text class="sub-title">取样明细</text> | |
| 21 | + </view> | |
| 22 | + <view class="sub-body"> | |
| 23 | + <view v-if="!sampleLines.length" class="empty-tip">暂无明细</view> | |
| 24 | + <view v-for="(item, idx) in sampleLines" :key="'s-' + idx" class="card"> | |
| 25 | + <view class="card-index">第 {{ idx + 1 }} 行</view> | |
| 26 | + <view class="row"><text class="label">取样次序</text><text class="value">{{ safeText(item.sampleNo) }}</text></view> | |
| 27 | + <view class="row"><text class="label">取样编号</text><text class="value">{{ safeText(item.sampleCode) }}</text></view> | |
| 28 | + </view> | |
| 29 | + </view> | |
| 30 | + </view> | |
| 15 | 31 | </scroll-view> |
| 16 | 32 | </view> |
| 17 | 33 | </template> |
| ... | ... | @@ -26,6 +42,8 @@ export default { |
| 26 | 42 | data() { |
| 27 | 43 | return { |
| 28 | 44 | form: {}, |
| 45 | + // 取样明细 | |
| 46 | + sampleLines: [], | |
| 29 | 47 | dicOptions: { |
| 30 | 48 | DEPARTMENT: [], |
| 31 | 49 | AUDIT_STATUS: [] |
| ... | ... | @@ -71,6 +89,8 @@ export default { |
| 71 | 89 | .then(res => { |
| 72 | 90 | const data = res && res.data ? res.data : {} |
| 73 | 91 | this.form = Object.assign({}, data) |
| 92 | + // 取样明细回显 | |
| 93 | + this.sampleLines = Array.isArray(data.lines) ? data.lines.map(x => ({ ...x })) : [] | |
| 74 | 94 | }) |
| 75 | 95 | .catch(() => { |
| 76 | 96 | uni.showToast({ title: '详情加载失败', icon: 'none' }) |
| ... | ... | @@ -138,4 +158,95 @@ export default { |
| 138 | 158 | word-break: break-all; |
| 139 | 159 | } |
| 140 | 160 | } |
| 161 | +.sub-table { | |
| 162 | + background: #fff; | |
| 163 | + margin-bottom: 20rpx; | |
| 164 | +} | |
| 165 | +.sub-header { | |
| 166 | + display: flex; | |
| 167 | + align-items: center; | |
| 168 | + padding: 16rpx 0 16rpx 32rpx; | |
| 169 | + | |
| 170 | + .sub-bar { | |
| 171 | + width: 6rpx; | |
| 172 | + height: 32rpx; | |
| 173 | + margin-right: 14rpx; | |
| 174 | + } | |
| 175 | + | |
| 176 | + .sub-title { | |
| 177 | + font-size: 30rpx; | |
| 178 | + font-weight: 600; | |
| 179 | + color: rgba(0, 0, 0, 0.9); | |
| 180 | + flex: 1; | |
| 181 | + line-height: 42rpx; | |
| 182 | + } | |
| 183 | +} | |
| 184 | +.sub-body { | |
| 185 | + padding: 0 32rpx 24rpx; | |
| 186 | + | |
| 187 | + .empty-tip { | |
| 188 | + text-align: center; | |
| 189 | + padding: 60rpx 0; | |
| 190 | + color: rgba(0, 0, 0, 0.4); | |
| 191 | + font-size: 28rpx; | |
| 192 | + } | |
| 193 | + | |
| 194 | + .card { | |
| 195 | + position: relative; | |
| 196 | + background: #fafafa; | |
| 197 | + border-radius: 12rpx; | |
| 198 | + padding: 32rpx 28rpx 20rpx; | |
| 199 | + margin-bottom: 24rpx; | |
| 200 | + | |
| 201 | + &:last-child { | |
| 202 | + margin-bottom: 0; | |
| 203 | + } | |
| 204 | + | |
| 205 | + .card-index { | |
| 206 | + position: absolute; | |
| 207 | + top: 0; | |
| 208 | + right: 0; | |
| 209 | + background: rgba(24, 144, 255, 0.08); | |
| 210 | + color: $theme-primary; | |
| 211 | + font-size: 22rpx; | |
| 212 | + line-height: 36rpx; | |
| 213 | + padding: 0 16rpx; | |
| 214 | + border-bottom-left-radius: 12rpx; | |
| 215 | + border-top-right-radius: 12rpx; | |
| 216 | + } | |
| 217 | + | |
| 218 | + .row { | |
| 219 | + align-items: center; | |
| 220 | + justify-content: space-between; | |
| 221 | + padding: 14rpx 0; | |
| 222 | + margin-bottom: 0; | |
| 223 | + border-bottom: 1rpx dashed #f2f2f2; | |
| 224 | + | |
| 225 | + &:last-child { | |
| 226 | + border-bottom: none; | |
| 227 | + } | |
| 228 | + | |
| 229 | + .label { | |
| 230 | + flex-shrink: 0; | |
| 231 | + width: 220rpx; | |
| 232 | + max-width: none; | |
| 233 | + margin-right: 0; | |
| 234 | + font-size: 28rpx; | |
| 235 | + color: rgba(0, 0, 0, 0.6); | |
| 236 | + line-height: 40rpx; | |
| 237 | + } | |
| 238 | + | |
| 239 | + .value { | |
| 240 | + flex: 1; | |
| 241 | + text-align: right; | |
| 242 | + font-size: 28rpx; | |
| 243 | + color: rgba(0, 0, 0, 0.9); | |
| 244 | + line-height: 40rpx; | |
| 245 | + overflow: hidden; | |
| 246 | + text-overflow: ellipsis; | |
| 247 | + white-space: nowrap; | |
| 248 | + } | |
| 249 | + } | |
| 250 | + } | |
| 251 | +} | |
| 141 | 252 | </style> | ... | ... |
| ... | ... | @@ -63,7 +63,7 @@ |
| 63 | 63 | </uni-list-item> |
| 64 | 64 | <uni-list-item> |
| 65 | 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 | 67 | </template> |
| 68 | 68 | <template v-slot:footer> |
| 69 | 69 | <uni-easyinput v-model="item.purchaseQuantity" type="digit" :inputBorder="false" placeholder="请输入采购数" @input="recalcTaxAmount(item)" /> |
| ... | ... | @@ -71,7 +71,7 @@ |
| 71 | 71 | </uni-list-item> |
| 72 | 72 | <uni-list-item> |
| 73 | 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 | 75 | </template> |
| 76 | 76 | <template v-slot:footer> |
| 77 | 77 | <uni-easyinput v-model="item.actualQuantity" type="digit" :inputBorder="false" placeholder="请输入实收数" /> |
| ... | ... | @@ -115,11 +115,11 @@ |
| 115 | 115 | <view class="total-title">合计</view> |
| 116 | 116 | <view class="total-body"> |
| 117 | 117 | <view class="total-item"> |
| 118 | - <text class="total-label">采购数</text> | |
| 118 | + <text class="total-label">采购数(kg)</text> | |
| 119 | 119 | <text class="total-value">{{ purchaseQuantityCap }}</text> |
| 120 | 120 | </view> |
| 121 | 121 | <view class="total-item"> |
| 122 | - <text class="total-label">实收数</text> | |
| 122 | + <text class="total-label">实收数(kg)</text> | |
| 123 | 123 | <text class="total-value">{{ totalActualQuantity || '-' }}</text> |
| 124 | 124 | </view> |
| 125 | 125 | <view class="total-item"> |
| ... | ... | @@ -143,9 +143,9 @@ |
| 143 | 143 | |
| 144 | 144 | <!-- 附件 --> |
| 145 | 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 | 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 | 149 | <view v-for="(file, idx) in fileList" :key="file.fileId || idx" class="file-item"> |
| 150 | 150 | <text class="file-name">{{ file.fileName || '未命名文件' }}</text> |
| 151 | 151 | <text class="file-del" @click="removeFile(idx)">删除</text> |
| ... | ... | @@ -442,7 +442,6 @@ export default { |
| 442 | 442 | if (row.actualQuantity === '' || row.actualQuantity == null) return this.tip(`明细第${i + 1}行:请输入实收数`) |
| 443 | 443 | if (row.taxPrice === '' || row.taxPrice == null) return this.tip(`明细第${i + 1}行:请输入含税单价`) |
| 444 | 444 | } |
| 445 | - if (!this.fileList.length) return this.tip('请上传附件') | |
| 446 | 445 | return true |
| 447 | 446 | }, |
| 448 | 447 | tip(msg) { | ... | ... |
| ... | ... | @@ -29,8 +29,8 @@ |
| 29 | 29 | <view class="row"><text class="label">材料名称</text><text class="value">{{ safeText(item.name) }}</text></view> |
| 30 | 30 | <view class="row"><text class="label">规格型号</text><text class="value">{{ safeText(item.specModel) }}</text></view> |
| 31 | 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 | 34 | <view class="row"><text class="label">含税价格(单价)</text><text class="value">{{ formatNumber(item.taxPrice) }}</text></view> |
| 35 | 35 | <view class="row"><text class="label">含税价格(金额)</text><text class="value">{{ formatNumber(item.taxAmount) }}</text></view> |
| 36 | 36 | <view class="row"><text class="label">不含税价格(单价)</text><text class="value">{{ formatNumber(item.noTaxPrice) }}</text></view> |
| ... | ... | @@ -44,11 +44,11 @@ |
| 44 | 44 | <view class="total-title">合计</view> |
| 45 | 45 | <view class="total-body"> |
| 46 | 46 | <view class="total-item"> |
| 47 | - <text class="total-label">采购数</text> | |
| 47 | + <text class="total-label">采购数(kg)</text> | |
| 48 | 48 | <text class="total-value">{{ purchaseQuantityCap }}</text> |
| 49 | 49 | </view> |
| 50 | 50 | <view class="total-item"> |
| 51 | - <text class="total-label">实收数</text> | |
| 51 | + <text class="total-label">实收数(kg)</text> | |
| 52 | 52 | <text class="total-value">{{ formatNumber(form.totalActualQuantity) }}</text> |
| 53 | 53 | </view> |
| 54 | 54 | <view class="total-item"> | ... | ... |
| ... | ... | @@ -62,7 +62,7 @@ |
| 62 | 62 | </uni-list-item> |
| 63 | 63 | <uni-list-item> |
| 64 | 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 | 66 | </template> |
| 67 | 67 | <template v-slot:footer> |
| 68 | 68 | <uni-easyinput v-model="item.purchaseQuantity" type="digit" :inputBorder="false" placeholder="请输入采购数" @input="recalcTaxAmount(item)" /> |
| ... | ... | @@ -70,7 +70,7 @@ |
| 70 | 70 | </uni-list-item> |
| 71 | 71 | <uni-list-item> |
| 72 | 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 | 74 | </template> |
| 75 | 75 | <template v-slot:footer> |
| 76 | 76 | <uni-easyinput v-model="item.actualQuantity" type="digit" :inputBorder="false" placeholder="请输入实收数" /> |
| ... | ... | @@ -114,11 +114,11 @@ |
| 114 | 114 | <view class="total-title">合计</view> |
| 115 | 115 | <view class="total-body"> |
| 116 | 116 | <view class="total-item"> |
| 117 | - <text class="total-label">采购数</text> | |
| 117 | + <text class="total-label">采购数(kg)</text> | |
| 118 | 118 | <text class="total-value">{{ purchaseQuantityCap }}</text> |
| 119 | 119 | </view> |
| 120 | 120 | <view class="total-item"> |
| 121 | - <text class="total-label">实收数</text> | |
| 121 | + <text class="total-label">实收数(kg)</text> | |
| 122 | 122 | <text class="total-value">{{ totalActualQuantity || '-' }}</text> |
| 123 | 123 | </view> |
| 124 | 124 | <view class="total-item"> |
| ... | ... | @@ -142,9 +142,9 @@ |
| 142 | 142 | |
| 143 | 143 | <!-- 附件 --> |
| 144 | 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 | 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 | 148 | <view v-for="(file, idx) in fileList" :key="file.fileId || idx" class="file-item"> |
| 149 | 149 | <text class="file-name">{{ file.fileName || '未命名文件' }}</text> |
| 150 | 150 | <text class="file-del" @click="removeFile(idx)">删除</text> |
| ... | ... | @@ -369,7 +369,6 @@ export default { |
| 369 | 369 | if (row.actualQuantity === '' || row.actualQuantity == null) return this.tip(`明细第${i + 1}行:请输入实收数`) |
| 370 | 370 | if (row.taxPrice === '' || row.taxPrice == null) return this.tip(`明细第${i + 1}行:请输入含税单价`) |
| 371 | 371 | } |
| 372 | - if (!this.fileList.length) return this.tip('请上传附件') | |
| 373 | 372 | return true |
| 374 | 373 | }, |
| 375 | 374 | tip(msg) { | ... | ... |
| ... | ... | @@ -24,9 +24,9 @@ |
| 24 | 24 | <view class="row"><text class="label">材料名称</text><text class="value">{{ safeText(item.name) }}</text></view> |
| 25 | 25 | <view class="row"><text class="label">规格型号</text><text class="value">{{ safeText(item.specModel) }}</text></view> |
| 26 | 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 | 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 | 30 | <view class="actual-value"> |
| 31 | 31 | <uni-easyinput v-if="canEditActualQuantity" v-model="item.actualQuantity" type="digit" |
| 32 | 32 | :inputBorder="false" placeholder="请输入实收数" /> |
| ... | ... | @@ -50,11 +50,11 @@ |
| 50 | 50 | <view class="total-title">合计</view> |
| 51 | 51 | <view class="total-body"> |
| 52 | 52 | <view class="total-item"> |
| 53 | - <text class="total-label">采购数</text> | |
| 53 | + <text class="total-label">采购数(kg)</text> | |
| 54 | 54 | <text class="total-value">{{ purchaseQuantityCap }}</text> |
| 55 | 55 | </view> |
| 56 | 56 | <view class="total-item"> |
| 57 | - <text class="total-label">实收数</text> | |
| 57 | + <text class="total-label">实收数(kg)</text> | |
| 58 | 58 | <text class="total-value">{{ formatNumber(form.totalActualQuantity) }}</text> |
| 59 | 59 | </view> |
| 60 | 60 | <view class="total-item"> | ... | ... |
| ... | ... | @@ -79,7 +79,7 @@ |
| 79 | 79 | <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> |
| 80 | 80 | </template> |
| 81 | 81 | </uni-list-item> |
| 82 | - <uni-list-item title="计划数量"> | |
| 82 | + <uni-list-item title="计划数量(kg)"> | |
| 83 | 83 | <template v-slot:footer> |
| 84 | 84 | <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> |
| 85 | 85 | </template> |
| ... | ... | @@ -135,7 +135,7 @@ |
| 135 | 135 | </uni-list-item> |
| 136 | 136 | <uni-list-item title="过磅数量"> |
| 137 | 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 | 139 | </template> |
| 140 | 140 | <template v-slot:footer> |
| 141 | 141 | <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" /> |
| ... | ... | @@ -179,7 +179,7 @@ |
| 179 | 179 | </uni-list-item> |
| 180 | 180 | <uni-list-item title="数量"> |
| 181 | 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 | 183 | </template> |
| 184 | 184 | <template v-slot:footer> |
| 185 | 185 | <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" /> |
| ... | ... | @@ -210,7 +210,7 @@ |
| 210 | 210 | </uni-list-item> |
| 211 | 211 | <uni-list-item> |
| 212 | 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 | 214 | </template> |
| 215 | 215 | <template v-slot:footer> |
| 216 | 216 | <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" /> |
| ... | ... | @@ -218,13 +218,13 @@ |
| 218 | 218 | </uni-list-item> |
| 219 | 219 | <uni-list-item> |
| 220 | 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 | 222 | </template> |
| 223 | 223 | <template v-slot:footer> |
| 224 | 224 | <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" /> |
| 225 | 225 | </template> |
| 226 | 226 | </uni-list-item> |
| 227 | - <uni-list-item title="货物净重"> | |
| 227 | + <uni-list-item title="货物净重(kg)"> | |
| 228 | 228 | <template v-slot:footer> |
| 229 | 229 | <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled /> |
| 230 | 230 | </template> |
| ... | ... | @@ -251,7 +251,16 @@ |
| 251 | 251 | <uni-list> |
| 252 | 252 | <uni-list-item> |
| 253 | 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 | 264 | </template> |
| 256 | 265 | <template v-slot:footer> |
| 257 | 266 | <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" /> |
| ... | ... | @@ -259,7 +268,7 @@ |
| 259 | 268 | </uni-list-item> |
| 260 | 269 | <uni-list-item> |
| 261 | 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 | 272 | </template> |
| 264 | 273 | <template v-slot:footer> |
| 265 | 274 | <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" /> |
| ... | ... | @@ -319,7 +328,7 @@ import { |
| 319 | 328 | weighTicketCreateApi |
| 320 | 329 | } from '@/api/procure-manage/weighTicket.js' |
| 321 | 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 | 333 | export default { |
| 325 | 334 | name: 'AddWeightTicket', |
| ... | ... | @@ -336,6 +345,7 @@ export default { |
| 336 | 345 | totalGrossWeight: '', |
| 337 | 346 | actualImpurityWeight: '', |
| 338 | 347 | deductionTypes: [], |
| 348 | + deductionTypesRemarks: '', | |
| 339 | 349 | supplierStockMaterial: '', |
| 340 | 350 | logisticsStockMaterial: '', |
| 341 | 351 | plateNumber: '', |
| ... | ... | @@ -420,6 +430,14 @@ export default { |
| 420 | 430 | if (net === '' || net === null || net === undefined) return '' |
| 421 | 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 | 442 | computedBusinessSummary() { |
| 425 | 443 | const parts = [] |
| ... | ... | @@ -432,10 +450,9 @@ export default { |
| 432 | 450 | }) |
| 433 | 451 | .filter(text => !!text) |
| 434 | 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 | 456 | if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) |
| 440 | 457 | if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) |
| 441 | 458 | if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`) |
| ... | ... | @@ -448,6 +465,15 @@ export default { |
| 448 | 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 | 477 | created() { |
| 452 | 478 | this.planSheet.fetchFn = this.fetchPlans.bind(this) |
| 453 | 479 | this.loadDicData() |
| ... | ... | @@ -494,6 +520,31 @@ export default { |
| 494 | 520 | }) |
| 495 | 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 | 549 | fetchPlans({ pageIndex, pageSize, extra }) { |
| 499 | 550 | const keyword = (extra && extra.keyword) || '' |
| ... | ... | @@ -563,11 +614,16 @@ export default { |
| 563 | 614 | row.productName = '' |
| 564 | 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 | 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 | 628 | getWeightProductLabel(item) { |
| 573 | 629 | if (!item.productId) return '' |
| ... | ... | @@ -577,7 +633,7 @@ export default { |
| 577 | 633 | // 过磅品种改选:整行替换为对应计划明细数据(保留行id与计划编号) |
| 578 | 634 | handleWeightProductChange(idx, optIdx) { |
| 579 | 635 | const row = this.weighList[idx] |
| 580 | - const options = (this.planList || []).filter(it => it.planCode === row.planCode) | |
| 636 | + const options = this.getWeightProductOptions(row) | |
| 581 | 637 | const raw = options[optIdx] |
| 582 | 638 | if (!raw) return |
| 583 | 639 | this.weighList.splice(idx, 1, { |
| ... | ... | @@ -629,8 +685,8 @@ export default { |
| 629 | 685 | if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重') |
| 630 | 686 | if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重') |
| 631 | 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 | 690 | if (!f.plateNumber) return this.tip('请输入车牌号') |
| 635 | 691 | // 过磅明细:计划编号、品种、数量必填 |
| 636 | 692 | const weightList = this.weighList || [] |
| ... | ... | @@ -681,6 +737,7 @@ export default { |
| 681 | 737 | netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), |
| 682 | 738 | netWeightUpper: this.computedNetWeightUpper || null, |
| 683 | 739 | deductionTypes: (this.form.deductionTypes || []).join(',') || null, |
| 740 | + deductionTypesRemarks: this.form.deductionTypesRemarks || null, | |
| 684 | 741 | supplierStockMaterial: this.form.supplierStockMaterial || null, |
| 685 | 742 | logisticsStockMaterial: this.form.logisticsStockMaterial || null, |
| 686 | 743 | plateNumber: this.form.plateNumber || null, |
| ... | ... | @@ -689,12 +746,24 @@ export default { |
| 689 | 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 | 760 | async onSubmit() { |
| 693 | 761 | if (!this.validate()) return |
| 694 | 762 | const confirmRes = await new Promise(resolve => { |
| 695 | 763 | uni.showModal({ title: '提示', content: '确定保存过磅单吗?', confirmText: '确定', cancelText: '取消', success: resolve }) |
| 696 | 764 | }) |
| 697 | 765 | if (!(confirmRes && confirmRes.confirm)) return |
| 766 | + if (!(await this.confirmQuantityMismatch())) return | |
| 698 | 767 | uni.showLoading({ title: '提交中...', mask: true }) |
| 699 | 768 | weighTicketCreateApi(this.buildSubmitData()) |
| 700 | 769 | .then(() => { |
| ... | ... | @@ -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 | 1128 | .remark-group { |
| 1054 | 1129 | margin-bottom: 32rpx; |
| 1055 | 1130 | ... | ... |
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 30 | 30 | <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> |
| 31 | 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 | 33 | </view> |
| 34 | 34 | </view> |
| 35 | 35 | </view> |
| ... | ... | @@ -51,7 +51,7 @@ |
| 51 | 51 | <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> |
| 52 | 52 | <view class="row"><text class="label">过磅品种</text><text class="value">{{ safeText(item.productName) }}</text></view> |
| 53 | 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 | 55 | </view> |
| 56 | 56 | </view> |
| 57 | 57 | </view> |
| ... | ... | @@ -71,7 +71,7 @@ |
| 71 | 71 | <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> |
| 72 | 72 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 73 | 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 | 75 | </view> |
| 76 | 76 | </view> |
| 77 | 77 | </view> |
| ... | ... | @@ -83,11 +83,12 @@ |
| 83 | 83 | </view> |
| 84 | 84 | <view class="section"> |
| 85 | 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 | 89 | <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view> |
| 90 | 90 | <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> |
| 91 | + <view class="row"><text class="label">来料类型备注</text><text class="value">{{ safeText(form.deductionTypesRemarks) }}</text></view> | |
| 91 | 92 | <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view> |
| 92 | 93 | <view class="row"><text class="label">物流存欠料</text><text class="value">{{ safeText(form.logisticsStockMaterial) }}</text></view> |
| 93 | 94 | <view class="row"><text class="label">车牌号</text><text class="value">{{ safeText(form.plateNumber) }}</text></view> | ... | ... |
| ... | ... | @@ -72,7 +72,7 @@ |
| 72 | 72 | <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> |
| 73 | 73 | </template> |
| 74 | 74 | </uni-list-item> |
| 75 | - <uni-list-item title="计划数量"> | |
| 75 | + <uni-list-item title="计划数量(kg)"> | |
| 76 | 76 | <template v-slot:footer> |
| 77 | 77 | <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> |
| 78 | 78 | </template> |
| ... | ... | @@ -133,9 +133,9 @@ |
| 133 | 133 | <uni-easyinput v-model="item.invoiceProductName" :inputBorder="false" disabled /> |
| 134 | 134 | </template> |
| 135 | 135 | </uni-list-item> |
| 136 | - <uni-list-item title="过磅数量"> | |
| 136 | + <uni-list-item title="过磅数量(kg)"> | |
| 137 | 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 | 139 | </template> |
| 140 | 140 | <template v-slot:footer> |
| 141 | 141 | <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" /> |
| ... | ... | @@ -180,7 +180,7 @@ |
| 180 | 180 | </uni-list-item> |
| 181 | 181 | <uni-list-item title="数量"> |
| 182 | 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 | 184 | </template> |
| 185 | 185 | <template v-slot:footer> |
| 186 | 186 | <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" :disabled="isReweigh" /> |
| ... | ... | @@ -211,7 +211,7 @@ |
| 211 | 211 | </uni-list-item> |
| 212 | 212 | <uni-list-item> |
| 213 | 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 | 215 | </template> |
| 216 | 216 | <template v-slot:footer> |
| 217 | 217 | <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" /> |
| ... | ... | @@ -219,13 +219,13 @@ |
| 219 | 219 | </uni-list-item> |
| 220 | 220 | <uni-list-item> |
| 221 | 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 | 223 | </template> |
| 224 | 224 | <template v-slot:footer> |
| 225 | 225 | <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" /> |
| 226 | 226 | </template> |
| 227 | 227 | </uni-list-item> |
| 228 | - <uni-list-item title="货物净重"> | |
| 228 | + <uni-list-item title="货物净重(kg)"> | |
| 229 | 229 | <template v-slot:footer> |
| 230 | 230 | <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled /> |
| 231 | 231 | </template> |
| ... | ... | @@ -252,7 +252,16 @@ |
| 252 | 252 | <uni-list> |
| 253 | 253 | <uni-list-item> |
| 254 | 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 | 265 | </template> |
| 257 | 266 | <template v-slot:footer> |
| 258 | 267 | <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" /> |
| ... | ... | @@ -260,7 +269,7 @@ |
| 260 | 269 | </uni-list-item> |
| 261 | 270 | <uni-list-item> |
| 262 | 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 | 273 | </template> |
| 265 | 274 | <template v-slot:footer> |
| 266 | 275 | <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" /> |
| ... | ... | @@ -320,7 +329,7 @@ import { |
| 320 | 329 | weighTicketUpdateApi |
| 321 | 330 | } from '@/api/procure-manage/weighTicket.js' |
| 322 | 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 | 334 | export default { |
| 326 | 335 | name: 'ModifyWeightTicket', |
| ... | ... | @@ -338,6 +347,7 @@ export default { |
| 338 | 347 | totalGrossWeight: '', |
| 339 | 348 | actualImpurityWeight: '', |
| 340 | 349 | deductionTypes: [], |
| 350 | + deductionTypesRemarks: '', | |
| 341 | 351 | supplierStockMaterial: '', |
| 342 | 352 | logisticsStockMaterial: '', |
| 343 | 353 | plateNumber: '', |
| ... | ... | @@ -426,6 +436,14 @@ export default { |
| 426 | 436 | if (net === '' || net === null || net === undefined) return '' |
| 427 | 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 | 448 | computedBusinessSummary() { |
| 431 | 449 | const parts = [] |
| ... | ... | @@ -438,10 +456,9 @@ export default { |
| 438 | 456 | }) |
| 439 | 457 | .filter(text => !!text) |
| 440 | 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 | 462 | if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) |
| 446 | 463 | if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) |
| 447 | 464 | if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`) |
| ... | ... | @@ -454,14 +471,23 @@ export default { |
| 454 | 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 | 483 | onLoad(query) { |
| 458 | 484 | this.id = (query && query.id) || '' |
| 459 | 485 | }, |
| 460 | 486 | created() { |
| 461 | 487 | this.planSheet.fetchFn = this.fetchPlans.bind(this) |
| 462 | - this.loadDicData() | |
| 463 | 488 | this.loadVarietyOptions() |
| 464 | - this.loadDetail() | |
| 489 | + // 先加载字典,再回显详情,保证来料类型备注能正确解析 | |
| 490 | + this.loadDicData().finally(() => this.loadDetail()) | |
| 465 | 491 | }, |
| 466 | 492 | methods: { |
| 467 | 493 | async loadDicData() { |
| ... | ... | @@ -482,6 +508,53 @@ export default { |
| 482 | 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 | 558 | loadDetail() { |
| 486 | 559 | if (!this.id) { |
| 487 | 560 | uni.showToast({ title: '缺少单据ID', icon: 'none' }) |
| ... | ... | @@ -505,11 +578,14 @@ export default { |
| 505 | 578 | totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight), |
| 506 | 579 | actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight), |
| 507 | 580 | deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [], |
| 581 | + deductionTypesRemarks: '', | |
| 508 | 582 | supplierStockMaterial: data.supplierStockMaterial || '', |
| 509 | 583 | logisticsStockMaterial: data.logisticsStockMaterial || '', |
| 510 | 584 | plateNumber: data.plateNumber || '', |
| 511 | 585 | specialNote: data.specialNote || '' |
| 512 | 586 | } |
| 587 | + // 回显来料类型备注:优先取独立字段,历史数据从业务摘要解析 | |
| 588 | + this.form.deductionTypesRemarks = this.extractDeductionRemark(data.deductionTypesRemarks || data.businessSummary) | |
| 513 | 589 | // 计划选择回显:行对象缓存供提交 planIds 使用(id 取计划明细行上的计划 id) |
| 514 | 590 | this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it })) |
| 515 | 591 | this.selectedPlanRows = this.planList.map(item => ({ |
| ... | ... | @@ -610,11 +686,16 @@ export default { |
| 610 | 686 | row.productName = '' |
| 611 | 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 | 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 | 700 | getWeightProductLabel(item) { |
| 620 | 701 | if (!item.productId) return '' |
| ... | ... | @@ -624,7 +705,7 @@ export default { |
| 624 | 705 | // 过磅品种改选:整行替换为对应计划明细数据(保留行id与计划编号) |
| 625 | 706 | handleWeightProductChange(idx, optIdx) { |
| 626 | 707 | const row = this.weighList[idx] |
| 627 | - const options = (this.planList || []).filter(it => it.planCode === row.planCode) | |
| 708 | + const options = this.getWeightProductOptions(row) | |
| 628 | 709 | const raw = options[optIdx] |
| 629 | 710 | if (!raw) return |
| 630 | 711 | this.weighList.splice(idx, 1, { |
| ... | ... | @@ -676,8 +757,8 @@ export default { |
| 676 | 757 | if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重') |
| 677 | 758 | if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重') |
| 678 | 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 | 762 | if (!f.plateNumber) return this.tip('请输入车牌号') |
| 682 | 763 | // 过磅明细:计划编号、品种、数量必填 |
| 683 | 764 | const weightList = this.weighList || [] |
| ... | ... | @@ -729,6 +810,7 @@ export default { |
| 729 | 810 | netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), |
| 730 | 811 | netWeightUpper: this.computedNetWeightUpper || null, |
| 731 | 812 | deductionTypes: (this.form.deductionTypes || []).join(',') || null, |
| 813 | + deductionTypesRemarks: this.form.deductionTypesRemarks || null, | |
| 732 | 814 | supplierStockMaterial: this.form.supplierStockMaterial || null, |
| 733 | 815 | logisticsStockMaterial: this.form.logisticsStockMaterial || null, |
| 734 | 816 | plateNumber: this.form.plateNumber || null, |
| ... | ... | @@ -737,12 +819,24 @@ export default { |
| 737 | 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 | 833 | async onSubmit() { |
| 741 | 834 | if (!this.validate()) return |
| 742 | 835 | const confirmRes = await new Promise(resolve => { |
| 743 | 836 | uni.showModal({ title: '提示', content: '确定保存修改吗?', confirmText: '确定', cancelText: '取消', success: resolve }) |
| 744 | 837 | }) |
| 745 | 838 | if (!(confirmRes && confirmRes.confirm)) return |
| 839 | + if (!(await this.confirmQuantityMismatch())) return | |
| 746 | 840 | uni.showLoading({ title: '保存中...', mask: true }) |
| 747 | 841 | weighTicketUpdateApi(this.buildSubmitData()) |
| 748 | 842 | .then(() => { |
| ... | ... | @@ -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 | 1204 | .remark-group { |
| 1105 | 1205 | margin-bottom: 32rpx; |
| 1106 | 1206 | ... | ... |
| ... | ... | @@ -68,7 +68,7 @@ |
| 68 | 68 | <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> |
| 69 | 69 | </template> |
| 70 | 70 | </uni-list-item> |
| 71 | - <uni-list-item title="计划数量"> | |
| 71 | + <uni-list-item title="计划数量(kg)"> | |
| 72 | 72 | <template v-slot:footer> |
| 73 | 73 | <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> |
| 74 | 74 | </template> |
| ... | ... | @@ -105,7 +105,7 @@ |
| 105 | 105 | </uni-list-item> |
| 106 | 106 | <uni-list-item title="过磅数量"> |
| 107 | 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 | 109 | </template> |
| 110 | 110 | <template v-slot:footer> |
| 111 | 111 | <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" /> |
| ... | ... | @@ -131,7 +131,7 @@ |
| 131 | 131 | <uni-easyinput :value="item.category" :inputBorder="false" disabled /> |
| 132 | 132 | </template> |
| 133 | 133 | </uni-list-item> |
| 134 | - <uni-list-item title="数量"> | |
| 134 | + <uni-list-item title="数量(kg)"> | |
| 135 | 135 | <template v-slot:footer> |
| 136 | 136 | <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> |
| 137 | 137 | </template> |
| ... | ... | @@ -156,7 +156,7 @@ |
| 156 | 156 | </uni-list-item> |
| 157 | 157 | <uni-list-item> |
| 158 | 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 | 160 | </template> |
| 161 | 161 | <template v-slot:footer> |
| 162 | 162 | <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" /> |
| ... | ... | @@ -164,13 +164,13 @@ |
| 164 | 164 | </uni-list-item> |
| 165 | 165 | <uni-list-item> |
| 166 | 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 | 168 | </template> |
| 169 | 169 | <template v-slot:footer> |
| 170 | 170 | <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" /> |
| 171 | 171 | </template> |
| 172 | 172 | </uni-list-item> |
| 173 | - <uni-list-item title="货物净重"> | |
| 173 | + <uni-list-item title="货物净重(kg)"> | |
| 174 | 174 | <template v-slot:footer> |
| 175 | 175 | <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled /> |
| 176 | 176 | </template> |
| ... | ... | @@ -197,7 +197,16 @@ |
| 197 | 197 | <uni-list> |
| 198 | 198 | <uni-list-item> |
| 199 | 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 | 210 | </template> |
| 202 | 211 | <template v-slot:footer> |
| 203 | 212 | <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" /> |
| ... | ... | @@ -205,7 +214,7 @@ |
| 205 | 214 | </uni-list-item> |
| 206 | 215 | <uni-list-item> |
| 207 | 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 | 218 | </template> |
| 210 | 219 | <template v-slot:footer> |
| 211 | 220 | <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" /> |
| ... | ... | @@ -272,7 +281,7 @@ |
| 272 | 281 | |
| 273 | 282 | <script> |
| 274 | 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 | 285 | import upload from '@/utils/upload' |
| 277 | 286 | import { uploadFileApi } from '@/api/base.js' |
| 278 | 287 | |
| ... | ... | @@ -292,6 +301,7 @@ export default { |
| 292 | 301 | totalGrossWeight: '', |
| 293 | 302 | actualImpurityWeight: '', |
| 294 | 303 | deductionTypes: [], |
| 304 | + deductionTypesRemarks: '', | |
| 295 | 305 | supplierStockMaterial: '', |
| 296 | 306 | logisticsStockMaterial: '', |
| 297 | 307 | plateNumber: '', |
| ... | ... | @@ -345,6 +355,14 @@ export default { |
| 345 | 355 | if (net === '' || net === null || net === undefined) return '' |
| 346 | 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 | 367 | computedBusinessSummary() { |
| 350 | 368 | const parts = [] |
| ... | ... | @@ -357,10 +375,9 @@ export default { |
| 357 | 375 | }) |
| 358 | 376 | .filter(text => !!text) |
| 359 | 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 | 381 | if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) |
| 365 | 382 | if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) |
| 366 | 383 | if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`) |
| ... | ... | @@ -373,12 +390,21 @@ export default { |
| 373 | 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 | 402 | onLoad(query) { |
| 377 | 403 | this.id = (query && query.id) || '' |
| 378 | 404 | }, |
| 379 | 405 | created() { |
| 380 | - this.loadDicData() | |
| 381 | - this.loadDetail() | |
| 406 | + // 先加载字典,再回显详情,保证来料类型备注能正确解析 | |
| 407 | + this.loadDicData().finally(() => this.loadDetail()) | |
| 382 | 408 | }, |
| 383 | 409 | methods: { |
| 384 | 410 | async loadDicData() { |
| ... | ... | @@ -394,6 +420,53 @@ export default { |
| 394 | 420 | const found = (this.dicOptions.TYPE || []).find(it => String(it.code) === String(this.form.type)) |
| 395 | 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 | 470 | loadDetail() { |
| 398 | 471 | if (!this.id) { |
| 399 | 472 | uni.showToast({ title: '缺少单据ID', icon: 'none' }) |
| ... | ... | @@ -415,11 +488,14 @@ export default { |
| 415 | 488 | totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight), |
| 416 | 489 | actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight), |
| 417 | 490 | deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [], |
| 491 | + deductionTypesRemarks: '', | |
| 418 | 492 | supplierStockMaterial: data.supplierStockMaterial || '', |
| 419 | 493 | logisticsStockMaterial: data.logisticsStockMaterial || '', |
| 420 | 494 | plateNumber: data.plateNumber || '', |
| 421 | 495 | specialNote: data.specialNote || '' |
| 422 | 496 | } |
| 497 | + // 回显来料类型备注:优先取独立字段,历史数据从业务摘要解析 | |
| 498 | + this.form.deductionTypesRemarks = this.extractDeductionRemark(data.deductionTypesRemarks || data.businessSummary) | |
| 423 | 499 | this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it })) |
| 424 | 500 | // 选中计划行对象(buyout 供 isBuyout 判断,id 供 planIds 提交使用) |
| 425 | 501 | this.selectedPlanRows = this.planList.map(item => ({ |
| ... | ... | @@ -519,8 +595,8 @@ export default { |
| 519 | 595 | if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重') |
| 520 | 596 | if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重') |
| 521 | 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 | 600 | if (!f.plateNumber) return this.tip('请输入车牌号') |
| 525 | 601 | // 过磅明细:过磅数量必填 |
| 526 | 602 | const weightList = this.weighList || [] |
| ... | ... | @@ -536,12 +612,24 @@ export default { |
| 536 | 612 | uni.showToast({ title: msg, icon: 'none' }) |
| 537 | 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 | 626 | async onSubmit() { |
| 540 | 627 | if (!this.validate()) return |
| 541 | 628 | const confirmRes = await new Promise(resolve => { |
| 542 | 629 | uni.showModal({ title: '提示', content: '确定保存复磅单吗?', confirmText: '确定', cancelText: '取消', success: resolve }) |
| 543 | 630 | }) |
| 544 | 631 | if (!(confirmRes && confirmRes.confirm)) return |
| 632 | + if (!(await this.confirmQuantityMismatch())) return | |
| 545 | 633 | const ids = this.fileList.map(it => it.id).filter(Boolean) |
| 546 | 634 | const names = this.fileList.map(it => it.name).filter(Boolean) |
| 547 | 635 | const payload = { |
| ... | ... | @@ -570,6 +658,7 @@ export default { |
| 570 | 658 | netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), |
| 571 | 659 | netWeightUpper: this.computedNetWeightUpper || null, |
| 572 | 660 | deductionTypes: (this.form.deductionTypes || []).join(',') || null, |
| 661 | + deductionTypesRemarks: this.form.deductionTypesRemarks || null, | |
| 573 | 662 | supplierStockMaterial: this.form.supplierStockMaterial || null, |
| 574 | 663 | logisticsStockMaterial: this.form.logisticsStockMaterial || null, |
| 575 | 664 | plateNumber: this.form.plateNumber || null, |
| ... | ... | @@ -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 | 1002 | .remark-group { |
| 908 | 1003 | margin-bottom: 32rpx; |
| 909 | 1004 | ... | ... |
| ... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 25 | 25 | <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view> |
| 26 | 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 | 28 | </view> |
| 29 | 29 | </view> |
| 30 | 30 | </view> |
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view> |
| 43 | 43 | <view class="row"><text class="label">过磅品种</text><text class="value">{{ item.productName || '-' }}</text></view> |
| 44 | 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 | 46 | </view> |
| 47 | 47 | </view> |
| 48 | 48 | </view> |
| ... | ... | @@ -58,7 +58,7 @@ |
| 58 | 58 | <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> |
| 59 | 59 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 60 | 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 | 62 | </view> |
| 63 | 63 | </view> |
| 64 | 64 | </view> |
| ... | ... | @@ -70,11 +70,12 @@ |
| 70 | 70 | </view> |
| 71 | 71 | <view class="section"> |
| 72 | 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 | 76 | <view class="row"><text class="label">净重大写</text><text class="value">{{ form.netWeightUpper || '-' }}</text></view> |
| 77 | 77 | <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> |
| 78 | + <view class="row"><text class="label">来料类型备注</text><text class="value">{{ form.deductionTypesRemarks || '-' }}</text></view> | |
| 78 | 79 | <view class="row"><text class="label">供应存欠料</text><text class="value">{{ form.supplierStockMaterial || '-' }}</text></view> |
| 79 | 80 | <view class="row"><text class="label">物流存欠料</text><text class="value">{{ form.logisticsStockMaterial || '-' }}</text></view> |
| 80 | 81 | <view class="row"><text class="label">车牌号</text><text class="value">{{ form.plateNumber || '-' }}</text></view> |
| ... | ... | @@ -168,6 +169,7 @@ export default { |
| 168 | 169 | netWeight: '', |
| 169 | 170 | netWeightUpper: '', |
| 170 | 171 | deductionTypes: '', |
| 172 | + deductionTypesRemarks: '', | |
| 171 | 173 | supplierStockMaterial: '', |
| 172 | 174 | logisticsStockMaterial: '', |
| 173 | 175 | plateNumber: '', |
| ... | ... | @@ -247,6 +249,7 @@ export default { |
| 247 | 249 | netWeight: data.netWeight == null ? '' : String(data.netWeight), |
| 248 | 250 | netWeightUpper: data.netWeightUpper || '', |
| 249 | 251 | deductionTypes: data.deductionTypes || '', |
| 252 | + deductionTypesRemarks: data.deductionTypesRemarks || '', | |
| 250 | 253 | supplierStockMaterial: data.supplierStockMaterial || '', |
| 251 | 254 | logisticsStockMaterial: data.logisticsStockMaterial || '', |
| 252 | 255 | plateNumber: data.plateNumber || '', |
| ... | ... | @@ -260,10 +263,10 @@ export default { |
| 260 | 263 | this.planList = Array.isArray(data.planLines) ? data.planLines.map(x => ({ ...x })) : [] |
| 261 | 264 | this.weighList = Array.isArray(data.weighLines) ? data.weighLines.map(x => ({ ...x })) : [] |
| 262 | 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 | 270 | this.fileList = ids.map((id, i) => ({ id, name: names[i] || '' })) |
| 268 | 271 | }) |
| 269 | 272 | .catch(() => { |
| ... | ... | @@ -273,8 +276,46 @@ export default { |
| 273 | 276 | uni.hideLoading() |
| 274 | 277 | }) |
| 275 | 278 | }, |
| 276 | - // 选择并上传文件(多文件逐个追加) | |
| 279 | + // 选择上传方式:拍照 / 相册 / 文件 | |
| 277 | 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 | 319 | if (typeof uni !== 'undefined' && typeof uni.chooseMessageFile === 'function') { |
| 279 | 320 | uni.chooseMessageFile({ |
| 280 | 321 | count: 9, |
| ... | ... | @@ -287,10 +328,7 @@ export default { |
| 287 | 328 | for (const f of files) { |
| 288 | 329 | const name = f.name || 'file' |
| 289 | 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 | 332 | if (id) this.fileList.push({ id, name }) |
| 295 | 333 | } |
| 296 | 334 | } catch (e) { |
| ... | ... | @@ -331,10 +369,7 @@ export default { |
| 331 | 369 | const fd = new FormData() |
| 332 | 370 | fd.append('file', file, name) |
| 333 | 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 | 373 | if (id) this.fileList.push({ id, name }) |
| 339 | 374 | } |
| 340 | 375 | } catch (e2) { |
| ... | ... | @@ -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 | 443 | </script> |
| 401 | 444 | |
| 402 | 445 | <style lang="scss" scoped> | ... | ... |
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | <view v-for="(item, idx) in planList" :key="'p-' + (item.id || idx)" class="card"> |
| 24 | 24 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 25 | 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 | 27 | <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> |
| 28 | 28 | </view> |
| 29 | 29 | </view> |
| ... | ... | @@ -41,7 +41,7 @@ |
| 41 | 41 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 42 | 42 | <view class="row"><text class="label">过磅品种</text><text class="value">{{ safeText(item.productName) }}</text></view> |
| 43 | 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 | 45 | <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> |
| 46 | 46 | </view> |
| 47 | 47 | </view> |
| ... | ... | @@ -58,7 +58,7 @@ |
| 58 | 58 | <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> |
| 59 | 59 | <view class="card-index">第 {{ idx + 1 }} 行</view> |
| 60 | 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 | 62 | </view> |
| 63 | 63 | </view> |
| 64 | 64 | </view> |
| ... | ... | @@ -70,11 +70,12 @@ |
| 70 | 70 | </view> |
| 71 | 71 | <view class="section"> |
| 72 | 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 | 76 | <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view> |
| 77 | 77 | <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> |
| 78 | + <view class="row"><text class="label">来料类型备注</text><text class="value">{{ safeText(form.deductionTypesRemarks) }}</text></view> | |
| 78 | 79 | <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view> |
| 79 | 80 | <view class="row"><text class="label">物流存欠料</text><text class="value">{{ safeText(form.logisticsStockMaterial) }}</text></view> |
| 80 | 81 | <view class="row"><text class="label">车牌号</text><text class="value">{{ safeText(form.plateNumber) }}</text></view> | ... | ... |