Files
xgy-oa/klp-ui/src/views/wms/receive/detail/index.vue
砂糖 99cd07939f feat(钢卷管理): 添加钢卷号组件并优化相关功能
新增CoilNo组件用于统一显示钢卷号,支持G开头钢卷号特殊样式
在actflow、detail、panels等页面中使用新组件替换原有el-tag显示
添加showExportTime属性控制发货时间列的显示
优化ImportGuide组件,钢卷号自动添加G前缀
2025-12-02 15:52:35 +08:00

453 lines
16 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-row :gutter="10">
<el-col :span="6">
<el-card>
<el-input v-model="planQueryParams.planName" placeholder="计划名称" clearable @change="handlePlanQuery"
style="width: 100%;" />
<el-tree v-loading="planLoading" :data="planTreeData" :props="planTreeProps" @node-click="handlePlanSelect"
default-expand-all style="margin-top: 10px; height: 550px; overflow: auto;">
<template slot-scope="{ node, data }">
<span class="plan-node">
<span class="plan-name">{{ data.planName }}</span>
</span>
</template>
</el-tree>
<pagination v-show="planTotal > 0" :total="planTotal" :page.sync="planQueryParams.pageNum"
:limit.sync="planQueryParams.pageSize" @pagination="getPlanList" style="margin-top: 10px;"
layout="total, prev, jumper, next" />
</el-card>
</el-col>
<el-col :span="18">
<el-card>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="收货单名称" prop="waybillName">
<el-input v-model="queryParams.waybillName" placeholder="请输入收货单名称" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="收货单位" prop="consigneeUnit">
<el-input v-model="queryParams.consigneeUnit" placeholder="请输入收货单位" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button type="success" plain icon="el-icon-refresh" size="mini" @click="handleQuery">刷新</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
:disabled="!selectedPlan" title="导入收货计划">导入</el-button>
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" border :data="deliveryWaybillList" highlight-current-row>
<el-table-column label="钢卷号" align="center" prop="currentCoilNo" :show-overflow-tooltip="true">
<template slot-scope="scope">
<CoilNo :coil-no="scope.row.currentCoilNo" />
<!-- <el-tag type="info" size="small">{{ scope.row.currentCoilNo }}</el-tag> -->
</template>
</el-table-column>
<el-table-column label="优先级" align="center" prop="priority">
<template slot-scope="scope">
<el-tag v-if="scope.row.priority === 0" type="info" size="mini">普通</el-tag>
<el-tag v-else-if="scope.row.priority === 1" type="warning" size="mini">重要</el-tag>
<el-tag v-else-if="scope.row.priority === 2" type="danger" size="mini">紧急</el-tag>
</template>
</el-table-column>
<el-table-column label="来源" align="center" prop="sourceType">
<template slot-scope="scope">
<el-tag v-if="scope.row.sourceType === 'scan'" type="success" size="mini">
<i class="el-icon-mobile"></i> 扫码
</el-tag>
<el-tag v-else type="info" size="mini">
<i class="el-icon-edit-outline"></i> 手动
</el-tag>
</template>
</el-table-column>
<el-table-column label="新增时间" align="center" prop="createTime" width="155" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" width="100" />
<el-table-column label="操作状态" align="center" prop="actionStatus" width="120">
<template slot-scope="scope">
<el-tag v-if="scope.row.actionStatus === 2" type="success">已收货</el-tag>
<el-tag v-else type="primary">未收货</el-tag>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button v-if="scope.row.actionStatus == 0 || scope.row.actionStatus == 1" type="primary" @click="openReceiptModal(scope.row)">签收</el-button>
</template>
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit"
@click.stop="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete"
@click.stop="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column> -->
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
</el-card>
</el-col>
</el-row>
<!-- 先做导入功能通过一个钢卷的excel文件导入, 全屏弹窗 -->
<el-dialog v-if="selectedPlan" title="导入收货计划" :visible.sync="importDialogVisible" width="80%" >
<ImportGuide :planId="selectedPlan.planId" />
</el-dialog>
<el-dialog title="确认收货" v-loading="loading" :visible.sync="receiptModalVisible" width="30%">
<el-form :model="coilInfo" ref="receiptFormRef" label-width="120px">
<el-form-item label="钢卷号" prop="currentCoilNo">
<el-input v-model="coilInfo.currentCoilNo" disabled placeholder="请输入钢卷号" />
</el-form-item>
<el-form-item label="净重" prop="netWeight">
<el-input v-model="coilInfo.netWeight" disabled placeholder="请输入净重" />
</el-form-item>
<el-form-item label="毛重" prop="grossWeight">
<el-input v-model="coilInfo.grossWeight" disabled placeholder="请输入毛重" />
</el-form-item>
<el-form-item label="实际库区" prop="actualWarehouseId">
<ActualWarehouseSelect v-model="coilInfo.actualWarehouseId" placeholder="请选择实际库区" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="coilInfo.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmReceipt" v-loading="buttonLoading">签收</el-button>
<el-button @click="receiptModalVisible = false">取消</el-button>
</template>
</el-dialog>
</div>
</template>
<script>
import { updateMaterialCoilSimple, getMaterialCoil } from '@/api/wms/coil'
import { listPendingAction, updatePendingAction } from '@/api/wms/pendingAction'
import { listDeliveryPlan } from '@/api/wms/deliveryPlan'
import MemoInput from "@/components/MemoInput";
import ImportGuide from "@/views/wms/receive/components/ImportGuide.vue";
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
export default {
name: "DeliveryWaybill",
components: {
MemoInput,
ImportGuide,
ActualWarehouseSelect,
CoilNo
},
data() {
return {
// 按钮loading
buttonLoading: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 收货单表格数据
deliveryWaybillList: [],
waybillId: null,
// 打印相关数据
printDialogVisible: false,
currentWaybill: {},
currentWaybillDetails: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
waybillNo: undefined,
waybillName: undefined,
licensePlate: undefined,
consigneeUnit: undefined,
senderUnit: undefined,
deliveryTime: undefined,
weighbridge: undefined,
salesPerson: undefined,
principal: undefined,
principalPhone: undefined,
status: undefined,
planId: undefined
},
// 表单参数
form: {},
// 表单校验
rules: {},
// 收货计划相关数据
planList: [],
planTreeData: [],
planTreeProps: {
label: 'planName',
children: 'children'
},
planTotal: 0,
planLoading: false,
selectedPlan: null,
planQueryParams: {
pageNum: 1,
pageSize: 100, // 增大分页大小以确保树形结构显示足够数据
planName: undefined,
planType: 1,
},
// 导入弹窗
importDialogVisible: false,
// 确认收货表单参数
receiptModalVisible: false,
receiptForm: {
currentCoilNo: null,
netWeight: null,
grossWeight: null,
actualWarehouseId: null,
remark: null,
},
coilInfo: {},
};
},
created() {
this.getList();
this.getPlanList();
},
methods: {
/** 查询收货单列表 */
getList() {
this.loading = true;
// 确保查询参数包含planId
const params = {
...this.queryParams,
actionType: 401, // 401表示钢卷入库
// 如果选中了计划将计划作为查询条件虽然字段名交warehouseId但实际存储的是计划Id
warehouseId: this.selectedPlan ? this.selectedPlan.planId : undefined
};
listPendingAction(params).then(response => {
this.deliveryWaybillList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
waybillId: undefined,
waybillNo: new Date().getTime(),
waybillName: undefined,
planId: undefined,
licensePlate: undefined,
consigneeUnit: undefined,
senderUnit: '科伦普',
deliveryTime: undefined,
weighbridge: undefined,
salesPerson: undefined,
principal: undefined,
principalPhone: undefined,
status: undefined,
remark: undefined,
delFlag: undefined,
createTime: undefined,
createBy: undefined,
updateTime: undefined,
updateBy: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
// 重置查询时保留planId
if (this.selectedPlan) {
this.queryParams.planId = this.selectedPlan.planId;
}
this.handleQuery();
},
// 获取收货计划列表
getPlanList() {
this.planLoading = true;
listDeliveryPlan(this.planQueryParams).then(response => {
this.planList = response.rows;
this.planTotal = response.total;
// 转换为树形数据格式
this.planTreeData = response.rows;
this.planLoading = false;
});
},
// 收货计划搜索
handlePlanQuery() {
this.planQueryParams.pageNum = 1;
this.getPlanList();
},
// 收货计划重置
resetPlanQuery() {
this.planQueryParams.planName = undefined;
this.handlePlanQuery();
},
handlePlanSelect(row) {
this.selectedPlan = row;
// 更新查询参数根据选中的planId筛选收货单
this.queryParams.planId = row.planId;
this.waybillId = null;
this.getList();
},
handleRowClick(row) {
this.waybillId = row.waybillId;
},
/** 新增按钮操作 */
handleAdd() {
this.importDialogVisible = true;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const waybillId = row.waybillId || this.ids
getDeliveryWaybill(waybillId).then(response => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改收货单";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.form.waybillId != null) {
updateDeliveryWaybill(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addDeliveryWaybill(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const waybillIds = row.waybillId || this.ids;
this.$modal.confirm('是否确认删除收货单编号为"' + waybillIds + '"的数据项?').then(() => {
this.loading = true;
return delDeliveryWaybill(waybillIds);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('wms/deliveryWaybill/export', {
...this.queryParams
}, `deliveryWaybill_${new Date().getTime()}.xlsx`)
},
// 打开收货弹窗
openReceiptModal(row) {
this.loading = true
// 打开确认收货弹窗
this.receiptModalVisible = true;
this.receiptForm = row;
// 根据钢卷id查询钢卷信息
getMaterialCoil(row.coilId).then(res => {
this.coilInfo = res.data;
this.loading = false
})
},
// 确认收货
confirmReceipt() {
// 二次确认
this.$modal.confirm("收货后刚钢卷会进入库存并占用所选的实际库区,是否继续?").then(() => {
this.buttonLoading = true;
// 更新操作记录状态 actionStatus: 2
updatePendingAction({
...this.receiptForm,
actionStatus: 2,
}).then(_ => {
this.$message.success("确认收货成功");
this.getList()
}).finally(() => {
this.buttonLoading = false;
});
// 更新钢卷状态为当前钢卷; dataType: 1
updateMaterialCoilSimple({
...this.coilInfo,
dataType: 1,
})
})
},
// 取消操作
cancel() {
this.form = {};
this.$refs.form.resetFields();
this.buttonLoading = false;
}
}
};
</script>
<style scoped>
.plan-container {
padding: 10px;
height: 100%;
border-right: 1px solid #ebeef5;
}
.plan-container h3 {
margin: 0 0 10px 0;
padding: 0;
font-size: 16px;
font-weight: 500;
}
</style>