dojo

dojo.provide("com.suning.ipd.rtcex.web.ui.page.DailyRelease");
dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require("dijit.form.DateTextBox");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.FilteringSelect");
dojo.require("com.ibm.team.repository.web.transport.ServiceResponseHandler");
dojo.require("dijit.form.ValidationTextBox");
dojo.require("dijit.form.ComboBox");
dojo.require("dijit.form.FilteringSelect");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dojox.grid.DataGrid");
dojo.require("dijit.form.Textarea");
dojo.require("dojo.parser");
dojo.require("com.suning.ipd.rtcex.web.ui.page.common.CreateWidget");
dojo.require("com.suning.ipd.rtcex.web.ui.page.projectpublish.PickupSysPubDialog");
dojo.require("com.suning.ipd.rtcex.web.ui.page.projectpublish.PickupUserDialog");


(function(){
var pub=null;
_URL = net.jazz.ajax.BootstrapProperties.FRONTSIDE_URL+"/service/com.suning.ipd.rtcex.service.ws.IRawMessageService/";
_ACTION = "dailyrelease.";
var PickupUserDialog=com.suning.ipd.rtcex.web.ui.page.projectpublish.PickupUserDialog;
var PlatformUI = net.jazz.ajax.ui.PlatformUI;
dojo.declare("com.suning.ipd.rtcex.web.ui.page.DailyRelease", [dijit._Widget, dijit._Templated], {
templatePath: dojo.moduleUrl("com.suning.ipd.rtcex.web", "ui/templates/DailyRelease.html"),
msgRequest:{"workflowargs":{},"bizfieldvalue":{"baseInfo":{},"resourceList":{}}},
msgResponse:{"workflowargs":{},"bizfieldvalue":{"baseInfo":{},"resourceList":{}}},
requestMessage:{"workflowargs":{},"bizfieldvalue":{"baseInfo":{}}},
//首先要执行的方法
postCreate: function(){
var ActionRegistry = PlatformUI.getWorkbench().getActionRegistry();
ActionRegistry.registerAction("com.suning.ipd.rtcex.web.dailyrelease.open", this, "_init");
},
_handleSaveClick: function(){

this.setHeaderMessage('保存成功!');
},

_handleHeaderMessageClick: function(e) {

},

clearValidationMessage: function() {
dojox.xml.parser.removeChildren(this.validationMessage);
this.validationMessageSpan.className= "validationMessageEmpty";
},

setHeaderMessage: function(messageText) {
this.clearValidationMessage();
this.validationMessageSpan.className= "validationMessageError";
dojox.xml.parser.removeChildren(this.validationMessage);
var messagesSpan= document.createElement("SPAN");

var div= document.createElement("DIV");
div.appendChild(document.createTextNode(messageText));
messagesSpan.appendChild(div);

this.validationMessage.appendChild(messagesSpan);
window.scrollTo(0,0); // show message
},

//显示页面
_init: function(args){

this.msgRequest.workflowargs = dojo.fromJson(decodeURIComponent(args.wfParams));
console.dir({"this.workflowargs":this.workflowargs});
console.dir({"this.msgRequest":this.msgRequest});
this.getInitData();
},
//从后台获取数据来初始化出面数据
getInitData: function(){
//从后台获取数据来初始化出面数据
var parent = this;
jazz.client.xhrGet({
url: _URL,
content: {
action: "dailyrelease.DailyReleaseInitAction", method: "Action", handleAs: "json", timeout: 50000,
args: dojo.toJson(this.msgRequest)
},

load:function(result) {


console.dir({result:dojo.fromJson(result)});


parent.msgResponse = dojo.fromJson(result);
parent.msgRequest.workflowargs = parent.msgResponse.workflowargs;
parent.msgRequest.bizfieldvalue = parent.msgResponse.bizfieldvalue;
console.dir({"parent.msgResponse":parent.msgResponse});
console.dir({"parent.msgRequest":parent.msgRequest});
//初始化页面
parent._initPage();
},
error:function(errorObj) {
return errorObj; // for other handlers in the chain
}
});
},

_initPage: function(args){
var step = window.workflow.workflowParams.get("currentStep")+"";
var bc = window.workflow.workflowParams.get("businessCode")+"";
var cidw = new CreateWidget();

//提交按钮
this._addBtn = cidw.createButton(this,this._addBtn,'提交',this.onSubmit);
//保存按钮
this._saveBtn = cidw.createButton(this,this._saveBtn,'保存',this.onSave)
alert(this.msgRequest.workflowargs.currentStep+'HHHHHHHHHHHHHHHHHH');
if(this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep=="S60"||this.msgRequest.workflowargs.currentStep=="S50"||this.msgRequest.workflowargs.currentStep==""||this.msgRequest.workflowargs.currentStep=="S10"){
this._saveBtn.set('disabled',false);
}else{
this._saveBtn.set('disabled',true);
}

//日常发布编号
var BILL_ID= new dijit.form.ValidationTextBox({name:"BILL_ID",id:"BILL_ID"});
this.BILL_ID.appendChild(BILL_ID.domNode);
this.BILL_ID=BILL_ID;
this.BILL_ID.setValue(bc);
BILL_ID.set('disabled',true);
//申请人
var APPLICANT = new dijit.form.ValidationTextBox({name:"APPLICANT",id:"APPLICANT"});
this.APPLICANT.appendChild(APPLICANT.domNode);
this.APPLICANT= APPLICANT;
APPLICANT.set('disabled',true);

//申请时间
var APPLY_TIME = new dijit.form.DateTextBox({name:"APPLY_TIME",id:"APPLY_TIME",value: new Date()});
this.APPLY_TIME.appendChild(APPLY_TIME.domNode);
this.APPLY_TIME=APPLY_TIME;
APPLY_TIME.set('disabled',true);

//发布级别
var PUB_LEVEL = {
identifier:"hrFrom",
label: "id",
items:[
{hrFrom:"in", id:"一般"},
{hrFrom:"out", id:"紧急"}
]
};
var _sourceFromStore = new dojo.data.ItemFileReadStore({data: PUB_LEVEL});
var filterSourceFrom = new dijit.form.ComboBox({
name: "PUB_LEVEL",id:"PUB_LEVEL",
value:"一般",
store: _sourceFromStore,
searchAttr: "id"
},this.PUB_LEVEL);
this.PUB_LEVEL= filterSourceFrom;

if(this.msgRequest.workflowargs.currentStep=="S10"||this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep==""){
filterSourceFrom.set('disabled',false);
}else{
filterSourceFrom.set('disabled',true);
}
//申请部门
var APPLY_DEPT = new dijit.form.ValidationTextBox({name:"APPLY_DEPT",id:"APPLY_DEPT"});
this.APPLY_DEPT.appendChild(APPLY_DEPT.domNode);
this.APPLY_DEPT = APPLY_DEPT;
APPLY_DEPT.set('disabled',true);

//申请组
var APPLY_GROUP = new dijit.form.ValidationTextBox({name:"APPLY_GROUP",id:"APPLY_GROUP"});
this.APPLY_GROUP.appendChild(APPLY_GROUP.domNode);
this.APPLY_GROUP =APPLY_GROUP;
APPLY_GROUP.set('disabled',true);

//涉及系统
var REFER_SYSTEM = new dijit.form.ValidationTextBox({name:"REFER_SYSTEM",id:"REFER_SYSTEM"});
this.REFER_SYSTEM.appendChild(REFER_SYSTEM.domNode);
this.REFER_SYSTEM =REFER_SYSTEM;

var pickupUserBtn = new dijit.form.Button({label: "选择用户"});
this._usersConntiner2.appendChild(pickupUserBtn.domNode);
dojo.connect(pickupUserBtn, "onClick", this, "_handlePickupSystem");

if(this.msgRequest.workflowargs.currentStep=="S10"||this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep==""){
REFER_SYSTEM.set('disabled',false);
pickupUserBtn.set('disabled',false)
}else{
REFER_SYSTEM.set('disabled',true);
pickupUserBtn.set('disabled',true);
}

//请求号
var REQUEST_NO = new dijit.form.ValidationTextBox({name:"REQUEST_NO",id:"REQUEST_NO"});
this.REQUEST_NO.appendChild(REQUEST_NO.domNode);
this.REQUEST_NO = REQUEST_NO;

if(this.msgRequest.workflowargs.currentStep=="S10"||this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep==""){
REQUEST_NO.set('disabled',false);
}else{
REQUEST_NO.set('disabled',true);
}
//请求释放
var REQUEST_RELEASE = new dijit.form.ValidationTextBox({name:"REQUEST_RELEASE",id:"REQUEST_RELEASE"});
this.REQUEST_RELEASE.appendChild(REQUEST_RELEASE.domNode);
this.REQUEST_RELEASE =REQUEST_RELEASE;

if(this.msgRequest.workflowargs.currentStep=="S10"||this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep==""){
REQUEST_RELEASE.set('disabled',false);
}else{
REQUEST_RELEASE.set('disabled',true);
}
//计划发布时间
var PLAN_PUB_TIME = new dijit.form.DateTextBox({name:"PLAN_PUB_TIME",id:"PLAN_PUB_TIME",value: new Date()});
this.PLAN_PUB_TIME.appendChild(PLAN_PUB_TIME.domNode);
this.PLAN_PUB_TIME =PLAN_PUB_TIME;

if(this.msgRequest.workflowargs.currentStep=="S10"||this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep==""){
PLAN_PUB_TIME.set('disabled',false);
}else{
PLAN_PUB_TIME.set('disabled',true);
}
//请求描述
var REQUEST_DESC = new dijit.form.Textarea({
name: "REQUEST_DESC",id:"REQUEST_DESC",
value: "",
style: "width:100%;min-height:6em"
},this.REQUEST_DESC);
this.REQUEST_DESC =REQUEST_DESC;

if(this.msgRequest.workflowargs.currentStep=="S10"||this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep==""){
REQUEST_DESC.set('disabled',false);
}else{
REQUEST_DESC.set('disabled',true);
}
//发布要求
var PUB_REQUIRE= new dijit.form.Textarea({
name: "PUB_REQUIRE",id: "PUB_REQUIRE",
value: "",
style: "width:100%;min-height:6em"
},this.PUB_REQUIRE);
this.PUB_REQUIRE=PUB_REQUIRE;
if(this.msgRequest.workflowargs.currentStep=="S10"||this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep==""){
PUB_REQUIRE.set('disabled',false);
}else{
PUB_REQUIRE.set('disabled',true);
}
//实际开始时间
var REAL_START_DATE = new dijit.form.DateTextBox({name:"REAL_START_DATE",id:"REAL_START_DATE",value: new Date()});
this.REAL_START_DATE.appendChild(REAL_START_DATE.domNode);
this.REAL_START_DATE =REAL_START_DATE;
if(this.msgRequest.workflowargs.currentStep=="S50"){
REAL_START_DATE.set('disabled',false);
}else{
REAL_START_DATE.set('disabled',true);
}
//实际结束时间
var REAL_END_DATE = new dijit.form.DateTextBox({name:"REAL_END_DATE",id:"REAL_END_DATE",value: new Date()});
this.REAL_END_DATE.appendChild(REAL_END_DATE.domNode);
this.REAL_END_DATE =REAL_END_DATE;
if(this.msgRequest.workflowargs.currentStep=="S50"){
REAL_END_DATE.set('disabled',false);
}else{
REAL_END_DATE.set('disabled',true);
}

//是否发布成功
var IS_FINISHED ={
identifier:"hrFrom",
label: "id",
items:[
{hrFrom:"in", id:"否"},
{hrFrom:"out", id:"是"}
]
};
var _sourceFromStore = new dojo.data.ItemFileReadStore({data: IS_FINISHED});
var filterSourceFrom = new dijit.form.ComboBox({
name: "IS_FINISHED",id:"IS_FINISHED",
value:"是",
store: _sourceFromStore,
searchAttr: "id"
},this.IS_FINISHED);
this.IS_FINISHED = filterSourceFrom;
if(this.msgRequest.workflowargs.currentStep=="S50"){
filterSourceFrom.set('disabled',false);
}else{
filterSourceFrom.set('disabled',true);
}
//实施情况说明
var IMPL_DESC= new dijit.form.Textarea({
name: "IMPL_DESC",id:"IMPL_DESC",
value: "",
style: "width:200%;min-height:6em"
},this.IMPL_DESC);
this.IMPL_DESC=IMPL_DESC;
if(this.msgRequest.workflowargs.currentStep=="S50"){
IMPL_DESC.set('disabled',false);
}else{
IMPL_DESC.set('disabled',true);
}

// 验证时间
var PUB_CHECK_TIME=new dijit.form.DateTextBox({name:"PUB_CHECK_TIME",id:"PUB_CHECK_TIME",value: new Date()});
this.PUB_CHECK_TIME.appendChild(PUB_CHECK_TIME.domNode);
this.PUB_CHECK_TIME =PUB_CHECK_TIME;
if(this.msgRequest.workflowargs.currentStep=="S60"){
PUB_CHECK_TIME.set('disabled',false);
}else{
PUB_CHECK_TIME.set('disabled',true);
}

// 是否通过
var IS_PASSED = {
identifier:"hrFrom",
label: "id",
items:[
{hrFrom:"in", id:"否"},
{hrFrom:"out", id:"是"}
]

};
var _sourceFromStore = new dojo.data.ItemFileReadStore({data:IS_PASSED});
var filterSourceFrom = new dijit.form.ComboBox({
name: "IS_PASSED",id:"IS_PASSED",
value:"是",
store: _sourceFromStore,
searchAttr: "id"
},this.IS_PASSED);
var xiao=this.msgRequest.workflowargs.currentStep;
this.connect(filterSourceFrom,'onChange',function(newValue){
if(newValue == '是'){
this.ACCIDENT_HOLDER.set('disabled',true);
this.CHECK_CONTENT.set('disabled',true);
this.PUB_FAIL_REASON.set('disabled',true);
this.PUB_FAIL_EFFECT.set('disabled',true);
this.SOLUTION.set('disabled',true);

}else if(newValue == '否'){
this.ACCIDENT_HOLDER.set('disabled',false);
this.CHECK_CONTENT.set('disabled',false);
this.PUB_FAIL_REASON.set('disabled',false);
this.PUB_FAIL_EFFECT.set('disabled',false);
this.SOLUTION.set('disabled',false);
}
});
this.IS_PASSED = filterSourceFrom;
if(this.msgRequest.workflowargs.currentStep=="S60"){
filterSourceFrom.set('disabled',false);
}else{
filterSourceFrom.set('disabled',true);
}

//事故责任人
var ACCIDENT_HOLDER=new dijit.form.ValidationTextBox({name:"ACCIDENT_HOLDER",id:"ACCIDENT_HOLDER"});
this.ACCIDENT_HOLDER.appendChild(ACCIDENT_HOLDER.domNode);
this.ACCIDENT_HOLDER =ACCIDENT_HOLDER;
if(this.msgRequest.workflowargs.currentStep=="S60"){
ACCIDENT_HOLDER.set('disabled',false);
}else{
ACCIDENT_HOLDER.set('disabled',true);
}

// 验证内容_check
var CHECK_CONTENT=new dijit.form.Textarea({
name: "CHECK_CONTENT",id:"CHECK_CONTENT",
value: "",
style: "width:100%;min-height:6em"
},this.CHECK_CONTENT);
this.CHECK_CONTENT=CHECK_CONTENT;
if(this.msgRequest.workflowargs.currentStep=="S60"){
CHECK_CONTENT.set('disabled',false);
}else{
CHECK_CONTENT.set('disabled',true);
}

// 发布失败原因
var PUB_FAIL_REASON= new dijit.form.Textarea({
name: "PUB_FAIL_REASON",id:"PUB_FAIL_REASON",
value: "",
style: "width:100%;min-height:6em"
},this.PUB_FAIL_REASON);

this.PUB_FAIL_REASON=PUB_FAIL_REASON;
if(this.msgRequest.workflowargs.currentStep=="S60"){
PUB_FAIL_REASON.set('disabled',false);
}else{
PUB_FAIL_REASON.set('disabled',true);
}

//发布失败影响
var PUB_FAIL_EFFECT= new dijit.form.Textarea({
name: "PUB_FAIL_EFFECT",id:"PUB_FAIL_EFFECT",
value: "",
style: "width:100%;min-height:6em"
},this.PUB_FAIL_EFFECT);

this.PUB_FAIL_EFFECT=PUB_FAIL_EFFECT;

if(this.msgRequest.workflowargs.currentStep=="S60"){
PUB_FAIL_EFFECT.set('disabled',false);
}else{
PUB_FAIL_EFFECT.set('disabled',true);
}

//解决方案
var SOLUTION= new dijit.form.Textarea({
name: "SOLUTION",id:"SOLUTION",
value: "",
style: "width:100%;min-height:6em"
},this.SOLUTION);

this.SOLUTION=SOLUTION;

if(this.msgRequest.workflowargs.currentStep=="S60"){
SOLUTION.set('disabled',false);
}else{
SOLUTION.set('disabled',true);
}

//主数据优化部负责人
var DEPT_MGR=new dijit.form.ValidationTextBox({name:"DEPT_MGR",id:"DEPT_MGR"});
this.DEPT_MGR.appendChild(DEPT_MGR.domNode);
this.DEPT_MGR =DEPT_MGR;

if(this.msgRequest.workflowargs.currentStep=="S20"){
DEPT_MGR.set('disabled',false);
}else{
DEPT_MGR.set('disabled',true);
}
//发布管理专员
var PUB_ADMIN=new dijit.form.ValidationTextBox({name:"PUB_ADMIN",id:"PUB_ADMIN"});
this.PUB_ADMIN.appendChild(PUB_ADMIN.domNode);
this.PUB_ADMIN =PUB_ADMIN;

if(this.msgRequest.workflowargs.currentStep=="S30"){
PUB_ADMIN.set('disabled',false);
}else{
PUB_ADMIN.set('disabled',true);
}

//运维管理中心负责人
var MAINTAIN_MGR=new dijit.form.ValidationTextBox({name:"MAINTAIN_MGR",id:"MAINTAIN_MGR"});
this.MAINTAIN_MGR.appendChild(MAINTAIN_MGR.domNode);
this.MAINTAIN_MGR =MAINTAIN_MGR;
//_usersConntinerwm
var _usersConnt = new dijit.form.Button({label: "选择用户"});
this._usersConntinerwm.appendChild(_usersConnt.domNode);
dojo.connect(_usersConnt, "onClick", this, "_handlePickupBtnClicked");
if(this.msgRequest.workflowargs.currentStep=="S30"&&this.msgResponse.bizfieldvalue.baseInfo['PUB_LEVEL']=="紧急"){
MAINTAIN_MGR.set('disabled',false);
_usersConnt.set('disabled',false);
}else{
MAINTAIN_MGR.set('disabled',true);
_usersConnt.set('disabled',true);
}
//系统发布专员
var SYS_PUBLISHER=new dijit.form.ValidationTextBox({name:"SYS_PUBLISHER",id:"SYS_PUBLISHER"});
this.SYS_PUBLISHER.appendChild(SYS_PUBLISHER.domNode);
this.SYS_PUBLISHER =SYS_PUBLISHER;

var pickupUserBtm = new dijit.form.Button({label: "选择用户"});
this._usersConntiner3.appendChild(pickupUserBtm.domNode);
dojo.connect(pickupUserBtm, "onClick", this, "_handlePickupUserBtnClicked");
if((this.msgRequest.workflowargs.currentStep=="S30"&&this.msgResponse.bizfieldvalue.baseInfo['PUB_LEVEL']=="一般")||this.msgRequest.workflowargs.currentStep=="S40"){
SYS_PUBLISHER.set('disabled',false);
pickupUserBtm.set('disabled',false);
}else{
SYS_PUBLISHER.set('disabled',true);
pickupUserBtm.set('disabled',true);
}

// 审批结果
var WANG_XIE = {
identifier:"hrFrom",
label: "id",
items:[
{hrFrom:"in", id:"同意"},
{hrFrom:"out", id:"不同意"}
]
};
var _sourceMainSystem = new dojo.data.ItemFileReadStore({data:WANG_XIE});
var filterSourceSystem = new dijit.form.ComboBox({
name: "WANG_XIE",id:"WANG_XIE",
value:"同意",
store: _sourceMainSystem,
searchAttr: "id"
},this.WANG_XIE);
this.WANG_XIE = filterSourceSystem;
if(this.msgRequest.workflowargs.currentStep=="S10"||this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep==""){
filterSourceSystem.set('disabled',true);
}else{
filterSourceSystem.set('disabled',false);
}


//审批历史
var WANG_XIEPP=new dijit.form.ValidationTextBox({name:"WANG_XIEPP",id:"WANG_XIEPP"});
this.WANG_XIEPP.appendChild(WANG_XIEPP.domNode);
this.WANG_XIEPP =WANG_XIEPP;
if(this.msgRequest.workflowargs.currentStep=="S10"||this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep==""){
WANG_XIEPP.set('disabled',true);
}else{
WANG_XIEPP.set('disabled',false);
}
//初始化参数
this._titleTextSpan.innerHTML = "日常发布<" + this.msgResponse.bizfieldvalue.baseInfo.BILL_ID + ">";
this._summary.value = "关于XX的日常发布";
this.setFormData();
},

//回填数据 通过id和name组成map对象 PUB_LEVEL
setFormData:function(){
for(var key in this.msgResponse.bizfieldvalue.baseInfo){

if(key == 'PUB_LEVEL'){

var pub=this.msgResponse.bizfieldvalue.baseInfo[key];
}



var value = this.msgResponse.bizfieldvalue.baseInfo[key];
var control = dijit.byId(key);
if(control && value) {
var dojoType = control.declaredClass;
if(dojoType=="dijit.form.DateTextBox") {
control.set('value', new Date(value));
} else {
control.set('value', value);
}
}
}
},


//根据Form数据设置Store
getFormData:function(){
//将响应消息中的部分数据复制到请求消息中
this.msgRequest.bizfieldvalue.baseInfo = this.msgResponse.bizfieldvalue.baseInfo;
for(var key in this.msgResponse.bizfieldvalue.baseInfo){
var control = dojo.byId(key);
if(control && control.value) {
var value = control.value;
this.msgRequest.bizfieldvalue.baseInfo[key] = value;
}
}
},

//提交方法
onSubmit: function(){
this.msgRequest.workflowargs.save = "false";

//设置业务相关的参数,供分支选择使用
this.msgRequest.workflowargs.varPassed = "true";

this.pushPage();
},

//保存方法
onSave: function(){
this.msgRequest.workflowargs.save = "true";

//设置业务相关的参数,供分支选择使用
this.msgRequest.workflowargs.varPassed = "true";

this.pushPage();
},

pushPage: function(){
this.getFormData();
console.dir({"tadaye":this.msgRequest});
/**
* 根据流程节点确定Action
*/
var save = this.msgRequest.workflowargs.save;
var action;
//如果是首次申请页面 保存
if(this.msgRequest.workflowargs.currentStep==""){
action = "DailyReleaseApplySaveAction";
}
// 草稿修改和被驳回需要修改
if(this.msgRequest.workflowargs.currentStep=="S11"||this.msgRequest.workflowargs.currentStep=="S10"){
action = "DailyReleaseApplyUpDateAction";
}
//主数据优化部负责人S20
if(this.msgRequest.workflowargs.currentStep=="S20"){
this.msgRequest.workflowargs["varXIEPANPAN"] = this.WANG_XIE.value;
action = "DailyReleaseApplyUpDateAction";
}
//发布管理专员 S30
if(this.msgRequest.workflowargs.currentStep=="S30"){
this.msgRequest.workflowargs["varSYS_PUBLISHER"] = this.SYS_PUBLISHER.value;
this.msgRequest.workflowargs["varPUB_LEVEL"]=this.PUB_LEVEL.value;
this.msgRequest.workflowargs["varXIEPANPAN"]=this.WANG_XIE.value;
action="DailyReleaseApplyUpDateAction";
}
//运维管理中心S40
if(this.msgRequest.workflowargs.currentStep=="S40"){
this.msgRequest.workflowargs["varSYS_PUBLISHER"] = this.SYS_PUBLISHER.value;
this.msgRequest.workflowargs["varXIEPANPAN"]=this.WANG_XIE.value;
action="DailyReleaseApplyUpDateAction";
}
//系统发布专员S50
if(this.msgRequest.workflowargs.currentStep=="S50"){
this.msgRequest.workflowargs["varXIEPANPAN"]=this.WANG_XIE.value;
action="DailyReleaseApplyUpDateAction";
}
//发布验证
if(this.msgRequest.workflowargs.currentStep=="S60"){
action="DailyReleaseApplyUpDateAction";
}

console.dir({xxxx:this.msgRequest});
var self = this;
jazz.client.xhrGet({
url: _URL,
content:{
action: _ACTION+action, method: "Action", handleAs: "json", timeout: 50000000,
args: dojo.toJson(this.msgRequest)
},
load:function(result) {
var json = dojo.fromJson(result);
if(json && json.id && json.id==200) {
self.setHeaderMessage('操作成功!');
} else {
self.setHeaderMessage("操作失败!");
}
// console.dir({"parent.msgRequest":parent.msgRequest});
self.msgResponse.bizfieldvalue = dojo.clone(self.msgRequest.bizfieldvalue);
self._saveBtn.setDisabled(true);
self._addBtn.setDisabled(true);

return result; // for other handlers in the chain
},
error:function(errorObj) {
return errorObj; // for other handlers in the chain
}
});
},

_handlePickupSystem:function(){
var dialog = new PickupUserDialog();
this._dialogs.push(dialog);
this.connect(dialog,"onOk","performPickupsystem");
},


performPickupsystem: function (users) {
if (users != null && users.length > 0) {
var userids='';

for (var i=0; i < users.length-1; i++) {
if (users[i].userId != null) {
if (users.length >1)
userids = userids+users[i].userId+',';
}
}
userids = userids+ users[users.length-1].userId;

this.REFER_SYSTEM.set("value",userids);
}
},
_handlePickupBtnClicked:function(){
var dialog = new PickupUserDialog();
//this._dialogs.push(dialog);
this.connect(dialog,"onOk","performPick");
},

performPick: function (users) {
if (users != null && users.length > 0) {
var userids='';

for (var i=0; i < users.length-1; i++) {
if (users[i].userId != null) {
if (users.length >1)
userids = userids+users[i].userId+',';
}
}
userids = userids+ users[users.length-1].userId;
this.MAINTAIN_MGR.set("value",userids);
}
},


_handlePickupUserBtnClicked:function(){
var dialog = new PickupUserDialog();
//this._dialogs.push(dialog);
this.connect(dialog,"onOk","performPickup");
},

performPickup: function (users) {
if (users != null && users.length > 0) {
var userids='';

for (var i=0; i < users.length-1; i++) {
if (users[i].userId != null) {
if (users.length >1)
userids = userids+users[i].userId+',';
}
}
userids = userids+ users[users.length-1].userId;
this.SYS_PUBLISHER.set("value",userids);
}
},
});
})();



