|
@@ -81,12 +81,12 @@
|
|
|
>
|
|
>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <div v-if="item.byProdList && item.byProdList.length > 0">
|
|
|
|
|
|
|
+ <div v-if="item.detailList && item.detailList.length > 0">
|
|
|
<el-table
|
|
<el-table
|
|
|
:ref="`form222${idx}`"
|
|
:ref="`form222${idx}`"
|
|
|
class="table_content"
|
|
class="table_content"
|
|
|
:max-height="300"
|
|
:max-height="300"
|
|
|
- :data="item.byProdList"
|
|
|
|
|
|
|
+ :data="item.detailList"
|
|
|
tooltip-effect="dark"
|
|
tooltip-effect="dark"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
stripe
|
|
stripe
|
|
@@ -113,10 +113,12 @@
|
|
|
<el-table-column label="不合格品数量" prop="notFormedNum">
|
|
<el-table-column label="不合格品数量" prop="notFormedNum">
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
|
|
|
- <el-table-column label="回收" prop="quantity" width="160px">
|
|
|
|
|
- <el-input v-model="row.quantity" disabled size="mini">
|
|
|
|
|
- <template slot="append">{{ row.unit }}</template>
|
|
|
|
|
- </el-input>
|
|
|
|
|
|
|
+ <el-table-column label="回收" prop="quantity" width="180px">
|
|
|
|
|
+ <template slot-scope="{ $index, row }">
|
|
|
|
|
+ <el-input v-model="row.quantity" disabled size="mini">
|
|
|
|
|
+ <template slot="append">{{ row.unit }}</template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="操作" fixed="right" width="100px">
|
|
<el-table-column label="操作" fixed="right" width="100px">
|
|
@@ -149,7 +151,7 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import { getCode } from '@/api/produce/workOrder';
|
|
import { getCode } from '@/api/produce/workOrder';
|
|
|
- import { listDisposeBy } from '@/api/byProduct/index';
|
|
|
|
|
|
|
+ import { listDisposeBy, disposeSave } from '@/api/byProduct/index';
|
|
|
import ProductModal from './ProductModal.vue';
|
|
import ProductModal from './ProductModal.vue';
|
|
|
import produceOrder from '@/views/pick/pickApply/components/produceOrder.vue';
|
|
import produceOrder from '@/views/pick/pickApply/components/produceOrder.vue';
|
|
|
export default {
|
|
export default {
|
|
@@ -172,7 +174,9 @@
|
|
|
|
|
|
|
|
productWeight: null,
|
|
productWeight: null,
|
|
|
|
|
|
|
|
- orderShow: false
|
|
|
|
|
|
|
+ orderShow: false,
|
|
|
|
|
+
|
|
|
|
|
+ newWeightList: []
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -189,7 +193,19 @@
|
|
|
this.productForm.code = await getCode('dispose_code');
|
|
this.productForm.code = await getCode('dispose_code');
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- save() {},
|
|
|
|
|
|
|
+ save() {
|
|
|
|
|
+ let param = {
|
|
|
|
|
+ detailList: this.materialList[0].detailList,
|
|
|
|
|
+ ...this.productForm,
|
|
|
|
|
+ categoryId: this.materialList[0].id,
|
|
|
|
|
+ quantity: this.productWeight
|
|
|
|
|
+ };
|
|
|
|
|
+ console.log(param);
|
|
|
|
|
+
|
|
|
|
|
+ disposeSave(param).then((res) => {
|
|
|
|
|
+ this.$emit('close', true);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
categorySelect() {
|
|
categorySelect() {
|
|
|
this.$refs.productRefs.open({}, '选择物料', '1', null);
|
|
this.$refs.productRefs.open({}, '选择物料', '1', null);
|
|
@@ -221,27 +237,39 @@
|
|
|
workOrderIds: ids
|
|
workOrderIds: ids
|
|
|
};
|
|
};
|
|
|
listDisposeBy(param).then((res) => {
|
|
listDisposeBy(param).then((res) => {
|
|
|
- console.log(res);
|
|
|
|
|
- let _arr = []
|
|
|
|
|
-
|
|
|
|
|
- let _totalWeight = 0;
|
|
|
|
|
|
|
+ this.newWeightList = res;
|
|
|
|
|
+ this.WeightListFN();
|
|
|
|
|
|
|
|
- res.materialList.forEach(item => {
|
|
|
|
|
- _totalWeight += Number(item.formedNum || 0 ) + Number(item.notFormedNum || 0 );
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
+ this.orderShow = false;
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
|
|
+ WeightListFN() {
|
|
|
|
|
+ let _totalNum = 0;
|
|
|
|
|
+ let _oneWeight = 0;
|
|
|
|
|
+ let _arr = [];
|
|
|
|
|
|
|
|
- this.$set(this.materialList[0], 'byProdList', res);
|
|
|
|
|
|
|
+ // 使用reduce方法求和
|
|
|
|
|
+ _totalNum = this.newWeightList.reduce((acc, item) => {
|
|
|
|
|
+ return acc + item.formedNum + item.notFormedNum;
|
|
|
|
|
+ }, 0);
|
|
|
|
|
|
|
|
- this.$forceUpdate();
|
|
|
|
|
|
|
+ _oneWeight = this.productWeight / _totalNum;
|
|
|
|
|
+
|
|
|
|
|
+ this.newWeightList.forEach((item) => {
|
|
|
|
|
+ _arr.push({
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ quantity: (item.formedNum + item.notFormedNum) * _oneWeight
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- this.orderShow = false;
|
|
|
|
|
|
|
+ this.$set(this.materialList[0], 'detailList', _arr);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
removeItem(idx, index) {
|
|
removeItem(idx, index) {
|
|
|
- this.materialList[idx].byProdList.splice(index, 1);
|
|
|
|
|
|
|
+ this.materialList[idx].detailList.splice(index, 1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|