浏览代码

生产总订单-表单校验

jingbb 11 月之前
父节点
当前提交
ff6f9de900

+ 43 - 11
src/views/production/productionTotalOrder/modules/SurplusMaterials.vue

@@ -1,6 +1,6 @@
 <template>
     <div >
-        <a-form-model ref="formRef">
+        <a-form-model ref="formRef" :model="form">
             <a-table
             ref="table"
             size="middle"
@@ -8,12 +8,18 @@
             id='sonList'
             :columns="columns"
             rowKey="rowNo"
-            :dataSource="dataSource"
+            :dataSource="form.dataSource"
             :pagination="false"
             :scroll="{ x: 5500, y: 300 }"
             :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
             @change="handleTableChange"
             >
+                <span slot="quantityTitle" class="form-table-heard">
+                    主数量
+                </span>
+                <span slot="unQuantityTitle" class="form-table-heard">
+                    辅数量
+                </span>
                 <template slot="batch" slot-scope="text, record, index">
                     <a-form-model-item prop="batch" class='sonItem'>
                         <a-input placeholder="请输入" v-model="record.batch" ></a-input>
@@ -25,12 +31,12 @@
                     </a-form-model-item>
                 </template>
                 <template slot="quantity" slot-scope="text, record, index">
-                    <a-form-model-item prop="quantity" class='sonItem'>
+                    <a-form-model-item :prop="'dataSource.'+index+'.quantity'" class='sonItem' :rules="rules.quantity">
                         <a-input placeholder="请输入" v-model="record.quantity" ></a-input>
                      </a-form-model-item>
                 </template>
                 <template slot="unQuantity" slot-scope="text, record, index">
-                    <a-form-model-item prop="unQuantity" class='sonItem'>
+                    <a-form-model-item :prop="'dataSource.'+index+'.unQuantity'" class='sonItem' :rules="rules.unQuantity">
                         <a-input placeholder="请输入" v-model="record.unQuantity" ></a-input>
                      </a-form-model-item>
                 </template>
@@ -184,7 +190,9 @@
         selectedRowKeys:[],
         selectedRows:[],
         planOrg:'',
-        dataSource:[],
+        form:{
+            dataSource:[],
+        },
         columns: [
                 {
                     title: '#',
@@ -243,19 +251,21 @@
                     ellipsis: true,
                 },
                 {
-                    title: '主数量',
+                    // title: '主数量',
                     align:"center",
                     dataIndex: 'quantity',
                     ellipsis: true,
-                    scopedSlots: { customRender: 'quantity' } 
+                    scopedSlots: { customRender: 'quantity' } ,
+                    slots:{title:'quantityTitle'},
 
                 },
                 {
-                    title: '辅数量',
+                    // title: '辅数量',
                     align:"center",
                     dataIndex: 'unQuantity',
                     ellipsis: true,
-                    scopedSlots: { customRender: 'unQuantity' } 
+                    scopedSlots: { customRender: 'unQuantity' } ,
+                    slots:{title:'quantityTitle'},
                 },
                 {
                     title: '规格',
@@ -442,6 +452,10 @@
                     scopedSlots: { customRender: 'glassNumber' } 
                 },
           ],
+        rules:{
+            quantity:{required:true,message:"不可为空"},
+            unQuantity:{required:true,message:"不可为空"},
+        },
       }
     },
      props: {
@@ -455,14 +469,25 @@
             this.selectedRows = selectionRows;
         },
         addList(projectCode,projectName){
-            this.dataSource.unshift({rowNo: this.dataSource.length+1,projectCode:projectCode,projectName:projectName})
+            this.form.dataSource.unshift({rowNo: this.form.dataSource.length+1,projectCode:projectCode,projectName:projectName})
+        },
+        validateList(){
+            let flag = null
+            this.$refs.formRef.validate(valid =>{
+                if(valid){
+                    flag = true
+                }else{
+                    flag = false
+                }
+            })
+            return flag
         },
         delectRow(){
             if( this.selectedRowKeys.length==0){
                 this.$message.warning('请勾选子表数据!')
             }else{
                 this.selectedRowKeys.map(event=>{
-                    this.dataSource =  this.dataSource.filter( (x)=> {return x.rowNo !== event});
+                    this.form.dataSource =  this.form.dataSource.filter( (x)=> {return x.rowNo !== event});
                 })
             }
         },
