liuhairui 1 жил өмнө
parent
commit
52ba0ebab7

+ 112 - 23
src/view/performance/chejianbaogong.vue

@@ -15,7 +15,7 @@
 			<el-button type="primary" size="large" class="bt" style="color:white;font-size: 16px;font-weight: bold;width: 70px"  @click="oncomplaints" >客诉记录</el-button>
 			<el-button type="primary" size="large" class="bt" style="color:white;font-size: 16px;font-weight: bold;width: 120px" @click="deldbcl_onclick" :disabled="dbclSelection === ''"   title="当班产量明细" >当班产量明细删除</el-button>
 			<el-button type="primary" size="large" class="bt" style="color:white;font-size: 16px;font-weight: bold;width: 85px"  @click="pd_lcdlistonClick" >流程单查询</el-button>
-			<el-button type="primary" size="large" class="bt" style="color:white;font-size: 16px;font-weight: bold;width: 165px"  @click="scpconClick" >工单生产批次信息查询</el-button>
+			<el-button type="primary" size="large" class="bt" style="color:white;font-size: 16px;font-weight: bold;width: 165px" @click="scpconClick" >工单生产批次信息查询</el-button>
 			<el-button type="primary" size="large" class="bt" style="color:white;font-size: 20px;font-weight: bold;width: 70px"  @click="onOver" title="完工按钮" >完工</el-button>
 		</div>
 	</header>
@@ -384,10 +384,13 @@
           </el-dialog>
 
 <!--          组员及分配比例-->
-          <el-dialog v-model="blModel" :before-close="() => blModel = false" style="width: 20%">
+          <el-dialog v-model="blModel" :before-close="() => blModel = false" style="width: 20%" @keydown="selectBZRR($event)">
             <el-form>
               <div>
-                <el-table :data="employeeData" border :show-overflow-tooltip="true" :cell-class-name="blplanUsageCellClass"  @row-click="tablebllickHandler($event)">
+                <el-table :data="employeeData" border :show-overflow-tooltip="true" :cell-class-name="blplanUsageCellClass"  
+				highlight-current-row="true"
+				ref="tableBZRR"
+				@row-click="tablebllickHandler($event)">
                   <el-table-column prop="员工编号" label="员工编号"></el-table-column>
                   <el-table-column prop="ygxm" label="员工姓名"></el-table-column>
                 </el-table>
@@ -3093,38 +3096,124 @@ const getbzyg = async (value,key) => {
 }
 
 const clicked = ref(false);
