feat: 生产管理

This commit is contained in:
砂糖
2025-08-26 16:51:23 +08:00
parent 666c42a128
commit 503b30ced5
13 changed files with 838 additions and 466 deletions

View File

@@ -22,7 +22,9 @@
</el-table-column>
<el-table-column label="制造规格">
<template slot-scope="scope">
<MSpecSelect v-model="scope.row.manufacturingSpecIds" />
<el-select v-model="scope.row.manufacturingSpecIds" placeholder="请选择制造规格" multiple>
<el-option v-for="item in manufacturingSpecList" :key="item.specId" :label="item.specName" :value="item.specId" />
</el-select>
</template>
</el-table-column>
</el-table>
@@ -30,7 +32,12 @@
<el-dialog title="产品规范" :visible.sync="specDialogVisible" width="600px" append-to-body>
<ProductSpec v-if="form.groupId" :groupId="form.groupId" :readonly="false"/>
<div v-else>
暂无产品规格
<el-select placeholder="请选择产品规范" @change="handleChangeSpec" style="width: 100%;">
<el-option v-for="item in productSpecList.filter(item => item.productId != this.form.productId)" :key="item.groupId" :label="item.groupName" :value="item.groupId" />
<template #empty>
<el-button type="primary" @click="handleAddSpec">新增产品规范</el-button>
</template>
</el-select>
</div>
</el-dialog>
</div>
@@ -38,11 +45,14 @@
<script>
import OrderSelect from "../components/OrderSelect";
import { listOrderDetail } from "@/api/wms/orderDetail";
import { listOrderDetail, updateOrderDetail } from "@/api/wms/orderDetail";
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
import MSpecSelect from "@/views/work/components/MSpecSelect";
import ProductSpec from "@/views/wms/order/panels/spec.vue";
import { listManufacturingSpec } from "@/api/work/manufacturingSpec";
import { listProductSpecGroup } from "@/api/work/productSpecGroup";
export default {
name: 'CreateByOrder',
components: {
@@ -51,6 +61,14 @@ export default {
MSpecSelect,
ProductSpec
},
created() {
listManufacturingSpec().then(res => {
this.manufacturingSpecList = res.rows;
})
listProductSpecGroup().then(response => {
this.productSpecList = response.rows;
});
},
data() {
return {
order: null,
@@ -58,7 +76,9 @@ export default {
specDialogVisible: false,
form: {
groupId: undefined
}
},
manufacturingSpecList: [],
productSpecList: [],
}
},
methods: {
@@ -72,11 +92,39 @@ export default {
},
handleCreate() {
console.log(this.orderItems);
if (this.orderItems.length === 0) {
this.$message.error('请选择订单');
return;
}
for (const item of this.orderItems) {
if (item.groupId && item.manufacturingSpecIds.length === 0) {
this.$message.error('请选择制造规格');
return;
}
}
this.$emit('create', this.orderItems);
},
handleSpec(row) {
this.specDialogVisible = true;
this.form = row;
},
handleChangeSpec(groupId) {
// 确认更换
this.$modal && this.$modal.confirm('是否确认更换产品规范?').then(() => {
this.form.groupId = groupId;
updateOrderDetail(this.form).then(response => {
this.$modal && this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
});
},
handleAddSpec() {
this.$router.push({
path: '/production/pspec',
});
}
}
}