html
<div class="com-ibm-ipd-content">
<div class="headpanel">
<div class="editorHeader">
<div class="firstRow">
<span class="CommandArea" style="float: right; padding-left:10px;">
<div class="Button" dojoattachpoint="_saveBtn" ></div>
</span>
<span style="float:left; padding-right:10px">
<img dojoAttachPoint="typeIcon" class="typeIcon" src="web/com.suning.ipd.rtcex.web/ui/graphics/template/capability.gif"></img>
<span class="typeText" dojoAttachPoint="_titleTextSpan">日常发布</span>
</span>
<div class="validationMessage" dojoAttachPoint="validationMessageSpan">
<a dojoAttachPoint="validationMessage" class="validationMessageAnchor" dojoAttachEvent="onclick: _handleHeaderMessageClick" href="#"></a>
</div>
<table style="float: right; padding-left:10px;">
<tr>
<td>
<div class="Button" dojoattachpoint="_addBtn" ></div>
</td>
<td>
<div class="Button" dojoattachpoint="_saveBtn" ></div>
</td>
</tr>

</table>
</div>
<div class="summaryRow">
<div class="summaryLabel">摘要:</div>
<div class = "nameInputContainer">
<input class="nameInput" dojoAttachPoint="_summary"/>
</div>
</div>
</div>
</div>

