zck před 9 měsíci
rodič
revize
e7a441d96a

+ 7 - 2
src/view/equipment/maintenance.vue

@@ -715,7 +715,8 @@ const actionMap = {
 
 // 节点点击事件
 const handleNodeClick = async (nodeData) => {
-  
+  console.log(nodeData)
+    if(!nodeData.children){
     const action = actionMap[nodeData.code];
     if (action) {
       await action(nodeData);
@@ -723,7 +724,11 @@ const handleNodeClick = async (nodeData) => {
     } else {
       console.warn('未知节点类型:', nodeData.code);
     }
-  
+  }else if(nodeData.children.length === 0){
+    yearcode.value = nodeData.code.includes('保养') ? 2 : 
+                 nodeData.code.includes('维修') ? 1 : 
+                 null;
+  }
 };
 
 const searchInfo = ref('')

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

@@ -998,6 +998,7 @@
 		  <div style="height: 50px;margin-left: 1vh;">
 			<el-button type="primary" @click="onYbout" >领出</el-button>
 			<el-button type="primary" @click="onYbback" >收回</el-button>
+			<el-button @click="yinbaninvertSelection" type="info">反选</el-button>
 		  </div>
 		</header>
 			<el-row :gutter="24">
@@ -1006,6 +1007,11 @@
 				  <el-input v-model="formData.工单编号"  />
 				</el-form-item>
 			  </el-col>
+			  <el-col :span="4">
+				<el-form-item label="印件号" prop="id">
+				  <el-input v-model="formData.印件号"  />
+				</el-form-item>
+			  </el-col>
 			  <el-col :span="6">
 				<el-form-item prop="id">
 				  <el-input v-model="formData.productCode"   />
@@ -1029,6 +1035,7 @@
 			  </div>
 			  <div style="flex: 1; margin: 0;">
 				<el-table
+				  ref="yinbanmultipleTable"
 				  tooltip-effect="dark"
 				  :data="yinbanselectData"
 				  row-key="ID"
@@ -1062,6 +1069,13 @@
 					label="供方批号"
 					width="150"
 				  />
+
+				  <el-table-column
+				  prop="工单编号"
+				  label="当前领用工单"
+				  width="180"
+				/>
+
 				  <el-table-column
 					prop="制造日期"
 					label="制造日期"
@@ -1109,6 +1123,25 @@
 			  </div>
 			</div>
 		  </el-dialog>
+
+		  <!-- 退回弹窗 -->
+		<el-dialog
+				v-model="dialogwithdrawVisible"
+				title="印版印数"
+				style="width: 20%; margin: 30vh auto;"
+				>
+				<el-form-item label="印数">
+				<el-input v-model="Plate.印数" placeholder="请输入印数" />
+			</el-form-item>
+
+			<template #footer>
+				<div class="dialog-footer" style="width: 100%;">
+					<el-button @click="rawcloseDialog" style="width: 100px; height: 40px;">关 闭</el-button>
+					<el-button type="primary" @click="rawenterDialog" style="width: 100px; height: 40px;">确 定</el-button>
+				</div>
+			</template>
+		</el-dialog>
+
   
 		  <el-dialog
 			v-model="xunchaVisible"
@@ -3692,11 +3725,13 @@ const warningres = (arr) => {
   }
   const onYbout = async() => {
 	yinbanSelection.value.map((item)=>{
+		const 印数 = item.印数 != null ? item.印数.toString() : '0';
 	  item.Yb_工单编号=formData.value.工单编号
+	  item.Yb_印件号=formData.value.印件号
 	  item.Yb_存货编码=item.存货编码
 	  item.Yb_供方批号=item.供方批号
 	  item.Yb_领用机台=JTMC
-	  item.Yb_印数=item.印数
+	  item.Yb_印数=印数
 	  item.Sys_id=`[${formData.value.addr}/${JTMC}]`
 	  delete item.UniqId
 	  delete item.产品名称
@@ -3710,6 +3745,8 @@ const warningres = (arr) => {
 	  delete item.存货编码
 	  delete item.客户名称
 	  delete item.客户编号
+	  delete item.工单编号
+	  delete item.印件号
 	  return item
 	})
 	console.log(yinbanSelection.value)
@@ -3724,20 +3761,100 @@ const warningres = (arr) => {
 	}
   
   }
-  const onYbback = async() => {
-	const arr=[]
-	yinbanSelection.value.map((item)=>{
-	  if(item.UniqId===null){
-	  }else{
-		arr.push(item.UniqId)
-	  }
-	})
-	const response = await PrintDetailEdit({id:arr.join(',')})
-	if(response.code===0){
-	  facilityPrintDetailItem(formData.value.code)
-	  successres('成功!')
-	}
+//   const onYbback = async() => {
+// 	const arr=[]
+// 	yinbanSelection.value.map((item)=>{
+// 	  if(item.UniqId===null){
+// 	  }else{
+// 		arr.push(item.UniqId)
+// 	  }
+// 	})
+// 	const response = await PrintDetailEdit({id:arr.join(',')})
+// 	if(response.code===0){
+// 	  facilityPrintDetailItem(formData.value.code)
+// 	  successres('成功!')
+// 	}
+//   }
+
+const dialogwithdrawVisible = ref(false)
+const Plate = ref({ 印数: '' });
+  const onYbback = async () => {
+  console.log(yinbanSelection.value);
+
+  // 检查是否有印数为 null 或 undefined
+  const hasInvalidUniqId = yinbanSelection.value.some(item => {
+    return item?.UniqId === null || item?.UniqId === undefined;
+  });
+
+  if (hasInvalidUniqId) {
+    ElMessage.error("选择的数据中有未领用的印版,无法收回!");
+    return; 
+  }
+
+  // 所有 UniqId 都有效,才打开弹窗
+  dialogwithdrawVisible.value = true;
+};
+
+  // 删除操作
+  const rawenterDialog = async () => {
+	console.log(Plate.value.印数)
+  try {
+    await ElMessageBox.confirm('确定收回吗', '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    })
+    console.log('收回选中的数据:', yinbanSelection.value)
+	const uniqIds = yinbanSelection.value.map(item => item.UniqId).join(',');
+	console.log(uniqIds); 
+    // 调用收回API,假设是批量删除接口
+    const res = await PrintDetailEdit({ id: uniqIds,number:Plate.value.印数})
+    
+    if (res.code === 0) {
+      ElMessage.success('收回成功')
+      rawcloseDialog()
+      // 清空选中
+      yinbanSelection.value = []
+    } else {
+      ElMessage.error(res.msg || '收回失败')
+    }
+  } catch (error) {
+    if (error !== 'cancel') {
+      console.error('收回失败:', error)
+      ElMessage.error('收回操作已取消')
+    }
   }
+}
+
+const rawcloseDialog = () => {
+  Plate.印数 = ''
+  dialogwithdrawVisible.value = false
+}
+
+const yinbanmultipleTable = ref(null); // 表格ref
+const yinbaninvertSelection = () => {
+  // 1. 获取当前表格的所有有效数据(排除不需要的行)
+  const validData = yinbanselectData.value.filter(item => 
+    !item.isTotal && 
+    !(item.产品名称?.includes('A班产量:') || item.产品名称?.includes('B班产量:'))
+  );
+
+  // 2. 获取当前已选中的行
+  const currentSelected = yinbanmultipleTable.value?.getSelectionRows() || [];
+  
+  // 3. 清除当前所有选择
+  yinbanmultipleTable.value?.clearSelection();
+
+  // 4. 执行反选操作
+  validData.forEach(row => {
+    yinbanmultipleTable.value?.toggleRowSelection(
+      row, 
+      !currentSelected.some(selected => selected.UniqId === row.UniqId)
+    );
+  });
+
+};
+
   const onzhicheng = async () => {
 	  zhichengstatus.value=false
 	  xunchaData.value=[]

+ 2 - 2
src/view/yunyin/chanpinziliao/chanpinziliao.vue

@@ -337,7 +337,7 @@
                 <el-input  v-model="scope.row.Gy0_ls" :clearable="false"/>
               </el-table-column>
               <el-table-column v-slot="scope" align="left" prop="Add_gxmc" label=工序名称 width="210" >
-                <el-input  v-model="scope.row.Add_gxmc" :clearable="false"/>
+                <el-input disabled v-model="scope.row.Add_gxmc" :clearable="false"/>
               </el-table-column>
               <el-table-column v-slot="scope" align="left" prop="remark" label=工序备注说明 width="340" >
                 <el-input  v-model="scope.row.remark" :clearable="false"/>
@@ -2304,8 +2304,8 @@ const jsssxzConfirm = async () => {
     return {
       UniqID: item.UniqID,
       Gy0_Ms: item.ms_coe,
-      Gy0_gxh: item.Gy0_gxh,
       Gy0_Ks: item.Gy0_Ks,
+      Gy0_ls:item.Gy0_ls,
       Add_gxmc: item.Add_gxmc,
       remark: item.remark
     };

+ 167 - 42
src/view/yunyin/shengchanguanli/shebeiyunxing.vue

@@ -699,15 +699,20 @@
 		  style="height: 75%;"
 		>
 		<div style="margin-top:-12px">
-			<el-button type="primary" class="bt" icon="edit" @click="onout">领出</el-button>
-			<el-button type="primary" class="bt" icon="document" @click="onwithdraw">收回</el-button>
-			<el-button @click="invertSelection" type="info">反选</el-button>
+			<el-button type="primary" class="bt" icon="edit" :disabled="currentSelection.length === 0" @click="onout">领出</el-button>
+			<el-button type="primary" class="bt" icon="document" :disabled="currentSelection.length === 0" @click="onwithdraw">收回</el-button>
+			<el-button @click="yinbaninvertSelection" type="info">反选</el-button>
     </div>
 		  <el-row :gutter="24" style="margin-top: 10px;">
 		    <el-col :span="4">
 		      <el-form-item label="工单编号" prop="id">
 		        <el-input v-model="formData.工单编号" :clearable="true" />
 		      </el-form-item>
+		    </el-col>
+			<el-col :span="4">
+		      <el-form-item label="印件号" prop="id">
+		        <el-input v-model="formData.印件号" :clearable="true" />
+		      </el-form-item>
 		    </el-col>
 			<el-col :span="6">
 			  <el-form-item prop="id">
@@ -733,16 +738,17 @@
 		    </div>
 		    <div style="flex: 1; margin: 0;">
 		      <el-table
-		        tooltip-effect="dark"
-		        :data="yinbanselectData"
-		        row-key="ID"
-		        highlight-current-row="true"
-		        border  
-		        style="width:1000px; height:400px;"
-		        @row-dblclick="handleSelectClick"
-		        :row-class-name="rowClassName"
-				@selection-change="yinbanSelectionChange">
-			  <el-table-column type="selection" width="30" />
+			 ref="yinbanmultipleTable"
+			 tooltip-effect="dark"
+			 :data="yinbanselectData"
+			  row-key="ID"
+			 highlight-current-row="true"
+			 border  
+			 style="width:1000px; height:400px;"
+			 @row-dblclick="handleSelectClick"
+			 :row-class-name="rowClassName"
+			 @selection-change="yinbanSelectionChange">
+			  <el-table-column fixed type="selection" width="30" />
 		        <el-table-column
 		          prop="存货编码"
 		          label="存货编码"
@@ -764,6 +770,13 @@
 				  label="供方批号"
 				  width="180"
 				/>
+
+				<el-table-column
+				  prop="工单编号"
+				  label="当前领用工单"
+				  width="180"
+				/>
+
 				<el-table-column
 				  prop="制造日期"
 				  label="制造日期"
@@ -802,21 +815,27 @@
 				  width="180"
 				/>
 
-				<el-table-column
-				  prop="点检方法"
-				  label="备注说明"
-				  width="180"
-				/>
-				<el-table-column
-				  prop="点检方法"
-				  label="备注说明"
-				  width="180"
-				/>
-
 		      </el-table>
 		    </div>
 		  </div>
 		</el-dialog>
+	<!-- 退回弹窗 -->
+		<el-dialog
+				v-model="dialogwithdrawVisible"
+				title="印版印数"
+				style="width: 20%; margin: 30vh auto;"
+				>
+				<el-form-item label="印数">
+				<el-input v-model="Plate.印数" placeholder="请输入印数" />
+			</el-form-item>
+
+			<template #footer>
+				<div class="dialog-footer" style="width: 100%;">
+					<el-button @click="rawcloseDialog" style="width: 100px; height: 40px;">关 闭</el-button>
+					<el-button type="primary" @click="rawenterDialog" style="width: 100px; height: 40px;">确 定</el-button>
+				</div>
+			</template>
+		</el-dialog>
 
 		<el-dialog
 		  v-model="xunchaVisible"
@@ -2518,6 +2537,7 @@ import {
 MachineTeamAdd,
   setMachineTeam,
   PrintDetailAdd,
+  PrintDetailEdit
 } from '@/api/jixiaoguanli/baogong'
 import {
   FieldInspectionRecord,
@@ -2591,6 +2611,7 @@ const handleNodeClick = (nodeData,node) => {
     node.querySelector('.el-tree-node__label').style.color = '';
   });
   // 获取点击的节点
+  console.log(node)
   const clickedNodeId = node['id'];
   const clickedNode = document.querySelector(`.treecolor .el-tree-node[data-key="${clickedNodeId}"]`);
   if (clickedNode) {
@@ -5277,32 +5298,55 @@ const facilityPrintDetailItem = async (value) => {
   }
 };
 
-let currentSelection = []; // 存储选中的数据
+let currentSelection = ref([]); // 存储选中的数据
 
 // 勾选回调
 const yinbanSelectionChange = (selection) => {
-  currentSelection = selection; // 更新选中的数据
-  console.log("当前勾选数据:", currentSelection);
+  currentSelection.value = selection; // 更新选中的数据
+  console.log("当前勾选数据:", currentSelection.value);
 };
 
 const onout = async () => {
   try {
-    console.log("当前selection:", currentSelection); // 确保能访问到
-    
-    if (!currentSelection || currentSelection.length === 0) {
-      ElMessage.warning("请先选择要领出的印版");
-      return;
-    }
+    console.log("当前选中数据:", currentSelection.value);
+
+    // 检查必填字段
+    const missingFields = [];
+    const requestData = currentSelection.value.map((item, index) => {
+		const 印数 = item.印数 != null ? item.印数.toString() : '0';
+      // 定义必填字段及其映射关系
+      const requiredFields = {
+        '工单编号': formData.value.工单编号,
+        '存货编码': item.存货编码,
+        '供方批号': item.供方批号,
+        '印数':印数,
+        '印件号': formData.value.印件号,
+        '系统ID': sys_id
+      };
 
-    // 转换数据格式
-    const requestData = currentSelection.map(item => ({
-      Yb_工单编号: formData.value.工单编号 || "",
-      Yb_存货编码: item.存货编码 || "",
-      Yb_供方批号: item.供方批号 || "",
-      Yb_领用机台: JTMC, 
-      Yb_印数: item.印数 ? item.印数.toString() : "0", 
-      Sys_id: sys_id || "",
-    }));
+      // 检查必填字段是否为空
+      Object.entries(requiredFields).forEach(([fieldName, value]) => {
+        if (value === undefined || value === null || value === "") {
+          missingFields.push(`第${index + 1}条数据的${fieldName}`);
+        }
+      });
+
+      // 构建请求数据对象
+      return {
+        Yb_工单编号: formData.value.工单编号,
+        Yb_存货编码: item.存货编码,
+        Yb_供方批号: item.供方批号,
+        Yb_领用机台: JTMC,
+        Yb_印数: 印数,
+        Yb_印件号: formData.value.印件号,
+        Sys_id: sys_id
+      };
+    });
+
+    // 如果有缺失字段,抛出错误
+    if (missingFields.length > 0) {
+      throw new Error(`以下字段为必填项且不能为空:\n${missingFields.join("\n")}`);
+    }
 
     console.log("提交数据:", requestData);
     const response = await PrintDetailAdd(requestData);
@@ -5317,7 +5361,84 @@ const onout = async () => {
     ElMessage.error(`调用失败: ${error.message}`);
   }
 };
+const dialogwithdrawVisible = ref(false)
+const Plate = ref({ 印数: '' });
+const onwithdraw = async () => {
+  console.log(currentSelection.value);
+
+  // 检查是否有印数为 null 或 undefined
+  const hasInvalidUniqId = currentSelection.value.some(item => {
+    return item?.UniqId === null || item?.UniqId === undefined;
+  });
+
+  if (hasInvalidUniqId) {
+    ElMessage.error("选择的数据中有未领用的印版,无法收回!");
+    return; 
+  }
+
+  // 所有 UniqId 都有效,才打开弹窗
+  dialogwithdrawVisible.value = true;
+};
+
+  // 删除操作
+const rawenterDialog = async () => {
+	console.log(Plate.value.印数)
+  try {
+    await ElMessageBox.confirm('确定收回吗', '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    })
+    console.log('收回选中的数据:', currentSelection.value)
+	const uniqIds = currentSelection.value.map(item => item.UniqId).join(',');
+	console.log(uniqIds); 
+    // 调用收回API,假设是批量删除接口
+    const res = await PrintDetailEdit({ id: uniqIds,number:Plate.value.印数})
+    
+    if (res.code === 0) {
+      ElMessage.success('收回成功')
+      rawcloseDialog()
+      // 清空选中
+      currentSelection.value = []
+    } else {
+      ElMessage.error(res.msg || '收回失败')
+    }
+  } catch (error) {
+    if (error !== 'cancel') {
+      console.error('收回失败:', error)
+      ElMessage.error('收回操作已取消')
+    }
+  }
+}
+
+const rawcloseDialog = () => {
+  Plate.印数 = ''
+  dialogwithdrawVisible.value = false
+}
+
+const yinbanmultipleTable = ref(null); // 表格ref
+const yinbaninvertSelection = () => {
+  // 1. 获取当前表格的所有有效数据(排除不需要的行)
+  const validData = yinbanselectData.value.filter(item => 
+    !item.isTotal && 
+    !(item.产品名称?.includes('A班产量:') || item.产品名称?.includes('B班产量:'))
+  );
+
+  // 2. 获取当前已选中的行
+  const currentSelected = yinbanmultipleTable.value?.getSelectionRows() || [];
+  
+  // 3. 清除当前所有选择
+  yinbanmultipleTable.value?.clearSelection();
 
+  // 4. 执行反选操作
+  validData.forEach(row => {
+    yinbanmultipleTable.value?.toggleRowSelection(
+      row, 
+      !currentSelected.some(selected => selected.UniqId === row.UniqId)
+    );
+  });
+
+};
 //树形结构单机
 const dianjianselectData = reactive([])
 const yinbanselectData = ref([])
@@ -8266,6 +8387,10 @@ const yjupdateCompanyFunc = async(row) => {
 	const Procedurelist = await Procedure({ Gd_gdbh: row['工单编号|质量信息'].replace(/\|$/, '') })
 	selectData.value = Procedurelist.data;
 	cpcode.value=row.产品代号
+	formData.value.工单编号 = row['工单编号|质量信息'].replace(/\|$/, '')
+	formData.value.印件号 = row['印件号'].slice(0, 2)
+	formData.value.productCode = row.产品代号
+	formData.value.产品名称 = row.产品名称
 	_gdbhlist.value = row['工单编号|质量信息'].split('|')[0]
 	finishedcode.value=row.产品代号
 }