liuhairui 1 年之前
父節點
當前提交
a30b55362f
共有 3 個文件被更改,包括 75 次插入72 次删除
  1. 51 62
      src/pinia/modules/user.js
  2. 2 3
      src/view/performance/caiqiebaogong.vue
  3. 22 7
      src/view/yunyin/shengchanguanli/gongdanziliao.vue

+ 51 - 62
src/pinia/modules/user.js

@@ -116,51 +116,35 @@ const fetchMACAddress = async () => {
 
 // 获取机器MAC列表,并设置Machine.value
 const getMachineMaclist = async (macAddress) => {
-  // try {
-	console.log("macAddress:",macAddress)
+  console.log("macAddress:", macAddress);
+  try {
     const response = await getMachineMac({ sys_sbID: macAddress });
+    console.log("response:", response);
 
-	if (response.code === 7) {console.log("未登录或非法访问");return;}
-	
-	
-	if (response.data.机台号 === macAddress) {
-        Machine.value = response.data.机台号;
-        console.log("获取到的机台号:", Machine.value);
-    }else{
-		if (response.data === null) {
-		    console.log("未能获取响应数据,请检查请求或网络连接。");
-		    return;
-		}
-		
-		if (response.code === 7) {
-		  console.log("未登录或非法访问,已忽略该提示");
-		  return;
-		}
-		
-		if (response.data.机台号 === undefined) {
-		  console.log("该电脑未绑定 MAC 地址");
-		  return;
-		}
-	}
-	
-	if (response.data === null) {
-        console.log("未能获取响应数据,请检查请求或网络连接。");
-        return;
+    if (response.code === 7) {
+      console.log("未登录或非法访问");
+      return;
     }
-	
-    
-	if (response.data.机台号 === undefined) {
-	  console.log("该电脑未绑定 MAC 地址");
-	  return;
-	}
-
-};
-
 
+    if (!response.data) {
+      console.log("未能获取响应数据,请检查请求或网络连接。");
+      return;
+    }
 
+    if (response.data.sys_sbID === macAddress) {
+      Machine.value = response.data.机台号;
+      console.log("获取到的机台号:", Machine.value);
+    } else {
+      console.log("该电脑未绑定 MAC 地址");
+    }
+  } catch (error) {
+    console.error("获取机台号失败:", error.message);
+  }
+};
 
 // 获取MAC地址并格式化
 const GetAddr = async () => {
+  try {
     const macAddress = await fetchMACAddress();
     await getMachineMaclist(macAddress);
 
@@ -169,30 +153,31 @@ const GetAddr = async () => {
       Machine.value = 'CF01';
       console.warn("未获取到机台号,使用默认机台号 CF01");
     }
+
     // 进行登录操作
     await proceedWithLogin();
-  
+  } catch (error) {
+    handleGlobalError("初始化失败", error);
+  }
 };
 
 // 处理登录逻辑
 const proceedWithLogin = async () => {
-	  let machineId = Machine.value;
-	
-	  // 匹配任意两位字母或字母数字开头,后面是两位数字,且后缀不是01的情况
-	  machineId = machineId.replace(/([A-Za-z]{2})\d{2}$/, "$101");
-	
-	  const loginInfo = {
-	    username: machineId,  // 修改后的机台号
-	    password: "123456",
-	    captcha: "443188",
-	    captchaId: "0FZfnUtAOrdXvTETkJRc",
-	    openCaptcha: false,
-	  };
-	
-	  console.log(loginInfo);  // 输出结果进行验证
-	
+  let machineId = Machine.value;
+
+  // 将机台号格式化为指定形式
+  machineId = machineId.replace(/([A-Za-z]{2})\d{2}$/, "$101");
+
+  const loginInfo = {
+    username: machineId,
+    password: "123456",
+    captcha: "443188",
+    captchaId: "0FZfnUtAOrdXvTETkJRc",
+    openCaptcha: false,
+  };
+
   console.log("准备登录,登录信息:", loginInfo);
-  await LoginIn2(loginInfo);  // 进行登录操作
+  await LoginIn2(loginInfo);
 };
 
 // 登录处理实现
@@ -208,7 +193,6 @@ const LoginIn2 = async (loginInfo) => {
     const res = await login2(loginInfo);
 
     if (res.code === 0) {
-      // 登录成功
       console.log("登录成功:", res);
 
       // 设置用户信息和Token
@@ -226,31 +210,36 @@ const LoginIn2 = async (loginInfo) => {
 
       // 再次获取MAC并校验
       const response = await getMachineMac({ sys_sbID: MAC.value });
-      if (response.data === null) {
+      if (!response.data) {
         ClearStorage();  // 清理本地存储
       } else {
-        // 检查默认路由是否存在
         const userInfo = res.data.user;
         if (!router.hasRoute(userInfo.authority.defaultRouter)) {
           ElMessage.error('请联系管理员进行授权');
         } else {
-          // 跳转到默认路由
           await router.replace({ name: userInfo.authority.defaultRouter });
         }
 
-        // 处理系统类型
+        // 设置系统类型
         const isWin = /windows/i.test(navigator.userAgent);
         window.localStorage.setItem('osType', isWin ? 'WIN' : 'MAC');
+
+        // 登录成功后刷新页面,只刷新一次
+        if (!localStorage.getItem('pageRefreshed')) {
+          localStorage.setItem('pageRefreshed', 'true');
+          setTimeout(() => {
+            location.reload();  // 刷新页面
+          }, 1000);
+        }
+
         return true;
       }
     } else {
-      // 登录失败
       throw new Error('登录失败:' + res.message);
     }
   } catch (error) {
-    throw new Error('登录时发生错误:' + error.message);
+    handleGlobalError("登录时发生错误", error);
   } finally {
-    // 关闭加载提示
     loadingInstance?.close();
   }
 };

+ 2 - 3
src/view/performance/caiqiebaogong.vue

@@ -93,9 +93,8 @@
               <el-table-column  sortable  align="left" label="制单总数" prop="zdtotal" width="110" />
               <el-table-column  sortable  align="left" label="实裁总数" prop="sctotal" width="110" />
               <el-table-column  sortable  align="left" label="单位" prop="单位" width="80" />
-              <!-- <el-table-column  sortable  align="left" label="工序" prop="工序" width="80" /> -->
-              <el-table-column  sortable  align="left" label="验片人" prop="Sys_id" width="100" />
-              <el-table-column  sortable  align="left" label="日期" prop="Sys_rq" width="160" />
+			  <el-table-column  sortable  align="left" label="日期" prop="Sys_rq" width="160" />
+              <el-table-column  sortable  align="left" label="验片人" prop="Sys_id" width="130" />
             </el-table>
 			</el-row>
 

+ 22 - 7
src/view/yunyin/shengchanguanli/gongdanziliao.vue

@@ -454,7 +454,7 @@
 			    </el-col>
 			    <el-col :span="10">
 			      <el-form-item label="船样合计" prop="customerCode" class="mab" label-width="150">
-			        <el-input v-model="edit_ddformData['船样合计']" style="width: 100%;" id="船样合计" @keydown="add_gdzlent($event, '船样描述', '船样合计', '箱唛要求')" />
+			        <el-input v-model="add_gdscgdformData['船样合计']" style="width: 100%;" id="船样合计" @keydown="add_gdzlent($event, '船样描述', '船样合计', '箱唛要求')" />
 			      </el-form-item>
 			    </el-col>
 			  </el-row>
@@ -690,12 +690,13 @@
         </el-dialog>
 
         <!-- 技术附件 -->
-        <el-dialog v-model="jsfjdialogFormVisible" :before-close="jsfjcloseDialog" :title="产品技术附件资料" style="margin-top: 40px" height="500px" width="800px" destroy-on-close>
+        <el-dialog v-model="jsfjdialogFormVisible" :before-close="jsfjcloseDialog" :title="产品技术附件资料" 
+		style="margin-top: 40px" height="500px" width="700px" destroy-on-close>
 			  <el-form :model="jsfjformdata" label-position="right" ref="elFormRef" :rules="rule" label-width="90px">
 				<el-row :gutter="24">
 					<el-col :span="8">
 					  <el-form-item label="关联编号:" prop="address" class="mab" >
-						<el-input v-model="jsfjformdata.关联编号"  id="关联编号" />
+						<el-input v-model="jsfjformdata.关联编号" disabled  id="关联编号" />
 					  </el-form-item>
 					</el-col>
 				</el-row>
@@ -710,16 +711,22 @@
 				  </el-col>  
 				</el-row> 
 				<el-row :gutter="24">
-					<el-col :span="6"></el-col>
+					<el-col :span="8">
+						<br>
+						<p>附件文件类型必须是"XLSX"格式</p> 
+					</el-col>
 					<el-col :span="12">
+						<br>
 						<input style="font-size:16px;" type="file" @change="uploadExcel" >
 					</el-col>
-					<el-col :span="6">
+					<el-col :span="4">
+						<br>
 						<el-button @click="yulan">预览</el-button>
 					</el-col>
 				</el-row>
 			  </el-form>
 			  <template #footer>
+				  <br>
 				<div class="dialog-footer">
 				  <el-button @click="jsfjcloseDialog">取 消</el-button>
 				  <el-button type="primary"  @click="jsfjenterDialog">确 定</el-button>
@@ -869,6 +876,14 @@ const updateCompanyFunc = async (row) => {
 }
 //订单资料修改确认
 const dd_edit_Dialog = async () => {
+	
+	//日期转换
+	let lhrq_formattedDeliveryDate = '';  
+	if (edit_ddformData.value.落货日期) {  
+	  const date = new Date(edit_ddformData.value.落货日期);  
+	  lhrq_formattedDeliveryDate = `${date.getFullYear()}-${('0' + (date.getMonth() + 1)).slice(-2)}-${('0' + date.getDate()).slice(-2)}`;  
+	}  
+	
   let params = {};
   params.订单编号 = edit_ddformData.value.订单编号
   params.生产款号 = edit_ddformData.value.生产款号
@@ -883,10 +898,10 @@ const dd_edit_Dialog = async () => {
   params.订单数量 = edit_ddformData.value.订单数量
   params.单位 = edit_ddformData.value.单位
   params.接单日期 = edit_ddformData.value.接单日期
-  params.落货日期 = edit_ddformData.value.落货日期
+  params.落货日期 = lhrq_formattedDeliveryDate
   params.Sys_id = edit_ddformData.value.Sys_id
   params.id = edit_ddformData.value.Uniqid
-  
+	
   console.log(params)
 
   const WorkOrderEdit_list = await WorkOrderEdit(params);