<div>

<div class="bodypanel" dojoAttachPoint="_resultsColumn">
<div class="Section">
<div class="sectionTitle">
【基本信息】
</div>
<div class="sectionContent">

<table class="actionTable" >
<tr class="TR">
<td class="QuarterLabelColumn">
日常发布编号
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="BILL_ID" class="QuarterField"/>
</td>

<td class="QuarterLabelColumn">
申请人
</td>

<td class="QuarterColumn">
<div dojoAttachpoint="APPLICANT" class="QuarterField"/>
</td>
<td class="QuarterLabelColumn">
申请时间
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="APPLY_TIME" class="QuarterField"/>
<td class="QuarterLabelColumn">
发布级别
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="PUB_LEVEL" class="QuarterField"/>
</td>

</tr>
<tr class="TR">
<td class="QuarterLabelColumn">
申请部门
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="APPLY_DEPT" class="QuarterField"/>
</td>

<td class="QuarterLabelColumn">
申请组
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="APPLY_GROUP" class="QuarterField"/>
</td>

<td class="QuarterLabelColumn">
计划发布时间
</td>

<td class="QuarterColumn">
<div dojoAttachpoint="PLAN_PUB_TIME" class="QuarterField"/>
</td>

<td class="QuarterLabelColumn">
请求号
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="REQUEST_NO" class="QuarterField"/>
</td>
</tr>

