<?xml version="1.0" encoding="UTF-8"?> <a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true"> <a:init-procedure/> <a:view> <a:link id="oth201_submit_wfl_link" model="oth.OTH201.oth_other_config_submit_wfl" modelaction="execute"/> <a:link id="oth201_attach_upload_link" url="${/request/@context_path}/uploadFile.lview"/> <script type="text/javascript"><![CDATA[ function oth201_query() { $('oth201_other_list_ds').query(); } function submit_wfl() { var list_ds = $('oth201_other_list_ds'); var records = list_ds.getCurrentRecord(); var oa_id = records.get('oa_id'); var auto_flag = records.get('auto_flag'); var oa_parameter1 = records.get('oa_parameter1'); var oa_parameter2 = records.get('oa_parameter2'); var oa_parameter3 = records.get('oa_parameter3'); if (auto_flag == 'Y') { if (Ext.isEmpty(oa_parameter1) && Ext.isEmpty(oa_parameter2) && Ext.isEmpty(oa_parameter3)) { Leaf.showMessage('提示', '至少维护一个参数!'); } }else if(records.dirty){ Leaf.showMessage('提示', '当前提交事项未保存,请先保存!'); }else if (records.get('status') === 'NEW' && list_ds.validate(true)) { Leaf.showConfirm('提交', '确认提交吗?', function() { Leaf.request({ url: $('oth201_submit_wfl_link').getUrl(), para: { oa_id: oa_id }, success: function() { Leaf.SideBar.show({ msg: '提交成功', duration: 2000 }); $('oth201_other_list_ds').query(); }, scope: this }); }); } } function updateHandler(ds, record, name, value, oldValue) { if (name == 'auto_flag') { if (value == 'Y') { record.getField('config_id_desc').setReadOnly(false); } else { record.getField('config_id_desc').setReadOnly(true); } } else if (name === 'oa_parameter1_sql') { if (value == null) { record.getField('oa_parameter1').setReadOnly(true); } else { record.getField('oa_parameter1').setReadOnly(false); record.getField('oa_parameter1').setLovPara('sql_text', value); } } else if (name === 'oa_parameter2_sql') { if (value == null) { record.getField('oa_parameter2').setReadOnly(true); } else { record.getField('oa_parameter2').setReadOnly(false); record.getField('oa_parameter2').setLovPara('sql_text', value); } } else if (name === 'oa_parameter3_sql') { if (value == null) { record.getField('oa_parameter3').setReadOnly(true); } else { record.getField('oa_parameter3').setReadOnly(false); record.getField('oa_parameter3').setLovPara('sql_text', value); } } else if (name == 'config_id_desc') { if (oldValue != null && value == "") { record.getField('oa_parameter1').setReadOnly(false); record.getField('oa_parameter2').setReadOnly(false); record.getField('oa_parameter3').setReadOnly(false); } } } function editor_func(record, name) { if(name === 'reason' || name === 'description'){ if(record.get('status') !== 'NEW'){ record.getField(name).setReadOnly(true); }else{ record.getField(name).setReadOnly(false); } return 'editor_tf'; } if(record.get('status') !== 'NEW'){ return ''; } if(name === 'oa_type_n'){ return 'editor_comboBox'; }else if(name === 'auto_flag'){ return 'editor_cb'; }else if(name === 'config_id_desc'){ return 'editor_config_id'; }else if(name === 'oa_parameter1' && record.get('oa_parameter1_sql')){ record.getField('oa_parameter1').setLovPara('sql_text', record.get('oa_parameter1_sql')); return 'editor_parameter'; }else if(name === 'oa_parameter2' && record.get('oa_parameter2_sql')){ record.getField('oa_parameter2').setLovPara('sql_text', record.get('oa_parameter2_sql')); return 'editor_parameter'; }else if(name === 'oa_parameter3' && record.get('oa_parameter3_sql')){ record.getField('oa_parameter3').setLovPara('sql_text', record.get('oa_parameter3_sql')); return 'editor_parameter'; } } function oth201_save() { var list_ds = $('oth201_other_list_ds'); var records = list_ds.getCurrentRecord(); var oa_id = records.get('oa_id'); var auto_flag = records.get('auto_flag'); var oa_parameter1 = records.get('oa_parameter1'); var oa_parameter2 = records.get('oa_parameter2'); var oa_parameter3 = records.get('oa_parameter3'); var config_id_desc = records.get('config_id_desc'); if (auto_flag == 'Y') { if(Ext.isEmpty(config_id_desc)){ Leaf.showMessage('提示', '请维护自动处理方案!'); return; } if (Ext.isEmpty(oa_parameter1) && Ext.isEmpty(oa_parameter2) && Ext.isEmpty(oa_parameter3)) { Leaf.showMessage('提示', '至少维护一个参数!'); record.getField('oa_parameter1').setLovPara('sql_text', records.get('oa_parameter1_sql')); record.getField('oa_parameter2').setLovPara('sql_text', records.get('oa_parameter2_sql')); record.getField('oa_parameter2').setLovPara('sql_text', records.get('oa_parameter3_sql')); return; } } else if (auto_flag == 'N') { if (!Ext.isEmpty(config_id_desc) || !Ext.isEmpty(oa_parameter1) || !Ext.isEmpty(oa_parameter2) || !Ext.isEmpty(oa_parameter3)) { Leaf.showMessage('提示', '非自动处理,请清除方案与参数!'); return; } } $('oth201_other_list_ds').submit(); } function successHandle() { $('oth201_other_list_ds').query(); } function attach_upload_renderer(value,record,name){ if(!Ext.isEmpty(record.get('oa_id'))){ return '<a href="javascript:attach_upload_win('+record.get('oa_id')+')">'+'上传附件'+'</a>'; } } function attach_upload_win(oa_id){ var url = $('oth201_attach_upload_link').getUrl() + '?table_name=BGFL_OA_AUTO&header_id='+oa_id; new Leaf.Window({ url: url, title: '附件上传', id: 'oth201_attach_upload_win_id', width: 850, height: 400 }); } function oth201_other_grid_add(){ var ds = $( 'oth201_other_list_ds'); var record = ds.create(ds.currentIndex); $( 'oth201_other_grid').showEditorByRecord(record); } function oth201_other_grid_clear(){ $('oth201_other_grid').clear(); } ]]></script> <a:dataSets> <a:dataSet id="oth201_status_ds" lookupCode="OTHER_WFL_WORKFLOW_STATUS"/> <a:dataSet id="oth201_process_flag_ds" lookupCode="YES_NO"/> <a:dataSet id="oa_type_ds" lookupCode="OA_TYPE"/> <a:dataSet id="oth201_other_query_ds"> <a:fields> <a:field name="oa_type"/> <a:field name="oa_type_n" displayField="code_value_name" options="oa_type_ds" returnField="oa_type" valueField="code_value"/> <a:field name="config_id_desc" lovGridHeight="350" lovHeight="500" lovService="oth.OTH201.oth_get_other_auto_config_for_lov" lovWidth="500" title="自动处理方案选择"> <a:mapping> <a:map from="config_id" to="config_id"/> <a:map from="config_code" to="config_code"/> <a:map from="description_desc" to="config_id_desc"/> </a:mapping> </a:field> <a:field name="auto_flag_desc" displayField="code_value_name" options="oth201_process_flag_ds" returnField="auto_flag" valueField="code_value"/> <a:field name="status_desc" displayField="code_value_name" options="oth201_status_ds" returnField="status" valueField="code_value"/> <a:field name="process_flag_desc" displayField="code_value_name" options="oth201_process_flag_ds" returnField="process_flag" valueField="code_value"/> </a:fields> </a:dataSet> <a:dataSet id="oth201_other_list_ds" autoPageSize="true" autoQuery="true" model="oth.OTH201.oth_bgfl_oa_auto_config_wfl" queryDataSet="oth201_other_query_ds" selectable="true" selectionModel="single"> <a:fields> <a:field name="oa_type"/> <a:field name="oa_type_n" displayField="code_value_name" options="oa_type_ds" required="true" returnField="oa_type" valueField="code_value"/> <a:field name="auto_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/> <a:field name="status_desc" defaultValue="新建" displayField="code_value_name" options="oth201_status_ds" returnField="status" valueField="code_value"/> <a:field name="status" defaultValue="NEW"/> <a:field name="oa_parameter1" lovGridHeight="350" lovHeight="500" lovService="oth.OTH201.oth_get_oa_parameter_for_lov" lovWidth="500" title="参数选择"> <a:mapping> <a:map from="value_code" to="oa_parameter1"/> <a:map from="value_name" to="oa_parameter1_desc"/> </a:mapping> </a:field> <a:field name="oa_parameter2" lovGridHeight="350" lovHeight="500" lovService="oth.OTH201.oth_get_oa_parameter_for_lov" lovWidth="500" title="参数选择"> <a:mapping> <a:map from="value_code" to="oa_parameter2"/> <a:map from="value_name" to="oa_parameter2_desc"/> </a:mapping> </a:field> <a:field name="oa_parameter3" lovGridHeight="350" lovHeight="500" lovService="oth.OTH201.oth_get_oa_parameter_for_lov" lovWidth="500" title="参数选择"> <a:mapping> <a:map from="value_code" to="oa_parameter3"/> <a:map from="value_name" to="oa_parameter3_desc"/> </a:mapping> </a:field> <a:field name="oa_parameter1_sql"/> <a:field name="oa_parameter2_sql"/> <a:field name="oa_parameter3_sql"/> <a:field name="config_id_desc" lovGridHeight="350" lovHeight="500" lovService="oth.OTH201.oth_get_other_auto_config_for_lov" lovWidth="500" title="自动处理方案选择"> <a:mapping> <a:map from="config_id" to="config_id"/> <a:map from="config_code" to="config_code"/> <a:map from="description_desc" to="config_id_desc"/> <a:map from="oa_parameter1_sql" to="oa_parameter1_sql"/> <a:map from="oa_parameter2_sql" to="oa_parameter2_sql"/> <a:map from="oa_parameter3_sql" to="oa_parameter3_sql"/> </a:mapping> </a:field> <a:field name="description" required="true"/> <a:field name="process_flag_desc" displayField="code_value_name" options="oth201_process_flag_ds" returnField="process_flag" valueField="code_value"/> <a:field name="process_suggestion" readOnly="true"/> <a:field name="reason" required="true"/> </a:fields> <a:events> <a:event name="update" handler="updateHandler"/> <a:event name="submitsuccess" handler="successHandle"/> </a:events> </a:dataSet> </a:dataSets> <a:screenBody> <a:screenTopToolbar> <a:screenTitle/> <a:gridButton click="oth201_query" text="查询"/> <!-- <a:gridButton bind="oth201_other_grid" type="add"/> --> <a:gridButton click="oth201_other_grid_add" text="新增"/> <a:gridButton click="oth201_save" text="保存"/> <a:gridButton click="submit_wfl" text="提交审批"/> <!-- <a:gridButton bind="oth201_other_grid" type="clear"/> --> <a:gridButton click="oth201_other_grid_clear" text="清除"/> </a:screenTopToolbar> <a:form column="3" labelWidth="120" marginWidth="30" title="HLS.QUERY_TITLE"> <a:comboBox name="oa_type_n" bindTarget="oth201_other_query_ds" prompt="事项分类"/> <a:textField name="description" bindTarget="oth201_other_query_ds" prompt="申请事项"/> <a:textField name="reason" bindTarget="oth201_other_query_ds" prompt="申请事项"/> <a:comboBox name="status_desc" bindTarget="oth201_other_query_ds" prompt="审批状态"/> <a:comboBox name="process_flag_desc" bindTarget="oth201_other_query_ds" prompt="是否处理"/> <a:textField name="process_suggestion" bindTarget="oth201_other_query_ds" prompt="处理意见"/> <!-- <a:lov name="config_id_desc" bindTarget="oth201_other_query_ds" prompt="自动处理方案"/> <a:textField name="oa_parameter1_desc" bindTarget="oth201_other_query_ds" prompt="参数1描述"/> <a:comboBox name="auto_flag_desc" bindTarget="oth201_other_query_ds" prompt="自动处理"/> --> </a:form> <a:grid id="oth201_other_grid" bindTarget="oth201_other_list_ds" marginHeight="200" marginWidth="30" navBar="true"> <a:columns> <a:column name="oa_type_n" editorFunction="editor_func" lock="true" prompt="事项分类" width="120"/> <a:column name="description" editorFunction="editor_func" lock="true" prompt="申请事项" width="300"/> <a:column name="reason" editorFunction="editor_func" prompt="申请原因" width="280"/> <a:column name="attach_upload" align="center" prompt="上传附件" renderer="attach_upload_renderer"/> <a:column name="status_desc" align="center" prompt="审批状态" width="80"/> <a:column name="process_flag_desc" align="center" prompt="是否处理" width="80"/> <a:column name="process_suggestion" editor="editor_tf" prompt="处理意见" width="280"/> <!-- <a:column name="auto_flag" editorFunction="editor_func" lock="true" prompt="是否自动处理" width="80"/> <a:column name="config_id_desc" editorFunction="editor_func" prompt="自动处理方案" width="120"/> <a:column name="oa_parameter1" align="center" editorFunction="editor_func" prompt="参数1" width="60"/> <a:column name="oa_parameter1_desc" prompt="参数1描述" width="120"/> <a:column name="oa_parameter2" align="center" editorFunction="editor_func" prompt="参数2" width="60"/> <a:column name="oa_parameter2_desc" prompt="参数2描述" width="120"/> <a:column name="oa_parameter3" align="center" editorFunction="editor_func" prompt="参数3" width="60"/> <a:column name="oa_parameter3_desc" prompt="参数3描述" width="120"/> --> </a:columns> <a:editors> <!-- <a:textField id="editor_tf"/> --> <a:textArea id="editor_tf" height="200"/> <a:checkBox id="editor_cb"/> <a:comboBox id="editor_comboBox"/> <a:lov id="editor_config_id"/> <a:lov id="editor_parameter"/> </a:editors> </a:grid> </a:screenBody> <script type="text/javascript"><![CDATA[ Leaf.onReady(init); function init() { $('oth201_other_list_ds').getField('oa_parameter1').setReadOnly(true); $('oth201_other_list_ds').getField('oa_parameter2').setReadOnly(true); $('oth201_other_list_ds').getField('oa_parameter3').setReadOnly(true); $('oth201_other_list_ds').getField('oa_parameter1_desc').setReadOnly(true); $('oth201_other_list_ds').getField('oa_parameter2_desc').setReadOnly(true); $('oth201_other_list_ds').getField('oa_parameter3_desc').setReadOnly(true); } ]]></script> </a:view> </a:screen>