hls_bp_master_billing.lview 11.4 KB
Newer Older
1 2 3 4 5
<?xml version="1.0" encoding="UTF-8"?>

<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true">
    <a:init-procedure/>
    <a:view>
liyuan.chen's avatar
liyuan.chen committed
6 7 8 9
        <a:link id="hls214N_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="hls214N_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/input_validator.js" type="text/javascript"/>
        <a:link id="hls214_bp_master_req_submit_link_id" model="hls.HLS214N.hls_bp_master_req_submit" modelaction="execute"/>
10
        <script><![CDATA[
11
        // 加载事件(form)
liyuan.chen's avatar
liyuan.chen committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
            if (record.get('invoice_method')) {
                var value = record.get('invoice_method');
                if (record.get('bp_class') == 'ORG') {
                    if (value == 'BILLING') {
                        record.getField('taxpayer_type').setRequired(true);
                        record.getField('taxpayer_type_n').setRequired(true);
                        record.getField('tax_registry_num').setRequired(true);
                        record.getField('invoice_title').setRequired(true);
                        record.getField('invoice_bp_address').setRequired(true);
                        record.getField('invoice_bp_phone_num').setRequired(true);
                        record.getField('invoice_bp_bank').setRequired(true);
                        record.getField('invoice_bp_bank_account').setRequired(true);
                    }
                    if (value == 'NO_BILLING') {
                        record.getField('taxpayer_type').setRequired(false);
                        record.getField('taxpayer_type_n').setRequired(false);
                        record.getField('tax_registry_num').setRequired(false);
                        record.getField('invoice_title').setRequired(false);
                        record.getField('invoice_bp_address').setRequired(false);
                        record.getField('invoice_bp_phone_num').setRequired(false);
                        record.getField('invoice_bp_bank').setRequired(false);
                        record.getField('invoice_bp_bank_account').setRequired(false);
                    }
36 37 38 39
                }
            }
        };
        // 更新事件
liyuan.chen's avatar
liyuan.chen committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
            if (name == 'invoice_title') {
                if (value != record.get('bp_name')) {
                    setTimeout(function () {
                        record.set('invoice_title', record.get('bp_name'));
                    }, 20);
                }
            }
            if (name == 'tax_registry_num') {
                if (value != record.get('social_code')) {
                    setTimeout(function () {
                        record.set('tax_registry_num', record.get('social_code'));
                    }, 20);
                }
            }
55
            /*if (name == 'invoice_bp_phone_num' && value) {
liyuan.chen's avatar
liyuan.chen committed
56 57 58 59 60 61 62
                if (!checkMobile(value)) {
                    Leaf.showMessage('提示', '基本信息中,请输入正确格式的手机号码!');
                    setTimeout(function () {
                        record.set('invoice_bp_phone_num', '');
                    }, 20);
                    return false;
                }
63
            }*/
liyuan.chen's avatar
liyuan.chen committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
            if (name == 'invoice_method' && value) {
                if (record.get('bp_class') == 'ORG') {
                    if (value == 'BILLING') {
                        record.getField('taxpayer_type').setRequired(true);
                        record.getField('taxpayer_type_n').setRequired(true);
                        record.getField('tax_registry_num').setRequired(true);
                        record.getField('invoice_title').setRequired(true);
                        record.getField('invoice_bp_address').setRequired(true);
                        record.getField('invoice_bp_phone_num').setRequired(true);
                        record.getField('invoice_bp_bank').setRequired(true);
                        record.getField('invoice_bp_bank_account').setRequired(true);
                    }
                    if (value == 'NO_BILLING') {
                        record.getField('taxpayer_type').setRequired(false);
                        record.getField('taxpayer_type_n').setRequired(false);
                        record.getField('tax_registry_num').setRequired(false);
                        record.getField('invoice_title').setRequired(false);
                        record.getField('invoice_bp_address').setRequired(false);
                        record.getField('invoice_bp_phone_num').setRequired(false);
                        record.getField('invoice_bp_bank').setRequired(false);
                        record.getField('invoice_bp_bank_account').setRequired(false);
                    }
86 87 88
                }
            }
        };
89

liyuan.chen's avatar
liyuan.chen committed
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
        function upload_file(id, name, query_only) {
            var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
            if (record.get('check_id')) {
                var url;
                if (query_only == 'Y') {
                    url = $('hls214N_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                } else {
                    url = $('hls214N_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                }

                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'prj500_cdd_uploadFile_screen_id',
                    width: 850,
                    height: 400
                });

                win.on('close', function () {
                    record.ds.query();
                });
            } else {
                Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');

            }
        }
116

liyuan.chen's avatar
liyuan.chen committed
117 118
        //超链接渲染
        window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
119

liyuan.chen's avatar
liyuan.chen committed
120 121 122
            window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
            if (name == 'attachment') {
                link_function = 'upload_file';
123 124 125 126 127 128 129 130 131 132 133 134
                if('${/parameter/@query_only}' == 'Y'){
                    if (record.get('attach_count') == 0 || !record.get('attach_count')) {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + '${/parameter/@query_only}' + '\');">' + '附件下载' + '</a>';
                    } else {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + '${/parameter/@query_only}' + '\');">' + '附件下载' + '(' + record.get('attach_count') + ')' + '</a>';
                    }
                }else{
                    if (record.get('attach_count') == 0 || !record.get('attach_count')) {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                    } else {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '(' + record.get('attach_count') + ')' + '</a>';
                    }
liyuan.chen's avatar
liyuan.chen committed
135
                }
136

liyuan.chen's avatar
liyuan.chen committed
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
            } else if (name == 'attach_file_name') {
                if (value != null) {
                    var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
                    var str = value.split(';;');
                    var url = '';
                    for (var i = 0; i < str.length; i++) {
                        var temp = str[i].split('--');
                        if (!Leaf.isEmpty(temp[0])) {
                            var file_name = temp[0].toUpperCase();
                            var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
                            if (file_name.indexOf('.PDF') >= 0) {
                                url = url + '<a href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>' + ',';
                            } else if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
                                url = url + '<a href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ',';
                            } else {
                                url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                            }
                        }
                    }
                    return url;

                }
            } else if (name == 'description') {
                if (record.get('important_flag') == 'Y') {
                    return '<font color="RED">' + value + '</font>';
                }
                return value;
            }
        };
        // 提交审批
        window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_req');
            var record = $(ds_id).getAt(0);
            if(record.dirty){
                Leaf.showMessage('提示','请先保存!');
                return;
            }
            if ($(ds_id).validate()) {
                var record = $(ds_id).getAt(0);
                Leaf.showConfirm('${l:HLS.PROMPT}', '确定提交审批吗?', function() {
                    window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
                    Leaf.request({
                        url: $('hls214_bp_master_req_submit_link_id').getUrl(),
                        para: {
                            change_req_id: record.get('change_req_id')
                        },
                        success: function(res) {
                            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            $('${/parameter/@winid}').close();
                        },
                        failure: function() {
                            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
                        error: function() {
                            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
                        scope: this
                    });
                });
            }
        };

        /*Leaf.onReady(function () {
            var billing_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');
201
            // console.log($(billing_ds));
liyuan.chen's avatar
liyuan.chen committed
202
            $(billing_ds).setQueryParameter("change_req_id", "${/parameter/@change_req_id}");
203
            $(billing_ds).query();
liyuan.chen's avatar
liyuan.chen committed
204
        });*/
205 206 207 208
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>