yaoyq 3 years ago
parent
commit
fd3b389c41

+ 2 - 1
imcs-ui/src/lang/zh/prepare.js

@@ -210,7 +210,8 @@ export default {
 				programType: '位置程序类型',
 				positions: '程序加工位置',
 				prority: '优先级',
-				addTime: '加工时间'
+				addTime: '加工时间',
+        submittedFileName: '程序名称'
 			},
 			// 【工艺版本管理-工艺分析-质检要求】列表table字段名称
 			quality: {

+ 4 - 3
imcs-ui/src/lang/zh/resource.js

@@ -90,7 +90,7 @@ export default {
 				nums: '资源数量',
 				layoutMap: '布局图',
 				resources: '包含生产资源',
-				mode: '产线模式',  
+				mode: '产线模式',
 				remark: '备注',
 				status: '启用状态',
 				createUser: '操作人',
@@ -127,9 +127,9 @@ export default {
 				capitalType: '资产类别',
 			    modeSpecification: '型号规格',
 				capitalPrice: '资产原值',
-				productionDate: '出厂年月', 
+				productionDate: '出厂年月',
 				productionNo: '出厂编号',
-				manufacturer: '制造厂家',				
+				manufacturer: '制造厂家',
 				model: '型号',
 				category: '分类',
 				zoneName: '所属区域',
@@ -258,6 +258,7 @@ export default {
 			userNums: '额定使用次数',
 			warninhNums: '报警次数',
 			prority: '优先级',
+      workTime: '加工时间',
 			pg: '程序',
 			pgNo: '程序编号',
 			pgName: '程序名称',

+ 33 - 33
imcs-ui/src/views/zuihou/machiningClient/waitingTasks/components/View.vue

@@ -65,7 +65,7 @@
     			</tr>
     		</table>
     	</el-row>
-    	
+
     	<!-- 自动化执行流程 -->
     	<el-row>
     		<p class="titleP">{{$t("runCenter.form.viewSched.autoLiuc")}}</p>
@@ -166,7 +166,7 @@
 		      	<template slot-scope="{ row }">
 		      		<el-button type="primary" plain size="mini" @click="print(row)">打码</el-button>
 					<el-button type="primary" plain size="mini" @click="read(row)">读RFID</el-button>
-					<el-button type="primary" plain size="mini" @click="write(row)">写RFID</el-button>  
+					<el-button type="primary" plain size="mini" @click="write(row)">写RFID</el-button>
 		      	</template>
 		      </el-table-column>
 		      <!-- 校验结果 -->
@@ -192,8 +192,8 @@
 		        </template>
 		    	</el-table-column>
 		    </el-table>
-    	</el-row>	
-    	
+    	</el-row>
+
     	<!-- 托盘夹具组 -->
     	<el-row>
     		<p class="titleP">{{$t("prepare.common.tpJgroup")}}</p>
@@ -235,9 +235,9 @@
 		      <el-table-column prop="armorPic" :label='$t("prepare.table.toolGroup.armorPic")' align="center" width="180px">
 		      	<template slot-scope="{ row }" v-if="row.category.key == '02'">
 		      		<div v-if="row.jjImgList && row.jjImgList.length > 0" class="demo-image__preview">
-							  <el-image 
+							  <el-image
 							    style="width: 100px; height: 60px"
-							    :src="row.jjImgList[0]" 
+							    :src="row.jjImgList[0]"
 							    :preview-src-list="row.jjImgList">
 							  </el-image>
 							</div>
@@ -251,7 +251,7 @@
 		      	<template slot-scope="{ row }">
 		      		<el-input size="small" v-model="row.uniqueCode" :placeholder='$t("common.pleaseEnter")'></el-input>
 		      	</template>
-		      </el-table-column>			  
+		      </el-table-column>
 		      <!-- 校验结果 -->
 		      <el-table-column v-if="tenant.loadingType=='1'" prop="checkData" :label='$t("prepare.table.tools.verificationResults")' align="center" width="150px">
 		      	<template slot-scope="{ row }">
@@ -276,7 +276,7 @@
 		    	</el-table-column>
 		    </el-table>
     	</el-row>
-    	
+
     	<!-- 【库位产品】组件 -->
 	    <product-select
 	      	ref="product"
@@ -284,7 +284,7 @@
 	      	@success="selectedCode"
 	      	@close="viewClose"
 	    />
-    		
+
     	<div slot="footer" class="dialog-footer">
 	      <el-button plain type="info" @click="isVisible = false">{{ $t('machining.buttons.noFinished') }}</el-button>
 	      <el-button type="primary" :disabled="confirmDisabled" @click="submitForm">{{ $t('machining.buttons.finished') }}</el-button>
@@ -338,7 +338,7 @@ export default {
 	  	tableData1: [],
 	  	tableData2: [],
 	  	currentRow: null, // 当前选择的行
-	  	
+
 	  	spanArr: [],  // 【组序】合并单元格
 	    spanArr2: [],  // 【优先级】合并单元格
     }
@@ -370,11 +370,11 @@ export default {
 	  	this.$refs.product.setTenant(this.tenant, row, flag)
 	  	this.productVisible = true
     },
-    
+
   	viewClose () {
       	this.productVisible = false
     },
-    
+
     // 【从库位选-入产线编码】返回的数据-函数
     selectedCode(cRow, uniqueCode, flag){
     	// console.log("子组件的传值:", cRow, uniqueCode, flag)
@@ -393,10 +393,10 @@ export default {
     		})
     	}
     },
-    
+
     // 【校验】按钮-事件
     checkMeterialResult(row, flag){
-    	if(row.uniqueCode){    		
+    	if(row.uniqueCode){
     		// 如果是【所需原材料】
 	    	if(flag == "meterial"){
 	    		this.tenant.meterialList = [row]
@@ -439,7 +439,7 @@ export default {
         })
     	}
     },
-    
+
     // 【新料入库】按钮-事件
     taskNodeStockIn(row, flag){
     	// 如果是【所需原材料】
@@ -460,7 +460,7 @@ export default {
     	// eslint-disable-next-line no-return-assign
   		}).finally(() => this.loading = false)
     },
-    
+
     // 【移库】按钮-事件
     taskNodeStockTran(row, flag){
     	if(row.uniqueCode){
@@ -490,7 +490,7 @@ export default {
         })
     	}
     },
-    
+
   	submitForm(){
   		let obj ={
   			taskNode: this.tenant,
@@ -559,7 +559,7 @@ export default {
         }
         // eslint-disable-next-line no-return-assign
       }).finally(() => this.loading = false)
-     
+
     },
     //获得数据相同的行数
  		rowspanFiled(data, filed) {
@@ -621,7 +621,7 @@ export default {
     // 根据【工艺id】查询详情信息
     getDetail(obj){
     	machiningClientApi.getTaskNodeProcessAnalysis(obj).then(res => {
-    		res = res.data 
+    		res = res.data
     		if(res.isSuccess){
     			console.log("详情信息:", res.data)
     			// 给各个组件赋值
@@ -640,32 +640,32 @@ export default {
     		}
     	})
     },
-	
+
 	//打码接口调用
 	print(row){
 		let code = row.uniqueCode
 		/*
 		machiningClientApi.print({param: code}).then(res => {
-		   
+
 		}) */
 		var socket = null
 		try{
             socket = new WebSocket('ws://192.168.170.69:8888')
 			socket.onopen= function(){
 				console.log("连接成功!")
-			    socket.send(code)			
+			    socket.send(code)
 			}
 			socket.onmessage= function(msg){console.log(msg)}
 			socket.onerror = function(e){alert("连接失败:"+e)}
 			socket.onclose= function(e){
 				console.log("连接关闭:"+ e.code)
 				socket.close()
-			}		   
+			}
 		}catch(ex){
-           alert('连接异常'+ex); 
+           alert('连接异常'+ex);
 		   return;
-		}						
-	}, 
+		}
+	},
     read(row){
 		let params = {
 			Url: "192.168.170.61",
@@ -679,8 +679,8 @@ export default {
 		}
         if(row!=null){
             params['TaskId'] = this.tenant.taskId
-			params['TaskNodeId'] = row.id			
-		}else{			 
+			params['TaskNodeId'] = row.id
+		}else{
 			 this.$emit('get-data', "222222")
 			 return false
 		}
@@ -689,7 +689,7 @@ export default {
 		//let url =  "http://192.168.170.202:8089"
 
 		machiningClientApi.read(JSON.stringify(params)).then(res => {
-		      console.log(res) 
+		      console.log(res)
 			  if(res.code == "1"){
 				  this.$message({
 		          	 message: this.$t("tips.optionSuccess"),
@@ -709,7 +709,7 @@ export default {
 		          })
 				  this.$refs.rfidMsg.innerHTML = ""
 				  this.isMsgVisible = false
-			  }    
+			  }
 		})
 
 	},
@@ -730,7 +730,7 @@ export default {
               console.log(e);
 			  this.RFIDMsg = ""
         }); */
-  
+
 		machiningClientApi.write(JSON.stringify(params)).then(res => {
 		      console.log(res)
 			  if(res.code == "1"){
@@ -747,7 +747,7 @@ export default {
 		         })
 				 this.$refs.rfidMsg.innerHTML = ""
 				 this.isMsgVisible = false
-			  }     
+			  }
 		})
 
 	},