@@ -551,5 +576,12 @@
     /deep/#sonList>.ant-spin-nested-loading>.ant-spin-container>.ant-table>.ant-table-content>.ant-table-scroll>.ant-table-body>.ant-table-fixed>.ant-table-tbody > tr > td {
         padding: 0px 8px !important;
     }
+    .form-table-heard:before {
+        content:'*';
+        color:red
+   }
+   /deep/.ant-form-explain, .ant-form-split {
+        display: none;
+   }
   </style>
   

+ 44 - 12
src/views/production/productionTotalOrder/modules/material.vue

@@ -1,6 +1,6 @@
 <template>
     <div >
-        <a-form-model ref="formRef">
+        <a-form-model ref="formRef" :model="form">
             <a-table
             ref="table"
             size="middle"
@@ -8,12 +8,18 @@
             id='sonList'
             :columns="columns"
             rowKey="rowNo"
-            :dataSource="dataSource"
+            :dataSource="form.dataSource"
             :pagination="false"
             :scroll="{ x: 5500, y: 300 }"
             :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
             @change="handleTableChange"
             >
+                <span slot="quantityTitle" class="form-table-heard">
+                    主数量
+                </span>
+                <span slot="unQuantityTitle" class="form-table-heard">
+                    辅数量
+                </span>
                 <template slot="batch" slot-scope="text, record, index">
                     <a-form-model-item prop="batch" class='sonItem'>
                         <a-input placeholder="请输入" v-model="record.batch" ></a-input>
@@ -25,12 +31,12 @@
                     </a-form-model-item>
                 </template>
                 <template slot="quantity" slot-scope="text, record, index">
-                    <a-form-model-item prop="quantity" class='sonItem'>
+                    <a-form-model-item :prop="'dataSource.'+index+'.quantity'" class='sonItem' :rules="rules.quantity">
                         <a-input placeholder="请输入" v-model="record.quantity"  @blur="changeQuantity(record)"></a-input>
                      </a-form-model-item>
                 </template>
                 <template slot="unQuantity" slot-scope="text, record, index">
-                    <a-form-model-item prop="unQuantity" class='sonItem'>
+                    <a-form-model-item :prop="'dataSource.'+index+'.unQuantity'" class='sonItem' :rules="rules.unQuantity">
                         <a-input placeholder="请输入" v-model="record.unQuantity"  @blur="changeUQuantity(record)"></a-input>
                      </a-form-model-item>
                 </template>
