Commit ba25d719 by 张立顺

fix bug

1 parent cb011310
......@@ -50,7 +50,7 @@ export function getAllGroupByCategory(data) {
return request(data);
}
// 升级品下拉:merchantGoodsInfo.rule.selectList,扁平 list(upgradeGoodsId / goodsShowName / merchantGoodsCode)
// 升级品下拉:merchantGoodsInfo.rule.selectList,扁平 list(upgradeGoodsId / goodsShowName / packageName / merchantGoodsCode)
export function getAllGoodsList(data) {
data.method = `${path}merchantGoodsInfo.rule.selectList`;
return request(data, "post");
......
......@@ -29,7 +29,7 @@
</el-row>
</section>
<section class="detail-card">
<section class="detail-card detail-card--staff">
<h3 class="detail-card__title">施工信息</h3>
<div class="staff-cards">
<div
......@@ -40,7 +40,7 @@
<div class="staff-card__avatar">{{ nameInitial(p.name) }}</div>
<div class="staff-card__meta">
<div class="staff-card__name">{{ p.name }}</div>
<el-tag size="small" type="info" class="staff-card__tag">{{ p.roleLabel }}</el-tag>
<span class="staff-card__tag">{{ p.roleLabel }}</span>
</div>
</div>
</div>
......@@ -71,6 +71,8 @@
<span class="suborder-mcode">物料编码{{ so.materialCode }}</span>
</div>
<div class="suborder-list__right">
<span class="suborder-outbound">出库 {{ so.outboundQty }}</span>
<span class="suborder-divider" />
<span
:class="['suborder-pill', 'suborder-pill--' + (so.statusTone || 'grey')]"
>{{ so.tag1 }}</span>
......@@ -226,6 +228,12 @@ export default {
margin: 0 0 14px 0;
}
.detail-card--staff .detail-card__title {
padding-bottom: 12px;
margin-bottom: 14px;
border-bottom: 1px solid #ebeef5;
}
.detail-row {
margin-bottom: 10px;
font-size: 14px;
......@@ -248,31 +256,54 @@ export default {
.staff-card {
display: flex;
align-items: center;
background: #f0f7ff;
border: 1px solid #d9ecff;
border-radius: 4px;
padding: 8px 12px;
background: #f5f7fa;
border: 1px solid #eceef5;
border-radius: 8px;
padding: 12px;
min-width: 200px;
box-sizing: border-box;
}
.staff-card__avatar {
width: 40px;
height: 40px;
border-radius: 50%;
background: #409eff;
color: #fff;
background: #e1e7f2;
color: #2a58ad;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
font-weight: 500;
margin-right: 10px;
flex-shrink: 0;
}
.staff-card__meta {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 6px;
min-width: 0;
}
.staff-card__name {
font-size: 14px;
color: #303133;
margin-bottom: 4px;
line-height: 1.4;
}
.staff-card__tag {
display: inline-block;
box-sizing: border-box;
padding: 2px 8px;
font-size: 12px;
line-height: 1.5;
color: #2a58ad;
border: 1px solid #2a58ad80;
border-radius: 12px;
background: #fff;
white-space: nowrap;
}
.m-t-16 {
......@@ -343,6 +374,12 @@ export default {
color: #606266;
}
.suborder-outbound {
color: #606266;
font-size: 13px;
white-space: nowrap;
}
.suborder-list__right {
display: flex;
align-items: center;
......
......@@ -66,15 +66,26 @@ function formatTechnicianText(row) {
}
/**
* 单条服务明细的实际出库展示(与列表「实际出库数量(米/件)」列同一规则)
* 实际出库数量展示(列表/详情「米/件」;取自 subOrderList[].materialsUsed)
* @param {*} materialsUsed
* @returns {string}
*/
export function formatMaterialsUsedDisplay(materialsUsed) {
if (materialsUsed == null || materialsUsed === '') return '-'
const num = Number(materialsUsed)
const formatted = Number.isFinite(num) ? num.toFixed(2) : String(materialsUsed).trim()
if (formatted === '') return '-'
return `${formatted}米/件`
}
/**
* 兼容:serviceItemsDetailList 项上的 useNum(新逻辑请以 formatMaterialsUsedDisplay 为准)
* @param {Object} d - serviceItemsDetailList 项
* @returns {string}
*/
export function formatServiceDetailOutboundLine(d) {
if (!d || d.useNum == null || d.useNum === '') return '-'
const num = Number(d.useNum)
const formatted = Number.isFinite(num) ? num.toFixed(2) : String(d.useNum).trim()
return `${formatted}米/件`
if (!d) return '-'
return formatMaterialsUsedDisplay(d.useNum)
}
/** 施工状态 0-待施工(橙) 1-已施工(绿) 2-客户返工(红),与列表 statusDotClass 一致 */
......@@ -94,21 +105,26 @@ export function constructionInnerPillTone(s) {
return 'grey'
}
/** 服务项目行与实际出库行同源、同序(与有名称的服务明细一一对应) */
function serviceItemsAndOutboundLinesForTable(row) {
/** 列表「服务项目」列(来自 serviceItemsDetailList;无则占位一行 `-`) */
function serviceLinesForTable(row) {
const serviceLines = []
const actualOutLines = []
;(row.serviceItemsDetailList || []).forEach((d) => {
if (!d) return
const n = d.serviceItemsName
if (n == null || String(n).trim() === '') return
serviceLines.push({ name: String(n).trim() })
actualOutLines.push(formatServiceDetailOutboundLine(d))
})
if (!serviceLines.length) {
return { serviceLines: [{ name: '-' }], actualOutLines: ['-'] }
return { serviceLines: [{ name: '-' }] }
}
return { serviceLines, actualOutLines }
return { serviceLines }
}
/** 列表「实际出库数量」列:与 subOrderList 一一对应 */
function actualOutLinesFromSubOrders(subList) {
const list = subList || []
if (!list.length) return ['-']
return list.map((s) => formatMaterialsUsedDisplay(s && s.materialsUsed))
}
/**
......@@ -126,7 +142,15 @@ export function mapConstructionListRow(row, index) {
const pictureUrl = constructionPhotoUrls[0] || ''
const cst = toIntOrNull(row.constructionStatus)
const ist = toIntOrNull(row.constructionInnerStatus)
const { serviceLines, actualOutLines } = serviceItemsAndOutboundLinesForTable(row)
let { serviceLines } = serviceLinesForTable(row)
const actualOutLines = actualOutLinesFromSubOrders(subList)
if (serviceLines.length === 1 && serviceLines[0].name === '-' && subList.length) {
serviceLines = subList.map((s) => {
const gn = s && s.upgradeGoodsName
const name = gn != null && String(gn).trim() !== '' ? String(gn).trim() : '-'
return { name }
})
}
return {
...row,
_rowKey: row.id != null ? row.id : (row.constructionCode || `idx-${index}`),
......@@ -203,6 +227,7 @@ export function mapApiRowToDetailForm(row) {
return {
productName: s.upgradeGoodsName || '-',
materialCode: s.materialCode || '-',
outboundQty: formatMaterialsUsedDisplay(s.materialsUsed),
tag1,
tag2,
statusTone: constructionStatusPillTone(statusVal),
......@@ -224,6 +249,7 @@ export function mapApiRowToDetailForm(row) {
{
productName: '-',
materialCode: '-',
outboundQty: '-',
tag1: '-',
tag2: '-',
statusTone: 'grey',
......
......@@ -900,7 +900,8 @@ export default {
feeCategoryType: 1,
applicationSceneType: this.routerInfo.scene,
orderBy: 2,
pageSize: 100000
pageSize: 100000,
baseSceneCodeList: [resolveBaseSceneCodeFromRouter(this.routerInfo)]
}).then((result) => {
result = result.list
// console.log(result, 'result')
......
......@@ -1020,7 +1020,8 @@ export default {
const base = {
feeCategoryType: 2,
applicationSceneType: scene,
pageSize
pageSize,
baseSceneCodeList: [resolveBaseSceneCodeFromRouter(this.routerInfo)]
}
const emptyThree = () => {
this.queryFeeCategoryByTypeFlow = []
......
/**
* merchantGoodsInfo.rule.selectList 返回的扁平 list(可与 merchantGoodsCode 独立的 commodityCode)
* → 分账「具体商品」下拉统一结构
* @param {Array<{upgradeGoodsId?: *, goodsShowName?: *, merchantGoodsCode?: *, commodityCode?: *}>|undefined} list
* @param {Array<{upgradeGoodsId?: *, goodsShowName?: *, packageName?: *, merchantGoodsCode?: *, commodityCode?: *}>|undefined} list
* @returns {Array<{upgradeGoodsId: *, upgradeGoodsName: string, commodityCode: string, merchantGoodsCode: string}>}
*/
export function mapProductSearchListToUpgradeGoodsOptions(list) {
return (list || [])
.map((row) => {
const upgradeGoodsId = row && row.upgradeGoodsId
const upgradeGoodsName =
const goodsName =
row && row.goodsShowName != null ? String(row.goodsShowName) : ""
let pkg = ""
if (row && row.packageName != null) {
const t = String(row.packageName).trim()
if (t !== "" && t !== "null" && t !== "undefined") pkg = t
}
const upgradeGoodsName = pkg ? `${pkg}-${goodsName}` : goodsName
const rawCode = row && row.merchantGoodsCode
const merchantGoodsCode =
rawCode != null && String(rawCode).trim() !== ""
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!