From 9f800124231dfee211df5b34c01262980d7b8438 Mon Sep 17 00:00:00 2001 From: "lj7788@126.com" Date: Wed, 6 Aug 2025 10:40:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B4=A8=E9=87=8F=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yanzhu-ui-app/miniprogram/api/attendance.js | 35 - yanzhu-ui-app/miniprogram/api/flowable.js | 197 --- .../miniprogram/api/problemmodify.js | 97 -- .../miniprogram/pageage/api/attendance.js | 35 + .../miniprogram/pageage/api/flowable.js | 197 +++ .../miniprogram/pageage/api/problemmodify.js | 97 ++ .../project_flowable/approveTask/index.js | 906 ++++++------- .../project_flowable/detailTask/index.js | 740 +++++----- .../project_flowable/subDepts/index.js | 528 ++++---- .../project_flowable/subDeptsUsers/index.js | 714 +++++----- .../miniprogram/pageage/project_info/index.js | 1190 ++++++++--------- .../miniprogram/pageage/project_more/index.js | 2 +- .../project_problemmodify/add/index.js | 818 +++++------ .../project_problemmodify/check/index.js | 6 +- .../project_problemmodify/draft/index.js | 670 +++++----- .../project_problemmodify/info/index.js | 6 +- .../project_problemmodify/list/index.js | 2 +- .../project_problemmodify/modify/index.js | 556 ++++---- .../pageage/project_quality/index.js | 384 +++--- .../pageage/project_safety/index.js | 384 +++--- .../pageage/project_schedule/list/index.js | 328 ++--- 21 files changed, 3946 insertions(+), 3946 deletions(-) delete mode 100644 yanzhu-ui-app/miniprogram/api/attendance.js delete mode 100644 yanzhu-ui-app/miniprogram/api/flowable.js delete mode 100644 yanzhu-ui-app/miniprogram/api/problemmodify.js create mode 100644 yanzhu-ui-app/miniprogram/pageage/api/attendance.js create mode 100644 yanzhu-ui-app/miniprogram/pageage/api/flowable.js create mode 100644 yanzhu-ui-app/miniprogram/pageage/api/problemmodify.js diff --git a/yanzhu-ui-app/miniprogram/api/attendance.js b/yanzhu-ui-app/miniprogram/api/attendance.js deleted file mode 100644 index 53244cbd..00000000 --- a/yanzhu-ui-app/miniprogram/api/attendance.js +++ /dev/null @@ -1,35 +0,0 @@ -import { - request -} from '../utils/request' - -// 统计劳务人员信息 -export function findSubDeptsUsers(proId) { - return request({ - url: '/manage/attendance/v1/findSubDeptsUsers/'+proId, - method: 'get' - }) -} - -// 统计今日出勤信息 -export function findDaysAttendanceView(proId) { - return request({ - url: '/manage/attendance/v1/findDaysAttendanceView/'+proId, - method: 'get' - }) -} - -// 统计人员出勤信息 -export function findSubDeptsAttendanceView(proId) { - return request({ - url: '/manage/attendance/v1/findSubDeptsAttendanceView/'+proId, - method: 'get' - }) -} - -// 查询人员出勤信息 -export function findUsersAttendanceView(proId) { - return request({ - url: '/manage/attendance/v1/findUsersAttendanceView/'+proId, - method: 'get' - }) -} diff --git a/yanzhu-ui-app/miniprogram/api/flowable.js b/yanzhu-ui-app/miniprogram/api/flowable.js deleted file mode 100644 index 07339ad4..00000000 --- a/yanzhu-ui-app/miniprogram/api/flowable.js +++ /dev/null @@ -1,197 +0,0 @@ -import {request} from '../utils/request' - -// 获取流程申请类型 -export function myDefinitionList(data) { - return request({ - url: '/flowable/businessKey/myDefinitionList', - method: 'get', - data: data - }) -} - -// 启动流程实例 -export function startProcessInstance(data) { - return request({ - url: '/flowable/businessKey/startProcessInstance', - method: 'post', - data: data - }) -} - -// 查询流程节点 -export function readNotes(deployId) { - return request({ - url: '/flowable/businessKey/readNotes/'+deployId, - method: 'get' - }) -} - -// 查询流程节点 -export function readDeployNotes(deployId) { - return request({ - url: '/flowable/businessKey/readDeployNotes/'+deployId, - method: 'get' - }) -} - -// 取消流程申请 -export function stopProcess(data) { - return request({ - url: '/flowable/businessKey/stopProcess', - method: 'post', - data: data - }) -} - -// 撤回流程办理 -export function revokeProcess(data) { - return request({ - url: '/flowable/businessKey/revokeProcess', - method: 'post', - data: data - }) -} - -// 审批任务流程 -export function complete(data) { - return request({ - url: '/flowable/task/complete', - method: 'post', - data: data - }) -} - -// 批量审批任务 -export function batchComplete(data) { - return request({ - url: '/flowable/task/batchComplete', - method: 'post', - data: data - }) -} - -// 驳回任务流程 -export function reject(data) { - return request({ - url: '/flowable/businessKey/reject', - method: 'post', - data: data - }) -} - -// 退回任务流程 -export function returnTask(data) { - return request({ - url: '/flowable/task/return', - method: 'post', - data: data - }) -} - -// 委派任务流程 -export function delegateTask(data) { - return request({ - url: '/flowable/businessKey/delegateTask', - method: 'post', - data: data - }) -} - -// 转办任务流程 -export function assignTask(data) { - return request({ - url: '/flowable/businessKey/assignTask', - method: 'post', - data: data - }) -} - -// 删除流程实例 -export function deleteInstance(instanceId) { - return request({ - url: '/flowable/businessKey/delete/'+instanceId, - method: 'get' - }) -} - -// 获取所有可回退的节点 -export function returnList(data) { - return request({ - url: '/flowable/task/returnList', - method: 'post', - data: data - }) -} - -// 根据流程Id查询操作日志 -export function findCommentByProcInsId(data) { - return request({ - url: '/flowable/businessKey/findCommentByProcInsId', - method: 'get', - data: data - }) -} - - -// 根据条件统计分包单位审批 -export function findMyTask(query) { - return request({ - url: '/flowable/businessKey/findMyTask', - method: 'get', - params: query - }) -} - -// 根据条件统计分包单位审批 -export function quueryCount(query) { - return request({ - url: '/flowable/businessKey/queryCount', - method: 'get', - params: query - }) -} - -// 根据条件查询我的代办任务 -export function myAwaitFlowTaskList(query) { - return request({ - url: '/flowable/businessKey/myAwaitFlowTaskList', - method: 'get', - params: query - }) -} - -// 根据条件查询我的已办任务 -export function myFinishedFlowTaskList(query) { - return request({ - url: '/flowable/businessKey/myFinishedFlowTaskList', - method: 'get', - params: query - }) -} - -// 根据条件查询所有流申请 -export function allInstanceList(data) { - return request({ - url: '/flowable/businessKey/allList', - method: 'get', - data: data - }) -} - -// 根据条件查询所有流申请 -export function myInstanceList(data) { - return request({ - url: '/flowable/businessKey/myList', - method: 'get', - data: data - }) -} - -// 根据条件统计所有流程任务 -export function queryTaskCount(data) { - return request({ - url: '/flowable/businessKey/queryCount', - method: 'get', - data: data - }) -} \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/api/problemmodify.js b/yanzhu-ui-app/miniprogram/api/problemmodify.js deleted file mode 100644 index 3f3dec22..00000000 --- a/yanzhu-ui-app/miniprogram/api/problemmodify.js +++ /dev/null @@ -1,97 +0,0 @@ -import { - request -} from '../utils/request' - -// 查询隐患列表 -export function list(query) { - return request({ - url: '/manage/problemmodify/wxList', - method: 'get', - params: query - }) -} - -// 统计隐患列表 -export function listCount(query) { - return request({ - url: '/manage/problemmodify/wxListCount', - method: 'get', - params: query - }) -} - -// 查询隐患详情 -export function findInfo(id) { - return request({ - url: '/manage/problemmodify/'+id, - method: 'get' - }) -} - -// 查询隐患审批详情 -export function findAuditInfos(id) { - return request({ - url: '/manage/problemmodify/findAuditInfos/'+id, - method: 'get' - }) -} - -// 新增隐患问题 -export function add(data) { - return request({ - url: '/manage/problemmodify', - method: 'post', - data: data - }) -} - -// 新增隐患草稿 -export function addDraft(data) { - return request({ - url: '/manage/problemmodifyDraft/addDraft', - method: 'post', - data: data - }) -} - -// 删除隐患详情 -export function remove(id) { - return request({ - url: '/manage/problemmodify/wxRemove/'+id, - method: 'delete' - }) -} - -// 提交隐患整改 -export function modifyProblemmodify(data) { - return request({ - url: '/manage/problemmodify/modifyProblemmodify', - method: 'post', - data: data - }) -} - -// 提交问题复检 -export function checkProblemmodify(data) { - return request({ - url: '/manage/problemmodify/checkProblemmodify', - method: 'post', - data: data - }) -} - -// 查询我上次提交的隐患信息 -export function findMyLastProblemmodify(proId,type) { - return request({ - url: '/manage/problemmodify/findMyLastProblemmodify/'+proId+'?infoType='+type, - method: 'get' - }) -} - -// 项目分组查询统计 -export function findGroupCountView(proId,type) { - return request({ - url: '/manage/problemmodify/getWxGroupCountView/'+proId+'?infoType='+type, - method: 'get' - }) -} \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/api/attendance.js b/yanzhu-ui-app/miniprogram/pageage/api/attendance.js new file mode 100644 index 00000000..f98db766 --- /dev/null +++ b/yanzhu-ui-app/miniprogram/pageage/api/attendance.js @@ -0,0 +1,35 @@ +import { + request +} from '../../utils/request' + +// 统计劳务人员信息 +export function findSubDeptsUsers(proId) { + return request({ + url: '/manage/attendance/v1/findSubDeptsUsers/' + proId, + method: 'get' + }) +} + +// 统计今日出勤信息 +export function findDaysAttendanceView(proId) { + return request({ + url: '/manage/attendance/v1/findDaysAttendanceView/' + proId, + method: 'get' + }) +} + +// 统计人员出勤信息 +export function findSubDeptsAttendanceView(proId) { + return request({ + url: '/manage/attendance/v1/findSubDeptsAttendanceView/' + proId, + method: 'get' + }) +} + +// 查询人员出勤信息 +export function findUsersAttendanceView(proId) { + return request({ + url: '/manage/attendance/v1/findUsersAttendanceView/' + proId, + method: 'get' + }) +} diff --git a/yanzhu-ui-app/miniprogram/pageage/api/flowable.js b/yanzhu-ui-app/miniprogram/pageage/api/flowable.js new file mode 100644 index 00000000..ced3f427 --- /dev/null +++ b/yanzhu-ui-app/miniprogram/pageage/api/flowable.js @@ -0,0 +1,197 @@ +import { request } from '../../utils/request' + +// 获取流程申请类型 +export function myDefinitionList(data) { + return request({ + url: '/flowable/businessKey/myDefinitionList', + method: 'get', + data: data + }) +} + +// 启动流程实例 +export function startProcessInstance(data) { + return request({ + url: '/flowable/businessKey/startProcessInstance', + method: 'post', + data: data + }) +} + +// 查询流程节点 +export function readNotes(deployId) { + return request({ + url: '/flowable/businessKey/readNotes/' + deployId, + method: 'get' + }) +} + +// 查询流程节点 +export function readDeployNotes(deployId) { + return request({ + url: '/flowable/businessKey/readDeployNotes/' + deployId, + method: 'get' + }) +} + +// 取消流程申请 +export function stopProcess(data) { + return request({ + url: '/flowable/businessKey/stopProcess', + method: 'post', + data: data + }) +} + +// 撤回流程办理 +export function revokeProcess(data) { + return request({ + url: '/flowable/businessKey/revokeProcess', + method: 'post', + data: data + }) +} + +// 审批任务流程 +export function complete(data) { + return request({ + url: '/flowable/task/complete', + method: 'post', + data: data + }) +} + +// 批量审批任务 +export function batchComplete(data) { + return request({ + url: '/flowable/task/batchComplete', + method: 'post', + data: data + }) +} + +// 驳回任务流程 +export function reject(data) { + return request({ + url: '/flowable/businessKey/reject', + method: 'post', + data: data + }) +} + +// 退回任务流程 +export function returnTask(data) { + return request({ + url: '/flowable/task/return', + method: 'post', + data: data + }) +} + +// 委派任务流程 +export function delegateTask(data) { + return request({ + url: '/flowable/businessKey/delegateTask', + method: 'post', + data: data + }) +} + +// 转办任务流程 +export function assignTask(data) { + return request({ + url: '/flowable/businessKey/assignTask', + method: 'post', + data: data + }) +} + +// 删除流程实例 +export function deleteInstance(instanceId) { + return request({ + url: '/flowable/businessKey/delete/' + instanceId, + method: 'get' + }) +} + +// 获取所有可回退的节点 +export function returnList(data) { + return request({ + url: '/flowable/task/returnList', + method: 'post', + data: data + }) +} + +// 根据流程Id查询操作日志 +export function findCommentByProcInsId(data) { + return request({ + url: '/flowable/businessKey/findCommentByProcInsId', + method: 'get', + data: data + }) +} + + +// 根据条件统计分包单位审批 +export function findMyTask(query) { + return request({ + url: '/flowable/businessKey/findMyTask', + method: 'get', + params: query + }) +} + +// 根据条件统计分包单位审批 +export function quueryCount(query) { + return request({ + url: '/flowable/businessKey/queryCount', + method: 'get', + params: query + }) +} + +// 根据条件查询我的代办任务 +export function myAwaitFlowTaskList(query) { + return request({ + url: '/flowable/businessKey/myAwaitFlowTaskList', + method: 'get', + params: query + }) +} + +// 根据条件查询我的已办任务 +export function myFinishedFlowTaskList(query) { + return request({ + url: '/flowable/businessKey/myFinishedFlowTaskList', + method: 'get', + params: query + }) +} + +// 根据条件查询所有流申请 +export function allInstanceList(data) { + return request({ + url: '/flowable/businessKey/allList', + method: 'get', + data: data + }) +} + +// 根据条件查询所有流申请 +export function myInstanceList(data) { + return request({ + url: '/flowable/businessKey/myList', + method: 'get', + data: data + }) +} + +// 根据条件统计所有流程任务 +export function queryTaskCount(data) { + return request({ + url: '/flowable/businessKey/queryCount', + method: 'get', + data: data + }) +} \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/api/problemmodify.js b/yanzhu-ui-app/miniprogram/pageage/api/problemmodify.js new file mode 100644 index 00000000..0bb3d108 --- /dev/null +++ b/yanzhu-ui-app/miniprogram/pageage/api/problemmodify.js @@ -0,0 +1,97 @@ +import { + request +} from '../../utils/request' + +// 查询隐患列表 +export function list(query) { + return request({ + url: '/manage/problemmodify/wxList', + method: 'get', + params: query + }) +} + +// 统计隐患列表 +export function listCount(query) { + return request({ + url: '/manage/problemmodify/wxListCount', + method: 'get', + params: query + }) +} + +// 查询隐患详情 +export function findInfo(id) { + return request({ + url: '/manage/problemmodify/' + id, + method: 'get' + }) +} + +// 查询隐患审批详情 +export function findAuditInfos(id) { + return request({ + url: '/manage/problemmodify/findAuditInfos/' + id, + method: 'get' + }) +} + +// 新增隐患问题 +export function add(data) { + return request({ + url: '/manage/problemmodify', + method: 'post', + data: data + }) +} + +// 新增隐患草稿 +export function addDraft(data) { + return request({ + url: '/manage/problemmodifyDraft/addDraft', + method: 'post', + data: data + }) +} + +// 删除隐患详情 +export function remove(id) { + return request({ + url: '/manage/problemmodify/wxRemove/' + id, + method: 'delete' + }) +} + +// 提交隐患整改 +export function modifyProblemmodify(data) { + return request({ + url: '/manage/problemmodify/modifyProblemmodify', + method: 'post', + data: data + }) +} + +// 提交问题复检 +export function checkProblemmodify(data) { + return request({ + url: '/manage/problemmodify/checkProblemmodify', + method: 'post', + data: data + }) +} + +// 查询我上次提交的隐患信息 +export function findMyLastProblemmodify(proId, type) { + return request({ + url: '/manage/problemmodify/findMyLastProblemmodify/' + proId + '?infoType=' + type, + method: 'get' + }) +} + +// 项目分组查询统计 +export function findGroupCountView(proId, type) { + return request({ + url: '/manage/problemmodify/getWxGroupCountView/' + proId + '?infoType=' + type, + method: 'get' + }) +} \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.js b/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.js index c246b4cf..7207f745 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_flowable/approveTask/index.js @@ -1,468 +1,468 @@ import config from '../../../config' import { - reject, - complete, - returnTask, - returnList, - readDeployNotes, - findCommentByProcInsId -} from '../../../api/flowable' + reject, + complete, + returnTask, + returnList, + readDeployNotes, + findCommentByProcInsId +} from '../../api/flowable' import { - editApproveStatus, - findProSubDeptsInfoById, - findProSubDeptsUserInfoById + editApproveStatus, + findProSubDeptsInfoById, + findProSubDeptsUserInfoById } from '../../../api/project' import { - getToken + 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 + /** + * 页面的初始数据 + */ + data: { + options: {}, + active: 0, + stepList: [], + rejectNode: false, + activeName: "", + flowRecordList: [], + subDeptData: { + subDeptInfos: {} }, + subDeptUserData: { + userInfos: {}, + }, + comment: "", + targetKey: "", + targetKeyList: [], + imgBaseUrl: config.baseImgUrl + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { + /** + * 生命周期函数--监听页面加载 + */ + 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({ - options: options + targetKey: list[0].id, + targetKeyList: list }) - 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() { + } + }); + }, + //退回 + 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/detailTask/index.js b/yanzhu-ui-app/miniprogram/pageage/project_flowable/detailTask/index.js index 68d659c8..7b7920c0 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_flowable/detailTask/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_flowable/detailTask/index.js @@ -1,391 +1,391 @@ import config from '../../../config' import { - readDeployNotes, - findCommentByProcInsId -} from '../../../api/flowable' + readDeployNotes, + findCommentByProcInsId +} from '../../api/flowable' import { - findProSubDeptsInfoById, - findProSubDeptsUserInfoById + findProSubDeptsInfoById, + findProSubDeptsUserInfoById } from '../../../api/project' import { - getToken + getToken } from '../../../utils/auth' const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - options: {}, - active: 100, - rejectNode: false, - stepList: [], - activeName: "", - flowRecordList: [], - subDeptData: { - subDeptInfos: {} - }, - subDeptUserData: { - userInfos: {}, - }, - stopShow: false, - deleteShow: false, - revocationShow: false, - fileNames: [], - minImageList: [], - imgTypes: ["png", "jpg", "jpeg"], - stopBtnShow: false, - comment: "", - imgBaseUrl: config.baseImgUrl + /** + * 页面的初始数据 + */ + data: { + options: {}, + active: 100, + rejectNode: false, + stepList: [], + activeName: "", + flowRecordList: [], + subDeptData: { + subDeptInfos: {} }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - this.setData({ - options: options - }) - this.findFlowNodes(); - this.findApplyDataInfo(); - this.findCommentByProcInsId(); + subDeptUserData: { + userInfos: {}, }, + stopShow: false, + deleteShow: false, + revocationShow: false, + fileNames: [], + minImageList: [], + imgTypes: ["png", "jpg", "jpeg"], + stopBtnShow: false, + comment: "", + imgBaseUrl: config.baseImgUrl + }, - //查询工作流节点 - findFlowNodes() { - readDeployNotes(this.data.options.deployId).then(res => { - let list = [{ - text: '开始' - }]; - let index = this.data.active; - res.data.forEach((item,idx) => { - console.log("this.data.options.taskName",this.data.options.taskName) - console.log("item.name",item.name) - 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 - }) - }); - }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + options: options + }) + this.findFlowNodes(); + this.findApplyDataInfo(); + this.findCommentByProcInsId(); + }, - //查询审批日志 - 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 - }) - }) - }, - - //流程退回 - onStop() { - if (!this.data.stopBtnShow) { - app.toast("请填写终止原因!") - this.setData({ - stopBtnShow: true - }) - return; - } else { - if (this.data.comment == "") { - app.toast("请填写终止原因!") - this.setData({ - stopBtnShow: true - }) - return; - } + //查询工作流节点 + findFlowNodes() { + readDeployNotes(this.data.options.deployId).then(res => { + let list = [{ + text: '开始' + }]; + let index = this.data.active; + res.data.forEach((item, idx) => { + console.log("this.data.options.taskName", this.data.options.taskName) + console.log("item.name", item.name) + if (this.data.options.taskName == item.name) { + index = idx + 1; } - let that = this - //弹出确认 - wx.showModal({ - title: '提示', - content: '是否终止当前流程申请?', - success: function (sm) { - if (sm.confirm) { - that.submitStopProcess(); - } - } - }) - }, - - /** - * 确认撤回 - */ - submitStopProcess() { - stopProcess({ - instanceId: this.data.options.procInsId, - comment: this.data.comment - }).then(res => { - if (res.code == 200) { - app.toast("终止流程申请成功!") - setTimeout(() => { - wx.redirectTo({ - url: '../../index/index', - }) - }, 500) - } + list.push({ + text: item.name.substr(0, 5), + desc: '' }); - }, + }); + list.push({ + text: '结束' + }); + this.setData({ + active: index, + stepList: list + }) + }); + }, - //流程删除 - onDelete() { - let that = this - //弹出确认 - wx.showModal({ - title: '提示', - content: '是否确认删除流程申请?', - success: function (sm) { - if (sm.confirm) { - that.submitDeleteInstance(); - } - } - }) - }, - - /** - * 流程删除 - */ - submitDeleteInstance() { - deleteInstance(this.data.options.procInsId).then(res => { - if (res.code == 200) { - app.toast("删除流程申请成功!") - setTimeout(() => { - wx.redirectTo({ - url: '../../index/index', - }) - }, 500) - } - }); - }, - - //流程撤回 - onRevocation() { - let that = this - //弹出确认 - wx.showModal({ - title: '提示', - content: '是否确认撤回当前任务流程?', - success: function (sm) { - if (sm.confirm) { - that.submitRevokeProcess(); - } - } - }); - }, - - /** - * 流程撤回 - */ - submitRevokeProcess() { - revokeProcess({ - procInsId: this.data.options.procInsId, - instanceId: this.data.options.procInsId, - taskId: this.data.options.taskId - }).then(res => { - if (res.code == 200) { - app.toast("撤回流程申请成功!") - setTimeout(() => { - wx.redirectTo({ - url: '../../index/index', - }) - }, 500) - } - }); - }, - - // 手风琴 - 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; - } + //查询审批日志 + 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 + }) } - }, - - //终止原因 - commentblur: function (options) { - this.data.comment = options.detail.value; - }, - - /** - * 下载并打开文档 - * @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', - }) + 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 + }) + }); + }, - //展示图片 - 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] + //查询审批表单参数 + 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 + }) + }) + }, + + //流程退回 + onStop() { + if (!this.data.stopBtnShow) { + app.toast("请填写终止原因!") + this.setData({ + stopBtnShow: true + }) + return; + } else { + if (this.data.comment == "") { + app.toast("请填写终止原因!") + this.setData({ + stopBtnShow: true }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - + return; + } } + let that = this + //弹出确认 + wx.showModal({ + title: '提示', + content: '是否终止当前流程申请?', + success: function (sm) { + if (sm.confirm) { + that.submitStopProcess(); + } + } + }) + }, + + /** + * 确认撤回 + */ + submitStopProcess() { + stopProcess({ + instanceId: this.data.options.procInsId, + comment: this.data.comment + }).then(res => { + if (res.code == 200) { + app.toast("终止流程申请成功!") + setTimeout(() => { + wx.redirectTo({ + url: '../../index/index', + }) + }, 500) + } + }); + }, + + //流程删除 + onDelete() { + let that = this + //弹出确认 + wx.showModal({ + title: '提示', + content: '是否确认删除流程申请?', + success: function (sm) { + if (sm.confirm) { + that.submitDeleteInstance(); + } + } + }) + }, + + /** + * 流程删除 + */ + submitDeleteInstance() { + deleteInstance(this.data.options.procInsId).then(res => { + if (res.code == 200) { + app.toast("删除流程申请成功!") + setTimeout(() => { + wx.redirectTo({ + url: '../../index/index', + }) + }, 500) + } + }); + }, + + //流程撤回 + onRevocation() { + let that = this + //弹出确认 + wx.showModal({ + title: '提示', + content: '是否确认撤回当前任务流程?', + success: function (sm) { + if (sm.confirm) { + that.submitRevokeProcess(); + } + } + }); + }, + + /** + * 流程撤回 + */ + submitRevokeProcess() { + revokeProcess({ + procInsId: this.data.options.procInsId, + instanceId: this.data.options.procInsId, + taskId: this.data.options.taskId + }).then(res => { + if (res.code == 200) { + app.toast("撤回流程申请成功!") + setTimeout(() => { + wx.redirectTo({ + url: '../../index/index', + }) + }, 500) + } + }); + }, + + // 手风琴 + 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; + }, + + /** + * 下载并打开文档 + * @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', + }) + } + }, + + //展示图片 + 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] + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_flowable/subDepts/index.js b/yanzhu-ui-app/miniprogram/pageage/project_flowable/subDepts/index.js index f6172954..9ed02a1d 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_flowable/subDepts/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_flowable/subDepts/index.js @@ -1,277 +1,277 @@ import config from '../../../config' import { - getToken + getToken } from '../../../utils/auth' import { - quueryCount, - myAwaitFlowTaskList, - myFinishedFlowTaskList, -} from '../../../api/flowable' + quueryCount, + myAwaitFlowTaskList, + myFinishedFlowTaskList, +} from '../../api/flowable' const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - projectId: '', - projectName: '', - initData: {}, - activeState: "dsh", - dshCount: 0, - yshCount: 0, - listData: [], + /** + * 页面的初始数据 + */ + data: { + projectId: '', + projectName: '', + initData: {}, + activeState: "dsh", + dshCount: 0, + yshCount: 0, + listData: [], + pageNum: 1, + pageSize: 10, + total: 0, + imgBaseUrl: config.baseImgUrl + }, + + //项目切换 返回值 + onProjectSelect(e) { + let projectId = e.detail.id; + let projectName = e.detail.text; + app.globalData.useProjectId = projectId; + app.globalData.useProjectName = projectName; + this.onLoad(); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (getToken()) { + this.setData({ pageNum: 1, pageSize: 10, + listData: [], total: 0, - imgBaseUrl: config.baseImgUrl - }, - - //项目切换 返回值 - onProjectSelect(e) { - let projectId = e.detail.id; - let projectName = e.detail.text; - app.globalData.useProjectId = projectId; - app.globalData.useProjectName = projectName; - this.onLoad(); - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - if (getToken()) { - this.setData({ - pageNum: 1, - pageSize: 10, - listData: [], - total: 0, - dshCount: 0, - yshCount: 0, - activeState: "dsh", - projectId: app.globalData.useProjectId, - projectName: app.globalData.useProjectName, - initData: { - id: app.globalData.useProjectId, - text: app.globalData.useProjectName, - } - }); - this.getListData(); - this.getFlowableCount(); - } else { - console.log("未查询到Token...{}...准备重新登录") - wx.redirectTo({ - url: '../../../pages/login/login', - }) + dshCount: 0, + yshCount: 0, + activeState: "dsh", + projectId: app.globalData.useProjectId, + projectName: app.globalData.useProjectName, + initData: { + id: app.globalData.useProjectId, + text: app.globalData.useProjectName, } - }, - - /** - * 查询列表数据 - */ - getListData() { - let params = "pageNum=" + this.data.pageNum + "&pageSize=" + this.data.pageSize + "&activeTags=depts&startProId=" + app.globalData.useProjectId; - if (this.data.activeState == 'dsh') { - myAwaitFlowTaskList(params).then(res => { - if (res.code == "200") { - res.rows.forEach(item => { - item.businessImg = this.data.imgBaseUrl + item.businessImg; - item.durationStr = this.getDurationDate(item.duration); - }); - this.setData({ - total: res.total, - listData: this.data.listData.concat(res.rows) - }) - } - }); - } else { - myFinishedFlowTaskList(params).then(res => { - if (res.code == "200") { - res.rows.forEach(item => { - item.businessImg = this.data.imgBaseUrl + item.businessImg; - item.durationStr = this.getDurationDate(item.duration); - }); - this.setData({ - total: res.total, - listData: this.data.listData.concat(res.rows) - }) - } - }); - } - }, - - /** - * 统计分包单位数据 - */ - getFlowableCount() { - let params = "activeTags=depts&startProId=" + app.globalData.useProjectId; - quueryCount(params).then(res => { - if (res.code == 200) { - this.setData({ - dshCount: res.data.await, - yshCount: res.data.finished - }) - } - }); - }, - - /** - * 统计审批数据 - */ - onScrollToLower() { - let nal = Math.ceil(this.data.total / this.data.pageSize); - if (this.data.pageNum < nal) { - this.setData({ - pageNum: this.data.pageNum + 1 - }); - this.getListData(); - } - }, - - /** - * 切换页签数据 - */ - switchTabJump(e) { - let index = e.currentTarget.dataset.index; - let nav = ""; - if (index == 1) { - nav = 'dsh'; - } else { - nav = 'ysh'; - } - if (nav != this.data.activeState) { - this.setData({ - activeState: nav, - pageNum: 1, - pageSize: 10, - listData: [], - }); - this.getListData(); - } - }, - - /** - * 点击栏目 - * @param {*} e - */ - findDetail(e) { - let { - taskId, - taskName, - procInsId, - deployId, - category, - businessKey, - finishTime - } = e.currentTarget.dataset.set - wx.setStorageSync('nav-types', "depts"); - if (finishTime) { - //详情页面 - wx.redirectTo({ - url: `../detailTask/index?taskId=${taskId}&taskName=${taskName}&procInsId=${procInsId}&deployId=${deployId}&category=${category}&businessKey=${businessKey}` - }) - } else { - //审批页面 - wx.redirectTo({ - url: `../approveTask/index?taskId=${taskId}&taskName=${taskName}&procInsId=${procInsId}&deployId=${deployId}&category=${category}&businessKey=${businessKey}` - }) - } - }, - - /** - * 办理时间计算 - * @param {*} val - */ - getDurationDate(val) { - let day = 0; - let hours = 0; - let min = val; - if (min > 1440) { - day = parseInt(min / 1440); - min = min % 1440; - if (min > 60) { - hours = parseInt(min / 60); - min = min % 60; - } - } else if (min > 60) { - hours = parseInt(min / 60); - min = min % 60; - } - if (day > 0) { - if (day < 10) day = "0" + day; - if (hours < 10) hours = "0" + hours; - if (min < 10) min = "0" + min; - return day + "天" + hours + "小时" + min + "分钟"; - } - if (hours > 0) { - if (hours < 10) hours = "0" + hours; - if (min < 10) min = "0" + min; - return hours + "小时" + min + "分钟"; - } - if (min > 0) { - if (min < 10) min = "0" + min; - return min + "分钟"; - } - if (min == 0) { - return "1分钟"; - } - }, - - /** - * 返回页面 - */ - returnToPage: function () { - wx.redirectTo({ - url: '../../project_more/index', - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - + }); + this.getListData(); + this.getFlowableCount(); + } else { + console.log("未查询到Token...{}...准备重新登录") + wx.redirectTo({ + url: '../../../pages/login/login', + }) } + }, + + /** + * 查询列表数据 + */ + getListData() { + let params = "pageNum=" + this.data.pageNum + "&pageSize=" + this.data.pageSize + "&activeTags=depts&startProId=" + app.globalData.useProjectId; + if (this.data.activeState == 'dsh') { + myAwaitFlowTaskList(params).then(res => { + if (res.code == "200") { + res.rows.forEach(item => { + item.businessImg = this.data.imgBaseUrl + item.businessImg; + item.durationStr = this.getDurationDate(item.duration); + }); + this.setData({ + total: res.total, + listData: this.data.listData.concat(res.rows) + }) + } + }); + } else { + myFinishedFlowTaskList(params).then(res => { + if (res.code == "200") { + res.rows.forEach(item => { + item.businessImg = this.data.imgBaseUrl + item.businessImg; + item.durationStr = this.getDurationDate(item.duration); + }); + this.setData({ + total: res.total, + listData: this.data.listData.concat(res.rows) + }) + } + }); + } + }, + + /** + * 统计分包单位数据 + */ + getFlowableCount() { + let params = "activeTags=depts&startProId=" + app.globalData.useProjectId; + quueryCount(params).then(res => { + if (res.code == 200) { + this.setData({ + dshCount: res.data.await, + yshCount: res.data.finished + }) + } + }); + }, + + /** + * 统计审批数据 + */ + onScrollToLower() { + let nal = Math.ceil(this.data.total / this.data.pageSize); + if (this.data.pageNum < nal) { + this.setData({ + pageNum: this.data.pageNum + 1 + }); + this.getListData(); + } + }, + + /** + * 切换页签数据 + */ + switchTabJump(e) { + let index = e.currentTarget.dataset.index; + let nav = ""; + if (index == 1) { + nav = 'dsh'; + } else { + nav = 'ysh'; + } + if (nav != this.data.activeState) { + this.setData({ + activeState: nav, + pageNum: 1, + pageSize: 10, + listData: [], + }); + this.getListData(); + } + }, + + /** + * 点击栏目 + * @param {*} e + */ + findDetail(e) { + let { + taskId, + taskName, + procInsId, + deployId, + category, + businessKey, + finishTime + } = e.currentTarget.dataset.set + wx.setStorageSync('nav-types', "depts"); + if (finishTime) { + //详情页面 + wx.redirectTo({ + url: `../detailTask/index?taskId=${taskId}&taskName=${taskName}&procInsId=${procInsId}&deployId=${deployId}&category=${category}&businessKey=${businessKey}` + }) + } else { + //审批页面 + wx.redirectTo({ + url: `../approveTask/index?taskId=${taskId}&taskName=${taskName}&procInsId=${procInsId}&deployId=${deployId}&category=${category}&businessKey=${businessKey}` + }) + } + }, + + /** + * 办理时间计算 + * @param {*} val + */ + getDurationDate(val) { + let day = 0; + let hours = 0; + let min = val; + if (min > 1440) { + day = parseInt(min / 1440); + min = min % 1440; + if (min > 60) { + hours = parseInt(min / 60); + min = min % 60; + } + } else if (min > 60) { + hours = parseInt(min / 60); + min = min % 60; + } + if (day > 0) { + if (day < 10) day = "0" + day; + if (hours < 10) hours = "0" + hours; + if (min < 10) min = "0" + min; + return day + "天" + hours + "小时" + min + "分钟"; + } + if (hours > 0) { + if (hours < 10) hours = "0" + hours; + if (min < 10) min = "0" + min; + return hours + "小时" + min + "分钟"; + } + if (min > 0) { + if (min < 10) min = "0" + min; + return min + "分钟"; + } + if (min == 0) { + return "1分钟"; + } + }, + + /** + * 返回页面 + */ + returnToPage: function () { + wx.redirectTo({ + url: '../../project_more/index', + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_flowable/subDeptsUsers/index.js b/yanzhu-ui-app/miniprogram/pageage/project_flowable/subDeptsUsers/index.js index c918a58a..1b322af5 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_flowable/subDeptsUsers/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_flowable/subDeptsUsers/index.js @@ -1,372 +1,372 @@ import config from '../../../config' import { - getToken, - getUserInfo + getToken, + getUserInfo } from '../../../utils/auth' import { - quueryCount, - batchComplete, - myAwaitFlowTaskList, - myFinishedFlowTaskList, -} from '../../../api/flowable' + quueryCount, + batchComplete, + myAwaitFlowTaskList, + myFinishedFlowTaskList, +} from '../../api/flowable' const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - projectId: '', - projectName: '', - initData: {}, - activeState: "dsh", - dshCount: 0, - yshCount: 0, - listData: [], + /** + * 页面的初始数据 + */ + data: { + projectId: '', + projectName: '', + initData: {}, + activeState: "dsh", + dshCount: 0, + yshCount: 0, + listData: [], + pageNum: 1, + pageSize: 10, + total: 0, + checkedAll: false, + showChecked: false, + imgBaseUrl: config.baseImgUrl + }, + + //项目切换 返回值 + onProjectSelect(e) { + let projectId = e.detail.id; + let projectName = e.detail.text; + app.globalData.useProjectId = projectId; + app.globalData.useProjectName = projectName; + this.onLoad(); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (getToken()) { + this.setData({ pageNum: 1, pageSize: 10, + lastDataSize: 10, + listData: [], total: 0, - checkedAll:false, - showChecked:false, - imgBaseUrl: config.baseImgUrl - }, - - //项目切换 返回值 - onProjectSelect(e) { - let projectId = e.detail.id; - let projectName = e.detail.text; - app.globalData.useProjectId = projectId; - app.globalData.useProjectName = projectName; - this.onLoad(); - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - if (getToken()) { - this.setData({ - pageNum: 1, - pageSize: 10, - lastDataSize: 10, - listData: [], - total: 0, - dshCount: 0, - yshCount: 0, - activeState: "dsh", - projectId: app.globalData.useProjectId, - projectName: app.globalData.useProjectName, - initData: { - id: app.globalData.useProjectId, - text: app.globalData.useProjectName, - } - }); - let userInfo = getUserInfo(); - if(userInfo && userInfo.projectUserInfo && userInfo.projectUserInfo.subDeptType=="1"){ - this.setData({ - showChecked:true - }); - } - this.getListData(); - this.getFlowableCount(); - } else { - console.log("未查询到Token...{}...准备重新登录") - wx.redirectTo({ - url: '../../login/login', - }) + dshCount: 0, + yshCount: 0, + activeState: "dsh", + projectId: app.globalData.useProjectId, + projectName: app.globalData.useProjectName, + initData: { + id: app.globalData.useProjectId, + text: app.globalData.useProjectName, } - }, - - /** - * 查询列表数据 - */ - getListData() { - let params = "pageNum=" + this.data.pageNum + "&pageSize=" + this.data.pageSize + "&activeTags=users&startProId=" + app.globalData.useProjectId; - if (this.data.activeState == 'dsh') { - myAwaitFlowTaskList(params).then(res => { - if (res.code == "200") { - res.rows.forEach(item => { - item.businessImg = this.data.imgBaseUrl + item.businessImg; - item.durationStr = this.getDurationDate(item.duration); - }); - this.setData({ - total: res.total, - listData: this.data.listData.concat(res.rows) - }) - } - }); - } else { - myFinishedFlowTaskList(params).then(res => { - if (res.code == "200") { - res.rows.forEach(item => { - item.businessImg = this.data.imgBaseUrl + item.businessImg; - item.durationStr = this.getDurationDate(item.duration); - }); - this.setData({ - total: res.total, - listData: this.data.listData.concat(res.rows) - }) - } - }); - } - }, - - /** - * 统计分包单位数据 - */ - getFlowableCount() { - let params = "activeTags=users&startProId=" + app.globalData.useProjectId; - quueryCount(params).then(res => { - if (res.code == 200) { - this.setData({ - dshCount: res.data.await, - yshCount: res.data.finished - }) - } - }); - }, - - /** - * 统计审批数据 - */ - onScrollToLower() { - let nal = Math.ceil(this.data.total / this.data.pageSize); - if (this.data.pageNum < nal) { - this.setData({ - pageNum: this.data.pageNum + 1 - }); - this.getListData(); - } - }, - - /** - * 切换页签数据 - */ - switchTabJump(e) { - let index = e.currentTarget.dataset.index; - let nav = ""; - if (index == 1) { - nav = 'dsh'; - } else { - nav = 'ysh'; - } - if (nav != this.data.activeState) { - this.setData({ - activeState: nav, - pageNum: 1, - pageSize: 10, - listData: [], - }); - this.getListData(); - } - }, - - /** - * 点击栏目 - * @param {*} e - */ - findDetail(e) { - let { - taskId, - taskName, - procInsId, - deployId, - category, - businessKey - } = e.currentTarget.dataset.set - wx.setStorageSync('nav-types', "users"); - if (this.data.activeState=="ysh") { - //详情页面 - wx.redirectTo({ - url: `../detailTask/index?taskId=${taskId}&taskName=${taskName}&procInsId=${procInsId}&deployId=${deployId}&category=${category}&businessKey=${businessKey}` - }) - } else { - //审批页面 - wx.redirectTo({ - url: `../approveTask/index?taskId=${taskId}&taskName=${taskName}&procInsId=${procInsId}&deployId=${deployId}&category=${category}&businessKey=${businessKey}` - }) - } - }, - - /** - * 选中节点 - * @param {*} e - */ - selectItem: function(event){ - let procInsId = event.currentTarget.dataset.set; - console.log("procInsId==>",procInsId) - let _listData = this.data.listData; - _listData.forEach(item =>{ - if(procInsId==item.procInsId){ - item.selected=!item.selected; - } - }) + }); + let userInfo = getUserInfo(); + if (userInfo && userInfo.projectUserInfo && userInfo.projectUserInfo.subDeptType == "1") { this.setData({ - listData: _listData + showChecked: true }); - }, - - /** - * 全选 - */ - onCheckedAll(){ - let _checked = !this.data.checkedAll; - let _listData = this.data.listData; - _listData.forEach(item =>{ - item.selected=_checked; - }); - this.setData({ - listData: _listData, - checkedAll: _checked - }); - }, - - /** - * 批量 - * 审核通过 - */ - onBatchPass(){ - let taskIds = []; - let _listData = this.data.listData; - _listData.forEach(item =>{ - if(item.selected){ - taskIds.push(item.taskId); - } - }); - if(taskIds.length==0){ - app.toast("请选择要审批的数据项!","none",1500); - return false; - } - let that = this; - //弹出确认 - wx.showModal({ - title: '提示', - content: '是否确认批量审批通过?', - success: function (sm) { - if (sm.confirm) { - that.submitBatchPass(); - } - } - }) - }, - - /** - * 提交审批 - */ - submitBatchPass(){ - let taskIds = []; - let instanceIds = []; - let _listData = this.data.listData; - _listData.forEach(item =>{ - if(item.selected){ - taskIds.push(item.taskId); - instanceIds.push(item.procInsId); - } - }); - let _data = { - 'taskIds':taskIds, - 'instanceIds':instanceIds - } - batchComplete(_data).then(res =>{ - app.toast("批量审批通过成功!"); - this.onLoad(); - }); - }, - - /** - * 办理时间计算 - * @param {*} val - */ - getDurationDate(val) { - let day = 0; - let hours = 0; - let min = val; - if (min > 1440) { - day = parseInt(min / 1440); - min = min % 1440; - if (min > 60) { - hours = parseInt(min / 60); - min = min % 60; - } - } else if (min > 60) { - hours = parseInt(min / 60); - min = min % 60; - } - if (day > 0) { - if (day < 10) day = "0" + day; - if (hours < 10) hours = "0" + hours; - if (min < 10) min = "0" + min; - return day + "天" + hours + "小时" + min + "分钟"; - } - if (hours > 0) { - if (hours < 10) hours = "0" + hours; - if (min < 10) min = "0" + min; - return hours + "小时" + min + "分钟"; - } - if (min > 0) { - if (min < 10) min = "0" + min; - return min + "分钟"; - } - if (min == 0) { - return "1分钟"; - } - }, - - /** - * 返回页面 - */ - returnToPage: function () { - wx.redirectTo({ - url: '../../project_more/index', - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - + } + this.getListData(); + this.getFlowableCount(); + } else { + console.log("未查询到Token...{}...准备重新登录") + wx.redirectTo({ + url: '../../login/login', + }) } + }, + + /** + * 查询列表数据 + */ + getListData() { + let params = "pageNum=" + this.data.pageNum + "&pageSize=" + this.data.pageSize + "&activeTags=users&startProId=" + app.globalData.useProjectId; + if (this.data.activeState == 'dsh') { + myAwaitFlowTaskList(params).then(res => { + if (res.code == "200") { + res.rows.forEach(item => { + item.businessImg = this.data.imgBaseUrl + item.businessImg; + item.durationStr = this.getDurationDate(item.duration); + }); + this.setData({ + total: res.total, + listData: this.data.listData.concat(res.rows) + }) + } + }); + } else { + myFinishedFlowTaskList(params).then(res => { + if (res.code == "200") { + res.rows.forEach(item => { + item.businessImg = this.data.imgBaseUrl + item.businessImg; + item.durationStr = this.getDurationDate(item.duration); + }); + this.setData({ + total: res.total, + listData: this.data.listData.concat(res.rows) + }) + } + }); + } + }, + + /** + * 统计分包单位数据 + */ + getFlowableCount() { + let params = "activeTags=users&startProId=" + app.globalData.useProjectId; + quueryCount(params).then(res => { + if (res.code == 200) { + this.setData({ + dshCount: res.data.await, + yshCount: res.data.finished + }) + } + }); + }, + + /** + * 统计审批数据 + */ + onScrollToLower() { + let nal = Math.ceil(this.data.total / this.data.pageSize); + if (this.data.pageNum < nal) { + this.setData({ + pageNum: this.data.pageNum + 1 + }); + this.getListData(); + } + }, + + /** + * 切换页签数据 + */ + switchTabJump(e) { + let index = e.currentTarget.dataset.index; + let nav = ""; + if (index == 1) { + nav = 'dsh'; + } else { + nav = 'ysh'; + } + if (nav != this.data.activeState) { + this.setData({ + activeState: nav, + pageNum: 1, + pageSize: 10, + listData: [], + }); + this.getListData(); + } + }, + + /** + * 点击栏目 + * @param {*} e + */ + findDetail(e) { + let { + taskId, + taskName, + procInsId, + deployId, + category, + businessKey + } = e.currentTarget.dataset.set + wx.setStorageSync('nav-types', "users"); + if (this.data.activeState == "ysh") { + //详情页面 + wx.redirectTo({ + url: `../detailTask/index?taskId=${taskId}&taskName=${taskName}&procInsId=${procInsId}&deployId=${deployId}&category=${category}&businessKey=${businessKey}` + }) + } else { + //审批页面 + wx.redirectTo({ + url: `../approveTask/index?taskId=${taskId}&taskName=${taskName}&procInsId=${procInsId}&deployId=${deployId}&category=${category}&businessKey=${businessKey}` + }) + } + }, + + /** + * 选中节点 + * @param {*} e + */ + selectItem: function (event) { + let procInsId = event.currentTarget.dataset.set; + console.log("procInsId==>", procInsId) + let _listData = this.data.listData; + _listData.forEach(item => { + if (procInsId == item.procInsId) { + item.selected = !item.selected; + } + }) + this.setData({ + listData: _listData + }); + }, + + /** + * 全选 + */ + onCheckedAll() { + let _checked = !this.data.checkedAll; + let _listData = this.data.listData; + _listData.forEach(item => { + item.selected = _checked; + }); + this.setData({ + listData: _listData, + checkedAll: _checked + }); + }, + + /** + * 批量 + * 审核通过 + */ + onBatchPass() { + let taskIds = []; + let _listData = this.data.listData; + _listData.forEach(item => { + if (item.selected) { + taskIds.push(item.taskId); + } + }); + if (taskIds.length == 0) { + app.toast("请选择要审批的数据项!", "none", 1500); + return false; + } + let that = this; + //弹出确认 + wx.showModal({ + title: '提示', + content: '是否确认批量审批通过?', + success: function (sm) { + if (sm.confirm) { + that.submitBatchPass(); + } + } + }) + }, + + /** + * 提交审批 + */ + submitBatchPass() { + let taskIds = []; + let instanceIds = []; + let _listData = this.data.listData; + _listData.forEach(item => { + if (item.selected) { + taskIds.push(item.taskId); + instanceIds.push(item.procInsId); + } + }); + let _data = { + 'taskIds': taskIds, + 'instanceIds': instanceIds + } + batchComplete(_data).then(res => { + app.toast("批量审批通过成功!"); + this.onLoad(); + }); + }, + + /** + * 办理时间计算 + * @param {*} val + */ + getDurationDate(val) { + let day = 0; + let hours = 0; + let min = val; + if (min > 1440) { + day = parseInt(min / 1440); + min = min % 1440; + if (min > 60) { + hours = parseInt(min / 60); + min = min % 60; + } + } else if (min > 60) { + hours = parseInt(min / 60); + min = min % 60; + } + if (day > 0) { + if (day < 10) day = "0" + day; + if (hours < 10) hours = "0" + hours; + if (min < 10) min = "0" + min; + return day + "天" + hours + "小时" + min + "分钟"; + } + if (hours > 0) { + if (hours < 10) hours = "0" + hours; + if (min < 10) min = "0" + min; + return hours + "小时" + min + "分钟"; + } + if (min > 0) { + if (min < 10) min = "0" + min; + return min + "分钟"; + } + if (min == 0) { + return "1分钟"; + } + }, + + /** + * 返回页面 + */ + returnToPage: function () { + wx.redirectTo({ + url: '../../project_more/index', + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_info/index.js b/yanzhu-ui-app/miniprogram/pageage/project_info/index.js index 47c98d89..963a3a63 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_info/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_info/index.js @@ -1,619 +1,619 @@ import config from '../../config' import { - getToken, - getUserInfo + getToken, + getUserInfo } from '../../utils/auth' import { - findProjectInfo, - findProjectDepts + findProjectInfo, + findProjectDepts } from '../../api/project' import { - findSubDeptsUsers, - findDaysAttendanceView, - findUsersAttendanceView, - findSubDeptsAttendanceView -} from '../../api/attendance' + findSubDeptsUsers, + findDaysAttendanceView, + findUsersAttendanceView, + findSubDeptsAttendanceView +} from '../api/attendance' import { - findMyTask -} from '../../api/flowable' + findMyTask +} from '../api/flowable' const app = getApp(); Page({ - /** - * 页面的初始数据 - */ - data: { - title: "项目详情", - activeNames: ["base"], - //项目信息 - projectInfo: {}, - projectDeptsList: [], - deptTypes: [{ - "name": "建设单位", - "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/WEB_jsdw.png" - }, { - "name": "监理单位", - "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/WEB_jldw.png" - }, { - "name": "设计单位", - "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/WEB_sjdw.png" - }, { - "name": "检测单位", - "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/WEB_jcjg.png" - }, { - "name": "勘察单位", - "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/web_ktdw.png" - }, { - "name": "总包单位", - "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/web_zbdw.png" - }], - active: 0, - projectId: '', - projectName: '', - initData: {}, - aqglDb: 0, - zlglDb: 0, - todoDb: 0, - nactive: 0, - labourData: [{ - name: "管理人员", - total: 0, - unit: "人", - yesMonitor: 180 - }, - { - name: "劳务人员", - yesMonitor: 0, - total: 0, - unit: "人" - }, - { - name: "特殊工种", - yesMonitor: 0, - total: 0, - unit: "人" - }, - ], - labourDataList: [], - labourDays: [{ - name: "管理人员", - total: 0, - unit: "人", - yesMonitor: 180 - }, - { - name: "劳务人员", - yesMonitor: 0, - total: 0, - unit: "人" - }, - { - name: "特殊工种", - yesMonitor: 0, - total: 0, - unit: "人" - }, - ], - labourDaysTotal: 0, - labourImg: "https://szgcwx.jhncidg.com/staticFiles/icon/zgry.png", - labourName: "在岗人员", - labourTotal: 0, - labourTypeList: [{ - name: "在岗人员", - total: 0, - img: "https://szgcwx.jhncidg.com/staticFiles/icon/zgry.png" - }, { - name: "离岗人员", - total: 0, - img: "https://szgcwx.jhncidg.com/staticFiles/icon/rylg.png" - }], - animation: true, - animationData: {}, - labourDatas: { - unit: '人', - legend: ['出勤人数', '当前在岗'], - color: ['#2e6ed0', '#fb9300'], - Xdata: ['01-01', '01-02', '01-03', '01-04', '01-05', '01-06', '01-07'], - Ydata: [ - [0, 0, 0, 0, 0, 0, 0], - [0, 0, 0, 0, 0, 0, 0] - ] - }, - switchChart: false, - attendanceListData: [], - subDeptUserInfo: {}, - imgBaseUrl: config.baseImgUrl + /** + * 页面的初始数据 + */ + data: { + title: "项目详情", + activeNames: ["base"], + //项目信息 + projectInfo: {}, + projectDeptsList: [], + deptTypes: [{ + "name": "建设单位", + "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/WEB_jsdw.png" + }, { + "name": "监理单位", + "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/WEB_jldw.png" + }, { + "name": "设计单位", + "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/WEB_sjdw.png" + }, { + "name": "检测单位", + "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/WEB_jcjg.png" + }, { + "name": "勘察单位", + "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/web_ktdw.png" + }, { + "name": "总包单位", + "iconSrc": "https://xiangguan.sxyanzhu.com/profile/static/icon/web_zbdw.png" + }], + active: 0, + projectId: '', + projectName: '', + initData: {}, + aqglDb: 0, + zlglDb: 0, + todoDb: 0, + nactive: 0, + labourData: [{ + name: "管理人员", + total: 0, + unit: "人", + yesMonitor: 180 }, + { + name: "劳务人员", + yesMonitor: 0, + total: 0, + unit: "人" + }, + { + name: "特殊工种", + yesMonitor: 0, + total: 0, + unit: "人" + }, + ], + labourDataList: [], + labourDays: [{ + name: "管理人员", + total: 0, + unit: "人", + yesMonitor: 180 + }, + { + name: "劳务人员", + yesMonitor: 0, + total: 0, + unit: "人" + }, + { + name: "特殊工种", + yesMonitor: 0, + total: 0, + unit: "人" + }, + ], + labourDaysTotal: 0, + labourImg: "https://szgcwx.jhncidg.com/staticFiles/icon/zgry.png", + labourName: "在岗人员", + labourTotal: 0, + labourTypeList: [{ + name: "在岗人员", + total: 0, + img: "https://szgcwx.jhncidg.com/staticFiles/icon/zgry.png" + }, { + name: "离岗人员", + total: 0, + img: "https://szgcwx.jhncidg.com/staticFiles/icon/rylg.png" + }], + animation: true, + animationData: {}, + labourDatas: { + unit: '人', + legend: ['出勤人数', '当前在岗'], + color: ['#2e6ed0', '#fb9300'], + Xdata: ['01-01', '01-02', '01-03', '01-04', '01-05', '01-06', '01-07'], + Ydata: [ + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0] + ] + }, + switchChart: false, + attendanceListData: [], + subDeptUserInfo: {}, + imgBaseUrl: config.baseImgUrl + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - if (!getToken()) { - wx.redirectTo({ - url: '../../pages/login/login', - }) - } - wx.setStorageSync('nav-menu', "xmgk"); - const proUserInfo = getUserInfo(); - app.globalData.subDeptUserData = proUserInfo.projectUserInfo; - this.initAnimationData(); + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if (!getToken()) { + wx.redirectTo({ + url: '../../pages/login/login', + }) + } + wx.setStorageSync('nav-menu', "xmgk"); + const proUserInfo = getUserInfo(); + app.globalData.subDeptUserData = proUserInfo.projectUserInfo; + this.initAnimationData(); + this.setData({ + labourImg: this.data.labourTypeList[this.data.nactive].img, + projectId: app.globalData.useProjectId, + projectName: app.globalData.useProjectName, + initData: { + id: app.globalData.useProjectId, + text: app.globalData.useProjectName, + }, + subDeptUserInfo: proUserInfo.projectUserInfo + }); + //项目基本信息 + this.getProjectInfo(app.globalData.useProjectId); + //用户项目信息 + this.getProUserDatas(); + //项目建设单位 + this.getProjectDepts(app.globalData.useProjectId); + }, + + /** + * 统计劳务人员信息 + * @param {*} proId + */ + getSubDeptsUsers(proId) { + findSubDeptsUsers(proId).then(res => { + if (res.code == 200) { + let zg = 0; + let lg = 0; + res.data.forEach(item => { + if (item.useStatus == '0') { + zg += item.total; + } else { + lg += item.total; + } + }); this.setData({ - labourImg: this.data.labourTypeList[this.data.nactive].img, - projectId: app.globalData.useProjectId, - projectName: app.globalData.useProjectName, - initData: { - id: app.globalData.useProjectId, - text: app.globalData.useProjectName, - }, - subDeptUserInfo: proUserInfo.projectUserInfo - }); - //项目基本信息 - this.getProjectInfo(app.globalData.useProjectId); - //用户项目信息 - this.getProUserDatas(); - //项目建设单位 - this.getProjectDepts(app.globalData.useProjectId); - }, - - /** - * 统计劳务人员信息 - * @param {*} proId - */ - getSubDeptsUsers(proId) { - findSubDeptsUsers(proId).then(res => { - if (res.code == 200) { - let zg = 0; - let lg = 0; - res.data.forEach(item => { - if (item.useStatus == '0') { - zg += item.total; - } else { - lg += item.total; - } - }); - this.setData({ - "labourTypeList[0].total": zg, - "labourTypeList[1].total": lg, - labourTotal: zg, - labourDataList: res.data || [] - }) - this.initSubDeptUsersCharts(); - } - }); - }, - - /** - * 初始化动画 - */ - initAnimationData() { - var animation = wx.createAnimation({ - duration: 1000, - timingFunction: 'linear', + "labourTypeList[0].total": zg, + "labourTypeList[1].total": lg, + labourTotal: zg, + labourDataList: res.data || [] }) - this.animation = animation; - if (this.data.animation) { - animation.translateY(-8).step(); + this.initSubDeptUsersCharts(); + } + }); + }, + + /** + * 初始化动画 + */ + initAnimationData() { + var animation = wx.createAnimation({ + duration: 1000, + timingFunction: 'linear', + }) + this.animation = animation; + if (this.data.animation) { + animation.translateY(-8).step(); + } else { + animation.translateY(8).step(); + } + this.setData({ + animation: this.data.animation ? false : true, + animationData: animation.export() + }) + setTimeout(() => { + this.initAnimationData(); + }, 1200) + }, + + /** + * 初始化统计图表 + */ + initSubDeptUsersCharts() { + let labourDataList = this.data.labourDataList; + if (labourDataList.length > 0) { + let gl = 0; + let ts = 0; + let lw = 0; + labourDataList.forEach(item => { + if (this.data.nactive == 0) { + if (item.useStatus == '0') { + if (item.craftType == '2') { + ts += item.total; + } else if (item.craftType == '3') { + gl += item.total; + } else { + lw += item.total; + } + } } else { - animation.translateY(8).step(); - } - this.setData({ - animation: this.data.animation ? false : true, - animationData: animation.export() - }) - setTimeout(() => { - this.initAnimationData(); - }, 1200) - }, - - /** - * 初始化统计图表 - */ - initSubDeptUsersCharts() { - let labourDataList = this.data.labourDataList; - if (labourDataList.length > 0) { - let gl = 0; - let ts = 0; - let lw = 0; - labourDataList.forEach(item => { - if (this.data.nactive == 0) { - if (item.useStatus == '0') { - if (item.craftType == '2') { - ts += item.total; - } else if (item.craftType == '3') { - gl += item.total; - } else { - lw += item.total; - } - } - } else { - if (item.useStatus != '0') { - if (item.craftType == '2') { - ts += item.total; - } else if (item.craftType == '3') { - gl += item.total; - } else { - lw += item.total; - } - } - } - }); - this.setData({ - "labourData[0].total": gl, - "labourData[0].yesMonitor": gl, - "labourData[1].total": ts, - "labourData[1].yesMonitor": ts, - "labourData[2].total": lw, - "labourData[2].yesMonitor": lw, - labourTotal: this.data.labourTypeList[this.data.nactive].total - }) - if (this.data.switchChart) { - let chats = this.selectComponent("#userChart"); - chats.initChart(); - } - } - }, - - /** - * 初始化 - * 今日考勤 - * @param {*} proId - */ - initSubDeptDaysCharts(proId) { - findDaysAttendanceView(proId).then(res => { - if (res.code == 200) { - let gl = 0; - let ts = 0; - let lw = 0; - res.data.forEach(item => { - if (item.craftType == '2') { - ts += item.total; - } else if (item.craftType == '3') { - gl += item.total; - } else { - lw += item.total; - } - }); - this.setData({ - "labourDays[0].total": gl, - "labourDays[0].yesMonitor": gl, - "labourDays[1].total": ts, - "labourDays[1].yesMonitor": ts, - "labourDays[2].total": lw, - "labourDays[2].yesMonitor": lw, - labourDaysTotal: gl + ts + lw - }) - if (this.data.switchChart) { - let chats = this.selectComponent("#attsChart"); - chats.initChart(); - } - } - }); - }, - - /** - * 统计 - * 最近出勤信息 - * @param {*} proId - */ - getSubDeptsAttendanceView(proId) { - findSubDeptsAttendanceView(proId).then(res => { - if (res.code == 200) { - let xd = []; - let yd1 = []; - let yd2 = []; - res.data.list.forEach(item => { - xd.push(item.attendanceTime); - yd1.push(item.total); - }); - if (xd.length < 7) { - let n = 7 - xd.length; - for (let i = 0; i < n; i++) { - xd.push('-'); - yd1.push(0); - } - } - for (let y = 0; y < 7; y++) { - yd2.push(res.data.user); - } - let yd = []; - yd.push(yd1); - yd.push(yd2); - this.setData({ - "labourDatas.Xdata": xd, - "labourDatas.Ydata": yd - }); - if (this.data.switchChart) { - let chats = this.selectComponent("#chartBar"); - chats.initChart(); - } - } - }); - }, - - /** - * 查询用户考勤 - * @param {*} proId - */ - getUsersAttendanceView(proId) { - findUsersAttendanceView(proId).then(res => { - if (res.code == 200) { - this.setData({ - attendanceListData: res.data - }); - } - }) - }, - - /** - * 单位人员信息 - * @param {*} proId - */ - getProUserDatas() { - //劳务人员信息 - if ((app.globalData.subDeptUserData.subDeptType == '1' || app.globalData.subDeptUserData.subDeptType == '4' || app.globalData.subDeptUserData.subDeptType == '5') && app.globalData.subDeptUserData.userPost != '4' && app.globalData.subDeptUserData.userPost != '5' && app.globalData.subDeptUserData.userPost != '6' && app.globalData.subDeptUserData.userPost != '8') { - //统计劳务人员信息 - this.getSubDeptsUsers(app.globalData.useProjectId); - this.initSubDeptDaysCharts(app.globalData.useProjectId); - } - this.awaitTask(); - //今日出勤信息 - if (app.globalData.subDeptUserData.subDeptType == '1') { - this.getSubDeptsAttendanceView(app.globalData.useProjectId); - } - //人员出勤信息 - if (app.globalData.subDeptUserData.userPost == '4' || app.globalData.subDeptUserData.userPost == '5' || app.globalData.subDeptUserData.userPost == '6' || app.globalData.subDeptUserData.userPost == '8') { - //统计劳务人员信息 - this.getUsersAttendanceView(app.globalData.useProjectId); - } - }, - - /** - * 查询公众号消息授权 - */ - reUserOpenMsgId() { - let userInfos = this.selectComponent("#userInfos"); - userInfos.loadUserInfo(); - }, - - // 底部导航 - onChange(event) { - // event.detail 的值为当前选中项的索引 - this.setData({ - active: event.detail - }); - }, - - /** - * 初始化曲线图表 - */ - initLabourDatas() { - findGroupAllByDays({ - projectId: app.globalData.projectId - }).then(res => { - if (res.code == 200) { - let xd = []; - let yd1 = []; - let yd2 = []; - res.data.list.forEach(item => { - xd.push(item.attendanceTime); - yd1.push(item.total); - }); - if (xd.length < 7) { - let n = 7 - xd.length; - for (let i = 0; i < n; i++) { - xd.push(''); - yd1.push(0); - } - } - for (let y = 0; y < 7; y++) { - yd2.push(res.data.user); - } - let yd = []; - yd.push(yd1); - yd.push(yd2); - this.setData({ - "labourDatas.Xdata": xd, - "labourDatas.Ydata": yd - }); - if (this.data.switchChart) { - let chats = this.selectComponent("#chartBar"); - chats.initChart(); - } - } - }); - }, - - /** - * 查询项目详情 - * @param {*} proId - */ - getProjectInfo: function (proId) { - findProjectInfo(proId).then(res => { - if (res.data.scheduledStartTime) { - res.data.scheduledStartTime = res.data.scheduledStartTime.split("T")[0]; + if (item.useStatus != '0') { + if (item.craftType == '2') { + ts += item.total; + } else if (item.craftType == '3') { + gl += item.total; } else { - res.data.scheduledStartTime = " - "; + lw += item.total; } - if (res.data.actualOperatingTime) { - res.data.actualOperatingTime = res.data.actualOperatingTime.split("T")[0]; - } else { - res.data.actualOperatingTime = " - "; - } - if (res.data.plannedCompletionTime) { - res.data.plannedCompletionTime = res.data.plannedCompletionTime.split("T")[0]; - } else { - res.data.plannedCompletionTime = " - "; - } - // let list = []; - // res.data.projectDeptsList.forEach(item => { - // let typeItem = this.data.deptTypes.filter((v) => v.name == item.deptType); - // if(typeItem.length>0){ - // item.iconSrc = typeItem[0].iconSrc; - // } - // list.push(item); - // }); - this.setData({ - projectInfo: res.data, - projectDeptsList: res.data.projectDeptsList - }) - }); - }, - - /** - * 查询 - * 项目建设单位 - * @param {*} proId - */ - getProjectDepts: function (proId) { - findProjectDepts(proId).then(res => { - this.setData({ - projectDeptsList: res.data - }) - }); - }, - - // 页签选中事件 - selectedTab(e) { - if(e.target.dataset.set!==undefined){ - this.setData({ - nactive: e.target.dataset.set, - labourImg: this.data.labourTypeList[e.target.dataset.set].img, - }) - this.initSubDeptUsersCharts(); + } } - }, + }); + this.setData({ + "labourData[0].total": gl, + "labourData[0].yesMonitor": gl, + "labourData[1].total": ts, + "labourData[1].yesMonitor": ts, + "labourData[2].total": lw, + "labourData[2].yesMonitor": lw, + labourTotal: this.data.labourTypeList[this.data.nactive].total + }) + if (this.data.switchChart) { + let chats = this.selectComponent("#userChart"); + chats.initChart(); + } + } + }, - //项目切换 返回值 - onProjectSelect(e) { - let projectId = e.detail.id; - let projectName = e.detail.text; - app.globalData.useProjectId = projectId; - app.globalData.useProjectName = projectName; - this.setData({ - switchChart: true - }) - this.onLoad(); - }, - - // 手风琴 - onCollChange(event) { - this.setData({ - activeNames: event.detail, + /** + * 初始化 + * 今日考勤 + * @param {*} proId + */ + initSubDeptDaysCharts(proId) { + findDaysAttendanceView(proId).then(res => { + if (res.code == 200) { + let gl = 0; + let ts = 0; + let lw = 0; + res.data.forEach(item => { + if (item.craftType == '2') { + ts += item.total; + } else if (item.craftType == '3') { + gl += item.total; + } else { + lw += item.total; + } }); - }, - - /** - * 拨打电话 - * @param {*} event - */ - calling: function (event) { - let callPhone = event.currentTarget.dataset.phone; - wx.makePhoneCall({ - phoneNumber: callPhone, - success: function () { - console.log("拨打电话成功!") - }, - fail: function () { - console.log("拨打电话失败!") - } + this.setData({ + "labourDays[0].total": gl, + "labourDays[0].yesMonitor": gl, + "labourDays[1].total": ts, + "labourDays[1].yesMonitor": ts, + "labourDays[2].total": lw, + "labourDays[2].yesMonitor": lw, + labourDaysTotal: gl + ts + lw }) - }, - - 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] - }) - }, - - /** - * 劳务管理查看详细 - */ - goLWGL: function () { - if (this.data.nactive == 2) { - wx.redirectTo({ - url: '../../pageage/project_attendance/project_attendanceData/list/index' - }) - } else { - let type; - if (this.data.nactive == 0) { - type = 1; - } else { - type = 2; - } - wx.redirectTo({ - url: '../../pageage/project_attendance/project_attendanceUser/list/index?type=' + type - }) + if (this.data.switchChart) { + let chats = this.selectComponent("#attsChart"); + chats.initChart(); } - }, + } + }); + }, - /** - * 最近出勤 - */ - goZJCQ: function () { - wx.redirectTo({ - url: '../../pageage/project_attendance/project_attendanceData/list/index' - }) - }, - - //跳转到安全管控 - XMSP: function () { - wx.setStorageSync('nav-menu', "aqgl"); - wx.redirectTo({ - url: '../project_safety/index' - }) - }, - - //跳转到质量管理 - ZLGL: function () { - wx.setStorageSync('nav-menu', "zlgl"); - wx.redirectTo({ - url: '../project_quality/index' - }) - }, - - //跳转到进度管理 - JDGL: function () { - wx.setStorageSync('nav-menu', "xmgk"); - wx.redirectTo({ - url: '../project_schedule/list/index' - }) - }, - - //跳转到项目管理 - XMGL: function () { - wx.setStorageSync('nav-menu', "xmgl"); - wx.redirectTo({ - url: '../project_more/index' - }) - }, - - //跳转到项目列表 - XMLB: function () { - wx.redirectTo({ - url: '../project_list/index' - }) - }, - - /** - * 统计代办 - */ - awaitTask() { - let param = "proId=" + app.globalData.useProjectId; - findMyTask(param).then(res => { - if (res.code == 200) { - let proUserInfo = this.data.subDeptUserInfo; - this.setData({ - todoDb: proUserInfo.subDeptType=="1"?(res.data.dwsh+res.data.rysh):res.data.todo, - aqglDb: proUserInfo.subDeptType=="1"?res.data.aqgl:0, - zlglDb: proUserInfo.subDeptType=="1"?res.data.zlgl:0 - }) - } + /** + * 统计 + * 最近出勤信息 + * @param {*} proId + */ + getSubDeptsAttendanceView(proId) { + findSubDeptsAttendanceView(proId).then(res => { + if (res.code == 200) { + let xd = []; + let yd1 = []; + let yd2 = []; + res.data.list.forEach(item => { + xd.push(item.attendanceTime); + yd1.push(item.total); }); - }, + if (xd.length < 7) { + let n = 7 - xd.length; + for (let i = 0; i < n; i++) { + xd.push('-'); + yd1.push(0); + } + } + for (let y = 0; y < 7; y++) { + yd2.push(res.data.user); + } + let yd = []; + yd.push(yd1); + yd.push(yd2); + this.setData({ + "labourDatas.Xdata": xd, + "labourDatas.Ydata": yd + }); + if (this.data.switchChart) { + let chats = this.selectComponent("#chartBar"); + chats.initChart(); + } + } + }); + }, + + /** + * 查询用户考勤 + * @param {*} proId + */ + getUsersAttendanceView(proId) { + findUsersAttendanceView(proId).then(res => { + if (res.code == 200) { + this.setData({ + attendanceListData: res.data + }); + } + }) + }, + + /** + * 单位人员信息 + * @param {*} proId + */ + getProUserDatas() { + //劳务人员信息 + if ((app.globalData.subDeptUserData.subDeptType == '1' || app.globalData.subDeptUserData.subDeptType == '4' || app.globalData.subDeptUserData.subDeptType == '5') && app.globalData.subDeptUserData.userPost != '4' && app.globalData.subDeptUserData.userPost != '5' && app.globalData.subDeptUserData.userPost != '6' && app.globalData.subDeptUserData.userPost != '8') { + //统计劳务人员信息 + this.getSubDeptsUsers(app.globalData.useProjectId); + this.initSubDeptDaysCharts(app.globalData.useProjectId); + } + this.awaitTask(); + //今日出勤信息 + if (app.globalData.subDeptUserData.subDeptType == '1') { + this.getSubDeptsAttendanceView(app.globalData.useProjectId); + } + //人员出勤信息 + if (app.globalData.subDeptUserData.userPost == '4' || app.globalData.subDeptUserData.userPost == '5' || app.globalData.subDeptUserData.userPost == '6' || app.globalData.subDeptUserData.userPost == '8') { + //统计劳务人员信息 + this.getUsersAttendanceView(app.globalData.useProjectId); + } + }, + + /** + * 查询公众号消息授权 + */ + reUserOpenMsgId() { + let userInfos = this.selectComponent("#userInfos"); + userInfos.loadUserInfo(); + }, + + // 底部导航 + onChange(event) { + // event.detail 的值为当前选中项的索引 + this.setData({ + active: event.detail + }); + }, + + /** + * 初始化曲线图表 + */ + initLabourDatas() { + findGroupAllByDays({ + projectId: app.globalData.projectId + }).then(res => { + if (res.code == 200) { + let xd = []; + let yd1 = []; + let yd2 = []; + res.data.list.forEach(item => { + xd.push(item.attendanceTime); + yd1.push(item.total); + }); + if (xd.length < 7) { + let n = 7 - xd.length; + for (let i = 0; i < n; i++) { + xd.push(''); + yd1.push(0); + } + } + for (let y = 0; y < 7; y++) { + yd2.push(res.data.user); + } + let yd = []; + yd.push(yd1); + yd.push(yd2); + this.setData({ + "labourDatas.Xdata": xd, + "labourDatas.Ydata": yd + }); + if (this.data.switchChart) { + let chats = this.selectComponent("#chartBar"); + chats.initChart(); + } + } + }); + }, + + /** + * 查询项目详情 + * @param {*} proId + */ + getProjectInfo: function (proId) { + findProjectInfo(proId).then(res => { + if (res.data.scheduledStartTime) { + res.data.scheduledStartTime = res.data.scheduledStartTime.split("T")[0]; + } else { + res.data.scheduledStartTime = " - "; + } + if (res.data.actualOperatingTime) { + res.data.actualOperatingTime = res.data.actualOperatingTime.split("T")[0]; + } else { + res.data.actualOperatingTime = " - "; + } + if (res.data.plannedCompletionTime) { + res.data.plannedCompletionTime = res.data.plannedCompletionTime.split("T")[0]; + } else { + res.data.plannedCompletionTime = " - "; + } + // let list = []; + // res.data.projectDeptsList.forEach(item => { + // let typeItem = this.data.deptTypes.filter((v) => v.name == item.deptType); + // if(typeItem.length>0){ + // item.iconSrc = typeItem[0].iconSrc; + // } + // list.push(item); + // }); + this.setData({ + projectInfo: res.data, + projectDeptsList: res.data.projectDeptsList + }) + }); + }, + + /** + * 查询 + * 项目建设单位 + * @param {*} proId + */ + getProjectDepts: function (proId) { + findProjectDepts(proId).then(res => { + this.setData({ + projectDeptsList: res.data + }) + }); + }, + + // 页签选中事件 + selectedTab(e) { + if (e.target.dataset.set !== undefined) { + this.setData({ + nactive: e.target.dataset.set, + labourImg: this.data.labourTypeList[e.target.dataset.set].img, + }) + this.initSubDeptUsersCharts(); + } + }, + + //项目切换 返回值 + onProjectSelect(e) { + let projectId = e.detail.id; + let projectName = e.detail.text; + app.globalData.useProjectId = projectId; + app.globalData.useProjectName = projectName; + this.setData({ + switchChart: true + }) + this.onLoad(); + }, + + // 手风琴 + onCollChange(event) { + this.setData({ + activeNames: event.detail, + }); + }, + + /** + * 拨打电话 + * @param {*} event + */ + calling: function (event) { + let callPhone = event.currentTarget.dataset.phone; + wx.makePhoneCall({ + phoneNumber: callPhone, + success: function () { + console.log("拨打电话成功!") + }, + fail: function () { + console.log("拨打电话失败!") + } + }) + }, + + 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] + }) + }, + + /** + * 劳务管理查看详细 + */ + goLWGL: function () { + if (this.data.nactive == 2) { + wx.redirectTo({ + url: '../../pageage/project_attendance/project_attendanceData/list/index' + }) + } else { + let type; + if (this.data.nactive == 0) { + type = 1; + } else { + type = 2; + } + wx.redirectTo({ + url: '../../pageage/project_attendance/project_attendanceUser/list/index?type=' + type + }) + } + }, + + /** + * 最近出勤 + */ + goZJCQ: function () { + wx.redirectTo({ + url: '../../pageage/project_attendance/project_attendanceData/list/index' + }) + }, + + //跳转到安全管控 + XMSP: function () { + wx.setStorageSync('nav-menu', "aqgl"); + wx.redirectTo({ + url: '../project_safety/index' + }) + }, + + //跳转到质量管理 + ZLGL: function () { + wx.setStorageSync('nav-menu', "zlgl"); + wx.redirectTo({ + url: '../project_quality/index' + }) + }, + + //跳转到进度管理 + JDGL: function () { + wx.setStorageSync('nav-menu', "xmgk"); + wx.redirectTo({ + url: '../project_schedule/list/index' + }) + }, + + //跳转到项目管理 + XMGL: function () { + wx.setStorageSync('nav-menu', "xmgl"); + wx.redirectTo({ + url: '../project_more/index' + }) + }, + + //跳转到项目列表 + XMLB: function () { + wx.redirectTo({ + url: '../project_list/index' + }) + }, + + /** + * 统计代办 + */ + awaitTask() { + let param = "proId=" + app.globalData.useProjectId; + findMyTask(param).then(res => { + if (res.code == 200) { + let proUserInfo = this.data.subDeptUserInfo; + this.setData({ + todoDb: proUserInfo.subDeptType == "1" ? (res.data.dwsh + res.data.rysh) : res.data.todo, + aqglDb: proUserInfo.subDeptType == "1" ? res.data.aqgl : 0, + zlglDb: proUserInfo.subDeptType == "1" ? res.data.zlgl : 0 + }) + } + }); + }, }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_more/index.js b/yanzhu-ui-app/miniprogram/pageage/project_more/index.js index bd4032a5..e220444e 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_more/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_more/index.js @@ -7,7 +7,7 @@ import { } from '../../api/publics' import { findMyTask -} from '../../api/flowable' +} from '../api/flowable' const app = getApp() Page({ diff --git a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/add/index.js b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/add/index.js index ff5ccb10..c09fee92 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/add/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/add/index.js @@ -1,424 +1,424 @@ import config from '../../../config' import { - getToken, - getUserInfo + getToken, + getUserInfo } from '../../../utils/auth' import { - findDictCache + findDictCache } from '../../../api/publics' import { - findProjectDeptUsers + findProjectDeptUsers } from '../../../api/project' import { - add, - findMyLastProblemmodify -} from '../../../api/problemmodify' + add, + findMyLastProblemmodify +} from '../../api/problemmodify' const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - maxDate: new Date(2088, 1, 1).getTime(), - minDate: new Date().getTime()+(3600*48*1000), - type: "", - typeName: "", - problemTypeList: [], - problemSubTypeList: [], - imageInfoData: [], - form: { - projectId: "", - projectName: "", - infoType: "", - problemType: '1', - dangerType: null, - workParts: "", - changeInfo: "", - nickedTime: "", - lordSent: "", - lordSentUser: "", - recheckSend: "", - recheckSendUser: "", - copySend: "", - copySendUser: "" - }, - active: 1, - flowNodes: [{ - text: '开始' - }, { - text: '提交隐患' - }, { - text: '隐患整改' - }, { - text: '隐患复检' - }, { - text: '结束' - }], - lordSentList: [], - copySendList: [], - checkUserList: [], - loadShow: false, - showHis: false, + /** + * 页面的初始数据 + */ + data: { + maxDate: new Date(2088, 1, 1).getTime(), + minDate: new Date().getTime() + (3600 * 48 * 1000), + type: "", + typeName: "", + problemTypeList: [], + problemSubTypeList: [], + imageInfoData: [], + form: { + projectId: "", + projectName: "", + infoType: "", + problemType: '1', + dangerType: null, + workParts: "", + changeInfo: "", + nickedTime: "", + lordSent: "", + lordSentUser: "", + recheckSend: "", + recheckSendUser: "", + copySend: "", + copySendUser: "" }, + active: 1, + flowNodes: [{ + text: '开始' + }, { + text: '提交隐患' + }, { + text: '隐患整改' + }, { + text: '隐患复检' + }, { + text: '结束' + }], + lordSentList: [], + copySendList: [], + checkUserList: [], + loadShow: false, + showHis: false, + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - if (!getToken()) { - wx.redirectTo({ - url: '../../../pages/login/login', - }) - } - const proUserInfo = getUserInfo(); - this.setData({ - type: options.type, - typeName: options.type == 1 ? "质量" : "安全", - "form.comId": proUserInfo.projectUserInfo.comId, - "form.projectId": app.globalData.useProjectId, - "form.projectName": app.globalData.useProjectName, - "form.infoType": options.type, - "form.recheckSend": proUserInfo.userId, - "form.recheckSendUser": proUserInfo.nickName - }); - this.getDictCache(options.type); - this.getHisInfo(options.type); - this.getProjectUsers(); - }, - - /** - * 获取字典缓存数据 - */ - getDictCache(type) { - // 初始化检查类型 - findDictCache("ssp_proble_type").then(res => { - if (res.code == 200) { - let list = []; - res.data.forEach(item => { - list.push({ - "id": item.dictValue, - "text": item.dictLabel - }); - }); - this.setData({ - problemTypeList: list - }); - } - }); - - //初始化隐患类型 - findDictCache("ssp_proble_sub_type").then(res => { - if (res.code == 200) { - let list = []; - res.data.forEach(item => { - if(item.remark==type){ - list.push({ - "id": item.dictValue, - "text": item.dictLabel - }); - } - }); - this.setData({ - problemSubTypeList: list - }); - } - }); - }, - - /** - * 查询项目人员数据 - * 获取项目所有人员,在页面组装数据... - */ - getProjectUsers() { - findProjectDeptUsers(app.globalData.useProjectId).then(res => { - if (res.code == 200) { - this.setData({ - lordSentList: res.data.lordSentList, - copySendList: res.data.copySendList, - checkUserList: res.data.checkUserList, - }); - } - }); - }, - - /** - * 这里查询当前登录人上次提交隐患 - * 自动填充整改人,复检人,抄送人 - * @param {*} type - */ - getHisInfo(type) { - findMyLastProblemmodify(app.globalData.useProjectId, type).then(res => { - if (res.code == 200 && res.data && res.data.length > 0) { - this.setData({ - showHis: true, - "form.lordSent": res.data[0].lordSent, - "form.lordSentUser": res.data[0].lordSentUser, - "form.recheckSend": res.data[0].recheckSend, - "form.recheckSendUser": res.data[0].recheckSendUser, - "form.copySend": res.data[0].copySend, - "form.copySendUser": res.data[0].copySendUser - }) - } - }); - }, - - //隐患描述 - onInputWorkParts(e) { - this.setData({ - "form.workParts": e.detail.value - }) - }, - - //整改要求 - onInputChangeInfoValue(e) { - this.setData({ - "form.changeInfo": e.detail.value - }) - }, - - //验收时间 - onInputTime(e) { - this.setData({ - "form.nickedTime": e.detail - }) - }, - - // 上传图片 - onImagesArr(e) { - this.setData({ - imageInfoData: e.detail - }) - }, - - //添加整改人 - onAddLordSent(e) { - if (e.detail.length > 0) { - this.setData({ - "form.lordSent": e.detail[0].userId, - "form.lordSentUser": e.detail[0].userName - }) - } - }, - - //添加抄送人 - onAddCopySend(e) { - if (e.detail.length > 0) { - let _userIds = ""; - let _userNames = ""; - e.detail.forEach(it => { - _userIds += "," + it.userId; - _userNames += "," + it.userName; - }); - this.setData({ - "form.copySend": _userIds.substring(1), - "form.copySendUser": _userNames.substring(1) - }) - } else { - this.setData({ - "form.copySend": "", - "form.copySendUser": "" - }) - } - }, - - //添加复检人 - onAddRecheckSend(e) { - if (e.detail.length > 0) { - this.setData({ - "form.recheckSend": e.detail[0].userId, - "form.recheckSendUser": e.detail[0].userName - }) - } - }, - - //取消页面 - cancelSaveView() { - this.returnToPage() - }, - - /** - * 数据保存 - */ - submitSave() { - let _form = { - ...this.data.form - }; - let { - imageInfoData - } = this.data - //数据效验 - if (!_form.comId || !_form.projectId) { - app.toast("数据异常,请刷新页面重试!") - return false; - } - if (imageInfoData.length == 0) { - app.toast("请上传隐患现场图片!") - return false; - } - if (!_form.problemType) { - app.toast("请选择检查类型!") - return false; - } - if (!_form.dangerType) { - app.toast("请选择隐患类型!") - return false; - } - if (!_form.workParts) { - app.toast("请填写隐患描述!") - return false; - } - if (!_form.changeInfo) { - app.toast("请填写隐患整改要求!") - return false; - } - if (!_form.nickedTime) { - app.toast("请选择整改截至时间!") - return false; - } - if (!_form.lordSent || !_form.lordSentUser) { - app.toast("请选择整改人!") - return false; - } - if (!_form.recheckSend || !_form.recheckSendUser) { - app.toast("请选择复检人!") - return false; - } - if (!_form.copySend || !_form.copySendUser) { - app.toast("请选择抄送人!") - return false; - } - let fileUrls = []; - this.setData({ - loadShow: true - }); - let that = this; - imageInfoData.forEach(async (item) => { - //这里复杂的图片上传,改为同步上传,因为小程序只能上传一张图片 - let obj = await that.syncUploadImage(item); - fileUrls.push(obj.data.data.url); - //验证图片上传完毕 - if (fileUrls.length == imageInfoData.length) { - _form.smarkUrl = fileUrls.toString(); - add(_form).then(res => { - this.setData({ - loadShow: false - }); - if (res.code == 200) { - app.toast("新增数据成功!") - setTimeout(() => { - wx.redirectTo({ - url: `../list/index?type=${this.data.type}`, - }) - }, 200) - } - }); - } - }) - }, - - //选择检查类型 - onSelectProblemType(e) { - this.setData({ - "form.problemType": e.detail.id - }) - }, - - //选择隐患类型 - onSelectDangerType(e) { - this.setData({ - "form.dangerType": e.detail.id - }) - }, - - /** - * 这里考虑上传图片异步问题,封装为同步 - */ - syncUploadImage(file) { - let _baseUrl = config.baseUrl; - return new Promise((resolve, reject) => { - wx.uploadFile({ - url: _baseUrl + "/file/upload", // 上传的服务器接口地址 - filePath: file, - header: { - "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", - 'Authorization': 'Bearer ' + getToken() - }, - name: "file", //上传的所需字段,后端提供 - formData: {}, - success: (res) => { - // 上传完成操作 - const data = JSON.parse(res.data) - resolve({ - data: data - }) - }, - fail: (err) => { - //上传失败:修改pedding为reject - console.log("访问接口失败", err); - wx.showToast({ - title: "网络出错,上传失败", - icon: 'none', - duration: 1000 - }); - reject(err) - } - }); - }) - }, - - returnToPage: function () { - wx.redirectTo({ - url: `../list/index?type=${this.data.type}` - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (!getToken()) { + wx.redirectTo({ + url: '../../../pages/login/login', + }) } + const proUserInfo = getUserInfo(); + this.setData({ + type: options.type, + typeName: options.type == 1 ? "质量" : "安全", + "form.comId": proUserInfo.projectUserInfo.comId, + "form.projectId": app.globalData.useProjectId, + "form.projectName": app.globalData.useProjectName, + "form.infoType": options.type, + "form.recheckSend": proUserInfo.userId, + "form.recheckSendUser": proUserInfo.nickName + }); + this.getDictCache(options.type); + this.getHisInfo(options.type); + this.getProjectUsers(); + }, + + /** + * 获取字典缓存数据 + */ + getDictCache(type) { + // 初始化检查类型 + findDictCache("ssp_proble_type").then(res => { + if (res.code == 200) { + let list = []; + res.data.forEach(item => { + list.push({ + "id": item.dictValue, + "text": item.dictLabel + }); + }); + this.setData({ + problemTypeList: list + }); + } + }); + + //初始化隐患类型 + findDictCache("ssp_proble_sub_type").then(res => { + if (res.code == 200) { + let list = []; + res.data.forEach(item => { + if (item.remark == type) { + list.push({ + "id": item.dictValue, + "text": item.dictLabel + }); + } + }); + this.setData({ + problemSubTypeList: list + }); + } + }); + }, + + /** + * 查询项目人员数据 + * 获取项目所有人员,在页面组装数据... + */ + getProjectUsers() { + findProjectDeptUsers(app.globalData.useProjectId).then(res => { + if (res.code == 200) { + this.setData({ + lordSentList: res.data.lordSentList, + copySendList: res.data.copySendList, + checkUserList: res.data.checkUserList, + }); + } + }); + }, + + /** + * 这里查询当前登录人上次提交隐患 + * 自动填充整改人,复检人,抄送人 + * @param {*} type + */ + getHisInfo(type) { + findMyLastProblemmodify(app.globalData.useProjectId, type).then(res => { + if (res.code == 200 && res.data && res.data.length > 0) { + this.setData({ + showHis: true, + "form.lordSent": res.data[0].lordSent, + "form.lordSentUser": res.data[0].lordSentUser, + "form.recheckSend": res.data[0].recheckSend, + "form.recheckSendUser": res.data[0].recheckSendUser, + "form.copySend": res.data[0].copySend, + "form.copySendUser": res.data[0].copySendUser + }) + } + }); + }, + + //隐患描述 + onInputWorkParts(e) { + this.setData({ + "form.workParts": e.detail.value + }) + }, + + //整改要求 + onInputChangeInfoValue(e) { + this.setData({ + "form.changeInfo": e.detail.value + }) + }, + + //验收时间 + onInputTime(e) { + this.setData({ + "form.nickedTime": e.detail + }) + }, + + // 上传图片 + onImagesArr(e) { + this.setData({ + imageInfoData: e.detail + }) + }, + + //添加整改人 + onAddLordSent(e) { + if (e.detail.length > 0) { + this.setData({ + "form.lordSent": e.detail[0].userId, + "form.lordSentUser": e.detail[0].userName + }) + } + }, + + //添加抄送人 + onAddCopySend(e) { + if (e.detail.length > 0) { + let _userIds = ""; + let _userNames = ""; + e.detail.forEach(it => { + _userIds += "," + it.userId; + _userNames += "," + it.userName; + }); + this.setData({ + "form.copySend": _userIds.substring(1), + "form.copySendUser": _userNames.substring(1) + }) + } else { + this.setData({ + "form.copySend": "", + "form.copySendUser": "" + }) + } + }, + + //添加复检人 + onAddRecheckSend(e) { + if (e.detail.length > 0) { + this.setData({ + "form.recheckSend": e.detail[0].userId, + "form.recheckSendUser": e.detail[0].userName + }) + } + }, + + //取消页面 + cancelSaveView() { + this.returnToPage() + }, + + /** + * 数据保存 + */ + submitSave() { + let _form = { + ...this.data.form + }; + let { + imageInfoData + } = this.data + //数据效验 + if (!_form.comId || !_form.projectId) { + app.toast("数据异常,请刷新页面重试!") + return false; + } + if (imageInfoData.length == 0) { + app.toast("请上传隐患现场图片!") + return false; + } + if (!_form.problemType) { + app.toast("请选择检查类型!") + return false; + } + if (!_form.dangerType) { + app.toast("请选择隐患类型!") + return false; + } + if (!_form.workParts) { + app.toast("请填写隐患描述!") + return false; + } + if (!_form.changeInfo) { + app.toast("请填写隐患整改要求!") + return false; + } + if (!_form.nickedTime) { + app.toast("请选择整改截至时间!") + return false; + } + if (!_form.lordSent || !_form.lordSentUser) { + app.toast("请选择整改人!") + return false; + } + if (!_form.recheckSend || !_form.recheckSendUser) { + app.toast("请选择复检人!") + return false; + } + if (!_form.copySend || !_form.copySendUser) { + app.toast("请选择抄送人!") + return false; + } + let fileUrls = []; + this.setData({ + loadShow: true + }); + let that = this; + imageInfoData.forEach(async (item) => { + //这里复杂的图片上传,改为同步上传,因为小程序只能上传一张图片 + let obj = await that.syncUploadImage(item); + fileUrls.push(obj.data.data.url); + //验证图片上传完毕 + if (fileUrls.length == imageInfoData.length) { + _form.smarkUrl = fileUrls.toString(); + add(_form).then(res => { + this.setData({ + loadShow: false + }); + if (res.code == 200) { + app.toast("新增数据成功!") + setTimeout(() => { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}`, + }) + }, 200) + } + }); + } + }) + }, + + //选择检查类型 + onSelectProblemType(e) { + this.setData({ + "form.problemType": e.detail.id + }) + }, + + //选择隐患类型 + onSelectDangerType(e) { + this.setData({ + "form.dangerType": e.detail.id + }) + }, + + /** + * 这里考虑上传图片异步问题,封装为同步 + */ + syncUploadImage(file) { + let _baseUrl = config.baseUrl; + return new Promise((resolve, reject) => { + wx.uploadFile({ + url: _baseUrl + "/file/upload", // 上传的服务器接口地址 + filePath: file, + header: { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", + 'Authorization': 'Bearer ' + getToken() + }, + name: "file", //上传的所需字段,后端提供 + formData: {}, + success: (res) => { + // 上传完成操作 + const data = JSON.parse(res.data) + resolve({ + data: data + }) + }, + fail: (err) => { + //上传失败:修改pedding为reject + console.log("访问接口失败", err); + wx.showToast({ + title: "网络出错,上传失败", + icon: 'none', + duration: 1000 + }); + reject(err) + } + }); + }) + }, + + returnToPage: function () { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}` + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/check/index.js b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/check/index.js index 2b4b30cf..348b8297 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/check/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/check/index.js @@ -6,7 +6,7 @@ import { findInfo, findAuditInfos, checkProblemmodify -} from '../../../api/problemmodify' +} from '../../api/problemmodify' const app = getApp() Page({ @@ -118,12 +118,12 @@ Page({ onSubmitSave(status) { let _form = { ...this.data.form - }; + }; _form.processState = status; this.setData({ loadShow: true }); - checkProblemmodify(_form).then(res =>{ + checkProblemmodify(_form).then(res => { this.setData({ loadShow: false }); diff --git a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/draft/index.js b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/draft/index.js index 7c912362..0e7a2c07 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/draft/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/draft/index.js @@ -1,350 +1,350 @@ import config from '../../../config' import { - getToken, - getUserInfo + getToken, + getUserInfo } from '../../../utils/auth' import { - findDictCache + findDictCache } from '../../../api/publics' import { - findProjectDeptUsers + findProjectDeptUsers } from '../../../api/project' import { - addDraft, - findMyLastProblemmodify -} from '../../../api/problemmodify' + addDraft, + findMyLastProblemmodify +} from '../../api/problemmodify' const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - type: "", - typeName: "", - problemTypeList: [], - form: { - projectId: "", - projectName: "", - infoType: "", - problemType: "1", - lordSent: "", - lordSentUser: "", - }, - active: 1, - flowNodes: [{ - text: '开始' - }, { - text: '提交隐患' - }, { - text: '隐患整改' - }, { - text: '隐患复检' - }, { - text: '结束' - }], - lordSentList: [], - loadShow: false, - showHis: false, - inspectInfoData: [{ - image_upload: [] - }] + /** + * 页面的初始数据 + */ + data: { + type: "", + typeName: "", + problemTypeList: [], + form: { + projectId: "", + projectName: "", + infoType: "", + problemType: "1", + lordSent: "", + lordSentUser: "", }, + active: 1, + flowNodes: [{ + text: '开始' + }, { + text: '提交隐患' + }, { + text: '隐患整改' + }, { + text: '隐患复检' + }, { + text: '结束' + }], + lordSentList: [], + loadShow: false, + showHis: false, + inspectInfoData: [{ + image_upload: [] + }] + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - if (!getToken()) { - wx.redirectTo({ - url: '../../../pages/login/login', - }) - } - const proUserInfo = getUserInfo(); - this.setData({ - type: options.type, - typeName: options.type == 1 ? "质量" : "安全", - "form.comId": proUserInfo.projectUserInfo.comId, - "form.projectId": app.globalData.useProjectId, - "form.projectName": app.globalData.useProjectName, - "form.infoType": options.type - }); - this.getDictCache(); - this.getHisInfo(options.type); - this.getProjectUsers(); - }, - - /** - * 获取字典缓存数据 - */ - getDictCache() { - // 初始化检查类型 - findDictCache("ssp_proble_type").then(res => { - if (res.code == 200) { - let list = []; - res.data.forEach(item => { - list.push({ - "id": item.dictValue, - "text": item.dictLabel - }); - }); - this.setData({ - problemTypeList: list - }); - } - }); - }, - - /** - * 查询项目人员数据 - * 获取项目所有人员,在页面组装数据... - */ - getProjectUsers() { - findProjectDeptUsers(app.globalData.useProjectId).then(res => { - if (res.code == 200) { - this.setData({ - lordSentList: res.data.lordSentList - }); - } - }); - }, - - /** - * 这里查询当前登录人上次提交隐患 - * 自动填充整改人,复检人,抄送人 - * @param {*} type - */ - getHisInfo(type) { - findMyLastProblemmodify(app.globalData.useProjectId, type).then(res => { - if (res.code == 200 && res.data && res.data.length > 0) { - this.setData({ - showHis: true, - "form.lordSent": res.data[0].lordSent, - "form.lordSentUser": res.data[0].lordSentUser - }) - } - }); - }, - - // 上传图片 - onImagesArr(e) { - var index = e.currentTarget.dataset.index - var data = this.data.inspectInfoData - data[index].image_upload = e.detail - this.setData({ - inspectInfoData: data - }) - }, - - //添加整改人 - onAddLordSent(e) { - if (e.detail.length > 0) { - this.setData({ - "form.lordSent": e.detail[0].userId, - "form.lordSentUser": e.detail[0].userName - }) - } - }, - - // 取消页面 - cancelSaveView() { - this.returnToPage() - }, - - // 保存 - submitSave() { - let _form = { - ...this.data.form - }; - let { - inspectInfoData - } = this.data - //数据效验 - if (!_form.comId || !_form.projectId) { - app.toast("数据异常,请刷新页面重试!"); - return false; - } - if (!_form.problemType) { - app.toast("请选择检查类型!"); - return false; - } - if (!_form.lordSent || !_form.lordSentUser) { - app.toast("请选择整改人!"); - return false; - } - - if (inspectInfoData.length > 0) { - for (let i = 0; i < inspectInfoData.length; i++) { - if (inspectInfoData[i].image_upload.length == 0) { - app.toast("请上传问题“" + (i + 1) + "”的隐患图片或删除问题项!"); - return false; - } - } - } - this.setData({ - loadShow: true - }) - let fileUrls = []; - let that = this; - inspectInfoData.forEach(async (item) => { - let beforeCheckUrl = []; - item.image_upload.forEach(async (itFile) => { - //这里复杂的图片上传,改为同步上传,因为小程序只能上传一张图片 - let obj = await that.syncUploadImage(itFile); - beforeCheckUrl.push(obj.data.data.url); - if (beforeCheckUrl.length >= item.image_upload.length) { - fileUrls.push(beforeCheckUrl); - } - //验证图片上传完毕 - if (fileUrls.length >= inspectInfoData.length) { - _form.smarkUrls = fileUrls; - addDraft(_form).then(res => { - this.setData({ - loadShow: false - }); - if (res.code == 200) { - app.toast("新增数据成功!") - setTimeout(() => { - wx.redirectTo({ - url: `../list/index?type=${this.data.type}`, - }) - }, 200); - } - }); - } - }); - }) - }, - - /** - * 这里考虑上传图片异步问题,封装为同步 - */ - syncUploadImage(file) { - let _baseUrl = config.baseUrl; - return new Promise((resolve, reject) => { - wx.uploadFile({ - url: _baseUrl + "/file/upload", // 上传的服务器接口地址 - filePath: file, - header: { - "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", - 'Authorization': 'Bearer ' + getToken() - }, - name: "file", //上传的所需字段,后端提供 - formData: {}, - success: (res) => { - // 上传完成操作 - const data = JSON.parse(res.data) - resolve({ - data: data - }) - }, - fail: (err) => { - //上传失败:修改pedding为reject - console.log("访问接口失败", err); - wx.showToast({ - title: "网络出错,上传失败", - icon: 'none', - duration: 1000 - }); - reject(err) - } - }); - }) - }, - - /** - * 选择问题类型 - * @param {*} e - */ - onSelectProblemType(e) { - this.setData({ - "form.problemType": e.detail.id, - }) - }, - - returnToPage: function () { - if (wx.getStorageSync('nav-menu') == "list") { - wx.redirectTo({ - url: `../list/index?type=${this.data.type}` - }) - } else { - wx.redirectTo({ - url: `../list/index?type=${this.data.type}` - }) - } - }, - - //新增问题 - onNewIssues() { - var data = this.data.inspectInfoData - if (data.length == 5) { - app.toast("一次最多只能提交5个问题!"); - return false; - } - data.push({ - image_upload: [] - }) - this.setData({ - inspectInfoData: data - }) - }, - - //删除 - onNewIssuesDelete(e) { - var index = e.currentTarget.dataset.index - var data = this.data.inspectInfoData - data.splice(index, 1) - this.setData({ - inspectInfoData: data - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (!getToken()) { + wx.redirectTo({ + url: '../../../pages/login/login', + }) } + const proUserInfo = getUserInfo(); + this.setData({ + type: options.type, + typeName: options.type == 1 ? "质量" : "安全", + "form.comId": proUserInfo.projectUserInfo.comId, + "form.projectId": app.globalData.useProjectId, + "form.projectName": app.globalData.useProjectName, + "form.infoType": options.type + }); + this.getDictCache(); + this.getHisInfo(options.type); + this.getProjectUsers(); + }, + + /** + * 获取字典缓存数据 + */ + getDictCache() { + // 初始化检查类型 + findDictCache("ssp_proble_type").then(res => { + if (res.code == 200) { + let list = []; + res.data.forEach(item => { + list.push({ + "id": item.dictValue, + "text": item.dictLabel + }); + }); + this.setData({ + problemTypeList: list + }); + } + }); + }, + + /** + * 查询项目人员数据 + * 获取项目所有人员,在页面组装数据... + */ + getProjectUsers() { + findProjectDeptUsers(app.globalData.useProjectId).then(res => { + if (res.code == 200) { + this.setData({ + lordSentList: res.data.lordSentList + }); + } + }); + }, + + /** + * 这里查询当前登录人上次提交隐患 + * 自动填充整改人,复检人,抄送人 + * @param {*} type + */ + getHisInfo(type) { + findMyLastProblemmodify(app.globalData.useProjectId, type).then(res => { + if (res.code == 200 && res.data && res.data.length > 0) { + this.setData({ + showHis: true, + "form.lordSent": res.data[0].lordSent, + "form.lordSentUser": res.data[0].lordSentUser + }) + } + }); + }, + + // 上传图片 + onImagesArr(e) { + var index = e.currentTarget.dataset.index + var data = this.data.inspectInfoData + data[index].image_upload = e.detail + this.setData({ + inspectInfoData: data + }) + }, + + //添加整改人 + onAddLordSent(e) { + if (e.detail.length > 0) { + this.setData({ + "form.lordSent": e.detail[0].userId, + "form.lordSentUser": e.detail[0].userName + }) + } + }, + + // 取消页面 + cancelSaveView() { + this.returnToPage() + }, + + // 保存 + submitSave() { + let _form = { + ...this.data.form + }; + let { + inspectInfoData + } = this.data + //数据效验 + if (!_form.comId || !_form.projectId) { + app.toast("数据异常,请刷新页面重试!"); + return false; + } + if (!_form.problemType) { + app.toast("请选择检查类型!"); + return false; + } + if (!_form.lordSent || !_form.lordSentUser) { + app.toast("请选择整改人!"); + return false; + } + + if (inspectInfoData.length > 0) { + for (let i = 0; i < inspectInfoData.length; i++) { + if (inspectInfoData[i].image_upload.length == 0) { + app.toast("请上传问题“" + (i + 1) + "”的隐患图片或删除问题项!"); + return false; + } + } + } + this.setData({ + loadShow: true + }) + let fileUrls = []; + let that = this; + inspectInfoData.forEach(async (item) => { + let beforeCheckUrl = []; + item.image_upload.forEach(async (itFile) => { + //这里复杂的图片上传,改为同步上传,因为小程序只能上传一张图片 + let obj = await that.syncUploadImage(itFile); + beforeCheckUrl.push(obj.data.data.url); + if (beforeCheckUrl.length >= item.image_upload.length) { + fileUrls.push(beforeCheckUrl); + } + //验证图片上传完毕 + if (fileUrls.length >= inspectInfoData.length) { + _form.smarkUrls = fileUrls; + addDraft(_form).then(res => { + this.setData({ + loadShow: false + }); + if (res.code == 200) { + app.toast("新增数据成功!") + setTimeout(() => { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}`, + }) + }, 200); + } + }); + } + }); + }) + }, + + /** + * 这里考虑上传图片异步问题,封装为同步 + */ + syncUploadImage(file) { + let _baseUrl = config.baseUrl; + return new Promise((resolve, reject) => { + wx.uploadFile({ + url: _baseUrl + "/file/upload", // 上传的服务器接口地址 + filePath: file, + header: { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", + 'Authorization': 'Bearer ' + getToken() + }, + name: "file", //上传的所需字段,后端提供 + formData: {}, + success: (res) => { + // 上传完成操作 + const data = JSON.parse(res.data) + resolve({ + data: data + }) + }, + fail: (err) => { + //上传失败:修改pedding为reject + console.log("访问接口失败", err); + wx.showToast({ + title: "网络出错,上传失败", + icon: 'none', + duration: 1000 + }); + reject(err) + } + }); + }) + }, + + /** + * 选择问题类型 + * @param {*} e + */ + onSelectProblemType(e) { + this.setData({ + "form.problemType": e.detail.id, + }) + }, + + returnToPage: function () { + if (wx.getStorageSync('nav-menu') == "list") { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}` + }) + } else { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}` + }) + } + }, + + //新增问题 + onNewIssues() { + var data = this.data.inspectInfoData + if (data.length == 5) { + app.toast("一次最多只能提交5个问题!"); + return false; + } + data.push({ + image_upload: [] + }) + this.setData({ + inspectInfoData: data + }) + }, + + //删除 + onNewIssuesDelete(e) { + var index = e.currentTarget.dataset.index + var data = this.data.inspectInfoData + data.splice(index, 1) + this.setData({ + inspectInfoData: data + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/info/index.js b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/info/index.js index 078d624a..50e5cd65 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/info/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/info/index.js @@ -7,7 +7,7 @@ import { remove, findInfo, findAuditInfos -} from '../../../api/problemmodify' +} from '../../api/problemmodify' const app = getApp() Page({ @@ -106,9 +106,9 @@ Page({ let urls = []; if (item.files.length > 0) { item.files.forEach(_file => { - urls.push(config.baseImgUrl + _file.fileUrl); + urls.push(config.baseImgUrl + _file.fileUrl); }); - } + } this.setData({ auditInfo1: item, auditImageList: urls diff --git a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/list/index.js b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/list/index.js index f7ad41b7..e0402f29 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/list/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/list/index.js @@ -6,7 +6,7 @@ import { import { list, listCount -} from '../../../api/problemmodify' +} from '../../api/problemmodify' const app = getApp() Page({ diff --git a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/modify/index.js b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/modify/index.js index 1654062e..c75cb781 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/modify/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_problemmodify/modify/index.js @@ -1,288 +1,288 @@ import config from '../../../config' import { - getToken + getToken } from '../../../utils/auth' import { - findInfo, - findAuditInfos, - modifyProblemmodify -} from '../../../api/problemmodify' + findInfo, + findAuditInfos, + modifyProblemmodify +} from '../../api/problemmodify' const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - infoData: {}, - loadShow: false, - auditInfo1: {}, - auditInfo3: {}, - auditInfo4: {}, - form: {}, - imageInfoData: [], - imageList: [], - auditImageList: [], - active: 2, - flowNodes: [{ - text: '开始' - }, { - text: '提交隐患' - }, { - text: '隐患整改' - }, { - text: '隐患复检' - }, { - text: '结束' - }] - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - if (!getToken()) { - wx.redirectTo({ - url: '../../../pages/login/login', - }) - } - this.setData({ - type: options.type, - typeName: options.type == 1 ? "质量" : "安全", - }); - this.getInfo(options.id); - this.getAuditInfos(options.id); - }, - - /** - * 查详隐患详情 - * @param {*} id - */ - getInfo(id) { - findInfo(id).then(res => { - if (res.code == 200) { - let state = this.data.active; - if (res.data.checkState == "0") { - state = 2; - } else if (res.data.checkState == "1") { - state = 3; - } else if (res.data.checkState == "3") { - state = 2; - } - this.setData({ - active: state - }) - let urls = []; - if (res.data.smarkUrl) { - res.data.smarkUrl.split(',').forEach(item => { - urls.push(config.baseImgUrl + item); - }); - } - this.setData({ - infoData: res.data, - imageList: urls, - "form.mainId": res.data.id, - }) - } - }) - }, - - /** - * 查详隐患流程 - * @param {*} id - */ - getAuditInfos(id) { - findAuditInfos(id).then(res => { - if (res.code == 200 && res.data.length > 0) { - res.data.forEach(item => { - if (item.processState == "0") { - let urls = []; - if (item.files.length > 0) { - item.files.forEach(_file => { - urls.push(config.baseImgUrl + _file.fileUrl); - }); - } - this.setData({ - auditInfo1: item, - auditImageList: urls - }) - } else if (item.processState == "1") { - this.setData({ - auditInfo4: item - }) - } else if (item.processState == "2") { - this.setData({ - auditInfo3: item - }) - } - }); - } - }); - }, - - //取消页面 - cancelSaveView() { - this.returnToPage() - }, - - //保存 - onSubmitSave() { - let _form = { - ...this.data.form - }; - let { - imageInfoData - } = this.data - //数据效验 - if (!_form.mainId) { - app.toast("数据异常,请刷新页面重试!") - return false; - } - if (!_form.opinion) { - app.toast("请填写整改说明!") - return false; - } - if (imageInfoData.length == 0) { - app.toast("请上传整改后图片!") - return false; - } - this.setData({ - loadShow: true - }) - let that = this - let fileUrls = []; - imageInfoData.forEach(async (item) => { - let obj = await that.syncUploadImage(item); - fileUrls.push(obj.data.data.url); - //验证图片上传完毕 - if (fileUrls.length == imageInfoData.length) { - _form.processState = "0"; - _form.images = fileUrls.toString(); - modifyProblemmodify(_form).then(res => { - if (res.code == 200) { - app.toast("整改提交成功,请关注审核结果!") - setTimeout(() => { - wx.redirectTo({ - url: `../list/index?type=${this.data.type}`, - }) - }, 200) - } - }); - } - }) - }, - - /** - * 这里考虑上传图片异步问题,封装为同步 - */ - syncUploadImage(file) { - let _baseUrl = config.baseUrl; - return new Promise((resolve, reject) => { - wx.uploadFile({ - url: _baseUrl + "/file/upload", // 上传的服务器接口地址 - filePath: file, - header: { - "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", - 'Authorization': 'Bearer ' + getToken() - }, - name: "file", //上传的所需字段,后端提供 - formData: {}, - success: (res) => { - // 上传完成操作 - const data = JSON.parse(res.data) - resolve({ - data: data - }) - }, - fail: (err) => { - //上传失败:修改pedding为reject - console.log("访问接口失败", err); - wx.showToast({ - title: "网络出错,上传失败", - icon: 'none', - duration: 1000 - }); - reject(err) - } - }); - }) - }, - - //展示图片 - showImg: function (e) { - let img = e.target.dataset.set; - wx.previewImage({ - urls: img.split(','), - current: 0 - }) - }, - - returnToPage: function () { - wx.redirectTo({ - url: `../list/index?type=${this.data.type}` - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - // 整改说明 - onInputOpinion(e) { - this.setData({ - "form.opinion": e.detail.value - }) - }, - - // 上传图片 - onImagesArr(e) { - this.setData({ - imageInfoData: e.detail - }) - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { + /** + * 页面的初始数据 + */ + data: { + infoData: {}, + loadShow: false, + auditInfo1: {}, + auditInfo3: {}, + auditInfo4: {}, + form: {}, + imageInfoData: [], + imageList: [], + auditImageList: [], + active: 2, + flowNodes: [{ + text: '开始' + }, { + text: '提交隐患' + }, { + text: '隐患整改' + }, { + text: '隐患复检' + }, { + text: '结束' + }] + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (!getToken()) { + wx.redirectTo({ + url: '../../../pages/login/login', + }) } + this.setData({ + type: options.type, + typeName: options.type == 1 ? "质量" : "安全", + }); + this.getInfo(options.id); + this.getAuditInfos(options.id); + }, + + /** + * 查详隐患详情 + * @param {*} id + */ + getInfo(id) { + findInfo(id).then(res => { + if (res.code == 200) { + let state = this.data.active; + if (res.data.checkState == "0") { + state = 2; + } else if (res.data.checkState == "1") { + state = 3; + } else if (res.data.checkState == "3") { + state = 2; + } + this.setData({ + active: state + }) + let urls = []; + if (res.data.smarkUrl) { + res.data.smarkUrl.split(',').forEach(item => { + urls.push(config.baseImgUrl + item); + }); + } + this.setData({ + infoData: res.data, + imageList: urls, + "form.mainId": res.data.id, + }) + } + }) + }, + + /** + * 查详隐患流程 + * @param {*} id + */ + getAuditInfos(id) { + findAuditInfos(id).then(res => { + if (res.code == 200 && res.data.length > 0) { + res.data.forEach(item => { + if (item.processState == "0") { + let urls = []; + if (item.files.length > 0) { + item.files.forEach(_file => { + urls.push(config.baseImgUrl + _file.fileUrl); + }); + } + this.setData({ + auditInfo1: item, + auditImageList: urls + }) + } else if (item.processState == "1") { + this.setData({ + auditInfo4: item + }) + } else if (item.processState == "2") { + this.setData({ + auditInfo3: item + }) + } + }); + } + }); + }, + + //取消页面 + cancelSaveView() { + this.returnToPage() + }, + + //保存 + onSubmitSave() { + let _form = { + ...this.data.form + }; + let { + imageInfoData + } = this.data + //数据效验 + if (!_form.mainId) { + app.toast("数据异常,请刷新页面重试!") + return false; + } + if (!_form.opinion) { + app.toast("请填写整改说明!") + return false; + } + if (imageInfoData.length == 0) { + app.toast("请上传整改后图片!") + return false; + } + this.setData({ + loadShow: true + }) + let that = this + let fileUrls = []; + imageInfoData.forEach(async (item) => { + let obj = await that.syncUploadImage(item); + fileUrls.push(obj.data.data.url); + //验证图片上传完毕 + if (fileUrls.length == imageInfoData.length) { + _form.processState = "0"; + _form.images = fileUrls.toString(); + modifyProblemmodify(_form).then(res => { + if (res.code == 200) { + app.toast("整改提交成功,请关注审核结果!") + setTimeout(() => { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}`, + }) + }, 200) + } + }); + } + }) + }, + + /** + * 这里考虑上传图片异步问题,封装为同步 + */ + syncUploadImage(file) { + let _baseUrl = config.baseUrl; + return new Promise((resolve, reject) => { + wx.uploadFile({ + url: _baseUrl + "/file/upload", // 上传的服务器接口地址 + filePath: file, + header: { + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", + 'Authorization': 'Bearer ' + getToken() + }, + name: "file", //上传的所需字段,后端提供 + formData: {}, + success: (res) => { + // 上传完成操作 + const data = JSON.parse(res.data) + resolve({ + data: data + }) + }, + fail: (err) => { + //上传失败:修改pedding为reject + console.log("访问接口失败", err); + wx.showToast({ + title: "网络出错,上传失败", + icon: 'none', + duration: 1000 + }); + reject(err) + } + }); + }) + }, + + //展示图片 + showImg: function (e) { + let img = e.target.dataset.set; + wx.previewImage({ + urls: img.split(','), + current: 0 + }) + }, + + returnToPage: function () { + wx.redirectTo({ + url: `../list/index?type=${this.data.type}` + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + // 整改说明 + onInputOpinion(e) { + this.setData({ + "form.opinion": e.detail.value + }) + }, + + // 上传图片 + onImagesArr(e) { + this.setData({ + imageInfoData: e.detail + }) + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_quality/index.js b/yanzhu-ui-app/miniprogram/pageage/project_quality/index.js index c04686a9..1a598b3e 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_quality/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_quality/index.js @@ -1,214 +1,214 @@ import { - getToken, - getUserInfo + getToken, + getUserInfo } from '../../utils/auth' import { - findUserMenuList + findUserMenuList } from '../../api/publics' import { - findMyTask -} from '../../api/flowable' + findMyTask +} from '../api/flowable' import { - findGroupCountView -} from '../../api/problemmodify' + findGroupCountView +} from '../api/problemmodify' const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - active: 2, - projectId: '', - projectName: '', - subDeptUserInfo: {}, - menuList: [], - initData: {}, - aqglDb: 0, - zlyhDB: 0, - zlglDb: 0, - todoDB: 0, - checkList: [{ - id: 1, - name: "日常巡检问题", - rate: 0, //整改率 - total: 0, //问题总数 - number: 0, //检查次数 - }, { - id: 2, - name: "周检隐患问题", - rate: 0, //整改率 - total: 0, //问题总数 - number: 0, //检查次数 - }, { - id: 3, - name: "月检隐患问题", - rate: 0, //整改率 - total: 0, //问题总数 - number: 0, //检查次数 - }, { - id: 4, - name: "专项检查问题", - rate: 0, //整改率 - total: 0, //问题总数 - number: 0, //检查次数 - }], - showZlyhpcDetail:false - }, + /** + * 页面的初始数据 + */ + data: { + active: 2, + projectId: '', + projectName: '', + subDeptUserInfo: {}, + menuList: [], + initData: {}, + aqglDb: 0, + zlyhDB: 0, + zlglDb: 0, + todoDB: 0, + checkList: [{ + id: 1, + name: "日常巡检问题", + rate: 0, //整改率 + total: 0, //问题总数 + number: 0, //检查次数 + }, { + id: 2, + name: "周检隐患问题", + rate: 0, //整改率 + total: 0, //问题总数 + number: 0, //检查次数 + }, { + id: 3, + name: "月检隐患问题", + rate: 0, //整改率 + total: 0, //问题总数 + number: 0, //检查次数 + }, { + id: 4, + name: "专项检查问题", + rate: 0, //整改率 + total: 0, //问题总数 + number: 0, //检查次数 + }], + showZlyhpcDetail: false + }, - //项目切换 返回值 - onProjectSelect(e) { - let projectId = e.detail.id; - let projectName = e.detail.text; - app.globalData.useProjectId = projectId; - app.globalData.useProjectName = projectName; - this.onLoad(); - }, + //项目切换 返回值 + onProjectSelect(e) { + let projectId = e.detail.id; + let projectName = e.detail.text; + app.globalData.useProjectId = projectId; + app.globalData.useProjectName = projectName; + this.onLoad(); + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - if (!getToken()) { - wx.redirectTo({ - url: '../../pages/login/login', - }) - } - const proUserInfo = getUserInfo(); - this.setData({ - projectId: app.globalData.useProjectId, - projectName: app.globalData.useProjectName, - initData: { - id: app.globalData.useProjectId, - text: app.globalData.useProjectName, - }, - subDeptUserInfo: proUserInfo.projectUserInfo, - }); - //用户权限菜单 - this.getUserMenuList(app.globalData.useProjectId); - this.awaitTask(); - this.getGroupCountView(app.globalData.useProjectId, 1); - }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if (!getToken()) { + wx.redirectTo({ + url: '../../pages/login/login', + }) + } + const proUserInfo = getUserInfo(); + this.setData({ + projectId: app.globalData.useProjectId, + projectName: app.globalData.useProjectName, + initData: { + id: app.globalData.useProjectId, + text: app.globalData.useProjectName, + }, + subDeptUserInfo: proUserInfo.projectUserInfo, + }); + //用户权限菜单 + this.getUserMenuList(app.globalData.useProjectId); + this.awaitTask(); + this.getGroupCountView(app.globalData.useProjectId, 1); + }, - /** - * 查询功能菜单 - * @param {*} proId - */ - getUserMenuList: function (proId) { - findUserMenuList(proId, 'zlgl').then(res => { - if (res.code == 200) { - res.data.forEach(item =>{ - if(item.menuIdenti=='ZLYHPC'){ - this.setData({ - showZlyhpcDetail: true - }) - } - }); - this.setData({ - menuList: res.data - }) - } - }); - }, - - /** - * 项目分组查询统计 - * @param {*} proId - * @param {*} type - */ - getGroupCountView(proId, type) { - findGroupCountView(proId, type).then(res => { - let _checkList = this.data.checkList; - //隐患统计数据 - res.data.forEach((item, idx) => { - let _index = parseInt(item.problemType - 1); - _checkList[_index].rate = (item.comTotal / item.total * 100).toFixed(2); - _checkList[_index].total = item.comTotal; - _checkList[_index].number = item.total; - }); + /** + * 查询功能菜单 + * @param {*} proId + */ + getUserMenuList: function (proId) { + findUserMenuList(proId, 'zlgl').then(res => { + if (res.code == 200) { + res.data.forEach(item => { + if (item.menuIdenti == 'ZLYHPC') { this.setData({ - checkList: _checkList + showZlyhpcDetail: true }) + } }); - }, - - goMenu: function (event) { - let _url = event.currentTarget.dataset.url; - if (!_url) { - app.toast("正在建设中...") - return false; - } - wx.setStorageSync('nav-menu', "zlgl"); - wx.redirectTo({ - url: _url - }) - }, - - // 底部导航 - onChange(event) { - // event.detail 的值为当前选中项的索引 this.setData({ - active: event.detail - }); - }, - - //跳转到项目概况 - XMGK: function () { - wx.setStorageSync('nav-menu', "xmgk"); - wx.redirectTo({ - url: '../project_info/index' + menuList: res.data }) - }, + } + }); + }, - //跳转到安全管理 - AQGL: function () { - wx.setStorageSync('nav-menu', "aqgl"); - wx.redirectTo({ - url: '../project_safety/index' + /** + * 项目分组查询统计 + * @param {*} proId + * @param {*} type + */ + getGroupCountView(proId, type) { + findGroupCountView(proId, type).then(res => { + let _checkList = this.data.checkList; + //隐患统计数据 + res.data.forEach((item, idx) => { + let _index = parseInt(item.problemType - 1); + _checkList[_index].rate = (item.comTotal / item.total * 100).toFixed(2); + _checkList[_index].total = item.comTotal; + _checkList[_index].number = item.total; + }); + this.setData({ + checkList: _checkList + }) + }); + }, + + goMenu: function (event) { + let _url = event.currentTarget.dataset.url; + if (!_url) { + app.toast("正在建设中...") + return false; + } + wx.setStorageSync('nav-menu', "zlgl"); + wx.redirectTo({ + url: _url + }) + }, + + // 底部导航 + onChange(event) { + // event.detail 的值为当前选中项的索引 + this.setData({ + active: event.detail + }); + }, + + //跳转到项目概况 + XMGK: function () { + wx.setStorageSync('nav-menu', "xmgk"); + wx.redirectTo({ + url: '../project_info/index' + }) + }, + + //跳转到安全管理 + AQGL: function () { + wx.setStorageSync('nav-menu', "aqgl"); + wx.redirectTo({ + url: '../project_safety/index' + }) + }, + + //跳转到进度管理 + JDGL: function () { + wx.setStorageSync('nav-menu', "zlgl"); + wx.redirectTo({ + url: '../project_schedule/list/index' + }) + }, + + //跳转到项目管理 + XMGL: function () { + wx.setStorageSync('nav-menu', "xmgl"); + wx.redirectTo({ + url: '../project_more/index' + }) + }, + + //质量隐患详情跳转 + goZLYH: function () { + wx.setStorageSync('nav-menu', "zlgl"); + wx.redirectTo({ + url: '../project_problemmodify/list/index?type=1' + }) + }, + + /** + * 统计代办 + */ + awaitTask() { + let param = "proId=" + app.globalData.useProjectId; + findMyTask(param).then(res => { + if (res.code == 200) { + let proUserInfo = this.data.subDeptUserInfo; + this.setData({ + aqglDb: proUserInfo.subDeptType == "1" ? res.data.aqgl : 0, + zlyhDB: res.data.zlyl, + zlglDb: proUserInfo.subDeptType == "1" ? res.data.zlgl : 0, + todoDb: proUserInfo.subDeptType == "1" ? (res.data.dwsh + res.data.rysh) : res.data.todo }) - }, - - //跳转到进度管理 - JDGL: function () { - wx.setStorageSync('nav-menu', "zlgl"); - wx.redirectTo({ - url: '../project_schedule/list/index' - }) - }, - - //跳转到项目管理 - XMGL: function () { - wx.setStorageSync('nav-menu', "xmgl"); - wx.redirectTo({ - url: '../project_more/index' - }) - }, - - //质量隐患详情跳转 - goZLYH: function () { - wx.setStorageSync('nav-menu', "zlgl"); - wx.redirectTo({ - url: '../project_problemmodify/list/index?type=1' - }) - }, - - /** - * 统计代办 - */ - awaitTask() { - let param = "proId=" + app.globalData.useProjectId; - findMyTask(param).then(res => { - if (res.code == 200) { - let proUserInfo = this.data.subDeptUserInfo; - this.setData({ - aqglDb: proUserInfo.subDeptType == "1" ? res.data.aqgl : 0, - zlyhDB: res.data.zlyl, - zlglDb: proUserInfo.subDeptType == "1" ? res.data.zlgl : 0, - todoDb: proUserInfo.subDeptType == "1" ? (res.data.dwsh + res.data.rysh) : res.data.todo - }) - } - }); - }, + } + }); + }, }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_safety/index.js b/yanzhu-ui-app/miniprogram/pageage/project_safety/index.js index 978968b0..41a81cf8 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_safety/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_safety/index.js @@ -1,213 +1,213 @@ import { - getToken, - getUserInfo + getToken, + getUserInfo } from '../../utils/auth' import { - findUserMenuList + findUserMenuList } from '../../api/publics' import { - findMyTask -} from '../../api/flowable' + findMyTask +} from '../api/flowable' import { - findGroupCountView -} from '../../api/problemmodify' + findGroupCountView +} from '../api/problemmodify' const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - active: 1, - projectId: '', - projectName: '', - subDeptUserInfo: {}, - menuList: [], - initData: {}, - aqyhDB: 0, - aqglDB: 0, - zlglDB: 0, - todoDB: 0, - checkList: [{ - id: 1, - name: "日常巡检问题", - rate: 0, //整改率 - total: 0, //问题总数 - number: 0, //检查次数 - }, { - id: 2, - name: "周检隐患问题", - rate: 0, //整改率 - total: 0, //问题总数 - number: 0, //检查次数 - }, { - id: 3, - name: "月检隐患问题", - rate: 0, //整改率 - total: 0, //问题总数 - number: 0, //检查次数 - }, { - id: 4, - name: "专项检查问题", - rate: 0, //整改率 - total: 0, //问题总数 - number: 0, //检查次数 - }], - showAqyhpcDetail:false, - }, + /** + * 页面的初始数据 + */ + data: { + active: 1, + projectId: '', + projectName: '', + subDeptUserInfo: {}, + menuList: [], + initData: {}, + aqyhDB: 0, + aqglDB: 0, + zlglDB: 0, + todoDB: 0, + checkList: [{ + id: 1, + name: "日常巡检问题", + rate: 0, //整改率 + total: 0, //问题总数 + number: 0, //检查次数 + }, { + id: 2, + name: "周检隐患问题", + rate: 0, //整改率 + total: 0, //问题总数 + number: 0, //检查次数 + }, { + id: 3, + name: "月检隐患问题", + rate: 0, //整改率 + total: 0, //问题总数 + number: 0, //检查次数 + }, { + id: 4, + name: "专项检查问题", + rate: 0, //整改率 + total: 0, //问题总数 + number: 0, //检查次数 + }], + showAqyhpcDetail: false, + }, - //项目切换 返回值 - onProjectSelect(e) { - let projectId = e.detail.id; - let projectName = e.detail.text; - app.globalData.useProjectId = projectId; - app.globalData.useProjectName = projectName; - this.onLoad(); - }, + //项目切换 返回值 + onProjectSelect(e) { + let projectId = e.detail.id; + let projectName = e.detail.text; + app.globalData.useProjectId = projectId; + app.globalData.useProjectName = projectName; + this.onLoad(); + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - if (!getToken()) { - wx.redirectTo({ - url: '../../pages/login/login', - }) - } - const proUserInfo = getUserInfo(); - this.setData({ - projectId: app.globalData.useProjectId, - projectName: app.globalData.useProjectName, - initData: { - id: app.globalData.useProjectId, - text: app.globalData.useProjectName, - }, - subDeptUserInfo: proUserInfo.projectUserInfo, - }); - //用户权限菜单 - this.getUserMenuList(app.globalData.useProjectId); - this.awaitTask(); - this.getGroupCountView(app.globalData.useProjectId, 0); - }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if (!getToken()) { + wx.redirectTo({ + url: '../../pages/login/login', + }) + } + const proUserInfo = getUserInfo(); + this.setData({ + projectId: app.globalData.useProjectId, + projectName: app.globalData.useProjectName, + initData: { + id: app.globalData.useProjectId, + text: app.globalData.useProjectName, + }, + subDeptUserInfo: proUserInfo.projectUserInfo, + }); + //用户权限菜单 + this.getUserMenuList(app.globalData.useProjectId); + this.awaitTask(); + this.getGroupCountView(app.globalData.useProjectId, 0); + }, - /** - * 查询功能菜单 - * @param {*} proId - */ - getUserMenuList: function (proId) { - findUserMenuList(proId, 'aqgl').then(res => { - if (res.code == 200) { - res.data.forEach(item =>{ - if(item.menuIdenti=='AQYHPC'){ - this.setData({ - showAqyhpcDetail: true - }) - } - }); - this.setData({ - menuList: res.data - }) - } - }); - }, - - /** - * 项目分组查询统计 - * @param {*} proId - * @param {*} type - */ - getGroupCountView(proId, type) { - findGroupCountView(proId, type).then(res => { - let _checkList = this.data.checkList; - //隐患统计数据 - res.data.forEach((item, idx) => { - let _index = parseInt(item.problemType - 1); - _checkList[_index].rate = (item.comTotal / item.total * 100).toFixed(2); - _checkList[_index].total = item.comTotal; - _checkList[_index].number = item.total; - }); + /** + * 查询功能菜单 + * @param {*} proId + */ + getUserMenuList: function (proId) { + findUserMenuList(proId, 'aqgl').then(res => { + if (res.code == 200) { + res.data.forEach(item => { + if (item.menuIdenti == 'AQYHPC') { this.setData({ - checkList: _checkList + showAqyhpcDetail: true }) + } }); - }, - - goMenu: function (event) { - let _url = event.currentTarget.dataset.url; - if (!_url) { - app.toast("正在建设中...") - return false; - } - wx.setStorageSync('nav-menu', "aqgl"); - wx.redirectTo({ - url: _url - }) - }, - - // 底部导航 - onChange(event) { - // event.detail 的值为当前选中项的索引 this.setData({ - active: event.detail - }); - }, - - //跳转到项目概况 - XMGK: function () { - wx.setStorageSync('nav-menu', "xmgk"); - wx.redirectTo({ - url: '../project_info/index' + menuList: res.data }) - }, + } + }); + }, - //跳转到质量管理 - ZLGL: function () { - wx.setStorageSync('nav-menu', "zlgl"); - wx.redirectTo({ - url: '../project_quality/index' + /** + * 项目分组查询统计 + * @param {*} proId + * @param {*} type + */ + getGroupCountView(proId, type) { + findGroupCountView(proId, type).then(res => { + let _checkList = this.data.checkList; + //隐患统计数据 + res.data.forEach((item, idx) => { + let _index = parseInt(item.problemType - 1); + _checkList[_index].rate = (item.comTotal / item.total * 100).toFixed(2); + _checkList[_index].total = item.comTotal; + _checkList[_index].number = item.total; + }); + this.setData({ + checkList: _checkList + }) + }); + }, + + goMenu: function (event) { + let _url = event.currentTarget.dataset.url; + if (!_url) { + app.toast("正在建设中...") + return false; + } + wx.setStorageSync('nav-menu', "aqgl"); + wx.redirectTo({ + url: _url + }) + }, + + // 底部导航 + onChange(event) { + // event.detail 的值为当前选中项的索引 + this.setData({ + active: event.detail + }); + }, + + //跳转到项目概况 + XMGK: function () { + wx.setStorageSync('nav-menu', "xmgk"); + wx.redirectTo({ + url: '../project_info/index' + }) + }, + + //跳转到质量管理 + ZLGL: function () { + wx.setStorageSync('nav-menu', "zlgl"); + wx.redirectTo({ + url: '../project_quality/index' + }) + }, + + //跳转到进度管理 + JDGL: function () { + wx.setStorageSync('nav-menu', "aqgl"); + wx.redirectTo({ + url: '../project_schedule/list/index' + }) + }, + + //跳转到项目管理 + XMGL: function () { + wx.setStorageSync('nav-menu', "xmgl"); + wx.redirectTo({ + url: '../project_more/index' + }) + }, + + //安全隐患详情跳转 + goAQYH: function () { + wx.setStorageSync('nav-menu', "aqgl"); + wx.redirectTo({ + url: '../project_problemmodify/list/index?type=0' + }) + }, + + /** + * 统计代办 + */ + awaitTask() { + let param = "proId=" + app.globalData.useProjectId; + findMyTask(param).then(res => { + if (res.code == 200) { + let proUserInfo = this.data.subDeptUserInfo; + this.setData({ + aqyhDB: res.data.aqyh, + aqglDb: proUserInfo.subDeptType == "1" ? res.data.aqgl : 0, + zlglDb: proUserInfo.subDeptType == "1" ? res.data.zlgl : 0, + todoDb: proUserInfo.subDeptType == "1" ? (res.data.dwsh + res.data.rysh) : res.data.todo }) - }, - - //跳转到进度管理 - JDGL: function () { - wx.setStorageSync('nav-menu', "aqgl"); - wx.redirectTo({ - url: '../project_schedule/list/index' - }) - }, - - //跳转到项目管理 - XMGL: function () { - wx.setStorageSync('nav-menu', "xmgl"); - wx.redirectTo({ - url: '../project_more/index' - }) - }, - - //安全隐患详情跳转 - goAQYH: function () { - wx.setStorageSync('nav-menu', "aqgl"); - wx.redirectTo({ - url: '../project_problemmodify/list/index?type=0' - }) - }, - - /** - * 统计代办 - */ - awaitTask() { - let param = "proId=" + app.globalData.useProjectId; - findMyTask(param).then(res => { - if (res.code == 200) { - let proUserInfo = this.data.subDeptUserInfo; - this.setData({ - aqyhDB: res.data.aqyh, - aqglDb: proUserInfo.subDeptType == "1" ? res.data.aqgl : 0, - zlglDb: proUserInfo.subDeptType == "1" ? res.data.zlgl : 0, - todoDb: proUserInfo.subDeptType == "1" ? (res.data.dwsh + res.data.rysh) : res.data.todo - }) - } - }); - }, + } + }); + }, }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_schedule/list/index.js b/yanzhu-ui-app/miniprogram/pageage/project_schedule/list/index.js index 7291ceaa..a124fa47 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_schedule/list/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_schedule/list/index.js @@ -1,77 +1,77 @@ import config from '../../../config' import { - getToken, - getUserInfo + getToken, + getUserInfo } from '../../../utils/auth' import { - findMyTask -} from '../../../api/flowable' + findMyTask +} from '../../api/flowable' import { - planScheduleList + planScheduleList } from '../../../api/project' const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - active: 3, - projectId: '', - projectName: '', - subDeptUserInfo: {}, - initData: {}, - aqglDb: 0, - zlyhDB: 0, - zlglDb: 0, - todoDB: 0, - pageNum: 1, - pageSize: 10, - total: 0, - listData: [], - imgBaseUrl:config.baseImgUrl - }, - - - //项目切换 返回值 - onProjectSelect(e) { - let projectId = e.detail.id; - let projectName = e.detail.text; - app.globalData.useProjectId = projectId; - app.globalData.useProjectName = projectName; - this.onLoad(); - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - if (!getToken()) { - wx.redirectTo({ - url: '../../../pages/login/login', - }) - } - const proUserInfo = getUserInfo(); - this.setData({ - projectId: app.globalData.useProjectId, - projectName: app.globalData.useProjectName, - initData: { - id: app.globalData.useProjectId, - text: app.globalData.useProjectName, - }, - subDeptUserInfo: proUserInfo.projectUserInfo, - pageNum: 1, - pageSize: 10, - total: 0, - listData: [], - }); - this.awaitTask(); - this.getListData(); - }, - - /** - * 添加进度计划 + /** + * 页面的初始数据 */ + data: { + active: 3, + projectId: '', + projectName: '', + subDeptUserInfo: {}, + initData: {}, + aqglDb: 0, + zlyhDB: 0, + zlglDb: 0, + todoDB: 0, + pageNum: 1, + pageSize: 10, + total: 0, + listData: [], + imgBaseUrl: config.baseImgUrl + }, + + + //项目切换 返回值 + onProjectSelect(e) { + let projectId = e.detail.id; + let projectName = e.detail.text; + app.globalData.useProjectId = projectId; + app.globalData.useProjectName = projectName; + this.onLoad(); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if (!getToken()) { + wx.redirectTo({ + url: '../../../pages/login/login', + }) + } + const proUserInfo = getUserInfo(); + this.setData({ + projectId: app.globalData.useProjectId, + projectName: app.globalData.useProjectName, + initData: { + id: app.globalData.useProjectId, + text: app.globalData.useProjectName, + }, + subDeptUserInfo: proUserInfo.projectUserInfo, + pageNum: 1, + pageSize: 10, + total: 0, + listData: [], + }); + this.awaitTask(); + this.getListData(); + }, + + /** +* 添加进度计划 +*/ skipAdd() { wx.redirectTo({ url: `../add/index`, @@ -82,111 +82,111 @@ Page({ * 查看进度详情 * @param {*} e */ - getInfo(e) { - let { - id - } = e.currentTarget.dataset.set - wx.redirectTo({ - url: `../info/index?id=${id}`, - }) - }, + getInfo(e) { + let { + id + } = e.currentTarget.dataset.set + wx.redirectTo({ + url: `../info/index?id=${id}`, + }) + }, - /** - * 数据加载 - */ - getListData() { - let params = "pageNum=" + this.data.pageNum + "&pageSize=" + this.data.pageSize + "&projectId=" + app.globalData.useProjectId; - planScheduleList(params).then(res => { - if (res.code == 200) { - res.rows.forEach(item => { - let _tsk = item.taskName.split(' / '); - item.mainPlan = _tsk[_tsk.length]; - item.planName = item.taskName.replace(item.mainPlan + " / "); - if (item.images) { - item.mainImage = item.images.split(',')[0]; - } else { - item.mainImage = "default"; - } - }); - this.setData({ - total: res.total, - listData: this.data.listData.concat(res.rows) - }) - } + /** + * 数据加载 + */ + getListData() { + let params = "pageNum=" + this.data.pageNum + "&pageSize=" + this.data.pageSize + "&projectId=" + app.globalData.useProjectId; + planScheduleList(params).then(res => { + if (res.code == 200) { + res.rows.forEach(item => { + let _tsk = item.taskName.split(' / '); + item.mainPlan = _tsk[_tsk.length]; + item.planName = item.taskName.replace(item.mainPlan + " / "); + if (item.images) { + item.mainImage = item.images.split(',')[0]; + } else { + item.mainImage = "default"; + } }); - }, - - /** - * 滚动加载 - */ - onScrollToLower() { - let nal = Math.ceil(this.data.total / this.data.pageSize); - if (this.data.pageNum < nal) { - this.setData({ - pageNum: this.data.pageNum + 1 - }); - this.getListData(); - } else { - console.log("已经到底了,没有数据可加载!!!"); - } - }, - - // 底部导航 - onChange(event) { - // event.detail 的值为当前选中项的索引 this.setData({ - active: event.detail - }); - }, - - //跳转到项目概况 - XMGK: function () { - wx.setStorageSync('nav-menu', "xmgk"); - wx.redirectTo({ - url: '../../project_info/index' + total: res.total, + listData: this.data.listData.concat(res.rows) }) - }, + } + }); + }, - //跳转到安全管理 - AQGL: function () { - wx.setStorageSync('nav-menu', "aqgl"); - wx.redirectTo({ - url: '../../project_safety/index' + /** + * 滚动加载 + */ + onScrollToLower() { + let nal = Math.ceil(this.data.total / this.data.pageSize); + if (this.data.pageNum < nal) { + this.setData({ + pageNum: this.data.pageNum + 1 + }); + this.getListData(); + } else { + console.log("已经到底了,没有数据可加载!!!"); + } + }, + + // 底部导航 + onChange(event) { + // event.detail 的值为当前选中项的索引 + this.setData({ + active: event.detail + }); + }, + + //跳转到项目概况 + XMGK: function () { + wx.setStorageSync('nav-menu', "xmgk"); + wx.redirectTo({ + url: '../../project_info/index' + }) + }, + + //跳转到安全管理 + AQGL: function () { + wx.setStorageSync('nav-menu', "aqgl"); + wx.redirectTo({ + url: '../../project_safety/index' + }) + }, + + //跳转到质量管理 + ZLGL: function () { + wx.setStorageSync('nav-menu', "zlgl"); + wx.redirectTo({ + url: '../../project_quality/index' + }) + }, + + //跳转到项目管理 + XMGL: function () { + wx.setStorageSync('nav-menu', "xmgl"); + wx.redirectTo({ + url: '../../project_more/index' + }) + }, + + /** + * 统计代办 + */ + awaitTask() { + let param = "proId=" + app.globalData.useProjectId; + findMyTask(param).then(res => { + if (res.code == 200) { + let proUserInfo = this.data.subDeptUserInfo; + this.setData({ + aqglDb: proUserInfo.subDeptType == "1" ? res.data.aqgl : 0, + zlyhDB: res.data.zlyl, + zlglDb: proUserInfo.subDeptType == "1" ? res.data.zlgl : 0, + todoDb: proUserInfo.subDeptType == "1" ? (res.data.dwsh + res.data.rysh) : res.data.todo }) - }, - - //跳转到质量管理 - ZLGL: function () { - wx.setStorageSync('nav-menu', "zlgl"); - wx.redirectTo({ - url: '../../project_quality/index' - }) - }, - - //跳转到项目管理 - XMGL: function () { - wx.setStorageSync('nav-menu', "xmgl"); - wx.redirectTo({ - url: '../../project_more/index' - }) - }, - - /** - * 统计代办 - */ - awaitTask() { - let param = "proId=" + app.globalData.useProjectId; - findMyTask(param).then(res => { - if (res.code == 200) { - let proUserInfo = this.data.subDeptUserInfo; - this.setData({ - aqglDb: proUserInfo.subDeptType == "1" ? res.data.aqgl : 0, - zlyhDB: res.data.zlyl, - zlglDb: proUserInfo.subDeptType == "1" ? res.data.zlgl : 0, - todoDb: proUserInfo.subDeptType == "1" ? (res.data.dwsh + res.data.rysh) : res.data.todo - }) - } - }); - }, + } + }); + }, }) \ No newline at end of file