|
|
|
@ -33,16 +33,24 @@
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="拆分状态" prop="prodDesc">
|
|
|
|
|
<el-select v-model="queryParams.status" placeholder="请选择">
|
|
|
|
|
<el-form-item label="拆分状态" prop="status">
|
|
|
|
|
<el-select v-model="queryParams.status" placeholder="请选择拆分状态" clearable>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in statusOptions"
|
|
|
|
|
:key="item.key"
|
|
|
|
|
:label="item.value"
|
|
|
|
|
:value="item.key">
|
|
|
|
|
</el-option>
|
|
|
|
|
v-for="dict in dict.type.order_status"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label-width="100px" label="计划生产日期" prop="planProDate">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="queryParams.planProDate"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择计划生产日期">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
@ -51,6 +59,16 @@
|
|
|
|
|
</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="dialogVisible = true"
|
|
|
|
|
v-hasPermi="['order:order:add']"
|
|
|
|
|
>新增</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="warning"
|
|
|
|
@ -130,6 +148,85 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<!-- 新增模块 -->
|
|
|
|
|
<el-dialog title="新增订单" :visible.sync="dialogVisible" width="900px" append-to-body :before-close="handleClose">
|
|
|
|
|
<el-form ref="form" :model="form" :rules="addrules" label-width="80px">
|
|
|
|
|
<!-- 第一行 -->
|
|
|
|
|
<el-row>
|
|
|
|
|
<!-- 第一列 -->
|
|
|
|
|
<el-col :offset="1" :span="8">
|
|
|
|
|
<el-form-item label-width="100px" label="物料号" prop="prodCode">
|
|
|
|
|
<el-input v-model="form.prodCode" placeholder="请输入物料号" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<!-- 第二列 -->
|
|
|
|
|
<el-col :offset="2" :span="8">
|
|
|
|
|
<el-form-item label-width="100px" label="计划生产日期" prop="planProDate">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.planProDate"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择计划生产日期">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<!-- 第二行 -->
|
|
|
|
|
<el-row>
|
|
|
|
|
<!-- 第一列 -->
|
|
|
|
|
<el-col :offset="1" :span="8">
|
|
|
|
|
<el-form-item label-width="100px" label="物料名称" prop="prodDesc">
|
|
|
|
|
<el-input v-model="form.prodDesc" placeholder="请输入物料名称" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<!-- 第二列 -->
|
|
|
|
|
<el-col :offset="2" :span="8">
|
|
|
|
|
<el-form-item label-width="100px" label="计划完成日期" prop="planComplete">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.planComplete"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择计划完成日期">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<!-- 第三行 -->
|
|
|
|
|
<el-row>
|
|
|
|
|
<!-- 第一列 -->
|
|
|
|
|
<el-col :offset="1" :span="8">
|
|
|
|
|
<el-form-item label-width="100px" label="订单数量" prop="quantity">
|
|
|
|
|
<el-input v-model="form.quantity" placeholder="请输入订单数量" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<!-- 第二列 -->
|
|
|
|
|
<el-col :offset="2" :span="9">
|
|
|
|
|
<el-form-item label-width="100px" label="单位" prop="unit">
|
|
|
|
|
<el-input v-model="form.unit" placeholder="请输入单位" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :offset="1" :span="8">
|
|
|
|
|
<el-form-item label-width="100px" label="产品类型" prop="prodType">
|
|
|
|
|
<el-select v-model="form.prodType" placeholder="请选择产品类型">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.product_type"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 拆分模块 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="splitOpen" width="1000px" append-to-body>
|
|
|
|
|
<!-- 拆分头pro -->
|
|
|
|
@ -252,19 +349,16 @@
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "Order",
|
|
|
|
|
dicts: ['product_type', 'order_status'],
|
|
|
|
|
components: {
|
|
|
|
|
Treeselect
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 拆分状态选择
|
|
|
|
|
statusOptions:[{
|
|
|
|
|
key:1,
|
|
|
|
|
value:"已拆分"
|
|
|
|
|
},{
|
|
|
|
|
key:0,
|
|
|
|
|
value:"未拆分"
|
|
|
|
|
}],
|
|
|
|
|
// 表单参数
|
|
|
|
|
form: {},
|
|
|
|
|
// 新增模块
|
|
|
|
|
dialogVisible: false,
|
|
|
|
|
//以下为新内容
|
|
|
|
|
productList:[],
|
|
|
|
|
//工单遮罩层
|
|
|
|
@ -312,7 +406,6 @@
|
|
|
|
|
refreshTable: true,
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
status: null,
|
|
|
|
|
planFactoryCode: null,
|
|
|
|
|
orderType: null,
|
|
|
|
|
orderCode: null,
|
|
|
|
@ -345,23 +438,62 @@
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
|
|
|
|
|
|
|
|
|
var 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 date = `${year}-${month}-${day}`;
|
|
|
|
|
|
|
|
|
|
this.loading = true;
|
|
|
|
|
this.queryParams.status = 'o0';
|
|
|
|
|
this.queryParams.planProDate = date;
|
|
|
|
|
listOrder(this.queryParams).then(response => {
|
|
|
|
|
this.orderList = this.handleTree(response.data, "orderCode", "parentOrder");
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 判空、空串
|
|
|
|
|
checkNull(entity) {
|
|
|
|
|
if (entity !== undefined && entity !== '' && entity !== null){
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
},
|
|
|
|
|
handleClose(done) {
|
|
|
|
|
this.$confirm('确认关闭?')
|
|
|
|
|
.then(_ => {
|
|
|
|
|
this.reset();
|
|
|
|
|
done();
|
|
|
|
|
})
|
|
|
|
|
.catch(_ => {});
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
// 表单校验
|
|
|
|
|
if (this.checkNull(this.form.prodCode) == 0 || this.checkNull(this.form.planProDate) == 0 || this.checkNull(this.form.prodDesc) == 0 || this.checkNull(this.form.planComplete) == 0 || this.checkNull(this.form.quantity) == 0 || this.checkNull(this.form.unit) == 0 || this.checkNull(this.form.prodType) == 0){
|
|
|
|
|
this.$message({
|
|
|
|
|
message:'数据不能为空!',
|
|
|
|
|
type:'warning'
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form.id != null) {
|
|
|
|
|
updateOrder(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
addOrder(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -370,16 +502,19 @@
|
|
|
|
|
},
|
|
|
|
|
/** 检验批次编码是否重复 */
|
|
|
|
|
batchCodeChange(e){
|
|
|
|
|
for (let i = 1; i < this.formFields.length;i++){
|
|
|
|
|
if (this.formFields[this.formFields.length-1].batchCode == this.formFields[i].batchCode){
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '批次号不能重复',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
this.formFields = [{
|
|
|
|
|
batchCode: '',
|
|
|
|
|
batchQuantity: ''
|
|
|
|
|
}]
|
|
|
|
|
if (this.formFields.length>1){
|
|
|
|
|
for (let i = 0; i < this.formFields.length-1; i++){
|
|
|
|
|
if (this.formFields[this.formFields.length-1].batchCode == this.formFields[i].batchCode){
|
|
|
|
|
this.$message({
|
|
|
|
|
message:'批次号不能重复!',
|
|
|
|
|
type:'warning'
|
|
|
|
|
})
|
|
|
|
|
this.formFields = [{
|
|
|
|
|
batchCode: '',
|
|
|
|
|
batchQuantity: ''
|
|
|
|
|
}]
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -420,6 +555,7 @@
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//整理订单传入到后端
|
|
|
|
|
this.splitForm.formFields = this.formFields;
|
|
|
|
|
//整理数据往后端发送
|
|
|
|
@ -457,22 +593,6 @@
|
|
|
|
|
batchCode: '',
|
|
|
|
|
batchQuantity: ''
|
|
|
|
|
}],
|
|
|
|
|
// 获取该订单下最新订单列表
|
|
|
|
|
getOrderList(id).then(response => {
|
|
|
|
|
if(response.code == 500){
|
|
|
|
|
this.$modal.msgError(response.msg);
|
|
|
|
|
};
|
|
|
|
|
// 设置最新数据
|
|
|
|
|
this.productData[0] = response.data;
|
|
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
|
|
this.proLoading = true; // 设置加载状态为true,表示正在加载
|
|
|
|
|
this.refreshProTable = false; // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshProTable = true; // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.proLoading = false; // 设置加载状态为false,表示加载完成
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 获取该订单下的最新工单列表
|
|
|
|
|
getWorkOrderList(id).then(response => {
|
|
|
|
@ -493,23 +613,12 @@
|
|
|
|
|
|
|
|
|
|
if (check){
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.resetQuery();
|
|
|
|
|
this.getList();
|
|
|
|
|
// 等待1秒后执行的代码
|
|
|
|
|
this.splitOpen = false;
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 调试
|
|
|
|
|
submitForm(formName) {
|
|
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
alert('submit!');
|
|
|
|
|
} else {
|
|
|
|
|
console.log('error submit!!');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 动态添加表单 */
|
|
|
|
|
addField() {
|
|
|
|
|
//如果批次数量大于等于拆分数量则不允许拆分
|
|
|
|
@ -564,13 +673,13 @@
|
|
|
|
|
},
|
|
|
|
|
// 取消按钮
|
|
|
|
|
cancel() {
|
|
|
|
|
this.splitOpen = false;
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
|
|
|
|
// 表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.splitForm = {
|
|
|
|
|
this.form = {
|
|
|
|
|
id: null,
|
|
|
|
|
planFactoryCode: null,
|
|
|
|
|
orderType: null,
|
|
|
|
@ -626,7 +735,7 @@
|
|
|
|
|
this.resetForm("queryForm");
|
|
|
|
|
this.handleQuery();
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
/** 拆分按钮操作 */
|
|
|
|
|
handleAdd(row) {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.getTreeselect();
|
|
|
|
@ -694,7 +803,7 @@
|
|
|
|
|
//初始化日期为默认今天
|
|
|
|
|
this.splitForm.productDate = new Date();
|
|
|
|
|
//获取成型机和班次
|
|
|
|
|
getprodLineShift().then(response => {
|
|
|
|
|
getprodLineShift(row.orderType).then(response => {
|
|
|
|
|
this.proline = response.data.lines;
|
|
|
|
|
this.workShift = response.data.shifts;
|
|
|
|
|
});
|
|
|
|
|