feat(排产单): 新增排产单列表组件和优化排产单详情页
refactor(线圈): 移除新增按钮并添加线圈ID格式校验 新增排产单列表组件PlanSheetList用于展示和选择排产单,重构排产单详情页布局和功能 优化线圈操作面板,移除无用新增按钮并添加线圈ID格式校验逻辑
This commit is contained in:
488
klp-ui/src/views/aps/planSheet/PlanSheetList.vue
Normal file
488
klp-ui/src/views/aps/planSheet/PlanSheetList.vue
Normal file
@@ -0,0 +1,488 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="tab-container">
|
||||
<div class="select-button" @click="openPlanSheetDialog">
|
||||
<i class="el-icon-setting"></i>
|
||||
</div>
|
||||
<div class="custom-tabs">
|
||||
<div class="tab-header">
|
||||
<div
|
||||
v-for="planSheet in planSheetList"
|
||||
:key="planSheet.planSheetId"
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === planSheet.planSheetId.toString() }"
|
||||
@click="handleTabClick(planSheet)"
|
||||
>
|
||||
<div class="tab-title">{{ planSheet.planCode }}</div>
|
||||
<div class="tab-info">
|
||||
<span>{{ planSheet.lineName }}</span>
|
||||
<span class="date">{{ parseTime(planSheet.planDate, '{y}-{m}-{d}') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="planSheetList.length === 0" class="tab-item disabled">
|
||||
<div class="tab-title">暂无排产单</div>
|
||||
<div class="tab-info">请点击齿轮图标选择排产单</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 排产单选择对话框 -->
|
||||
<el-dialog :title="'选择排产单'" :visible.sync="planSheetDialogVisible" width="900px" append-to-body>
|
||||
<div class="dialog-toolbar">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
|
||||
<el-form-item label="排产日期" prop="planDate">
|
||||
<el-date-picker clearable v-model="queryParams.planDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="请选择排产日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="产线名称" prop="lineName">
|
||||
<el-input v-model="queryParams.lineName" placeholder="请输入产线名称" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排产单号" prop="planCode">
|
||||
<el-input v-model="queryParams.planCode" placeholder="请输入排产单号" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排产人" prop="scheduler">
|
||||
<el-input v-model="queryParams.scheduler" placeholder="请输入排产人" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
<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-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="allPlanSheetList" height="350px" @row-click="handleTabClick">
|
||||
<el-table-column label="排产日期" align="center" prop="planDate" width="140">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.planDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产线名称" align="center" prop="lineName" />
|
||||
<el-table-column label="排产单号" align="center" prop="planCode" />
|
||||
<el-table-column label="排产人" align="center" prop="scheduler" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-download" @click.stop="handleExport(scope.row)">导出</el-button>
|
||||
<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-dialog>
|
||||
|
||||
<!-- 添加或修改排产单对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="排产日期" prop="planDate">
|
||||
<el-date-picker clearable v-model="form.planDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择排产日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="产线名称" prop="lineName">
|
||||
<el-select v-model="form.lineName" placeholder="请选择产线名称" filterable clearable>
|
||||
<el-option v-for="item in dict.type.sys_lines" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="排产单号" prop="planCode">
|
||||
<el-input v-model="form.planCode" placeholder="请输入排产单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排产人" prop="scheduler">
|
||||
<el-input v-model="form.scheduler" placeholder="请输入排产人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPlanSheet, getPlanSheet, delPlanSheet, addPlanSheet, updatePlanSheet } from "@/api/aps/planSheet";
|
||||
|
||||
export default {
|
||||
name: "PlanSheetList",
|
||||
dicts: ['sys_lines'],
|
||||
props: {
|
||||
selectFirst: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 排产单表格数据(用于tab展示)
|
||||
planSheetList: [],
|
||||
// 所有排产单数据(用于选择对话框)
|
||||
allPlanSheetList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示添加/修改弹出层
|
||||
open: false,
|
||||
// 是否显示排产单选择弹出层
|
||||
planSheetDialogVisible: false,
|
||||
// 当前激活的tab
|
||||
activeTab: '',
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 6,
|
||||
planDate: undefined,
|
||||
lineId: undefined,
|
||||
lineName: undefined,
|
||||
planCode: undefined,
|
||||
planType: undefined,
|
||||
scheduler: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
planSheetId: [
|
||||
{ required: true, message: "排产单键ID不能为空", trigger: "blur" }
|
||||
],
|
||||
planDate: [
|
||||
{ required: true, message: "排产日期不能为空", trigger: "blur" }
|
||||
],
|
||||
lineId: [
|
||||
{ required: true, message: "产线ID不能为空", trigger: "blur" }
|
||||
],
|
||||
lineName: [
|
||||
{ required: true, message: "产线名称不能为空", trigger: "blur" }
|
||||
],
|
||||
planCode: [
|
||||
{ required: true, message: "排产单号不能为空", trigger: "blur" }
|
||||
],
|
||||
planType: [
|
||||
{ required: true, message: "排产类型不能为空", trigger: "change" }
|
||||
],
|
||||
scheduler: [
|
||||
{ required: true, message: "排产人不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList().then((list) => {
|
||||
// 如果有数据,选中第一个
|
||||
if (list.length > 0) {
|
||||
this.activeTab = list[0].planSheetId.toString();
|
||||
if (this.selectFirst) {
|
||||
this.handleRowClick(list[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
parseTime(time, pattern) {
|
||||
if (!time) return '';
|
||||
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}';
|
||||
const date = new Date(time);
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const day = date.getDate();
|
||||
const hour = date.getHours();
|
||||
const minute = date.getMinutes();
|
||||
const second = date.getSeconds();
|
||||
return format.replace('{y}', year)
|
||||
.replace('{m}', month.toString().padStart(2, '0'))
|
||||
.replace('{d}', day.toString().padStart(2, '0'))
|
||||
.replace('{h}', hour.toString().padStart(2, '0'))
|
||||
.replace('{i}', minute.toString().padStart(2, '0'))
|
||||
.replace('{s}', second.toString().padStart(2, '0'));
|
||||
},
|
||||
/** 查询排产单列表 */
|
||||
async getList() {
|
||||
this.loading = true;
|
||||
const response = await listPlanSheet(this.queryParams);
|
||||
this.allPlanSheetList = response.rows;
|
||||
this.total = response.total;
|
||||
// 默认显示所有排产单
|
||||
this.planSheetList = response.rows;
|
||||
this.loading = false;
|
||||
return this.planSheetList;
|
||||
},
|
||||
// 点击排产单行
|
||||
handleRowClick(row) {
|
||||
this.$emit('row-click', row);
|
||||
},
|
||||
// 点击tab
|
||||
handleTabClick(planSheet) {
|
||||
this.activeTab = planSheet.planSheetId.toString();
|
||||
this.planSheetDialogVisible = false;
|
||||
this.handleRowClick(planSheet);
|
||||
},
|
||||
// 打开排产单选择对话框
|
||||
openPlanSheetDialog() {
|
||||
this.getList();
|
||||
this.planSheetDialogVisible = true;
|
||||
},
|
||||
// 选择排产单行
|
||||
handlePlanSheetSelect(row) {
|
||||
this.$refs['queryForm'].$refs.table.toggleRowSelection(row);
|
||||
},
|
||||
// 确认选择排产单
|
||||
confirmSelect() {
|
||||
const selectedRows = this.$refs['queryForm'].$refs.table.selection;
|
||||
if (selectedRows.length > 0) {
|
||||
this.planSheetList = selectedRows;
|
||||
this.activeTab = selectedRows[0].planSheetId.toString();
|
||||
this.handleRowClick(selectedRows[0]);
|
||||
}
|
||||
this.planSheetDialogVisible = false;
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
// 日期默认选中今天 yyyy-MM-dd格式,北京时间
|
||||
// planCode与日期格式一致,添加-HHmmss
|
||||
// 排产人默认当前登录用户 this.$store.getters.nickName
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(now.getDate()).padStart(2, '0');
|
||||
const hours = String(now.getHours()).padStart(2, '0');
|
||||
const minutes = String(now.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(now.getSeconds()).padStart(2, '0');
|
||||
|
||||
const dateStr = `${year}-${month}-${day}`;
|
||||
const timeStr = `${hours}${minutes}${seconds}`;
|
||||
|
||||
this.form = {
|
||||
planSheetId: undefined,
|
||||
planDate: dateStr,
|
||||
lineId: undefined,
|
||||
lineName: undefined,
|
||||
planCode: `${dateStr}-${timeStr}`,
|
||||
planType: undefined,
|
||||
scheduler: this.$store.getters.nickName || undefined,
|
||||
remark: undefined,
|
||||
delFlag: undefined,
|
||||
createBy: undefined,
|
||||
updateBy: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
// 重置表单
|
||||
resetForm(formName) {
|
||||
if (this.$refs[formName]) {
|
||||
this.$refs[formName].resetFields();
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加排产单";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const planSheetId = row.planSheetId;
|
||||
getPlanSheet(planSheetId).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.planSheetId != null) {
|
||||
updatePlanSheet(this.form).then(response => {
|
||||
this.$message({
|
||||
message: "修改成功",
|
||||
type: "success"
|
||||
});
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addPlanSheet(this.form).then(response => {
|
||||
this.$message({
|
||||
message: "新增成功",
|
||||
type: "success"
|
||||
});
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const planSheetIds = row.planSheetId;
|
||||
this.$confirm('是否确认删除排产单编号为"' + planSheetIds + '"的数据项?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
return delPlanSheet(planSheetIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$message({
|
||||
message: "删除成功",
|
||||
type: "success"
|
||||
});
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport(row) {
|
||||
this.download('aps/planSheet/exportAll', {
|
||||
...this.queryParams,
|
||||
planSheetId: row.planSheetId,
|
||||
}, `planSheet_${new Date().getTime()}.xlsx`);
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tab-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.select-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 16px;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
background-color: #f9f9f9;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
user-select: none;
|
||||
margin-right: 10px;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.select-button:hover {
|
||||
background-color: #ecf5ff;
|
||||
border-color: #c6e2ff;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.custom-tabs {
|
||||
flex: 1;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
}
|
||||
|
||||
.tab-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
padding: 4px 4px;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-bottom: none;
|
||||
border-radius: 4px 4px 0 0;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
background-color: #f9f9f9;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
.tab-item:hover {
|
||||
background-color: #ecf5ff;
|
||||
border-color: #c6e2ff;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
background-color: #ffffff;
|
||||
border-color: #409eff;
|
||||
border-bottom-color: #ffffff;
|
||||
color: #409eff;
|
||||
box-shadow: 0 -2px 0 0 #409eff inset;
|
||||
}
|
||||
|
||||
.tab-item.disabled {
|
||||
cursor: not-allowed;
|
||||
background-color: #f5f7fa;
|
||||
color: #c0c4cc;
|
||||
border-color: #ebeef5;
|
||||
}
|
||||
|
||||
.tab-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
margin-bottom: 1px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.tab-info {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tab-info .date {
|
||||
color: #606266;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.empty-content {
|
||||
padding: 40px;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.dialog-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,219 +1,444 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="8">
|
||||
<el-col :span="16">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-form-item label="排产日期" prop="planDate">
|
||||
<el-date-picker clearable v-model="queryParams.planDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="请选择排产日期">
|
||||
</el-date-picker>
|
||||
<!-- 增加操作列用于打开弹窗选择排产单,选择后展示选择的排产单的信息 -->
|
||||
<PlanSheetList @row-click="handleRowClick" />
|
||||
|
||||
<div v-if="currentPlanSheetId" class="plan-detail-container">
|
||||
<!-- 排产单信息 -->
|
||||
<div class="card-header">
|
||||
<h3>{{ currentPlanSheetInfo.planSheetName || '排产单详情' }}</h3>
|
||||
<div>
|
||||
<el-button type="primary" plain @click="handleAdd">新增明细</el-button>
|
||||
<el-button type="info" plain @click="getList">刷新</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="plan-info">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<span class="label">排产单号:</span>
|
||||
<span>{{ currentPlanSheetInfo.planCode }}</span>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span class="label">排产人:</span>
|
||||
<span>{{ currentPlanSheetInfo.scheduler }}</span>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span class="label">排产时间:</span>
|
||||
<span>{{ currentPlanSheetInfo.planDate }}</span>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<span class="label">产线:</span>
|
||||
<span>{{ currentPlanSheetInfo.lineName }}</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<!-- 可编辑表格 -->
|
||||
<el-table v-loading="loading" :data="planDetailList" style="width: 100%" border>
|
||||
<!-- 操作列 -->
|
||||
<el-table-column label="操作" align="center" width="120" fixed="left">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="mini" @click="handleSave(scope.row)">保存</el-button>
|
||||
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="序号" align="center" prop="bizSeqNo" width="80" fixed="left">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.bizSeqNo" />
|
||||
<!-- {{ scope.$index + 1 }} -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 订单信息 -->
|
||||
<el-table-column label="订单号" align="center" prop="orderCode" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.orderCode">
|
||||
<template slot="append">
|
||||
<el-button size="mini" @click.stop="openOrderDialog(scope.row)">选择</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合同号" align="center" prop="contractCode" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.contractCode" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="客户" align="center" prop="customerName" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.customerName" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="业务员" align="center" prop="salesman" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.salesman" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 原料信息 -->
|
||||
<el-table-column label="原料厂家" align="center" prop="rawManufacturer" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.rawManufacturer" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="原料材质" align="center" prop="rawMaterial" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.rawMaterial" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="原料厚度" align="center" prop="rawThick" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.rawThick" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="原料宽度" align="center" prop="rawWidth" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.rawWidth" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 成品信息 -->
|
||||
<el-table-column label="成品名称" align="center" prop="productName" width="170">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.productName">
|
||||
<template slot="append">
|
||||
<el-button size="mini" @click.stop="openOrderItemDialog(scope.row)"
|
||||
:disabled="!scope.row.orderId">选择</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成品材质" align="center" prop="productMaterial" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.productMaterial" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成品镀层" align="center" prop="coatingG" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.coatingG" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="成品宽度" align="center" prop="productWidth" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.productWidth" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="轧制厚度" align="center" prop="rollingThick" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.rollingThick" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标签厚度" align="center" prop="markCoatThick" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.markCoatThick" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="吨钢长度区间" align="center" prop="tonSteelLengthRange" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.tonSteelLengthRange" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" align="center" prop="planQty" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.planQty" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="重量" align="center" prop="planWeight" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.planWeight" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="表面处理" align="center" prop="surfaceTreatmentDesc" width="100">
|
||||
<template slot-scope="scope">
|
||||
<MemoInput storageKey="surfaceTreatmentDesc" v-model="scope.row.surfaceTreatment" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="切边要求" align="center" prop="widthReq" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.widthReq" style="width: 100%">
|
||||
<el-option label="净边料" value="净边料" />
|
||||
<el-option label="毛边料" value="毛边料" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="包装要求" align="center" prop="productPackaging" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.productPackaging" style="width: 100%">
|
||||
<el-option label="裸包" value="裸包" />
|
||||
<el-option label="普包" value="普包" />
|
||||
<el-option label="简包" value="简包" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="宽度要求" align="center" prop="productEdgeReq" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.productEdgeReq" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用途" align="center" prop="usageReq" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.usageReq" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 生产信息 -->
|
||||
<el-table-column label="开始时间" align="center" prop="startTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-date-picker v-model="scope.row.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 100%" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束时间" align="center" prop="endTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-date-picker v-model="scope.row.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 100%" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="后处理" align="center" prop="postProcess" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.postProcess" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下工序" align="center" prop="nextProcess" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.nextProcess" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="取样" align="center" prop="sampleReq" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.sampleReq" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.remark" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
<el-empty v-else class="appempty" description="选择排产单查看详情" />
|
||||
|
||||
<!-- 选择订单对话框 -->
|
||||
<el-dialog title="选择订单" :visible.sync="orderDialogVisible" width="80%" append-to-body>
|
||||
<div class="order-dialog-content">
|
||||
<!-- 筛选条件 -->
|
||||
<el-form :model="orderQueryParams" ref="orderQueryForm" size="small" :inline="true" label-width="80px">
|
||||
<el-form-item label="合同号" prop="contractCode">
|
||||
<el-input v-model="orderQueryParams.contractCode" placeholder="请输入合同号" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产线名称" prop="lineName">
|
||||
<el-input v-model="queryParams.lineName" placeholder="请输入产线名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
<el-form-item label="客户">
|
||||
<el-input v-model="orderQueryParams.customerName" placeholder="请输入客户名称" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排产单号" prop="planCode">
|
||||
<el-input v-model="queryParams.planCode" placeholder="请输入排产单号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排产人" prop="scheduler">
|
||||
<el-input v-model="queryParams.scheduler" placeholder="请输入排产人" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
<el-form-item label="业务员">
|
||||
<el-input v-model="orderQueryParams.salesman" placeholder="请输入业务员" style="width: 120px" />
|
||||
</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="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button> -->
|
||||
<el-button type="primary" icon="el-icon-search" @click="getOrderList">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetOrderQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="planSheetList" height="400px" @row-click="handleRowClick">
|
||||
<el-table-column label="排产日期" align="center" prop="planDate" width="140">
|
||||
<!-- 订单列表 -->
|
||||
<el-table v-loading="orderLoading" :data="orderList" style="width: 100%" @row-click="handleOrderSelect">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="contractCode" label="合同号" width="150" />
|
||||
<el-table-column prop="signTime" label="签订时间" width="150" />
|
||||
<el-table-column prop="signLocation" label="签订地点" />
|
||||
<el-table-column prop="companyName" label="客户" width="180" />
|
||||
<el-table-column prop="salesman" label="业务员" width="100" />
|
||||
<el-table-column prop="orderAmount" label="订单金额" width="120" align="right" />
|
||||
<el-table-column prop="deliveryDate" label="交货日期" width="150" />
|
||||
<el-table-column prop="createTime" label="创建时间" width="180" />
|
||||
<el-table-column label="操作" width="80" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.planDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="产线ID" align="center" prop="lineId" /> -->
|
||||
<el-table-column label="产线名称" align="center" prop="lineName" />
|
||||
<el-table-column label="排产单号" align="center" prop="planCode" />
|
||||
<!-- <el-table-column label="排产类型" align="center" prop="planType" /> -->
|
||||
<el-table-column label="排产人" align="center" prop="scheduler" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-download" @click="handleExport(scope.row)">导出</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
<el-button type="text" size="small" @click.stop="selectOrder(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" />
|
||||
|
||||
<PlanDetail v-if="currentPlanSheetId" ref="planDetail" :planSheetId="currentPlanSheetId"
|
||||
@change="handlePlanDetailChange" />
|
||||
<el-empty v-else class="appempty" description="选择排产单查看详情" />
|
||||
|
||||
<!-- 添加或修改排产单对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="排产日期" prop="planDate">
|
||||
<el-date-picker clearable v-model="form.planDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="请选择排产日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="产线名称" prop="lineName">
|
||||
<el-select v-model="form.lineName" placeholder="请选择产线名称" filterable clearable>
|
||||
<el-option v-for="item in dict.type.sys_lines" :key="item.value" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="排产单号" prop="planCode">
|
||||
<el-input v-model="form.planCode" placeholder="请输入排产单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排产人" prop="scheduler">
|
||||
<el-input v-model="form.scheduler" placeholder="请输入排产人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<div class="detail-form-container">
|
||||
<div v-if="currentPlanDetail.planDetailId" class="detail-card">
|
||||
<div class="card-header">
|
||||
<span>排产明细信息</span>
|
||||
<el-button type="primary" size="mini" @click="submitDetail">保存变更</el-button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<PlanDetailForm v-model="currentPlanDetail" :plan-sheet-id="currentPlanSheetId" />
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-else description="选择排产单和明细行查看详情" />
|
||||
<!-- 分页 -->
|
||||
<div class="pagination-container">
|
||||
<el-pagination background layout="prev, pager, next, jumper" :total="orderTotal"
|
||||
:page-size="orderQueryParams.pageSize" :current-page.sync="orderQueryParams.pageNum"
|
||||
@current-change="getOrderList" />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 选择订单明细对话框 -->
|
||||
<el-dialog title="选择订单明细" :visible.sync="orderItemDialogVisible" width="80%" append-to-body>
|
||||
<el-table v-loading="orderItemLoading" :data="orderItemList" @row-click="selectOrderItem">
|
||||
<el-table-column label="产品类型" align="center" prop="productType" />
|
||||
<el-table-column label="成品宽度" align="center" prop="width" />
|
||||
<el-table-column label="成品厚度" align="center" prop="thickness" />
|
||||
<el-table-column label="成品规格" align="center" prop="finishedProductSpec" />
|
||||
<el-table-column label="材质" align="center" prop="material" />
|
||||
<el-table-column label="重量" align="center" prop="weight" />
|
||||
<el-table-column label="卷数" align="center" prop="productNum" />
|
||||
<el-table-column label="表面处理" align="center" prop="surfaceTreatment" />
|
||||
<el-table-column label="包装要求" align="center" prop="packagingReq" />
|
||||
<el-table-column label="切边要求" align="center" prop="edgeCuttingReq" />
|
||||
<el-table-column label="用途" align="center" prop="purpose" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPlanSheet, getPlanSheet, delPlanSheet, addPlanSheet, updatePlanSheet } from "@/api/aps/planSheet";
|
||||
import { updatePlanDetail } from "@/api/aps/planDetail";
|
||||
import PlanDetail from "@/views/aps/planSheet/detail.vue";
|
||||
import PlanDetailForm from "@/views/aps/planSheet/PlanDetailForm.vue";
|
||||
import { updatePlanDetail, listPlanDetail, addPlanDetail, delPlanDetail } from "@/api/aps/planDetail";
|
||||
import { getPlanSheet } from "@/api/aps/planSheet";
|
||||
import { listOrder } from '@/api/crm/order';
|
||||
import { listOrderItem } from '@/api/crm/orderItem'
|
||||
import PlanSheetList from "@/views/aps/planSheet/PlanSheetList.vue";
|
||||
|
||||
export default {
|
||||
name: "PlanSheet",
|
||||
dicts: ['sys_lines'],
|
||||
components: {
|
||||
PlanDetail,
|
||||
PlanDetailForm
|
||||
PlanSheetList
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 当前选中的排产单ID
|
||||
currentPlanSheetId: undefined,
|
||||
// 当前选中的明细数据
|
||||
currentPlanDetail: {},
|
||||
// 排产单表格数据
|
||||
planSheetList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 对话框可见状态
|
||||
dialogVisible: false,
|
||||
// 当前排产单详情信息
|
||||
currentPlanSheetInfo: {},
|
||||
// 最近选择的排产单列表
|
||||
recentPlanSheets: [],
|
||||
// 排产单明细表格数据
|
||||
planDetailList: [],
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 加载状态
|
||||
loading: false,
|
||||
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
planDate: undefined,
|
||||
lineId: undefined,
|
||||
lineName: undefined,
|
||||
planCode: undefined,
|
||||
planType: undefined,
|
||||
scheduler: undefined,
|
||||
pageSize: 50,
|
||||
planSheetId: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
planSheetId: [
|
||||
{ required: true, message: "排产单键ID不能为空", trigger: "blur" }
|
||||
],
|
||||
planDate: [
|
||||
{ required: true, message: "排产日期不能为空", trigger: "blur" }
|
||||
],
|
||||
lineId: [
|
||||
{ required: true, message: "产线ID不能为空", trigger: "blur" }
|
||||
],
|
||||
lineName: [
|
||||
{ required: true, message: "产线名称不能为空", trigger: "blur" }
|
||||
],
|
||||
planCode: [
|
||||
{ required: true, message: "排产单号不能为空", trigger: "blur" }
|
||||
],
|
||||
planType: [
|
||||
{ required: true, message: "排产类型不能为空", trigger: "change" }
|
||||
],
|
||||
scheduler: [
|
||||
{ required: true, message: "排产人不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
// 订单对话框
|
||||
orderDialogVisible: false,
|
||||
// 订单明细对话框
|
||||
orderItemDialogVisible: false,
|
||||
// 订单列表
|
||||
orderList: [],
|
||||
// 订单总数
|
||||
orderTotal: 0,
|
||||
// 订单加载状态
|
||||
orderLoading: false,
|
||||
// 订单查询参数
|
||||
orderQueryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
contractCode: undefined,
|
||||
customerName: undefined,
|
||||
salesman: undefined
|
||||
},
|
||||
// 订单明细列表
|
||||
orderItemList: [],
|
||||
// 订单明细加载状态
|
||||
orderItemLoading: false,
|
||||
// 当前编辑的行
|
||||
currentEditingRow: null
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
// 从本地存储加载最近选择的排产单
|
||||
this.loadRecentPlanSheets();
|
||||
},
|
||||
methods: {
|
||||
/** 查询排产单列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPlanSheet(this.queryParams).then(response => {
|
||||
this.planSheetList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
// 打开管理排产单对话框
|
||||
openDialog() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
// 点击排产单行,显示详情
|
||||
handleRowClick(row) {
|
||||
this.currentPlanSheetId = row.planSheetId;
|
||||
this.currentPlanDetail = {};
|
||||
this.$nextTick(() => {
|
||||
this.$refs.planDetail.getList();
|
||||
})
|
||||
this.dialogVisible = false;
|
||||
|
||||
// 获取排产单详情
|
||||
this.getPlanSheetDetail(row.planSheetId);
|
||||
|
||||
// 添加到最近选择的列表
|
||||
this.addToRecentPlanSheets(row);
|
||||
|
||||
// 更新查询参数
|
||||
this.queryParams.planSheetId = row.planSheetId;
|
||||
|
||||
// 获取排产单明细列表
|
||||
this.getList();
|
||||
},
|
||||
// 获取排产单详情
|
||||
getPlanSheetDetail(planSheetId) {
|
||||
getPlanSheet(planSheetId).then(response => {
|
||||
this.currentPlanSheetInfo = response.data;
|
||||
});
|
||||
},
|
||||
// 添加到最近选择的排产单列表
|
||||
addToRecentPlanSheets(planSheet) {
|
||||
// 移除已存在的相同排产单
|
||||
this.recentPlanSheets = this.recentPlanSheets.filter(item => item.planSheetId !== planSheet.planSheetId);
|
||||
|
||||
// 添加到列表开头
|
||||
this.recentPlanSheets.unshift(planSheet);
|
||||
|
||||
// 限制最近选择的数量为5个
|
||||
if (this.recentPlanSheets.length > 5) {
|
||||
this.recentPlanSheets = this.recentPlanSheets.slice(0, 5);
|
||||
}
|
||||
|
||||
// 保存到本地存储
|
||||
this.saveRecentPlanSheets();
|
||||
},
|
||||
// 从本地存储加载最近选择的排产单
|
||||
loadRecentPlanSheets() {
|
||||
try {
|
||||
const stored = localStorage.getItem('recentPlanSheets');
|
||||
if (stored) {
|
||||
this.recentPlanSheets = JSON.parse(stored);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load recent plan sheets:', error);
|
||||
this.recentPlanSheets = [];
|
||||
}
|
||||
},
|
||||
// 保存最近选择的排产单到本地存储
|
||||
saveRecentPlanSheets() {
|
||||
try {
|
||||
localStorage.setItem('recentPlanSheets', JSON.stringify(this.recentPlanSheets));
|
||||
} catch (error) {
|
||||
console.error('Failed to save recent plan sheets:', error);
|
||||
}
|
||||
},
|
||||
// 选择最近的排产单
|
||||
selectRecentPlanSheet(item) {
|
||||
this.currentPlanSheetId = item.planSheetId;
|
||||
this.currentPlanDetail = {};
|
||||
this.currentPlanSheetInfo = item;
|
||||
|
||||
// 更新查询参数
|
||||
this.queryParams.planSheetId = item.planSheetId;
|
||||
|
||||
// 获取排产单明细列表
|
||||
this.getList();
|
||||
},
|
||||
// 处理排产明细行点击事件
|
||||
handlePlanDetailChange(row) {
|
||||
this.currentPlanDetail = row;
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 提交排产明细变更
|
||||
submitDetail() {
|
||||
updatePlanDetail(this.currentPlanDetail).then(response => {
|
||||
@@ -221,159 +446,212 @@ export default {
|
||||
message: "变更保存成功",
|
||||
type: "success"
|
||||
});
|
||||
this.handleQuery();
|
||||
});
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
// 日期默认选中今天 yyyy-MM-dd格式,北京时间
|
||||
// planCode与日期格式一致,添加-HHmmss
|
||||
// 排产人默认当前登录用户 this.$store.getters.nickName
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(now.getDate()).padStart(2, '0');
|
||||
const hours = String(now.getHours()).padStart(2, '0');
|
||||
const minutes = String(now.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(now.getSeconds()).padStart(2, '0');
|
||||
|
||||
const dateStr = `${year}-${month}-${day}`;
|
||||
const timeStr = `${hours}${minutes}${seconds}`;
|
||||
|
||||
this.form = {
|
||||
planSheetId: undefined,
|
||||
planDate: dateStr,
|
||||
lineId: undefined,
|
||||
lineName: undefined,
|
||||
planCode: `${dateStr}-${timeStr}`,
|
||||
planType: undefined,
|
||||
scheduler: this.$store.getters.nickName || undefined,
|
||||
remark: undefined,
|
||||
delFlag: undefined,
|
||||
createBy: undefined,
|
||||
updateBy: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.planSheetId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加排产单";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
// 获取排产单明细列表
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const planSheetId = row.planSheetId || this.ids
|
||||
getPlanSheet(planSheetId).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.planSheetId != null) {
|
||||
updatePlanSheet(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addPlanSheet(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const planSheetIds = row.planSheetId || this.ids;
|
||||
this.$modal.confirm('是否确认删除排产单编号为"' + planSheetIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delPlanSheet(planSheetIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport(row) {
|
||||
this.download('aps/planSheet/exportAll', {
|
||||
listPlanDetail({
|
||||
...this.queryParams,
|
||||
planSheetId: row.planSheetId,
|
||||
}, `planSheet_${new Date().getTime()}.xlsx`)
|
||||
planSheetId: this.currentPlanSheetId,
|
||||
}).then(response => {
|
||||
// 按照序号正序排序
|
||||
this.planDetailList = response.rows.sort((a, b) => {
|
||||
return parseInt(a.bizSeqNo) - parseInt(b.bizSeqNo);
|
||||
});
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 新增明细
|
||||
handleAdd() {
|
||||
const newRow = {
|
||||
planSheetId: this.currentPlanSheetId,
|
||||
bizSeqNo: this.planDetailList.length + 1
|
||||
};
|
||||
|
||||
addPlanDetail(newRow).then(response => {
|
||||
this.$message({
|
||||
message: "新增成功",
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
// 保存行
|
||||
handleSave(row) {
|
||||
updatePlanDetail(row).then(response => {
|
||||
this.$message({
|
||||
message: "保存成功",
|
||||
type: "success"
|
||||
});
|
||||
}).catch(error => {
|
||||
this.$message({
|
||||
message: "保存失败,正在重新获取数据",
|
||||
type: "error"
|
||||
});
|
||||
// 保存失败时获取正确数据
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
// 删除行
|
||||
handleDelete(row) {
|
||||
this.$confirm('是否确认删除该排产单明细?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
delPlanDetail(row.planDetailId).then(response => {
|
||||
this.$message({
|
||||
message: "删除成功",
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
// 打开订单选择对话框
|
||||
openOrderDialog(row) {
|
||||
this.currentEditingRow = row;
|
||||
this.orderDialogVisible = true;
|
||||
this.getOrderList();
|
||||
},
|
||||
// 打开订单明细选择对话框
|
||||
openOrderItemDialog(row) {
|
||||
this.currentEditingRow = row;
|
||||
this.orderItemDialogVisible = true;
|
||||
this.orderItemLoading = true;
|
||||
listOrderItem({ orderId: row.orderId }).then(res => {
|
||||
this.orderItemList = res.rows;
|
||||
this.orderItemLoading = false;
|
||||
});
|
||||
},
|
||||
// 获取订单列表
|
||||
getOrderList() {
|
||||
this.orderLoading = true;
|
||||
listOrder(this.orderQueryParams).then(response => {
|
||||
this.orderList = response.rows;
|
||||
this.orderTotal = response.total;
|
||||
this.orderLoading = false;
|
||||
});
|
||||
},
|
||||
// 重置订单查询参数
|
||||
resetOrderQuery() {
|
||||
this.orderQueryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
contractCode: undefined,
|
||||
customerName: undefined,
|
||||
salesman: undefined
|
||||
};
|
||||
this.getOrderList();
|
||||
},
|
||||
// 选择订单
|
||||
selectOrder(row) {
|
||||
this.currentEditingRow.orderCode = row.orderCode;
|
||||
this.currentEditingRow.contractCode = row.contractCode;
|
||||
this.currentEditingRow.customerName = row.companyName;
|
||||
this.currentEditingRow.salesman = row.salesman;
|
||||
this.currentEditingRow.orderId = row.orderId;
|
||||
this.orderDialogVisible = false;
|
||||
|
||||
// 保存修改
|
||||
this.handleSave(this.currentEditingRow);
|
||||
},
|
||||
// 选择订单明细
|
||||
selectOrderItem(row) {
|
||||
this.currentEditingRow.productName = row.productType;
|
||||
this.currentEditingRow.productMaterial = row.material;
|
||||
this.currentEditingRow.productWidth = row.width;
|
||||
this.currentEditingRow.rollingThick = row.thickness;
|
||||
this.currentEditingRow.markCoatThick = row.thickness;
|
||||
this.currentEditingRow.tonSteelLengthRange = 0;
|
||||
this.currentEditingRow.planQty = row.productNum;
|
||||
this.currentEditingRow.planWeight = row.weight;
|
||||
this.currentEditingRow.surfaceTreatment = row.surfaceTreatment;
|
||||
this.currentEditingRow.productPackaging = row.packagingReq;
|
||||
this.currentEditingRow.widthReq = row.edgeCuttingReq;
|
||||
this.currentEditingRow.productEdgeReq = row.widthTolerance;
|
||||
this.currentEditingRow.usageReq = row.purpose;
|
||||
|
||||
this.orderItemDialogVisible = false;
|
||||
|
||||
// 保存修改
|
||||
this.handleSave(this.currentEditingRow);
|
||||
},
|
||||
// 处理订单行点击
|
||||
handleOrderSelect(row) {
|
||||
this.selectOrder(row);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.detail-form-container {
|
||||
height: 100%;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.detail-card {
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
background-color: #fafafa;
|
||||
.header {
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding: 16px;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
.plan-info {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.card-header h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.plan-info .label {
|
||||
font-weight: 600;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.mb20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.plan-detail-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.el-table .cell {
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.order-dialog-content {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
margin-top: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.appempty {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
::v-deep .el-table .cell {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* ::v-deep .el-input__inner {
|
||||
padding: 0 1px;
|
||||
} */
|
||||
</style>
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
|
||||
@click="handleDelete">删除</el-button>
|
||||
|
||||
@@ -547,6 +547,11 @@ export default {
|
||||
this.splitList = []
|
||||
return
|
||||
}
|
||||
// 如果coildIds不满足格式:coilId1,coilId2,coilId3(任意个coilId),返回空数组, 其中coilId必须是数字字符串
|
||||
if (!coilIds || !/^\d+(,\d+)*$/.test(coilIds)) {
|
||||
this.splitList = []
|
||||
return
|
||||
}
|
||||
const res = await listMaterialCoil({
|
||||
coilIds
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user