@@ -816,4 +816,4 @@ export default {
 		background: #EEEEEE;
 		color: #333333;
 	}
-</style>
+</style>

+ 2 - 2
imcs-ui/src/views/zuihou/prepareProductMgr/technologyMgr/components/TechnologyEdit.vue

@@ -52,10 +52,10 @@
 		  			<!-- 所需原材料 -->
 		  			<!-- <material-form ref="material" :type="type"></material-form> -->
 		  			
-		  			<!-- 托盘夹具 -->
+		  			<!-- 夹具 -->
 		  			<tray-form ref="tray" :type="type" @setProgram="setProgramByTray"></tray-form>
 		  			
-		  			<!-- 程序 -->
+		  			<!-- NC程序 -->
 		  			<program-form ref="program" :type="type"></program-form>
 		  			
 		  			<!-- 人工质检 -->

+ 2 - 2
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/TechnologyEdit.vue

@@ -54,10 +54,10 @@
 		  			<!-- 所需原材料 -->
 		  			<!-- <material-form ref="material" :technology="currentRow"></material-form> -->
 		  			
-		  			<!-- 托盘夹具 -->
+		  			<!-- 夹具 -->
 		  			<tray-form ref="tray" :technology="currentRow" @clearProgram="clearProgram" @setProgram="setProgramByTray"></tray-form>
 		  			
