zck 1 year ago
parent
commit
97c895841a

+ 14 - 10
src/view/performance/chejianbaogong.vue

@@ -1404,23 +1404,23 @@
 					<!-- <el-col :span="1" style="margin-top:0px; margin-bottom: 1px;"></el-col> -->
 					<el-col :span="4" style="margin-top:0px; margin-bottom: 1px;margin-left:0">
 						<el-form-item label="定额代号" prop="id" style="margin-top:0px; margin-bottom: 1px;">
-						<el-input v-model="formData3.定额代号" id="定额代号" style="margin-top:0px; margin-bottom: 1px;" @keydown="ent($event, '通电工时', '定额代号', '码')"  placeholder="" />
+						<el-input v-model="formData3.定额代号" id="定额代号" style="margin-top:0px; margin-bottom: 1px;" @keydown="ent($event, '通电工时', '定额代号', '码开始行')"  placeholder="" />
 						</el-form-item>
 					</el-col>
 
 					<el-col :span="3" style="margin-top:0px; margin-bottom: 1px;">
 					  <el-form-item label="码开始行" prop="id" style="margin-top:0px; margin-bottom: 1px;margin-left:0">
-						<el-input v-model="formData3.码开始行" style="margin-top:0px; margin-bottom: 1px;" id="码包"  @keydown="ent($event, '定额代号', '码包', '主电表')"  placeholder="" />
+						<el-input v-model="formData3.码开始行" style="margin-top:0px; margin-bottom: 1px;" id="码开始行"  @keydown="ent($event, '定额代号', '码开始行', '码结束行')"  placeholder="" />
 					  </el-form-item>
 					  </el-col>
 					  <el-col :span="3" style="margin-top:0px; margin-bottom: 1px;">
 					  <el-form-item label="码结束行" prop="id" style="margin-top:0px; margin-bottom: 1px;margin-left:0">
-						<el-input v-model="formData3.码结束行" style="margin-top:0px; margin-bottom: 1px;" id="码包"  @keydown="ent($event, '定额代号', '码包', '主电表')"  placeholder="" />
+						<el-input v-model="formData3.码结束行" style="margin-top:0px; margin-bottom: 1px;" id="码结束行"  @keydown="ent($event, '码开始行', '码结束行', '码包')"  placeholder="" />
 					  </el-form-item>
 					  </el-col>
 					  <el-col :span="6" style="margin-top:0px; margin-bottom: 1px;">
 					  <el-form-item label="码包" prop="id" style="margin-top:0px; margin-bottom: 1px;margin-left:105px">
-						<el-input v-model="formData3.码包" style="margin-top:0px; margin-bottom: 1px;" id="码包"  @keydown="ent($event, '定额代号', '码包', '主电表')"  placeholder="" />
+						<el-input v-model="formData3.码包" style="margin-top:0px; margin-bottom: 1px;" id="码包"  @keydown="ent($event, '码结束行', '码包', '主电表')"  placeholder="" />
 					  </el-form-item>
 					  </el-col>
 					  <el-col :span="5" style="margin-top:0px; margin-bottom: 1px;">