<tr class="TR">
<td class="QuarterLabelColumn">
请求释放
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="REQUEST_RELEASE" class="QuarterField"/>
</td>

<td class="QuarterLabelColumn">
涉及系统
</td>
<td class="QuarterColumn">
<div dojoattachpoint="REFER_SYSTEM" class="QuarterField"/>
</td>

<td class="QuarterLabelColumn"></td>

<td class="QuarterColumn">
<div dojoattachpoint="_usersConntiner2" />
</td>
</tr>

<tr class="TR">

<td >

请求描述
</td>

<td colspan="3">
<div dojoAttachpoint="REQUEST_DESC" />
</td>

<td colspan="0" >
发布要求
</td>

<td colspan="3">
<div dojoAttachpoint="PUB_REQUIRE" />
</td>
</tr>

<tr>
</tr>
</table>
</div>
</div>
<div class="Section" >

<div class="bodypanel" dojoAttachPoint="_resultsColumn">
<div class="sectionTitle">
【发布实施】
</div>


<div class="sectionContent">
<table class="actionTable" >
<tr >
<td class="QuarterLabelColumn">
实际开始时间
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="REAL_START_DATE" class="QuarterField"/>
</td>
<td class="QuarterLabelColumn">
实际结束时间
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="REAL_END_DATE" class="QuarterField"/>
</td>
<td class="QuarterLabelColumn">
是否发布成功
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="IS_FINISHED" class="QuarterField"/>
</td>
</tr>
<tr class="TR">
<td class="QuarterLabelColumn"> 实施情况说明 </td>