-		  			<!-- 程序 -->
+		  			<!-- NC程序 -->
 		  			<program-form ref="program"></program-form>
 		  			
 		  			<!-- 人工质检 -->

+ 387 - 0
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/programForm/components/ProgramncMgr.vue

@@ -0,0 +1,387 @@
+<!-- NC程序-新增-->
+<template>
+	<el-dialog 
+	  	:close-on-click-modal="false" 
+	  	:close-on-press-escape="false" 
+	  	:title="title" 
+	  	:append-to-body="true"
+	  	:visible.sync="isVisible" 
+	  	width="800px" 
+	  	top="50px"
+	>
+		<div class="uploadProgram">
+		    <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">
+		    	 	<el-select v-model="tenant.resourceIds" :placeholder='$t("common.pleaseSelect")' style="width: 50%;">
+				      	<el-option v-for="item in selectedEq" :key="item.resourceId" :label="item.name" :value="item.resourceId+','+item.name"></el-option>
+				    </el-select>
+		      	</el-form-item>
+		    	<!-- 上传程序 -->
+		      	<el-form-item :label='$t("resource.form.pgUpload")+":"' prop="filePath">
+		      		<el-input v-model="fileObj.filePath" :readOnly="true" :placeholder='$t("common.pleaseEnter")'/>
+		          	<el-upload
+		          		accept=".*"
+					  	class="upload-demo"
+					  	:headers="headers"
+					  	:action="action"
+					  	:data="fileOtherData"
+					  	:on-preview="handlePreview"
+					  	:on-remove="handleRemove"
+					  	:before-remove="beforeRemove"
+					  	:on-success="handleSuccess"
+					  	:on-error='handleError'
+					  	:on-progress="handlePropress"
+					  	multiple
+					  	:limit="1"
+					  	:on-exceed="handleExceed"
+					  	:file-list="fileList">
+					  <el-button size="small" type="primary">{{$t("common.upload")}}</el-button>
+					  <!--<div slot="tip" class="el-upload__tip">{{$t("resource.tips.fileTips")}}</div>-->
+					</el-upload>
+		      	</el-form-item>
+		      	<!-- 加工时间 -->
+			    <el-form-item :label='$t("resource.form.workTime")+":"' prop="workTime">
+			        <el-input v-model="tenant.workTime" :placeholder='$t("common.pleaseEnter")' style="width: 50%;"/>&nbsp;&nbsp;分钟
+			    </el-form-item>
+		      	<!-- 程序内容 -->
+		      	<el-form-item :label='$t("resource.form.pgContent")+":"' prop="pgContent">
+		        	<el-input v-model="pgContent" :readOnly="true" type="textarea" :rows="6" style="width: 100%;"/>
+		      	</el-form-item>
+		      	<!-- 刀具解析结果 -->
+		      	<div>
+		      	<h2 class="editTitle">{{$t("prepare.common.toolfx")}}</h2>
+		      		<el-table
+				      :data="toolList"
+				      style="width: 100%"
+				    >
+				      <el-table-column prop="specification" :label='$t("resource.table.programTool.specification")'></el-table-column>
+				      <el-table-column prop="model" :label='$t("resource.table.programTool.model")'></el-table-column>
+				      <el-table-column prop="brand" :label='$t("resource.table.programTool.brand")'></el-table-column>
+				      <el-table-column prop="usageTime" :label='$t("resource.table.programTool.usageTime")'></el-table-column>
+				      <el-table-column prop="duration" :label='$t("resource.table.programTool.duration")'></el-table-column>
+				    </el-table>
+		      	</div>
+		      
+		    </el-form>
+		    <div slot="footer" class="dialog-footer" style="margin-top: 15px;text-align: right;">
+		      <el-button plain type="warning" @click="isVisible = false">{{ $t('common.cancel') }}</el-button>
+		      <el-button plain type="primary" :disabled="subBtn" @click="submitForm">{{ $t('common.confirm') }}</el-button>
+		    </div>
+	    </div>
+	</el-dialog>
+</template>
+<script>
+// 【程序中心】-API
+import programCenterApi from "@/api/resourceProductMgr/programCenter"
+// 【设备(生产资源)】-API
+import productionResourcesMgrApi from "@/api/resourceProductMgr/productionResourcesMgr"
+import db from "@/utils/localstorage";
+import {Base64} from 'js-base64';
+export default {
+  name: 'ProgramncMgr',
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    title: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+    	selectedEq: [], // 新增和修改的设备[设备]数据-来自·(可执行设备(位置))
+    	subBtn: false,
+    	formDisabled: false,
+    	tableData: [],
+    	eqList: [], // 设备下拉类别数据
+    	toolList: [], // 刀具列表
+    	pgContent: '',  // 程序内容
+      	type: 'add',
+      	tenant: this.initTenant(),
+      	screenWidth: 0,
+      	width: this.initWidth(),
+      	confirmDisabled: false,
+      	fileObj: {}, // 附件信息
+      	// 附件上传
+      	action: `${process.env.VUE_APP_BASE_API}/file/attachment/upload`,
+      	// 附件其它参数
+      	fileOtherData: {
+	      	bizId: "",
+	        bizType: "PROGRAM"
+	    },
+      	// 附件的值
+      	fileList: [/*
+      		{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, 
+      		{name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}
+      	*/],
+      	rules: {
+	      	resourceIds: [
+	        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+	        ],
+	        filePath1: [
+	        	{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
+	        ]
+      	}
+    }
+  },
+  	// 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
+	created() {
+		// 查询【程序】信息
+		if(!!this.programId){
+			this.getProgram(this.programId)
+		}
+	},
+	watch: {
+		programId(val){
+			console.log("值变化了:", val)
+			// 查询【程序】信息
+	  		this.getProgram(val)
+		}
+	},
+  computed: {
+  	headers() {
+      return {
+        token: 'Bearer ' + db.get("TOKEN", ""),
+        tenant: db.get("TENANT", "") || "",
+        Authorization: `Basic ${Base64.encode(`${process.env.VUE_APP_CLIENT_ID}:${process.env.VUE_APP_CLIENT_SECRET}`)}`
+      };
+    },
+    isVisible: {
+      get () {
+        return this.dialogVisible
+      },
+      set () {
+        this.close()
+        this.reset()
+      }
+    }
+  },
+  mounted () {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth()
+      })()
+    }
+  },
+  methods: {
+  	// 文件列表移除文件时的钩子
+  	handleRemove(file, fileList) {
+	    console.log("删除事件:", file, fileList);
+	    // 还原数据
+	    this.resetFile()
+	},
+	
+	  // 点击文件列表中已上传的文件时的钩子
+	  handlePreview(file) {
+	    console.log("上传之前事件:",file);
+	  },
+	  
+	  // 文件超出个数限制时的钩子
+	  handleExceed(files, fileList) {
+	    this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
+	  },
+	  
+	  // 删除文件之前的钩子,参数为上传的文件和文件列表,若返回 false 或者返回 Promise 且被 reject,则停止删除。
+	  beforeRemove(file, fileList) {
+	    return this.$confirm(`确定移除 ${ file.name }?`);
+	  },
+	  
+	  // 文件上传成功时的钩子
+	  handleSuccess(response, file, fileList){
+	  	console.log("文件上传成功!", response)
+	  	if(response.isSuccess){
+	  		// [上传程序]字段的值
+	  		this.fileObj.filePath = response.data.url
+	  		// [程序大小]字段的值
+	  		this.fileObj.size = response.data.size
+	  		// [程序id]
+	  		this.fileObj.programId = response.data.bizId
+	  		// 查询【程序】信息
+	  		// this.getProgram(response.data.filename)
+	  		this.getProgram(response.data.bizId)
+	  	}
+	  },
+	  
+	  // 文件上传失败时的钩子
+	  handleError(err, file, fileList){
+	  	console.log("文件上传失败~", err)
+	  },
+	  
+	  // 文件上传时的钩子
+	  handlePropress(event, file, fileList){
+	  	console.log("文件上传~", event)
+	  },
+	  
+    initTenant () {
+      return {
+        id: '',
+        no: '',
+        submittedFileName: '',
+        workTime: '',
+        filePath: '',
+        size: null,
+        runTime: null
+      }
+    },
+    
+    resetFile(){
+    	// [上传程序]字段的值
+  		this.tenant.filePath = '';
+  		this.fileObj.filePath = '';
+  		// [程序大小]字段的值
+  		this.tenant.size = null;
+  		// [加工时间]字段的值
+	  	this.tenant.workTime = null;
+		// [程序内容]字段的值
+	  	this.pgContent = '';
+    },
+    
+    initWidth () {
+      this.screenWidth = document.body.clientWidth
+      if (this.screenWidth < 991) {
+        return '90%'
+      } else if (this.screenWidth < 1400) {
+        return '45%'
+      } else {
+        return '800px'
+      }
+    },
+    
+    // 父组件,设置子组件的值-方法
+    setTenant (val, selectedEq) {
+    	// console.log("设备:", selectedEq)
+    	// 表单下拉数据,赋值,动态数据
+    	this.selectedEq = selectedEq;
+    	
+    	if(val){
+    		this.tenant = { ...val }
+    		// 如果附件存在 /
+    		if(!!val.id){
+    			// 查询【程序】信息
+	  			this.getProgram(val.id)
+    		}
+    	}
+    },
+    
+    close () {
+      this.$emit('close')
+    },
+    
+    reset () {
+    	console.log("清空了多少次!!!!!");
+      // 先清除校验,再清除表单,不然有奇怪的bug
+      this.$refs.form.clearValidate()
+      this.$refs.form.resetFields()
+      this.tenant = this.initTenant()
+      // 【刀具】清空
+      this.toolList = []
+      // 【程序内容】清空
+      this.pgContent = ''
+      // 清空上传附件
+      this.fileList = []
+    },
+    submitForm () {
+      this.$refs.form.validate((valid) => {
+      	console.log("Form的数据123:", this.tenant, valid);
+        if (valid) {
+        	let obj = {...this.tenant, ...this.fileObj};
+        	// 把生产资源id,分开
+	        if(!!obj.resourceIds){
+	          	let arr = this.tenant.resourceIds.split(",");
+	          	obj.resourceId = arr[0];   // 设备id
+	          	obj.name = arr[1];   // 设备名称
+	        }
+	        console.log("Form最终数据:", obj);
+        	// 恢复按钮
+          	this.confirmDisabled = true;
+          	// 传值父组件
+          	this.$emit("success", obj);
+          	// 关闭
+          	this.$emit("close");
+          	// 初始化数据
+          	this.reset();
+        } else {
+          return false;
+        }
+      })
+    },
+    // 【设备】下拉数据
+    equmentList() {
+    	productionResourcesMgrApi.getList({cncProgram: '1'}).then(res => {
+    		res = res.data
+    		// console.log("【设备】下拉数据:", res)
+    		if(res.isSuccess){
+    			this.eqList = res.data
+    		}
+    	})
+    },
+    // 根据[程序ID]获取文件内容 
+    getProgram(programId){
+    	programCenterApi.getProgram({id: programId}).then(res => {
+    		res = res.data 
+    		console.log("根据[程序ID]:", res.data)
+    		if(res.isSuccess){
+    			const obj = res.data
+    			// [程序内容]字段的值
+		  		this.pgContent = obj.content
+		  		// [刀具]列表
+		  		this.toolList = obj.toolList
+		  		// 附件数据
+		  		this.fileList = [{
+		  			name: obj.name,
+		  			url: obj.url
+		  		}]
+		  		// 附件-赋值
+		  		// this.fileObj = res.data;
+		  		// 需要回填的信息
+	  			this.fileObj.nc = '1' // 表示已经上传
+	  			this.fileObj.submittedFileName = obj.name
+	  			this.fileObj.filePath  = obj.url
+	  			this.fileObj.runTime = obj.runTime
+	  			this.fileObj.toolList = obj.toolList
+	  			this.fileObj.toolNums = obj.toolList ? obj.toolList.length : 0
+    		}
+    	})
+    }
+
+  }
+}
+</script>
+<style lang="scss" scoped>
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409eff;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 100px;
+  height: 100px;
+  line-height: 100px;
+  text-align: center;
+}
+.avatar {
+  width: 100px;
+  height: 100px;
+  display: block;
+}
+.checkUsed{
+	display: inline-block;
+	margin-left: 10px;
+	color: #1890ff;
+}
+.editTitle{
+	font-size: 17px;
+	padding-bottom: 15px;
+	border-bottom: 1px solid #CCCCCC;
+}
+</style>

