Browse Source

fix:解决移动端项目显示问题

qiny 1 year ago
parent
commit
e5d52a7b55

+ 2 - 2
client/postcss.config.js

@@ -2,8 +2,8 @@ module.exports = {
   plugins: {
     'postcss-pxtorem': {
       rootValue: 16,
-      propList: ['*'], 
+      propList: ['*'],
       selectorBlackList: ['van']
     },
   },
-};
+};

+ 2 - 0
client/src/views/OaSystem/personnelManagement/components/AmountOfWork.vue

@@ -375,6 +375,8 @@ const openDialog = (id) => {
   }
 }
 .work-hours-select-panel {
+  width: 100%;
+  height: 100%;
   .title {
     padding: 10px;
     text-align: center;

+ 24 - 3
client_h5/src/pages/myLogs/Daily/index.vue

@@ -99,6 +99,16 @@ onMounted(async () => {
   await getIsWorkDays();
 });
 
+// 在退出前调用一下暂存
+onBeforeRouteLeave((ev: any) => {
+  // 如果是千万详情,则不做处理
+  if (ev.name == "LogsDetail") return;
+  // 如果日志内容不为空则触发暂存,否则直接退出
+  if (formData.reportContent?.length > 0) {
+    onSubmit(true);
+  }
+});
+
 // 回填暂存数据
 const receiveData = (dailyDetail: any) => {
   formData.reportContent = dailyDetail.reportContent;
@@ -169,7 +179,7 @@ const projectChange = (data: any) => {
 };
 
 // 提交
-const { push, replace } = useRouter();
+const { replace } = useRouter();
 const onSubmit = async (isTemp: boolean) => {
   const userInfo = getUserInfo();
   const params: IReport = {
@@ -181,6 +191,7 @@ const onSubmit = async (isTemp: boolean) => {
     reportEndDate: moment(today.value).valueOf(),
     isTemp,
   };
+  // 提交前校验
   const submitCheck = onSubmitCheck(params);
   if (!submitCheck.success) {
     showToast({
@@ -190,9 +201,19 @@ const onSubmit = async (isTemp: boolean) => {
     return;
   }
   const result: any = await http.submitReport(params);
+  const type = isTemp ? "暂存" : "发送";
   if (result.msg == "success") {
-    showSuccessToast("发送成功");
-    push(`/logsDetail?id=${result.data}`);
+    showSuccessToast(`${type}成功`);
+    if (!isTemp) {
+      replace({
+        path: "/logsDetail",
+        query: {
+          id: result.data,
+        },
+      });
+    }
+  } else {
+    showToast(`${type}失败,请稍后重试`);
   }
 };
 

+ 24 - 3
client_h5/src/pages/myLogs/Weekly/index.vue

@@ -126,6 +126,16 @@ onMounted(async () => {
   formData.receiveUserIds = receiveUser;
 });
 
+// 在退出前调用一下暂存
+onBeforeRouteLeave((ev: any) => {
+  // 如果是千万详情,则不做处理
+  if (ev.name == "LogsDetail") return;
+  // 如果日志内容不为空则触发暂存,否则直接退出
+  if (formData.reportContent?.length > 0) {
+    onSubmit(true);
+  }
+});
+
 // 回填暂存数据
 const receiveData = (weekDetail: any) => {
   formData.reportContent = weekDetail.reportContent;
@@ -156,7 +166,7 @@ const projectChange = (data: any) => {
 };
 
 // 提交
-const { push, replace } = useRouter();
+const { replace } = useRouter();
 const onSubmit = async (isTemp: boolean) => {
   const date = thisWeek.value.split(" ~ ");
   const userInfo = getUserInfo();
@@ -169,6 +179,7 @@ const onSubmit = async (isTemp: boolean) => {
     reportEndDate: moment(date[1]).valueOf(),
     isTemp,
   };
+  // 提交前校验
   const submitCheck = onSubmitCheck(params);
   if (!submitCheck.success) {
     showToast({
@@ -178,9 +189,19 @@ const onSubmit = async (isTemp: boolean) => {
     return;
   }
   const result: any = await http.submitReport(params);
+  const type = isTemp ? "暂存" : "发送";
   if (result.msg == "success") {
-    showSuccessToast("发送成功");
-    push(`/logsDetail?id=${result.data}`);
+    showSuccessToast(`${type}成功`);
+    if (!isTemp) {
+      replace({
+        path: "/logsDetail",
+        query: {
+          id: result.data,
+        },
+      });
+    }
+  } else {
+    showToast(`${type}失败,请稍后重试`);
   }
 };
 

+ 1 - 0
client_h5/src/pages/myLogs/components/ProjectList.vue

@@ -36,6 +36,7 @@ import { http } from "../http";
 interface IProp {
   type: "weekly" | "daily";
   onChange: (data: any) => any;
+  defaultData?: any[];
 }
 
 const { type, onChange } = defineProps<IProp>();

+ 4 - 2
client_h5/src/pages/myLogs/http.ts

@@ -31,9 +31,11 @@ export const http = {
     const params = {
       pageSize: -1,
       userId: userInfo.id ?? "",
-      xmzList: [1, 4], // 仅可对进行中和已验收的项目进行填报
+      // xmzList: [1, 4],
     };
-    const result: any = await request.get(api.project, { params });
+    // 同 不太优雅的方式 (仅可对进行中和已验收的项目进行填报)
+    const url = `${api.project}?xmzList%5B0%5D=1&%5B1%5D=4`;
+    const result: any = await request.get(url, { params });
     return result.msg == "success" ? result.data.records : [];
   },
   // 获取工作日列表 YYYY-MM-DD HH:mm:ss

+ 1 - 1
client_h5/src/pages/myLogs/service.ts

@@ -34,7 +34,7 @@ export const transformUserListToTree = (arr: any) => {
 };
 // 提交校验
 export const onSubmitCheck = (formData: any) => {
-  if (formData.reportContent == "") {
+  if (formData.reportContent == "" || !formData.reportContent) {
     return {
       msg: "请填写今日工作",
       success: false,