| 
					
				 | 
			
			
				@@ -47,6 +47,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 remote 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                          filterable 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                          :remote-method="remoteApplier" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                         @change="onApplierChanged" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 placeholder="请选择"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 <el-option 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   v-for="item in optionsApplier" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -150,8 +151,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               width="150" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               label="操作"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               <template slot-scope="scope"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                <el-button type="text" size="small" @click="addMaterialHandle(scope.row.materialId, false)">编辑</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                <el-button style="color: red" type="text" size="small" @click="deleteMaterialHandle(scope.row.materialId)">删除</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <el-button type="text" size="small" @click="addMaterialHandle(scope.row, false)">编辑</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <el-button style="color: red" type="text" size="small" @click="deleteMaterialHandle(scope.row.detailId)">删除</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </el-table-column> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           </el-table> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -166,7 +167,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </el-dialog> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- 新增物品 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <Add v-show="addMaterialVisible" ref="comAddMaterial" @refreshDataList="getMaterialDetails"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <Add v-show="addMaterialVisible" ref="comAddMaterial" @addItem="addMaterialCallback"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -180,11 +181,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     components: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       Add 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    computed: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      orgId: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        get () { return this.$store.state.user.orgId } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     data () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         visible: false, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -197,8 +193,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         materialDetails: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         addMaterialVisible: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dataRule: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          // drawingName: [{ required: true, message: '图纸名称不能为空', trigger: 'blur' }], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          // source: [{ required: true, message: '图纸来源不能为空', trigger: 'blur' }] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          purchaseType: [{ required: true, message: '请选择采购类别', trigger: 'change' }], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          applierId: [{ required: true, message: '请选择申请人', trigger: 'change' }] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -212,6 +208,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       async init (id, display) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.materialDetails = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.dataForm = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           payType: '0' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -267,7 +264,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       async remoteApplier (query) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!query) return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const params = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          name: query 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          name: query.trimStart() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         await getUserList(params).then(({data}) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (data && data.code === '200') { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -275,37 +272,52 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             data.data.records.forEach((item) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.optionsApplier.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 code: item.userId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                value: item.name + '( 用户名: ' + item.username + ' )' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                value: item.name + '  (用户名: ' + item.username + ')', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                orgId: item.orgId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                orgName: item.orgName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       addMaterial () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.materialListVisible = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.addMaterialVisible = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.$nextTick(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.$refs.comAddMaterial.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      addMaterialHandle (id, disable) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      addMaterialHandle (row, disable) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.addMaterialVisible = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.$nextTick(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.$refs.comAddMaterial.init(id, disable) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$refs.comAddMaterial.init(row.detailId, disable, row) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       deleteMaterialHandle (id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // if (!id) return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.materialDetails.splice(this.materialDetails.findIndex((item) => item.id === id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      getMaterialDetails () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      addMaterialCallback (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!data) return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.addMaterialVisible = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // todo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let i = this.materialDetails.findIndex((item) => item.detailId === data.detailId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (i > -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.materialDetails.splice(i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.materialDetails.push(data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 百分比 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       formatPercent (row) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!row.taxRate) return '' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let str = Number(row.taxRate * 100) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log('taxRate: ' + row.taxRate) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let str = (Number(row.taxRate * 100)).toFixed(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         str += '%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return str 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      onApplierChanged (val) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!val) return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let item1 = this.optionsApplier.find((item) => item.code === val) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!item1) return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.dataForm.deptName = item1.orgName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.dataForm.orgId = item1.orgId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 |