增加APP调用方法

This commit is contained in:
wanggeng 2022-05-26 12:13:06 +08:00
parent 2762f6179a
commit f13b3e8cc6
2 changed files with 62 additions and 3 deletions

View File

@ -5,13 +5,15 @@
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
function AppOaFormUtil() { function AppOaFormUtil() {
this.confirmAssignees = null; this.confirmAssignees = null;
this.fields = null; this.fields = null;
this.formButton = null; this.formButton = null;
this.currentUser = null; this.currentUser = null;
this.form = null;
/** /**
* 初始化APP数据 * 初始化APP数据H5 -> APP
* @param dataObj * @param dataObj
*/ */
this.initAppFormData = function (dataObj) { this.initAppFormData = function (dataObj) {
@ -25,8 +27,59 @@
} }
} }
/**
* 初始化APP附件
* @param attachments
*/
this.initAppAttachments = function(attachments) {
if(!attachments) {
return;
}
if (isAndroid) {
window.android.invokeNative('echoAccessory', attachments)
}
}
/**
* 提交表单
* @param btnIndex
*/
this.submitFormReport = function (btnIndex) {
document.getElementById('submitFormBtn'+ btnIndex).click();
}
/**
* 设置字段值
* @param fieldName
* @param fieldValue
*/
this.setFieldValue = function (fieldName, fieldValue) {
var obj = {};
obj[fieldName] = fieldValue;
this.form.val('dataForm', obj);
}
/**
* 设置附件
* @param attachments
*/
this.setAttachments = function (attachments) {
this.form.val('dataForm', {attachments: attachments});
}
/**
* 设置抄送人
* @param setCcs
*/
this.setCcs = function (ccs) {
this.form.val('dataForm', {ccs: ccs});
}
this.setForm = function (form) {
this.form = form;
}
this.getConfirmAssignees = function () { this.getConfirmAssignees = function () {
alert(JSON.stringify(this.confirmAssignees))
return this.confirmAssignees; return this.confirmAssignees;
} }

View File

@ -777,7 +777,13 @@ function OaFormUtil(layui) {
layer.close(promptIndex); layer.close(promptIndex);
var loadLayerIndex; var loadLayerIndex;
restAjax.put(restAjax.path('api/oa-form-report/update-go-back/process-instance-id/{processInstanceId}/task-id/{taskId}/node-id/{nodeId}', [processInstanceId, taskId, nodeId]), { var url;
if(isApp) {
url = 'app/oa-form-report/update-go-back/process-instance-id/{processInstanceId}/task-id/{taskId}/node-id/{nodeId}';
} else {
url = 'api/oa-form-report/update-go-back/process-instance-id/{processInstanceId}/task-id/{taskId}/node-id/{nodeId}';
}
restAjax.put(restAjax.path(url, [processInstanceId, taskId, nodeId]), {
reason: reason reason: reason
}, null, function (code, data) { }, null, function (code, data) {
layer.msg('回退成功', {offset: getMsgOffset(isApp)}); layer.msg('回退成功', {offset: getMsgOffset(isApp)});