Parcourir la source

解决前端数据展示Bug

oyq28 il y a 3 ans
Parent
commit
cc7f02bbd4

+ 1 - 1
imcs-ui/src/api/resourceProductMgr/programCenter.js

@@ -63,7 +63,7 @@ const apiList = {
   // 【刀具下拉】数据
   toolList: {
     method: 'POST',
-    url: `/authority/customizeCuttingTool/query`
+    url: `/authority/customizeCuttingTool/page`
   },
   
   list: {

+ 4 - 4
imcs-ui/src/lang/zh/prepare.js

@@ -94,7 +94,7 @@ export default {
 		// 列表搜索表单名称
 		searchForm: {
 			name: '零件名称',
-			tpName: '托盘名称',
+			tpName: '托板名称',			
 			productName: '产品名称',
 			parts_no: '零部件编号',
 			bomAlias: '产品代号',
@@ -102,8 +102,8 @@ export default {
 			partsAlias: '零件代号',
 			specification: '规格',
 			batchNo: '零件批号',
-      trayName:'托盘名称',
-      groupNo:'分组号',
+      		trayName:'托盘名称',
+     		groupNo:'分组号',
 			models: '型  号',
 			brand: '品牌',
 			model: '规格',
@@ -251,7 +251,7 @@ export default {
 			// 【托盘管理】列表table字段名称
 			tray: {
 				no: '物料编码',
-				name: '托名称',
+				name: '托名称',
         materialType: '物料类型',
         factory: '生产分厂/制造商',
 

+ 1 - 0
imcs-ui/src/lang/zh/runCenter.js

@@ -176,6 +176,7 @@ export default {
 				source: '来源',
 				deliveryTime: '交货日期',
 				status: '启用状态',
+				state: '使用状态',
 				auditStatus: '审核状态',
 				orderStatus: '订单状态',
 				planStatus: '计划',

+ 8 - 0
imcs-ui/src/views/zuihou/prepareProductMgr/cuttingToolMgr/components/customizeCuttingTool/index.vue

@@ -98,6 +98,14 @@
           	{{ row.status=='1' ? $t("common.status.valid") : $t("common.frozen") }}
           </el-tag>
         </template>
+      </el-table-column>
+	  <!-- 启用状态 -->
+      <el-table-column prop="programId" :label='$t("runCenter.table.oder.state")' align="center">
+      	<template slot-scope="{ row }">
+          <el-tag :type="row.programId==null ? 'success' : 'danger'">
+          	{{ row.programId==null ? '可用' : '占用' }}
+          </el-tag>
+        </template>
       </el-table-column>
       <!-- 操作 -->
       <el-table-column

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

@@ -65,12 +65,17 @@
 							</template> 
 							<template slot-scope="{ row }">
 					      		<el-select v-model="row.toolId" filterable :placeholder='$t("common.pleaseEnter")'>
-								    <el-option
+								    <el-option-group
 								      	v-for="item in toolSelectList"
-								      	:key="item.id"
-								      	:label="item.cuttingToolName"
-								      	:value="item.id">
-								    </el-option>
+								      	:key="item.label"
+								      	:label="item.label">
+										<el-option
+        									v-for="option in item.options"
+        									:key="option.id"
+        									:label="option.cuttingToolName"
+        									:value="option.id">
+      									</el-option>
+								    </el-option-group>
 								</el-select>
 					      	</template>
 				      	</el-table-column>
@@ -131,6 +136,7 @@ import programCenterApi from "@/api/resourceProductMgr/programCenter"
 import productionResourcesMgrApi from "@/api/resourceProductMgr/productionResourcesMgr"
 import db from "@/utils/localstorage";
 import {Base64} from 'js-base64';
+import { initQueryParams } from '@/utils/commons'
 export default {
   name: 'ProgramncMgr',
   props: {
@@ -152,7 +158,8 @@ export default {
     	tableData: [],
     	eqList: [], // 设备下拉类别数据
     	toolList: [], // 刀具列表
-    	toolSelectList: [], // 刀具下拉数据
+    	toolSelectList: [], // 刀具下拉数据		
+		queryParams: initQueryParams({}),
     	pgContent: '',  // 程序内容
       	type: 'add',
       	tenant: this.initTenant(),
@@ -194,10 +201,7 @@ export default {
 		// 查询【程序】信息
 		if(!!this.programId){
 			this.getProgram(this.programId)
-		}
-
-		// 初始化,刀具下拉
-		this.getToolList();
+		}		
 	},
 	watch: {
 		programId(val){
@@ -240,12 +244,32 @@ export default {
 		},
 
 		// 初始化,【刀具下拉】
-		getToolList(){
-			programCenterApi.toolList().then(res => {
+		getToolList(arrs){
+			this.queryParams.current = 1
+			this.queryParams.size = 9999
+			this.queryParams.map.state = '0'
+
+			if(arrs.length > 0){			
+				this.queryParams.map.ids = 	arrs.map(item=>{return item.toolId}).join(',')	
+			}	
+									
+			programCenterApi.toolList(this.queryParams).then(res => {
 	    		res = res.data
 	    		// console.log("【刀具下拉】下拉数据:", res)
-	    		if(res.isSuccess){
-	    			this.toolSelectList = res.data
+	    		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					
 	    		}
 	    	})
 		},
@@ -334,7 +358,7 @@ export default {
     setTenant (val, selectedEq) {
     	// console.log("设备:", val)
     	// 表单下拉数据,赋值,动态数据
-    	this.selectedEq = selectedEq;
+    	this.selectedEq = selectedEq;		
 
     	if(val){
     		// 刀具管理
@@ -346,7 +370,7 @@ export default {
     			resourceId: val.resourceId,
     			resourceIds: val.resourceId +','+ val.name,
 		        workTime: val.workTime,
-				filePath: val.filePath
+				filePath: val.filePath 				
     		};
     		this.fileObj= {
     			nc: '1', // 表示已经上传
@@ -364,10 +388,11 @@ export default {
     			// 查询【程序】信息
 	  			this.getProgram(pid);
     		}
+			this.getToolList(this.toolList)
     	} else {
     		// 新增,清空数据
     		this.resetFile();
-    	}
+    	}		
     },
 
     // 【新增】按钮-事件
@@ -379,7 +404,8 @@ export default {
       	useTime: '',
       	count: null,
       	isEdit: true
-      })
+      });
+	  this.getToolList([]);
     },
 
     // 【删除】按钮事件
@@ -426,6 +452,7 @@ export default {
       	this.$refs.form.clearValidate()
       	this.$refs.form.resetFields()
       	this.tenant = this.initTenant()
+		this.queryParams = initQueryParams({});
       	// 【刀具】清空
       	this.toolList = []
       	// 【程序内容】清空

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

@@ -350,7 +350,7 @@
 	      this.$refs.programnc.type = "edit"
 	      this.dialogProg.title = this.$t("common.edit")
 	      // 打开弹出框
-	  		this.dialogProg.isVisible = true;
+	  	  this.dialogProg.isVisible = true;
 	    },
 	    
 	    fetch (params = {}) {