update 订单编辑

Šī revīzija ir iekļauta:
lb 2023-07-31 14:39:46 +08:00
vecāks 3291c1a971
revīzija 03f65dd6c2

Parādīt failu

@ -20,7 +20,9 @@
<el-row :gutter="20">
<el-col :span="6">
<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-col>
<el-col :span="6">
@ -28,7 +30,10 @@
label="订单号"
prop="code"
: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-col>
<el-col :span="6">
@ -44,7 +49,10 @@
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-col>
<el-col :span="6">
@ -58,7 +66,8 @@
placeholder: '选择计划开始时间',
type: 'datetime',
'value-format': 'yyyy-MM-ddTHH:mm:ss',
}"></el-date-picker>
}"
:disabled="mode.includes('detail')"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
@ -75,6 +84,7 @@
v-model="dataForm.press"
filterable
clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择压机', filterable: true }">
<el-option
v-for="opt in pressOptions"
@ -100,6 +110,7 @@
v-model="dataForm.blender"
filterable
clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择混料机', filterable: true }">
<el-option
v-for="opt in blenderOptions"
@ -122,6 +133,7 @@
v-model="dataForm.kiln"
filterable
clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择隧道窑', filterable: true }">
<el-option
v-for="opt in kilnOptions"
@ -140,7 +152,10 @@
</el-col>
<el-col :span="6">
<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-col>
</el-row>
@ -151,6 +166,7 @@
v-model="dataForm.bomId"
filterable
clearable
:disabled="mode.includes('detail')"
@change="handleBomChange"
v-bind="{ placeholder: '选择配方号', filterable: true }">
<el-option
@ -181,6 +197,7 @@
v-model="dataForm.ai"
filterable
clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '请选择版本' }"
@change="handleVersionChange">
<el-option
@ -199,6 +216,7 @@
v-model="dataForm.packTech"
filterable
clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择包装代码', filterable: true }">
<el-option
v-for="opt in packOptions"
@ -223,6 +241,7 @@
v-model="dataForm.productId"
filterable
clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择物料', filterable: true }">
<el-option
v-for="opt in productOptions"
@ -245,6 +264,7 @@
v-model="dataForm.shape"
filterable
clearable
:disabled="mode.includes('detail')"
v-bind="{ placeholder: '选择砖型', filterable: true }">
<el-option
v-for="opt in shapeOptions"
@ -274,7 +294,10 @@
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-col>
<el-col :span="6">
@ -290,7 +313,10 @@
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-col>
</el-row>
@ -300,7 +326,10 @@
<el-row :gutter="20">
<el-col :span="6">
<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-col>
<el-col :span="6">
@ -316,7 +345,10 @@
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-col>
<el-col :span="6">
@ -331,7 +363,10 @@
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-col>
<el-col :span="6">
@ -347,7 +382,10 @@
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-col>
</el-row>
@ -357,12 +395,18 @@
label="销售订单号"
prop="saleNo"
: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-col>
<el-col :span="6">
<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-col>
<el-col :span="6">
@ -378,7 +422,10 @@
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-col>
<el-col :span="6">
@ -386,7 +433,10 @@
label="销售时间"
prop="deliveryTime"
: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-col>
</el-row>
@ -396,7 +446,12 @@
label="客户"
prop="customerId"
: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
v-for="opt in clientOptions"
:key="opt.label + opt.value"
@ -421,9 +476,12 @@
<el-col :span="6"></el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6">
<el-col>
<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-col>
</el-row>
@ -433,8 +491,12 @@
<!-- footer -->
<div slot="footer">
<!-- TODO: permission 相关内容 未添加 -->
<el-button v-if="mode.includes('create')" type="primary" @click="handleSave('POST')">保存</el-button>
<el-button v-if="mode.includes('edit')" type="primary" @click="handleSave('PUT')">更新</el-button>
<el-button v-if="mode.includes('create')" type="primary" @click="handleSave('POST')" :loading="btnLoading">
保存
</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 @click="handleClose">取消</el-button>
</div>
@ -592,6 +654,7 @@ export default {
],
promiseList: [],
bomId: null,
btnLoading: false,
};
},
@ -697,8 +760,9 @@ export default {
console.log("[handleVersionChange] new bomID", this.bomId);
},
async init(id) {
async init(id, detail_mode) {
this.visible = true;
this.mode = detail_mode ? "#detail" : id ? "#edit#reset" : "#create#reset";
await this.prepareSelectOptions();
if (this.$refs.dataForm) {
@ -707,8 +771,6 @@ export default {
this.$refs.dataForm.clearValidate();
}
if (id) this.mode = "#edit#reset";
this.$nextTick(() => {
this.dataForm.id = id || null;
if (this.dataForm.id) {
@ -750,20 +812,23 @@ export default {
this.$forceUpdate();
},
async handleSave(method = "POST") {
this.$refs.dataForm.validate((valid) => {
handleSave(method = "POST") {
this.$refs.dataForm.validate(async (valid) => {
if (valid) {
this.btnLoading = true;
try {
const { data: res } = this.$http({
const { data: res } = await this.$http({
url: this.urls.base,
method,
data: {
...this.dataForm,
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) {
this.$message.success("添加成功");
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() {
this.visible = false;