Browse Source

刀具分组前端处理

oyq28 5 hours ago
parent
commit
297c463f7d

+ 10 - 0
imcs-ui/src/api/resourceProductMgr/programCenter.js

@@ -89,6 +89,10 @@ const apiList = {
   getCutterCategory: {
     method: 'POST',
     url: `/authority/cutterCategory/page`
+  },
+  getBomProcedureTool: {
+    method: 'POST',
+    url: `/authority/cutterCategory/getBomProcedureTool`
   }
 }
 
@@ -229,5 +233,11 @@ export default {
       ...apiList.getCutterCategory,
       data
     })
+  },
+  getBomProcedureTool (data) {
+    return axiosApi({
+      ...apiList.getBomProcedureTool,
+      data
+    })
   }
 }

+ 59 - 74
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/programForm/components/ProgramncMgr.vue

@@ -58,12 +58,12 @@
 				      	:data="toolList"
 				      	style="width: 100%"
 				    >
-					   <el-table-column prop="partsAlias" label='零件号'>
+					   <el-table-column prop="partsAlias" label='零件号'>
 					      	<template slot="header">
-			   					<span>零件号</span>			   					
+			   					<span>零件号</span>			   					
 							</template>
 							<template slot-scope="{ row }">
-					      		<span>{{ row.partsAlias}}</span>
+					      		<span>{{ row.partsNo}}</span>
 					      	</template>							
 				      	</el-table-column>
 
@@ -76,24 +76,6 @@
 					      	</template>							
 				      	</el-table-column>
 
-						<!--
-				      	<el-table-column prop="cuttingToolCategory" :label='$t("resource.table.programTool.cuttingToolCategory")'>
-					      	<template slot="header">
-			   					<span>{{$t("resource.table.programTool.cuttingToolCategory")}}</span>
-			   					<span class="star">*</span>
-							</template>
-							<template slot-scope="{ row }">
-					      		<el-select v-model="row.cuttingToolCategory" filterable :placeholder='$t("common.pleaseEnter")'>
-										<el-option
-        									v-for="(item,key,index) in toolSelectList"
-        									:key="index"
-        									:label="item.procedureNo"
-        									:value="item.id">
-                    					</el-option>
-								</el-select>
-					      	</template>
-				      	</el-table-column>	-->
-
 				      	<el-table-column label='刀具数量'>
 					      	<template slot="header">
 			   					<span>刀具数量</span>			   					
@@ -101,12 +83,7 @@
 							<template slot-scope="{ row }">
 					      		<span v-if="row.count">{{ row.count}}</span>
 					      	</template>							
-				      	</el-table-column>
-				      	<!--<el-table-column prop="count" :label='$t("resource.table.programTool.count")'>
-					      	<template slot-scope="{ row }">
-					      		<el-input-number v-model="row.count" :min="1" :max="999999999" label="数量"></el-input-number>
-					      	</template>
-				      	</el-table-column>-->
+				      	</el-table-column>				      	
 				      	<!-- 操作 -->
 				      	<el-table-column
 					        :label="$t('table.operation')"
@@ -133,6 +110,13 @@
 					        </template>
 				      	</el-table-column>
 				    </el-table>
+					<el-row :gutter="12" v-show="toolList.length>0">
+						<el-col :xs="24">
+							<el-input v-model="cuttingToolNames" :readOnly="true" type="textarea" :rows="8" style="width: 100%;"/>
+						</el-col>
+					</el-row>	
+
+					
 		      	</div>
 
 		    </el-form>
@@ -175,6 +159,7 @@ export default {
         	CUTTING_TOOL_CATEGORY: {}
       	},
 		cuttingToolCategory:{},
+		cuttingToolNames:"",
     	tableData: [],
     	eqList: [], // 设备下拉类别数据
     	toolList: [], // 刀具列表