<td class="QuarterColumn" colspan="2">
<div dojoAttachpoint="IMPL_DESC" />
</td>
</tr>

</table>
</div>
</div>


<div class="bodypanel" dojoAttachPoint="_resultsColumn">
<div class="sectionTitle">
【发布验证】
</div>

<div class="sectionContent">
<table class="actionTable">

<tr>
<td class="QuarterLabelColumn">
验证时间
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="PUB_CHECK_TIME"/>
</td>

<td class="QuarterLabelColumn">
是否通过
</td>

<td class="QuarterColumn">
<div dojoAttachpoint="IS_PASSED"/>
</td>
<td class="QuarterLabelColumn">
事故责任人
</td>
<td class="QuarterColumn">
<div dojoAttachpoint="ACCIDENT_HOLDER" />
</td>

<td> </td>
</tr>
<tr class="TR">

</tr>
<tr class="TR">
<td class="QuarterColumn" colspan="3">
验证内容
</td>

<td class="QuarterColumn" colspan="3">
发布失败原因
</td>

</tr>

<tr>
<td colspan="3">
<div dojoAttachpoint="CHECK_CONTENT" />
</td>

<td class="Column" colspan="3" wedding=2>
<div dojoAttachpoint="PUB_FAIL_REASON"/>
</td>
</tr>
<tr class="TR">
<td class="QuarterColumn" colspan="3">
发布失败影响
</td>