+ 76 - 11
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/programForm/index.vue

@@ -7,7 +7,7 @@
 			    <el-radio label="1">{{$t("prepare.common.idNeed.unneed")}}</el-radio>
 			    <el-radio label="2">{{$t("prepare.common.idNeed.need")}}</el-radio>
 			</el-radio-group>
-			<el-button :disabled="showButton" type="primary" icon="el-icon-plus" size="small" @click="add" circle></el-button>
+			<el-button :disabled="showButton" type="primary" icon="el-icon-plus" size="small" @click="addProgram" circle></el-button>
 		</div>
 		<!-- Table数据 -->
 		<el-table
@@ -31,28 +31,31 @@
 	      </template>
       </el-table-column>
       <!-- 设备 -->
-    	<el-table-column prop="name" :label='$t("prepare.table.program.name")' align="center" width="150px" :show-overflow-tooltip="true">
+    	<el-table-column prop="name" :label='$t("prepare.table.program.name")' align="center" width="220px" :show-overflow-tooltip="true">
     		<template slot-scope="{ row }">
-    			<div v-if="type == 'view'">{{row.name}}</div>
+    			<div>{{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>
     	<!-- 托盘夹具组 -->
-    	<el-table-column prop="groupSort" :label='$t("prepare.table.program.groupSort")' align="center" width="120px"></el-table-column>
+    	<!--<el-table-column prop="groupSort" :label='$t("prepare.table.program.groupSort")' align="center" width="120px"></el-table-column>-->
     	<!-- 位置程序类型 -->
-      <el-table-column prop="programType" :label='$t("prepare.table.program.programType")' align="center" width="130px">
+      <!--<el-table-column prop="programType" :label='$t("prepare.table.program.programType")' align="center" width="130px">
       	<template slot-scope="{ row }">
       		<span>{{row.programType == "1" ? $t("prepare.common.programType.type1") : (row.programType == "2" ? $t("prepare.common.programType.type2") : $t("prepare.common.programType.type3"))}}</span>
       	</template>
-      </el-table-column>
+      </el-table-column>-->
       <!-- 程序加工位置 -->
-      <el-table-column prop="positions" :label='$t("prepare.table.program.positions")' width="160px"></el-table-column>
+      <!--<el-table-column prop="positions" :label='$t("prepare.table.program.positions")' width="160px"></el-table-column>-->
       <!-- 优先级 -->
-      <el-table-column prop="prority" :label='$t("prepare.table.program.prority")' width="70px"></el-table-column>
+      <!--<el-table-column prop="prority" :label='$t("prepare.table.program.prority")' width="70px"></el-table-column>-->
       <!-- 加工时间 -->
-      <el-table-column prop="addTime" :label='$t("prepare.table.program.addTime")' align="center"></el-table-column>
+      <el-table-column prop="workTime" :label='$t("prepare.table.program.addTime")' width="180px" align="center"></el-table-column>
+      <!-- 程序名称 -->
+      <el-table-column prop="submittedFileName" :label='$t("prepare.table.program.submittedFileName")' align="center"></el-table-column>
       <!-- 操作 -->
       <el-table-column
       	v-if="type == 'view' ? false : true"
@@ -101,6 +104,22 @@
       :dialog-visible="tenantViewVisible"
       @close="viewClose"
     />
+    
+    <programnc-mgr 
+    	ref="programnc" 
+    	:dialog-visible="dialogProg.isVisible"
+      :title="dialogProg.title"
+    	@close="editProgClose" 
+    	@success="editProgSuccess"
+    ></programnc-mgr>
+    <!--<el-dialog
+		  title="添加NC程序"
+		  :visible.sync="dialogProgram"
+		  width="750px"
+		  :append-to-body="true"
+		>
+		  
+		</el-dialog>-->
   </div>
 </template>
 
@@ -108,15 +127,18 @@
 	import TenantEdit from "./components/Edit"
 	import TenantView from "./components/View"
 	import Pagination from "@/components/Pagination"
+	// 【程序管理】组件
+	import ProgramncMgr from "./components/ProgramncMgr"
 	import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
 	export default {
 	  name: "ProgramForm",
-	  components: { Pagination, TenantEdit, TenantView },
+	  components: { Pagination, TenantEdit, TenantView, ProgramncMgr },
 	  props: {
 	  	type: String
 	  },
 	  data () {
 	    return {
+	    	dialogProgram: false,
 	    	currentRow: null,
 	    	radio: '2',
 	    	audioStatus: [],
@@ -124,6 +146,10 @@
 	        isVisible: false,
 	        title: ""
 	      },
+	      dialogProg: {
+	        isVisible: false,
+	        title: ""
+	      },
 	      preview: {
 	        isVisible: false,
 	        context: ''
@@ -191,6 +217,41 @@
 	  	handleCurrentChange(val) {
 		    this.currentRow = val;
 		  },
+		  
+		  // 【程序管理】按钮-事件
+	  	addProgram(){
+	  		this.dialogProg.title = this.$t("common.add");
+	  		this.$refs.programnc.setTenant(false, this.selectedEq);
+	  		// 打开弹出框
+	  		this.dialogProg.isVisible = true;
+	  	},
+  	
+		  // 【程序管理-取消】按钮-事件
+	  	editProgClose(){
+	  		this.dialogProg.isVisible = false;
+	  	},
+	  	
+	  	// 【程序管理-确定】按钮-事件
+	  	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*/
+	  	},
 	    viewClose () {
 	      this.tenantViewVisible = false
 	    },
@@ -226,20 +287,24 @@
 	    		})
 	    	}
 	    },
