jzh 1 year ago
parent
commit
37a31c1547

+ 33 - 0
client_h5/src/pages/resign/index.scss

@@ -0,0 +1,33 @@
+.van-cell-group {
+  margin: 0px;
+}
+.van-overlay {
+  background: rgba(0,0,0,0.3);
+}
+.add_btn {
+  background-color: #1989fa;
+  padding: 5px 10px;
+  border: 0px;
+  outline: none;
+  font-size: 13px;
+  color: #fff;
+  border-radius: 2px;
+}
+.detail-popup {
+  >.title {
+    font-size: 15px;
+    padding-left: 10px;
+  }
+  >.fixed-btn {
+    padding: 15px;
+  }
+}
+  :deep(.van-swipe-cell__right) {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+    >button {
+      height: 50%;
+    }
+  }

+ 243 - 0
client_h5/src/pages/resign/index.vue

@@ -0,0 +1,243 @@
+<template>
+  <flow-form :data="formData" @submit="submitNextActivity">
+    <card title="基础信息" style="height: auto">
+      <van-form required="true">
+        <van-cell-group inset>
+          <van-field
+              v-model="formData.nickname"
+              name="姓名"
+              label="姓名"
+              placeholder="姓名"
+              readonly
+              :rules="[{ required: true, message: '未获取姓名' }]"
+          />
+          <van-field
+              v-model="formData.deptName"
+              name="部门"
+              label="部门"
+              placeholder="部门"
+              readonly
+              :rules="[{ required: true, message: '请填写部门' }]"
+          />
+          <van-field
+              v-model="formData.drzw"
+              name="岗位"
+              label="岗位"
+              placeholder="岗位"
+              readonly
+              :rules="[{ required: true, message: '未获取岗位' }]"
+          />
+          <van-field
+              v-model="formData.rgssjc"
+              name="入职时间"
+              label="入职时间"
+              placeholder="入职时间"
+              readonly
+              :rules="[{ required: true, message: '未获取入职时间' }]"
+          />
+
+          <van-field
+              v-model="formData.htdqsc"
+              name="合同期限"
+              label="合同期限"
+              placeholder="合同期限"
+              readonly
+              :rules="[{ required: true, message: '未获取合同期限' }]"
+          />
+          <van-field
+              v-model="formData.zhsbrqc"
+              name="最后上班日期"
+              label="最后上班日期"
+              placeholder="最后上班日期"
+              readonly
+              :rules="[{ required: true, message: '未获取最后上班日期' }]"
+          />
+          <van-field
+              v-model="formData.lzsxrqc"
+              name="离职生效日期"
+              label="离职生效日期"
+              placeholder="离职生效日期"
+              readonly
+              :rules="[{ required: true, message: '未获取离职生效日期' }]"
+          />
+          <van-field
+              v-model="formData.lzyyc"
+              name="离职原因"
+              label="离职原因"
+              placeholder="离职原因"
+              readonly
+              :rules="[{ required: true, message: '未获取离职原因' }]"
+          />
+        </van-cell-group>
+      </van-form>
+    </card>
+  </flow-form>
+</template>
+
+<script setup lang="ts">
+import {useRoute} from 'vue-router';
+import {FlowDTO, getNextActivity} from '@/service/flow';
+import reqest from "@/utils/request";
+import DateTimeRange from '@/components/dateTimeRange.vue';
+import FlowForm from '@/components/flowForm.vue';
+import Card from '@/components/card.vue';
+import CardCell from '@/components/cardCell.vue';
+import {Checkbox, CheckboxGroup} from 'vant';
+
+const popupShow = ref<boolean>(false)
+const route = useRoute();
+
+interface FormDataType {
+  // instanceId: undefined,
+  // id: undefined,
+  // userNickname: undefined,
+  // deptName: undefined,
+  // detail: {
+  //   text: string
+  // }[]
+}
+
+const formData = ref<FormDataType>({
+  // instanceId: undefined,
+  // id: undefined,
+  // userNickname: undefined,
+  // deptName: undefined,
+  // detail: []
+})
+
+
+const {activityInstanceId, participantId, flowInstanceId} = route.query as {
+  activityInstanceId: string;
+  participantId: string;
+  flowInstanceId: string;
+};
+const activityData: FlowDTO = {
+  activityInstanceId,
+  participantId,
+  flowOpinion: ''
+}
+const submitNextActivity = async () => {
+  console.log(formData)
+  //更新表单业务数据
+  const result = await reqest.post("/business/resign/update", formData.value)
+  if (result.code === 200 || result.code === 0) {
+    //工作流转件
+    activityData.activityInstanceId = '018f23b914660a07729e8f224db60203'
+    activityData.participantId = '018f23b9148b0a07729e8f224db60205'
+    activityData.flowOpinion = '{"id":"018f23b914970a07729e8f224db60206","opinionContent":"同意","opinionTime":"2024-04-28"}'
+    const result = await getNextActivity(jsonToFormData(activityData))
+    // getNextActivity(activityData).then(result => {
+    //   console.log(result)
+    // }).catch((err) => {
+    //   console.error(err)
+    // })
+  }
+}
+const jsonToFormData = (json: any): FormData | null => {
+  const keys: string[] = Object.keys(json)
+  if (keys.length > 0) {
+    const formData = new FormData();
+    keys.forEach((key) => {
+      formData.append(key, (json[key] instanceof Object) ? JSON.stringify(json[key]) : json[key]);
+    });
+    return formData;
+  }
+  return null;
+}
+
+
+function formatDate(timestamp: number) {
+  const date = new Date(timestamp);
+  const year = date.getFullYear();
+  let month = (1 + date.getMonth()).toString();
+  month = month.length > 1 ? month : '0' + month;
+  let day = date.getDate().toString();
+  day = day.length > 1 ? day : '0' + day;
+  return `${year}-${month}-${day}`;
+}
+
+
+/** 初始化表单数据 */
+const initFormData = async () => {
+  const result = await reqest.get(`/business/resign/mobileAdd?flowInstanceId=${flowInstanceId}`)
+  formData.value = result.data
+
+  formData.value.rgssjc = formatDate(formData.value.rgssj);
+  formData.value.htdqsc = formatDate(formData.value.htdqs);
+  formData.value.zhsbrqc = formatDate(formData.value.zhsbrq);
+  formData.value.lzsxrqc = formatDate(formData.value.lzsxrq);
+
+  let lzyy = formData.value.lzyy;
+  let v = "";
+  if (lzyy != null) {
+    if (lzyy.includes(",1,")) {
+      v = v + "个人原因,";
+    }
+    if (lzyy.includes(",2,")) {
+      v = v + "晋升机会,";
+    }
+    if (lzyy.includes(",3,")) {
+      v = v + "换个行业发展,";
+    }
+    if (lzyy.includes(",4,")) {
+      v = v + "薪资偏低,";
+    }
+    if (lzyy.includes(",5,")) {
+      v = v + "福利不佳,";
+    }
+    if (lzyy.includes(",6,")) {
+      v = v + "劳动合同到期,";
+    }
+    if (lzyy.includes(",7,")) {
+      v = v + "无归属感,";
+    }
+    if (lzyy.includes(",8,")) {
+      v = v + "健康因素,";
+    }
+    if (lzyy.includes(",9,")) {
+      v = v + "文化理念不同,";
+    }
+    if (lzyy.includes(",10,")) {
+      v = v + "求学深造,";
+    }
+    if (lzyy.includes(",11,")) {
+      v = v + "家庭因素,";
+    }
+    if (lzyy.includes(",12,")) {
+      v = v + "领导风格不适,";
+    }
+    if (lzyy.includes(",13,")) {
+      v = v + "工作环境,";
+    }
+    if (lzyy.includes(",14,")) {
+      v = v + "人际关系,";
+    }
+    if (lzyy.includes(",15,")) {
+      v = v + "遭受不公平待遇,";
+    }
+    if (lzyy.includes(",16,")) {
+      v = v + "不能胜任本质工作,";
+    }
+    if (lzyy.includes(",17,")) {
+      v = v + "严重违反公司规章制度,";
+    }
+
+
+    if (v.length > 0) {
+      v = v.slice(0, -1); // 使用 slice 方法去除最后一个字符(逗号)
+      formData.value.lzyyc = v;
+    }
+  }
+
+}
+
+
+/** 初始化 */
+onMounted(() => {
+  initFormData()
+})
+</script>
+
+<style lang="scss" scoped>
+@import "./index.scss";
+</style>