@@ -178,7 +184,9 @@
       return {
         selectedRowKeys:[],
         selectedRows:[],
-        dataSource:[],
+        form:{
+            dataSource:[],
+        },
         planOrg:'',
         columns: [
                 {
@@ -243,19 +251,21 @@
                     ellipsis: true,
                 },
                 {
-                    title: '主数量',
+                    // title: '主数量',
                     align:"center",
                     dataIndex: 'quantity',
                     ellipsis: true,
-                    scopedSlots: { customRender: 'quantity' } 
+                    scopedSlots: { customRender: 'quantity' } ,
+                    slots:{title:'quantityTitle'},
 
                 },
                 {
-                    title: '辅数量',
+                    // title: '辅数量',
                     align:"center",
                     dataIndex: 'unQuantity',
                     ellipsis: true,
-                    scopedSlots: { customRender: 'unQuantity' } 
+                    scopedSlots: { customRender: 'unQuantity' } ,
+                    slots:{title:'unQuantityTitle'},
                 },
                 {
                     title: '已执行辅数量',
@@ -451,6 +461,10 @@
                     scopedSlots: { customRender: 'glassNumber' } 
                 },
           ],
+          rules:{
+            quantity:{required:true,message:"不可为空"},
+            unQuantity:{required:true,message:"不可为空"},
+        },
       }
     },
      props: {
@@ -464,19 +478,30 @@
             this.selectedRows = selectionRows;
         },
         addList(projectCode,projectName){
-            this.dataSource.unshift({rowNo: this.dataSource.length+1,projectCode:projectCode,projectName:projectName})
+            this.form.dataSource.unshift({rowNo: this.form.dataSource.length+1,projectCode:projectCode,projectName:projectName})
         },
         delectRow(){
             if( this.selectedRowKeys.length==0){
                 this.$message.warning('请勾选子表数据!')
             }else{
                 this.selectedRowKeys.map(event=>{
-                    this.dataSource =  this.dataSource.filter( (x)=> {return x.rowNo !== event});
+                    this.form.dataSource =  this.form.dataSource.filter( (x)=> {return x.rowNo !== event});
                 })
             }
         },
         addMaterial(){
-            this.dataSource.push({newRow:'1'})
+            this.form.dataSource.push({newRow:'1'})
+        },
+        validateList(){
+            let flag = null
+            this.$refs.formRef.validate(valid =>{
+                if(valid){
+                    flag = true
+                }else{
+                    flag = false
+                }
+            })
+            return flag
         },
         changeQuantity(record){
             if(record.quantity&&record.quantityExecute&&(Number(record.quantity)<Number(record.quantityExecute))){
@@ -576,5 +601,12 @@
     /deep/#sonList>.ant-spin-nested-loading>.ant-spin-container>.ant-table>.ant-table-content>.ant-table-scroll>.ant-table-body>.ant-table-fixed>.ant-table-tbody > tr > td {
         padding: 0px 8px !important;
     }
+    .form-table-heard:before {
+        content:'*';
+        color:red
+   }
+   /deep/.ant-form-explain, .ant-form-split {
+        display: none;
+   }
   </style>
   

+ 44 - 12
src/views/production/productionTotalOrder/modules/productDetails.vue

@@ -1,6 +1,6 @@
 <template>
     <div >
-        <a-form-model ref="formRef">
+        <a-form-model ref="formRef" :model="form">
             <a-table
             ref="table"
             size="middle"
@@ -8,12 +8,18 @@
             id='sonList'
             :columns="columns"
             rowKey="rowNo"
-            :dataSource="dataSource"
+            :dataSource="form.dataSource"
             :pagination="false"
             :scroll="{ x: 5500, y: 300 }"
             :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
             @change="handleTableChange"
             >
+                <span slot="framesCountTitle" class="form-table-heard">
+                    框数量
+                </span>
+                <span slot="leafCountTitle" class="form-table-heard">
+                    扇数量
+                </span>
                 <template slot="billingType" slot-scope="text, record, index">
                     <a-form-model-item prop="billingType" class='sonItem'>
                         <a-select v-model="record.billingType"  style='width:100%'  >
@@ -53,12 +59,12 @@
                      </a-form-model-item>
                 </template>
                 <template slot="framesCount" slot-scope="text, record, index">
-                    <a-form-model-item prop="framesCount" class='sonItem'>
+                    <a-form-model-item :prop="'dataSource.'+index+'.framesCount'" class='sonItem' :rules="rules.framesCount">
                         <a-input placeholder="请输入" v-model="record.framesCount"></a-input>
                      </a-form-model-item>
                 </template>
                 <template slot="leafCount" slot-scope="text, record, index">
-                    <a-form-model-item prop="leafCount" class='sonItem'>
+                    <a-form-model-item :prop="'dataSource.'+index+'.leafCount'" class='sonItem' :rules="rules.leafCount">
                         <a-input placeholder="请输入" v-model="record.leafCount"></a-input>
                      </a-form-model-item>
                 </template>
@@ -216,7 +222,9 @@
         selectedRowKeys:[],
         selectedRows:[],
         planOrg:'',
-        dataSource:[],
+        form:{
+            dataSource:[],
+        },
         columns: [
                 {
                     title: '#',
@@ -303,25 +311,27 @@
                     scopedSlots: { customRender: 'quantityExecuteIn' } 
                 },
                 {
-                    title: '框数量',
+                    // title: '框数量',
                     align:"center",
                     dataIndex: 'framesCount',
                     ellipsis: true,
-                    scopedSlots: { customRender: 'framesCount' } 
+                    scopedSlots: { customRender: 'framesCount' } ,
+                    slots:{title:'framesCountTitle'},
                  },
                 {
-                    title: '扇数量',
+                    // title: '扇数量',
                     align:"center",
                     dataIndex: 'leafCount',
                     ellipsis: true,
-                    scopedSlots: { customRender: 'leafCount' } 
+                    scopedSlots: { customRender: 'leafCount' } ,
+                    slots:{title:'leafCountTitle'},
                 },
                 {
                     title: '已入库扇数量',
                     align:"center",
                     dataIndex: 'executeInLeaf',
                     ellipsis: true,
-                    scopedSlots: { customRender: 'executeInLeaf' } 
+                    scopedSlots: { customRender: 'executeInLeaf' } ,
                 },
                 {
                     title: '已入库框数量',
@@ -509,6 +519,10 @@
                     scopedSlots: { customRender: 'glassNumber' } 
                 },
           ],
+        rules:{
+            framesCount:{required:true,message:"不可为空"},
+            leafCount:{required:true,message:"不可为空"},
+        },
       }
     },
      props: {
@@ -522,7 +536,7 @@
             this.selectedRows = selectionRows;
         },
         addList(projectCode,projectName){
-            this.dataSource.unshift({rowNo: this.dataSource.length+1,projectCode:projectCode,projectName:projectName})
+            this.form.dataSource.unshift({rowNo: this.form.dataSource.length+1,projectCode:projectCode,projectName:projectName})
         },
         onSearchInven(record){
             if(!this.planOrg||this.planOrg==''){
@@ -533,6 +547,17 @@
                 this.$refs.inventoryPopup.record=record
             }
         },
