jhwxapp/miniprogram/pages/project_flowable/editTask/index.js

878 lines
26 KiB
JavaScript
Raw Normal View History

2024-03-17 16:19:31 +08:00
import config from '../../../config'
2024-05-03 10:37:27 +08:00
import {
getDictCache
} from '../../../api/publics'
2023-09-17 02:08:35 +08:00
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
2024-05-03 10:37:27 +08:00
maxDate: new Date(2088, 1, 1).getTime(),
deptName: "",
userId: "",
nickName: "",
loginName: "",
projectId: "",
projectName: "",
procInsId: "",
infoData: {},
procDefName: "",
deployId: "",
activeName: "",
flowNodeList: [],
flowNodes: [],
comment: "",
taskId: "",
procInsId: "",
2024-08-31 10:48:34 +08:00
procDefKey: "",
2024-05-03 10:37:27 +08:00
backShow: false,
targetKey: "",
targetKeyList: [],
taskName: "",
passState: true,
backName: "",
ret: "",
remark: "",
filesData: [],
limit: 30,
fileType: ["pdf"],
imageType: ["png", "jpg", "jpeg"],
imageInfoData: [],
2024-03-17 16:19:31 +08:00
isFiles: null,
2024-04-14 21:28:11 +08:00
active: 100,
2024-05-03 10:37:27 +08:00
rejectNode: false,
fbAptitude: false,
subDeptTypes: [],
subDeptScopes: [],
2024-07-09 21:42:49 +08:00
persChange1: false,
persChange2: false,
2024-08-31 10:48:34 +08:00
gwmxChange0: false,
2023-09-17 02:08:35 +08:00
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
2024-05-03 10:37:27 +08:00
let {
deployId,
procInsId,
procDefName,
deptName,
nickName,
taskId,
taskName,
projectName,
ret,
procDefKey
} = options
if (procDefKey == "flow_fbzzsp_fbszzsp") {
this.getDicts();
2023-09-17 02:08:35 +08:00
this.setData({
2024-05-03 10:37:27 +08:00
fbAptitude: true
2023-09-17 02:08:35 +08:00
})
2024-05-03 10:37:27 +08:00
}
2024-08-31 10:48:34 +08:00
if(procDefKey == "flow_zxys_gzmjtys"){
this.setData({
gwmxChange0: true
})
}
2024-07-09 21:42:49 +08:00
if (procDefKey == "flow_xmglzdl_xmzbdwrybg" || procDefKey == "flow_xmglzdl_xmjldwrybg") {
this.setData({
persChange1: true
})
}
if (procDefKey == "flow_xmglzdl_xmjlzjrybg" || procDefKey == "flow_xmglzdl_xmzbjlrybg") {
this.setData({
persChange2: true
})
}
2024-05-03 10:37:27 +08:00
//获取缓存数据
wx.getStorage({
key: 'userinfo',
success: res => {
this.setData({
projectId: app.globalData.projectId,
projectName,
procInsId,
2024-08-31 10:48:34 +08:00
procDefKey,
2024-05-03 10:37:27 +08:00
procDefName,
deployId,
deptName,
nickName,
taskId,
taskName,
ret,
userId: res.data.userId,
loginName: res.data.loginName,
})
this.getFlowRecordList();
this.getFlowNodes();
this.getFormDatasList();
//this.initTargetKeyList();
}
})
},
//获取字典信息
getDicts() {
let that = this;
/*关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面*/
getDictCache('flow_sub_dept_type').then(res => {
if (res.code == 200) {
let typeList = [];
res.data.forEach(item => {
typeList.push({
"id": item.dictValue,
"text": item.dictLabel
});
})
that.setData({
subDeptTypes: typeList
})
}
});
getDictCache('flow_sub_dept_scope').then(res => {
if (res.code == 200) {
let scopeList = [];
res.data.forEach(item => {
scopeList.push({
"id": item.dictValue,
"text": item.dictLabel,
"type": false
});
})
that.setData({
subDeptScopes: scopeList
})
}
});
},
//选择分包类型
onSelectSubDeptTypes(e) {
this.setData({
"infoData.subDeptType": e.detail.id
})
},
//选择分包范围
onSelectSubDeptScopes(e) {
let list = [];
e.detail.forEach(it =>{
if(it.id){
list.push(it.id)
}
})
this.setData({
"infoData.subDeptScope": list.toString()
})
},
//输入分包单位名称
inputSubDeptName(e) {
this.setData({
"infoData.subDeptName": e.detail.value
})
},
//输入分包单位资质
inputSubDeptAptitude(e) {
this.setData({
"infoData.subDeptAptitude": e.detail.value
})
2023-09-17 02:08:35 +08:00
},
2024-05-03 10:37:27 +08:00
//输入分包单位法人代表
inputSubDeptChairman(e) {
this.setData({
"infoData.subDeptChairman": e.detail.value
})
},
//输入分包单位安全证书
inputSubDeptSafetyCertificate(e) {
this.setData({
"infoData.subDeptSafetyCertificate": e.detail.value
})
},
//输入分包单位项目经理
inputSubDeptCustodian(e) {
this.setData({
"infoData.subDeptCustodian": e.detail.value
})
},
//输入分包单位名称
inputSubDeptCustodianCardId(e) {
this.setData({
"infoData.subDeptCustodianCardId": e.detail.value
})
},
//选择分包进场时间
inputSubDeptApproachDate(e) {
this.setData({
"infoData.subDeptApproachDate": e.detail
})
},
getFlowNode(val) {
2023-09-17 02:08:35 +08:00
let flowNodeList = this.data.flowNodeList;
2024-05-03 10:37:27 +08:00
for (let i = 0; i < flowNodeList.length; i++) {
if (flowNodeList[i].id == val) {
2023-09-17 02:08:35 +08:00
let list = this.data.flowNodes;
2024-04-14 21:28:11 +08:00
let actNv = this.data.active;
2024-05-03 10:37:27 +08:00
if (flowNodeList[i].name == this.data.taskName) {
2024-04-14 21:28:11 +08:00
actNv = list.length;
2023-09-17 02:08:35 +08:00
}
2024-04-14 21:28:11 +08:00
list.push({
id: flowNodeList[i].id,
name: flowNodeList[i].name,
text: flowNodeList[i].name.length > 4 ? flowNodeList[i].name.substring(0, 4) : flowNodeList[i].name
});
2023-09-17 02:08:35 +08:00
this.setData({
2024-05-03 10:37:27 +08:00
active: actNv,
2024-04-14 21:28:11 +08:00
flowNodes: list
2023-09-17 02:08:35 +08:00
})
2024-05-03 10:37:27 +08:00
if (flowNodeList[i].outgoingFlows && flowNodeList[i].outgoingFlows.length > 0) {
2023-09-17 02:08:35 +08:00
return this.getFlowNode(flowNodeList[i].outgoingFlows[0].targetRef);
}
}
}
},
//查询工作流节点
2024-05-03 10:37:27 +08:00
getFlowNodes() {
2023-09-17 02:08:35 +08:00
let that = this;
wx.request({
2024-05-03 10:37:27 +08:00
url: app.globalData.reqUrl + '/wechat/flowTask/readNotes/' + that.data.deployId,
method: "get",
data: {},
2023-09-17 02:08:35 +08:00
header: {
"Content-Type": "application/json"
},
2024-05-03 10:37:27 +08:00
success(res) {
2023-09-17 02:08:35 +08:00
res = res.data
2024-05-03 10:37:27 +08:00
if (res.code == 200) {
2023-09-17 02:08:35 +08:00
that.setData({
2024-05-03 10:37:27 +08:00
flowNodeList: res.data
2023-09-17 02:08:35 +08:00
})
2024-05-03 10:37:27 +08:00
if (res.data.length > 0) {
2023-09-17 02:08:35 +08:00
let list = that.data.flowNodes;
2024-04-14 21:28:11 +08:00
list.push({
id: res.data[0].id,
name: res.data[0].name,
text: res.data[0].name
});
2023-09-17 02:08:35 +08:00
that.setData({
2024-04-14 21:28:11 +08:00
flowNodes: list
2023-09-17 02:08:35 +08:00
})
return that.getFlowNode(res.data[0].outgoingFlows[0].targetRef);
}
2024-05-03 10:37:27 +08:00
} else {
2023-09-17 02:08:35 +08:00
app.toast(res.msg);
}
}
})
},
//查询审批日志
2024-05-03 10:37:27 +08:00
getFlowRecordList() {
2023-09-17 02:08:35 +08:00
let that = this;
wx.request({
url: app.globalData.reqUrl + '/wechat/flowTask/findCommentByProcInsId',
2024-05-03 10:37:27 +08:00
method: "get",
data: {
procInsId: this.data.procInsId
2023-09-17 02:08:35 +08:00
},
header: {
"Content-Type": "application/json"
},
2024-05-03 10:37:27 +08:00
success(res) {
2023-09-17 02:08:35 +08:00
res = res.data
2024-05-03 10:37:27 +08:00
if (res.code == 200) {
2023-09-17 02:08:35 +08:00
that.setData({
2024-05-03 10:37:27 +08:00
flowRecordList: res.data
2023-09-17 02:08:35 +08:00
})
2024-05-03 10:37:27 +08:00
let list = [];
res.data.forEach((item, idx) => {
if (idx == 1 && (item.commentType == "3" || item.commentType == "2")) {
2024-04-14 21:28:11 +08:00
that.setData({
2024-05-03 10:37:27 +08:00
rejectNode: true
2024-04-14 21:28:11 +08:00
})
}
2024-05-03 10:37:27 +08:00
if (item.deleteReason) {
item.deleteReason = that.getDeleteReason(item.deleteReason);
2023-09-17 02:08:35 +08:00
}
2024-05-03 10:37:27 +08:00
if (item.duration) {
item.duration = that.getDurationDate(item.duration);
2023-09-17 02:08:35 +08:00
}
list.push(item);
})
that.setData({
2024-05-03 10:37:27 +08:00
flowRecordList: list
2023-09-17 02:08:35 +08:00
})
2024-05-03 10:37:27 +08:00
} else {
2023-09-17 02:08:35 +08:00
app.toast(res.msg);
}
}
})
},
//查询审批表单参数
2024-05-03 10:37:27 +08:00
getFormDatasList() {
2023-09-17 02:08:35 +08:00
let that = this;
wx.request({
url: app.globalData.reqUrl + '/wechat/flowTask/findFormDatasByProcInsId',
2024-05-03 10:37:27 +08:00
method: "get",
data: {
procInsId: this.data.procInsId
2023-09-17 02:08:35 +08:00
},
header: {
"Content-Type": "application/json"
},
2024-05-03 10:37:27 +08:00
success(res) {
2023-09-17 02:08:35 +08:00
res = res.data
2024-05-03 10:37:27 +08:00
if (res.code == 200) {
2023-09-17 02:08:35 +08:00
that.setData({
2024-05-03 10:37:27 +08:00
infoData: res.data,
2023-09-17 02:08:35 +08:00
})
2024-03-17 16:19:31 +08:00
let filesData = [];
let imageList = [];
2024-05-03 10:37:27 +08:00
/**
* 分包范围
*/
if(res.data.subDeptScope){
let list = that.data.subDeptScopes;
list.forEach(it =>{
if(res.data.subDeptScope.split(',').indexOf(it.id)>-1){
it.type = true;
}
});
that.setData({
subDeptScopes: list,
})
}
2023-09-17 02:08:35 +08:00
//判断附件
2024-05-03 10:37:27 +08:00
if (res.data.files) {
res.data.files.split(',').forEach(element => {
let ft = element.split('.');
if (that.data.imageType.indexOf(ft[ft.length - 1].toLowerCase()) > -1) {
imageList.push(config.baseUrl + element);
} else {
let it = element.split('/');
filesData.push({
name: it[it.length - 1],
path: element
});
}
});
2023-09-17 02:08:35 +08:00
}
that.setData({
2024-03-17 16:19:31 +08:00
filesData,
2024-05-03 10:37:27 +08:00
imageInfoData: imageList,
isFiles: filesData.length > 0 ? true : false,
remark: res.data.remark
2023-09-17 02:08:35 +08:00
})
2024-05-03 10:37:27 +08:00
} else {
2023-09-17 02:08:35 +08:00
app.toast(res.msg);
}
}
})
},
//初始化退回节点
2024-05-03 10:37:27 +08:00
initTargetKeyList() {
2023-09-17 02:08:35 +08:00
let that = this;
wx.request({
url: app.globalData.reqUrl + '/wechat/flowTask/returnList',
2024-05-03 10:37:27 +08:00
method: "post",
data: {
taskId: that.data.taskId
2023-09-17 02:08:35 +08:00
},
header: {
"Content-Type": "application/json"
},
2024-05-03 10:37:27 +08:00
success(res) {
2023-09-17 02:08:35 +08:00
res = res.data
2024-05-03 10:37:27 +08:00
if (res.code == 200) {
let list = [{
id: '',
text: ''
}];
res.data.forEach(item => {
list.push({
id: item.id,
text: item.name
})
2023-09-17 02:08:35 +08:00
})
that.setData({
2024-05-03 10:37:27 +08:00
targetKeyList: list
2023-09-17 02:08:35 +08:00
})
2024-05-03 10:37:27 +08:00
} else {
2023-09-17 02:08:35 +08:00
app.toast(res.msg);
}
}
})
},
//保存
2024-05-03 10:37:27 +08:00
onSave() {
2023-09-17 02:08:35 +08:00
this.setData({
2024-05-03 10:37:27 +08:00
loadShow: true
2023-09-17 02:08:35 +08:00
})
2024-05-03 10:37:27 +08:00
let {
procDefId,
projectId,
userId,
loginName,
remark,
filesData,
fbAptitude,
infoData
} = this.data;
2023-09-17 02:08:35 +08:00
//数据效验
2024-05-03 10:37:27 +08:00
if (projectId == "" || loginName == "" || userId == "" || procDefId == "") {
2023-09-17 02:08:35 +08:00
app.toast("数据异常,请刷新页面重试!")
this.setData({
2024-05-03 10:37:27 +08:00
loadShow: false
2023-09-17 02:08:35 +08:00
})
return;
}
2024-05-03 10:37:27 +08:00
//分包资质审批数据效验
if (fbAptitude) {
if (infoData.subDeptType == "") {
app.toast("请选择分包类型!")
this.setData({
loadShow: false
})
return;
}
if (infoData.subDeptScope == "") {
app.toast("请选择分包范围!")
this.setData({
loadShow: false
})
return;
}
if (infoData.subDeptName == "") {
app.toast("请填写分包单位名称!")
this.setData({
loadShow: false
})
return;
}
if (infoData.subDeptAptitude == "") {
app.toast("请填写分包单位资质!")
this.setData({
loadShow: false
})
return;
}
if (infoData.subDeptChairman == "") {
app.toast("请填写分包单位法人代表!")
this.setData({
loadShow: false
})
return;
}
if (infoData.subDeptSafetyCertificate == "") {
app.toast("请填写分包单位安全生产许可证!")
this.setData({
loadShow: false
})
return;
}
if (infoData.subDeptCustodian == "") {
app.toast("请填写分包单位项目经理!")
this.setData({
loadShow: false
})
return;
}
if (infoData.subDeptCustodianCardId == "") {
app.toast("请填写分包单位项目经理身份证号!")
this.setData({
loadShow: false
})
return;
}
if (infoData.subDeptApproachDate == "") {
app.toast("请选择分包单位进场时间!")
this.setData({
loadShow: false
})
return;
}
2023-09-17 02:08:35 +08:00
}
2024-05-03 10:37:27 +08:00
if (filesData.length == 0 && this.data.imageInfoData.length == 0) {
2023-09-17 02:08:35 +08:00
app.toast("请上传审批内容!")
this.setData({
2024-05-03 10:37:27 +08:00
loadShow: false
2023-09-17 02:08:35 +08:00
});
return;
}
2024-05-03 10:37:27 +08:00
if (remark == "") {
app.toast("请填写申请说明!")
this.setData({
loadShow: false
})
return;
}
for (let i = 0; i < filesData.length; i++) {
2023-09-17 02:08:35 +08:00
let _fileType = filesData[0].path.split('.');
2024-05-03 10:37:27 +08:00
_fileType = _fileType[_fileType.length - 1].toLowerCase();
2023-09-17 02:08:35 +08:00
//判断附件类型,如果是图片直接展示,非图片则显示附件
2024-05-03 10:37:27 +08:00
if (this.data.fileType.indexOf(_fileType) == -1) {
app.toast("申批内容不支持 [ " + _fileType + " ] 格式请上传PDF文件。")
2023-09-17 02:08:35 +08:00
this.setData({
2024-05-03 10:37:27 +08:00
loadShow: false
2023-09-17 02:08:35 +08:00
});
return;
}
}
let that = this;
wx.showModal({
title: '提示',
2024-05-03 10:37:27 +08:00
content: '是否确定提交' + this.data.procDefName + '',
2023-09-17 02:08:35 +08:00
success: function (sm) {
2024-05-03 10:37:27 +08:00
if (sm.confirm) {
// 用户点击了确定 可以调用了
that.submit()
2023-09-17 02:08:35 +08:00
} else if (sm.cancel) {
that.setData({
2024-05-03 10:37:27 +08:00
loadShow: false
2023-09-17 02:08:35 +08:00
});
2024-05-03 10:37:27 +08:00
console.log('用户点击取消');
2023-09-17 02:08:35 +08:00
}
}
2024-05-03 10:37:27 +08:00
})
2023-09-17 02:08:35 +08:00
},
2024-05-03 10:37:27 +08:00
submit() {
2023-09-17 02:08:35 +08:00
let that = this
2024-05-03 10:37:27 +08:00
let {
taskId,
procInsId,
projectId,
projectName,
userId,
loginName,
nickName,
remark,
filesData,
imageInfoData,
fbAptitude,
infoData
} = that.data;
2023-09-17 02:08:35 +08:00
let fileUrls = [];
2024-05-03 10:37:27 +08:00
filesData.forEach(f => {
2024-03-17 16:19:31 +08:00
imageInfoData.push(f.path);
});
2024-05-03 10:37:27 +08:00
imageInfoData.forEach(async (item) => {
let uploadUrl = app.globalData.uploadUrl + '/common/upload'
let name = "file"
2023-09-17 02:08:35 +08:00
//这里复杂的图片上传,改为同步上传,因为小程序只能上传一张图片
2024-05-03 10:37:27 +08:00
if (item.indexOf(config.baseUrl) > -1) {
fileUrls.push(item.replace(config.baseUrl, ''));
} else if (item.indexOf("/profile/") > -1) {
2024-03-17 16:19:31 +08:00
fileUrls.push(item);
2024-05-03 10:37:27 +08:00
} else {
let obj = await that.syncUploadImage(uploadUrl, item, name);
2023-09-17 02:08:35 +08:00
fileUrls.push(obj.data.fileName);
}
//验证图片上传完毕
2024-05-03 10:37:27 +08:00
if (fileUrls.length == imageInfoData.length) {
//分包单位资质审批参数
let fbAptitudeParams = {};
if (fbAptitude) {
fbAptitudeParams = {
subDeptType:infoData.subDeptType,
subDeptScope:infoData.subDeptScope,
subDeptName:infoData.subDeptName,
subDeptAptitude:infoData.subDeptAptitude,
subDeptChairman:infoData.subDeptChairman,
subDeptSafetyCertificate:infoData.subDeptSafetyCertificate,
subDeptCustodian:infoData.subDeptCustodian,
subDeptCustodianCardId:infoData.subDeptCustodianCardId,
subDeptApproachDate:infoData.subDeptApproachDate
}
}
2023-09-17 02:08:35 +08:00
let params = {
taskId,
2024-05-03 10:37:27 +08:00
instanceId: procInsId,
2023-09-17 02:08:35 +08:00
userId,
2024-05-03 10:37:27 +08:00
assignee: nickName,
variables: {
businessKey: projectId,
2023-09-17 02:08:35 +08:00
projectName,
2024-05-03 10:37:27 +08:00
files: fileUrls.toString(),
2023-09-17 02:08:35 +08:00
remark,
2024-05-03 10:37:27 +08:00
INITIATOR: that.data.infoData.INITIATOR,
...fbAptitudeParams
2023-09-17 02:08:35 +08:00
}
}
wx.request({
url: app.globalData.reqUrl + '/wechat/flowTask/complete',
2024-05-03 10:37:27 +08:00
method: "POST",
data: params,
2023-09-17 02:08:35 +08:00
header: {
"Username": loginName,
"Content-Type": "application/json"
},
2024-05-03 10:37:27 +08:00
success(res) {
2023-09-17 02:08:35 +08:00
that.setData({
2024-05-03 10:37:27 +08:00
loadShow: false
2023-09-17 02:08:35 +08:00
})
res = res.data
2024-05-03 10:37:27 +08:00
if (res.code == 200) {
2023-09-17 02:08:35 +08:00
app.toast("提交申请成功!")
2024-05-03 10:37:27 +08:00
if (that.data.ret == "await") {
setTimeout(() => {
2023-09-17 02:08:35 +08:00
wx.redirectTo({
url: '../await/index',
})
2024-05-03 10:37:27 +08:00
}, 200)
} else {
setTimeout(() => {
2023-09-17 02:08:35 +08:00
wx.redirectTo({
url: '../myFlowDefinition/index',
})
2024-05-03 10:37:27 +08:00
}, 200)
2023-09-17 02:08:35 +08:00
}
2024-05-03 10:37:27 +08:00
} else {
2023-09-17 02:08:35 +08:00
app.toast(res.msg);
}
}
})
2024-05-03 10:37:27 +08:00
}
2023-09-17 02:08:35 +08:00
})
},
/**
* 这里考虑上传图片异步问题封装为同步
*/
2024-05-03 10:37:27 +08:00
syncUploadImage(url, uploadFile, name) {
2023-09-17 02:08:35 +08:00
return new Promise((resolve, reject) => {
wx.uploadFile({
2024-05-03 10:37:27 +08:00
url, // 上传的服务器接口地址
filePath: uploadFile,
header: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
},
name, //上传的所需字段,后端提供
formData: {
user: 'test'
},
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)
}
2023-09-17 02:08:35 +08:00
});
})
},
//申请说明
remarkblur: function (options) {
this.data.remark = options.detail.value;
},
2024-05-03 10:37:27 +08:00
// list 上传图片
onImagesArr(e) {
var data = this.data.imageInfoData
data = e.detail
this.setData({
imageInfoData: data
})
},
/**
* 上传文件
* @param {*} options
*/
fileUpload(options) {
let file = options.detail;
2023-09-17 02:08:35 +08:00
this.setData({
filesData: file
});
},
2024-05-03 10:37:27 +08:00
// 手风琴
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;
}
}
},
getDurationDate(val) {
// 计算出相差天数
let days = Math.floor(val / (24 * 3600 * 1000))
// 计算出小时数
let leave1 = val % (24 * 3600 * 1000) // 计算天数后剩余的毫秒数
let hours = Math.floor(leave1 / (3600 * 1000))
// 计算相差分钟数
let leave2 = leave1 % (3600 * 1000) // 计算小时数后剩余的毫秒数
let minutes = Math.floor(leave2 / (60 * 1000))
// 计算相差秒数
let leave3 = leave2 % (60 * 1000) // 计算分钟数后剩余的毫秒数
let seconds = Math.round(leave3 / 1000)
if (days > 0) {
if (days < 10) days = "0" + days;
if (hours < 10) hours = "0" + hours;
if (minutes < 10) minutes = "0" + minutes;
if (seconds < 10) seconds = "0" + seconds;
return days + '天' + hours + '小时' + minutes + '分钟' + seconds + '秒';
}
if (hours > 0) {
if (hours < 10) hours = "0" + hours;
if (minutes < 10) minutes = "0" + minutes;
if (seconds < 10) seconds = "0" + seconds;
return hours + '小时' + minutes + '分钟' + seconds + '秒';
}
if (minutes > 0) {
if (minutes < 10) minutes = "0" + minutes;
if (seconds < 10) seconds = "0" + seconds;
return minutes + '分钟' + seconds + '秒';
}
if (seconds > 0) {
if (seconds < 10) seconds = "0" + seconds;
return seconds + '秒';
}
},
2023-09-17 02:08:35 +08:00
//选择退回节点
2024-05-03 10:37:27 +08:00
onSelectTargetKey(e) {
2023-09-17 02:08:35 +08:00
this.setData({
2024-05-03 10:37:27 +08:00
targetKey: e.detail.id,
backName: e.detail.name
2023-09-17 02:08:35 +08:00
})
},
2024-05-03 10:37:27 +08:00
2023-09-17 02:08:35 +08:00
returnToPage: function () {
/*关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面*/
2024-05-03 10:37:27 +08:00
if (this.data.ret == "await") {
2023-09-17 02:08:35 +08:00
wx.redirectTo({
url: '../await/index',
})
2024-05-03 10:37:27 +08:00
} else {
2023-09-17 02:08:35 +08:00
wx.redirectTo({
2024-05-03 10:37:27 +08:00
url: '../myProcessIns/index'
2023-09-17 02:08:35 +08:00
})
}
},
2024-05-03 10:37:27 +08:00
/**
2024-03-17 16:19:31 +08:00
* 切换上传文件类型
* @param {*} e
*/
switchFiles(e) {
this.setData({
isFiles: !this.data.isFiles,
});
2024-05-03 10:37:27 +08:00
if (this.data.isFiles) {
if (this.data.filesData.length == 0) {
2024-03-17 16:19:31 +08:00
let myImages = this.selectComponent("#myImage");
myImages.upload();
}
2024-05-03 10:37:27 +08:00
} else {
if (this.data.imageInfoData.length == 0) {
2024-03-17 16:19:31 +08:00
let myFiles = this.selectComponent("#myFiles");
myFiles.upload();
}
}
},
2023-09-17 02:08:35 +08:00
//取消页面
2024-05-03 10:37:27 +08:00
cancelSaveView() {
2023-09-17 02:08:35 +08:00
/*关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面*/
2024-05-03 10:37:27 +08:00
if (this.data.ret == "await") {
2023-09-17 02:08:35 +08:00
wx.redirectTo({
url: '../await/index',
})
2024-05-03 10:37:27 +08:00
} else {
2023-09-17 02:08:35 +08:00
wx.redirectTo({
url: '../myFlowDefinition/index'
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})