rsc_value_assessment_create.lview 9.82 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: peter soong  
    $Date: 2014-08-27 16:33:57  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:view>
        <a:link id="rsc_value_assessment_save" url="${/request/@context_path}/modules/rsc/RSC504/rsc_value_assessment_save.lsc"/>
        <a:link id="rsc_value_assessment_detail" url="${/request/@context_path}/modules/rsc/RSC505/rsc_value_assessment_detail.lview"/>
        <a:link id="rsc_value_assessment" url="${/request/@context_path}/modules/rsc/RSC504/rsc_value_assessment.lview"/>
        <script type="text/javascript"><![CDATA[
            function submitScreen_quit() {
                $('rsc_value_assessment_submit_id').close();
            }
            
            var assess_hd_id;
            
            function submitScreen_save(value) {
            
                var bp_id_tenant = '${/parameter/@bp_id_tenant}';
                var lns_ds = $('submitDs');
                var lns_reords = lns_ds.getAll();
                var datas = [];
                for (var i = 0;i < lns_reords.length;i++) {
                    var data = lns_reords[i].data;
                    datas.push(data);
                }
                var queryParams = new Object();
                queryParams['details'] = datas;
                queryParams['bp_id_tenant'] = bp_id_tenant;
            
            
                if (lns_reords.length == 0) {
                    Leaf.showWarningMessage('消息', '请先点击新增,再保存。', null, 300, 100);
                } else {
                    if (lns_ds.validate()) {
                        Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
                        Leaf.request({
                            url: $('rsc_value_assessment_save').getUrl(),
                            para: queryParams,
                            success: function(args) {
                                assess_hd_id = args.result.assess_hd_id;
                                if (value == 'sub') {
                                    submitScreen_submit();
                                } else {
                                    Leaf.SideBar.show({
                                        msg: '${l:HLS.SUBMIT_SUCCESS}',
                                        duration: 2000
                                    });
                                    Leaf.Masker.unmask(Ext.getBody());
                                    window.location.href = $('rsc_value_assessment_detail').getUrl() + '?assess_hd_id=' + assess_hd_id + '&bp_id_tenant=' + bp_id_tenant;
                                }
                            },
                            failure: function() {
                                Leaf.Masker.unmask(Ext.getBody());
                            },
                            error: function() {
                                Leaf.Masker.unmask(Ext.getBody());
                            },
                            scope: this
                        });
                    }
                }
            }
            
            function submitScreen_submit() {
                Leaf.showConfirm('${l:HLS.PROMPT}', '${l:HLS.ARE_YOU_SURE_TO_SUBMIT}', function okFun() {
                    Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
                    Leaf.request({
                        url: '${/request/@context_path}/autocrud/rsc.RSC504.rsc_value_assess_submit/execute',
                        para: {
                            assess_hd_id: assess_hd_id,
                            _status: 'execute'
                        },
                        success: function(res) {
                            Leaf.SideBar.show({
                                msg: '${l:HLS.SUBMIT_SUCCESS}',
                                duration: 2000
                            });
                            Leaf.Masker.unmask(Ext.getBody());
                            window.location.href = $('rsc_value_assessment').getUrl() + '?assess_hd_id=' + assess_hd_id + '&bp_id_tenant=' + bp_id_tenant;
                        },
                        failure: function() {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        error: function() {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        scope: this
                    });
                }, Leaf.Masker.unmask(Ext.getBody()));
            }
            
            function submitScreen_save_submit() {
                submitScreen_save('sub');
            
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="asset_type_ds" lookupCode="RSC504_ASSET_TYPE"/>
            <a:dataSet id="asset_way_ds" lookupCode="RSC504_ASSET_WAY"/>
            <a:dataSet id="asset_method_ds" lookupCode="RSC504_ASSET_METHOD"/>
            <a:dataSet id="submitDs" autoPageSize="true" autoQuery="true" model="rsc.RSC504.rsc_value_assess_ln" queryUrl="${/request/@context_path}/autocrud/rsc.RSC504.rsc_value_assess_ln/query?bp_id_tenant=${/parameter/@bp_id_tenant}" selectable="true">
                <a:fields>
                    <a:field name="contract_number" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="rsc.RSC504.rsc_value_contract_lov?bp_id=${/parameter/@bp_id_tenant}" lovWidth="500" required="true" title="合同信息">
                        <a:mapping>
                            <a:map from="contract_id" to="contract_id"/>
                            <a:map from="contract_name" to="contract_name"/>
                            <a:map from="contract_number" to="contract_number"/>
                            <a:map from="contract_num" to="contract_num"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="contract_id"/>
                    <a:field name="contract_name"/>
                    <a:field name="asset_type_desc" displayField="code_value_name" options="asset_type_ds" required="true" returnField="asset_type" valueField="code_value"/>
                    <a:field name="asset_type"/>
                    <a:field name="assess_way_desc" displayField="code_value_name" options="asset_way_ds" required="true" returnField="assess_way" valueField="code_value"/>
                    <a:field name="assess_way"/>
                    <a:field name="assess_method_desc" displayField="code_value_name" options="asset_method_ds" required="true" returnField="assess_method" valueField="code_value"/>
                    <a:field name="assess_method"/>
                    <a:field name="assess_name"/>
                    <a:field name="asset_detail"/>
                    <a:field name="orig_value"/>
                    <a:field name="assess_value" required="true"/>
                    <a:field name="assess_date" required="true"/>
                    <a:field name="last_assess_value"/>
                    <a:field name="last_assess_date"/>
                    <a:field name="operator"/>
                    <a:field name="comments"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton bind="submitDs_grid" type="add"/>
                <a:gridButton bind="submitDs_grid" type="clear"/>
                <!-- <a:gridButton bind="submitDs_grid" type="delete"/> -->
                <a:gridButton click="submitScreen_save" text="HLS.SAVE"/>
                <!-- <a:gridButton click="submitScreen_save_submit" text="HLS.SUBMIT"/> -->
                <a:gridButton bind="submitDs_grid" type="excel"/>
                <a:gridButton click="submitScreen_quit" text="HLS.EXIT"/>
            </a:screenTopToolbar>
            <a:grid id="submitDs_grid" bindTarget="submitDs" marginHeight="250" marginWidth="30" navBar="true">
                <a:columns>
                    <!-- <a:column name="contract_num" prompt="HLS.CONTRACT_NUM" width="120"/> -->
                    <a:column name="contract_number" editor="grid_lov" prompt="HLS.CONTRACT_NUMBER" width="120"/>
                    <a:column name="assess_name" editor="grid_tf" prompt="评估物品名称" width="200"/>
                    <a:column name="asset_type_desc" editor="grid_cb" prompt="资产类型" width="100"/>
                    <a:column name="asset_detail" editor="grid_tf" prompt="资产明细" width="120"/>
                    <a:column name="orig_value" editor="grid_nf" prompt="设备原值" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="assess_value" editor="grid_nf" prompt="本次评估价值" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="assess_date" editor="grid_dp" prompt="本次评估日期" renderer="Leaf.formatDate" width="100"/>
                    <a:column name="last_assess_value" editor="grid_nf" prompt="上次评估价值" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="last_assess_date" editor="grid_dp" prompt="上次评估日期" renderer="Leaf.formatDate" width="100"/>
                    <a:column name="assess_way_desc" editor="grid_cb" prompt="评估方式" width="100"/>
                    <a:column name="assess_method_desc" editor="grid_cb" prompt="评估方法" width="100"/>
                    <a:column name="operator" editor="grid_tf" prompt="评估机构" width="100"/>
                    <a:column name="comments" editor="grid_tf" prompt="备注" width="220"/>
                </a:columns>
                <a:editors>
                    <a:lov id="grid_lov"/>
                    <a:textField id="grid_tf"/>
                    <a:comboBox id="grid_cb"/>
                    <a:datePicker id="grid_dp"/>
                    <a:numberField id="grid_nf"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>