update 订单编辑

This commit is contained in:
lb 2023-07-31 14:39:46 +08:00
parent 3291c1a971
commit 03f65dd6c2

View File

@ -20,7 +20,9 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="订单状态" prop="statusDictValue" :rules="null"> <el-form-item label="订单状态" prop="statusDictValue" :rules="null">
<span style="display: block; margin-top: 32px">{{ dataForm.statusDictValue }}</span> <span style="display: block; margin-top: 32px">
{{ ["等待", "确认", "生产", "暂停", "结束", "接受", "拒绝", "已下发"][dataForm.statusDictValue] }}
</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -28,7 +30,10 @@
label="订单号" label="订单号"
prop="code" prop="code"
:rules="{ required: true, message: '必填项不能为空', trigger: 'blur' }"> :rules="{ required: true, message: '必填项不能为空', trigger: 'blur' }">
<el-input v-model="dataForm.code" v-bind="{ placeholder: '输入订单号' }"></el-input> <el-input
v-model="dataForm.code"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入订单号' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -44,7 +49,10 @@
transform: (val) => Number(val), transform: (val) => Number(val),
}, },
]"> ]">
<el-input v-model="dataForm.cate" v-bind="{ placeholder: '输入订单子号' }"></el-input> <el-input
v-model="dataForm.cate"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入订单子号' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -58,7 +66,8 @@
placeholder: '选择计划开始时间', placeholder: '选择计划开始时间',
type: 'datetime', type: 'datetime',
'value-format': 'yyyy-MM-ddTHH:mm:ss', 'value-format': 'yyyy-MM-ddTHH:mm:ss',
}"></el-date-picker> }"
:disabled="mode.includes('detail')"></el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -75,6 +84,7 @@
v-model="dataForm.press" v-model="dataForm.press"
filterable filterable
clearable clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择压机', filterable: true }"> v-bind="{ placeholder: '选择压机', filterable: true }">
<el-option <el-option
v-for="opt in pressOptions" v-for="opt in pressOptions"
@ -100,6 +110,7 @@
v-model="dataForm.blender" v-model="dataForm.blender"
filterable filterable
clearable clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择混料机', filterable: true }"> v-bind="{ placeholder: '选择混料机', filterable: true }">
<el-option <el-option
v-for="opt in blenderOptions" v-for="opt in blenderOptions"
@ -122,6 +133,7 @@
v-model="dataForm.kiln" v-model="dataForm.kiln"
filterable filterable
clearable clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择隧道窑', filterable: true }"> v-bind="{ placeholder: '选择隧道窑', filterable: true }">
<el-option <el-option
v-for="opt in kilnOptions" v-for="opt in kilnOptions"
@ -140,7 +152,10 @@
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="Add on" prop="sapParam1" :rules="null"> <el-form-item label="Add on" prop="sapParam1" :rules="null">
<el-input v-model="dataForm.sapParam1" v-bind="{ placeholder: '输入addon' }"></el-input> <el-input
v-model="dataForm.sapParam1"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入addon' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -151,6 +166,7 @@
v-model="dataForm.bomId" v-model="dataForm.bomId"
filterable filterable
clearable clearable
:disabled="mode.includes('detail')"
@change="handleBomChange" @change="handleBomChange"
v-bind="{ placeholder: '选择配方号', filterable: true }"> v-bind="{ placeholder: '选择配方号', filterable: true }">
<el-option <el-option
@ -181,6 +197,7 @@
v-model="dataForm.ai" v-model="dataForm.ai"
filterable filterable
clearable clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '请选择版本' }" v-bind="{ placeholder: '请选择版本' }"
@change="handleVersionChange"> @change="handleVersionChange">
<el-option <el-option
@ -199,6 +216,7 @@
v-model="dataForm.packTech" v-model="dataForm.packTech"
filterable filterable
clearable clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择包装代码', filterable: true }"> v-bind="{ placeholder: '选择包装代码', filterable: true }">
<el-option <el-option
v-for="opt in packOptions" v-for="opt in packOptions"
@ -223,6 +241,7 @@
v-model="dataForm.productId" v-model="dataForm.productId"
filterable filterable
clearable clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择物料', filterable: true }"> v-bind="{ placeholder: '选择物料', filterable: true }">
<el-option <el-option
v-for="opt in productOptions" v-for="opt in productOptions"
@ -245,6 +264,7 @@
v-model="dataForm.shape" v-model="dataForm.shape"
filterable filterable
clearable clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择砖型', filterable: true }"> v-bind="{ placeholder: '选择砖型', filterable: true }">
<el-option <el-option
v-for="opt in shapeOptions" v-for="opt in shapeOptions"
@ -274,7 +294,10 @@
transform: (val) => Number(val), transform: (val) => Number(val),
}, },
]"> ]">
<el-input v-model="dataForm.sapParam6" v-bind="{ placeholder: '输入烧成温度' }"></el-input> <el-input
v-model="dataForm.sapParam6"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入烧成温度' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -290,7 +313,10 @@
transform: (val) => Number(val), transform: (val) => Number(val),
}, },
]"> ]">
<el-input v-model="dataForm.sapParam7" v-bind="{ placeholder: '输入烧成时间' }"></el-input> <el-input
v-model="dataForm.sapParam7"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入烧成时间' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -300,7 +326,10 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="生产订单类型" prop="specifications" :rules="null"> <el-form-item label="生产订单类型" prop="specifications" :rules="null">
<el-input v-model="dataForm.specifications" v-bind="{ placeholder: '输入生产订单类型' }"></el-input> <el-input
v-model="dataForm.specifications"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入生产订单类型' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -316,7 +345,10 @@
transform: (val) => Number(val), transform: (val) => Number(val),
}, },
]"> ]">
<el-input v-model="dataForm.prodqty" v-bind="{ placeholder: '输入要求生产的数量' }"></el-input> <el-input
v-model="dataForm.prodqty"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入要求生产的数量' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -331,7 +363,10 @@
transform: (val) => Number(val), transform: (val) => Number(val),
}, },
]"> ]">
<el-input v-model="dataForm.yieldqty" v-bind="{ placeholder: '输入已经生产的数量' }"></el-input> <el-input
v-model="dataForm.yieldqty"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入已经生产的数量' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -347,7 +382,10 @@
transform: (val) => Number(val), transform: (val) => Number(val),
}, },
]"> ]">
<el-input v-model="dataForm.pcsKilnCar" v-bind="{ placeholder: '输入托盘码放砖数' }"></el-input> <el-input
v-model="dataForm.pcsKilnCar"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入托盘码放砖数' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -357,12 +395,18 @@
label="销售订单号" label="销售订单号"
prop="saleNo" prop="saleNo"
:rules="{ required: true, message: '必填项不能为空', trigger: 'blur' }"> :rules="{ required: true, message: '必填项不能为空', trigger: 'blur' }">
<el-input v-model="dataForm.saleNo" v-bind="{ placeholder: '输入销售订单号' }"></el-input> <el-input
v-model="dataForm.saleNo"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入销售订单号' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="销售订单item号" prop="saleOrderItem" :rules="null"> <el-form-item label="销售订单item号" prop="saleOrderItem" :rules="null">
<el-input v-model="dataForm.saleOrderItem" v-bind="{ placeholder: '输入销售订单item号' }"></el-input> <el-input
v-model="dataForm.saleOrderItem"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入销售订单item号' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -378,7 +422,10 @@
transform: (val) => Number(val), transform: (val) => Number(val),
}, },
]"> ]">
<el-input v-model="dataForm.soqty" v-bind="{ placeholder: '输入销售订单砖数' }"></el-input> <el-input
v-model="dataForm.soqty"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '输入销售订单砖数' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -386,7 +433,10 @@
label="销售时间" label="销售时间"
prop="deliveryTime" prop="deliveryTime"
:rules="{ required: true, message: '必填项不能为空', trigger: 'blur' }"> :rules="{ required: true, message: '必填项不能为空', trigger: 'blur' }">
<el-date-picker v-model="dataForm.deliveryTime" v-bind="{ placeholder: '选择销售时间' }"></el-date-picker> <el-date-picker
v-model="dataForm.deliveryTime"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择销售时间' }"></el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -396,7 +446,12 @@
label="客户" label="客户"
prop="customerId" prop="customerId"
:rules="{ required: true, message: '必填项不能为空', trigger: 'blur' }"> :rules="{ required: true, message: '必填项不能为空', trigger: 'blur' }">
<el-select v-model="dataForm.customerId" filterable clearable v-bind="{ placeholder: '选择客户' }"> <el-select
v-model="dataForm.customerId"
filterable
clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择客户' }">
<el-option <el-option
v-for="opt in clientOptions" v-for="opt in clientOptions"
:key="opt.label + opt.value" :key="opt.label + opt.value"
@ -421,9 +476,12 @@
<el-col :span="6"></el-col> <el-col :span="6"></el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6"> <el-col>
<el-form-item label="备注" prop="remark" :rules="null"> <el-form-item label="备注" prop="remark" :rules="null">
<el-input v-model="dataForm.remark" v-bind="{ placeholder: '备注' }"></el-input> <el-input
v-model="dataForm.remark"
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '备注' }"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -433,8 +491,12 @@
<!-- footer --> <!-- footer -->
<div slot="footer"> <div slot="footer">
<!-- TODO: permission 相关内容 未添加 --> <!-- TODO: permission 相关内容 未添加 -->
<el-button v-if="mode.includes('create')" type="primary" @click="handleSave('POST')">保存</el-button> <el-button v-if="mode.includes('create')" type="primary" @click="handleSave('POST')" :loading="btnLoading">
<el-button v-if="mode.includes('edit')" type="primary" @click="handleSave('PUT')">更新</el-button> 保存
</el-button>
<el-button v-if="mode.includes('edit')" type="primary" @click="handleSave('PUT')" :loading="btnLoading">
更新
</el-button>
<el-button v-if="mode.includes('reset')" type="warning" @click="handleReset">重置</el-button> <el-button v-if="mode.includes('reset')" type="warning" @click="handleReset">重置</el-button>
<el-button @click="handleClose">取消</el-button> <el-button @click="handleClose">取消</el-button>
</div> </div>
@ -592,6 +654,7 @@ export default {
], ],
promiseList: [], promiseList: [],
bomId: null, bomId: null,
btnLoading: false,
}; };
}, },
@ -697,8 +760,9 @@ export default {
console.log("[handleVersionChange] new bomID", this.bomId); console.log("[handleVersionChange] new bomID", this.bomId);
}, },
async init(id) { async init(id, detail_mode) {
this.visible = true; this.visible = true;
this.mode = detail_mode ? "#detail" : id ? "#edit#reset" : "#create#reset";
await this.prepareSelectOptions(); await this.prepareSelectOptions();
if (this.$refs.dataForm) { if (this.$refs.dataForm) {
@ -707,8 +771,6 @@ export default {
this.$refs.dataForm.clearValidate(); this.$refs.dataForm.clearValidate();
} }
if (id) this.mode = "#edit#reset";
this.$nextTick(() => { this.$nextTick(() => {
this.dataForm.id = id || null; this.dataForm.id = id || null;
if (this.dataForm.id) { if (this.dataForm.id) {
@ -750,20 +812,23 @@ export default {
this.$forceUpdate(); this.$forceUpdate();
}, },
async handleSave(method = "POST") { handleSave(method = "POST") {
this.$refs.dataForm.validate((valid) => { this.$refs.dataForm.validate(async (valid) => {
if (valid) { if (valid) {
this.btnLoading = true; this.btnLoading = true;
try { try {
const { data: res } = this.$http({ const { data: res } = await this.$http({
url: this.urls.base, url: this.urls.base,
method, method,
data: { data: {
...this.dataForm, ...this.dataForm,
bomId: this.bomId != null ? this.bomId : this.dataForm.bomId, bomId: this.bomId != null ? this.bomId : this.dataForm.bomId,
brand: null, // BOM ID
ai: null, // BOM ID
}, },
}); });
console.log("herer.......", res);
if (res && res.code == 0) { if (res && res.code == 0) {
this.$message.success("添加成功"); this.$message.success("添加成功");
this.$emit("refreshDataList"); this.$emit("refreshDataList");
@ -780,7 +845,12 @@ export default {
}); });
}, },
handleReset() {}, handleReset() {
this.bomId = null;
Object.keys(this.dataForm).forEach((k) => {
this.dataForm[k] = null;
});
},
handleClose() { handleClose() {
this.visible = false; this.visible = false;