feat: 新增多项功能并优化多个页面交互

1. 新增批量修改钢卷合同接口与合同批量转单功能
2. 优化KLPTable多选列默认位置与物料预警查询交互
3. 升级CoilTable支持多选与自定义操作栏
4. 新增菜单导出功能
5. 优化钢卷面板列宽与操作按钮文案
This commit is contained in:
2026-06-24 17:51:14 +08:00
parent fa84bae4f2
commit a4f8ecb48b
8 changed files with 255 additions and 75 deletions

View File

@@ -542,6 +542,16 @@ export function listForPeriodComparison(data) {
})
}
// 批量修改钢卷所挂接的合同
export function batchUpdateContractCoil(contractId, coilIds) {
return request({
url: '/wms/coilContractRel/batchUpdateContract',
method: 'put',
params: { contractId },
data: coilIds
})
}
// 钢卷加工链追溯查询(双向:向上到根节点,向下到所有后代)
export function getCoilChain(coilId) {
return request({

View File

@@ -18,11 +18,11 @@
<slot name="append" v-bind="scope"></slot>
</template>
<el-table-column v-if="selectionColumn" type="selection" width="55" align="center"></el-table-column>
<!-- 3. 透传"自定义列"插槽直接接收<el-table-column> 嵌套的情况 -->
<slot v-bind:tableRef="tableRef"></slot>
<el-table-column v-if="selectionColumn" type="selection" width="55" align="center"></el-table-column>
<el-table-column v-if="indexColumn" type="index" width="55" align="center"></el-table-column>
</el-table>
<!-- 浮层组件 -->

View File

@@ -1,11 +1,17 @@
<template>
<div>
<!-- 统计信息 -->
<div class="coil-stats" style="margin-bottom: 10px; padding: 10px; background-color: #f5f7fa; border-radius: 4px;">
<span style="margin-right: 20px;"><strong>总卷数{{ totalCoils }}</strong></span>
<span><strong>净重{{ totalNetWeight }} kg</strong></span>
<!-- 统计信息 + 操作栏 -->
<div class="coil-toolbar" style="margin-bottom: 10px; padding: 10px; background-color: #f5f7fa; border-radius: 4px; display: flex; align-items: center; justify-content: space-between;">
<div class="coil-stats">
<span style="margin-right: 20px;"><strong>卷数{{ totalCoils }}</strong></span>
<span><strong>总净重{{ totalNetWeight }} kg</strong></span>
</div>
<div class="coil-actions">
<slot name="filter-actions" :selectedRows="selectedRows" :clearSelection="clearSelection" />
</div>
</div>
<KLPTable :data="data" :floatLayer="true" :floatLayerConfig="floatLayerConfig" :height="tableHeight">
<KLPTable ref="klpTable" :data="data" :floatLayer="true" :floatLayerConfig="floatLayerConfig" :height="tableHeight"
:selectionColumn="showSelection" @selection-change="handleSelectionChange">
<el-table-column label="入场卷号" align="center" prop="enterCoilNo">
<template slot-scope="scope">
<coil-no :coil-no="scope.row.enterCoilNo"></coil-no>
@@ -90,6 +96,10 @@ export default {
tableHeight: {
type: [String, Number],
default: ''
},
showSelection: {
type: Boolean,
default: false
}
},
components: {
@@ -113,6 +123,7 @@ export default {
},
data() {
return {
selectedRows: [],
floatLayerConfig: {
columns: [
{ label: '入场卷号', prop: 'enterCoilNo' },
@@ -151,6 +162,16 @@ export default {
}
},
methods: {
handleSelectionChange(selection) {
this.selectedRows = selection;
this.$emit('selection-change', selection);
},
clearSelection() {
if (this.$refs.klpTable) {
this.$refs.klpTable.clearSelection();
}
this.selectedRows = [];
},
/** 预览标签 */
handlePreviewLabel(row) {
this.labelRender.visible = true;

View File

@@ -24,7 +24,15 @@
<el-tab-pane label="生产成果" name="product">
<div class="order-record" v-if="activeTab === 'product'">
<!-- 生产成果内容 -->
<CoilTable :data="productList || []" />
<CoilTable ref="productCoilTable" :data="productList || []" :showSelection="true"
@selection-change="handleProductSelectionChange">
<template slot="filter-actions" slot-scope="{ selectedRows }">
<el-button type="primary" size="mini" icon="el-icon-refresh"
:disabled="!selectedRows.length" @click="handleBatchTransferContract(selectedRows)">
批量转单
</el-button>
</template>
</CoilTable>
</div>
</el-tab-pane>
<el-tab-pane label="发货配卷" name="coil">
@@ -63,6 +71,20 @@
</div>
</el-tab-pane> -->
</el-tabs>
<!-- 批量转单 - 选择目标合同弹窗 -->
<el-dialog title="批量转单" :visible.sync="batchTransferDialogVisible" width="500px" append-to-body
@closed="batchTargetContractId = ''">
<div style="margin-bottom: 12px;">
已选择 <strong>{{ (batchTransferCoilIds || []).length }}</strong> 卷钢卷请选择目标合同
</div>
<ContractSelect v-model="batchTargetContractId" mode="all" />
<span slot="footer">
<el-button @click="batchTransferDialogVisible = false">取消</el-button>
<el-button type="primary" :disabled="!batchTargetContractId" :loading="batchTransferLoading"
@click="confirmBatchTransfer">确认转单</el-button>
</span>
</el-dialog>
</div>
<div v-else class="no-selection" style="display: flex; align-items: center; justify-content: center; height: 100%;">
<el-empty description="请先选择合同" />
@@ -73,6 +95,8 @@
<script>
// import OrderPage from "@/views/crm/order/index.vue";
import CoilTable from "../../components/CoilTable.vue";
import ContractSelect from "@/components/KLPService/ContractSelect";
import { batchUpdateContractCoil } from "@/api/wms/coil";
import FileList from "@/components/FileList";
import DeliveryTable from "../../components/DeliveryTable.vue";
@@ -87,6 +111,7 @@ export default {
name: "ContractTabs",
components: {
CoilTable,
ContractSelect,
FileList,
DeliveryTable,
OrderDetail,
@@ -142,10 +167,51 @@ export default {
data() {
return {
// 活动tab
activeTab: "finance"
activeTab: "finance",
selectedProductRows: [],
batchTransferDialogVisible: false,
batchTargetContractId: '',
batchTransferCoilIds: [],
batchTransferLoading: false
};
},
methods: {
handleProductSelectionChange(selection) {
this.selectedProductRows = selection;
},
handleBatchTransferContract(selectedRows) {
if (!selectedRows || !selectedRows.length) {
this.$message.warning('请先选择需要转单的钢卷');
return;
}
this.batchTransferCoilIds = selectedRows.map(row => row.coilId);
this.batchTargetContractId = '';
this.batchTransferDialogVisible = true;
},
confirmBatchTransfer() {
const coilIds = this.batchTransferCoilIds;
const contractId = this.batchTargetContractId;
if (!contractId) {
this.$message.warning('请选择目标合同');
return;
}
this.batchTransferLoading = true;
batchUpdateContractCoil(contractId, coilIds).then(res => {
this.$message.success(`成功将 ${coilIds.length} 卷钢卷转入目标合同`);
this.batchTransferDialogVisible = false;
// 刷新生产成果列表
this.$emit('refresh-product');
// 清除选中
if (this.$refs.productCoilTable) {
this.$refs.productCoilTable.clearSelection();
}
}).catch(err => {
console.error('批量转单失败:', err);
this.$message.error('批量转单失败,请重试');
}).finally(() => {
this.batchTransferLoading = false;
});
},
// 解析时间
parseTime(time, pattern) {
if (!time) return '';

View File

@@ -27,7 +27,8 @@
<!-- 右侧下方Tab标签页 -->
<div class="tab-panel" ref="tabPanel" style="flex: 1; overflow-y: auto;">
<ContractTabs :orderId="form.orderId" :deliveryWaybillList="wmsDeliveryWaybills" :coilList="coilList" :contract-attachment="form.businessAnnex" :technical-agreement="form.techAnnex"
:other-attachment="form.productionSchedule" :currentOrder="form" :productList="form.coilList" />
:other-attachment="form.productionSchedule" :currentOrder="form" :productList="form.coilList"
@refresh-product="handleRefreshProduct" />
</div>
</div>
<div v-else style="flex: 1; display: flex; flex-direction: column;">
@@ -508,6 +509,17 @@ export default {
this.coilList = response.data || [];
})
},
/** 刷新生产成果列表(批量转单后调用) */
handleRefreshProduct() {
if (!this.form.orderId) return;
getOrder(this.form.orderId).then(res => {
if (res.data) {
this.form.coilList = res.data.coilList || [];
}
}).catch(err => {
console.error('刷新生产成果失败:', err);
});
},
/** 表单重置 */
reset() {
this.form = {

View File

@@ -45,6 +45,15 @@
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -278,6 +287,7 @@ import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/me
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import IconSelect from "@/components/IconSelect";
import * as XLSX from 'xlsx';
export default {
name: "Menu",
@@ -446,6 +456,71 @@ export default {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出菜单(仅可见且未停用的菜单,父节点被过滤则子节点一并排除) */
handleExport() {
// 菜单类型映射
const menuTypeMap = { M: '目录', C: '菜单', F: '按钮' };
// 递归过滤:只保留 visible='0'(显示) && status='0'(正常) 的节点
const filterTree = (nodes) => {
return nodes
.filter(node => node.visible === '0' && node.status === '0')
.map(node => ({
...node,
children: node.children ? filterTree(node.children) : []
}));
};
// 递归展平为一维数组,缩进体现层级
const flattenTree = (nodes, level = 0, result = []) => {
nodes.forEach(node => {
const prefix = '\u3000'.repeat(level); // 全角空格缩进
result.push({
menuName: prefix + node.menuName,
menuType: menuTypeMap[node.menuType] || node.menuType,
icon: node.icon || '',
orderNum: node.orderNum,
perms: node.perms || '',
component: node.component || '',
status: '正常',
createTime: node.createTime || ''
});
if (node.children && node.children.length > 0) {
flattenTree(node.children, level + 1, result);
}
});
return result;
};
const filtered = filterTree(this.menuList);
const flatData = flattenTree(filtered);
if (flatData.length === 0) {
this.$modal.msgWarning('没有可导出的菜单数据');
return;
}
// 构建 Excel 数据
const wsData = [
['菜单名称', '菜单类型', '图标', '排序', '权限标识', '组件路径', '状态', '创建时间'],
...flatData.map(item => [
item.menuName, item.menuType, item.icon,
item.orderNum, item.perms, item.component,
item.status, item.createTime
])
];
const ws = XLSX.utils.aoa_to_sheet(wsData);
ws['!cols'] = [
{ wch: 30 }, { wch: 10 }, { wch: 12 },
{ wch: 8 }, { wch: 25 }, { wch: 30 },
{ wch: 8 }, { wch: 20 }
];
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, '菜单列表');
XLSX.writeFile(wb, '菜单列表.xlsx');
}
}
};

View File

@@ -26,16 +26,7 @@
<el-option label="已忽略" value="2" />
</el-select>
</el-form-item>
<el-form-item label="工序" prop="actionType">
<el-select
v-model="queryParams.actionType"
placeholder="请选择工序"
clearable
@change="handleQuery"
>
<el-option v-for="item in dict.type.action_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="处理人" prop="handleBy">
<el-input v-model="queryParams.handleBy" placeholder="请输入处理人" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
@@ -91,6 +82,15 @@
</el-col>
</el-row>
<el-row :gutter="10" class="mb8" style="margin-bottom: 16px;">
<el-col :span="24">
<el-radio-group v-model="queryParams.actionType" @change="handleQuery" size="mini">
<el-radio-button :key="all" :label="''">全部</el-radio-button>
<el-radio-button v-for="item in dict.type.action_type" :key="item.value" :label="item.value">{{ item.label }}</el-radio-button>
</el-radio-group>
</el-col>
</el-row>
<el-table v-loading="loading" :data="materialWarningList" :row-class-name="getRowClassName" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" :selectable="checkSelectable" />
<!-- <el-table-column label="钢卷ID" align="center" prop="coilId" /> -->

View File

@@ -165,11 +165,11 @@
<current-coil-no :current-coil-no="scope.row.currentCoilNo"></current-coil-no>
</template>
</el-table-column>
<el-table-column label="净重" align="center" prop="netWeight" v-if="!hideWarehouseQuery" />
<el-table-column label="净重" width="80" align="center" prop="netWeight" v-if="!hideWarehouseQuery" />
<el-table-column label="逻辑库位" width="120" align="center" prop="warehouseName" v-if="!hideWarehouseQuery" />
<el-table-column label="实际库区" width="100" align="center" prop="actualWarehouseName"
v-if="!hideWarehouseQuery && !showExportTime" />
<el-table-column label="产品类型" align="center" width="180" v-if="!moreColumn">
<el-table-column label="产品类型" align="center" width="160" v-if="!moreColumn">
<template slot-scope="scope">
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row" />
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row" />
@@ -256,22 +256,15 @@
</template>
</el-table-column>
<el-table-column label="关联订单" align="center" prop="relatedToOrder" v-if="showRelatedToOrder" width="150">
<template slot-scope="scope">
<el-switch @change="handleRowChange(scope.row)" v-model="scope.row.isRelatedToOrder" :active-value="1"
:inactive-value="0" />
</template>
</el-table-column>
<el-table-column label="发货计划" align="center" prop="nextWarehouseId"
v-if="showWaybill || (isShipView && shipViewModel.status == 'has')" width="150">
v-if="showWaybill || isShipView" width="150">
<template slot-scope="scope">
{{ scope.row.bindPlanName || '-' }}
</template>
</el-table-column>
<el-table-column label="发货单据" align="center" prop="nextWarehouseId"
v-if="showWaybill || (isShipView && shipViewModel.status == 'has')" width="150">
v-if="showWaybill || isShipView" width="150">
<template slot-scope="scope">
<el-popover placement="top" width="400" trigger="hover">
<div>
@@ -346,52 +339,55 @@
</el-table-column>
<el-table-column prop="action" label="操作" align="center" class-name="small-padding fixed-width"
<el-table-column prop="action" label="操作" align="center" class-name="small-padding fixed-width" width="180"
v-if="!moreColumn">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-view" @click="handlePreviewLabel(scope.row)">
预览标签
</el-button>
<el-button size="mini" type="text" icon="el-icon-printer" @click="handlePrintLabel(scope.row)">
打印标签
</el-button>
<el-button size="mini" type="text" icon="el-icon-view" @click="handleNumberCoilClick(scope.row)">
数字钢卷
</el-button>
<el-button size="mini" v-if="showStatus" type="text" icon="el-icon-upload"
@click="handleExportCoil(scope.row)">
发货
</el-button>
<el-button size="mini" v-if="showExportTime" type="text" icon="el-icon-close"
@click="handleCancelExport(scope.row)">
撤回发货
</el-button>
<el-button size="mini" v-if="showProductionTimeEdit" type="text" icon="el-icon-close"
@click="handleProductionTimeEdit(scope.row)">
加工修正
</el-button>
<el-button size="mini" v-if="showExportTime" type="text" icon="el-icon-sold-out"
@click="handleReturnCoil(scope.row)">
退货钢卷
</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleCheck(scope.row)"
v-if="showControl">修正</el-button>
<el-button size="mini" type="text" icon="el-icon-search" @click="handleTrace(scope.row)">追溯</el-button>
<el-button size="mini" v-if="showWaybill" type="text" icon="el-icon-close"
@click="handleRemoveFromWaybill(scope.row)">
移出发货单
</el-button>
<el-button v-if="showGrade" size="mini" type="text" icon="el-icon-edit" @click="handleJudge(scope.row)">
改判
</el-button>
<el-button size="mini" v-if="hasTransferType" type="text" icon="el-icon-close"
@click="handleReplaceLabel(scope.row)">
重贴标签
</el-button>
<el-button size="mini" v-if="hasTransferType" type="text" icon="el-icon-document"
@click="handleViewTransferRecord(scope.row)">
查看记录
</el-button>
<div>
<el-button size="mini" type="text" icon="el-icon-view" @click="handlePreviewLabel(scope.row)">
预览标签
</el-button>
<el-button size="mini" type="text" icon="el-icon-printer" @click="handlePrintLabel(scope.row)">
打印标签
</el-button>
<el-button size="mini" type="text" icon="el-icon-view" @click="handleNumberCoilClick(scope.row)">
数字钢卷
</el-button>
<el-button size="mini" v-if="showStatus" type="text" icon="el-icon-upload"
@click="handleExportCoil(scope.row)">
钢卷发货
</el-button>
<el-button size="mini" v-if="showExportTime" type="text" icon="el-icon-close"
@click="handleCancelExport(scope.row)">
撤回发货
</el-button>
<el-button size="mini" v-if="showProductionTimeEdit" type="text" icon="el-icon-close"
@click="handleProductionTimeEdit(scope.row)">
加工修正
</el-button>
<el-button size="mini" v-if="showExportTime" type="text" icon="el-icon-sold-out"
@click="handleReturnCoil(scope.row)">
退货钢卷
</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleCheck(scope.row)"
v-if="showControl">数据修正</el-button>
<el-button size="mini" type="text" icon="el-icon-search" @click="handleTrace(scope.row)">生产追溯</el-button>
<el-button size="mini" v-if="showWaybill" type="text" icon="el-icon-close"
@click="handleRemoveFromWaybill(scope.row)">
移出货单
</el-button>
<el-button v-if="showGrade" size="mini" type="text" icon="el-icon-edit" @click="handleJudge(scope.row)">
质量改判
</el-button>
<el-button size="mini" v-if="hasTransferType" type="text" icon="el-icon-close"
@click="handleReplaceLabel(scope.row)">
重贴标签
</el-button>
<el-button size="mini" v-if="hasTransferType" type="text" icon="el-icon-document"
@click="handleViewTransferRecord(scope.row)">
查看记录
</el-button>
</div>
</template>
</el-table-column>
</KLPTable>