<td class="QuarterColumn" colspan="3">
解决方案
</td>
</tr>
<tr>
<td class="Column" colspan="3" wedding=2>
<div dojoAttachpoint="PUB_FAIL_EFFECT" style="width:98%" />
</td>

<td class="Column" colspan="3" wedding=2>
<div dojoAttachpoint="SOLUTION" style="width:98%" />
</td>
</tr>

</table>
</div>
</div>


<div class="bodypanel" dojoAttachPoint="_resultsColumn" >

<div class="sectionTitle" >
【审批人员】
</div>
<div class="sectionContent">
<table class="actionTable" >

<tr class="TR">
<td class="QuarterLabelColumn">
*主数据优化部负责人
</td>
<td class="Column" >
<div dojoAttachpoint="DEPT_MGR" class="QuarterColumn"/>
</td>

<td class="QuarterLabelColumn"></td>

<td class="QuarterColumn">
<div dojoattachpoint="_usersConntinerx" />
</td>


</tr>
<tr class="TR" >
<td class="QuarterLabelColumn">

*发布管理专员
</td>
<td class="Column" >
<div dojoAttachpoint="PUB_ADMIN" class="QuarterColumn"/>
</td>

<td class="QuarterLabelColumn"></td>
<td class="QuarterColumn">
<div dojoattachpoint="_usersConntinerp" />
</td>

