Dorado7工作笔记

1.修改按钮:

var selections = view.get("#dgTapsLongcutSpeed.selection");

if(selections.length > 0){

dorado.MessageBox.confirm("确定修改吗?",function(){

selections.each(function(selection, i){

view.get("#dgTapsLongcutSpeed").set("readOnly",false);

});

})

}else {

//alert("请选择要修改的数据!");

dorado.MessageBox.alert("请选择要修改的数据!");

}

 

2.数据校验:

var data = view.get("#dsTapsLongcutSpeed").get("data:#");

var maxDeep = data.get("maxDeep");

var mixDeep = data.get("mixDeep");

if(mixDeep > maxDeep){

throw new dorado.Exception("最小厚度大于最大厚度!");

 

}

 

3. 联动查询下拉框

publicDropDownDP#checkTssProduceMachine

publicDropDownDP#queryTssProduceMachine

DataSet: dataType    

 

4. onBlur校验信息

var data = view.get("#dsTapsCrosscutSpeed").get("data:#");

var mixLength = data.get("mixLength");

var maxLength = data.get("maxLength");

if(mixLength != null && maxLength != null && maxLength!='' && mixLength > maxLength){

data.set("maxLength",'');

dorado.MessageBox.alert("最小长度大于最大长度!");

}

5. 新增,修改时,只有选定行 才能够编辑  (解决)

ToolBarButton修改按钮onClick事件中

var selections = view.get("#dgTapsCrosscutSpeed.selection");

if(selections.length > 0){

var count = [];

selections.each(function(selection, i){

        count[i] = selection.get("seqId");

    });

view.set("context.updateCount",count);

view.get("#dgTapsCrosscutSpeed").set("readOnly",false);

}else {

dorado.MessageBox.alert("请先勾选要修改的记录!");

}

DataGrid中onCurrentChange事件

var count = view.get("context.updateCount");

var id = view.get("#dsTapsCrosscutSpeed").get("data:#").get("seqId");

var status = view.get("#dsTapsCrosscutSpeed").get("data:#").get("status");

if(count != null){

for(var i = 0; i <= count.length; i++){

//撤销的数据不予许修改

if(id == count[i] && status != '00'){

view.get("#dgTapsCrosscutSpeed").set("readOnly", false);

break;

}else {

view.get("#dgTapsCrosscutSpeed").set("readOnly", true);

}

}

}

 

 

6. 取消行

view.get("#dsTapsLongcutSpeed").clear();//清空所有行

view.get("#dsTapsLongcutSpeed").get("data:#").cancel();//清空当前行

7. 修改选中行,dateset只可以修改选中行,其他行不允许操作

在修改按钮中onClick事件中:

var selections = view.get("#dgTapsLongcutSpeed.selection");

if(selections.length > 0){

var count = [];

selections.each(function(selection, i){

        count[i] = selection.get("seqId");

    });

view.set("context.updateCount",count);

}else {

dorado.MessageBox.alert("请选择要修改的数据!");

}

DataGrid中onCurrentChange事件中:

var count = view.get("context.updateCount");

var id = view.get("#dsTapsCustomerPriority").get("data:#").get("customerId");

for(var i=0;i<=count.length;i++){

if(id==count[i]){

 view.get("#dgCustomerPriority").set("readOnly",false);

 break;

}else{

view.get("#dgCustomerPriority").set("readOnly",true);

}

}

8. 绑定同一个下拉框,设置不同的autoOpen效果

DataGridonDataRowClick事件中

view.get("#cddVSsCustomer").set("autoOpen",true);

在查询框的AutoFormElementonFocus事件中

view.get("#cddVSsCustomer").set("autoOpen",false);

9. 判断当前行状态 1为新增, 2为修改

view.get("#dsTapsLongcutSpeed").get("data:#").state

10. 前台数据校验

DataType中onDataChange事件中:

var mixDeep = arg.entity.get("mixDeep");

