MWF.xApplication.process.Application.options.multitask = true; o2.xDesktop.requireApp("Selector", "package", null, false); MWF.xDesktop.requireApp("Template", "MPopupForm", null, false); MWF.xDesktop.requireApp("Template", "MForm", null, false); MWF.xApplication.process.Application.Main = new Class({ Extends: MWF.xApplication.Common.Main, Implements: [Options, Events], options: { "style1": "default", "style": "default", "name": "process.Application", "mvcStyle": "style.css", "icon": "icon.png", "application": "", "id": "", "navi" : "all", "title": MWF.xApplication.process.Application.LP.title }, onQueryLoad: function(){ this.lp = MWF.xApplication.process.Application.LP; this.action = o2.Actions.load("x_processplatform_assemble_surface"); if (this.status) { if(this.status.id)this.options.id = this.status.id; if(this.status.navi){ this.options.navi = this.status.navi; } } this._loadCss(); }, loadApplication: function(callback){ this.initAcl(function (){ this.loadProcessList(function (){ this.action.ApplicationAction.get(this.options.id).then(function (json){ if (json.data){ this.setTitle(this.lp.title+"-"+json.data.name); this.application = json.data; var url = this.path+this.options.style+"/view/view.html"; this.content.loadHtml(url, {"bind": {"acl":this.acl,"lp": this.lp,"data":{"application" : this.application}}, "module": this}, function(){ this.setLayout(); this.loadList(this.options.navi); if (callback) callback(); }.bind(this)); } }.bind(this)); }.bind(this)); }.bind(this)); }, loadApplicationIcon : function (e){ var node = e.currentTarget; if (this.application.icon){ node.setStyle("background-image", "url(data:image/png;base64,"+this.application.icon+")"); }else{ node.setStyle("background-image", "url("+"../x_component_process_Application/$Main/default/icon/application.png)"); } }, initAcl : function (callback){ this.acl = { } this.action.ApplicationAction.isManager(this.options.id).then(function (json){ this.acl.isAppManager = json.data.value; this.action.ProcessAction.listControllableWithApplication(this.options.id).then(function (json){ var processList = json.data.valueList; if(processList.length>0){ this.acl.isProcessManager = true; }else { this.acl.isProcessManager = false; } this.acl.processList = json.data.valueList; if(callback) callback(); }.bind(this)); }.bind(this)); }, loadProcessList : function (callback){ this.action.ProcessAction.listWithPersonWithApplication(this.options.id).then(function (json){ this.processList = json.data; if(callback) callback(); }.bind(this)); }, createCountData: function(){ var _self = this; if (!this.countData){ this.countData = {"data": {}}; var createDefineObject = function(p){ return { "get": function(){return this.data[p]}, "set": function(v){ this.data[p] = v; _self[p+"CountNode"].set("text", v); } } }; var o = { "task": createDefineObject("task"), "taskCompleted": createDefineObject("taskCompleted"), "read": createDefineObject("read"), "readCompleted": createDefineObject("readCompleted"), "draft": createDefineObject("draft"), }; MWF.defineProperties(this.countData, o); } }, loadCount: function(){ this.createCountData(); this.action.WorkAction.countWithPersonAndApplication(layout.session.user.id,this.application.id).then(function(json){ this.countData.task = json.data.task; this.countData.taskCompleted = json.data.taskCompleted; this.countData.read = json.data.read; this.countData.readCompleted = json.data.readCompleted; }.bind(this)); this.action.DraftAction.listMyPaging(1,1, {"applicationList":[this.application.id]}).then(function(json){ this.countData.draft = json.count; }.bind(this)); }, loadList: function(type,ev,data){ if (this.currentMenu) this.setMenuItemStyleDefault(this.currentMenu); this.setMenuItemStyleCurrent(this[type+"MenuNode"]); this.currentMenu = this[type+"MenuNode"]; this._loadListContent(type); this.loadCount(); }, _loadListContent: function(type){ this.mainNode.empty(); list = new MWF.xApplication.process.Application[type.capitalize() +"List"](this.mainNode,this, { "onLoadData": function (){ this.hideSkeleton(); }, "type" : type, "key" : this.options.key }); this.currentList = list; }, setLayout: function(){ var items = this.content.getElements(".menuItem"); items.addEvents({ "mouseover": function(){this.addClass("menuItem_over")}, "mouseout": function(){this.removeClass("menuItem_over")}, "click": function(){} }); }, startProcess: function(){ this.action.ProcessAction.listWithPersonWithApplication(this.application.id).then(function (json){ var node = new Element("div"); var url = this.path+this.options.style+"/view/dlg/processList.html"; node.loadHtml(url, {"bind": {"lp": this.lp,"processList":json.data}, "module": this}, function(){ this.startProcessDlg = o2.DL.open({ "title": this.lp.startProcess, "width": "400px", "height": "260px", "mask": true, "content": node, "container": null, "positionNode": this.content, "onQueryClose": function () { node.destroy(); }.bind(this), "buttonList": [ ], "onPostShow": function () { this.startProcessDlg.reCenter(); }.bind(this) }); }.bind(this)); }.bind(this)); }, startProcessItemOver: function(e){ var node = e.target; while (node && !node.hasClass("st_processItem")){ node = node.getParent();} if (node){ node.addClass("menuItem_over"); node.removeClass("mainColor_bg"); } }, startProcessItemOut: function(e){ var node = e.target; while (node && !node.hasClass("st_processItem")){ node = node.getParent();} if (node){ node.removeClass("menuItem_over"); node.removeClass("mainColor_bg"); } }, startProcessItemDown: function(e){ var node = e.target; while (node && !node.hasClass("st_processItem")){ node = node.getParent();} if (node){ node.removeClass("menuItem_over"); node.addClass("mainColor_bg"); } }, startProcessItemUp: function(e){ var node = e.target; while (node && !node.hasClass("st_processItem")){ node = node.getParent();} if (node){ node.addClass("menuItem_over"); node.removeClass("mainColor_bg"); } }, startProcessItemClick: function(e, data){ this.startProcessDlg.close(); MWF.xDesktop.requireApp("process.TaskCenter", "ProcessStarter", function(){ var starter = new MWF.xApplication.process.TaskCenter.ProcessStarter(data, this, { "onStarted": function(workdata, title, processName){ this.afterStartProcess(workdata, title, processName, data); }.bind(this) }); starter.load(); }.bind(this)); }, afterStartProcess: function(data, title, processName, processdata){ if (data.work){ this.startProcessDraft(data, title, processName); }else{ this.startProcessInstance(data, title, processName); } }, startProcessDraft: function(data, title, processName){ var work = data.work; var options = {"draft": work, "appId": "process.Work"+(new o2.widget.UUID).toString(), "desktopReload": false, "onPostClose": function(){ if (this.currentList.refresh) this.currentList.refresh(); }.bind(this) }; this.desktop.openApplication(null, "process.Work", options); }, startProcessInstance: function(data, title, processName){ var workInfors = []; var currentTask = []; data.each(function(work){ if (work.currentTaskIndex !== -1) currentTask.push(work.taskList[work.currentTaskIndex].work); workInfors.push(this.getStartWorkInforObj(work)); }.bind(this)); if (currentTask.length===1){ var options = {"workId": currentTask[0], "appId": "process.Work"+currentTask[0], "onPostClose": function(){ if (this.currentList.refresh) this.currentList.refresh(); }.bind(this) }; this.desktop.openApplication(null, "process.Work", options); if (layout.desktop.message) this.createStartWorkResault(workInfors, title, processName, false); }else{ if (layout.desktop.message) this.createStartWorkResault(workInfors, title, processName, true); } }, getStartWorkInforObj: function(work){ var users = []; var currentTask = ""; work.taskList.each(function(task, idx){ users.push(task.person+"("+task.department + ")"); if (work.currentTaskIndex===idx) currentTask = task.id; }.bind(this)); return {"activity": work.fromActivityName, "users": users, "currentTask": currentTask}; }, setMenuItemStyleDefault: function(node){ node.removeClass("mainColor_bg_opacity"); node.getFirst().removeClass("mainColor_color"); node.getLast().removeClass("mainColor_color"); }, setMenuItemStyleCurrent: function(node){ node.addClass("mainColor_bg_opacity"); node.getFirst().addClass("mainColor_color"); node.getLast().addClass("mainColor_color"); }, recordStatus: function(){ return { "id": this.options.id}; } }); MWF.xApplication.process.Application.List = new Class({ Implements: [Options, Events], options: { "type": "all", "itemHeight": 40, }, initialize: function (node,app, options) { this.setOptions(options); this.app = app; this.container = node; this.lp = this.app.lp; this.css = this.app.css; this.action = app.action; this.type = this.options.type; this.application = app.application; var url = this.app.path+this.app.options.style+"/view/content.html"; this.container.loadHtml(url, {"bind": {"lp": this.lp,"data":{"type":this.type}}, "module": this}, function(){ this.content = this.listContentNode; this.bottomNode = this.listBottomNode; this.pageNode = this.pageNumberAreaNode; this.init(); this.load(); }.bind(this)); }, loadFilter: function () { var lp = this.lp; this.fileterNode = new Element("div.fileterNode", { "styles": this.css.fileterNode }).inject(this.searchNode); var html = "" + //style='width: 900px;' "" + " " + " " + " " + " " + " " + " " + " " + " " + "" + "" + " " + " " + " " + " " + " " + " " + " " + "" + "
"; this.fileterNode.set("html", html); var selectValue = [""]; var selectText = [""]; this.app.processList.each(function(d){ selectValue.push(d.id); selectText.push(d.name); }) this.form = new MForm(this.fileterNode, {}, { style: "attendance", isEdited: true, itemTemplate: { title: {text: lp.subject, "type": "text", "style": {"min-width": "150px"}}, activityName: {text: lp.activity, "type": "text", "style": {"min-width": "150px"}}, processName: { "text": lp.process, "type": "select", "selectValue" :selectValue, "selectText" :selectText, "style": {"min-width": "150px"}, }, credentialList: { "text": lp.creator, "type": "org", "orgType": "identity", "orgOptions": {"resultType": "person"}, "style": {"min-width": "150px"}, "orgWidgetOptions": {"disableInfor": true} }, creatorUnitList: { "text": lp.createunit, "type": "org", "orgType": "unit", "orgOptions": {"resultType": "person"}, "style": {"min-width": "150px"}, "orgWidgetOptions": {"disableInfor": true} }, startTime: { text: lp.begin, "tType": "date", "style": {"min-width":"150px"} }, endTime: { text: lp.end, "tType": "date", "style": {"min-width":"150px"} }, action: { "value": this.lp.query, type: "button", className: "filterButton", event: { click: function () { var result = this.form.getResult(false, null, false, false, false); for (var key in result) { if (!result[key]) { delete result[key]; } else if (key === "activityName" && result[key].length > 0) { //result[key] = result[key][0].split("@")[1]; result["activityNameList"] = [result[key]]; delete result[key]; }else if (key === "processName" && result[key] !== "") { //result[key] = result[key][0].split("@")[1]; result["processList"] = [result[key]]; delete result[key]; }else if (key === "endTime" && result[key] !== "") { result[key] = result[key] + " 23:59:59" } } result.applicationList = this.filterList.applicationList; if(result.credentialList) { result.creatorPersonList = result.credentialList; } this.filterList = result; this.refresh(); }.bind(this) } }, reset: { "value": this.lp.reset, type: "button", className: "filterButtonGrey", event: { click: function () { this.form.reset(); this._initFilter(); this.refresh(); }.bind(this) } }, } }, this.app, this.css); this.form.load(); }, showSkeleton: function(){ if (this.skeletonNode) this.skeletonNode.inject(this.listContentNode); }, hideSkeleton: function(){ if (this.skeletonNode) this.skeletonNode.dispose(); }, loadListTitle : function (){ this.listTitleNode.empty(); this.listTitleNode.loadHtml(this.titleTempleteUrl, {"bind": {"lp": this.lp}, "module": this}, function(){ this.currentSortNode = this.sortUpdateTimeNode; this.currentSortKey = "name"; }.bind(this)); }, selectAll : function (e){ if (e.currentTarget.get("disabled").toString()!="true"){ var itemNode = e.currentTarget.getParent(".listItem"); var iconNode = e.currentTarget.getElement(".selectFlagIcon"); if (itemNode){ if (itemNode.hasClass("mainColor_bg_opacity")){ itemNode.removeClass("mainColor_bg_opacity"); iconNode.removeClass("icon-xuanzhong"); iconNode.removeClass("selectFlagIcon_select"); iconNode.removeClass("mainColor_color"); this.listContentNode.getElements("tr").each(function (tr){ tr.removeClass("mainColor_bg_opacity"); var ss = tr.getElement(".selectFlagIcon"); tr.getElement(".selectFlag").hide(); ss.removeClass("icon-xuanzhong"); ss.removeClass("selectFlagIcon_select"); ss.removeClass("mainColor_color"); }) this.selectedList = []; }else{ itemNode.addClass("mainColor_bg_opacity"); iconNode.addClass("icon-xuanzhong"); iconNode.addClass("selectFlagIcon_select"); iconNode.addClass("mainColor_color"); this.listContentNode.getElements("tr").each(function (tr){ tr.getElement(".selectFlag").show(); tr.addClass("mainColor_bg_opacity"); var ss = tr.getElement(".selectFlagIcon"); ss.addClass("icon-xuanzhong"); ss.addClass("selectFlagIcon_select"); ss.addClass("mainColor_color"); }) this.selectedList.append(this.dataList); } } } this._setToolBar(); }, loadItems: function(data){ this.dataList = data; this.content.loadHtml(this.listTempleteUrl, {"bind": {"lp": this.lp, "type": this.options.type, "data": data}, "module": this}, function(){ this.node = this.content.getFirst(); }.bind(this)); }, init: function(){ this.listHeight = this.content.getSize().y - this.options.itemHeight - 60; this.size = (this.listHeight/this.options.itemHeight).toInt(); this.size = 15; this.page = 1; this.loadFilter(); this._initFilter(); this.filterNameList = {}; }, _initFilter : function(){ this.filterList = { applicationList : [this.application.id] }; }, _initTempate: function () { this.titleTempleteUrl = this.app.path + this.app.options.style + "/view/" + this.type + "/list_title.html"; this.listTempleteUrl = this.app.path + this.app.options.style + "/view/" + this.type + "/list.html"; }, load: function(){ var _self = this; this._initToolBar(); this._initTempate(); this.loadListTitle(); if(this.toolbarItems.unSelect.length>0){ this.loadToolBar(this.toolbarItems.unSelect); }else { this.loadToolBar(this.toolbarItems.default,true); } this.selectedList = []; this.loadData().then(function(data){ _self.hide(); _self.loadPage(); _self.loadItems(data); }); }, _initToolBar : function (){ this.toolbarItems = { "default":[ ], "unSelect":[ ], "selected":[ ], "mulSelect":[ ] } }, loadToolBar : function (availableTool,disabled){ this.toolBarNode.empty(); this.toolbar = new MWF.xApplication.process.Application.Toolbar(this.toolBarNode, this, { viewType : this.options.defaultViewType, type : this.type, disabled : !!disabled, availableTool : availableTool }); this.toolbar.load(); if(availableTool.length===0){ this.toolBarNode.hide(); }else { this.toolBarNode.show(); } }, refresh: function(){ this.hide(); this.load(); this.app.loadCount(); }, hide: function(){ if (this.node) this.node.destroy(); }, loadPage: function(){ var totalCount = this.total; var pages = totalCount/this.size; var pageCount = pages.toInt(); if (pages !== pageCount) pageCount = pageCount+1; this.pageCount = pageCount; var size = this.bottomNode.getSize(); var maxPageSize = 500;//size.x*0.8; maxPageSize = maxPageSize - 80*2-24*2-10*3; var maxPageCount = (maxPageSize/34).toInt(); this.loadPageNode(pageCount, maxPageCount); }, loadPageNode: function(pageCount, maxPageCount){ var pageStart = 1; var pageEnd = pageCount; if (pageCount>maxPageCount){ var halfCount = (maxPageCount/2).toInt(); pageStart = Math.max(this.page-halfCount, 1); pageEnd = pageStart+maxPageCount-1; pageEnd = Math.min(pageEnd, pageCount); pageStart = pageEnd - maxPageCount+1; } this.pageNode.empty(); var _self = this; for (var i=pageStart; i<=pageEnd; i++){ var node = new Element("div.pageItem", { "text": i, "events": { "click": function(){_self.gotoPage(this.get("text"));} } }).inject(this.pageNode); if (i==this.page) node.addClass("mainColor_bg"); } }, nextPage: function(){ this.page++; if (this.page>this.pageCount) this.page = this.pageCount; this.gotoPage(this.page); }, prevPage: function(){ this.page--; if (this.page<1) this.page = 1; this.gotoPage(this.page); }, firstPage: function(){ this.gotoPage(1); }, lastPage: function(){ this.gotoPage(this.pageCount); }, gotoPage: function(page){ this.page = page; this.hide(); this.showSkeleton(); this.load(); }, loadData: function(){ }, _fixData : function (dataList){ dataList.each(function (data){ data.creatorPersonName = data.creatorPerson.split("@")[0]; data.creatorUnitName = data.creatorUnit.split("@")[0]; data.title = data.title || this.lp.unnamed; }.bind(this)); return dataList; }, overTaskItem: function(e){ e.currentTarget.addClass("listItem_over"); var iconNode = e.currentTarget.getElement(".selectFlagIcon"); if (iconNode.hasClass("selectFlagIcon_select")){ }else{ e.currentTarget.getElement(".selectFlag").show(); } }, outTaskItem: function(e){ e.currentTarget.removeClass("listItem_over"); var iconNode = e.currentTarget.getElement(".selectFlagIcon"); if (iconNode.hasClass("selectFlagIcon_select")){ }else{ e.currentTarget.getElement(".selectFlag").hide(); } }, loadItemIcon: function(application, e){ return this.app.loadItemIcon(application, e); }, selectFile: function(id,e, dataList){ var data ; for(var i = 0 ; i < this.dataList.length;i++){ if(this.dataList[i].id === id){ data = this.dataList[i]; break ; } } if (e.currentTarget.get("disabled").toString()!="true"){ var itemNode = e.currentTarget.getParent(".listItem"); var iconNode = e.currentTarget.getElement(".selectFlagIcon"); if (itemNode){ if (itemNode.hasClass("mainColor_bg_opacity")){ itemNode.removeClass("mainColor_bg_opacity"); iconNode.removeClass("icon-xuanzhong"); iconNode.removeClass("selectFlagIcon_select"); iconNode.removeClass("mainColor_color"); this.unselectedFile(data); }else{ itemNode.addClass("mainColor_bg_opacity"); iconNode.addClass("icon-xuanzhong"); iconNode.addClass("selectFlagIcon_select"); iconNode.addClass("mainColor_color"); this.selectedFile(data); } } } this._setToolBar(); }, _setToolBar : function (){ if(this.selectedList.length === 0 ){ if(this.toolbarItems.unSelect.length>0){ this.loadToolBar(this.toolbarItems.unSelect); }else { this.loadToolBar(this.toolbarItems.default,true); } } else if (this.selectedList.length === 1){ this.loadToolBar(this.toolbarItems.selected); }else{ this.loadToolBar(this.toolbarItems.mulSelect); } }, selectedFile: function(data){ if (!this.selectedList) this.selectedList = []; var idx = this.selectedList.findIndex(function(t){ return t.id == data.id; }); if (idx===-1) this.selectedList.push(data); }, unselectedFile: function(data){ // delete data._; if (!this.selectedList) this.selectedList = []; var idx = this.selectedList.findIndex(function(t){ return t.id == data.id; }); if (idx!==-1) this.selectedList.splice(idx, 1); }, open : function (work,workCompleted,jobId){ var options = { "workId": work, "workCompletedId": workCompleted, "appId": "process.Work" + work }; if(o2.typeOf(jobId)=="string"){ options.jobId = jobId; } layout.desktop.openApplication(null, "process.Work", options); } }); MWF.xApplication.process.Application.AllList = new Class({ Extends: MWF.xApplication.process.Application.List, loadData: function(){ var _self = this; this.filterList.relateTask = true; return this.action.ReviewAction.V2ListPaging(this.page, this.size, this.filterList||{}).then(function(json){ _self.fireEvent("loadData"); _self.total = json.count; return _self._fixData(json.data); }.bind(this)); }, loadFilter: function () { var lp = this.lp; this.fileterNode = new Element("div.fileterNode", { "styles": this.css.fileterNode }).inject(this.searchNode); var html = "" + //style='width: 900px;' "" + " " + " " + " " + " " + " " + " " + " " + "" + "" + " " + " " + " " + " " + " " + " " + " " + "" + "
"; this.fileterNode.set("html", html); var selectValue = [""]; var selectText = [""]; this.app.processList.each(function(d){ selectValue.push(d.id); selectText.push(d.name); }) this.form = new MForm(this.fileterNode, {}, { style: "attendance", isEdited: true, itemTemplate: { title: {text: lp.subject, "type": "text", "style": {"min-width": "150px"}}, processName: { "text": lp.process, "type": "select", "selectValue" :selectValue, "selectText" :selectText, "style": {"min-width": "150px"}, }, credentialList: { "text": lp.creator, "type": "org", "orgType": "identity", "orgOptions": {"resultType": "person"}, "style": {"min-width": "150px"}, "orgWidgetOptions": {"disableInfor": true} }, creatorUnitList: { "text": lp.createunit, "type": "org", "orgType": "unit", "orgOptions": {"resultType": "person"}, "style": {"min-width": "150px"}, "orgWidgetOptions": {"disableInfor": true} }, startTime: { text: lp.begin, "tType": "date", "style": {"min-width":"150px"} }, endTime: { text: lp.end, "tType": "date", "style": {"min-width":"150px"} }, action: { "value": this.lp.query, type: "button", className: "filterButton", event: { click: function () { var result = this.form.getResult(false, null, false, false, false); for (var key in result) { if (!result[key]) { delete result[key]; } else if (key === "activityName" && result[key].length > 0) { //result[key] = result[key][0].split("@")[1]; result["activityNameList"] = [result[key]]; delete result[key]; }else if (key === "processName" && result[key] !== "") { //result[key] = result[key][0].split("@")[1]; result["processList"] = [result[key]]; delete result[key]; }else if (key === "endTime" && result[key] !== "") { result[key] = result[key] + " 23:59:59" } } result.applicationList = this.filterList.applicationList; if(result.credentialList) { result.creatorPersonList = result.credentialList; } this.filterList = result; this.refresh(); }.bind(this) } }, reset: { "value": this.lp.reset, type: "button", className: "filterButtonGrey", event: { click: function () { this.form.reset(); this._initFilter(); this.refresh(); }.bind(this) } }, } }, this.app, this.css); this.form.load(); }, _fixData : function (dataList){ dataList.each(function (data){ data.creatorPersonName = data.creatorPerson.split("@")[0]; data.creatorUnitName = data.creatorUnit.split("@")[0]; if(data.completed) { data.activityName = "结束"; }else { if(data.taskList.length >0){ data.activityName = data.taskList[0].activityName; } } data.title = data.title || this.lp.unnamed; }.bind(this)); return dataList; }, }); MWF.xApplication.process.Application.TaskList = new Class({ Extends: MWF.xApplication.process.Application.List, loadData: function(){ var _self = this; return this.action.TaskAction.V2ListPaging(this.page, this.size, this.filterList||{}).then(function(json){ _self.fireEvent("loadData"); _self.total = json.count; return _self._fixData(json.data); }.bind(this)); }, }); MWF.xApplication.process.Application.TaskDoneList = new Class({ Extends: MWF.xApplication.process.Application.List, loadData: function(){ var _self = this; this.filterList = this.filterList||{}; this.filterList.latest = true; return this.action.TaskCompletedAction.V2ListPaging(this.page, this.size, this.filterList).then(function(json){ _self.fireEvent("loadData"); _self.total = json.count; return _self._fixData(json.data); }.bind(this)); }, }); MWF.xApplication.process.Application.ReadList = new Class({ Extends: MWF.xApplication.process.Application.List, loadData: function(){ var _self = this; return this.action.ReadAction.V2ListPaging(this.page, this.size, this.filterList||{}).then(function(json){ _self.fireEvent("loadData"); _self.total = json.count; return _self._fixData(json.data); }.bind(this)); }, }); MWF.xApplication.process.Application.ReadDoneList = new Class({ Extends: MWF.xApplication.process.Application.List, loadData: function(){ var _self = this; return this.action.ReadCompletedAction.V2ListPaging(this.page, this.size, this.filterList||{}).then(function(json){ _self.fireEvent("loadData"); _self.total = json.count; return _self._fixData(json.data); }.bind(this)); }, }); MWF.xApplication.process.Application.DraftList = new Class({ Extends: MWF.xApplication.process.Application.List, loadData: function(){ var _self = this; return this.action.DraftAction.listMyPaging(this.page, this.size, this.filterList||{}).then(function(json){ _self.fireEvent("loadData"); _self.total = json.count; return _self._fixData(json.data); }.bind(this)); }, _fixData : function (dataList){ dataList.each(function(d){ if(d.title === "") d.title = this.lp.unnamed; }.bind(this)); return dataList; }, loadFilter: function () { var lp = this.lp; this.fileterNode = new Element("div.fileterNode", { "styles": this.css.fileterNode }).inject(this.searchNode); var html = "" + //style='width: 900px;' "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + "
"; this.fileterNode.set("html", html); var selectValue = [""]; var selectText = [""]; this.app.processList.each(function(d){ selectValue.push(d.id); selectText.push(d.name); }) this.form = new MForm(this.fileterNode, {}, { style: "attendance", isEdited: true, itemTemplate: { title: {text: lp.subject, "type": "text", "style": {"min-width": "150px"}}, processName: { "text": lp.process, "type": "select", "selectValue" :selectValue, "selectText" :selectText, "style": {"min-width": "150px"}, }, startTime: { text: lp.begin, "tType": "date", "style": {"min-width":"150px"} }, endTime: { text: lp.end, "tType": "date", "style": {"min-width":"150px"} }, action: { "value": lp.query, type: "button", className: "filterButton", event: { click: function () { var result = this.form.getResult(false, null, false, false, false); for (var key in result) { if (!result[key]) { delete result[key]; } else if (key === "activityName" && result[key].length > 0) { //result[key] = result[key][0].split("@")[1]; result["activityNameList"] = [result[key]]; delete result[key]; }else if (key === "processName" && result[key] !== "") { //result[key] = result[key][0].split("@")[1]; result["processList"] = [result[key]]; delete result[key]; }else if (key === "endTime" && result[key] !== "") { result[key] = result[key] + " 23:59:59" } } this.filterList = result; this.refresh(); }.bind(this) } }, reset: { "value": lp.reset, type: "button", className: "filterButtonGrey", event: { click: function () { this.form.reset(); this._initFilter(); this.refresh(); }.bind(this) } }, } }, this.app, this.css); this.form.load(); }, open : function (id){ var options = { "draftId": id, "appId": "process.Work" + id }; layout.desktop.openApplication(null, "process.Work", options); } }); MWF.xApplication.process.Application.WorkList = new Class({ Extends: MWF.xApplication.process.Application.List, loadData: function(){ var _self = this; this.filterList.relateEditionProcess = true; return this.action.WorkAction.manageListWithApplicationPaging(this.page, this.size, this.application.id,this.filterList||{}).then(function(json){ _self.fireEvent("loadData"); _self.total = json.count; return _self._fixData(json.data); }.bind(this)); }, _initToolBar : function (){ this.toolbarItems = { "default":[ ["delWork","jump","sendRead","rollback"], ["processing","endWork","addReview"], ["manage"] ], "unSelect":[ ], "selected":[ ["delWork","jump","sendRead","rollback"], ["processing","endWork","addReview"], ["manage"] ], "mulSelect":[ ["delWork"], ["processing","endWork","addReview"] ] } }, open : function (id){ var options = { "workId": id, "appId": "process.Work" + id }; layout.desktop.openApplication(null, "process.Work", options); }, manage : function (id,ev,dataList){ var data ; for(var i = 0 ; i < dataList.length;i++){ if(dataList[i].id === id){ data = dataList[i]; break ; } } this._manage(data); }, _manage : function (data){ var form; form = new MWF.xApplication.process.Application.ManageWorkForm({app: this.app}, data ); form.open(); }, delete : function(id,e){ var _self = this; this.app.confirm("warn", e,"删除确认!!", { "html": "
请选择删除方式?
软删除(可恢复)" + "
硬删除(不能恢复)
" }, 400, 200, function(){ var inputs = this.content.getElements("input"); var flag = ""; for (var i=0; i请选择删除方式?
软删除(可恢复)" + "
硬删除(不能恢复)
" }, 400, 200, function(){ var inputs = this.content.getElements("input"); var flag = ""; for (var i=0; i请选择删除方式?
软删除(可恢复)" + "
硬删除(不能恢复)
" }, 400, 200, function(){ var inputs = this.content.getElements("input"); var flag = ""; for (var i=0; i请选择删除方式?
软删除(可恢复)" + "
硬删除(不能恢复)
" }, 400, 280, function(){ var inputs = this.content.getElements("input"); var flag = ""; for (var i=0; i请选择文件要回溯到的位置:"; html += "
并尝试继续流转
"; html += "
"; node.set("html", html); var rollbackItemNode = node.getLast(); this.getRollbackLogs(rollbackItemNode,data.id); //node.inject(this.app.content); var dlg = o2.DL.open({ "title": MWF.xApplication.process.Work.LP.rollback, "style": "user", "isResize": false, "content": node, "width": 600, "height" : 400, "buttonList": [ { "type": "ok", "text": MWF.LP.process.button.ok, "action": function (d, e) { this.doRollback(node, e, dlg ,data.id); }.bind(this) }, { "type": "cancel", "text": MWF.LP.process.button.cancel, "action": function () { dlg.close(); } } ] }); }, doRollback: function (node, e, dlg ,workid) { var lp = MWF.xApplication.process.Work.LP; var rollbackItemNode = node.getLast(); var items = rollbackItemNode.getChildren(); var flowOption = (node.getElement(".rollback_flowOption").checked); var _self = this; for (var i = 0; i < items.length; i++) { if (items[i].retrieve("isSelected")) { var text = lp.rollbackConfirmContent; var log = items[i].retrieve("log"); var checks = items[i].getElements("input:checked"); var idList = []; checks.each(function (check) { var id = check.get("value"); if (idList.indexOf(id) == -1) idList.push(id); }); var opinion = MWF.xApplication.process.Xform.LP.rollbackTo+":"+log.fromActivityName; text = text.replace("{log}", log.fromActivityName + "(" + log.arrivedTime + ")"); this.explorer.app.confirm("infor", e, lp.rollbackConfirmTitle, text, 450, 120, function () { _self.app.action[_self.type === "workCompleted"?"WorkCompletedAction":"WorkAction"][_self.type === "workCompleted"?"rollback":"V2Rollback"](workid,{ "workLog": log.id, "distinguishedNameList": idList, "processing": !!flowOption, "opinion": opinion },function (json){ _self.app.notice(lp.rollbackSuccess); _self.explorer.refresh(); },null,false); dlg.close(); this.close(); }, function () { this.close(); }); break; } } }, getRollbackLogs: function (rollbackItemNode,id) { var _self = this; var data ; this.app.action.WorkLogAction.listRollbackWithWorkOrWorkCompleted(id).then(function (json){ var dataList = json.data; dataList.each(function (log) { if (!log.splitting && log.connected) { var node = new Element("div", { "styles": this.css.rollbackItemNode }).inject(rollbackItemNode); node.store("log", log); var iconNode = new Element("div", { "styles": this.css.rollbackItemIconNode }).inject(node); var contentNode = new Element("div", { "styles": this.css.rollbackItemContentNode }).inject(node); var div = new Element("div", { "styles": { "overflow": "hidden" } }).inject(contentNode); var activityNode = new Element("div", { "styles": this.css.rollbackItemActivityNode, "text": log.fromActivityName }).inject(div); var timeNode = new Element("div", { "styles": this.css.rollbackItemTimeNode, "text": log.arrivedTime }).inject(div); div = new Element("div", { "styles": { "overflow": "hidden" } }).inject(contentNode); var taskTitleNode = new Element("div", { "styles": this.css.rollbackItemTaskTitleNode, "text": "办理人: " }).inject(div); if (log.taskCompletedList.length) { log.taskCompletedList.each(function (o) { var text = o2.name.cn(o.person) + "(" + o.completedTime + ")"; var check = new Element("input", { "value": o.identity, "type": "checkbox", "disabled": true, "styles": this.css.rollbackItemTaskCheckNode }).inject(div); check.addEvent("click", function (e) { e.stopPropagation(); }); var taskNode = new Element("div", { "styles": this.css.rollbackItemTaskNode, "text": text }).inject(div); }.bind(this)); } else { var text = "系统自动处理"; var taskNode = new Element("div", { "styles": this.css.rollbackItemTaskNode, "text": text }).inject(div); } node.addEvents({ "mouseover": function () { var isSelected = this.retrieve("isSelected"); if (!isSelected) this.setStyles(_self.css.rollbackItemNode_over); }, "mouseout": function () { var isSelected = this.retrieve("isSelected"); if (!isSelected) this.setStyles(_self.css.rollbackItemNode) }, "click": function () { var isSelected = this.retrieve("isSelected"); if (isSelected) { _self.setRollBackUnchecked(this); } else { var items = rollbackItemNode.getChildren(); items.each(function (item) { _self.setRollBackUnchecked(item); }); _self.setRollBackChecked(this); } } }); } }.bind(this)); }.bind(this)); }, setRollBackChecked: function (item) { item.store("isSelected", true); item.setStyles(this.css.rollbackItemNode_current); item.getFirst().setStyles(this.css.rollbackItemIconNode_current); var node = item.getLast().getFirst(); node.getFirst().setStyles(this.css.rollbackItemActivityNode_current); node.getLast().setStyles(this.css.rollbackItemTimeNode_current); node = item.getLast().getLast(); node.getFirst().setStyles(this.css.rollbackItemTaskTitleNode_current); node.getLast().setStyles(this.css.rollbackItemTaskNode_current); var checkeds = item.getElements("input"); if (checkeds){ checkeds.set("checked", true); checkeds.set("disabled", false); } }, setRollBackUnchecked: function (item) { item.store("isSelected", false); item.setStyles(this.css.rollbackItemNode); item.getFirst().setStyles(this.css.rollbackItemIconNode); var node = item.getLast().getFirst(); node.getFirst().setStyles(this.css.rollbackItemActivityNode); node.getLast().setStyles(this.css.rollbackItemTimeNode); node = item.getLast().getLast(); node.getFirst().setStyles(this.css.rollbackItemTaskTitleNode); node.getLast().setStyles(this.css.rollbackItemTaskNode); var checkeds = item.getElements("input"); if (checkeds) { checkeds.set("checked", false); checkeds.set("disabled", true); } }, loadRightNode : function(){ this.toolabrRightNode = new Element("div.toolabrRightNode",{ "style": "float:right" }).inject(this.node); //this.loadSearch(); }, loadSearch : function (){ var searchNode = new Element("div.ft_titleSearchArea",{"style":"width:300px"}).inject(this.toolabrRightNode); var searchIconNode = new Element("div.ft_filterIcon",{"html":''}).inject(searchNode); var searchBtn = new Element("div",{"class":"ft_searchButton mainColor_bg","text":"搜索"}).inject(searchNode); var searchInput = new Element("div.ft_titleInputArea").inject(searchNode); new Element("input",{"placeholder" : "请输入关键字"}).inject(searchInput); }, getListType : function(){ return this.viewType || this.options.viewType }, loadListType : function(){ this.listViewTypeNode = new Element("div", { "style" : "font-size:18px;float:left;margin-right:6px", "class" : this.options.viewType == "list" ? "mainColor_color" : "", events : { click : function(){ this.viewType = "list"; this.explorer.options.defaultViewType = this.viewType; this.explorer.refresh(); }.bind(this) } }).inject(this.toolabrRightNode); new Element("icon",{"class":"o2Drive icon-list"}).inject(this.listViewTypeNode); this.tileViewTypeNode = new Element("div", { "style" : "font-size:18px;float:left", "class" : this.options.viewType !== "list" ? "mainColor_color" : "", events : { click : function(){ this.viewType = "tile"; this.explorer.options.defaultViewType = this.viewType; this.explorer.refresh(); }.bind(this) } }).inject(this.toolabrRightNode); new Element("icon",{"class":"o2Drive icon-grid"}).inject(this.tileViewTypeNode); } }); MWF.xApplication.process.Application.AddSerSialForm = new Class({ Extends: MPopupForm, Implements: [Options, Events], options: { "style": "attendanceV2", "width": 500, //"height": 300, "height": "350", "hasTop": true, "hasIcon": false, "draggable": true, "title" : "新增流水号", "id" : "" }, _createTableContent: function () { var html = "" + "" + " " + "" + "" + " " + "" + "" + " " + "
"; this.formTableArea.set("html", html); this.form = new MForm(this.formTableArea, this.data || {}, { isEdited: true, style : "attendance", hasColon : true, itemTemplate: { name: { text : "关键字", notEmpty : true }, serial: { text : "流水号", notEmpty : true }, process: { "text": "流程", "type": "text", "notEmpty" : true, "defaultValue":this.data.processName, "event": { "click": function (item, ev){ var v = item.getValue(); o2.xDesktop.requireApp("Selector", "package", function(){ var options = { "type": "Process", "values": [], "count": 1, "applicationId" : this.app.application.id, "onComplete": function (items) { if(items.length>0){ var d = items[0].data; this.data.processId = d.id; item.setValue(d.name); } }.bind(this) }; new o2.O2Selector(this.app.desktop.node, options); }.bind(this),false); }.bind(this)} } } }, this.app); this.form.load(); }, _createBottomContent: function () { if (this.isNew || this.isEdited) { this.okActionNode = new Element("button.inputOkButton", { "styles": this.css.inputOkButton, "text": "确定" }).inject(this.formBottomNode); this.okActionNode.addEvent("click", function (e) { this.save(e); }.bind(this)); } this.cancelActionNode = new Element("button.inputCancelButton", { "styles": (this.isEdited || this.isNew || this.getEditPermission() ) ? this.css.inputCancelButton : this.css.inputCancelButton_long, "text": "关闭" }).inject(this.formBottomNode); this.cancelActionNode.addEvent("click", function (e) { this.close(e); }.bind(this)); }, save: function(){ var data = this.form.getResult(true,null,true,false,true); if( data ){ debugger this.app.action.SerialNumberAction.create({ "application" : this.app.application.id, "process" : data.processId, "name" : data.name, "serial" : data.serial }).then(function (){ this.app.notice("添加成功"); this.explorer.refresh(); this.close(); }.bind(this)); } } }); MWF.xApplication.process.Application.SetSerSialForm = new Class({ Extends: MPopupForm, Implements: [Options, Events], options: { "style": "attendanceV2", "width": 500, //"height": 300, "height": "200", "hasTop": true, "hasIcon": false, "draggable": true, "title" : "设置流水号", "id" : "" }, _createTableContent: function () { var html = "" + "" + " " + "
"; this.formTableArea.set("html", html); this.form = new MForm(this.formTableArea, this.data || {}, { isEdited: true, style : "minder", hasColon : true, itemTemplate: { serial: { text : "流水号", notEmpty : true } } }, this.app); this.form.load(); }, _createBottomContent: function () { if (this.isNew || this.isEdited) { this.okActionNode = new Element("button.inputOkButton", { "styles": this.css.inputOkButton, "text": "确定" }).inject(this.formBottomNode); this.okActionNode.addEvent("click", function (e) { this.save(e); }.bind(this)); } this.cancelActionNode = new Element("button.inputCancelButton", { "styles": (this.isEdited || this.isNew || this.getEditPermission() ) ? this.css.inputCancelButton : this.css.inputCancelButton_long, "text": "关闭" }).inject(this.formBottomNode); this.cancelActionNode.addEvent("click", function (e) { this.close(e); }.bind(this)); }, save: function(){ var data = this.form.getResult(true,null,true,false,true); if( data ){ debugger this.app.action.SerialNumberAction.update(data.id,{ "application" : data.application, "process" : data.process, "serial" : data.serial }).then(function (){ this.app.notice("更新成功"); this.explorer.refresh(); this.close(); }.bind(this)); } } }); MWF.xApplication.process.Application.ManageWorkForm = new Class({ Extends: MPopupForm, Implements: [Options, Events], options: { "style": "attendanceV2", "width": "1000", "height": "700", "hasTop": true, "hasIcon": false, "hasTopIcon" : false, "hasTopContent" : false, "draggable": true, "maxAction" : true, "resizeable" : true, "closeAction": true, "title": MWF.xApplication.process.Application.LP.adminwork, "hideBottomWhenReading": true, "closeByClickMaskWhenReading": true, }, _postLoad: function(){ if(this.data.completedTime){ this.isCompletedWork = true; } this._createTableContent_(); }, _createTableContent: function(){}, _createTableContent_: function () { //this.formTableArea.set("html", this.getHtml()); this.formTableContainer.setStyle("width","95%"); this.formTableContainer.setStyle("margin","0px auto 10px"); this.loadTab(); }, loadTab : function (){ this.tabNode = new Element("div",{"styles" : this.css.tabNode }).inject(this.formTableArea); this.taskArea = new Element("div",{"style" : "height:500px;overflow:auto" }).inject(this.tabNode); this.taskDoneArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.readArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.readDoneArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.reviewArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.attachementArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.recordArea = new Element("div",{"style" : "height:550px;overflow:auto" }).inject(this.tabNode); this.businessDataArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.dataRecordArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); MWF.require("MWF.widget.Tab", function(){ this.tabs = new MWF.widget.Tab(this.tabNode, {"style": "attendance"}); this.tabs.load(); this.taskPage = this.tabs.addTab(this.taskArea, this.lp.task, false); this.taskPage.addEvent("show",function(){ if(!this.initTask) this.loadTask(); }.bind(this)); this.taskDonePage = this.tabs.addTab(this.taskDoneArea, this.lp.taskDone, false); this.taskDonePage.addEvent("show",function(){ if(!this.initTaskDone) this.loadTaskDone(); }.bind(this)); this.readPage = this.tabs.addTab(this.readArea, this.lp.read, false); this.readPage.addEvent("show",function(){ if(!this.initRead) this.loadRead(); }.bind(this)); this.readDonePage = this.tabs.addTab(this.readDoneArea, this.lp.readDone, false); this.readDonePage.addEvent("show",function(){ if(!this.initReadDone) this.loadReadDone(); }.bind(this)); this.recordPage = this.tabs.addTab(this.recordArea, this.lp.workLog, false); this.recordPage.addEvent("show",function(){ if(!this.initRecord) this.loadRecord(); }.bind(this)); this.reviewPage = this.tabs.addTab(this.reviewArea, this.lp.review, false); this.reviewPage.addEvent("show",function(){ if(!this.initReview) this.loadReview(); }.bind(this)); this.attachementPage = this.tabs.addTab(this.attachementArea, this.lp.attachment, false); this.attachementPage.addEvent("show",function(){ if(!this.initAttachement) this.loadAttachement(); }.bind(this)); this.businessDataPage = this.tabs.addTab(this.businessDataArea,this.lp.businessData, false); this.businessDataPage.addEvent("show",function(){ if(!this.initBusinessData) this.loadBusinessData(); }.bind(this)); this.dataRecordPage = this.tabs.addTab(this.dataRecordArea,this.lp.dataRecord, false); this.dataRecordPage.addEvent("show",function(){ if(!this.initDataRecord) this.loadDataRecord(); }.bind(this)); this.tabs.pages[0].showTab(); }.bind(this)); }, loadTask : function () { this.app.action.TaskAction.listWithWork(this.data.id,function (json){ this.taskList = json.data; this._loadTask(); this.initTask = true; }.bind(this),function (){ this.taskArea.empty(); this.initTask = true; return true; }.bind(this)); }, _loadTask : function (){ this.taskArea.empty(); this.taskContentNode = new Element("div").inject(this.taskArea); var taskTableNode = new Element("table.table",{ "border" : 0, "cellpadding" : 5, "cellspacing" : 0 }).inject(this.taskContentNode); var taskTableTheadNode = new Element("thead").inject(taskTableNode); var taskTableTbodyNode = new Element("tbody").inject(taskTableNode); var taskTableTheadTrNode = new Element("tr").inject(taskTableTheadNode); Array.each([this.lp.currentPerson, this.lp.currentDept, this.lp.activity, this.lp.startTime, this.lp.action], function (text) { new Element("th", {"text": text}).inject(taskTableTheadTrNode); }); this.taskList.each(function (task) { var trNode = new Element("tr").inject(taskTableTbodyNode); trNode.store("data", task); Array.each([task.person.split("@")[0], task.unit.split("@")[0], task.activityName, task.startTime], function (text) { new Element("td", { text: text }).inject(trNode); }); var tdOpNode = new Element("td").inject(trNode); var restButton = new Element("button", {"text": this.lp.resetAction, "class": "button"}).inject(tdOpNode); var deleteButton = new Element("button", {"text": this.lp.remove, "class": "button"}).inject(tdOpNode); var addSignButton = new Element("button", {"text": this.lp.addSign, "class": "button"}).inject(tdOpNode); var flowButton = new Element("button", {"text": this.lp.flow, "class": "button"}).inject(tdOpNode); _self = this; deleteButton.addEvent("click", function (e) { _self.app.confirm("warn", e, _self.lp.tip, this.lp.tip_remove, 350, 120, function () { _self.app.action.TaskAction.manageDelete(task.id,function (){},null,false); _self.loadTask(); this.close(); }, function(){ this.close(); }); }.bind(this)); restButton.addEvent("click", function (ev) { var opt = { "type": "identity", "count": 0, "title": _self.lp.resetAction, "onComplete": function (items) { var _self = this; var nameArr = []; items.each(function(item){ nameArr.push(item.data.name) }); this.explorer.app.confirm("warn", ev,_self.lp.tip_reset, { "html": _self.lp.rest_content.replace("(name)",nameArr.join()) }, 400, 300, function(){ var inputs = this.content.getElements("input"); var opinion = this.content.getElement("textarea").get("value"); var flag = ""; for (var i=0; i 3 ? (nameArr[0]+"、"+nameArr[1]+"、"+nameArr[2]+"...") : nameArr.join(", "); var routeName = leftText+":"+n; if (!opinion) opinion = leftText+":"+nameArr.join(", "); //o2.xApplication.process.Xform.LP.form.addTask+":"+nameArr.join(", "); var data = { "mode": mode, "before": !!before, "opinion": opinion, "routeName": routeName, "distinguishedNameList": names }; o2.Actions.load("x_processplatform_assemble_surface").TaskAction.v3Add( //this.workAction.resetWork( function (json) { if (success) success(json); }.bind(this), function (xhr, text, error) { if (failure) failure(xhr, text, error); }, task.id, data ); }, selectPeopleAll: function (dlg, count) { var names = dlg.identityList || []; var areaNode = $("resetWork_selPeopleArea"); var options = { "values": names, "type": "identity", "count": count, "onComplete": function (items) { areaNode.empty(); var identityList = []; items.each(function (item) { new MWF.widget.O2Identity(item.data, areaNode, { "style": "reset" }); identityList.push(item.data.distinguishedName); }.bind(this)); dlg.identityList = identityList; }.bind(this) }; MWF.xDesktop.requireApp("Selector", "package", function () { var selector = new MWF.O2Selector(this.app.content, options); }.bind(this)); }, loadTaskDone : function () { this.app.action.TaskCompletedAction.listWithJob(this.data.job, function (json) { this.taskDoneList = json.data; this._loadTaskDone(); this.initTaskDone = true; }.bind(this)); }, _loadTaskDone : function (){ var lp = this.lp; this.taskDoneArea.empty(); this.taskDoneContentNode = new Element("div").inject(this.taskDoneArea); var taskDoneTableNode = new Element("table.table",{ "border" : 0, "cellpadding" : 5, "cellspacing" : 0 }).inject(this.taskDoneContentNode); var taskDoneTableTheadNode = new Element("thead").inject(taskDoneTableNode); var taskDoneTableTbodyNode = new Element("tbody").inject(taskDoneTableNode); var taskDoneTableTheadTrNode = new Element("tr").inject(taskDoneTableTheadNode); Array.each([lp.currentPerson, lp.currentDept, lp.activity, lp.startTime, lp.endTime, lp.routerName, lp.idea, lp.action], function (text) { var tmpthNode = new Element("th", {"text": text}).inject(taskDoneTableTheadTrNode); if(text===lp.idea){ tmpthNode.setStyle("width","150px"); } }); this.taskDoneList.each(function (taskDone) { var trNode = new Element("tr").inject(taskDoneTableTbodyNode); trNode.store("data", taskDone); Array.each([taskDone.person.split("@")[0], taskDone.unit.split("@")[0], taskDone.activityName, taskDone.startTime, taskDone.updateTime, taskDone.routeName, taskDone.opinion], function (text) { new Element("td", { text: text }).inject(trNode); }); var tdOpNode = new Element("td").inject(trNode); var setOpinionButton = new Element("button", {"text": lp.idea, "class": "button"}).inject(tdOpNode); var deleteButton = new Element("button", {"text": lp.remove, "class": "button"}).inject(tdOpNode); deleteButton.addEvent("click", function (e) { _self = this; this.app.confirm("warn", e, lp.tip, lp.tip_remove, 350, 120, function () { _self.app.action.TaskCompletedAction.manageDelete(taskDone.id,function (){},null,false); _self.loadTaskDone(); this.close(); }, function(){ this.close(); }); }.bind(this)); setOpinionButton.addEvent("click", function () { var ideaNode = new Element("div", {"class": "control", "style": "margin:10px"}); var textareaNode = new Element("textarea", {"style":"height:80px","class": "textarea", "text": taskDone.opinion}); textareaNode.inject(ideaNode); var ideaDlg = o2.DL.open({ "title": lp.editIdea, "width": "400px", "height": "260px", "mask": true, "content": ideaNode, "container": null, "positionNode": this.app.content, "onQueryClose": function () { ideaNode.destroy(); }.bind(this), "buttonList": [ { "text": lp.ok, "action": function () { this.app.action.TaskCompletedAction.manageOpinion(taskDone.id,{"opinion":textareaNode.get("value")},function(json){ },null,false); this.loadTaskDone(); ideaDlg.close(); }.bind(this) }, { "text": lp.close, "action": function () { ideaDlg.close(); }.bind(this) } ], "onPostShow": function () { ideaDlg.reCenter(); }.bind(this) }); }.bind(this)); }.bind(this)); }, loadRead : function () { this.app.action.ReadAction.listWithJob(this.data.job, function (json) { this.readList = json.data; this._loadRead(); this.initRead = true; }.bind(this)); }, _loadRead : function (){ var lp = this.lp; this.readArea.empty(); this.readContentNode = new Element("div").inject(this.readArea); var readTableNode = new Element("table.table",{ "border" : 0, "cellpadding" : 5, "cellspacing" : 0 }).inject(this.readContentNode); var readTableTheadNode = new Element("thead").inject(readTableNode); var readTableTbodyNode = new Element("tbody").inject(readTableNode); var readTableTheadTrNode = new Element("tr").inject(readTableTheadNode); Array.each([lp.readPerson, lp.currentDept, lp.activity, lp.startTime, lp.action], function (text) { new Element("th", {"text": text}).inject(readTableTheadTrNode); }); this.readList.each(function (read) { var trNode = new Element("tr").inject(readTableTbodyNode); trNode.store("data", read); Array.each([read.person.split("@")[0], read.unit.split("@")[0], read.activityName, read.startTime], function (text) { new Element("td", { text: text }).inject(trNode); }); var tdOpNode = new Element("td").inject(trNode); var readButton = new Element("button", {"text": lp.readDone, "class": "button"}).inject(tdOpNode); var restButton = new Element("button", {"text": lp.resetAction, "class": "button"}).inject(tdOpNode); var deleteButton = new Element("button", {"text": lp.remove, "class": "button"}).inject(tdOpNode); deleteButton.addEvent("click", function (e) { var _self = this; _self.app.confirm("warn", e, lp.tip, lp.tip_remove, 350, 120, function () { _self.app.action.ReadAction.manageDelete(read.id,function (){},null,false); _self.loadRead(); this.close(); }, function(){ this.close(); }); }.bind(this)); restButton.addEvent("click", function () { var opt = { "type": "identity", "count": 0, "title": lp.resetAction, "onComplete": function (items) { var nameList = []; var nameDnList = []; items.each(function (identity) { nameList.push(identity.data.name); nameDnList.push(identity.data.distinguishedName); }); var data = { "opinion":lp.resetActionFor + ": " + nameList.join(","), "identityList":nameDnList } this.app.action.ReadAction.manageResetRead(read.id,data,function(json){ },null,false); this.loadRead(); }.bind(this) }; new MWF.O2Selector(this.app.content, opt); }.bind(this)); readButton.addEvent("click", function () { var ideaNode = new Element("div", { "style": "margin:10px"}); var textareaNode = new Element("textarea", {"class":"textarea","style": "min-width:100%;height: 100px", "text": read.opinion}); textareaNode.inject(ideaNode); var ideaDlg = o2.DL.open({ "title": lp.readProcess, "width": "400px", "height": "260px", "mask": true, "content": ideaNode, "container": null, "positionNode": this.app.content, "onQueryClose": function () { ideaNode.destroy(); }.bind(this), "buttonList": [ { "text": lp.ok, "action": function () { this.app.action.ReadAction.manageProcessing(read.id,{"opinion":textareaNode.get("value")},function(json){ },null,false); this.loadRead(); ideaDlg.close(); }.bind(this) }, { "text": lp.close, "action": function () { ideaDlg.close(); }.bind(this) } ], "onPostShow": function () { ideaDlg.reCenter(); }.bind(this) }); }.bind(this)); }.bind(this)); }, loadReadDone : function () { this.app.action.ReadCompletedAction.listWithJob(this.data.job, function (json) { this.readDoneList = json.data; this._loadReadDone(); this.initReadDone = true; }.bind(this), null, false); }, _loadReadDone : function (){ var lp = this.lp; this.readDoneArea.empty(); this.readDoneContentNode = new Element("div").inject(this.readDoneArea); var readDoneTableNode = new Element("table.table",{ "border" : 0, "cellpadding" : 5, "cellspacing" : 0 }).inject(this.readDoneContentNode); var readDoneTableTheadNode = new Element("thead").inject(readDoneTableNode); var readDoneTableTbodyNode = new Element("tbody").inject(readDoneTableNode); var readDoneTableTheadTrNode = new Element("tr").inject(readDoneTableTheadNode); Array.each([lp.currentPerson, lp.currentDept, lp.activity, lp.startTime, lp.endTime, lp.idea, lp.action], function (text) { new Element("th", {"text": text}).inject(readDoneTableTheadTrNode); }); this.readDoneList.each(function (readDone) { var trNode = new Element("tr").inject(readDoneTableTbodyNode); trNode.store("data", readDone); Array.each([readDone.person.split("@")[0], readDone.unit.split("@")[0], readDone.activityName, readDone.startTime, readDone.updateTime, readDone.opinion], function (text) { new Element("td", { text: text }).inject(trNode); }); var tdOpNode = new Element("td").inject(trNode); var setOpinionButton = new Element("button", {"text": lp.idea, "class": "button"}).inject(tdOpNode); var deleteButton = new Element("button", {"text": lp.remove, "class": "button"}).inject(tdOpNode); deleteButton.addEvent("click", function (e) { _self = this; this.app.confirm("warn", e, lp.tip, lp.tip_remove, 350, 120, function () { _self.app.action.ReadCompletedAction.manageDelete(readDone.id,function (){},null,false); _self.loadReadDone(); this.close(); }, function(){ this.close(); }); }.bind(this)); setOpinionButton.addEvent("click", function () { var ideaNode = new Element("div", {"class": "control", "style": "margin:10px"}); var textareaNode = new Element("textarea", {"class": "textarea", "text": readDone.opinion}); textareaNode.inject(ideaNode); var ideaDlg = o2.DL.open({ "title": lp.editIdea, "width": "400px", "height": "260px", "mask": true, "content": ideaNode, "container": null, "positionNode": this.app.content, "onQueryClose": function () { ideaNode.destroy(); }.bind(this), "buttonList": [ { "text": lp.ok, "action": function () { this.app.action.ReadCompletedAction.manageUpdate(readDone.id,{"opinion":textareaNode.get("value")},function(json){ },null,false); this.loadReadDone(); ideaDlg.close(); }.bind(this) }, { "text": lp.close, "action": function () { ideaDlg.close(); }.bind(this) } ], "onPostShow": function () { ideaDlg.reCenter(); }.bind(this) }); }.bind(this)); }.bind(this)); }, loadRecord : function (){ this.app.action.RecordAction.listWithJob(this.data.job, function (json) { this.recordList = json.data; this._loadRecord(); this.initRecord = true; }.bind(this), null, false); }, _loadRecord : function (){ var lp = this.lp; this.recordArea.empty(); this.recordContentNode = new Element("div").inject(this.recordArea); var recordTableNode = new Element("table.table",{ "border" : 0, "cellpadding" : 5, "cellspacing" : 0 }).inject(this.recordContentNode); var recordTableTheadNode = new Element("thead").inject(recordTableNode); var recordTableTbodyNode = new Element("tbody").inject(recordTableNode); var recordTableTheadTrNode = new Element("tr").inject(recordTableTheadNode); Array.each([lp.currentPerson, lp.currentDept, lp.activity, lp.startTime, lp.endTime, lp.routerName, lp.idea, lp.action], function (text) { var tmpthNode = new Element("th", {"text": text}).inject(recordTableTheadTrNode); if(text===lp.idea){ tmpthNode.setStyle("width","150px"); } }); this.recordList.each(function (record) { if(record.type!=="currentTask"){ var trNode = new Element("tr").inject(recordTableTbodyNode); trNode.store("data", record); console.log(record) var routeName; if(record.type === "reroute"){ routeName = lp.reroute; }else if(record.type === "reset"){ routeName = lp.resetAction; }else { routeName = record.properties.routeName; } Array.each([record.person.split("@")[0], record.unit.split("@")[0], record.fromActivityName, record.properties.startTime, record.updateTime, routeName, record.properties.opinion], function (text) { new Element("td", { text: text }).inject(trNode); }); var tdOpNode = new Element("td").inject(trNode); var setOpinionButton = new Element("button", {"text": lp.idea, "class": "button"}).inject(tdOpNode); var modifyButton = new Element("button", {"text": lp.modify, "class": "button"}).inject(tdOpNode); var copyButton = new Element("button", {"text": lp.copy, "class": "button"}).inject(tdOpNode); var deleteButton = new Element("button", {"text": lp.remove, "class": "button"}).inject(tdOpNode); deleteButton.addEvent("click", function (e) { _self = this; this.app.confirm("warn", e, lp.tip, lp.tip_remove, 350, 120, function () { _self.app.action.RecordAction.manageDelete(record.id,function(json){ _self.loadRecord(); },null,false); this.close(); }, function(){ this.close(); }); }.bind(this)); setOpinionButton.addEvent("click", function () { _self = this; var ideaNode = new Element("div", {"class": "control", "style": "margin:10px"}); var textareaNode = new Element("textarea", {"style":"height:80px","class": "textarea", "text": record.opinion}); textareaNode.inject(ideaNode); var ideaDlg = o2.DL.open({ "title": lp.editIdea, "width": "400px", "height": "260px", "mask": true, "content": ideaNode, "container": null, "positionNode": this.app.content, "onQueryClose": function () { ideaNode.destroy(); }.bind(this), "buttonList": [ { "text": lp.ok, "action": function () { record.opinion = textareaNode.get("value"); _self.app.action.RecordAction.manageEdit(record.id,record,function(json){ _self.loadRecord(); },null,false); ideaDlg.close(); }.bind(this) }, { "text": lp.close, "action": function () { ideaDlg.close(); }.bind(this) } ], "onPostShow": function () { ideaDlg.reCenter(); }.bind(this) }); }.bind(this)); modifyButton.addEvent("click", function () { var recordNode = new Element("div", {"class": "control", "style": "margin:10px"}); var textareaNode = new Element("textarea", {"style":"height:350px","class": "textarea", "text": JSON.stringify(record,null,"\t")}); textareaNode.inject(recordNode); var recordDlg = o2.DL.open({ "title": lp.recordEdit, "width": "800px", "height": "500", "mask": true, "content": recordNode, "container": null, "positionNode": this.app.content, "onQueryClose": function () { recordNode.destroy(); }.bind(this), "buttonList": [ { "text": lp.ok, "action": function () { record = JSON.parse(textareaNode.get("value")); this.app.action.RecordAction.manageEdit(record.id,record,function(json){ this.loadRecord(); }.bind(this),null,false); recordDlg.close(); }.bind(this) }, { "text": lp.close, "action": function () { recordDlg.close(); }.bind(this) } ], "onPostShow": function () { recordDlg.reCenter(); }.bind(this) }); }.bind(this)); copyButton.addEvent("click", function () { var recordNode = new Element("div", {"class": "control", "style": "margin:10px"}); var textareaNode = new Element("textarea", {"style":"height:350px","class": "textarea", "text": JSON.stringify(record,null,"\t")}); textareaNode.inject(recordNode); var recordDlg = o2.DL.open({ "title": lp.recordAdd, "width": "800px", "height": "500", "mask": true, "content": recordNode, "container": null, "positionNode": this.app.content, "onQueryClose": function () { recordNode.destroy(); }.bind(this), "buttonList": [ { "text": lp.ok, "action": function () { record = JSON.parse(textareaNode.get("value")); this.app.action.RecordAction.manageCreateWithJob(record.job,record,function(json){ this.loadRecord(); }.bind(this),null,false); recordDlg.close(); }.bind(this) }, { "text": lp.close, "action": function () { recordDlg.close(); }.bind(this) } ], "onPostShow": function () { recordDlg.reCenter(); }.bind(this) }); }.bind(this)); } }.bind(this)); }, loadReview : function (){ this.app.action.ReviewAction.listWithJob(this.data.job, function (json) { this.reviewList = json.data; this._loadReview(); this.initReview = true; }.bind(this), null, false); }, _loadReview : function (){ var lp = this.lp; this.reviewArea.empty(); this.reviewContentNode = new Element("div").inject(this.reviewArea) var reviewTableNode = new Element("table.table",{ "border" : 0, "cellpadding" : 5, "cellspacing" : 0 }).inject(this.reviewContentNode); var reviewTableTheadNode = new Element("thead").inject(reviewTableNode); var reviewTableTbodyNode = new Element("tbody").inject(reviewTableNode); var reviewTableTheadTrNode = new Element("tr").inject(reviewTableTheadNode); Array.each([lp.reviewitem, lp.action], function (text) { new Element("th", {"text": text}).inject(reviewTableTheadTrNode); }); this.reviewList.each(function (review) { var trNode = new Element("tr").inject(reviewTableTbodyNode); trNode.store("data", review); Array.each([review.person], function (text) { new Element("td", { text: text }).inject(trNode); }); var tdOpNode = new Element("td").inject(trNode); var deleteButton = new Element("button", {"text": lp.remove, "class": "button"}).inject(tdOpNode); deleteButton.addEvent("click", function (e) { _self = this; this.app.confirm("warn", e, lp.tip, lp.tip_remove, 350, 120, function () { _self.app.action.ReviewAction.manageDelete(review.id,review.application,function(json){ _self.loadReview(); },null,false); this.close(); }, function(){ this.close(); }); }.bind(this)); }.bind(this)); }, loadDataRecord : function (){ this.app.action.DataRecordAction.listWithJob(this.data.job, function (json) { this.dataRecordList = json.data; this._loadDataRecord(); this.initAttachement = true; }.bind(this), null, false); }, _loadDataRecord : function (){ var lp = this.lp; this.dataRecordArea.empty(); this.dataRecordContentNode = new Element("div").inject(this.dataRecordArea) var dataRecordTableNode = new Element("table.table",{ "border" : 0, "cellpadding" : 5, "cellspacing" : 0 }).inject(this.dataRecordContentNode); var dataRecordTableTheadNode = new Element("thead").inject(dataRecordTableNode); var dataRecordTableTbodyNode = new Element("tbody").inject(dataRecordTableNode); var dataRecordTableTheadTrNode = new Element("tr").inject(dataRecordTableTheadNode); Array.each([this.lp.fieldName,lp.dataRecordView.person,lp.dataRecordView.time,lp.dataRecordView.active,lp.dataRecordView.old,lp.dataRecordView.new], function (text) { new Element("th", {"text": text}).inject(dataRecordTableTheadTrNode); }); this.dataRecordList.each(function (dataRecord) { if(dataRecord.updateNum && dataRecord.updateNum>1){ var path = dataRecord.path; var updateNum = dataRecord.updateNum; this.app.action.DataRecordAction.getWithJobPath(this.data.job, dataRecord.path,function (json) { var dataRecordList = json.data; dataRecordList.dataRecordItemList.each(function (item,index) { var trNode = new Element("tr").inject(dataRecordTableTbodyNode); if(index === 0 ){ new Element("td", { text: path, rowspan : updateNum, style : "border-right:1px solid #E6E6E6;background:#F7F7F7;font-weight:500" }).inject(trNode); } item.personName = item.person.split("@")[0]; Array.each([item.personName,item.updateDate,item.activityName,item.oldData,item.newData], function (text) { new Element("td", { text: text }).inject(trNode); }.bind(this)); }.bind(this)); }) } }.bind(this)); }, _loadDataRecordDetail : function (path){ _self = this; var lp = this.lp; var recordNode = new Element("div"); var dataRecordContentNode = new Element("div").inject(recordNode) var dataRecordTableNode = new Element("table.table",{ "border" : 0, "cellpadding" : 5, "cellspacing" : 0 }).inject(dataRecordContentNode); var dataRecordTableTheadNode = new Element("thead").inject(dataRecordTableNode); var dataRecordTableTbodyNode = new Element("tbody").inject(dataRecordTableNode); var dataRecordTableTheadTrNode = new Element("tr").inject(dataRecordTableTheadNode); Array.each([lp.dataRecordView.person,lp.dataRecordView.time,lp.dataRecordView.active,lp.dataRecordView.old,lp.dataRecordView.new], function (text) { new Element("th", {"text": text}).inject(dataRecordTableTheadTrNode); }); this.app.action.DataRecordAction.getWithJobPath(this.data.job, path,function (json) { var dataRecordList = json.data; dataRecordList.dataRecordItemList.each(function (item) { item.personName = item.person.split("@")[0]; var trNode = new Element("tr").inject(dataRecordTableTbodyNode); Array.each([item.personName,item.updateDate,item.activityName,item.oldData,item.newData], function (text, index) { new Element("td", { text: text }).inject(trNode); }.bind(this)); }.bind(this)); var viewDlg = o2.DL.open({ "title": path + " : " + this.lp.dataRecordView.record, "width": "800px", "height": "500", "mask": true, "content": recordNode, "container": this.app.content, "positionNode": this.app.content, "onQueryClose": function () { recordNode.destroy(); }.bind(this), "buttonList": [ { "text": lp.close, "action": function () { viewDlg.close(); }.bind(this) } ], "onPostShow": function () { viewDlg.reCenter(); }.bind(this) }); }.bind(this),null,false); }, loadAttachement : function (){ this.app.action.AttachmentAction.listWithJob(this.data.job, function (json) { this.attachmentList = json.data; this._loadAttachement(); this.initAttachement = true; }.bind(this), null, false); }, _loadAttachement : function (){ this.attachementArea.empty(); this.attachmentContentNode = new Element("div").inject(this.attachementArea) var attachmentTableNode = new Element("table.table",{ "border" : 0, "cellpadding" : 5, "cellspacing" : 0 }).inject(this.attachmentContentNode); var attachmentTableTheadNode = new Element("thead").inject(attachmentTableNode); var attachmentTableTbodyNode = new Element("tbody").inject(attachmentTableNode); var attachmentTableTheadTrNode = new Element("tr").inject(attachmentTableTheadNode); Array.each(["附件名称", "上传环节", "上传人", "上传时间", "标识","大小" ,"排序","操作"], function (text) { new Element("th", {"text": text}).inject(attachmentTableTheadTrNode); }); var siteArr = []; this.attachmentList.each(function (attachment) { if(!siteArr.contains(attachment.site)) siteArr.push(attachment.site); var trNode = new Element("tr").inject(attachmentTableTbodyNode); trNode.store("data", attachment); Array.each([attachment.name, attachment.activityName, attachment.person.split("@")[0], attachment.createTime ,attachment.site,attachment["length"],attachment.orderNumber], function (text, index) { new Element("td", { text: index ===5 ? this.getFileSize(text) : text }).inject(trNode); }.bind(this)); var tdOpNode = new Element("td").inject(trNode); var deleteButton = new Element("button", {"text": "删除", "class": "button"}).inject(tdOpNode); deleteButton.addEvent("click", function (e) { _self = this; this.app.confirm("warn", e, "提示", "确认是否删除", 350, 120, function () { _self.app.action.AttachmentAction.delete(attachment.id,function(json){ _self.loadAttachement(); },null,false); this.close(); }, function(){ this.close(); }); }.bind(this)); var downButton = new Element("button", {"text": "下载", "class": "button"}).inject(tdOpNode); downButton.addEvent("click", function () { var locate = window.location; var protocol = locate.protocol; var addressObj = layout.serviceAddressList["x_processplatform_assemble_surface"]; var defaultPort = layout.config.app_protocol==='https' ? "443" : "80"; var appPort = addressObj.port || window.location.port; var address = protocol+"//"+(addressObj.host || window.location.hostname)+((!appPort || appPort.toString()===defaultPort) ? "" : ":"+appPort)+addressObj.context; window.open(o2.filterUrl(address) + "/jaxrs/attachment/download/"+ attachment.id +"/stream") }.bind(this)); var sortButton = new Element("button", {"text": "排序", "class": "button"}).inject(tdOpNode); sortButton.addEvent("click", function () { var sortNode = new Element("div", {"class": "control", "style": "margin:10px"}); var inputNode = new Element("input", {"class": "input", "text": attachment.orderNumber}); inputNode.inject(sortNode); var sortDlg = o2.DL.open({ "title": "排序号修改", "width": "400px", "height": "260px", "mask": true, "content": sortNode, "container": null, "positionNode": this.app.content, "onQueryClose": function () { sortNode.destroy(); }.bind(this), "buttonList": [ { "text": "确认", "action": function () { var orderNumber = inputNode.get("value"); debugger this.app.action.AttachmentAction.changeOrderNumber(attachment.id,this.data.id,orderNumber,function( json ){ this.loadAttachement(); }.bind(this),null,false); sortDlg.close(); }.bind(this) }, { "text": "关闭", "action": function () { sortDlg.close(); }.bind(this) } ], "onPostShow": function () { sortDlg.reCenter(); }.bind(this) }); }.bind(this)); }.bind(this)); var attachmentUploadDiv = new Element("div").inject(this.attachmentContentNode); var siteSelect = new Element("select",{"class":"select","style":"float:left"}).inject(attachmentUploadDiv); new Element("option",{value:"",text:""}).inject(siteSelect); siteArr.each(function(site){ new Element("option",{value:site,text:site}).inject(siteSelect); }); siteSelect.addEvent("change",function(){ uploadSite.set("value",siteSelect.get("value")); }); var uploadSite = new Element("input",{ "class":"input", "placeholder":"对应上传的附件标识", "style" :"width:200px;float:left" }).inject(attachmentUploadDiv); var uploadButton = new Element("button", {"text": "上传", "class": "button"}).inject(attachmentUploadDiv); uploadButton.addEvent("click", function () { if(uploadSite.get("value")==""){ this.app.notice("对应上传的附件标识不能为空","error"); return false; } var options = { "title": "附件区域" }; var site = uploadSite.get("value"); var uploadAction = this.isCompletedWork?"uploadAttachmentByWorkCompleted":"uploadAttachment"; o2.require("o2.widget.Upload", null, false); var upload = new o2.widget.Upload(this.app.content, { "action": o2.Actions.get("x_processplatform_assemble_surface").action, "method": uploadAction, "parameter": { "id": this.data.id }, "data":{ "site": site }, "onCompleted": function(){ this.loadAttachement(); }.bind(this) }); upload.load(); }.bind(this)); }, loadBusinessData : function (){ this.app.action.DataAction.getWithJob(this.data.job, function (json) { this.workData = json.data; this._loadBusinessData(); this.initBusinessData = true; }.bind(this), null, false); }, _loadBusinessData : function (){ var workData = this.workData; var workDataContentNode = new Element("div",{"style":"margin:5px"}).inject(this.businessDataArea); this.workDataContentNode = workDataContentNode; var html = "" + "" + " " + " " + " " + " " + " " + " " + "" + "" + " " + " " + " " + "" + "
" workDataContentNode.set("html", html); this.form = new MForm(workDataContentNode, {}, { style: "attendance", isEdited: true, itemTemplate: { fieldList: { "text": "字段列表", "type": "select", "style": {"max-width": "150px"}, "selectValue": function () { var arr = [""]; arr.append(Object.keys(workData)); return arr; }, "event": { "change": function (item, ev) { var type = typeof(workData[item.getValue()]); item.form.getItem("fieldType").setValue(type); item.form.getItem("fieldName").setValue(item.getValue()); if(type === "object" || type === "array"){ item.form.getItem("fieldValue").setValue(JSON.stringify(workData[item.getValue()])); }else { item.form.getItem("fieldValue").setValue(workData[item.getValue()]); } }.bind(this) } }, fieldType: { "text": "字段类型", "type": "select", "style": {"max-width": "150px"}, "selectValue": function () { var array = ["","array","boolean","string","number","object"]; return array; }, "event": { "change": function (item, ev) { }.bind(this) } }, fieldName: {text: "字段名", "type": "text", "style": {"min-width": "100px"}}, fieldValue: {text: "字段值", "type": "textarea", "style": {"width": "100%","margin-left": "10px"}}, action: { "value": "修改", type: "button", className: "filterButton", event: { click: function (e) { var result = this.form.getResult(false, null, false, false, false); var fieldName = result["fieldName"]; var fieldType = result["fieldType"]; var fieldValue = result["fieldValue"]; if (!fieldName) return false; workData[fieldName] = (fieldType === "object" ? JSON.parse(fieldValue) : fieldValue); _self = this; this.app.confirm("warn", e.node, "提示", "确认是否修改", 350, 120, function () { if(_self.isCompletedWork){ _self.app.action.DataAction.updateWithWorkCompleted(_self.data.id,workData,function (json){},null,false); }else{ _self.app.action.DataAction.updateWithWork(_self.data.id,workData,function (json){},null,false); } _self.app.notice("success"); _self.loadScriptEditor(); this.close(); }, function(){ this.close(); }); }.bind(this) } } } }, this.app, this.css); this.form.load(); this.loadScriptEditor(); }, loadScriptEditor:function(){ if( !this.workData )return; MWF.require("MWF.widget.JavascriptEditor", null, false); var workDataNode = this.formTableContainer.getElement('[item="workData"]'); this.scriptEditor = new MWF.widget.JavascriptEditor(workDataNode, { "forceType": "ace", "option": { "mode" : "json" } }); this.scriptEditor.load(function(){ this.scriptEditor.setValue(JSON.stringify(this.workData, null, "\t")); this.scriptEditor.editor.setReadOnly(true); this.addEvent("afterResize", function () { this.resizeScript(); }.bind(this)) this.addEvent("queryClose", function () { }.bind(this)) this.resizeScript(); }.bind(this)); }, resizeScript: function () { var size = this.formTableContainer.getSize(); var tableSize = this.formTableContainer.getElement('table').getSize(); this.formTableContainer.getElement('[item="workData"]').setStyle("height", size.y - 200); if (this.scriptEditor && this.scriptEditor.editor) this.scriptEditor.editor.resize(); }, getFileSize: function (size) { if (!size) return ""; var num = 1024.00; //byte if (size < num) return size + "B"; if (size < Math.pow(num, 2)) return (size / num).toFixed(2) + "K"; //kb if (size < Math.pow(num, 3)) return (size / Math.pow(num, 2)).toFixed(2) + "M"; //M if (size < Math.pow(num, 4)) return (size / Math.pow(num, 3)).toFixed(2) + "G"; //G }, }); MWF.xApplication.process.Application.ManageWorkCompletedForm = new Class({ Extends: MWF.xApplication.process.Application.ManageWorkForm, loadTask : function () { this.app.action.TaskAction.listWithJob(this.data.job).then(function(json){ this.taskList = json.data; this._loadTask(); this.initTask = true; }.bind(this)); }, loadTab : function (){ this.tabNode = new Element("div",{"styles" : this.css.tabNode }).inject(this.formTableArea); this.taskDoneArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.readArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.readDoneArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.reviewArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.attachementArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.recordArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.businessDataArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); this.dataRecordArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode); MWF.require("MWF.widget.Tab", function(){ this.tabs = new MWF.widget.Tab(this.tabNode, {"style": "attendance"}); this.tabs.load(); this.taskDonePage = this.tabs.addTab(this.taskDoneArea, this.lp.taskDone, false); this.taskDonePage.addEvent("show",function(){ if(!this.initTaskDone) this.loadTaskDone(); }.bind(this)); this.readPage = this.tabs.addTab(this.readArea, this.lp.read, false); this.readPage.addEvent("show",function(){ if(!this.initRead) this.loadRead(); }.bind(this)); this.readDonePage = this.tabs.addTab(this.readDoneArea, this.lp.readDone, false); this.readDonePage.addEvent("show",function(){ if(!this.initReadDone) this.loadReadDone(); }.bind(this)); this.recordPage = this.tabs.addTab(this.recordArea, this.lp.workLog, false); this.recordPage.addEvent("show",function(){ if(!this.initRecord) this.loadRecord(); }.bind(this)); this.reviewPage = this.tabs.addTab(this.reviewArea, this.lp.review, false); this.reviewPage.addEvent("show",function(){ if(!this.initReview) this.loadReview(); }.bind(this)); this.attachementPage = this.tabs.addTab(this.attachementArea, this.lp.attachment, false); this.attachementPage.addEvent("show",function(){ if(!this.initAttachement) this.loadAttachement(); }.bind(this)); this.businessDataPage = this.tabs.addTab(this.businessDataArea, this.lp.businessData, false); this.businessDataPage.addEvent("show",function(){ if(!this.initBusinessData) this.loadBusinessData(); }.bind(this)); this.dataRecordPage = this.tabs.addTab(this.dataRecordArea,this.lp.dataRecord, false); this.dataRecordPage.addEvent("show",function(){ if(!this.initDataRecord) this.loadDataRecord(); }.bind(this)); this.tabs.pages[0].showTab(); }.bind(this)); } });