|
@@ -0,0 +1,172 @@
|
|
|
+<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.dgsjc"
|
|
|
+ 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.deptTransferName"
|
|
|
+ name="调任部门"
|
|
|
+ label="调任部门"
|
|
|
+ placeholder="调任部门"
|
|
|
+ readonly
|
|
|
+ :rules="[{ required: true, message: '未获取调任部门' }]"
|
|
|
+ />
|
|
|
+
|
|
|
+ <van-field
|
|
|
+ v-model="formData.post"
|
|
|
+ name="原岗位"
|
|
|
+ label="原岗位"
|
|
|
+ placeholder="原岗位"
|
|
|
+ readonly
|
|
|
+ :rules="[{ required: true, message: '未获取原岗位' }]"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="formData.transferPost"
|
|
|
+ name="调任岗位"
|
|
|
+ label="调任岗位"
|
|
|
+ placeholder="调任岗位"
|
|
|
+ readonly
|
|
|
+ :rules="[{ required: true, message: '未获取调任岗位' }]"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="formData.sqly"
|
|
|
+ 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/regular/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/transfer/mobileAdd?flowInstanceId=${flowInstanceId}`)
|
|
|
+ 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);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/** 初始化 */
|
|
|
+onMounted(() => {
|
|
|
+ initFormData()
|
|
|
+})
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+@import "./index.scss";
|
|
|
+</style>
|