Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

ljy121 1 год назад
Родитель
Сommit
ca1f0dca5e

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

@@ -25,15 +25,29 @@
     <SelectUser v-model="formData.receiveUserIds" />
     <div class="blank-line"></div>
     <div class="send-btn-group" v-if="formData.isUpdate">
-      <van-button type="primary" block @click="onSubmit(false)"
+      <van-button
+        type="primary"
+        block
+        @click="onSubmit(false)"
+        :loading="submitLoading"
         >更新</van-button
       >
     </div>
     <div class="send-btn-group" v-else>
-      <van-button type="success" block class="send-btn" @click="onSubmit(true)"
+      <van-button
+        type="success"
+        block
+        class="send-btn"
+        @click="onSubmit(true)"
+        :loading="tempLoading"
         >暂存</van-button
       >
-      <van-button type="primary" block class="send-btn" @click="onSubmit(false)"
+      <van-button
+        type="primary"
+        block
+        class="send-btn"
+        @click="onSubmit(false)"
+        :loading="submitLoading"
         >发送</van-button
       >
     </div>
@@ -214,6 +228,8 @@ const projectChange = (data: any) => {
 
 // 提交
 const { replace } = useRouter();
+const tempLoading = ref(false);
+const submitLoading = ref(false);
 const onSubmit = throttle(async (isTemp: boolean, isRouteLeave?: boolean) => {
   const userInfo = getUserInfo();
   const params: IReport = {
@@ -234,6 +250,14 @@ const onSubmit = throttle(async (isTemp: boolean, isRouteLeave?: boolean) => {
     });
     return;
   }
+  // 提交或暂存时loading
+  if (!isRouteLeave) {
+    if (isTemp) {
+      tempLoading.value = true;
+    } else {
+      submitLoading.value = true;
+    }
+  }
   // return
   const result: any = await http.submitReport(params);
   // 如果暂存且有返回id
@@ -255,6 +279,8 @@ const onSubmit = throttle(async (isTemp: boolean, isRouteLeave?: boolean) => {
   } else {
     showToast(`${type}失败,请稍后重试`);
   }
+  tempLoading.value = false;
+  submitLoading.value = false;
 }, 5000);
 
 // 获取是否工作日

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

@@ -31,15 +31,29 @@
     <SelectUser v-model="formData.receiveUserIds" />
     <div class="blank-line"></div>
     <div class="send-btn-group" v-if="formData.isUpdate">
-      <van-button type="primary" block @click="onSubmit(false)"
+      <van-button
+        type="primary"
+        block
+        @click="onSubmit(false)"
+        :loading="submitLoading"
         >更新</van-button
       >
     </div>
     <div class="send-btn-group" v-else>
-      <van-button type="success" block class="send-btn" @click="onSubmit(true)"
+      <van-button
+        type="success"
+        block
+        class="send-btn"
+        @click="onSubmit(true)"
+        :loading="tempLoading"
         >暂存</van-button
       >
-      <van-button type="primary" block class="send-btn" @click="onSubmit(false)"
+      <van-button
+        type="primary"
+        block
+        class="send-btn"
+        @click="onSubmit(false)"
+        :loading="submitLoading"
         >发送</van-button
       >
     </div>
@@ -200,6 +214,8 @@ const projectChange = (data: any) => {
 
 // 提交
 const { replace } = useRouter();
+const tempLoading = ref(false);
+const submitLoading = ref(false);
 const onSubmit = throttle(async (isTemp: boolean, isRouteLeave?: boolean) => {
   const date = thisWeek.value.split(" ~ ");
   const userInfo = getUserInfo();
@@ -221,6 +237,14 @@ const onSubmit = throttle(async (isTemp: boolean, isRouteLeave?: boolean) => {
     });
     return;
   }
+  // 提交或暂存时loading
+  if (!isRouteLeave) {
+    if (isTemp) {
+      tempLoading.value = true;
+    } else {
+      submitLoading.value = true;
+    }
+  }
   const result: any = await http.submitReport(params);
   // 如果暂存且有返回id
   if (result.data) {
@@ -241,6 +265,8 @@ const onSubmit = throttle(async (isTemp: boolean, isRouteLeave?: boolean) => {
   } else {
     showToast(`${type}失败,请稍后重试`);
   }
+  tempLoading.value = false;
+  submitLoading.value = false;
 }, 5000);
 
 // 获取是否工作日

+ 62 - 1
zjugis-business/src/main/java/com/zjugis/business/flow/contractRenew/event/ContractRenewEvent.java

@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollectionUtil;
 import com.zjugis.business.converter.contractRenew.ContractRenewConvert;
 import com.zjugis.business.flow.contractRenew.entity.ContractRenewDO;
 import com.zjugis.business.flow.contractRenew.service.ContractRenewService;
+import com.zjugis.business.flow.staff.entity.StaffDO;
+import com.zjugis.framework.common.pojo.CommonResult;
 import com.zjugis.framework.common.util.date.LocalDateTimeUtils;
 import com.zjugis.framework.workflow.exception.BusinessException;
 import com.zjugis.framework.workflow.model.BaseController;
@@ -14,6 +16,8 @@ import com.zjugis.module.adm.api.staff.dto.StaffRecordsDTO;
 import com.zjugis.module.system.api.dept.DeptApi;
 import com.zjugis.module.system.api.dept.DeptLeaderApi;
 import com.zjugis.module.system.api.dept.PostApi;
+import com.zjugis.module.system.api.dept.dto.DeptLeaderRespDTO;
+import com.zjugis.module.system.api.dept.dto.DeptRespDTO;
 import com.zjugis.module.system.api.dept.dto.PostRespDTO;
 import com.zjugis.module.system.api.user.AdminUserApi;
 import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
@@ -218,11 +222,68 @@ public class ContractRenewEvent extends BaseController {
     }
 
 
+    /**
+     * 转到部门经理
+     */
+    @PostMapping("/to-dept-manager")
+    public String toDeptManager(String flowInstanceId) {
+        try {
+            if (StringUtils.isNotBlank(flowInstanceId)) {
+                ContractRenewDO entity = contractRenewService.findByInstanceId(flowInstanceId);
+                List<Map<String, String>> userMaps = new ArrayList<>();
+                if (StringUtils.isNotBlank(entity.getDeptId())) {
+                    CommonResult<DeptRespDTO> result = deptApi.getDept(entity.getDeptId());
+                    DeptRespDTO dept = result.getCheckedData();
+                    if (dept != null && StringUtils.isNotBlank(dept.getLeaderUserId())) {
+                        HashMap<String, String> map = new HashMap<>();
+                        map.put("id", dept.getLeaderUserId());
+                        userMaps.add(map);
+                    }
+                }
+                return ok(userMaps);
+            } else {
+                throw new BusinessException("找不到流程id");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+
+    /**
+     * 转到分管领导
+     */
+    @PostMapping("/to-dept-manager-leader")
+    public String toDeptManagerLeader(String flowInstanceId) {
+        try {
+            if (StringUtils.isNotBlank(flowInstanceId)) {
+                ContractRenewDO entity = contractRenewService.findByInstanceId(flowInstanceId);
+                List<Map<String, String>> userMaps = new ArrayList<>();
+                if (StringUtils.isNotBlank(entity.getDeptId())) {
+                    DeptLeaderRespDTO deptLeaderRespDTO = deptLeaderApi.getDeptLeaderByDeptId(entity.getDeptId()).getCheckedData();
+                    if (deptLeaderRespDTO != null && StringUtils.isNotBlank(deptLeaderRespDTO.getUserId())) {
+                        HashMap<String, String> map = new HashMap<>();
+                        map.put("id", deptLeaderRespDTO.getUserId());
+                        userMaps.add(map);
+                    }
+                }
+                return ok(userMaps);
+            } else {
+                throw new BusinessException("找不到流程id");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+
     /**
      * 根据所在地查询hr
      */
     @PostMapping("/to-hr")
-    public String toDeptManager(String flowInstanceId) {
+    public String toHR(String flowInstanceId) {
         try {
             if (StringUtils.isNotBlank(flowInstanceId)) {
                 ContractRenewDO entity = contractRenewService.findByInstanceId(flowInstanceId);