yaoyq 3 gadi atpakaļ
vecāks
revīzija
51921e4600

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

@@ -9,7 +9,7 @@
 	  	width="800px" 
 	  	top="50px"
 	>
-		<div class="uploadProgram" v-loading="loading">
+		<div v-loading="loading" 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">
@@ -177,13 +177,12 @@ export default {
 	
 	  // 点击文件列表中已上传的文件时的钩子
 	  handlePreview(file) {
-	  	this.loading = true;  // 上传遮罩
 	    console.log("上传之前事件:",file);
 	  },
 	  
 	  // 文件超出个数限制时的钩子
 	  handleExceed(files, fileList) {
-	  	this.loading = false;  // 上传遮罩
+	  	this.loading = false;  // 上传遮罩-关闭
 	    this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
 	  },
 	  
@@ -215,6 +214,7 @@ export default {
 	  
 	  // 文件上传时的钩子
 	  handlePropress(event, file, fileList){
+	  	this.loading = true;  // 上传遮罩-打开
 	  	console.log("文件上传~", event)
 	  },
 	  

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

@@ -9,7 +9,7 @@
 			    <el-radio label="3">{{$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="editTools" circle></el-button>
+			<el-button :disabled="showButton" type="primary" icon="el-icon-plus" size="small" @click="addTools" circle></el-button>
 			<span style="margin-left: 50px;">
 				<el-checkbox v-model="armTrayConf" :disabled="showRadio">{{$t("prepare.common.armTrayConf")}}</el-checkbox>
 				<el-checkbox v-model="armFixtureConf" :disabled="showRadio">{{$t("prepare.common.armFixtureConf")}}</el-checkbox>
@@ -45,20 +45,27 @@
 	    	<!-- 名称 -->
 	    	<el-table-column prop="name" :label='$t("prepare.table.toolGroup.name")' align="center" width="120px" :show-overflow-tooltip="true"></el-table-column>
 	      <!-- 编号 -->
-	      <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="no" :label='$t("prepare.table.toolGroup.no")' align="center" width="180px" :show-overflow-tooltip="true">
+	      	<template slot-scope="{ row }">
+	    			<div v-if="type == 'view'">{{row.no}}</div>
+	    			<div v-else>
+	    				<el-button type="text" @click="editTools(row)">{{row.no}}</el-button>
+	    			</div>
+	    		</template>
+	      </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="150px"></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="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 }">
 	      		<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>
@@ -99,7 +106,7 @@
 	        </template>
 	      </el-table-column>
 	    </el-table>
-
+				    
     <pagination
       v-show="tableData.total > 0"
       :limit.sync="queryParams.size"
@@ -107,7 +114,7 @@
       :total="Number(tableData.total)"
       @pagination="fetch"
     />
-
+    
     <!-- 托盘 -->
     <tenant-add
       ref="add"
@@ -116,7 +123,7 @@
       @close="editAddClose"
       @success="editAddSuccess"
     />
-
+    
     <!-- 夹具 -->
     <tenant-edit
       ref="edit"
@@ -130,12 +137,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 +180,7 @@
 	// 附件上传需要的组件和函数
 	import db from "@/utils/localstorage";
 	import {Base64} from 'js-base64';
-
+	
 	export default {
 	  name: "TrayForm",
 	  components: { Pagination, TenantAdd, TenantEdit, TenantView },
@@ -196,7 +203,7 @@
 	      },
 	    	fileList: [],  // 附件的数据
 	    	tempObj: {}, // 当前的Row数据
-
+	    	
 	    	radio: '3',
 	    	audioStatus: [],
 	    	dialogAdd: {
@@ -382,7 +389,7 @@
 		        this.fileList = Object.assign([],row.jjImgList)
 		    }
 			},
-
+			
 			// 上传成功,push到当前行的jjImgList数组中
 	    handleSuccss(res, file, fileList) {
 	    	// console.log("图片:", res)
@@ -395,7 +402,7 @@
 	      this.uploadQcVisible = false
 	      this.closePic()
 	    },
-
+	    
 	    //关闭对话框时,重载组件,并且把fileList清空,否则会有异常
 	    closePic() {
 	      this.timer = new Date().getTime()
@@ -428,10 +435,28 @@
 	      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"),
+	        cancelButtonText: this.$t("common.cancel"),
+	        type: "warning"
+	      }).then(() => {
+	      	// 过滤我们需要的数据
+		  		let list = this.tableData.filter(item => {
+		  			let f1 = item.id || item.key;
+		  			let f2 = row.id || row.key;
+		  			return f1 != f2
+		  		});
+		  		// 重新赋值
+		  		this.tableData = list;
+	      }).catch(() => {})
+	    },
+	    
+	    // 【删除】按钮-事件  groupSort
+	    domDelete_v1(row){
 	    	this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
 	      	distinguishCancelAndClose: true,
 	        confirmButtonText: this.$t("common.confirm"),
@@ -442,18 +467,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 +490,7 @@
 	      this.dialogAdd.title = this.$t("common.add") + this.$t("prepare.common.tpJgroup")
 	      this.dialogAdd.isVisible = true
 	    },
-
+	    
 	    // 托盘【修改】按钮-事件
 	    addRow(row){
 	    	// 设置【组序】
@@ -474,12 +499,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 +557,7 @@
 	    	// 把值给父组件【程序】赋值
 	    	this.$emit("setProgram", this.tableData.filter(item => item.category.key == '03'))
 	    },
-
+	    
 	    // 设置数据前,需要合并
 	    setDataMustSpan(data){
 	    	this.tableData =  data
@@ -544,24 +569,36 @@
 	    		this.$emit("setProgram", this.tableData.filter(item => item.category.key == '03'))
 	    	}
 	    },
