diff --git a/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.js b/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.js new file mode 100644 index 00000000..c246b4cf --- /dev/null +++ b/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.js @@ -0,0 +1,468 @@ +import config from '../../../config' +import { + reject, + complete, + returnTask, + returnList, + readDeployNotes, + findCommentByProcInsId +} from '../../../api/flowable' +import { + editApproveStatus, + findProSubDeptsInfoById, + findProSubDeptsUserInfoById +} from '../../../api/project' +import { + getToken +} from '../../../utils/auth' +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + options: {}, + active: 0, + stepList: [], + rejectNode: false, + activeName: "", + flowRecordList: [], + subDeptData: { + subDeptInfos: {} + }, + subDeptUserData: { + userInfos: {}, + }, + comment: "", + targetKey: "", + targetKeyList: [], + imgBaseUrl: config.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + options: options + }) + this.findFlowNodes(); + this.findApplyDataInfo(); + this.findCommentByProcInsId(); + this.initTargetKeyList(); + }, + + //查询工作流节点 + findFlowNodes() { + readDeployNotes(this.data.options.deployId).then(res => { + let list = [{ + text: '开始' + }]; + let index = this.data.active; + res.data.forEach((item, idx) => { + if (this.data.options.taskName == item.name) { + index = idx + 1; + } + list.push({ + text: item.name.substr(0,5), + desc: '' + }); + }); + list.push({ + text: '结束' + }); + this.setData({ + active: index, + stepList: list + }) + }); + }, + + //查询审批日志 + findCommentByProcInsId() { + findCommentByProcInsId({ + procInsId: this.data.options.procInsId + }).then(res => { + this.setData({ + flowRecordList: res.data + }) + let list = []; + res.data.forEach((item, idx) => { + if (idx == 1 && (item.commentType == "3" || item.commentType == "2")) { + this.setData({ + rejectNode: true + }) + } + if (item.deleteReason) { + item.deleteReason = this.getDeleteReason(item.deleteReason); + } + if (item.duration) { + item.duration = app.getDurationDate(item.duration); + } + list.push(item); + }) + this.setData({ + flowRecordList: list + }) + }); + }, + + //查询审批表单参数 + findApplyDataInfo() { + findProSubDeptsUserInfoById(this.data.options.businessKey).then(res => { + if (res.data.eduFilePath) { + let files = res.data.eduFilePath.split('/'); + res.data.eduFileName = files[files.length - 1]; + } + if(res.data.userInfos){ + res.data.userInfos = JSON.parse(res.data.userInfos); + } + this.setData({ + subDeptUserData: res.data + }) + //查询单位信息 + this.getSubDeptInfo(res.data.subDeptId); + }) + }, + + //查询审批表单参数 + getSubDeptInfo(subDeptId) { + findProSubDeptsInfoById(subDeptId).then(res => { + res.data.subDeptInfos = JSON.parse(res.data.subDeptInfos); + this.setData({ + subDeptData: res.data + }) + }) + }, + + + //初始化退回节点 + initTargetKeyList() { + returnList({ + taskId: this.data.options.taskId + }).then(res => { + if (res.data && res.data.length > 0) { + let list = []; + res.data.forEach(item => { + list.push({ + id: item.id, + text: item.name + }) + }) + this.setData({ + targetKey: list[0].id, + targetKeyList: list + }) + } + }); + }, + + //退回 + onBack() { + let { + options, + comment + } = this.data; + //数据效验 + if (!options.taskId) { + app.toast("数据异常,请刷新页面重试!") + return; + } + if (!comment) { + app.toast("请填写审批意见!") + return false; + } + let that = this; + //弹出确认 + wx.showModal({ + title: '提示', + content: '是否确认审批驳回?', + success: function (sm) { + if (sm.confirm) { + that.submitBackTask(); + } + } + }) + }, + + /** + * 提交退回任务 + */ + submitBackTask() { + let { + options, + comment, + targetKeyList + } = this.data; + returnTask({ + taskId: options.taskId, + targetKey: targetKeyList[0].id, + comment + }).then(res => { + if (res.code == 200) { + editApproveStatus(this.data.options.businessKey); + app.toast("驳回申请成功!") + setTimeout(() => { + this.returnToPage(); + }, 500) + } + }); + }, + + //通过 + onPass() { + let { + options, + comment + } = this.data; + //数据效验 + if (!options.taskId) { + app.toast("数据异常,请刷新页面重试!") + return; + } + if (comment == "") { + app.toast("请填写审批意见!") + return; + } + let that = this; + //弹出确认 + wx.showModal({ + title: '提示', + content: '是否确认审批通过?', + success: function (sm) { + if (sm.confirm) { + that.submitPassTask(); + } + } + }) + }, + + /** + * 提交审核结果 + */ + submitPassTask() { + let { + options, + procInsId, + comment + } = this.data; + complete({ + taskId: options.taskId, + instanceId: procInsId, + comment + }).then(res => { + if (res.code == 200) { + app.toast("申请审批通过成功!") + setTimeout(() => { + this.returnToPage(); + }, 500) + } + }); + }, + + //驳回 + onReject() { + let { + taskId, + procInsId, + comment + } = this.data; + //数据效验 + if (!taskId || !procInsId) { + app.toast("数据异常,请刷新页面重试!") + return; + } + if (comment == "") { + app.toast("请填写审批意见!") + return; + } + let that = this; + //弹出确认 + wx.showModal({ + title: '提示', + content: '是否确认审批驳回?', + success: function (sm) { + if (sm.confirm) { + that.submitRejectTask(); + } + } + }) + }, + + /** + * 提交流程驳回 + */ + submitRejectTask() { + let { + taskId, + procInsId, + comment + } = this.data; + reject({ + taskId, + instanceId: procInsId, + comment + }).then(res => { + if (res.code == 200) { + app.toast("驳回申请流程成功!") + setTimeout(() => { + this.returnToPage(); + }, 500) + } + }); + }, + + //申请说明 + commentInput: function (options) { + this.data.comment = options.detail.value; + }, + + // 手风琴 + onChange(event) { + this.setData({ + activeName: event.detail, + }); + }, + + /** + * 获取驳回节点 + * @param {*} val + */ + getDeleteReason(val) { + val = val.replace("Change activity to ", ""); + let flowRecordList = this.data.flowRecordList; + for (let i = 0; i < flowRecordList.length; i++) { + if (flowRecordList[i].taskDefKey == val) { + return "驳回至" + flowRecordList[i].taskName; + } + } + }, + + //终止原因 + commentblur: function (options) { + this.data.comment = options.detail.value; + }, + + //展示图片 + showImg: function (e) { + let paths = e.target.dataset.set; + let path = []; + paths.split(',').forEach(url => { + path.push(config.baseImgUrl + url); + }); + wx.previewImage({ + urls: path, + current: path[0] + }) + }, + + /** + * 下载并打开文档 + * @param {*} e + */ + downFile: function (e) { + let path = this.data.subDeptUserData.eduFilePath; + wx.downloadFile({ + // 示例 url,并非真实存在 + url: config.baseUrl + '/file/download?fileName=' + path, + header: { + 'Authorization': 'Bearer ' + getToken() + }, + success: function (res) { + const filePath = res.tempFilePath + let fpt = path.split("."); + wx.openDocument({ + filePath: filePath, + fileType: fpt[fpt.length - 1], + success: function (res) { + console.log('打开文档成功') + }, + fail: function (res) { + console.log(res) + } + }) + } + }) + }, + + //选择退回节点 + onSelectTargetKey(e) { + this.setData({ + targetKey: e.detail.id, + backName: e.detail.name + }) + }, + + /** + * 返回页面 + */ + returnToPage: function () { + if (wx.getStorageSync('nav-types') == "depts") { + wx.redirectTo({ + url: '../subDepts/index', + }) + } else if (wx.getStorageSync('nav-types') == "users") { + wx.redirectTo({ + url: '../subDeptsUsers/index', + }) + } + }, + + /** + * 修改申请 + */ + onEditApply: function () { + wx.redirectTo({ + url: `../editTask/index?deployId=${this.data.options.deployId}&procInsId=${this.data.options.procInsId}&nickName=${this.data.options.nickName}&deptName=${this.data.options.deptName}&procDefName=${this.data.options.procDefName}&taskId=${this.data.options.taskId}&taskName=${this.data.options.taskName}&category=${this.data.options.category}&projectName=${this.data.options.projectName}&businessKey=${this.data.options.businessKey}&businessKeyParName=${this.data.options.businessKeyParName}&businessDeptId=${this.data.options.businessDeptId}&startUserId=${this.data.options.startUserId}`, + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.json b/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.json new file mode 100644 index 00000000..4cd33ca1 --- /dev/null +++ b/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "van-collapse": "@vant/weapp/collapse", + "van-collapse-item": "@vant/weapp/collapse-item", + "van-steps": "@vant/weapp/steps/index" + }, + "navigationStyle":"custom" +} \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.wxml b/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.wxml new file mode 100644 index 00000000..8c6327a0 --- /dev/null +++ b/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.wxml @@ -0,0 +1,347 @@ + + + + + + + 返回 + + + + 流程申请详情 + + + + + + + + + + + + + + + + {{(flowRecordList.length-index) < 10 ?'0'+(flowRecordList.length-index):(flowRecordList.length-index)}} + {{item.taskName}} + {{item.commentResult}} + {{item.commentResult}} + {{item.commentResult}} + {{item.commentResult}} + {{item.commentResult}} + + + + + + 办理用户:{{item.assigneeName}} + + + 办理单位:{{item.deptName}} + + + 候选办理:{{item.candidate}} + + + 驳回节点:{{item.deleteReason}} + + + 接收时间:{{item.startTime}} + + + 处理时间:{{item.endTime}} + + + 处理耗时:{{item.duration}} + + + 处理意见:{{item.message}} + + + + + + + + + + {{subDeptData.projectName}} + + + + + + 单位类型 + {{subDeptData.subDeptTypeName}} + + + + + 单位名称 + {{subDeptData.subDeptName}} + + + + + 信用代码 + {{subDeptData.subDeptCode}} + + + + + 营业执照 + + + + + + + + + + + + 法人姓名 + {{subDeptData.subDeptInfos.legalPerson}} + + + + + 法人身份证 + {{subDeptData.subDeptInfos.legalPersonCard}} + + + + + 法人证件 + + + + + + + + + + + + + 进入场地时间 + {{subDeptData.useDates}} + + + + + 计划开工时间 + {{subDeptData.startWorkDates}} + + + + + 计划完工时间 + {{subDeptData.endWorkDates}} + + + + + 合同约定范围 + {{subDeptData.contractInfos}} + + + + + + 委托代理人 + 人员姓名 + + {{subDeptUserData.userName}} + + + + + + 代理人身份证 + 身份证号码 + + {{subDeptUserData.cardCode}} + + + + + + 工种岗位 + + {{subDeptUserData.craftPostName}} + + + + + + 工种班组 + + {{subDeptUserData.subDeptGroupName}} + + + + + 民族 + {{subDeptUserData.userInfos.nation}} + + + + + 籍贯 + {{subDeptUserData.userInfos.nativePlace}} + + + + + 详细地址 + {{subDeptUserData.userInfos.address}} + + + + + + 代理人证件 + 人员证件照 + + + + + + + + + + + + + + 花名册近照 + + + + + + + + + + + + 单位委托书 + + + + + + + + + + + + 联系电话 + {{subDeptUserData.userPhone}} + + + + + 紧急联系人 + {{subDeptUserData.userInfos.emergencyContact}} + + + + + 紧急联系电话 + {{subDeptUserData.userInfos.contactPhone}} + + + + + 开户行名称 + {{subDeptUserData.userInfos.bankName}} + + + + + 开户行网点 + {{subDeptUserData.userInfos.bankOffice}} + + + + + 工资银行卡号 + {{subDeptUserData.userInfos.bankCardNo}} + + + + 高血压、心脏病等基础身体健康问题 + + + + + + + + 严重呼吸系统疾病、严重心脑血管疾病、肝肾疾病、恶性肿瘤以及药物无法有效控制的高血压和糖尿病等基础性病症状征兆 + + + + + + + + + 安全承诺书 + + + 点击查看安全承诺书 + + + + + + + + + + 审批意见 + +