+	    
 	    onSelectChange (selection) {
 	      this.selection = selection
 	    },
+	    
 	    search () {
 	      this.fetch({
 	        ...this.queryParams
 	      })
 	    },
+	    
 	    reset () {
 	      this.queryParams = initQueryParams({})
 	      this.$refs.table.clearSort()
 	      this.$refs.table.clearFilter()
 	      this.search()
 	    },
+	    
 	    add () {
 	      this.$refs.edit.type = "add"
 	      this.$refs.edit.setTenant(false, this.selectedEq, this.selectedTray)

+ 36 - 36
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/trayForm/index.vue

@@ -47,24 +47,24 @@
 	      <!-- 编号 -->
 	      <el-table-column prop="no" :label='$t("prepare.table.toolGroup.no")' align="center" width="120px" :show-overflow-tooltip="true"></el-table-column>
 	      <!-- 规格 -->
-	      <el-table-column prop="specification" :label='$t("prepare.table.toolGroup.specification")' width="180px" :show-overflow-tooltip="true"></el-table-column>
+	      <el-table-column prop="specification" :label='$t("prepare.table.toolGroup.specification")' width="150px" :show-overflow-tooltip="true"></el-table-column>
 	      <!-- 品牌 -->
-	      <el-table-column prop="brand.data" :label='$t("prepare.table.toolGroup.brand")' width="180px"></el-table-column>
+	      <el-table-column prop="brand.data" :label='$t("prepare.table.toolGroup.brand")' width="150px"></el-table-column>
 	      <!-- 使用加紧位置 -->
-	      <el-table-column prop="positions" :label='$t("prepare.table.toolGroup.positions")' align="center" width="180px"></el-table-column>
+<!--	      <el-table-column prop="positions" :label='$t("prepare.table.toolGroup.positions")' align="center" width="120px"></el-table-column>-->
 	      <!-- 装甲方式 -->
-	      <!--<el-table-column prop="armorPic" :label='$t("prepare.table.toolGroup.armorPic")' align="center" width="180px">
-	      	<template slot-scope="{ row }" v-if="row.category.key == '02'">
+	      <el-table-column prop="armorPic" :label='$t("prepare.table.toolGroup.armorPic")' align="center" width="180px">
+	      	<template slot-scope="{ row }">
 	      		<div v-if="row.jjImgList && row.jjImgList.length > 0" class="demo-image__preview">
-						  <el-image 
+						  <el-image
 						    style="width: 100px; height: 60px"
-						    :src="row.jjImgList[0]" 
+						    :src="row.jjImgList[0]"
 						    :preview-src-list="row.jjImgList">
 						  </el-image>
 						</div>
 	          <el-button v-else type="text" @click="handleClick(row)">{{$t("common.uploadImg")}}</el-button>
 					</template>
-	      </el-table-column>-->
+	      </el-table-column>
 	      <!-- 备注 -->
 	      <el-table-column prop="remark" :label='$t("common.remark")'>
 	      	<template slot-scope="{ row }">
@@ -99,7 +99,7 @@
 	        </template>
 	      </el-table-column>
 	    </el-table>
-				    
+
     <pagination
       v-show="tableData.total > 0"
       :limit.sync="queryParams.size"
@@ -107,7 +107,7 @@
       :total="Number(tableData.total)"
       @pagination="fetch"
     />
-    
+
     <!-- 托盘 -->
     <tenant-add
       ref="add"
@@ -116,7 +116,7 @@
       @close="editAddClose"
       @success="editAddSuccess"
     />
-    
+
     <!-- 夹具 -->
     <tenant-edit
       ref="edit"
@@ -130,12 +130,12 @@
       :dialog-visible="tenantViewVisible"
       @close="viewClose"
     />
-    
+
     <!-- 上传图片对话框 -->
-    <el-dialog 
-    	title="上传图片" 
+    <el-dialog
+    	title="上传图片"
     	width="350px"
-    	:visible.sync="uploadQcVisible" 
+    	:visible.sync="uploadQcVisible"
     	:append-to-body="true"
     	@closed="closePic"
     >
@@ -173,7 +173,7 @@
 	// 附件上传需要的组件和函数
 	import db from "@/utils/localstorage";
 	import {Base64} from 'js-base64';
-	
+
 	export default {
 	  name: "TrayForm",
 	  components: { Pagination, TenantAdd, TenantEdit, TenantView },
@@ -196,7 +196,7 @@
 	      },
 	    	fileList: [],  // 附件的数据
 	    	tempObj: {}, // 当前的Row数据
-	    	
+
 	    	radio: '3',
 	    	audioStatus: [],
 	    	dialogAdd: {
@@ -382,7 +382,7 @@
 		        this.fileList = Object.assign([],row.jjImgList)
 		    }
 			},
