Browse Source

借款管理

sangwenwei 1 year ago
parent
commit
22fa91d67f

+ 70 - 0
src/api/jy/BorrowService.js

@@ -0,0 +1,70 @@
+import request from '@/utils/httpRequest'
+import { BUSINESS_PATH as prefix } from "../AppPath";
+
+export default class BorrowService{
+	list (param) {
+		return request({
+			url: prefix +'/borrow/findList',
+			method: 'get',
+			params: param
+		})
+	}
+
+	saveForm (inputForm) {
+		return request({
+			url: prefix + `/borrow/saveForm`,
+			method: 'post',
+			data: inputForm
+		})
+	}
+
+	queryById (id) {
+		return request({
+			url: prefix +'/borrow/findById',
+			method: 'get',
+			params: {id: id}
+		})
+	}
+
+	updateStatusById(data) {
+		return request({
+			url: prefix + "/borrow/updateStatusById",
+			method: "post",
+			data: data,
+		})
+	}
+	delete (ids) {
+		return request({
+			url: prefix+"/borrow/delete",
+			method: 'delete',
+			params: {id: ids}
+		})
+	}
+
+
+
+	adminEditForm(param){
+		return request({
+			url: prefix + "/borrow/adminEditForm",
+			method: "post",
+			data: param,
+		})
+	}
+
+	saveRefund (inputForm) {
+		return request({
+			url: prefix + `/borrow/saveRefund`,
+			method: 'post',
+			data: inputForm
+		})
+	}
+
+	updateRefundById(data) {
+		return request({
+			url: prefix + "/borrow/updateRefundById",
+			method: "post",
+			data: data,
+		})
+	}
+
+}

+ 7 - 1
src/views/flowable/task/TaskForm.vue

