|
|
@@ -1,103 +1,173 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <ele-modal
|
|
|
- width="80vw"
|
|
|
- :visible.sync="visible"
|
|
|
- :close-on-click-modal="false"
|
|
|
- row-key="code"
|
|
|
- custom-class="ele-dialog-form"
|
|
|
- :title="'齐套性检查'"
|
|
|
- :maxable="true"
|
|
|
- >
|
|
|
- <div class="form-wrapper">
|
|
|
- <div v-if="leftShow" :style="{width: leftWidth}">
|
|
|
- <el-tree :expand-on-click-node="false" :data="cardList" :props="treeProps" @node-click="handleNodeClick"></el-tree>
|
|
|
- </div>
|
|
|
- <div :style="{width: rightWidth}">
|
|
|
- <div v-if="!leftShow" class="planInfo">
|
|
|
- <el-row style="width: 100%;">
|
|
|
-<!-- <el-col :span="planInfo.salesCode ? 6 : planInfo.salesCode.length * 6">-->
|
|
|
-<!-- <div style="color: blue; display: flex;">-->
|
|
|
-<!-- <div>销售单号:</div><div v-if="planInfo.salesCode"><span v-for="item in planInfo.salesCode"> {{item}}</span></div>-->
|
|
|
-<!-- </div>-->
|
|
|
-<!-- </el-col>-->
|
|
|
- <el-col :span="6">
|
|
|
- 销售单号:{{orderInfo.code}}
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- 编号:{{orderInfo.productCode}}
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- 名称:{{orderInfo.productName}}
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- 规格:{{orderInfo.specification}}
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- 型号:{{orderInfo.model}}
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- 合同数量:{{orderInfo.contractNum}}
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <ele-modal
|
|
|
+ width="80vw"
|
|
|
+ :visible.sync="visible"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ row-key="code"
|
|
|
+ custom-class="ele-dialog-form"
|
|
|
+ :title="'齐套性检查'"
|
|
|
+ :maxable="true"
|
|
|
+ >
|
|
|
+ <div class="form-wrapper" v-loading="loading">
|
|
|
+ <div v-show="leftShow" :style="{ width: leftWidth }">
|
|
|
+ <el-tree
|
|
|
+ ref="treeRef"
|
|
|
+ :expand-on-click-node="false"
|
|
|
+ :data="cardList"
|
|
|
+ :props="treeProps"
|
|
|
+ node-key="id"
|
|
|
+ highlight-current
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ ></el-tree>
|
|
|
</div>
|
|
|
- <div>
|
|
|
- <ele-pro-table
|
|
|
- ref="table"
|
|
|
- :needPage="false"
|
|
|
- :columns="columns"
|
|
|
- key="checkTable"
|
|
|
- :init-load="false"
|
|
|
- :datasource="datasource"
|
|
|
- >
|
|
|
- <template v-slot:stockCount="{ row }">
|
|
|
- <el-link type="primary" :underline="false" @click="stockDetail(row)">
|
|
|
- {{ row.stockCount }}
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
- <template v-slot:currentCount="{ row }">
|
|
|
- <el-link type="primary" :underline="false" @click="currentDetail(row)">
|
|
|
- {{ row.currentCount }}
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
- <template v-slot:stockColor="{ row }">
|
|
|
- <div :class="{'statusRed' : row.stockStatus == '缺料'}">
|
|
|
- {{row.stockStatus}}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template v-slot:currentColor="{ row }">
|
|
|
- <div :class="{'statusRed' : row.currentStatus == '缺料'}">
|
|
|
- {{row.currentStatus}}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template v-slot:finishColor="{ row }">
|
|
|
- <div :class="{'statusRed' : row.finishStatus == '缺料'}">
|
|
|
- {{row.finishStatus}}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template v-slot:finishCount="{ row }">
|
|
|
- <div>
|
|
|
- <div v-if="row.finishCount > 0">{{row.finishCount}}</div>
|
|
|
- <div v-else>-</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </ele-pro-table>
|
|
|
+ <div :style="{ width: rightWidth }">
|
|
|
+ <div v-if="!leftShow" class="planInfo">
|
|
|
+ <el-row style="width: 100%">
|
|
|
+ <!-- <el-col :span="planInfo.salesCode ? 6 : planInfo.salesCode.length * 6">-->
|
|
|
+ <!-- <div style="color: blue; display: flex;">-->
|
|
|
+ <!-- <div>销售单号:</div><div v-if="planInfo.salesCode"><span v-for="item in planInfo.salesCode"> {{item}}</span></div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </el-col>-->
|
|
|
+ <el-col :span="6"> 销售单号:{{ orderInfo.code }} </el-col>
|
|
|
+ <el-col :span="6"> 编号:{{ orderInfo.productCode }} </el-col>
|
|
|
+ <el-col :span="6"> 名称:{{ orderInfo.productName }} </el-col>
|
|
|
+ <el-col :span="6"> 规格:{{ orderInfo.specification }} </el-col>
|
|
|
+ <el-col :span="6"> 型号:{{ orderInfo.model }} </el-col>
|
|
|
+ <el-col :span="6"> 合同数量:{{ orderInfo.contractNum }} </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :needPage="false"
|
|
|
+ :columns="columns"
|
|
|
+ key="checkTable"
|
|
|
+ :init-load="false"
|
|
|
+ :datasource="datasourceList"
|
|
|
+ >
|
|
|
+ <template v-slot:toolkit>
|
|
|
+ <el-form
|
|
|
+ :inline="true"
|
|
|
+ :model="formInline"
|
|
|
+ class="demo-form-inline"
|
|
|
+ >
|
|
|
+ <el-form-item label="BOM类型">
|
|
|
+ <el-select
|
|
|
+ size="mini"
|
|
|
+ v-model="formInline.bomType"
|
|
|
+ placeholder="BOM类型"
|
|
|
+ class="select-type"
|
|
|
+ @change="bomTypeChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in bomListType"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.bomName"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="BOM版本">
|
|
|
+ <el-select
|
|
|
+ class="select-type"
|
|
|
+ size="mini"
|
|
|
+ v-model="formInline.bomId"
|
|
|
+ placeholder="BOM版本"
|
|
|
+ @change="bomVChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in bomListV"
|
|
|
+ :key="item.bomId"
|
|
|
+ :label="item.versions"
|
|
|
+ :value="item.bomId"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="最终状态">
|
|
|
+ <el-select
|
|
|
+ class="select-type"
|
|
|
+ size="mini"
|
|
|
+ v-model="formInline.finalState"
|
|
|
+ placeholder="最终状态"
|
|
|
+ @change="finalChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in finalStateList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </template>
|
|
|
+ <template v-slot:stockCount="{ row }">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="stockDetail(row)"
|
|
|
+ >
|
|
|
+ {{ row.stockCount }}
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ <template v-slot:currentCount="{ row }">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="currentDetail(row)"
|
|
|
+ >
|
|
|
+ {{ row.currentCount }}
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ <template v-slot:stockColor="{ row }">
|
|
|
+ <div :class="{ statusRed: row.stockStatus == '缺料' }">
|
|
|
+ {{ row.stockStatus }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-slot:currentColor="{ row }">
|
|
|
+ <div :class="{ statusRed: row.currentStatus == '缺料' }">
|
|
|
+ {{ row.currentStatus }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-slot:finishColor="{ row }">
|
|
|
+ <div :class="{ statusRed: row.finishStatus == '缺料' }">
|
|
|
+ {{ row.finishStatus }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-slot:finishCount="{ row }">
|
|
|
+ <div>
|
|
|
+ <div v-if="row.finishCount > 0">{{ row.finishCount }}</div>
|
|
|
+ <div v-else>-</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div slot="footer">
|
|
|
- <el-button plain @click="cancel">取消</el-button>
|
|
|
- <el-button type="primary" @click="confirm">确定</el-button>
|
|
|
- </div>
|
|
|
- </ele-modal>
|
|
|
+ <div slot="footer">
|
|
|
+ <el-button plain @click="cancel">取消</el-button>
|
|
|
+ <el-button type="primary" @click="confirm">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </ele-modal>
|
|
|
|
|
|
- <stockDetailDialog ref="stockDetailDialog" />
|
|
|
+ <stockDetailDialog ref="stockDetailDialog" />
|
|
|
|
|
|
- <currentDetailDialog ref="currentDetailDialog" />
|
|
|
+ <currentDetailDialog ref="currentDetailDialog" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {
|
|
|
+ homogeneityInspect,
|
|
|
+ homogeneityInspectMerge,
|
|
|
+ findBomSalesorderCategoryId,
|
|
|
+ findMaterialInfoSalesorder,
|
|
|
+ getBom
|
|
|
+ } from '@/api/productionPlan/index.js';
|
|
|
import { orderHomogeneityInspect } from '@/api/saleOrder/index.js';
|
|
|
import stockDetailDialog from '../../productionPlan/components/stockDetailDialog.vue';
|
|
|
import currentDetailDialog from '../../productionPlan/components/currentDetailDialog.vue';
|
|
|
@@ -111,95 +181,157 @@
|
|
|
visible: false,
|
|
|
|
|
|
bomIdList: [],
|
|
|
- formData: {},
|
|
|
- requestData: {
|
|
|
- deviceCode: '',
|
|
|
- deviceName: '',
|
|
|
- deviceId: ''
|
|
|
- },
|
|
|
requiredFormingNum: 0,
|
|
|
-
|
|
|
+ formInline: {
|
|
|
+ finalState: 0
|
|
|
+ },
|
|
|
+ finalStateList: [
|
|
|
+ {
|
|
|
+ label: '全部',
|
|
|
+ value: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '齐套',
|
|
|
+ value: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '缺料',
|
|
|
+ value: 2
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ loading: false,
|
|
|
+ datasourceAllList: [], // 表格物料全部数据
|
|
|
+ datasourceList: [], // 表格物料数据
|
|
|
+ bomListV: [], // BOM版本
|
|
|
+ bomListType: [], // BOM 类型
|
|
|
form: {
|
|
|
homogeneityInspect: []
|
|
|
},
|
|
|
|
|
|
- rules: {},
|
|
|
-
|
|
|
columns: [
|
|
|
{
|
|
|
- prop: 'opCode',
|
|
|
- label: '工序编码',
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'selection',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'batchNo',
|
|
|
+ label: '批次号',
|
|
|
align: 'center',
|
|
|
minWidth: 100,
|
|
|
showOverflowTooltip: true
|
|
|
},
|
|
|
{
|
|
|
- prop: 'opName',
|
|
|
- label: '工序名称',
|
|
|
+ prop: 'productCode',
|
|
|
+ label: '编码',
|
|
|
align: 'center',
|
|
|
- minWidth: 100
|
|
|
+ minWidth: 100,
|
|
|
+ showOverflowTooltip: true
|
|
|
},
|
|
|
{
|
|
|
- prop: 'bomCode',
|
|
|
+ prop: 'code',
|
|
|
label: '物料编码',
|
|
|
align: 'center',
|
|
|
minWidth: 100,
|
|
|
showOverflowTooltip: true
|
|
|
},
|
|
|
{
|
|
|
- prop: 'bomName',
|
|
|
+ prop: 'name',
|
|
|
label: '物料名称',
|
|
|
align: 'center',
|
|
|
- minWidth: 100
|
|
|
+ minWidth: 100,
|
|
|
+ showOverflowTooltip: true
|
|
|
},
|
|
|
{
|
|
|
- prop: 'count',
|
|
|
+ prop: 'demandQuantity',
|
|
|
label: '定额数量',
|
|
|
- align: 'center',
|
|
|
- minWidth: 80
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- slot: 'stockCount',
|
|
|
- prop: 'stockCount',
|
|
|
+ prop: 'inventoryQuantity',
|
|
|
label: '库存数量',
|
|
|
- align: 'center',
|
|
|
- minWidth: 80
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'secureInventory',
|
|
|
+ label: '安全库存',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'lockQuantity',
|
|
|
+ label: '锁库数量',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- slot: 'stockColor',
|
|
|
- prop: 'stockStatus',
|
|
|
+ slot: 'inventoryStatusText',
|
|
|
+ prop: 'inventoryStatusText',
|
|
|
label: '库存状态',
|
|
|
align: 'center',
|
|
|
minWidth: 80
|
|
|
},
|
|
|
{
|
|
|
- slot: 'currentCount',
|
|
|
- prop: 'currentCount',
|
|
|
+ slot: 'inTransitNum',
|
|
|
+ prop: 'inTransitNum',
|
|
|
label: '在途数量',
|
|
|
align: 'center',
|
|
|
minWidth: 80
|
|
|
},
|
|
|
{
|
|
|
- slot: 'currentColor',
|
|
|
- prop: 'currentStatus',
|
|
|
+ prop: 'inTransitOrdersNum',
|
|
|
+ label: '在途已关联数量 ',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'inTransitStatusText',
|
|
|
+ prop: 'inTransitStatusText',
|
|
|
label: '在途状态',
|
|
|
align: 'center',
|
|
|
minWidth: 80
|
|
|
},
|
|
|
{
|
|
|
- slot: 'finishCount',
|
|
|
- prop: 'finishCount',
|
|
|
+ label: '最终可用数量',
|
|
|
+ prop: 'finalAvailableQuantity',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
label: '最终缺料数量',
|
|
|
+ prop: 'finalShortageQuantity',
|
|
|
align: 'center',
|
|
|
- minWidth: 80
|
|
|
+ minWidth: 120
|
|
|
},
|
|
|
{
|
|
|
- slot: 'finishColor',
|
|
|
- prop: 'finishStatus',
|
|
|
+ slot: 'finalStateText',
|
|
|
+ prop: 'finalStateText',
|
|
|
label: '最终状态',
|
|
|
align: 'center',
|
|
|
minWidth: 80
|
|
|
},
|
|
|
+ // {
|
|
|
+ // columnKey: 'action',
|
|
|
+ // label: '操作',
|
|
|
+ // width: 120,
|
|
|
+ // align: 'center',
|
|
|
+ // resizable: false,
|
|
|
+ // fixed: 'right',
|
|
|
+ // slot: 'action'
|
|
|
+ // }
|
|
|
],
|
|
|
ids: [],
|
|
|
leftShow: false,
|
|
|
@@ -208,10 +340,7 @@
|
|
|
cardList: [],
|
|
|
treeProps: {
|
|
|
label: 'code',
|
|
|
- children: 'children',
|
|
|
- },
|
|
|
- planInfo: {
|
|
|
- salesCode: '',
|
|
|
+ children: 'children'
|
|
|
},
|
|
|
orderInfo: {
|
|
|
code: '',
|
|
|
@@ -219,64 +348,82 @@
|
|
|
productName: '',
|
|
|
contractNum: '',
|
|
|
specification: '',
|
|
|
- model: '',
|
|
|
+ model: ''
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
- leftShow(newVal, oldVal){
|
|
|
- if(newVal){
|
|
|
- this.leftWidth = '15%';
|
|
|
- this.rightWidth = '85%';
|
|
|
+ leftShow(newVal, oldVal) {
|
|
|
+ if (newVal) {
|
|
|
+ this.leftWidth = '230px';
|
|
|
+ this.rightWidth = 'calc(100% - 230px)';
|
|
|
} else {
|
|
|
- this.leftWidth = '0%';
|
|
|
+ this.leftWidth = '0';
|
|
|
this.rightWidth = '100%';
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- reload(where) {
|
|
|
+ reload(where) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 表格数据源 */
|
|
|
+ datasource({ page, limit, where }) {
|
|
|
+ return orderHomogeneityInspect({
|
|
|
+ pageNum: page,
|
|
|
+ size: limit,
|
|
|
+ ...where
|
|
|
+ });
|
|
|
+ },
|
|
|
+ stockDetail(row) {
|
|
|
+ this.$refs.stockDetailDialog.open(row);
|
|
|
+ },
|
|
|
+ currentDetail(row) {
|
|
|
+ this.$refs.currentDetailDialog.open(row);
|
|
|
+ },
|
|
|
+ open(dataList, order) {
|
|
|
+ console.log(order, 'order order order 1');
|
|
|
+ console.log(dataList, 'dataList');
|
|
|
+ this.visible = true;
|
|
|
+ this.cardList = dataList.map((el) => {
|
|
|
+ return {
|
|
|
+ ...order,
|
|
|
+ ...el
|
|
|
+ };
|
|
|
+ });
|
|
|
+ if (dataList.length === 1) {
|
|
|
+ this.leftShow = false;
|
|
|
+ } else {
|
|
|
+ this.leftShow = true;
|
|
|
+ const firstNodeKey = dataList[0].id;
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.table.reload({ page: 1, where });
|
|
|
- });
|
|
|
- },
|
|
|
- /* 表格数据源 */
|
|
|
- datasource({ page, limit, where }) {
|
|
|
- return orderHomogeneityInspect({
|
|
|
- pageNum: page,
|
|
|
- size: limit,
|
|
|
- ...where,
|
|
|
+ this.$refs.treeRef.setCurrentKey(firstNodeKey);
|
|
|
});
|
|
|
- },
|
|
|
- stockDetail(row) {
|
|
|
- this.$refs.stockDetailDialog.open(row);
|
|
|
- },
|
|
|
- currentDetail(row) {
|
|
|
- this.$refs.currentDetailDialog.open(row);
|
|
|
- },
|
|
|
- open(data, order) {
|
|
|
- this.visible = true;
|
|
|
- this.bomIdList = [];
|
|
|
- if(data){
|
|
|
- if(data.length == 1){
|
|
|
- this.orderInfo = data[0];
|
|
|
- this.orderInfo.code = order.code;
|
|
|
- console.log(this.orderInfo);
|
|
|
- this.leftShow = false;
|
|
|
- } else {
|
|
|
- this.leftShow = true;
|
|
|
- }
|
|
|
- let list = [];
|
|
|
- for(let item of data){
|
|
|
- list.push({bomId: item.bomCategoryId, planNum: item.contractNum});
|
|
|
- }
|
|
|
- this.bomIdList = list;
|
|
|
- this.reload({bomIdList: this.bomIdList});
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+ this.handleNodeClick(this.cardList[0]);
|
|
|
+ // this.visible = true;
|
|
|
+ // this.bomIdList = [];
|
|
|
+ // if (data) {
|
|
|
+ // if (data.length == 1) {
|
|
|
+ // this.orderInfo = data[0];
|
|
|
+ // this.orderInfo.code = order.code;
|
|
|
+ // console.log(this.orderInfo);
|
|
|
+ // this.leftShow = false;
|
|
|
+ // } else {
|
|
|
+ // this.leftShow = true;
|
|
|
+ // }
|
|
|
+ // let list = [];
|
|
|
+ // for (let item of data) {
|
|
|
+ // list.push({ bomId: item.bomCategoryId, planNum: item.contractNum });
|
|
|
+ // }
|
|
|
+ // this.bomIdList = list;
|
|
|
+ // this.reload({ bomIdList: this.bomIdList });
|
|
|
+ // }
|
|
|
},
|
|
|
cancel() {
|
|
|
- this.formData = {};
|
|
|
+ this.clearData();
|
|
|
this.visible = false;
|
|
|
},
|
|
|
|
|
|
@@ -284,10 +431,105 @@
|
|
|
this.visible = false;
|
|
|
},
|
|
|
|
|
|
- handleNodeClick(data){
|
|
|
- console.log(data);
|
|
|
+ handleNodeClick(data) {
|
|
|
+ this.clearData();
|
|
|
+ this.getBomData(data);
|
|
|
+ this.selectNodeId = data.id;
|
|
|
+ this.orderInfo = data;
|
|
|
+ // console.log(data);
|
|
|
// this.reload({planIds: [data.id]});
|
|
|
},
|
|
|
+ // 获取bom 数据
|
|
|
+ async getBomData(data) {
|
|
|
+ this.loading = true;
|
|
|
+ try {
|
|
|
+ this.planId = data.id;
|
|
|
+ const res = await findBomSalesorderCategoryId(data.categoryId);
|
|
|
+ if (!res || res.length == 0) {
|
|
|
+ this.bomListD = [];
|
|
|
+ this.datasourceList = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let obj = {};
|
|
|
+ let bomMap = {
|
|
|
+ 1: 'PBOM',
|
|
|
+ 2: 'MBOM',
|
|
|
+ 3: 'ABOM',
|
|
|
+ 4: 'EBOM'
|
|
|
+ };
|
|
|
+ res.map((el) => {
|
|
|
+ el.bomName = bomMap[el.bomType];
|
|
|
+ let OBMINFO = {
|
|
|
+ bomId: el.bomId,
|
|
|
+ bomType: el.type,
|
|
|
+ versions: `V${el.versions}.0`
|
|
|
+ };
|
|
|
+ if (obj[el.bomType]) {
|
|
|
+ obj[el.bomType].bomList.unshift(OBMINFO);
|
|
|
+ } else {
|
|
|
+ obj[el.bomType] = { ...el, bomList: [OBMINFO] };
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let list = Object.values(obj);
|
|
|
+ this.bomListType = list;
|
|
|
+ await this.bomTypeChange(list[0].id);
|
|
|
+ this.loading = false;
|
|
|
+ } catch (err) {
|
|
|
+ this.$message.error(err.message);
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 选择BOM类型
|
|
|
+ async bomTypeChange(e) {
|
|
|
+ this.formInline.bomType = e;
|
|
|
+ let data = this.bomListType.find((el) => el.id === e);
|
|
|
+ if (!data) return;
|
|
|
+ this.bomListV = data.bomList;
|
|
|
+ await this.bomVChange(data.bomList[0].bomId);
|
|
|
+ },
|
|
|
+ // 选择BOM版本
|
|
|
+ async bomVChange(e) {
|
|
|
+ this.formInline.bomId = e;
|
|
|
+ let data = this.bomListV.find((el) => el.bomId === e);
|
|
|
+ if (!data) return;
|
|
|
+ await this.getMaterialData(data);
|
|
|
+ },
|
|
|
+ // 获取物料数据信息
|
|
|
+ async getMaterialData(data) {
|
|
|
+ let params = { planId: this.planId, bomVersionId: data.bomId };
|
|
|
+ const result = await findMaterialInfoSalesorder(params);
|
|
|
+ result.map((item) => {
|
|
|
+ item.batchNo = this.orderInfo.batchNo;
|
|
|
+ item.productCode = this.orderInfo.productCode;
|
|
|
+ item.finalState =
|
|
|
+ item.finalStateText == '齐套'
|
|
|
+ ? 1
|
|
|
+ : item.finalStateText == '缺料'
|
|
|
+ ? 2
|
|
|
+ : '';
|
|
|
+ });
|
|
|
+ this.datasourceAllList = result;
|
|
|
+ this.finalChange(0);
|
|
|
+ },
|
|
|
+ // 选择状态
|
|
|
+ finalChange(e) {
|
|
|
+ if (e === 0 || !e) {
|
|
|
+ this.datasourceList = this.datasourceAllList;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.datasourceList = this.datasourceAllList.filter(
|
|
|
+ (item) => item.finalState === e
|
|
|
+ );
|
|
|
+ },
|
|
|
+ clearData() {
|
|
|
+ this.formInline = {
|
|
|
+ finalState: 0
|
|
|
+ };
|
|
|
+ this.bomListV = [];
|
|
|
+ this.bomListType = [];
|
|
|
+ this.datasourceList = [];
|
|
|
+ this.datasourceAllList = [];
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
@@ -300,8 +542,12 @@
|
|
|
.el-form-item {
|
|
|
margin-bottom: 0 !important;
|
|
|
}
|
|
|
- .planInfo{
|
|
|
+ .planInfo {
|
|
|
display: flex;
|
|
|
font-size: 16px;
|
|
|
}
|
|
|
+
|
|
|
+ .form-wrapper {
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
</style>
|