@@ -266,36 +251,32 @@ export default {
 
 		// 初始化,【刀具下拉】
 		getToolList(arrs){
+			if(arrs.length == 0)
+			{
+				this.$message.warning('刀具分组数据不存在')			
+				return false;
+		    }
+			let arr = arrs[0].cuttingToolCategory.split("_")
+
 			this.queryParams.current = 1
 			this.queryParams.size = 9999
-			this.queryParams.map.state = 1
-			let arr = this.tenant.resourceIds.split(",")
-			if(arr.length>0){
-				this.queryParams.model.deviceId = arr[0]
-			}
-
-			if(arrs.length > 0){
-				this.queryParams.map.ids = arrs.map(item=>{return item.cuttingToolCategory}).join(',')
-			}
-
-			programCenterApi.toolList(this.queryParams).then(res => {
-	    		res = res.data
-	    		// console.log("【刀具下拉】下拉数据:", res)
-	    		if(res.isSuccess){
-					let arr = []
-					res.data.records.forEach(item =>{
-						const parent = arr.find(cur => cur.label === item.cuttingToolType.data)
-						if(parent){
-                           parent.options.push(item)
-						}else{
-						   let groupObj = {}
-						   groupObj.label = item.cuttingToolType.data
-						   groupObj.options = [item]
-						   arr.push(groupObj)
-						}
-					});
-					this.toolSelectList = arr
-	    		}
+			this.queryParams.model.partsNo = arr[0]
+			this.queryParams.model.procedureNo = arr[1]
+			let that = this
+			  programCenterApi.getCutterCategory(this.queryParams).then(res => {
+	    		res = res.data	    	
+    			if(res.isSuccess){    						
+					that.cuttingToolNames = res.data.records.map(item=>item.cutterName).join('\n')	
+					that.toolList = []							
+					that.toolList.push({
+      				id: arrs[0].id,
+      				cuttingToolCategory: arrs[0].cuttingToolCategory,
+      				partsNo: arr[0],
+					procedureNo: arr[1],      	
+      				count: res.data.total,					
+      				isEdit: false
+      			});
+    		  }	    		
 	    	})
 		},
 
@@ -387,6 +368,7 @@ export default {
     // 父组件,设置子组件的值-方法
     setTenant (val, selectedEq) {
     	 console.log("设备:", selectedEq)
+		 console.log("val:", val)
     	// 表单下拉数据,赋值,动态数据
     	this.selectedEq = selectedEq;        
 
@@ -426,7 +408,7 @@ export default {
     			// 查询【程序】信息
 	  			this.getProgram(pid);
     		}
-			//this.getToolList(this.toolList)
+			this.getToolList(this.toolList)
     	} else {
     		// 新增,清空数据
     		this.resetFile();
@@ -435,21 +417,27 @@ export default {
 
     // 【新增】按钮-事件
     addRes(){		
+		if(this.toolList.length>0){
+			this.$message.warning('刀具分组已经存在,请勿重复添加')			
+			return false;
+		}
+
 		this.queryParams.current = 1
 		this.queryParams.size = 9999
 		this.queryParams.model.partsNo = this.cuttingToolCategory.parts_no
 		this.queryParams.model.procedureNo = this.cuttingToolCategory.no
+		let that = this
 		programCenterApi.getCutterCategory(this.queryParams).then(res => {
     		console.log("根据id,查询详情BOM:", res.data);
     		res = res.data
-    		if(res.isSuccess){
-    			console.log(res)
-				this.toolList.push({
+    		if(res.isSuccess){    						
+				that.cuttingToolNames = res.data.records.map(item=>item.cutterName).join('\n')								
+				that.toolList.push({
       				key: "WKS_"+ Math.random(),
-      				cuttingToolCategory: this.cuttingToolCategory.parts_no+"_"+this.cuttingToolCategory.no,
-      				partsNo: this.cuttingToolCategory.parts_alias,
-					procedureNo: this.cuttingToolCategory.no,      	
-      				count: 0,
+      				cuttingToolCategory: that.cuttingToolCategory.parts_no+"_"+ that.cuttingToolCategory.no,
+      				partsNo: that.cuttingToolCategory.parts_no,
+					procedureNo: that.cuttingToolCategory.no,      	
+      				count: res.data.total,					
       				isEdit: false
       			});
     		}
@@ -516,25 +504,22 @@ export default {
       this.$refs.form.validate((valid) => {
 		let bool = true;
 		let msg = ""
-		if(this.toolList.length ==0 && this.toolSelectList.length>0){
+		if(this.toolList.length ==0){
             bool = false
 			msg = "刀具设备不能为空"
-		}else if(this.toolList.length>0) {
+		}else if(this.toolList.length == 1) {
 			this.toolList.forEach(item => {
               if(!item.cuttingToolCategory){
 				 bool = false
 				 msg = "刀具类别不能为空"
 				 return false
 			  }else{
-				  if(idArr.indexOf(item.cuttingToolCategory)<0){
-				  	idArr.push(item.cuttingToolCategory)
-				  }else{
-					bool = false
-				 	msg = "同名类别不能重复选择"
-				    return false
-				  }
+				idArr.push(item.cuttingToolCategory)
 			  }
 			});
+		}else if(this.toolList.length > 1){
+             bool = false
+			 msg = "刀具分组数量大于1"
 		}
         if(!bool){
             this.$message({
@@ -552,7 +537,7 @@ export default {
         	if(obj.toolList && obj.toolList.length > 0){
         		let arr = [];
         		obj.toolList.map(item => {
-        			let target = this.toolSelectList.filter(obj => obj.id = item.cuttingToolCategory)[0];
+        			//let target = this.toolSelectList.filter(obj => obj.id = item.cuttingToolCategory)[0];
         			// 把刀具名称带出来
         			//item.toolName = target.cuttingToolName;
         			// 添加数据
@@ -570,7 +555,7 @@ export default {
 	        	// 添加关键字
 	        	obj.keys = ''+ Math.random();
 	        }
-	        // console.log("Form最终数据:", obj);
+	        console.log("Form最终数据:", obj);
 	        // return false;
         	// 恢复按钮
           	this.confirmDisabled = true;

+ 1 - 3
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/programForm/index.vue

@@ -224,9 +224,7 @@
 		  // 【程序管理】按钮-事件
 	  	addProgram(){
 	  		this.dialogProg.title = this.$t("prepare.common.addProgram"); // this.$t("common.add")
-	  		this.$refs.programnc.type = "add";
-			console.log("程序管理")
-			console.log(this.selectedEq)
+	  		this.$refs.programnc.type = "add";			
 	  		this.$refs.programnc.setTenant(false, this.selectedEq);
 	  		// 打开弹出框
 	  		this.dialogProg.isVisible = true;