hls_approve_template.lview 10.1 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 234 235 236 237 238 239 240 241
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ericyin  
    $Date: 2013-4-11 下午13:15:36  
    $Revision: 1.0  
    $Purpose: 商业伙伴关系类别定义
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view template="default">
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[



            var header = $jq('meta[name=_csrf_header]').attr('content');
            var token = $jq('meta[name=_csrf]').attr('content');
            $jq(document).ajaxSend(function (e, xhr, options) {
                xhr.setRequestHeader(header, token);
            });

            function queryFunction() {
                //alert("Search");
                $('hls_approve_template_ds').query();


            }
            
            function hls_112_back() {

                history.go(-1);
            }
            
            function hls_112_next() {
                history.go(1);
            }
            
            function hls_012_quit() {
                //alert("Q");
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
            

            
            function hls_112_grid_clear() {
                $('hls_approve_template_grid').clear();
            }
            
            function hls_112_grid_submit() {
                $('hls_approve_template_ds').submit();
            }
            

            function hls_012_submitsuccess(){
                //alert("9");
                $('hls_approve_template_ds').query();
            }


            function tplNo_render(val,data,col_name){
                return "<a href=\"javascript:open_contract_win('"+ data.id +"','"+ val +"')\">"+ val +"</a>";
            }


            function setDetailParam(param, data){
                var tmp1;
                var tmpDiv, tmpNo, tmpDispAppDiv, tmpAppDiv;
                        var tmpDispAppVal = "";
                        for(var i=0; i < data.length; i++){
                            tmpDiv = data[i].DTL_DIV;
                            tmpAppDiv = (data[i].APPROVE_DIV == undefined ? "": data[i].APPROVE_DIV);
                            tmpNo = data[i].DTL_NO;

                            if(tmpDiv == "A"){        tmp1 = "appr";    }
                            else if(tmpDiv == "R"){  tmp1 = "reci";     }
                            else if(tmpDiv == "C"){  tmp1 = "cc";       }

                            if(tmpDiv =="A"){
                                if(tmpAppDiv == "N"){        tmpDispAppDiv = "Not Used";    }
                                else if(tmpAppDiv == "D"){  tmpDispAppDiv = "Dept Leader";     }
                                else if(tmpAppDiv == "U"){  tmpDispAppDiv = "User ID";       }
                                else if(tmpAppDiv == "P"){  tmpDispAppDiv = "Parents";       }
                                else if(tmpAppDiv == "Q"){  tmpDispAppDiv = "Grandparents";       }
                                else {  tmpDispAppDiv = "";       }
                            }else{
                                if(tmpAppDiv == "N"){        tmpDispAppDiv = "Not Used";    }
                                else if(tmpAppDiv == "D"){  tmpDispAppDiv = "Dept";     }
                                else if(tmpAppDiv == "U"){  tmpDispAppDiv = "User";       }
                                else {  tmpDispAppDiv = "";       }
                            }


                            param['inp_'+tmp1+'_div'+tmpNo] = data[i].APPROVE_DIV;
                            param['inp_combo_'+tmp1+'_div'+tmpNo] = tmpDispAppDiv;
                            param['inp_'+tmp1+'_tp'+tmpNo] = data[i].APPROVE_TP;
                            param['inp_combo_'+tmp1+'_tp'+tmpNo] = data[i].APPROVE_TP;


                            if(tmpAppDiv == "U"){
                                param['inp_'+tmp1+'_user_id'+tmpNo] = data[i].APPROVE_VAL;
                                param['inp_'+tmp1+'_user_name'+tmpNo] = data[i].USER_NAME;

                            }else if(tmpAppDiv == "D"){
                                param['inp_'+tmp1+'_dept_id'+tmpNo] = data[i].APPROVE_VAL;
                                param['inp_'+tmp1+'_dept_name'+tmpNo] = data[i].DEPT_NAME;
                            }

                }


            }

            function open_contract_win(record_id, tplNo){

                var data = $("hls_approve_template_ds").findById(record_id);

                //设置header token
                var header = $jq('meta[name=_csrf_header]').attr('content');
                var token = $jq('meta[name=_csrf]').attr('content');
                $jq(document).ajaxSend(function (e, xhr, options) {
                    xhr.setRequestHeader(header, token);
                });
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');

                var schData = {};
                schData ={'tplNo' : data.data.tpl_no};

                $jq.ajax({
                    url: '${/request/@context_path}/hls/template/detail/list',
                    method: 'post',
                    dataType: "json",
                    contentType: 'application/json;charset=UTF-8',
                    data: JSON.stringify(schData),
                    success: function (args) {

                        Leaf.Masker.unmask(Ext.getBody(), '${l:HLS.EXECUTING}');
                        if (args.success) {


                            var maintain_type = 'QUERY';
                            var param = {};
                            param['from_master_flag'] = "Y";
                            param['tpl_code'] = tplNo;
                            param['function_code'] = 'PRJ502D';
                            param['function_usage'] = 'QUERY';
                            param['maintain_type'] = maintain_type;
                            param['url_title'] = data.data.tpl_title;
                            param['winid'] = "hls_doc_get_layout_code_winid";

                            setDetailParam(param, args.rows);

                            var win = new Leaf.Window({
                                id: 'hls_doc_get_layout_code_winid',
                                /*params: {
                                    from_master_flag:'Y',
                                    tpl_code: param['tpl_code'],
                                    function_code: param['function_code'],
                                    function_usage: param['function_usage'],
                                    maintain_type: param['maintain_type'],
                                    //inp_combo_appr_div1: param['inp_combo_appr_div1'],
                                    //inp_combo_appr_div: param['inp_combo_appr_div'],
                                    winid: 'hls_doc_get_layout_code_winid'
                                },*/
                                params : param,
                                url: "${/request/@context_path}/modules/hls/HLS112/hls_approve_template_user_modify.lview?_csrf=${/session/@_csrf.token}",
                                title: param['url_title'] ,
                                fullScreen: true,
                                draggable: true
                            });
                            win.on('close', function() {
                                //if (list_ds) {
                                //   $(list_ds).query();
                                //}
                            });


                        } else {
                            Leaf.showMessage('提示', args.message);
                            return;
                        }
                    },
                    failure: function (args) {
                        //$('acr515_invoiceVatDs').query();
                        Leaf.Masker.unmask(Ext.getBody(), '${l:HLS.EXECUTING}');
                        Leaf.SideBar.show({
                            msg: 'failure',
                            duration: 2000
                        });
                    },
                    error: function (args) {
                        //alert(args);
                        console.log(args);
                        //$('acr515_invoiceVatDs').query();
                        Leaf.Masker.unmask(Ext.getBody(), '${l:HLS.EXECUTING}');
                        Leaf.SideBar.show({
                            msg: 'error',
                            duration: 2000
                        });
                    },
                });


            }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls_approve_template_ds" autoQuery="true" model="hls.HLS112.hls_approve_template" selectable="true">
                <a:fields>
                    <a:field name="tpl_no" required="true" />
                    <a:field name="tpl_title" required="true"/>
                    <a:field name="last_update_dt" />
                </a:fields>
            </a:dataSet>
            <a:events>
                <a:event name="submitsuccess" handler="hls_012_submitsuccess"/>
            </a:events>
        </a:dataSets>
        <a:screenBody>

            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls_112_back" text="HLS.BACK"/>
                <a:gridButton click="hls_112_next" text="HLS.FORWARD"/>
                <a:gridButton click="hls_112_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="hls_112_grid_submit" text="HLS.SAVE"/>
                <a:gridButton click="queryFunction" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:grid id="hls_approve_template_grid" bindTarget="hls_approve_template_ds" marginHeight="80" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="tpl_no" renderer="tplNo_render" width="100" />
                    <a:column name="tpl_title" editor="templateDs_title" width="500" />
                    <a:column name="last_update_dt" width="200" />
                </a:columns>
                <a:editors>
                    <a:textField id="templateDs_title"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>