</tr>
<tr class="TR" >
<td class="QuarterLabelColumn">
*运维管理中心负责人
</td>
<td class="Column" >
<div dojoAttachpoint="MAINTAIN_MGR" class="QuarterColumn"/>
</td>

<td class="QuarterLabelColumn"></td>
<td class="QuarterColumn">
<div dojoattachpoint="_usersConntinerwm" />
</td>
<td></td>

</tr>
<tr class="TR">
<td class="QuarterLabelColumn">
*系统发布专员
</td>
<td class="Column">
<div dojoAttachpoint="SYS_PUBLISHER" class="QuarterColumn"/>
</td>

<td class="QuarterLabelColumn"></td>

<td class="QuarterColumn">
<div dojoattachpoint="_usersConntiner3" />
</td>
</tr>

<tr>

<td class="QuarterLabelColumn">
审批结果
</td>
<td class="QuarterLabelColumn">
<div dojoAttachpoint="WANG_XIE" style="width:98%" class="QuarterColumn"/>
</td>

</tr>

<tr>

<td class="QuarterLabelColumn">审批意见 </td>
<td class="QuarterLabelColumn">
<div dojoAttachpoint="WANG_XIEPP" style="width:98%" class="QuarterColumn"/>
</td>

</tr>

</table>
</div>
</div>
</div>
</div>

js :

dojo.provide("com.suning.ipd.rtcex.web.ui.page.projectpublish.PickupUserDialog");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require("dojox.xml.parser");
dojo.require("dojo.i18n");

dojo.require("jazz.ui.Dialog");


