|
@@ -1,154 +1,198 @@
|
|
|
|
|
|
<template>
|
|
|
<flow-form :data="formData" @submit="submitNextActivity">
|
|
|
- <card title="基础信息">
|
|
|
- <van-form required="auto" :readonly="formRead">
|
|
|
- <van-cell-group inset>
|
|
|
- <van-field
|
|
|
- v-model="formData.worker"
|
|
|
- name="借款人"
|
|
|
- label="借款人"
|
|
|
- placeholder="借款人"
|
|
|
- readonly
|
|
|
- :rules="[{ required: true, message: '未获取借款人' }]"
|
|
|
- />
|
|
|
- <van-field
|
|
|
- v-model="formData.workerDept"
|
|
|
- name="所在部门"
|
|
|
- label="所在部门"
|
|
|
- placeholder="所在部门"
|
|
|
- readonly
|
|
|
- :rules="[{ required: true, message: '未获取所在部门' }]"
|
|
|
- />
|
|
|
- <van-field
|
|
|
- v-model="formData.applyDate"
|
|
|
- name="申请时间"
|
|
|
- label="申请时间"
|
|
|
- placeholder="申请时间"
|
|
|
- readonly
|
|
|
- :rules="[{ required: true, message: '未获取申请时间' }]"
|
|
|
- />
|
|
|
- <van-field
|
|
|
- v-model="formData.loanNumber"
|
|
|
- name="借款单号"
|
|
|
- label="借款单号"
|
|
|
- placeholder="借款单号"
|
|
|
- readonly
|
|
|
- :rules="[{ required: true, message: '未获取借款单号' }]"
|
|
|
- />
|
|
|
- <van-field
|
|
|
- v-model="formData.loanAmount"
|
|
|
- name="借款总金额(元)"
|
|
|
- label="借款总金额(元)"
|
|
|
- placeholder="借款总金额(元)"
|
|
|
- :rules="[{ required: true, message: '请填写借款总金额(元)' }]"
|
|
|
- />
|
|
|
- <van-field
|
|
|
- v-model="formData.description"
|
|
|
- name="借款事由"
|
|
|
- label="借款事由"
|
|
|
- placeholder="借款事由"
|
|
|
- type="textarea"
|
|
|
- rows="3"
|
|
|
- autosize
|
|
|
- :rules="[{ required: true, message: '请填写借款事由' }]"
|
|
|
- />
|
|
|
- <van-field
|
|
|
- v-model="formData.bz1"
|
|
|
- name="借款备注"
|
|
|
- label="借款备注"
|
|
|
- placeholder="借款备注"
|
|
|
- type="textarea"
|
|
|
- rows="3"
|
|
|
- autosize
|
|
|
- :rules="[{ required: true, message: '请填写借款备注' }]"
|
|
|
- />
|
|
|
- </van-cell-group>
|
|
|
- </van-form>
|
|
|
- </card>
|
|
|
+ <card title="基础信息">
|
|
|
+ <van-form required="auto" :readonly="formRead">
|
|
|
+ <van-cell-group inset>
|
|
|
+ <van-field
|
|
|
+ v-model="formData.worker"
|
|
|
+ name="借款人"
|
|
|
+ label="借款人"
|
|
|
+ placeholder="借款人"
|
|
|
+ readonly
|
|
|
+ :rules="[{ required: true, message: '未获取借款人' }]"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="formData.workerDept"
|
|
|
+ name="所在部门"
|
|
|
+ label="所在部门"
|
|
|
+ placeholder="所在部门"
|
|
|
+ readonly
|
|
|
+ :rules="[{ required: true, message: '未获取所在部门' }]"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="formData.applyDate"
|
|
|
+ name="申请时间"
|
|
|
+ label="申请时间"
|
|
|
+ placeholder="申请时间"
|
|
|
+ readonly
|
|
|
+ :rules="[{ required: true, message: '未获取申请时间' }]"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="formData.loanNumber"
|
|
|
+ name="借款单号"
|
|
|
+ label="借款单号"
|
|
|
+ placeholder="借款单号"
|
|
|
+ readonly
|
|
|
+ :rules="[{ required: true, message: '未获取借款单号' }]"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="formData.projectName"
|
|
|
+ is-link
|
|
|
+ readonly
|
|
|
+ name="项目"
|
|
|
+ label="项目"
|
|
|
+ placeholder="点击选择项目"
|
|
|
+ @click="showPicker = true"
|
|
|
+ :rules="[{ required: true, message: '请选择项目' }]"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="formData.loanAmount"
|
|
|
+ name="借款总金额(元)"
|
|
|
+ label="借款总金额(元)"
|
|
|
+ placeholder="借款总金额(元)"
|
|
|
+ :rules="[{ required: true, message: '请填写借款总金额(元)' }]"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="formData.description"
|
|
|
+ name="借款事由"
|
|
|
+ label="借款事由"
|
|
|
+ placeholder="借款事由"
|
|
|
+ type="textarea"
|
|
|
+ rows="3"
|
|
|
+ autosize
|
|
|
+ :rules="[{ required: true, message: '请填写借款事由' }]"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="formData.bz1"
|
|
|
+ name="借款备注"
|
|
|
+ label="借款备注"
|
|
|
+ placeholder="借款备注"
|
|
|
+ type="textarea"
|
|
|
+ rows="3"
|
|
|
+ autosize
|
|
|
+ :rules="[{ required: true, message: '请填写借款备注' }]"
|
|
|
+ />
|
|
|
+ </van-cell-group>
|
|
|
+ </van-form>
|
|
|
+ </card>
|
|
|
</flow-form>
|
|
|
+ <van-popup v-model:show="showPicker" position="bottom">
|
|
|
+ <van-picker
|
|
|
+ :columns="columns"
|
|
|
+ @confirm="onConfirm"
|
|
|
+ @cancel="showPicker = false"
|
|
|
+ :columns-field-names="customFieldName"
|
|
|
+ />
|
|
|
+ </van-popup>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { useRoute } from 'vue-router';
|
|
|
-import { FlowDTO, getNextActivity } from '@/service/flow';
|
|
|
+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 DateTimeRange from "@/components/dateTimeRange.vue";
|
|
|
+import FlowForm from "@/components/flowForm.vue";
|
|
|
+import Card from "@/components/card.vue";
|
|
|
+import CardCell from "@/components/cardCell.vue";
|
|
|
const route = useRoute();
|
|
|
interface FormDataType {
|
|
|
- instanceId: string
|
|
|
- id: string
|
|
|
- worker: string
|
|
|
- workerDept: string
|
|
|
- applyDate: string
|
|
|
- loanNumber: string
|
|
|
- loanAmount: string
|
|
|
- description: string
|
|
|
- bz1: string
|
|
|
+ instanceId: string;
|
|
|
+ id: string;
|
|
|
+ worker: string;
|
|
|
+ workerDept: string;
|
|
|
+ applyDate: string;
|
|
|
+ loanNumber: string;
|
|
|
+ loanAmount: string;
|
|
|
+ description: string;
|
|
|
+ projectName: string;
|
|
|
+ projecId: string;
|
|
|
+ bz1: string;
|
|
|
}
|
|
|
const formData = ref<FormDataType>({
|
|
|
- instanceId: '',
|
|
|
- id: '',
|
|
|
- worker: '',
|
|
|
- workerDept: '',
|
|
|
- applyDate: '',
|
|
|
- loanNumber: '',
|
|
|
+ instanceId: "",
|
|
|
+ id: "",
|
|
|
+ worker: "",
|
|
|
+ workerDept: "",
|
|
|
+ applyDate: "",
|
|
|
+ loanNumber: "",
|
|
|
loanAmount: null,
|
|
|
- description: '',
|
|
|
- bz1: ''
|
|
|
-})
|
|
|
-const formRead = ref(false)
|
|
|
-const { activityInstanceId, participant,flowInstanceId,read } = route.query as {
|
|
|
- activityInstanceId: string;
|
|
|
- participant: string;
|
|
|
- flowInstanceId: string;
|
|
|
- read: string;
|
|
|
+ description: "",
|
|
|
+ bz1: "",
|
|
|
+ projectName: "",
|
|
|
+ projecId: "",
|
|
|
+});
|
|
|
+let columns = [];
|
|
|
+const showPicker = ref(false);
|
|
|
+const customFieldName = {
|
|
|
+ text: "xmmc",
|
|
|
+ value: "id",
|
|
|
};
|
|
|
+const onConfirm = (value) => {
|
|
|
+ formData.value.projectId = value.selectedValues[0];
|
|
|
+ formData.value.projectName = value.selectedOptions[0].xmmc;
|
|
|
+ showPicker.value = false;
|
|
|
+};
|
|
|
+const formRead = ref(false);
|
|
|
+const { activityInstanceId, participant, flowInstanceId, read } =
|
|
|
+ route.query as {
|
|
|
+ activityInstanceId: string;
|
|
|
+ participant: string;
|
|
|
+ flowInstanceId: string;
|
|
|
+ read: string;
|
|
|
+ };
|
|
|
const activityData: FlowDTO = {
|
|
|
activityInstanceId,
|
|
|
participantId: participant,
|
|
|
- flowOpinion: ''
|
|
|
-}
|
|
|
+ flowOpinion: "",
|
|
|
+};
|
|
|
const submitNextActivity = async (activeOpinion: any) => {
|
|
|
//更新表单业务数据
|
|
|
- const result = await reqest.post("/business/Loan/update",formData.value)
|
|
|
- if(result.code ===200||result.code ===0){
|
|
|
+ const result = await reqest.post("/business/Loan/update", formData.value);
|
|
|
+ if (result.code === 200 || result.code === 0) {
|
|
|
//工作流转件
|
|
|
- activityData.activityInstanceId=activityInstanceId
|
|
|
- activityData.participantId=participant
|
|
|
- activityData.flowOpinion=JSON.stringify(activeOpinion)
|
|
|
- const result = await getNextActivity(jsonToFormData(activityData))
|
|
|
+ activityData.activityInstanceId = activityInstanceId;
|
|
|
+ activityData.participantId = participant;
|
|
|
+ activityData.flowOpinion = JSON.stringify(activeOpinion);
|
|
|
+ const result = await getNextActivity(jsonToFormData(activityData));
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
const jsonToFormData = (json: any): FormData | null => {
|
|
|
- const keys: string[] = Object.keys(json)
|
|
|
- if (keys.length > 0) {
|
|
|
+ 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]);
|
|
|
+ keys.forEach((key) => {
|
|
|
+ formData.append(
|
|
|
+ key,
|
|
|
+ json[key] instanceof Object ? JSON.stringify(json[key]) : json[key]
|
|
|
+ );
|
|
|
});
|
|
|
return formData;
|
|
|
}
|
|
|
return null;
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 初始化表单数据 */
|
|
|
-const initFormData= async () => {
|
|
|
- const result = await reqest.get(`/business/Loan/mobileAdd?flowInstanceId=${flowInstanceId}`)
|
|
|
- formData.value = result.data
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
+const initFormData = async () => {
|
|
|
+ const result = await reqest.get(
|
|
|
+ `/business/Loan/mobileAdd?flowInstanceId=${flowInstanceId}`
|
|
|
+ );
|
|
|
+ formData.value = result.data;
|
|
|
+};
|
|
|
+const getProjectList = async () => {
|
|
|
+ const result = await reqest.get(
|
|
|
+ `/business/project/getListByUser?userId=${flowInstanceId}`
|
|
|
+ );
|
|
|
+ columns = result.data;
|
|
|
+};
|
|
|
/** 初始化 */
|
|
|
onMounted(() => {
|
|
|
- initFormData()
|
|
|
- if(read==='1'){
|
|
|
- formRead.value=true
|
|
|
+ initFormData();
|
|
|
+ getProjectList();
|
|
|
+ if (read === "1") {
|
|
|
+ formRead.value = true;
|
|
|
}
|
|
|
-})
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|