Commit 6f86e825 authored by 528360026@qq.com's avatar 528360026@qq.com

更改组合单创建根据组合规格多个组合规则自动产生多个组合单

parent dc9b3799
...@@ -105,28 +105,30 @@ ...@@ -105,28 +105,30 @@
> >
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建人" align="center" prop="createBy"/>
<el-table-column label="创建时间" align="center" prop="createTime"/>
<!-- <el-table-column label="序号" align="center" prop="combinationSort"/>--> <!-- <el-table-column label="序号" align="center" prop="combinationSort"/>-->
<!-- <el-table-column label="生产工单号" align="center" prop="workorderCode"/>--> <!-- <el-table-column label="生产工单号" align="center" prop="workorderCode"/>-->
<!-- <el-table-column label="销售订单号" align="center" prop="salesOrderNumber"/>--> <!-- <el-table-column label="销售订单号" align="center" prop="salesOrderNumber"/>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<template slot-scope="scope"> <!-- <template slot-scope="scope">-->
<el-button <!-- <el-button-->
size="mini" <!-- size="mini"-->
type="text" <!-- type="text"-->
icon="el-icon-edit" <!-- icon="el-icon-edit"-->
@click="handleUpdate(scope.row)" <!-- @click="handleUpdate(scope.row)"-->
v-hasPermi="['pro:combination:edit']" <!-- v-hasPermi="['pro:combination:edit']"-->
>修改 <!-- >修改-->
</el-button> <!-- </el-button>-->
<el-button <!-- <el-button-->
size="mini" <!-- size="mini"-->
type="text" <!-- type="text"-->
icon="el-icon-delete" <!-- icon="el-icon-delete"-->
@click="handleDelete(scope.row)" <!-- @click="handleDelete(scope.row)"-->
v-hasPermi="['pro:combination:remove']" <!-- v-hasPermi="['pro:combination:remove']"-->
>删除 <!-- >删除-->
</el-button> <!-- </el-button>-->
</template> <!-- </template>-->
</el-table-column> </el-table-column>
</el-table> </el-table>
......
...@@ -99,7 +99,8 @@ ...@@ -99,7 +99,8 @@
<el-table-column label="组合单号" align="center" prop="combinationCode"/> <el-table-column label="组合单号" align="center" prop="combinationCode"/>
<el-table-column label="序号" align="center" width prop="combinationSort"> <el-table-column label="序号" align="center" width prop="combinationSort">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number v-model="scope.row.combinationSort" @change="handleChangeSort(scope.row)" :min="0" style="width: 140px" <el-input-number v-model="scope.row.combinationSort" @change="handleChangeSort(scope.row)" :min="0"
style="width: 140px"
label="序号"></el-input-number> label="序号"></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
...@@ -229,18 +230,23 @@ export default { ...@@ -229,18 +230,23 @@ export default {
watch: { watch: {
combinationCode: { combinationCode: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
if (newVal) { this.$nextTick(() => {
this.queryParams.combinationCode = newVal; this.queryParams.combinationCode = newVal;
this.getList(); this.getList();
} })
}, },
immediate: true immediate: true,
deep: true
} }
}, },
created() { created() {
this.getList(); // this.getList();
}, },
methods: { methods: {
changeCombination(combinationCode) {
this.queryParams.combinationCode = combinationCode;
this.getList();
},
handleChangeSort(item) { handleChangeSort(item) {
updateCombination({...item}).then(response => { updateCombination({...item}).then(response => {
}); });
......
<template>
<div>
<el-tabs type="border-card">
<el-tab-pane v-for="item in combinationCodes">
<div slot="label" @click="changeCombination(item)">{{ item }}
</div>
<CombinationInfo ref="caonima" :combinationCode="combinationCode"></CombinationInfo>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import CombinationInfo from "./info.vue";
import Da from "element-ui/src/locale/lang/da";
export default {
name: "CombinationInfos",
components: {CombinationInfo},
props: {
combinationCodes: {
type: Array,
default: null
}
},
data() {
return {combinationCode: '', key: ''}
},
watch: {
combinationCodes: {
handler(newVal, oldVal) {
this.$nextTick(() => {
this.combinationCode = this.combinationCodes[0]
})
},
immediate: true
}
},
created() {
},
methods: {
changeCombination(combinationCode) {
this.$nextTick(() => {
this.combinationCode = combinationCode
this.$refs.caonima[0].changeCombination(combinationCode)
})
}
}
};
</script>
<style scoped>
</style>
...@@ -757,8 +757,9 @@ ...@@ -757,8 +757,9 @@
</el-dialog> </el-dialog>
<el-dialog title="组合单明细" :visible.sync="combOpen" width="800px" append-to-body @close="getList"> <el-dialog title="组合单明细" v-if="combOpen" :visible.sync="combOpen" width="800px" append-to-body
<CombinationInfo :combinationCode="combinationCode"></CombinationInfo> @close="getList">
<CombinationInfos :combinationCodes="combinationCodes"></CombinationInfos>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
...@@ -784,7 +785,7 @@ import Treeselect from "@riophae/vue-treeselect"; ...@@ -784,7 +785,7 @@ import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {getToken} from "@/utils/auth"; import {getToken} from "@/utils/auth";
import {addCombination, batchAddCombination} from "@/api/mes/pro/combination"; import {addCombination, batchAddCombination} from "@/api/mes/pro/combination";
import CombinationInfo from "@/views/mes/pro/combination/info.vue"; import CombinationInfos from "@/views/mes/pro/combination/infos.vue";
import {batchAddArrange} from "@/api/mes/pro/arrange"; import {batchAddArrange} from "@/api/mes/pro/arrange";
export default { export default {
...@@ -795,7 +796,7 @@ export default { ...@@ -795,7 +796,7 @@ export default {
"mes_workorder_type", "mes_workorder_type",
], ],
components: { components: {
CombinationInfo, CombinationInfos,
Treeselect, Treeselect,
ItemSelect, ItemSelect,
ClientSelect, ClientSelect,
...@@ -809,7 +810,7 @@ export default { ...@@ -809,7 +810,7 @@ export default {
autoGenFlag: false, autoGenFlag: false,
optType: undefined, optType: undefined,
combOpen: false, combOpen: false,
combinationCode: [], combinationCodes: [],
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 显示搜索条件 // 显示搜索条件
...@@ -909,7 +910,7 @@ export default { ...@@ -909,7 +910,7 @@ export default {
methods: { methods: {
showCombDetail(combinationCode) { showCombDetail(combinationCode) {
this.combOpen = true; this.combOpen = true;
this.combinationCode = combinationCode; this.combinationCodes = [combinationCode];
}, },
async handleArrange() { async handleArrange() {
...@@ -936,26 +937,33 @@ export default { ...@@ -936,26 +937,33 @@ export default {
}, },
async handleCombination() { async handleCombination() {
let params = [] let params = []
this.selectedRows.forEach((item, index) => { let hasNonEmptyCombination = false;
if (item.combinationCode != '') { this.selectedRows.every((item, index) => {
if (item.combinationCode != '' && item.combinationCode != null) {
this.$modal.msgWarning(`${item.workorderCode}生产单已绑定组合单,不能再绑定!`); this.$modal.msgWarning(`${item.workorderCode}生产单已绑定组合单,不能再绑定!`);
return hasNonEmptyCombination = true;
return false; // 结束every循环
} }
return true; // 继续检查下一个项
}); });
this.selectedRows.forEach((item, index) => { if (!hasNonEmptyCombination) {
params.push({ this.selectedRows.forEach((item, index) => {
combinationSort: index + 1, params.push({
workorderId: item.workorderId, combinationSort: index + 1,
workorderCode: item.workorderCode, workorderId: item.workorderId,
salesOrderId: 0, workorderCode: item.workorderCode,
combinationCode: null salesOrderId: 0,
}) combinationCode: null
}); })
});
batchAddCombination(params).then(response => { batchAddCombination(params).then(response => {
this.$modal.msgSuccess("新增组合单成功"); this.combOpen = true
this.getList(); this.combinationCodes = response
}); this.$modal.msgSuccess("新增组合单成功");
this.getList();
});
}
}, },
/** 查询生产工单列表 */ /** 查询生产工单列表 */
getList() { getList() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment