hls_plan_to_grant.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 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: liukang 
    $Date: 2016-04-05 上午9:53:03  
    $Revision: 1.0  
    $Purpose: 产品方案授权
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" dynamiccreateenabled="true" trace="true">
    <a:init-procedure><![CDATA[
	]]></a:init-procedure>
    <a:view>
        <a:link id="hls_plan_to_grant_brand_link" url="${/request/@context_path}/modules/hls/HLS051/hls_plan_to_grant_barnd.lview"/>
        <a:link id="hls_plan_to_grant_area_link" url="${/request/@context_path}/modules/hls/HLS051/hls_plan_to_grant_area.lview"/>
        <script type="text/javascript"><![CDATA[
        
          	window['${/parameter/@bp_seq}${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name) {
                var product_grant_id = record.get('product_grant_id');
                if (name == 'province_city_grant') {
                    return '<a  href="javascript:grant_area_window_open(' + product_grant_id + ',\'' + name + '\')">' + '<font color="#FF9900">省市授权</font>' + '</a>';
                }
            };
            
            //更新时调用
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
            	var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_product_plan_to_grant');
            	if (ds_id == ds.id){
            	    if(name=='agent_type'){
            	        if(!value){
            	            record.getField('agent_n').setLovPara('agent_type', value);
            	        }
            	    }
            	}
            };
            
/*             window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
            	var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_product_plan_to_grant');

            	if (ds_id == ds.id){
            	    if(name=='start_date'||name=='end_date'){
            	        var start_date= record.get('start_date')||0;
            			var end_date = record.get('end_date')||0;
            			if(start_date > end_date){
            			    record.set('end_date','');
            			    Leaf.showMessage('开始时间不能小于结束时间','结束时间必须在开始时间之后!');
            			}            			
            	    }
            	}
               }; */
            
            function grant_area_window_open(id, name) {
                if (Ext.isEmpty(id) || id == 'undefined') {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请先点击保存!');
                } else {
                    var win = new Leaf.Window({
                        id: 'hls_grant_area_window',
                        url: $('hls_plan_to_grant_area_link').getUrl(),
                        params: {
                            winId: 'hls_grant_area_window',
                            product_grant_id: id
                        },
                        title: '区域授权',
                        height: 700,
                        width: 550
                    });
                }
            }
            
            // function hls051_grant_close() {
                // $('hls_grant_window').close();
            // }
            
            // function hls051_grant_copy(ds, record) {
                // lag = 'Y';
                // var result_ds = $('hls051_plan_to_grant_ds');
                // var records = result_ds.getSelected();
                // if (records.length == 0) {
                    // Leaf.showMessage("提示", "请至少选择一条数据");
                    // return;
                // } else if (records.length > 1) {
                    // Leaf.showMessage("提示", "请选择单条数据进行复制");
                    // return;
                // } else {
                    // $('hls051_plan_to_grant_grid').showEditorByRecord($('hls051_plan_to_grant_ds').create());
                // }
            // }
            // var lag = 'N';
            
            // function grant_add(ds, record, index) {
            
            
                // if (lag == 'Y') {
                    // var select_record = ds.getSelected()[0];
                    // for (var name in select_record.data) {
                        // record.set(name, select_record.get(name));
                        // record.set('product_grant_id', null);
            
                    // }
                // }
                // lag = 'N';
            // }
            
            // function grant_update(dataset, record, name, value, oldvalue) {
            // if (name == 'province_id') {
            // if (value != oldvalue && !Ext.isEmpty(value)) {
            // var v_city_field = record.getField('city_name');
            // v_city_field.setLovModel('hls.HLS051.hls051_fnd_city');
            // v_city_field.setLovPara('province_id', value);
            // record.set('city_id', null);
            // record.set('city_name', null);
            // }
            // }
            // }
            
            // function grant_selected(grid, row, record) {
            // //alert(${/parameter/@product_plan_id});
            // var v_province_id = record.get('province_id');
            // if (typeof(v_province_id) != 'undefined' && !Ext.isEmpty(v_province_id)) {
            // var v_city_field = record.getField('city_name');
            // v_city_field.setLovModel('hls.HLS051.hls051_fnd_city');
            // v_city_field.setLovPara('province_id', v_province_id);
            // }
            // }
            
            // function to_grand_brand(value, record, name) {
                // var product_grant_id = record.get('product_grant_id');
                // if (name == 'grant_brand') {
                    // return '<a  href="javascript:grant_brand_window_open(' + product_grant_id + ',\'' + name + '\')">' + '<font color="#FF9900">授权品牌</font>' + '</a>';
                // }
            // }
            
            // function grant_brand_window_open(id, name) {
                // if (Ext.isEmpty(id) || id == 'undefined') {
                    // Leaf.showMessage('${l:HLS.PROMPT}', '请先点击保存!');
                // } else {
                    // var win = new Leaf.Window({
                        // id: 'hls_grant_brand_window',
                        // url: $('hls_plan_to_grant_brand_link').getUrl(),
                        // params: {
                            // winId: 'hls_grant_brand_window',
                            // product_grant_id: id
                        // },
                        // title: '品牌授权',
                        // height: 700,
                        // width: 550
                    // });
                // }
            // }
            
            
            // function to_grant_area(value, record, name) {
                // var product_grant_id = record.get('product_grant_id');
                // if (name == 'area') {
                    // return '<a  href="javascript:grant_area_window_open(' + product_grant_id + ',\'' + name + '\')">' + '<font color="#FF9900">授权区域</font>' + '</a>';
                // }
            // }
            
            // function grant_area_window_open(id, name) {
                // if (Ext.isEmpty(id) || id == 'undefined') {
                    // Leaf.showMessage('${l:HLS.PROMPT}', '请先点击保存!');
                // } else {
                    // var win = new Leaf.Window({
                        // id: 'hls_grant_area_window',
                        // url: $('hls_plan_to_grant_area_link').getUrl(),
                        // params: {
                            // winId: 'hls_grant_area_window',
                            // product_grant_id: id
                        // },
                        // title: '区域授权',
                        // height: 700,
                        // width: 550
                    // });
                // }
            // }
        ]]></script>
        <!--         <a:dataSets>
            <a:dataSet id="apply_channel_ds" lookupCode="AGENT_GROUP"/>
            <a:dataSet id="car_type_ds" lookupCode="CAR_TYPE"/>
            <a:dataSet id="lease_method_ds" lookupCode="LEASE_TYPE"/>
            <a:dataSet id="customer_type_ds" lookupCode="CUSTOMER_TYPE"/>
            <a:dataSet id="hls051_plan_to_grant_ds" autoPageSize="true" autoQuery="true" model="hls.HLS051.hls051_product_plan_to_grant" queryUrl="${/request/@context_path}/autocrud/hls.HLS051.hls051_product_plan_to_grant/query?product_plan_id=${/parameter/@product_plan_id}" selectable="true">
                <a:fields>
                    <a:field name="apply_channel"/>
                    <a:field name="apply_channel_desc" displayField="code_value_name" options="apply_channel_ds" returnField="apply_channel" valueField="code_value"/>
                    <a:field name="area"/>
                    <a:field name="car_type"/>
                    <a:field name="product_plan_id" defaultValue="${/parameter/@product_plan_id}"/>
                    <a:field name="car_type_desc" displayField="code_value_name" options="car_type_ds" returnField="car_type" valueField="code_value"/>
                    <a:field name="lease_method"/>
                    <a:field name="lease_method_desc" displayField="code_value_name" options="lease_method_ds" returnField="lease_method" valueField="code_value"/>
                    <a:field name="customer_type"/>
                    <a:field name="customer_type_desc" displayField="code_value_name" options="customer_type_ds" returnField="customer_type" valueField="code_value"/>
                    <a:field name="brand_id"/>

                    <a:field name="grant_brand"/>
                    <a:field name="province_id"/>
                    <a:field name="province_name" lovGridHeight="320" lovHeight="460" lovLabelWidth="120" lovService="hls.HLS051.hls051_fnd_province" lovWidth="500">
                        <a:mapping>
                            <a:map from="description" to="province_name"/>
                            <a:map from="province_id" to="province_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="city_id"/>
                    <a:field name="city_name" lovGridHeight="320" lovHeight="460" lovLabelWidth="120" lovWidth="500">
                        <a:mapping>
                            <a:map from="description" to="city_name"/>
                            <a:map from="city_id" to="city_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id"/>
                    <a:field name="grant_company" lovGridHeight="320" lovHeight="460" lovLabelWidth="120" lovService="hls.HLS051.hls051_grant_company" lovWidth="500">
                        <a:mapping>
                            <a:map from="description" to="grant_company"/>
                            <a:map from="bp_id" to="bp_id"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
                <a:events>

                    <a:event name="add" handler="grant_add"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls051_grant_close" text="退出"/>
                <a:gridButton click="hls051_grant_copy" text="复制"/>
            </a:screenTopToolbar>
            <a:grid id="hls051_plan_to_grant_grid" bindTarget="hls051_plan_to_grant_ds" marginHeight="180" marginWidth="15" navBar="true">
                <a:toolBar>
                    <a:button type="add"/>
                    <a:button type="save"/>
                    <a:button type="delete"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="car_type_desc" align="center" autoAdjust="true" editor="editor_grant_comb" prompt="车辆类型"/>
                    <a:column name="apply_channel_desc" align="center" autoAdjust="true" editor="editor_grant_comb" prompt="申请渠道"/>
                    <a:column name="lease_method_desc" align="center" autoAdjust="true" editor="editor_grant_comb" prompt="租赁方式"/>
                    <a:column name="customer_type_desc" align="center" autoAdjust="true" editor="editor_grant_comb" prompt="客户类型"/>
                    <a:column name="grant_brand" align="center" autoAdjust="true" prompt="授权品牌" renderer="to_grand_brand"/>

                    <a:column name="area" align="center" autoAdjust="true" prompt="授权区域" renderer="to_grant_area"/>
                    <a:column name="grant_company" align="center" autoAdjust="true" editor="editor_lov" prompt="授权公司"/>
                    <a:column name="start_date" align="center" autoAdjust="true" editor="date_dp" prompt="开始时间" renderer="Leaf.formatDate"/>
                    <a:column name="end_date" align="center" autoAdjust="true" editor="date_dp" prompt="结束时间" renderer="Leaf.formatDate"/>
                </a:columns>
                <a:editors>
                    <a:comboBox id="editor_grant_comb"/>
                    <a:lov id="province_lov"/>
                    <a:lov id="city_lov"/>
                    <a:lov id="editor_lov"/>
                    <a:datePicker id="date_dp"/>
                </a:editors>

            </a:grid>
        </a:screenBody> -->
    </a:view>
</a:screen>