con350_insurance_import.lview 9.7 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhuxianfei
    $Date: 2018-07-17 下午2:20:47
    $Revision: 1.0
    $Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query model="cont.CON350.con_insurance_import_batch_id" rootPath="batch_id"/>
        <a:model-delete model="cont.CON350.con350_update_interface"/>
    </a:init-procedure>
    <a:view>
14
        <a:link id="license_attachment_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
Spencer Chang's avatar
Spencer Chang committed
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
        <a:link id="import_upload_link"
                url="${/request/@context_path}/modules/cont/CON350/con_insurance_import_upload.lview"/>
        <a:link id="con350_import_check_link" model="cont.CON350.check_data" modelaction="update"/>
        <a:link id="import_save_link" model="cont.CON350.contract_insurance_temp" modelaction="update"/>
        <a:link id="con_contract_return_link"
                url="${/request/@context_path}/modules/cont/CON350/con350_insurance_entrance.lview"/>
        <script type="text/javascript"><![CDATA[
        var flag;
        var check_flag = 'N';
        //导入数据

        function loadData() {
            new Leaf.Window({
                id: 'upload_window',
                url: $('import_upload_link').getUrl() + '?batch_id=${/model/batch_id/record/@batch_id}',
                title: '导入实例',
                width: 420,
                height: 300
            });
        }

        //校验数据

        function checkData() {
            var allData = $('con_contract_insurance_ds').getAll();
            if (allData.length == 0) {
                Leaf.showMessage('${l:PROMPT}', '请导入数据!');
            } else {
                var param = {};
                param['batch_id'] = '${/model/batch_id/record/@batch_id}';
                Leaf.request({
                    url: $('con350_import_check_link').getUrl(),
                    para: param,
                    success: function (res) {
                        check_flag = 'Y';
                        flag = res.result.return_id;
                        if (res.result.return_id == 0) {
                            Leaf.showMessage('${l:PROMPT}', '数据有错误,请核对!');
                            $('con_contract_insurance_ds').query();
                        } else {
                            Leaf.SideBar.show({
                                msg: '核对操作成功!',
                                duration: 2000
                            });
                            $('con_contract_insurance_ds').query();
                        }
                    },
                    scope: this
                });
            }
        }
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
        function receipt_attachment_upload(val,rec,name){
           /* if(!rec.get('contract_id')){
                $L.showErrorMessage("提示",'请先保存数据!');
                return;
            }*/
           if (!rec.get('contract_id')){
               $L.showErrorMessage("提示","请先保存数据后再上传附件!")
               return;
           }
            return '<a href=javascript:open_upload_window('+rec.get('contract_id')+')>附件</a>';
        }
        function open_upload_window(record_id){
            var url = $('license_attachment_uploadFile_id').getUrl() + '?table_name=CONTRACT_INSURANCE&header_id=' + record_id;
            var win = new Leaf.Window({
                url: url,
                title: '${l:HLS.SUPPORTING_DOCUMENT}',
                id: 'license_uploadFile_id',
                width: 850,
                height: 400
            });
            win.on('close', function() {
            });
        }
        //保存数据
        function submitData(){
            Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            var ds=$('con_contract_insurance_ds');
            if( !ds.validate() ){
                Leaf.Masker.unmask(Ext.getBody(), '${l:HLS.EXECUTING}');
                return;
            }
            ds.submit();
            Leaf.Masker.unmask(Ext.getBody(), '${l:HLS.EXECUTING}');

Spencer Chang's avatar
Spencer Chang committed
100

101 102 103 104 105 106 107 108 109 110 111
        }

        function submit_success_handle( ds, response){
            $('${/parameter/@winId}').close();
            $('${/parameter/@con_ds_id}').query();
        }

        //数据添加事件
        function add_record_handle(dataSet,record,index){
            record.set('attachment','附件');
        }
Spencer Chang's avatar
Spencer Chang committed
112 113
        //提交数据

114
       /* function submitData() {
Spencer Chang's avatar
Spencer Chang committed
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
            //
            if (check_flag == 'N') {
                Leaf.showMessage('${l:PROMPT}', '请先核对通过再提交,谢谢!');
                return;
            } else {
                if (flag == 0) {
                    Leaf.showMessage('${l:PROMPT}', '导入的数据有错误,请重新导入,谢谢!');
                    return;
                } else {
                    $('submitData_btn_id').disable(); //让按钮失效
                    var param = {};
                    param['batch_id'] = '${/model/batch_id/record/@batch_id}';
                    Leaf.request({
                        url: $('import_save_link').getUrl(),
                        para: param,
                        success: function () {
                            Leaf.SideBar.show({
                                msg: '提交操作成功!',
                                duration: 2000
                            });
                            quit();
                        },
                        scope: this
                    });
                }
            }
141
        }*/
Spencer Chang's avatar
Spencer Chang committed
142 143

        function quit() {
144 145 146
          //  window.location.href = $('con_contract_return_link').getUrl() + '?layout_code=CONTRACT_INSURANCE&function_code=CON350';
            $('${/parameter/@winId}').close();
            $('${/parameter/@con_ds_id}').query();
Spencer Chang's avatar
Spencer Chang committed
147 148 149 150
        }

        ]]></script>
        <a:dataSets>
