|
|
@@ -5,7 +5,7 @@
|
|
|
<div class="title-left">销售订单转生产计划</div>
|
|
|
<div class="title-right">
|
|
|
<el-button @click="cancel">取消</el-button>
|
|
|
- <el-button type="primary" @click="toSubmit">
|
|
|
+ <el-button type="primary" @click="toSubmit" :loading="loading">
|
|
|
提交计划
|
|
|
</el-button>
|
|
|
</div>
|
|
|
@@ -14,7 +14,7 @@
|
|
|
<el-row :gutter="24">
|
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
|
<el-form-item label="计划类型:">
|
|
|
- <DictSelection dictName="订单计划类型" clearable v-model="form.orderType">
|
|
|
+ <DictSelection dictName="订单计划类型" clearable v-model="form.planType">
|
|
|
</DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -189,22 +189,25 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
- <AdditionalOrder ref="additionalRefs" :selectList="form.salesOrderVOS" @choose="confirmChoose"></AdditionalOrder>
|
|
|
+ <AdditionalOrder ref="additionalRefs" :productCode="form.productCode" :selectList="form.salesOrderVOS" @choose="confirmChoose"></AdditionalOrder>
|
|
|
<ProductionVersion ref="versionRefs" @confirm="confirmVersion"></ProductionVersion>
|
|
|
+ <PlanSubmit ref="submitRefs" :info="form"></PlanSubmit>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import AdditionalOrder from './components/AdditionalOrder.vue';
|
|
|
+ import PlanSubmit from './components/plan-submit.vue';
|
|
|
import ProductionVersion from '@/components/CreatePlan/ProductionVersion.vue'
|
|
|
- import { productionToPlan } from '@/api/saleOrder';
|
|
|
+ import { productionToPlan , saveSaleToPlan } from '@/api/saleOrder';
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
import { deepClone } from '@/utils/index'
|
|
|
export default {
|
|
|
mixins: [dictMixins],
|
|
|
components: {
|
|
|
AdditionalOrder,
|
|
|
- ProductionVersion
|
|
|
+ ProductionVersion,
|
|
|
+ PlanSubmit
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
@@ -216,7 +219,8 @@
|
|
|
rules: {
|
|
|
producteVersionName:[{required: true,message: '请选择生产版本',trigger: 'change'}]
|
|
|
},
|
|
|
- selection:[]
|
|
|
+ selection:[],
|
|
|
+ loading:false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -249,7 +253,11 @@
|
|
|
this.$router.go(-1)
|
|
|
},
|
|
|
toSubmit(){
|
|
|
-
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.$refs.submitRefs.open()
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
sortTop (row) {
|
|
|
if (row.priority <= 1) {
|
|
|
@@ -298,12 +306,37 @@
|
|
|
const result = list.filter(
|
|
|
i => this.form.salesOrderVOS.findIndex(p => p.id === i.id) === -1
|
|
|
)
|
|
|
- console.log('筛选出的',result)
|
|
|
- // const sum = arr.reduce((pre,cur)=>{
|
|
|
- // return pre +cur
|
|
|
- // },2)
|
|
|
+ // 取出在表格中并且不在弹窗中选中的数据 即取消选中的数据
|
|
|
+ const del = this.form.salesOrderVOS.filter(
|
|
|
+ i => list.findIndex(p => p.id === i.id) === -1
|
|
|
+ )
|
|
|
+ for(let i= this.form.salesOrderVOS.length-1;i>=0;i--){
|
|
|
+ for(let j in del){
|
|
|
+ if(this.form.salesOrderVOS[i].id === del[j].id){
|
|
|
+ this.form.salesOrderVOS.splice(i,1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.salesOrderVOS = this.form.salesOrderVOS.concat(result)
|
|
|
+ this.changeData()
|
|
|
+ },
|
|
|
+ changeData(){
|
|
|
+ var productNum = 0
|
|
|
+ var productWeight = 0
|
|
|
+ var requiredFormingNum = 0
|
|
|
+ // var requiredFormingWeight = 0
|
|
|
+ // var formingCompletionDate = ''
|
|
|
+ this.form.salesOrderVOS.map((item,index)=>{
|
|
|
+ item.priority = index+1
|
|
|
+ productNum = productNum + item.contractNum
|
|
|
+ productWeight = productWeight + Number(item.productSumWeight)
|
|
|
+ requiredFormingNum = requiredFormingNum + item.requiredFormingNum
|
|
|
+ // requiredFormingWeight = requiredFormingWeight + Number(item.productUnitWeight) * Number(item.requiredFormingNum)
|
|
|
+ })
|
|
|
+ this.$set(this.form,'codeNum',this.form.salesOrderVOS.length)
|
|
|
+ this.$set(this.form,'contractNum',productNum)
|
|
|
+ this.$set(this.form,'sumOrderWeight',productWeight.toFixed(2))
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
};
|
|
|
</script>
|