| 
					
				 | 
			
			
				@@ -1,25 +1,64 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <!-- 委外 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <div class="my-title">委外</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <div class="my-title">{{subTitle}}</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <!-- 表单 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <el-form-item label="供应商" prop="supplierId"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <supplier-component v-model="dataForm.supplierId" :supplier-id.sync="dataForm.supplierId"></supplier-component> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <el-form-item label="不含税单价" prop="price"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <el-input-number v-model="dataForm.price" :step="1" :min="0" :precision="1"></el-input-number> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <el-form-item label="含税单价" prop="taxPrice"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <el-input-number v-model="dataForm.taxPrice" :step="1" :min="0" :precision="1"></el-input-number> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <el-form-item label="含税总价" prop="taxAmount"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <span>{{dataForm.cnt * dataForm.taxPrice}}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <el-form-item label="税率" prop="taxRate"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <el-input-number style="width: 160px" v-model="dataForm.taxRate" :step="1" :precision="1"/> % 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </el-form> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <div class="form-item" v-for="(item, index) in dataForm.list" :key="item.purchaseDetailId"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-row> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-col :span="6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-form-item label="物料名称"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <span>{{item.productName}}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-col :span="6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-form-item label="物料规格"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <span>{{item.productSpec}}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-col :span="6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-form-item label="数量"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <span>{{item.cnt}}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-col :span="6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-form-item label="图号"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <span>{{item.batchNumber}}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          </el-row> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-row class="my-row"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-col :span="6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-form-item ref="supplierCheckbox" label="供应商" :prop="'list.' + index + '.supplierId'" :rules="dataRule.supplierId"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <supplier-component v-model="item.supplierId" :supplier-id.sync="item.supplierId"></supplier-component> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-col :span="6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-form-item label="不含税单价" :prop="'list.' + index + '.price'" :rules="dataRule.price"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <el-input-number v-model="item.price" :step="1" :min="0" :precision="1"></el-input-number> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-col :span="6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-form-item label="含税单价" :prop="'list.' + index + '.taxPrice'" :rules="dataRule.taxPrice"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <el-input-number v-model="item.taxPrice" :step="1" :min="0" :precision="1"></el-input-number> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-col :span="6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-form-item label="含税总价"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <span>{{ item.cnt * item.taxPrice }}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          </el-row> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-row class="my-row"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-col :span="6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <el-form-item label="税率" :prop="'list.' + index + '.taxRate'" :rules="dataRule.taxRate"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <el-input-number v-model="item.taxRate" :step="1" :precision="1"/> % 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </el-col> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          </el-row> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      </el-form> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <span slot="footer" class="dialog-footer"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-button @click="onChose">取消</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-button type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -48,23 +87,50 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           price: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           taxPrice: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           taxRate: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          cnt: 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          cnt: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          list:[] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dataRule: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           supplierId: [{ required: true, message: '请选择供应商', trigger: 'change' }], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           price: [{ required: true, message: '不含税单价不能为空', trigger: 'change' }], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           taxPrice: [{ required: true, message: '含税单价不能为空', trigger: 'change' }], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           taxRate: [{ required: true, message: '税率不能为空', trigger: 'change' }] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        subTitle:''//副标题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     methods: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       onChose () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.$emit('onChose') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      async init (id, cnt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.dataForm.purComDetailId = id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.dataForm.cnt = cnt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      async init (rows) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(rows instanceof Array){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.subTitle = '批量委外' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.dataForm.list = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          let list = rows.map(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              purComDetailId:item.purComDetailId,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              cnt:item.cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              price:1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              taxPrice:1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              taxRate:1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.dataForm.list = list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.subTitle = '委外' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.dataForm.list = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              purComDetailId:rows.id,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              cnt:rows.cnt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              price:1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              taxPrice:1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              taxRate:1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log('dataForm',this.dataForm) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       validateField (type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.$refs.dataForm.validateField(type) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -96,5 +162,10 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <style scoped> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+.form-item { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  margin: 5px 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  padding:25px 0 5px; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  background-color: #f1f9f9; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  border-radius: 10px; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </style> 
			 |