-
+	    
+	    // 【夹具】新增-事件
+	    addTools(){
+	    	this.$refs.edit.type = "add";
+	    	this.dialog.title = this.$t("common.add") + this.$t("prepare.common.tab5");
+	      this.dialog.isVisible = true;
+	    },
+	    
 	    // 【夹具】修改-事件
 	    editTools(row){
-	    	this.dialog.title = this.$t("common.edit") + this.$t("prepare.common.tab5")
-	      this.dialog.isVisible = true
+	    	this.dialog.title = this.$t("common.edit") + this.$t("prepare.common.tab5");
+	    	this.$refs.edit.type = "edit";
+	    	// 赋值,修改的识别用。
+	    	let keys = row.id || row.key;
+	    	this.$refs.edit.keys = keys;
+	      this.dialog.isVisible = true;
 	    },
-
+	    
 	    editClose(){
 	    	this.dialog.isVisible = false
 	    },
-
-	    editSuccess(obj){
+	    
+	    editSuccess(data, type){
 	    	// 最新数组
 	    	let list = []
 	    	// 深度Copy,防止翻车
-	    	let tool = JSON.parse(obj);
+	    	let tool = JSON.parse(data);
 	    	let arr = tool.specification2.split(",");
 	    	let item = {
+	    		key: tool.key, 						// 关键字
 	    		trayPositionId: tool.id,
 	    		trayId: tool.trayId,			// 夹具id
 	    		no: tool.no, 							// 编号
@@ -570,12 +607,34 @@
 	    		specification: arr[1],  	// 规格
 	    		specificationId: arr[0] 	// 规格id
 	    	};
-	    	// 添加数据
-	    	list.push(item);
-	    	// 重新赋值
-	    	this.tableData = [...this.tableData, ...list];
+	    	if (type == "add") {
+		    	// 添加数据
+		    	list.push(item);
+		    	// 重新赋值
+		    	this.tableData = [...this.tableData, ...list];
+	    	} else {
+	    		let target = [];
+	    		this.tableData.map(obj => {
+	    			let f1 = obj.id;
+	    			let f2 = tool.key;
+	    			if(f1 == f2){
+	    				obj.trayPositionId = tool.id;
+	    				obj.trayId = tool.trayId;			// 夹具id
+				    	obj.no = tool.no; 							// 编号
+				    	obj.name = tool.name;  				// 名称
+				    	obj.brand = tool.brand; 				// 品牌
+				    	obj.specification = arr[1];  	// 规格
+				    	obj.specificationId = arr[0]; 	// 规格id
+	    			}
+	    			target.push(obj);
+	    		});
+	    		// 赋值
+	    		this.tableData = target;
+	    		console.log("最终数据:", this.tableData);
+	    	}
+	    	
 	    },
-
+	    
 	    editSuccess_v1(obj){
 	    	// 深度Copy,防止翻车
 	    	let tool = JSON.parse(obj)
@@ -602,12 +661,12 @@
 	    	// 重新赋值
 	    	this.tableData = list
 	    },
-
+	    
 	    clearSelections () {
 	      this.$refs.table.clearSelection()
 	    },
 	    delete (ids) {
-
+	    	
 	    },
 	    view (row) {
 	      this.$refs.view.setTenant(row)
@@ -645,7 +704,7 @@
 	      this.dialog.isVisible = true
 	    },
 	    fetch (params = {}) {
-
+	    	
 	    }
 	  }
 	}
@@ -670,4 +729,4 @@
 	.itemDiv{
 		margin: 10px 0;
 	}
-</style>
+</style>