liuhairui 1 yıl önce
ebeveyn
işleme
6c1390e075

+ 170 - 0
src/view/DecisionSupport/Processwaste.vue

@@ -0,0 +1,170 @@
+<template>
+  <div>
+    <el-container>
+      <el-aside width="200px">
+        <div class="JKWTree-tree">
+          <h3>工序大废品统计</h3>
+          <el-tree :data="treeData" :props="defaultProps" node-key="id" @node-click="handleNodeClick"></el-tree>
+        </div>
+      </el-aside>
+      <el-container>
+		  
+        <el-main>
+			<el-table tooltip-effect="dark" :data="gxdfptableData" row-key="ID"
+			  highlight-current-row="true"
+			  :row-style="{ height: '0px' }" :header-cell-style="{ padding: '0px' }"
+			  :cell-style="{ padding: '0px' }" :header-row-style="{ height: '0px' }"
+			  border :show-overflow-tooltip="true" :cell-class-name="planUsageCellClass"
+			  style="width: 100%;height: 65vh" ref="tablesczl_gxmc"
+			  @row-dblclick="gyscbzSelectClick">
+			  <el-table-column align="left"  label="所在部门" 	width="100"	prop="所在部门" />
+			  <el-table-column align="left"  label="员工编号" 	width="81"	prop="员工编号" />
+			  <el-table-column align="left"  label="员工姓名" 	width="110"	prop="员工姓名" />
+			  <el-table-column align="left"  label="发现次数" 	width="100"	prop="发现次数" />
+			  <el-table-column align="left"  label="发现张数" 	width="100"	prop="发现张数" />
+			  <el-table-column align="left"  label="奖励金额" 	width="100"	prop="奖励金额" />
+			  <el-table-column align="left"  label="遗漏次数" 	width="100"	prop="遗漏次数" />
+			  <el-table-column align="left"  label="遗漏张数" 	width="100"	prop="遗漏张数" />
+			  <el-table-column align="left"  label="处罚金额" 	width="100"	prop="处罚金额" />
+			  <el-table-column align="left"  label="年月" 		width="100"	prop="年月" />
+			  <el-table-column align="left"  label="周数" 		width="100"	prop="周数" />
+			</el-table>
+        </el-main>
+      </el-container>
+    </el-container>
+  </div>
+</template>
+<script setup>
+import {
+  GXReghtList,
+  GXGetList
+} from '@/api/mes/job'
+import {
+  createCompany,
+  deleteCompany,
+  deleteCompanyByIds,
+  updateCompany,
+  findCompany,
+  getCompanyList
+} from '@/api/company'
+// 全量引入格式化工具 请按需保留
+import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { ref, reactive } from 'vue'
+import { useUserStore } from '@/pinia/modules/user'
+const userStore = useUserStore()
+const sys_id = '['+userStore.userInfo.userName+'/'+userStore.userInfo.nickName+']'
+defineOptions({name: 'Company'})
+
+//获取左侧菜单栏
+const treeData = reactive([]);
+const defaultProps = {
+  label: "label", // 显示的字段
+  children: "children", // 子节点的字段
+};
+const _GXGetList = async () => {
+  try {
+	//工序大废品统计->左侧菜单接口
+	const GXGetListdata = await GXGetList({});
+	console.log(GXGetListdata);
+	const responseData = GXGetListdata.data;
+	const formattedTreeData = Object.entries(responseData).map(([year, weeks]) => {
+	  return {
+		label: year, // 父节点显示年份
+		children: weeks.map((weekItem) => ({
+		  label: weekItem.周数, // 子节点显示周数
+		  week: weekItem.week, // 周数
+		  year, // 保存年份数据,便于点击时获取
+		  dateRange: weekItem.dateRange, // 假设接口返回的时间范围
+		})),
+	  };
+	});
+	treeData.splice(0, treeData.length, ...formattedTreeData);
+  } catch (error) {
+	console.error("获取数据失败:", error);
+  }
+};
+_GXGetList();
+	
+// 节点点击事件
+const handleNodeClick = (node) => {
+  // 判断是否是子节点
+  if (!node.children) {
+	console.log("点击的节点信息:", node);
+	// 获取年月日和周数
+	const { year, week } = node;
+	// console.log(`年份:${year}`);
+	// console.log(`周数:${week}`);
+	_GXReghtList(year,week)
+  } else {
+	console.log("点击的是父节点,非具体周数节点");
+  }
+};
+	
+//右侧数据列表
+const gxdfptableData = reactive([])
+const _GXReghtList = async (year,week) => {
+  const GXReghtListdata = await GXReghtList({mouth:year,week:week});
+  console.log(GXReghtListdata.data)
+  gxdfptableData.splice(0,gxdfptableData.length,...GXReghtListdata.data);
+};
+	
+</script>
+
+<style scoped>
+:deep(.plan-usage-low div) {
+	color: red !important;
+}
+.JKWTree-container {
+	display: flex;
+}
+.JKWTree-tree {
+	width: 100%;
+	background-color: #fff;	/* 树状图背景颜色 */
+	padding: 10px;
+	margin-right: 20px;
+}
+.JKWTree-tree h3 {
+	font-size: 15px;
+	font-weight: 700;
+	margin: 10px 0;
+}
+.JKWTree-content {
+	flex: 1;
+}
+.search {
+	margin-left: 0px !important;
+	margin-right: 10px !important;
+}
+.bt {
+	margin-left: 2px !important;
+	padding: 3px !important;
+	font-size: 12px;
+}
+.el-tabs__header {
+	margin: 0px !important;
+}
+.gva-table-box {
+	padding: 0px !important;
+}
+/* 給input增加class:"mab"调节样式 */
+.mab {
+	margin-bottom: 5px;
+}
+</style>
+
+<!-- 自定义全局css样式-->
+<style scoped>
+/* 表格行高 */
+:deep(.el-table td .cell) {
+	line-height: 25px !important;
+}
+/* 选中table某行时的背景色 */
+:deep(.el-table__body tr.current-row)>td {
+	background: #ff80ff !important;
+}
+/* 选中tree组件背景高亮 */
+:deep(.el-tree-node:focus > .el-tree-node__content){
+	background: #ff80ff !important;
+}
+</style>

