liuhairui 1 year ago
parent
commit
ce17d460f8
1 changed files with 51 additions and 14 deletions
  1. 51 14
      src/view/yunyin/shengchanguanli/baogongshuju.vue

+ 51 - 14
src/view/yunyin/shengchanguanli/baogongshuju.vue

@@ -109,6 +109,9 @@
 				<el-table-column  align="left" label="客户编号" prop="客户编号" width="80"/>
 				<el-table-column  align="left" label="款式" prop="款式" width="90"/>
 				<el-table-column  align="left" label="生产款号" prop="生产款号" width="110"/>
+				
+				<el-table-column  align="left" label="颜色备注" prop="颜色备注" width="110"/>
+				
 				<!-- 尺码列表 -->
 				<template v-for="item in sizeDatas">
 				  <el-table-column align="center"  :label=item :prop=item  width="50"/> 
@@ -244,6 +247,7 @@ const minutes = String(today.getMinutes()).padStart(2, '0');
 const seconds = String(today.getSeconds()).padStart(2, '0');
 const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
 const currentDates = `${year}-${month}-${day}`;
+const currentDatesa = `${year}-${month}`;
 const currentDatess = `${month}`;
 const treeData = ref([]);
 
@@ -321,20 +325,42 @@ const handleNodeClick = async (node) => {
   // 清空表格数据
   tableData.splice(0, tableData.length);
 
-  // 判断点击节点的层级并设置相应值
-  if (!node.children || node.children.length === 0) {  // 底层日期节点
-    _Machine_riqi.value = node.label;  // 设置日期
-    const parentNode = node.parent;
-    // 获取机台名称
-    if (parentNode && parentNode.label.includes('--')) {
-      _Machine.value = parentNode.label.split('--')[0];  // 获取机台名
+  // // 判断点击节点的层级并设置相应值
+  // if (!node.children || node.children.length === 0) {  // 底层日期节点
+  //   _Machine_riqi.value = node.label;  // 设置日期
+  //   const parentNode = node.parent;
+  //   // 获取机台名称
+  //   if (parentNode && parentNode.label.includes('--')) {
+  //     _Machine.value = parentNode.label.split('--')[0];  // 获取机台名
+  //   }
+  // } else {  
+	 //  console.log(1)
+  //   // 非日期节点时清空 _Machine 和 _Machine_riqi
+  //   _Machine.value = node.label.split('--')[0];
+  //   _Machine_riqi.value = currentDatess;
+  // }
+
+//日期不是固定的
+if (!node.children || node.children.length === 0) {
+    // 第4层(日期节点)
+    _Machine_riqi.value = node.label; // 日期为当前节点的值
+    const parentNode = node.parent; // 获取父节点(如 CQ03--裁剪03组)
+    if (parentNode) {
+        _Machine.value = parentNode.label.split('--')[0]; // 从父节点中提取机台名(CQ03)
     }
-  } else {  
-	  console.log(1)
-    // 非日期节点时清空 _Machine 和 _Machine_riqi
-    _Machine.value = node.label.split('--')[0];
-    _Machine_riqi.value = currentDatess;
-  }
+} else {
+    // 非第4层节点
+    _Machine_riqi.value = "2024-11"; // 日期固定为年份
+    if (node.label.includes('--')) {
+        // 第3层(机台节点)
+        _Machine.value = node.label.split('--')[0]; // 提取机台名(CQ03)
+    } else {
+        // 第1层或第2层节点
+        _Machine.value = node.label; // 直接取节点名作为机台(如“裁剪”)
+    }
+}
+
+
 
   // 调用获取员工列表的函数
   _getStaffList();
@@ -349,6 +375,8 @@ const _department_code = ref('')
 const onSubmit = () => {
 	_department_code.value = '';
 	if(searchInfo.value === ''){
+	  // 清空数据,防止重复
+	  sizeDatas.length = 0;
 	  tableData.length = 0;
 	}else{
 	 _getStaffList();
@@ -359,11 +387,20 @@ const onSubmit = () => {
 const sizeDatas = reactive([])
 //调用报工数据接口
 const _getStaffList = async ()=>{
+	// if (/^\d{4}-\d{2}$/.test(_Machine.value)) {
+	// 	_Machine_riqi.value = _Machine.value
+	// 	_Machine.value = '';
+	// }
+	
 	console.log("机台",_Machine.value)
 	console.log("日期",_Machine_riqi.value)
+	return;
+	// 清空数据,防止重复
+	sizeDatas.length = 0;
+	tableData.length = 0;
   try {
 	  const WorkListdata = await MachineDetail({machine:_Machine.value,date:_Machine_riqi.value,order:searchInfo.value});
-	  console.log(WorkListdata)
+	  // console.log(WorkListdata)
 	  //将 1 转换为 "是",0 转换为 "否"
 	  WorkListdata.data.table.forEach(item => {
 		  item.船样 = item.船样 === 1 ? '是' : '否';