con_collection_call_phone.lview 11.8 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Think  
    $Date: 2016-8-22 下午4:49:25  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:c="leaf.application.action" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" customizationEnabled="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="cont.CON632.con_collection_phone_query" rootPath="collection_phone_query_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="save_con_collection_cell_hd" model="cont.CON632.con_collection_cell_note" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            function update_payments_date(ds, record, name, value, oldvalue) {
                if (name == 'payments_day') {
                    if (value != oldvalue) {
                        var myDate = new Date();
                        myDate.setDate(myDate.getDate() + value);
                        record.set('payments_date', myDate);
                    }
                }
                if (name == 'overdue_state_type') {
                    if (value == 'PTP') {
                        record.getField('payments_day').setRequired(true);
                        record.getField('payments_day').setReadOnly(false);
                        record.getField('payments_date').setRequired(true);
                        record.getField('payments_date').setReadOnly(false);
                    } else {
                        record.getField('payments_day').setRequired(false);
                        record.getField('payments_day').setReadOnly(true);
                        record.getField('payments_date').setRequired(false);
                        record.getField('payments_date').setReadOnly(true);
                        record.set('payments_day', '');
                        record.set('payments_date', '');
                    }
                }
            }
            
            function save() {
                if ($('con_overdue_ds').validate() && $('con_overdue_ln_ds').validate()) {

                    var record = $('con_overdue_ds').getAt(0);
                    var records = $('con_overdue_ln_ds').getAt(0);
                    Leaf.request({
                        url: $('save_con_collection_cell_hd').getUrl(),
                        para: {
                            contract_id: '${/parameter/@contract_id}',
                            project_id: '${/parameter/@project_id}',
                            bp_id: '${/parameter/@bp_id_tenant}',
                            overdue_state: record.get('overdue_state'),
                            overdue_state_type: record.get('overdue_state_type'),
                            payments_day: record.get('payments_day'),
                            payments_date: record.get('payments_date'),
                            col_id: '${/parameter/@col_id}',
            
                            bp_type_desc: records.get('bp_type_desc'),
                            collection_name: records.get('collection_name'),
                            staff_id: '${/parameter/@staff_id}',
                            cell_phone: '${/parameter/@cell_phone}',
                            call_time: records.get('call_time'),
                            note: records.get('note'),
                            type: records.get('type')
                        },
                        success: function(args) {
                            var ds = $('con_collection_phone_ds').getAll();
                            for (var i = 0;i < ds.length;i++) {
                                var record = ds[i];
                                var query_url = $(record.get('type') + '_con_collection_call_phone_result_ds');
                                query_url.query();
                                $('con_contract_content_window').close();
                            }
                            Leaf.SideBar.show({
                                msg: '${l:HLS.SUBMIT_SUCCESS}',
                                duration: 2000
                            })
                        },
                        failure: function(args) {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        error: function(args) {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        scope: this
                    });
                }
            }
            
            function close() {
                $('con_contract_content_window').close();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="con_collection_phone_ds">
                <a:datas dataSource="/model/collection_phone_query_path"/>
            </a:dataSet>
            <!-- <a:dataSet id="con_over_state_id" loadData="true" model="cont.CON632.con632_over_state">
                <a:fields>
                    <a:field name="value_code"/>
                </a:fields>
            </a:dataSet> -->
            <a:dataSet id="overdue_status_type_ds_id" lookupCode="OVERDUE_STATUS_TYPE"/>
            <a:dataSet id="con_over_base" autoCreate="true">
                <a:fields>
                    <a:field name="contract_number" defaultValue="${/parameter/@contract_number}" readOnly="true"/>
                    <a:field name="project_number" defaultValue="${/parameter/@project_number}" readOnly="true"/>
                    <a:field name="bp_id_tenant_n" defaultValue="${/parameter/@bp_id_tenant_n}" readOnly="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con_overdue_ds" autoQuery="true" model="cont.CON632.con_collection_call_hd" queryUrl="${/request/@context_path}/autocrud/cont.CON632.con_collection_call_hd/query?contract_id=${/parameter/@contract_id}&amp;project_id=${/parameter/@project_id}">
                <a:fields>
                    <a:field name="contract_id"/>
                    <a:field name="project_id"/>
                    <a:field name="bp_id_tenant"/>
                    <a:field name="overdue_state_type_n" readOnly="true"/>
                    <a:field name="overdue_state_type" readOnly="true"/>
                    <a:field name="overdue_state"/>
                    <a:field name="overdue_state_n" lovGridHeight="400" lovHeight="550" lovService="cont.CON632.con632_over_state" lovWidth="500" required="true">
                        <a:mapping>
                            <a:map from="status_id" to="overdue_state"/>
                            <a:map from="status_name" to="overdue_state_n"/>
                            <a:map from="overdue_status_type" to="overdue_state_type"/>
                            <a:map from="overdue_status_type_n" to="overdue_state_type_n"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="payments_day"/>
                    <a:field name="payments_date"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="update_payments_date"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="con_overdue_ln_ds" autoCreate="true">
                <a:fields>
                    <a:field name="phone_number"/>
                    <a:field name="call_time" readOnly="true"/>
                    <a:field name="bp_type_desc" defaultValue="${/parameter/@type_desc}" readOnly="true"/>
                    <a:field name="collection_name" defaultValue="${/parameter/@bp_name}" readOnly="true"/>
                    <a:field name="staff_name" defaultValue="${/parameter/@staff_name}" readOnly="true"/>
                    <a:field name="type" defaultValue="${/parameter/@type}" readOnly="true"/>
                    <a:field name="note" required="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con_collection_call_phone_result_ds" autoQuery="true" model="cont.CON632.con_collection_call_ln" selectable="true" selectionModel="single"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="close" text="关闭"/>
                <a:gridButton click="save" text="保存"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="100" marginWidth="30" title="逾期状态">
                <a:textField name="contract_number" bindTarget="con_over_base" prompt="合同编号"/>
                <a:textField name="project_number" bindTarget="con_over_base" prompt="申请编号"/>
                <a:textField name="bp_id_tenant_n" bindTarget="con_over_base" colspan="2" prompt="客户名称" width="520"/>
                <a:lov name="overdue_state_n" bindTarget="con_overdue_ds" prompt="逾期状态"/>
                <a:comboBox name="overdue_state_type_n" bindTarget="con_overdue_ds" prompt="逾期状态类别"/>
                <a:numberField name="payments_day" allowDecimals="false" bindTarget="con_overdue_ds" prompt="承诺还款天数"/>
                <a:datePicker name="payments_date" bindTarget="con_overdue_ds" prompt="承诺还款日期"/>
            </a:form>
            <a:form column="4" labelWidth="100" marginWidth="30" title="电话催收记录">
                <a:textField name="bp_type_desc" bindTarget="con_overdue_ln_ds" prompt="类型"/>
                <a:textField name="collection_name" bindTarget="con_overdue_ln_ds" prompt="姓名"/>
                <a:textField name="staff_name" bindTarget="con_overdue_ln_ds" prompt="电催人员"/>
                <a:dateTimePicker name="call_time" bindTarget="con_overdue_ln_ds" prompt="时间"/>
                <a:textArea name="note" bindTarget="con_overdue_ln_ds" colspan="2" prompt="电催记录" width="520"/>
            </a:form>
            <a:tabPanel marginHeight="200" marginWidth="30">
                <a:tabs>
                    <a:placeHolder id="con_collection_call_id"/>
                </a:tabs>
            </a:tabPanel>
            <!-- <a:grid bindTarget="con_collection_call_phone_result_ds" marginHeight="200" marginWidth="20" navBar="true" title="历史电催记录">
                <a:columns>
                    <a:column name="bp_type_desc" align="center" prompt="类型" width="120"/>
                    <a:column name="collection_name" align="center" prompt="催收对象" width="120"/>
                    <a:column name="cell_phone" align="center" prompt="电话" width="120"/>
                    <a:column name="note" align="center" prompt="电催记录" width="120"/>
                    <a:column name="call_time" align="center" prompt="登记时间" renderer="Leaf.formatDate" width="120"/>
                    <a:column name="staff_name" align="center" prompt="电催人员" width="120"/>
                </a:columns>
            </a:grid> -->
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
            Ext.onReady(function() {
                var myDate = new Date();
                // var records = $('con_overdue_ds').getAt(0);
                var record = $('con_overdue_ln_ds').getAt(0);
                // records.set('payments_date', myDate);
                record.set('call_time', myDate);
            });
        ]]></script>
    </a:view>
    <a:view-config>
        <c:create-config targetId="con_collection_call_id">
            <p:loop source="/model/collection_phone_query_path">
                <p:switch test="@type">
                    <p:case value="*">
                        <c:process-config>
                            <a:tab prompt="${@type_desc}" width="100">
                                <a:screen-include screen="modules/cont/CON632/con_collection_phone_query.lview?type=${@type}&amp;contract_id=${/parameter/@contract_id}"/>
                            </a:tab>
                        </c:process-config>
                    </p:case>
                </p:switch>
            </p:loop>
        </c:create-config>
    </a:view-config>
</a:screen>