+        validateList(){
+            let flag = null
+            this.$refs.formRef.validate(valid =>{
+                if(valid){
+                    flag = true
+                }else{
+                    flag = false
+                }
+            })
+            return flag
+        },
         okDataInvent(data,recoerd){
             this.$set(recoerd,'inventoryCode',data.Code)
             this.$set(recoerd,'inventoryName',data.Name)
@@ -547,7 +572,7 @@
                 this.$message.warning('请勾选子表数据!')
             }else{
                 this.selectedRowKeys.map(event=>{
-                    this.dataSource =  this.dataSource.filter( (x)=> {return x.rowNo !== event});
+                    this.form.dataSource =  this.form.dataSource.filter( (x)=> {return x.rowNo !== event});
                 })
             }
         },
@@ -619,5 +644,12 @@
     /deep/#sonList>.ant-spin-nested-loading>.ant-spin-container>.ant-table>.ant-table-content>.ant-table-scroll>.ant-table-body>.ant-table-fixed>.ant-table-tbody > tr > td {
         padding: 0px 8px !important;
     }
+    .form-table-heard:before {
+    content:'*';
+    color:red
+   }
+   /deep/.ant-form-explain, .ant-form-split {
+        display: none;
+   }
   </style>
   

+ 128 - 75
src/views/production/productionTotalOrder/modules/productionTotalOrderAdd.vue

@@ -14,78 +14,78 @@
      </template>
       <a-card :bordered="false" class="top" style="margin-bottom:1%;margin-top:1%" :loading = 'loading'>
         <div class="table-page-search-wrapper">
-            <a-form layout="inline" @keyup.enter.native="searchQuery">
+            <a-form-model layout="inline" @keyup.enter.native="searchQuery" :model="form" :rules="rules"  ref="form">
                 <a-row :gutter="24">
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="生产组织">
+                        <a-form-model-item label="生产组织" prop='orgName' >
                             <a-input-search placeholder="请输入" v-model="form.orgName"  @search="onSearchProductionOrg" readOnly></a-input-search>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col  :md="4" :sm="24">
-                        <a-form-item label="单据号">
+                        <a-form-model-item label="单据号">
                             <a-input placeholder="请输入" v-model="form.orderCode" disabled></a-input>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="单据日期">
+                        <a-form-model-item label="单据日期" prop='orderDate'>
                             <a-date-picker showTime valueFormat="YYYY-MM-DD" format = "YYYY-MM-DD" v-model="form.orderDate" style="width:100%" />
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="单据状态">
+                        <a-form-model-item label="单据状态">
                             <a-input placeholder="请输入" v-model="form.state"  disabled></a-input>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="业务员">
+                        <a-form-model-item label="业务员">
                             <a-input-search placeholder="请输入" v-model="form.salesperson" @search="onSearchPerson" readOnly ></a-input-search>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="计划部门">
+                        <a-form-model-item label="计划部门">
                             <a-input-search placeholder="请输入" v-model="form.planDept" @search="onSearchPlanDept" readOnly></a-input-search>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="项目名称">
+                        <a-form-model-item label="项目名称" prop='projectName'>
                             <a-input-search placeholder="请输入" v-model="form.projectName" @search="onSearchProject" readOnly></a-input-search>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="项目编码" >
