|
@@ -13,9 +13,9 @@
|
|
|
</view>
|
|
|
<view class="carrierList uni-row">
|
|
|
<view class="carrierItem uni-row" v-for="(item,index) in carrierList">
|
|
|
- <view class="uni-row" style="width: 46%;justify-content: flex-start;">{{ item.lotCode }}</view>
|
|
|
- <view class="uni-row" style="width: 27%;justify-content: flex-start;">{{ item.carrierCode }}</view>
|
|
|
- <view class="uni-row" style="width: 27%;word-wrap: break-word;">{{ item.place }}</view>
|
|
|
+ <view style="width: 46%;text-align: left;">{{ item.lotCode }}</view>
|
|
|
+ <view style="width: 27%;text-align: left;">{{ item.carrierCode }}</view>
|
|
|
+ <view style="width: 27%;word-wrap: break-word;text-align: left;">{{ item.place }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</dialog-base>
|
|
@@ -90,7 +90,29 @@
|
|
|
|
|
|
console.log(processList.value)
|
|
|
}
|
|
|
- carrierList.value = response.data;
|
|
|
+ /* 处理结果格式 */
|
|
|
+ // 用于存放处理后的结果
|
|
|
+ const result = {};
|
|
|
+ // 遍历原始数组的每个对象
|
|
|
+ response.data.forEach(item => {
|
|
|
+ const { lotCode, place,carrierCode } = item;
|
|
|
+ // 如果lotCode不存在于结果中,则以该lotCode为键,创建一个新对象
|
|
|
+ if (!result[lotCode]) {
|
|
|
+ result[lotCode] = {
|
|
|
+ lotCode: lotCode,
|
|
|
+ place: place,
|
|
|
+ carrierCode: carrierCode
|
|
|
+ };
|
|
|
+ // 如果lotCode已存在于结果中,则将place进行字符串拼接
|
|
|
+ } else {
|
|
|
+ if (result[lotCode].place !== place){
|
|
|
+ result[lotCode].place += `, ${place}`;
|
|
|
+ }
|
|
|
+ result[lotCode].carrierCode += `, ${carrierCode}`;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ carrierList.value = Object.values(result);
|
|
|
+ console.log(carrierList.value)
|
|
|
baseDialog.value.open();
|
|
|
})
|
|
|
}
|
|
@@ -191,6 +213,8 @@
|
|
|
line-height: 64rpx;
|
|
|
text-align: center;
|
|
|
justify-content: flex-start;
|
|
|
+ align-items: center;
|
|
|
+ border-bottom: 1rpx solid #999999;
|
|
|
}
|
|
|
}
|
|
|
}
|