diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/FundsApplyController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/FundsApplyController.cs index d9d239d80..62a9369da 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/FundsApplyController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Controllers/FundsApplyController.cs @@ -136,9 +136,18 @@ namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers { FundsApplyEntity entity = strEntity.ToObject(); List detailList = fundsApplyDetailList.ToObject>(); - if (entity.EnCode.Length > 15) + var code = entity.EnCode; + var savecode = fundsApplyIBLL.SaveCode(entity.EnCode, keyValue); + entity.EnCode = savecode; + var encode = savecode.Substring(13).ToInt(); + if (encode > 99) { - return Fail("保存失败,经费开支单号今日数量已超上限,请明日提交!"); + return Fail("保存失败,经费开支单今日数量已超上限,请您明日编辑!"); + } + if (code != entity.EnCode) + { + fundsApplyIBLL.SaveEntity(keyValue, entity, detailList); + return Success("保存成功,经费开支申报单号已重复,系统已为您自动变更!"); } fundsApplyIBLL.SaveEntity(keyValue, entity, detailList); return Success("保存成功!"); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js index afe703ac6..da19f9b6b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js @@ -196,6 +196,11 @@ var bootstrap = function ($, learun) { if (!$('body').lrValidform()) { return false; } + var datas = $('#FundsApplyDetail').jfGridGet('rowdatas'); + if (datas == null || datas.length == 0) { + learun.alert.warning("经费开支申报单未包含明细!请先新增明细!"); + return false; + } return true; }; // 保存数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs index db8ecfb68..35e9c16bc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs @@ -129,9 +129,19 @@ namespace Learun.Application.WebApi ReqFormEntity parameter = this.GetReqData(); FundsApplyEntity entity = parameter.strEntity.ToObject(); List detailList = parameter.fundsApplyDetailList.ToObject>(); - if (entity.EnCode.Length > 15) + var code = entity.EnCode; + var savecode = fundsApplyIBLL.SaveCode(entity.EnCode, parameter.keyValue); + entity.EnCode = savecode; + + var encode = savecode.Substring(13).ToInt(); + if (encode > 99) + { + return Fail("保存失败,经费开支单今日数量已超上限,请您明日编辑!"); + } + if (code != entity.EnCode) { - return Fail("保存失败,经费开支单号今日数量已超上限,请明日提交!"); + fundsApplyIBLL.SaveEntity(parameter.keyValue, entity, detailList); + return Success("保存成功,经费开支申报单号已重复,系统已为您自动变更!"); } fundsApplyIBLL.SaveEntity(parameter.keyValue, entity, detailList); return Success("保存成功!"); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs index 0b2a99972..2aa086974 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyBLL.cs @@ -114,6 +114,30 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } } + + /// + /// 获取FundsApply表实体数据 + /// + /// 主键 + /// + public string SaveCode(string Code, string keyValue) + { + try + { + return fundsApplyService.SaveCode(Code,keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion #region 提交数据 @@ -165,7 +189,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } - public void ChangeStatusById(string keyValue,int status, string processId) + public void ChangeStatusById(string keyValue, int status, string processId) { try { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs index 2dc5f4539..af3fbe388 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyIBLL.cs @@ -40,6 +40,11 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem /// /// string GetCode(); + /// + /// 保存判断 + /// + /// + string SaveCode(string Code, string keyValue); #endregion @@ -61,7 +66,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem /// /// /// - void ChangeStatusById(string keyValue,int status, string processId); + void ChangeStatusById(string keyValue, int status, string processId); void ChangeStatusByProcessId(string processId, int status); #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs index 1a3f85156..fe2c7fb7a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/FundsApply/FundsApplyService.cs @@ -160,6 +160,42 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } } } + public string SaveCode(string Code, string keyValue) + { + var result = Code; + var strSql = new StringBuilder(); + strSql.Append(@"select * from FundsApply where 1= 1 and ApplyTime >= '" + DateTime.Now.Date + "' and Encode = '" + Code + "'"); + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()).FirstOrDefault(); + var Codes = "JFKZ_" + CommonHelper.StringTime(); + if (data != null && !string.IsNullOrEmpty(data.EnCode)) + { + if (!string.IsNullOrEmpty(keyValue)) + { + if (data.Id == keyValue) + { + return result; + } + else if (data.Id != keyValue && Code != data.EnCode) + { + var NCode = data.EnCode.Substring(data.EnCode.Length - 2, 2); + result = Codes + (Convert.ToInt32(NCode) + 1).ToString().PadLeft(2, '0'); + } + } + else + { + if (Code == data.EnCode) + { + var NCode = data.EnCode.Substring(data.EnCode.Length - 2, 2); + result = Codes + (Convert.ToInt32(NCode) + 1).ToString().PadLeft(2, '0'); + } + else if (Code != data.EnCode) + { + result = Code; + } + } + } + return result; + } #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/releasetask/single.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/releasetask/single.vue index f8269c91d..0c46e9655 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/releasetask/single.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/nworkflow/releasetask/single.vue @@ -9,7 +9,15 @@ - + + + + + 确定指派 + 取消 + + @@ -43,7 +51,15 @@ export default { level: '0', levelRange: [{ value: '0', text: '普通' }, { value: '1', text: '重要' }, { value: '2', text: '紧急' }], title: '', - needTitle: false + needTitle: false, + + // 指派审核人数据 + modal: false, + userAssignData:{},//收集数据用来判断是否需要审核人 + reviewerListId:'', + reviewerList:[], + submitPostData:{}, + reviewer: [], } }, @@ -61,6 +77,7 @@ export default { this.LOADING('加载表单中…') this.type = type const currentTask = this.GET_PARAM() + this.userAssignData.currentTask = currentTask const { F_Code: code, F_Id: pid } = currentTask // 设置页面标题 @@ -75,6 +92,9 @@ export default { const processId = this.type === 'create' ? this.GUID('-') : pid const processInfo = await this.fetchProcessInfo({ code, processId: this.type === 'create' ? null : processId }) const currentNode = this.getCurrentNode(processInfo) + console.log(processInfo) + + this.userAssignData.currentNode =currentNode // wfForms 的数组成员 t,表示表单数据项(TAB页),t.type 表示类别,注意它是字符串型,用 Number(t.type) 转换 // 为 1 则使用工作流表单,依据它的 .formId @@ -153,7 +173,49 @@ export default { this.TOAST('草稿已保存', 'success') }) }, - + + // 指派审核人 + async userAssign() { + this.modal = false + if(!this.reviewer.length){ + this.TOAST('请选择审核人') + return + } + + // const res = await this.HTTP_POST('learun/adms/newwf/instance', this.submitPostData.formreq, `指派审核人时发生错误`) + // if(!res){ + // return + // } + // delete this.submitPostData.formreq + + const isAgain = this.type === 'again' + // if (!(await this.CONFIRM('提交确认', `确定要${isAgain ? '重新' : ''}发起流程吗?`, true))) { + // return + // } + this.LOADING('正在提交…') + // this.submitPostData.schemeCode = this.submitPostData.code + // delete this.submitPostData.code + // this.submitPostData.title = '' + // this.submitPostData.createUserId = '' + if (this.needTitle) { + this.submitPostData.title = this.title + } + this.submitPostData.level = this.level + this.submitPostData.auditors = JSON.stringify({[this.reviewerListId]:this.reviewer.toString()}) + + const url = isAgain ? 'learun/adms/newwf/againcreate' : 'learun/adms/newwf/create' + const tips = `流程${isAgain ? '重新' : ''}发起失败` + this.HTTP_POST(url, this.submitPostData, tips).then(success => { + this.HIDE_LOADING() + if (!success) { + return + } + this.EMIT('task-list-change') + this.NAV_BACK() + this.TOAST(`流程${isAgain ? '重新' : ''}发起成功`, 'success') + }) + }, + // 发起流程按钮 async submit() { const isAgain = this.type === 'again' @@ -165,6 +227,46 @@ export default { this.CONFIRM('表单验证失败', verifyResult.join('\n')) return } + + const formValue = this.$refs.form.getFormValue() + const postData = await this.getPostData(this.formValue, this.scheme) + + // 判断是否指派审核人 + let isNext = this.userAssignData.currentNode.isNext + Object.assign(this.userAssignData,{ code: 'agree' }) + if (this.userAssignData.next == '2') { + isNext = '1'; + } + if (isNext == '1') { + let params = { + code: this.code, + processId: this.processId, + taskId: this.userAssignData.currentTask.taskId, + nodeId: this.userAssignData.currentNode.id, + operationCode: this.userAssignData.code, + } + this.LOADING('正在获取审核人…') + const userList = await this.HTTP_GET('learun/adms/newwf/auditer', params, `获取审核人时发生错误`) + this.HIDE_LOADING() + if (!userList) { + return + } + + let arr = Object.entries(userList) + this.reviewerListId = arr[0][0] + this.reviewerList = arr[0][1].map(item => { + return { + text: item.Name, + value: item.Id + } + }) + this.submitPostData = postData + if(this.reviewerList.length>1){ + this.modal = true + return + } + } + if (!(await this.CONFIRM('提交确认', `确定要${isAgain ? '重新' : ''}发起流程吗?`, true))) { return @@ -172,8 +274,8 @@ export default { this.LOADING('正在提交…') - const formValue = this.$refs.form.getFormValue() - const postData = await this.getPostData(formValue, this.scheme) + // const formValue = this.$refs.form.getFormValue() + // const postData = await this.getPostData(formValue, this.scheme) if (this.needTitle) { postData.title = this.title }