+                        <a-form-model-item label="项目编码" prop='projectCode'>
                             <a-input placeholder="请输入" v-model="form.projectCode" disabled></a-input>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="业务类型">
+                        <a-form-model-item label="业务类型" prop='type'>
                             <a-select v-model="form.type"  style='width:100%'  >
                                 <a-select-option value='工装'> 工装</a-select-option>
                                 <a-select-option value='家装'> 家装</a-select-option>
                             </a-select>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="制单人">
+                        <a-form-model-item label="制单人">
                             <a-input placeholder="请输入" v-model="form.createBy"  disabled></a-input>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="审核人">
+                        <a-form-model-item label="审核人">
                             <a-input placeholder="请输入" v-model="form.reviewer" disabled></a-input>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="工单号">
+                        <a-form-model-item label="工单号" prop='workNo'>
                             <a-input placeholder="请输入" v-model="form.workNo" ></a-input>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>
                     <a-col :md="4" :sm="24">
-                        <a-form-item label="备注">
+                        <a-form-model-item label="备注">
                             <a-input placeholder="请输入" v-model="form.remarks"></a-input>
-                        </a-form-item>
+                        </a-form-model-item>
                     </a-col>                    
                 </a-row>
-            </a-form>
+            </a-form-model>
         </div>
      </a-card>
      <a-card :bordered="false" class="three" style="margin-bottom:1%" :loading = 'loading'>
@@ -169,9 +169,28 @@
           return {
             visible:false,
             form:{},
-            form1:{},
             execute:undefined,
             defaultMethod:'add',
+            rules:{
+              orgName: [
+                { required: true, trigger: 'change' },
+              ],
+              orderDate:[
+                { required: true, trigger: 'change' },
+              ],
+              projectName:[
+                { required: true, trigger: 'change' },
+              ],
+              projectCode:[
+                { required: true, trigger: 'change' },
+              ],
+              type:[
+                { required: true, trigger: 'change' },
+              ],
+              workNo:[
+                { required: true, trigger: 'change' },
+              ],
+            },
             dataSource:[],
             loading:false,
             // ipagination:{},
@@ -191,8 +210,7 @@
                 this.activeKey='finishProduct',
                 this.execute = ''
                 this.dataSource = [] 
-                this.form={}
-                this.form1={}
+                this.form={ }
                 this.$emit('ok')
             },
             // changeChose(prop){
