1075 lines
29 KiB
Vue
1075 lines
29 KiB
Vue
<template>
|
||
<div class="merge-coil-container">
|
||
<!-- 顶部操作栏 -->
|
||
<div class="header-bar">
|
||
<div class="header-title">
|
||
<i class="el-icon-connection"></i>
|
||
<span>钢卷合卷</span>
|
||
</div>
|
||
<div class="header-actions">
|
||
<el-button v-if="!readonly" type="primary" size="small" @click="handleSave" :loading="loading">保存合卷</el-button>
|
||
<el-button size="small" @click="handleCancel" :disabled="loading">{{ readonly ? '返回' : '取消' }}</el-button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 流程图区域 -->
|
||
<div class="flow-container">
|
||
<!-- 左侧:源卷列表 -->
|
||
<div class="flow-left">
|
||
<div class="flow-section-title">
|
||
<span>源卷列表</span>
|
||
<!-- <el-button v-if="!readonly" type="text" size="mini" @click="addSourceCoil" icon="el-icon-plus">添加钢卷</el-button> -->
|
||
</div>
|
||
|
||
<div class="source-list">
|
||
<div class="source-coil-card" v-for="(item, index) in sourceCoils" :key="index">
|
||
<div class="source-coil-header">
|
||
<div class="source-number">{{ index + 1 }}</div>
|
||
<div class="source-info">
|
||
<div class="source-id">{{ item.currentCoilNo || '待选择' }}</div>
|
||
</div>
|
||
<el-button
|
||
v-if="!readonly"
|
||
type="text"
|
||
size="mini"
|
||
icon="el-icon-delete"
|
||
@click="removeSourceCoil(index)"
|
||
class="btn-remove"
|
||
></el-button>
|
||
</div>
|
||
<div class="source-coil-body">
|
||
<template v-if="item.coilId">
|
||
<div class="source-detail-row">
|
||
<span class="detail-label">入场钢卷号:</span>
|
||
<span class="detail-value">{{ item.enterCoilNo || '—' }}</span>
|
||
</div>
|
||
<div class="source-detail-row">
|
||
<span class="detail-label">当前库区:</span>
|
||
<span class="detail-value">{{ item.warehouseName || '未分配' }}</span>
|
||
</div>
|
||
<div class="source-detail-row" v-if="item.materialName || item.productName">
|
||
<span class="detail-label">物料名称:</span>
|
||
<span class="detail-value">{{ item.materialName || item.productName || '—' }}</span>
|
||
</div>
|
||
</template>
|
||
|
||
<!-- 第二个位置:显示待合卷列表 -->
|
||
<template v-else-if="index === 1 && !readonly">
|
||
<div class="pending-list-title">待合卷钢卷列表</div>
|
||
<div class="pending-coil-list" v-if="pendingMergeList.length > 0">
|
||
<div
|
||
class="pending-coil-item"
|
||
v-for="pending in pendingMergeList"
|
||
:key="pending.actionId"
|
||
@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>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div v-else class="empty-tip">
|
||
<i class="el-icon-info"></i>
|
||
暂无其他待合卷钢卷
|
||
</div>
|
||
</template>
|
||
|
||
<!-- 其他位置:显示选择按钮 -->
|
||
<el-button v-else-if="!readonly" type="text" size="small" @click="selectCoil(index)">
|
||
<i class="el-icon-search"></i> 选择钢卷
|
||
</el-button>
|
||
<div v-else class="empty-tip">未选择钢卷</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 中间:流程箭头(汇聚) -->
|
||
<div class="flow-middle">
|
||
<div class="merge-arrow-container">
|
||
<svg width="120" height="100%" viewBox="0 0 120 400" xmlns="http://www.w3.org/2000/svg">
|
||
<!-- 多条线汇聚到一点 -->
|
||
<line
|
||
v-for="(item, index) in sourceCoils"
|
||
:key="index"
|
||
:x1="0"
|
||
:y1="50 + index * 80"
|
||
:x2="100"
|
||
:y2="200"
|
||
stroke="#0066cc"
|
||
stroke-width="2"
|
||
stroke-dasharray="5,5"
|
||
/>
|
||
<!-- 箭头 -->
|
||
<polygon points="100,200 110,195 110,205" fill="#0066cc"/>
|
||
</svg>
|
||
</div>
|
||
<div class="flow-label">
|
||
<i class="el-icon-d-arrow-right"></i>
|
||
<span>合并</span>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 右侧:目标卷信息 -->
|
||
<div class="flow-right">
|
||
<div class="flow-section-title">目标卷信息</div>
|
||
<div class="target-coil-card">
|
||
<div class="target-coil-header">
|
||
<i class="el-icon-s-grid"></i>
|
||
<span>新钢卷</span>
|
||
</div>
|
||
<div class="target-coil-body">
|
||
<el-form size="small" label-width="90px">
|
||
<el-form-item label="卷号">
|
||
<el-input v-model="targetCoil.currentCoilNo" placeholder="输入目标卷号" :disabled="readonly"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="班组">
|
||
<el-input v-model="targetCoil.team" placeholder="请输入班组名称" :disabled="readonly"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="物品类型">
|
||
<el-select v-model="targetCoil.itemType" placeholder="请选择" style="width: 100%" :disabled="readonly">
|
||
<el-option label="原材料" value="raw_material" />
|
||
<el-option label="产品" value="product" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="物品">
|
||
<el-select
|
||
v-model="targetCoil.itemId"
|
||
placeholder="请选择物品"
|
||
filterable
|
||
remote
|
||
:remote-method="searchItems"
|
||
:loading="itemSearchLoading"
|
||
style="width: 100%"
|
||
clearable
|
||
:disabled="readonly"
|
||
>
|
||
<el-option
|
||
v-for="item in currentItemList"
|
||
:key="item.id"
|
||
:label="item.name"
|
||
:value="item.id"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="毛重(t)">
|
||
<el-input
|
||
v-model.number="targetCoil.grossWeight"
|
||
placeholder="请输入毛重"
|
||
type="number"
|
||
step="0.01"
|
||
:disabled="readonly"
|
||
>
|
||
<template slot="append">吨</template>
|
||
</el-input>
|
||
</el-form-item>
|
||
<el-form-item label="净重(t)">
|
||
<el-input
|
||
v-model.number="targetCoil.netWeight"
|
||
placeholder="请输入净重"
|
||
type="number"
|
||
step="0.01"
|
||
:disabled="readonly"
|
||
>
|
||
<template slot="append">吨</template>
|
||
</el-input>
|
||
</el-form-item>
|
||
<el-form-item label="目标库位">
|
||
<el-select v-model="targetCoil.warehouseId" placeholder="请选择" style="width: 100%" clearable :disabled="readonly">
|
||
<el-option
|
||
v-for="warehouse in warehouseList"
|
||
:key="warehouse.warehouseId"
|
||
:label="warehouse.warehouseName"
|
||
:value="warehouse.warehouseId"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="真实库区">
|
||
<actual-warehouse-select
|
||
v-model="targetCoil.actualWarehouseId"
|
||
placeholder="请选择"
|
||
style="width: 100%"
|
||
clearable
|
||
:disabled="readonly"
|
||
/>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 合卷规则说明 -->
|
||
<div class="rule-card">
|
||
<div class="rule-title">
|
||
<i class="el-icon-warning-outline"></i>
|
||
合卷规则
|
||
</div>
|
||
<ul class="rule-list">
|
||
<li>至少需要2个源卷</li>
|
||
<li>所有源卷的物品类型和物品ID应保持一致</li>
|
||
<li>请确保录入正确的新钢卷号和班组信息</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 钢卷选择器 -->
|
||
<coil-selector
|
||
:visible.sync="coilSelectorVisible"
|
||
@select="handleCoilSelect"
|
||
/>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { getMaterialCoil, mergeMaterialCoil } from '@/api/wms/coil';
|
||
import { listWarehouse } from '@/api/wms/warehouse';
|
||
import { listRawMaterial } from '@/api/wms/rawMaterial';
|
||
import { listProduct } from '@/api/wms/product';
|
||
import { listPendingAction, completeAction } from '@/api/wms/pendingAction';
|
||
import CoilSelector from '@/components/CoilSelector';
|
||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||
|
||
export default {
|
||
name: 'MergeCoil',
|
||
components: {
|
||
CoilSelector,
|
||
ActualWarehouseSelect
|
||
},
|
||
data() {
|
||
return {
|
||
// 源卷列表
|
||
sourceCoils: [],
|
||
// 目标卷信息
|
||
targetCoil: {
|
||
currentCoilNo: '',
|
||
team: '',
|
||
itemType: null,
|
||
itemId: null,
|
||
grossWeight: null,
|
||
netWeight: null,
|
||
warehouseId: null,
|
||
actualWarehouseId: null
|
||
},
|
||
loading: false,
|
||
// 钢卷选择器可见性
|
||
coilSelectorVisible: false,
|
||
// 当前选择的源卷索引
|
||
currentSelectIndex: -1,
|
||
// 库区列表
|
||
warehouseList: [],
|
||
// 原材料和产品列表
|
||
rawMaterialList: [],
|
||
productList: [],
|
||
itemSearchLoading: false,
|
||
// 只读模式
|
||
readonly: false,
|
||
// 待合卷列表(其他待操作的合卷任务)
|
||
pendingMergeList: [],
|
||
pendingLoading: false
|
||
};
|
||
},
|
||
computed: {
|
||
// 当前物品列表(根据物品类型动态切换)
|
||
currentItemList() {
|
||
if (this.targetCoil.itemType === 'raw_material') {
|
||
return this.rawMaterialList.map(item => ({
|
||
id: item.rawMaterialId,
|
||
name: item.rawMaterialName
|
||
}));
|
||
} else if (this.targetCoil.itemType === 'product') {
|
||
return this.productList.map(item => ({
|
||
id: item.productId,
|
||
name: item.productName
|
||
}));
|
||
}
|
||
return [];
|
||
}
|
||
},
|
||
watch: {
|
||
// 监听物品类型变化,加载对应的列表
|
||
'targetCoil.itemType'(newVal, oldVal) {
|
||
if (newVal !== oldVal) {
|
||
this.targetCoil.itemId = null; // 清空物品ID
|
||
this.loadItemList(newVal);
|
||
}
|
||
}
|
||
},
|
||
async created() {
|
||
// 加载库区列表
|
||
await this.loadWarehouses();
|
||
|
||
// 从路由参数获取coilId、actionId和readonly
|
||
const coilId = this.$route.query.coilId;
|
||
const actionId = this.$route.query.actionId;
|
||
const readonly = this.$route.query.readonly;
|
||
|
||
// 保存当前页面的待操作ID
|
||
if (actionId) {
|
||
this.actionId = actionId;
|
||
}
|
||
|
||
// 设置只读模式
|
||
if (readonly === 'true' || readonly === true) {
|
||
this.readonly = true;
|
||
}
|
||
|
||
// 如果有coilId,加载该钢卷作为第一个源卷
|
||
if (coilId) {
|
||
await this.loadFirstCoil(coilId);
|
||
// 加载其他待合卷的钢卷列表
|
||
await this.loadPendingMergeList();
|
||
} else {
|
||
// 没有coilId,初始化空的源卷
|
||
this.sourceCoils = [
|
||
{
|
||
coilId: null,
|
||
enterCoilNo: '',
|
||
currentCoilNo: '',
|
||
itemType: null,
|
||
itemId: null,
|
||
warehouseName: '',
|
||
materialName: '',
|
||
productName: ''
|
||
},
|
||
{
|
||
coilId: null,
|
||
enterCoilNo: '',
|
||
currentCoilNo: '',
|
||
itemType: null,
|
||
itemId: null,
|
||
warehouseName: '',
|
||
materialName: '',
|
||
productName: ''
|
||
}
|
||
];
|
||
}
|
||
},
|
||
methods: {
|
||
// 加载第一个钢卷(从待操作进入时)
|
||
async loadFirstCoil(coilId) {
|
||
try {
|
||
this.loading = true;
|
||
const response = await getMaterialCoil(coilId);
|
||
if (response.code === 200 && response.data) {
|
||
const data = response.data;
|
||
|
||
// 初始化源卷列表,第一个是当前钢卷
|
||
this.sourceCoils = [
|
||
{
|
||
coilId: data.coilId,
|
||
enterCoilNo: data.enterCoilNo || '',
|
||
currentCoilNo: data.currentCoilNo || '',
|
||
itemType: data.itemType,
|
||
itemId: data.itemId,
|
||
warehouseName: data.warehouseName || (data.warehouse ? data.warehouse.warehouseName : ''),
|
||
materialName: data.materialName || (data.rawMaterial ? data.rawMaterial.rawMaterialName : ''),
|
||
productName: data.productName || (data.product ? data.product.productName : '')
|
||
},
|
||
{
|
||
coilId: null,
|
||
enterCoilNo: '',
|
||
currentCoilNo: '',
|
||
itemType: null,
|
||
itemId: null,
|
||
warehouseName: '',
|
||
materialName: '',
|
||
productName: ''
|
||
}
|
||
];
|
||
|
||
// 自动填充目标卷信息
|
||
this.targetCoil.itemType = data.itemType;
|
||
this.targetCoil.itemId = data.itemId;
|
||
this.targetCoil.warehouseId = data.warehouseId;
|
||
this.targetCoil.actualWarehouseId = data.actualWarehouseId;
|
||
|
||
// 加载对应的物品列表
|
||
if (data.itemType) {
|
||
await this.loadItemList(data.itemType);
|
||
}
|
||
}
|
||
} catch (error) {
|
||
this.$message.error('加载钢卷信息失败');
|
||
console.error(error);
|
||
} finally {
|
||
this.loading = false;
|
||
}
|
||
},
|
||
|
||
// 加载待合卷列表
|
||
async loadPendingMergeList() {
|
||
try {
|
||
this.pendingLoading = true;
|
||
const response = await listPendingAction({
|
||
actionType: 1, // 1=合卷
|
||
actionStatus: 0, // 0=待处理
|
||
pageNum: 1,
|
||
pageSize: 50
|
||
});
|
||
|
||
if (response.code === 200) {
|
||
// 排除当前钢卷
|
||
const currentCoilId = this.sourceCoils[0].coilId;
|
||
this.pendingMergeList = (response.rows || []).filter(item => item.coilId !== currentCoilId);
|
||
}
|
||
} catch (error) {
|
||
console.error('加载待合卷列表失败', error);
|
||
} finally {
|
||
this.pendingLoading = false;
|
||
}
|
||
},
|
||
|
||
// 选择待操作中的钢卷
|
||
async selectPendingCoil(pending, index) {
|
||
try {
|
||
this.loading = true;
|
||
const response = await getMaterialCoil(pending.coilId);
|
||
if (response.code === 200 && response.data) {
|
||
const data = response.data;
|
||
this.$set(this.sourceCoils, index, {
|
||
coilId: data.coilId,
|
||
enterCoilNo: data.enterCoilNo || '',
|
||
currentCoilNo: data.currentCoilNo || '',
|
||
itemType: data.itemType,
|
||
itemId: data.itemId,
|
||
warehouseName: data.warehouseName || (data.warehouse ? data.warehouse.warehouseName : ''),
|
||
materialName: data.materialName || (data.rawMaterial ? data.rawMaterial.rawMaterialName : ''),
|
||
productName: data.productName || (data.product ? data.product.productName : ''),
|
||
actionId: pending.actionId // 保存待操作ID,用于后续完成操作
|
||
});
|
||
|
||
this.$message.success('已添加到合卷列表');
|
||
}
|
||
} catch (error) {
|
||
this.$message.error('加载钢卷信息失败');
|
||
console.error(error);
|
||
} finally {
|
||
this.loading = false;
|
||
}
|
||
},
|
||
|
||
// 格式化时间
|
||
formatTime(time) {
|
||
if (!time) return '';
|
||
const date = new Date(time);
|
||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||
const day = String(date.getDate()).padStart(2, '0');
|
||
const hour = String(date.getHours()).padStart(2, '0');
|
||
const minute = String(date.getMinutes()).padStart(2, '0');
|
||
return `${month}-${day} ${hour}:${minute}`;
|
||
},
|
||
|
||
// 加载库区列表
|
||
async loadWarehouses() {
|
||
try {
|
||
const response = await listWarehouse({ pageNum: 1, pageSize: 1000 });
|
||
if (response.code === 200) {
|
||
this.warehouseList = response.rows || response.data || [];
|
||
}
|
||
} catch (error) {
|
||
console.error('加载库区列表失败', error);
|
||
}
|
||
},
|
||
|
||
// 加载物品列表(根据类型)
|
||
async loadItemList(itemType) {
|
||
if (!itemType) return;
|
||
|
||
try {
|
||
this.itemSearchLoading = true;
|
||
if (itemType === 'raw_material') {
|
||
const response = await listRawMaterial({ pageNum: 1, pageSize: 100 });
|
||
if (response.code === 200) {
|
||
this.rawMaterialList = response.rows || [];
|
||
}
|
||
} else if (itemType === 'product') {
|
||
const response = await listProduct({ pageNum: 1, pageSize: 100 });
|
||
if (response.code === 200) {
|
||
this.productList = response.rows || [];
|
||
}
|
||
}
|
||
} catch (error) {
|
||
console.error('加载物品列表失败', error);
|
||
} finally {
|
||
this.itemSearchLoading = false;
|
||
}
|
||
},
|
||
|
||
// 搜索物品
|
||
async searchItems(query) {
|
||
if (!this.targetCoil.itemType) {
|
||
this.$message.warning('请先选择物品类型');
|
||
return;
|
||
}
|
||
|
||
try {
|
||
this.itemSearchLoading = true;
|
||
if (this.targetCoil.itemType === 'raw_material') {
|
||
const response = await listRawMaterial({
|
||
rawMaterialName: query,
|
||
pageNum: 1,
|
||
pageSize: 50
|
||
});
|
||
if (response.code === 200) {
|
||
this.rawMaterialList = response.rows || [];
|
||
}
|
||
} else if (this.targetCoil.itemType === 'product') {
|
||
const response = await listProduct({
|
||
productName: query,
|
||
pageNum: 1,
|
||
pageSize: 50
|
||
});
|
||
if (response.code === 200) {
|
||
this.productList = response.rows || [];
|
||
}
|
||
}
|
||
} catch (error) {
|
||
console.error('搜索物品失败', error);
|
||
} finally {
|
||
this.itemSearchLoading = false;
|
||
}
|
||
},
|
||
|
||
// 添加源卷
|
||
addSourceCoil() {
|
||
this.sourceCoils.push({
|
||
coilId: null,
|
||
enterCoilNo: '',
|
||
currentCoilNo: '',
|
||
itemType: null,
|
||
itemId: null,
|
||
warehouseName: '',
|
||
materialName: '',
|
||
productName: ''
|
||
});
|
||
},
|
||
|
||
// 删除源卷
|
||
removeSourceCoil(index) {
|
||
if (this.sourceCoils.length > 2) {
|
||
this.sourceCoils.splice(index, 1);
|
||
} else {
|
||
this.$message.warning('至少需要2个源卷才能合卷');
|
||
}
|
||
},
|
||
|
||
// 选择钢卷
|
||
selectCoil(index) {
|
||
this.currentSelectIndex = index;
|
||
this.coilSelectorVisible = true;
|
||
},
|
||
|
||
// 钢卷选择回调
|
||
handleCoilSelect(coil) {
|
||
const index = this.currentSelectIndex;
|
||
this.$set(this.sourceCoils, index, {
|
||
coilId: coil.coilId,
|
||
enterCoilNo: coil.enterCoilNo || '',
|
||
currentCoilNo: coil.currentCoilNo || '',
|
||
itemType: coil.itemType,
|
||
itemId: coil.itemId,
|
||
warehouseName: coil.warehouseName || '',
|
||
materialName: coil.materialName || '',
|
||
productName: coil.productName || ''
|
||
});
|
||
|
||
// 如果是第一个源卷,自动填充目标卷信息
|
||
if (index === 0) {
|
||
this.targetCoil.itemType = coil.itemType;
|
||
this.targetCoil.itemId = coil.itemId;
|
||
this.targetCoil.warehouseId = coil.warehouseId;
|
||
this.targetCoil.actualWarehouseId = coil.actualWarehouseId;
|
||
}
|
||
|
||
this.$message.success('钢卷选择成功');
|
||
},
|
||
|
||
// 保存合卷
|
||
async handleSave() {
|
||
// 验证源卷数量
|
||
if (this.sourceCoils.length < 2) {
|
||
this.$message.error('至少需要2个源卷才能合卷');
|
||
return;
|
||
}
|
||
|
||
// 验证源卷信息
|
||
for (let i = 0; i < this.sourceCoils.length; i++) {
|
||
const item = this.sourceCoils[i];
|
||
if (!item.coilId) {
|
||
this.$message.error(`第${i + 1}个源卷未选择`);
|
||
return;
|
||
}
|
||
}
|
||
|
||
// 验证目标卷卷号
|
||
if (!this.targetCoil.currentCoilNo || this.targetCoil.currentCoilNo.trim() === '') {
|
||
this.$message.error('请输入目标卷卷号');
|
||
return;
|
||
}
|
||
|
||
// 验证班组
|
||
if (!this.targetCoil.team || this.targetCoil.team.trim() === '') {
|
||
this.$message.error('请输入班组名称');
|
||
return;
|
||
}
|
||
|
||
try {
|
||
this.loading = true;
|
||
|
||
// 构造合卷数据
|
||
// 入场钢卷号:所有源卷的入场钢卷号拼接(逗号分隔)
|
||
const enterCoilNos = this.sourceCoils
|
||
.map(item => item.enterCoilNo)
|
||
.filter(no => no) // 过滤空值
|
||
.join(',');
|
||
|
||
const mergeData = {
|
||
enterCoilNo: enterCoilNos, // 拼接的入场钢卷号
|
||
currentCoilNo: this.targetCoil.currentCoilNo,
|
||
team: this.targetCoil.team,
|
||
itemType: this.targetCoil.itemType,
|
||
itemId: this.targetCoil.itemId,
|
||
grossWeight: this.targetCoil.grossWeight,
|
||
netWeight: this.targetCoil.netWeight,
|
||
warehouseId: this.targetCoil.warehouseId,
|
||
actualWarehouseId: this.targetCoil.actualWarehouseId,
|
||
hasMergeSplit: 2, // 2表示合卷
|
||
newCoils: this.sourceCoils.map(item => ({
|
||
coilId: item.coilId,
|
||
enterCoilNo: item.enterCoilNo,
|
||
currentCoilNo: item.currentCoilNo
|
||
}))
|
||
};
|
||
|
||
console.log('提交的合卷数据:', mergeData);
|
||
const loadingInstance = this.$loading({
|
||
lock: true,
|
||
text: '正在合卷,请稍后...',
|
||
background: 'rgba(0, 0, 0, 0.7)'
|
||
})
|
||
const response = await mergeMaterialCoil(mergeData);
|
||
if (response.code === 200) {
|
||
this.$message.success('合卷保存成功');
|
||
|
||
// 完成所有相关的待操作记录
|
||
await this.completeAllRelatedActions();
|
||
|
||
// 延迟返回,让用户看到成功提示
|
||
setTimeout(() => {
|
||
this.$router.back();
|
||
}, 1000);
|
||
} else {
|
||
this.$message.error(response.msg || '合卷保存失败');
|
||
}
|
||
} catch (error) {
|
||
this.$message.error('合卷保存失败');
|
||
console.error(error);
|
||
} finally {
|
||
this.loading = false;
|
||
loadingInstance.close();
|
||
}
|
||
},
|
||
|
||
// 完成所有相关的待操作记录
|
||
async completeAllRelatedActions() {
|
||
try {
|
||
// 收集所有待操作ID
|
||
const actionIds = [];
|
||
|
||
// 当前页面的actionId(从路由参数获取)
|
||
if (this.actionId) {
|
||
actionIds.push(this.actionId);
|
||
}
|
||
|
||
// 从待合卷列表中选择的钢卷的actionId
|
||
this.sourceCoils.forEach(item => {
|
||
if (item.actionId) {
|
||
actionIds.push(item.actionId);
|
||
}
|
||
});
|
||
|
||
// 批量完成所有待操作
|
||
console.log('需要完成的待操作ID列表:', actionIds);
|
||
|
||
const promises = actionIds.map(id => completeAction(id));
|
||
await Promise.all(promises);
|
||
|
||
console.log('所有待操作已完成');
|
||
} catch (error) {
|
||
console.error('完成待操作失败:', error);
|
||
// 不影响主流程,只记录错误
|
||
}
|
||
},
|
||
|
||
// 取消操作
|
||
handleCancel() {
|
||
this.$router.back();
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.merge-coil-container {
|
||
padding: 20px;
|
||
background: #f5f7fa;
|
||
min-height: calc(100vh - 84px);
|
||
}
|
||
|
||
/* 顶部操作栏 */
|
||
.header-bar {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
background: #fff;
|
||
padding: 16px 20px;
|
||
margin-bottom: 20px;
|
||
border-radius: 4px;
|
||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||
}
|
||
|
||
.header-title {
|
||
font-size: 18px;
|
||
font-weight: 500;
|
||
color: #303133;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
|
||
i {
|
||
color: #0066cc;
|
||
font-size: 20px;
|
||
}
|
||
}
|
||
|
||
/* 流程图容器 */
|
||
.flow-container {
|
||
display: flex;
|
||
gap: 40px;
|
||
background: #fff;
|
||
padding: 30px;
|
||
border-radius: 4px;
|
||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||
min-height: 600px;
|
||
}
|
||
|
||
.flow-left {
|
||
flex: 1;
|
||
max-width: 350px;
|
||
}
|
||
|
||
.flow-middle {
|
||
flex: 0 0 120px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
position: relative;
|
||
}
|
||
|
||
.flow-right {
|
||
flex: 1;
|
||
max-width: 400px;
|
||
}
|
||
|
||
.flow-section-title {
|
||
font-size: 16px;
|
||
font-weight: 500;
|
||
color: #303133;
|
||
margin-bottom: 16px;
|
||
padding-left: 12px;
|
||
border-left: 4px solid #0066cc;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
|
||
/* 源卷列表 */
|
||
.source-list {
|
||
max-height: 500px;
|
||
overflow-y: auto;
|
||
padding-right: 10px;
|
||
margin-bottom: 20px;
|
||
|
||
&::-webkit-scrollbar {
|
||
width: 6px;
|
||
}
|
||
|
||
&::-webkit-scrollbar-thumb {
|
||
background: #dcdfe6;
|
||
border-radius: 3px;
|
||
}
|
||
}
|
||
|
||
.source-coil-card {
|
||
background: #fff;
|
||
border: 1px solid #e4e7ed;
|
||
border-radius: 8px;
|
||
margin-bottom: 12px;
|
||
transition: all 0.3s;
|
||
|
||
&:hover {
|
||
border-color: #0066cc;
|
||
box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
|
||
}
|
||
}
|
||
|
||
.source-coil-header {
|
||
padding: 12px 16px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
border-bottom: 1px solid #f5f7fa;
|
||
}
|
||
|
||
.source-number {
|
||
width: 28px;
|
||
height: 28px;
|
||
border-radius: 50%;
|
||
background: #0066cc;
|
||
color: #fff;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.source-info {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.source-id {
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
color: #303133;
|
||
margin-bottom: 4px;
|
||
}
|
||
|
||
.source-weight {
|
||
font-size: 13px;
|
||
color: #909399;
|
||
}
|
||
|
||
.source-coil-body {
|
||
padding: 12px 16px;
|
||
|
||
&:empty {
|
||
text-align: center;
|
||
}
|
||
|
||
.empty-tip {
|
||
text-align: center;
|
||
color: #909399;
|
||
font-size: 13px;
|
||
padding: 10px 0;
|
||
|
||
i {
|
||
display: block;
|
||
font-size: 24px;
|
||
margin-bottom: 5px;
|
||
}
|
||
}
|
||
}
|
||
|
||
/* 待合卷列表 */
|
||
.pending-list-title {
|
||
font-size: 13px;
|
||
font-weight: 500;
|
||
color: #606266;
|
||
margin-bottom: 10px;
|
||
padding-bottom: 8px;
|
||
border-bottom: 1px solid #e4e7ed;
|
||
}
|
||
|
||
.pending-coil-list {
|
||
max-height: 300px;
|
||
overflow-y: auto;
|
||
|
||
&::-webkit-scrollbar {
|
||
width: 4px;
|
||
}
|
||
|
||
&::-webkit-scrollbar-thumb {
|
||
background: #dcdfe6;
|
||
border-radius: 2px;
|
||
}
|
||
}
|
||
|
||
.pending-coil-item {
|
||
padding: 10px;
|
||
margin-bottom: 8px;
|
||
background: #f5f7fa;
|
||
border: 1px solid #e4e7ed;
|
||
border-radius: 4px;
|
||
cursor: pointer;
|
||
transition: all 0.3s;
|
||
|
||
&:hover {
|
||
background: #ecf5ff;
|
||
border-color: #0066cc;
|
||
}
|
||
|
||
.pending-coil-no {
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
color: #303133;
|
||
margin-bottom: 4px;
|
||
}
|
||
|
||
.pending-coil-info {
|
||
font-size: 12px;
|
||
color: #909399;
|
||
|
||
.pending-label {
|
||
margin-right: 4px;
|
||
}
|
||
}
|
||
}
|
||
|
||
.source-detail-row {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
margin-bottom: 8px;
|
||
font-size: 13px;
|
||
|
||
&:last-child {
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
.detail-label {
|
||
color: #909399;
|
||
min-width: 90px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.detail-value {
|
||
color: #303133;
|
||
flex: 1;
|
||
word-break: break-all;
|
||
}
|
||
}
|
||
|
||
.btn-remove {
|
||
color: #f56c6c;
|
||
padding: 0;
|
||
|
||
&:hover {
|
||
color: #f56c6c;
|
||
}
|
||
}
|
||
|
||
/* 流程箭头 */
|
||
.merge-arrow-container {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
|
||
.flow-label {
|
||
position: absolute;
|
||
bottom: 20px;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
background: #ecf5ff;
|
||
color: #0066cc;
|
||
padding: 8px 16px;
|
||
border-radius: 20px;
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
border: 1px solid #d9ecff;
|
||
}
|
||
|
||
/* 目标卷卡片 */
|
||
.target-coil-card {
|
||
background: #fff;
|
||
border: 2px solid #0066cc;
|
||
border-radius: 8px;
|
||
overflow: hidden;
|
||
box-shadow: 0 4px 12px rgba(0, 102, 204, 0.15);
|
||
margin-bottom: 20px;
|
||
}
|
||
|
||
.target-coil-header {
|
||
background: #0066cc;
|
||
color: #fff;
|
||
padding: 16px 20px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.target-coil-body {
|
||
padding: 20px;
|
||
}
|
||
|
||
/* 规则说明卡片 */
|
||
.rule-card {
|
||
background: #fff9f0;
|
||
border: 1px solid #ffe9c2;
|
||
border-radius: 8px;
|
||
padding: 16px;
|
||
}
|
||
|
||
.rule-title {
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
color: #e6a23c;
|
||
margin-bottom: 12px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
}
|
||
|
||
.rule-list {
|
||
padding-left: 20px;
|
||
margin: 0;
|
||
|
||
li {
|
||
color: #606266;
|
||
font-size: 13px;
|
||
line-height: 24px;
|
||
}
|
||
}
|
||
|
||
// 优化按钮文字颜色
|
||
// 实心primary按钮:白色文字
|
||
::v-deep .el-button--primary.el-button--small:not(.is-plain) {
|
||
color: #fff;
|
||
}
|
||
|
||
// plain按钮和text按钮:蓝色文字
|
||
::v-deep .el-button--primary.el-button--small.is-plain,
|
||
::v-deep .el-button--text {
|
||
color: #409eff;
|
||
|
||
&:hover {
|
||
color: #66b1ff;
|
||
}
|
||
}
|
||
|
||
// 修复数字输入框的上下箭头溢出
|
||
.target-coil-body {
|
||
::v-deep input[type="number"] {
|
||
appearance: textfield;
|
||
-moz-appearance: textfield;
|
||
|
||
&::-webkit-outer-spin-button,
|
||
&::-webkit-inner-spin-button {
|
||
-webkit-appearance: none;
|
||
appearance: none;
|
||
margin: 0;
|
||
}
|
||
}
|
||
}
|
||
</style>
|
||
|