+const currentIndex = ref(0);
+const tableBZRR = ref();
+
+// 模拟点击某一行
+const setCurrent = (row) => {
+  setTimeout(() => {
+    tableBZRR.value?.setCurrentRow(row); // 高亮选中当前行
+    const { 员工编号, ygxm } = row;
+    console.log("选中行数据:", row);
+  });
+};
+
+// 键盘事件处理逻辑
+const selectBZRR = (event) => {
+  if (event.keyCode === 40) {
+    // 向下箭头
+    if (currentIndex.value < employeeData.value.length - 1) {
+      currentIndex.value++;
+    } else {
+      // 如果是最后一行,回到第一行
+      currentIndex.value = 0;
+    }
+  } else if (event.keyCode === 38) {
+    // 向上箭头
+    if (currentIndex.value > 0) {
+      currentIndex.value--;
+    } else {
+      // 如果是第一行,跳到最后一行
+      currentIndex.value = employeeData.value.length - 1;
+    }
+  } else if (event.keyCode === 13) {
+    // 回车键,模拟触发点击事件
+    const row = employeeData.value[currentIndex.value];
+    tablebllickHandler(row); // 手动调用行点击事件
+  }
+  setCurrent(employeeData.value[currentIndex.value]); // 高亮当前选中的行
+};
+
+// 表格行点击事件处理
 const tablebllickHandler = async (row, column, event) => {
   if (clicked.value) {
     // 如果已经点击过一次,则不再执行操作
     return;
   }
-  console.log("Special",Special.value)
+
+  console.log("Special", Special.value);
+
+  // 检查 code1 到 code7 和 name1 到 name7 的情况
+  for (let i = 1; i <= 7; i++) {
+    const codeKey = `code${i}`;
+    const nameKey = `name${i}`;
+
+    // 如果 code 有值,且对应的 name 没有值,则清空 code 的值
+    if (formDatas.value[codeKey] !== '' && formDatas.value[nameKey] === '') {
+      formDatas.value[codeKey] = ''; // 清空 code 的值
+      console.log(`清空了 ${codeKey} 的值,因为 ${nameKey} 为空`);
+    }
+  }
+
   let nextIndex = 1;
-  while (formDatas.value[`code${nextIndex}`] !== '' && formDatas.value[`name${nextIndex}`] !== '') {
+  // 找到下一个需要填充的空位置
+  while (
+    formDatas.value[`code${nextIndex}`] !== '' && 
+    formDatas.value[`name${nextIndex}`] !== ''
+  ) {
     nextIndex++;
-    if (nextIndex > 8) {
+    if (nextIndex > 4) { // 这里只处理4个输入框的情况
       // 如果所有字段都已经填满,则不做任何事情并退出函数
       return;
     }
   }
-  if(Special.value === "8"){
-	formDatas.value.code8 = row.员工编号;
-	formDatas.value.name8= row.ygxm;
-	console.log(787878)
-	blModel.value = false;
-	clicked.value = true;
-  }else{
-	formDatas.value[`code${nextIndex}`] = row.员工编号;
-	formDatas.value[`name${nextIndex}`] = row.ygxm;
-	console.log(12345)
-	blModel.value = false;
-	clicked.value = true;
-  }
-  // 将选定的值分配给下一个空的代码和名称字段
 
-  setTimeout(() => {
-    clicked.value = false;
-  }, 300); // 300毫秒内再次点击将不会触发事件,你可以根据需要调整这个延迟时间
+  // 特殊情况:直接填充到第8个位置
+  if (Special.value === "8") {
+    formDatas.value.code8 = row.员工编号;
+    formDatas.value.name8 = row.ygxm;
+    console.log("填充到code8和name8");
+
+    // 弹窗关闭并防止重复点击
+    setTimeout(() => {
+      blModel.value = false; // 延迟关闭弹窗
+      clicked.value = false; // 恢复点击标志
+    }, 300);
+  } else {
+    // 当前按下回车的输入框索引
+    const currentInputIndex = currentIndex.value + 1;
+    console.log("当前输入框索引:", currentInputIndex);
+
+    // 如果找到的空位不是当前输入框,则填充前面的空位
+    if (nextIndex !== currentInputIndex) {
+      // 填充前面空位
+      formDatas.value[`code${nextIndex}`] = row.员工编号;
+      formDatas.value[`name${nextIndex}`] = row.ygxm;
+
+      console.log(`填充数据到第${nextIndex}个输入框:`, row);
+
+      // 检查当前输入框是否需要清空
+      if (
+        formDatas.value[`name${currentInputIndex}`] === '' && 
+        formDatas.value[`code${currentInputIndex}`] !== ''
+      ) {
+        // 如果当前输入框的 name 为空,但 code 有值,清空当前输入框
+        formDatas.value[`code${currentInputIndex}`] = '';
+        console.log(`清空当前第${currentInputIndex}个输入框的数据`);
+      }
+    } else {
+      // 如果当前输入框就是下一个空位,则直接填充到当前输入框
+      formDatas.value[`code${currentInputIndex}`] = row.员工编号;
+      formDatas.value[`name${currentInputIndex}`] = row.ygxm;
+      console.log(`填充数据到当前第${currentInputIndex}个输入框:`, row);
+    }
+
+    // 弹窗关闭并防止重复点击
+    setTimeout(() => {
+      blModel.value = false; // 延迟关闭弹窗
+      clicked.value = false; // 恢复点击标志
+    }, 300);
+  }
 };
 
 const getxunchayg = async (value) => {

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 421 - 407
src/view/yunyin/shengchanguanli/shebeiyunxing.vue


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно