sys_notify_insert.lview 13.4 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangyi2652 $
    $Date: 2010/11/26 07:25:06 $
    $Revision: 1.2 $
    $Purpose: “事件消息模板维护” 新增界面
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
    <a:init-procedure>
        <p:echo/>
        <a:model-query defaultWhereClause=" cs.code = &apos;SYS_NOTIFY_SEND_METHOD&apos;" fetchAll="true" model="sys.SYS2020.sys_notify_code_codevalue" rootPath="send_method"/>
        <a:model-query defaultWhereClause=" cs.code = &apos;SYS_NOTIFY_SEND_METHOD&apos;" fetchAll="true" model="sys.SYS2020.sys_notify_code_codevalue" rootPath="send_method"/>
        <a:model-query defaultWhereClause=" cs.code = &apos;SYS_NOTIFY_SEND_MODE&apos;" fetchAll="true" model="sys.SYS2020.sys_notify_code_codevalue" rootPath="send_mode"/>
        <a:model-query defaultWhereClause=" cs.code = &apos;SYS_NOTIFY_DELAY_TIME_UNIT&apos;" fetchAll="true" model="sys.SYS2020.sys_notify_code_codevalue" rootPath="delay_time_unit"/>
        <a:model-query defaultWhereClause=" snrt.enabled_flag = &apos;Y&apos; " fetchAll="true" model="sys.SYS2020.sys_notify_recipient_type" rootPath="recipientType"/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
        
            function onNotifyRecipientUpdate(ds,record,name,value){
                if (name=='recipient_type_id'){
                    record.set('recipient_name', '');
                    record.set('recipient_user_id', '');
                }
            }

            function onFieldSetUpdate(ds,record,name,value){
                if(name=='send_mode'){
                    var send_mode=record.get('send_mode');

                    var delay_time_unit_display=record.getMeta().getField('delay_time_unit_display');
                    var delay_time=record.getMeta().getField('delay_time');
                    if (send_mode=='02'){
                        delay_time_unit_display.setReadOnly(false);
                        delay_time.setReadOnly(false);
                    }else{
                        delay_time_unit_display.setReadOnly(true);
                        delay_time.setReadOnly(true);

                        record.set('delay_time_unit_display',null);
                        record.set('delay_time',null);
                        record.set('delay_time_unit',null);
                    }
                }
            }

            function onFieldSetInit(){
                var record = $('sys_notify_edit_ds').getCurrentRecord();
                var send_mode=record.get('send_mode');
                var delay_time_unit_display=record.getMeta().getField('delay_time_unit_display');
                var delay_time=record.getMeta().getField('delay_time');
                if (send_mode=='02'){
                    delay_time_unit_display.setReadOnly(false);
                    delay_time.setReadOnly(false);
                }else{
                    delay_time_unit_display.setReadOnly(true);
                    delay_time.setReadOnly(true);
                    record.set('delay_time_unit_display',null);
                    record.set('delay_time',null);
                    record.set('delay_time_unit',null);
                }
            }

            function onCellClick(grid, row, name, record){
                if(name =='recipient_name_display'){
                    var recipient_type_id = record.get('recipient_type_id');
                    var url=null;

                    if (recipient_type_id==null||recipient_type_id==''){
                        return;
                    }

                    var allRecords=$('sys_recipient_type_ds').getAll();
                    if (allRecords==null||allRecords==''||allRecords==undefined){
                        return;
                    }
                    for(var k = 0,l=allRecords.length;k<l;k++){
                        var rcd = allRecords[k];
                        if (rcd.get('recipient_type_id')==recipient_type_id){
                            url=rcd.get('lov_url');
                            break;
                        }
                    }

                    var recipient_name_display=record.getMeta().getField('recipient_name_display');
                    recipient_name_display.setLovService(url);
                }
            }

            function saveFunction(){
                var ds=$('sys_notify_edit_ds');
                var gridDs=$('sys_notify_recipient_ds');
                if (ds.validate()&&gridDs.validate()){
                    ds.submit();
                }
            }

            function onSuccess(dataSet, datas, res){
                Leaf.showMessage('${l:PROMPT_MESSAGE}','${l:HLS.SUBMIT_SUCCESS}',function(cmp){closeWindow();cmp.close();});
                queryRecipientType();
            }

            function closeWindow(){
                $('newNotify').close();
            }


        
        ]]></script>
        <a:dataSets>
            <a:dataSet id="sys_notify_sendMethod_ds">
                <a:datas dataSource="/model/send_method"/>
            </a:dataSet>
            <a:dataSet id="sys_notify_sendMode_ds">
                <a:datas dataSource="/model/send_mode"/>
            </a:dataSet>
            <a:dataSet id="sys_notify_delayTimeUnit_ds">
                <a:datas dataSource="/model/delay_time_unit"/>
            </a:dataSet>
            <a:dataSet id="sys_recipient_type_ds">
                <a:datas dataSource="/model/recipientType"/>
            </a:dataSet>
            <a:dataSet id="sys_notify_edit_ds" autoCreate="true" submitUrl="${/request/@context_path}/modules/sys/SYS2020/sys_notify_insert.lsc">
                <a:fields>
                    <a:field name="notify_code" required="true"/>
                    <a:field name="description" required="true"/>
                    <a:field name="send_method_display" displayField="code_value_name" options="sys_notify_sendMethod_ds" returnField="send_method" valueField="code_value"/>
                    <a:field name="send_mode_display" displayField="code_value_name" options="sys_notify_sendMode_ds" returnField="send_mode" valueField="code_value"/>
                    <a:field name="delay_time_unit_display" displayField="code_value_name" options="sys_notify_delayTimeUnit_ds" returnField="delay_time_unit" valueField="code_value"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onFieldSetUpdate"/>
                    <a:event name="submitsuccess" handler="onSuccess"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="sys_notify_recipient_ds" bindName="recipients" bindTarget="sys_notify_edit_ds" selectable="true">
                <a:fields>
                    <a:field name="recipient_type_display" displayField="description" options="sys_recipient_type_ds" required="true" returnField="recipient_type_id" valueField="recipient_type_id"/>
                    <a:field name="recipient_name_display" fetchRemote="false" lovGridHeight="320" lovHeight="440" lovWidth="500" title="RECIEVER_SELECT">
                        <a:mapping>
                            <a:map from="description" to="recipient_name_display"/>
                            <a:map from="notify_code" to="notify_code"/>
                            <a:map from="notify_id" to="recipient_name"/>
                            <a:map from="recipient_user_id" to="recipient_user_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="notify_id" defaultValue="${/parameter/@notify_id}"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onNotifyRecipientUpdate"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:tabPanel height="400" width="550">
                <a:tabs>
                    <a:tab prompt="SYS_NOTIFY_EDIT.TAB_TITLE1" width="110">
                        <a:fieldSet column="1" labelWidth="95" title="SYS_NOTIFY_EDIT.NEW_NOTIFY" width="525">
                            <a:hBox prompt="SYS_MESSAGES.MESSAGE_CODE">
                                <a:textField name="notify_code" bindTarget="sys_notify_edit_ds" typeCase="upper"/>
                                <a:textField name="description" bindTarget="sys_notify_edit_ds" prompt="SYS_MESSAGES.MESSAGE_NAME"/>
                            </a:hBox>
                            <a:hBox prompt="SYS_NOTIFY.MESSAGE_TITLE">
                                <a:textField name="message_title" bindTarget="sys_notify_edit_ds" width="380"/>
                            </a:hBox>
                            <a:hBox prompt="SYS_NOTIFY.MESSAGE_CONTENT">
                                <a:textArea name="message_content" bindTarget="sys_notify_edit_ds" width="380"/>
                            </a:hBox>
                            <a:hBox prompt="SYS_NOTIFY.SEND_METHOD">
                                <a:comboBox name="send_method_display" bindTarget="sys_notify_edit_ds"/>
                                <a:comboBox name="send_mode_display" bindTarget="sys_notify_edit_ds" prompt="SYS_NOTIFY.SEND_MODE"/>
                            </a:hBox>
                            <a:hBox prompt="SYS_NOTIFY.DELAY_TIME">
                                <a:numberField name="delay_time" bindTarget="sys_notify_edit_ds"/>
                                <a:comboBox name="delay_time_unit_display" bindTarget="sys_notify_edit_ds" prompt="SYS_NOTIFY_RECIPIENT.DELAY_TIME_UNIT"/>
                            </a:hBox>
                            <a:hBox prompt="SYS_NOTIFY.CONTENT_SQL">
                                <a:textArea name="content_sql" bindTarget="sys_notify_edit_ds" width="380"/>
                            </a:hBox>
                            <a:hBox prompt="SYS_NOTIFY.MSG_SEND_CHECK_PROC">
                                <a:textField name="msg_send_check_proc" bindTarget="sys_notify_edit_ds" width="380"/>
                            </a:hBox>
                            <a:hBox prompt="SYS_NOTIFY.MSG_CREATE_PROC">
                                <a:textField name="msg_create_proc" bindTarget="sys_notify_edit_ds"/>
                                <a:checkBox name="enabled_flag" bindTarget="sys_notify_edit_ds" prompt="FND_OPERATION_UNITS.ENABLED_FLAG"/>
                            </a:hBox>
                        </a:fieldSet>
                    </a:tab>
                    <a:tab prompt="SYS_NOTIFY_RECIPIENT.RECIPIENT_NAME" width="110">
                        <a:grid id="edit_grid" bindTarget="sys_notify_recipient_ds" height="350" navBar="true" width="525">
                            <a:toolBar>
                                <a:button type="add"/>
                                <a:button type="clear"/>
                            </a:toolBar>
                            <a:columns>
                                <a:column name="recipient_type_display" editor="edit_grid_comboBox" prompt="SYS_NOTIFY_RECIPIENT.RECIPIENT_TYPE" sortable="true"/>
                                <a:column name="recipient_name_display" editor="edit_grid_lov" prompt="SYS_NOTIFY_RECIPIENT.RECIPIENT_NAME" sortable="true"/>
                                <a:column name="recipient_mobile" editor="edit_grid_tf" prompt="SYS_NOTIFY_RECIPIENT.RECIPIENT_MOBILE" sortable="true"/>
                                <a:column name="recipient_mail" editor="edit_grid_tf" prompt="SYS_NOTIFY_RECIPIENT.EMAIL" sortable="true"/>
                                <a:column name="param1" editor="edit_grid_tf" prompt="SYS_NOTIFY_RECIPIENT.PARAM1" sortable="true"/>
                                <a:column name="param2" editor="edit_grid_tf" prompt="SYS_NOTIFY_RECIPIENT.PARAM2" sortable="true"/>
                                <a:column name="param3" editor="edit_grid_tf" prompt="SYS_NOTIFY_RECIPIENT.PARAM3" sortable="true"/>
                                <a:column name="param4" editor="edit_grid_tf" prompt="SYS_NOTIFY_RECIPIENT.PARAM4" sortable="true"/>
                                <a:column name="recipient_desc" editor="edit_grid_tf" prompt="WFL_WORKFLOW_PARAM_VALUE.VALUE_DESC" sortable="true"/>
                                <a:column name="enabled_flag" editor="edit_grid_checkBox" prompt="FND_OPERATION_UNITS.ENABLED_FLAG" sortable="true"/>
                            </a:columns>
                            <a:editors>
                                <a:textField id="edit_grid_tf"/>
                                <a:checkBox id="edit_grid_checkBox"/>
                                <a:comboBox id="edit_grid_comboBox"/>
                                <a:lov id="edit_grid_lov"/>
                            </a:editors>
                            <a:events>
                                <a:event name="cellClick" handler="onCellClick"/>
                            </a:events>
                        </a:grid>
                    </a:tab>
                </a:tabs>
            </a:tabPanel>
            <script type="text/javascript"><![CDATA[
                onFieldSetInit(); 
            ]]></script>
        </a:screenBody>
        <div class="win-toolbar" style="width:520px;height:40px;">
            <a:hBox style="float:right;margin-right:10px;margin-top:5px;">
                <a:button click="saveFunction" text="HAP_SAVE"/>
                <a:button click="closeWindow" text="HAP_CLOSE"/>
            </a:hBox>
        </div>
    </a:view>
</a:screen>