var maxDeep = arg.entity.get("maxDeep");

if(mixDeep != null && maxDeep != null && mixDeep >= maxDeep){

arg.entity.set("mixDeep",'');

arg.entity.set("maxDeep",'');

dorado.MessageBox.alert("最小厚度不得大于或者等于最大厚度!");

}

11. 绑定下拉框

使用的表 xt.t_ss_code_value

A 在DataType中keyProperty:codeValue    valueProperty:codeDesc   mapValues:

${dorado.getDataProvider("publicDropDownDP#queryCodeValue").getResult({"codeType":"IGC_STATUS"})}

B 在AutoFormElement中Trigger绑定 dsddCodeValueEmpty

C 在AutoFormElement中onFocus

view.get("#dsCodeValue").set("parameter",{"codeType":"IGC_STATUS"});

view.get("#dsCodeValue").flushAsync();

view.get("#dsddCodeValueEmpty").set("assignmentMap",'status=codeValue');

12. 共用下拉框 不同页面显示不同的列

onFous事件中

view.get("#dgTssProduceMachine").get("columns").get("productProcessId").set("visible",false);

view.get("#dgTssProduceMachine").get("columns").get("productProcessName").set("visible",false);

 

13. 两值相减,给第三个字段自动赋值

View中onReady事件

view.set("context.dataChangeFlag",false);

DataType中onDataChange事件

//自动生成检修时间

var examineStartTime = view.get("#dsTapsRegularxEamineTime").get("data:#").get("examineStartTime");

var examineEndTime = view.get("#dsTapsRegularxEamineTime").get("data:#").get("examineEndTime");

var flag = view.get("context.dataChangeFlag");

if(!flag && examineStartTime != null && examineEndTime != null) {

if(examineStartTime > examineEndTime){

dorado.MessageBox.alert("检修开始时间必须小于检修结束时间");

view.set("context.dataChangeFlag",true);

}

}

var examineTime = Math.round((examineEndTime - examineStartTime)/1000/60);

view.set("context.examineTime",examineTime);

DataGrid中onCellValueEdit事件

var examineTime = view.get("context.examineTime");

view.get("#dsTapsRegularxEamineTime").get("data:#").set("examineTime",examineTime);

view.set("context.examineTime",null);

DataColumn的TextEdit控件onFocus事件

view.set("context.dataChangeFlag",false);

14. 主子表判断新增和修改状态

新增判断

if(view.get("#dsTssCodeType").getData("#.tssCodeValueList").current.getData().segNo == null)

修改判断

selections.each(function(selection, i){

        count[i] = selection.entityId;

});

view.get("#dsTssCodeType").getData("#.tssCodeValueList").current.entityId;

15. DataGrid新增时给其中一列赋值

view.get("#dsTssCodeType").getData("#.tssCodeValueVoList").insert({"codeType":codeType});

16. 子页面跳转

view.get("#tcTssCodeValue").set("currentIndex",1);

17. 控制子页面

throw new dorado.Exception("当前有操作正在进行,请完成当前操作或取消!");

18. 页面获取登陆人信息

${loginUser.getUsername()}

19. 下拉框列名不对应

在下拉框当前列onFoucs事件中

view.get("#cddVSsCustomer").set("assignmentMap",'customId=customerId,customName=custName');

20. autoForm列设置为只读且赋值

autoFormElement的id给个值

view.get("#afTgMouldMBase.entity").set("ratio", "1");

view.get("#ratio").set("readOnly", true);

21. 实现下拉框弹出时就开始查询

OnFucs事件中

view.get("#cddTssProduceMachineAuto").removeListener("onOpen");

view.get("#cddTssProduceMachineAuto").set({

    onOpen: function(slef, arg){

        view.get("#dsTssProduceMachineAuto").clear();

        view.get("#dsTssProduceMachineAuto").flushAsync();

    }

});

你可能感兴趣的:(Dorado7工作笔记)