-			
+
 			// 上传成功,push到当前行的jjImgList数组中
 	    handleSuccss(res, file, fileList) {
 	    	// console.log("图片:", res)
@@ -395,7 +395,7 @@
 	      this.uploadQcVisible = false
 	      this.closePic()
 	    },
-	    
+
 	    //关闭对话框时,重载组件,并且把fileList清空,否则会有异常
 	    closePic() {
 	      this.timer = new Date().getTime()
@@ -428,10 +428,10 @@
 	      this.$refs.table.clearFilter()
 	      this.search()
 	    },
-	    
+
 	    // 【删除】按钮-事件  groupSort
 	    domDelete(row){
-	    	
+
 	    	this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
 	      	distinguishCancelAndClose: true,
 	        confirmButtonText: this.$t("common.confirm"),
@@ -442,18 +442,18 @@
 		    	let list = this.tableData.filter(item => item.groupSort != row.groupSort)
 		    	// 重新赋值
 		    	this.tableData = list
-		    	
+
 		    	// 要合并列的准备数据
 		    	if(this.tableData.length > 0){
 		    		this.spanArr = this.rowspanFiled(this.tableData, "groupSort")
 				  	this.spanArr2 = this.rowspanFiled(this.tableData, "groupPrority")
 		    	}
-		    	
+
 		    	// 把值给父组件【程序】赋值
 		    	this.$emit("setProgram", this.tableData.filter(item => item.category.key == '03'))
 	      }).catch(() => {})
 	    },
