<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: lpc 9874
    $Date: 
    $Revision: 1.0 $
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure><![CDATA[     
    ]]></a:init-procedure>
    <a:view>
        <a:link id="acp_invoice_attachment_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:screen-include screen="modules/hls/hls_common_javascript.lview"/>
        <script type="text/javascript"><![CDATA[
            
            
            function prj_exit() {
                $('project_houdu_query_window').close();
            }
            
            function detail_upload_window(check_id, file_name, record_id) {

                var record = $('file_result_ds').getCurrentRecord();
                var oldvalue = file_name ? file_name : null;
                var project_id = ${/parameter/@project_id};
                paras = {
                    'project_id': project_id
                };
                var url = $('acp_invoice_attachment_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + check_id;
                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'insurance_records_uploadFile_id',
                    width: 850,
                    height: 400
                });
                //
                win.on('close', function() {
                   $('file_result_ds').query();
                });
            
            }
            //附件上传
            
            function attachment_upload(value, record, name) {

                var check_id = record.get('check_id');
                var file_name = record.get('file_name');
                var record_id = record.id;
                if (!record.isNew && check_id) {
                    return '<a href="javascript:detail_upload_window(\'' + record.get('check_id') + '\',\'' + file_name + '\',\'' + record_id + '\')">附件上传</a>';
                }
            }
            
            function prj_attachment(value, record, 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_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
                            if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
                                url = url + '<a ref="img" href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                            } else {
                                url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                            }
                        }
                    }
                    return url;
                }
            }
            
        ]]></script>
        <a:dataSet id="doc_require_ds" lookupCode="DOC_REQUIRE"/>
        <a:dataSet id="req_status_ds" lookupCode="REQ_STATUS"/>
        <a:dataSet id="raise_status_ds" lookupCode="RAISE_STATUS"/>
        <a:dataSets>
            <a:dataSet id="file_result_ds" autoQuery="true" fetchAll="false" model="prj.PRJ520.prj520_file_query" pageSize="15" queryUrl="${/request/@context_path}/autocrud/prj.PRJ520.prj520_file_query/query?project_id=${/parameter/@project_id}" selectable="true">
                <a:fields>
                    <a:field name="project_id" defaultValue="${/parameter/@project_id}"/>
                    <a:field name="note" readOnly="true"/>
                    <a:field name="doc_require_n" displayField="code_value_name" options="doc_require_ds" readOnly="true" returnField="doc_require" valueField="code_value"/>
                    <a:field name="doc_require"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="prj_file_result_ds" autoQuery="true" fetchAll="false" model="prj.PRJ520.prj_file_query" pageSize="15" queryUrl="${/request/@context_path}/autocrud/prj.PRJ520.prj_file_query/query?project_id=${/parameter/@project_id}" selectable="true">
                <a:fields>
                    <a:field name="prj_file_info_id"/>
                    <a:field name="project_id" defaultValue="${/parameter/@project_id}"/>
                    <a:field name="condition_req" required="true"/>
                    <a:field name="department_id"/>
                    <a:field name="raise_status_desc" defaultValue="${/parameter/@raise_status_desc}" displayField="code_value_name" options="raise_status_ds" readOnly="true" returnField="raise_status" valueField="code_value"/>
                    <a:field name="raise_status" defaultValue="${/parameter/@raise_status}" readOnly="true"/>
                    <a:field name="req_status_desc" displayField="code_value_name" options="req_status_ds" required="true" returnField="req_status" valueField="code_value"/>
                    <a:field name="req_status"/>
                    <a:field name="department_desc" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="cont.CON303N.exp_org_unit_for_lov" lovWidth="650" required="true" title="部门">
                        <a:mapping>
                            <a:map from="unit_id" to="department_id"/>
                            <a:map from="description" to="department_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="expiration_date" required="true"/>
                    <a:field name="req_description"/>
                    <a:field name="req_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                    <a:field name="req_date"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="prj_exit" text="HLS.EXIT"/>
            </a:screenTopToolbar>
            <a:grid id="file_grid" bindTarget="file_result_ds" marginHeight="180" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="description" prompt="文件名称" width="120"/>
                    <a:column name="attachment" align="center" prompt="附件上传" renderer="attachment_upload" width="85"/>
                    <a:column name="file_name" prompt="附件名称" renderer="prj_attachment" width="120"/>
                    <a:column name="doc_require" prompt="文件要求" width="120"/>
                    <a:column name="note" prompt="备注" width="120"/>
                </a:columns>
                <a:editors>
                    <a:textField id="fileDs_tf"/>
                    <a:comboBox id="doc_type_n_cb_id"/>
                </a:editors>
            </a:grid>
            <a:grid id="prj_file_grid" bindTarget="prj_file_result_ds" marginHeight="180" marginWidth="30" navBar="true">
                <a:toolBar>
                    <a:button type="add"/>
                    <a:button type="delete"/>
                    <a:button type="save"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="condition_req" editor="prjFileDs_tf" prompt="条件要求" width="120"/>
                    <a:column name="department_desc" editor="departmentDs_lov" prompt="部门" width="120"/>
                    <a:column name="raise_status_desc" editor="statusDs_box" prompt="提出时点" width="120"/>
                    <a:column name="req_status_desc" editor="statusDs_box" prompt="要求完成时点" width="120"/>
                    <a:datePicker name="expiration_date" editor="dateDs_picker" prompt="到期时间" renderer="Leaf.formatDate" width="110"/>
                    <a:column name="req_description" editor="prjFileDs_tf" prompt="备注" width="120"/>
                    <a:column name="req_flag" editor="isNo_check" prompt="是否已完成" width="120"/>
                    <a:column name="req_date" editor="dateDs_picker" prompt="完成时间" renderer="Leaf.formatDate" width="120"/>
                </a:columns>
                <a:editors>
                    <a:textField id="prjFileDs_tf"/>
                    <a:lov id="departmentDs_lov"/>
                    <a:datePicker id="dateDs_picker"/>
                    <a:checkBox id="isNo_check"/>
                    <a:comboBox id="statusDs_box"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>