151 152 153
            <a:dataSet id="con_contract_insurance_ds" autoQuery="true" model="cont.CON350.contract_insurance_temp" selectable="true"
                       queryUrl="${/request/@context_path}/autocrud/cont.CON350.contract_insurance_temp/query?batch_id=${/model/batch_id/record/@batch_id}">
             <a:fields>
stone's avatar
stone committed
154
                 <a:field name="contract_number" required="true" lovGridHeight="350" lovHeight="550" lovService="cont.CON350.con_contract_for_lov" lovWidth="550" title="合同">
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
                    <a:mapping>
                           <a:map from="contract_number" to="contract_number"/>
                           <a:map from="contract_id" to="contract_id"/>
                     </a:mapping>
                 </a:field>
                 <a:field name="contract_id" required="true"/>
                 <a:field name="insurance_number" required="true"/>
                 <a:field name="real_insurance_date" required="true"/>
                 <a:field name="insurance_end_date" required="true"/>
                 <a:field name="ins_company" required="true"/>
                 <a:field name="insurance_fee" required="true"/>
                 <a:field name="insurance_rate" required="true"/>
             <!--    <a:field name="attachment_file"/>-->

             </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="submit_success_handle"/>
                <!--    <a:event name="add" handler="add_record_handle"/>-->
                </a:events>
            </a:dataSet>

Spencer Chang's avatar
Spencer Chang committed
176 177 178 179 180
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:toolbarButton click="quit" text="HLS.EXIT"/>
stone's avatar
stone committed
181 182
<!--                <a:toolbarButton click="loadData" text="PROMPT.LOADDATA" width="80"/>-->
<!--                <a:toolbarButton click="checkData" text="PROMPT.CHECK"/>-->
183
                <a:toolbarButton id="submitData_btn_id" click="submitData" text="保存" width="80"/>
Spencer Chang's avatar
Spencer Chang committed
184 185
            </a:screenTopToolbar>
            <a:grid bindTarget="con_contract_insurance_ds" marginHeight="200" marginWidth="30" navBar="true">
stone's avatar
stone committed
186 187 188 189
                <a:toolBar>
                    <a:button type="add"/>
                    <a:button type="delete"/>
                </a:toolBar>
Spencer Chang's avatar
Spencer Chang committed
190
                <a:columns>
191 192
                    <a:column name="contract_number" prompt="合同编号" width="120" editor="edit_lov"/>
                    <a:column name="insurance_number" prompt="保单号" width="120" editor="edit_text"/>
Spencer Chang's avatar
Spencer Chang committed
193 194 195
                    <!--<a:column name="pattern" prompt="机型" width="120"/>-->
                   <!-- <a:column name="model_number" prompt="机号" width="120"/>
                    <a:column name="engine_number" prompt="发动机号" width="120"/>-->
196 197 198
                    <a:column name="real_insurance_date" renderer="Leaf.formatDate" prompt="保险起始日" width="120" editor="edit_date"/>
                    <a:column name="insurance_end_date" renderer="Leaf.formatDate" prompt="保单到期日" width="120" editor="edit_date"/>
                    <a:column name="insurance_fee"  prompt="保险费" width="120" editor="edit_number" renderer="Leaf.formatMoney" align="right"/>
stone's avatar
stone committed
199
                    <a:column name="insurance_rate"  prompt="保险费率(%)" width="120" editor="edit_number" align="center"/>
200 201
                    <a:column name="ins_company"  prompt="保险公司" width="120" editor="edit_text"/>
<!--                    <a:column name="attachment_file"  prompt="附件" width="120" renderer="receipt_attachment_upload" align="center"/>-->
stone's avatar
stone committed
202
<!--                    <a:column name="err_message" prompt="错误信息" width="230"/>-->
Spencer Chang's avatar
Spencer Chang committed
203
                </a:columns>
204 205 206 207 208 209
                <a:editors>
                    <a:textField id="edit_text"/>
                    <a:lov id="edit_lov"/>
                    <a:numberField id="edit_number"/>
                    <a:datePicker id="edit_date"/>
                </a:editors>
Spencer Chang's avatar
Spencer Chang committed
210 211 212 213
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>