@@ -712,6 +712,9 @@ export default {
 		// Process_1701396100594 嘉溢-出差申请
 		// Process_1701410671521 嘉溢-外出申请
 		// Process_1701655913359 嘉溢-文印申请
+		// Process_1701936620599 嘉溢-借款管理
+		// Process_1701946907362 嘉溢-借款归还
+		// Process_1702002020267 嘉溢-付款管理
 
 		// 驳回
 		reject(vars) {
@@ -768,7 +771,10 @@ export default {
 				this.procDefId.includes('Process_1701332165234') ||
 				this.procDefId.includes('Process_1701396100594') ||
 				this.procDefId.includes('Process_1701410671521') ||
-				this.procDefId.includes('Process_1701655913359')
+				this.procDefId.includes('Process_1701655913359') ||
+				this.procDefId.includes('Process_1701936620599') ||
+				this.procDefId.includes('Process_1701946907362') ||
+				this.procDefId.includes('Process_1702002020267')
 			) {
 				console.log('进入新版驳回')
 				this.$confirm(`确定驳回流程吗?`, '提示', {

+ 490 - 0
src/views/jy/borrowMoney/BorrowDia.vue

@@ -0,0 +1,490 @@
+<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
+	<div>
+		<el-dialog
+			:title="title"
+			:close-on-click-modal="false"
+			draggable
+			append-to-body
+			width="1300px"
+			@close="close"
+			@keyup.enter.native="doSubmit"
+			v-model="visible">
+		<el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="status === 'audit' || status === 'taskFormDetail'"
+				 label-width="160px" @submit.native.prevent>
+			<el-divider content-position="left"><i class="el-icon-document"></i>
+				借款申请
+			</el-divider>
+			<el-row  :gutter="15">
+				<el-col :span="12">
+					<el-form-item label="还款人" prop="createName"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.createName"></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="还款时间" prop="createTime"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.createTime"></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="借款金额(小写)" prop="moneyLower"
+								  :rules="[{required: true, message:'请输入还款金额(小写)', trigger:'blur'}]">
+						<el-input v-on:input="inputForm.moneyLower=inputForm.moneyLower.replace(/[^\d.]/g,'')
+							  .replace(/^\./g,'')
+							  .replace(/\.{2,}/g,'.')
+							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
+							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')" @blur="convert(this.inputForm.refundLower)" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" placeholder="请输入借款金额" v-model="inputForm.moneyLower" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="借款金额(大写)" prop="money"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.money"></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="还款金额(小写)" prop="refundLower"
+								  :rules="[{required: true, message:'请输入还款金额(小写)', trigger:'blur'}]">
+						<el-input v-on:input="inputForm.refundLower=inputForm.refundLower.replace(/[^\d.]/g,'')
+							  .replace(/^\./g,'')
+							  .replace(/\.{2,}/g,'.')
+							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
+							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')" @blur="convert(this.inputForm.refundLower)" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" placeholder="请输入还款金额" v-model="inputForm.refundLower" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="还款金额(大写)" prop="refund"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.refund"></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="剩余借款金额" prop="finalMoney"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.finalMoney"></el-input>
+					</el-form-item>
+				</el-col>
+			</el-row>
+		</el-form>
+			<template #footer>
+			<span class="dialog-footer">
+			  <el-button @click="close()" icon="el-icon-circle-close">关闭</el-button>
+			  <el-button type="primary" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+			</span>
+			</template>
+		</el-dialog>
+	</div>
+</template>
+
+<script>
+	import XEUtils from 'xe-utils'
+	import BorrowService from '@/api/jy/BorrowService'
+	import { ElDatePicker } from 'element-plus';
+	import CommonApi from '@/api/cw/common/CommonApi'
+	export default {
+		props: {
+			businessId: {
+				type: String,
+				default: ''
+			},
+			formReadOnly: {
+				type: Boolean,
+				default: false
+			},
+			status: {
+				type: String,
+				default: ''
+			}
+		},
+		data () {
+			return {
+				title: '',
+				method: '',
+				loading: false,
+				visible: false,
+				inputForm: {
+					id: '',
+					no: '',
+					createById: '',
+					createName: this.$store.state.user.name,
+					createTime: this.moment(new Date()).format('YYYY-MM-DD'),
+					reason: '',
+					refundLower:'', // 还款金额小写
+					moneyLower:'', // 借款金额小写
+					money:'', // 借款金额小写
+					refund:'', //借款金额大写
+					procInsId:'',
+					status:'',
+					finalMoney:'',
+					endMoney:'',
+					refundId:''
+				},
+				baseKey: '',
+				keyWatch: '',
+				dateList:[]
+			}
+		},
+		BorrowService:null,
+		CommonApi:null,
+		created () {
+			console.log('jld ')
+			this.borrowService=new BorrowService()
+			this.commonApi = new CommonApi()
+		},
+		mounted () {
+		},
+		activated () {
+		},
+		components: {
+			ElDatePicker
+		},
+		computed: {
+			bus: {
+				get () {
+					return this.businessId
+				},
+				set (val) {
+					this.businessId = val
+				}
+			}
+		},
+		watch: {
+			'keyWatch': {
+				handler (newVal) {
+					console.log('几里路')
+					if (this.bus) {
+						if (this.bus !== 'false') {
+							this.init('', this.bus)
+						}
+					} else {
+						this.$nextTick(() => {
+							this.$refs.inputForm.resetFields()
+						})
+					}
+				}
+			},
+			'loading': {
+				handler (newVal) {
+					this.$emit('changeLoading', newVal)
+				}
+			}
+		},
+		methods: {
+			getKeyWatch(keyWatch) {
+				this.keyWatch = keyWatch
+			},
+			init(method, id) {
+				this.method = method
+				this.inputForm={
+					id: '',
+					no: '',
+					createById: this.$store.state.user.id,
+					createName: this.$store.state.user.name,
+					createTime: this.moment(new Date()).format('YYYY-MM-DD'),
+					reason: '',
+					refundLower:'', // 还款金额小写
+					refund:'', //还款金额大写
+					procInsId:'',
+					finalMoney:'',
+					moneyLower:'', // 借款金额小写
+					money:'', // 借款金额小写
+					endMoney:'',
+					refundId:''
+				}
+				this.inputForm.id = id
+				this.loading = false
+				this.visible = true
+				this.$nextTick(() => {
+					this.$refs.inputForm.resetFields()
+					this.loading = true
+					if (this.commonJS.isNotEmpty(this.inputForm.id)) {
+						console.log('this.inputForm.id', this.inputForm.id)
+						this.borrowService.queryById(this.inputForm.id).then((data)=>{
+							console.log('this.inputForm', this.inputForm)
+							this.inputForm = this.recover(this.inputForm, data)
+							if (this.commonJS.isEmpty(this.inputForm.createName)){
+								this.inputForm.createName=this.$store.state.user.name
+							}
+							if (this.commonJS.isEmpty(this.inputForm.officeName)){
+								this.inputForm.officeName=this.$store.state.user.office.name							}
+							if (this.commonJS.isEmpty(this.inputForm.createTime)){
+								this.inputForm.createTime=this.moment(new Date()).format('YYYY-MM-DD')
+							}
+							this.inputForm.endMoney=data.finalMoney
+						})
+						this.loading = false
+					}
+				})
+			},
+			saveForm(callback) {
+				this.doSubmit('save', callback)
+			},
+			startForm(callback) {
+				this.loading = true
+				if (this.commonJS.isNotEmpty(this.inputForm.id)) {
+					this.borrowService.queryById(this.inputForm.id).then((data) => {
+						if (data.refundStatus !== '0' && data.refundStatus !== '1' && data.refundStatus !== '3') { // 审核状态不是“未发起”或“暂存”或“撤回”,就弹出提示
+							this.loading = false
+							this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+							throw new Error()
+						} else {
+							this.doSubmit('start', callback)
+						}
+					})
+				} else {
+					this.doSubmit('start', callback)
+				}
+			},
+			async agreeForm(callback) {
+				console.log('进入方法')
+				this.loading = true
+				await this.borrowService.queryById(this.inputForm.id).then((data) => {
+					if (data.refundStatus !== '2' ) { // status的值不等于“审核中”,就弹出提示
+						this.loading = false
+						this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+						throw new Error()
+					} else {
+						this.inputForm.status= '5'
+						let param = {status: this.inputForm.status, id: this.inputForm.id}
+						this.borrowService.updateRefundById(param).then(() => {
+							callback(data.businessTable, data.businessId, this.inputForm)
+							this.loading = false
+						}).catch(() => {
+							this.loading = false
+						})
+					}
+				})
+			},
+			reapplyForm(callback) {
+				this.loading = true
+				this.borrowService.queryById(this.inputForm.id).then((data) => {
+					if (data.refundStatus !== '4') { // 审核状态不是“驳回”,就弹出提示
+						this.loading = false
+						this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+						throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+					} else {
+						this.doSubmit('reapply', callback)
+					}
+				})
+			},
+			// 表单提交
+			async doSubmit(status, callback) {
+				this.loading = true
+				console.log('5',this.inputForm)
+				if (status === 'save') {
+					// 暂存
+					this.loading = true
+					this.inputForm.status = '1'
+					this.inputForm.createTime=''
+					this.borrowService.saveRefund(this.inputForm).then((data) => {
+						callback(data.businessTable, data.businessId, this.inputForm)
+						this.loading = false
+					}).catch(() => {
+						this.loading = false
+					})
+					return
+				} else if (status === 'start') {
+					if (this.commonJS.isEmpty(this.inputForm.reason)) {
+						this.$message.error('请输入借款用途')
+						this.loading = false
+					}
+					if (this.commonJS.isEmpty(this.inputForm.moneyLower)) {
+						this.$message.error('请输入借款金额')
+						this.loading = false
+					}
+					this.inputForm.createTime=''
+					// 送审  待审核
+					this.inputForm.status = '2'
+				} else if (status === 'agree') {
+					this.inputForm.status= '5'
+				} else if (status === 'reapply') {
+					this.inputForm.status = '2'
+				}
+				this.$refs['inputForm'].validate((valid) => {
+					if (valid) {
+						this.loading = true
+						console.log('form',this.inputForm)
+						this.inputForm.createTime=''
+						this.borrowService.adminEditForm(this.inputForm).then((data) => {
+							this.visible=false
+							this.$emit('refreshList')
+						}).catch(() => {
+							this.$refs.inputForm.resetFields()
+							this.loading = false
+						})
+					} else {
+						this.loading = false
+					}
+				})
+			},
+			close() {
+				this.inputForm = {
+					id:'',
+					projectList:[],
+					name:'',
+					no:'',
+					projectLeader:'',
+					projectCreateDate:'',
+					createById:'',
+					createByName:'',
+					createDate:'',
+					remarks:'',
+					files: [], // 附件信息
+					types:[], //用印类型
+					number:'', //用印份数
+					projectId:'',
+				}
+				this.visible = false
+			},
+			async updateStatusById(type, callback) {
+				this.loading = true
+				if (type === 'reject' || type === 'reback') {
+					this.borrowService.queryById(this.inputForm.id).then((data) => {
+						if (data.refundStatus !== '2') { // status的值不等于“审核中”,就弹出提示
+							this.loading = false
+							this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+							throw new Error()
+						} else {
+							// if (type === 'agree') {
+							//   // 同意
+							//   this.inputForm.status = '5'
+							// }
+							if (type === 'reject') {
+								// 驳回
+								this.inputForm.status = '4'
+							}
+							if (type === 'reback') {
+								// 撤回
+								this.inputForm.status = '3'
+							}
+							if (type === 'reject' || type === 'reback') {
+								let param = {status: this.inputForm.status, id: this.inputForm.id}
+								this.borrowService.updateRefundById(param).then(() => {
+									this.loading = false
+									callback()
+								})
+							}
+						}
+					})
+				} else if (type === 'hold') {
+					this.borrowService.queryById(this.inputForm.id).then((data) => {
+						if (data.refundStatus !== '4') { // status的值不等于“驳回”就弹出提示
+							this.loading = false
+							this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+							throw new Error()
+						} else {
+							// 终止
+							let param = {status: '1', id: this.inputForm.id}
+							this.borrowService.updateRefundById(param).then(() => {
+								this.loading = false
+								callback()
+							})
+						}
+					})
+				}
+
+			},
+			convert(money){
+				if (!money) { return this.inputForm.refund='';}
+				//数字的汉字数组
+				let numberCNList = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
+				//数字的基础单位汉字数组
+				let numberBaseUnit = ['', '拾', '佰', '仟'];
+				//数字的高级单位汉字数组
+				let numberHighUnit = ['', '万', '亿', '兆'];// 一兆等于一万亿
+				//小数部分单位汉字数组
+				let floatUnit = ['角', '分', '毫', '厘'];
+				//整数金额时后面跟的字符
+				let integerLastCN = '整';
+				//整数后的单位汉字
+				let integerLastUnit = '元';
+				//最大处理的数字
+				let maxNum = 999999999999999.9999;
+				//以小数点拆分金额产生的数组
+				let decimalPointSplitList;
+				//金额整数部分
+				let integerNum;
+				//金额小数部分
+				let decimalNum;
+				//返回的大写金额
+				let moneyCNString = '';
+				money = parseFloat(money);// 转为数字
+				if(typeof money !== 'number' || isNaN(money)){this.$message('检测到非数字字符');return '';}
+				//超出最大处理数字
+				if (money >= maxNum) {this.$message('超出最大处理数字');return '';}
+				// 等于0时 返回零元整
+				if (money === 0) {
+					moneyCNString = numberCNList[0] + integerLastUnit + integerLastCN;
+					return moneyCNString;
+				}
+				//转换为字符串
+				money = money.toString();
+				/******金额数字的处理,转为字符串,判断有没有小数位,获取整数部分和小数部分*******/
+				if (money.indexOf('.') === -1) {// 如果没有小数点
+					integerNum = money;// money就都等于整数部分,小数部分为空
+					decimalNum = '';
+				} else {// 有小数点
+					decimalPointSplitList = money.split('.');// 以小数点拆分数组
+					if(decimalPointSplitList[1].length > 4)this.$message('金额精确仅支持到厘');
+					integerNum = decimalPointSplitList[0];// 整数部分
+					decimalNum = decimalPointSplitList[1].substr(0, 4);// 小数部分只支持4位
+				}
+				/******整数部分处理*******/
+				if (parseInt(integerNum, 10) > 0) {// 以十进制转为int类型 大于零
+					let zeroCount = 0;// 记录零的个数
+					for (let i = 0; i < integerNum.length; i++) {
+						let p = integerNum.length - 1 - i;// 当前数字的位数, 比如10000 ,1的位数是4 , 10001000,第一个1的位数是7,第二个1的位数是3
+						console.log(p,integerNum[i]);
+						let q = p / 4;// 当前数字位数 除以 4 商0余1,则值为0,控制其高级单位
+						let m = p % 4;// 取余,比如1%4 商0余1 ,则值为1, 控制其基础单位
+						// 如果当前数字等于零 则++
+						if (integerNum[i] === '0') {zeroCount++;}
+						// 否则当前数字不等于零时
+						else {
+							// 如果记录的零的个数大于0 返回结果中加一个汉字零
+							if (zeroCount > 0) {moneyCNString += numberCNList[0];}
+							//把零的个数归零,重新计算零的个数
+							zeroCount = 0;
+							// 然后把返回结果 加上 当前数字的汉字以及其基础单位
+							moneyCNString += numberCNList[parseInt(integerNum[i])] + numberBaseUnit[m];
+						}
+						// 如果当前数字所在位数取余4等于0时,那么除以4一定是整数,并且记录的零的个数小于4个,则拼接当前位数对应的高级单位
+						if (m === 0 && zeroCount < 4) {moneyCNString += numberHighUnit[q];}
+					}
+					moneyCNString += integerLastUnit;// 整数部分结束后 拼接上整数部分单位 元
+				}
+				/******小数部分处理 --- 小数部分只考虑是否有值,以及当前值所在单位,没有零的概念,所以只需拼接当前值对应的汉字,以及当前值的单位即可*******/
+				if (decimalNum !== '') {
+					for (let i = 0; i < decimalNum.length; i++) {
+						if (decimalNum[i] !== '0') {// 如果当前数字不等于零 则加上当前数字的汉字 以及 其小数单位
+							moneyCNString += numberCNList[Number(decimalNum[i])] + floatUnit[i];
+						}
+					}
+				}else {// 如果没有小数部分则加上汉字 整
+					moneyCNString += integerLastCN;
+				}
+
+				this.inputForm.refund= moneyCNString;
+				this.inputForm.finalMoney=parseFloat(this.inputForm.moneyLower-money)
+				if (this.inputForm.finalMoney <0){
+					this.$message.error("还款金额不正确")
+					throw new Error()
+					this.inputForm.refundLower=''
+					this.inputForm.finalMoney=this.inputForm.endMoney
+				}
+			}
+
+
+		}
+
+	}
+</script>
+<style scoped>
+	/deep/ .el-input-number .el-input__inner {
+		text-align: left;
+	}
+	/deep/ .vxe-footer--row .vxe-footer--column:nth-child(1) .vxe-cell--item {
+		font-weight:700;
+	}
+</style>

+ 450 - 0
src/views/jy/borrowMoney/BorrowForm.vue

@@ -0,0 +1,450 @@
+<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
+	<div>
+		<el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="status === 'audit' || status === 'taskFormDetail'"
+				 label-width="160px" @submit.native.prevent>
+			<el-divider content-position="left"><i class="el-icon-document"></i>
+				借款申请
+			</el-divider>
+			<el-row  :gutter="15">
+				<el-col :span="12">
+					<el-form-item label="借款编号" prop="no"
+								  :rules="[ ]">
+						<el-input :disabled="true" placeholder="编号自动生成" v-model="inputForm.no" ></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="借款人" prop="createName"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.createName"></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="借款时间" prop="createTime"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.createTime"></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="24">
+					<el-form-item label="借款理由或用途" prop="reason"
+								  :rules="[{required: true, message:'请输入借款理由或用途', trigger:'blur'} ]">
+						<el-input :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" type="textarea" placeholder="请输入借款理由或用途"  maxlength="500"  style="width:100%" v-model="inputForm.reason" show-word-limit></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="借款金额(小写)" prop="moneyLower"
+								  :rules="[{required: true, message:'请输入借款金额(小写)', trigger:'blur'}]">
+						<el-input v-on:input="inputForm.moneyLower=inputForm.moneyLower.replace(/[^\d.]/g,'')
+							  .replace(/^\./g,'')
+							  .replace(/\.{2,}/g,'.')
+							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
+							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')" @blur="convert(this.inputForm.moneyLower)" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" placeholder="请输入借款金额" v-model="inputForm.moneyLower" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="借款金额(大写)" prop="money"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.money"></el-input>
+					</el-form-item>
+				</el-col>
+			</el-row>
+		</el-form>
+	</div>
+</template>
+
+<script>
+	import XEUtils from 'xe-utils'
+	import BorrowService from '@/api/jy/BorrowService'
+	import { ElDatePicker } from 'element-plus';
+	import CommonApi from '@/api/cw/common/CommonApi'
+	export default {
+		props: {
+			businessId: {
+				type: String,
+				default: ''
+			},
+			formReadOnly: {
+				type: Boolean,
+				default: false
+			},
+			status: {
+				type: String,
+				default: ''
+			}
+		},
+		data () {
+			return {
+				title: '',
+				method: '',
+				loading: false,
+				inputForm: {
+					id: '',
+					no: '',
+					createById: '',
+					createName: this.$store.state.user.name,
+					createTime: this.moment(new Date()).format('YYYY-MM-DD'),
+					reason: '',
+					moneyLower:'', // 借款金额小写
+					money:'', //借款金额大写
+					procInsId:'',
+					status:''
+				},
+				baseKey: '',
+				keyWatch: '',
+				dateList:[]
+			}
+		},
+		BorrowService:null,
+		CommonApi:null,
+		created () {
+			console.log('jld ')
+			this.borrowService=new BorrowService()
+			this.commonApi = new CommonApi()
+		},
+		mounted () {
+		},
+		activated () {
+		},
+		components: {
+			ElDatePicker
+		},
+		computed: {
+			bus: {
+				get () {
+					return this.businessId
+				},
+				set (val) {
+					this.businessId = val
+				}
+			}
+		},
+		watch: {
+			'keyWatch': {
+				handler (newVal) {
+					console.log('几里路')
+					if (this.bus) {
+						if (this.bus !== 'false') {
+							this.init('', this.bus)
+						}
+					} else {
+						this.$nextTick(() => {
+							this.$refs.inputForm.resetFields()
+						})
+					}
+				}
+			},
+			'loading': {
+				handler (newVal) {
+					this.$emit('changeLoading', newVal)
+				}
+			}
+		},
+		methods: {
+			getKeyWatch(keyWatch) {
+				this.keyWatch = keyWatch
+			},
+			init(method, id) {
+				this.method = method
+				this.inputForm={
+					id: '',
+					no: '',
+					createById: this.$store.state.user.id,
+					createName: this.$store.state.user.name,
+					createTime: this.moment(new Date()).format('YYYY-MM-DD'),
+					reason: '',
+					moneyLower:'', // 借款金额小写
+					money:'', //借款金额大写
+					procInsId:''
+				}
+				this.inputForm.id = id
+				this.loading = false
+				this.$nextTick(() => {
+					this.$refs.inputForm.resetFields()
+					this.loading = true
+					if (this.commonJS.isNotEmpty(this.inputForm.id)) {
+						console.log('this.inputForm.id', this.inputForm.id)
+						this.borrowService.queryById(this.inputForm.id).then((data)=>{
+							this.inputForm = this.recover(this.inputForm, data)
+							if (this.commonJS.isEmpty(this.inputForm.createName)){
+								this.inputForm.createName=this.$store.state.user.name
+							}
+							if (this.commonJS.isEmpty(this.inputForm.officeName)){
+								this.inputForm.officeName=this.$store.state.user.office.name							}
+							if (this.commonJS.isEmpty(this.inputForm.createTime)){
+								this.inputForm.createTime=this.moment(new Date()).format('YYYY-MM-DD')
+							}
+						})
+						this.loading = false
+					}
+				})
+			},
+			saveForm(callback) {
+				this.doSubmit('save', callback)
+			},
+			startForm(callback) {
+				this.loading = true
+				if (this.commonJS.isNotEmpty(this.inputForm.id)) {
+					this.borrowService.queryById(this.inputForm.id).then((data) => {
+						if (data.status !== '0' && data.status !== '1' && data.status !== '3') { // 审核状态不是“未发起”或“暂存”或“撤回”,就弹出提示
+							this.loading = false
+							this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+							throw new Error()
+						} else {
+							this.doSubmit('start', callback)
+						}
+					})
+				} else {
+					this.doSubmit('start', callback)
+				}
+			},
+			async agreeForm(callback) {
+				console.log('进入方法')
+				this.loading = true
+				await this.borrowService.queryById(this.inputForm.id).then((data) => {
+					if (data.status !== '2' ) { // status的值不等于“审核中”,就弹出提示
+						this.loading = false
+						this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+						throw new Error()
+					} else {
+						this.inputForm.status= '2'
+						this.commonApi.getTaskNameByProcInsId(this.inputForm.procInsId).then((data)=>{
+							if (this.commonJS.isNotEmpty(data)) {
+								if (data === '总经理审核') {
+									this.inputForm.status = '5'
+								}
+							}
+							let param = {status: this.inputForm.status, id: this.inputForm.id}
+							this.borrowService.updateStatusById(param).then(() => {
+								callback(data.businessTable, data.businessId, this.inputForm)
+								this.loading = false
+							}).catch(() => {
+								this.loading = false
+							})
+						})
+					}
+				})
+			},
+			reapplyForm(callback) {
+				this.loading = true
+				this.borrowService.queryById(this.inputForm.id).then((data) => {
+					if (data.status !== '4') { // 审核状态不是“驳回”,就弹出提示
+						this.loading = false
+						this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+						throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+					} else {
+						this.doSubmit('reapply', callback)
+					}
+				})
+			},
+			// 表单提交
+			async doSubmit(status, callback) {
+				this.loading = true
+				console.log('5',this.inputForm)
+				if (status === 'save') {
+					// 暂存
+					this.loading = true
+					this.inputForm.status = '1'
+					this.inputForm.createTime=''
+					this.borrowService.saveForm(this.inputForm).then((data) => {
+						callback(data.businessTable, data.businessId, this.inputForm)
+						this.loading = false
+					}).catch(() => {
+						this.loading = false
+					})
+					return
+				} else if (status === 'start') {
+					if (this.commonJS.isEmpty(this.inputForm.reason)) {
+						this.$message.error('请输入借款用途')
+						this.loading = false
+					}
+					if (this.commonJS.isEmpty(this.inputForm.moneyLower)) {
+						this.$message.error('请输入借款金额')
+						this.loading = false
+					}
+					this.inputForm.createTime=''
+					// 送审  待审核
+					this.inputForm.status = '2'
+				} else if (status === 'agree') {
+					this.inputForm.status= '5'
+				} else if (status === 'reapply') {
+					this.inputForm.status = '2'
+				}
+				this.$refs['inputForm'].validate((valid) => {
+					if (valid) {
+						this.loading = true
+						console.log('form',this.inputForm)
+						this.borrowService.saveForm(this.inputForm).then((data) => {
+							callback(data.businessTable, data.businessId, this.inputForm)
+							this.$refs.inputForm.resetFields()
+							this.loading = false
+						}).catch(() => {
+							this.$refs.inputForm.resetFields()
+							this.loading = false
+						})
+					} else {
+						this.loading = false
+					}
+				})
+			},
+			close() {
+				this.inputForm = {
+					id:'',
+					projectList:[],
+					name:'',
+					no:'',
+					projectLeader:'',
+					projectCreateDate:'',
+					createById:'',
+					createByName:'',
+					createDate:'',
+					remarks:'',
+					files: [], // 附件信息
+					types:[], //用印类型
+					number:'', //用印份数
+					projectId:'',
+				}
+				this.visible = false
+			},
+			async updateStatusById(type, callback) {
+				this.loading = true
+				if (type === 'reject' || type === 'reback') {
+					this.borrowService.queryById(this.inputForm.id).then((data) => {
+						if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
+							this.loading = false
+							this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+							throw new Error()
+						} else {
+							// if (type === 'agree') {
+							//   // 同意
+							//   this.inputForm.status = '5'
+							// }
+							if (type === 'reject') {
+								// 驳回
+								this.inputForm.status = '4'
+							}
+							if (type === 'reback') {
+								// 撤回
+								this.inputForm.status = '3'
+							}
+							if (type === 'reject' || type === 'reback') {
+								let param = {status: this.inputForm.status, id: this.inputForm.id}
+								this.borrowService.updateStatusById(param).then(() => {
+									this.loading = false
+									callback()
+								})
+							}
+						}
+					})
+				} else if (type === 'hold') {
+					this.borrowService.queryById(this.inputForm.id).then((data) => {
+						if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
+							this.loading = false
+							this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+							throw new Error()
+						} else {
+							// 终止
+							let param = {status: '1', id: this.inputForm.id}
+							this.borrowService.updateStatusById(param).then(() => {
+								this.loading = false
+								callback()
+							})
+						}
+					})
+				}
+
+			},
+			convert(money){
+				if (!money) { return this.inputForm.money='';}
+				//数字的汉字数组
+				let numberCNList = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
+				//数字的基础单位汉字数组
+				let numberBaseUnit = ['', '拾', '佰', '仟'];
+				//数字的高级单位汉字数组
+				let numberHighUnit = ['', '万', '亿', '兆'];// 一兆等于一万亿
+				//小数部分单位汉字数组
+				let floatUnit = ['角', '分', '毫', '厘'];
+				//整数金额时后面跟的字符
+				let integerLastCN = '整';
+				//整数后的单位汉字
+				let integerLastUnit = '元';
+				//最大处理的数字
+				let maxNum = 999999999999999.9999;
+				//以小数点拆分金额产生的数组
+				let decimalPointSplitList;
+				//金额整数部分
+				let integerNum;
+				//金额小数部分
+				let decimalNum;
+				//返回的大写金额
+				let moneyCNString = '';
+				money = parseFloat(money);// 转为数字
+				if(typeof money !== 'number' || isNaN(money)){this.$message('检测到非数字字符');return '';}
+				//超出最大处理数字
+				if (money >= maxNum) {this.$message('超出最大处理数字');return '';}
+				// 等于0时 返回零元整
+				if (money === 0) {
+					moneyCNString = numberCNList[0] + integerLastUnit + integerLastCN;
+					return moneyCNString;
+				}
+				//转换为字符串
+				money = money.toString();
+				/******金额数字的处理,转为字符串,判断有没有小数位,获取整数部分和小数部分*******/
+				if (money.indexOf('.') === -1) {// 如果没有小数点
+					integerNum = money;// money就都等于整数部分,小数部分为空
+					decimalNum = '';
+				} else {// 有小数点
+					decimalPointSplitList = money.split('.');// 以小数点拆分数组
+					if(decimalPointSplitList[1].length > 4)this.$message('金额精确仅支持到厘');
+					integerNum = decimalPointSplitList[0];// 整数部分
+					decimalNum = decimalPointSplitList[1].substr(0, 4);// 小数部分只支持4位
+				}
+				/******整数部分处理*******/
+				if (parseInt(integerNum, 10) > 0) {// 以十进制转为int类型 大于零
+					let zeroCount = 0;// 记录零的个数
+					for (let i = 0; i < integerNum.length; i++) {
+						let p = integerNum.length - 1 - i;// 当前数字的位数, 比如10000 ,1的位数是4 , 10001000,第一个1的位数是7,第二个1的位数是3
+						console.log(p,integerNum[i]);
+						let q = p / 4;// 当前数字位数 除以 4 商0余1,则值为0,控制其高级单位
+						let m = p % 4;// 取余,比如1%4 商0余1 ,则值为1, 控制其基础单位
+						// 如果当前数字等于零 则++
+						if (integerNum[i] === '0') {zeroCount++;}
+						// 否则当前数字不等于零时
+						else {
+							// 如果记录的零的个数大于0 返回结果中加一个汉字零
+							if (zeroCount > 0) {moneyCNString += numberCNList[0];}
+							//把零的个数归零,重新计算零的个数
+							zeroCount = 0;
+							// 然后把返回结果 加上 当前数字的汉字以及其基础单位
+							moneyCNString += numberCNList[parseInt(integerNum[i])] + numberBaseUnit[m];
+						}
+						// 如果当前数字所在位数取余4等于0时,那么除以4一定是整数,并且记录的零的个数小于4个,则拼接当前位数对应的高级单位
+						if (m === 0 && zeroCount < 4) {moneyCNString += numberHighUnit[q];}
+					}
+					moneyCNString += integerLastUnit;// 整数部分结束后 拼接上整数部分单位 元
+				}
+				/******小数部分处理 --- 小数部分只考虑是否有值,以及当前值所在单位,没有零的概念,所以只需拼接当前值对应的汉字,以及当前值的单位即可*******/
+				if (decimalNum !== '') {
+					for (let i = 0; i < decimalNum.length; i++) {
+						if (decimalNum[i] !== '0') {// 如果当前数字不等于零 则加上当前数字的汉字 以及 其小数单位
+							moneyCNString += numberCNList[Number(decimalNum[i])] + floatUnit[i];
+						}
+					}
+				}else {// 如果没有小数部分则加上汉字 整
+					moneyCNString += integerLastCN;
+				}
+
+				this.inputForm.money= moneyCNString;
+			}
+
+
+		}
+
+	}
+</script>
+<style scoped>
+	/deep/ .el-input-number .el-input__inner {
+		text-align: left;
+	}
+	/deep/ .vxe-footer--row .vxe-footer--column:nth-child(1) .vxe-cell--item {
+		font-weight:700;
+	}
+</style>

+ 605 - 0
src/views/jy/borrowMoney/BorrowMoneyList.vue

@@ -0,0 +1,605 @@
+<template>
+	<div class="page">
+		<el-form :inline="true"  v-if="searchVisible" class="query-form m-b-10" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+			<!-- 搜索框-->
+			<el-form-item label="借款编号" prop="no">
+				<el-input v-model="searchForm.no" placeholder="请输入借款编号" clearable></el-input>
+			</el-form-item>
+			<el-form-item label="借款原因" prop="reason">
+				<el-input v-model="searchForm.reason" placeholder="请输入借款原因" clearable></el-input>
+			</el-form-item>
+			<el-form-item v-if="showHideItem" label="借款人" prop="createById">
+				<UserSelectSignatory style="width: 100%" ref="userSelect2" :limit="1"
+									 :readonly="true" :modelValue="searchForm.createById"
+									 @update:modelValue='(value) => {searchForm.createById = value}'></UserSelectSignatory>			</el-form-item>
+			<el-form-item v-if="showHideItem"  prop="officeId" label="借款人部门">
+				<SelectTree
+					ref="officeTree"
+					:props="{
+                  value: 'id',             // ID字段名
+                  label: 'name',         // 显示名称
+                  children: 'children'    // 子级字段名
+                }"
+
+					:url="`/system-server/sys/office/treeData?type=2`"
+					:value="searchForm.officeId"
+					size="default"
+					:accordion="true"
+					@getValue="(value) => {searchForm.officeId=value}"/>
+			</el-form-item>
+			<el-form-item v-if="showHideItem" label="借款时间" prop="createDates">
+				<el-date-picker
+					placement="bottom-start"
+					v-model="searchForm.createDates"
+					type="datetimerange"
+					format="YYYY-MM-DD HH:mm:ss"
+					value-format="YYYY-MM-DD HH:mm:ss"
+					range-separator="至"
+					start-placeholder="开始日期"
+					end-placeholder="结束日期">
+				</el-date-picker>
+			</el-form-item>
+			<el-form-item v-if="showHideItem" label="借款金额" prop="borrowAmounts">
+				<InputNumber :disabled="false" :precision="num"
+							 :value="searchForm.borrowAmounts"
+							 @changefrom="(val) => {searchForm.borrowAmounts[0] = val}"
+							 @changeto="(val) => {searchForm.borrowAmounts[1] = val}"
+				>
+				</InputNumber>
+			</el-form-item>
+
+			<el-form-item>
+				<el-button type="default" @click="showHide" :icon="showHideIcon">{{showHideName}}</el-button>
+				<el-button type="primary" @click="refreshList()" icon="el-icon-search">查询</el-button>
+				<el-button @click="resetSearch()" icon="el-icon-refresh-right">重置</el-button>
+			</el-form-item>
+		</el-form>
+		<div class="jp-table top" style="">
+			<vxe-toolbar :refresh="{query: refreshList}" custom>
+				<template #buttons>
+					<el-button v-if="hasPermission('borrow:add')" :disabled="isAdmin" type="primary" icon="el-icon-plus" @click="add()">新建</el-button>
+				</template>
+				<template #tools>
+					<vxe-button
+						text
+						type="primary"
+						:title="searchVisible ? '收起检索' : '展开检索'"
+						icon="vxe-icon-search"
+						class="tool-btn"
+						@click="searchVisible = !searchVisible"
+					></vxe-button>
+				</template>
+			</vxe-toolbar>
+			<div style="height: calc(100% - 90px)">
+				<vxe-table
+					border="inner"
+					auto-resize
+					resizable
+					height="auto"
+					:loading="loading"
+					ref="clientTable"
+					show-header-overflow
+					show-overflow
+					highlight-hover-row
+					:menu-config="{}"
+					@sort-change="sortChangeHandle"
+					:sort-config="{remote:true}"
+					:data="dataList"
+					:checkbox-config="{}">
+					<vxe-column type="seq" width="60" title="序号"></vxe-column>
+					<vxe-column min-width="160" align="center" title="借款编号" field="no">
+						<template  #default="scope">
+							<el-link  type="primary" :underline="false"  @click="view(scope.row)">{{scope.row.no}}</el-link>
+						</template>
+					</vxe-column>
+					<vxe-column min-width="160" align="center" title="借款用途" field="reason"></vxe-column>
+					<vxe-column min-width="160" align="center" title="借款人" field="createName"></vxe-column>
+					<vxe-column min-width="160" align="center" title="借款人部门" field="officeName"></vxe-column>
+					<vxe-column min-width="160" align="center" title="借款时间" field="createTime"></vxe-column>
+					<vxe-column min-width="160" align="center" title="借款金额" field="moneyLower"></vxe-column>
+					<vxe-column min-width="160" align="center" title="对冲金额" field="refundLower"></vxe-column>
+					<vxe-column min-width="160" align="center" title="剩余借款金额" field="finalMoney"></vxe-column>
+					<vxe-column  min-width="150px" align="center" title="借款状态" field="status" fixed="right">
+						<template #default="scope">
+							<el-button @click="detail(scope.row)" :type="$dictUtils.getDictLabel('program_project_list_info_status_info', scope.row.status, '')" effect="dark" >{{$dictUtils.getDictLabel("program_project_list_info_status", scope.row.status, '未登记')}} </el-button>
+						</template>
+					</vxe-column>
+					<vxe-column  min-width="150px" align="center" title="还款状态" field="refundStatus" fixed="right">
+						<template #default="scope">
+							<el-button @click="detailAccount(scope.row)" :type="$dictUtils.getDictLabel('program_project_list_info_status_info', scope.row.refundStatus, '')" effect="dark" >{{$dictUtils.getDictLabel("program_project_list_info_status", scope.row.refundStatus, '未登记')}} </el-button>
+						</template>
+					</vxe-column>
+					<vxe-column title="操作" width="150px" fixed="right" align="center">
+						<template  #default="scope">
+							<div v-if="isAdmin">
+								<el-button text type="primary" size="small" v-if="scope.row.status==='0' || scope.row.status==='5'" @click="del(scope.row.id)">删除</el-button>
+								<el-button  size="small" text type="primary"  @click="adminEdit(scope.row)">修改</el-button>
+							</div>
+							<div v-else>
+								<el-button text type="primary" size="small" v-if="scope.row.status==='0' || scope.row.status==='1'|| scope.row.status==='3'" @click="del(scope.row.id)">删除</el-button>
+								<el-button v-if="(scope.row.status === '0'||scope.row.status === '1'|| scope.row.status === '3')" size="small" text type="primary"  @click="edit(scope.row)">修改</el-button>
+								<!--              当前申请人撤回-->
+								<el-button v-if="scope.row.createById === $store.state.user.id && scope.row.status==='2'" text type="primary" size="small" @click="reback(scope.row)">撤回</el-button>
+
+								<el-button v-if="scope.row.status==='2' && checkIsAudit(scope.row)" text type="primary" size="small" @click="examine(scope.row)">审核</el-button>
+								<el-button v-if="scope.row.status === '4'&&scope.row.createById === $store.state.user.id" text type="primary" size="small" @click="adjust(scope.row)">驳回调整</el-button>
+								<el-button v-if="scope.row.status === '5'&&scope.row.createById === $store.state.user.id" text type="primary" size="small" @click="account(scope.row)">还款申请</el-button>
+								<el-button v-if="scope.row.createById === $store.state.user.id && scope.row.refundStatus==='2'" text type="primary" size="small" @click="rebackAccount(scope.row)">还款撤回</el-button>
+
+								<el-button v-if="scope.row.refundStatus==='2' && checkIsAudit(scope.row)" text type="primary" size="small" @click="examineAccount(scope.row)">还款审核</el-button>
+								<el-button v-if="scope.row.refundStatus === '4'&&scope.row.createById === $store.state.user.id" text type="primary" size="small" @click="adjustAccount(scope.row)">还款驳回调整</el-button>
+							</div>
+						</template>
+					</vxe-column>
+				</vxe-table>
+				<vxe-pager
+					background
+					:current-page="tablePage.currentPage"
+					:page-size="tablePage.pageSize"
+					:total="tablePage.total"
+					:page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
+					:layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
+					@page-change="currentChangeHandle">
+				</vxe-pager>
+
+			</div>
+		</div>
+
+	<BorrowDia ref="borrowDia" @refreshList="refreshList"></BorrowDia>
+	</div>
+
+</template>
+
+<script>
+	import InputNumber from './InputNumber.vue'
+	import UserSelect from '@/components/userSelect'
+	import SelectTree from '@/components/treeSelect/treeSelect.vue'
+	import BorrowService from '@/api/jy/BorrowService'
+	import taskService from '@/api/flowable/taskService'
+	import processService from '@/api/flowable/processService'
+	import userService from '@/api/sys/userService'
+	import pick from 'lodash.pick'
+	import SupplierChooseForm from '@/views/materialManagement/supplier/SupplierChooseForm'
+	import UserSelectSignatory from '../workClientInfo/clientUserSelect'
+	import BorrowDia from './BorrowDia'
+	export default {
+		data () {
+			return {
+				dialogTableVisible:false,
+				searchVisible: true,
+				showHideItem: false,
+				showHideIcon: 'el-icon-arrow-down',
+				showHideName: '展示',
+				num: 0,
+				searchForm: {
+					no: '',
+					reason: '',
+					officeId: '',
+					createById: '',
+					borrowAmounts:[],
+					createDates:[]
+				},
+				dataList: [],
+				tablePage: {
+					total: 0,
+					currentPage: 1,
+					pageSize: 10,
+					orders: []
+				},
+				tableKey: '',
+				loading: false,
+				processDefinitionId: '',
+				processDefinitionIdAccount:'',
+				procDefKey: '',
+				procDefKeyAccount: '',
+				isAdmin: false,
+				create: '',
+				gridData:[],
+				typeData:[]
+			}
+		},
+		BorrowService:null,
+		created () {
+			this.borrowService=new BorrowService()
+		},
+		components: {
+			SelectTree,
+			UserSelect,
+			SupplierChooseForm,
+			UserSelectSignatory,
+			InputNumber,
+			BorrowDia
+		},
+		computed: {
+			userName () {
+				return this.$store.state.user.name
+			},
+			user () {
+				this.createName = this.$store.state.user.name
+				return this.$store.state.user
+			}
+		},
+		mounted () {
+			this.refreshList()
+		},
+		activated () {
+			this.refreshList()
+		},
+		methods: {
+			showHide () {
+				if (this.showHideItem === false) {
+					this.showHideItem = true
+					this.showHideIcon = 'el-icon-arrow-up'
+					this.showHideName = '隐藏'
+				} else {
+					this.showHideItem = false
+					this.showHideIcon = 'el-icon-arrow-down'
+					this.showHideName = '展示'
+				}
+			},
+			// 新增
+			add () {
+				// 读取流程表单
+				let tabTitle = `发起流程【嘉溢-借款管理】`
+				let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [嘉溢-借款管理]`
+				taskService.getTaskDef({ procDefId: this.processDefinitionId,
+					status: 'startAndHold'}).then((data) => {
+					this.$router.push({
+						path: '/flowable/task/TaskForm',
+						query: {
+							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+							procDefId: this.processDefinitionId,
+							procDefKey: this.procDefKey,
+							status: 'startAndHold',
+							title: tabTitle,
+							formType: data.formType,
+							formUrl: data.formUrl,
+							formTitle: processTitle,
+							businessId: 'false',
+							isShow: false,
+							routePath: '/jy/borrowMoney/BorrowMoneyList'
+						}
+					})
+				})
+			},
+			// 修改
+			edit (row) {
+				let tabTitle = `发起流程【嘉溢-借款管理】`
+				let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [嘉溢-借款管理]`
+				taskService.getTaskDef({ procDefId: this.processDefinitionId,
+					businessId: row.id,
+					businessTable: 'jy_borrow_money',
+					status: 'startAndHold'}).then((data) => {
+					this.$router.push({
+						path: '/flowable/task/TaskForm',
+						query: {
+							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+							procDefId: this.processDefinitionId,
+							procDefKey: this.procDefKey,
+							status: 'startAndHold',
+							title: tabTitle,
+							formType: data.formType,
+							formUrl: data.formUrl,
+							formTitle: processTitle,
+							businessId: row.id,
+							businessTable: 'jy_borrow_money',
+							isShow: false,
+							routePath: '/jy/borrowMoney/BorrowMoneyList'
+						}
+					})
+				})
+			},
+			// 查看
+			view (row) {
+				this.$refs.borrowDia.init('view',row.id);
+
+			},
+			// 查询当前用户是否是管理员用户
+			checkIsAdmin () {
+				userService.is().then((data) => {
+					this.isAdmin = data
+				})
+			},
+			// 获取数据列表
+			refreshList () {
+				this.loading = true
+				this.borrowService.list({
+					'current': this.tablePage.currentPage,
+					'size': this.tablePage.pageSize,
+					'orders': this.tablePage.orders,
+					...this.searchForm
+				}).then((data) => {
+					console.log('x',data.records)
+					this.dataList = data.records
+					this.tablePage.total = data.total
+					this.tableKey = Math.random()
+					this.loading = false
+				})
+				this.checkIsAdmin()
+				processService.getByName('嘉溢-借款管理').then((data) => {
+					if (!this.commonJS.isEmpty(data.id)) {
+						this.processDefinitionId = data.id
+						this.procDefKey = data.key
+					}
+				})
+				processService.getByName('嘉溢-借款归还').then((data) => {
+					if (!this.commonJS.isEmpty(data.id)) {
+						this.processDefinitionIdAccount = data.id
+						this.procDefKeyAccount = data.key
+					}
+				})
+			},
+			// 当前页
+			currentChangeHandle ({ currentPage, pageSize }) {
+				this.tablePage.currentPage = currentPage
+				this.tablePage.pageSize = pageSize
+				this.refreshList()
+			},
+			// 排序
+			sortChangeHandle (column) {
+				this.tablePage.orders = []
+				if (column.order != null) {
+					this.tablePage.orders.push({column: this.$utils.toLine(column.property), asc: column.order === 'asc'})
+				}
+				this.refreshList()
+			},
+			// 删除
+			del (id) {
+				let ids = id || this.$refs.clientTable.getCheckboxRecords().map(item => {
+					return item.id
+				}).join(',')
+				this.$confirm(`确定删除所选项吗?`, '提示', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning'
+				}).then(() => {
+					this.loading = true
+					this.borrowService.delete(ids).then((data) => {
+						this.$message.success(data)
+						this.refreshList()
+						this.loading = false
+					})
+				})
+			},
+			resetSearch () {
+				this.$refs.searchForm.resetFields()
+				this.searchForm.projectId = '' // 重置时清空项目id
+				this.refreshList()
+			},
+
+			// 查看修改流程结果
+			detail (row) {
+				if (row.status !== '0' && row.status !== '1') {
+					this.borrowService.queryById(row.id).then((da)=>{
+						// eslint-disable-next-line eqeqeq
+						taskService.getTaskDef({
+							procInsId: row.procInsId,
+							procDefId: this.processDefinitionId
+						}).then((data) => {
+							this.$router.push({
+								path: '/flowable/task/TaskFormDetail',
+								query: {
+									...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+									isShow: 'false',
+									readOnly: true,
+									title: '借款申请' + '流程详情',
+									formTitle: '借款申请' + '流程详情',
+									businessId: row.id,
+									status: 'reback',
+									method: 'view'
+								}
+							})
+						})
+					})
+				}
+			},
+			// 撤回入库修改
+			reback (row) {
+				this.$confirm(`确定要撤回该申请吗?`, '提示', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning'
+				}).then(() => {
+					this.borrowService.queryById(row.id).then((data) => {
+						if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
+							this.$message.error('数据已发生改变或不存在,请刷新数据')
+							this.refreshList()
+						} else {
+							processService.revokeProcIns(row.procInsId).then((data) => {
+								let form = {status: '3', id: row.id}
+								this.borrowService.updateStatusById(form)
+								this.$message.success(data)
+								this.refreshList()
+							})
+						}
+					})
+				})
+			},
+			// 驳回后调整
+			adjust (row) {
+				this.borrowService.queryById(row.id).then((data) => {
+					if (data.status !== '4') { // status的值不等于“驳回”,就弹出提示
+						this.$message.error('数据已发生改变或不存在,请刷新数据')
+						this.refreshList()
+					} else {
+						this.todo(row)
+					}
+				})
+			},
+			// 审核
+			examine (row) {
+				this.borrowService.queryById(row.id).then((data) => {
+					if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
+						this.$message.error('数据已发生改变或不存在,请刷新数据')
+						this.refreshList()
+					} else {
+						this.todo(row)
+					}
+				})
+			},
+			// 审核或重新调整跳转
+			todo (row) {
+				let cUser = false
+				taskService.getTaskDefInfo({
+					taskId: row.taskId
+				}).then((data) => {
+					this.$router.push({
+						path: '/flowable/task/TaskForm',
+						query: {
+							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
+							isShow: false,
+							formReadOnly: true,
+							formTitle: `${data.taskName}`,
+							cUser: cUser,
+							title: `审批【${data.taskName || ''}】`,
+							routePath: '/jy/borrowMoney/BorrowMoneyList',   // 数据处理后需要跳转的页面路径
+						}
+					})
+				})
+			},
+			// 查询当前登录人是否是数据的审核人
+			checkIsAudit (row) {
+				let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
+				if (this.commonJS.isNotEmpty(row.auditUserIds)) {
+					for (const userId of row.auditUserIds) {
+						if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时,返回true
+							return true
+						}
+					}
+				}
+				return false
+			},
+			//发起借款归还
+			account (row) {
+				let tabTitle = `发起流程【嘉溢-借款归还】`
+				let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [嘉溢-借款归还]`
+				let status = 'startAndHold'
+				if (row.accountStatus === '3') {
+					status = 'startAndClose'
+				} else if (row.accountStatus === '4') {
+					status = 'reapplyFlag'
+				}
+				taskService.getTaskDef({ procDefId: this.processDefinitionIdAccount,
+					businessId: row.refundId,
+					businessTable: 'jy_refund'}).then((data) => {
+					this.$router.push({
+						path: '/flowable/task/TaskForm',
+						query: {
+							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+							procDefId: this.processDefinitionIdAccount,
+							procDefKey: this.procDefKeyAccount,
+							status: 'startAndHold',
+							title: tabTitle,
+							formType: data.formType,
+							formUrl: data.formUrl,
+							formTitle: processTitle,
+							businessId: row.refundId,
+							businessTable: 'jy_refund',
+							isShow: false,
+							status: status,
+							routePath: '/jy/borrowMoney/BorrowMoneyList'
+						}
+					})
+				})
+			},
+			// 查看修改流程结果
+			detailAccount (row) {
+				if (row.refundStatus !== '0' && row.refundStatus !== '1') {
+					this.borrowService.queryById(row.refundId).then((da)=>{
+						// eslint-disable-next-line eqeqeq
+						taskService.getTaskDef({
+							procInsId: row.procInsIdRefund,
+							procDefId: this.processDefinitionIdAccount
+						}).then((data) => {
+							this.$router.push({
+								path: '/flowable/task/TaskFormDetail',
+								query: {
+									...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
+									isShow: 'false',
+									readOnly: true,
+									title: '借款归还' + '流程详情',
+									formTitle: '借款归还' + '流程详情',
+									businessId: row.refundId,
+									status: 'reback',
+									method: 'view'
+								}
+							})
+						})
+					})
+				}
+			},
+			// 撤回用车结算
+			rebackAccount (row) {
+				this.$confirm(`确定要撤回该申请吗?`, '提示', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning'
+				}).then(() => {
+					this.borrowService.queryById(row.id).then((data) => {
+						if (data.refundStatus !== '2') { // status的值不等于“审核中”,就弹出提示
+							this.$message.error('数据已发生改变或不存在,请刷新数据')
+							this.refreshList()
+						} else {
+							processService.revokeProcIns(row.procInsIdRefund).then((data) => {
+								let form = {status: '3', id: row.refundId}
+								this.borrowService.updateRefundById(form)
+								this.$message.success(data)
+								this.refreshList()
+							})
+						}
+					})
+				})
+			},
+			// 驳回后调整
+			adjustAccount (row) {
+				this.borrowService.queryById(row.id).then((data) => {
+					if (data.refundStatus !== '4') { // status的值不等于“驳回”,就弹出提示
+						this.$message.error('数据已发生改变或不存在,请刷新数据')
+						this.refreshList()
+					} else {
+						this.todoAccount(row)
+					}
+				})
+			},
+			// 审核
+			examineAccount (row) {
+				this.borrowService.queryById(row.id).then((data) => {
+					if (data.refundStatus !== '2') { // status的值不等于“审核中”,就弹出提示
+						this.$message.error('数据已发生改变或不存在,请刷新数据')
+						this.refreshList()
+					} else {
+						this.todoAccount(row)
+					}
+				})
+			},
+			// 审核或重新调整跳转
+			todoAccount (row) {
+				let cUser = false
+				taskService.getTaskDefInfo({
+					taskId: row.taskIdRefund
+				}).then((data) => {
+					this.$router.push({
+						path: '/flowable/task/TaskForm',
+						query: {
+							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
+							isShow: false,
+							formReadOnly: true,
+							formTitle: `${data.taskName}`,
+							cUser: cUser,
+							title: `审批【${data.taskName || ''}】`,
+							routePath: '/jy/borrowMoney/BorrowMoneyList',   // 数据处理后需要跳转的页面路径
+						}
+					})
+				})
+			},
+			adminEdit(row){
+				this.$refs.borrowDia.init('edit',row.refundId);
+			},
+
+
+
+
+
+		}
+	}
+</script>

+ 202 - 0
src/views/jy/borrowMoney/InputNumber.vue

@@ -0,0 +1,202 @@
+<template>
+  <div>
+    <div class="input-number-range" :class="{ 'is-disabled': disabled }">
+      <div class="flex">
+        <div class="from">
+          <el-input
+            ref="input_from"
+            oninput="value=value.replace(/[^\d]/g,'')"
+            v-model="userInputForm"
+            :disabled="disabled"
+            placeholder="最小值"
+            @blur="handleBlurFrom"
+            @focus="handleFocusFrom"
+            @input="handleInputFrom"
+            @change="handleInputChangeFrom"
+          ></el-input>
+        </div>
+        <div class="center">
+          <span>至</span>
+        </div>
+        <div class="to">
+          <el-input
+            ref="input_to"
+            oninput="value=value.replace(/[^\d]/g,'')"
+            v-model="userInputTo"
+            :disabled="disabled"
+            placeholder="最大值"
+            @blur="handleBlurTo"
+            @focus="handleFocusTo"
+            @input="handleInputTo"
+            @change="handleInputChangeTo"
+          ></el-input>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+  export default {
+    name: 'InputNumber',
+
+    props: {
+      // 初始化范围
+      value: { required: true },
+
+      // 是否禁用
+      disabled: {
+        type: Boolean,
+        default: false
+      },
+
+      // 精度参数
+      precision: {
+        type: Number,
+        default: 0,
+        validator (val) {
+          return val >= 0 && val === parseInt(val, 10)
+        }
+      }
+    },
+
+    data () {
+      return {
+        userInputForm: null,
+        userInputTo: null
+      }
+    },
+
+    watch: {
+      value: {
+        immediate: true,
+        handler (value) {
+          /** 初始化范围 */
+          if (value instanceof Array && this.precision !== undefined) {
+            this.userInputForm = typeof value[0] === 'number' ? value[0] : null
+            this.userInputTo = typeof value[1] === 'number' ? value[1] : null
+          }
+        }
+      }
+    },
+
+    methods: {
+      // 根据精度保留数字
+      toPrecision (num, precision) {
+        if (precision === undefined) precision = 0
+        return parseFloat(
+          Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision)
+        )
+      },
+
+      handleBlurFrom (event) {
+        this.$emit('blurfrom', event)
+      },
+
+      handleFocusFrom (event) {
+        this.$emit('focusfrom', event)
+      },
+
+      handleBlurTo (event) {
+        this.$emit('blurto', event)
+      },
+
+      handleFocusTo (event) {
+        this.$emit('focusto', event)
+      },
+
+      handleInputFrom (value) {
+        this.$emit('inputfrom', value)
+      },
+
+      handleInputTo (value) {
+        this.$emit('inputto', value)
+      },
+
+      // from输入框change事件
+      handleInputChangeFrom (value) {
+        // 如果是非数字空返回null
+        if (isNaN(value) || value === '') {
+          this.$emit('input', [null, this.userInputTo])
+          this.$emit('changefrom', this.userInputForm)
+          return
+        }
+
+        // 初始化数字精度
+        this.userInputForm = this.setPrecisionValue(value)
+
+        // 如果from > to 将from值替换成to
+        if (typeof this.userInputTo === 'number') {
+          this.userInputForm =
+            parseFloat(this.userInputForm) <= parseFloat(this.userInputTo)
+              ? this.userInputForm
+              : this.userInputTo
+        }
+        this.$emit('input', [this.userInputForm, this.userInputTo])
+        this.$emit('changefrom', this.userInputForm)
+      },
+
+      // to输入框change事件
+      handleInputChangeTo (value) {
+        // 如果是非数字空返回null
+        if (isNaN(value) || value === '') {
+          this.$emit('input', [this.userInputForm, null])
+          this.$emit('changefrom', this.userInputTo)
+          return
+        }
+
+        // 初始化数字精度
+        this.userInputTo = this.setPrecisionValue(value)
+
+        // 如果to < tfrom 将to值替换成from
+        if (typeof this.userInputForm === 'number') {
+          this.userInputTo =
+            parseFloat(this.userInputTo) >= parseFloat(this.userInputForm)
+              ? this.userInputTo
+              : this.userInputForm
+        }
+        this.$emit('input', [this.userInputForm, this.userInputTo])
+        this.$emit('changeto', this.userInputTo)
+      },
+
+      // 设置成精度数字
+      setPrecisionValue (value) {
+        if (this.precision !== undefined) {
+          const val = this.toPrecision(value, this.precision)
+          return val
+        }
+        return null
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  /*// 取消element原有的input框样式*/
+  ::v-deep .el-input--mini .el-input__inner {
+    border: 0px;
+    margin: 0;
+    padding: 0 15px;
+    background-color: transparent;
+  }
+  .input-number-range {
+    background-color: #fff;
+    /*border: 1px solid #dcdfe6;*/
+    border-radius: 4px;
+  }
+  .flex {
+    display: flex;
+    flex-direction: row;
+    width: 100%;
+    justify-content: center;
+    align-items: center;
+    .center {
+      margin-top: 1px;
+    }
+  }
+  .is-disabled {
+    background-color: #eef0f6;
+    border-color: #e4e7ed;
+    color: #c0c4cc;
+    cursor: not-allowed;
+  }
+</style>

+ 452 - 0
src/views/jy/borrowMoney/RefundForm.vue

@@ -0,0 +1,452 @@
+<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
+	<div>
+		<el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="status === 'audit' || status === 'taskFormDetail'"
+				 label-width="160px" @submit.native.prevent>
+			<el-divider content-position="left"><i class="el-icon-document"></i>
+				借款申请
+			</el-divider>
+			<el-row  :gutter="15">
+				<el-col :span="12">
+					<el-form-item label="还款人" prop="createName"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.createName"></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="还款时间" prop="createTime"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.createTime"></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="还款金额(小写)" prop="refundLower"
+								  :rules="[{required: true, message:'请输入还款金额(小写)', trigger:'blur'}]">
+						<el-input v-on:input="inputForm.refundLower=inputForm.refundLower.replace(/[^\d.]/g,'')
+							  .replace(/^\./g,'')
+							  .replace(/\.{2,}/g,'.')
+							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
+							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')" @blur="convert(this.inputForm.refundLower)" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" placeholder="请输入还款金额" v-model="inputForm.refundLower" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="还款金额(大写)" prop="refund"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.refund"></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="12">
+					<el-form-item label="剩余借款金额" prop="finalMoney"
+								  :rules="[]">
+						<el-input :disabled="true" v-model="inputForm.finalMoney"></el-input>
+					</el-form-item>
+				</el-col>
+			</el-row>
+		</el-form>
+	</div>
+</template>
+
+<script>
+	import XEUtils from 'xe-utils'
+	import BorrowService from '@/api/jy/BorrowService'
+	import { ElDatePicker } from 'element-plus';
+	import CommonApi from '@/api/cw/common/CommonApi'
+	export default {
+		props: {
+			businessId: {
+				type: String,
+				default: ''
+			},
+			formReadOnly: {
+				type: Boolean,
+				default: false
+			},
+			status: {
+				type: String,
+				default: ''
+			}
+		},
+		data () {
+			return {
+				title: '',
+				method: '',
+				loading: false,
+				inputForm: {
+					id: '',
+					no: '',
+					createById: '',
+					createName: this.$store.state.user.name,
+					createTime: this.moment(new Date()).format('YYYY-MM-DD'),
+					reason: '',
+					refundLower:'', // 还款金额小写
+					moneyLower:'', // 借款金额小写
+					refund:'', //借款金额大写
+					procInsId:'',
+					status:'',
+					finalMoney:'',
+					endMoney:''
+				},
+				baseKey: '',
+				keyWatch: '',
+				dateList:[]
+			}
+		},
+		BorrowService:null,
+		CommonApi:null,
+		created () {
+			console.log('jld ')
+			this.borrowService=new BorrowService()
+			this.commonApi = new CommonApi()
+		},
+		mounted () {
+		},
+		activated () {
+		},
+		components: {
+			ElDatePicker
+		},
+		computed: {
+			bus: {
+				get () {
+					return this.businessId
+				},
+				set (val) {
+					this.businessId = val
+				}
+			}
+		},
+		watch: {
+			'keyWatch': {
+				handler (newVal) {
+					console.log('几里路')
+					if (this.bus) {
+						if (this.bus !== 'false') {
+							this.init('', this.bus)
+						}
+					} else {
+						this.$nextTick(() => {
+							this.$refs.inputForm.resetFields()
+						})
+					}
+				}
+			},
+			'loading': {
+				handler (newVal) {
+					this.$emit('changeLoading', newVal)
+				}
+			}
+		},
+		methods: {
+			getKeyWatch(keyWatch) {
+				this.keyWatch = keyWatch
+			},
+			init(method, id) {
+				this.method = method
+				this.inputForm={
+					id: '',
+					no: '',
+					createById: this.$store.state.user.id,
+					createName: this.$store.state.user.name,
+					createTime: this.moment(new Date()).format('YYYY-MM-DD'),
+					reason: '',
+					refundLower:'', // 还款金额小写
+					refund:'', //还款金额大写
+					procInsId:'',
+					finalMoney:'',
+					moneyLower:'', // 借款金额小写
+					endMoney:''
+				}
+				this.inputForm.id = id
+				this.loading = false
+				this.$nextTick(() => {
+					this.$refs.inputForm.resetFields()
+					this.loading = true
+					if (this.commonJS.isNotEmpty(this.inputForm.id)) {
+						console.log('this.inputForm.id', this.inputForm.id)
+						this.borrowService.queryById(this.inputForm.id).then((data)=>{
+							this.inputForm = this.recover(this.inputForm, data)
+							this.inputForm.id=data.refundId
+							if (this.commonJS.isEmpty(this.inputForm.createName)){
+								this.inputForm.createName=this.$store.state.user.name
+							}
+							if (this.commonJS.isEmpty(this.inputForm.officeName)){
+								this.inputForm.officeName=this.$store.state.user.office.name							}
+							if (this.commonJS.isEmpty(this.inputForm.createTime)){
+								this.inputForm.createTime=this.moment(new Date()).format('YYYY-MM-DD')
+							}
+							this.inputForm.endMoney=data.finalMoney
+						})
+						this.loading = false
+					}
+				})
+			},
+			saveForm(callback) {
+				this.doSubmit('save', callback)
+			},
+			startForm(callback) {
+				this.loading = true
+				if (this.commonJS.isNotEmpty(this.inputForm.id)) {
+					this.borrowService.queryById(this.inputForm.id).then((data) => {
+						if (data.refundStatus !== '0' && data.refundStatus !== '1' && data.refundStatus !== '3' && data.refundStatus !== '5') { // 审核状态不是“未发起”或“暂存”或“撤回”,就弹出提示
+							this.loading = false
+							this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+							throw new Error()
+						} else {
+							this.doSubmit('start', callback)
+						}
+					})
+				} else {
+					this.doSubmit('start', callback)
+				}
+			},
+			async agreeForm(callback) {
+				console.log('进入方法')
+				this.loading = true
+				await this.borrowService.queryById(this.inputForm.id).then((data) => {
+					if (data.refundStatus !== '2' ) { // status的值不等于“审核中”,就弹出提示
+						this.loading = false
+						this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+						throw new Error()
+					} else {
+						this.inputForm.status= '5'
+						let param = {status: this.inputForm.status, id: this.inputForm.id}
+						this.borrowService.updateRefundById(param).then(() => {
+							callback(data.businessTable, data.businessId, this.inputForm)
+							this.loading = false
+						}).catch(() => {
+							this.loading = false
+						})
+					}
+				})
+			},
+			reapplyForm(callback) {
+				this.loading = true
+				this.borrowService.queryById(this.inputForm.id).then((data) => {
+					if (data.refundStatus !== '4') { // 审核状态不是“驳回”,就弹出提示
+						this.loading = false
+						this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+						throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+					} else {
+						this.doSubmit('reapply', callback)
+					}
+				})
+			},
+			// 表单提交
+			async doSubmit(status, callback) {
+				this.loading = true
+				console.log('5',this.inputForm)
+				if (status === 'save') {
+					// 暂存
+					this.loading = true
+					this.inputForm.status = '1'
+					this.inputForm.createTime=''
+					this.borrowService.saveRefund(this.inputForm).then((data) => {
+						callback(data.businessTable, data.businessId, this.inputForm)
+						this.loading = false
+					}).catch(() => {
+						this.loading = false
+					})
+					return
+				} else if (status === 'start') {
+					if (this.commonJS.isEmpty(this.inputForm.reason)) {
+						this.$message.error('请输入借款用途')
+						this.loading = false
+					}
+					if (this.commonJS.isEmpty(this.inputForm.moneyLower)) {
+						this.$message.error('请输入借款金额')
+						this.loading = false
+					}
+					this.inputForm.createTime=''
+					// 送审  待审核
+					this.inputForm.status = '2'
+				} else if (status === 'agree') {
+					this.inputForm.status= '5'
+				} else if (status === 'reapply') {
+					this.inputForm.status = '2'
+				}
+				this.$refs['inputForm'].validate((valid) => {
+					if (valid) {
+						this.loading = true
+						console.log('form',this.inputForm)
+						this.borrowService.saveRefund(this.inputForm).then((data) => {
+							callback(data.businessTable, data.businessId, this.inputForm)
+							this.$refs.inputForm.resetFields()
+							this.loading = false
+						}).catch(() => {
+							this.$refs.inputForm.resetFields()
+							this.loading = false
+						})
+					} else {
+						this.loading = false
+					}
+				})
+			},
+			close() {
+				this.inputForm = {
+					id:'',
+					projectList:[],
+					name:'',
+					no:'',
+					projectLeader:'',
+					projectCreateDate:'',
+					createById:'',
+					createByName:'',
+					createDate:'',
+					remarks:'',
+					files: [], // 附件信息
+					types:[], //用印类型
+					number:'', //用印份数
+					projectId:'',
+				}
+				this.visible = false
+			},
+			async updateStatusById(type, callback) {
+				this.loading = true
+				if (type === 'reject' || type === 'reback') {
+					this.borrowService.queryById(this.inputForm.id).then((data) => {
+						if (data.refundStatus !== '2') { // status的值不等于“审核中”,就弹出提示
+							this.loading = false
+							this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+							throw new Error()
+						} else {
+							// if (type === 'agree') {
+							//   // 同意
+							//   this.inputForm.status = '5'
+							// }
+							if (type === 'reject') {
+								// 驳回
+								this.inputForm.status = '4'
+							}
+							if (type === 'reback') {
+								// 撤回
+								this.inputForm.status = '3'
+							}
+							if (type === 'reject' || type === 'reback') {
+								let param = {status: this.inputForm.status, id: this.inputForm.id}
+								this.borrowService.updateRefundById(param).then(() => {
+									this.loading = false
+									callback()
+								})
+							}
+						}
+					})
+				} else if (type === 'hold') {
+					this.borrowService.queryById(this.inputForm.id).then((data) => {
+						if (data.refundStatus !== '4') { // status的值不等于“驳回”就弹出提示
+							this.loading = false
+							this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
+							throw new Error()
+						} else {
+							// 终止
+							let param = {status: '1', id: this.inputForm.id}
+							this.borrowService.updateRefundById(param).then(() => {
+								this.loading = false
+								callback()
+							})
+						}
+					})
+				}
+
+			},
+			convert(money){
+				if (!money) { return this.inputForm.refund='';}
+				//数字的汉字数组
+				let numberCNList = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
+				//数字的基础单位汉字数组
+				let numberBaseUnit = ['', '拾', '佰', '仟'];
+				//数字的高级单位汉字数组
+				let numberHighUnit = ['', '万', '亿', '兆'];// 一兆等于一万亿
+				//小数部分单位汉字数组
+				let floatUnit = ['角', '分', '毫', '厘'];
+				//整数金额时后面跟的字符
+				let integerLastCN = '整';
+				//整数后的单位汉字
+				let integerLastUnit = '元';
+				//最大处理的数字
+				let maxNum = 999999999999999.9999;
+				//以小数点拆分金额产生的数组
+				let decimalPointSplitList;
+				//金额整数部分
+				let integerNum;
+				//金额小数部分
+				let decimalNum;
+				//返回的大写金额
+				let moneyCNString = '';
+				money = parseFloat(money);// 转为数字
+				if(typeof money !== 'number' || isNaN(money)){this.$message('检测到非数字字符');return '';}
+				//超出最大处理数字
+				if (money >= maxNum) {this.$message('超出最大处理数字');return '';}
+				// 等于0时 返回零元整
+				if (money === 0) {
+					moneyCNString = numberCNList[0] + integerLastUnit + integerLastCN;
+					return moneyCNString;
+				}
+				//转换为字符串
+				money = money.toString();
+				/******金额数字的处理,转为字符串,判断有没有小数位,获取整数部分和小数部分*******/
+				if (money.indexOf('.') === -1) {// 如果没有小数点
+					integerNum = money;// money就都等于整数部分,小数部分为空
+					decimalNum = '';
+				} else {// 有小数点
+					decimalPointSplitList = money.split('.');// 以小数点拆分数组
+					if(decimalPointSplitList[1].length > 4)this.$message('金额精确仅支持到厘');
+					integerNum = decimalPointSplitList[0];// 整数部分
+					decimalNum = decimalPointSplitList[1].substr(0, 4);// 小数部分只支持4位
+				}
+				/******整数部分处理*******/
+				if (parseInt(integerNum, 10) > 0) {// 以十进制转为int类型 大于零
+					let zeroCount = 0;// 记录零的个数
+					for (let i = 0; i < integerNum.length; i++) {
+						let p = integerNum.length - 1 - i;// 当前数字的位数, 比如10000 ,1的位数是4 , 10001000,第一个1的位数是7,第二个1的位数是3
+						console.log(p,integerNum[i]);
+						let q = p / 4;// 当前数字位数 除以 4 商0余1,则值为0,控制其高级单位
+						let m = p % 4;// 取余,比如1%4 商0余1 ,则值为1, 控制其基础单位
+						// 如果当前数字等于零 则++
+						if (integerNum[i] === '0') {zeroCount++;}
+						// 否则当前数字不等于零时
+						else {
+							// 如果记录的零的个数大于0 返回结果中加一个汉字零
+							if (zeroCount > 0) {moneyCNString += numberCNList[0];}
+							//把零的个数归零,重新计算零的个数
+							zeroCount = 0;
+							// 然后把返回结果 加上 当前数字的汉字以及其基础单位
+							moneyCNString += numberCNList[parseInt(integerNum[i])] + numberBaseUnit[m];
+						}
+						// 如果当前数字所在位数取余4等于0时,那么除以4一定是整数,并且记录的零的个数小于4个,则拼接当前位数对应的高级单位
+						if (m === 0 && zeroCount < 4) {moneyCNString += numberHighUnit[q];}
+					}
+					moneyCNString += integerLastUnit;// 整数部分结束后 拼接上整数部分单位 元
+				}
+				/******小数部分处理 --- 小数部分只考虑是否有值,以及当前值所在单位,没有零的概念,所以只需拼接当前值对应的汉字,以及当前值的单位即可*******/
+				if (decimalNum !== '') {
+					for (let i = 0; i < decimalNum.length; i++) {
+						if (decimalNum[i] !== '0') {// 如果当前数字不等于零 则加上当前数字的汉字 以及 其小数单位
+							moneyCNString += numberCNList[Number(decimalNum[i])] + floatUnit[i];
+						}
+					}
+				}else {// 如果没有小数部分则加上汉字 整
+					moneyCNString += integerLastCN;
+				}
+
+				this.inputForm.refund= moneyCNString;
+				this.inputForm.finalMoney=parseFloat(this.inputForm.moneyLower-money)
+				if (this.inputForm.finalMoney <0){
+					this.$message.error("还款金额不正确")
+					throw new Error()
+					this.inputForm.refundLower=''
+					this.inputForm.finalMoney=this.inputForm.endMoney
+				}
+			}
+
+
+		}
+
+	}
+</script>
+<style scoped>
+	/deep/ .el-input-number .el-input__inner {
+		text-align: left;
+	}
+	/deep/ .vxe-footer--row .vxe-footer--column:nth-child(1) .vxe-cell--item {
+		font-weight:700;
+	}
+</style>