订单管理管理模块(维护)

master
wws 2 years ago
parent 7344c017fd
commit b2297f323e

@ -35,9 +35,9 @@ export function getConvert() {
} }
// 获取线体 // 获取线体
export function getprodLineShift() { export function getprodLineShift(orderType) {
return request({ return request({
url: '/mes/order/getProdLineShift', url: '/mes/order/getProdLineShift/'+'?type='+orderType,
method: 'get', method: 'get',
}) })
} }

@ -33,16 +33,24 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="拆分状态" prop="prodDesc"> <el-form-item label="拆分状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择"> <el-select v-model="queryParams.status" placeholder="请选择拆分状态" clearable>
<el-option <el-option
v-for="item in statusOptions" v-for="dict in dict.type.order_status"
:key="item.key" :key="dict.value"
:label="item.value" :label="dict.label"
:value="item.key"> :value="dict.value"
</el-option> />
</el-select> </el-select>
</el-form-item> </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-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
@ -51,6 +59,16 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <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-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@ -130,6 +148,85 @@
</el-table-column> </el-table-column>
</el-table> </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> <el-dialog :title="title" :visible.sync="splitOpen" width="1000px" append-to-body>
<!-- 拆分头pro --> <!-- 拆分头pro -->
@ -252,19 +349,16 @@
export default { export default {
name: "Order", name: "Order",
dicts: ['product_type', 'order_status'],
components: { components: {
Treeselect Treeselect
}, },
data() { data() {
return { return {
// //
statusOptions:[{ form: {},
key:1, //
value:"已拆分" dialogVisible: false,
},{
key:0,
value:"未拆分"
}],
// //
productList:[], productList:[],
// //
@ -312,7 +406,6 @@
refreshTable: true, refreshTable: true,
// //
queryParams: { queryParams: {
status: null,
planFactoryCode: null, planFactoryCode: null,
orderType: null, orderType: null,
orderCode: null, orderCode: null,
@ -345,23 +438,62 @@
}; };
}, },
created() { 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: { methods: {
//
checkNull(entity) {
if (entity !== undefined && entity !== '' && entity !== null){
return 1;
}
return 0;
},
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
this.reset();
done();
})
.catch(_ => {});
},
/** 提交按钮 */ /** 提交按钮 */
submitForm() { 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 => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateOrder(this.form).then(response => { updateOrder(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.dialogVisible = false;
this.reset();
this.getList(); this.getList();
}); });
} else { } else {
addOrder(this.form).then(response => { addOrder(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.dialogVisible = false;
this.reset();
this.getList(); this.getList();
}); });
} }
@ -370,16 +502,19 @@
}, },
/** 检验批次编码是否重复 */ /** 检验批次编码是否重复 */
batchCodeChange(e){ batchCodeChange(e){
for (let i = 1; i < this.formFields.length;i++){ if (this.formFields.length>1){
if (this.formFields[this.formFields.length-1].batchCode == this.formFields[i].batchCode){ for (let i = 0; i < this.formFields.length-1; i++){
this.$message({ if (this.formFields[this.formFields.length-1].batchCode == this.formFields[i].batchCode){
message: '批次号不能重复', this.$message({
type: 'warning' message:'批次号不能重复!',
}) type:'warning'
this.formFields = [{ })
batchCode: '', this.formFields = [{
batchQuantity: '' batchCode: '',
}] batchQuantity: ''
}]
return;
}
} }
} }
}, },
@ -420,6 +555,7 @@
}) })
return; return;
} }
// //
this.splitForm.formFields = this.formFields; this.splitForm.formFields = this.formFields;
// //
@ -457,22 +593,6 @@
batchCode: '', batchCode: '',
batchQuantity: '' 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; // refreshProTablefalse
this.$nextTick(() => {
// 使$nextTickDOM
this.refreshProTable = true; // refreshProTabletrue
this.proLoading = false; // false
});
})
// //
getWorkOrderList(id).then(response => { getWorkOrderList(id).then(response => {
@ -493,23 +613,12 @@
if (check){ if (check){
setTimeout(() => { setTimeout(() => {
this.resetQuery(); this.getList();
// 1 // 1
this.splitOpen = false; this.splitOpen = false;
}, 500); }, 500);
} }
}, },
//
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
} else {
console.log('error submit!!');
return false;
}
});
},
/** 动态添加表单 */ /** 动态添加表单 */
addField() { addField() {
// //
@ -564,13 +673,13 @@
}, },
// //
cancel() { cancel() {
this.splitOpen = false; this.dialogVisible = false;
this.open = false; this.open = false;
this.reset(); this.reset();
}, },
// //
reset() { reset() {
this.splitForm = { this.form = {
id: null, id: null,
planFactoryCode: null, planFactoryCode: null,
orderType: null, orderType: null,
@ -626,7 +735,7 @@
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */ /** 拆分按钮操作 */
handleAdd(row) { handleAdd(row) {
this.reset(); this.reset();
this.getTreeselect(); this.getTreeselect();
@ -694,7 +803,7 @@
// //
this.splitForm.productDate = new Date(); this.splitForm.productDate = new Date();
// //
getprodLineShift().then(response => { getprodLineShift(row.orderType).then(response => {
this.proline = response.data.lines; this.proline = response.data.lines;
this.workShift = response.data.shifts; this.workShift = response.data.shifts;
}); });

Loading…
Cancel
Save