-	    
+
 	    // 托盘【新增】按钮-事件
 	    add () {
 	      // 设置【组序】
@@ -465,7 +465,7 @@
 	      this.dialogAdd.title = this.$t("common.add") + this.$t("prepare.common.tpJgroup")
 	      this.dialogAdd.isVisible = true
 	    },
-	    
+
 	    // 托盘【修改】按钮-事件
 	    addRow(row){
 	    	// 设置【组序】
@@ -474,12 +474,12 @@
 	      this.dialogAdd.title = this.$t("common.edit") + this.$t("prepare.common.tpJgroup")
 	      this.dialogAdd.isVisible = true
 	    },
-	    
+
 	    // 弹出框【取消】按钮-事件
 	    editAddClose () {
 	      this.dialogAdd.isVisible = false
 	    },
-	    
+
 	    // 弹出框【确定】按钮-事件
 	    editAddSuccess (arr) {
 	    	// 通过深层复制,避免相同地址引起数据,一起改变
@@ -532,7 +532,7 @@
 	    	// 把值给父组件【程序】赋值
 	    	this.$emit("setProgram", this.tableData.filter(item => item.category.key == '03'))
 	    },
-	    
+
 	    // 设置数据前,需要合并
 	    setDataMustSpan(data){
 	    	this.tableData =  data
@@ -544,17 +544,17 @@
 	    		this.$emit("setProgram", this.tableData.filter(item => item.category.key == '03'))
 	    	}
 	    },
