Browse Source

bom修改

yaoyq 3 years ago
parent
commit
951481f579

+ 37 - 9
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/programForm/components/ProgramncMgr.vue

@@ -9,7 +9,7 @@
 	  	width="800px" 
 	  	top="50px"
 	>
-		<div class="uploadProgram">
+		<div class="uploadProgram" v-loading="loading">
 		    <el-form ref="form" :model="tenant" :disabled="formDisabled" :rules="rules" label-position="right" label-width="130px">
 		    	<!-- 设备 -->
 		    	<el-form-item :label='$t("prepare.searchForm.resourceId")+":"' prop="resourceIds">
@@ -92,6 +92,7 @@ export default {
   },
   data () {
     return {
+    	loading: false,  // 上传遮罩
     	selectedEq: [], // 新增和修改的设备[设备]数据-来自·(可执行设备(位置))
     	subBtn: false,
     	formDisabled: false,
@@ -176,11 +177,13 @@ export default {
 	
 	  // 点击文件列表中已上传的文件时的钩子
 	  handlePreview(file) {
+	  	this.loading = true;  // 上传遮罩
 	    console.log("上传之前事件:",file);
 	  },
 	  
 	  // 文件超出个数限制时的钩子
 	  handleExceed(files, fileList) {
+	  	this.loading = false;  // 上传遮罩
 	    this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
 	  },
 	  
@@ -201,7 +204,7 @@ export default {
 	  		this.fileObj.programId = response.data.bizId
 	  		// 查询【程序】信息
 	  		// this.getProgram(response.data.filename)
-	  		this.getProgram(response.data.bizId)
+	  		this.getProgram(response.data.bizId);
 	  	}
 	  },
 	  
@@ -218,7 +221,7 @@ export default {
     initTenant () {
       return {
         id: '',
-        no: '',
+        resourceIds: '',
         submittedFileName: '',
         workTime: '',
         filePath: '',
@@ -257,12 +260,32 @@ export default {
     	this.selectedEq = selectedEq;
     	
     	if(val){
-    		this.tenant = { ...val }
+    		this.tenant = { 
+    			id: val.id,
+    			keys: val.keys,
+    			name: val.name,
+    			resourceId: val.resourceId,
+    			resourceIds: val.resourceId +','+ val.name,
+		        workTime: val.workTime
+    		};
+    		this.fileObj= {
+    			nc: '1', // 表示已经上传
+    			size: val.size,
+	  			programId: val.programId,
+	  			submittedFileName: val.name,
+	  			filePath: val.url,
+	  			runTime: val.runTime,
+	  			toolList: val.toolList,
+	  			toolNums: val.toolList ? val.toolList.length : 0
+    		};
     		// 如果附件存在 /
-    		if(!!val.id){
+    		if(!!val.programId){
     			// 查询【程序】信息
-	  			this.getProgram(val.id)
+	  			this.getProgram(val.programId)
     		}
+    	} else {
+    		// 新增,清空数据
+    		this.resetFile();
     	}
     },
     
@@ -294,11 +317,15 @@ export default {
 	          	obj.resourceId = arr[0];   // 设备id
 	          	obj.name = arr[1];   // 设备名称
 	        }
-	        console.log("Form最终数据:", obj);
+	        // console.log("Form最终数据:", obj);
+	        if(this.type == "add") {
+	        	// 添加关键字
+	        	obj.keys = ''+ Math.random();
+	        }
         	// 恢复按钮
           	this.confirmDisabled = true;
-          	// 传值父组件
-          	this.$emit("success", obj);
+      		// 传值父组件
+      		this.$emit("success", obj, this.type);
           	// 关闭
           	this.$emit("close");
           	// 初始化数据
@@ -322,6 +349,7 @@ export default {
     getProgram(programId){
     	programCenterApi.getProgram({id: programId}).then(res => {
     		res = res.data 
+    		this.loading = false;  // 上传遮罩-关闭
     		console.log("根据[程序ID]:", res.data)
     		if(res.isSuccess){
     			const obj = res.data

+ 35 - 28
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/programForm/index.vue

@@ -33,11 +33,10 @@
       <!-- 设备 -->
     	<el-table-column prop="name" :label='$t("prepare.table.program.name")' align="center" width="220px" :show-overflow-tooltip="true">
     		<template slot-scope="{ row }">
-    			<div>{{row.name}}</div>
-    			<!--<div v-if="type == 'view'">{{row.name}}</div>
+    			<div v-if="type == 'view'">{{row.name}}</div>
     			<div v-else>
     				<el-button type="text" @click="edit(row)">{{row.name}}</el-button>
-    			</div>-->
+    			</div>
     		</template>
     	</el-table-column>
     	<!-- 托盘夹具组 -->
@@ -208,9 +207,13 @@
 	        type: "warning"
 	      }).then(() => {
 	    		// 过滤我们需要的数据
-		  		let list = this.tableData.filter(item => item.key != row.key)
+		  		let list = this.tableData.filter(item => {
+		  			let f1 = item.keys || item.id;
+		  			let f2 = row.keys || row.id;
+		  			return f1 != f2
+		  		});
 		  		// 重新赋值
-		  		this.tableData = list
+		  		this.tableData = list;
 	      }).catch(() => {})
 	  	},
 	  	// table的当前行,变化-事件
@@ -221,6 +224,7 @@
 		  // 【程序管理】按钮-事件
 	  	addProgram(){
 	  		this.dialogProg.title = this.$t("common.add");
+	  		this.$refs.programnc.type = "add";
 	  		this.$refs.programnc.setTenant(false, this.selectedEq);
 	  		// 打开弹出框
 	  		this.dialogProg.isVisible = true;
@@ -232,26 +236,25 @@
 	  	},
 	  	
 	  	// 【程序管理-确定】按钮-事件
-	  	editProgSuccess(obj){
-	  		// 给选择的数据,赋值
-	  		this.tableData.push(obj);
-	  		/*let list = []
-	  		this.tableData.forEach(item => {
-	  			if(item.key == this.currentRow.key){
-						item.nc = obj.nc // 是否上传
-		  			item.name = obj.name
-		  			item.programId  = obj.programId  // 附件的id
-		  			item.filePath  = obj.filePath    // 附件的名称
-		  			item.runTime = obj.runTime
-		  			item.toolList = obj.toolList
-		  			item.workTime = obj.workTime    	// 加工时间
-		  			item.toolNums = obj.toolNums
-	  			}
-	  			list.push(item)
-	  		})
-	  		// 赋值
-	  		this.tableData =  list*/
+	  	editProgSuccess(obj, type){
+	  		if(type == "add") {
+	  			// 给选择的数据,赋值
+	  			this.tableData.push(obj);
+	  		} else {
+	  			let arr = [];
+	  			this.tableData.map(item => {
+	  				let f1 = item.keys || item.id;
+	  				let f2 = obj.keys || obj.id;
+	  				if (f1 == f2){
+	  					arr.push(obj);
+	  				} else {
+	  					arr.push(item);
+	  				}
+	  			});
+	  			this.tableData = arr;
+	  		}
 	  	},
+	  	
 	    viewClose () {
 	      this.tenantViewVisible = false
 	    },
@@ -339,12 +342,16 @@
 	      }
 	    	this.edit(this.selection[0]);
 	    },
+	    
+	    // [NC程序]修改-事件
 	    edit (row) {
-	      this.$refs.edit.setTenant(row, this.selectedEq, this.selectedTray)
-	      this.$refs.edit.type = "edit"
-	      this.dialog.title = this.$t("common.edit")
-	      this.dialog.isVisible = true
+	      this.$refs.programnc.setTenant(row, this.selectedEq)
+	      this.$refs.programnc.type = "edit"
+	      this.dialogProg.title = this.$t("common.edit")
+	      // 打开弹出框
+	  		this.dialogProg.isVisible = true;
 	    },
+	    
 	    fetch (params = {}) {
 	    	
 	    }