+ 105 - 80
src/view/performance/Manualdocuments.vue

@@ -104,7 +104,7 @@
 								<el-col :span="24">
 									<el-form-item label="工单编号" prop="id" class="mab">
 										<el-input v-model="formData.sczl_gdbh" id="工单编号" placeholder="Enter回车"
-											@keydown="ent1($event)" @blur="getGxMcsubmit"
+											@keydown="ent1($event,$index,row,'工单编号')"
 											style="width: 118px; margin-right: 5px;" />
 										<el-input v-model="formData.sczl_yjgx" id="yjgx" :readonly="true"
 											@keydown="ent1($event)" style="width: 80px; margin-right: 5px;" />
@@ -119,7 +119,7 @@
 							<el-row :gutter="24">
 								<el-col :span="6">
 									<el-form-item label="产量合计" prop="id" class="mab">
-										<el-input v-model="formData.sczl_cl" id="产量合计" @keydown="ent1($event)"
+										<el-input v-model="formData.sczl_cl" id="产量合计" :readonly="true" @keydown="ent1($event)"
 											style="width: 150px;" />
 									</el-form-item>
 								</el-col>
@@ -708,9 +708,28 @@
 	const ent1 = (event,id1,id2,id3) => {
 		const inputs = document.getElementsByTagName('input');
 		const currentIndex = Array.from(inputs).indexOf(event.target);
-		console.log(id3)
 		
-	if (event.keyCode === 13 && id3 === '流程单号') {
+	if (event.keyCode === 13 && id3 === '工单编号') {
+		getGxMcsubmit()
+		let nextIndex = currentIndex + 1;
+		   let foundNext = false; // 标记是否找到下一个可用的输入框
+		   while (nextIndex < inputs.length) {
+			   if (inputs[nextIndex].disabled) {
+				   console.log("当前输入框为disabled,跳过");
+				   nextIndex++; // 跳过disabled的输入框
+				   continue;
+			   }
+			   if (!inputs[nextIndex].readOnly) {
+				   nextTick(() => {
+					   inputs[nextIndex].focus();
+					   inputs[nextIndex].select();
+				   });
+				   foundNext = true; // 找到下一个可用输入框
+				   break;
+			   }
+			   nextIndex++;
+		   }
+	}else if (event.keyCode === 13 && id3 === '流程单号') {
 	  console.log(id3);
 	
 	  // 获取所有相关的输入框值
@@ -728,78 +747,79 @@
 	  ];
 	
 	  // 获取当前输入框的值
-	  const currentValue = event.target.value;
-	
-	  // 如果输入值为 0,跳过重复校验,直接跳转到下一个输入框
-	  if (currentValue === "0") {
-	    console.log("输入值为 0,无需校验");
+	  let currentValue = event.target.value;
 	
-	    // 跳转到下一个输入框
-	    let nextIndex = currentIndex + 1; // 从当前输入框的下一个开始查找
-	    let foundNext = false; // 标记是否找到下一个可用输入框
-	
-	    while (nextIndex < inputs.length) {
-	      if (inputs[nextIndex].disabled) {
-	        console.log("当前输入框为 disabled,跳过");
-	        nextIndex++; // 跳过 disabled 的输入框
-	        continue;
-	      }
-	      if (!inputs[nextIndex].readOnly) {
-	        nextTick(() => {
-	          inputs[nextIndex].focus(); // 聚焦到下一个输入框
-	          inputs[nextIndex].select(); // 选中下一个输入框的内容
-	        });
-	        foundNext = true; // 标记已找到下一个输入框
-	        break;
-	      }
-	      nextIndex++;
-	    }
+	  // 如果输入框为空,自动填充为 0
+	  if (currentValue === "") {
+	    console.log("输入框为空,自动填充为 0");
+	    event.target.value = "0";
+		let nextIndex = currentIndex + 1;
+		   let foundNext = false; // 标记是否找到下一个可用的输入框
+		   while (nextIndex < inputs.length) {
+			   if (inputs[nextIndex].disabled) {
+				   console.log("当前输入框为disabled,跳过");
+				   nextIndex++; // 跳过disabled的输入框
+				   continue;
+			   }
+			   if (!inputs[nextIndex].readOnly) {
+				   nextTick(() => {
+					   inputs[nextIndex].focus();
+					   inputs[nextIndex].select();
+				   });
+				   foundNext = true; // 找到下一个可用输入框
+				   break;
+			   }
+			   nextIndex++;
+		   }
+	    return;
+	  }
 	
-	    if (!foundNext) {
-	      console.log("没有更多可用的输入框");
-	    }
+	  // 转换输入值为数字类型
+	  currentValue = Number(currentValue);
 	
-	    return; // 直接返回,不再执行后续校验逻辑
+	  // 判断输入值是否小于 0
+	  if (currentValue < 0) {
+	    // 如果输入值小于 0,提示错误并清空输入框
+	    event.target.value = "";
+	    ElMessage({
+	      type: 'error',
+	      message: '输入的值不能小于 0,请重新输入',
+	    });
+	    return;
 	  }
 	
-	  // 检查当前值是否重复(值为 0 不算重复)
-	  const isDuplicate = allValues.filter((val) => val === currentValue && val !== "0").length > 0;
+	  // 检查输入值是否重复
+	  const isDuplicate = allValues.filter((val) => val === currentValue).length > 0;
 	
 	  if (isDuplicate) {
-	    // 如果输入值重复(0 除外),清空当前输入框并提示错误信息
-	    event.target.value = 0;
+	    // 如果值重复,提示错误并清空输入框
+	    event.target.value = "";
 	    ElMessage({
 	      type: 'error',
 	      message: '输入的值已存在,请重新输入',
 	    });
 	  } else {
-	    console.log('输入值无重复');
-	
-	    // 跳转到下一个输入框
-	    let nextIndex = currentIndex + 1; // 从当前输入框的下一个开始查找
-	    let foundNext = false; // 标记是否找到下一个可用输入框
-	
-	    while (nextIndex < inputs.length) {
-	      if (inputs[nextIndex].disabled) {
-	        console.log("当前输入框为 disabled,跳过");
-	        nextIndex++; // 跳过 disabled 的输入框
-	        continue;
-	      }
-	      if (!inputs[nextIndex].readOnly) {
-	        nextTick(() => {
-	          inputs[nextIndex].focus(); // 聚焦到下一个输入框
-	          inputs[nextIndex].select(); // 选中下一个输入框的内容
-	        });
-	        foundNext = true; // 标记已找到下一个输入框
-	        break;
-	      }
-	      nextIndex++;
-	    }
-	
-	    if (!foundNext) {
-	      console.log("没有更多可用的输入框");
-	    }
+	    console.log("输入的值无重复");
+	    // 值无重复,可以继续处理逻辑
 	  }
+	  let nextIndex = currentIndex + 1;
+	     let foundNext = false; // 标记是否找到下一个可用的输入框
+	     while (nextIndex < inputs.length) {
+	  	   if (inputs[nextIndex].disabled) {
+	  		   console.log("当前输入框为disabled,跳过");
+	  		   nextIndex++; // 跳过disabled的输入框
+	  		   continue;
+	  	   }
+	  	   if (!inputs[nextIndex].readOnly) {
+	  		   nextTick(() => {
+	  			   inputs[nextIndex].focus();
+	  			   inputs[nextIndex].select();
+	  		   });
+	  		   foundNext = true; // 找到下一个可用输入框
+	  		   break;
+	  	   }
+	  	   nextIndex++;
+	     }
 	}
 else if (event.keyCode === 13 && id3 === '定额代号') { 
 		console.log("定额代号");
@@ -1210,22 +1230,22 @@ else if (event.keyCode === 13 && id3 === '定额代号') {
 				document.getElementById('备注').select()
 			}
 			ent_sum()
-		} else if (event.keyCode === 8) { // 删除箭头
-			if (event.target.selectionStart === 0) {
-				if (inputName != 1) {
-					if (document.getElementById('fp' + (parseInt(inputName) - 1)).readOnly) {
-						document.getElementById('bh' + (parseInt(inputName) - 1)).focus()
-						document.getElementById('bh' + (parseInt(inputName) - 1)).setSelectionRange(0, 0)
-					} else {
-						document.getElementById('fp' + (parseInt(inputName) - 1)).focus()
-						document.getElementById('fp' + (parseInt(inputName) - 1)).setSelectionRange(0, 0)
-					}
-				} else {
-					document.getElementById('备注').focus()
-					document.getElementById('备注').setSelectionRange(0, 0)
-				}
-				ent_sum()
-			}
+		// } else if (event.keyCode === 8) { // 删除箭头
+		// 	if (event.target.selectionStart === 0) {
+		// 		if (inputName != 1) {
+		// 			if (document.getElementById('fp' + (parseInt(inputName) - 1)).readOnly) {
+		// 				document.getElementById('bh' + (parseInt(inputName) - 1)).focus()
+		// 				document.getElementById('bh' + (parseInt(inputName) - 1)).setSelectionRange(0, 0)
+		// 			} else {
+		// 				document.getElementById('fp' + (parseInt(inputName) - 1)).focus()
+		// 				document.getElementById('fp' + (parseInt(inputName) - 1)).setSelectionRange(0, 0)
+		// 			}
+		// 		} else {
+		// 			document.getElementById('备注').focus()
+		// 			document.getElementById('备注').setSelectionRange(0, 0)
+		// 		}
+		// 		ent_sum()
+		// 	}
 		} else if (event.keyCode === 37) { // 向左箭头
 			if (event.target.selectionStart === 0) {
 				if (inputName != 1) {
@@ -1917,7 +1937,12 @@ const entdedh = (event) => {
 					//刷新页面
 					getTableData()
 				}
-				
+				setTimeout(() => {
+				const inputElement = document.getElementById('工单编号');
+					if (inputElement) {
+						inputElement.focus();		
+					}
+				}, 100);
 			}
 
 		} else if (ADD.value == '修改'){