@@ -232,51 +250,69 @@
                 })
             },
             handleOk(){
-                var madeProductionOrdersPage = this.form
-                madeProductionOrdersPage.madeProductionOrdersFinishedList = this.$refs.productDetails.dataSource
-                madeProductionOrdersPage.madeProductionOrdersMaterialList = this.$refs.material.dataSource
-                madeProductionOrdersPage.madeProductionOrdersInList = this.$refs.TemporaryStorage.dataSource
-                madeProductionOrdersPage.madeProductionOrdersOutList = this.$refs.SurplusMaterials.dataSource
-                this.loading = true
-                if(this.defaultMethod=='add'){
-                    postAction('/productionOrder/madeProductionOrders/add', madeProductionOrdersPage).then((res) => {
-                        if (res.success) {
-                            this.$message.success('添加成功!');
-                            this.$emit('ok')
-                            this.handleCancel()
-                        } else {
-                            this.$message.error(res.message);
+                this.$refs.form.validate(success => {
+                    if (success) {
+                        var arrValid = [true]
+                        if(this.$refs.productDetails.form.dataSource.length!==0){
+                            arrValid.push(this.$refs.productDetails.validateList())
                         }
-                    }).finally(() => {
-                        this.loading = false
-                    })
-                }else{
-                    postAction('/productionOrder/madeProductionOrders/edit', madeProductionOrdersPage).then((res) => {
-                        if (res.success) {
-                            this.$emit('ok')
-                            this.handleCancel()
-                            this.$message.success('编辑成功!');
-                        } else {
-                            this.$message.error(res.message);
+                        if(this.$refs.material.form.dataSource.length!==0){
+                            arrValid.push(this.$refs.material.validateList())
                         }
-                    }).finally(() => {
-                        this.loading = false
-                    })
-                }                
+                        if(this.$refs.SurplusMaterials.form.dataSource.length!==0){
+                            arrValid.push(this.$refs.SurplusMaterials.validateList())
+                        }
+                        if(arrValid.indexOf(false) == -1){
+                            var madeProductionOrdersPage = this.form
+                            madeProductionOrdersPage.madeProductionOrdersFinishedList = this.$refs.productDetails.form.dataSource
+                            madeProductionOrdersPage.madeProductionOrdersMaterialList = this.$refs.material.form.dataSource
+                            madeProductionOrdersPage.madeProductionOrdersInList = this.$refs.TemporaryStorage.dataSource
+                            madeProductionOrdersPage.madeProductionOrdersOutList = this.$refs.SurplusMaterials.form.dataSource
+                            this.loading = true
+                            if(this.defaultMethod=='add'){
+                                postAction('/productionOrder/madeProductionOrders/add', madeProductionOrdersPage).then((res) => {
+                                    if (res.success) {
+                                        this.$message.success('添加成功!');
+                                        this.$emit('ok')
+                                        this.handleCancel()
+                                    } else {
+                                        this.$message.error(res.message);
+                                    }
+                                }).finally(() => {
+                                    this.loading = false
+                                })
+                            }else{
+                                postAction('/productionOrder/madeProductionOrders/edit', madeProductionOrdersPage).then((res) => {
+                                    if (res.success) {
+                                        this.$emit('ok')
+                                        this.handleCancel()
+                                        this.$message.success('编辑成功!');
+                                    } else {
+                                        this.$message.error(res.message);
+                                    }
+                                }).finally(() => {
+                                    this.loading = false
+                                })
+                            }   
+                        }else{
+                            this.$message.warning('请检查子表必填项')
+                        }             
+                    }
+                })
             },
             changeEdit(){
                 var madeProductionOrdersPage = this.form
-                madeProductionOrdersPage.madeProductionOrdersFinishedList = this.$refs.productDetails.dataSource
-                madeProductionOrdersPage.madeProductionOrdersMaterialList = this.$refs.material.dataSource
+                madeProductionOrdersPage.madeProductionOrdersFinishedList = this.$refs.productDetails.form.dataSource
+                madeProductionOrdersPage.madeProductionOrdersMaterialList = this.$refs.material.form.dataSource
                 madeProductionOrdersPage.madeProductionOrdersInList = this.$refs.TemporaryStorage.dataSource
-                madeProductionOrdersPage.madeProductionOrdersOutList = this.$refs.SurplusMaterials.dataSource
+                madeProductionOrdersPage.madeProductionOrdersOutList = this.$refs.SurplusMaterials.form.dataSource
                 postAction('/productionOrder/madeProductionOrders/editChild', madeProductionOrdersPage).then((res) => {
                         if (res.success) {
                             console.log(res.message);
-                            this.$refs.productDetails.dataSource = madeProductionOrdersPage.madeProductionOrdersFinishedList
-                            this.$refs.material.dataSource = madeProductionOrdersPage.madeProductionOrdersMaterialList
+                            this.$refs.productDetails.form.dataSource = madeProductionOrdersPage.madeProductionOrdersFinishedList
+                            this.$refs.material.form.dataSource = madeProductionOrdersPage.madeProductionOrdersMaterialList
                             this.$refs.TemporaryStorage.dataSource = madeProductionOrdersPage.madeProductionOrdersOutList
-                            this.$refs.SurplusMaterials.dataSource = madeProductionOrdersPage.madeProductionOrdersInList
+                            this.$refs.SurplusMaterials.form.dataSource= madeProductionOrdersPage.madeProductionOrdersInList
                         } else {
                             this.$message.error(res.message);
                         }
@@ -308,9 +344,9 @@
                 //成品明细
                 getAction('/productionOrder/madeProductionOrders/queryMadeProductionOrdersFinishedByMainId',{id:id}).then(res=>{
                     if(res.success){
-                        this.$refs.productDetails.dataSource =res.result
+                        this.$refs.productDetails.form.dataSource =res.result
                         this.$refs.productDetails.planOrg=this.form.pkOrg
-                        this.$refs.productDetails.dataSource.map((item,index)=>{
+                        this.$refs.productDetails.form.dataSource.map((item,index)=>{
                             item.rowNo =index+1
                        })
                        
@@ -324,9 +360,9 @@
                 //材料明细
                 getAction('/productionOrder/madeProductionOrders/queryMadeProductionOrdersMaterialByMainId',{id:id}).then(res=>{
                     if(res.success){
-                        this.$refs.material.dataSource =res.result
+                        this.$refs.material.form.dataSource =res.result
                         this.$refs.material.planOrg=this.form.pkOrg
-                        this.$refs.material.dataSource.map((item,index)=>{
+                        this.$refs.material.form.dataSource.map((item,index)=>{
                             item.rowNo =index+1
                        })
                        
@@ -355,9 +391,9 @@
                 //余料管理
                 getAction('/productionOrder/madeProductionOrders/queryMadeProductionOrdersOutByMainId',{id:id}).then(res=>{
                     if(res.success){
-                        this.$refs.SurplusMaterials.dataSource =res.result
+                        this.$refs.SurplusMaterials.form.dataSource =res.result
                         this.$refs.SurplusMaterials.planOrg=this.form.pkOrg
-                        this.$refs.SurplusMaterials.dataSource.map((item,index)=>{
+                        this.$refs.SurplusMaterials.form.dataSource.map((item,index)=>{
                             item.rowNo =index+1
                        })
                        
@@ -383,14 +419,24 @@
                 this.$set(this.form,'projectCode',data.Code)
                 this.$set(this.form,'projectName',data.Name)
                 this.$set(this.form,'project',data.ID)
-                this.$refs.productDetails.dataSource.map((item,index)=>{
+                this.$refs.productDetails.form.dataSource.map((item,index)=>{
+                    item.projectCode = data.Code
+                    item.projectName = data.Name
+                })
+                this.$refs.material.form.dataSource.map((item,index)=>{
                     item.projectCode = data.Code
                     item.projectName = data.Name
                 })
-                this.$refs.material.dataSource.map((item,index)=>{
+                this.$refs.SurplusMaterials.form.dataSource.map((item,index)=>{
                     item.projectCode = data.Code
                     item.projectName = data.Name
                 })
+                if(this.form.projectName&&this.form.projectName!==''){
+                    this.$refs.form.clearValidate(['projectName']);
+                }
+                if(this.form.projectCode&&this.form.projectCode!==''){
+                    this.$refs.form.clearValidate(['projectCode']);
+                }
             },
             onSearchProject(){
                     if(this.form.orgName&&this.form.orgName!==''){
@@ -428,6 +474,9 @@
                 this.$refs.productDetails.planOrg=this.form.pkOrg
                 this.$refs.material.planOrg=this.form.pkOrg
                 this.$refs.SurplusMaterials.planOrg=this.form.pkOrg
+                if(this.form.orgName&&this.form.orgName!==''){
+                    this.$refs.form.clearValidate(['orgName']);
+                }
             },
             okDataOperators(data){
                 this.$set(this.form,'salesperson',data.Name)
@@ -503,5 +552,9 @@
     }
     /deep/.highlight-row {
         background-color: #E6F7FF;
-}
+    }
+     // 表单校验隐藏提示文字
+     /deep/.ant-form-explain{
+      display:none
+    }
   </style>

+ 10 - 1
src/views/production/productionTotalOrder/productionTotalOrderList.vue

@@ -127,7 +127,7 @@
             <a-button  size="small" @click="examineApprove">审批</a-button>
             <a-button  size="small" @click="abstainExamineApprove">弃审</a-button>
             <a-button size="small" @click="exportList('生产总订单列表')">导出</a-button>
-            <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="fileUpload">
+            <a-upload name="file" :showUploadList="false" @change="handleUploadChange" :multiple="false" :headers="tokenHeader" :action="fileUpload">
                 <a-button  size="small">导入</a-button>
             </a-upload>
           </div>
@@ -357,6 +357,14 @@
               this.queryParam.pageNo=1
               this.getTableList()
             },
+            handleUploadChange({ file, fileList }){
+                if (file.status === 'done'&&file.response.success) {
+                    this.$message.success(file.response.message)
+                    this.getTableList()
+                }else if(file.status === 'done'&&!file.response.success){
+                    this.$message.error(file.response.message)
+                }
+            },
             //单据日期
             changeStartDate(data){
               this.orderDate = data
@@ -375,6 +383,7 @@
             addList(){
                 this.$refs.productionTotalOrderAdd.visible=true
                 this.$refs.productionTotalOrderAdd.defaultMethod='add'
+                this.$refs.productionTotalOrderAdd.form.state='开立'
             },
             editList(){
               if(this.selectedRowKeys.length==0){