@@ -2332,11 +2332,12 @@ const ent = (event,id1,id2,id3) => {
     if(id1!=''){
       document.getElementById(id1).focus()
     }
-  }else if (event.keyCode === 8) { // 删除箭头
-    if(id1!='' && document.getElementById(id2).value==''){
-      document.getElementById(id1).focus()
-    }
-    console.log(document.getElementById(id2).value)
+//   }
+//   else if (event.keyCode === 8) { // 删除箭头
+//     if(id1!='' && document.getElementById(id2).value==''){
+//       document.getElementById(id1).focus()
+//     }
+//     console.log(document.getElementById(id2).value)
   }else if (event.keyCode === 37) { // 向左箭头
     if(id1!='' && document.getElementById(id2).selectionStart==0){
       document.getElementById(id1).focus()
@@ -3530,6 +3531,7 @@ const JPblplanUsageCellClass = ({row, column, rowIndex, columnIndex}) =>{
 const JPtableData = ref([
 	{ name: '废品版', type: '废品版' },
 	{ name: '正品版', type: '正品版' },
+	{ name: '次品版', type: '次品版' },
 ])
 
 const JPhandleRowClick = async (row) => {
@@ -3780,7 +3782,6 @@ const ReportInfo = async () => {
 	console.log(getTimelistss)
 	console.log("获取下机时间")
 	console.log(formData)
-	chanliangVisible.value = true
 	//4.1获取报工单其他信息接口
 	const response = await reportInfo({ machine: JTMC.split("#")[0] });
 	// console.log(response)
@@ -3847,6 +3848,9 @@ const ReportInfo = async () => {
 	  装版总时长:0,
 	  打样总工时:0,
 	  通电工时:0,
+	  码开始行:0,
+	  码结束行:0,
+	  码包:0,
 	  主电表:0,
 	  辅电表:0,
 	  定额代号:formData.value.定额代号,

+ 71 - 40
src/view/yunyin/shengchanguanli/shebeiyunxing.vue

@@ -146,7 +146,7 @@
 
                         <el-tab-pane label="当班产量明细" @click="showTable('印版资料')" name="third">
                         <el-table ref="multipleTable" highlight-current-row="true"
-                                  :show-overflow-tooltip="true" :row-style="{ height: '20px' }"
+                                  :show-overflow-tooltip="true" :row-style="{ height: '20px' }" 
                                   :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                                   :header-cell-style="{ padding: '0px' }"  @row-dblclick="ybupdateCompanyFunc"
                                   style="width: 100%;height: 400px" border tooltip-effect="dark" :data="CLMXData" row-key="ID"
@@ -877,10 +877,10 @@
 						v-if="! isJPJT"
 						:show-overflow-tooltip="true"
 						@selection-change="selectionChange($event)"
-						:row-style="{ height: '20px' }"
+						:row-style="{ height: '20px' }" :selectable="checkboxT"
 						:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
 						:header-cell-style="{ padding: '0px' }" @row-click="getUid"
-						highlight-current-row="true" @row-dblclick="gytableDatadoubleClick"
+						highlight-current-row="true" @row-dblclick="gytableDatadoubleClick" 
 						style="width: 100%;height: 70vh" border tooltip-effect="dark" :data="gytableData" row-key="ID" >
 				<el-table-column type="selection" width="55" />
 				<!-- <el-table-column align="left" label="选择" prop="工单编号"  width="100"/> -->
@@ -2871,7 +2871,7 @@ const InspectionRecord = async () => {
 const dbclSelection = ref('')
 //当班产量明细复选框
 const dbclmxSelectionChange = (selection, type) => {
-  console.log(selection)
+  console.log("selection",selection)
   if (selection.length > 1) {
   	ElMessage({type: 'warning',message: '您只能选择一条进行删除!'})
     // 重置选择项
@@ -3934,13 +3934,30 @@ const JPent = async (event,key,val) => {
 
 
 const Selection_ids = ref('')
+const customer = ref('')
 // 印件资料多选、工艺资料多选
 const selectionChange = (selection) => {
+	console.log(selection)
+	if(selection.length !==0){
+		customer.value = selection[0].工单编号
+	}else{
+		customer.value = ''
+	}
 	const ids = selection.map(item => {
 	  return item.UniqId
 	})
     Selection_ids.value = ids.join(',')
+	console.log(Selection_ids.value)
+}
+
+const checkboxT = (row, index) => {
+	if(customer.value != ''){
+		return row.工单编号 === customer.value
+	}else{
+		return true
+	}
 }
+
 //删除
 function onDel() {
 	Chanliangdel()
@@ -3969,6 +3986,7 @@ const Chanliangdel = async() => {
 		})
 	}
 }
+
 //核算调整
 function hesuan(){
 	hesuanVisible.value=true
@@ -4754,61 +4772,74 @@ function updateTotal() {
 
 const addBz = async() => {
 	//数据初始化
-	initfordata3()
 	updateTotal()
+	//判断机台和班组是否为空
 	if(!selectedOption.value || !BZMC.value){
 		ElMessage({
 		  type: 'warning',
-		  message: '机台或者班组不能为空'
+		  message: '机台或者班组编号不能为空'
 		})
 		return;
 	}
 	const jt = selectedOption.value.split('|')[0]//获取车间数据
-	//判断车间分配比例【SY、PM】	
+	//判断车间是否是【SY、PM】	
 	const shouldCheckLessThanOne = !jt.includes('SY') && !jt.includes('PM');
 	console.log(fpsum.value)
 	const relevantKeys = ['percentage1', 'percentage2', 'percentage3', 'percentage4', 'percentage5', 'percentage6', 'percentage7', 'percentage8'];
-  	const values = relevantKeys.reduce((acc, key) => {
-    const value = parseFloat(formDatas.value[key], 10);
-    if (!isNaN(value)) {
-      acc.push(value); // 只有当 value 不是 NaN 时才添加到数组中
-    }
-    return acc;
-  }, []); // 初始化为空数组
+	let hasValidMember = false; // 标志变量,用于检查是否有有效的组员
+
+	// 循环检查每个成员
+	for (let i = 1; i <= relevantKeys.length; i++) {
+	const codeKey = `code${i}`;
+	const nameKey = `name${i}`;
+	const percentageKey = `percentage${i}`;
+	const percentageValue = parseFloat(formDatas.value[percentageKey], 10); //获取分配系数的值
+	//编号为空时清空名称和分配系数
+	(function(index) {
+    watch(
+      () => formDatas.value[codeKey],
+      (newVal, oldVal) => {
+        if (!newVal) {
+			formDatas.value[nameKey] = '';
+			formDatas.value[percentageKey] = '';
+        }
+      }
+    );
+  })(i); // 使用立即执行的函数表达式(IIFE)来捕获当前的i值
  
-//   for(let i=0;i<relevantKeys.length;i++){
-// 	if(formDatas.code[i] && formDatas.name[i]){
-// 		console.log('有组员')
-// 	}
-//   }
-  //判断分配系数是否在0-1之间
-  const hasInvalidValue = values.some(value => value <= 0 || value > 1);
-  console.log(hasInvalidValue);
-  if (hasInvalidValue) {
-    ElMessage({
-      type: "error",
-      message: "组员分配系数有误",
-    });
-    return;
+  if (formDatas.value[codeKey] || formDatas.value[nameKey]) {
+    console.log('有组员');
+    if (isNaN(percentageValue) || percentageValue <= 0 || percentageValue > 1) {
+      console.log('分配系数不能小于等于0或者大于1,或者该值为NaN');
+    } else {
+      hasValidMember = true; // 如果有有效的百分比值,则设置标志变量为true
+    }
   }
-	
-  //全部机台组员合计不能大于1
-	if (fpsum.value > 1) {
+}
+ 
+// 循环结束后检查标志变量
+if (!hasValidMember) {
+  // 如果没有有效的组员(即所有百分比值都无效或为空),则显示错误消息
+  ElMessage({
+    type: "error",
+    message: "所有组员的分配系数必须填写且值应在0到1之间",
+  });
+}else if (shouldCheckLessThanOne && fpsum.value < 1) {//如果有组员,并且 shouldCheckLessThanOne 为 true(不是PM和SY机器),则检查 fpsum.value < 1
 		ElMessage({
 		type: "error",
-		message: "分配系数相加不能大于1",
-	});
+		message: "分配系数相加不能于1",
+		});
 		return;
-	}
-
-	// 只有当 shouldCheckLessThanOne 为 true 时才检查 fpsum.value < 1
-	if (shouldCheckLessThanOne && fpsum.value < 1) {
+	}else if(fpsum.value > 1) { //所有机器的分配系数之和不能大于1
 		ElMessage({
 		type: "error",
-		message: "分配系数相加不能于1",
-		});
+		message: "分配系数相加不能大于1",
+	});
 		return;
 	}
+  return;
+
+	
 
   const response = await MachineTeamAdd({
     sczl_jtbh:  selectedOption.value.split('|')[0],
@@ -4857,7 +4888,7 @@ const selectBz = async() => {
 	return;
 }
 	const jt = selectedOption.value.split('|')[0]//获取车间数据
-	//判断车间分配比例【SY、PM、WY
+	//判断车间分配比例【SY、PM】	
 	const shouldCheckLessThanOne = !jt.includes('SY') && !jt.includes('PM');
 	const relevantKeys = ['percentage1', 'percentage2', 'percentage3', 'percentage4', 'percentage5', 'percentage6', 'percentage7', 'percentage8'];
   	const values = relevantKeys.reduce((acc, key) => {