8
0

update blender-order

Este cometimento está contido em:
lb 2023-08-09 09:35:03 +08:00
ascendente 3601b574fb
cometimento bfd6a42349
3 ficheiros modificados com 133 adições e 19 eliminações

Ver ficheiro

@ -1,5 +1,5 @@
{ {
"printWidth": 120, "printWidth": 108,
"bracketSameLine": true, "bracketSameLine": true,
"htmlWhitespaceSensitivity": "ignore", "htmlWhitespaceSensitivity": "ignore",
"semi": true, "semi": true,

Ver ficheiro

@ -279,12 +279,12 @@ export default {
}, },
handleSwitchChange(val) { handleSwitchChange(val) {
console.log("[dialog] switch change: ", val, this.dataForm); // console.log("[dialog] switch change: ", val, this.dataForm);
}, },
handleComponentModelUpdate(propName, { subject, payload: { data } }) { handleComponentModelUpdate(propName, { subject, payload: { data } }) {
this.dataForm[propName] = JSON.stringify(data); this.dataForm[propName] = JSON.stringify(data);
console.log("[DialogJustForm] handleComponentModelUpdate", this.dataForm[propName]); // console.log("[DialogJustForm] handleComponentModelUpdate", this.dataForm[propName]);
}, },
addOrUpdate(method = "POST") { addOrUpdate(method = "POST") {

Ver ficheiro

@ -9,6 +9,7 @@
<el-dialog <el-dialog
class="blender-order-dialog" class="blender-order-dialog"
:visible="visible" :visible="visible"
width="30%"
@close="close" @close="close"
@closed="$emit('destroy')" @closed="$emit('destroy')"
:close-on-click-modal="false" :close-on-click-modal="false"
@ -21,10 +22,40 @@
</div> </div>
<!-- form --> <!-- form -->
<el-form ref="dataForm" :model="dataForm" size="small"> <el-form ref="dataForm" :model="dataForm" v-loading="optionsLoading || formLoading">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6"> <el-col :span="24">
<el-form-item label="订单状态" prop="statusDictValue" :rules="null"></el-form-item> <el-form-item label="混料订单" prop="code" :rules="null">
<el-input v-model="dataForm.code" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item
label="配方"
prop="bomId"
:rules="[{ required: true, message: '必填项不能为空', trigger: 'blur' }]">
<el-select v-model="dataForm.bomId" placeholder="请选择配方">
<el-option v-for="bom in bomList" :key="bom.value" :label="bom.label" :value="bom.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item
label="混料机"
prop="blender"
:rules="[{ required: true, message: '必填项不能为空', trigger: 'blur' }]">
<el-select v-model="dataForm.blender" placeholder="请选择混料机">
<el-option
v-for="bdr in blenderList"
:key="bdr.value"
:label="bdr.label"
:value="bdr.value" />
</el-select>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
@ -32,10 +63,18 @@
<!-- footer --> <!-- footer -->
<div slot="footer"> <div slot="footer">
<!-- TODO: permission 相关内容 未添加 --> <!-- TODO: permission 相关内容 未添加 -->
<el-button v-if="mode.includes('create')" type="primary" @click="handleSave('POST')" :loading="btnLoading"> <el-button
v-if="mode.includes('create')"
type="primary"
@click="handleSave('POST')"
:loading="btnLoading">
保存 保存
</el-button> </el-button>
<el-button v-if="mode.includes('edit')" type="primary" @click="handleSave('PUT')" :loading="btnLoading"> <el-button
v-if="mode.includes('edit')"
type="primary"
@click="handleSave('PUT')"
:loading="btnLoading">
更新 更新
</el-button> </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>
@ -58,29 +97,104 @@ export default {
btnLoading: false, btnLoading: false,
dataForm: { dataForm: {
id: null, id: null,
code: null,
bomId: null,
blender: null,
}, },
bomList: [],
blenderList: [],
}; };
}, },
computed: {}, computed: {},
mounted() {},
methods: { methods: {
init(id) { init({ id, blender, blenderCode, bomCode, bomId, bomName, code, orderCode, orderId }) {
console.log("[blenderOrderEdit] init", id); // console.log("[blenderOrderEdit] init");
this.visible = true; Promise.all([this.getBlenderList(), this.getBomList(bomCode)])
.then((r1, r2) => {
this.dataForm = {
id: id,
code: code,
bomId: bomId,
blender: blender,
};
this.visible = true;
})
.catch((err) => {
console.log(err);
this.close();
});
}, },
close() { close() {
this.visible = false; this.visible = false;
}, },
handleSave(type) { async getBomList(bomCode) {
switch (type) { this.optionsLoading = true;
case "POST": const { data: res } = await this.$http.get("/pms/bom/pageVersion", {
break; params: { key: bomCode, limit: 999, page: 1 },
case "PUT": });
break; this.optionsLoading = false;
if (res.code === 0) {
this.bomList = res.data.list.map((bom) => ({
label: bom.code,
value: bom.id,
}));
} }
}, },
handleReset() {}, async getBlenderList() {
this.optionsLoading = true;
const { data: res } = await this.$http.get("/pms/equipment/list", {
params: { workSequenceName: "混料工序" },
});
this.optionsLoading = false;
if (res.code === 0) {
this.blenderList = res.data.map((bdr) => ({
label: bdr.code,
value: bdr.id,
}));
}
},
handleSave(type) {
this.$refs.dataForm.validate(async (valid) => {
if (valid) {
this.btnLoading = true;
const { id, blender, bomId } = this.dataForm;
const { data: res } = await this.$http.get("/pms/order/changeBlender", {
params: { id, blender, bomId },
});
this.btnLoading = false;
if (res.code == 0) {
this.$message.success("修改成功");
this.close();
this.$emit("refreshDataList");
} else {
this.$message.error(res.msg);
}
}
});
// switch (type) {
// case "POST":
// break;
// case "PUT":
// break;
// }
},
handleReset() {
Object.keys(this.dataForm).forEach((key) => {
if (key != "id" && key != "code") this.dataForm[key] = null;
});
this.$refs.dataForm.clearValidate();
},
}, },
}; };
</script> </script>
<style scoped lang="scss"></style> <style lang="scss">
.blender-order-dialog .el-dialog__body {
padding: 10px 20px;
}
.el-select {
width: 100%;
}
</style>