ccb_ebank_withhold_manager.lview 16 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 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Eugene Song $
    $Date: 2018年11月2日10:19:17 $
    $Revision: 1.1 $
    $Purpose: 网银代扣管理
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query autoCount="false" fetchAll="true" model="ccb.CCB600.hls_ebank_bank" rootPath="bank_name"/>
    </a:init-procedure>
    <a:view>
        <!--      <a:link id="create_ebank_link" url="${/request/@context_path}/modules/ccb/CCB600/ccb_ebank_create.lview"/>
              <a:link id="query_ebank_link" url="${/request/@context_path}/modules/ccb/CCB600/ccb_ebank_query.lview"/>
              <a:link id="delete_ebank_link" model="ccb.CCB600.hls_ebank_batch" modelaction="delete"/>
              <a:link id="create_abc_ebank_link" model="ccb.CCB600.hls_ebank_batch_hd" modelaction="execute"/>
              <a:link id="query_abc_ebank_link" model="ccb.CCB600.hls_ebank_batch_hd" modelaction="update"/>-->


        <a:link id="create_withhold_ebank_link" model="ccb.CCB600.hls_ebank_withhold_batch" modelaction="execute"/>
        <a:link id="delete_withhold_ebank_link" model="ccb.CCB600.hls_ebank_withhold_batch" modelaction="delete"/>
        <a:link id="create_withhold_link" url="${/request/@context_path}/modules/ccb/CCB600/ccb_ebank_withhold_detail.lview"/>
        <a:link id="query_withhold_link" url="${/request/@context_path}/modules/ccb/CCB600/ccb_ebank_withhold_query.lview"/>
        <a:link id="create_manual_abc_ebank_link" model="ccb.CCB600.hls_ebank_withhold_update" modelaction="execute"/>
        <a:link id="query_manual_abc_ebank_link" model="ccb.CCB600.hls_ebank_withhold_update" modelaction="update"/>
        <script><![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 add_withhold() {
            $('hls_ccb_withhold_result_ds').create(0);
        }

        function save_withhold() {
            var ds = $('hls_ccb_withhold_result_ds');
            var record = ds.getCurrentRecord();

            Leaf.request({
                url: $('create_withhold_ebank_link').getUrl(),
                para: {
                    bank_account_id: record.get('bank_account_id')
                },
                success: function (res) {
                    Leaf.SideBar.show({
                        msg: '操作成功',
                        duration: 2000
                    });
                    Leaf.Masker.unmask(Ext.getBody()); //解锁
                    $('hls_ccb_withhold_result_ds').query();

                },
                failure: function () {
                },
                error: function () {
                },
                scope: this
            });
        }


        function delete_withhold() {
            var ds = $('hls_ccb_withhold_result_ds');
            var records = ds.getSelected();
            if (records.length == 0) {
                Leaf.showMessage('${l:HLS.PROMPT}', '至少有一条数据');
                return;
            } else {
                var status = records[0].get('status');
                var batch_id = records[0].get('batch_id');
                if (status != 'NEW' && status != 'POST_FAIL') {
                    Leaf.showMessage('${l:HLS.PROMPT}', '只有新建或推送失败的数据才能删除!');
                    return;
                } else {
                    Leaf.Masker.mask(Ext.getBody(), '删除中...'); //锁屏
                    Leaf.request({
                        url: $('delete_withhold_ebank_link').getUrl(),
                        para: {
                            batch_id: batch_id
                        },
                        success: function (res) {

                            Leaf.SideBar.show({
                                msg: '操作成功',
                                duration: 2000
                            });
                            Leaf.Masker.unmask(Ext.getBody()); //解锁
                            $('hls_ccb_withhold_result_ds').query();

                        },
                        failure: function () {
                        },
                        error: function () {
                        },
                        scope: this
                    });
                }
            }

        }


        function post_withhold() {
            var ds = $('hls_ccb_withhold_result_ds');
            var records = ds.getSelected();
            if (records.length == 0) {
                Leaf.showMessage('${l:HLS.PROMPT}', '至少有一条数据');
                return;
            } else {
                var status = records[0].get('status');
                var batch_id = records[0].get('batch_id');
                var bank_code = records[0].get('bank_code');
                if (status != 'NEW' && status != 'POST_FAIL') {
                    Leaf.showMessage('${l:HLS.PROMPT}', '只有新建或推送失败的数据才能发送!');
                    return;
                } else {
                    Leaf.Masker.mask(Ext.getBody(), '发送代扣指令...'); //锁屏
                    if (bank_code == '008') {
                        Leaf.request({
                            url: $('create_manual_abc_ebank_link').getUrl(),
                            para: {
                                batch_id: batch_id
                            },
                            success: function (res) {
                                Leaf.SideBar.show({
                                    msg: '操作成功',
                                    duration: 2000
                                });
                                Leaf.Masker.unmask(Ext.getBody()); //解锁
                                $('hls_ccb_withhold_result_ds').query();

                            },
                            failure: function () {
                            },
                            error: function () {
                            },
                            scope: this
                        });
                    } else if (bank_code == '002') {
                        $jq.ajax({
                            url: '${/request/@context_path}/icbc/interface/record/withhold/submitorder',
                            contentType: 'application/x-www-form-urlencoded;charset=utf8',
                            type: 'post',
                            data: {
                                batchId: batch_id
                            },
                            success: function (datas) {
                                if (datas.success) {
                                    Leaf.SideBar.show({
                                        msg: '操作成功',
                                        duration: 2000
                                    });
                                    Leaf.Masker.unmask(Ext.getBody()); //解锁
                                    $('hls_ccb_withhold_result_ds').query();
                                } else {
                                    Leaf.Masker.unmask(Ext.getBody()); //解锁
                                    Leaf.showErrorMessage('提示', datas.message);
                                }
                            }
                        })
                    }
                }
            }

        }

        function write_off_withhold() {
            var record = $('hls_ccb_withhold_result_ds').getCurrentRecord();
            var batch_id = record.get("batch_id");
            var bank_code = record.get("bank_code");
            var status_desc = record.get("status_desc");
            if(status_desc == '新建'){
            alert('新建状态无法回传!');
            $('hls_ccb_withhold_result_ds').query();
            }
            else{
            Leaf.Masker.mask(Ext.getBody(), '核销代扣信息中...'); //锁屏
            if (bank_code == '008') {
                Leaf.request({
                    url: $('query_manual_abc_ebank_link').getUrl(),
                    para: {
                        batch_id: batch_id
                    },
                    success: function (res) {
                        Leaf.SideBar.show({
                            msg: '查询成功',
                            duration: 2000
                        });
                        Leaf.Masker.unmask(Ext.getBody()); //解锁
                        $('hls_ccb_withhold_result_ds').query();
                    },
                    failure: function () {
                    },
                    error: function () {
                    },
                    scope: this
                });

            } else if (bank_code == '002') {
                $jq.ajax({
                    url: '${/request/@context_path}/icbc/interface/record/withhold/queryorder',
                    data: {
                        batchId: batch_id
                    },
                    type: 'post',
                    contentType: 'application/x-www-form-urlencoded;charset=utf8',
                    success: function (datas) {
                        if (datas.success) {
                            Leaf.SideBar.show({
                                msg: '工行查询成功',
                                duration: 2000
                            });
                        } else {
                            Leaf.showErrorMessage('提示', datas.message);
                        }

                        Leaf.Masker.unmask(Ext.getBody()); //解锁
                        $('hls_ccb_withhold_result_ds').query();

                    }
                });
            }
            }


        }

        function detail_withhold_renderer(value, record, name) {
            var status = record.get('status');
            if (status === 'NEW') {
                return '<a href="javascript:open_detail_withhold_window(' + record.get('batch_id') + ',\'' + status + '\')">' + '${l:PROMPT.DETAIL}' + '</a>';
            } else {
                return '<a href="javascript:open_query_withhold_window(' + record.get('batch_id') + ',\'' + status + '\')">' + '${l:PROMPT.DETAIL}' + '</a>';
            }


        }

        function open_detail_withhold_window(batch_id, status) {
            var win = new Leaf.Window({
                id: 'create_withhold_link_winId',
                url: $('create_withhold_link').getUrl(),
                params: {
                    batch_id: batch_id,
                    status: status,
                    winid: 'create_withhold_link_winId'

                },
                title: '手工代扣清单创建',
                draggable: true,
                width: 900,
                height: 680
            });
        }

        function open_query_withhold_window(batch_id, status) {
            var win = new Leaf.Window({
                id: 'query_withhold_link_winId',
                url: $('query_withhold_link').getUrl(),
                params: {
                    batch_id: batch_id,
                    status: status,
                    winid: 'query_withhold_link_winId'

                },
                title: '手工代扣清单查询',
                draggable: true,
                width: 900,
                height: 680
            });
        }

        function query_withhold() {
            $('hls_ccb_withhold_result_ds').query();
        }


        function editorFunction(record, name) {
            if (record.isNew) {
                if (name == 'bank_account_num') {
                    return 'grid_lov';
                }
            }
            return '';
        }

        ]]></script>
        <a:dataSets>

            <a:dataSet id="hls_ccb_withhlod_query_ds">
                <a:fields>
                    <a:field name="bank_name" displayField="code_value_name" options="bank_name_combobox_ds"
                             returnField="bank_code" valueField="code_value"/>

                    <a:field name="status_desc" displayField="code_value_name" options="ebank_status_combobox_ds"
                             returnField="status" valueField="code_value"/>
                </a:fields>
            </a:dataSet>

            <a:dataSet id="hls_ccb_withhold_result_ds" autoCount="true" autoQuery="true" fetchAll="false"
                       model="ccb.CCB600.hls_ebank_batch" pageSize="15" queryDataSet="hls_ccb_withhlod_query_ds"
                       queryUrl="${/request/@context_path}/autocrud/ccb.CCB600.hls_ebank_withhold_batch/query"
                       selectable="true" selectionModel="single">
                <a:fields>
                    <a:field name="bank_account_num" autoComplete="true" lovGridHeight="350" lovHeight="550"
                             lovService="ccb.CCB600.hls_ebank_bank" lovWidth="1000" required="true"
                             title="银行账户" prompt="银行账户">
                        <a:mapping>
                            <a:map from="bank_account_name" to="bank_account_name"/>
                            <a:map from="bank_account_num" to="bank_account_num"/>
                            <a:map from="bank_short_name" to="bank_name"/>
                            <a:map from="bank_account_id" to="bank_account_id"/>
                            <a:map from="bank_branch_name" to="bank_branch_name"/>
                            <a:map from="currency_code" to="currency"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar height="29">
                <a:screenTitle/>
                <a:gridButton click="query_withhold" text="查询"/>
                <a:gridButton click="add_withhold" text="新增"/>
                <a:gridButton click="save_withhold" text="保存"/>
                <a:gridButton click="delete_withhold" text="删除"/>
                <a:gridButton click="post_withhold" text="发送代扣指令"/>
                <a:gridButton click="write_off_withhold" text="刷新代扣信息"/>
            </a:screenTopToolbar>
            <a:form column="3">
                <a:comboBox name="bank_name" bindTarget="hls_ccb_withhlod_query_ds" prompt="银行名称"/>
                <a:comboBox name="status_desc" bindTarget="hls_ccb_withhlod_query_ds" prompt="状态"/>
                <a:datePicker name="batch_date" bindTarget="hls_ccb_withhlod_query_ds" prompt="创建日期"/>
            </a:form>
            <a:grid id="hls_ccb_withhold_grid" bindTarget="hls_ccb_withhold_result_ds" height="490" width="1400"
                    navBar="true">
                <a:columns>
                    <a:column name="batch_id" align="left" prompt="序号" width="100"/>
                    <a:column name="batch_date" align="center" prompt="创建日期" renderer="Leaf.formatDate" width="150"/>
                    <a:column name="bank_name" align="left" prompt="银行" width="150"/>
                    <a:column name="bank_branch_name" align="left" prompt="支行" width="200"/>
                    <a:column name="bank_account_num" align="left" prompt="账户" editorFunction="editorFunction"
                              width="200"/>
                    <a:column name="status_desc" align="center" prompt="状态" width="100"/>
                    <a:column name="detail" align="center" prompt="明细" renderer="detail_withhold_renderer" width="100"/>
                    <a:column name="created_by_n" align="center" prompt="制单人" width="150"/>
                    <a:column name="total_real_amount" align="right" prompt="实扣总金额" renderer="Leaf.formatMoney"
                              width="100"/>
                    <a:column name="total_success_count" align="right" prompt="扣款成功合同" width="100"/>
                    <a:column name="message" align="right" prompt="错误消息" width="150"/>
                </a:columns>
                <a:editors>
                    <a:comboBox id="grid_cb"/>
                    <a:lov id="grid_lov"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>