-	    
+
 	    // 【夹具】修改-事件
 	    editTools(row){
 	    	this.dialog.title = this.$t("common.edit") + this.$t("prepare.common.tab5")
 	      this.dialog.isVisible = true
 	    },
-	    
+
 	    editClose(){
 	    	this.dialog.isVisible = false
 	    },
-	    
+
 	    editSuccess(obj){
 	    	// 最新数组
 	    	let list = []
@@ -575,7 +575,7 @@
 	    	// 重新赋值
 	    	this.tableData = [...this.tableData, ...list];
 	    },
-	    
+
 	    editSuccess_v1(obj){
 	    	// 深度Copy,防止翻车
 	    	let tool = JSON.parse(obj)
@@ -602,12 +602,12 @@
 	    	// 重新赋值
 	    	this.tableData = list
 	    },
-	    
+
 	    clearSelections () {
 	      this.$refs.table.clearSelection()
 	    },
 	    delete (ids) {
-	    	
+
 	    },
 	    view (row) {
 	      this.$refs.view.setTenant(row)
@@ -645,7 +645,7 @@
 	      this.dialog.isVisible = true
 	    },
 	    fetch (params = {}) {
-	    	
+
 	    }
 	  }
 	}
@@ -670,4 +670,4 @@
 	.itemDiv{
 		margin: 10px 0;
 	}
-</style>
+</style>