提交 a6981197 编写于 作者: NoSubject's avatar NoSubject

增加加签操作及api

上级 d21b44a3
{
"identityNode": {
"padding": "5px",
"float": "left",
"margin-right": "5px",
"margin-bottom": "2px",
"background-color": "#DDD",
......@@ -9,7 +8,8 @@
"color": "#333",
"line-height": "18px",
"font-size": "12px",
"cursor": "pointer"
"cursor": "pointer",
"display": "inline-block"
},
"identityNode_over": {
"padding": "5px",
......@@ -65,4 +65,4 @@
"margin-top": "15px",
"height": "10px"
}
}
\ No newline at end of file
}
......@@ -2955,6 +2955,78 @@ MWF.xScript.Environment = function(ev){
_form.shareToIMChat();
},
/**添加待办人,可用于加签等操作。<b>(仅流程表单中可用)</b><br/>
* 可以通过this.workContext.getControl().allowAddTask来判断当前用户是否有权限。<br/>
* @method addTask
* @static
* @param {Object} [option] - 添加待办人的相关参数,如果不提供option参数,则弹出加签对话框。<br/>
* 格式如下:
<pre><code class="language-js">
{
optionList: optionList,
remove: false,
opinion: opinion,
routeName
"optionList" : [ //增加待办人的操作的列表
{
"identityList;": [], //要增加待办组的身份列表,这些身份中只需要一个人处理即可。
"position": "after" //增加待办的位置,可以选用以下值:
//after: 在当前待办(由identity参数指定)之后;
//before: 在当前待办(由identity参数指定)之前;
//top: 将要添加的待办人加入到所有待办列表最前面;
//bottom: 将要添加的待办人加入到所有待办列表的最后;
//extend: 在当前待办(由identity参数指定)组中,添加待办人;
//after、before、top、bottom四个参数值在并行处理活动时,没有本质区别,所有待办都会同时产生。
//而在串行活动或单人活动就会影响到待办产生的顺序。
//extend参数值,会在当前待办(由identity参数指定)组中添加一个待办人,在同一组中的待办人,只需要一人处理,就会标志整个待办组已经处理。
//当传入identity参数时,此处参数值都会会生效,默认为after;如果没有传入identity,只有top和bottom生效
}
],
"opinion" : "", //增加待办意见.
"routeName" : "", //增加待办在流程记录中显示的路由.
"identity": "", //当前待办的用户身份,如果没有传入此参数,会查找当前用户对于此文档的待办,如果有,则并传入待办的身份。
"remove" : false, //是否删除当前用户的待办.默认false
"success": function(){}, //执行成功后的回调方法
"failure": function(){} //执行失败后的回调方法
}
</code></pre>
* @example
//不带参数,则弹出加签对话框
this.form.addTask();
* @example
//带参数,根据参数执行添加待办操作
this.form.addTask({
"value" : ["开发部@kfb@U"],
"trimExist" : true,
"success": function(json){
this.form.notice("addSplit success", "success");
}.bind(this),
"failure": function(xhr, text, error){
//xhr--HttpRequest请求对象
//text--HttpResponse内容文本
//error--错误信息
this.form.notice("addSplit failure: "+error, "error");
}.bind(this)
});
*/
"addTask": function(option){
if (!option){
if (_form.businessData.control["allowAddTask"]) _form.addTask();
}else{
(function(callback){
if (_form.businessData.control["allowSave"]){
_form.saveFormData(callback);
}else{
if (callback) callback();
}
})(function(){
var workId = _form.businessData.work.id;
o2.Actions.load("x_processplatform_assemble_surface").WorkAction.v2AddManualTaskIdentityMatrix(workId, option, option.success, option.failure);
});
}
},
/**弹出一个确认框,带确认和关闭按钮
* @method confirm
......
......@@ -53,6 +53,17 @@
"condition": "",
"read": true
},
{
"type": "MWFToolBarButton",
"img": "addTask.png",
"title": "{{$.lp.addTaskTitle}}",
"action": "addTask",
"text": "{{$.lp.addTask}}",
"id": "action_addTask",
"control": "allowReset",
"condition": "",
"read": true
},
{
"type": "MWFToolBarButton",
"img": "split.png",
......
......@@ -1437,7 +1437,9 @@ MWF.xApplication.process.FormDesigner.LP = {
"downloadAll": "Download",
"downloadAllTitle": "Download the form and all attachments",
"setReaded": "Mark as read",
"readed": "Readed"
"readed": "Readed",
"addTask": "Add Task",
"addTaskTitle": "Add task to current activity"
},
"filedConfigurator": {
"sequence": "Sequence",
......
......@@ -1444,7 +1444,9 @@ MWF.xApplication.process.FormDesigner.LP = {
"downloadAll": "一键下载",
"downloadAllTitle": "一键下载",
"setReaded" : "标记为已阅",
"readed" : "已阅"
"readed" : "已阅",
"addTask": "加签",
"addTaskTitle": "在当前活动添加处理人"
},
"filedConfigurator": {
"sequence": "序号",
......
......@@ -65,6 +65,7 @@
"allowReroute": true,
"allowRerouteTo": true,
"allowReset": true,
"allowAddTask": true,
"allowRapid": false,
"allowAddSplit": false,
"allowRollback": false,
......@@ -733,4 +734,4 @@
"delayMinute": "",
"workMinute": true
}
}
\ No newline at end of file
}
......@@ -335,7 +335,7 @@
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableValue" colspan="2"><b>{{$.lp.allowAddSplit}}allowAddSplit </b><input class="editTableRadio" name="allowAddSplit" text{($.allowAddSplit)?'checked':''} type="radio" value="true"/>{{$.lp.yes}}
<td class="editTableValue" colspan="2"><b>{{$.lp.allowAddSplit}}</b><input class="editTableRadio" name="allowAddSplit" text{($.allowAddSplit)?'checked':''} type="radio" value="true"/>{{$.lp.yes}}
<input class="editTableRadio" name="allowAddSplit" text{(!$.allowAddSplit)?'checked':''} type="radio" value="false"/>{{$.lp.no}}</td>
</tr>
</table>
......@@ -357,6 +357,14 @@
<input class="editTableRadio" name="allowPause" text{(!$.allowPause)?'checked':''} type="radio" value="false"/>{{$.lp.no}}</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableValue" colspan="2"><b>{{$.lp.allowAddTask}}:</b>
<input class="editTableRadio" name="allowAddTask" text{($.allowAddTask!==false)?'checked':''} type="radio" value="true"/>{{$.lp.yes}}
<input class="editTableRadio" name="allowAddTask" text{($.allowAddTask===false)?'checked':''} type="radio" value="false"/>{{$.lp.no}}
</td>
</tr>
</table>
</div>
......
......@@ -404,6 +404,7 @@ MWF.xApplication.process.ProcessDesigner.LP = {
"allowRollback": "允许流程回溯",
"allowPress": "允许发起办理提醒",
"allowPause": "允许挂起",
"allowAddTask": "允许加签",
"beforeBegin": "流程启动前",
"eventInfo1": "启动流程生成work实例",
......
<div style="padding: 20px 20px 0px 30px; font-size:14px;">
<div style="margin-bottom:10px;">
<div style="line-height: 30px; margin-bottom:10px;">
<div style="float: left; width: 70px;">{{$.lp.addTaskPerson}}: </div>
<div style="margin-left: 70px; margin-top: 10px">
<div class="addTask_selPeopleButton mainColor_bg" style="font-size:12px; border-radius:20px; float:right; cursor: pointer; padding: 0 20px;">{{$.lp.selectPerson}}</div>
<div id="resetWork_selPeopleArea" style="margin-right: 70px; min-height: 24px; padding:3px; overflow: hidden; border-radius: 10px; border: 1px solid #DEDEDE; width: 400px"></div>
</div>
</div>
<div style="line-height: 30px; margin-bottom:20px; overflow: hidden">
<div style="float: left; width: 70px;"></div>
<div style="margin-left: 70px; margin-top: 10px">
<span style="cursor: pointer" onclick="this.getFirst().checked=true;" title="{{$.lp.addTaskBeforeTitle}}"><input name="addTask_type" class="addTask_type" type="radio" value="before">{{$.lp.addTaskBefore}}</span>
<span style="cursor: pointer" onclick="this.getFirst().checked=true;" title="{{$.lp.addTaskAfterTitle}}"><input name="addTask_type" class="addTask_type" checked type="radio" value="after">{{$.lp.addTaskAfter}}</span>
</div>
</div>
<div style="height: 30px; line-height: 30px; margin-bottom:10px;">
<div style="float: left; width: 70px; height: 50px; line-height: 50px;">{{$.lp.addTaskOpinion}}: </div>
<div style="margin-left: 70px"><textarea class="addTask_opinion" style="width: 500px; padding:5px; overflow:auto; height: 60px; border-radius: 10px; border: 1px solid #DEDEDE;" type="text" id="resetWork_opinion"></textarea></div>
</div>
</div>
</div>
......@@ -300,6 +300,9 @@ MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar = new Class(
resetWork: function(){
this.form.resetWork();
},
addTask: function(){
this.form.addTask();
},
retractWork: function(e, ev){
this.form.retractWork(e, ev);
},
......
......@@ -167,7 +167,22 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
* @event MWF.xApplication.process.Xform.Form#afterReaded
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterReaded"]
"afterReaded",
/**
* 加签前触发。
* @event MWF.xApplication.process.Xform.Form#beforeAddTask
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeAddTask",
/**
* 加签后触发。
* @event MWF.xApplication.process.Xform.Form#afterAddTask
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterAddTask"
]
},
initialize: function (node, data, options) {
this.setOptions(options);
......@@ -3548,7 +3563,6 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
"type": "identity",
"count": count,
"units": (unit) ? [unit] : [],
"title": this.app.lp.reset,
"onComplete": function (items) {
areaNode.empty();
var identityList = [];
......@@ -3578,7 +3592,6 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
"values": names,
"type": "identity",
"count": count,
"title": this.app.lp.reset,
"onComplete": function (items) {
areaNode.empty();
var identityList = [];
......@@ -5082,8 +5095,137 @@ debugger;
if (this.mask) { this.mask.hide(); this.mask = null; }
}.bind(this));
}.bind(this));
}
},
checkControl: function(key){
if (!this.businessData.control[key]) {
o2.xDesktop.notice("error", { x: "right", y: "top" }, "Permission Denied");
return false;
}
if( !this.businessData.task ){
o2.xDesktop.notice("error", { x: "right", y: "top" }, o2.xApplication.process.Xform.LP.form.noTaskToReset);
return false;
}
return true;
},
addTask: function(){
if (this.checkControl("allowReset")){
var _self = this;
var opt = {};
o2.DL.open({
"title": o2.xApplication.process.Xform.LP.form.addTask,
"style": this.json.dialogStyle || "user",
"width": 680,
"height": 380,
"url": this.app.path + "addTask.html",
"lp": o2.xApplication.process.Xform.LP.form,
"container": this.app.content,
"maskNode": this.app.content,
"offset": {y: -120},
"buttonList": [
{
"type": "ok",
"text": o2.LP.process.button.ok,
"action": function (d, e) {
if( !this.identityList || !this.identityList.length ){
_self.app.notice(o2.xApplication.process.Xform.LP.inputAddTaskPeople, "error", this.node);
}else{
_self.doAddTask(this);
}
}
},
{
"type": "cancel",
"text": MWF.LP.process.button.cancel,
"action": function () {
this.close();
}
}
],
"onPostShow": function () {
var selPeopleButton = this.content.getElement(".addTask_selPeopleButton");
selPeopleButton.addEvent("click", function () {
_self.selectPeople(this);
}.bind(this));
}
});
}
},
getRadioValue: function(node, selector){
var nodes = node.getElements(selector);
for (var i=0; i<nodes.length; i++){
if (nodes[i].checked){
return nodes[i].value;
}
}
return "";
},
doAddTask: function(dlg){
MWF.require("MWF.widget.Mask", function () {
this.mask = new MWF.widget.Mask({ "style": "desktop", "zIndex": 50000 });
this.mask.loadNode(this.app.content);
var position = this.getRadioValue(dlg.content, ".addTask_type") || "after";
var nameArr = [];
var optionList = dlg.identityList.map(function (n) {
nameArr.push(n.substring(0, n.indexOf("@")));
return {
position: position,
identityList: [n]
}
});
var opinion = dlg.content.getElement(".addTask_opinion").get("value");
var taskId = this.businessData.task.id;
var addTaskOptions = {
optionList: optionList,
remove: false,
opinion: opinion,
routeName: o2.xApplication.process.Xform.LP.form.addTask
}
this.fireEvent("beforeAddTask");
if (this.app && this.app.fireEvent) this.app.fireEvent("beforeAddTask");
this.saveFormData(function(){
o2.Actions.load("x_processplatform_assemble_surface").TaskAction.v2Add(taskId, addTaskOptions, function (json) {
debugger;
this.fireEvent("afterAddTask");
if (this.app && this.app.fireEvent) this.app.fireEvent("afterAddTask");
this.app.notice(MWF.xApplication.process.Xform.LP.addTaskOk + ": " + nameArr, "success");
dlg.close();
if (this.mask) { this.mask.hide(); this.mask = null; }
this.addAddTaskMessage(json.data);
if (!this.app.inBrowser) this.app.close();
}.bind(this), function (xhr, text, error) {
var errorText = error + ":" + text;
if (xhr) errorText = xhr.responseText;
this.app.notice("request json error: " + errorText, "error", opt.dlg ? opt.dlg.node : null);
if (this.mask) { this.mask.hide(); this.mask = null; }
}.bind(this))
}.bind(this));
}.bind(this));
},
addAddTaskMessage: function (data) {
var content = this.getMessageContent(data, 0, MWF.xApplication.process.Xform.LP.addTaskInfor);
if (layout.desktop.message) {
var msg = {
"subject": MWF.xApplication.process.Xform.LP.form.addTask,
"content": content
};
layout.desktop.message.addTooltip(msg);
return layout.desktop.message.addMessage(msg);
} else {
if (this.app.inBrowser) {
this.inBrowserDkg(content);
}
}
},
});
......
......@@ -337,6 +337,9 @@ MWF.xApplication.process.Xform.LP = {
"downloadAll": "Download",
"downloadAllTitle": "Download the form and all attachments",
"addTask": "Add Task",
"addTaskTitle": "Add task to current activity",
"rerouteActivity": "Activity: ",
"reroutePerson": "Person: ",
"selectPerson": "Select",
......
......@@ -336,6 +336,9 @@ MWF.xApplication.process.Xform.LP = {
"downloadAll": "一键下载",
"downloadAllTitle": "一键下载",
"addTask": "加签",
"addTaskTitle": "在当前活动添加处理人",
"rerouteActivity": "调度到:",
"reroutePerson": "调度给:",
"selectPerson": "选择人员",
......@@ -361,7 +364,16 @@ MWF.xApplication.process.Xform.LP = {
"sendReadNotify": "发送待阅通知",
"reviewIdentity": "阅读人",
"noTaskToReset": "当前工作没有您的待办,不能执行该操作"
"noTaskToReset": "当前工作没有您的待办,不能执行该操作",
"addTaskPerson": "加签人",
"addTaskOpinion": "意 见",
"addTaskBefore": "前加签",
"addTaskAfter": "后加签",
"addTaskBeforeTitle": "在您处理之前添加处理人",
"addTaskAfterTitle": "在您处理之后添加处理人",
"addTaskType": "加签方式"
},
"sendRead": "发送待阅",
......@@ -374,6 +386,9 @@ MWF.xApplication.process.Xform.LP = {
"sendReviewOk": "已添加阅读人",
"inputSendReviewPeople": "请选择阅读人",
"sendReviewPeopleCanNotEmpty": "阅读人不能为空",
"inputAddTaskPeople": "请选择加签人",
"addTaskOk": "已添加加签人",
"addTaskInfor": "您加签了文件:",
"applicationNotFound": "未找到应用",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册