+ 0 - 2
client_h5/src/pages/transfer/index.vue

@@ -155,8 +155,6 @@ const initFormData = async () => {
   formData.value = result.data
 
   formData.value.dgsjc = formatDate(formData.value.dgsj)
-  formData.value.zzsjc = formatDate(formData.value.zzsj);
-  formData.value.txsjc = formatDate(formData.value.txsj);
 
 }
 

+ 8 - 0
client_h5/src/router/routes.ts

@@ -69,6 +69,14 @@ const routes: RouteRecordRaw[] = [
             },
             component: () => import("@/pages/transfer/index.vue"),
         },
+        {
+            path: "resign",
+            name: "resign",
+            meta: {
+                title: "离职申请",
+            },
+            component: () => import("@/pages/resign/index.vue"),
+        },
     ] as RouteRecordRaw[],
   },
 ] as RouteRecordRaw[];

+ 8 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/resign/controller/ResignController.java

@@ -49,6 +49,14 @@ public class ResignController extends BaseController {
         return resultPage(map);
     }
 
+    /**
+     * 离职办理表单生成 vue
+     */
+    @GetMapping("/mobileAdd")
+    public CommonResult<ResignPageReqVO> mobileAdd(String activityTemplateId, String flowInstanceId, String userId){
+        return CommonResult.success(resignService.flowAdd(flowInstanceId, userId));
+    }
+
     /**
      * 离职办理需求表单生成
      */

+ 4 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/resign/controller/vo/ResignPageReqVO.java

@@ -69,6 +69,10 @@ public class ResignPageReqVO extends PageParam {
      * 合同期限
      */
     private Integer htqx;
+    /**
+     * 合同到期时间
+     */
+    private LocalDateTime htdqs;
 
     /**
      * 入公司时间

+ 2 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/resign/service/ResignService.java

@@ -24,4 +24,6 @@ public interface ResignService {
     void delete(String id);
 
     ResignDO findByInstanceId(String flowInstanceId);
+
+    ResignPageReqVO flowAdd(String flowInstanceId, String userId);
 }

+ 6 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/resign/service/impl/ResignServiceImpl.java

@@ -153,6 +153,12 @@ public class ResignServiceImpl implements ResignService {
         return resignDAO.findByInstanceId(flowInstanceId);
     }
 
+    @Override
+    public ResignPageReqVO flowAdd(String flowInstanceId, String userId) {
+        ResignDO entity = resignDAO.findByInstanceId(flowInstanceId);
+        return ResignConvert.INSTANCE.convert(entity);
+    }
+
 
     private Map<String, Object> createMap(String flowInstanceId, ResignDO entity, String userId) {
         Map<String, Object> map = new HashMap<>();