(function(){
var _URL = net.jazz.ajax.BootstrapProperties.FRONTSIDE_URL+"/service/com.suning.ipd.rtcex.service.ws.IRawMessageService/";


function addOption(selectList, option){
if (dojo.isIE) {
var newOption = new Option(option.text, option.value);
newOption.EMPLOYEEID = option.EMPLOYEEID;
var newIndex = selectList.options.length;
selectList[newIndex] = newOption;
}
else {
option.selected = false;
var inserted = false;
for (i = 0; i < selectList.options.length; i++) {
if (selectList.options[i].text > option.text) {
selectList.insertBefore(option, selectList.options[i]);
inserted = true;
break;
}
}
if (!inserted) {
selectList.appendChild(option);
}
}
}

function removeOption(selectList, option){
if (dojo.isIE) {
var index = selectList.options.length;
for (var i = 0; i < selectList.options.length; i++) {
if (selectList.options[i] === option) {
index = i;
break;
}
}
selectList.remove(index);
}
else {
try {
selectList.removeChild(option);
}
catch (err) {
// don't throw an error if the option wasn't in the list to begin with
}
}
}

dojo.declare("com.suning.ipd.rtcex.web.ui.page.projectpublish.PickupUserDialog", [dijit._Widget, dijit._Templated], {
templatePath: dojo.moduleUrl("com.suning.ipd.rtcex.web", "ui/page/projectpublish/templates/PickupUserDialog.html"),

constructor: function(args){
if (args == null) {
args = {};
}
this.width = args.width || "450px";
var properties = {
"width": "450px",
"removeUsersOnAdd": true,
"searchLimit": 50
};
this.selectedUsersList = [];
},

postCreate: function(){
this.userSelector.size = 12;
this.userSelector.multiple = true;
this.selectedUsers.size = 6;
this.selectedUsers.multiple = true;
this.dialog = new jazz.ui.Dialog({
contentNode: this.contentNode,
primaryTitle: '选择用户对话框',
width: this.width,
closable: this.closable
});

this.connect(this.searchButton, "onclick", "_runSearch");
this.connect(this.selectButton, "onclick", "_runSelect");
this.connect(this.deselectButton, "onclick", "_runDeselect");
this.connect(this.cancelButton, "onclick", function(e){
dojo.stopEvent(e);
this.dialog.close();
});
this.connect(this.okButton, "onclick", "_onOk");
this.connect(this.userSelector, "ondblclick", "_runSelect");
this.connect(this.userSelector, "onchange", "_handleSelectorChange");
this.connect(this.selectedUsers, "onchange", "_handleSelectedChange");
this.connect(this.dialog, "onClose", "onClose");
this.searchText.focus();
},

_runSearch: function(e, query){
if (e != null) {
dojo.stopEvent(e);
}
if (this.searchText.value != "") {

var args1 = {
searchText: query == null ? this.searchText.value : query,
};
this.lastQueryTerm = args1.searchText;
this._setStatusMessage('正在查询...');
var self = this;
jazz.client.xhrGet({
url: _URL,
content: {
action: "biz.PickupUserAction",
method: "action",
args: dojo.toJson(args1)
},
headers: {
accept: "text/json"
},
handleAs: "json",
load:function(result) {
self.runSearchCallback(result);
},
error:function(errorObj) {
self._queryError(errorObj);
}
});
}
},

runSearchCallback: function(data){
this._clearStatusMessage();

var users = data.bizfieldvalue.userlist;

if (dojo.isIE) {
this.userSelector.options.length = 0;
}
else {
dojox.xml.parser.removeChildren(this.userSelector);
}
if (users != null) {
var selectedUserMap = {};
for (var i = 0; i < this.selectedUsers.options.length; i++) {
selectedUserMap[this.selectedUsers.options[i].value] = true;
}
users.sort();
// users.sort(function(a, b){
// if (a.EMPLOYEENAME == null || a.EMPLOYEENAME.length === 0) {
// return 1;
// }
// else
// if (b.EMPLOYEENAME == null || b.EMPLOYEENAME.length === 0) {
// return -1;
// }
// else {
// return a.EMPLOYEENAME[0] === b.EMPLOYEENAME[0] ? 0 : a.EMPLOYEENAME[0] > b.EMPLOYEENAME[0] ? 1 : -1;
// }
// });

for (i = 0; i < users.length; i++) {
// filter out users that do not have a name or do not have exactly one user ID
if (users[i].EMPLOYEENAME != null && users[i].EMPLOYEENAME.length > 0 &&
users[i].EMPLOYEEID != null &&
users[i].EMPLOYEEID.length > 0) {

if (selectedUserMap[users[i].EMPLOYEEID]) {
continue;
}

var option = new Option(users[i].EMPLOYEENAME+' - <' +users[i].EMPLOYEEID+'>', users[i].EMPLOYEEID);

if (dojo.isIE) {
this.userSelector.options[this.userSelector.options.length] = option;
}
else {
this.userSelector.appendChild(option);
}
}
}
}
this._handleSelectedChange();
},

_runSelect: function(e){
dojo.stopEvent(e);
for (var i = 0; i < this.userSelector.options.length; i++) {
if (this.userSelector.options[i].selected) {
var option = this.userSelector.options[i];
addOption(this.selectedUsers, option);
removeOption(this.userSelector, option);
i--;
}
}
this._handleSelectorChange();
this._handleSelectedChange();
},

_runDeselect: function(e){
dojo.stopEvent(e);
for (var i = 0; i < this.selectedUsers.options.length; i++) {
if (this.selectedUsers.options[i].selected) {
var option = this.selectedUsers.options[i];
removeOption(this.selectedUsers, option);
i--;
}
}
this._runSearch(e, this.lastQueryTerm);
},

_onOk: function(e){
dojo.stopEvent(e);
var users = [];
for (var i = 0; i < this.selectedUsers.options.length; i++) {
users.push({
name: this.selectedUsers.options[i].text,
userId: this.selectedUsers.options[i].value,

userId1: this.selectedUsers.options[i].EMPLOYEEID
});
}
this.onOk(users);
},

_handleSelectorChange: function(e){
var count = 0;
var selected = null;
for (var i = 0; i < this.userSelector.options.length; i++) {
if (this.userSelector.options[i].selected) {
selected = this.userSelector.options[i];
count++;
}
}
this.selectButton.disabled = (count === 0);
dojox.xml.parser.removeChildren(this.userInfoDiv);
if (count === 1) {
if (selected.EMPLOYEEID != null) {
this.userInfoDiv.appendChild(document.createTextNode(selected.EMPLOYEEID));
}
}
else
if (count > 1) {
this.userInfoDiv.appendChild(document.createTextNode(count + this.messages.selected));
}
},

_handleSelectedChange: function(e){
var selected = false;
for (var i = 0; i < this.selectedUsers.options.length; i++) {
if (this.selectedUsers.options[i].selected) {
selected = true;
}
}
this.deselectButton.disabled = !selected;
this.okButton.disabled = this.selectedUsers.options.length === 0;
},

onOk: function(selectedUsers){
this.dialog.close();
},

onClose: function(){
},

_queryError: function(err){
this._setStatusMessage(err.message, true);
},

_clearStatusMessage: function(){
this.searchStatus.style.visibility = "hidden";
},

_setStatusMessage: function(msg, isError){
this.searchStatus.style.visibility = "visible";
dojox.xml.parser.replaceChildren(this.searchStatus, document.createTextNode(msg));
this.searchStatus.className = isError ? "ErrorStatus" : "NormalStatus";
}
});

})();
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值