完成排产(测试过了)

This commit is contained in:
2026-03-08 16:02:44 +08:00
parent b660ddcc3e
commit 7736ac3311
125 changed files with 10418 additions and 15 deletions

View File

@@ -0,0 +1,252 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
<el-form-item label="班次编码" prop="shiftCode">
<el-input v-model="queryParams.shiftCode" placeholder="请输入班次编码" clearable />
</el-form-item>
<el-form-item label="班次名称" prop="shiftName">
<el-input v-model="queryParams.shiftName" placeholder="请输入班次名称" clearable />
</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-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</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>
<KLPTable v-loading="loading" :data="shiftTemplateList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="班次编码" align="center" prop="shiftCode" width="120" />
<el-table-column label="班次名称" align="center" prop="shiftName" width="150" />
<el-table-column label="开始时间" align="center" prop="startTime" width="120" />
<el-table-column label="结束时间" align="center" prop="endTime" width="120" />
<el-table-column label="跨天" align="center" prop="crossDayName" width="80" />
<el-table-column label="效率系数" align="center" prop="efficiencyRate" width="100" />
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
<template slot-scope="scope">
<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>
</template>
</el-table-column>
</KLPTable>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
<!-- 添加或修改班次模板对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="班次编码" prop="shiftCode">
<el-input v-model="form.shiftCode" placeholder="请输入班次编码" />
</el-form-item>
<el-form-item label="班次名称" prop="shiftName">
<el-input v-model="form.shiftName" placeholder="请输入班次名称" />
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-time-picker
v-model="form.startTime"
value-format="HH:mm:ss"
placeholder="选择开始时间"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-time-picker
v-model="form.endTime"
value-format="HH:mm:ss"
placeholder="选择结束时间"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="跨天标识" prop="crossDay">
<el-radio-group v-model="form.crossDay">
<el-radio :label="0">不跨天</el-radio>
<el-radio :label="1">跨天</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="效率系数" prop="efficiencyRate">
<el-input-number v-model="form.efficiencyRate" :min="0" :max="2" :precision="2" :step="0.1" style="width: 100%" />
</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 { listShiftTemplate, getShiftTemplate, delShiftTemplate, addShiftTemplate, updateShiftTemplate, exportShiftTemplate } from "@/api/aps/aps";
export default {
name: "ApsShiftTemplate",
data() {
return {
buttonLoading: false,
loading: true,
ids: [],
single: true,
multiple: true,
showSearch: true,
total: 0,
shiftTemplateList: [],
title: "",
open: false,
queryParams: {
pageNum: 1,
pageSize: 20,
shiftCode: undefined,
shiftName: undefined
},
form: {},
rules: {
shiftCode: [{ required: true, message: "班次编码不能为空", trigger: "blur" }],
shiftName: [{ required: true, message: "班次名称不能为空", trigger: "blur" }],
startTime: [{ required: true, message: "开始时间不能为空", trigger: "change" }],
endTime: [{ required: true, message: "结束时间不能为空", trigger: "change" }]
}
};
},
created() {
this.getList();
},
methods: {
getList() {
this.loading = true;
listShiftTemplate(this.queryParams).then(response => {
this.shiftTemplateList = response.rows;
this.total = response.total;
this.loading = false;
});
},
cancel() {
this.open = false;
this.reset();
},
reset() {
this.form = {
shiftId: undefined,
shiftCode: undefined,
shiftName: undefined,
startTime: undefined,
endTime: undefined,
crossDay: 0,
efficiencyRate: 1,
remark: 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.shiftId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
handleAdd() {
this.reset();
this.open = true;
this.title = "添加班次模板";
},
handleUpdate(row) {
this.loading = true;
this.reset();
const shiftId = row.shiftId || this.ids[0];
getShiftTemplate(shiftId).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.shiftId != null) {
updateShiftTemplate(this.form).then(() => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addShiftTemplate(this.form).then(() => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
handleDelete(row) {
const shiftIds = row.shiftId || this.ids;
this.$modal.confirm('是否确认删除选中的班次模板数据?').then(() => {
this.loading = true;
return delShiftTemplate(shiftIds);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {}).finally(() => {
this.loading = false;
});
},
handleExport() {
this.download('aps/shift-template/export', {
...this.queryParams
}, `shift_template_${new Date().getTime()}.xlsx`);
}
}
};
</script>
<style scoped lang="scss">
.app-container {
padding: 10px;
}
::v-deep .el-table,
::v-deep .el-table--border,
::v-deep .el-table--group {
border-color: #eef2f7;
}
::v-deep .el-table td,
::v-deep .el-table th.is-leaf {
border-bottom: 1px solid #f3f5f8;
}
::v-deep .el-dialog {
border-radius: 8px;
}
</style>