refactor(wms): 优化钢卷操作界面组件和交互逻辑
替换通用选择器为专用组件,优化按钮加载状态 统一操作后的页面返回延迟时间
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<span>钢卷合卷</span>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<el-button v-if="!readonly" type="primary" size="small" @click="handleSave" :loading="loading">保存合卷</el-button>
|
||||
<el-button v-if="!readonly" type="primary" size="small" @click="handleSave" :disabled="buttonLoading" v-loading="buttonLoading">保存合卷</el-button>
|
||||
<el-button size="small" @click="handleCancel" :disabled="loading">{{ readonly ? '返回' : '取消' }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,8 +74,8 @@
|
||||
@click="selectPendingCoil(pending, index)">
|
||||
<div class="pending-coil-no">{{ pending.currentCoilNo }}</div>
|
||||
<div class="pending-coil-info">
|
||||
<span class="pending-label">扫码时间:</span>
|
||||
<span class="pending-value">{{ formatTime(pending.scanTime) }}</span>
|
||||
<span class="pending-label">更新时间:</span>
|
||||
<span class="pending-value">{{ formatTime(pending.updateTime) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -163,11 +163,11 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="getItemLabel">
|
||||
<el-select v-model="targetCoil.itemId" :placeholder="getItemPlaceholder" filterable remote
|
||||
:remote-method="searchItems" :loading="itemSearchLoading" style="width: 100%"
|
||||
:disabled="readonly || !targetCoil.materialType">
|
||||
<el-option v-for="item in currentItemList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
<raw-material-selector v-if="targetCoil.materialType === '原料' || targetCoil.materialType === '废品'" v-model="targetCoil.itemId" placeholder="请选择原料" style="width: 100%"
|
||||
clearable :disabled="readonly || !targetCoil.materialType" />
|
||||
<product-selector v-else-if="targetCoil.materialType === '成品'" v-model="targetCoil.itemId" placeholder="请选择成品" style="width: 100%"
|
||||
clearable :disabled="readonly || !targetCoil.materialType" />
|
||||
<div v-else>请先选择物料类型</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="毛重(t)">
|
||||
@@ -225,12 +225,17 @@ import { listProductWithBom } from '@/api/wms/product';
|
||||
import { listPendingAction, completeAction } from '@/api/wms/pendingAction';
|
||||
import CoilSelector from '@/components/CoilSelector';
|
||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||
import RawMaterialSelector from "@/components/KLPService/RawMaterialSelect";
|
||||
import ProductSelector from "@/components/KLPService/ProductSelect";
|
||||
|
||||
|
||||
export default {
|
||||
name: 'MergeCoil',
|
||||
components: {
|
||||
CoilSelector,
|
||||
ActualWarehouseSelect
|
||||
ActualWarehouseSelect,
|
||||
RawMaterialSelector,
|
||||
ProductSelector
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -252,6 +257,7 @@ export default {
|
||||
packingStatus: '',
|
||||
trimmingRequirement: ''
|
||||
},
|
||||
buttonLoading: false,
|
||||
loading: false,
|
||||
// 钢卷选择器可见性
|
||||
coilSelectorVisible: false,
|
||||
@@ -370,23 +376,6 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 处理材料类型变化
|
||||
handleMaterialTypeChange(value) {
|
||||
// 清空物品选择
|
||||
this.$set(this.targetCoil, 'itemId', null);
|
||||
|
||||
// 根据材料类型设置物品类型
|
||||
if (value === '成品') {
|
||||
this.$set(this.targetCoil, 'itemType', 'product');
|
||||
// 清空列表,等待用户搜索
|
||||
this.productList = [];
|
||||
} else if (value === '原料' || value === '废品') {
|
||||
this.$set(this.targetCoil, 'itemType', 'raw_material');
|
||||
// 清空列表,等待用户搜索
|
||||
this.rawMaterialList = [];
|
||||
}
|
||||
},
|
||||
|
||||
// 加载第一个钢卷(从待操作进入时)
|
||||
async loadFirstCoil(coilId) {
|
||||
try {
|
||||
@@ -409,7 +398,6 @@ export default {
|
||||
productName: data.productName || (data.product ? data.product.productName : ''),
|
||||
specification: data.rawMaterial?.specification || data.product?.specification || '',
|
||||
bomItems: data.bomItemList || [],
|
||||
|
||||
},
|
||||
{
|
||||
coilId: null,
|
||||
@@ -450,13 +438,13 @@ export default {
|
||||
// 分别查询待处理和处理中的记录
|
||||
const responses = await Promise.all([
|
||||
listPendingAction({
|
||||
actionType: 1, // 合卷操作
|
||||
actionType: 200, // 合卷操作
|
||||
actionStatus: 0, // 待处理
|
||||
pageNum: 1,
|
||||
pageSize: 1000
|
||||
}),
|
||||
listPendingAction({
|
||||
actionType: 1, // 合卷操作
|
||||
actionType: 200, // 合卷操作
|
||||
actionStatus: 1, // 处理中
|
||||
pageNum: 1,
|
||||
pageSize: 1000
|
||||
@@ -753,7 +741,7 @@ export default {
|
||||
// 延迟返回,让用户看到成功提示
|
||||
setTimeout(() => {
|
||||
this.$router.back();
|
||||
}, 1000);
|
||||
}, 100);
|
||||
} else {
|
||||
this.$message.error(response.msg || '合卷保存失败');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user